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,1748 @@
1
+ import { e as _inherits, f as _wrapNativeSuper, g as _classCallCheck, h as _possibleConstructorReturn, i as _getPrototypeOf, j as _createClass, b as _typeof, d as _toConsumableArray, k as _slicedToArray, l as _taggedTemplateLiteral, _ as _defineProperty } from './chunk-455cdeae.js';
2
+ import { isMobile } from './helpers.js';
3
+ import { c as config } from './chunk-8ed29c41.js';
4
+ import { F as FormElementMixin } from './chunk-84c6dfd6.js';
5
+ import { I as Icon } from './chunk-e044aa02.js';
6
+ import { _ as __vue_normalize__, r as registerComponent, u as use } from './chunk-cca88db8.js';
7
+ import { I as Input } from './chunk-a628d44d.js';
8
+ import './chunk-60a03517.js';
9
+ import './chunk-42f463e6.js';
10
+ import { D as Dropdown, a as DropdownItem } from './chunk-dbd43ef1.js';
11
+ import { F as Field } from './chunk-effa4d25.js';
12
+ import { S as Select } from './chunk-6adc5c5d.js';
13
+ import { T as Tooltip } from './chunk-22cf6667.js';
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
+ _this.hue = hue;
632
+ _this.saturation = saturation;
633
+ _this.lightness = lightness;
634
+ }, 200);
635
+ }
636
+ }
637
+ },
638
+ methods: {
639
+ increaseHue: function increaseHue() {
640
+ var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;
641
+ this.hue = (this.hue + value) % 360;
642
+ },
643
+ decreaseHue: function decreaseHue() {
644
+ var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;
645
+ this.hue = (360 + this.hue - value) % 360;
646
+ },
647
+ increaseSaturation: function increaseSaturation() {
648
+ var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0.01;
649
+ this.saturation = Math.min(1, Math.max(0, this.saturation + value));
650
+ this.lightness = Math.min(0.5 + (1 - this.saturation) * 0.5, Math.max(0.5 - (1 - this.saturation) * 0.5, this.lightness));
651
+ },
652
+ decreaseSaturation: function decreaseSaturation() {
653
+ var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0.01;
654
+ this.saturation = Math.min(1, Math.max(0, this.saturation - value));
655
+ this.lightness = Math.min(0.5 + (1 - this.saturation) * 0.5, Math.max(0.5 - (1 - this.saturation) * 0.5, this.lightness));
656
+ },
657
+ increaseLightness: function increaseLightness() {
658
+ var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0.01;
659
+ this.lightness = Math.min(0.5 + (1 - this.saturation) * 0.5, Math.max(0.5 - (1 - this.saturation) * 0.5, this.lightness + value));
660
+ },
661
+ decreaseLightness: function decreaseLightness() {
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
+ hueKeyPress: function hueKeyPress(event) {
666
+ var handled = false;
667
+
668
+ switch (event.key) {
669
+ case 'ArrowRight':
670
+ case 'ArrowUp':
671
+ this.increaseHue();
672
+ handled = true;
673
+ break;
674
+
675
+ case 'ArrowLeft':
676
+ case 'ArrowDown':
677
+ this.decreaseHue();
678
+ handled = true;
679
+ break;
680
+
681
+ case 'Home':
682
+ this.increaseHue(360 - this.hue);
683
+ handled = true;
684
+ break;
685
+
686
+ case 'End':
687
+ this.decreaseHue(this.hue);
688
+ handled = true;
689
+ break;
690
+
691
+ case 'PageUp':
692
+ this.increaseHue(60 - this.hue % 60);
693
+ handled = true;
694
+ break;
695
+
696
+ case 'PageDown':
697
+ this.decreaseHue(60 + this.hue % 60);
698
+ handled = true;
699
+ break;
700
+ }
701
+
702
+ if (handled) {
703
+ event.preventDefault();
704
+ event.stopPropagation();
705
+ this.emitColor();
706
+ }
707
+ },
708
+ slKeyPress: function slKeyPress(event) {
709
+ var handled = false;
710
+
711
+ switch (event.key) {
712
+ case 'ArrowRight':
713
+ this.decreaseLightness();
714
+ handled = true;
715
+ break;
716
+
717
+ case 'ArrowUp':
718
+ this.increaseSaturation();
719
+ handled = true;
720
+ break;
721
+
722
+ case 'ArrowLeft':
723
+ this.increaseLightness();
724
+ handled = true;
725
+ break;
726
+
727
+ case 'ArrowDown':
728
+ this.decreaseSaturation();
729
+ handled = true;
730
+ break;
731
+
732
+ case 'Home':
733
+ this.increaseLightness(1 - this.lightness);
734
+ handled = true;
735
+ break;
736
+
737
+ case 'End':
738
+ this.decreaseLightness(this.lightness);
739
+ handled = true;
740
+ break;
741
+
742
+ case 'PageUp':
743
+ this.increaseSaturation(1 - this.saturation);
744
+ handled = true;
745
+ break;
746
+
747
+ case 'PageDown':
748
+ this.decreaseSaturation(this.saturation);
749
+ handled = true;
750
+ break;
751
+ }
752
+
753
+ if (handled) {
754
+ event.preventDefault();
755
+ event.stopPropagation();
756
+ this.emitColor();
757
+ }
758
+ },
759
+ clickHue: function clickHue(event) {
760
+ this.startMouseCapture(event);
761
+ this.trackMouse(event);
762
+ this.stopMouseCapture(event);
763
+ this.$refs.hueCursor.focus();
764
+ },
765
+ clickSL: function clickSL(event) {
766
+ this.startMouseCapture(event);
767
+ this.trackMouse(event);
768
+ this.stopMouseCapture(event);
769
+ this.$refs.slCursor.focus();
770
+ },
771
+ trackMouse: function trackMouse(event) {
772
+ if (this.captureMouse === false) {
773
+ return;
774
+ }
775
+
776
+ event.preventDefault();
777
+ event.stopPropagation();
778
+ var mouseX = 0,
779
+ mouseY = 0;
780
+
781
+ if (typeof event.touches !== 'undefined' && event.touches.length) {
782
+ var _ref = [event.touches[0].clientX, event.touches[0].clientY];
783
+ mouseX = _ref[0];
784
+ mouseY = _ref[1];
785
+ } else {
786
+ var _ref2 = [event.clientX, event.clientY];
787
+ mouseX = _ref2[0];
788
+ mouseY = _ref2[1];
789
+ }
790
+
791
+ var angle = Math.atan2(mouseY - this.clientOffset.cy, mouseX - this.clientOffset.cx);
792
+
793
+ if (this.captureType === 'sl') {
794
+ var d = Math.sqrt(Math.pow(mouseX - this.clientOffset.cx, 2) + Math.pow(mouseY - this.clientOffset.cy, 2));
795
+ var ratio = this.size / this.clientOffset.width;
796
+ var dx = d * Math.cos(angle - this.hue / 180 * Math.PI) * ratio;
797
+ var dy = d * Math.sin(angle - this.hue / 180 * Math.PI) * ratio;
798
+ var radius = this.internalRadius;
799
+ var saturation = 1 - (Math.min(radius * sin30, Math.max(-radius, dy)) + radius) / (radius + radius * sin30);
800
+ var lightness = (Math.min(radius * cos30 * (1 - saturation), Math.max(-radius * cos30 * (1 - saturation), dx)) + radius * cos30) / (radius * 2 * cos30);
801
+ this.saturation = Math.round(saturation * 1000) / 1000;
802
+ this.lightness = 1 - Math.round(lightness * 1000) / 1000;
803
+ } else {
804
+ this.hue = Math.round(angle / Math.PI * 180 + 90) % 360;
805
+ }
806
+
807
+ this.emitColor();
808
+ },
809
+ startMouseCapture: function startMouseCapture(event) {
810
+ event.stopPropagation();
811
+ this.captureMouse = true;
812
+
813
+ if (event.target.closest('.colorpicker-triangle-slider-sl') !== null) {
814
+ this.captureType = 'sl';
815
+ } else {
816
+ this.captureType = 'hue';
817
+ }
818
+ },
819
+ stopMouseCapture: function stopMouseCapture(event) {
820
+ if (this.captureMouse !== false) {
821
+ event.preventDefault();
822
+ event.stopPropagation();
823
+ this.$refs[this.captureType === 'sl' ? 'slCursor' : 'hueCursor'].focus();
824
+ }
825
+
826
+ this.captureMouse = false;
827
+ },
828
+ emitColor: function emitColor() {
829
+ var hue = this.hue,
830
+ saturation = this.saturation,
831
+ lightness = this.lightness;
832
+ this.$emit('input', Color.fromHSL(hue, saturation, lightness));
833
+ window.clearTimeout(this.debounce);
834
+ }
835
+ },
836
+ mounted: function mounted() {
837
+ window.addEventListener('mousemove', this.trackMouse);
838
+ window.addEventListener('touchmove', this.trackMouse, {
839
+ passive: false
840
+ });
841
+ window.addEventListener('mouseup', this.stopMouseCapture);
842
+ window.addEventListener('touchend', this.stopMouseCapture);
843
+ },
844
+ beforeDestroy: function beforeDestroy() {
845
+ window.removeEventListener('mousemove', this.trackMouse);
846
+ window.removeEventListener('touchmove', this.trackMouse);
847
+ window.removeEventListener('mouseup', this.stopMouseCapture);
848
+ window.removeEventListener('touchend', this.stopMouseCapture);
849
+ }
850
+ };
851
+
852
+ /* script */
853
+ const __vue_script__ = script;
854
+
855
+ /* template */
856
+ 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:({
857
+ backgroundColor: ("hsl(" + _vm.hue + "deg, " + (_vm.saturation * 100) + "%, " + (_vm.lightness * 100) + "%)")
858
+ }),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)])};
859
+ var __vue_staticRenderFns__ = [];
860
+
861
+ /* style */
862
+ const __vue_inject_styles__ = undefined;
863
+ /* scoped */
864
+ const __vue_scope_id__ = undefined;
865
+ /* module identifier */
866
+ const __vue_module_identifier__ = undefined;
867
+ /* functional template */
868
+ const __vue_is_functional_template__ = false;
869
+ /* style inject */
870
+
871
+ /* style inject SSR */
872
+
873
+
874
+
875
+ var ColorpickerHSLRepresentationTriangle = __vue_normalize__(
876
+ { render: __vue_render__, staticRenderFns: __vue_staticRenderFns__ },
877
+ __vue_inject_styles__,
878
+ __vue_script__,
879
+ __vue_scope_id__,
880
+ __vue_is_functional_template__,
881
+ __vue_module_identifier__,
882
+ undefined,
883
+ undefined
884
+ );
885
+
886
+ function _templateObject3() {
887
+ var data = _taggedTemplateLiteral(["", "px"]);
888
+
889
+ _templateObject3 = function _templateObject3() {
890
+ return data;
891
+ };
892
+
893
+ return data;
894
+ }
895
+
896
+ function _templateObject2() {
897
+ var data = _taggedTemplateLiteral(["", "px"]);
898
+
899
+ _templateObject2 = function _templateObject2() {
900
+ return data;
901
+ };
902
+
903
+ return data;
904
+ }
905
+
906
+ function _templateObject() {
907
+ var data = _taggedTemplateLiteral(["", "px"]);
908
+
909
+ _templateObject = function _templateObject() {
910
+ return data;
911
+ };
912
+
913
+ return data;
914
+ }
915
+
916
+ var precision = function precision(strs) {
917
+ for (var _len = arguments.length, values = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
918
+ values[_key - 1] = arguments[_key];
919
+ }
920
+
921
+ var tmp = [];
922
+ strs.forEach(function (str, i) {
923
+ tmp.push(str);
924
+
925
+ if (values[i]) {
926
+ tmp.push(Number.isNaN(values[i] / 1) ? values[i] : Math.round(values * 10) / 10);
927
+ }
928
+ });
929
+ return tmp.join('');
930
+ };
931
+
932
+ var script$1 = {
933
+ name: 'BColorpickerHSLRepresentationSquare',
934
+ props: {
935
+ value: {
936
+ type: Object,
937
+ required: true,
938
+ validator: function validator(value) {
939
+ return typeof value.hue === 'number' && typeof value.saturation === 'number' && typeof value.lightness === 'number';
940
+ }
941
+ },
942
+ size: {
943
+ type: Number,
944
+ default: 200
945
+ },
946
+ thickness: {
947
+ type: Number,
948
+ default: 20
949
+ }
950
+ },
951
+ data: function data() {
952
+ return {
953
+ hue: this.value.hue,
954
+ saturation: this.value.saturation,
955
+ lightness: this.value.lightness,
956
+ captureMouse: false,
957
+ captureType: 'hue',
958
+ clientOffset: {
959
+ cx: -1,
960
+ cy: -1,
961
+ width: 0,
962
+ height: 0
963
+ },
964
+ debounce: 0
965
+ };
966
+ },
967
+ computed: {
968
+ hueThumbStyle: function hueThumbStyle() {
969
+ var hue = this.hue,
970
+ size = this.size,
971
+ thickness = this.thickness;
972
+ var side = size - thickness;
973
+ var offset = size / 2;
974
+ var angle = (hue + 720 + 90) % 360 / 180 * Math.PI;
975
+ var ciq = 1 / Math.cos(Math.PI / 4);
976
+ var _x$y = {
977
+ x: -Math.min(1, Math.max(-1, ciq * Math.cos(angle))) / 2 * side + offset,
978
+ y: -Math.min(1, Math.max(-1, ciq * Math.sin(angle))) / 2 * side + offset
979
+ },
980
+ x = _x$y.x,
981
+ y = _x$y.y;
982
+ return {
983
+ background: "hsl(".concat(hue, "deg, 100%, 50%)"),
984
+ left: precision(_templateObject(), x),
985
+ top: precision(_templateObject2(), y),
986
+ width: precision(_templateObject3(), thickness - 2)
987
+ };
988
+ },
989
+ slThumbStyle: function slThumbStyle() {
990
+ var hue = this.hue,
991
+ saturation = this.saturation,
992
+ lightness = this.lightness;
993
+ saturation = Math.max(0, Math.min(1, saturation));
994
+ lightness = Math.max(0, Math.min(1, lightness));
995
+ return {
996
+ background: "hsl(".concat(hue, "deg, ").concat(saturation * 100, "%, ").concat(lightness * 100, "%)"),
997
+ left: "".concat(saturation * 100, "%"),
998
+ top: "".concat((1 - lightness) * 100, "%")
999
+ };
1000
+ },
1001
+ SLBackground: function SLBackground() {
1002
+ var hue = this.hue;
1003
+ return "linear-gradient(90deg, hsl(".concat(hue, "deg, 0%, 50%), hsl(").concat(hue, "deg, 100%, 50%))");
1004
+ }
1005
+ },
1006
+ watch: {
1007
+ captureMouse: function captureMouse(newValue, oldValue) {
1008
+ if (oldValue === false && newValue !== false) {
1009
+ var rect = this.$el.getBoundingClientRect(); // Caching offset
1010
+
1011
+ this.clientOffset.cx = rect.x + rect.width / 2;
1012
+ this.clientOffset.cy = rect.y + rect.height / 2;
1013
+ this.clientOffset.width = rect.width;
1014
+ this.clientOffset.height = rect.height;
1015
+ }
1016
+ },
1017
+ value: {
1018
+ deep: true,
1019
+ handler: function handler(newColor) {
1020
+ var _this = this;
1021
+
1022
+ var hue = newColor.hue,
1023
+ saturation = newColor.saturation,
1024
+ lightness = newColor.lightness;
1025
+ window.clearTimeout(this.debounce);
1026
+ this.debounce = window.setTimeout(function () {
1027
+ _this.hue = hue;
1028
+ _this.saturation = saturation;
1029
+ _this.lightness = lightness;
1030
+ }, 200);
1031
+ }
1032
+ }
1033
+ },
1034
+ methods: {
1035
+ increaseHue: function increaseHue() {
1036
+ var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;
1037
+ this.hue = (this.hue + value) % 360;
1038
+ },
1039
+ decreaseHue: function decreaseHue() {
1040
+ var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;
1041
+ this.hue = (360 + this.hue - value) % 360;
1042
+ },
1043
+ increaseSaturation: function increaseSaturation() {
1044
+ var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0.01;
1045
+ this.saturation = Math.min(1, Math.max(0, this.saturation + value));
1046
+ this.lightness = Math.min(0.5 + (1 - this.saturation) * 0.5, Math.max(0.5 - (1 - this.saturation) * 0.5, this.lightness));
1047
+ },
1048
+ decreaseSaturation: function decreaseSaturation() {
1049
+ var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0.01;
1050
+ this.saturation = Math.min(1, Math.max(0, this.saturation - value));
1051
+ this.lightness = Math.min(0.5 + (1 - this.saturation) * 0.5, Math.max(0.5 - (1 - this.saturation) * 0.5, this.lightness));
1052
+ },
1053
+ increaseLightness: function increaseLightness() {
1054
+ var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0.01;
1055
+ this.lightness = Math.min(0.5 + (1 - this.saturation) * 0.5, Math.max(0.5 - (1 - this.saturation) * 0.5, this.lightness + value));
1056
+ },
1057
+ decreaseLightness: function decreaseLightness() {
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
+ hueKeyPress: function hueKeyPress(event) {
1062
+ var handled = false;
1063
+
1064
+ switch (event.key) {
1065
+ case 'ArrowRight':
1066
+ case 'ArrowUp':
1067
+ this.increaseHue();
1068
+ handled = true;
1069
+ break;
1070
+
1071
+ case 'ArrowLeft':
1072
+ case 'ArrowDown':
1073
+ this.decreaseHue();
1074
+ handled = true;
1075
+ break;
1076
+
1077
+ case 'Home':
1078
+ this.increaseHue(360 - this.hue);
1079
+ handled = true;
1080
+ break;
1081
+
1082
+ case 'End':
1083
+ this.decreaseHue(this.hue);
1084
+ handled = true;
1085
+ break;
1086
+
1087
+ case 'PageUp':
1088
+ this.increaseHue(60 - this.hue % 60);
1089
+ handled = true;
1090
+ break;
1091
+
1092
+ case 'PageDown':
1093
+ this.decreaseHue(60 + this.hue % 60);
1094
+ handled = true;
1095
+ break;
1096
+ }
1097
+
1098
+ if (handled) {
1099
+ event.preventDefault();
1100
+ event.stopPropagation();
1101
+ this.emitColor();
1102
+ }
1103
+ },
1104
+ slKeyPress: function slKeyPress(event) {
1105
+ var handled = false;
1106
+
1107
+ switch (event.key) {
1108
+ case 'ArrowRight':
1109
+ this.increaseSaturation();
1110
+ handled = true;
1111
+ break;
1112
+
1113
+ case 'ArrowUp':
1114
+ this.increaseLightness();
1115
+ handled = true;
1116
+ break;
1117
+
1118
+ case 'ArrowLeft':
1119
+ this.decreaseSaturation();
1120
+ handled = true;
1121
+ break;
1122
+
1123
+ case 'ArrowDown':
1124
+ this.decreaseLightness();
1125
+ handled = true;
1126
+ break;
1127
+
1128
+ case 'Home':
1129
+ this.increaseLightness(1 - this.lightness);
1130
+ handled = true;
1131
+ break;
1132
+
1133
+ case 'End':
1134
+ this.decreaseLightness(this.lightness);
1135
+ handled = true;
1136
+ break;
1137
+
1138
+ case 'PageUp':
1139
+ this.increaseSaturation(1 - this.saturation);
1140
+ handled = true;
1141
+ break;
1142
+
1143
+ case 'PageDown':
1144
+ this.decreaseSaturation(this.saturation);
1145
+ handled = true;
1146
+ break;
1147
+ }
1148
+
1149
+ if (handled) {
1150
+ event.preventDefault();
1151
+ event.stopPropagation();
1152
+ this.emitColor();
1153
+ }
1154
+ },
1155
+ startMouseCapture: function startMouseCapture(event) {
1156
+ event.stopPropagation();
1157
+ this.captureMouse = true;
1158
+
1159
+ if (event.target.closest('.colorpicker-square-slider-sl') !== null) {
1160
+ this.captureType = 'sl';
1161
+ } else {
1162
+ this.captureType = 'hue';
1163
+ }
1164
+ },
1165
+ stopMouseCapture: function stopMouseCapture(event) {
1166
+ if (this.captureMouse !== false) {
1167
+ event.preventDefault();
1168
+ event.stopPropagation();
1169
+ this.$refs[this.captureType === 'sl' ? 'slCursor' : 'hueCursor'].focus();
1170
+ }
1171
+
1172
+ this.captureMouse = false;
1173
+ },
1174
+ clickHue: function clickHue(event) {
1175
+ this.startMouseCapture(event);
1176
+ this.trackMouse(event);
1177
+ this.stopMouseCapture(event);
1178
+ this.$refs.hueCursor.focus();
1179
+ },
1180
+ clickSL: function clickSL(event) {
1181
+ this.startMouseCapture(event);
1182
+ this.trackMouse(event);
1183
+ this.stopMouseCapture(event);
1184
+ this.$refs.slCursor.focus();
1185
+ },
1186
+ trackMouse: function trackMouse(event) {
1187
+ if (this.captureMouse === false) {
1188
+ return;
1189
+ }
1190
+
1191
+ event.preventDefault();
1192
+ event.stopPropagation();
1193
+ var mouseX = 0,
1194
+ mouseY = 0;
1195
+
1196
+ if (typeof event.touches !== 'undefined' && event.touches.length) {
1197
+ var _ref = [event.touches[0].clientX, event.touches[0].clientY];
1198
+ mouseX = _ref[0];
1199
+ mouseY = _ref[1];
1200
+ } else {
1201
+ var _ref2 = [event.clientX, event.clientY];
1202
+ mouseX = _ref2[0];
1203
+ mouseY = _ref2[1];
1204
+ }
1205
+
1206
+ var angle = Math.atan2(mouseY - this.clientOffset.cy, mouseX - this.clientOffset.cx);
1207
+
1208
+ if (this.captureType === 'sl') {
1209
+ var saturation = (mouseX - this.clientOffset.cx) / (this.clientOffset.width - this.thickness * 2) + 0.5;
1210
+ var lightness = (mouseY - this.clientOffset.cy) / (this.clientOffset.height - this.thickness * 2) + 0.5;
1211
+ this.saturation = Math.round(Math.min(1, Math.max(0, saturation)) * 1000) / 1000;
1212
+ this.lightness = 1 - Math.round(Math.min(1, Math.max(0, lightness)) * 1000) / 1000;
1213
+ } else {
1214
+ this.hue = Math.round(angle / Math.PI * 180 + 90) % 360;
1215
+ }
1216
+
1217
+ this.emitColor();
1218
+ },
1219
+ emitColor: function emitColor() {
1220
+ var hue = this.hue,
1221
+ saturation = this.saturation,
1222
+ lightness = this.lightness;
1223
+ this.$emit('input', Color.fromHSL(hue, saturation, lightness));
1224
+ window.clearTimeout(this.debounce);
1225
+ }
1226
+ },
1227
+ mounted: function mounted() {
1228
+ window.addEventListener('mousemove', this.trackMouse);
1229
+ window.addEventListener('touchmove', this.trackMouse, {
1230
+ passive: false
1231
+ });
1232
+ window.addEventListener('mouseup', this.stopMouseCapture);
1233
+ window.addEventListener('touchend', this.stopMouseCapture);
1234
+ },
1235
+ beforeDestroy: function beforeDestroy() {
1236
+ window.removeEventListener('mousemove', this.trackMouse);
1237
+ window.removeEventListener('touchmove', this.trackMouse);
1238
+ window.removeEventListener('mouseup', this.stopMouseCapture);
1239
+ window.removeEventListener('touchend', this.stopMouseCapture);
1240
+ }
1241
+ };
1242
+
1243
+ /* script */
1244
+ const __vue_script__$1 = script$1;
1245
+
1246
+ /* template */
1247
+ 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:({
1248
+ background: _vm.SLBackground,
1249
+ margin: (_vm.thickness + "px")
1250
+ }),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)}}})])])};
1251
+ var __vue_staticRenderFns__$1 = [];
1252
+
1253
+ /* style */
1254
+ const __vue_inject_styles__$1 = undefined;
1255
+ /* scoped */
1256
+ const __vue_scope_id__$1 = undefined;
1257
+ /* module identifier */
1258
+ const __vue_module_identifier__$1 = undefined;
1259
+ /* functional template */
1260
+ const __vue_is_functional_template__$1 = false;
1261
+ /* style inject */
1262
+
1263
+ /* style inject SSR */
1264
+
1265
+
1266
+
1267
+ var ColorpickerHSLRepresentationSquare = __vue_normalize__(
1268
+ { render: __vue_render__$1, staticRenderFns: __vue_staticRenderFns__$1 },
1269
+ __vue_inject_styles__$1,
1270
+ __vue_script__$1,
1271
+ __vue_scope_id__$1,
1272
+ __vue_is_functional_template__$1,
1273
+ __vue_module_identifier__$1,
1274
+ undefined,
1275
+ undefined
1276
+ );
1277
+
1278
+ var script$2 = {
1279
+ name: 'BColorpickerAlphaSlider',
1280
+ components: _defineProperty({}, Tooltip.name, Tooltip),
1281
+ props: {
1282
+ value: {
1283
+ type: Number,
1284
+ validator: function validator(value) {
1285
+ return value >= 0 && value < 256;
1286
+ }
1287
+ },
1288
+ color: [String, Object]
1289
+ },
1290
+ data: function data() {
1291
+ var color = Color.parse(this.color);
1292
+ color.alpha = 0;
1293
+ return {
1294
+ startColor: color.toString('hex'),
1295
+ endColor: color.toString('hexa'),
1296
+ percent: Math.round((1 - this.value / 255) * 100),
1297
+ captureMouse: false,
1298
+ clientOffset: {
1299
+ cx: -1,
1300
+ cy: -1,
1301
+ width: 0,
1302
+ height: 0
1303
+ }
1304
+ };
1305
+ },
1306
+ computed: {
1307
+ style: function style() {
1308
+ return {
1309
+ 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)"),
1310
+ backgroundSize: '100% 100%, 1em 1em, 1em 1em',
1311
+ backgroundPosition: '0 0, .5em .5em, 0 0'
1312
+ };
1313
+ }
1314
+ },
1315
+ watch: {
1316
+ value: function value(newValue, oldValue) {
1317
+ if (newValue !== oldValue) {
1318
+ this.percent = Math.round((1 - newValue / 255) * 100);
1319
+ }
1320
+ },
1321
+ color: function color(newColor) {
1322
+ var color = Color.parse(newColor);
1323
+ color.alpha = 0;
1324
+ this.startColor = color.toString('hex');
1325
+ this.endColor = color.toString('hexa');
1326
+ },
1327
+ captureMouse: function captureMouse(newValue, oldValue) {
1328
+ if (oldValue === false && newValue !== false) {
1329
+ var rect = this.$el.getBoundingClientRect(); // Caching offset
1330
+
1331
+ this.clientOffset.cx = rect.x + rect.width / 2;
1332
+ this.clientOffset.cy = rect.y + rect.height / 2;
1333
+ this.clientOffset.width = rect.width;
1334
+ this.clientOffset.height = rect.height;
1335
+ }
1336
+ }
1337
+ },
1338
+ methods: {
1339
+ increaseAlpha: function increaseAlpha() {
1340
+ var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;
1341
+ this.percent = Math.max(0, Math.min(100, this.percent + value));
1342
+ },
1343
+ decreaseAlpha: function decreaseAlpha() {
1344
+ var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0.01;
1345
+ this.increaseAlpha(-value);
1346
+ },
1347
+ alphaKeyPress: function alphaKeyPress(event) {
1348
+ var handled = false;
1349
+
1350
+ switch (event.key) {
1351
+ case 'ArrowRight':
1352
+ case 'ArrowUp':
1353
+ this.increaseAlpha();
1354
+ handled = true;
1355
+ break;
1356
+
1357
+ case 'ArrowLeft':
1358
+ case 'ArrowDown':
1359
+ this.decreaseAlpha();
1360
+ handled = true;
1361
+ break;
1362
+
1363
+ case 'Home':
1364
+ this.decreaseAlpha(this.percent);
1365
+ handled = true;
1366
+ break;
1367
+
1368
+ case 'End':
1369
+ this.increaseAlpha(100 - this.percent);
1370
+ handled = true;
1371
+ break;
1372
+
1373
+ case 'PageUp':
1374
+ this.increaseAlpha(10 - this.percent % 10);
1375
+ handled = true;
1376
+ break;
1377
+
1378
+ case 'PageDown':
1379
+ this.decreaseAlpha(this.percent % 10);
1380
+ handled = true;
1381
+ break;
1382
+ }
1383
+
1384
+ if (handled) {
1385
+ event.preventDefault();
1386
+ event.stopPropagation();
1387
+ this.emitAlpha();
1388
+ }
1389
+ },
1390
+ clickAlpha: function clickAlpha(event) {
1391
+ this.startMouseCapture(event);
1392
+ this.trackMouse(event);
1393
+ this.stopMouseCapture(event);
1394
+ this.$refs.alphaCursor.focus();
1395
+ },
1396
+ startMouseCapture: function startMouseCapture(event) {
1397
+ event.stopPropagation();
1398
+ this.captureMouse = true;
1399
+ },
1400
+ trackMouse: function trackMouse(event) {
1401
+ if (this.captureMouse === false) {
1402
+ return;
1403
+ }
1404
+
1405
+ event.preventDefault();
1406
+ event.stopPropagation();
1407
+ var _ref = [0, 0],
1408
+ mouseX = _ref[0];
1409
+
1410
+ if (typeof event.touches !== 'undefined' && event.touches.length) {
1411
+ var _ref2 = [event.touches[0].clientX];
1412
+ mouseX = _ref2[0];
1413
+ } else {
1414
+ var _ref3 = [event.clientX];
1415
+ mouseX = _ref3[0];
1416
+ }
1417
+
1418
+ var ratio = 0.5 + (this.clientOffset.cx - mouseX) / this.clientOffset.width;
1419
+ this.percent = Math.round(100 - Math.max(0, Math.min(1, ratio)) * 100);
1420
+ this.emitAlpha();
1421
+ },
1422
+ stopMouseCapture: function stopMouseCapture(event) {
1423
+ if (this.captureMouse !== false) {
1424
+ event.preventDefault();
1425
+ event.stopPropagation();
1426
+ this.$refs.alphaCursor.focus();
1427
+ }
1428
+
1429
+ this.captureMouse = false;
1430
+ },
1431
+ emitAlpha: function emitAlpha() {
1432
+ this.$emit('input', (1 - this.percent / 100) * 255);
1433
+ }
1434
+ },
1435
+ mounted: function mounted() {
1436
+ window.addEventListener('mousemove', this.trackMouse);
1437
+ window.addEventListener('touchmove', this.trackMouse, {
1438
+ passive: false
1439
+ });
1440
+ window.addEventListener('mouseup', this.stopMouseCapture);
1441
+ window.addEventListener('touchend', this.stopMouseCapture);
1442
+ },
1443
+ beforeDestroy: function beforeDestroy() {
1444
+ window.removeEventListener('mousemove', this.trackMouse);
1445
+ window.removeEventListener('touchmove', this.trackMouse);
1446
+ window.removeEventListener('mouseup', this.stopMouseCapture);
1447
+ window.removeEventListener('touchend', this.stopMouseCapture);
1448
+ }
1449
+ };
1450
+
1451
+ /* script */
1452
+ const __vue_script__$2 = script$2;
1453
+
1454
+ /* template */
1455
+ 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)])};
1456
+ var __vue_staticRenderFns__$2 = [];
1457
+
1458
+ /* style */
1459
+ const __vue_inject_styles__$2 = undefined;
1460
+ /* scoped */
1461
+ const __vue_scope_id__$2 = undefined;
1462
+ /* module identifier */
1463
+ const __vue_module_identifier__$2 = undefined;
1464
+ /* functional template */
1465
+ const __vue_is_functional_template__$2 = false;
1466
+ /* style inject */
1467
+
1468
+ /* style inject SSR */
1469
+
1470
+
1471
+
1472
+ var ColorpickerAlphaSlider = __vue_normalize__(
1473
+ { render: __vue_render__$2, staticRenderFns: __vue_staticRenderFns__$2 },
1474
+ __vue_inject_styles__$2,
1475
+ __vue_script__$2,
1476
+ __vue_scope_id__$2,
1477
+ __vue_is_functional_template__$2,
1478
+ __vue_module_identifier__$2,
1479
+ undefined,
1480
+ undefined
1481
+ );
1482
+
1483
+ var _components;
1484
+
1485
+ var defaultColorFormatter = function defaultColorFormatter(color, vm) {
1486
+ if (color.alpha < 1) {
1487
+ return color.toString('hexa');
1488
+ } else {
1489
+ return color.toString('hex');
1490
+ }
1491
+ };
1492
+
1493
+ var defaultColorParser = function defaultColorParser(color, vm) {
1494
+ return Color.parse(color);
1495
+ };
1496
+
1497
+ var script$3 = {
1498
+ name: 'BColorpicker',
1499
+ 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),
1500
+ mixins: [FormElementMixin],
1501
+ inheritAttrs: false,
1502
+ provide: function provide() {
1503
+ return {
1504
+ $colorpicker: this
1505
+ };
1506
+ },
1507
+ props: {
1508
+ value: {
1509
+ type: [String, Object],
1510
+ validator: function validator(value) {
1511
+ return typeof value === 'string' || _typeof(value) === 'object' && typeof value.red === 'number' && typeof value.green === 'number' && typeof value.blue === 'number';
1512
+ }
1513
+ },
1514
+ representation: {
1515
+ type: String,
1516
+ default: 'triangle',
1517
+ value: function value(_value) {
1518
+ return ['triangle', 'square'].some(function (r) {
1519
+ return r === _value;
1520
+ });
1521
+ }
1522
+ },
1523
+ inline: Boolean,
1524
+ disabled: Boolean,
1525
+ horizontalColorPicker: {
1526
+ type: Boolean,
1527
+ default: false
1528
+ },
1529
+ colorFormatter: {
1530
+ type: Function,
1531
+ default: function _default(color, vm) {
1532
+ if (typeof config.defaultColorFormatter === 'function') {
1533
+ return config.defaultColorFormatter(color);
1534
+ } else {
1535
+ return defaultColorFormatter(color);
1536
+ }
1537
+ }
1538
+ },
1539
+ colorParser: {
1540
+ type: Function,
1541
+ default: function _default(color, vm) {
1542
+ if (typeof config.defaultColorParser === 'function') {
1543
+ return config.defaultColorParser(color);
1544
+ } else {
1545
+ return defaultColorParser(color);
1546
+ }
1547
+ }
1548
+ },
1549
+ alpha: {
1550
+ type: Boolean,
1551
+ default: false
1552
+ },
1553
+ expanded: Boolean,
1554
+ position: String,
1555
+ mobileModal: {
1556
+ type: Boolean,
1557
+ default: function _default() {
1558
+ return config.defaultDatepickerMobileModal;
1559
+ }
1560
+ },
1561
+ focusable: {
1562
+ type: Boolean,
1563
+ default: true
1564
+ },
1565
+ trapFocus: {
1566
+ type: Boolean,
1567
+ default: function _default() {
1568
+ return config.defaultTrapFocus;
1569
+ }
1570
+ },
1571
+ appendToBody: Boolean
1572
+ },
1573
+ data: function data() {
1574
+ var color = this.colorParser(this.value);
1575
+ return {
1576
+ colorSelected: color
1577
+ };
1578
+ },
1579
+ computed: {
1580
+ background: function background() {
1581
+ if (this.alpha) {
1582
+ return "linear-gradient(\n 45deg,\n ".concat(this.colorSelected.toString('hex'), " 50%,\n ").concat(this.colorSelected.toString('hexa'), " 50%\n )");
1583
+ } else {
1584
+ var hex = this.colorSelected.toString('hex');
1585
+ return "linear-gradient(\n 45deg,\n ".concat(hex, " 50%,\n ").concat(hex, " 50%\n )");
1586
+ }
1587
+ },
1588
+ triggerStyle: function triggerStyle() {
1589
+ var _this$colorSelected = this.colorSelected,
1590
+ red = _this$colorSelected.red,
1591
+ green = _this$colorSelected.green,
1592
+ blue = _this$colorSelected.blue;
1593
+ var light = red * 0.299 + green * 0.587 + blue * 0.114 > 186;
1594
+ return {
1595
+ backgroundColor: '#ffffff',
1596
+ 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 "),
1597
+ backgroundSize: '100% 100%, 16px 16px, 16px 16px',
1598
+ backgroundPosition: '0 0, 8px 8px, 0 0',
1599
+ color: light ? '#000000' : '#FFFFFF',
1600
+ textShadow: "0 0 2px ".concat(light ? '#FFFFFFAA' : '#000000AA')
1601
+ };
1602
+ },
1603
+ isMobile: function isMobile$1() {
1604
+ return this.mobileNative && isMobile.any();
1605
+ },
1606
+ ariaRole: function ariaRole() {
1607
+ if (!this.inline) {
1608
+ return 'dialog';
1609
+ }
1610
+ }
1611
+ },
1612
+ watch: {
1613
+ value: function value(_value2) {
1614
+ this.colorSelected = new Color(_value2);
1615
+ }
1616
+ },
1617
+ methods: {
1618
+ updateColor: function updateColor(value) {
1619
+ value.alpha = this.colorSelected.alpha;
1620
+ this.colorSelected = value;
1621
+ this.$emit('change', value);
1622
+ },
1623
+
1624
+ /*
1625
+ * Format color into string
1626
+ */
1627
+ formatValue: function formatValue(value) {
1628
+ return value ? this.colorFormatter(value, this) : null;
1629
+ },
1630
+
1631
+ /*
1632
+ * Toggle datepicker
1633
+ */
1634
+ togglePicker: function togglePicker(active) {
1635
+ if (this.$refs.dropdown) {
1636
+ var isActive = typeof active === 'boolean' ? active : !this.$refs.dropdown.isActive;
1637
+
1638
+ if (isActive) {
1639
+ this.$refs.dropdown.isActive = isActive;
1640
+ } else if (this.closeOnClick) {
1641
+ this.$refs.dropdown.isActive = isActive;
1642
+ }
1643
+ }
1644
+ },
1645
+
1646
+ /*
1647
+ * Call default onFocus method and show datepicker
1648
+ */
1649
+ handleOnFocus: function handleOnFocus(event) {
1650
+ this.onFocus(event);
1651
+
1652
+ if (this.openOnFocus) {
1653
+ this.togglePicker(true);
1654
+ }
1655
+ },
1656
+
1657
+ /*
1658
+ * Toggle dropdown
1659
+ */
1660
+ toggle: function toggle() {
1661
+ if (this.mobileNative && this.isMobile) {
1662
+ var input = this.$refs.input.$refs.input;
1663
+ input.focus();
1664
+ input.click();
1665
+ return;
1666
+ }
1667
+
1668
+ this.$refs.dropdown.toggle();
1669
+ },
1670
+
1671
+ /*
1672
+ * Avoid dropdown toggle when is already visible
1673
+ */
1674
+ onInputClick: function onInputClick(event) {
1675
+ if (this.$refs.dropdown.isActive) {
1676
+ event.stopPropagation();
1677
+ }
1678
+ },
1679
+
1680
+ /**
1681
+ * Keypress event that is bound to the document.
1682
+ */
1683
+ keyPress: function keyPress(_ref) {
1684
+ var key = _ref.key;
1685
+
1686
+ if (this.$refs.dropdown && this.$refs.dropdown.isActive && (key === 'Escape' || key === 'Esc')) {
1687
+ this.togglePicker(false);
1688
+ }
1689
+ },
1690
+
1691
+ /**
1692
+ * Emit 'blur' event on dropdown is not active (closed)
1693
+ */
1694
+ onActiveChange: function onActiveChange(value) {
1695
+ if (!value) {
1696
+ this.onBlur();
1697
+ }
1698
+ /*
1699
+ * Emit 'active-change' when on dropdown active state change
1700
+ */
1701
+
1702
+
1703
+ this.$emit('active-change', value);
1704
+ }
1705
+ }
1706
+ };
1707
+
1708
+ /* script */
1709
+ const __vue_script__$3 = script$3;
1710
+
1711
+ /* template */
1712
+ 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)};
1713
+ var __vue_staticRenderFns__$3 = [];
1714
+
1715
+ /* style */
1716
+ const __vue_inject_styles__$3 = undefined;
1717
+ /* scoped */
1718
+ const __vue_scope_id__$3 = undefined;
1719
+ /* module identifier */
1720
+ const __vue_module_identifier__$3 = undefined;
1721
+ /* functional template */
1722
+ const __vue_is_functional_template__$3 = false;
1723
+ /* style inject */
1724
+
1725
+ /* style inject SSR */
1726
+
1727
+
1728
+
1729
+ var Colorpicker = __vue_normalize__(
1730
+ { render: __vue_render__$3, staticRenderFns: __vue_staticRenderFns__$3 },
1731
+ __vue_inject_styles__$3,
1732
+ __vue_script__$3,
1733
+ __vue_scope_id__$3,
1734
+ __vue_is_functional_template__$3,
1735
+ __vue_module_identifier__$3,
1736
+ undefined,
1737
+ undefined
1738
+ );
1739
+
1740
+ var Plugin = {
1741
+ install: function install(Vue) {
1742
+ registerComponent(Vue, Colorpicker);
1743
+ }
1744
+ };
1745
+ use(Plugin);
1746
+
1747
+ export default Plugin;
1748
+ export { Colorpicker as BColorpicker };