@youcan/celeste 0.6.29 → 0.6.31

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 (369) hide show
  1. package/dist/celeste.css +4244 -0
  2. package/dist/cjs/alert.js +111 -0
  3. package/dist/cjs/alpha-slider.js +3 -0
  4. package/dist/cjs/badge.js +55 -0
  5. package/dist/cjs/button.js +39 -0
  6. package/dist/cjs/checkbox-label.js +112 -0
  7. package/dist/cjs/checkbox.js +3 -0
  8. package/dist/cjs/chunks/_plugin-vue_export-helper.js +9 -0
  9. package/dist/cjs/chunks/alpha-slider.js +127 -0
  10. package/dist/cjs/chunks/checkbox.vue_vue_type_style_index_0_lang.js +38 -0
  11. package/dist/cjs/chunks/clsx.js +15 -0
  12. package/dist/cjs/chunks/combobox-anchor.js +31 -0
  13. package/dist/cjs/chunks/content-divider.vue_vue_type_style_index_0_lang.js +52 -0
  14. package/dist/cjs/chunks/dropdown-menu-content.vue_vue_type_style_index_0_lang.js +51 -0
  15. package/dist/cjs/chunks/dropdown-menu-sub-content.vue_vue_type_style_index_0_lang.js +49 -0
  16. package/dist/cjs/chunks/dropdown-menu-sub-trigger.vue_vue_type_style_index_0_lang.js +32 -0
  17. package/dist/cjs/chunks/dropdown-menu-sub.js +25 -0
  18. package/dist/cjs/chunks/index.js +9300 -0
  19. package/dist/cjs/chunks/index2.js +1457 -0
  20. package/dist/cjs/chunks/index3.js +16457 -0
  21. package/dist/cjs/chunks/modal-close.js +22 -0
  22. package/dist/cjs/chunks/modal-trigger.js +22 -0
  23. package/dist/cjs/chunks/modal.js +26 -0
  24. package/dist/cjs/chunks/popover.js +26 -0
  25. package/dist/cjs/chunks/scroll-area.js +41 -0
  26. package/dist/cjs/chunks/select-group.js +22 -0
  27. package/dist/cjs/chunks/select.js +38 -0
  28. package/dist/cjs/chunks/slider.vue_vue_type_style_index_0_lang.js +52 -0
  29. package/dist/cjs/chunks/sonner.js +1153 -0
  30. package/dist/cjs/chunks/switch.vue_vue_type_style_index_0_lang.js +38 -0
  31. package/dist/cjs/chunks/use-color-model.js +992 -0
  32. package/dist/cjs/color-area.js +175 -0
  33. package/dist/cjs/color-picker.js +514 -0
  34. package/dist/cjs/color-swatch.js +59 -0
  35. package/dist/cjs/color.js +102 -0
  36. package/dist/cjs/combobox-anchor.js +3 -0
  37. package/dist/cjs/combobox-empty.js +32 -0
  38. package/dist/cjs/combobox-group.js +42 -0
  39. package/dist/cjs/combobox-input.js +63 -0
  40. package/dist/cjs/combobox-item.js +109 -0
  41. package/dist/cjs/combobox-list.js +62 -0
  42. package/dist/cjs/combobox-root.js +40 -0
  43. package/dist/cjs/combobox-separator.js +32 -0
  44. package/dist/cjs/combobox-trigger.js +47 -0
  45. package/dist/cjs/combobox.js +233 -0
  46. package/dist/cjs/command-group.js +41 -0
  47. package/dist/cjs/command-input.js +42 -0
  48. package/dist/cjs/command-item.js +34 -0
  49. package/dist/cjs/command-list.js +52 -0
  50. package/dist/cjs/command-root.js +45 -0
  51. package/dist/cjs/command-separator.js +32 -0
  52. package/dist/cjs/compact-button.js +42 -0
  53. package/dist/cjs/config.js +136 -0
  54. package/dist/cjs/content-divider.js +3 -0
  55. package/dist/cjs/context-menu-item.js +134 -0
  56. package/dist/cjs/crypto.js +8 -0
  57. package/dist/cjs/dropdown-item.js +99 -0
  58. package/dist/cjs/dropdown-menu-content.js +3 -0
  59. package/dist/cjs/dropdown-menu-group.js +24 -0
  60. package/dist/cjs/dropdown-menu-item.js +68 -0
  61. package/dist/cjs/dropdown-menu-label.js +31 -0
  62. package/dist/cjs/dropdown-menu-separator.js +25 -0
  63. package/dist/cjs/dropdown-menu-sub-content.js +3 -0
  64. package/dist/cjs/dropdown-menu-sub-trigger.js +3 -0
  65. package/dist/cjs/dropdown-menu-sub.js +3 -0
  66. package/dist/cjs/dropdown-menu-trigger.js +26 -0
  67. package/dist/cjs/dropdown-menu.js +32 -0
  68. package/dist/cjs/dropdown.js +291 -0
  69. package/dist/cjs/extra-settings.js +155 -0
  70. package/dist/cjs/fancy-button.js +38 -0
  71. package/dist/cjs/hint-text.js +36 -0
  72. package/dist/cjs/hue-slider.js +133 -0
  73. package/dist/cjs/index.js +229 -0
  74. package/dist/cjs/label.js +55 -0
  75. package/dist/cjs/link-bubble.js +228 -0
  76. package/dist/cjs/link-button.js +44 -0
  77. package/dist/cjs/modal-body.js +22 -0
  78. package/dist/cjs/modal-close.js +3 -0
  79. package/dist/cjs/modal-content.js +48 -0
  80. package/dist/cjs/modal-footer.js +22 -0
  81. package/dist/cjs/modal-header.js +81 -0
  82. package/dist/cjs/modal-trigger.js +3 -0
  83. package/dist/cjs/modal.js +3 -0
  84. package/dist/cjs/popover-content.js +104 -0
  85. package/dist/cjs/popover-trigger.js +24 -0
  86. package/dist/cjs/popover.js +3 -0
  87. package/dist/cjs/rich-editor.js +4996 -0
  88. package/dist/cjs/scroll-area.js +3 -0
  89. package/dist/cjs/scroll-bar.js +39 -0
  90. package/dist/cjs/segmented-control-item.js +41 -0
  91. package/dist/cjs/segmented-control.js +40 -0
  92. package/dist/cjs/select-content.js +61 -0
  93. package/dist/cjs/select-group.js +3 -0
  94. package/dist/cjs/select-icon.js +25 -0
  95. package/dist/cjs/select-item.js +44 -0
  96. package/dist/cjs/select-label.js +32 -0
  97. package/dist/cjs/select-separator.js +26 -0
  98. package/dist/cjs/select-trigger.js +40 -0
  99. package/dist/cjs/select-value.js +31 -0
  100. package/dist/cjs/select.js +3 -0
  101. package/dist/cjs/shims.js +1 -0
  102. package/dist/cjs/slider.js +3 -0
  103. package/dist/cjs/social-button.js +45 -0
  104. package/dist/cjs/sonner-alert.js +41 -0
  105. package/dist/cjs/sonner.js +3 -0
  106. package/dist/cjs/status-badge.js +49 -0
  107. package/dist/cjs/switch.js +3 -0
  108. package/dist/cjs/tab-menu-content.js +32 -0
  109. package/dist/cjs/tab-menu-item.js +44 -0
  110. package/dist/cjs/tab-menu-list.js +34 -0
  111. package/dist/cjs/tab-menu.js +32 -0
  112. package/dist/cjs/text-input-affix.js +27 -0
  113. package/dist/cjs/text-input-button.js +31 -0
  114. package/dist/cjs/text-input.js +119 -0
  115. package/dist/cjs/textarea.js +56 -0
  116. package/dist/cjs/tooltip.js +115 -0
  117. package/dist/cjs/types.js +1 -0
  118. package/dist/cjs/use-color-model.js +6 -0
  119. package/dist/cjs/use-delegated-props.js +14 -0
  120. package/dist/cjs/use-user-select.js +39 -0
  121. package/dist/components/alert/alert.d.ts +30 -0
  122. package/dist/components/alert/index.d.ts +2 -0
  123. package/dist/components/badge/badge.d.ts +17 -0
  124. package/dist/components/badge/index.d.ts +4 -0
  125. package/dist/components/badge/status-badge.d.ts +13 -0
  126. package/dist/components/button/button.d.ts +22 -0
  127. package/dist/components/button/compact-button.d.ts +15 -0
  128. package/dist/components/button/fancy-button.d.ts +20 -0
  129. package/dist/components/button/index.d.ts +10 -0
  130. package/dist/components/button/link-button.d.ts +22 -0
  131. package/dist/components/button/social-button.d.ts +10 -0
  132. package/dist/components/checkbox/checkbox-label.d.ts +32 -0
  133. package/dist/components/checkbox/checkbox.d.ts +11 -0
  134. package/dist/components/checkbox/index.d.ts +4 -0
  135. package/dist/components/color-picker/alpha-slider.d.ts +15 -0
  136. package/dist/components/color-picker/color-area.d.ts +9 -0
  137. package/dist/components/color-picker/color-picker.d.ts +47 -0
  138. package/dist/components/color-picker/color-swatch.d.ts +19 -0
  139. package/dist/components/color-picker/composable/use-color-model.d.ts +7 -0
  140. package/dist/components/color-picker/composable/use-user-select.d.ts +8 -0
  141. package/dist/components/color-picker/hue-slider.d.ts +14 -0
  142. package/dist/components/color-picker/index.d.ts +10 -0
  143. package/dist/components/combobox/combobox-anchor.d.ts +22 -0
  144. package/dist/components/combobox/combobox-empty.d.ts +22 -0
  145. package/dist/components/combobox/combobox-group.d.ts +23 -0
  146. package/dist/components/combobox/combobox-input.d.ts +17 -0
  147. package/dist/components/combobox/combobox-item.d.ts +31 -0
  148. package/dist/components/combobox/combobox-list.d.ts +36 -0
  149. package/dist/components/combobox/combobox-root.d.ts +29 -0
  150. package/dist/components/combobox/combobox-separator.d.ts +22 -0
  151. package/dist/components/combobox/combobox-trigger.d.ts +20 -0
  152. package/dist/components/combobox/combobox.d.ts +42 -0
  153. package/dist/components/combobox/index.d.ts +20 -0
  154. package/dist/components/content-divider/content-divider.d.ts +10 -0
  155. package/dist/components/content-divider/index.d.ts +2 -0
  156. package/dist/components/dropdown/context-menu-item.d.ts +39 -0
  157. package/dist/components/dropdown/dropdown-item.d.ts +30 -0
  158. package/dist/components/dropdown/dropdown.d.ts +55 -0
  159. package/dist/components/dropdown/index.d.ts +6 -0
  160. package/dist/components/dropdown-menu/dropdown-menu-content.d.ts +36 -0
  161. package/dist/components/dropdown-menu/dropdown-menu-group.d.ts +18 -0
  162. package/dist/components/dropdown-menu/dropdown-menu-item.d.ts +26 -0
  163. package/dist/components/dropdown-menu/dropdown-menu-label.d.ts +22 -0
  164. package/dist/components/dropdown-menu/dropdown-menu-separator.d.ts +7 -0
  165. package/dist/components/dropdown-menu/dropdown-menu-sub-content.d.ts +38 -0
  166. package/dist/components/dropdown-menu/dropdown-menu-sub-trigger.d.ts +22 -0
  167. package/dist/components/dropdown-menu/dropdown-menu-sub.d.ts +22 -0
  168. package/dist/components/dropdown-menu/dropdown-menu-trigger.d.ts +18 -0
  169. package/dist/components/dropdown-menu/dropdown-menu.d.ts +18 -0
  170. package/dist/components/dropdown-menu/index.d.ts +20 -0
  171. package/dist/components/hint-text/hint-text.d.ts +11 -0
  172. package/dist/components/hint-text/index.d.ts +2 -0
  173. package/dist/components/index.d.ts +23 -0
  174. package/dist/components/label/index.d.ts +2 -0
  175. package/dist/components/label/label.d.ts +29 -0
  176. package/dist/components/modal/index.d.ts +14 -0
  177. package/dist/components/modal/modal-body.d.ts +21 -0
  178. package/dist/components/modal/modal-close.d.ts +18 -0
  179. package/dist/components/modal/modal-content.d.ts +37 -0
  180. package/dist/components/modal/modal-footer.d.ts +21 -0
  181. package/dist/components/modal/modal-header.d.ts +16 -0
  182. package/dist/components/modal/modal-trigger.d.ts +18 -0
  183. package/dist/components/modal/modal.d.ts +22 -0
  184. package/dist/components/popover/index.d.ts +6 -0
  185. package/dist/components/popover/popover-content.d.ts +41 -0
  186. package/dist/components/popover/popover-trigger.d.ts +18 -0
  187. package/dist/components/popover/popover.d.ts +22 -0
  188. package/dist/components/rich-editor/config.d.ts +33 -0
  189. package/dist/components/rich-editor/extra-settings.d.ts +6 -0
  190. package/dist/components/rich-editor/index.d.ts +2 -0
  191. package/dist/components/rich-editor/link-bubble.d.ts +11 -0
  192. package/dist/components/rich-editor/rich-editor.d.ts +55 -0
  193. package/dist/components/rich-editor/types.d.ts +19 -0
  194. package/dist/components/scroll-area/index.d.ts +2 -0
  195. package/dist/components/scroll-area/scroll-area.d.ts +22 -0
  196. package/dist/components/scroll-area/scroll-bar.d.ts +9 -0
  197. package/dist/components/segmented-control/index.d.ts +4 -0
  198. package/dist/components/segmented-control/segmented-control-item.d.ts +22 -0
  199. package/dist/components/segmented-control/segmented-control.d.ts +26 -0
  200. package/dist/components/select/index.d.ts +18 -0
  201. package/dist/components/select/select-content.d.ts +33 -0
  202. package/dist/components/select/select-group.d.ts +18 -0
  203. package/dist/components/select/select-icon.d.ts +21 -0
  204. package/dist/components/select/select-item.d.ts +22 -0
  205. package/dist/components/select/select-label.d.ts +22 -0
  206. package/dist/components/select/select-separator.d.ts +7 -0
  207. package/dist/components/select/select-trigger.d.ts +28 -0
  208. package/dist/components/select/select-value.d.ts +22 -0
  209. package/dist/components/select/select.d.ts +28 -0
  210. package/dist/components/slider/index.d.ts +2 -0
  211. package/dist/components/slider/slider.d.ts +13 -0
  212. package/dist/components/sonner/index.d.ts +4 -0
  213. package/dist/components/sonner/sonner-alert.d.ts +13 -0
  214. package/dist/components/sonner/sonner.d.ts +5 -0
  215. package/dist/components/switch/index.d.ts +2 -0
  216. package/dist/components/switch/switch.d.ts +11 -0
  217. package/dist/components/tab-menu/index.d.ts +8 -0
  218. package/dist/components/tab-menu/tab-menu-content.d.ts +22 -0
  219. package/dist/components/tab-menu/tab-menu-item.d.ts +24 -0
  220. package/dist/components/tab-menu/tab-menu-list.d.ts +22 -0
  221. package/dist/components/tab-menu/tab-menu.d.ts +23 -0
  222. package/dist/components/text-input/index.d.ts +6 -0
  223. package/dist/components/text-input/text-input-affix.d.ts +23 -0
  224. package/dist/components/text-input/text-input-button.d.ts +23 -0
  225. package/dist/components/text-input/text-input.d.ts +32 -0
  226. package/dist/components/textarea/index.d.ts +2 -0
  227. package/dist/components/textarea/textarea.d.ts +22 -0
  228. package/dist/components/tooltip/index.d.ts +2 -0
  229. package/dist/components/tooltip/tooltip.d.ts +29 -0
  230. package/dist/composables/use-delegated-props.d.ts +2 -0
  231. package/dist/es/alert.js +112 -0
  232. package/dist/es/alpha-slider.js +4 -0
  233. package/dist/es/badge.js +56 -0
  234. package/dist/es/button.js +40 -0
  235. package/dist/es/checkbox-label.js +113 -0
  236. package/dist/es/checkbox.js +4 -0
  237. package/dist/es/chunks/_plugin-vue_export-helper.js +10 -0
  238. package/dist/es/chunks/alpha-slider.js +128 -0
  239. package/dist/es/chunks/checkbox.vue_vue_type_style_index_0_lang.js +39 -0
  240. package/dist/es/chunks/clsx.js +16 -0
  241. package/dist/es/chunks/combobox-anchor.js +32 -0
  242. package/dist/es/chunks/content-divider.vue_vue_type_style_index_0_lang.js +53 -0
  243. package/dist/es/chunks/dropdown-menu-content.vue_vue_type_style_index_0_lang.js +52 -0
  244. package/dist/es/chunks/dropdown-menu-sub-content.vue_vue_type_style_index_0_lang.js +50 -0
  245. package/dist/es/chunks/dropdown-menu-sub-trigger.vue_vue_type_style_index_0_lang.js +33 -0
  246. package/dist/es/chunks/dropdown-menu-sub.js +26 -0
  247. package/dist/es/chunks/index.js +9285 -0
  248. package/dist/es/chunks/index2.js +1457 -0
  249. package/dist/es/chunks/index3.js +16458 -0
  250. package/dist/es/chunks/modal-close.js +23 -0
  251. package/dist/es/chunks/modal-trigger.js +23 -0
  252. package/dist/es/chunks/modal.js +27 -0
  253. package/dist/es/chunks/popover.js +27 -0
  254. package/dist/es/chunks/scroll-area.js +42 -0
  255. package/dist/es/chunks/select-group.js +23 -0
  256. package/dist/es/chunks/select.js +39 -0
  257. package/dist/es/chunks/slider.vue_vue_type_style_index_0_lang.js +53 -0
  258. package/dist/es/chunks/sonner.js +1154 -0
  259. package/dist/es/chunks/switch.vue_vue_type_style_index_0_lang.js +39 -0
  260. package/dist/es/chunks/use-color-model.js +993 -0
  261. package/dist/es/color-area.js +176 -0
  262. package/dist/es/color-picker.js +515 -0
  263. package/dist/es/color-swatch.js +60 -0
  264. package/dist/es/color.js +102 -0
  265. package/dist/es/combobox-anchor.js +4 -0
  266. package/dist/es/combobox-empty.js +33 -0
  267. package/dist/es/combobox-group.js +43 -0
  268. package/dist/es/combobox-input.js +64 -0
  269. package/dist/es/combobox-item.js +110 -0
  270. package/dist/es/combobox-list.js +63 -0
  271. package/dist/es/combobox-root.js +41 -0
  272. package/dist/es/combobox-separator.js +33 -0
  273. package/dist/es/combobox-trigger.js +48 -0
  274. package/dist/es/combobox.js +234 -0
  275. package/dist/es/command-group.js +42 -0
  276. package/dist/es/command-input.js +43 -0
  277. package/dist/es/command-item.js +35 -0
  278. package/dist/es/command-list.js +53 -0
  279. package/dist/es/command-root.js +46 -0
  280. package/dist/es/command-separator.js +33 -0
  281. package/dist/es/compact-button.js +43 -0
  282. package/dist/es/config.js +136 -0
  283. package/dist/es/content-divider.js +4 -0
  284. package/dist/es/context-menu-item.js +135 -0
  285. package/dist/es/crypto.js +8 -0
  286. package/dist/es/dropdown-item.js +100 -0
  287. package/dist/es/dropdown-menu-content.js +4 -0
  288. package/dist/es/dropdown-menu-group.js +25 -0
  289. package/dist/es/dropdown-menu-item.js +69 -0
  290. package/dist/es/dropdown-menu-label.js +32 -0
  291. package/dist/es/dropdown-menu-separator.js +26 -0
  292. package/dist/es/dropdown-menu-sub-content.js +4 -0
  293. package/dist/es/dropdown-menu-sub-trigger.js +4 -0
  294. package/dist/es/dropdown-menu-sub.js +4 -0
  295. package/dist/es/dropdown-menu-trigger.js +27 -0
  296. package/dist/es/dropdown-menu.js +33 -0
  297. package/dist/es/dropdown.js +292 -0
  298. package/dist/es/extra-settings.js +156 -0
  299. package/dist/es/fancy-button.js +39 -0
  300. package/dist/es/hint-text.js +37 -0
  301. package/dist/es/hue-slider.js +134 -0
  302. package/dist/es/index.js +229 -0
  303. package/dist/es/label.js +56 -0
  304. package/dist/es/link-bubble.js +229 -0
  305. package/dist/es/link-button.js +45 -0
  306. package/dist/es/modal-body.js +23 -0
  307. package/dist/es/modal-close.js +4 -0
  308. package/dist/es/modal-content.js +49 -0
  309. package/dist/es/modal-footer.js +23 -0
  310. package/dist/es/modal-header.js +82 -0
  311. package/dist/es/modal-trigger.js +4 -0
  312. package/dist/es/modal.js +4 -0
  313. package/dist/es/popover-content.js +105 -0
  314. package/dist/es/popover-trigger.js +25 -0
  315. package/dist/es/popover.js +4 -0
  316. package/dist/es/rich-editor.js +4997 -0
  317. package/dist/es/scroll-area.js +4 -0
  318. package/dist/es/scroll-bar.js +40 -0
  319. package/dist/es/segmented-control-item.js +42 -0
  320. package/dist/es/segmented-control.js +41 -0
  321. package/dist/es/select-content.js +62 -0
  322. package/dist/es/select-group.js +4 -0
  323. package/dist/es/select-icon.js +26 -0
  324. package/dist/es/select-item.js +45 -0
  325. package/dist/es/select-label.js +33 -0
  326. package/dist/es/select-separator.js +27 -0
  327. package/dist/es/select-trigger.js +41 -0
  328. package/dist/es/select-value.js +32 -0
  329. package/dist/es/select.js +4 -0
  330. package/dist/es/shims.js +1 -0
  331. package/dist/es/slider.js +4 -0
  332. package/dist/es/social-button.js +46 -0
  333. package/dist/es/sonner-alert.js +42 -0
  334. package/dist/es/sonner.js +4 -0
  335. package/dist/es/status-badge.js +50 -0
  336. package/dist/es/switch.js +4 -0
  337. package/dist/es/tab-menu-content.js +33 -0
  338. package/dist/es/tab-menu-item.js +45 -0
  339. package/dist/es/tab-menu-list.js +35 -0
  340. package/dist/es/tab-menu.js +33 -0
  341. package/dist/es/text-input-affix.js +28 -0
  342. package/dist/es/text-input-button.js +32 -0
  343. package/dist/es/text-input.js +120 -0
  344. package/dist/es/textarea.js +57 -0
  345. package/dist/es/tooltip.js +116 -0
  346. package/dist/es/types.js +1 -0
  347. package/dist/es/use-color-model.js +6 -0
  348. package/dist/es/use-delegated-props.js +14 -0
  349. package/dist/es/use-user-select.js +39 -0
  350. package/dist/index.d.ts +5 -0
  351. package/dist/utils/color.d.ts +26 -0
  352. package/dist/utils/crypto.d.ts +1 -0
  353. package/dist/utils/index.d.ts +3 -0
  354. package/dist/utils/sonner.d.ts +19 -0
  355. package/package.json +15 -4
  356. package/src/components/index.ts +2 -0
  357. package/src/components/rich-editor/config.ts +150 -0
  358. package/src/components/rich-editor/extra-settings.vue +151 -0
  359. package/src/components/rich-editor/index.ts +2 -0
  360. package/src/components/rich-editor/link-bubble.vue +288 -0
  361. package/src/components/rich-editor/rich-editor.vue +428 -0
  362. package/src/components/rich-editor/stories/rich-editor.stories.ts +87 -0
  363. package/src/components/rich-editor/types.ts +21 -0
  364. package/src/components/sonner/index.ts +5 -0
  365. package/src/components/sonner/sonner-alert.vue +54 -0
  366. package/src/components/sonner/sonner.vue +13 -0
  367. package/src/components/sonner/stories/sonner.stories.ts +194 -0
  368. package/src/utils/index.ts +3 -0
  369. package/src/utils/sonner.ts +72 -0
@@ -0,0 +1,992 @@
1
+ "use strict";
2
+ const Mo = require("vue");
3
+ function _typeof(obj) {
4
+ "@babel/helpers - typeof";
5
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(obj2) {
6
+ return typeof obj2;
7
+ } : function(obj2) {
8
+ return obj2 && "function" == typeof Symbol && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2;
9
+ }, _typeof(obj);
10
+ }
11
+ var trimLeft = /^\s+/;
12
+ var trimRight = /\s+$/;
13
+ function tinycolor(color, opts) {
14
+ color = color ? color : "";
15
+ opts = opts || {};
16
+ if (color instanceof tinycolor) {
17
+ return color;
18
+ }
19
+ if (!(this instanceof tinycolor)) {
20
+ return new tinycolor(color, opts);
21
+ }
22
+ var rgb = inputToRGB(color);
23
+ this._originalInput = color, this._r = rgb.r, this._g = rgb.g, this._b = rgb.b, this._a = rgb.a, this._roundA = Math.round(100 * this._a) / 100, this._format = opts.format || rgb.format;
24
+ this._gradientType = opts.gradientType;
25
+ if (this._r < 1) this._r = Math.round(this._r);
26
+ if (this._g < 1) this._g = Math.round(this._g);
27
+ if (this._b < 1) this._b = Math.round(this._b);
28
+ this._ok = rgb.ok;
29
+ }
30
+ tinycolor.prototype = {
31
+ isDark: function isDark() {
32
+ return this.getBrightness() < 128;
33
+ },
34
+ isLight: function isLight() {
35
+ return !this.isDark();
36
+ },
37
+ isValid: function isValid() {
38
+ return this._ok;
39
+ },
40
+ getOriginalInput: function getOriginalInput() {
41
+ return this._originalInput;
42
+ },
43
+ getFormat: function getFormat() {
44
+ return this._format;
45
+ },
46
+ getAlpha: function getAlpha() {
47
+ return this._a;
48
+ },
49
+ getBrightness: function getBrightness() {
50
+ var rgb = this.toRgb();
51
+ return (rgb.r * 299 + rgb.g * 587 + rgb.b * 114) / 1e3;
52
+ },
53
+ getLuminance: function getLuminance() {
54
+ var rgb = this.toRgb();
55
+ var RsRGB, GsRGB, BsRGB, R, G, B;
56
+ RsRGB = rgb.r / 255;
57
+ GsRGB = rgb.g / 255;
58
+ BsRGB = rgb.b / 255;
59
+ if (RsRGB <= 0.03928) R = RsRGB / 12.92;
60
+ else R = Math.pow((RsRGB + 0.055) / 1.055, 2.4);
61
+ if (GsRGB <= 0.03928) G = GsRGB / 12.92;
62
+ else G = Math.pow((GsRGB + 0.055) / 1.055, 2.4);
63
+ if (BsRGB <= 0.03928) B = BsRGB / 12.92;
64
+ else B = Math.pow((BsRGB + 0.055) / 1.055, 2.4);
65
+ return 0.2126 * R + 0.7152 * G + 0.0722 * B;
66
+ },
67
+ setAlpha: function setAlpha(value) {
68
+ this._a = boundAlpha(value);
69
+ this._roundA = Math.round(100 * this._a) / 100;
70
+ return this;
71
+ },
72
+ toHsv: function toHsv() {
73
+ var hsv = rgbToHsv(this._r, this._g, this._b);
74
+ return {
75
+ h: hsv.h * 360,
76
+ s: hsv.s,
77
+ v: hsv.v,
78
+ a: this._a
79
+ };
80
+ },
81
+ toHsvString: function toHsvString() {
82
+ var hsv = rgbToHsv(this._r, this._g, this._b);
83
+ var h = Math.round(hsv.h * 360), s = Math.round(hsv.s * 100), v = Math.round(hsv.v * 100);
84
+ return this._a == 1 ? "hsv(" + h + ", " + s + "%, " + v + "%)" : "hsva(" + h + ", " + s + "%, " + v + "%, " + this._roundA + ")";
85
+ },
86
+ toHsl: function toHsl() {
87
+ var hsl = rgbToHsl(this._r, this._g, this._b);
88
+ return {
89
+ h: hsl.h * 360,
90
+ s: hsl.s,
91
+ l: hsl.l,
92
+ a: this._a
93
+ };
94
+ },
95
+ toHslString: function toHslString() {
96
+ var hsl = rgbToHsl(this._r, this._g, this._b);
97
+ var h = Math.round(hsl.h * 360), s = Math.round(hsl.s * 100), l = Math.round(hsl.l * 100);
98
+ return this._a == 1 ? "hsl(" + h + ", " + s + "%, " + l + "%)" : "hsla(" + h + ", " + s + "%, " + l + "%, " + this._roundA + ")";
99
+ },
100
+ toHex: function toHex(allow3Char) {
101
+ return rgbToHex(this._r, this._g, this._b, allow3Char);
102
+ },
103
+ toHexString: function toHexString(allow3Char) {
104
+ return "#" + this.toHex(allow3Char);
105
+ },
106
+ toHex8: function toHex8(allow4Char) {
107
+ return rgbaToHex(this._r, this._g, this._b, this._a, allow4Char);
108
+ },
109
+ toHex8String: function toHex8String(allow4Char) {
110
+ return "#" + this.toHex8(allow4Char);
111
+ },
112
+ toRgb: function toRgb() {
113
+ return {
114
+ r: Math.round(this._r),
115
+ g: Math.round(this._g),
116
+ b: Math.round(this._b),
117
+ a: this._a
118
+ };
119
+ },
120
+ toRgbString: function toRgbString() {
121
+ return this._a == 1 ? "rgb(" + Math.round(this._r) + ", " + Math.round(this._g) + ", " + Math.round(this._b) + ")" : "rgba(" + Math.round(this._r) + ", " + Math.round(this._g) + ", " + Math.round(this._b) + ", " + this._roundA + ")";
122
+ },
123
+ toPercentageRgb: function toPercentageRgb() {
124
+ return {
125
+ r: Math.round(bound01(this._r, 255) * 100) + "%",
126
+ g: Math.round(bound01(this._g, 255) * 100) + "%",
127
+ b: Math.round(bound01(this._b, 255) * 100) + "%",
128
+ a: this._a
129
+ };
130
+ },
131
+ toPercentageRgbString: function toPercentageRgbString() {
132
+ return this._a == 1 ? "rgb(" + Math.round(bound01(this._r, 255) * 100) + "%, " + Math.round(bound01(this._g, 255) * 100) + "%, " + Math.round(bound01(this._b, 255) * 100) + "%)" : "rgba(" + Math.round(bound01(this._r, 255) * 100) + "%, " + Math.round(bound01(this._g, 255) * 100) + "%, " + Math.round(bound01(this._b, 255) * 100) + "%, " + this._roundA + ")";
133
+ },
134
+ toName: function toName() {
135
+ if (this._a === 0) {
136
+ return "transparent";
137
+ }
138
+ if (this._a < 1) {
139
+ return false;
140
+ }
141
+ return hexNames[rgbToHex(this._r, this._g, this._b, true)] || false;
142
+ },
143
+ toFilter: function toFilter(secondColor) {
144
+ var hex8String = "#" + rgbaToArgbHex(this._r, this._g, this._b, this._a);
145
+ var secondHex8String = hex8String;
146
+ var gradientType = this._gradientType ? "GradientType = 1, " : "";
147
+ if (secondColor) {
148
+ var s = tinycolor(secondColor);
149
+ secondHex8String = "#" + rgbaToArgbHex(s._r, s._g, s._b, s._a);
150
+ }
151
+ return "progid:DXImageTransform.Microsoft.gradient(" + gradientType + "startColorstr=" + hex8String + ",endColorstr=" + secondHex8String + ")";
152
+ },
153
+ toString: function toString(format) {
154
+ var formatSet = !!format;
155
+ format = format || this._format;
156
+ var formattedString = false;
157
+ var hasAlpha = this._a < 1 && this._a >= 0;
158
+ var needsAlphaFormat = !formatSet && hasAlpha && (format === "hex" || format === "hex6" || format === "hex3" || format === "hex4" || format === "hex8" || format === "name");
159
+ if (needsAlphaFormat) {
160
+ if (format === "name" && this._a === 0) {
161
+ return this.toName();
162
+ }
163
+ return this.toRgbString();
164
+ }
165
+ if (format === "rgb") {
166
+ formattedString = this.toRgbString();
167
+ }
168
+ if (format === "prgb") {
169
+ formattedString = this.toPercentageRgbString();
170
+ }
171
+ if (format === "hex" || format === "hex6") {
172
+ formattedString = this.toHexString();
173
+ }
174
+ if (format === "hex3") {
175
+ formattedString = this.toHexString(true);
176
+ }
177
+ if (format === "hex4") {
178
+ formattedString = this.toHex8String(true);
179
+ }
180
+ if (format === "hex8") {
181
+ formattedString = this.toHex8String();
182
+ }
183
+ if (format === "name") {
184
+ formattedString = this.toName();
185
+ }
186
+ if (format === "hsl") {
187
+ formattedString = this.toHslString();
188
+ }
189
+ if (format === "hsv") {
190
+ formattedString = this.toHsvString();
191
+ }
192
+ return formattedString || this.toHexString();
193
+ },
194
+ clone: function clone() {
195
+ return tinycolor(this.toString());
196
+ },
197
+ _applyModification: function _applyModification(fn, args) {
198
+ var color = fn.apply(null, [this].concat([].slice.call(args)));
199
+ this._r = color._r;
200
+ this._g = color._g;
201
+ this._b = color._b;
202
+ this.setAlpha(color._a);
203
+ return this;
204
+ },
205
+ lighten: function lighten() {
206
+ return this._applyModification(_lighten, arguments);
207
+ },
208
+ brighten: function brighten() {
209
+ return this._applyModification(_brighten, arguments);
210
+ },
211
+ darken: function darken() {
212
+ return this._applyModification(_darken, arguments);
213
+ },
214
+ desaturate: function desaturate() {
215
+ return this._applyModification(_desaturate, arguments);
216
+ },
217
+ saturate: function saturate() {
218
+ return this._applyModification(_saturate, arguments);
219
+ },
220
+ greyscale: function greyscale() {
221
+ return this._applyModification(_greyscale, arguments);
222
+ },
223
+ spin: function spin() {
224
+ return this._applyModification(_spin, arguments);
225
+ },
226
+ _applyCombination: function _applyCombination(fn, args) {
227
+ return fn.apply(null, [this].concat([].slice.call(args)));
228
+ },
229
+ analogous: function analogous() {
230
+ return this._applyCombination(_analogous, arguments);
231
+ },
232
+ complement: function complement() {
233
+ return this._applyCombination(_complement, arguments);
234
+ },
235
+ monochromatic: function monochromatic() {
236
+ return this._applyCombination(_monochromatic, arguments);
237
+ },
238
+ splitcomplement: function splitcomplement() {
239
+ return this._applyCombination(_splitcomplement, arguments);
240
+ },
241
+ // Disabled until https://github.com/bgrins/TinyColor/issues/254
242
+ // polyad: function (number) {
243
+ // return this._applyCombination(polyad, [number]);
244
+ // },
245
+ triad: function triad() {
246
+ return this._applyCombination(polyad, [3]);
247
+ },
248
+ tetrad: function tetrad() {
249
+ return this._applyCombination(polyad, [4]);
250
+ }
251
+ };
252
+ tinycolor.fromRatio = function(color, opts) {
253
+ if (_typeof(color) == "object") {
254
+ var newColor = {};
255
+ for (var i in color) {
256
+ if (color.hasOwnProperty(i)) {
257
+ if (i === "a") {
258
+ newColor[i] = color[i];
259
+ } else {
260
+ newColor[i] = convertToPercentage(color[i]);
261
+ }
262
+ }
263
+ }
264
+ color = newColor;
265
+ }
266
+ return tinycolor(color, opts);
267
+ };
268
+ function inputToRGB(color) {
269
+ var rgb = {
270
+ r: 0,
271
+ g: 0,
272
+ b: 0
273
+ };
274
+ var a = 1;
275
+ var s = null;
276
+ var v = null;
277
+ var l = null;
278
+ var ok = false;
279
+ var format = false;
280
+ if (typeof color == "string") {
281
+ color = stringInputToObject(color);
282
+ }
283
+ if (_typeof(color) == "object") {
284
+ if (isValidCSSUnit(color.r) && isValidCSSUnit(color.g) && isValidCSSUnit(color.b)) {
285
+ rgb = rgbToRgb(color.r, color.g, color.b);
286
+ ok = true;
287
+ format = String(color.r).substr(-1) === "%" ? "prgb" : "rgb";
288
+ } else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.v)) {
289
+ s = convertToPercentage(color.s);
290
+ v = convertToPercentage(color.v);
291
+ rgb = hsvToRgb(color.h, s, v);
292
+ ok = true;
293
+ format = "hsv";
294
+ } else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.l)) {
295
+ s = convertToPercentage(color.s);
296
+ l = convertToPercentage(color.l);
297
+ rgb = hslToRgb(color.h, s, l);
298
+ ok = true;
299
+ format = "hsl";
300
+ }
301
+ if (color.hasOwnProperty("a")) {
302
+ a = color.a;
303
+ }
304
+ }
305
+ a = boundAlpha(a);
306
+ return {
307
+ ok,
308
+ format: color.format || format,
309
+ r: Math.min(255, Math.max(rgb.r, 0)),
310
+ g: Math.min(255, Math.max(rgb.g, 0)),
311
+ b: Math.min(255, Math.max(rgb.b, 0)),
312
+ a
313
+ };
314
+ }
315
+ function rgbToRgb(r, g, b) {
316
+ return {
317
+ r: bound01(r, 255) * 255,
318
+ g: bound01(g, 255) * 255,
319
+ b: bound01(b, 255) * 255
320
+ };
321
+ }
322
+ function rgbToHsl(r, g, b) {
323
+ r = bound01(r, 255);
324
+ g = bound01(g, 255);
325
+ b = bound01(b, 255);
326
+ var max = Math.max(r, g, b), min = Math.min(r, g, b);
327
+ var h, s, l = (max + min) / 2;
328
+ if (max == min) {
329
+ h = s = 0;
330
+ } else {
331
+ var d = max - min;
332
+ s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
333
+ switch (max) {
334
+ case r:
335
+ h = (g - b) / d + (g < b ? 6 : 0);
336
+ break;
337
+ case g:
338
+ h = (b - r) / d + 2;
339
+ break;
340
+ case b:
341
+ h = (r - g) / d + 4;
342
+ break;
343
+ }
344
+ h /= 6;
345
+ }
346
+ return {
347
+ h,
348
+ s,
349
+ l
350
+ };
351
+ }
352
+ function hslToRgb(h, s, l) {
353
+ var r, g, b;
354
+ h = bound01(h, 360);
355
+ s = bound01(s, 100);
356
+ l = bound01(l, 100);
357
+ function hue2rgb(p2, q2, t) {
358
+ if (t < 0) t += 1;
359
+ if (t > 1) t -= 1;
360
+ if (t < 1 / 6) return p2 + (q2 - p2) * 6 * t;
361
+ if (t < 1 / 2) return q2;
362
+ if (t < 2 / 3) return p2 + (q2 - p2) * (2 / 3 - t) * 6;
363
+ return p2;
364
+ }
365
+ if (s === 0) {
366
+ r = g = b = l;
367
+ } else {
368
+ var q = l < 0.5 ? l * (1 + s) : l + s - l * s;
369
+ var p = 2 * l - q;
370
+ r = hue2rgb(p, q, h + 1 / 3);
371
+ g = hue2rgb(p, q, h);
372
+ b = hue2rgb(p, q, h - 1 / 3);
373
+ }
374
+ return {
375
+ r: r * 255,
376
+ g: g * 255,
377
+ b: b * 255
378
+ };
379
+ }
380
+ function rgbToHsv(r, g, b) {
381
+ r = bound01(r, 255);
382
+ g = bound01(g, 255);
383
+ b = bound01(b, 255);
384
+ var max = Math.max(r, g, b), min = Math.min(r, g, b);
385
+ var h, s, v = max;
386
+ var d = max - min;
387
+ s = max === 0 ? 0 : d / max;
388
+ if (max == min) {
389
+ h = 0;
390
+ } else {
391
+ switch (max) {
392
+ case r:
393
+ h = (g - b) / d + (g < b ? 6 : 0);
394
+ break;
395
+ case g:
396
+ h = (b - r) / d + 2;
397
+ break;
398
+ case b:
399
+ h = (r - g) / d + 4;
400
+ break;
401
+ }
402
+ h /= 6;
403
+ }
404
+ return {
405
+ h,
406
+ s,
407
+ v
408
+ };
409
+ }
410
+ function hsvToRgb(h, s, v) {
411
+ h = bound01(h, 360) * 6;
412
+ s = bound01(s, 100);
413
+ v = bound01(v, 100);
414
+ var i = Math.floor(h), f = h - i, p = v * (1 - s), q = v * (1 - f * s), t = v * (1 - (1 - f) * s), mod = i % 6, r = [v, q, p, p, t, v][mod], g = [t, v, v, q, p, p][mod], b = [p, p, t, v, v, q][mod];
415
+ return {
416
+ r: r * 255,
417
+ g: g * 255,
418
+ b: b * 255
419
+ };
420
+ }
421
+ function rgbToHex(r, g, b, allow3Char) {
422
+ var hex = [pad2(Math.round(r).toString(16)), pad2(Math.round(g).toString(16)), pad2(Math.round(b).toString(16))];
423
+ if (allow3Char && hex[0].charAt(0) == hex[0].charAt(1) && hex[1].charAt(0) == hex[1].charAt(1) && hex[2].charAt(0) == hex[2].charAt(1)) {
424
+ return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0);
425
+ }
426
+ return hex.join("");
427
+ }
428
+ function rgbaToHex(r, g, b, a, allow4Char) {
429
+ var hex = [pad2(Math.round(r).toString(16)), pad2(Math.round(g).toString(16)), pad2(Math.round(b).toString(16)), pad2(convertDecimalToHex(a))];
430
+ if (allow4Char && hex[0].charAt(0) == hex[0].charAt(1) && hex[1].charAt(0) == hex[1].charAt(1) && hex[2].charAt(0) == hex[2].charAt(1) && hex[3].charAt(0) == hex[3].charAt(1)) {
431
+ return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0) + hex[3].charAt(0);
432
+ }
433
+ return hex.join("");
434
+ }
435
+ function rgbaToArgbHex(r, g, b, a) {
436
+ var hex = [pad2(convertDecimalToHex(a)), pad2(Math.round(r).toString(16)), pad2(Math.round(g).toString(16)), pad2(Math.round(b).toString(16))];
437
+ return hex.join("");
438
+ }
439
+ tinycolor.equals = function(color1, color2) {
440
+ if (!color1 || !color2) return false;
441
+ return tinycolor(color1).toRgbString() == tinycolor(color2).toRgbString();
442
+ };
443
+ tinycolor.random = function() {
444
+ return tinycolor.fromRatio({
445
+ r: Math.random(),
446
+ g: Math.random(),
447
+ b: Math.random()
448
+ });
449
+ };
450
+ function _desaturate(color, amount) {
451
+ amount = amount === 0 ? 0 : amount || 10;
452
+ var hsl = tinycolor(color).toHsl();
453
+ hsl.s -= amount / 100;
454
+ hsl.s = clamp01(hsl.s);
455
+ return tinycolor(hsl);
456
+ }
457
+ function _saturate(color, amount) {
458
+ amount = amount === 0 ? 0 : amount || 10;
459
+ var hsl = tinycolor(color).toHsl();
460
+ hsl.s += amount / 100;
461
+ hsl.s = clamp01(hsl.s);
462
+ return tinycolor(hsl);
463
+ }
464
+ function _greyscale(color) {
465
+ return tinycolor(color).desaturate(100);
466
+ }
467
+ function _lighten(color, amount) {
468
+ amount = amount === 0 ? 0 : amount || 10;
469
+ var hsl = tinycolor(color).toHsl();
470
+ hsl.l += amount / 100;
471
+ hsl.l = clamp01(hsl.l);
472
+ return tinycolor(hsl);
473
+ }
474
+ function _brighten(color, amount) {
475
+ amount = amount === 0 ? 0 : amount || 10;
476
+ var rgb = tinycolor(color).toRgb();
477
+ rgb.r = Math.max(0, Math.min(255, rgb.r - Math.round(255 * -(amount / 100))));
478
+ rgb.g = Math.max(0, Math.min(255, rgb.g - Math.round(255 * -(amount / 100))));
479
+ rgb.b = Math.max(0, Math.min(255, rgb.b - Math.round(255 * -(amount / 100))));
480
+ return tinycolor(rgb);
481
+ }
482
+ function _darken(color, amount) {
483
+ amount = amount === 0 ? 0 : amount || 10;
484
+ var hsl = tinycolor(color).toHsl();
485
+ hsl.l -= amount / 100;
486
+ hsl.l = clamp01(hsl.l);
487
+ return tinycolor(hsl);
488
+ }
489
+ function _spin(color, amount) {
490
+ var hsl = tinycolor(color).toHsl();
491
+ var hue = (hsl.h + amount) % 360;
492
+ hsl.h = hue < 0 ? 360 + hue : hue;
493
+ return tinycolor(hsl);
494
+ }
495
+ function _complement(color) {
496
+ var hsl = tinycolor(color).toHsl();
497
+ hsl.h = (hsl.h + 180) % 360;
498
+ return tinycolor(hsl);
499
+ }
500
+ function polyad(color, number) {
501
+ if (isNaN(number) || number <= 0) {
502
+ throw new Error("Argument to polyad must be a positive number");
503
+ }
504
+ var hsl = tinycolor(color).toHsl();
505
+ var result = [tinycolor(color)];
506
+ var step = 360 / number;
507
+ for (var i = 1; i < number; i++) {
508
+ result.push(tinycolor({
509
+ h: (hsl.h + i * step) % 360,
510
+ s: hsl.s,
511
+ l: hsl.l
512
+ }));
513
+ }
514
+ return result;
515
+ }
516
+ function _splitcomplement(color) {
517
+ var hsl = tinycolor(color).toHsl();
518
+ var h = hsl.h;
519
+ return [tinycolor(color), tinycolor({
520
+ h: (h + 72) % 360,
521
+ s: hsl.s,
522
+ l: hsl.l
523
+ }), tinycolor({
524
+ h: (h + 216) % 360,
525
+ s: hsl.s,
526
+ l: hsl.l
527
+ })];
528
+ }
529
+ function _analogous(color, results, slices) {
530
+ results = results || 6;
531
+ slices = slices || 30;
532
+ var hsl = tinycolor(color).toHsl();
533
+ var part = 360 / slices;
534
+ var ret = [tinycolor(color)];
535
+ for (hsl.h = (hsl.h - (part * results >> 1) + 720) % 360; --results; ) {
536
+ hsl.h = (hsl.h + part) % 360;
537
+ ret.push(tinycolor(hsl));
538
+ }
539
+ return ret;
540
+ }
541
+ function _monochromatic(color, results) {
542
+ results = results || 6;
543
+ var hsv = tinycolor(color).toHsv();
544
+ var h = hsv.h, s = hsv.s, v = hsv.v;
545
+ var ret = [];
546
+ var modification = 1 / results;
547
+ while (results--) {
548
+ ret.push(tinycolor({
549
+ h,
550
+ s,
551
+ v
552
+ }));
553
+ v = (v + modification) % 1;
554
+ }
555
+ return ret;
556
+ }
557
+ tinycolor.mix = function(color1, color2, amount) {
558
+ amount = amount === 0 ? 0 : amount || 50;
559
+ var rgb1 = tinycolor(color1).toRgb();
560
+ var rgb2 = tinycolor(color2).toRgb();
561
+ var p = amount / 100;
562
+ var rgba = {
563
+ r: (rgb2.r - rgb1.r) * p + rgb1.r,
564
+ g: (rgb2.g - rgb1.g) * p + rgb1.g,
565
+ b: (rgb2.b - rgb1.b) * p + rgb1.b,
566
+ a: (rgb2.a - rgb1.a) * p + rgb1.a
567
+ };
568
+ return tinycolor(rgba);
569
+ };
570
+ tinycolor.readability = function(color1, color2) {
571
+ var c1 = tinycolor(color1);
572
+ var c2 = tinycolor(color2);
573
+ return (Math.max(c1.getLuminance(), c2.getLuminance()) + 0.05) / (Math.min(c1.getLuminance(), c2.getLuminance()) + 0.05);
574
+ };
575
+ tinycolor.isReadable = function(color1, color2, wcag2) {
576
+ var readability = tinycolor.readability(color1, color2);
577
+ var wcag2Parms, out;
578
+ out = false;
579
+ wcag2Parms = validateWCAG2Parms(wcag2);
580
+ switch (wcag2Parms.level + wcag2Parms.size) {
581
+ case "AAsmall":
582
+ case "AAAlarge":
583
+ out = readability >= 4.5;
584
+ break;
585
+ case "AAlarge":
586
+ out = readability >= 3;
587
+ break;
588
+ case "AAAsmall":
589
+ out = readability >= 7;
590
+ break;
591
+ }
592
+ return out;
593
+ };
594
+ tinycolor.mostReadable = function(baseColor, colorList, args) {
595
+ var bestColor = null;
596
+ var bestScore = 0;
597
+ var readability;
598
+ var includeFallbackColors, level, size;
599
+ args = args || {};
600
+ includeFallbackColors = args.includeFallbackColors;
601
+ level = args.level;
602
+ size = args.size;
603
+ for (var i = 0; i < colorList.length; i++) {
604
+ readability = tinycolor.readability(baseColor, colorList[i]);
605
+ if (readability > bestScore) {
606
+ bestScore = readability;
607
+ bestColor = tinycolor(colorList[i]);
608
+ }
609
+ }
610
+ if (tinycolor.isReadable(baseColor, bestColor, {
611
+ level,
612
+ size
613
+ }) || !includeFallbackColors) {
614
+ return bestColor;
615
+ } else {
616
+ args.includeFallbackColors = false;
617
+ return tinycolor.mostReadable(baseColor, ["#fff", "#000"], args);
618
+ }
619
+ };
620
+ var names = tinycolor.names = {
621
+ aliceblue: "f0f8ff",
622
+ antiquewhite: "faebd7",
623
+ aqua: "0ff",
624
+ aquamarine: "7fffd4",
625
+ azure: "f0ffff",
626
+ beige: "f5f5dc",
627
+ bisque: "ffe4c4",
628
+ black: "000",
629
+ blanchedalmond: "ffebcd",
630
+ blue: "00f",
631
+ blueviolet: "8a2be2",
632
+ brown: "a52a2a",
633
+ burlywood: "deb887",
634
+ burntsienna: "ea7e5d",
635
+ cadetblue: "5f9ea0",
636
+ chartreuse: "7fff00",
637
+ chocolate: "d2691e",
638
+ coral: "ff7f50",
639
+ cornflowerblue: "6495ed",
640
+ cornsilk: "fff8dc",
641
+ crimson: "dc143c",
642
+ cyan: "0ff",
643
+ darkblue: "00008b",
644
+ darkcyan: "008b8b",
645
+ darkgoldenrod: "b8860b",
646
+ darkgray: "a9a9a9",
647
+ darkgreen: "006400",
648
+ darkgrey: "a9a9a9",
649
+ darkkhaki: "bdb76b",
650
+ darkmagenta: "8b008b",
651
+ darkolivegreen: "556b2f",
652
+ darkorange: "ff8c00",
653
+ darkorchid: "9932cc",
654
+ darkred: "8b0000",
655
+ darksalmon: "e9967a",
656
+ darkseagreen: "8fbc8f",
657
+ darkslateblue: "483d8b",
658
+ darkslategray: "2f4f4f",
659
+ darkslategrey: "2f4f4f",
660
+ darkturquoise: "00ced1",
661
+ darkviolet: "9400d3",
662
+ deeppink: "ff1493",
663
+ deepskyblue: "00bfff",
664
+ dimgray: "696969",
665
+ dimgrey: "696969",
666
+ dodgerblue: "1e90ff",
667
+ firebrick: "b22222",
668
+ floralwhite: "fffaf0",
669
+ forestgreen: "228b22",
670
+ fuchsia: "f0f",
671
+ gainsboro: "dcdcdc",
672
+ ghostwhite: "f8f8ff",
673
+ gold: "ffd700",
674
+ goldenrod: "daa520",
675
+ gray: "808080",
676
+ green: "008000",
677
+ greenyellow: "adff2f",
678
+ grey: "808080",
679
+ honeydew: "f0fff0",
680
+ hotpink: "ff69b4",
681
+ indianred: "cd5c5c",
682
+ indigo: "4b0082",
683
+ ivory: "fffff0",
684
+ khaki: "f0e68c",
685
+ lavender: "e6e6fa",
686
+ lavenderblush: "fff0f5",
687
+ lawngreen: "7cfc00",
688
+ lemonchiffon: "fffacd",
689
+ lightblue: "add8e6",
690
+ lightcoral: "f08080",
691
+ lightcyan: "e0ffff",
692
+ lightgoldenrodyellow: "fafad2",
693
+ lightgray: "d3d3d3",
694
+ lightgreen: "90ee90",
695
+ lightgrey: "d3d3d3",
696
+ lightpink: "ffb6c1",
697
+ lightsalmon: "ffa07a",
698
+ lightseagreen: "20b2aa",
699
+ lightskyblue: "87cefa",
700
+ lightslategray: "789",
701
+ lightslategrey: "789",
702
+ lightsteelblue: "b0c4de",
703
+ lightyellow: "ffffe0",
704
+ lime: "0f0",
705
+ limegreen: "32cd32",
706
+ linen: "faf0e6",
707
+ magenta: "f0f",
708
+ maroon: "800000",
709
+ mediumaquamarine: "66cdaa",
710
+ mediumblue: "0000cd",
711
+ mediumorchid: "ba55d3",
712
+ mediumpurple: "9370db",
713
+ mediumseagreen: "3cb371",
714
+ mediumslateblue: "7b68ee",
715
+ mediumspringgreen: "00fa9a",
716
+ mediumturquoise: "48d1cc",
717
+ mediumvioletred: "c71585",
718
+ midnightblue: "191970",
719
+ mintcream: "f5fffa",
720
+ mistyrose: "ffe4e1",
721
+ moccasin: "ffe4b5",
722
+ navajowhite: "ffdead",
723
+ navy: "000080",
724
+ oldlace: "fdf5e6",
725
+ olive: "808000",
726
+ olivedrab: "6b8e23",
727
+ orange: "ffa500",
728
+ orangered: "ff4500",
729
+ orchid: "da70d6",
730
+ palegoldenrod: "eee8aa",
731
+ palegreen: "98fb98",
732
+ paleturquoise: "afeeee",
733
+ palevioletred: "db7093",
734
+ papayawhip: "ffefd5",
735
+ peachpuff: "ffdab9",
736
+ peru: "cd853f",
737
+ pink: "ffc0cb",
738
+ plum: "dda0dd",
739
+ powderblue: "b0e0e6",
740
+ purple: "800080",
741
+ rebeccapurple: "663399",
742
+ red: "f00",
743
+ rosybrown: "bc8f8f",
744
+ royalblue: "4169e1",
745
+ saddlebrown: "8b4513",
746
+ salmon: "fa8072",
747
+ sandybrown: "f4a460",
748
+ seagreen: "2e8b57",
749
+ seashell: "fff5ee",
750
+ sienna: "a0522d",
751
+ silver: "c0c0c0",
752
+ skyblue: "87ceeb",
753
+ slateblue: "6a5acd",
754
+ slategray: "708090",
755
+ slategrey: "708090",
756
+ snow: "fffafa",
757
+ springgreen: "00ff7f",
758
+ steelblue: "4682b4",
759
+ tan: "d2b48c",
760
+ teal: "008080",
761
+ thistle: "d8bfd8",
762
+ tomato: "ff6347",
763
+ turquoise: "40e0d0",
764
+ violet: "ee82ee",
765
+ wheat: "f5deb3",
766
+ white: "fff",
767
+ whitesmoke: "f5f5f5",
768
+ yellow: "ff0",
769
+ yellowgreen: "9acd32"
770
+ };
771
+ var hexNames = tinycolor.hexNames = flip(names);
772
+ function flip(o) {
773
+ var flipped = {};
774
+ for (var i in o) {
775
+ if (o.hasOwnProperty(i)) {
776
+ flipped[o[i]] = i;
777
+ }
778
+ }
779
+ return flipped;
780
+ }
781
+ function boundAlpha(a) {
782
+ a = parseFloat(a);
783
+ if (isNaN(a) || a < 0 || a > 1) {
784
+ a = 1;
785
+ }
786
+ return a;
787
+ }
788
+ function bound01(n, max) {
789
+ if (isOnePointZero(n)) n = "100%";
790
+ var processPercent = isPercentage(n);
791
+ n = Math.min(max, Math.max(0, parseFloat(n)));
792
+ if (processPercent) {
793
+ n = parseInt(n * max, 10) / 100;
794
+ }
795
+ if (Math.abs(n - max) < 1e-6) {
796
+ return 1;
797
+ }
798
+ return n % max / parseFloat(max);
799
+ }
800
+ function clamp01(val) {
801
+ return Math.min(1, Math.max(0, val));
802
+ }
803
+ function parseIntFromHex(val) {
804
+ return parseInt(val, 16);
805
+ }
806
+ function isOnePointZero(n) {
807
+ return typeof n == "string" && n.indexOf(".") != -1 && parseFloat(n) === 1;
808
+ }
809
+ function isPercentage(n) {
810
+ return typeof n === "string" && n.indexOf("%") != -1;
811
+ }
812
+ function pad2(c) {
813
+ return c.length == 1 ? "0" + c : "" + c;
814
+ }
815
+ function convertToPercentage(n) {
816
+ if (n <= 1) {
817
+ n = n * 100 + "%";
818
+ }
819
+ return n;
820
+ }
821
+ function convertDecimalToHex(d) {
822
+ return Math.round(parseFloat(d) * 255).toString(16);
823
+ }
824
+ function convertHexToDecimal(h) {
825
+ return parseIntFromHex(h) / 255;
826
+ }
827
+ var matchers = function() {
828
+ var CSS_INTEGER = "[-\\+]?\\d+%?";
829
+ var CSS_NUMBER = "[-\\+]?\\d*\\.\\d+%?";
830
+ var CSS_UNIT = "(?:" + CSS_NUMBER + ")|(?:" + CSS_INTEGER + ")";
831
+ var PERMISSIVE_MATCH3 = "[\\s|\\(]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")\\s*\\)?";
832
+ var PERMISSIVE_MATCH4 = "[\\s|\\(]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")\\s*\\)?";
833
+ return {
834
+ CSS_UNIT: new RegExp(CSS_UNIT),
835
+ rgb: new RegExp("rgb" + PERMISSIVE_MATCH3),
836
+ rgba: new RegExp("rgba" + PERMISSIVE_MATCH4),
837
+ hsl: new RegExp("hsl" + PERMISSIVE_MATCH3),
838
+ hsla: new RegExp("hsla" + PERMISSIVE_MATCH4),
839
+ hsv: new RegExp("hsv" + PERMISSIVE_MATCH3),
840
+ hsva: new RegExp("hsva" + PERMISSIVE_MATCH4),
841
+ hex3: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
842
+ hex6: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,
843
+ hex4: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
844
+ hex8: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/
845
+ };
846
+ }();
847
+ function isValidCSSUnit(color) {
848
+ return !!matchers.CSS_UNIT.exec(color);
849
+ }
850
+ function stringInputToObject(color) {
851
+ color = color.replace(trimLeft, "").replace(trimRight, "").toLowerCase();
852
+ var named = false;
853
+ if (names[color]) {
854
+ color = names[color];
855
+ named = true;
856
+ } else if (color == "transparent") {
857
+ return {
858
+ r: 0,
859
+ g: 0,
860
+ b: 0,
861
+ a: 0,
862
+ format: "name"
863
+ };
864
+ }
865
+ var match;
866
+ if (match = matchers.rgb.exec(color)) {
867
+ return {
868
+ r: match[1],
869
+ g: match[2],
870
+ b: match[3]
871
+ };
872
+ }
873
+ if (match = matchers.rgba.exec(color)) {
874
+ return {
875
+ r: match[1],
876
+ g: match[2],
877
+ b: match[3],
878
+ a: match[4]
879
+ };
880
+ }
881
+ if (match = matchers.hsl.exec(color)) {
882
+ return {
883
+ h: match[1],
884
+ s: match[2],
885
+ l: match[3]
886
+ };
887
+ }
888
+ if (match = matchers.hsla.exec(color)) {
889
+ return {
890
+ h: match[1],
891
+ s: match[2],
892
+ l: match[3],
893
+ a: match[4]
894
+ };
895
+ }
896
+ if (match = matchers.hsv.exec(color)) {
897
+ return {
898
+ h: match[1],
899
+ s: match[2],
900
+ v: match[3]
901
+ };
902
+ }
903
+ if (match = matchers.hsva.exec(color)) {
904
+ return {
905
+ h: match[1],
906
+ s: match[2],
907
+ v: match[3],
908
+ a: match[4]
909
+ };
910
+ }
911
+ if (match = matchers.hex8.exec(color)) {
912
+ return {
913
+ r: parseIntFromHex(match[1]),
914
+ g: parseIntFromHex(match[2]),
915
+ b: parseIntFromHex(match[3]),
916
+ a: convertHexToDecimal(match[4]),
917
+ format: named ? "name" : "hex8"
918
+ };
919
+ }
920
+ if (match = matchers.hex6.exec(color)) {
921
+ return {
922
+ r: parseIntFromHex(match[1]),
923
+ g: parseIntFromHex(match[2]),
924
+ b: parseIntFromHex(match[3]),
925
+ format: named ? "name" : "hex"
926
+ };
927
+ }
928
+ if (match = matchers.hex4.exec(color)) {
929
+ return {
930
+ r: parseIntFromHex(match[1] + "" + match[1]),
931
+ g: parseIntFromHex(match[2] + "" + match[2]),
932
+ b: parseIntFromHex(match[3] + "" + match[3]),
933
+ a: convertHexToDecimal(match[4] + "" + match[4]),
934
+ format: named ? "name" : "hex8"
935
+ };
936
+ }
937
+ if (match = matchers.hex3.exec(color)) {
938
+ return {
939
+ r: parseIntFromHex(match[1] + "" + match[1]),
940
+ g: parseIntFromHex(match[2] + "" + match[2]),
941
+ b: parseIntFromHex(match[3] + "" + match[3]),
942
+ format: named ? "name" : "hex"
943
+ };
944
+ }
945
+ return false;
946
+ }
947
+ function validateWCAG2Parms(parms) {
948
+ var level, size;
949
+ parms = parms || {
950
+ level: "AA",
951
+ size: "small"
952
+ };
953
+ level = (parms.level || "AA").toUpperCase();
954
+ size = (parms.size || "small").toLowerCase();
955
+ if (level !== "AA" && level !== "AAA") {
956
+ level = "AA";
957
+ }
958
+ if (size !== "small" && size !== "large") {
959
+ size = "small";
960
+ }
961
+ return {
962
+ level,
963
+ size
964
+ };
965
+ }
966
+ const ColorPickerEmits = ["update:modelValue"];
967
+ function defineColorModel(props, emit) {
968
+ let originalFormat;
969
+ const tinyColorRef = Mo.computed({
970
+ get: () => {
971
+ const colorInput = props.modelValue;
972
+ const value = tinycolor(colorInput);
973
+ originalFormat = value.getFormat();
974
+ return value;
975
+ },
976
+ set: (newValue) => {
977
+ const newTinyColor = tinycolor(newValue);
978
+ const transformedValue = transformToOriginalInputFormat(
979
+ newTinyColor,
980
+ originalFormat
981
+ );
982
+ emit("update:modelValue", transformedValue);
983
+ }
984
+ });
985
+ return tinyColorRef;
986
+ }
987
+ function transformToOriginalInputFormat(color, originalFormat) {
988
+ return color.toString(originalFormat);
989
+ }
990
+ exports.ColorPickerEmits = ColorPickerEmits;
991
+ exports.defineColorModel = defineColorModel;
992
+ exports.tinycolor = tinycolor;