buefy 0.9.13 → 0.9.17

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