buefy 0.9.21 → 0.9.23
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/README.md +4 -0
- package/dist/buefy.css +76 -24
- package/dist/buefy.esm.js +103 -89
- package/dist/buefy.esm.min.js +2 -2
- package/dist/buefy.js +103 -88
- package/dist/buefy.min.css +1 -1
- package/dist/buefy.min.js +2 -2
- package/dist/cjs/autocomplete.js +2 -2
- package/dist/cjs/{chunk-dddb035c.js → chunk-37e64a78.js} +6 -2
- package/dist/cjs/{chunk-f8eb56c6.js → chunk-4702fda4.js} +1 -1
- package/dist/cjs/{chunk-bcab8905.js → chunk-6e9f64e7.js} +3 -3
- package/dist/cjs/{chunk-eba24a95.js → chunk-8ab08774.js} +5 -5
- package/dist/cjs/{chunk-85b00a19.js → chunk-94bbc46e.js} +4 -4
- package/dist/cjs/{chunk-befea70a.js → chunk-994f8066.js} +22 -8
- package/dist/cjs/{chunk-95c4b826.js → chunk-a39776c7.js} +4 -1
- package/dist/cjs/{chunk-cc9676a6.js → chunk-b7163607.js} +2 -1
- package/dist/cjs/clockpicker.js +3 -3
- package/dist/cjs/colorpicker-a5bbcf7b.js +1774 -0
- package/dist/cjs/colorpicker.js +14 -1750
- package/dist/cjs/datepicker.js +4 -4
- package/dist/cjs/datetimepicker.js +5 -5
- package/dist/cjs/dialog.js +1 -1
- package/dist/cjs/dropdown.js +1 -1
- package/dist/cjs/field.js +1 -1
- package/dist/cjs/index.js +12 -11
- package/dist/cjs/input.js +1 -1
- package/dist/cjs/message.js +1 -1
- package/dist/cjs/modal.js +1 -1
- package/dist/cjs/navbar.js +4 -1
- package/dist/cjs/notification.js +1 -1
- package/dist/cjs/numberinput.js +7 -2
- package/dist/cjs/sidebar.js +6 -44
- package/dist/cjs/steps.js +1 -1
- package/dist/cjs/table.js +5 -5
- package/dist/cjs/tabs.js +1 -1
- package/dist/cjs/taginput.js +7 -3
- package/dist/cjs/timepicker.js +4 -4
- package/dist/components/autocomplete/index.js +26 -9
- package/dist/components/autocomplete/index.min.js +2 -2
- package/dist/components/breadcrumb/index.js +1 -1
- package/dist/components/breadcrumb/index.min.js +1 -1
- package/dist/components/button/index.js +1 -1
- package/dist/components/button/index.min.js +1 -1
- package/dist/components/carousel/index.js +1 -1
- package/dist/components/carousel/index.min.js +1 -1
- package/dist/components/checkbox/index.js +1 -1
- package/dist/components/checkbox/index.min.js +1 -1
- package/dist/components/clockpicker/index.js +12 -5
- package/dist/components/clockpicker/index.min.js +2 -2
- package/dist/components/collapse/index.js +1 -1
- package/dist/components/collapse/index.min.js +1 -1
- package/dist/components/colorpicker/index.js +46 -21
- package/dist/components/colorpicker/index.min.js +2 -2
- package/dist/components/datepicker/index.js +13 -6
- package/dist/components/datepicker/index.min.js +2 -2
- package/dist/components/datetimepicker/index.js +13 -6
- package/dist/components/datetimepicker/index.min.js +2 -2
- package/dist/components/dialog/index.js +3 -2
- package/dist/components/dialog/index.min.js +2 -2
- package/dist/components/dropdown/index.js +7 -3
- package/dist/components/dropdown/index.min.js +2 -2
- package/dist/components/field/index.js +2 -2
- package/dist/components/field/index.min.js +2 -2
- package/dist/components/icon/index.js +1 -1
- package/dist/components/icon/index.min.js +1 -1
- package/dist/components/image/index.js +1 -1
- package/dist/components/image/index.min.js +1 -1
- package/dist/components/input/index.js +5 -2
- package/dist/components/input/index.min.js +2 -2
- package/dist/components/loading/index.js +1 -1
- package/dist/components/loading/index.min.js +1 -1
- package/dist/components/menu/index.js +1 -1
- package/dist/components/menu/index.min.js +1 -1
- package/dist/components/message/index.js +2 -2
- package/dist/components/message/index.min.js +2 -2
- package/dist/components/modal/index.js +3 -2
- package/dist/components/modal/index.min.js +2 -2
- package/dist/components/navbar/index.js +5 -2
- package/dist/components/navbar/index.min.js +2 -2
- package/dist/components/notification/index.js +2 -2
- package/dist/components/notification/index.min.js +2 -2
- package/dist/components/numberinput/index.js +11 -3
- package/dist/components/numberinput/index.min.js +2 -2
- package/dist/components/pagination/index.js +1 -1
- package/dist/components/pagination/index.min.js +1 -1
- package/dist/components/progress/index.js +1 -1
- package/dist/components/progress/index.min.js +1 -1
- package/dist/components/radio/index.js +1 -1
- package/dist/components/radio/index.min.js +1 -1
- package/dist/components/rate/index.js +1 -1
- package/dist/components/rate/index.min.js +1 -1
- package/dist/components/select/index.js +1 -1
- package/dist/components/select/index.min.js +1 -1
- package/dist/components/sidebar/index.js +7 -48
- package/dist/components/sidebar/index.min.js +2 -2
- package/dist/components/skeleton/index.js +1 -1
- package/dist/components/skeleton/index.min.js +1 -1
- package/dist/components/slider/index.js +1 -1
- package/dist/components/slider/index.min.js +1 -1
- package/dist/components/snackbar/index.js +1 -1
- package/dist/components/snackbar/index.min.js +1 -1
- package/dist/components/steps/index.js +6 -6
- package/dist/components/steps/index.min.js +2 -2
- package/dist/components/switch/index.js +1 -1
- package/dist/components/switch/index.min.js +1 -1
- package/dist/components/table/index.js +9 -6
- package/dist/components/table/index.min.js +2 -2
- package/dist/components/tabs/index.js +6 -6
- package/dist/components/tabs/index.min.js +2 -2
- package/dist/components/tag/index.js +1 -1
- package/dist/components/tag/index.min.js +1 -1
- package/dist/components/taginput/index.js +31 -10
- package/dist/components/taginput/index.min.js +2 -2
- package/dist/components/timepicker/index.js +12 -5
- package/dist/components/timepicker/index.min.js +2 -2
- package/dist/components/toast/index.js +1 -1
- package/dist/components/toast/index.min.js +1 -1
- package/dist/components/tooltip/index.js +1 -1
- package/dist/components/tooltip/index.min.js +1 -1
- package/dist/components/upload/index.js +1 -1
- package/dist/components/upload/index.min.js +1 -1
- package/dist/esm/autocomplete.js +6 -6
- package/dist/esm/button.js +4 -4
- package/dist/esm/carousel.js +4 -4
- package/dist/esm/{chunk-293c457c.js → chunk-007b3ff8.js} +7 -7
- package/dist/esm/{chunk-c5284276.js → chunk-048831a9.js} +2 -2
- package/dist/esm/{chunk-493ff0a9.js → chunk-07da0ba7.js} +1 -1
- package/dist/esm/{chunk-ade5b253.js → chunk-0c67e5e7.js} +8 -4
- package/dist/esm/{chunk-9b0b8225.js → chunk-18dce47f.js} +1 -1
- package/dist/esm/{chunk-6e56b8bc.js → chunk-27ec55c7.js} +1 -1
- package/dist/esm/{chunk-7e17a637.js → chunk-4b289821.js} +1 -1
- package/dist/esm/{chunk-d46e7ff0.js → chunk-6a7209ee.js} +2 -2
- package/dist/esm/{chunk-b5576437.js → chunk-6b514c98.js} +2 -2
- package/dist/esm/{chunk-f32d0228.js → chunk-6efa106e.js} +9 -9
- package/dist/esm/{chunk-60a03517.js → chunk-70481141.js} +1 -1
- package/dist/esm/{chunk-455cdeae.js → chunk-851d1b8f.js} +1 -1
- package/dist/esm/{chunk-33e1434e.js → chunk-8e497030.js} +2 -1
- package/dist/esm/{chunk-b0123b89.js → chunk-9bd1f33e.js} +24 -10
- package/dist/esm/{chunk-4e788733.js → chunk-bf29bc31.js} +3 -3
- package/dist/esm/{chunk-7bb9107f.js → chunk-d62aa1f5.js} +2 -2
- package/dist/esm/{chunk-83c8b459.js → chunk-d77d421b.js} +7 -4
- package/dist/esm/{chunk-6c64686f.js → chunk-dc931ea5.js} +8 -8
- package/dist/esm/clockpicker.js +8 -8
- package/dist/esm/colorpicker-91643f19.js +1770 -0
- package/dist/esm/colorpicker.js +13 -1754
- package/dist/esm/config.js +1 -1
- package/dist/esm/datepicker.js +10 -10
- package/dist/esm/datetimepicker.js +11 -11
- package/dist/esm/dialog.js +4 -4
- package/dist/esm/dropdown.js +4 -4
- package/dist/esm/field.js +3 -3
- package/dist/esm/helpers.js +1 -1
- package/dist/esm/icon.js +3 -3
- package/dist/esm/image.js +3 -3
- package/dist/esm/index.js +24 -24
- package/dist/esm/input.js +5 -5
- package/dist/esm/loading.js +3 -3
- package/dist/esm/menu.js +2 -2
- package/dist/esm/message.js +4 -4
- package/dist/esm/modal.js +3 -3
- package/dist/esm/navbar.js +5 -2
- package/dist/esm/notification.js +5 -5
- package/dist/esm/numberinput.js +10 -5
- package/dist/esm/pagination.js +4 -4
- package/dist/esm/progress.js +2 -2
- package/dist/esm/rate.js +2 -2
- package/dist/esm/select.js +5 -5
- package/dist/esm/sidebar.js +8 -46
- package/dist/esm/slider.js +2 -2
- package/dist/esm/snackbar.js +2 -2
- package/dist/esm/steps.js +5 -5
- package/dist/esm/table.js +12 -12
- package/dist/esm/tabs.js +5 -5
- package/dist/esm/taginput.js +10 -6
- package/dist/esm/timepicker.js +11 -11
- package/dist/esm/toast.js +2 -2
- package/dist/esm/tooltip.js +3 -3
- package/dist/esm/upload.js +2 -2
- package/dist/vetur/attributes.json +12 -0
- package/dist/vetur/tags.json +5 -2
- package/package.json +3 -2
- package/src/components/autocomplete/Autocomplete.vue +23 -4
- package/src/components/autocomplete/index.js +1 -1
- package/src/components/breadcrumb/Breadcrumb.vue +0 -2
- package/src/components/breadcrumb/BreadcrumbItem.spec.js +1 -1
- package/src/components/breadcrumb/BreadcrumbItem.vue +0 -3
- package/src/components/breadcrumb/index.js +2 -2
- package/src/components/button/Button.vue +1 -1
- package/src/components/button/index.js +1 -1
- package/src/components/carousel/Carousel.vue +1 -1
- package/src/components/carousel/CarouselList.vue +2 -2
- package/src/components/carousel/index.js +3 -3
- package/src/components/checkbox/Checkbox.vue +1 -1
- package/src/components/checkbox/CheckboxButton.vue +1 -1
- package/src/components/checkbox/index.js +2 -2
- package/src/components/clockpicker/Clockpicker.vue +5 -5
- package/src/components/clockpicker/index.js +1 -1
- package/src/components/collapse/index.js +1 -1
- package/src/components/colorpicker/Colorpicker.vue +50 -31
- package/src/components/colorpicker/ColorpickerAlphaSlider.spec.js +3 -1
- package/src/components/colorpicker/ColorpickerAlphaSlider.vue +1 -1
- package/src/components/colorpicker/index.js +1 -1
- package/src/components/datepicker/Datepicker.spec.js +4 -4
- package/src/components/datepicker/Datepicker.vue +14 -13
- package/src/components/datepicker/DatepickerTable.vue +1 -1
- package/src/components/datepicker/index.js +1 -1
- package/src/components/datetimepicker/Datetimepicker.vue +2 -2
- package/src/components/datetimepicker/index.js +1 -1
- package/src/components/dialog/Dialog.vue +3 -3
- package/src/components/dialog/index.js +1 -1
- package/src/components/dropdown/Dropdown.vue +6 -2
- package/src/components/dropdown/index.js +2 -2
- package/src/components/field/Field.spec.js +11 -2
- package/src/components/field/Field.vue +6 -2
- package/src/components/field/index.js +1 -1
- package/src/components/icon/index.js +1 -1
- package/src/components/image/index.js +1 -1
- package/src/components/input/Input.spec.js +11 -0
- package/src/components/input/Input.vue +5 -2
- package/src/components/input/index.js +1 -1
- package/src/components/loading/index.js +1 -1
- package/src/components/menu/MenuItem.vue +1 -1
- package/src/components/menu/index.js +3 -3
- package/src/components/message/Message.vue +2 -1
- package/src/components/message/index.js +1 -1
- package/src/components/modal/Modal.vue +2 -1
- package/src/components/modal/index.js +1 -1
- package/src/components/navbar/NavBar.spec.js +1 -1
- package/src/components/navbar/{NavbarBurger.spec.js → NavBarBurger.spec.js} +1 -1
- package/src/components/navbar/NavBarItem.spec.js +1 -1
- package/src/components/navbar/NavbarDropdown.spec.js +1 -1
- package/src/components/navbar/NavbarDropdown.vue +10 -1
- package/src/components/navbar/index.js +3 -3
- package/src/components/notification/Notification.vue +3 -2
- package/src/components/notification/NotificationNotice.vue +1 -1
- package/src/components/notification/index.js +2 -2
- package/src/components/numberinput/Numberinput.spec.js +31 -0
- package/src/components/numberinput/Numberinput.vue +8 -3
- package/src/components/numberinput/index.js +1 -1
- package/src/components/pagination/Pagination.vue +2 -2
- package/src/components/pagination/index.js +2 -2
- package/src/components/progress/index.js +2 -2
- package/src/components/radio/Radio.vue +1 -1
- package/src/components/radio/RadioButton.vue +1 -1
- package/src/components/radio/index.js +2 -2
- package/src/components/rate/Rate.vue +1 -1
- package/src/components/rate/index.js +1 -1
- package/src/components/select/Select.vue +1 -1
- package/src/components/select/index.js +1 -1
- package/src/components/sidebar/Sidebar.vue +6 -25
- package/src/components/sidebar/index.js +1 -1
- package/src/components/skeleton/index.js +1 -1
- package/src/components/slider/Slider.vue +2 -2
- package/src/components/slider/SliderThumb.vue +1 -1
- package/src/components/slider/index.js +2 -2
- package/src/components/snackbar/Snackbar.vue +1 -1
- package/src/components/snackbar/index.js +1 -1
- package/src/components/steps/StepItem.vue +1 -1
- package/src/components/steps/Steps.vue +2 -2
- package/src/components/steps/index.js +2 -2
- package/src/components/switch/index.js +1 -1
- package/src/components/table/Table.vue +31 -19
- package/src/components/table/TableColumn.vue +121 -121
- package/src/components/table/TableMobileSort.vue +2 -2
- package/src/components/table/TablePagination.vue +1 -1
- package/src/components/table/index.js +2 -2
- package/src/components/tabs/TabItem.vue +1 -1
- package/src/components/tabs/Tabs.vue +1 -1
- package/src/components/tabs/index.js +2 -2
- package/src/components/tag/index.js +2 -2
- package/src/components/taginput/Taginput.vue +7 -3
- package/src/components/taginput/index.js +1 -1
- package/src/components/timepicker/Timepicker.vue +6 -6
- package/src/components/timepicker/index.js +1 -1
- package/src/components/toast/Toast.vue +1 -1
- package/src/components/toast/index.js +1 -1
- package/src/components/tooltip/Tooltip.spec.js +35 -0
- package/src/components/tooltip/index.js +1 -1
- package/src/components/upload/index.js +1 -1
- package/src/index.js +1 -0
- package/src/scss/components/_colorpicker.scss +1 -1
- package/src/scss/components/_datepicker.scss +2 -2
- package/src/scss/components/_message.scss +8 -2
- package/src/scss/components/_notification.scss +5 -5
- package/src/scss/components/_radio.scss +3 -0
- package/src/scss/components/_table.scss +1 -0
- package/src/utils/MessageMixin.js +1 -1
- package/src/utils/TabbedChildMixin.js +1 -1
- package/src/utils/TabbedMixin.js +1 -1
- package/src/utils/color.js +3 -2
- package/src/utils/color.spec.js +3 -1
- package/CHANGELOG.md +0 -1741
- /package/dist/esm/{chunk-6d0f2352.js → chunk-241dbe8d.js} +0 -0
- /package/dist/esm/{chunk-17b33cd2.js → chunk-6ca75105.js} +0 -0
- /package/dist/esm/{chunk-c9c18b2f.js → chunk-f37c671e.js} +0 -0
- /package/dist/esm/{chunk-a32d1427.js → chunk-f4922148.js} +0 -0
- /package/src/components/colorpicker/__snapshots__/{ColorPickerHSLRepresentationSquare.spec.js.snap → ColorpickerHSLRepresentationSquare.spec.js.snap} +0 -0
package/dist/esm/colorpicker.js
CHANGED
|
@@ -1,1755 +1,14 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import './chunk-
|
|
1
|
+
import './chunk-851d1b8f.js';
|
|
2
|
+
import './helpers.js';
|
|
3
|
+
import './chunk-e92e3389.js';
|
|
4
|
+
import './chunk-6ca75105.js';
|
|
5
|
+
import './chunk-4b289821.js';
|
|
6
|
+
import './chunk-cca88db8.js';
|
|
7
|
+
import './chunk-d77d421b.js';
|
|
8
|
+
import './chunk-70481141.js';
|
|
9
9
|
import './chunk-42f463e6.js';
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
|
|
13
|
-
import
|
|
14
|
-
|
|
15
|
-
var colorChannels = ['red', 'green', 'blue', 'alpha'];
|
|
16
|
-
var colorsNammed = {
|
|
17
|
-
black: '#000000',
|
|
18
|
-
silver: '#c0c0c0',
|
|
19
|
-
gray: '#808080',
|
|
20
|
-
white: '#ffffff',
|
|
21
|
-
maroon: '#800000',
|
|
22
|
-
red: '#ff0000',
|
|
23
|
-
purple: '#800080',
|
|
24
|
-
fuchsia: '#ff00ff',
|
|
25
|
-
green: '#008000',
|
|
26
|
-
lime: '#00ff00',
|
|
27
|
-
olive: '#808000',
|
|
28
|
-
yellow: '#ffff00',
|
|
29
|
-
navy: '#000080',
|
|
30
|
-
blue: '#0000ff',
|
|
31
|
-
teal: '#008080',
|
|
32
|
-
aqua: '#00ffff',
|
|
33
|
-
orange: '#ffa500',
|
|
34
|
-
aliceblue: '#f0f8ff',
|
|
35
|
-
antiquewhite: '#faebd7',
|
|
36
|
-
aquamarine: '#7fffd4',
|
|
37
|
-
azure: '#f0ffff',
|
|
38
|
-
beige: '#f5f5dc',
|
|
39
|
-
bisque: '#ffe4c4',
|
|
40
|
-
blanchedalmond: '#ffebcd',
|
|
41
|
-
blueviolet: '#8a2be2',
|
|
42
|
-
brown: '#a52a2a',
|
|
43
|
-
burlywood: '#deb887',
|
|
44
|
-
cadetblue: '#5f9ea0',
|
|
45
|
-
chartreuse: '#7fff00',
|
|
46
|
-
chocolate: '#d2691e',
|
|
47
|
-
coral: '#ff7f50',
|
|
48
|
-
cornflowerblue: '#6495ed',
|
|
49
|
-
cornsilk: '#fff8dc',
|
|
50
|
-
crimson: '#dc143c',
|
|
51
|
-
cyan: '#00ffff',
|
|
52
|
-
darkblue: '#00008b',
|
|
53
|
-
darkcyan: '#008b8b',
|
|
54
|
-
darkgoldenrod: '#b8860b',
|
|
55
|
-
darkgray: '#a9a9a9',
|
|
56
|
-
darkgreen: '#006400',
|
|
57
|
-
darkgrey: '#a9a9a9',
|
|
58
|
-
darkkhaki: '#bdb76b',
|
|
59
|
-
darkmagenta: '#8b008b',
|
|
60
|
-
darkolivegreen: '#556b2f',
|
|
61
|
-
darkorange: '#ff8c00',
|
|
62
|
-
darkorchid: '#9932cc',
|
|
63
|
-
darkred: '#8b0000',
|
|
64
|
-
darksalmon: '#e9967a',
|
|
65
|
-
darkseagreen: '#8fbc8f',
|
|
66
|
-
darkslateblue: '#483d8b',
|
|
67
|
-
darkslategray: '#2f4f4f',
|
|
68
|
-
darkslategrey: '#2f4f4f',
|
|
69
|
-
darkturquoise: '#00ced1',
|
|
70
|
-
darkviolet: '#9400d3',
|
|
71
|
-
deeppink: '#ff1493',
|
|
72
|
-
deepskyblue: '#00bfff',
|
|
73
|
-
dimgray: '#696969',
|
|
74
|
-
dimgrey: '#696969',
|
|
75
|
-
dodgerblue: '#1e90ff',
|
|
76
|
-
firebrick: '#b22222',
|
|
77
|
-
floralwhite: '#fffaf0',
|
|
78
|
-
forestgreen: '#228b22',
|
|
79
|
-
gainsboro: '#dcdcdc',
|
|
80
|
-
ghostwhite: '#f8f8ff',
|
|
81
|
-
gold: '#ffd700',
|
|
82
|
-
goldenrod: '#daa520',
|
|
83
|
-
greenyellow: '#adff2f',
|
|
84
|
-
grey: '#808080',
|
|
85
|
-
honeydew: '#f0fff0',
|
|
86
|
-
hotpink: '#ff69b4',
|
|
87
|
-
indianred: '#cd5c5c',
|
|
88
|
-
indigo: '#4b0082',
|
|
89
|
-
ivory: '#fffff0',
|
|
90
|
-
khaki: '#f0e68c',
|
|
91
|
-
lavender: '#e6e6fa',
|
|
92
|
-
lavenderblush: '#fff0f5',
|
|
93
|
-
lawngreen: '#7cfc00',
|
|
94
|
-
lemonchiffon: '#fffacd',
|
|
95
|
-
lightblue: '#add8e6',
|
|
96
|
-
lightcoral: '#f08080',
|
|
97
|
-
lightcyan: '#e0ffff',
|
|
98
|
-
lightgoldenrodyellow: '#fafad2',
|
|
99
|
-
lightgray: '#d3d3d3',
|
|
100
|
-
lightgreen: '#90ee90',
|
|
101
|
-
lightgrey: '#d3d3d3',
|
|
102
|
-
lightpink: '#ffb6c1',
|
|
103
|
-
lightsalmon: '#ffa07a',
|
|
104
|
-
lightseagreen: '#20b2aa',
|
|
105
|
-
lightskyblue: '#87cefa',
|
|
106
|
-
lightslategray: '#778899',
|
|
107
|
-
lightslategrey: '#778899',
|
|
108
|
-
lightsteelblue: '#b0c4de',
|
|
109
|
-
lightyellow: '#ffffe0',
|
|
110
|
-
limegreen: '#32cd32',
|
|
111
|
-
linen: '#faf0e6',
|
|
112
|
-
magenta: '#ff00ff',
|
|
113
|
-
mediumaquamarine: '#66cdaa',
|
|
114
|
-
mediumblue: '#0000cd',
|
|
115
|
-
mediumorchid: '#ba55d3',
|
|
116
|
-
mediumpurple: '#9370db',
|
|
117
|
-
mediumseagreen: '#3cb371',
|
|
118
|
-
mediumslateblue: '#7b68ee',
|
|
119
|
-
mediumspringgreen: '#00fa9a',
|
|
120
|
-
mediumturquoise: '#48d1cc',
|
|
121
|
-
mediumvioletred: '#c71585',
|
|
122
|
-
midnightblue: '#191970',
|
|
123
|
-
mintcream: '#f5fffa',
|
|
124
|
-
mistyrose: '#ffe4e1',
|
|
125
|
-
moccasin: '#ffe4b5',
|
|
126
|
-
navajowhite: '#ffdead',
|
|
127
|
-
oldlace: '#fdf5e6',
|
|
128
|
-
olivedrab: '#6b8e23',
|
|
129
|
-
orangered: '#ff4500',
|
|
130
|
-
orchid: '#da70d6',
|
|
131
|
-
palegoldenrod: '#eee8aa',
|
|
132
|
-
palegreen: '#98fb98',
|
|
133
|
-
paleturquoise: '#afeeee',
|
|
134
|
-
palevioletred: '#db7093',
|
|
135
|
-
papayawhip: '#ffefd5',
|
|
136
|
-
peachpuff: '#ffdab9',
|
|
137
|
-
peru: '#cd853f',
|
|
138
|
-
pink: '#ffc0cb',
|
|
139
|
-
plum: '#dda0dd',
|
|
140
|
-
powderblue: '#b0e0e6',
|
|
141
|
-
rosybrown: '#bc8f8f',
|
|
142
|
-
royalblue: '#4169e1',
|
|
143
|
-
saddlebrown: '#8b4513',
|
|
144
|
-
salmon: '#fa8072',
|
|
145
|
-
sandybrown: '#f4a460',
|
|
146
|
-
seagreen: '#2e8b57',
|
|
147
|
-
seashell: '#fff5ee',
|
|
148
|
-
sienna: '#a0522d',
|
|
149
|
-
skyblue: '#87ceeb',
|
|
150
|
-
slateblue: '#6a5acd',
|
|
151
|
-
slategray: '#708090',
|
|
152
|
-
slategrey: '#708090',
|
|
153
|
-
snow: '#fffafa',
|
|
154
|
-
springgreen: '#00ff7f',
|
|
155
|
-
steelblue: '#4682b4',
|
|
156
|
-
tan: '#d2b48c',
|
|
157
|
-
thistle: '#d8bfd8',
|
|
158
|
-
tomato: '#ff6347',
|
|
159
|
-
turquoise: '#40e0d0',
|
|
160
|
-
violet: '#ee82ee',
|
|
161
|
-
wheat: '#f5deb3',
|
|
162
|
-
whitesmoke: '#f5f5f5',
|
|
163
|
-
yellowgreen: '#9acd32',
|
|
164
|
-
rebeccapurple: '#663399'
|
|
165
|
-
};
|
|
166
|
-
var ColorTypeError =
|
|
167
|
-
/*#__PURE__*/
|
|
168
|
-
function (_Error) {
|
|
169
|
-
_inherits(ColorTypeError, _Error);
|
|
170
|
-
|
|
171
|
-
function ColorTypeError() {
|
|
172
|
-
_classCallCheck(this, ColorTypeError);
|
|
173
|
-
|
|
174
|
-
return _possibleConstructorReturn(this, _getPrototypeOf(ColorTypeError).call(this, 'ColorTypeError: type must be hex(a), rgb(a) or hsl(a)'));
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
return ColorTypeError;
|
|
178
|
-
}(_wrapNativeSuper(Error));
|
|
179
|
-
|
|
180
|
-
var Color =
|
|
181
|
-
/*#__PURE__*/
|
|
182
|
-
function () {
|
|
183
|
-
function Color() {
|
|
184
|
-
var _this = this;
|
|
185
|
-
|
|
186
|
-
_classCallCheck(this, Color);
|
|
187
|
-
|
|
188
|
-
if (arguments.length > 0) {
|
|
189
|
-
return Color.parse.apply(Color, arguments);
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
this.$channels = new Uint8Array(colorChannels.length);
|
|
193
|
-
colorChannels.forEach(function (channel, index) {
|
|
194
|
-
Object.defineProperty(_this, channel, {
|
|
195
|
-
get: function get() {
|
|
196
|
-
return _this.$channels[index];
|
|
197
|
-
},
|
|
198
|
-
set: function set(byte) {
|
|
199
|
-
if (!Number.isNaN(byte / 1)) {
|
|
200
|
-
_this.$channels[index] = Math.min(255, Math.max(0, byte));
|
|
201
|
-
}
|
|
202
|
-
},
|
|
203
|
-
enumerable: true,
|
|
204
|
-
configurable: true
|
|
205
|
-
});
|
|
206
|
-
}) // Required for observability
|
|
207
|
-
;
|
|
208
|
-
['hue', 'saturation', 'lightness'].forEach(function (name) {
|
|
209
|
-
var capitalizedName = name.replace(/^./, function (m) {
|
|
210
|
-
return m.toUpperCase();
|
|
211
|
-
});
|
|
212
|
-
Object.defineProperty(_this, name, {
|
|
213
|
-
get: function get() {
|
|
214
|
-
return _this["get".concat(capitalizedName)]();
|
|
215
|
-
},
|
|
216
|
-
set: function set(value) {
|
|
217
|
-
if (!Number.isNaN(value / 1)) {
|
|
218
|
-
_this["set".concat(capitalizedName)](value);
|
|
219
|
-
}
|
|
220
|
-
},
|
|
221
|
-
enumerable: true,
|
|
222
|
-
configurable: true
|
|
223
|
-
});
|
|
224
|
-
});
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
_createClass(Color, [{
|
|
228
|
-
key: "getHue",
|
|
229
|
-
value: function getHue() {
|
|
230
|
-
var _Array$from$map = Array.from(this.$channels).map(function (c) {
|
|
231
|
-
return c / 255;
|
|
232
|
-
}),
|
|
233
|
-
_Array$from$map2 = _slicedToArray(_Array$from$map, 3),
|
|
234
|
-
red = _Array$from$map2[0],
|
|
235
|
-
green = _Array$from$map2[1],
|
|
236
|
-
blue = _Array$from$map2[2];
|
|
237
|
-
|
|
238
|
-
var _ref = [Math.min(red, green, blue), Math.max(red, green, blue)],
|
|
239
|
-
min = _ref[0],
|
|
240
|
-
max = _ref[1];
|
|
241
|
-
var delta = max - min;
|
|
242
|
-
var hue = 0;
|
|
243
|
-
|
|
244
|
-
if (delta === 0) {
|
|
245
|
-
return hue;
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
if (red === max) {
|
|
249
|
-
hue = (green - blue) / delta % 6;
|
|
250
|
-
} else if (green === max) {
|
|
251
|
-
hue = (blue - red) / delta + 2;
|
|
252
|
-
} else {
|
|
253
|
-
hue = (red - green) / delta + 4;
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
hue *= 60;
|
|
257
|
-
|
|
258
|
-
while (hue !== -Infinity && hue < 0) {
|
|
259
|
-
hue += 360;
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
return Math.round(hue % 360);
|
|
263
|
-
}
|
|
264
|
-
}, {
|
|
265
|
-
key: "setHue",
|
|
266
|
-
value: function setHue(value) {
|
|
267
|
-
var color = Color.fromHSL(value, this.saturation, this.lightness, this.alpha / 255);
|
|
268
|
-
|
|
269
|
-
for (var i = 0; i < this.$channels.length; i++) {
|
|
270
|
-
this.$channels[i] = Number(color.$channels[i]);
|
|
271
|
-
}
|
|
272
|
-
}
|
|
273
|
-
}, {
|
|
274
|
-
key: "getSaturation",
|
|
275
|
-
value: function getSaturation() {
|
|
276
|
-
var _Array$from$map3 = Array.from(this.$channels).map(function (c) {
|
|
277
|
-
return c / 255;
|
|
278
|
-
}),
|
|
279
|
-
_Array$from$map4 = _slicedToArray(_Array$from$map3, 3),
|
|
280
|
-
red = _Array$from$map4[0],
|
|
281
|
-
green = _Array$from$map4[1],
|
|
282
|
-
blue = _Array$from$map4[2];
|
|
283
|
-
|
|
284
|
-
var _ref2 = [Math.min(red, green, blue), Math.max(red, green, blue)],
|
|
285
|
-
min = _ref2[0],
|
|
286
|
-
max = _ref2[1];
|
|
287
|
-
var delta = max - min;
|
|
288
|
-
return delta !== 0 ? Math.round(delta / (1 - Math.abs(2 * this.lightness - 1)) * 100) / 100 : 0;
|
|
289
|
-
}
|
|
290
|
-
}, {
|
|
291
|
-
key: "setSaturation",
|
|
292
|
-
value: function setSaturation(value) {
|
|
293
|
-
var _this2 = this;
|
|
294
|
-
|
|
295
|
-
var color = Color.fromHSL(this.hue, value, this.lightness, this.alpha / 255);
|
|
296
|
-
colorChannels.forEach(function (_, i) {
|
|
297
|
-
return _this2.$channels[i] = color.$channels[i];
|
|
298
|
-
});
|
|
299
|
-
}
|
|
300
|
-
}, {
|
|
301
|
-
key: "getLightness",
|
|
302
|
-
value: function getLightness() {
|
|
303
|
-
var _Array$from$map5 = Array.from(this.$channels).map(function (c) {
|
|
304
|
-
return c / 255;
|
|
305
|
-
}),
|
|
306
|
-
_Array$from$map6 = _slicedToArray(_Array$from$map5, 3),
|
|
307
|
-
red = _Array$from$map6[0],
|
|
308
|
-
green = _Array$from$map6[1],
|
|
309
|
-
blue = _Array$from$map6[2];
|
|
310
|
-
|
|
311
|
-
var _ref3 = [Math.min(red, green, blue), Math.max(red, green, blue)],
|
|
312
|
-
min = _ref3[0],
|
|
313
|
-
max = _ref3[1];
|
|
314
|
-
return Math.round((max + min) / 2 * 100) / 100;
|
|
315
|
-
}
|
|
316
|
-
}, {
|
|
317
|
-
key: "setLightness",
|
|
318
|
-
value: function setLightness(value) {
|
|
319
|
-
var _this3 = this;
|
|
320
|
-
|
|
321
|
-
var color = Color.fromHSL(this.hue, this.lightness, value, this.alpha / 255);
|
|
322
|
-
colorChannels.forEach(function (_, i) {
|
|
323
|
-
return _this3.$channels[i] = color.$channels[i];
|
|
324
|
-
});
|
|
325
|
-
}
|
|
326
|
-
}, {
|
|
327
|
-
key: "clone",
|
|
328
|
-
value: function clone() {
|
|
329
|
-
var _this4 = this;
|
|
330
|
-
|
|
331
|
-
var color = new Color();
|
|
332
|
-
colorChannels.forEach(function (_, i) {
|
|
333
|
-
return color.$channels[i] = _this4.$channels[i];
|
|
334
|
-
});
|
|
335
|
-
return color;
|
|
336
|
-
}
|
|
337
|
-
}, {
|
|
338
|
-
key: "toString",
|
|
339
|
-
value: function toString() {
|
|
340
|
-
var _this5 = this;
|
|
341
|
-
|
|
342
|
-
var type = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'hex';
|
|
343
|
-
|
|
344
|
-
switch (String(type).toLowerCase()) {
|
|
345
|
-
case 'hex':
|
|
346
|
-
return '#' + colorChannels.slice(0, 3).map(function (channel) {
|
|
347
|
-
return _this5[channel].toString(16).padStart(2, '0');
|
|
348
|
-
}).join('');
|
|
349
|
-
|
|
350
|
-
case 'hexa':
|
|
351
|
-
return '#' + colorChannels.map(function (channel) {
|
|
352
|
-
return _this5[channel].toString(16).padStart(2, '0');
|
|
353
|
-
}).join('');
|
|
354
|
-
|
|
355
|
-
case 'rgb':
|
|
356
|
-
return "rgb(".concat(this.red, ", ").concat(this.green, ", ").concat(this.blue, ")");
|
|
357
|
-
|
|
358
|
-
case 'rgba':
|
|
359
|
-
return "rgba(".concat(this.red, ", ").concat(this.green, ", ").concat(this.blue, ", ").concat(Math.round(this.alpha / 2.55) / 100, ")");
|
|
360
|
-
|
|
361
|
-
case 'hsl':
|
|
362
|
-
return "hsl(".concat(Math.round(this.hue), "deg, ").concat(Math.round(this.saturation * 100), "%, ").concat(Math.round(this.lightness * 100), "%)");
|
|
363
|
-
|
|
364
|
-
case 'hsla':
|
|
365
|
-
return "hsla(".concat(Math.round(this.hue), "deg, ").concat(Math.round(this.saturation * 100), "%, ").concat(Math.round(this.lightness * 100), "%, ").concat(Math.round(this.alpha / 2.55) / 100, ")");
|
|
366
|
-
|
|
367
|
-
default:
|
|
368
|
-
throw new ColorTypeError();
|
|
369
|
-
}
|
|
370
|
-
}
|
|
371
|
-
}, {
|
|
372
|
-
key: Symbol.toString,
|
|
373
|
-
get: function get() {
|
|
374
|
-
return this.toString('hex');
|
|
375
|
-
}
|
|
376
|
-
}], [{
|
|
377
|
-
key: "parse",
|
|
378
|
-
value: function parse() {
|
|
379
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
380
|
-
args[_key] = arguments[_key];
|
|
381
|
-
}
|
|
382
|
-
|
|
383
|
-
if (_typeof(args[0]) === 'object') {
|
|
384
|
-
return Color.parseObject(args[0]);
|
|
385
|
-
} else if (args.every(function (arg) {
|
|
386
|
-
return !Number.isNaN(arg / 1);
|
|
387
|
-
})) {
|
|
388
|
-
var color = new Color();
|
|
389
|
-
|
|
390
|
-
if (args.length > 3) {
|
|
391
|
-
color.red = args[0];
|
|
392
|
-
color.green = args[1];
|
|
393
|
-
color.blue = args[2];
|
|
394
|
-
|
|
395
|
-
if (args[3]) {
|
|
396
|
-
color.alpha = args[3];
|
|
397
|
-
}
|
|
398
|
-
} else if (args.length === 1) {
|
|
399
|
-
var index = Number(args[0]);
|
|
400
|
-
return Color.parseIndex(index, index > Math.pow(2, 24) ? 3 : 4);
|
|
401
|
-
}
|
|
402
|
-
} else if (typeof args[0] === 'string') {
|
|
403
|
-
var match = null;
|
|
404
|
-
|
|
405
|
-
if (typeof colorsNammed[args[0].toLowerCase()] === 'string') {
|
|
406
|
-
return Color.parseHex(colorsNammed[args[0].toLowerCase()]);
|
|
407
|
-
} else if ((match = args[0].match(/^(#|&h|0x)?(([a-f0-9]{3,4}){1,2})$/i)) !== null) {
|
|
408
|
-
return Color.parseHex(match[2]);
|
|
409
|
-
} else if ((match = args[0].match(/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)(\s*,\s*(\d*\.?\d+))?\s*\)$/i)) !== null) {
|
|
410
|
-
var channels = [match[1], match[2], match[3], typeof match[5] !== 'undefined' ? match[5] : 1];
|
|
411
|
-
return Color.fromRGB.apply(Color, _toConsumableArray(channels.map(function (value) {
|
|
412
|
-
return Number(value);
|
|
413
|
-
})));
|
|
414
|
-
} else if (match = args[0].match(/^(h(sl|wb)a?|lab|color|cmyk)\(/i)) {
|
|
415
|
-
throw new Error('Color expression not implemented yet');
|
|
416
|
-
}
|
|
417
|
-
}
|
|
418
|
-
|
|
419
|
-
return new Color();
|
|
420
|
-
}
|
|
421
|
-
}, {
|
|
422
|
-
key: "parseObject",
|
|
423
|
-
value: function parseObject(object) {
|
|
424
|
-
var color = new Color();
|
|
425
|
-
|
|
426
|
-
if (object === null || _typeof(object) !== 'object') {
|
|
427
|
-
return color;
|
|
428
|
-
}
|
|
429
|
-
|
|
430
|
-
if (Color.isColor(object)) {
|
|
431
|
-
return object.clone();
|
|
432
|
-
}
|
|
433
|
-
|
|
434
|
-
colorChannels.forEach(function (channel) {
|
|
435
|
-
if (!Number.isNaN(object[channel])) {
|
|
436
|
-
color[channel] = object[channel];
|
|
437
|
-
}
|
|
438
|
-
});
|
|
439
|
-
return color;
|
|
440
|
-
}
|
|
441
|
-
}, {
|
|
442
|
-
key: "parseHex",
|
|
443
|
-
value: function parseHex(hex) {
|
|
444
|
-
if (typeof hex !== 'string') {
|
|
445
|
-
throw new Error('Hex expression must be a string');
|
|
446
|
-
}
|
|
447
|
-
|
|
448
|
-
hex = hex.trim().replace(/^(0x|&h|#)/i, '');
|
|
449
|
-
|
|
450
|
-
if (hex.length === 3 || hex.length === 4) {
|
|
451
|
-
hex = hex.split('').map(function (c) {
|
|
452
|
-
return c.repeat(2);
|
|
453
|
-
}).join('');
|
|
454
|
-
}
|
|
455
|
-
|
|
456
|
-
if (!(hex.length === 6 || hex.length === 8)) {
|
|
457
|
-
throw new Error('Incorrect Hex expression length');
|
|
458
|
-
}
|
|
459
|
-
|
|
460
|
-
var chans = hex.split(/(..)/).filter(function (value) {
|
|
461
|
-
return value;
|
|
462
|
-
}).map(function (value) {
|
|
463
|
-
return Number.parseInt(value, 16);
|
|
464
|
-
});
|
|
465
|
-
|
|
466
|
-
if (typeof chans[3] === 'number') {
|
|
467
|
-
chans[3] /= 255;
|
|
468
|
-
}
|
|
469
|
-
|
|
470
|
-
return Color.fromRGB.apply(Color, _toConsumableArray(chans));
|
|
471
|
-
}
|
|
472
|
-
}, {
|
|
473
|
-
key: "parseIndex",
|
|
474
|
-
value: function parseIndex(value) {
|
|
475
|
-
var channels = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 3;
|
|
476
|
-
var color = new Color();
|
|
477
|
-
|
|
478
|
-
for (var i = 0; i < 4; i++) {
|
|
479
|
-
color[colorChannels[i]] = value >> (channels - i) * 8 && 0xff;
|
|
480
|
-
}
|
|
481
|
-
|
|
482
|
-
return color;
|
|
483
|
-
}
|
|
484
|
-
}, {
|
|
485
|
-
key: "fromRGB",
|
|
486
|
-
value: function fromRGB(red, green, blue) {
|
|
487
|
-
var alpha = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 1;
|
|
488
|
-
|
|
489
|
-
if ([red, green, blue, alpha].some(function (arg) {
|
|
490
|
-
return Number.isNaN(arg / 1);
|
|
491
|
-
})) {
|
|
492
|
-
throw new Error('Invalid arguments');
|
|
493
|
-
}
|
|
494
|
-
|
|
495
|
-
alpha *= 255;
|
|
496
|
-
var color = new Color();
|
|
497
|
-
[red, green, blue, alpha].forEach(function (value, index) {
|
|
498
|
-
color[colorChannels[index]] = value;
|
|
499
|
-
});
|
|
500
|
-
return color;
|
|
501
|
-
}
|
|
502
|
-
}, {
|
|
503
|
-
key: "fromHSL",
|
|
504
|
-
value: function fromHSL(hue, saturation, lightness) {
|
|
505
|
-
var alpha = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 1;
|
|
506
|
-
|
|
507
|
-
if ([hue, saturation, lightness, alpha].some(function (arg) {
|
|
508
|
-
return Number.isNaN(arg);
|
|
509
|
-
})) {
|
|
510
|
-
throw new Error('Invalid arguments');
|
|
511
|
-
}
|
|
512
|
-
|
|
513
|
-
while (hue < 0 && hue !== -Infinity) {
|
|
514
|
-
hue += 360;
|
|
515
|
-
}
|
|
516
|
-
|
|
517
|
-
hue = hue % 360;
|
|
518
|
-
saturation = Math.max(0, Math.min(1, saturation));
|
|
519
|
-
lightness = Math.max(0, Math.min(1, lightness));
|
|
520
|
-
alpha = Math.max(0, Math.min(1, alpha));
|
|
521
|
-
var c = (1 - Math.abs(2 * lightness - 1)) * saturation;
|
|
522
|
-
var x = c * (1 - Math.abs(hue / 60 % 2 - 1));
|
|
523
|
-
var m = lightness - c / 2;
|
|
524
|
-
|
|
525
|
-
var _ref4 = hue < 60 ? [c, x, 0] : hue < 120 ? [x, c, 0] : hue < 180 ? [0, c, x] : hue < 240 ? [0, x, c] : hue < 300 ? [x, 0, c] : [c, 0, x],
|
|
526
|
-
_ref5 = _slicedToArray(_ref4, 3),
|
|
527
|
-
r = _ref5[0],
|
|
528
|
-
g = _ref5[1],
|
|
529
|
-
b = _ref5[2];
|
|
530
|
-
|
|
531
|
-
return Color.fromRGB((r + m) * 255, (g + m) * 255, (b + m) * 255, alpha);
|
|
532
|
-
}
|
|
533
|
-
}, {
|
|
534
|
-
key: "isColor",
|
|
535
|
-
value: function isColor(arg) {
|
|
536
|
-
return arg instanceof Color;
|
|
537
|
-
}
|
|
538
|
-
}]);
|
|
539
|
-
|
|
540
|
-
return Color;
|
|
541
|
-
}();
|
|
542
|
-
|
|
543
|
-
//
|
|
544
|
-
var cos30 = 0.86602540378;
|
|
545
|
-
var sin30 = 0.5;
|
|
546
|
-
var id = 0;
|
|
547
|
-
var script = {
|
|
548
|
-
name: 'BColorpickerHSLRepresentationTriangle',
|
|
549
|
-
props: {
|
|
550
|
-
value: {
|
|
551
|
-
type: Object,
|
|
552
|
-
required: true,
|
|
553
|
-
validator: function validator(value) {
|
|
554
|
-
return typeof value.hue === 'number' && typeof value.saturation === 'number' && typeof value.lightness === 'number';
|
|
555
|
-
}
|
|
556
|
-
},
|
|
557
|
-
size: {
|
|
558
|
-
type: Number,
|
|
559
|
-
default: 200
|
|
560
|
-
},
|
|
561
|
-
thickness: {
|
|
562
|
-
type: Number,
|
|
563
|
-
default: 20
|
|
564
|
-
}
|
|
565
|
-
},
|
|
566
|
-
data: function data() {
|
|
567
|
-
return {
|
|
568
|
-
id: id++,
|
|
569
|
-
hue: this.value.hue,
|
|
570
|
-
saturation: this.value.saturation,
|
|
571
|
-
lightness: this.value.lightness,
|
|
572
|
-
captureMouse: false,
|
|
573
|
-
captureType: 'hue',
|
|
574
|
-
clientOffset: {
|
|
575
|
-
cx: -1,
|
|
576
|
-
cy: -1,
|
|
577
|
-
width: 0,
|
|
578
|
-
height: 0
|
|
579
|
-
},
|
|
580
|
-
cos30: cos30,
|
|
581
|
-
sin30: sin30,
|
|
582
|
-
debounce: 0
|
|
583
|
-
};
|
|
584
|
-
},
|
|
585
|
-
computed: {
|
|
586
|
-
viewBox: function viewBox() {
|
|
587
|
-
var size = this.size;
|
|
588
|
-
return "0 0 ".concat(size, " ").concat(size);
|
|
589
|
-
},
|
|
590
|
-
internalRadius: function internalRadius() {
|
|
591
|
-
return this.size / 2 - this.thickness;
|
|
592
|
-
},
|
|
593
|
-
haloPath: function haloPath() {
|
|
594
|
-
var size = this.size,
|
|
595
|
-
thickness = this.thickness;
|
|
596
|
-
var radius = size / 2 - 2; // 2px padding
|
|
597
|
-
|
|
598
|
-
var thicknessRadius = radius - thickness;
|
|
599
|
-
var center = size / 2;
|
|
600
|
-
return "M".concat(center - radius, " ").concat(center, "a").concat(radius, " ").concat(radius, " 0 1 1 ").concat(2 * radius, " 0") + "h".concat(-thickness) + "a".concat(-thicknessRadius, " ").concat(thicknessRadius, " 0 1 0 ").concat(-2 * thicknessRadius, " 0") + "a".concat(thicknessRadius, " ").concat(thicknessRadius, " 0 1 0 ").concat(2 * thicknessRadius, " 0") + "h".concat(thickness) + "a".concat(radius, " ").concat(radius, " 0 1 1 ").concat(-2 * radius, " 0z");
|
|
601
|
-
},
|
|
602
|
-
trianglePath: function trianglePath() {
|
|
603
|
-
var size = this.size,
|
|
604
|
-
thickness = this.thickness;
|
|
605
|
-
var radius = size - 4;
|
|
606
|
-
var thicknessRadius = (radius - 2 * thickness) / 2;
|
|
607
|
-
return "M0 ".concat(-thicknessRadius) + "L".concat(cos30 * thicknessRadius, " ").concat(sin30 * thicknessRadius) + "H".concat(-cos30 * thicknessRadius, "z");
|
|
608
|
-
}
|
|
609
|
-
},
|
|
610
|
-
watch: {
|
|
611
|
-
captureMouse: function captureMouse(newValue, oldValue) {
|
|
612
|
-
if (oldValue === false && newValue !== false) {
|
|
613
|
-
var rect = this.$el.getBoundingClientRect(); // Caching offset
|
|
614
|
-
|
|
615
|
-
this.clientOffset.cx = rect.x + rect.width / 2;
|
|
616
|
-
this.clientOffset.cy = rect.y + rect.height / 2;
|
|
617
|
-
this.clientOffset.width = rect.width;
|
|
618
|
-
this.clientOffset.height = rect.height;
|
|
619
|
-
}
|
|
620
|
-
},
|
|
621
|
-
value: {
|
|
622
|
-
deep: true,
|
|
623
|
-
handler: function handler(newColor) {
|
|
624
|
-
var _this = this;
|
|
625
|
-
|
|
626
|
-
var hue = newColor.hue,
|
|
627
|
-
saturation = newColor.saturation,
|
|
628
|
-
lightness = newColor.lightness;
|
|
629
|
-
window.clearTimeout(this.debounce);
|
|
630
|
-
this.debounce = window.setTimeout(function () {
|
|
631
|
-
if (lightness >= 0.03 && lightness <= 0.97 && saturation > 0) {
|
|
632
|
-
_this.hue = hue;
|
|
633
|
-
}
|
|
634
|
-
|
|
635
|
-
_this.saturation = saturation;
|
|
636
|
-
_this.lightness = lightness;
|
|
637
|
-
}, 200);
|
|
638
|
-
}
|
|
639
|
-
}
|
|
640
|
-
},
|
|
641
|
-
methods: {
|
|
642
|
-
increaseHue: function increaseHue() {
|
|
643
|
-
var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;
|
|
644
|
-
this.hue = (this.hue + value) % 360;
|
|
645
|
-
},
|
|
646
|
-
decreaseHue: function decreaseHue() {
|
|
647
|
-
var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;
|
|
648
|
-
this.hue = (360 + this.hue - value) % 360;
|
|
649
|
-
},
|
|
650
|
-
increaseSaturation: function increaseSaturation() {
|
|
651
|
-
var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0.01;
|
|
652
|
-
this.saturation = Math.min(1, Math.max(0, this.saturation + value));
|
|
653
|
-
this.lightness = Math.min(0.5 + (1 - this.saturation) * 0.5, Math.max(0.5 - (1 - this.saturation) * 0.5, this.lightness));
|
|
654
|
-
},
|
|
655
|
-
decreaseSaturation: function decreaseSaturation() {
|
|
656
|
-
var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0.01;
|
|
657
|
-
this.saturation = Math.min(1, Math.max(0, this.saturation - value));
|
|
658
|
-
this.lightness = Math.min(0.5 + (1 - this.saturation) * 0.5, Math.max(0.5 - (1 - this.saturation) * 0.5, this.lightness));
|
|
659
|
-
},
|
|
660
|
-
increaseLightness: function increaseLightness() {
|
|
661
|
-
var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0.01;
|
|
662
|
-
this.lightness = Math.min(0.5 + (1 - this.saturation) * 0.5, Math.max(0.5 - (1 - this.saturation) * 0.5, this.lightness + value));
|
|
663
|
-
},
|
|
664
|
-
decreaseLightness: function decreaseLightness() {
|
|
665
|
-
var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0.01;
|
|
666
|
-
this.lightness = Math.min(0.5 + (1 - this.saturation) * 0.5, Math.max(0.5 - (1 - this.saturation) * 0.5, this.lightness - value));
|
|
667
|
-
},
|
|
668
|
-
hueKeyPress: function hueKeyPress(event) {
|
|
669
|
-
var handled = false;
|
|
670
|
-
|
|
671
|
-
switch (event.key) {
|
|
672
|
-
case 'ArrowRight':
|
|
673
|
-
case 'ArrowUp':
|
|
674
|
-
this.increaseHue();
|
|
675
|
-
handled = true;
|
|
676
|
-
break;
|
|
677
|
-
|
|
678
|
-
case 'ArrowLeft':
|
|
679
|
-
case 'ArrowDown':
|
|
680
|
-
this.decreaseHue();
|
|
681
|
-
handled = true;
|
|
682
|
-
break;
|
|
683
|
-
|
|
684
|
-
case 'Home':
|
|
685
|
-
this.increaseHue(360 - this.hue);
|
|
686
|
-
handled = true;
|
|
687
|
-
break;
|
|
688
|
-
|
|
689
|
-
case 'End':
|
|
690
|
-
this.decreaseHue(this.hue);
|
|
691
|
-
handled = true;
|
|
692
|
-
break;
|
|
693
|
-
|
|
694
|
-
case 'PageUp':
|
|
695
|
-
this.increaseHue(60 - this.hue % 60);
|
|
696
|
-
handled = true;
|
|
697
|
-
break;
|
|
698
|
-
|
|
699
|
-
case 'PageDown':
|
|
700
|
-
this.decreaseHue(60 + this.hue % 60);
|
|
701
|
-
handled = true;
|
|
702
|
-
break;
|
|
703
|
-
}
|
|
704
|
-
|
|
705
|
-
if (handled) {
|
|
706
|
-
event.preventDefault();
|
|
707
|
-
event.stopPropagation();
|
|
708
|
-
this.emitColor();
|
|
709
|
-
}
|
|
710
|
-
},
|
|
711
|
-
slKeyPress: function slKeyPress(event) {
|
|
712
|
-
var handled = false;
|
|
713
|
-
|
|
714
|
-
switch (event.key) {
|
|
715
|
-
case 'ArrowRight':
|
|
716
|
-
this.decreaseLightness();
|
|
717
|
-
handled = true;
|
|
718
|
-
break;
|
|
719
|
-
|
|
720
|
-
case 'ArrowUp':
|
|
721
|
-
this.increaseSaturation();
|
|
722
|
-
handled = true;
|
|
723
|
-
break;
|
|
724
|
-
|
|
725
|
-
case 'ArrowLeft':
|
|
726
|
-
this.increaseLightness();
|
|
727
|
-
handled = true;
|
|
728
|
-
break;
|
|
729
|
-
|
|
730
|
-
case 'ArrowDown':
|
|
731
|
-
this.decreaseSaturation();
|
|
732
|
-
handled = true;
|
|
733
|
-
break;
|
|
734
|
-
|
|
735
|
-
case 'Home':
|
|
736
|
-
this.increaseLightness(1 - this.lightness);
|
|
737
|
-
handled = true;
|
|
738
|
-
break;
|
|
739
|
-
|
|
740
|
-
case 'End':
|
|
741
|
-
this.decreaseLightness(this.lightness);
|
|
742
|
-
handled = true;
|
|
743
|
-
break;
|
|
744
|
-
|
|
745
|
-
case 'PageUp':
|
|
746
|
-
this.increaseSaturation(1 - this.saturation);
|
|
747
|
-
handled = true;
|
|
748
|
-
break;
|
|
749
|
-
|
|
750
|
-
case 'PageDown':
|
|
751
|
-
this.decreaseSaturation(this.saturation);
|
|
752
|
-
handled = true;
|
|
753
|
-
break;
|
|
754
|
-
}
|
|
755
|
-
|
|
756
|
-
if (handled) {
|
|
757
|
-
event.preventDefault();
|
|
758
|
-
event.stopPropagation();
|
|
759
|
-
this.emitColor();
|
|
760
|
-
}
|
|
761
|
-
},
|
|
762
|
-
clickHue: function clickHue(event) {
|
|
763
|
-
this.startMouseCapture(event);
|
|
764
|
-
this.trackMouse(event);
|
|
765
|
-
this.stopMouseCapture(event);
|
|
766
|
-
this.$refs.hueCursor.focus();
|
|
767
|
-
},
|
|
768
|
-
clickSL: function clickSL(event) {
|
|
769
|
-
this.startMouseCapture(event);
|
|
770
|
-
this.trackMouse(event);
|
|
771
|
-
this.stopMouseCapture(event);
|
|
772
|
-
this.$refs.slCursor.focus();
|
|
773
|
-
},
|
|
774
|
-
trackMouse: function trackMouse(event) {
|
|
775
|
-
if (this.captureMouse === false) {
|
|
776
|
-
return;
|
|
777
|
-
}
|
|
778
|
-
|
|
779
|
-
event.preventDefault();
|
|
780
|
-
event.stopPropagation();
|
|
781
|
-
var mouseX = 0,
|
|
782
|
-
mouseY = 0;
|
|
783
|
-
|
|
784
|
-
if (typeof event.touches !== 'undefined' && event.touches.length) {
|
|
785
|
-
var _ref = [event.touches[0].clientX, event.touches[0].clientY];
|
|
786
|
-
mouseX = _ref[0];
|
|
787
|
-
mouseY = _ref[1];
|
|
788
|
-
} else {
|
|
789
|
-
var _ref2 = [event.clientX, event.clientY];
|
|
790
|
-
mouseX = _ref2[0];
|
|
791
|
-
mouseY = _ref2[1];
|
|
792
|
-
}
|
|
793
|
-
|
|
794
|
-
var angle = Math.atan2(mouseY - this.clientOffset.cy, mouseX - this.clientOffset.cx);
|
|
795
|
-
|
|
796
|
-
if (this.captureType === 'sl') {
|
|
797
|
-
var d = Math.sqrt(Math.pow(mouseX - this.clientOffset.cx, 2) + Math.pow(mouseY - this.clientOffset.cy, 2));
|
|
798
|
-
var ratio = this.size / this.clientOffset.width;
|
|
799
|
-
var dx = d * Math.cos(angle - this.hue / 180 * Math.PI) * ratio;
|
|
800
|
-
var dy = d * Math.sin(angle - this.hue / 180 * Math.PI) * ratio;
|
|
801
|
-
var radius = this.internalRadius;
|
|
802
|
-
var saturation = 1 - (Math.min(radius * sin30, Math.max(-radius, dy)) + radius) / (radius + radius * sin30);
|
|
803
|
-
var lightness = (Math.min(radius * cos30 * (1 - saturation), Math.max(-radius * cos30 * (1 - saturation), dx)) + radius * cos30) / (radius * 2 * cos30);
|
|
804
|
-
this.saturation = Math.round(saturation * 1000) / 1000;
|
|
805
|
-
this.lightness = 1 - Math.round(lightness * 1000) / 1000;
|
|
806
|
-
} else {
|
|
807
|
-
this.hue = Math.round(angle / Math.PI * 180 + 90) % 360;
|
|
808
|
-
}
|
|
809
|
-
|
|
810
|
-
this.emitColor();
|
|
811
|
-
},
|
|
812
|
-
startMouseCapture: function startMouseCapture(event) {
|
|
813
|
-
event.stopPropagation();
|
|
814
|
-
this.captureMouse = true;
|
|
815
|
-
|
|
816
|
-
if (event.target.closest('.colorpicker-triangle-slider-sl') !== null) {
|
|
817
|
-
this.captureType = 'sl';
|
|
818
|
-
} else {
|
|
819
|
-
this.captureType = 'hue';
|
|
820
|
-
}
|
|
821
|
-
},
|
|
822
|
-
stopMouseCapture: function stopMouseCapture(event) {
|
|
823
|
-
if (this.captureMouse !== false) {
|
|
824
|
-
event.preventDefault();
|
|
825
|
-
event.stopPropagation();
|
|
826
|
-
this.$refs[this.captureType === 'sl' ? 'slCursor' : 'hueCursor'].focus();
|
|
827
|
-
}
|
|
828
|
-
|
|
829
|
-
this.captureMouse = false;
|
|
830
|
-
},
|
|
831
|
-
emitColor: function emitColor() {
|
|
832
|
-
var hue = this.hue,
|
|
833
|
-
saturation = this.saturation,
|
|
834
|
-
lightness = this.lightness;
|
|
835
|
-
this.$emit('input', Color.fromHSL(hue, saturation, lightness));
|
|
836
|
-
window.clearTimeout(this.debounce);
|
|
837
|
-
}
|
|
838
|
-
},
|
|
839
|
-
mounted: function mounted() {
|
|
840
|
-
window.addEventListener('mousemove', this.trackMouse);
|
|
841
|
-
window.addEventListener('touchmove', this.trackMouse, {
|
|
842
|
-
passive: false
|
|
843
|
-
});
|
|
844
|
-
window.addEventListener('mouseup', this.stopMouseCapture);
|
|
845
|
-
window.addEventListener('touchend', this.stopMouseCapture);
|
|
846
|
-
},
|
|
847
|
-
beforeDestroy: function beforeDestroy() {
|
|
848
|
-
window.removeEventListener('mousemove', this.trackMouse);
|
|
849
|
-
window.removeEventListener('touchmove', this.trackMouse);
|
|
850
|
-
window.removeEventListener('mouseup', this.stopMouseCapture);
|
|
851
|
-
window.removeEventListener('touchend', this.stopMouseCapture);
|
|
852
|
-
}
|
|
853
|
-
};
|
|
854
|
-
|
|
855
|
-
/* script */
|
|
856
|
-
const __vue_script__ = script;
|
|
857
|
-
|
|
858
|
-
/* template */
|
|
859
|
-
var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('svg',{staticClass:"b-colorpicker-triangle",attrs:{"viewBox":_vm.viewBox}},[_c('defs',[_c('linearGradient',{attrs:{"id":("cp-triangle-gradient-ligthness-" + _vm.id),"x1":"0","y1":"0","x2":"1","y2":"0"}},[_c('stop',{attrs:{"offset":"0%","stop-color":"#fff"}}),_c('stop',{attrs:{"offset":"100%","stop-color":"#000"}})],1),_c('linearGradient',{attrs:{"id":("cp-triangle-gradient-saturation-" + _vm.id),"x1":"0","y1":"0","x2":"0","y2":"1"}},[_c('stop',{attrs:{"offset":"0%","stop-color":("hsl(" + _vm.hue + "deg, 100%, 50%)"),"stop-opacity":"1"}}),_c('stop',{attrs:{"offset":"100%","stop-color":("hsl(" + _vm.hue + "deg, 100%, 50%)"),"stop-opacity":"0"}})],1),_c('clipPath',{attrs:{"id":("cp-triangle-clip-" + _vm.id)}},[_c('path',{attrs:{"d":_vm.haloPath}})])],1),_c('g',{staticClass:"colorpicker-triangle-slider-hue"},[_c('foreignObject',{attrs:{"x":0,"y":0,"width":_vm.size,"height":_vm.size,"clip-path":("url(#cp-triangle-clip-" + _vm.id + ")")}},[_c('div',{staticClass:"colorpicker-triangle-hue",on:{"click":_vm.clickHue,"mousedown":function($event){$event.preventDefault();return _vm.startMouseCapture($event)},"touchstart":function($event){$event.preventDefault();return _vm.startMouseCapture($event)}}})]),_c('g',{style:(("transform: rotate(" + _vm.hue + "deg)"))},[_c('foreignObject',{attrs:{"x":_vm.size / 2 - 4,"y":0,"width":"8","height":_vm.thickness + 4}},[_c('div',{ref:"hueCursor",staticClass:"hue-range-thumb",style:(("background-color: hsl(" + _vm.hue + "deg, 100%, 50%)")),attrs:{"role":"slider","tabindex":"0","aria-label":"Hue","aria-valuemin":"0","aria-valuenow":_vm.hue,"aria-valuemax":"360"},on:{"click":_vm.clickHue,"keydown":_vm.hueKeyPress,"mousedown":function($event){$event.preventDefault();return _vm.startMouseCapture($event)},"touchstart":function($event){$event.preventDefault();return _vm.startMouseCapture($event)}}})])],1)],1),_c('g',{staticClass:"colorpicker-triangle-slider-sl",style:(("transform: rotate(" + _vm.hue + "deg) translate(50%, 50%)")),attrs:{"role":"graphics-datagroup","aria-datascales":"lightness, saturation"}},[_c('path',{attrs:{"d":_vm.trianglePath,"fill":("url(#cp-triangle-gradient-ligthness-" + _vm.id + ")")}}),_c('path',{staticStyle:{"mix-blend-mode":"overlay"},attrs:{"d":_vm.trianglePath,"fill":("url(#cp-triangle-gradient-saturation-" + _vm.id + ")")},on:{"click":_vm.clickSL,"mousedown":function($event){$event.preventDefault();return _vm.startMouseCapture($event)},"touchstart":function($event){$event.preventDefault();return _vm.startMouseCapture($event)}}}),_c('foreignObject',{attrs:{"x":((_vm.internalRadius - 3) * _vm.cos30) * (-_vm.lightness + 0.5) * 2 - 6,"y":-_vm.internalRadius + (1 - _vm.saturation) * (_vm.internalRadius - 3) * 1.5 - 3,"width":"12","height":"12"}},[_c('div',{ref:"slCursor",staticClass:"sl-range-thumb",style:({
|
|
860
|
-
backgroundColor: ("hsl(" + _vm.hue + "deg, " + (_vm.saturation * 100) + "%, " + (_vm.lightness * 100) + "%)")
|
|
861
|
-
}),attrs:{"tabindex":"0","aria-datavalues":((_vm.saturation * 100) + "%, " + (_vm.lightness * 100) + "%")},on:{"click":_vm.clickSL,"keydown":_vm.slKeyPress,"mousedown":function($event){$event.preventDefault();return _vm.startMouseCapture($event)},"touchstart":function($event){$event.preventDefault();return _vm.startMouseCapture($event)}}})])],1)])};
|
|
862
|
-
var __vue_staticRenderFns__ = [];
|
|
863
|
-
|
|
864
|
-
/* style */
|
|
865
|
-
const __vue_inject_styles__ = undefined;
|
|
866
|
-
/* scoped */
|
|
867
|
-
const __vue_scope_id__ = undefined;
|
|
868
|
-
/* module identifier */
|
|
869
|
-
const __vue_module_identifier__ = undefined;
|
|
870
|
-
/* functional template */
|
|
871
|
-
const __vue_is_functional_template__ = false;
|
|
872
|
-
/* style inject */
|
|
873
|
-
|
|
874
|
-
/* style inject SSR */
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
var ColorpickerHSLRepresentationTriangle = __vue_normalize__(
|
|
879
|
-
{ render: __vue_render__, staticRenderFns: __vue_staticRenderFns__ },
|
|
880
|
-
__vue_inject_styles__,
|
|
881
|
-
__vue_script__,
|
|
882
|
-
__vue_scope_id__,
|
|
883
|
-
__vue_is_functional_template__,
|
|
884
|
-
__vue_module_identifier__,
|
|
885
|
-
undefined,
|
|
886
|
-
undefined
|
|
887
|
-
);
|
|
888
|
-
|
|
889
|
-
function _templateObject3() {
|
|
890
|
-
var data = _taggedTemplateLiteral(["", "px"]);
|
|
891
|
-
|
|
892
|
-
_templateObject3 = function _templateObject3() {
|
|
893
|
-
return data;
|
|
894
|
-
};
|
|
895
|
-
|
|
896
|
-
return data;
|
|
897
|
-
}
|
|
898
|
-
|
|
899
|
-
function _templateObject2() {
|
|
900
|
-
var data = _taggedTemplateLiteral(["", "px"]);
|
|
901
|
-
|
|
902
|
-
_templateObject2 = function _templateObject2() {
|
|
903
|
-
return data;
|
|
904
|
-
};
|
|
905
|
-
|
|
906
|
-
return data;
|
|
907
|
-
}
|
|
908
|
-
|
|
909
|
-
function _templateObject() {
|
|
910
|
-
var data = _taggedTemplateLiteral(["", "px"]);
|
|
911
|
-
|
|
912
|
-
_templateObject = function _templateObject() {
|
|
913
|
-
return data;
|
|
914
|
-
};
|
|
915
|
-
|
|
916
|
-
return data;
|
|
917
|
-
}
|
|
918
|
-
|
|
919
|
-
var precision = function precision(strs) {
|
|
920
|
-
for (var _len = arguments.length, values = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
921
|
-
values[_key - 1] = arguments[_key];
|
|
922
|
-
}
|
|
923
|
-
|
|
924
|
-
var tmp = [];
|
|
925
|
-
strs.forEach(function (str, i) {
|
|
926
|
-
tmp.push(str);
|
|
927
|
-
|
|
928
|
-
if (values[i]) {
|
|
929
|
-
tmp.push(Number.isNaN(values[i] / 1) ? values[i] : Math.round(values * 10) / 10);
|
|
930
|
-
}
|
|
931
|
-
});
|
|
932
|
-
return tmp.join('');
|
|
933
|
-
};
|
|
934
|
-
|
|
935
|
-
var script$1 = {
|
|
936
|
-
name: 'BColorpickerHSLRepresentationSquare',
|
|
937
|
-
props: {
|
|
938
|
-
value: {
|
|
939
|
-
type: Object,
|
|
940
|
-
required: true,
|
|
941
|
-
validator: function validator(value) {
|
|
942
|
-
return typeof value.hue === 'number' && typeof value.saturation === 'number' && typeof value.lightness === 'number';
|
|
943
|
-
}
|
|
944
|
-
},
|
|
945
|
-
size: {
|
|
946
|
-
type: Number,
|
|
947
|
-
default: 200
|
|
948
|
-
},
|
|
949
|
-
thickness: {
|
|
950
|
-
type: Number,
|
|
951
|
-
default: 20
|
|
952
|
-
}
|
|
953
|
-
},
|
|
954
|
-
data: function data() {
|
|
955
|
-
return {
|
|
956
|
-
hue: this.value.hue,
|
|
957
|
-
saturation: this.value.saturation,
|
|
958
|
-
lightness: this.value.lightness,
|
|
959
|
-
captureMouse: false,
|
|
960
|
-
captureType: 'hue',
|
|
961
|
-
clientOffset: {
|
|
962
|
-
cx: -1,
|
|
963
|
-
cy: -1,
|
|
964
|
-
width: 0,
|
|
965
|
-
height: 0
|
|
966
|
-
},
|
|
967
|
-
debounce: 0
|
|
968
|
-
};
|
|
969
|
-
},
|
|
970
|
-
computed: {
|
|
971
|
-
hueThumbStyle: function hueThumbStyle() {
|
|
972
|
-
var hue = this.hue,
|
|
973
|
-
size = this.size,
|
|
974
|
-
thickness = this.thickness;
|
|
975
|
-
var side = size - thickness;
|
|
976
|
-
var offset = size / 2;
|
|
977
|
-
var angle = (hue + 720 + 90) % 360 / 180 * Math.PI;
|
|
978
|
-
var ciq = 1 / Math.cos(Math.PI / 4);
|
|
979
|
-
var _x$y = {
|
|
980
|
-
x: -Math.min(1, Math.max(-1, ciq * Math.cos(angle))) / 2 * side + offset,
|
|
981
|
-
y: -Math.min(1, Math.max(-1, ciq * Math.sin(angle))) / 2 * side + offset
|
|
982
|
-
},
|
|
983
|
-
x = _x$y.x,
|
|
984
|
-
y = _x$y.y;
|
|
985
|
-
return {
|
|
986
|
-
background: "hsl(".concat(hue, "deg, 100%, 50%)"),
|
|
987
|
-
left: precision(_templateObject(), x),
|
|
988
|
-
top: precision(_templateObject2(), y),
|
|
989
|
-
width: precision(_templateObject3(), thickness - 2)
|
|
990
|
-
};
|
|
991
|
-
},
|
|
992
|
-
slThumbStyle: function slThumbStyle() {
|
|
993
|
-
var hue = this.hue,
|
|
994
|
-
saturation = this.saturation,
|
|
995
|
-
lightness = this.lightness;
|
|
996
|
-
saturation = Math.max(0, Math.min(1, saturation));
|
|
997
|
-
lightness = Math.max(0, Math.min(1, lightness));
|
|
998
|
-
return {
|
|
999
|
-
background: "hsl(".concat(hue, "deg, ").concat(saturation * 100, "%, ").concat(lightness * 100, "%)"),
|
|
1000
|
-
left: "".concat(saturation * 100, "%"),
|
|
1001
|
-
top: "".concat((1 - lightness) * 100, "%")
|
|
1002
|
-
};
|
|
1003
|
-
},
|
|
1004
|
-
SLBackground: function SLBackground() {
|
|
1005
|
-
var hue = this.hue;
|
|
1006
|
-
return "linear-gradient(90deg, hsl(".concat(hue, "deg, 0%, 50%), hsl(").concat(hue, "deg, 100%, 50%))");
|
|
1007
|
-
}
|
|
1008
|
-
},
|
|
1009
|
-
watch: {
|
|
1010
|
-
captureMouse: function captureMouse(newValue, oldValue) {
|
|
1011
|
-
if (oldValue === false && newValue !== false) {
|
|
1012
|
-
var rect = this.$el.getBoundingClientRect(); // Caching offset
|
|
1013
|
-
|
|
1014
|
-
this.clientOffset.cx = rect.x + rect.width / 2;
|
|
1015
|
-
this.clientOffset.cy = rect.y + rect.height / 2;
|
|
1016
|
-
this.clientOffset.width = rect.width;
|
|
1017
|
-
this.clientOffset.height = rect.height;
|
|
1018
|
-
}
|
|
1019
|
-
},
|
|
1020
|
-
value: {
|
|
1021
|
-
deep: true,
|
|
1022
|
-
handler: function handler(newColor) {
|
|
1023
|
-
var _this = this;
|
|
1024
|
-
|
|
1025
|
-
var hue = newColor.hue,
|
|
1026
|
-
saturation = newColor.saturation,
|
|
1027
|
-
lightness = newColor.lightness;
|
|
1028
|
-
window.clearTimeout(this.debounce);
|
|
1029
|
-
this.debounce = window.setTimeout(function () {
|
|
1030
|
-
_this.hue = hue;
|
|
1031
|
-
_this.saturation = saturation;
|
|
1032
|
-
_this.lightness = lightness;
|
|
1033
|
-
}, 200);
|
|
1034
|
-
}
|
|
1035
|
-
}
|
|
1036
|
-
},
|
|
1037
|
-
methods: {
|
|
1038
|
-
increaseHue: function increaseHue() {
|
|
1039
|
-
var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;
|
|
1040
|
-
this.hue = (this.hue + value) % 360;
|
|
1041
|
-
},
|
|
1042
|
-
decreaseHue: function decreaseHue() {
|
|
1043
|
-
var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;
|
|
1044
|
-
this.hue = (360 + this.hue - value) % 360;
|
|
1045
|
-
},
|
|
1046
|
-
increaseSaturation: function increaseSaturation() {
|
|
1047
|
-
var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0.01;
|
|
1048
|
-
this.saturation = Math.min(1, Math.max(0, this.saturation + value));
|
|
1049
|
-
this.lightness = Math.min(0.5 + (1 - this.saturation) * 0.5, Math.max(0.5 - (1 - this.saturation) * 0.5, this.lightness));
|
|
1050
|
-
},
|
|
1051
|
-
decreaseSaturation: function decreaseSaturation() {
|
|
1052
|
-
var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0.01;
|
|
1053
|
-
this.saturation = Math.min(1, Math.max(0, this.saturation - value));
|
|
1054
|
-
this.lightness = Math.min(0.5 + (1 - this.saturation) * 0.5, Math.max(0.5 - (1 - this.saturation) * 0.5, this.lightness));
|
|
1055
|
-
},
|
|
1056
|
-
increaseLightness: function increaseLightness() {
|
|
1057
|
-
var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0.01;
|
|
1058
|
-
this.lightness = Math.min(0.5 + (1 - this.saturation) * 0.5, Math.max(0.5 - (1 - this.saturation) * 0.5, this.lightness + value));
|
|
1059
|
-
},
|
|
1060
|
-
decreaseLightness: function decreaseLightness() {
|
|
1061
|
-
var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0.01;
|
|
1062
|
-
this.lightness = Math.min(0.5 + (1 - this.saturation) * 0.5, Math.max(0.5 - (1 - this.saturation) * 0.5, this.lightness - value));
|
|
1063
|
-
},
|
|
1064
|
-
hueKeyPress: function hueKeyPress(event) {
|
|
1065
|
-
var handled = false;
|
|
1066
|
-
|
|
1067
|
-
switch (event.key) {
|
|
1068
|
-
case 'ArrowRight':
|
|
1069
|
-
case 'ArrowUp':
|
|
1070
|
-
this.increaseHue();
|
|
1071
|
-
handled = true;
|
|
1072
|
-
break;
|
|
1073
|
-
|
|
1074
|
-
case 'ArrowLeft':
|
|
1075
|
-
case 'ArrowDown':
|
|
1076
|
-
this.decreaseHue();
|
|
1077
|
-
handled = true;
|
|
1078
|
-
break;
|
|
1079
|
-
|
|
1080
|
-
case 'Home':
|
|
1081
|
-
this.increaseHue(360 - this.hue);
|
|
1082
|
-
handled = true;
|
|
1083
|
-
break;
|
|
1084
|
-
|
|
1085
|
-
case 'End':
|
|
1086
|
-
this.decreaseHue(this.hue);
|
|
1087
|
-
handled = true;
|
|
1088
|
-
break;
|
|
1089
|
-
|
|
1090
|
-
case 'PageUp':
|
|
1091
|
-
this.increaseHue(60 - this.hue % 60);
|
|
1092
|
-
handled = true;
|
|
1093
|
-
break;
|
|
1094
|
-
|
|
1095
|
-
case 'PageDown':
|
|
1096
|
-
this.decreaseHue(60 + this.hue % 60);
|
|
1097
|
-
handled = true;
|
|
1098
|
-
break;
|
|
1099
|
-
}
|
|
1100
|
-
|
|
1101
|
-
if (handled) {
|
|
1102
|
-
event.preventDefault();
|
|
1103
|
-
event.stopPropagation();
|
|
1104
|
-
this.emitColor();
|
|
1105
|
-
}
|
|
1106
|
-
},
|
|
1107
|
-
slKeyPress: function slKeyPress(event) {
|
|
1108
|
-
var handled = false;
|
|
1109
|
-
|
|
1110
|
-
switch (event.key) {
|
|
1111
|
-
case 'ArrowRight':
|
|
1112
|
-
this.increaseSaturation();
|
|
1113
|
-
handled = true;
|
|
1114
|
-
break;
|
|
1115
|
-
|
|
1116
|
-
case 'ArrowUp':
|
|
1117
|
-
this.increaseLightness();
|
|
1118
|
-
handled = true;
|
|
1119
|
-
break;
|
|
1120
|
-
|
|
1121
|
-
case 'ArrowLeft':
|
|
1122
|
-
this.decreaseSaturation();
|
|
1123
|
-
handled = true;
|
|
1124
|
-
break;
|
|
1125
|
-
|
|
1126
|
-
case 'ArrowDown':
|
|
1127
|
-
this.decreaseLightness();
|
|
1128
|
-
handled = true;
|
|
1129
|
-
break;
|
|
1130
|
-
|
|
1131
|
-
case 'Home':
|
|
1132
|
-
this.increaseLightness(1 - this.lightness);
|
|
1133
|
-
handled = true;
|
|
1134
|
-
break;
|
|
1135
|
-
|
|
1136
|
-
case 'End':
|
|
1137
|
-
this.decreaseLightness(this.lightness);
|
|
1138
|
-
handled = true;
|
|
1139
|
-
break;
|
|
1140
|
-
|
|
1141
|
-
case 'PageUp':
|
|
1142
|
-
this.increaseSaturation(1 - this.saturation);
|
|
1143
|
-
handled = true;
|
|
1144
|
-
break;
|
|
1145
|
-
|
|
1146
|
-
case 'PageDown':
|
|
1147
|
-
this.decreaseSaturation(this.saturation);
|
|
1148
|
-
handled = true;
|
|
1149
|
-
break;
|
|
1150
|
-
}
|
|
1151
|
-
|
|
1152
|
-
if (handled) {
|
|
1153
|
-
event.preventDefault();
|
|
1154
|
-
event.stopPropagation();
|
|
1155
|
-
this.emitColor();
|
|
1156
|
-
}
|
|
1157
|
-
},
|
|
1158
|
-
startMouseCapture: function startMouseCapture(event) {
|
|
1159
|
-
event.stopPropagation();
|
|
1160
|
-
this.captureMouse = true;
|
|
1161
|
-
|
|
1162
|
-
if (event.target.closest('.colorpicker-square-slider-sl') !== null) {
|
|
1163
|
-
this.captureType = 'sl';
|
|
1164
|
-
} else {
|
|
1165
|
-
this.captureType = 'hue';
|
|
1166
|
-
}
|
|
1167
|
-
},
|
|
1168
|
-
stopMouseCapture: function stopMouseCapture(event) {
|
|
1169
|
-
if (this.captureMouse !== false) {
|
|
1170
|
-
event.preventDefault();
|
|
1171
|
-
event.stopPropagation();
|
|
1172
|
-
this.$refs[this.captureType === 'sl' ? 'slCursor' : 'hueCursor'].focus();
|
|
1173
|
-
}
|
|
1174
|
-
|
|
1175
|
-
this.captureMouse = false;
|
|
1176
|
-
},
|
|
1177
|
-
clickHue: function clickHue(event) {
|
|
1178
|
-
this.startMouseCapture(event);
|
|
1179
|
-
this.trackMouse(event);
|
|
1180
|
-
this.stopMouseCapture(event);
|
|
1181
|
-
this.$refs.hueCursor.focus();
|
|
1182
|
-
},
|
|
1183
|
-
clickSL: function clickSL(event) {
|
|
1184
|
-
this.startMouseCapture(event);
|
|
1185
|
-
this.trackMouse(event);
|
|
1186
|
-
this.stopMouseCapture(event);
|
|
1187
|
-
this.$refs.slCursor.focus();
|
|
1188
|
-
},
|
|
1189
|
-
trackMouse: function trackMouse(event) {
|
|
1190
|
-
if (this.captureMouse === false) {
|
|
1191
|
-
return;
|
|
1192
|
-
}
|
|
1193
|
-
|
|
1194
|
-
event.preventDefault();
|
|
1195
|
-
event.stopPropagation();
|
|
1196
|
-
var mouseX = 0,
|
|
1197
|
-
mouseY = 0;
|
|
1198
|
-
|
|
1199
|
-
if (typeof event.touches !== 'undefined' && event.touches.length) {
|
|
1200
|
-
var _ref = [event.touches[0].clientX, event.touches[0].clientY];
|
|
1201
|
-
mouseX = _ref[0];
|
|
1202
|
-
mouseY = _ref[1];
|
|
1203
|
-
} else {
|
|
1204
|
-
var _ref2 = [event.clientX, event.clientY];
|
|
1205
|
-
mouseX = _ref2[0];
|
|
1206
|
-
mouseY = _ref2[1];
|
|
1207
|
-
}
|
|
1208
|
-
|
|
1209
|
-
var angle = Math.atan2(mouseY - this.clientOffset.cy, mouseX - this.clientOffset.cx);
|
|
1210
|
-
|
|
1211
|
-
if (this.captureType === 'sl') {
|
|
1212
|
-
var saturation = (mouseX - this.clientOffset.cx) / (this.clientOffset.width - this.thickness * 2) + 0.5;
|
|
1213
|
-
var lightness = (mouseY - this.clientOffset.cy) / (this.clientOffset.height - this.thickness * 2) + 0.5;
|
|
1214
|
-
this.saturation = Math.round(Math.min(1, Math.max(0, saturation)) * 1000) / 1000;
|
|
1215
|
-
this.lightness = 1 - Math.round(Math.min(1, Math.max(0, lightness)) * 1000) / 1000;
|
|
1216
|
-
} else {
|
|
1217
|
-
this.hue = Math.round(angle / Math.PI * 180 + 90) % 360;
|
|
1218
|
-
}
|
|
1219
|
-
|
|
1220
|
-
this.emitColor();
|
|
1221
|
-
},
|
|
1222
|
-
emitColor: function emitColor() {
|
|
1223
|
-
var hue = this.hue,
|
|
1224
|
-
saturation = this.saturation,
|
|
1225
|
-
lightness = this.lightness;
|
|
1226
|
-
this.$emit('input', Color.fromHSL(hue, saturation, lightness));
|
|
1227
|
-
window.clearTimeout(this.debounce);
|
|
1228
|
-
}
|
|
1229
|
-
},
|
|
1230
|
-
mounted: function mounted() {
|
|
1231
|
-
window.addEventListener('mousemove', this.trackMouse);
|
|
1232
|
-
window.addEventListener('touchmove', this.trackMouse, {
|
|
1233
|
-
passive: false
|
|
1234
|
-
});
|
|
1235
|
-
window.addEventListener('mouseup', this.stopMouseCapture);
|
|
1236
|
-
window.addEventListener('touchend', this.stopMouseCapture);
|
|
1237
|
-
},
|
|
1238
|
-
beforeDestroy: function beforeDestroy() {
|
|
1239
|
-
window.removeEventListener('mousemove', this.trackMouse);
|
|
1240
|
-
window.removeEventListener('touchmove', this.trackMouse);
|
|
1241
|
-
window.removeEventListener('mouseup', this.stopMouseCapture);
|
|
1242
|
-
window.removeEventListener('touchend', this.stopMouseCapture);
|
|
1243
|
-
}
|
|
1244
|
-
};
|
|
1245
|
-
|
|
1246
|
-
/* script */
|
|
1247
|
-
const __vue_script__$1 = script$1;
|
|
1248
|
-
|
|
1249
|
-
/* template */
|
|
1250
|
-
var __vue_render__$1 = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"b-colorpicker-square",style:({ width: (_vm.size + "px") })},[_c('div',{staticClass:"colorpicker-square-slider-hue",on:{"click":_vm.clickHue,"mousedown":function($event){$event.preventDefault();return _vm.startMouseCapture($event)},"touchstart":function($event){$event.preventDefault();return _vm.startMouseCapture($event)}}},[_c('div',{ref:"hueCursor",staticClass:"hue-range-thumb",style:(_vm.hueThumbStyle),attrs:{"role":"slider","tabindex":"0","aria-label":"Hue","aria-valuemin":"0","aria-valuemax":"359"}})]),_c('div',{staticClass:"colorpicker-square-slider-sl",style:({
|
|
1251
|
-
background: _vm.SLBackground,
|
|
1252
|
-
margin: (_vm.thickness + "px")
|
|
1253
|
-
}),attrs:{"aria-datascales":"lightness, saturation"},on:{"click":_vm.clickSL,"mousedown":function($event){$event.preventDefault();return _vm.startMouseCapture($event)},"touchstart":function($event){$event.preventDefault();return _vm.startMouseCapture($event)}}},[_c('div',{ref:"slCursor",staticClass:"sl-range-thumb",style:(_vm.slThumbStyle),attrs:{"role":"slider","tabindex":"0","aria-datavalues":((_vm.saturation * 100) + "%, " + (_vm.lightness * 100) + "%")},on:{"click":_vm.clickSL,"keydown":_vm.slKeyPress,"mousedown":function($event){$event.preventDefault();return _vm.startMouseCapture($event)},"touchstart":function($event){$event.preventDefault();return _vm.startMouseCapture($event)}}})])])};
|
|
1254
|
-
var __vue_staticRenderFns__$1 = [];
|
|
1255
|
-
|
|
1256
|
-
/* style */
|
|
1257
|
-
const __vue_inject_styles__$1 = undefined;
|
|
1258
|
-
/* scoped */
|
|
1259
|
-
const __vue_scope_id__$1 = undefined;
|
|
1260
|
-
/* module identifier */
|
|
1261
|
-
const __vue_module_identifier__$1 = undefined;
|
|
1262
|
-
/* functional template */
|
|
1263
|
-
const __vue_is_functional_template__$1 = false;
|
|
1264
|
-
/* style inject */
|
|
1265
|
-
|
|
1266
|
-
/* style inject SSR */
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
var ColorpickerHSLRepresentationSquare = __vue_normalize__(
|
|
1271
|
-
{ render: __vue_render__$1, staticRenderFns: __vue_staticRenderFns__$1 },
|
|
1272
|
-
__vue_inject_styles__$1,
|
|
1273
|
-
__vue_script__$1,
|
|
1274
|
-
__vue_scope_id__$1,
|
|
1275
|
-
__vue_is_functional_template__$1,
|
|
1276
|
-
__vue_module_identifier__$1,
|
|
1277
|
-
undefined,
|
|
1278
|
-
undefined
|
|
1279
|
-
);
|
|
1280
|
-
|
|
1281
|
-
var script$2 = {
|
|
1282
|
-
name: 'BColorpickerAlphaSlider',
|
|
1283
|
-
components: _defineProperty({}, Tooltip.name, Tooltip),
|
|
1284
|
-
props: {
|
|
1285
|
-
value: {
|
|
1286
|
-
type: Number,
|
|
1287
|
-
validator: function validator(value) {
|
|
1288
|
-
return value >= 0 && value < 256;
|
|
1289
|
-
}
|
|
1290
|
-
},
|
|
1291
|
-
color: [String, Object]
|
|
1292
|
-
},
|
|
1293
|
-
data: function data() {
|
|
1294
|
-
var color = Color.parse(this.color);
|
|
1295
|
-
color.alpha = 0;
|
|
1296
|
-
return {
|
|
1297
|
-
startColor: color.toString('hex'),
|
|
1298
|
-
endColor: color.toString('hexa'),
|
|
1299
|
-
percent: Math.round((1 - this.value / 255) * 100),
|
|
1300
|
-
captureMouse: false,
|
|
1301
|
-
clientOffset: {
|
|
1302
|
-
cx: -1,
|
|
1303
|
-
cy: -1,
|
|
1304
|
-
width: 0,
|
|
1305
|
-
height: 0
|
|
1306
|
-
}
|
|
1307
|
-
};
|
|
1308
|
-
},
|
|
1309
|
-
computed: {
|
|
1310
|
-
style: function style() {
|
|
1311
|
-
return {
|
|
1312
|
-
backgroundImage: "linear-gradient(90deg, ".concat(this.startColor, " 0%, ").concat(this.endColor, " 100%),\n linear-gradient(45deg, #c7c7c7 25%, transparent 25%, transparent 75%, #c7c7c7 75%, #c7c7c7),\n linear-gradient(45deg, #c7c7c7 25%, transparent 25%, transparent 75%, #c7c7c7 75%, #c7c7c7)"),
|
|
1313
|
-
backgroundSize: '100% 100%, 1em 1em, 1em 1em',
|
|
1314
|
-
backgroundPosition: '0 0, .5em .5em, 0 0'
|
|
1315
|
-
};
|
|
1316
|
-
}
|
|
1317
|
-
},
|
|
1318
|
-
watch: {
|
|
1319
|
-
value: function value(newValue, oldValue) {
|
|
1320
|
-
if (newValue !== oldValue) {
|
|
1321
|
-
this.percent = Math.round((1 - newValue / 255) * 100);
|
|
1322
|
-
}
|
|
1323
|
-
},
|
|
1324
|
-
color: function color(newColor) {
|
|
1325
|
-
var color = Color.parse(newColor);
|
|
1326
|
-
color.alpha = 0;
|
|
1327
|
-
this.startColor = color.toString('hex');
|
|
1328
|
-
this.endColor = color.toString('hexa');
|
|
1329
|
-
},
|
|
1330
|
-
captureMouse: function captureMouse(newValue, oldValue) {
|
|
1331
|
-
if (oldValue === false && newValue !== false) {
|
|
1332
|
-
var rect = this.$el.getBoundingClientRect(); // Caching offset
|
|
1333
|
-
|
|
1334
|
-
this.clientOffset.cx = rect.x + rect.width / 2;
|
|
1335
|
-
this.clientOffset.cy = rect.y + rect.height / 2;
|
|
1336
|
-
this.clientOffset.width = rect.width;
|
|
1337
|
-
this.clientOffset.height = rect.height;
|
|
1338
|
-
}
|
|
1339
|
-
}
|
|
1340
|
-
},
|
|
1341
|
-
methods: {
|
|
1342
|
-
increaseAlpha: function increaseAlpha() {
|
|
1343
|
-
var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;
|
|
1344
|
-
this.percent = Math.max(0, Math.min(100, this.percent + value));
|
|
1345
|
-
},
|
|
1346
|
-
decreaseAlpha: function decreaseAlpha() {
|
|
1347
|
-
var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0.01;
|
|
1348
|
-
this.increaseAlpha(-value);
|
|
1349
|
-
},
|
|
1350
|
-
alphaKeyPress: function alphaKeyPress(event) {
|
|
1351
|
-
var handled = false;
|
|
1352
|
-
|
|
1353
|
-
switch (event.key) {
|
|
1354
|
-
case 'ArrowRight':
|
|
1355
|
-
case 'ArrowUp':
|
|
1356
|
-
this.increaseAlpha();
|
|
1357
|
-
handled = true;
|
|
1358
|
-
break;
|
|
1359
|
-
|
|
1360
|
-
case 'ArrowLeft':
|
|
1361
|
-
case 'ArrowDown':
|
|
1362
|
-
this.decreaseAlpha();
|
|
1363
|
-
handled = true;
|
|
1364
|
-
break;
|
|
1365
|
-
|
|
1366
|
-
case 'Home':
|
|
1367
|
-
this.decreaseAlpha(this.percent);
|
|
1368
|
-
handled = true;
|
|
1369
|
-
break;
|
|
1370
|
-
|
|
1371
|
-
case 'End':
|
|
1372
|
-
this.increaseAlpha(100 - this.percent);
|
|
1373
|
-
handled = true;
|
|
1374
|
-
break;
|
|
1375
|
-
|
|
1376
|
-
case 'PageUp':
|
|
1377
|
-
this.increaseAlpha(10 - this.percent % 10);
|
|
1378
|
-
handled = true;
|
|
1379
|
-
break;
|
|
1380
|
-
|
|
1381
|
-
case 'PageDown':
|
|
1382
|
-
this.decreaseAlpha(this.percent % 10);
|
|
1383
|
-
handled = true;
|
|
1384
|
-
break;
|
|
1385
|
-
}
|
|
1386
|
-
|
|
1387
|
-
if (handled) {
|
|
1388
|
-
event.preventDefault();
|
|
1389
|
-
event.stopPropagation();
|
|
1390
|
-
this.emitAlpha();
|
|
1391
|
-
}
|
|
1392
|
-
},
|
|
1393
|
-
clickAlpha: function clickAlpha(event) {
|
|
1394
|
-
this.startMouseCapture(event);
|
|
1395
|
-
this.trackMouse(event);
|
|
1396
|
-
this.stopMouseCapture(event);
|
|
1397
|
-
this.$refs.alphaCursor.focus();
|
|
1398
|
-
},
|
|
1399
|
-
startMouseCapture: function startMouseCapture(event) {
|
|
1400
|
-
event.stopPropagation();
|
|
1401
|
-
this.captureMouse = true;
|
|
1402
|
-
},
|
|
1403
|
-
trackMouse: function trackMouse(event) {
|
|
1404
|
-
if (this.captureMouse === false) {
|
|
1405
|
-
return;
|
|
1406
|
-
}
|
|
1407
|
-
|
|
1408
|
-
event.preventDefault();
|
|
1409
|
-
event.stopPropagation();
|
|
1410
|
-
var _ref = [0, 0],
|
|
1411
|
-
mouseX = _ref[0];
|
|
1412
|
-
|
|
1413
|
-
if (typeof event.touches !== 'undefined' && event.touches.length) {
|
|
1414
|
-
var _ref2 = [event.touches[0].clientX];
|
|
1415
|
-
mouseX = _ref2[0];
|
|
1416
|
-
} else {
|
|
1417
|
-
var _ref3 = [event.clientX];
|
|
1418
|
-
mouseX = _ref3[0];
|
|
1419
|
-
}
|
|
1420
|
-
|
|
1421
|
-
var ratio = 0.5 + (this.clientOffset.cx - mouseX) / this.clientOffset.width;
|
|
1422
|
-
this.percent = Math.round(100 - Math.max(0, Math.min(1, ratio)) * 100);
|
|
1423
|
-
this.emitAlpha();
|
|
1424
|
-
},
|
|
1425
|
-
stopMouseCapture: function stopMouseCapture(event) {
|
|
1426
|
-
if (this.captureMouse !== false) {
|
|
1427
|
-
event.preventDefault();
|
|
1428
|
-
event.stopPropagation();
|
|
1429
|
-
this.$refs.alphaCursor.focus();
|
|
1430
|
-
}
|
|
1431
|
-
|
|
1432
|
-
this.captureMouse = false;
|
|
1433
|
-
},
|
|
1434
|
-
emitAlpha: function emitAlpha() {
|
|
1435
|
-
this.$emit('input', (1 - this.percent / 100) * 255);
|
|
1436
|
-
}
|
|
1437
|
-
},
|
|
1438
|
-
mounted: function mounted() {
|
|
1439
|
-
window.addEventListener('mousemove', this.trackMouse);
|
|
1440
|
-
window.addEventListener('touchmove', this.trackMouse, {
|
|
1441
|
-
passive: false
|
|
1442
|
-
});
|
|
1443
|
-
window.addEventListener('mouseup', this.stopMouseCapture);
|
|
1444
|
-
window.addEventListener('touchend', this.stopMouseCapture);
|
|
1445
|
-
},
|
|
1446
|
-
beforeDestroy: function beforeDestroy() {
|
|
1447
|
-
window.removeEventListener('mousemove', this.trackMouse);
|
|
1448
|
-
window.removeEventListener('touchmove', this.trackMouse);
|
|
1449
|
-
window.removeEventListener('mouseup', this.stopMouseCapture);
|
|
1450
|
-
window.removeEventListener('touchend', this.stopMouseCapture);
|
|
1451
|
-
}
|
|
1452
|
-
};
|
|
1453
|
-
|
|
1454
|
-
/* script */
|
|
1455
|
-
const __vue_script__$2 = script$2;
|
|
1456
|
-
|
|
1457
|
-
/* template */
|
|
1458
|
-
var __vue_render__$2 = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"b-colorpicker-alpha-slider",style:(_vm.style),on:{"click":_vm.clickAlpha,"keydown":_vm.alphaKeyPress,"mousedown":_vm.startMouseCapture,"touchstart":function($event){$event.preventDefault();return _vm.startMouseCapture($event)}}},[_c('div',{ref:"alphaCursor",staticClass:"alpha-range-thumb",style:({ left: (_vm.percent + "%") }),attrs:{"role":"slider","tabindex":"0","aria-label":"Tranparency","aria-valuemin":"0","aria-valuenow":_vm.percent,"aria-valuemax":"100"}},[_c('b-tooltip',{attrs:{"label":(_vm.percent + "%"),"always":_vm.captureMouse}})],1)])};
|
|
1459
|
-
var __vue_staticRenderFns__$2 = [];
|
|
1460
|
-
|
|
1461
|
-
/* style */
|
|
1462
|
-
const __vue_inject_styles__$2 = undefined;
|
|
1463
|
-
/* scoped */
|
|
1464
|
-
const __vue_scope_id__$2 = undefined;
|
|
1465
|
-
/* module identifier */
|
|
1466
|
-
const __vue_module_identifier__$2 = undefined;
|
|
1467
|
-
/* functional template */
|
|
1468
|
-
const __vue_is_functional_template__$2 = false;
|
|
1469
|
-
/* style inject */
|
|
1470
|
-
|
|
1471
|
-
/* style inject SSR */
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
var ColorpickerAlphaSlider = __vue_normalize__(
|
|
1476
|
-
{ render: __vue_render__$2, staticRenderFns: __vue_staticRenderFns__$2 },
|
|
1477
|
-
__vue_inject_styles__$2,
|
|
1478
|
-
__vue_script__$2,
|
|
1479
|
-
__vue_scope_id__$2,
|
|
1480
|
-
__vue_is_functional_template__$2,
|
|
1481
|
-
__vue_module_identifier__$2,
|
|
1482
|
-
undefined,
|
|
1483
|
-
undefined
|
|
1484
|
-
);
|
|
1485
|
-
|
|
1486
|
-
var _components;
|
|
1487
|
-
|
|
1488
|
-
var defaultColorFormatter = function defaultColorFormatter(color, vm) {
|
|
1489
|
-
if (color.alpha < 1) {
|
|
1490
|
-
return color.toString('hexa');
|
|
1491
|
-
} else {
|
|
1492
|
-
return color.toString('hex');
|
|
1493
|
-
}
|
|
1494
|
-
};
|
|
1495
|
-
|
|
1496
|
-
var defaultColorParser = function defaultColorParser(color, vm) {
|
|
1497
|
-
return Color.parse(color);
|
|
1498
|
-
};
|
|
1499
|
-
|
|
1500
|
-
var script$3 = {
|
|
1501
|
-
name: 'BColorpicker',
|
|
1502
|
-
components: (_components = {}, _defineProperty(_components, ColorpickerHSLRepresentationTriangle.name, ColorpickerHSLRepresentationTriangle), _defineProperty(_components, ColorpickerHSLRepresentationSquare.name, ColorpickerHSLRepresentationSquare), _defineProperty(_components, ColorpickerAlphaSlider.name, ColorpickerAlphaSlider), _defineProperty(_components, Input.name, Input), _defineProperty(_components, Field.name, Field), _defineProperty(_components, Select.name, Select), _defineProperty(_components, Icon.name, Icon), _defineProperty(_components, Dropdown.name, Dropdown), _defineProperty(_components, DropdownItem.name, DropdownItem), _components),
|
|
1503
|
-
mixins: [FormElementMixin],
|
|
1504
|
-
inheritAttrs: false,
|
|
1505
|
-
provide: function provide() {
|
|
1506
|
-
return {
|
|
1507
|
-
$colorpicker: this
|
|
1508
|
-
};
|
|
1509
|
-
},
|
|
1510
|
-
props: {
|
|
1511
|
-
value: {
|
|
1512
|
-
type: [String, Object],
|
|
1513
|
-
validator: function validator(value) {
|
|
1514
|
-
return typeof value === 'string' || _typeof(value) === 'object' && typeof value.red === 'number' && typeof value.green === 'number' && typeof value.blue === 'number';
|
|
1515
|
-
}
|
|
1516
|
-
},
|
|
1517
|
-
representation: {
|
|
1518
|
-
type: String,
|
|
1519
|
-
default: 'triangle',
|
|
1520
|
-
value: function value(_value) {
|
|
1521
|
-
return ['triangle', 'square'].some(function (r) {
|
|
1522
|
-
return r === _value;
|
|
1523
|
-
});
|
|
1524
|
-
}
|
|
1525
|
-
},
|
|
1526
|
-
inline: Boolean,
|
|
1527
|
-
disabled: Boolean,
|
|
1528
|
-
horizontalColorPicker: {
|
|
1529
|
-
type: Boolean,
|
|
1530
|
-
default: false
|
|
1531
|
-
},
|
|
1532
|
-
colorFormatter: {
|
|
1533
|
-
type: Function,
|
|
1534
|
-
default: function _default(color, vm) {
|
|
1535
|
-
if (typeof config.defaultColorFormatter === 'function') {
|
|
1536
|
-
return config.defaultColorFormatter(color);
|
|
1537
|
-
} else {
|
|
1538
|
-
return defaultColorFormatter(color);
|
|
1539
|
-
}
|
|
1540
|
-
}
|
|
1541
|
-
},
|
|
1542
|
-
colorParser: {
|
|
1543
|
-
type: Function,
|
|
1544
|
-
default: function _default(color, vm) {
|
|
1545
|
-
if (typeof config.defaultColorParser === 'function') {
|
|
1546
|
-
return config.defaultColorParser(color);
|
|
1547
|
-
} else {
|
|
1548
|
-
return defaultColorParser(color);
|
|
1549
|
-
}
|
|
1550
|
-
}
|
|
1551
|
-
},
|
|
1552
|
-
alpha: {
|
|
1553
|
-
type: Boolean,
|
|
1554
|
-
default: false
|
|
1555
|
-
},
|
|
1556
|
-
expanded: Boolean,
|
|
1557
|
-
position: String,
|
|
1558
|
-
mobileModal: {
|
|
1559
|
-
type: Boolean,
|
|
1560
|
-
default: function _default() {
|
|
1561
|
-
return config.defaultDatepickerMobileModal;
|
|
1562
|
-
}
|
|
1563
|
-
},
|
|
1564
|
-
focusable: {
|
|
1565
|
-
type: Boolean,
|
|
1566
|
-
default: true
|
|
1567
|
-
},
|
|
1568
|
-
trapFocus: {
|
|
1569
|
-
type: Boolean,
|
|
1570
|
-
default: function _default() {
|
|
1571
|
-
return config.defaultTrapFocus;
|
|
1572
|
-
}
|
|
1573
|
-
},
|
|
1574
|
-
appendToBody: Boolean
|
|
1575
|
-
},
|
|
1576
|
-
data: function data() {
|
|
1577
|
-
var color = this.colorParser(this.value);
|
|
1578
|
-
return {
|
|
1579
|
-
colorSelected: color
|
|
1580
|
-
};
|
|
1581
|
-
},
|
|
1582
|
-
computed: {
|
|
1583
|
-
background: function background() {
|
|
1584
|
-
if (this.alpha) {
|
|
1585
|
-
return "linear-gradient(\n 45deg,\n ".concat(this.colorSelected.toString('hex'), " 50%,\n ").concat(this.colorSelected.toString('hexa'), " 50%\n )");
|
|
1586
|
-
} else {
|
|
1587
|
-
var hex = this.colorSelected.toString('hex');
|
|
1588
|
-
return "linear-gradient(\n 45deg,\n ".concat(hex, " 50%,\n ").concat(hex, " 50%\n )");
|
|
1589
|
-
}
|
|
1590
|
-
},
|
|
1591
|
-
triggerStyle: function triggerStyle() {
|
|
1592
|
-
var _this$colorSelected = this.colorSelected,
|
|
1593
|
-
red = _this$colorSelected.red,
|
|
1594
|
-
green = _this$colorSelected.green,
|
|
1595
|
-
blue = _this$colorSelected.blue;
|
|
1596
|
-
var light = red * 0.299 + green * 0.587 + blue * 0.114 > 186;
|
|
1597
|
-
return {
|
|
1598
|
-
backgroundColor: '#ffffff',
|
|
1599
|
-
backgroundImage: "\n ".concat(this.background, ",\n linear-gradient(45deg, #c7c7c7 25%, transparent 25%, transparent 75%, #c7c7c7 75%, #c7c7c7),\n linear-gradient(45deg, #c7c7c7 25%, transparent 25%, transparent 75%, #c7c7c7 75%, #c7c7c7)\n "),
|
|
1600
|
-
backgroundSize: '100% 100%, 16px 16px, 16px 16px',
|
|
1601
|
-
backgroundPosition: '0 0, 8px 8px, 0 0',
|
|
1602
|
-
color: light ? '#000000' : '#FFFFFF',
|
|
1603
|
-
textShadow: "0 0 2px ".concat(light ? '#FFFFFFAA' : '#000000AA')
|
|
1604
|
-
};
|
|
1605
|
-
},
|
|
1606
|
-
isMobile: function isMobile$1() {
|
|
1607
|
-
return this.mobileNative && isMobile.any();
|
|
1608
|
-
},
|
|
1609
|
-
ariaRole: function ariaRole() {
|
|
1610
|
-
if (!this.inline) {
|
|
1611
|
-
return 'dialog';
|
|
1612
|
-
}
|
|
1613
|
-
}
|
|
1614
|
-
},
|
|
1615
|
-
watch: {
|
|
1616
|
-
value: function value(_value2) {
|
|
1617
|
-
this.colorSelected = new Color(_value2);
|
|
1618
|
-
}
|
|
1619
|
-
},
|
|
1620
|
-
methods: {
|
|
1621
|
-
updateColor: function updateColor(value) {
|
|
1622
|
-
value.alpha = this.colorSelected.alpha;
|
|
1623
|
-
this.colorSelected = value;
|
|
1624
|
-
this.$emit('input', value);
|
|
1625
|
-
},
|
|
1626
|
-
updateAlpha: function updateAlpha(alpha) {
|
|
1627
|
-
this.colorSelected.alpha = alpha;
|
|
1628
|
-
this.$emit('input', this.colorSelected);
|
|
1629
|
-
},
|
|
1630
|
-
|
|
1631
|
-
/*
|
|
1632
|
-
* Format color into string
|
|
1633
|
-
*/
|
|
1634
|
-
formatValue: function formatValue(value) {
|
|
1635
|
-
return value ? this.colorFormatter(value, this) : null;
|
|
1636
|
-
},
|
|
1637
|
-
|
|
1638
|
-
/*
|
|
1639
|
-
* Toggle datepicker
|
|
1640
|
-
*/
|
|
1641
|
-
togglePicker: function togglePicker(active) {
|
|
1642
|
-
if (this.$refs.dropdown) {
|
|
1643
|
-
var isActive = typeof active === 'boolean' ? active : !this.$refs.dropdown.isActive;
|
|
1644
|
-
|
|
1645
|
-
if (isActive) {
|
|
1646
|
-
this.$refs.dropdown.isActive = isActive;
|
|
1647
|
-
} else if (this.closeOnClick) {
|
|
1648
|
-
this.$refs.dropdown.isActive = isActive;
|
|
1649
|
-
}
|
|
1650
|
-
}
|
|
1651
|
-
},
|
|
1652
|
-
|
|
1653
|
-
/*
|
|
1654
|
-
* Call default onFocus method and show datepicker
|
|
1655
|
-
*/
|
|
1656
|
-
handleOnFocus: function handleOnFocus(event) {
|
|
1657
|
-
this.onFocus(event);
|
|
1658
|
-
|
|
1659
|
-
if (this.openOnFocus) {
|
|
1660
|
-
this.togglePicker(true);
|
|
1661
|
-
}
|
|
1662
|
-
},
|
|
1663
|
-
|
|
1664
|
-
/*
|
|
1665
|
-
* Toggle dropdown
|
|
1666
|
-
*/
|
|
1667
|
-
toggle: function toggle() {
|
|
1668
|
-
if (this.mobileNative && this.isMobile) {
|
|
1669
|
-
var input = this.$refs.input.$refs.input;
|
|
1670
|
-
input.focus();
|
|
1671
|
-
input.click();
|
|
1672
|
-
return;
|
|
1673
|
-
}
|
|
1674
|
-
|
|
1675
|
-
this.$refs.dropdown.toggle();
|
|
1676
|
-
},
|
|
1677
|
-
|
|
1678
|
-
/*
|
|
1679
|
-
* Avoid dropdown toggle when is already visible
|
|
1680
|
-
*/
|
|
1681
|
-
onInputClick: function onInputClick(event) {
|
|
1682
|
-
if (this.$refs.dropdown.isActive) {
|
|
1683
|
-
event.stopPropagation();
|
|
1684
|
-
}
|
|
1685
|
-
},
|
|
1686
|
-
|
|
1687
|
-
/**
|
|
1688
|
-
* Keypress event that is bound to the document.
|
|
1689
|
-
*/
|
|
1690
|
-
keyPress: function keyPress(_ref) {
|
|
1691
|
-
var key = _ref.key;
|
|
1692
|
-
|
|
1693
|
-
if (this.$refs.dropdown && this.$refs.dropdown.isActive && (key === 'Escape' || key === 'Esc')) {
|
|
1694
|
-
this.togglePicker(false);
|
|
1695
|
-
}
|
|
1696
|
-
},
|
|
1697
|
-
|
|
1698
|
-
/**
|
|
1699
|
-
* Emit 'blur' event on dropdown is not active (closed)
|
|
1700
|
-
*/
|
|
1701
|
-
onActiveChange: function onActiveChange(value) {
|
|
1702
|
-
if (!value) {
|
|
1703
|
-
this.onBlur();
|
|
1704
|
-
}
|
|
1705
|
-
/*
|
|
1706
|
-
* Emit 'active-change' when on dropdown active state change
|
|
1707
|
-
*/
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
this.$emit('active-change', value);
|
|
1711
|
-
}
|
|
1712
|
-
}
|
|
1713
|
-
};
|
|
1714
|
-
|
|
1715
|
-
/* script */
|
|
1716
|
-
const __vue_script__$3 = script$3;
|
|
1717
|
-
|
|
1718
|
-
/* template */
|
|
1719
|
-
var __vue_render__$3 = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"colorpicker control",class:[_vm.size, {'is-expanded': _vm.expanded}]},[(!_vm.isMobile || _vm.inline)?_c('b-dropdown',{ref:"dropdown",attrs:{"position":_vm.position,"expanded":_vm.expanded,"disabled":_vm.disabled,"inline":_vm.inline,"mobile-modal":_vm.mobileModal,"trap-focus":_vm.trapFocus,"aria-role":_vm.ariaRole,"append-to-body":_vm.appendToBody,"append-to-body-copy-parent":""},on:{"active-change":_vm.onActiveChange},scopedSlots:_vm._u([(!_vm.inline)?{key:"trigger",fn:function(){return [_vm._t("trigger",[_c('b-button',{style:(_vm.triggerStyle),attrs:{"expanded":_vm.expanded,"disabled":_vm.disabled}},[_c('span',{staticClass:"color-name"},[_vm._v(_vm._s(_vm.colorFormatter(_vm.colorSelected)))])])])]},proxy:true}:null],null,true)},[_c('b-dropdown-item',{class:{'dropdown-horizonal-colorpicker': _vm.horizontalColorPicker},attrs:{"disabled":_vm.disabled,"focusable":_vm.focusable,"custom":""}},[_c('div',[_c('header',{staticClass:"colorpicker-header"},[(_vm.$slots.header !== undefined && _vm.$slots.header.length)?[_vm._t("header")]:_vm._e()],2),_c('div',{staticClass:"colorpicker-content"},[(_vm.representation === 'square')?_c('b-colorpicker-h-s-l-representation-square',{attrs:{"value":_vm.colorSelected},on:{"input":_vm.updateColor}}):_c('b-colorpicker-h-s-l-representation-triangle',{attrs:{"value":_vm.colorSelected},on:{"input":_vm.updateColor}})],1)]),_c('footer',{staticClass:"colorpicker-footer"},[(_vm.alpha)?_c('b-colorpicker-alpha-slider',{attrs:{"value":_vm.colorSelected.alpha,"color":_vm.colorSelected},on:{"input":_vm.updateAlpha}}):_vm._e(),_vm._t("footer",[_c('b-field',{staticClass:"colorpicker-fields",attrs:{"grouped":""}},[_c('b-field',{attrs:{"horizontal":"","label":"R"}},[_c('b-input',{attrs:{"type":"number","size":"is-small","aria-label":"Red"},model:{value:(_vm.colorSelected.red),callback:function ($$v) {_vm.$set(_vm.colorSelected, "red", _vm._n($$v));},expression:"colorSelected.red"}})],1),_c('b-field',{attrs:{"horizontal":"","label":"G"}},[_c('b-input',{attrs:{"type":"number","size":"is-small","aria-label":"Green"},model:{value:(_vm.colorSelected.green),callback:function ($$v) {_vm.$set(_vm.colorSelected, "green", _vm._n($$v));},expression:"colorSelected.green"}})],1),_c('b-field',{attrs:{"horizontal":"","label":"B"}},[_c('b-input',{attrs:{"type":"number","size":"is-small","aria-label":"Blue"},model:{value:(_vm.colorSelected.blue),callback:function ($$v) {_vm.$set(_vm.colorSelected, "blue", _vm._n($$v));},expression:"colorSelected.blue"}})],1)],1)],{"color":_vm.colorSelected})],2)])],1):_vm._e()],1)};
|
|
1720
|
-
var __vue_staticRenderFns__$3 = [];
|
|
1721
|
-
|
|
1722
|
-
/* style */
|
|
1723
|
-
const __vue_inject_styles__$3 = undefined;
|
|
1724
|
-
/* scoped */
|
|
1725
|
-
const __vue_scope_id__$3 = undefined;
|
|
1726
|
-
/* module identifier */
|
|
1727
|
-
const __vue_module_identifier__$3 = undefined;
|
|
1728
|
-
/* functional template */
|
|
1729
|
-
const __vue_is_functional_template__$3 = false;
|
|
1730
|
-
/* style inject */
|
|
1731
|
-
|
|
1732
|
-
/* style inject SSR */
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
var Colorpicker = __vue_normalize__(
|
|
1737
|
-
{ render: __vue_render__$3, staticRenderFns: __vue_staticRenderFns__$3 },
|
|
1738
|
-
__vue_inject_styles__$3,
|
|
1739
|
-
__vue_script__$3,
|
|
1740
|
-
__vue_scope_id__$3,
|
|
1741
|
-
__vue_is_functional_template__$3,
|
|
1742
|
-
__vue_module_identifier__$3,
|
|
1743
|
-
undefined,
|
|
1744
|
-
undefined
|
|
1745
|
-
);
|
|
1746
|
-
|
|
1747
|
-
var Plugin = {
|
|
1748
|
-
install: function install(Vue) {
|
|
1749
|
-
registerComponent(Vue, Colorpicker);
|
|
1750
|
-
}
|
|
1751
|
-
};
|
|
1752
|
-
use(Plugin);
|
|
1753
|
-
|
|
1754
|
-
export default Plugin;
|
|
1755
|
-
export { Colorpicker as BColorpicker };
|
|
10
|
+
import './chunk-0c67e5e7.js';
|
|
11
|
+
import './chunk-6a7209ee.js';
|
|
12
|
+
export { C as BColorpicker, P as default } from './colorpicker-91643f19.js';
|
|
13
|
+
import './chunk-bf29bc31.js';
|
|
14
|
+
import './chunk-18dce47f.js';
|