@wfrog/vc-ui 1.0.0

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 (301) hide show
  1. package/README.md +95 -0
  2. package/dist/es/chunk/-EkpfdcW.mjs +1100 -0
  3. package/dist/es/chunk/8rLUmOVR.mjs +29 -0
  4. package/dist/es/chunk/B-rxnVJv.mjs +3 -0
  5. package/dist/es/chunk/BAGoDD49.mjs +36 -0
  6. package/dist/es/chunk/BAtns-Mc.mjs +96 -0
  7. package/dist/es/chunk/BJS5Pdfp.mjs +55 -0
  8. package/dist/es/chunk/BMzd-IS6.mjs +900 -0
  9. package/dist/es/chunk/BWcCXRRK.mjs +229 -0
  10. package/dist/es/chunk/BX-Ogf7p.mjs +3743 -0
  11. package/dist/es/chunk/B_tU9Nax.mjs +49 -0
  12. package/dist/es/chunk/BdDihk0t.mjs +3420 -0
  13. package/dist/es/chunk/C2LgraHx.mjs +489 -0
  14. package/dist/es/chunk/C5hWsUfD.mjs +64 -0
  15. package/dist/es/chunk/C7iSSBUr.mjs +303 -0
  16. package/dist/es/chunk/CD98REcR.mjs +666 -0
  17. package/dist/es/chunk/CEClY-_T.mjs +445 -0
  18. package/dist/es/chunk/CEm0brzD.mjs +35 -0
  19. package/dist/es/chunk/CMABHk8B.mjs +1942 -0
  20. package/dist/es/chunk/CS4VKsqy.mjs +19 -0
  21. package/dist/es/chunk/CVlj9F0I.mjs +291 -0
  22. package/dist/es/chunk/CZ4ggqDE.mjs +140 -0
  23. package/dist/es/chunk/CaTfZePA.mjs +533 -0
  24. package/dist/es/chunk/Ce9ApjrT.mjs +201 -0
  25. package/dist/es/chunk/ClZGuAIb.mjs +10 -0
  26. package/dist/es/chunk/Coex0GxM.mjs +450 -0
  27. package/dist/es/chunk/Ct6q2FXg.mjs +5 -0
  28. package/dist/es/chunk/CyxEcbcy.mjs +29 -0
  29. package/dist/es/chunk/D389hx_T.mjs +35 -0
  30. package/dist/es/chunk/D3DXeVfC.mjs +1171 -0
  31. package/dist/es/chunk/D3uV7vm-.mjs +45 -0
  32. package/dist/es/chunk/D5259bwd.mjs +50 -0
  33. package/dist/es/chunk/DMHNh_tw.mjs +49 -0
  34. package/dist/es/chunk/DVNTpOBR.mjs +4 -0
  35. package/dist/es/chunk/DZACQ9LT.mjs +95 -0
  36. package/dist/es/chunk/De_EXLIy.mjs +22 -0
  37. package/dist/es/chunk/Dh4jaUSg.mjs +89 -0
  38. package/dist/es/chunk/DhhdKtyu.mjs +439 -0
  39. package/dist/es/chunk/DqUIKX7f.mjs +2039 -0
  40. package/dist/es/chunk/Dqz1zvKN.mjs +59 -0
  41. package/dist/es/chunk/Dvi7RsXg.mjs +727 -0
  42. package/dist/es/chunk/DyDMGLoF.mjs +123 -0
  43. package/dist/es/chunk/E_WRn0OP.mjs +449 -0
  44. package/dist/es/chunk/Fo0dZYnz.mjs +128 -0
  45. package/dist/es/chunk/HSv8BL8o.mjs +72 -0
  46. package/dist/es/chunk/JCIyOUEY.mjs +105 -0
  47. package/dist/es/chunk/O-uhUKF4.mjs +43 -0
  48. package/dist/es/chunk/Spa-JKB4.mjs +1046 -0
  49. package/dist/es/chunk/VAdRxe-1.mjs +16 -0
  50. package/dist/es/chunk/VCrtRnxt.mjs +1477 -0
  51. package/dist/es/chunk/ViP2SEY4.mjs +211 -0
  52. package/dist/es/chunk/aibQ9WSZ.mjs +249 -0
  53. package/dist/es/chunk/nWBcrYxV.mjs +690 -0
  54. package/dist/es/chunk/pcqpp-6-.mjs +9 -0
  55. package/dist/es/chunk/qY9OvNHY.mjs +283 -0
  56. package/dist/es/chunk/su2Zrql0.mjs +53 -0
  57. package/dist/es/chunk/zfg5SOj1.mjs +138 -0
  58. package/dist/es/components/awesome-icon/awesome-icon.d.ts +6 -0
  59. package/dist/es/components/awesome-icon/awesome-icon.mjs +41 -0
  60. package/dist/es/components/awesome-icon/awesome-icon.vue.d.ts +5 -0
  61. package/dist/es/components/awesome-icon/index.d.ts +4 -0
  62. package/dist/es/components/awesome-icon/index.mjs +6 -0
  63. package/dist/es/components/backbottom/backbottom.d.ts +7 -0
  64. package/dist/es/components/backbottom/backbottom.mjs +172 -0
  65. package/dist/es/components/backbottom/backbottom.vue.d.ts +7 -0
  66. package/dist/es/components/backbottom/components/child.vue.d.ts +30 -0
  67. package/dist/es/components/backbottom/index.d.ts +4 -0
  68. package/dist/es/components/backbottom/index.mjs +6 -0
  69. package/dist/es/components/button/button.d.ts +18 -0
  70. package/dist/es/components/button/button.mjs +313 -0
  71. package/dist/es/components/button/button.vue.d.ts +33 -0
  72. package/dist/es/components/button/index.css +9 -0
  73. package/dist/es/components/button/index.d.ts +4 -0
  74. package/dist/es/components/button/index.mjs +6 -0
  75. package/dist/es/components/cdn-tag.vue.d.ts +5 -0
  76. package/dist/es/components/chat-container/chat-container.d.ts +9 -0
  77. package/dist/es/components/chat-container/chat-container.mjs +77 -0
  78. package/dist/es/components/chat-container/chat-container.vue.d.ts +29 -0
  79. package/dist/es/components/chat-container/index.css +9 -0
  80. package/dist/es/components/chat-container/index.d.ts +4 -0
  81. package/dist/es/components/chat-container/index.mjs +6 -0
  82. package/dist/es/components/choice/choice.d.ts +6 -0
  83. package/dist/es/components/choice/choice.mjs +53 -0
  84. package/dist/es/components/choice/choice.vue.d.ts +5 -0
  85. package/dist/es/components/choice/index.css +7 -0
  86. package/dist/es/components/choice/index.d.ts +4 -0
  87. package/dist/es/components/choice/index.mjs +6 -0
  88. package/dist/es/components/choice-boolean/choice-boolean.d.ts +5 -0
  89. package/dist/es/components/choice-boolean/choice-boolean.mjs +32 -0
  90. package/dist/es/components/choice-boolean/choice-boolean.vue.d.ts +10 -0
  91. package/dist/es/components/choice-boolean/index.d.ts +4 -0
  92. package/dist/es/components/choice-boolean/index.mjs +6 -0
  93. package/dist/es/components/config-provider/config-provider.d.ts +16 -0
  94. package/dist/es/components/config-provider/config-provider.mjs +29 -0
  95. package/dist/es/components/config-provider/config-provider.vue.d.ts +18 -0
  96. package/dist/es/components/config-provider/config-provider2.mjs +6 -0
  97. package/dist/es/components/config-provider/index.d.ts +4 -0
  98. package/dist/es/components/config-provider/index.mjs +6 -0
  99. package/dist/es/components/cropper/cropper.d.ts +12 -0
  100. package/dist/es/components/cropper/cropper.mjs +333 -0
  101. package/dist/es/components/cropper/cropper.vue.d.ts +32 -0
  102. package/dist/es/components/cropper/index.css +4 -0
  103. package/dist/es/components/cropper/index.d.ts +4 -0
  104. package/dist/es/components/cropper/index.mjs +6 -0
  105. package/dist/es/components/currency/currency.d.ts +21 -0
  106. package/dist/es/components/currency/currency.mjs +185 -0
  107. package/dist/es/components/currency/currency.vue.d.ts +14 -0
  108. package/dist/es/components/currency/index.css +8 -0
  109. package/dist/es/components/currency/index.d.ts +4 -0
  110. package/dist/es/components/currency/index.mjs +6 -0
  111. package/dist/es/components/daterange-picker/daterange-picker.d.ts +6 -0
  112. package/dist/es/components/daterange-picker/daterange-picker.mjs +5550 -0
  113. package/dist/es/components/daterange-picker/daterange-picker.vue.d.ts +13 -0
  114. package/dist/es/components/daterange-picker/index.d.ts +4 -0
  115. package/dist/es/components/daterange-picker/index.mjs +6 -0
  116. package/dist/es/components/dialog/dialog.d.ts +13 -0
  117. package/dist/es/components/dialog/dialog.mjs +537 -0
  118. package/dist/es/components/dialog/dialog.vue.d.ts +38 -0
  119. package/dist/es/components/dialog/index.css +87 -0
  120. package/dist/es/components/dialog/index.d.ts +4 -0
  121. package/dist/es/components/dialog/index.mjs +6 -0
  122. package/dist/es/components/dialog-camera-upload/dialog-camera-upload.d.ts +33 -0
  123. package/dist/es/components/dialog-camera-upload/dialog-camera-upload.mjs +412 -0
  124. package/dist/es/components/dialog-camera-upload/dialog-camera-upload.vue.d.ts +23 -0
  125. package/dist/es/components/dialog-camera-upload/index.css +66 -0
  126. package/dist/es/components/dialog-camera-upload/index.d.ts +4 -0
  127. package/dist/es/components/dialog-camera-upload/index.mjs +6 -0
  128. package/dist/es/components/dialog-map-point/dialog-map-point.d.ts +9 -0
  129. package/dist/es/components/dialog-map-point/dialog-map-point.mjs +183 -0
  130. package/dist/es/components/dialog-map-point/dialog-map-point.vue.d.ts +22 -0
  131. package/dist/es/components/dialog-map-point/index.css +11 -0
  132. package/dist/es/components/dialog-map-point/index.d.ts +4 -0
  133. package/dist/es/components/dialog-map-point/index.mjs +6 -0
  134. package/dist/es/components/dialog-upload-images/dialog-upload-images.d.ts +16 -0
  135. package/dist/es/components/dialog-upload-images/dialog-upload-images.mjs +1391 -0
  136. package/dist/es/components/dialog-upload-images/dialog-upload-images.vue.d.ts +19 -0
  137. package/dist/es/components/dialog-upload-images/index.css +62 -0
  138. package/dist/es/components/dialog-upload-images/index.d.ts +4 -0
  139. package/dist/es/components/dialog-upload-images/index.mjs +6 -0
  140. package/dist/es/components/document.vue.d.ts +14 -0
  141. package/dist/es/components/drawer/drawer.d.ts +7 -0
  142. package/dist/es/components/drawer/drawer.mjs +412 -0
  143. package/dist/es/components/drawer/drawer.vue.d.ts +31 -0
  144. package/dist/es/components/drawer/index.css +56 -0
  145. package/dist/es/components/drawer/index.d.ts +4 -0
  146. package/dist/es/components/drawer/index.mjs +6 -0
  147. package/dist/es/components/easy-pagination/easy-pagination.d.ts +8 -0
  148. package/dist/es/components/easy-pagination/easy-pagination.mjs +74 -0
  149. package/dist/es/components/easy-pagination/easy-pagination.vue.d.ts +19 -0
  150. package/dist/es/components/easy-pagination/index.css +10 -0
  151. package/dist/es/components/easy-pagination/index.d.ts +4 -0
  152. package/dist/es/components/easy-pagination/index.mjs +6 -0
  153. package/dist/es/components/el-icon/el-icon.d.ts +6 -0
  154. package/dist/es/components/el-icon/el-icon.mjs +46 -0
  155. package/dist/es/components/el-icon/el-icon.vue.d.ts +6 -0
  156. package/dist/es/components/el-icon/index.css +7 -0
  157. package/dist/es/components/el-icon/index.d.ts +4 -0
  158. package/dist/es/components/el-icon/index.mjs +6 -0
  159. package/dist/es/components/example-wrapper.vue.d.ts +19 -0
  160. package/dist/es/components/flag/flag.mjs +44 -0
  161. package/dist/es/components/flag/flag.vue.d.ts +5 -0
  162. package/dist/es/components/flag/flags.d.ts +8 -0
  163. package/dist/es/components/flag/index.d.ts +4 -0
  164. package/dist/es/components/flag/index.mjs +6 -0
  165. package/dist/es/components/icon/icon.d.ts +6 -0
  166. package/dist/es/components/icon/icon.mjs +54 -0
  167. package/dist/es/components/icon/icon.vue.d.ts +3 -0
  168. package/dist/es/components/icon/icon2.mjs +27 -0
  169. package/dist/es/components/icon/index.css +9 -0
  170. package/dist/es/components/icon/index.d.ts +4 -0
  171. package/dist/es/components/icon/index.mjs +6 -0
  172. package/dist/es/components/image/image.d.ts +16 -0
  173. package/dist/es/components/image/image.mjs +167 -0
  174. package/dist/es/components/image/image.vue.d.ts +206 -0
  175. package/dist/es/components/image/index.css +20 -0
  176. package/dist/es/components/image/index.d.ts +4 -0
  177. package/dist/es/components/image/index.mjs +6 -0
  178. package/dist/es/components/input/index.css +9 -0
  179. package/dist/es/components/input/index.d.ts +4 -0
  180. package/dist/es/components/input/index.mjs +6 -0
  181. package/dist/es/components/input/input.d.ts +4 -0
  182. package/dist/es/components/input/input.mjs +85 -0
  183. package/dist/es/components/input/input.vue.d.ts +1232 -0
  184. package/dist/es/components/input-number/index.css +24 -0
  185. package/dist/es/components/input-number/index.d.ts +4 -0
  186. package/dist/es/components/input-number/index.mjs +6 -0
  187. package/dist/es/components/input-number/input-number.d.ts +8 -0
  188. package/dist/es/components/input-number/input-number.mjs +137 -0
  189. package/dist/es/components/input-number/input-number.vue.d.ts +35 -0
  190. package/dist/es/components/pca-picker/components/c.vue.d.ts +123 -0
  191. package/dist/es/components/pca-picker/components/elevator-item.vue.d.ts +7 -0
  192. package/dist/es/components/pca-picker/components/filter.vue.d.ts +2 -0
  193. package/dist/es/components/pca-picker/components/history.vue.d.ts +2 -0
  194. package/dist/es/components/pca-picker/components/hot.vue.d.ts +2 -0
  195. package/dist/es/components/pca-picker/components/p.vue.d.ts +2 -0
  196. package/dist/es/components/pca-picker/components/pca.vue.d.ts +9 -0
  197. package/dist/es/components/pca-picker/index.css +107 -0
  198. package/dist/es/components/pca-picker/index.d.ts +4 -0
  199. package/dist/es/components/pca-picker/index.mjs +6 -0
  200. package/dist/es/components/pca-picker/pca-picker.d.ts +78 -0
  201. package/dist/es/components/pca-picker/pca-picker.mjs +1667 -0
  202. package/dist/es/components/pca-picker/pca-picker.vue.d.ts +583 -0
  203. package/dist/es/components/qr-code/index.d.ts +4 -0
  204. package/dist/es/components/qr-code/index.mjs +6 -0
  205. package/dist/es/components/qr-code/qr-code.d.ts +9 -0
  206. package/dist/es/components/qr-code/qr-code.mjs +69 -0
  207. package/dist/es/components/qr-code/qr-code.vue.d.ts +13 -0
  208. package/dist/es/components/screenfull/index.css +14 -0
  209. package/dist/es/components/screenfull/index.d.ts +4 -0
  210. package/dist/es/components/screenfull/index.mjs +6 -0
  211. package/dist/es/components/screenfull/screenfull.d.ts +4 -0
  212. package/dist/es/components/screenfull/screenfull.mjs +91 -0
  213. package/dist/es/components/screenfull/screenfull.vue.d.ts +20 -0
  214. package/dist/es/components/select/index.css +9 -0
  215. package/dist/es/components/select/index.d.ts +4 -0
  216. package/dist/es/components/select/index.mjs +6 -0
  217. package/dist/es/components/select/select.d.ts +6 -0
  218. package/dist/es/components/select/select.mjs +63 -0
  219. package/dist/es/components/select/select.vue.d.ts +6 -0
  220. package/dist/es/components/single-player/index.css +45 -0
  221. package/dist/es/components/single-player/index.d.ts +4 -0
  222. package/dist/es/components/single-player/index.mjs +6 -0
  223. package/dist/es/components/single-player/single-player.d.ts +4 -0
  224. package/dist/es/components/single-player/single-player.mjs +1172 -0
  225. package/dist/es/components/single-player/single-player.vue.d.ts +13 -0
  226. package/dist/es/components/svg-icon/index.css +9 -0
  227. package/dist/es/components/svg-icon/index.d.ts +4 -0
  228. package/dist/es/components/svg-icon/index.mjs +6 -0
  229. package/dist/es/components/svg-icon/svg-icon.d.ts +5 -0
  230. package/dist/es/components/svg-icon/svg-icon.mjs +46 -0
  231. package/dist/es/components/svg-icon/svg-icon.vue.d.ts +18 -0
  232. package/dist/es/components/switch/index.css +15 -0
  233. package/dist/es/components/switch/index.d.ts +4 -0
  234. package/dist/es/components/switch/index.mjs +6 -0
  235. package/dist/es/components/switch/switch.d.ts +9 -0
  236. package/dist/es/components/switch/switch.mjs +82 -0
  237. package/dist/es/components/switch/switch.vue.d.ts +14 -0
  238. package/dist/es/components/sync-scroll-container/index.css +82 -0
  239. package/dist/es/components/sync-scroll-container/index.d.ts +4 -0
  240. package/dist/es/components/sync-scroll-container/index.mjs +6 -0
  241. package/dist/es/components/sync-scroll-container/sync-scroll-container.d.ts +6 -0
  242. package/dist/es/components/sync-scroll-container/sync-scroll-container.mjs +157 -0
  243. package/dist/es/components/sync-scroll-container/sync-scroll-container.vue.d.ts +36 -0
  244. package/dist/es/components/tags/index.css +17 -0
  245. package/dist/es/components/tags/index.d.ts +4 -0
  246. package/dist/es/components/tags/index.mjs +6 -0
  247. package/dist/es/components/tags/tags.d.ts +9 -0
  248. package/dist/es/components/tags/tags.mjs +296 -0
  249. package/dist/es/components/tags/tags.vue.d.ts +20 -0
  250. package/dist/es/components/text-ellipsis/index.css +15 -0
  251. package/dist/es/components/text-ellipsis/index.d.ts +4 -0
  252. package/dist/es/components/text-ellipsis/index.mjs +6 -0
  253. package/dist/es/components/text-ellipsis/text-ellipsis.d.ts +12 -0
  254. package/dist/es/components/text-ellipsis/text-ellipsis.mjs +137 -0
  255. package/dist/es/components/text-ellipsis/text-ellipsis.vue.d.ts +41 -0
  256. package/dist/es/components/thousand-input/index.css +4 -0
  257. package/dist/es/components/thousand-input/index.d.ts +4 -0
  258. package/dist/es/components/thousand-input/index.mjs +6 -0
  259. package/dist/es/components/thousand-input/thousand-input.d.ts +11 -0
  260. package/dist/es/components/thousand-input/thousand-input.mjs +159 -0
  261. package/dist/es/components/thousand-input/thousand-input.vue.d.ts +2558 -0
  262. package/dist/es/components/tinymce/config.d.ts +25 -0
  263. package/dist/es/components/tinymce/index.css +9 -0
  264. package/dist/es/components/tinymce/index.d.ts +4 -0
  265. package/dist/es/components/tinymce/index.mjs +6 -0
  266. package/dist/es/components/tinymce/tinymce.d.ts +9 -0
  267. package/dist/es/components/tinymce/tinymce.mjs +176 -0
  268. package/dist/es/components/tinymce/tinymce.vue.d.ts +20 -0
  269. package/dist/es/components/tree-picker/components/popover-cascader.d.ts +8 -0
  270. package/dist/es/components/tree-picker/components/popover-cascader.vue.d.ts +1361 -0
  271. package/dist/es/components/tree-picker/docs/data.d.ts +2 -0
  272. package/dist/es/components/tree-picker/index.css +41 -0
  273. package/dist/es/components/tree-picker/index.d.ts +4 -0
  274. package/dist/es/components/tree-picker/index.mjs +6 -0
  275. package/dist/es/components/tree-picker/popover-cascader.css +23 -0
  276. package/dist/es/components/tree-picker/tree-picker.d.ts +14 -0
  277. package/dist/es/components/tree-picker/tree-picker.mjs +173 -0
  278. package/dist/es/components/tree-picker/tree-picker.vue.d.ts +575 -0
  279. package/dist/es/components/upload-file/index.css +30 -0
  280. package/dist/es/components/upload-file/index.d.ts +4 -0
  281. package/dist/es/components/upload-file/index.mjs +6 -0
  282. package/dist/es/components/upload-file/upload-file.d.ts +39 -0
  283. package/dist/es/components/upload-file/upload-file.mjs +202 -0
  284. package/dist/es/components/upload-file/upload-file.vue.d.ts +30 -0
  285. package/dist/es/directives/cleave/index.d.ts +3 -0
  286. package/dist/es/directives/focus/index.d.ts +4 -0
  287. package/dist/es/directives/index.d.ts +3 -0
  288. package/dist/es/directives/thousand/index.d.ts +3 -0
  289. package/dist/es/index.d.ts +42 -0
  290. package/dist/es/index.mjs +122 -0
  291. package/dist/es/use/useSmallScreen/index.d.ts +4 -0
  292. package/dist/es/use/useSmallScreen/index.mjs +10 -0
  293. package/dist/es/use/useStore/index.d.ts +3 -0
  294. package/dist/es/use/useStore/index.mjs +22 -0
  295. package/dist/es/utils/index.d.ts +6 -0
  296. package/dist/es/utils/resolver.d.ts +3 -0
  297. package/dist/es/utils/resolver.mjs +24 -0
  298. package/dist/es/utils/typescript.d.ts +6 -0
  299. package/dist/global.d.ts +42 -0
  300. package/dist/index.css +869 -0
  301. package/package.json +58 -0
@@ -0,0 +1,1477 @@
1
+ import { computed, inject, ref, useSlots, Text, defineComponent, createBlock, openBlock, resolveDynamicComponent, mergeProps, unref, withCtx, createElementBlock, createCommentVNode, Fragment, renderSlot, normalizeClass, provide, reactive, toRef } from 'vue';
2
+ import { E as ElIcon } from './DMHNh_tw.mjs';
3
+ import { u as useDeprecated } from './VAdRxe-1.mjs';
4
+ import { u as useGlobalConfig } from './Dh4jaUSg.mjs';
5
+ import { u as useFormItem, c as useFormSize, b as useFormDisabled } from './DZACQ9LT.mjs';
6
+ import { Loading } from '@element-plus/icons-vue';
7
+ import { c as buildProps, d as definePropType, u as useNamespace } from './E_WRn0OP.mjs';
8
+ import { u as useSizeProp } from './CS4VKsqy.mjs';
9
+ import { i as iconPropType } from '../components/icon/icon2.mjs';
10
+ import { _ as _export_sfc, w as withInstall, a as withNoopInstall } from './D389hx_T.mjs';
11
+
12
+ const buttonGroupContextKey = Symbol("buttonGroupContextKey");
13
+
14
+ const useButton = (props, emit) => {
15
+ useDeprecated({
16
+ from: "type.text",
17
+ replacement: "link",
18
+ version: "3.0.0",
19
+ scope: "props",
20
+ ref: "https://element-plus.org/en-US/component/button.html#button-attributes"
21
+ }, computed(() => props.type === "text"));
22
+ const buttonGroupContext = inject(buttonGroupContextKey, void 0);
23
+ const globalConfig = useGlobalConfig("button");
24
+ const { form } = useFormItem();
25
+ const _size = useFormSize(computed(() => buttonGroupContext == null ? void 0 : buttonGroupContext.size));
26
+ const _disabled = useFormDisabled();
27
+ const _ref = ref();
28
+ const slots = useSlots();
29
+ const _type = computed(() => {
30
+ var _a;
31
+ return props.type || (buttonGroupContext == null ? void 0 : buttonGroupContext.type) || ((_a = globalConfig.value) == null ? void 0 : _a.type) || "";
32
+ });
33
+ const autoInsertSpace = computed(() => {
34
+ var _a, _b, _c;
35
+ return (_c = (_b = props.autoInsertSpace) != null ? _b : (_a = globalConfig.value) == null ? void 0 : _a.autoInsertSpace) != null ? _c : false;
36
+ });
37
+ const _plain = computed(() => {
38
+ var _a, _b, _c;
39
+ return (_c = (_b = props.plain) != null ? _b : (_a = globalConfig.value) == null ? void 0 : _a.plain) != null ? _c : false;
40
+ });
41
+ const _round = computed(() => {
42
+ var _a, _b, _c;
43
+ return (_c = (_b = props.round) != null ? _b : (_a = globalConfig.value) == null ? void 0 : _a.round) != null ? _c : false;
44
+ });
45
+ const _text = computed(() => {
46
+ var _a, _b, _c;
47
+ return (_c = (_b = props.text) != null ? _b : (_a = globalConfig.value) == null ? void 0 : _a.text) != null ? _c : false;
48
+ });
49
+ const _props = computed(() => {
50
+ if (props.tag === "button") {
51
+ return {
52
+ ariaDisabled: _disabled.value || props.loading,
53
+ disabled: _disabled.value || props.loading,
54
+ autofocus: props.autofocus,
55
+ type: props.nativeType
56
+ };
57
+ }
58
+ return {};
59
+ });
60
+ const shouldAddSpace = computed(() => {
61
+ var _a;
62
+ const defaultSlot = (_a = slots.default) == null ? void 0 : _a.call(slots);
63
+ if (autoInsertSpace.value && (defaultSlot == null ? void 0 : defaultSlot.length) === 1) {
64
+ const slot = defaultSlot[0];
65
+ if ((slot == null ? void 0 : slot.type) === Text) {
66
+ const text = slot.children;
67
+ return /^\p{Unified_Ideograph}{2}$/u.test(text.trim());
68
+ }
69
+ }
70
+ return false;
71
+ });
72
+ const handleClick = (evt) => {
73
+ if (_disabled.value || props.loading) {
74
+ evt.stopPropagation();
75
+ return;
76
+ }
77
+ if (props.nativeType === "reset") {
78
+ form == null ? void 0 : form.resetFields();
79
+ }
80
+ emit("click", evt);
81
+ };
82
+ return {
83
+ _disabled,
84
+ _size,
85
+ _type,
86
+ _ref,
87
+ _props,
88
+ _plain,
89
+ _round,
90
+ _text,
91
+ shouldAddSpace,
92
+ handleClick
93
+ };
94
+ };
95
+
96
+ const buttonTypes = [
97
+ "default",
98
+ "primary",
99
+ "success",
100
+ "warning",
101
+ "info",
102
+ "danger",
103
+ "text",
104
+ ""
105
+ ];
106
+ const buttonNativeTypes = ["button", "submit", "reset"];
107
+ const buttonProps = buildProps({
108
+ size: useSizeProp,
109
+ disabled: {
110
+ type: Boolean,
111
+ default: void 0
112
+ },
113
+ type: {
114
+ type: String,
115
+ values: buttonTypes,
116
+ default: ""
117
+ },
118
+ icon: {
119
+ type: iconPropType
120
+ },
121
+ nativeType: {
122
+ type: String,
123
+ values: buttonNativeTypes,
124
+ default: "button"
125
+ },
126
+ loading: Boolean,
127
+ loadingIcon: {
128
+ type: iconPropType,
129
+ default: () => Loading
130
+ },
131
+ plain: {
132
+ type: Boolean,
133
+ default: void 0
134
+ },
135
+ text: {
136
+ type: Boolean,
137
+ default: void 0
138
+ },
139
+ link: Boolean,
140
+ bg: Boolean,
141
+ autofocus: Boolean,
142
+ round: {
143
+ type: Boolean,
144
+ default: void 0
145
+ },
146
+ circle: Boolean,
147
+ color: String,
148
+ dark: Boolean,
149
+ autoInsertSpace: {
150
+ type: Boolean,
151
+ default: void 0
152
+ },
153
+ tag: {
154
+ type: definePropType([String, Object]),
155
+ default: "button"
156
+ }
157
+ });
158
+ const buttonEmits = {
159
+ click: (evt) => evt instanceof MouseEvent
160
+ };
161
+
162
+ /**
163
+ * Take input from [0, n] and return it as [0, 1]
164
+ * @hidden
165
+ */
166
+ function bound01(n, max) {
167
+ if (isOnePointZero(n)) {
168
+ n = '100%';
169
+ }
170
+ var isPercent = isPercentage(n);
171
+ n = max === 360 ? n : Math.min(max, Math.max(0, parseFloat(n)));
172
+ // Automatically convert percentage into number
173
+ if (isPercent) {
174
+ n = parseInt(String(n * max), 10) / 100;
175
+ }
176
+ // Handle floating point rounding errors
177
+ if (Math.abs(n - max) < 0.000001) {
178
+ return 1;
179
+ }
180
+ // Convert into [0, 1] range if it isn't already
181
+ if (max === 360) {
182
+ // If n is a hue given in degrees,
183
+ // wrap around out-of-range values into [0, 360] range
184
+ // then convert into [0, 1].
185
+ n = (n < 0 ? (n % max) + max : n % max) / parseFloat(String(max));
186
+ }
187
+ else {
188
+ // If n not a hue given in degrees
189
+ // Convert into [0, 1] range if it isn't already.
190
+ n = (n % max) / parseFloat(String(max));
191
+ }
192
+ return n;
193
+ }
194
+ /**
195
+ * Force a number between 0 and 1
196
+ * @hidden
197
+ */
198
+ function clamp01(val) {
199
+ return Math.min(1, Math.max(0, val));
200
+ }
201
+ /**
202
+ * Need to handle 1.0 as 100%, since once it is a number, there is no difference between it and 1
203
+ * <http://stackoverflow.com/questions/7422072/javascript-how-to-detect-number-as-a-decimal-including-1-0>
204
+ * @hidden
205
+ */
206
+ function isOnePointZero(n) {
207
+ return typeof n === 'string' && n.indexOf('.') !== -1 && parseFloat(n) === 1;
208
+ }
209
+ /**
210
+ * Check to see if string passed in is a percentage
211
+ * @hidden
212
+ */
213
+ function isPercentage(n) {
214
+ return typeof n === 'string' && n.indexOf('%') !== -1;
215
+ }
216
+ /**
217
+ * Return a valid alpha value [0,1] with all invalid values being set to 1
218
+ * @hidden
219
+ */
220
+ function boundAlpha(a) {
221
+ a = parseFloat(a);
222
+ if (isNaN(a) || a < 0 || a > 1) {
223
+ a = 1;
224
+ }
225
+ return a;
226
+ }
227
+ /**
228
+ * Replace a decimal with it's percentage value
229
+ * @hidden
230
+ */
231
+ function convertToPercentage(n) {
232
+ if (n <= 1) {
233
+ return "".concat(Number(n) * 100, "%");
234
+ }
235
+ return n;
236
+ }
237
+ /**
238
+ * Force a hex value to have 2 characters
239
+ * @hidden
240
+ */
241
+ function pad2(c) {
242
+ return c.length === 1 ? '0' + c : String(c);
243
+ }
244
+
245
+ // `rgbToHsl`, `rgbToHsv`, `hslToRgb`, `hsvToRgb` modified from:
246
+ // <http://mjijackson.com/2008/02/rgb-to-hsl-and-rgb-to-hsv-color-model-conversion-algorithms-in-javascript>
247
+ /**
248
+ * Handle bounds / percentage checking to conform to CSS color spec
249
+ * <http://www.w3.org/TR/css3-color/>
250
+ * *Assumes:* r, g, b in [0, 255] or [0, 1]
251
+ * *Returns:* { r, g, b } in [0, 255]
252
+ */
253
+ function rgbToRgb(r, g, b) {
254
+ return {
255
+ r: bound01(r, 255) * 255,
256
+ g: bound01(g, 255) * 255,
257
+ b: bound01(b, 255) * 255,
258
+ };
259
+ }
260
+ /**
261
+ * Converts an RGB color value to HSL.
262
+ * *Assumes:* r, g, and b are contained in [0, 255] or [0, 1]
263
+ * *Returns:* { h, s, l } in [0,1]
264
+ */
265
+ function rgbToHsl(r, g, b) {
266
+ r = bound01(r, 255);
267
+ g = bound01(g, 255);
268
+ b = bound01(b, 255);
269
+ var max = Math.max(r, g, b);
270
+ var min = Math.min(r, g, b);
271
+ var h = 0;
272
+ var s = 0;
273
+ var l = (max + min) / 2;
274
+ if (max === min) {
275
+ s = 0;
276
+ h = 0; // achromatic
277
+ }
278
+ else {
279
+ var d = max - min;
280
+ s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
281
+ switch (max) {
282
+ case r:
283
+ h = (g - b) / d + (g < b ? 6 : 0);
284
+ break;
285
+ case g:
286
+ h = (b - r) / d + 2;
287
+ break;
288
+ case b:
289
+ h = (r - g) / d + 4;
290
+ break;
291
+ }
292
+ h /= 6;
293
+ }
294
+ return { h: h, s: s, l: l };
295
+ }
296
+ function hue2rgb(p, q, t) {
297
+ if (t < 0) {
298
+ t += 1;
299
+ }
300
+ if (t > 1) {
301
+ t -= 1;
302
+ }
303
+ if (t < 1 / 6) {
304
+ return p + (q - p) * (6 * t);
305
+ }
306
+ if (t < 1 / 2) {
307
+ return q;
308
+ }
309
+ if (t < 2 / 3) {
310
+ return p + (q - p) * (2 / 3 - t) * 6;
311
+ }
312
+ return p;
313
+ }
314
+ /**
315
+ * Converts an HSL color value to RGB.
316
+ *
317
+ * *Assumes:* h is contained in [0, 1] or [0, 360] and s and l are contained [0, 1] or [0, 100]
318
+ * *Returns:* { r, g, b } in the set [0, 255]
319
+ */
320
+ function hslToRgb(h, s, l) {
321
+ var r;
322
+ var g;
323
+ var b;
324
+ h = bound01(h, 360);
325
+ s = bound01(s, 100);
326
+ l = bound01(l, 100);
327
+ if (s === 0) {
328
+ // achromatic
329
+ g = l;
330
+ b = l;
331
+ r = l;
332
+ }
333
+ else {
334
+ var q = l < 0.5 ? l * (1 + s) : l + s - l * s;
335
+ var p = 2 * l - q;
336
+ r = hue2rgb(p, q, h + 1 / 3);
337
+ g = hue2rgb(p, q, h);
338
+ b = hue2rgb(p, q, h - 1 / 3);
339
+ }
340
+ return { r: r * 255, g: g * 255, b: b * 255 };
341
+ }
342
+ /**
343
+ * Converts an RGB color value to HSV
344
+ *
345
+ * *Assumes:* r, g, and b are contained in the set [0, 255] or [0, 1]
346
+ * *Returns:* { h, s, v } in [0,1]
347
+ */
348
+ function rgbToHsv(r, g, b) {
349
+ r = bound01(r, 255);
350
+ g = bound01(g, 255);
351
+ b = bound01(b, 255);
352
+ var max = Math.max(r, g, b);
353
+ var min = Math.min(r, g, b);
354
+ var h = 0;
355
+ var v = max;
356
+ var d = max - min;
357
+ var s = max === 0 ? 0 : d / max;
358
+ if (max === min) {
359
+ h = 0; // achromatic
360
+ }
361
+ else {
362
+ switch (max) {
363
+ case r:
364
+ h = (g - b) / d + (g < b ? 6 : 0);
365
+ break;
366
+ case g:
367
+ h = (b - r) / d + 2;
368
+ break;
369
+ case b:
370
+ h = (r - g) / d + 4;
371
+ break;
372
+ }
373
+ h /= 6;
374
+ }
375
+ return { h: h, s: s, v: v };
376
+ }
377
+ /**
378
+ * Converts an HSV color value to RGB.
379
+ *
380
+ * *Assumes:* h is contained in [0, 1] or [0, 360] and s and v are contained in [0, 1] or [0, 100]
381
+ * *Returns:* { r, g, b } in the set [0, 255]
382
+ */
383
+ function hsvToRgb(h, s, v) {
384
+ h = bound01(h, 360) * 6;
385
+ s = bound01(s, 100);
386
+ v = bound01(v, 100);
387
+ var i = Math.floor(h);
388
+ var f = h - i;
389
+ var p = v * (1 - s);
390
+ var q = v * (1 - f * s);
391
+ var t = v * (1 - (1 - f) * s);
392
+ var mod = i % 6;
393
+ var r = [v, q, p, p, t, v][mod];
394
+ var g = [t, v, v, q, p, p][mod];
395
+ var b = [p, p, t, v, v, q][mod];
396
+ return { r: r * 255, g: g * 255, b: b * 255 };
397
+ }
398
+ /**
399
+ * Converts an RGB color to hex
400
+ *
401
+ * Assumes r, g, and b are contained in the set [0, 255]
402
+ * Returns a 3 or 6 character hex
403
+ */
404
+ function rgbToHex(r, g, b, allow3Char) {
405
+ var hex = [
406
+ pad2(Math.round(r).toString(16)),
407
+ pad2(Math.round(g).toString(16)),
408
+ pad2(Math.round(b).toString(16)),
409
+ ];
410
+ // Return a 3 character hex if possible
411
+ if (allow3Char &&
412
+ hex[0].startsWith(hex[0].charAt(1)) &&
413
+ hex[1].startsWith(hex[1].charAt(1)) &&
414
+ hex[2].startsWith(hex[2].charAt(1))) {
415
+ return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0);
416
+ }
417
+ return hex.join('');
418
+ }
419
+ /**
420
+ * Converts an RGBA color plus alpha transparency to hex
421
+ *
422
+ * Assumes r, g, b are contained in the set [0, 255] and
423
+ * a in [0, 1]. Returns a 4 or 8 character rgba hex
424
+ */
425
+ // eslint-disable-next-line max-params
426
+ function rgbaToHex(r, g, b, a, allow4Char) {
427
+ var hex = [
428
+ pad2(Math.round(r).toString(16)),
429
+ pad2(Math.round(g).toString(16)),
430
+ pad2(Math.round(b).toString(16)),
431
+ pad2(convertDecimalToHex(a)),
432
+ ];
433
+ // Return a 4 character hex if possible
434
+ if (allow4Char &&
435
+ hex[0].startsWith(hex[0].charAt(1)) &&
436
+ hex[1].startsWith(hex[1].charAt(1)) &&
437
+ hex[2].startsWith(hex[2].charAt(1)) &&
438
+ hex[3].startsWith(hex[3].charAt(1))) {
439
+ return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0) + hex[3].charAt(0);
440
+ }
441
+ return hex.join('');
442
+ }
443
+ /** Converts a decimal to a hex value */
444
+ function convertDecimalToHex(d) {
445
+ return Math.round(parseFloat(d) * 255).toString(16);
446
+ }
447
+ /** Converts a hex value to a decimal */
448
+ function convertHexToDecimal(h) {
449
+ return parseIntFromHex(h) / 255;
450
+ }
451
+ /** Parse a base-16 hex value into a base-10 integer */
452
+ function parseIntFromHex(val) {
453
+ return parseInt(val, 16);
454
+ }
455
+ function numberInputToObject(color) {
456
+ return {
457
+ r: color >> 16,
458
+ g: (color & 0xff00) >> 8,
459
+ b: color & 0xff,
460
+ };
461
+ }
462
+
463
+ // https://github.com/bahamas10/css-color-names/blob/master/css-color-names.json
464
+ /**
465
+ * @hidden
466
+ */
467
+ var names = {
468
+ aliceblue: '#f0f8ff',
469
+ antiquewhite: '#faebd7',
470
+ aqua: '#00ffff',
471
+ aquamarine: '#7fffd4',
472
+ azure: '#f0ffff',
473
+ beige: '#f5f5dc',
474
+ bisque: '#ffe4c4',
475
+ black: '#000000',
476
+ blanchedalmond: '#ffebcd',
477
+ blue: '#0000ff',
478
+ blueviolet: '#8a2be2',
479
+ brown: '#a52a2a',
480
+ burlywood: '#deb887',
481
+ cadetblue: '#5f9ea0',
482
+ chartreuse: '#7fff00',
483
+ chocolate: '#d2691e',
484
+ coral: '#ff7f50',
485
+ cornflowerblue: '#6495ed',
486
+ cornsilk: '#fff8dc',
487
+ crimson: '#dc143c',
488
+ cyan: '#00ffff',
489
+ darkblue: '#00008b',
490
+ darkcyan: '#008b8b',
491
+ darkgoldenrod: '#b8860b',
492
+ darkgray: '#a9a9a9',
493
+ darkgreen: '#006400',
494
+ darkgrey: '#a9a9a9',
495
+ darkkhaki: '#bdb76b',
496
+ darkmagenta: '#8b008b',
497
+ darkolivegreen: '#556b2f',
498
+ darkorange: '#ff8c00',
499
+ darkorchid: '#9932cc',
500
+ darkred: '#8b0000',
501
+ darksalmon: '#e9967a',
502
+ darkseagreen: '#8fbc8f',
503
+ darkslateblue: '#483d8b',
504
+ darkslategray: '#2f4f4f',
505
+ darkslategrey: '#2f4f4f',
506
+ darkturquoise: '#00ced1',
507
+ darkviolet: '#9400d3',
508
+ deeppink: '#ff1493',
509
+ deepskyblue: '#00bfff',
510
+ dimgray: '#696969',
511
+ dimgrey: '#696969',
512
+ dodgerblue: '#1e90ff',
513
+ firebrick: '#b22222',
514
+ floralwhite: '#fffaf0',
515
+ forestgreen: '#228b22',
516
+ fuchsia: '#ff00ff',
517
+ gainsboro: '#dcdcdc',
518
+ ghostwhite: '#f8f8ff',
519
+ goldenrod: '#daa520',
520
+ gold: '#ffd700',
521
+ gray: '#808080',
522
+ green: '#008000',
523
+ greenyellow: '#adff2f',
524
+ grey: '#808080',
525
+ honeydew: '#f0fff0',
526
+ hotpink: '#ff69b4',
527
+ indianred: '#cd5c5c',
528
+ indigo: '#4b0082',
529
+ ivory: '#fffff0',
530
+ khaki: '#f0e68c',
531
+ lavenderblush: '#fff0f5',
532
+ lavender: '#e6e6fa',
533
+ lawngreen: '#7cfc00',
534
+ lemonchiffon: '#fffacd',
535
+ lightblue: '#add8e6',
536
+ lightcoral: '#f08080',
537
+ lightcyan: '#e0ffff',
538
+ lightgoldenrodyellow: '#fafad2',
539
+ lightgray: '#d3d3d3',
540
+ lightgreen: '#90ee90',
541
+ lightgrey: '#d3d3d3',
542
+ lightpink: '#ffb6c1',
543
+ lightsalmon: '#ffa07a',
544
+ lightseagreen: '#20b2aa',
545
+ lightskyblue: '#87cefa',
546
+ lightslategray: '#778899',
547
+ lightslategrey: '#778899',
548
+ lightsteelblue: '#b0c4de',
549
+ lightyellow: '#ffffe0',
550
+ lime: '#00ff00',
551
+ limegreen: '#32cd32',
552
+ linen: '#faf0e6',
553
+ magenta: '#ff00ff',
554
+ maroon: '#800000',
555
+ mediumaquamarine: '#66cdaa',
556
+ mediumblue: '#0000cd',
557
+ mediumorchid: '#ba55d3',
558
+ mediumpurple: '#9370db',
559
+ mediumseagreen: '#3cb371',
560
+ mediumslateblue: '#7b68ee',
561
+ mediumspringgreen: '#00fa9a',
562
+ mediumturquoise: '#48d1cc',
563
+ mediumvioletred: '#c71585',
564
+ midnightblue: '#191970',
565
+ mintcream: '#f5fffa',
566
+ mistyrose: '#ffe4e1',
567
+ moccasin: '#ffe4b5',
568
+ navajowhite: '#ffdead',
569
+ navy: '#000080',
570
+ oldlace: '#fdf5e6',
571
+ olive: '#808000',
572
+ olivedrab: '#6b8e23',
573
+ orange: '#ffa500',
574
+ orangered: '#ff4500',
575
+ orchid: '#da70d6',
576
+ palegoldenrod: '#eee8aa',
577
+ palegreen: '#98fb98',
578
+ paleturquoise: '#afeeee',
579
+ palevioletred: '#db7093',
580
+ papayawhip: '#ffefd5',
581
+ peachpuff: '#ffdab9',
582
+ peru: '#cd853f',
583
+ pink: '#ffc0cb',
584
+ plum: '#dda0dd',
585
+ powderblue: '#b0e0e6',
586
+ purple: '#800080',
587
+ rebeccapurple: '#663399',
588
+ red: '#ff0000',
589
+ rosybrown: '#bc8f8f',
590
+ royalblue: '#4169e1',
591
+ saddlebrown: '#8b4513',
592
+ salmon: '#fa8072',
593
+ sandybrown: '#f4a460',
594
+ seagreen: '#2e8b57',
595
+ seashell: '#fff5ee',
596
+ sienna: '#a0522d',
597
+ silver: '#c0c0c0',
598
+ skyblue: '#87ceeb',
599
+ slateblue: '#6a5acd',
600
+ slategray: '#708090',
601
+ slategrey: '#708090',
602
+ snow: '#fffafa',
603
+ springgreen: '#00ff7f',
604
+ steelblue: '#4682b4',
605
+ tan: '#d2b48c',
606
+ teal: '#008080',
607
+ thistle: '#d8bfd8',
608
+ tomato: '#ff6347',
609
+ turquoise: '#40e0d0',
610
+ violet: '#ee82ee',
611
+ wheat: '#f5deb3',
612
+ white: '#ffffff',
613
+ whitesmoke: '#f5f5f5',
614
+ yellow: '#ffff00',
615
+ yellowgreen: '#9acd32',
616
+ };
617
+
618
+ /* eslint-disable @typescript-eslint/no-redundant-type-constituents */
619
+ /**
620
+ * Given a string or object, convert that input to RGB
621
+ *
622
+ * Possible string inputs:
623
+ * ```
624
+ * "red"
625
+ * "#f00" or "f00"
626
+ * "#ff0000" or "ff0000"
627
+ * "#ff000000" or "ff000000"
628
+ * "rgb 255 0 0" or "rgb (255, 0, 0)"
629
+ * "rgb 1.0 0 0" or "rgb (1, 0, 0)"
630
+ * "rgba (255, 0, 0, 1)" or "rgba 255, 0, 0, 1"
631
+ * "rgba (1.0, 0, 0, 1)" or "rgba 1.0, 0, 0, 1"
632
+ * "hsl(0, 100%, 50%)" or "hsl 0 100% 50%"
633
+ * "hsla(0, 100%, 50%, 1)" or "hsla 0 100% 50%, 1"
634
+ * "hsv(0, 100%, 100%)" or "hsv 0 100% 100%"
635
+ * ```
636
+ */
637
+ function inputToRGB(color) {
638
+ var rgb = { r: 0, g: 0, b: 0 };
639
+ var a = 1;
640
+ var s = null;
641
+ var v = null;
642
+ var l = null;
643
+ var ok = false;
644
+ var format = false;
645
+ if (typeof color === 'string') {
646
+ color = stringInputToObject(color);
647
+ }
648
+ if (typeof color === 'object') {
649
+ if (isValidCSSUnit(color.r) && isValidCSSUnit(color.g) && isValidCSSUnit(color.b)) {
650
+ rgb = rgbToRgb(color.r, color.g, color.b);
651
+ ok = true;
652
+ format = String(color.r).substr(-1) === '%' ? 'prgb' : 'rgb';
653
+ }
654
+ else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.v)) {
655
+ s = convertToPercentage(color.s);
656
+ v = convertToPercentage(color.v);
657
+ rgb = hsvToRgb(color.h, s, v);
658
+ ok = true;
659
+ format = 'hsv';
660
+ }
661
+ else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.l)) {
662
+ s = convertToPercentage(color.s);
663
+ l = convertToPercentage(color.l);
664
+ rgb = hslToRgb(color.h, s, l);
665
+ ok = true;
666
+ format = 'hsl';
667
+ }
668
+ if (Object.prototype.hasOwnProperty.call(color, 'a')) {
669
+ a = color.a;
670
+ }
671
+ }
672
+ a = boundAlpha(a);
673
+ return {
674
+ ok: ok,
675
+ format: color.format || format,
676
+ r: Math.min(255, Math.max(rgb.r, 0)),
677
+ g: Math.min(255, Math.max(rgb.g, 0)),
678
+ b: Math.min(255, Math.max(rgb.b, 0)),
679
+ a: a,
680
+ };
681
+ }
682
+ // <http://www.w3.org/TR/css3-values/#integers>
683
+ var CSS_INTEGER = '[-\\+]?\\d+%?';
684
+ // <http://www.w3.org/TR/css3-values/#number-value>
685
+ var CSS_NUMBER = '[-\\+]?\\d*\\.\\d+%?';
686
+ // Allow positive/negative integer/number. Don't capture the either/or, just the entire outcome.
687
+ var CSS_UNIT = "(?:".concat(CSS_NUMBER, ")|(?:").concat(CSS_INTEGER, ")");
688
+ // Actual matching.
689
+ // Parentheses and commas are optional, but not required.
690
+ // Whitespace can take the place of commas or opening paren
691
+ var PERMISSIVE_MATCH3 = "[\\s|\\(]+(".concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")\\s*\\)?");
692
+ var PERMISSIVE_MATCH4 = "[\\s|\\(]+(".concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")\\s*\\)?");
693
+ var matchers = {
694
+ CSS_UNIT: new RegExp(CSS_UNIT),
695
+ rgb: new RegExp('rgb' + PERMISSIVE_MATCH3),
696
+ rgba: new RegExp('rgba' + PERMISSIVE_MATCH4),
697
+ hsl: new RegExp('hsl' + PERMISSIVE_MATCH3),
698
+ hsla: new RegExp('hsla' + PERMISSIVE_MATCH4),
699
+ hsv: new RegExp('hsv' + PERMISSIVE_MATCH3),
700
+ hsva: new RegExp('hsva' + PERMISSIVE_MATCH4),
701
+ hex3: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
702
+ hex6: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,
703
+ hex4: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
704
+ hex8: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,
705
+ };
706
+ /**
707
+ * Permissive string parsing. Take in a number of formats, and output an object
708
+ * based on detected format. Returns `{ r, g, b }` or `{ h, s, l }` or `{ h, s, v}`
709
+ */
710
+ function stringInputToObject(color) {
711
+ color = color.trim().toLowerCase();
712
+ if (color.length === 0) {
713
+ return false;
714
+ }
715
+ var named = false;
716
+ if (names[color]) {
717
+ color = names[color];
718
+ named = true;
719
+ }
720
+ else if (color === 'transparent') {
721
+ return { r: 0, g: 0, b: 0, a: 0, format: 'name' };
722
+ }
723
+ // Try to match string input using regular expressions.
724
+ // Keep most of the number bounding out of this function - don't worry about [0,1] or [0,100] or [0,360]
725
+ // Just return an object and let the conversion functions handle that.
726
+ // This way the result will be the same whether the tinycolor is initialized with string or object.
727
+ var match = matchers.rgb.exec(color);
728
+ if (match) {
729
+ return { r: match[1], g: match[2], b: match[3] };
730
+ }
731
+ match = matchers.rgba.exec(color);
732
+ if (match) {
733
+ return { r: match[1], g: match[2], b: match[3], a: match[4] };
734
+ }
735
+ match = matchers.hsl.exec(color);
736
+ if (match) {
737
+ return { h: match[1], s: match[2], l: match[3] };
738
+ }
739
+ match = matchers.hsla.exec(color);
740
+ if (match) {
741
+ return { h: match[1], s: match[2], l: match[3], a: match[4] };
742
+ }
743
+ match = matchers.hsv.exec(color);
744
+ if (match) {
745
+ return { h: match[1], s: match[2], v: match[3] };
746
+ }
747
+ match = matchers.hsva.exec(color);
748
+ if (match) {
749
+ return { h: match[1], s: match[2], v: match[3], a: match[4] };
750
+ }
751
+ match = matchers.hex8.exec(color);
752
+ if (match) {
753
+ return {
754
+ r: parseIntFromHex(match[1]),
755
+ g: parseIntFromHex(match[2]),
756
+ b: parseIntFromHex(match[3]),
757
+ a: convertHexToDecimal(match[4]),
758
+ format: named ? 'name' : 'hex8',
759
+ };
760
+ }
761
+ match = matchers.hex6.exec(color);
762
+ if (match) {
763
+ return {
764
+ r: parseIntFromHex(match[1]),
765
+ g: parseIntFromHex(match[2]),
766
+ b: parseIntFromHex(match[3]),
767
+ format: named ? 'name' : 'hex',
768
+ };
769
+ }
770
+ match = matchers.hex4.exec(color);
771
+ if (match) {
772
+ return {
773
+ r: parseIntFromHex(match[1] + match[1]),
774
+ g: parseIntFromHex(match[2] + match[2]),
775
+ b: parseIntFromHex(match[3] + match[3]),
776
+ a: convertHexToDecimal(match[4] + match[4]),
777
+ format: named ? 'name' : 'hex8',
778
+ };
779
+ }
780
+ match = matchers.hex3.exec(color);
781
+ if (match) {
782
+ return {
783
+ r: parseIntFromHex(match[1] + match[1]),
784
+ g: parseIntFromHex(match[2] + match[2]),
785
+ b: parseIntFromHex(match[3] + match[3]),
786
+ format: named ? 'name' : 'hex',
787
+ };
788
+ }
789
+ return false;
790
+ }
791
+ /**
792
+ * Check to see if it looks like a CSS unit
793
+ * (see `matchers` above for definition).
794
+ */
795
+ function isValidCSSUnit(color) {
796
+ return Boolean(matchers.CSS_UNIT.exec(String(color)));
797
+ }
798
+
799
+ var TinyColor = /** @class */ (function () {
800
+ function TinyColor(color, opts) {
801
+ if (color === void 0) { color = ''; }
802
+ if (opts === void 0) { opts = {}; }
803
+ var _a;
804
+ // If input is already a tinycolor, return itself
805
+ if (color instanceof TinyColor) {
806
+ // eslint-disable-next-line no-constructor-return
807
+ return color;
808
+ }
809
+ if (typeof color === 'number') {
810
+ color = numberInputToObject(color);
811
+ }
812
+ this.originalInput = color;
813
+ var rgb = inputToRGB(color);
814
+ this.originalInput = color;
815
+ this.r = rgb.r;
816
+ this.g = rgb.g;
817
+ this.b = rgb.b;
818
+ this.a = rgb.a;
819
+ this.roundA = Math.round(100 * this.a) / 100;
820
+ this.format = (_a = opts.format) !== null && _a !== void 0 ? _a : rgb.format;
821
+ this.gradientType = opts.gradientType;
822
+ // Don't let the range of [0,255] come back in [0,1].
823
+ // Potentially lose a little bit of precision here, but will fix issues where
824
+ // .5 gets interpreted as half of the total, instead of half of 1
825
+ // If it was supposed to be 128, this was already taken care of by `inputToRgb`
826
+ if (this.r < 1) {
827
+ this.r = Math.round(this.r);
828
+ }
829
+ if (this.g < 1) {
830
+ this.g = Math.round(this.g);
831
+ }
832
+ if (this.b < 1) {
833
+ this.b = Math.round(this.b);
834
+ }
835
+ this.isValid = rgb.ok;
836
+ }
837
+ TinyColor.prototype.isDark = function () {
838
+ return this.getBrightness() < 128;
839
+ };
840
+ TinyColor.prototype.isLight = function () {
841
+ return !this.isDark();
842
+ };
843
+ /**
844
+ * Returns the perceived brightness of the color, from 0-255.
845
+ */
846
+ TinyColor.prototype.getBrightness = function () {
847
+ // http://www.w3.org/TR/AERT#color-contrast
848
+ var rgb = this.toRgb();
849
+ return (rgb.r * 299 + rgb.g * 587 + rgb.b * 114) / 1000;
850
+ };
851
+ /**
852
+ * Returns the perceived luminance of a color, from 0-1.
853
+ */
854
+ TinyColor.prototype.getLuminance = function () {
855
+ // http://www.w3.org/TR/2008/REC-WCAG20-20081211/#relativeluminancedef
856
+ var rgb = this.toRgb();
857
+ var R;
858
+ var G;
859
+ var B;
860
+ var RsRGB = rgb.r / 255;
861
+ var GsRGB = rgb.g / 255;
862
+ var BsRGB = rgb.b / 255;
863
+ if (RsRGB <= 0.03928) {
864
+ R = RsRGB / 12.92;
865
+ }
866
+ else {
867
+ // eslint-disable-next-line prefer-exponentiation-operator
868
+ R = Math.pow((RsRGB + 0.055) / 1.055, 2.4);
869
+ }
870
+ if (GsRGB <= 0.03928) {
871
+ G = GsRGB / 12.92;
872
+ }
873
+ else {
874
+ // eslint-disable-next-line prefer-exponentiation-operator
875
+ G = Math.pow((GsRGB + 0.055) / 1.055, 2.4);
876
+ }
877
+ if (BsRGB <= 0.03928) {
878
+ B = BsRGB / 12.92;
879
+ }
880
+ else {
881
+ // eslint-disable-next-line prefer-exponentiation-operator
882
+ B = Math.pow((BsRGB + 0.055) / 1.055, 2.4);
883
+ }
884
+ return 0.2126 * R + 0.7152 * G + 0.0722 * B;
885
+ };
886
+ /**
887
+ * Returns the alpha value of a color, from 0-1.
888
+ */
889
+ TinyColor.prototype.getAlpha = function () {
890
+ return this.a;
891
+ };
892
+ /**
893
+ * Sets the alpha value on the current color.
894
+ *
895
+ * @param alpha - The new alpha value. The accepted range is 0-1.
896
+ */
897
+ TinyColor.prototype.setAlpha = function (alpha) {
898
+ this.a = boundAlpha(alpha);
899
+ this.roundA = Math.round(100 * this.a) / 100;
900
+ return this;
901
+ };
902
+ /**
903
+ * Returns whether the color is monochrome.
904
+ */
905
+ TinyColor.prototype.isMonochrome = function () {
906
+ var s = this.toHsl().s;
907
+ return s === 0;
908
+ };
909
+ /**
910
+ * Returns the object as a HSVA object.
911
+ */
912
+ TinyColor.prototype.toHsv = function () {
913
+ var hsv = rgbToHsv(this.r, this.g, this.b);
914
+ return { h: hsv.h * 360, s: hsv.s, v: hsv.v, a: this.a };
915
+ };
916
+ /**
917
+ * Returns the hsva values interpolated into a string with the following format:
918
+ * "hsva(xxx, xxx, xxx, xx)".
919
+ */
920
+ TinyColor.prototype.toHsvString = function () {
921
+ var hsv = rgbToHsv(this.r, this.g, this.b);
922
+ var h = Math.round(hsv.h * 360);
923
+ var s = Math.round(hsv.s * 100);
924
+ var v = Math.round(hsv.v * 100);
925
+ return this.a === 1 ? "hsv(".concat(h, ", ").concat(s, "%, ").concat(v, "%)") : "hsva(".concat(h, ", ").concat(s, "%, ").concat(v, "%, ").concat(this.roundA, ")");
926
+ };
927
+ /**
928
+ * Returns the object as a HSLA object.
929
+ */
930
+ TinyColor.prototype.toHsl = function () {
931
+ var hsl = rgbToHsl(this.r, this.g, this.b);
932
+ return { h: hsl.h * 360, s: hsl.s, l: hsl.l, a: this.a };
933
+ };
934
+ /**
935
+ * Returns the hsla values interpolated into a string with the following format:
936
+ * "hsla(xxx, xxx, xxx, xx)".
937
+ */
938
+ TinyColor.prototype.toHslString = function () {
939
+ var hsl = rgbToHsl(this.r, this.g, this.b);
940
+ var h = Math.round(hsl.h * 360);
941
+ var s = Math.round(hsl.s * 100);
942
+ var l = Math.round(hsl.l * 100);
943
+ return this.a === 1 ? "hsl(".concat(h, ", ").concat(s, "%, ").concat(l, "%)") : "hsla(".concat(h, ", ").concat(s, "%, ").concat(l, "%, ").concat(this.roundA, ")");
944
+ };
945
+ /**
946
+ * Returns the hex value of the color.
947
+ * @param allow3Char will shorten hex value to 3 char if possible
948
+ */
949
+ TinyColor.prototype.toHex = function (allow3Char) {
950
+ if (allow3Char === void 0) { allow3Char = false; }
951
+ return rgbToHex(this.r, this.g, this.b, allow3Char);
952
+ };
953
+ /**
954
+ * Returns the hex value of the color -with a # prefixed.
955
+ * @param allow3Char will shorten hex value to 3 char if possible
956
+ */
957
+ TinyColor.prototype.toHexString = function (allow3Char) {
958
+ if (allow3Char === void 0) { allow3Char = false; }
959
+ return '#' + this.toHex(allow3Char);
960
+ };
961
+ /**
962
+ * Returns the hex 8 value of the color.
963
+ * @param allow4Char will shorten hex value to 4 char if possible
964
+ */
965
+ TinyColor.prototype.toHex8 = function (allow4Char) {
966
+ if (allow4Char === void 0) { allow4Char = false; }
967
+ return rgbaToHex(this.r, this.g, this.b, this.a, allow4Char);
968
+ };
969
+ /**
970
+ * Returns the hex 8 value of the color -with a # prefixed.
971
+ * @param allow4Char will shorten hex value to 4 char if possible
972
+ */
973
+ TinyColor.prototype.toHex8String = function (allow4Char) {
974
+ if (allow4Char === void 0) { allow4Char = false; }
975
+ return '#' + this.toHex8(allow4Char);
976
+ };
977
+ /**
978
+ * Returns the shorter hex value of the color depends on its alpha -with a # prefixed.
979
+ * @param allowShortChar will shorten hex value to 3 or 4 char if possible
980
+ */
981
+ TinyColor.prototype.toHexShortString = function (allowShortChar) {
982
+ if (allowShortChar === void 0) { allowShortChar = false; }
983
+ return this.a === 1 ? this.toHexString(allowShortChar) : this.toHex8String(allowShortChar);
984
+ };
985
+ /**
986
+ * Returns the object as a RGBA object.
987
+ */
988
+ TinyColor.prototype.toRgb = function () {
989
+ return {
990
+ r: Math.round(this.r),
991
+ g: Math.round(this.g),
992
+ b: Math.round(this.b),
993
+ a: this.a,
994
+ };
995
+ };
996
+ /**
997
+ * Returns the RGBA values interpolated into a string with the following format:
998
+ * "RGBA(xxx, xxx, xxx, xx)".
999
+ */
1000
+ TinyColor.prototype.toRgbString = function () {
1001
+ var r = Math.round(this.r);
1002
+ var g = Math.round(this.g);
1003
+ var b = Math.round(this.b);
1004
+ return this.a === 1 ? "rgb(".concat(r, ", ").concat(g, ", ").concat(b, ")") : "rgba(".concat(r, ", ").concat(g, ", ").concat(b, ", ").concat(this.roundA, ")");
1005
+ };
1006
+ /**
1007
+ * Returns the object as a RGBA object.
1008
+ */
1009
+ TinyColor.prototype.toPercentageRgb = function () {
1010
+ var fmt = function (x) { return "".concat(Math.round(bound01(x, 255) * 100), "%"); };
1011
+ return {
1012
+ r: fmt(this.r),
1013
+ g: fmt(this.g),
1014
+ b: fmt(this.b),
1015
+ a: this.a,
1016
+ };
1017
+ };
1018
+ /**
1019
+ * Returns the RGBA relative values interpolated into a string
1020
+ */
1021
+ TinyColor.prototype.toPercentageRgbString = function () {
1022
+ var rnd = function (x) { return Math.round(bound01(x, 255) * 100); };
1023
+ return this.a === 1
1024
+ ? "rgb(".concat(rnd(this.r), "%, ").concat(rnd(this.g), "%, ").concat(rnd(this.b), "%)")
1025
+ : "rgba(".concat(rnd(this.r), "%, ").concat(rnd(this.g), "%, ").concat(rnd(this.b), "%, ").concat(this.roundA, ")");
1026
+ };
1027
+ /**
1028
+ * The 'real' name of the color -if there is one.
1029
+ */
1030
+ TinyColor.prototype.toName = function () {
1031
+ if (this.a === 0) {
1032
+ return 'transparent';
1033
+ }
1034
+ if (this.a < 1) {
1035
+ return false;
1036
+ }
1037
+ var hex = '#' + rgbToHex(this.r, this.g, this.b, false);
1038
+ for (var _i = 0, _a = Object.entries(names); _i < _a.length; _i++) {
1039
+ var _b = _a[_i], key = _b[0], value = _b[1];
1040
+ if (hex === value) {
1041
+ return key;
1042
+ }
1043
+ }
1044
+ return false;
1045
+ };
1046
+ TinyColor.prototype.toString = function (format) {
1047
+ var formatSet = Boolean(format);
1048
+ format = format !== null && format !== void 0 ? format : this.format;
1049
+ var formattedString = false;
1050
+ var hasAlpha = this.a < 1 && this.a >= 0;
1051
+ var needsAlphaFormat = !formatSet && hasAlpha && (format.startsWith('hex') || format === 'name');
1052
+ if (needsAlphaFormat) {
1053
+ // Special case for "transparent", all other non-alpha formats
1054
+ // will return rgba when there is transparency.
1055
+ if (format === 'name' && this.a === 0) {
1056
+ return this.toName();
1057
+ }
1058
+ return this.toRgbString();
1059
+ }
1060
+ if (format === 'rgb') {
1061
+ formattedString = this.toRgbString();
1062
+ }
1063
+ if (format === 'prgb') {
1064
+ formattedString = this.toPercentageRgbString();
1065
+ }
1066
+ if (format === 'hex' || format === 'hex6') {
1067
+ formattedString = this.toHexString();
1068
+ }
1069
+ if (format === 'hex3') {
1070
+ formattedString = this.toHexString(true);
1071
+ }
1072
+ if (format === 'hex4') {
1073
+ formattedString = this.toHex8String(true);
1074
+ }
1075
+ if (format === 'hex8') {
1076
+ formattedString = this.toHex8String();
1077
+ }
1078
+ if (format === 'name') {
1079
+ formattedString = this.toName();
1080
+ }
1081
+ if (format === 'hsl') {
1082
+ formattedString = this.toHslString();
1083
+ }
1084
+ if (format === 'hsv') {
1085
+ formattedString = this.toHsvString();
1086
+ }
1087
+ return formattedString || this.toHexString();
1088
+ };
1089
+ TinyColor.prototype.toNumber = function () {
1090
+ return (Math.round(this.r) << 16) + (Math.round(this.g) << 8) + Math.round(this.b);
1091
+ };
1092
+ TinyColor.prototype.clone = function () {
1093
+ return new TinyColor(this.toString());
1094
+ };
1095
+ /**
1096
+ * Lighten the color a given amount. Providing 100 will always return white.
1097
+ * @param amount - valid between 1-100
1098
+ */
1099
+ TinyColor.prototype.lighten = function (amount) {
1100
+ if (amount === void 0) { amount = 10; }
1101
+ var hsl = this.toHsl();
1102
+ hsl.l += amount / 100;
1103
+ hsl.l = clamp01(hsl.l);
1104
+ return new TinyColor(hsl);
1105
+ };
1106
+ /**
1107
+ * Brighten the color a given amount, from 0 to 100.
1108
+ * @param amount - valid between 1-100
1109
+ */
1110
+ TinyColor.prototype.brighten = function (amount) {
1111
+ if (amount === void 0) { amount = 10; }
1112
+ var rgb = this.toRgb();
1113
+ rgb.r = Math.max(0, Math.min(255, rgb.r - Math.round(255 * -(amount / 100))));
1114
+ rgb.g = Math.max(0, Math.min(255, rgb.g - Math.round(255 * -(amount / 100))));
1115
+ rgb.b = Math.max(0, Math.min(255, rgb.b - Math.round(255 * -(amount / 100))));
1116
+ return new TinyColor(rgb);
1117
+ };
1118
+ /**
1119
+ * Darken the color a given amount, from 0 to 100.
1120
+ * Providing 100 will always return black.
1121
+ * @param amount - valid between 1-100
1122
+ */
1123
+ TinyColor.prototype.darken = function (amount) {
1124
+ if (amount === void 0) { amount = 10; }
1125
+ var hsl = this.toHsl();
1126
+ hsl.l -= amount / 100;
1127
+ hsl.l = clamp01(hsl.l);
1128
+ return new TinyColor(hsl);
1129
+ };
1130
+ /**
1131
+ * Mix the color with pure white, from 0 to 100.
1132
+ * Providing 0 will do nothing, providing 100 will always return white.
1133
+ * @param amount - valid between 1-100
1134
+ */
1135
+ TinyColor.prototype.tint = function (amount) {
1136
+ if (amount === void 0) { amount = 10; }
1137
+ return this.mix('white', amount);
1138
+ };
1139
+ /**
1140
+ * Mix the color with pure black, from 0 to 100.
1141
+ * Providing 0 will do nothing, providing 100 will always return black.
1142
+ * @param amount - valid between 1-100
1143
+ */
1144
+ TinyColor.prototype.shade = function (amount) {
1145
+ if (amount === void 0) { amount = 10; }
1146
+ return this.mix('black', amount);
1147
+ };
1148
+ /**
1149
+ * Desaturate the color a given amount, from 0 to 100.
1150
+ * Providing 100 will is the same as calling greyscale
1151
+ * @param amount - valid between 1-100
1152
+ */
1153
+ TinyColor.prototype.desaturate = function (amount) {
1154
+ if (amount === void 0) { amount = 10; }
1155
+ var hsl = this.toHsl();
1156
+ hsl.s -= amount / 100;
1157
+ hsl.s = clamp01(hsl.s);
1158
+ return new TinyColor(hsl);
1159
+ };
1160
+ /**
1161
+ * Saturate the color a given amount, from 0 to 100.
1162
+ * @param amount - valid between 1-100
1163
+ */
1164
+ TinyColor.prototype.saturate = function (amount) {
1165
+ if (amount === void 0) { amount = 10; }
1166
+ var hsl = this.toHsl();
1167
+ hsl.s += amount / 100;
1168
+ hsl.s = clamp01(hsl.s);
1169
+ return new TinyColor(hsl);
1170
+ };
1171
+ /**
1172
+ * Completely desaturates a color into greyscale.
1173
+ * Same as calling `desaturate(100)`
1174
+ */
1175
+ TinyColor.prototype.greyscale = function () {
1176
+ return this.desaturate(100);
1177
+ };
1178
+ /**
1179
+ * Spin takes a positive or negative amount within [-360, 360] indicating the change of hue.
1180
+ * Values outside of this range will be wrapped into this range.
1181
+ */
1182
+ TinyColor.prototype.spin = function (amount) {
1183
+ var hsl = this.toHsl();
1184
+ var hue = (hsl.h + amount) % 360;
1185
+ hsl.h = hue < 0 ? 360 + hue : hue;
1186
+ return new TinyColor(hsl);
1187
+ };
1188
+ /**
1189
+ * Mix the current color a given amount with another color, from 0 to 100.
1190
+ * 0 means no mixing (return current color).
1191
+ */
1192
+ TinyColor.prototype.mix = function (color, amount) {
1193
+ if (amount === void 0) { amount = 50; }
1194
+ var rgb1 = this.toRgb();
1195
+ var rgb2 = new TinyColor(color).toRgb();
1196
+ var p = amount / 100;
1197
+ var rgba = {
1198
+ r: (rgb2.r - rgb1.r) * p + rgb1.r,
1199
+ g: (rgb2.g - rgb1.g) * p + rgb1.g,
1200
+ b: (rgb2.b - rgb1.b) * p + rgb1.b,
1201
+ a: (rgb2.a - rgb1.a) * p + rgb1.a,
1202
+ };
1203
+ return new TinyColor(rgba);
1204
+ };
1205
+ TinyColor.prototype.analogous = function (results, slices) {
1206
+ if (results === void 0) { results = 6; }
1207
+ if (slices === void 0) { slices = 30; }
1208
+ var hsl = this.toHsl();
1209
+ var part = 360 / slices;
1210
+ var ret = [this];
1211
+ for (hsl.h = (hsl.h - ((part * results) >> 1) + 720) % 360; --results;) {
1212
+ hsl.h = (hsl.h + part) % 360;
1213
+ ret.push(new TinyColor(hsl));
1214
+ }
1215
+ return ret;
1216
+ };
1217
+ /**
1218
+ * taken from https://github.com/infusion/jQuery-xcolor/blob/master/jquery.xcolor.js
1219
+ */
1220
+ TinyColor.prototype.complement = function () {
1221
+ var hsl = this.toHsl();
1222
+ hsl.h = (hsl.h + 180) % 360;
1223
+ return new TinyColor(hsl);
1224
+ };
1225
+ TinyColor.prototype.monochromatic = function (results) {
1226
+ if (results === void 0) { results = 6; }
1227
+ var hsv = this.toHsv();
1228
+ var h = hsv.h;
1229
+ var s = hsv.s;
1230
+ var v = hsv.v;
1231
+ var res = [];
1232
+ var modification = 1 / results;
1233
+ while (results--) {
1234
+ res.push(new TinyColor({ h: h, s: s, v: v }));
1235
+ v = (v + modification) % 1;
1236
+ }
1237
+ return res;
1238
+ };
1239
+ TinyColor.prototype.splitcomplement = function () {
1240
+ var hsl = this.toHsl();
1241
+ var h = hsl.h;
1242
+ return [
1243
+ this,
1244
+ new TinyColor({ h: (h + 72) % 360, s: hsl.s, l: hsl.l }),
1245
+ new TinyColor({ h: (h + 216) % 360, s: hsl.s, l: hsl.l }),
1246
+ ];
1247
+ };
1248
+ /**
1249
+ * Compute how the color would appear on a background
1250
+ */
1251
+ TinyColor.prototype.onBackground = function (background) {
1252
+ var fg = this.toRgb();
1253
+ var bg = new TinyColor(background).toRgb();
1254
+ var alpha = fg.a + bg.a * (1 - fg.a);
1255
+ return new TinyColor({
1256
+ r: (fg.r * fg.a + bg.r * bg.a * (1 - fg.a)) / alpha,
1257
+ g: (fg.g * fg.a + bg.g * bg.a * (1 - fg.a)) / alpha,
1258
+ b: (fg.b * fg.a + bg.b * bg.a * (1 - fg.a)) / alpha,
1259
+ a: alpha,
1260
+ });
1261
+ };
1262
+ /**
1263
+ * Alias for `polyad(3)`
1264
+ */
1265
+ TinyColor.prototype.triad = function () {
1266
+ return this.polyad(3);
1267
+ };
1268
+ /**
1269
+ * Alias for `polyad(4)`
1270
+ */
1271
+ TinyColor.prototype.tetrad = function () {
1272
+ return this.polyad(4);
1273
+ };
1274
+ /**
1275
+ * Get polyad colors, like (for 1, 2, 3, 4, 5, 6, 7, 8, etc...)
1276
+ * monad, dyad, triad, tetrad, pentad, hexad, heptad, octad, etc...
1277
+ */
1278
+ TinyColor.prototype.polyad = function (n) {
1279
+ var hsl = this.toHsl();
1280
+ var h = hsl.h;
1281
+ var result = [this];
1282
+ var increment = 360 / n;
1283
+ for (var i = 1; i < n; i++) {
1284
+ result.push(new TinyColor({ h: (h + i * increment) % 360, s: hsl.s, l: hsl.l }));
1285
+ }
1286
+ return result;
1287
+ };
1288
+ /**
1289
+ * compare color vs current color
1290
+ */
1291
+ TinyColor.prototype.equals = function (color) {
1292
+ return this.toRgbString() === new TinyColor(color).toRgbString();
1293
+ };
1294
+ return TinyColor;
1295
+ }());
1296
+
1297
+ function darken(color, amount = 20) {
1298
+ return color.mix("#141414", amount).toString();
1299
+ }
1300
+ function useButtonCustomStyle(props) {
1301
+ const _disabled = useFormDisabled();
1302
+ const ns = useNamespace("button");
1303
+ return computed(() => {
1304
+ let styles = {};
1305
+ let buttonColor = props.color;
1306
+ if (buttonColor) {
1307
+ const match = buttonColor.match(/var\((.*?)\)/);
1308
+ if (match) {
1309
+ buttonColor = window.getComputedStyle(window.document.documentElement).getPropertyValue(match[1]);
1310
+ }
1311
+ const color = new TinyColor(buttonColor);
1312
+ const activeBgColor = props.dark ? color.tint(20).toString() : darken(color, 20);
1313
+ if (props.plain) {
1314
+ styles = ns.cssVarBlock({
1315
+ "bg-color": props.dark ? darken(color, 90) : color.tint(90).toString(),
1316
+ "text-color": buttonColor,
1317
+ "border-color": props.dark ? darken(color, 50) : color.tint(50).toString(),
1318
+ "hover-text-color": `var(${ns.cssVarName("color-white")})`,
1319
+ "hover-bg-color": buttonColor,
1320
+ "hover-border-color": buttonColor,
1321
+ "active-bg-color": activeBgColor,
1322
+ "active-text-color": `var(${ns.cssVarName("color-white")})`,
1323
+ "active-border-color": activeBgColor
1324
+ });
1325
+ if (_disabled.value) {
1326
+ styles[ns.cssVarBlockName("disabled-bg-color")] = props.dark ? darken(color, 90) : color.tint(90).toString();
1327
+ styles[ns.cssVarBlockName("disabled-text-color")] = props.dark ? darken(color, 50) : color.tint(50).toString();
1328
+ styles[ns.cssVarBlockName("disabled-border-color")] = props.dark ? darken(color, 80) : color.tint(80).toString();
1329
+ }
1330
+ } else {
1331
+ const hoverBgColor = props.dark ? darken(color, 30) : color.tint(30).toString();
1332
+ const textColor = color.isDark() ? `var(${ns.cssVarName("color-white")})` : `var(${ns.cssVarName("color-black")})`;
1333
+ styles = ns.cssVarBlock({
1334
+ "bg-color": buttonColor,
1335
+ "text-color": textColor,
1336
+ "border-color": buttonColor,
1337
+ "hover-bg-color": hoverBgColor,
1338
+ "hover-text-color": textColor,
1339
+ "hover-border-color": hoverBgColor,
1340
+ "active-bg-color": activeBgColor,
1341
+ "active-border-color": activeBgColor
1342
+ });
1343
+ if (_disabled.value) {
1344
+ const disabledButtonColor = props.dark ? darken(color, 50) : color.tint(50).toString();
1345
+ styles[ns.cssVarBlockName("disabled-bg-color")] = disabledButtonColor;
1346
+ styles[ns.cssVarBlockName("disabled-text-color")] = props.dark ? "rgba(255, 255, 255, 0.5)" : `var(${ns.cssVarName("color-white")})`;
1347
+ styles[ns.cssVarBlockName("disabled-border-color")] = disabledButtonColor;
1348
+ }
1349
+ }
1350
+ }
1351
+ return styles;
1352
+ });
1353
+ }
1354
+
1355
+ const __default__$1 = defineComponent({
1356
+ name: "ElButton"
1357
+ });
1358
+ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
1359
+ ...__default__$1,
1360
+ props: buttonProps,
1361
+ emits: buttonEmits,
1362
+ setup(__props, { expose, emit }) {
1363
+ const props = __props;
1364
+ const buttonStyle = useButtonCustomStyle(props);
1365
+ const ns = useNamespace("button");
1366
+ const {
1367
+ _ref,
1368
+ _size,
1369
+ _type,
1370
+ _disabled,
1371
+ _props,
1372
+ _plain,
1373
+ _round,
1374
+ _text,
1375
+ shouldAddSpace,
1376
+ handleClick
1377
+ } = useButton(props, emit);
1378
+ const buttonKls = computed(() => [
1379
+ ns.b(),
1380
+ ns.m(_type.value),
1381
+ ns.m(_size.value),
1382
+ ns.is("disabled", _disabled.value),
1383
+ ns.is("loading", props.loading),
1384
+ ns.is("plain", _plain.value),
1385
+ ns.is("round", _round.value),
1386
+ ns.is("circle", props.circle),
1387
+ ns.is("text", _text.value),
1388
+ ns.is("link", props.link),
1389
+ ns.is("has-bg", props.bg)
1390
+ ]);
1391
+ expose({
1392
+ ref: _ref,
1393
+ size: _size,
1394
+ type: _type,
1395
+ disabled: _disabled,
1396
+ shouldAddSpace
1397
+ });
1398
+ return (_ctx, _cache) => {
1399
+ return openBlock(), createBlock(resolveDynamicComponent(_ctx.tag), mergeProps({
1400
+ ref_key: "_ref",
1401
+ ref: _ref
1402
+ }, unref(_props), {
1403
+ class: unref(buttonKls),
1404
+ style: unref(buttonStyle),
1405
+ onClick: unref(handleClick)
1406
+ }), {
1407
+ default: withCtx(() => [
1408
+ _ctx.loading ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
1409
+ _ctx.$slots.loading ? renderSlot(_ctx.$slots, "loading", { key: 0 }) : (openBlock(), createBlock(unref(ElIcon), {
1410
+ key: 1,
1411
+ class: normalizeClass(unref(ns).is("loading"))
1412
+ }, {
1413
+ default: withCtx(() => [
1414
+ (openBlock(), createBlock(resolveDynamicComponent(_ctx.loadingIcon)))
1415
+ ]),
1416
+ _: 1
1417
+ }, 8, ["class"]))
1418
+ ], 64)) : _ctx.icon || _ctx.$slots.icon ? (openBlock(), createBlock(unref(ElIcon), { key: 1 }, {
1419
+ default: withCtx(() => [
1420
+ _ctx.icon ? (openBlock(), createBlock(resolveDynamicComponent(_ctx.icon), { key: 0 })) : renderSlot(_ctx.$slots, "icon", { key: 1 })
1421
+ ]),
1422
+ _: 3
1423
+ })) : createCommentVNode("v-if", true),
1424
+ _ctx.$slots.default ? (openBlock(), createElementBlock("span", {
1425
+ key: 2,
1426
+ class: normalizeClass({ [unref(ns).em("text", "expand")]: unref(shouldAddSpace) })
1427
+ }, [
1428
+ renderSlot(_ctx.$slots, "default")
1429
+ ], 2)) : createCommentVNode("v-if", true)
1430
+ ]),
1431
+ _: 3
1432
+ }, 16, ["class", "style", "onClick"]);
1433
+ };
1434
+ }
1435
+ });
1436
+ var Button = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__file", "button.vue"]]);
1437
+
1438
+ const buttonGroupProps = {
1439
+ size: buttonProps.size,
1440
+ type: buttonProps.type,
1441
+ direction: {
1442
+ type: definePropType(String),
1443
+ values: ["horizontal", "vertical"],
1444
+ default: "horizontal"
1445
+ }
1446
+ };
1447
+
1448
+ const __default__ = defineComponent({
1449
+ name: "ElButtonGroup"
1450
+ });
1451
+ const _sfc_main = /* @__PURE__ */ defineComponent({
1452
+ ...__default__,
1453
+ props: buttonGroupProps,
1454
+ setup(__props) {
1455
+ const props = __props;
1456
+ provide(buttonGroupContextKey, reactive({
1457
+ size: toRef(props, "size"),
1458
+ type: toRef(props, "type")
1459
+ }));
1460
+ const ns = useNamespace("button");
1461
+ return (_ctx, _cache) => {
1462
+ return openBlock(), createElementBlock("div", {
1463
+ class: normalizeClass([unref(ns).b("group"), unref(ns).bm("group", props.direction)])
1464
+ }, [
1465
+ renderSlot(_ctx.$slots, "default")
1466
+ ], 2);
1467
+ };
1468
+ }
1469
+ });
1470
+ var ButtonGroup = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "button-group.vue"]]);
1471
+
1472
+ const ElButton = withInstall(Button, {
1473
+ ButtonGroup
1474
+ });
1475
+ withNoopInstall(ButtonGroup);
1476
+
1477
+ export { ElButton as E, buttonTypes as b };