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