buefy 1.0.0 → 1.0.2

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 (588) hide show
  1. package/LICENSE.md +21 -0
  2. package/README.md +242 -0
  3. package/dist/buefy.css +15895 -0
  4. package/dist/buefy.d.ts +11706 -0
  5. package/dist/buefy.esm.js +21082 -0
  6. package/dist/buefy.esm.min.js +2 -0
  7. package/dist/buefy.js +21227 -0
  8. package/dist/buefy.min.css +1 -0
  9. package/dist/buefy.min.js +2 -0
  10. package/dist/cjs/Autocomplete-BMmOsPiK.js +864 -0
  11. package/dist/cjs/Button-Cq7yqI8p.js +118 -0
  12. package/dist/cjs/CheckRadioMixin-CDu0SN3g.js +58 -0
  13. package/dist/cjs/Checkbox-GPzAMQqM.js +85 -0
  14. package/dist/cjs/CompatFallthroughMixin-hhK0Gkhr.js +48 -0
  15. package/dist/cjs/Datepicker-B-9ReBe6.js +2120 -0
  16. package/dist/cjs/Dropdown-DtpKU9qf.js +470 -0
  17. package/dist/cjs/DropdownItem-IMOKyRGV.js +110 -0
  18. package/dist/cjs/Field-19ZCJFF8.js +405 -0
  19. package/dist/cjs/FormElementMixin-DavX4iOv.js +170 -0
  20. package/dist/cjs/Icon-lsDKE2wQ.js +184 -0
  21. package/dist/cjs/Image-CocPwU3n.js +356 -0
  22. package/dist/cjs/InjectedChildMixin-CUKn09dB.js +150 -0
  23. package/dist/cjs/Input-BcloGeZ3.js +350 -0
  24. package/dist/cjs/Loading-GqqqjipO.js +145 -0
  25. package/dist/cjs/MessageMixin-bGuuzfev.js +136 -0
  26. package/dist/cjs/Modal-CYpSQe2Q.js +315 -0
  27. package/dist/cjs/NoticeMixin--3RjH43z.js +163 -0
  28. package/dist/cjs/Pagination-D1MVdiLp.js +547 -0
  29. package/dist/cjs/Progress-DT9Qc8Id.js +177 -0
  30. package/dist/cjs/Select-DayPKwCY.js +147 -0
  31. package/dist/cjs/SlotComponent-BruGdRW3.js +41 -0
  32. package/dist/cjs/TabbedChildMixin-B3JUUwcf.js +211 -0
  33. package/dist/cjs/Tag-BprnwJJ1.js +167 -0
  34. package/dist/cjs/Timepicker-CDZ3V-2J.js +283 -0
  35. package/dist/cjs/TimepickerMixin-C9WVvcUL.js +666 -0
  36. package/dist/cjs/Tooltip-Cgighv0j.js +393 -0
  37. package/dist/cjs/_plugin-vue_export-helper-Die8u8yB.js +11 -0
  38. package/dist/cjs/autocomplete.js +23 -0
  39. package/dist/cjs/breadcrumb.js +107 -0
  40. package/dist/cjs/button.js +20 -0
  41. package/dist/cjs/carousel.js +825 -0
  42. package/dist/cjs/checkbox.js +88 -0
  43. package/dist/cjs/clockpicker.js +668 -0
  44. package/dist/cjs/collapse.js +99 -0
  45. package/dist/cjs/colorpicker.js +25 -0
  46. package/dist/cjs/config-DR826Ki2.js +103 -0
  47. package/dist/cjs/config.js +18 -0
  48. package/dist/cjs/datepicker.js +28 -0
  49. package/dist/cjs/datetimepicker.js +483 -0
  50. package/dist/cjs/dialog.js +506 -0
  51. package/dist/cjs/dropdown.js +23 -0
  52. package/dist/cjs/field.js +19 -0
  53. package/dist/cjs/helpers.js +276 -0
  54. package/dist/cjs/icon.js +19 -0
  55. package/dist/cjs/image.js +19 -0
  56. package/dist/cjs/index-DiQy3SCb.js +1942 -0
  57. package/dist/cjs/index.js +274 -0
  58. package/dist/cjs/input.js +22 -0
  59. package/dist/cjs/loading.js +87 -0
  60. package/dist/cjs/menu.js +340 -0
  61. package/dist/cjs/message.js +119 -0
  62. package/dist/cjs/modal.js +103 -0
  63. package/dist/cjs/navbar.js +572 -0
  64. package/dist/cjs/notification.js +281 -0
  65. package/dist/cjs/numberinput.js +386 -0
  66. package/dist/cjs/pagination.js +22 -0
  67. package/dist/cjs/plugins-DbyYGVpp.js +16 -0
  68. package/dist/cjs/progress.js +91 -0
  69. package/dist/cjs/radio.js +137 -0
  70. package/dist/cjs/rate.js +197 -0
  71. package/dist/cjs/select.js +22 -0
  72. package/dist/cjs/sidebar.js +309 -0
  73. package/dist/cjs/skeleton.js +78 -0
  74. package/dist/cjs/slider.js +699 -0
  75. package/dist/cjs/snackbar.js +224 -0
  76. package/dist/cjs/ssr-DVRFTu_P.js +8 -0
  77. package/dist/cjs/steps.js +347 -0
  78. package/dist/cjs/switch.js +161 -0
  79. package/dist/cjs/table.js +2391 -0
  80. package/dist/cjs/tabs.js +258 -0
  81. package/dist/cjs/tag.js +44 -0
  82. package/dist/cjs/taginput.js +425 -0
  83. package/dist/cjs/timepicker.js +29 -0
  84. package/dist/cjs/toast.js +162 -0
  85. package/dist/cjs/tooltip.js +19 -0
  86. package/dist/cjs/trapFocus-BlX6xykt.js +53 -0
  87. package/dist/cjs/upload.js +195 -0
  88. package/dist/components/autocomplete/index.js +1647 -0
  89. package/dist/components/autocomplete/index.min.js +2 -0
  90. package/dist/components/breadcrumb/index.js +173 -0
  91. package/dist/components/breadcrumb/index.min.js +2 -0
  92. package/dist/components/button/index.js +334 -0
  93. package/dist/components/button/index.min.js +2 -0
  94. package/dist/components/carousel/index.js +1534 -0
  95. package/dist/components/carousel/index.min.js +2 -0
  96. package/dist/components/checkbox/index.js +236 -0
  97. package/dist/components/checkbox/index.min.js +2 -0
  98. package/dist/components/clockpicker/index.js +2636 -0
  99. package/dist/components/clockpicker/index.min.js +2 -0
  100. package/dist/components/collapse/index.js +111 -0
  101. package/dist/components/collapse/index.min.js +2 -0
  102. package/dist/components/colorpicker/index.js +4251 -0
  103. package/dist/components/colorpicker/index.min.js +2 -0
  104. package/dist/components/datepicker/index.js +4110 -0
  105. package/dist/components/datepicker/index.min.js +2 -0
  106. package/dist/components/datetimepicker/index.js +5479 -0
  107. package/dist/components/datetimepicker/index.min.js +2 -0
  108. package/dist/components/dialog/index.js +1202 -0
  109. package/dist/components/dialog/index.min.js +2 -0
  110. package/dist/components/dropdown/index.js +680 -0
  111. package/dist/components/dropdown/index.min.js +2 -0
  112. package/dist/components/field/index.js +439 -0
  113. package/dist/components/field/index.min.js +2 -0
  114. package/dist/components/icon/index.js +212 -0
  115. package/dist/components/icon/index.min.js +2 -0
  116. package/dist/components/image/index.js +396 -0
  117. package/dist/components/image/index.min.js +2 -0
  118. package/dist/components/input/index.js +764 -0
  119. package/dist/components/input/index.min.js +2 -0
  120. package/dist/components/loading/index.js +280 -0
  121. package/dist/components/loading/index.min.js +2 -0
  122. package/dist/components/menu/index.js +586 -0
  123. package/dist/components/menu/index.min.js +2 -0
  124. package/dist/components/message/index.js +611 -0
  125. package/dist/components/message/index.min.js +2 -0
  126. package/dist/components/modal/index.js +516 -0
  127. package/dist/components/modal/index.min.js +2 -0
  128. package/dist/components/navbar/index.js +634 -0
  129. package/dist/components/navbar/index.min.js +2 -0
  130. package/dist/components/notification/index.js +976 -0
  131. package/dist/components/notification/index.min.js +2 -0
  132. package/dist/components/numberinput/index.js +1128 -0
  133. package/dist/components/numberinput/index.min.js +2 -0
  134. package/dist/components/pagination/index.js +764 -0
  135. package/dist/components/pagination/index.min.js +2 -0
  136. package/dist/components/progress/index.js +280 -0
  137. package/dist/components/progress/index.min.js +2 -0
  138. package/dist/components/radio/index.js +208 -0
  139. package/dist/components/radio/index.min.js +2 -0
  140. package/dist/components/rate/index.js +391 -0
  141. package/dist/components/rate/index.min.js +2 -0
  142. package/dist/components/select/index.js +560 -0
  143. package/dist/components/select/index.min.js +2 -0
  144. package/dist/components/sidebar/index.js +337 -0
  145. package/dist/components/sidebar/index.min.js +2 -0
  146. package/dist/components/skeleton/index.js +87 -0
  147. package/dist/components/skeleton/index.min.js +2 -0
  148. package/dist/components/slider/index.js +1171 -0
  149. package/dist/components/slider/index.min.js +2 -0
  150. package/dist/components/snackbar/index.js +439 -0
  151. package/dist/components/snackbar/index.min.js +2 -0
  152. package/dist/components/steps/index.js +925 -0
  153. package/dist/components/steps/index.min.js +2 -0
  154. package/dist/components/switch/index.js +182 -0
  155. package/dist/components/switch/index.min.js +2 -0
  156. package/dist/components/table/index.js +4208 -0
  157. package/dist/components/table/index.min.js +2 -0
  158. package/dist/components/tabs/index.js +837 -0
  159. package/dist/components/tabs/index.min.js +2 -0
  160. package/dist/components/tag/index.js +396 -0
  161. package/dist/components/tag/index.min.js +2 -0
  162. package/dist/components/taginput/index.js +2209 -0
  163. package/dist/components/taginput/index.min.js +2 -0
  164. package/dist/components/timepicker/index.js +2906 -0
  165. package/dist/components/timepicker/index.min.js +2 -0
  166. package/dist/components/toast/index.js +377 -0
  167. package/dist/components/toast/index.min.js +2 -0
  168. package/dist/components/tooltip/index.js +445 -0
  169. package/dist/components/tooltip/index.min.js +2 -0
  170. package/dist/components/upload/index.js +426 -0
  171. package/dist/components/upload/index.min.js +2 -0
  172. package/dist/esm/Autocomplete-CjbTh9D8.js +862 -0
  173. package/dist/esm/Button-DyUYShTZ.js +116 -0
  174. package/dist/esm/CheckRadioMixin-DSD_rjC8.js +56 -0
  175. package/dist/esm/Checkbox-KUMz0sfA.js +83 -0
  176. package/dist/esm/CompatFallthroughMixin-C8LPuwDr.js +46 -0
  177. package/dist/esm/Datepicker-Bl8Wfdkn.js +2118 -0
  178. package/dist/esm/Dropdown-CGTYVyoL.js +467 -0
  179. package/dist/esm/DropdownItem-Cn3nM0A3.js +108 -0
  180. package/dist/esm/Field-B7bX_uUg.js +403 -0
  181. package/dist/esm/FormElementMixin-Dd_wkBN5.js +168 -0
  182. package/dist/esm/Icon-DPyGDeRK.js +182 -0
  183. package/dist/esm/Image-DhX-4hlV.js +354 -0
  184. package/dist/esm/InjectedChildMixin-D2K-FwuO.js +145 -0
  185. package/dist/esm/Input-C4L520az.js +348 -0
  186. package/dist/esm/Loading-tuQoo6TU.js +143 -0
  187. package/dist/esm/MessageMixin-CQ7LIdvq.js +134 -0
  188. package/dist/esm/Modal-tfvyhxw_.js +313 -0
  189. package/dist/esm/NoticeMixin-ByNlva3T.js +161 -0
  190. package/dist/esm/Pagination-B-LAJQay.js +543 -0
  191. package/dist/esm/Progress-BPGTVZgr.js +174 -0
  192. package/dist/esm/Select-bl4qUzij.js +145 -0
  193. package/dist/esm/SlotComponent-BwNpVnfH.js +39 -0
  194. package/dist/esm/TabbedChildMixin-C4i6WP9j.js +208 -0
  195. package/dist/esm/Tag-jS5Bcj6N.js +165 -0
  196. package/dist/esm/Timepicker-DnkqnOBT.js +281 -0
  197. package/dist/esm/TimepickerMixin-Bikh6_Fg.js +664 -0
  198. package/dist/esm/Tooltip-CtDSXAqa.js +391 -0
  199. package/dist/esm/_plugin-vue_export-helper-OJRSZE6i.js +9 -0
  200. package/dist/esm/autocomplete.js +18 -0
  201. package/dist/esm/breadcrumb.js +101 -0
  202. package/dist/esm/button.js +15 -0
  203. package/dist/esm/carousel.js +818 -0
  204. package/dist/esm/checkbox.js +82 -0
  205. package/dist/esm/clockpicker.js +663 -0
  206. package/dist/esm/collapse.js +94 -0
  207. package/dist/esm/colorpicker.js +16 -0
  208. package/dist/esm/config-CKuo-p6e.js +100 -0
  209. package/dist/esm/config.js +14 -0
  210. package/dist/esm/datepicker.js +23 -0
  211. package/dist/esm/datetimepicker.js +478 -0
  212. package/dist/esm/dialog.js +500 -0
  213. package/dist/esm/dropdown.js +17 -0
  214. package/dist/esm/field.js +14 -0
  215. package/dist/esm/helpers.js +247 -0
  216. package/dist/esm/icon.js +14 -0
  217. package/dist/esm/image.js +14 -0
  218. package/dist/esm/index-CQegEsxK.js +1938 -0
  219. package/dist/esm/index.js +164 -0
  220. package/dist/esm/input.js +17 -0
  221. package/dist/esm/loading.js +81 -0
  222. package/dist/esm/menu.js +333 -0
  223. package/dist/esm/message.js +114 -0
  224. package/dist/esm/modal.js +97 -0
  225. package/dist/esm/navbar.js +565 -0
  226. package/dist/esm/notification.js +275 -0
  227. package/dist/esm/numberinput.js +381 -0
  228. package/dist/esm/pagination.js +16 -0
  229. package/dist/esm/plugins-B172kuKE.js +13 -0
  230. package/dist/esm/progress.js +85 -0
  231. package/dist/esm/radio.js +131 -0
  232. package/dist/esm/rate.js +192 -0
  233. package/dist/esm/select.js +17 -0
  234. package/dist/esm/sidebar.js +304 -0
  235. package/dist/esm/skeleton.js +73 -0
  236. package/dist/esm/slider.js +693 -0
  237. package/dist/esm/snackbar.js +218 -0
  238. package/dist/esm/ssr-C7yEpGLm.js +5 -0
  239. package/dist/esm/steps.js +341 -0
  240. package/dist/esm/switch.js +156 -0
  241. package/dist/esm/table.js +2385 -0
  242. package/dist/esm/tabs.js +252 -0
  243. package/dist/esm/tag.js +38 -0
  244. package/dist/esm/taginput.js +420 -0
  245. package/dist/esm/timepicker.js +24 -0
  246. package/dist/esm/toast.js +156 -0
  247. package/dist/esm/tooltip.js +14 -0
  248. package/dist/esm/trapFocus-KHP_kCNE.js +51 -0
  249. package/dist/esm/upload.js +190 -0
  250. package/dist/tsdoc-metadata.json +11 -0
  251. package/package.json +73 -6
  252. package/src/components/autocomplete/Autocomplete.spec.ts +783 -0
  253. package/src/components/autocomplete/Autocomplete.vue +966 -0
  254. package/src/components/autocomplete/__snapshots__/Autocomplete.spec.ts.snap +21 -0
  255. package/src/components/autocomplete/index.ts +16 -0
  256. package/src/components/breadcrumb/Breadcrumb.spec.ts +65 -0
  257. package/src/components/breadcrumb/Breadcrumb.vue +42 -0
  258. package/src/components/breadcrumb/BreadcrumbItem.spec.ts +74 -0
  259. package/src/components/breadcrumb/BreadcrumbItem.vue +34 -0
  260. package/src/components/breadcrumb/__snapshots__/Breadcrumb.spec.ts.snap +7 -0
  261. package/src/components/breadcrumb/__snapshots__/BreadcrumbItem.spec.ts.snap +3 -0
  262. package/src/components/breadcrumb/index.ts +19 -0
  263. package/src/components/button/Button.spec.ts +117 -0
  264. package/src/components/button/Button.vue +112 -0
  265. package/src/components/button/__snapshots__/Button.spec.ts.snap +9 -0
  266. package/src/components/button/index.ts +16 -0
  267. package/src/components/carousel/Carousel.spec.ts +304 -0
  268. package/src/components/carousel/Carousel.vue +389 -0
  269. package/src/components/carousel/CarouselItem.spec.ts +105 -0
  270. package/src/components/carousel/CarouselItem.vue +38 -0
  271. package/src/components/carousel/CarouselList.spec.ts +172 -0
  272. package/src/components/carousel/CarouselList.vue +364 -0
  273. package/src/components/carousel/__snapshots__/Carousel.spec.ts.snap +19 -0
  274. package/src/components/carousel/__snapshots__/CarouselItem.spec.ts.snap +7 -0
  275. package/src/components/carousel/__snapshots__/CarouselList.spec.ts.snap +36 -0
  276. package/src/components/carousel/index.ts +23 -0
  277. package/src/components/carousel/types.ts +17 -0
  278. package/src/components/checkbox/Checkbox.spec.ts +40 -0
  279. package/src/components/checkbox/Checkbox.vue +63 -0
  280. package/src/components/checkbox/CheckboxButton.spec.ts +46 -0
  281. package/src/components/checkbox/CheckboxButton.vue +59 -0
  282. package/src/components/checkbox/__snapshots__/Checkbox.spec.ts.snap +9 -0
  283. package/src/components/checkbox/__snapshots__/CheckboxButton.spec.ts.snap +3 -0
  284. package/src/components/checkbox/index.ts +20 -0
  285. package/src/components/clockpicker/Clockpicker.spec.ts +161 -0
  286. package/src/components/clockpicker/Clockpicker.vue +311 -0
  287. package/src/components/clockpicker/ClockpickerFace.spec.ts +99 -0
  288. package/src/components/clockpicker/ClockpickerFace.vue +272 -0
  289. package/src/components/clockpicker/__snapshots__/Clockpicker.spec.ts.snap +36 -0
  290. package/src/components/clockpicker/__snapshots__/ClockpickerFace.spec.ts.snap +9 -0
  291. package/src/components/clockpicker/index.ts +16 -0
  292. package/src/components/collapse/Collapse.spec.ts +106 -0
  293. package/src/components/collapse/Collapse.vue +98 -0
  294. package/src/components/collapse/__snapshots__/Collapse.spec.ts.snap +10 -0
  295. package/src/components/collapse/index.ts +16 -0
  296. package/src/components/colorpicker/Colorpicker.spec.ts +22 -0
  297. package/src/components/colorpicker/Colorpicker.vue +416 -0
  298. package/src/components/colorpicker/ColorpickerAlphaSlider.spec.ts +17 -0
  299. package/src/components/colorpicker/ColorpickerAlphaSlider.vue +205 -0
  300. package/src/components/colorpicker/ColorpickerHSLRepresentationSquare.spec.ts +23 -0
  301. package/src/components/colorpicker/ColorpickerHSLRepresentationSquare.vue +380 -0
  302. package/src/components/colorpicker/ColorpickerHSLRepresentationTriangle.spec.ts +23 -0
  303. package/src/components/colorpicker/ColorpickerHSLRepresentationTriangle.vue +456 -0
  304. package/src/components/colorpicker/__snapshots__/Colorpicker.spec.ts.snap +77 -0
  305. package/src/components/colorpicker/__snapshots__/ColorpickerAlphaSlider.spec.ts.snap +9 -0
  306. package/src/components/colorpicker/__snapshots__/ColorpickerHSLRepresentationSquare.spec.ts.snap +12 -0
  307. package/src/components/colorpicker/__snapshots__/ColorpickerHSLRepresentationTriangle.spec.ts.snap +36 -0
  308. package/src/components/colorpicker/index.ts +16 -0
  309. package/src/components/datepicker/Datepicker.spec.ts +482 -0
  310. package/src/components/datepicker/Datepicker.vue +908 -0
  311. package/src/components/datepicker/DatepickerMonth.spec.ts +346 -0
  312. package/src/components/datepicker/DatepickerMonth.vue +444 -0
  313. package/src/components/datepicker/DatepickerTable.spec.ts +290 -0
  314. package/src/components/datepicker/DatepickerTable.vue +398 -0
  315. package/src/components/datepicker/DatepickerTableRow.spec.ts +300 -0
  316. package/src/components/datepicker/DatepickerTableRow.vue +416 -0
  317. package/src/components/datepicker/__snapshots__/Datepicker.spec.ts.snap +54 -0
  318. package/src/components/datepicker/__snapshots__/DatepickerMonth.spec.ts.snap +33 -0
  319. package/src/components/datepicker/__snapshots__/DatepickerTable.spec.ts.snap +16 -0
  320. package/src/components/datepicker/__snapshots__/DatepickerTableRow.spec.ts.snap +23 -0
  321. package/src/components/datepicker/index.ts +17 -0
  322. package/src/components/datepicker/types.ts +41 -0
  323. package/src/components/datetimepicker/Datetimepicker.spec.ts +132 -0
  324. package/src/components/datetimepicker/Datetimepicker.vue +491 -0
  325. package/src/components/datetimepicker/index.ts +16 -0
  326. package/src/components/dialog/Dialog.spec.ts +108 -0
  327. package/src/components/dialog/Dialog.vue +300 -0
  328. package/src/components/dialog/index.ts +169 -0
  329. package/src/components/dropdown/Dropdown.spec.ts +229 -0
  330. package/src/components/dropdown/Dropdown.vue +491 -0
  331. package/src/components/dropdown/DropdownItem.spec.ts +78 -0
  332. package/src/components/dropdown/DropdownItem.vue +112 -0
  333. package/src/components/dropdown/__snapshots__/Dropdown.spec.ts.snap +15 -0
  334. package/src/components/dropdown/__snapshots__/DropdownItem.spec.ts.snap +3 -0
  335. package/src/components/dropdown/index.ts +20 -0
  336. package/src/components/field/Field.spec.ts +324 -0
  337. package/src/components/field/Field.vue +316 -0
  338. package/src/components/field/FieldBody.spec.ts +96 -0
  339. package/src/components/field/FieldBody.vue +74 -0
  340. package/src/components/field/__snapshots__/Field.spec.ts.snap +8 -0
  341. package/src/components/field/__snapshots__/FieldBody.spec.ts.snap +3 -0
  342. package/src/components/field/index.ts +16 -0
  343. package/src/components/icon/Icon.spec.ts +142 -0
  344. package/src/components/icon/Icon.vue +120 -0
  345. package/src/components/icon/__snapshots__/Icon.spec.ts.snap +3 -0
  346. package/src/components/icon/index.ts +17 -0
  347. package/src/components/image/Image.spec.ts +218 -0
  348. package/src/components/image/Image.vue +358 -0
  349. package/src/components/image/__snapshots__/Image.spec.ts.snap +37 -0
  350. package/src/components/image/index.ts +16 -0
  351. package/src/components/index.ts +179 -0
  352. package/src/components/input/Input.spec.ts +396 -0
  353. package/src/components/input/Input.vue +335 -0
  354. package/src/components/input/__snapshots__/Input.spec.ts.snap +9 -0
  355. package/src/components/input/index.ts +17 -0
  356. package/src/components/loading/Loading.spec.ts +151 -0
  357. package/src/components/loading/Loading.vue +135 -0
  358. package/src/components/loading/__snapshots__/Loading.spec.ts.snap +10 -0
  359. package/src/components/loading/index.ts +91 -0
  360. package/src/components/menu/Menu.spec.ts +21 -0
  361. package/src/components/menu/Menu.vue +31 -0
  362. package/src/components/menu/MenuItem.spec.ts +92 -0
  363. package/src/components/menu/MenuItem.vue +168 -0
  364. package/src/components/menu/MenuItemContainerMixin.ts +72 -0
  365. package/src/components/menu/MenuList.spec.ts +35 -0
  366. package/src/components/menu/MenuList.vue +47 -0
  367. package/src/components/menu/__snapshots__/Menu.spec.ts.snap +3 -0
  368. package/src/components/menu/__snapshots__/MenuItem.spec.ts.snap +9 -0
  369. package/src/components/menu/__snapshots__/MenuList.spec.ts.snap +8 -0
  370. package/src/components/menu/index.ts +25 -0
  371. package/src/components/message/Message.spec.ts +30 -0
  372. package/src/components/message/Message.vue +73 -0
  373. package/src/components/message/__snapshots__/Message.spec.ts.snap +11 -0
  374. package/src/components/message/index.ts +15 -0
  375. package/src/components/modal/Modal.spec.ts +167 -0
  376. package/src/components/modal/Modal.vue +335 -0
  377. package/src/components/modal/__snapshots__/Modal.spec.ts.snap +10 -0
  378. package/src/components/modal/index.ts +107 -0
  379. package/src/components/navbar/NavBar.spec.ts +78 -0
  380. package/src/components/navbar/NavBarBurger.spec.ts +30 -0
  381. package/src/components/navbar/NavBarItem.spec.ts +92 -0
  382. package/src/components/navbar/Navbar.vue +274 -0
  383. package/src/components/navbar/NavbarBurger.vue +29 -0
  384. package/src/components/navbar/NavbarDropdown.spec.ts +84 -0
  385. package/src/components/navbar/NavbarDropdown.vue +115 -0
  386. package/src/components/navbar/NavbarItem.vue +97 -0
  387. package/src/components/navbar/__snapshots__/NavBar.spec.ts.snap +11 -0
  388. package/src/components/navbar/__snapshots__/NavBarBurger.spec.ts.snap +3 -0
  389. package/src/components/navbar/__snapshots__/NavBarItem.spec.ts.snap +3 -0
  390. package/src/components/navbar/__snapshots__/NavbarDropdown.spec.ts.snap +7 -0
  391. package/src/components/navbar/index.ts +22 -0
  392. package/src/components/notification/Notification.spec.ts +21 -0
  393. package/src/components/notification/Notification.vue +77 -0
  394. package/src/components/notification/NotificationNotice.vue +76 -0
  395. package/src/components/notification/__snapshots__/Notification.spec.ts.snap +10 -0
  396. package/src/components/notification/index.ts +121 -0
  397. package/src/components/numberinput/Numberinput.spec.ts +445 -0
  398. package/src/components/numberinput/Numberinput.vue +372 -0
  399. package/src/components/numberinput/index.ts +16 -0
  400. package/src/components/pagination/Pagination.spec.ts +94 -0
  401. package/src/components/pagination/Pagination.vue +434 -0
  402. package/src/components/pagination/PaginationButton.spec.ts +42 -0
  403. package/src/components/pagination/PaginationButton.vue +59 -0
  404. package/src/components/pagination/__snapshots__/Pagination.spec.ts.snap +22 -0
  405. package/src/components/pagination/__snapshots__/PaginationButton.spec.ts.snap +3 -0
  406. package/src/components/pagination/index.ts +19 -0
  407. package/src/components/pagination/types.ts +11 -0
  408. package/src/components/progress/Progress.spec.ts +81 -0
  409. package/src/components/progress/Progress.vue +168 -0
  410. package/src/components/progress/ProgressBar.spec.ts +45 -0
  411. package/src/components/progress/ProgressBar.vue +74 -0
  412. package/src/components/progress/__snapshots__/Progress.spec.ts.snap +7 -0
  413. package/src/components/progress/__snapshots__/ProgressBar.spec.ts.snap +7 -0
  414. package/src/components/progress/index.ts +18 -0
  415. package/src/components/radio/Radio.spec.ts +40 -0
  416. package/src/components/radio/Radio.vue +35 -0
  417. package/src/components/radio/RadioButton.spec.ts +40 -0
  418. package/src/components/radio/RadioButton.vue +69 -0
  419. package/src/components/radio/__snapshots__/Radio.spec.ts.snap +3 -0
  420. package/src/components/radio/__snapshots__/RadioButton.spec.ts.snap +3 -0
  421. package/src/components/radio/index.ts +18 -0
  422. package/src/components/rate/Rate.spec.ts +90 -0
  423. package/src/components/rate/Rate.vue +158 -0
  424. package/src/components/rate/index.ts +15 -0
  425. package/src/components/select/Select.spec.ts +74 -0
  426. package/src/components/select/Select.vue +118 -0
  427. package/src/components/select/__snapshots__/Select.spec.ts.snap +7 -0
  428. package/src/components/select/index.ts +16 -0
  429. package/src/components/sidebar/Sidebar.spec.ts +107 -0
  430. package/src/components/sidebar/Sidebar.vue +316 -0
  431. package/src/components/sidebar/__snapshots__/Sidebar.spec.ts.snap +25 -0
  432. package/src/components/sidebar/index.ts +16 -0
  433. package/src/components/skeleton/Skeleton.spec.ts +16 -0
  434. package/src/components/skeleton/Skeleton.vue +98 -0
  435. package/src/components/skeleton/__snapshots__/Skeleton.spec.ts.snap +7 -0
  436. package/src/components/skeleton/index.ts +18 -0
  437. package/src/components/slider/Slider.spec.ts +115 -0
  438. package/src/components/slider/Slider.vue +374 -0
  439. package/src/components/slider/SliderThumb.spec.ts +176 -0
  440. package/src/components/slider/SliderThumb.vue +251 -0
  441. package/src/components/slider/SliderTick.spec.ts +33 -0
  442. package/src/components/slider/SliderTick.vue +50 -0
  443. package/src/components/slider/__snapshots__/Slider.spec.ts.snap +12 -0
  444. package/src/components/slider/__snapshots__/SliderThumb.spec.ts.snap +16 -0
  445. package/src/components/slider/__snapshots__/SliderTick.spec.ts.snap +7 -0
  446. package/src/components/slider/index.ts +19 -0
  447. package/src/components/slider/types.ts +34 -0
  448. package/src/components/snackbar/Snackbar.spec.ts +35 -0
  449. package/src/components/snackbar/Snackbar.vue +88 -0
  450. package/src/components/snackbar/__snapshots__/Snackbar.spec.ts.snap +12 -0
  451. package/src/components/snackbar/index.ts +118 -0
  452. package/src/components/steps/StepItem.spec.ts +114 -0
  453. package/src/components/steps/StepItem.vue +26 -0
  454. package/src/components/steps/Steps.spec.ts +125 -0
  455. package/src/components/steps/Steps.vue +273 -0
  456. package/src/components/steps/__snapshots__/StepItem.spec.ts.snap +7 -0
  457. package/src/components/steps/__snapshots__/Steps.spec.ts.snap +40 -0
  458. package/src/components/steps/index.ts +19 -0
  459. package/src/components/switch/Switch.spec.ts +74 -0
  460. package/src/components/switch/Switch.vue +146 -0
  461. package/src/components/switch/__snapshots__/Switch.spec.ts.snap +3 -0
  462. package/src/components/switch/index.ts +16 -0
  463. package/src/components/table/Table.spec.ts +622 -0
  464. package/src/components/table/Table.vue +1770 -0
  465. package/src/components/table/TableColumn.spec.ts +85 -0
  466. package/src/components/table/TableColumn.vue +140 -0
  467. package/src/components/table/TableMobileSort.spec.ts +47 -0
  468. package/src/components/table/TableMobileSort.vue +236 -0
  469. package/src/components/table/TablePagination.vue +86 -0
  470. package/src/components/table/__snapshots__/Table.spec.ts.snap +24 -0
  471. package/src/components/table/__snapshots__/TableMobileSort.spec.ts.snap +12 -0
  472. package/src/components/table/index.ts +32 -0
  473. package/src/components/table/mockTableColumn.ts +110 -0
  474. package/src/components/table/types.ts +110 -0
  475. package/src/components/tabs/TabItem.spec.ts +203 -0
  476. package/src/components/tabs/TabItem.vue +19 -0
  477. package/src/components/tabs/Tabs.spec.ts +122 -0
  478. package/src/components/tabs/Tabs.vue +204 -0
  479. package/src/components/tabs/__snapshots__/TabItem.spec.ts.snap +7 -0
  480. package/src/components/tabs/__snapshots__/Tabs.spec.ts.snap +33 -0
  481. package/src/components/tabs/index.ts +19 -0
  482. package/src/components/tag/Tag.spec.ts +32 -0
  483. package/src/components/tag/Tag.vue +132 -0
  484. package/src/components/tag/Taglist.spec.ts +21 -0
  485. package/src/components/tag/Taglist.vue +16 -0
  486. package/src/components/tag/__snapshots__/Tag.spec.ts.snap +6 -0
  487. package/src/components/tag/__snapshots__/Taglist.spec.ts.snap +3 -0
  488. package/src/components/tag/index.ts +19 -0
  489. package/src/components/taginput/Taginput.spec.ts +132 -0
  490. package/src/components/taginput/Taginput.vue +415 -0
  491. package/src/components/taginput/__snapshots__/Taginput.spec.ts.snap +10 -0
  492. package/src/components/taginput/index.ts +16 -0
  493. package/src/components/timepicker/Timepicker.spec.ts +108 -0
  494. package/src/components/timepicker/Timepicker.vue +183 -0
  495. package/src/components/timepicker/__snapshots__/Timepicker.spec.ts.snap +41 -0
  496. package/src/components/timepicker/index.ts +17 -0
  497. package/src/components/toast/Toast.spec.ts +74 -0
  498. package/src/components/toast/Toast.vue +46 -0
  499. package/src/components/toast/__snapshots__/Toast.spec.ts.snap +10 -0
  500. package/src/components/toast/index.ts +120 -0
  501. package/src/components/tooltip/Tooltip.spec.ts +64 -0
  502. package/src/components/tooltip/Tooltip.vue +393 -0
  503. package/src/components/tooltip/__snapshots__/Tooltip.spec.ts.snap +12 -0
  504. package/src/components/tooltip/index.ts +16 -0
  505. package/src/components/upload/Upload.spec.ts +62 -0
  506. package/src/components/upload/Upload.vue +188 -0
  507. package/src/components/upload/__snapshots__/Upload.spec.ts.snap +3 -0
  508. package/src/components/upload/index.ts +15 -0
  509. package/src/directives/clickOutside.ts +113 -0
  510. package/src/directives/trapFocus.ts +61 -0
  511. package/src/index.ts +43 -0
  512. package/src/scss/buefy-build.scss +6 -0
  513. package/src/scss/buefy.scss +39 -0
  514. package/src/scss/components/_autocomplete.scss +39 -0
  515. package/src/scss/components/_carousel.scss +204 -0
  516. package/src/scss/components/_checkbox.scss +106 -0
  517. package/src/scss/components/_clockpicker.scss +283 -0
  518. package/src/scss/components/_collapse.scss +9 -0
  519. package/src/scss/components/_colorpicker.scss +283 -0
  520. package/src/scss/components/_datepicker.scss +220 -0
  521. package/src/scss/components/_dialog.scss +54 -0
  522. package/src/scss/components/_dropdown.scss +143 -0
  523. package/src/scss/components/_form.scss +309 -0
  524. package/src/scss/components/_icon.scss +16 -0
  525. package/src/scss/components/_image.scss +20 -0
  526. package/src/scss/components/_loading.scss +45 -0
  527. package/src/scss/components/_menu.scss +11 -0
  528. package/src/scss/components/_message.scss +16 -0
  529. package/src/scss/components/_modal.scss +37 -0
  530. package/src/scss/components/_navbar.scss +22 -0
  531. package/src/scss/components/_notices.scss +144 -0
  532. package/src/scss/components/_notification.scss +8 -0
  533. package/src/scss/components/_numberinput.scss +33 -0
  534. package/src/scss/components/_pagination.scss +63 -0
  535. package/src/scss/components/_progress.scss +105 -0
  536. package/src/scss/components/_radio.scss +123 -0
  537. package/src/scss/components/_rate.scss +72 -0
  538. package/src/scss/components/_select.scss +38 -0
  539. package/src/scss/components/_sidebar.scss +107 -0
  540. package/src/scss/components/_skeleton.scss +66 -0
  541. package/src/scss/components/_slider.scss +162 -0
  542. package/src/scss/components/_steps.scss +491 -0
  543. package/src/scss/components/_switch.scss +214 -0
  544. package/src/scss/components/_table.scss +322 -0
  545. package/src/scss/components/_tabs.scss +197 -0
  546. package/src/scss/components/_tag.scss +36 -0
  547. package/src/scss/components/_taginput.scss +73 -0
  548. package/src/scss/components/_timepicker.scss +73 -0
  549. package/src/scss/components/_tooltip.scss +192 -0
  550. package/src/scss/components/_upload.scss +62 -0
  551. package/src/scss/utils/_all.scss +4 -0
  552. package/src/scss/utils/_animations.scss +183 -0
  553. package/src/scss/utils/_functions.scss +49 -0
  554. package/src/scss/utils/_helpers.scss +6 -0
  555. package/src/scss/utils/_variables-ext.scss +2 -0
  556. package/src/scss/utils/_variables.scss +16 -0
  557. package/src/utils/CheckRadioMixin.spec.ts +28 -0
  558. package/src/utils/CheckRadioMixin.ts +61 -0
  559. package/src/utils/CompatFallthroughMixin.ts +34 -0
  560. package/src/utils/ConfigComponent.ts +12 -0
  561. package/src/utils/FormElementMixin.spec.ts +41 -0
  562. package/src/utils/FormElementMixin.ts +206 -0
  563. package/src/utils/InjectedChildMixin.ts +139 -0
  564. package/src/utils/MessageMixin.spec.ts +51 -0
  565. package/src/utils/MessageMixin.ts +138 -0
  566. package/src/utils/NoticeMixin.spec.ts +55 -0
  567. package/src/utils/NoticeMixin.ts +181 -0
  568. package/src/utils/ProvideInjectTypes.ts +20 -0
  569. package/src/utils/ProviderParentMixin.ts +105 -0
  570. package/src/utils/SlotComponent.spec.ts +55 -0
  571. package/src/utils/SlotComponent.ts +38 -0
  572. package/src/utils/TabbedChildMixin.ts +96 -0
  573. package/src/utils/TabbedMixin.ts +166 -0
  574. package/src/utils/TabbedTypes.ts +33 -0
  575. package/src/utils/TimepickerMixin.spec.ts +75 -0
  576. package/src/utils/TimepickerMixin.ts +767 -0
  577. package/src/utils/color.spec.ts +55 -0
  578. package/src/utils/color.ts +507 -0
  579. package/src/utils/config.spec.ts +11 -0
  580. package/src/utils/config.ts +619 -0
  581. package/src/utils/debounce.spec.ts +52 -0
  582. package/src/utils/debounce.ts +20 -0
  583. package/src/utils/helpers.spec.ts +257 -0
  584. package/src/utils/helpers.ts +527 -0
  585. package/src/utils/icons.ts +73 -0
  586. package/src/utils/plugins.ts +20 -0
  587. package/src/utils/ssr.ts +6 -0
  588. package/src/utils/vue-augmentation.ts +35 -0
@@ -0,0 +1,1942 @@
1
+ 'use strict';
2
+
3
+ var vue = require('vue');
4
+ var FormElementMixin = require('./FormElementMixin-DavX4iOv.js');
5
+ var helpers = require('./helpers.js');
6
+ var config = require('./config-DR826Ki2.js');
7
+ var Button = require('./Button-Cq7yqI8p.js');
8
+ var Dropdown = require('./Dropdown-DtpKU9qf.js');
9
+ var DropdownItem = require('./DropdownItem-IMOKyRGV.js');
10
+ var Input = require('./Input-BcloGeZ3.js');
11
+ var Field = require('./Field-19ZCJFF8.js');
12
+ var _pluginVue_exportHelper = require('./_plugin-vue_export-helper-Die8u8yB.js');
13
+ var Tooltip = require('./Tooltip-Cgighv0j.js');
14
+ var plugins = require('./plugins-DbyYGVpp.js');
15
+
16
+ var __defProp = Object.defineProperty;
17
+ var __pow = Math.pow;
18
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
19
+ var __publicField = (obj, key, value) => __defNormalProp(obj, key + "" , value);
20
+ const colorChannels = ["red", "green", "blue", "alpha"];
21
+ const colorsNammed = {
22
+ transparent: "#00000000",
23
+ black: "#000000",
24
+ silver: "#c0c0c0",
25
+ gray: "#808080",
26
+ white: "#ffffff",
27
+ maroon: "#800000",
28
+ red: "#ff0000",
29
+ purple: "#800080",
30
+ fuchsia: "#ff00ff",
31
+ green: "#008000",
32
+ lime: "#00ff00",
33
+ olive: "#808000",
34
+ yellow: "#ffff00",
35
+ navy: "#000080",
36
+ blue: "#0000ff",
37
+ teal: "#008080",
38
+ aqua: "#00ffff",
39
+ orange: "#ffa500",
40
+ aliceblue: "#f0f8ff",
41
+ antiquewhite: "#faebd7",
42
+ aquamarine: "#7fffd4",
43
+ azure: "#f0ffff",
44
+ beige: "#f5f5dc",
45
+ bisque: "#ffe4c4",
46
+ blanchedalmond: "#ffebcd",
47
+ blueviolet: "#8a2be2",
48
+ brown: "#a52a2a",
49
+ burlywood: "#deb887",
50
+ cadetblue: "#5f9ea0",
51
+ chartreuse: "#7fff00",
52
+ chocolate: "#d2691e",
53
+ coral: "#ff7f50",
54
+ cornflowerblue: "#6495ed",
55
+ cornsilk: "#fff8dc",
56
+ crimson: "#dc143c",
57
+ cyan: "#00ffff",
58
+ darkblue: "#00008b",
59
+ darkcyan: "#008b8b",
60
+ darkgoldenrod: "#b8860b",
61
+ darkgray: "#a9a9a9",
62
+ darkgreen: "#006400",
63
+ darkgrey: "#a9a9a9",
64
+ darkkhaki: "#bdb76b",
65
+ darkmagenta: "#8b008b",
66
+ darkolivegreen: "#556b2f",
67
+ darkorange: "#ff8c00",
68
+ darkorchid: "#9932cc",
69
+ darkred: "#8b0000",
70
+ darksalmon: "#e9967a",
71
+ darkseagreen: "#8fbc8f",
72
+ darkslateblue: "#483d8b",
73
+ darkslategray: "#2f4f4f",
74
+ darkslategrey: "#2f4f4f",
75
+ darkturquoise: "#00ced1",
76
+ darkviolet: "#9400d3",
77
+ deeppink: "#ff1493",
78
+ deepskyblue: "#00bfff",
79
+ dimgray: "#696969",
80
+ dimgrey: "#696969",
81
+ dodgerblue: "#1e90ff",
82
+ firebrick: "#b22222",
83
+ floralwhite: "#fffaf0",
84
+ forestgreen: "#228b22",
85
+ gainsboro: "#dcdcdc",
86
+ ghostwhite: "#f8f8ff",
87
+ gold: "#ffd700",
88
+ goldenrod: "#daa520",
89
+ greenyellow: "#adff2f",
90
+ grey: "#808080",
91
+ honeydew: "#f0fff0",
92
+ hotpink: "#ff69b4",
93
+ indianred: "#cd5c5c",
94
+ indigo: "#4b0082",
95
+ ivory: "#fffff0",
96
+ khaki: "#f0e68c",
97
+ lavender: "#e6e6fa",
98
+ lavenderblush: "#fff0f5",
99
+ lawngreen: "#7cfc00",
100
+ lemonchiffon: "#fffacd",
101
+ lightblue: "#add8e6",
102
+ lightcoral: "#f08080",
103
+ lightcyan: "#e0ffff",
104
+ lightgoldenrodyellow: "#fafad2",
105
+ lightgray: "#d3d3d3",
106
+ lightgreen: "#90ee90",
107
+ lightgrey: "#d3d3d3",
108
+ lightpink: "#ffb6c1",
109
+ lightsalmon: "#ffa07a",
110
+ lightseagreen: "#20b2aa",
111
+ lightskyblue: "#87cefa",
112
+ lightslategray: "#778899",
113
+ lightslategrey: "#778899",
114
+ lightsteelblue: "#b0c4de",
115
+ lightyellow: "#ffffe0",
116
+ limegreen: "#32cd32",
117
+ linen: "#faf0e6",
118
+ magenta: "#ff00ff",
119
+ mediumaquamarine: "#66cdaa",
120
+ mediumblue: "#0000cd",
121
+ mediumorchid: "#ba55d3",
122
+ mediumpurple: "#9370db",
123
+ mediumseagreen: "#3cb371",
124
+ mediumslateblue: "#7b68ee",
125
+ mediumspringgreen: "#00fa9a",
126
+ mediumturquoise: "#48d1cc",
127
+ mediumvioletred: "#c71585",
128
+ midnightblue: "#191970",
129
+ mintcream: "#f5fffa",
130
+ mistyrose: "#ffe4e1",
131
+ moccasin: "#ffe4b5",
132
+ navajowhite: "#ffdead",
133
+ oldlace: "#fdf5e6",
134
+ olivedrab: "#6b8e23",
135
+ orangered: "#ff4500",
136
+ orchid: "#da70d6",
137
+ palegoldenrod: "#eee8aa",
138
+ palegreen: "#98fb98",
139
+ paleturquoise: "#afeeee",
140
+ palevioletred: "#db7093",
141
+ papayawhip: "#ffefd5",
142
+ peachpuff: "#ffdab9",
143
+ peru: "#cd853f",
144
+ pink: "#ffc0cb",
145
+ plum: "#dda0dd",
146
+ powderblue: "#b0e0e6",
147
+ rosybrown: "#bc8f8f",
148
+ royalblue: "#4169e1",
149
+ saddlebrown: "#8b4513",
150
+ salmon: "#fa8072",
151
+ sandybrown: "#f4a460",
152
+ seagreen: "#2e8b57",
153
+ seashell: "#fff5ee",
154
+ sienna: "#a0522d",
155
+ skyblue: "#87ceeb",
156
+ slateblue: "#6a5acd",
157
+ slategray: "#708090",
158
+ slategrey: "#708090",
159
+ snow: "#fffafa",
160
+ springgreen: "#00ff7f",
161
+ steelblue: "#4682b4",
162
+ tan: "#d2b48c",
163
+ thistle: "#d8bfd8",
164
+ tomato: "#ff6347",
165
+ turquoise: "#40e0d0",
166
+ violet: "#ee82ee",
167
+ wheat: "#f5deb3",
168
+ whitesmoke: "#f5f5f5",
169
+ yellowgreen: "#9acd32",
170
+ rebeccapurple: "#663399"
171
+ };
172
+ class ColorTypeError extends Error {
173
+ constructor() {
174
+ super("ColorTypeError: type must be hex(a), rgb(a) or hsl(a)");
175
+ }
176
+ }
177
+ class Color {
178
+ // Since getters and setters for the color channels, e.g., "alpha", are
179
+ // dynamically defined with `Object.defineProperty` in the constructor, we
180
+ // cannot write property declarations inside the class body. Instead, we
181
+ // augment the `Color` class with an ambient module declared in `color.ts`.
182
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
183
+ constructor(...args) {
184
+ // @ts-expect-error - TypeScript failed to inter the initialization of this property
185
+ __publicField(this, "$channels");
186
+ if (args.length > 0) {
187
+ return Color.parse(...args);
188
+ }
189
+ this.$channels = new Uint8Array(colorChannels.length);
190
+ }
191
+ get red() {
192
+ return this.$channels[0];
193
+ }
194
+ set red(byte) {
195
+ if (!Number.isNaN(byte / 1)) {
196
+ this.$channels[0] = Math.min(255, Math.max(0, byte));
197
+ }
198
+ }
199
+ get green() {
200
+ return this.$channels[1];
201
+ }
202
+ set green(byte) {
203
+ if (!Number.isNaN(byte / 1)) {
204
+ this.$channels[1] = Math.min(255, Math.max(0, byte));
205
+ }
206
+ }
207
+ get blue() {
208
+ return this.$channels[2];
209
+ }
210
+ set blue(byte) {
211
+ if (!Number.isNaN(byte / 1)) {
212
+ this.$channels[2] = Math.min(255, Math.max(0, byte));
213
+ }
214
+ }
215
+ get alpha() {
216
+ return this.$channels[3];
217
+ }
218
+ set alpha(byte) {
219
+ if (!Number.isNaN(byte / 1)) {
220
+ this.$channels[3] = Math.min(255, Math.max(0, byte));
221
+ }
222
+ }
223
+ get hue() {
224
+ return this.getHue();
225
+ }
226
+ set hue(value) {
227
+ if (!Number.isNaN(value / 1)) {
228
+ this.setHue(value);
229
+ }
230
+ }
231
+ get saturation() {
232
+ return this.getSaturation();
233
+ }
234
+ set saturation(value) {
235
+ if (!Number.isNaN(value / 1)) {
236
+ this.setSaturation(value);
237
+ }
238
+ }
239
+ get lightness() {
240
+ return this.getLightness();
241
+ }
242
+ set lightness(value) {
243
+ if (!Number.isNaN(value / 1)) {
244
+ this.setLightness(value);
245
+ }
246
+ }
247
+ getHue() {
248
+ const [red, green, blue] = Array.from(this.$channels).map((c) => c / 255);
249
+ const [min, max] = [Math.min(red, green, blue), Math.max(red, green, blue)];
250
+ const delta = max - min;
251
+ let hue = 0;
252
+ if (delta === 0) {
253
+ return hue;
254
+ }
255
+ if (red === max) {
256
+ hue = (green - blue) / delta % 6;
257
+ } else if (green === max) {
258
+ hue = (blue - red) / delta + 2;
259
+ } else {
260
+ hue = (red - green) / delta + 4;
261
+ }
262
+ hue *= 60;
263
+ while (hue !== -Infinity && hue < 0) hue += 360;
264
+ return Math.round(hue % 360);
265
+ }
266
+ setHue(value) {
267
+ const color = Color.fromHSL(value, this.saturation, this.lightness, this.alpha / 255);
268
+ for (let i = 0; i < this.$channels.length; i++) {
269
+ this.$channels[i] = Number(color.$channels[i]);
270
+ }
271
+ }
272
+ getSaturation() {
273
+ const [red, green, blue] = Array.from(this.$channels).map((c) => c / 255);
274
+ const [min, max] = [Math.min(red, green, blue), Math.max(red, green, blue)];
275
+ const delta = max - min;
276
+ return delta !== 0 ? Math.round(delta / (1 - Math.abs(2 * this.lightness - 1)) * 100) / 100 : 0;
277
+ }
278
+ setSaturation(value) {
279
+ const color = Color.fromHSL(this.hue, value, this.lightness, this.alpha / 255);
280
+ colorChannels.forEach((_, i) => this.$channels[i] = color.$channels[i]);
281
+ }
282
+ getLightness() {
283
+ const [red, green, blue] = Array.from(this.$channels).map((c) => c / 255);
284
+ const [min, max] = [Math.min(red, green, blue), Math.max(red, green, blue)];
285
+ return Math.round((max + min) / 2 * 100) / 100;
286
+ }
287
+ setLightness(value) {
288
+ const color = Color.fromHSL(this.hue, this.lightness, value, this.alpha / 255);
289
+ colorChannels.forEach((_, i) => this.$channels[i] = color.$channels[i]);
290
+ }
291
+ clone() {
292
+ const color = new Color();
293
+ colorChannels.forEach((_, i) => color.$channels[i] = this.$channels[i]);
294
+ return color;
295
+ }
296
+ toString(type = "hex") {
297
+ switch (String(type).toLowerCase()) {
298
+ case "hex":
299
+ return "#" + colorChannels.slice(0, 3).map((channel) => this[channel].toString(16).padStart(2, "0")).join("");
300
+ case "hexa":
301
+ return "#" + colorChannels.map((channel) => this[channel].toString(16).padStart(2, "0")).join("");
302
+ case "rgb":
303
+ return `rgb(${this.red}, ${this.green}, ${this.blue})`;
304
+ case "rgba":
305
+ return `rgba(${this.red}, ${this.green}, ${this.blue}, ${Math.round(this.alpha / 2.55) / 100})`;
306
+ case "hsl":
307
+ return `hsl(${Math.round(this.hue)}deg, ${Math.round(this.saturation * 100)}%, ${Math.round(this.lightness * 100)}%)`;
308
+ case "hsla":
309
+ return `hsla(${Math.round(this.hue)}deg, ${Math.round(this.saturation * 100)}%, ${Math.round(this.lightness * 100)}%, ${Math.round(this.alpha / 2.55) / 100})`;
310
+ default:
311
+ throw new ColorTypeError();
312
+ }
313
+ }
314
+ get [Symbol.toStringTag]() {
315
+ return this.toString("hex");
316
+ }
317
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
318
+ static parse(...args) {
319
+ if (typeof args[0] === "object") {
320
+ return Color.parseObject(args[0]);
321
+ } else if (args.every((arg) => !Number.isNaN(arg / 1))) {
322
+ const color = new Color();
323
+ if (args.length > 3) {
324
+ color.red = args[0];
325
+ color.green = args[1];
326
+ color.blue = args[2];
327
+ if (args[3]) {
328
+ color.alpha = args[3];
329
+ }
330
+ } else if (args.length === 1) {
331
+ const index = Number(args[0]);
332
+ return Color.parseIndex(index, index > __pow(2, 24) ? 3 : 4);
333
+ }
334
+ } else if (typeof args[0] === "string") {
335
+ let match = null;
336
+ if (typeof colorsNammed[args[0].toLowerCase()] === "string") {
337
+ return Color.parseHex(colorsNammed[args[0].toLowerCase()]);
338
+ } else if ((match = args[0].match(/^(#|&h|0x)?(([a-f0-9]{3,4}){1,2})$/i)) !== null) {
339
+ return Color.parseHex(match[2]);
340
+ } else if ((match = args[0].match(/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)(\s*,\s*(\d*\.?\d+))?\s*\)$/i)) !== null) {
341
+ const channels = [
342
+ match[1],
343
+ match[2],
344
+ match[3],
345
+ typeof match[5] !== "undefined" ? match[5] : 1
346
+ ];
347
+ return Color.fromRGB(...channels.map((value) => Number(value)));
348
+ } else if (args[0].match(/^(h(sl|wb)a?|lab|color|cmyk)\(/i)) {
349
+ throw new Error("Color expression not implemented yet");
350
+ }
351
+ }
352
+ throw new Error("Invalid color expression");
353
+ }
354
+ static parseObject(object) {
355
+ const color = new Color();
356
+ if (object === null || typeof object !== "object") {
357
+ return color;
358
+ }
359
+ if (Color.isColor(object)) {
360
+ return object.clone();
361
+ }
362
+ colorChannels.forEach((channel) => {
363
+ if (!Number.isNaN(object[channel])) {
364
+ color[channel] = object[channel];
365
+ }
366
+ });
367
+ return color;
368
+ }
369
+ static parseHex(hex) {
370
+ if (typeof hex !== "string") {
371
+ throw new Error("Hex expression must be a string");
372
+ }
373
+ hex = hex.trim().replace(/^(0x|&h|#)/i, "");
374
+ if (hex.length === 3 || hex.length === 4) {
375
+ hex = hex.split("").map((c) => c.repeat(2)).join("");
376
+ }
377
+ if (!(hex.length === 6 || hex.length === 8)) {
378
+ throw new Error("Incorrect Hex expression length");
379
+ }
380
+ const chans = hex.split(/(..)/).filter((value) => value).map((value) => Number.parseInt(value, 16));
381
+ if (typeof chans[3] === "number") {
382
+ chans[3] /= 255;
383
+ }
384
+ return Color.fromRGB(...chans);
385
+ }
386
+ static parseIndex(value, channels = 3) {
387
+ const color = new Color();
388
+ for (let i = 0; i < 4; i++) {
389
+ color[colorChannels[i]] = value >> (channels - i) * 8 && 255;
390
+ }
391
+ return color;
392
+ }
393
+ static fromRGB(red, green, blue, alpha = 1) {
394
+ if ([red, green, blue, alpha].some((arg) => Number.isNaN(arg / 1))) {
395
+ throw new Error("Invalid arguments");
396
+ }
397
+ alpha *= 255;
398
+ const color = new Color();
399
+ [red, green, blue, alpha].forEach((value, index) => {
400
+ color[colorChannels[index]] = value;
401
+ });
402
+ return color;
403
+ }
404
+ static fromHSL(hue, saturation, lightness, alpha = 1) {
405
+ if ([hue, saturation, lightness, alpha].some((arg) => Number.isNaN(arg))) {
406
+ throw new Error("Invalid arguments");
407
+ }
408
+ while (hue < 0 && hue !== -Infinity) hue += 360;
409
+ hue = hue % 360;
410
+ saturation = Math.max(0, Math.min(1, saturation));
411
+ lightness = Math.max(0, Math.min(1, lightness));
412
+ alpha = Math.max(0, Math.min(1, alpha));
413
+ const c = (1 - Math.abs(2 * lightness - 1)) * saturation;
414
+ const x = c * (1 - Math.abs(hue / 60 % 2 - 1));
415
+ const m = lightness - c / 2;
416
+ const [r, g, b] = 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];
417
+ return Color.fromRGB((r + m) * 255, (g + m) * 255, (b + m) * 255, alpha);
418
+ }
419
+ static isColor(arg) {
420
+ return arg instanceof Color;
421
+ }
422
+ }
423
+
424
+ const cos30 = 0.86602540378;
425
+ const sin30 = 0.5;
426
+ let id = 0;
427
+ var _sfc_main$3 = vue.defineComponent({
428
+ name: "BColorpickerHSLRepresentationTriangle",
429
+ props: {
430
+ value: {
431
+ type: Object,
432
+ required: true,
433
+ validator(value) {
434
+ return typeof value.hue === "number" && typeof value.saturation === "number" && typeof value.lightness === "number";
435
+ }
436
+ },
437
+ size: {
438
+ type: Number,
439
+ default: 200
440
+ },
441
+ thickness: {
442
+ type: Number,
443
+ default: 20
444
+ }
445
+ },
446
+ emits: {
447
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
448
+ input: (_value) => true
449
+ },
450
+ data() {
451
+ return {
452
+ id: id++,
453
+ hue: this.value.hue,
454
+ saturation: this.value.saturation,
455
+ lightness: this.value.lightness,
456
+ captureMouse: false,
457
+ captureType: "hue",
458
+ clientOffset: {
459
+ cx: -1,
460
+ cy: -1,
461
+ width: 0,
462
+ height: 0
463
+ },
464
+ cos30,
465
+ sin30,
466
+ debounce: 0
467
+ };
468
+ },
469
+ computed: {
470
+ viewBox() {
471
+ const { size } = this;
472
+ return `0 0 ${size} ${size}`;
473
+ },
474
+ internalRadius() {
475
+ return this.size / 2 - this.thickness;
476
+ },
477
+ haloPath() {
478
+ const { size, thickness } = this;
479
+ const radius = size / 2 - 2;
480
+ const thicknessRadius = radius - thickness;
481
+ const center = size / 2;
482
+ return `M${center - radius} ${center}a${radius} ${radius} 0 1 1 ${2 * radius} 0h${-thickness}a${-thicknessRadius} ${thicknessRadius} 0 1 0 ${ -2 * thicknessRadius} 0a${thicknessRadius} ${thicknessRadius} 0 1 0 ${2 * thicknessRadius} 0h${thickness}a${radius} ${radius} 0 1 1 ${ -2 * radius} 0z`;
483
+ },
484
+ trianglePath() {
485
+ const { size, thickness } = this;
486
+ const radius = size - 4;
487
+ const thicknessRadius = (radius - 2 * thickness) / 2;
488
+ return `M0 ${-thicknessRadius}L${cos30 * thicknessRadius} ${sin30 * thicknessRadius}H${ -0.86602540378 * thicknessRadius}z`;
489
+ }
490
+ },
491
+ watch: {
492
+ captureMouse(newValue, oldValue) {
493
+ if (oldValue === false && newValue !== false) {
494
+ const rect = this.$el.getBoundingClientRect();
495
+ this.clientOffset.cx = rect.x + rect.width / 2;
496
+ this.clientOffset.cy = rect.y + rect.height / 2;
497
+ this.clientOffset.width = rect.width;
498
+ this.clientOffset.height = rect.height;
499
+ }
500
+ },
501
+ value: {
502
+ deep: true,
503
+ handler(newColor) {
504
+ const { hue, saturation, lightness } = newColor;
505
+ window.clearTimeout(this.debounce);
506
+ this.debounce = window.setTimeout(() => {
507
+ if (lightness >= 0.03 && lightness <= 0.97 && saturation > 0) {
508
+ this.hue = hue;
509
+ }
510
+ this.saturation = saturation;
511
+ this.lightness = lightness;
512
+ }, 200);
513
+ }
514
+ }
515
+ },
516
+ methods: {
517
+ increaseHue(value = 1) {
518
+ this.hue = (this.hue + value) % 360;
519
+ },
520
+ decreaseHue(value = 1) {
521
+ this.hue = (360 + this.hue - value) % 360;
522
+ },
523
+ increaseSaturation(value = 0.01) {
524
+ this.saturation = Math.min(1, Math.max(0, this.saturation + value));
525
+ this.lightness = Math.min(
526
+ 0.5 + (1 - this.saturation) * 0.5,
527
+ Math.max(
528
+ 0.5 - (1 - this.saturation) * 0.5,
529
+ this.lightness
530
+ )
531
+ );
532
+ },
533
+ decreaseSaturation(value = 0.01) {
534
+ this.saturation = Math.min(1, Math.max(0, this.saturation - value));
535
+ this.lightness = Math.min(
536
+ 0.5 + (1 - this.saturation) * 0.5,
537
+ Math.max(
538
+ 0.5 - (1 - this.saturation) * 0.5,
539
+ this.lightness
540
+ )
541
+ );
542
+ },
543
+ increaseLightness(value = 0.01) {
544
+ this.lightness = Math.min(
545
+ 0.5 + (1 - this.saturation) * 0.5,
546
+ Math.max(
547
+ 0.5 - (1 - this.saturation) * 0.5,
548
+ this.lightness + value
549
+ )
550
+ );
551
+ },
552
+ decreaseLightness(value = 0.01) {
553
+ this.lightness = Math.min(
554
+ 0.5 + (1 - this.saturation) * 0.5,
555
+ Math.max(
556
+ 0.5 - (1 - this.saturation) * 0.5,
557
+ this.lightness - value
558
+ )
559
+ );
560
+ },
561
+ hueKeyPress(event) {
562
+ let handled = false;
563
+ switch (event.key) {
564
+ case "ArrowRight":
565
+ case "ArrowUp":
566
+ this.increaseHue();
567
+ handled = true;
568
+ break;
569
+ case "ArrowLeft":
570
+ case "ArrowDown":
571
+ this.decreaseHue();
572
+ handled = true;
573
+ break;
574
+ case "Home":
575
+ this.increaseHue(360 - this.hue);
576
+ handled = true;
577
+ break;
578
+ case "End":
579
+ this.decreaseHue(this.hue);
580
+ handled = true;
581
+ break;
582
+ case "PageUp":
583
+ this.increaseHue(60 - this.hue % 60);
584
+ handled = true;
585
+ break;
586
+ case "PageDown":
587
+ this.decreaseHue(60 + this.hue % 60);
588
+ handled = true;
589
+ break;
590
+ }
591
+ if (handled) {
592
+ event.preventDefault();
593
+ event.stopPropagation();
594
+ this.emitColor();
595
+ }
596
+ },
597
+ slKeyPress(event) {
598
+ let handled = false;
599
+ switch (event.key) {
600
+ case "ArrowRight":
601
+ this.decreaseLightness();
602
+ handled = true;
603
+ break;
604
+ case "ArrowUp":
605
+ this.increaseSaturation();
606
+ handled = true;
607
+ break;
608
+ case "ArrowLeft":
609
+ this.increaseLightness();
610
+ handled = true;
611
+ break;
612
+ case "ArrowDown":
613
+ this.decreaseSaturation();
614
+ handled = true;
615
+ break;
616
+ case "Home":
617
+ this.increaseLightness(1 - this.lightness);
618
+ handled = true;
619
+ break;
620
+ case "End":
621
+ this.decreaseLightness(this.lightness);
622
+ handled = true;
623
+ break;
624
+ case "PageUp":
625
+ this.increaseSaturation(1 - this.saturation);
626
+ handled = true;
627
+ break;
628
+ case "PageDown":
629
+ this.decreaseSaturation(this.saturation);
630
+ handled = true;
631
+ break;
632
+ }
633
+ if (handled) {
634
+ event.preventDefault();
635
+ event.stopPropagation();
636
+ this.emitColor();
637
+ }
638
+ },
639
+ clickHue(event) {
640
+ this.startMouseCapture(event);
641
+ this.trackMouse(event);
642
+ this.stopMouseCapture(event);
643
+ this.$refs.hueCursor.focus();
644
+ },
645
+ clickSL(event) {
646
+ this.startMouseCapture(event);
647
+ this.trackMouse(event);
648
+ this.stopMouseCapture(event);
649
+ this.$refs.slCursor.focus();
650
+ },
651
+ trackMouse(event) {
652
+ if (this.captureMouse === false) {
653
+ return;
654
+ }
655
+ event.preventDefault();
656
+ event.stopPropagation();
657
+ const touches = event.touches;
658
+ let [mouseX, mouseY] = [0, 0];
659
+ if (typeof touches !== "undefined" && touches.length) {
660
+ [mouseX, mouseY] = [touches[0].clientX, touches[0].clientY];
661
+ } else {
662
+ [mouseX, mouseY] = [event.clientX, event.clientY];
663
+ }
664
+ const angle = Math.atan2(
665
+ mouseY - this.clientOffset.cy,
666
+ mouseX - this.clientOffset.cx
667
+ );
668
+ if (this.captureType === "sl") {
669
+ const d = Math.sqrt(
670
+ Math.pow(mouseX - this.clientOffset.cx, 2) + Math.pow(mouseY - this.clientOffset.cy, 2)
671
+ );
672
+ const ratio = this.size / this.clientOffset.width;
673
+ const dx = d * Math.cos(angle - this.hue / 180 * Math.PI) * ratio;
674
+ const dy = d * Math.sin(angle - this.hue / 180 * Math.PI) * ratio;
675
+ const radius = this.internalRadius;
676
+ const saturation = 1 - (Math.min(
677
+ radius * sin30,
678
+ Math.max(
679
+ -radius,
680
+ dy
681
+ )
682
+ ) + radius) / (radius + radius * sin30);
683
+ const lightness = (Math.min(
684
+ radius * cos30 * (1 - saturation),
685
+ Math.max(
686
+ -radius * cos30 * (1 - saturation),
687
+ dx
688
+ )
689
+ ) + radius * cos30) / (radius * 2 * cos30);
690
+ this.saturation = Math.round(saturation * 1e3) / 1e3;
691
+ this.lightness = 1 - Math.round(lightness * 1e3) / 1e3;
692
+ } else {
693
+ this.hue = Math.round(angle / Math.PI * 180 + 90) % 360;
694
+ }
695
+ this.emitColor();
696
+ },
697
+ startMouseCapture(event) {
698
+ event.stopPropagation();
699
+ this.captureMouse = true;
700
+ if (event.target.closest(".colorpicker-triangle-slider-sl") !== null) {
701
+ this.captureType = "sl";
702
+ } else {
703
+ this.captureType = "hue";
704
+ }
705
+ },
706
+ stopMouseCapture(event) {
707
+ if (this.captureMouse !== false) {
708
+ event.preventDefault();
709
+ event.stopPropagation();
710
+ this.$refs[this.captureType === "sl" ? "slCursor" : "hueCursor"].focus();
711
+ }
712
+ this.captureMouse = false;
713
+ },
714
+ emitColor() {
715
+ const { hue, saturation, lightness } = this;
716
+ this.$emit("input", Color.fromHSL(hue, saturation, lightness));
717
+ window.clearTimeout(this.debounce);
718
+ }
719
+ },
720
+ mounted() {
721
+ window.addEventListener("mousemove", this.trackMouse);
722
+ window.addEventListener("touchmove", this.trackMouse, { passive: false });
723
+ window.addEventListener("mouseup", this.stopMouseCapture);
724
+ window.addEventListener("touchend", this.stopMouseCapture);
725
+ },
726
+ beforeUnmount() {
727
+ window.removeEventListener("mousemove", this.trackMouse);
728
+ window.removeEventListener("touchmove", this.trackMouse);
729
+ window.removeEventListener("mouseup", this.stopMouseCapture);
730
+ window.removeEventListener("touchend", this.stopMouseCapture);
731
+ clearTimeout(this.debounce);
732
+ }
733
+ });
734
+
735
+ const _hoisted_1$3 = ["viewBox"];
736
+ const _hoisted_2$1 = ["id"];
737
+ const _hoisted_3$1 = /* @__PURE__ */ vue.createElementVNode(
738
+ "stop",
739
+ {
740
+ offset: "0%",
741
+ "stop-color": "#fff"
742
+ },
743
+ null,
744
+ -1
745
+ /* HOISTED */
746
+ );
747
+ const _hoisted_4$1 = /* @__PURE__ */ vue.createElementVNode(
748
+ "stop",
749
+ {
750
+ offset: "100%",
751
+ "stop-color": "#000"
752
+ },
753
+ null,
754
+ -1
755
+ /* HOISTED */
756
+ );
757
+ const _hoisted_5 = [
758
+ _hoisted_3$1,
759
+ _hoisted_4$1
760
+ ];
761
+ const _hoisted_6 = ["id"];
762
+ const _hoisted_7 = ["stop-color"];
763
+ const _hoisted_8 = ["stop-color"];
764
+ const _hoisted_9 = ["id"];
765
+ const _hoisted_10 = ["d"];
766
+ const _hoisted_11 = { class: "colorpicker-triangle-slider-hue" };
767
+ const _hoisted_12 = ["width", "height", "clip-path"];
768
+ const _hoisted_13 = ["x", "height"];
769
+ const _hoisted_14 = ["aria-valuenow"];
770
+ const _hoisted_15 = ["d", "fill"];
771
+ const _hoisted_16 = ["d", "fill"];
772
+ const _hoisted_17 = ["x", "y"];
773
+ const _hoisted_18 = ["aria-datavalues"];
774
+ function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {
775
+ return vue.openBlock(), vue.createElementBlock("svg", {
776
+ viewBox: _ctx.viewBox,
777
+ class: "b-colorpicker-triangle"
778
+ }, [
779
+ vue.createElementVNode("defs", null, [
780
+ vue.createElementVNode("linearGradient", {
781
+ id: `cp-triangle-gradient-ligthness-${_ctx.id}`,
782
+ x1: "0",
783
+ y1: "0",
784
+ x2: "1",
785
+ y2: "0"
786
+ }, [..._hoisted_5], 8, _hoisted_2$1),
787
+ vue.createElementVNode("linearGradient", {
788
+ id: `cp-triangle-gradient-saturation-${_ctx.id}`,
789
+ x1: "0",
790
+ y1: "0",
791
+ x2: "0",
792
+ y2: "1"
793
+ }, [
794
+ vue.createElementVNode("stop", {
795
+ offset: "0%",
796
+ "stop-color": `hsl(${_ctx.hue}deg, 100%, 50%)`,
797
+ "stop-opacity": "1"
798
+ }, null, 8, _hoisted_7),
799
+ vue.createElementVNode("stop", {
800
+ offset: "100%",
801
+ "stop-color": `hsl(${_ctx.hue}deg, 100%, 50%)`,
802
+ "stop-opacity": "0"
803
+ }, null, 8, _hoisted_8)
804
+ ], 8, _hoisted_6),
805
+ vue.createElementVNode("clipPath", {
806
+ id: `cp-triangle-clip-${_ctx.id}`
807
+ }, [
808
+ vue.createElementVNode("path", { d: _ctx.haloPath }, null, 8, _hoisted_10)
809
+ ], 8, _hoisted_9)
810
+ ]),
811
+ vue.createElementVNode("g", _hoisted_11, [
812
+ (vue.openBlock(), vue.createElementBlock("foreignObject", {
813
+ x: 0,
814
+ y: 0,
815
+ width: _ctx.size,
816
+ height: _ctx.size,
817
+ "clip-path": `url(#cp-triangle-clip-${_ctx.id})`
818
+ }, [
819
+ vue.createElementVNode(
820
+ "div",
821
+ {
822
+ class: "colorpicker-triangle-hue",
823
+ onClick: _cache[0] || (_cache[0] = (...args) => _ctx.clickHue && _ctx.clickHue(...args)),
824
+ onMousedown: _cache[1] || (_cache[1] = vue.withModifiers((...args) => _ctx.startMouseCapture && _ctx.startMouseCapture(...args), ["prevent"])),
825
+ onTouchstart: _cache[2] || (_cache[2] = vue.withModifiers((...args) => _ctx.startMouseCapture && _ctx.startMouseCapture(...args), ["prevent"]))
826
+ },
827
+ null,
828
+ 32
829
+ /* NEED_HYDRATION */
830
+ )
831
+ ], 8, _hoisted_12)),
832
+ vue.createElementVNode(
833
+ "g",
834
+ {
835
+ style: vue.normalizeStyle(`transform: rotate(${_ctx.hue}deg)`)
836
+ },
837
+ [
838
+ (vue.openBlock(), vue.createElementBlock("foreignObject", {
839
+ x: _ctx.size / 2 - 4,
840
+ y: 0,
841
+ width: "8",
842
+ height: _ctx.thickness + 4
843
+ }, [
844
+ vue.createElementVNode("div", {
845
+ ref: "hueCursor",
846
+ class: "hue-range-thumb",
847
+ style: vue.normalizeStyle(`background-color: hsl(${_ctx.hue}deg, 100%, 50%)`),
848
+ role: "slider",
849
+ tabindex: "0",
850
+ "aria-label": "Hue",
851
+ "aria-valuemin": "0",
852
+ "aria-valuenow": _ctx.hue,
853
+ "aria-valuemax": "360",
854
+ onClick: _cache[3] || (_cache[3] = (...args) => _ctx.clickHue && _ctx.clickHue(...args)),
855
+ onKeydown: _cache[4] || (_cache[4] = (...args) => _ctx.hueKeyPress && _ctx.hueKeyPress(...args)),
856
+ onMousedown: _cache[5] || (_cache[5] = vue.withModifiers((...args) => _ctx.startMouseCapture && _ctx.startMouseCapture(...args), ["prevent"])),
857
+ onTouchstart: _cache[6] || (_cache[6] = vue.withModifiers((...args) => _ctx.startMouseCapture && _ctx.startMouseCapture(...args), ["prevent"]))
858
+ }, null, 44, _hoisted_14)
859
+ ], 8, _hoisted_13))
860
+ ],
861
+ 4
862
+ /* STYLE */
863
+ )
864
+ ]),
865
+ vue.createElementVNode(
866
+ "g",
867
+ {
868
+ class: "colorpicker-triangle-slider-sl",
869
+ style: vue.normalizeStyle(`transform: rotate(${_ctx.hue}deg) translate(50%, 50%)`),
870
+ role: "graphics-datagroup",
871
+ "aria-datascales": "lightness, saturation"
872
+ },
873
+ [
874
+ vue.createElementVNode("path", {
875
+ d: _ctx.trianglePath,
876
+ fill: `url(#cp-triangle-gradient-ligthness-${_ctx.id})`
877
+ }, null, 8, _hoisted_15),
878
+ vue.createElementVNode("path", {
879
+ d: _ctx.trianglePath,
880
+ fill: `url(#cp-triangle-gradient-saturation-${_ctx.id})`,
881
+ style: { "mix-blend-mode": "overlay" },
882
+ onClick: _cache[7] || (_cache[7] = (...args) => _ctx.clickSL && _ctx.clickSL(...args)),
883
+ onMousedown: _cache[8] || (_cache[8] = vue.withModifiers((...args) => _ctx.startMouseCapture && _ctx.startMouseCapture(...args), ["prevent"])),
884
+ onTouchstart: _cache[9] || (_cache[9] = vue.withModifiers((...args) => _ctx.startMouseCapture && _ctx.startMouseCapture(...args), ["prevent"]))
885
+ }, null, 40, _hoisted_16),
886
+ (vue.openBlock(), vue.createElementBlock("foreignObject", {
887
+ x: (_ctx.internalRadius - 3) * _ctx.cos30 * (-_ctx.lightness + 0.5) * 2 - 6,
888
+ y: -_ctx.internalRadius + (1 - _ctx.saturation) * (_ctx.internalRadius - 3) * 1.5 - 3,
889
+ width: "12",
890
+ height: "12"
891
+ }, [
892
+ vue.createElementVNode("div", {
893
+ ref: "slCursor",
894
+ class: "sl-range-thumb",
895
+ style: vue.normalizeStyle({
896
+ backgroundColor: `hsl(${_ctx.hue}deg, ${_ctx.saturation * 100}%, ${_ctx.lightness * 100}%)`
897
+ }),
898
+ tabindex: "0",
899
+ "aria-datavalues": `${_ctx.saturation * 100}%, ${_ctx.lightness * 100}%`,
900
+ onClick: _cache[10] || (_cache[10] = (...args) => _ctx.clickSL && _ctx.clickSL(...args)),
901
+ onKeydown: _cache[11] || (_cache[11] = (...args) => _ctx.slKeyPress && _ctx.slKeyPress(...args)),
902
+ onMousedown: _cache[12] || (_cache[12] = vue.withModifiers((...args) => _ctx.startMouseCapture && _ctx.startMouseCapture(...args), ["prevent"])),
903
+ onTouchstart: _cache[13] || (_cache[13] = vue.withModifiers((...args) => _ctx.startMouseCapture && _ctx.startMouseCapture(...args), ["prevent"]))
904
+ }, null, 44, _hoisted_18)
905
+ ], 8, _hoisted_17))
906
+ ],
907
+ 4
908
+ /* STYLE */
909
+ )
910
+ ], 8, _hoisted_1$3);
911
+ }
912
+ var BColorpickerHSLRepresentationTriangle = /* @__PURE__ */ _pluginVue_exportHelper._export_sfc(_sfc_main$3, [["render", _sfc_render$3]]);
913
+
914
+ const precision = (strs, ...values) => {
915
+ const tmp = [];
916
+ strs.forEach((str, i) => {
917
+ tmp.push(str);
918
+ const value = values[i];
919
+ if (value) {
920
+ tmp.push(
921
+ Number.isNaN(+value / 1) ? value : Math.round(+value * 10) / 10
922
+ );
923
+ }
924
+ });
925
+ return tmp.join("");
926
+ };
927
+ var _sfc_main$2 = vue.defineComponent({
928
+ name: "BColorpickerHSLRepresentationSquare",
929
+ props: {
930
+ value: {
931
+ type: Object,
932
+ required: true,
933
+ validator(value) {
934
+ return typeof value.hue === "number" && typeof value.saturation === "number" && typeof value.lightness === "number";
935
+ }
936
+ },
937
+ size: {
938
+ type: Number,
939
+ default: 200
940
+ },
941
+ thickness: {
942
+ type: Number,
943
+ default: 20
944
+ }
945
+ },
946
+ emits: {
947
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
948
+ input: (_value) => true
949
+ },
950
+ data() {
951
+ return {
952
+ hue: this.value.hue,
953
+ saturation: this.value.saturation,
954
+ lightness: this.value.lightness,
955
+ captureMouse: false,
956
+ captureType: "hue",
957
+ clientOffset: {
958
+ cx: -1,
959
+ cy: -1,
960
+ width: 0,
961
+ height: 0
962
+ },
963
+ debounce: 0
964
+ };
965
+ },
966
+ computed: {
967
+ hueThumbStyle() {
968
+ const { hue, size, thickness } = this;
969
+ const side = size - thickness;
970
+ const offset = size / 2;
971
+ const angle = (hue + 720 + 90) % 360 / 180 * Math.PI;
972
+ const ciq = 1 / Math.cos(Math.PI / 4);
973
+ const { x, y } = {
974
+ x: -Math.min(1, Math.max(-1, ciq * Math.cos(angle))) / 2 * side + offset,
975
+ y: -Math.min(1, Math.max(-1, ciq * Math.sin(angle))) / 2 * side + offset
976
+ };
977
+ return {
978
+ background: `hsl(${hue}deg, 100%, 50%)`,
979
+ left: precision`${x}px`,
980
+ top: precision`${y}px`,
981
+ width: precision`${thickness - 2}px`
982
+ };
983
+ },
984
+ slThumbStyle() {
985
+ let { hue, saturation, lightness } = this;
986
+ saturation = Math.max(0, Math.min(1, saturation));
987
+ lightness = Math.max(0, Math.min(1, lightness));
988
+ return {
989
+ background: `hsl(${hue}deg, ${saturation * 100}%, ${lightness * 100}%)`,
990
+ left: `${saturation * 100}%`,
991
+ top: `${(1 - lightness) * 100}%`
992
+ };
993
+ },
994
+ SLBackground() {
995
+ const { hue } = this;
996
+ return `linear-gradient(90deg, hsl(${hue}deg, 0%, 50%), hsl(${hue}deg, 100%, 50%))`;
997
+ }
998
+ },
999
+ watch: {
1000
+ captureMouse(newValue, oldValue) {
1001
+ if (oldValue === false && newValue !== false) {
1002
+ const rect = this.$el.getBoundingClientRect();
1003
+ this.clientOffset.cx = rect.x + rect.width / 2;
1004
+ this.clientOffset.cy = rect.y + rect.height / 2;
1005
+ this.clientOffset.width = rect.width;
1006
+ this.clientOffset.height = rect.height;
1007
+ }
1008
+ },
1009
+ value: {
1010
+ deep: true,
1011
+ handler(newColor) {
1012
+ const { hue, saturation, lightness } = newColor;
1013
+ window.clearTimeout(this.debounce);
1014
+ this.debounce = window.setTimeout(() => {
1015
+ this.hue = hue;
1016
+ this.saturation = saturation;
1017
+ this.lightness = lightness;
1018
+ }, 200);
1019
+ }
1020
+ }
1021
+ },
1022
+ methods: {
1023
+ increaseHue(value = 1) {
1024
+ this.hue = (this.hue + value) % 360;
1025
+ },
1026
+ decreaseHue(value = 1) {
1027
+ this.hue = (360 + this.hue - value) % 360;
1028
+ },
1029
+ increaseSaturation(value = 0.01) {
1030
+ this.saturation = Math.min(1, Math.max(0, this.saturation + value));
1031
+ this.lightness = Math.min(
1032
+ 0.5 + (1 - this.saturation) * 0.5,
1033
+ Math.max(
1034
+ 0.5 - (1 - this.saturation) * 0.5,
1035
+ this.lightness
1036
+ )
1037
+ );
1038
+ },
1039
+ decreaseSaturation(value = 0.01) {
1040
+ this.saturation = Math.min(1, Math.max(0, this.saturation - value));
1041
+ this.lightness = Math.min(
1042
+ 0.5 + (1 - this.saturation) * 0.5,
1043
+ Math.max(
1044
+ 0.5 - (1 - this.saturation) * 0.5,
1045
+ this.lightness
1046
+ )
1047
+ );
1048
+ },
1049
+ increaseLightness(value = 0.01) {
1050
+ this.lightness = Math.min(
1051
+ 0.5 + (1 - this.saturation) * 0.5,
1052
+ Math.max(
1053
+ 0.5 - (1 - this.saturation) * 0.5,
1054
+ this.lightness + value
1055
+ )
1056
+ );
1057
+ },
1058
+ decreaseLightness(value = 0.01) {
1059
+ this.lightness = Math.min(
1060
+ 0.5 + (1 - this.saturation) * 0.5,
1061
+ Math.max(
1062
+ 0.5 - (1 - this.saturation) * 0.5,
1063
+ this.lightness - value
1064
+ )
1065
+ );
1066
+ },
1067
+ hueKeyPress(event) {
1068
+ let handled = false;
1069
+ switch (event.key) {
1070
+ case "ArrowRight":
1071
+ case "ArrowUp":
1072
+ this.increaseHue();
1073
+ handled = true;
1074
+ break;
1075
+ case "ArrowLeft":
1076
+ case "ArrowDown":
1077
+ this.decreaseHue();
1078
+ handled = true;
1079
+ break;
1080
+ case "Home":
1081
+ this.increaseHue(360 - this.hue);
1082
+ handled = true;
1083
+ break;
1084
+ case "End":
1085
+ this.decreaseHue(this.hue);
1086
+ handled = true;
1087
+ break;
1088
+ case "PageUp":
1089
+ this.increaseHue(60 - this.hue % 60);
1090
+ handled = true;
1091
+ break;
1092
+ case "PageDown":
1093
+ this.decreaseHue(60 + this.hue % 60);
1094
+ handled = true;
1095
+ break;
1096
+ }
1097
+ if (handled) {
1098
+ event.preventDefault();
1099
+ event.stopPropagation();
1100
+ this.emitColor();
1101
+ }
1102
+ },
1103
+ slKeyPress(event) {
1104
+ let handled = false;
1105
+ switch (event.key) {
1106
+ case "ArrowRight":
1107
+ this.increaseSaturation();
1108
+ handled = true;
1109
+ break;
1110
+ case "ArrowUp":
1111
+ this.increaseLightness();
1112
+ handled = true;
1113
+ break;
1114
+ case "ArrowLeft":
1115
+ this.decreaseSaturation();
1116
+ handled = true;
1117
+ break;
1118
+ case "ArrowDown":
1119
+ this.decreaseLightness();
1120
+ handled = true;
1121
+ break;
1122
+ case "Home":
1123
+ this.increaseLightness(1 - this.lightness);
1124
+ handled = true;
1125
+ break;
1126
+ case "End":
1127
+ this.decreaseLightness(this.lightness);
1128
+ handled = true;
1129
+ break;
1130
+ case "PageUp":
1131
+ this.increaseSaturation(1 - this.saturation);
1132
+ handled = true;
1133
+ break;
1134
+ case "PageDown":
1135
+ this.decreaseSaturation(this.saturation);
1136
+ handled = true;
1137
+ break;
1138
+ }
1139
+ if (handled) {
1140
+ event.preventDefault();
1141
+ event.stopPropagation();
1142
+ this.emitColor();
1143
+ }
1144
+ },
1145
+ startMouseCapture(event) {
1146
+ event.stopPropagation();
1147
+ this.captureMouse = true;
1148
+ if (event.target.closest(".colorpicker-square-slider-sl") !== null) {
1149
+ this.captureType = "sl";
1150
+ } else {
1151
+ this.captureType = "hue";
1152
+ }
1153
+ },
1154
+ stopMouseCapture(event) {
1155
+ if (this.captureMouse !== false) {
1156
+ event.preventDefault();
1157
+ event.stopPropagation();
1158
+ this.$refs[this.captureType === "sl" ? "slCursor" : "hueCursor"].focus();
1159
+ }
1160
+ this.captureMouse = false;
1161
+ },
1162
+ clickHue(event) {
1163
+ this.startMouseCapture(event);
1164
+ this.trackMouse(event);
1165
+ this.stopMouseCapture(event);
1166
+ this.$refs.hueCursor.focus();
1167
+ },
1168
+ clickSL(event) {
1169
+ this.startMouseCapture(event);
1170
+ this.trackMouse(event);
1171
+ this.stopMouseCapture(event);
1172
+ this.$refs.slCursor.focus();
1173
+ },
1174
+ trackMouse(event) {
1175
+ if (this.captureMouse === false) {
1176
+ return;
1177
+ }
1178
+ event.preventDefault();
1179
+ event.stopPropagation();
1180
+ const touches = event.touches;
1181
+ let [mouseX, mouseY] = [0, 0];
1182
+ if (typeof touches !== "undefined" && touches.length) {
1183
+ [mouseX, mouseY] = [touches[0].clientX, touches[0].clientY];
1184
+ } else {
1185
+ [mouseX, mouseY] = [event.clientX, event.clientY];
1186
+ }
1187
+ const angle = Math.atan2(
1188
+ mouseY - this.clientOffset.cy,
1189
+ mouseX - this.clientOffset.cx
1190
+ );
1191
+ if (this.captureType === "sl") {
1192
+ const saturation = (mouseX - this.clientOffset.cx) / (this.clientOffset.width - this.thickness * 2) + 0.5;
1193
+ const lightness = (mouseY - this.clientOffset.cy) / (this.clientOffset.height - this.thickness * 2) + 0.5;
1194
+ this.saturation = Math.round(Math.min(1, Math.max(0, saturation)) * 1e3) / 1e3;
1195
+ this.lightness = 1 - Math.round(Math.min(1, Math.max(0, lightness)) * 1e3) / 1e3;
1196
+ } else {
1197
+ this.hue = Math.round(angle / Math.PI * 180 + 90) % 360;
1198
+ }
1199
+ this.emitColor();
1200
+ },
1201
+ emitColor() {
1202
+ const { hue, saturation, lightness } = this;
1203
+ this.$emit("input", Color.fromHSL(hue, saturation, lightness));
1204
+ window.clearTimeout(this.debounce);
1205
+ }
1206
+ },
1207
+ mounted() {
1208
+ window.addEventListener("mousemove", this.trackMouse);
1209
+ window.addEventListener("touchmove", this.trackMouse, { passive: false });
1210
+ window.addEventListener("mouseup", this.stopMouseCapture);
1211
+ window.addEventListener("touchend", this.stopMouseCapture);
1212
+ },
1213
+ beforeUnmount() {
1214
+ window.removeEventListener("mousemove", this.trackMouse);
1215
+ window.removeEventListener("touchmove", this.trackMouse);
1216
+ window.removeEventListener("mouseup", this.stopMouseCapture);
1217
+ window.removeEventListener("touchend", this.stopMouseCapture);
1218
+ clearTimeout(this.debounce);
1219
+ }
1220
+ });
1221
+
1222
+ const _hoisted_1$2 = ["aria-datavalues"];
1223
+ function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
1224
+ return vue.openBlock(), vue.createElementBlock(
1225
+ "div",
1226
+ {
1227
+ class: "b-colorpicker-square",
1228
+ style: vue.normalizeStyle({ width: `${_ctx.size}px` })
1229
+ },
1230
+ [
1231
+ vue.createElementVNode(
1232
+ "div",
1233
+ {
1234
+ class: "colorpicker-square-slider-hue",
1235
+ onClick: _cache[0] || (_cache[0] = (...args) => _ctx.clickHue && _ctx.clickHue(...args)),
1236
+ onMousedown: _cache[1] || (_cache[1] = vue.withModifiers((...args) => _ctx.startMouseCapture && _ctx.startMouseCapture(...args), ["prevent"])),
1237
+ onTouchstart: _cache[2] || (_cache[2] = vue.withModifiers((...args) => _ctx.startMouseCapture && _ctx.startMouseCapture(...args), ["prevent"]))
1238
+ },
1239
+ [
1240
+ vue.createElementVNode(
1241
+ "div",
1242
+ {
1243
+ ref: "hueCursor",
1244
+ role: "slider",
1245
+ class: "hue-range-thumb",
1246
+ tabindex: "0",
1247
+ "aria-label": "Hue",
1248
+ "aria-valuemin": "0",
1249
+ "aria-valuemax": "359",
1250
+ style: vue.normalizeStyle(_ctx.hueThumbStyle)
1251
+ },
1252
+ null,
1253
+ 4
1254
+ /* STYLE */
1255
+ )
1256
+ ],
1257
+ 32
1258
+ /* NEED_HYDRATION */
1259
+ ),
1260
+ vue.createElementVNode(
1261
+ "div",
1262
+ {
1263
+ class: "colorpicker-square-slider-sl",
1264
+ style: vue.normalizeStyle({
1265
+ background: _ctx.SLBackground,
1266
+ margin: `${_ctx.thickness}px`
1267
+ }),
1268
+ "aria-datascales": "lightness, saturation",
1269
+ onClick: _cache[7] || (_cache[7] = (...args) => _ctx.clickSL && _ctx.clickSL(...args)),
1270
+ onMousedown: _cache[8] || (_cache[8] = vue.withModifiers((...args) => _ctx.startMouseCapture && _ctx.startMouseCapture(...args), ["prevent"])),
1271
+ onTouchstart: _cache[9] || (_cache[9] = vue.withModifiers((...args) => _ctx.startMouseCapture && _ctx.startMouseCapture(...args), ["prevent"]))
1272
+ },
1273
+ [
1274
+ vue.createElementVNode("div", {
1275
+ ref: "slCursor",
1276
+ role: "slider",
1277
+ class: "sl-range-thumb",
1278
+ tabindex: "0",
1279
+ "aria-datavalues": `${_ctx.saturation * 100}%, ${_ctx.lightness * 100}%`,
1280
+ style: vue.normalizeStyle(_ctx.slThumbStyle),
1281
+ onClick: _cache[3] || (_cache[3] = (...args) => _ctx.clickSL && _ctx.clickSL(...args)),
1282
+ onKeydown: _cache[4] || (_cache[4] = (...args) => _ctx.slKeyPress && _ctx.slKeyPress(...args)),
1283
+ onMousedown: _cache[5] || (_cache[5] = vue.withModifiers((...args) => _ctx.startMouseCapture && _ctx.startMouseCapture(...args), ["prevent"])),
1284
+ onTouchstart: _cache[6] || (_cache[6] = vue.withModifiers((...args) => _ctx.startMouseCapture && _ctx.startMouseCapture(...args), ["prevent"]))
1285
+ }, null, 44, _hoisted_1$2)
1286
+ ],
1287
+ 36
1288
+ /* STYLE, NEED_HYDRATION */
1289
+ )
1290
+ ],
1291
+ 4
1292
+ /* STYLE */
1293
+ );
1294
+ }
1295
+ var BColorpickerHSLRepresentationSquare = /* @__PURE__ */ _pluginVue_exportHelper._export_sfc(_sfc_main$2, [["render", _sfc_render$2]]);
1296
+
1297
+ var _sfc_main$1 = vue.defineComponent({
1298
+ name: "BColorpickerAlphaSlider",
1299
+ components: {
1300
+ BTooltip: Tooltip.Tooltip
1301
+ },
1302
+ props: {
1303
+ value: {
1304
+ type: Number,
1305
+ validator: (value) => value >= 0 && value < 256
1306
+ },
1307
+ color: [String, Object]
1308
+ },
1309
+ emits: {
1310
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
1311
+ input: (_value) => true
1312
+ },
1313
+ data() {
1314
+ const color = Color.parse(this.color);
1315
+ color.alpha = 0;
1316
+ return {
1317
+ startColor: color.toString("hex"),
1318
+ endColor: color.toString("hexa"),
1319
+ percent: Math.round((1 - this.value / 255) * 100),
1320
+ captureMouse: false,
1321
+ clientOffset: {
1322
+ cx: -1,
1323
+ cy: -1,
1324
+ width: 0,
1325
+ height: 0
1326
+ }
1327
+ };
1328
+ },
1329
+ computed: {
1330
+ style() {
1331
+ return {
1332
+ backgroundImage: `linear-gradient(90deg, ${this.startColor} 0%, ${this.endColor} 100%),
1333
+ linear-gradient(45deg, #c7c7c7 25%, transparent 25%, transparent 75%, #c7c7c7 75%, #c7c7c7),
1334
+ linear-gradient(45deg, #c7c7c7 25%, transparent 25%, transparent 75%, #c7c7c7 75%, #c7c7c7)`,
1335
+ backgroundSize: "100% 100%, 1em 1em, 1em 1em",
1336
+ backgroundPosition: "0 0, .5em .5em, 0 0"
1337
+ };
1338
+ }
1339
+ },
1340
+ watch: {
1341
+ value(newValue, oldValue) {
1342
+ if (newValue !== oldValue) {
1343
+ this.percent = Math.round((1 - newValue / 255) * 100);
1344
+ }
1345
+ },
1346
+ color(newColor) {
1347
+ const color = Color.parse(newColor);
1348
+ color.alpha = 0;
1349
+ this.startColor = color.toString("hex");
1350
+ this.endColor = color.toString("hexa");
1351
+ },
1352
+ captureMouse(newValue, oldValue) {
1353
+ if (oldValue === false && newValue !== false) {
1354
+ const rect = this.$el.getBoundingClientRect();
1355
+ this.clientOffset.cx = rect.x + rect.width / 2;
1356
+ this.clientOffset.cy = rect.y + rect.height / 2;
1357
+ this.clientOffset.width = rect.width;
1358
+ this.clientOffset.height = rect.height;
1359
+ }
1360
+ }
1361
+ },
1362
+ methods: {
1363
+ increaseAlpha(value = 1) {
1364
+ this.percent = Math.max(0, Math.min(100, this.percent + value));
1365
+ },
1366
+ decreaseAlpha(value = 0.01) {
1367
+ this.increaseAlpha(-value);
1368
+ },
1369
+ alphaKeyPress(event) {
1370
+ let handled = false;
1371
+ switch (event.key) {
1372
+ case "ArrowRight":
1373
+ case "ArrowUp":
1374
+ this.increaseAlpha();
1375
+ handled = true;
1376
+ break;
1377
+ case "ArrowLeft":
1378
+ case "ArrowDown":
1379
+ this.decreaseAlpha();
1380
+ handled = true;
1381
+ break;
1382
+ case "Home":
1383
+ this.decreaseAlpha(this.percent);
1384
+ handled = true;
1385
+ break;
1386
+ case "End":
1387
+ this.increaseAlpha(100 - this.percent);
1388
+ handled = true;
1389
+ break;
1390
+ case "PageUp":
1391
+ this.increaseAlpha(10 - this.percent % 10);
1392
+ handled = true;
1393
+ break;
1394
+ case "PageDown":
1395
+ this.decreaseAlpha(this.percent % 10);
1396
+ handled = true;
1397
+ break;
1398
+ }
1399
+ if (handled) {
1400
+ event.preventDefault();
1401
+ event.stopPropagation();
1402
+ this.emitAlpha();
1403
+ }
1404
+ },
1405
+ clickAlpha(event) {
1406
+ this.startMouseCapture(event);
1407
+ this.trackMouse(event);
1408
+ this.stopMouseCapture(event);
1409
+ this.$refs.alphaCursor.focus();
1410
+ },
1411
+ startMouseCapture(event) {
1412
+ event.stopPropagation();
1413
+ this.captureMouse = true;
1414
+ },
1415
+ trackMouse(event) {
1416
+ if (this.captureMouse === false) {
1417
+ return;
1418
+ }
1419
+ event.preventDefault();
1420
+ event.stopPropagation();
1421
+ let [mouseX] = [0, 0];
1422
+ const touches = event.touches;
1423
+ if (typeof touches !== "undefined" && touches.length) {
1424
+ [mouseX] = [touches[0].clientX];
1425
+ } else {
1426
+ [mouseX] = [event.clientX];
1427
+ }
1428
+ const ratio = 0.5 + (this.clientOffset.cx - mouseX) / this.clientOffset.width;
1429
+ this.percent = Math.round(100 - Math.max(0, Math.min(1, ratio)) * 100);
1430
+ this.emitAlpha();
1431
+ },
1432
+ stopMouseCapture(event) {
1433
+ if (this.captureMouse !== false) {
1434
+ event.preventDefault();
1435
+ event.stopPropagation();
1436
+ this.$refs.alphaCursor.focus();
1437
+ }
1438
+ this.captureMouse = false;
1439
+ },
1440
+ emitAlpha() {
1441
+ this.$emit("input", (1 - this.percent / 100) * 255);
1442
+ }
1443
+ },
1444
+ mounted() {
1445
+ window.addEventListener("mousemove", this.trackMouse);
1446
+ window.addEventListener("touchmove", this.trackMouse, { passive: false });
1447
+ window.addEventListener("mouseup", this.stopMouseCapture);
1448
+ window.addEventListener("touchend", this.stopMouseCapture);
1449
+ },
1450
+ beforeUnmount() {
1451
+ window.removeEventListener("mousemove", this.trackMouse);
1452
+ window.removeEventListener("touchmove", this.trackMouse);
1453
+ window.removeEventListener("mouseup", this.stopMouseCapture);
1454
+ window.removeEventListener("touchend", this.stopMouseCapture);
1455
+ }
1456
+ });
1457
+
1458
+ const _hoisted_1$1 = ["aria-valuenow"];
1459
+ function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
1460
+ const _component_b_tooltip = vue.resolveComponent("b-tooltip");
1461
+ return vue.openBlock(), vue.createElementBlock(
1462
+ "div",
1463
+ {
1464
+ class: "b-colorpicker-alpha-slider",
1465
+ style: vue.normalizeStyle(_ctx.style),
1466
+ onClick: _cache[0] || (_cache[0] = (...args) => _ctx.clickAlpha && _ctx.clickAlpha(...args)),
1467
+ onKeydown: _cache[1] || (_cache[1] = (...args) => _ctx.alphaKeyPress && _ctx.alphaKeyPress(...args)),
1468
+ onMousedown: _cache[2] || (_cache[2] = (...args) => _ctx.startMouseCapture && _ctx.startMouseCapture(...args)),
1469
+ onTouchstart: _cache[3] || (_cache[3] = vue.withModifiers((...args) => _ctx.startMouseCapture && _ctx.startMouseCapture(...args), ["prevent"]))
1470
+ },
1471
+ [
1472
+ vue.createElementVNode("div", {
1473
+ ref: "alphaCursor",
1474
+ role: "slider",
1475
+ class: "alpha-range-thumb",
1476
+ tabindex: "0",
1477
+ "aria-label": "Tranparency",
1478
+ "aria-valuemin": "0",
1479
+ "aria-valuenow": _ctx.percent,
1480
+ "aria-valuemax": "100",
1481
+ style: vue.normalizeStyle({ left: `${_ctx.percent}%` })
1482
+ }, [
1483
+ vue.createVNode(_component_b_tooltip, {
1484
+ label: `${_ctx.percent}%`,
1485
+ always: _ctx.captureMouse,
1486
+ position: "is-top"
1487
+ }, {
1488
+ default: vue.withCtx(() => [
1489
+ vue.createTextVNode("   ")
1490
+ ]),
1491
+ _: 1
1492
+ /* STABLE */
1493
+ }, 8, ["label", "always"])
1494
+ ], 12, _hoisted_1$1)
1495
+ ],
1496
+ 36
1497
+ /* STYLE, NEED_HYDRATION */
1498
+ );
1499
+ }
1500
+ var BColorpickerAlphaSlider = /* @__PURE__ */ _pluginVue_exportHelper._export_sfc(_sfc_main$1, [["render", _sfc_render$1]]);
1501
+
1502
+ const defaultColorFormatter = (color) => {
1503
+ if (color.alpha < 1) {
1504
+ return color.toString("hexa");
1505
+ } else {
1506
+ return color.toString("hex");
1507
+ }
1508
+ };
1509
+ const defaultColorParser = (color) => {
1510
+ return Color.parse(color);
1511
+ };
1512
+ var _sfc_main = vue.defineComponent({
1513
+ name: "BColorpicker",
1514
+ components: {
1515
+ BColorpickerHSLRepresentationTriangle,
1516
+ BColorpickerHSLRepresentationSquare,
1517
+ BColorpickerAlphaSlider,
1518
+ BInput: Input.BInput,
1519
+ BField: Field.Field,
1520
+ BButton: Button.BButton,
1521
+ BDropdown: Dropdown.BDropdown,
1522
+ BDropdownItem: DropdownItem.BDropdownItem
1523
+ },
1524
+ mixins: [FormElementMixin.FormElementMixin],
1525
+ inheritAttrs: false,
1526
+ provide() {
1527
+ return {
1528
+ $colorpicker: this
1529
+ };
1530
+ },
1531
+ props: {
1532
+ modelValue: {
1533
+ type: [String, Object],
1534
+ validator(value) {
1535
+ return typeof value === "string" || typeof value === "object" && typeof value.red === "number" && typeof value.green === "number" && typeof value.blue === "number";
1536
+ }
1537
+ },
1538
+ mobileNative: {
1539
+ type: Boolean,
1540
+ default: false
1541
+ },
1542
+ representation: {
1543
+ type: String,
1544
+ default: "triangle",
1545
+ value(value) {
1546
+ return ["triangle", "square"].some((r) => r === value);
1547
+ }
1548
+ },
1549
+ inline: Boolean,
1550
+ disabled: Boolean,
1551
+ horizontalColorPicker: {
1552
+ type: Boolean,
1553
+ default: false
1554
+ },
1555
+ colorFormatter: {
1556
+ type: Function,
1557
+ default: (color, vm) => {
1558
+ if (typeof config.config.defaultColorFormatter === "function") {
1559
+ return config.config.defaultColorFormatter(color);
1560
+ } else {
1561
+ return defaultColorFormatter(color);
1562
+ }
1563
+ }
1564
+ },
1565
+ colorParser: {
1566
+ type: Function,
1567
+ default: (color, vm) => {
1568
+ if (typeof config.config.defaultColorParser === "function") {
1569
+ return config.config.defaultColorParser(color);
1570
+ } else {
1571
+ return defaultColorParser(color);
1572
+ }
1573
+ }
1574
+ },
1575
+ alpha: {
1576
+ type: Boolean,
1577
+ default: false
1578
+ },
1579
+ expanded: Boolean,
1580
+ position: String,
1581
+ mobileModal: {
1582
+ type: Boolean,
1583
+ default: () => config.config.defaultDatepickerMobileModal
1584
+ },
1585
+ focusable: {
1586
+ type: Boolean,
1587
+ default: true
1588
+ },
1589
+ trapFocus: {
1590
+ type: Boolean,
1591
+ default: () => config.config.defaultTrapFocus
1592
+ },
1593
+ openOnFocus: Boolean,
1594
+ closeOnClick: Boolean,
1595
+ appendToBody: Boolean
1596
+ },
1597
+ emits: {
1598
+ /* eslint-disable @typescript-eslint/no-unused-vars */
1599
+ "active-change": (_active) => true,
1600
+ "update:modelValue": (_value) => true
1601
+ /* eslint-enable @typescript-eslint/no-unused-vars */
1602
+ },
1603
+ data() {
1604
+ return {
1605
+ color: this.parseColor(this.modelValue)
1606
+ };
1607
+ },
1608
+ computed: {
1609
+ computedValue: {
1610
+ set(value) {
1611
+ this.color = this.parseColor(value);
1612
+ },
1613
+ get() {
1614
+ return this.color;
1615
+ }
1616
+ },
1617
+ background() {
1618
+ if (this.alpha) {
1619
+ return `linear-gradient(
1620
+ 45deg,
1621
+ ${this.computedValue.toString("hex")} 50%,
1622
+ ${this.computedValue.toString("hexa")} 50%
1623
+ )`;
1624
+ } else {
1625
+ const hex = this.computedValue.toString("hex");
1626
+ return `linear-gradient(
1627
+ 45deg,
1628
+ ${hex} 50%,
1629
+ ${hex} 50%
1630
+ )`;
1631
+ }
1632
+ },
1633
+ triggerStyle() {
1634
+ const { red, green, blue } = this.computedValue;
1635
+ const light = red * 0.299 + green * 0.587 + blue * 0.114 > 186;
1636
+ return {
1637
+ backgroundColor: "#ffffff",
1638
+ backgroundImage: `
1639
+ ${this.background},
1640
+ linear-gradient(45deg, #c7c7c7 25%, transparent 25%, transparent 75%, #c7c7c7 75%, #c7c7c7),
1641
+ linear-gradient(45deg, #c7c7c7 25%, transparent 25%, transparent 75%, #c7c7c7 75%, #c7c7c7)
1642
+ `,
1643
+ backgroundSize: "100% 100%, 16px 16px, 16px 16px",
1644
+ backgroundPosition: "0 0, 8px 8px, 0 0",
1645
+ color: light ? "#000000" : "#FFFFFF",
1646
+ textShadow: `0 0 2px ${light ? "#FFFFFFAA" : "#000000AA"}`
1647
+ };
1648
+ },
1649
+ isMobile() {
1650
+ return this.mobileNative && helpers.isMobile.any();
1651
+ },
1652
+ ariaRole() {
1653
+ if (!this.inline) {
1654
+ return "dialog";
1655
+ } else {
1656
+ return void 0;
1657
+ }
1658
+ }
1659
+ },
1660
+ watch: {
1661
+ modelValue(value) {
1662
+ this.computedValue = new Color(value);
1663
+ }
1664
+ },
1665
+ methods: {
1666
+ parseColor(color) {
1667
+ try {
1668
+ return this.colorParser(color);
1669
+ } catch (e) {
1670
+ return new Color();
1671
+ }
1672
+ },
1673
+ updateColor(value) {
1674
+ value.alpha = this.computedValue.alpha;
1675
+ this.computedValue = value;
1676
+ this.$emit("update:modelValue", value);
1677
+ },
1678
+ updateAlpha(alpha) {
1679
+ this.computedValue.alpha = alpha;
1680
+ this.$emit("update:modelValue", this.computedValue);
1681
+ },
1682
+ updateRGB() {
1683
+ this.$emit("update:modelValue", this.computedValue);
1684
+ },
1685
+ /*
1686
+ * Format color into string
1687
+ */
1688
+ formatValue(value) {
1689
+ return value ? this.colorFormatter(value, this) : null;
1690
+ },
1691
+ /*
1692
+ * Toggle datepicker
1693
+ */
1694
+ togglePicker(active) {
1695
+ if (this.$refs.dropdown) {
1696
+ const isActive = typeof active === "boolean" ? active : !this.$refs.dropdown.isActive;
1697
+ if (isActive) {
1698
+ this.$refs.dropdown.isActive = isActive;
1699
+ } else if (this.closeOnClick) {
1700
+ this.$refs.dropdown.isActive = isActive;
1701
+ }
1702
+ }
1703
+ },
1704
+ /*
1705
+ * Call default onFocus method and show datepicker
1706
+ */
1707
+ handleOnFocus(event) {
1708
+ this.onFocus(event);
1709
+ if (this.openOnFocus) {
1710
+ this.togglePicker(true);
1711
+ }
1712
+ },
1713
+ /*
1714
+ * Toggle dropdown
1715
+ */
1716
+ // I decided to comment out the following unused method until we come
1717
+ // back to deal with the `open-on-focus` and `close-on-click` props
1718
+ /*
1719
+ toggle() {
1720
+ if (this.mobileNative && this.isMobile) {
1721
+ const input = this.$refs.input.$refs.input
1722
+ input.focus()
1723
+ input.click()
1724
+ return
1725
+ }
1726
+ (this.$refs.dropdown as BDropdownInstance).toggle()
1727
+ }, */
1728
+ /*
1729
+ * Avoid dropdown toggle when is already visible
1730
+ */
1731
+ onInputClick(event) {
1732
+ if (this.$refs.dropdown.isActive) {
1733
+ event.stopPropagation();
1734
+ }
1735
+ },
1736
+ /*
1737
+ * Keypress event that is bound to the document.
1738
+ */
1739
+ keyPress({ key }) {
1740
+ const dropdown = this.$refs.dropdown;
1741
+ if (dropdown && dropdown.isActive && (key === "Escape" || key === "Esc")) {
1742
+ this.togglePicker(false);
1743
+ }
1744
+ },
1745
+ /*
1746
+ * Emit 'blur' event on dropdown is not active (closed)
1747
+ */
1748
+ onActiveChange(value) {
1749
+ if (!value) {
1750
+ this.onBlur();
1751
+ }
1752
+ this.$emit("active-change", value);
1753
+ }
1754
+ }
1755
+ });
1756
+
1757
+ const _hoisted_1 = { class: "color-name" };
1758
+ const _hoisted_2 = { class: "colorpicker-header" };
1759
+ const _hoisted_3 = { class: "colorpicker-content" };
1760
+ const _hoisted_4 = { class: "colorpicker-footer" };
1761
+ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
1762
+ const _component_b_button = vue.resolveComponent("b-button");
1763
+ const _component_b_colorpicker_h_s_l_representation_square = vue.resolveComponent("b-colorpicker-h-s-l-representation-square");
1764
+ const _component_b_colorpicker_h_s_l_representation_triangle = vue.resolveComponent("b-colorpicker-h-s-l-representation-triangle");
1765
+ const _component_b_colorpicker_alpha_slider = vue.resolveComponent("b-colorpicker-alpha-slider");
1766
+ const _component_b_input = vue.resolveComponent("b-input");
1767
+ const _component_b_field = vue.resolveComponent("b-field");
1768
+ const _component_b_dropdown_item = vue.resolveComponent("b-dropdown-item");
1769
+ const _component_b_dropdown = vue.resolveComponent("b-dropdown");
1770
+ return vue.openBlock(), vue.createElementBlock(
1771
+ "div",
1772
+ {
1773
+ class: vue.normalizeClass(["colorpicker control", [_ctx.size, { "is-expanded": _ctx.expanded }]])
1774
+ },
1775
+ [
1776
+ !_ctx.isMobile || _ctx.inline ? (vue.openBlock(), vue.createBlock(_component_b_dropdown, {
1777
+ key: 0,
1778
+ ref: "dropdown",
1779
+ position: _ctx.position,
1780
+ expanded: _ctx.expanded,
1781
+ disabled: _ctx.disabled,
1782
+ inline: _ctx.inline,
1783
+ "mobile-modal": _ctx.mobileModal,
1784
+ "trap-focus": _ctx.trapFocus,
1785
+ "aria-role": _ctx.ariaRole,
1786
+ "append-to-body": _ctx.appendToBody,
1787
+ "append-to-body-copy-parent": "",
1788
+ onActiveChange: _ctx.onActiveChange
1789
+ }, vue.createSlots({
1790
+ default: vue.withCtx(() => [
1791
+ vue.createVNode(_component_b_dropdown_item, {
1792
+ disabled: _ctx.disabled,
1793
+ focusable: _ctx.focusable,
1794
+ custom: "",
1795
+ class: vue.normalizeClass({ "dropdown-horizontal-colorpicker": _ctx.horizontalColorPicker })
1796
+ }, {
1797
+ default: vue.withCtx(() => [
1798
+ vue.createElementVNode("div", null, [
1799
+ vue.createElementVNode("header", _hoisted_2, [
1800
+ _ctx.$slots.header !== void 0 && _ctx.$slots.header.length ? vue.renderSlot(_ctx.$slots, "header", { key: 0 }) : vue.createCommentVNode("v-if", true)
1801
+ ]),
1802
+ vue.createElementVNode("div", _hoisted_3, [
1803
+ _ctx.representation === "square" ? (vue.openBlock(), vue.createBlock(_component_b_colorpicker_h_s_l_representation_square, {
1804
+ key: 0,
1805
+ value: _ctx.computedValue,
1806
+ onInput: _ctx.updateColor
1807
+ }, null, 8, ["value", "onInput"])) : (vue.openBlock(), vue.createBlock(_component_b_colorpicker_h_s_l_representation_triangle, {
1808
+ key: 1,
1809
+ value: _ctx.computedValue,
1810
+ onInput: _ctx.updateColor
1811
+ }, null, 8, ["value", "onInput"]))
1812
+ ])
1813
+ ]),
1814
+ vue.createElementVNode("footer", _hoisted_4, [
1815
+ _ctx.alpha ? (vue.openBlock(), vue.createBlock(_component_b_colorpicker_alpha_slider, {
1816
+ key: 0,
1817
+ value: _ctx.computedValue.alpha,
1818
+ onInput: _ctx.updateAlpha,
1819
+ color: _ctx.computedValue
1820
+ }, null, 8, ["value", "onInput", "color"])) : vue.createCommentVNode("v-if", true),
1821
+ vue.renderSlot(_ctx.$slots, "footer", { color: _ctx.computedValue }, () => [
1822
+ vue.createVNode(_component_b_field, {
1823
+ class: "colorpicker-fields",
1824
+ grouped: ""
1825
+ }, {
1826
+ default: vue.withCtx(() => [
1827
+ vue.createVNode(_component_b_field, {
1828
+ horizontal: "",
1829
+ label: "R"
1830
+ }, {
1831
+ default: vue.withCtx(() => [
1832
+ vue.createVNode(_component_b_input, {
1833
+ type: "number",
1834
+ modelValue: _ctx.computedValue.red,
1835
+ "onUpdate:modelValue": [
1836
+ _cache[0] || (_cache[0] = ($event) => _ctx.computedValue.red = $event),
1837
+ _ctx.updateRGB
1838
+ ],
1839
+ modelModifiers: { number: true },
1840
+ size: "is-small",
1841
+ "aria-label": "Red"
1842
+ }, null, 8, ["modelValue", "onUpdate:modelValue"])
1843
+ ]),
1844
+ _: 1
1845
+ /* STABLE */
1846
+ }),
1847
+ vue.createVNode(_component_b_field, {
1848
+ horizontal: "",
1849
+ label: "G"
1850
+ }, {
1851
+ default: vue.withCtx(() => [
1852
+ vue.createVNode(_component_b_input, {
1853
+ type: "number",
1854
+ modelValue: _ctx.computedValue.green,
1855
+ "onUpdate:modelValue": [
1856
+ _cache[1] || (_cache[1] = ($event) => _ctx.computedValue.green = $event),
1857
+ _ctx.updateRGB
1858
+ ],
1859
+ modelModifiers: { number: true },
1860
+ size: "is-small",
1861
+ "aria-label": "Green"
1862
+ }, null, 8, ["modelValue", "onUpdate:modelValue"])
1863
+ ]),
1864
+ _: 1
1865
+ /* STABLE */
1866
+ }),
1867
+ vue.createVNode(_component_b_field, {
1868
+ horizontal: "",
1869
+ label: "B"
1870
+ }, {
1871
+ default: vue.withCtx(() => [
1872
+ vue.createVNode(_component_b_input, {
1873
+ type: "number",
1874
+ modelValue: _ctx.computedValue.blue,
1875
+ "onUpdate:modelValue": [
1876
+ _cache[2] || (_cache[2] = ($event) => _ctx.computedValue.blue = $event),
1877
+ _ctx.updateRGB
1878
+ ],
1879
+ modelModifiers: { number: true },
1880
+ size: "is-small",
1881
+ "aria-label": "Blue"
1882
+ }, null, 8, ["modelValue", "onUpdate:modelValue"])
1883
+ ]),
1884
+ _: 1
1885
+ /* STABLE */
1886
+ })
1887
+ ]),
1888
+ _: 1
1889
+ /* STABLE */
1890
+ })
1891
+ ])
1892
+ ])
1893
+ ]),
1894
+ _: 3
1895
+ /* FORWARDED */
1896
+ }, 8, ["disabled", "focusable", "class"])
1897
+ ]),
1898
+ _: 2
1899
+ /* DYNAMIC */
1900
+ }, [
1901
+ !_ctx.inline ? {
1902
+ name: "trigger",
1903
+ fn: vue.withCtx(() => [
1904
+ vue.renderSlot(_ctx.$slots, "trigger", {}, () => [
1905
+ vue.createVNode(_component_b_button, {
1906
+ style: vue.normalizeStyle(_ctx.triggerStyle),
1907
+ expanded: _ctx.expanded,
1908
+ disabled: _ctx.disabled
1909
+ }, {
1910
+ default: vue.withCtx(() => [
1911
+ vue.createElementVNode(
1912
+ "span",
1913
+ _hoisted_1,
1914
+ vue.toDisplayString(_ctx.colorFormatter(_ctx.computedValue)),
1915
+ 1
1916
+ /* TEXT */
1917
+ )
1918
+ ]),
1919
+ _: 1
1920
+ /* STABLE */
1921
+ }, 8, ["style", "expanded", "disabled"])
1922
+ ])
1923
+ ]),
1924
+ key: "0"
1925
+ } : void 0
1926
+ ]), 1032, ["position", "expanded", "disabled", "inline", "mobile-modal", "trap-focus", "aria-role", "append-to-body", "onActiveChange"])) : vue.createCommentVNode("v-if", true)
1927
+ ],
1928
+ 2
1929
+ /* CLASS */
1930
+ );
1931
+ }
1932
+ var Colorpicker = /* @__PURE__ */ _pluginVue_exportHelper._export_sfc(_sfc_main, [["render", _sfc_render]]);
1933
+
1934
+ const Plugin = {
1935
+ install(Vue) {
1936
+ plugins.registerComponent(Vue, Colorpicker);
1937
+ }
1938
+ };
1939
+
1940
+ exports.Color = Color;
1941
+ exports.Colorpicker = Colorpicker;
1942
+ exports.Plugin = Plugin;