primeng 22.1.1 → 22.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (850) hide show
  1. package/fesm2022/primeng-accordion.mjs +998 -594
  2. package/fesm2022/primeng-accordion.mjs.map +1 -1
  3. package/fesm2022/primeng-animateonscroll.mjs +266 -174
  4. package/fesm2022/primeng-animateonscroll.mjs.map +1 -1
  5. package/fesm2022/primeng-api.mjs +888 -848
  6. package/fesm2022/primeng-api.mjs.map +1 -1
  7. package/fesm2022/primeng-autocomplete.mjs +2534 -1631
  8. package/fesm2022/primeng-autocomplete.mjs.map +1 -1
  9. package/fesm2022/primeng-autofocus.mjs +114 -77
  10. package/fesm2022/primeng-autofocus.mjs.map +1 -1
  11. package/fesm2022/primeng-avatar.mjs +330 -189
  12. package/fesm2022/primeng-avatar.mjs.map +1 -1
  13. package/fesm2022/primeng-avatargroup.mjs +178 -95
  14. package/fesm2022/primeng-avatargroup.mjs.map +1 -1
  15. package/fesm2022/primeng-badge.mjs +290 -156
  16. package/fesm2022/primeng-badge.mjs.map +1 -1
  17. package/fesm2022/primeng-base.mjs +95 -83
  18. package/fesm2022/primeng-base.mjs.map +1 -1
  19. package/fesm2022/primeng-basecomponent.mjs +528 -478
  20. package/fesm2022/primeng-basecomponent.mjs.map +1 -1
  21. package/fesm2022/primeng-baseeditableholder.mjs +131 -74
  22. package/fesm2022/primeng-baseeditableholder.mjs.map +1 -1
  23. package/fesm2022/primeng-baseinput.mjs +214 -99
  24. package/fesm2022/primeng-baseinput.mjs.map +1 -1
  25. package/fesm2022/primeng-basemodelholder.mjs +39 -26
  26. package/fesm2022/primeng-basemodelholder.mjs.map +1 -1
  27. package/fesm2022/primeng-bind.mjs +156 -97
  28. package/fesm2022/primeng-bind.mjs.map +1 -1
  29. package/fesm2022/primeng-blockui.mjs +360 -225
  30. package/fesm2022/primeng-blockui.mjs.map +1 -1
  31. package/fesm2022/primeng-breadcrumb.mjs +458 -220
  32. package/fesm2022/primeng-breadcrumb.mjs.map +1 -1
  33. package/fesm2022/primeng-button.mjs +1568 -710
  34. package/fesm2022/primeng-button.mjs.map +1 -1
  35. package/fesm2022/primeng-buttongroup.mjs +125 -73
  36. package/fesm2022/primeng-buttongroup.mjs.map +1 -1
  37. package/fesm2022/primeng-card.mjs +389 -178
  38. package/fesm2022/primeng-card.mjs.map +1 -1
  39. package/fesm2022/primeng-carousel.mjs +2393 -1772
  40. package/fesm2022/primeng-carousel.mjs.map +1 -1
  41. package/fesm2022/primeng-cascadeselect.mjs +2373 -1399
  42. package/fesm2022/primeng-cascadeselect.mjs.map +1 -1
  43. package/fesm2022/primeng-chart.mjs +402 -231
  44. package/fesm2022/primeng-chart.mjs.map +1 -1
  45. package/fesm2022/primeng-checkbox.mjs +650 -351
  46. package/fesm2022/primeng-checkbox.mjs.map +1 -1
  47. package/fesm2022/primeng-chip.mjs +411 -224
  48. package/fesm2022/primeng-chip.mjs.map +1 -1
  49. package/fesm2022/primeng-classnames.mjs +95 -48
  50. package/fesm2022/primeng-classnames.mjs.map +1 -1
  51. package/fesm2022/primeng-colorpicker.mjs +890 -635
  52. package/fesm2022/primeng-colorpicker.mjs.map +1 -1
  53. package/fesm2022/primeng-commandmenu.mjs +568 -313
  54. package/fesm2022/primeng-commandmenu.mjs.map +1 -1
  55. package/fesm2022/primeng-compare.mjs +843 -481
  56. package/fesm2022/primeng-compare.mjs.map +1 -1
  57. package/fesm2022/primeng-config.mjs +415 -321
  58. package/fesm2022/primeng-config.mjs.map +1 -1
  59. package/fesm2022/primeng-confirmdialog.mjs +1188 -536
  60. package/fesm2022/primeng-confirmdialog.mjs.map +1 -1
  61. package/fesm2022/primeng-confirmpopup.mjs +810 -518
  62. package/fesm2022/primeng-confirmpopup.mjs.map +1 -1
  63. package/fesm2022/primeng-contextmenu.mjs +1862 -1082
  64. package/fesm2022/primeng-contextmenu.mjs.map +1 -1
  65. package/fesm2022/primeng-dataview.mjs +1130 -550
  66. package/fesm2022/primeng-dataview.mjs.map +1 -1
  67. package/fesm2022/primeng-datepicker.mjs +3750 -3356
  68. package/fesm2022/primeng-datepicker.mjs.map +1 -1
  69. package/fesm2022/primeng-dialog.mjs +1635 -975
  70. package/fesm2022/primeng-dialog.mjs.map +1 -1
  71. package/fesm2022/primeng-divider.mjs +272 -146
  72. package/fesm2022/primeng-divider.mjs.map +1 -1
  73. package/fesm2022/primeng-dock.mjs +609 -391
  74. package/fesm2022/primeng-dock.mjs.map +1 -1
  75. package/fesm2022/primeng-dom.mjs +599 -767
  76. package/fesm2022/primeng-dom.mjs.map +1 -1
  77. package/fesm2022/primeng-dragdrop.mjs +323 -312
  78. package/fesm2022/primeng-dragdrop.mjs.map +1 -1
  79. package/fesm2022/primeng-drawer.mjs +913 -484
  80. package/fesm2022/primeng-drawer.mjs.map +1 -1
  81. package/fesm2022/primeng-dynamicdialog.mjs +828 -917
  82. package/fesm2022/primeng-dynamicdialog.mjs.map +1 -1
  83. package/fesm2022/primeng-editor.mjs +547 -391
  84. package/fesm2022/primeng-editor.mjs.map +1 -1
  85. package/fesm2022/primeng-fieldset.mjs +559 -271
  86. package/fesm2022/primeng-fieldset.mjs.map +1 -1
  87. package/fesm2022/primeng-fileupload.mjs +1836 -1054
  88. package/fesm2022/primeng-fileupload.mjs.map +1 -1
  89. package/fesm2022/primeng-floatlabel.mjs +187 -102
  90. package/fesm2022/primeng-floatlabel.mjs.map +1 -1
  91. package/fesm2022/primeng-fluid.mjs +156 -85
  92. package/fesm2022/primeng-fluid.mjs.map +1 -1
  93. package/fesm2022/primeng-focustrap.mjs +150 -112
  94. package/fesm2022/primeng-focustrap.mjs.map +1 -1
  95. package/fesm2022/primeng-galleria.mjs +2589 -1410
  96. package/fesm2022/primeng-galleria.mjs.map +1 -1
  97. package/fesm2022/primeng-gallery.mjs +2768 -1796
  98. package/fesm2022/primeng-gallery.mjs.map +1 -1
  99. package/fesm2022/primeng-iconfield.mjs +192 -93
  100. package/fesm2022/primeng-iconfield.mjs.map +1 -1
  101. package/fesm2022/primeng-icons-angledoubledown.mjs +41 -23
  102. package/fesm2022/primeng-icons-angledoubledown.mjs.map +1 -1
  103. package/fesm2022/primeng-icons-angledoubleleft.mjs +41 -23
  104. package/fesm2022/primeng-icons-angledoubleleft.mjs.map +1 -1
  105. package/fesm2022/primeng-icons-angledoubleright.mjs +41 -23
  106. package/fesm2022/primeng-icons-angledoubleright.mjs.map +1 -1
  107. package/fesm2022/primeng-icons-angledoubleup.mjs +41 -23
  108. package/fesm2022/primeng-icons-angledoubleup.mjs.map +1 -1
  109. package/fesm2022/primeng-icons-angledown.mjs +41 -23
  110. package/fesm2022/primeng-icons-angledown.mjs.map +1 -1
  111. package/fesm2022/primeng-icons-angleleft.mjs +41 -23
  112. package/fesm2022/primeng-icons-angleleft.mjs.map +1 -1
  113. package/fesm2022/primeng-icons-angleright.mjs +41 -23
  114. package/fesm2022/primeng-icons-angleright.mjs.map +1 -1
  115. package/fesm2022/primeng-icons-angleup.mjs +41 -23
  116. package/fesm2022/primeng-icons-angleup.mjs.map +1 -1
  117. package/fesm2022/primeng-icons-arrowdown.mjs +46 -28
  118. package/fesm2022/primeng-icons-arrowdown.mjs.map +1 -1
  119. package/fesm2022/primeng-icons-arrowdownleft.mjs +41 -23
  120. package/fesm2022/primeng-icons-arrowdownleft.mjs.map +1 -1
  121. package/fesm2022/primeng-icons-arrowdownright.mjs +41 -23
  122. package/fesm2022/primeng-icons-arrowdownright.mjs.map +1 -1
  123. package/fesm2022/primeng-icons-arrowleft.mjs +46 -28
  124. package/fesm2022/primeng-icons-arrowleft.mjs.map +1 -1
  125. package/fesm2022/primeng-icons-arrowright.mjs +41 -23
  126. package/fesm2022/primeng-icons-arrowright.mjs.map +1 -1
  127. package/fesm2022/primeng-icons-arrowup.mjs +46 -28
  128. package/fesm2022/primeng-icons-arrowup.mjs.map +1 -1
  129. package/fesm2022/primeng-icons-ban.mjs +46 -28
  130. package/fesm2022/primeng-icons-ban.mjs.map +1 -1
  131. package/fesm2022/primeng-icons-bars.mjs +41 -23
  132. package/fesm2022/primeng-icons-bars.mjs.map +1 -1
  133. package/fesm2022/primeng-icons-baseicon.mjs +111 -67
  134. package/fesm2022/primeng-icons-baseicon.mjs.map +1 -1
  135. package/fesm2022/primeng-icons-blank.mjs +40 -22
  136. package/fesm2022/primeng-icons-blank.mjs.map +1 -1
  137. package/fesm2022/primeng-icons-calendar.mjs +41 -23
  138. package/fesm2022/primeng-icons-calendar.mjs.map +1 -1
  139. package/fesm2022/primeng-icons-caretleft.mjs +41 -23
  140. package/fesm2022/primeng-icons-caretleft.mjs.map +1 -1
  141. package/fesm2022/primeng-icons-caretright.mjs +41 -23
  142. package/fesm2022/primeng-icons-caretright.mjs.map +1 -1
  143. package/fesm2022/primeng-icons-check.mjs +41 -23
  144. package/fesm2022/primeng-icons-check.mjs.map +1 -1
  145. package/fesm2022/primeng-icons-chevrondown.mjs +41 -23
  146. package/fesm2022/primeng-icons-chevrondown.mjs.map +1 -1
  147. package/fesm2022/primeng-icons-chevronleft.mjs +41 -23
  148. package/fesm2022/primeng-icons-chevronleft.mjs.map +1 -1
  149. package/fesm2022/primeng-icons-chevronright.mjs +41 -23
  150. package/fesm2022/primeng-icons-chevronright.mjs.map +1 -1
  151. package/fesm2022/primeng-icons-chevronup.mjs +41 -23
  152. package/fesm2022/primeng-icons-chevronup.mjs.map +1 -1
  153. package/fesm2022/primeng-icons-exclamationtriangle.mjs +46 -28
  154. package/fesm2022/primeng-icons-exclamationtriangle.mjs.map +1 -1
  155. package/fesm2022/primeng-icons-eye.mjs +41 -23
  156. package/fesm2022/primeng-icons-eye.mjs.map +1 -1
  157. package/fesm2022/primeng-icons-eyeslash.mjs +46 -28
  158. package/fesm2022/primeng-icons-eyeslash.mjs.map +1 -1
  159. package/fesm2022/primeng-icons-filter.mjs +46 -28
  160. package/fesm2022/primeng-icons-filter.mjs.map +1 -1
  161. package/fesm2022/primeng-icons-filterfill.mjs +41 -23
  162. package/fesm2022/primeng-icons-filterfill.mjs.map +1 -1
  163. package/fesm2022/primeng-icons-filterslash.mjs +46 -28
  164. package/fesm2022/primeng-icons-filterslash.mjs.map +1 -1
  165. package/fesm2022/primeng-icons-home.mjs +46 -28
  166. package/fesm2022/primeng-icons-home.mjs.map +1 -1
  167. package/fesm2022/primeng-icons-infocircle.mjs +46 -28
  168. package/fesm2022/primeng-icons-infocircle.mjs.map +1 -1
  169. package/fesm2022/primeng-icons-minus.mjs +41 -23
  170. package/fesm2022/primeng-icons-minus.mjs.map +1 -1
  171. package/fesm2022/primeng-icons-pencil.mjs +46 -28
  172. package/fesm2022/primeng-icons-pencil.mjs.map +1 -1
  173. package/fesm2022/primeng-icons-plus.mjs +46 -28
  174. package/fesm2022/primeng-icons-plus.mjs.map +1 -1
  175. package/fesm2022/primeng-icons-refresh.mjs +46 -28
  176. package/fesm2022/primeng-icons-refresh.mjs.map +1 -1
  177. package/fesm2022/primeng-icons-search.mjs +46 -28
  178. package/fesm2022/primeng-icons-search.mjs.map +1 -1
  179. package/fesm2022/primeng-icons-searchminus.mjs +46 -28
  180. package/fesm2022/primeng-icons-searchminus.mjs.map +1 -1
  181. package/fesm2022/primeng-icons-searchplus.mjs +46 -28
  182. package/fesm2022/primeng-icons-searchplus.mjs.map +1 -1
  183. package/fesm2022/primeng-icons-sortalt.mjs +46 -28
  184. package/fesm2022/primeng-icons-sortalt.mjs.map +1 -1
  185. package/fesm2022/primeng-icons-sortamountdown.mjs +46 -28
  186. package/fesm2022/primeng-icons-sortamountdown.mjs.map +1 -1
  187. package/fesm2022/primeng-icons-sortamountupalt.mjs +46 -28
  188. package/fesm2022/primeng-icons-sortamountupalt.mjs.map +1 -1
  189. package/fesm2022/primeng-icons-spinner.mjs +46 -28
  190. package/fesm2022/primeng-icons-spinner.mjs.map +1 -1
  191. package/fesm2022/primeng-icons-star.mjs +46 -28
  192. package/fesm2022/primeng-icons-star.mjs.map +1 -1
  193. package/fesm2022/primeng-icons-starfill.mjs +46 -28
  194. package/fesm2022/primeng-icons-starfill.mjs.map +1 -1
  195. package/fesm2022/primeng-icons-thlarge.mjs +46 -28
  196. package/fesm2022/primeng-icons-thlarge.mjs.map +1 -1
  197. package/fesm2022/primeng-icons-times.mjs +41 -23
  198. package/fesm2022/primeng-icons-times.mjs.map +1 -1
  199. package/fesm2022/primeng-icons-timescircle.mjs +46 -28
  200. package/fesm2022/primeng-icons-timescircle.mjs.map +1 -1
  201. package/fesm2022/primeng-icons-trash.mjs +46 -28
  202. package/fesm2022/primeng-icons-trash.mjs.map +1 -1
  203. package/fesm2022/primeng-icons-undo.mjs +46 -28
  204. package/fesm2022/primeng-icons-undo.mjs.map +1 -1
  205. package/fesm2022/primeng-icons-upload.mjs +46 -28
  206. package/fesm2022/primeng-icons-upload.mjs.map +1 -1
  207. package/fesm2022/primeng-icons-windowmaximize.mjs +46 -28
  208. package/fesm2022/primeng-icons-windowmaximize.mjs.map +1 -1
  209. package/fesm2022/primeng-icons-windowminimize.mjs +46 -28
  210. package/fesm2022/primeng-icons-windowminimize.mjs.map +1 -1
  211. package/fesm2022/primeng-icons.mjs +53 -63
  212. package/fesm2022/primeng-iftalabel.mjs +153 -86
  213. package/fesm2022/primeng-iftalabel.mjs.map +1 -1
  214. package/fesm2022/primeng-image.mjs +1006 -532
  215. package/fesm2022/primeng-image.mjs.map +1 -1
  216. package/fesm2022/primeng-imagecompare.mjs +325 -165
  217. package/fesm2022/primeng-imagecompare.mjs.map +1 -1
  218. package/fesm2022/primeng-inplace.mjs +401 -199
  219. package/fesm2022/primeng-inplace.mjs.map +1 -1
  220. package/fesm2022/primeng-inputcolor.mjs +2631 -2189
  221. package/fesm2022/primeng-inputcolor.mjs.map +1 -1
  222. package/fesm2022/primeng-inputgroup.mjs +159 -91
  223. package/fesm2022/primeng-inputgroup.mjs.map +1 -1
  224. package/fesm2022/primeng-inputgroupaddon.mjs +153 -68
  225. package/fesm2022/primeng-inputgroupaddon.mjs.map +1 -1
  226. package/fesm2022/primeng-inputicon.mjs +173 -72
  227. package/fesm2022/primeng-inputicon.mjs.map +1 -1
  228. package/fesm2022/primeng-inputmask.mjs +1607 -1387
  229. package/fesm2022/primeng-inputmask.mjs.map +1 -1
  230. package/fesm2022/primeng-inputnumber.mjs +1646 -1305
  231. package/fesm2022/primeng-inputnumber.mjs.map +1 -1
  232. package/fesm2022/primeng-inputotp.mjs +571 -376
  233. package/fesm2022/primeng-inputotp.mjs.map +1 -1
  234. package/fesm2022/primeng-inputpassword.mjs +179 -96
  235. package/fesm2022/primeng-inputpassword.mjs.map +1 -1
  236. package/fesm2022/primeng-inputtags.mjs +1212 -588
  237. package/fesm2022/primeng-inputtags.mjs.map +1 -1
  238. package/fesm2022/primeng-inputtext.mjs +325 -175
  239. package/fesm2022/primeng-inputtext.mjs.map +1 -1
  240. package/fesm2022/primeng-keyfilter.mjs +268 -244
  241. package/fesm2022/primeng-keyfilter.mjs.map +1 -1
  242. package/fesm2022/primeng-knob.mjs +627 -405
  243. package/fesm2022/primeng-knob.mjs.map +1 -1
  244. package/fesm2022/primeng-label.mjs +143 -81
  245. package/fesm2022/primeng-label.mjs.map +1 -1
  246. package/fesm2022/primeng-license.mjs +10 -36
  247. package/fesm2022/primeng-license.mjs.map +1 -1
  248. package/fesm2022/primeng-listbox.mjs +2409 -1608
  249. package/fesm2022/primeng-listbox.mjs.map +1 -1
  250. package/fesm2022/primeng-megamenu.mjs +2006 -1137
  251. package/fesm2022/primeng-megamenu.mjs.map +1 -1
  252. package/fesm2022/primeng-menu.mjs +1437 -848
  253. package/fesm2022/primeng-menu.mjs.map +1 -1
  254. package/fesm2022/primeng-menubar.mjs +1832 -994
  255. package/fesm2022/primeng-menubar.mjs.map +1 -1
  256. package/fesm2022/primeng-message.mjs +474 -239
  257. package/fesm2022/primeng-message.mjs.map +1 -1
  258. package/fesm2022/primeng-metergroup.mjs +663 -331
  259. package/fesm2022/primeng-metergroup.mjs.map +1 -1
  260. package/fesm2022/primeng-motion.mjs +1179 -690
  261. package/fesm2022/primeng-motion.mjs.map +1 -1
  262. package/fesm2022/primeng-multiselect.mjs +3406 -1932
  263. package/fesm2022/primeng-multiselect.mjs.map +1 -1
  264. package/fesm2022/primeng-orderlist.mjs +1308 -664
  265. package/fesm2022/primeng-orderlist.mjs.map +1 -1
  266. package/fesm2022/primeng-organizationchart.mjs +912 -595
  267. package/fesm2022/primeng-organizationchart.mjs.map +1 -1
  268. package/fesm2022/primeng-overlay.mjs +929 -624
  269. package/fesm2022/primeng-overlay.mjs.map +1 -1
  270. package/fesm2022/primeng-overlaybadge.mjs +291 -107
  271. package/fesm2022/primeng-overlaybadge.mjs.map +1 -1
  272. package/fesm2022/primeng-paginator.mjs +959 -503
  273. package/fesm2022/primeng-paginator.mjs.map +1 -1
  274. package/fesm2022/primeng-panel.mjs +668 -343
  275. package/fesm2022/primeng-panel.mjs.map +1 -1
  276. package/fesm2022/primeng-panelmenu.mjs +1842 -998
  277. package/fesm2022/primeng-panelmenu.mjs.map +1 -1
  278. package/fesm2022/primeng-passthrough.mjs +8 -16
  279. package/fesm2022/primeng-passthrough.mjs.map +1 -1
  280. package/fesm2022/primeng-password.mjs +1518 -866
  281. package/fesm2022/primeng-password.mjs.map +1 -1
  282. package/fesm2022/primeng-picklist.mjs +2270 -1256
  283. package/fesm2022/primeng-picklist.mjs.map +1 -1
  284. package/fesm2022/primeng-popover.mjs +656 -436
  285. package/fesm2022/primeng-popover.mjs.map +1 -1
  286. package/fesm2022/primeng-progressbar.mjs +346 -168
  287. package/fesm2022/primeng-progressbar.mjs.map +1 -1
  288. package/fesm2022/primeng-progressspinner.mjs +338 -188
  289. package/fesm2022/primeng-progressspinner.mjs.map +1 -1
  290. package/fesm2022/primeng-radiobutton.mjs +499 -292
  291. package/fesm2022/primeng-radiobutton.mjs.map +1 -1
  292. package/fesm2022/primeng-rating.mjs +583 -352
  293. package/fesm2022/primeng-rating.mjs.map +1 -1
  294. package/fesm2022/primeng-ripple.mjs +194 -184
  295. package/fesm2022/primeng-ripple.mjs.map +1 -1
  296. package/fesm2022/primeng-scrollarea.mjs +1018 -721
  297. package/fesm2022/primeng-scrollarea.mjs.map +1 -1
  298. package/fesm2022/primeng-scroller.mjs +1386 -1083
  299. package/fesm2022/primeng-scroller.mjs.map +1 -1
  300. package/fesm2022/primeng-scrollpanel.mjs +568 -480
  301. package/fesm2022/primeng-scrollpanel.mjs.map +1 -1
  302. package/fesm2022/primeng-scrolltop.mjs +509 -260
  303. package/fesm2022/primeng-scrolltop.mjs.map +1 -1
  304. package/fesm2022/primeng-select.mjs +2948 -1765
  305. package/fesm2022/primeng-select.mjs.map +1 -1
  306. package/fesm2022/primeng-selectbutton.mjs +629 -339
  307. package/fesm2022/primeng-selectbutton.mjs.map +1 -1
  308. package/fesm2022/primeng-sidebar.mjs +2561 -1416
  309. package/fesm2022/primeng-sidebar.mjs.map +1 -1
  310. package/fesm2022/primeng-skeleton.mjs +300 -157
  311. package/fesm2022/primeng-skeleton.mjs.map +1 -1
  312. package/fesm2022/primeng-slider.mjs +841 -604
  313. package/fesm2022/primeng-slider.mjs.map +1 -1
  314. package/fesm2022/primeng-speeddial.mjs +1115 -717
  315. package/fesm2022/primeng-speeddial.mjs.map +1 -1
  316. package/fesm2022/primeng-splitbutton.mjs +889 -339
  317. package/fesm2022/primeng-splitbutton.mjs.map +1 -1
  318. package/fesm2022/primeng-splitter.mjs +997 -759
  319. package/fesm2022/primeng-splitter.mjs.map +1 -1
  320. package/fesm2022/primeng-stepper.mjs +1355 -641
  321. package/fesm2022/primeng-stepper.mjs.map +1 -1
  322. package/fesm2022/primeng-steps.mjs +397 -304
  323. package/fesm2022/primeng-steps.mjs.map +1 -1
  324. package/fesm2022/primeng-styleclass.mjs +446 -334
  325. package/fesm2022/primeng-styleclass.mjs.map +1 -1
  326. package/fesm2022/primeng-table.mjs +9763 -5870
  327. package/fesm2022/primeng-table.mjs.map +1 -1
  328. package/fesm2022/primeng-tabs.mjs +1357 -831
  329. package/fesm2022/primeng-tabs.mjs.map +1 -1
  330. package/fesm2022/primeng-tag.mjs +305 -151
  331. package/fesm2022/primeng-tag.mjs.map +1 -1
  332. package/fesm2022/primeng-terminal.mjs +368 -216
  333. package/fesm2022/primeng-terminal.mjs.map +1 -1
  334. package/fesm2022/primeng-textarea.mjs +345 -208
  335. package/fesm2022/primeng-textarea.mjs.map +1 -1
  336. package/fesm2022/primeng-tieredmenu.mjs +1917 -1125
  337. package/fesm2022/primeng-tieredmenu.mjs.map +1 -1
  338. package/fesm2022/primeng-timeline.mjs +304 -165
  339. package/fesm2022/primeng-timeline.mjs.map +1 -1
  340. package/fesm2022/primeng-toast.mjs +1369 -922
  341. package/fesm2022/primeng-toast.mjs.map +1 -1
  342. package/fesm2022/primeng-togglebutton.mjs +563 -309
  343. package/fesm2022/primeng-togglebutton.mjs.map +1 -1
  344. package/fesm2022/primeng-toggleswitch.mjs +464 -237
  345. package/fesm2022/primeng-toggleswitch.mjs.map +1 -1
  346. package/fesm2022/primeng-toolbar.mjs +299 -129
  347. package/fesm2022/primeng-toolbar.mjs.map +1 -1
  348. package/fesm2022/primeng-tooltip.mjs +1018 -778
  349. package/fesm2022/primeng-tooltip.mjs.map +1 -1
  350. package/fesm2022/primeng-tree.mjs +2679 -1875
  351. package/fesm2022/primeng-tree.mjs.map +1 -1
  352. package/fesm2022/primeng-treeselect.mjs +1678 -939
  353. package/fesm2022/primeng-treeselect.mjs.map +1 -1
  354. package/fesm2022/primeng-treetable.mjs +5849 -3754
  355. package/fesm2022/primeng-treetable.mjs.map +1 -1
  356. package/fesm2022/primeng-ts-helpers.mjs +0 -4
  357. package/fesm2022/primeng-types-accordion.mjs +0 -4
  358. package/fesm2022/primeng-types-autocomplete.mjs +0 -4
  359. package/fesm2022/primeng-types-avatar.mjs +0 -4
  360. package/fesm2022/primeng-types-avatargroup.mjs +0 -4
  361. package/fesm2022/primeng-types-badge.mjs +0 -4
  362. package/fesm2022/primeng-types-blockui.mjs +0 -4
  363. package/fesm2022/primeng-types-breadcrumb.mjs +0 -4
  364. package/fesm2022/primeng-types-button.mjs +0 -4
  365. package/fesm2022/primeng-types-card.mjs +0 -4
  366. package/fesm2022/primeng-types-carousel.mjs +0 -4
  367. package/fesm2022/primeng-types-cascadeselect.mjs +0 -4
  368. package/fesm2022/primeng-types-chart.mjs +0 -4
  369. package/fesm2022/primeng-types-checkbox.mjs +0 -4
  370. package/fesm2022/primeng-types-chip.mjs +0 -4
  371. package/fesm2022/primeng-types-colorpicker.mjs +0 -4
  372. package/fesm2022/primeng-types-commandmenu.mjs +0 -4
  373. package/fesm2022/primeng-types-compare.mjs +0 -4
  374. package/fesm2022/primeng-types-confirmdialog.mjs +0 -4
  375. package/fesm2022/primeng-types-confirmpopup.mjs +0 -4
  376. package/fesm2022/primeng-types-contextmenu.mjs +0 -4
  377. package/fesm2022/primeng-types-dataview.mjs +0 -4
  378. package/fesm2022/primeng-types-datepicker.mjs +0 -4
  379. package/fesm2022/primeng-types-dialog.mjs +0 -4
  380. package/fesm2022/primeng-types-divider.mjs +0 -4
  381. package/fesm2022/primeng-types-dock.mjs +0 -4
  382. package/fesm2022/primeng-types-drawer.mjs +0 -4
  383. package/fesm2022/primeng-types-editor.mjs +0 -4
  384. package/fesm2022/primeng-types-fieldset.mjs +0 -4
  385. package/fesm2022/primeng-types-fileupload.mjs +0 -4
  386. package/fesm2022/primeng-types-floatlabel.mjs +0 -4
  387. package/fesm2022/primeng-types-fluid.mjs +0 -4
  388. package/fesm2022/primeng-types-galleria.mjs +0 -4
  389. package/fesm2022/primeng-types-gallery.mjs +0 -4
  390. package/fesm2022/primeng-types-iconfield.mjs +0 -4
  391. package/fesm2022/primeng-types-iftalabel.mjs +0 -4
  392. package/fesm2022/primeng-types-image.mjs +0 -4
  393. package/fesm2022/primeng-types-imagecompare.mjs +0 -4
  394. package/fesm2022/primeng-types-inplace.mjs +0 -4
  395. package/fesm2022/primeng-types-inputcolor.mjs +0 -4
  396. package/fesm2022/primeng-types-inputgroup.mjs +0 -4
  397. package/fesm2022/primeng-types-inputgroupaddon.mjs +0 -4
  398. package/fesm2022/primeng-types-inputicon.mjs +0 -4
  399. package/fesm2022/primeng-types-inputmask.mjs +0 -4
  400. package/fesm2022/primeng-types-inputnumber.mjs +0 -4
  401. package/fesm2022/primeng-types-inputotp.mjs +0 -4
  402. package/fesm2022/primeng-types-inputpassword.mjs +0 -4
  403. package/fesm2022/primeng-types-inputtags.mjs +0 -4
  404. package/fesm2022/primeng-types-inputtext.mjs +0 -4
  405. package/fesm2022/primeng-types-knob.mjs +0 -4
  406. package/fesm2022/primeng-types-label.mjs +0 -4
  407. package/fesm2022/primeng-types-listbox.mjs +0 -4
  408. package/fesm2022/primeng-types-megamenu.mjs +0 -4
  409. package/fesm2022/primeng-types-menu.mjs +0 -4
  410. package/fesm2022/primeng-types-menubar.mjs +0 -4
  411. package/fesm2022/primeng-types-message.mjs +0 -4
  412. package/fesm2022/primeng-types-metergroup.mjs +0 -4
  413. package/fesm2022/primeng-types-motion.mjs +0 -4
  414. package/fesm2022/primeng-types-multiselect.mjs +0 -4
  415. package/fesm2022/primeng-types-orderlist.mjs +0 -4
  416. package/fesm2022/primeng-types-organizationchart.mjs +0 -4
  417. package/fesm2022/primeng-types-overlay.mjs +0 -4
  418. package/fesm2022/primeng-types-overlaybadge.mjs +0 -4
  419. package/fesm2022/primeng-types-paginator.mjs +0 -4
  420. package/fesm2022/primeng-types-panel.mjs +0 -4
  421. package/fesm2022/primeng-types-panelmenu.mjs +0 -4
  422. package/fesm2022/primeng-types-password.mjs +0 -4
  423. package/fesm2022/primeng-types-picklist.mjs +0 -4
  424. package/fesm2022/primeng-types-popover.mjs +0 -4
  425. package/fesm2022/primeng-types-progressbar.mjs +0 -4
  426. package/fesm2022/primeng-types-progressspinner.mjs +0 -4
  427. package/fesm2022/primeng-types-radiobutton.mjs +0 -4
  428. package/fesm2022/primeng-types-rating.mjs +0 -4
  429. package/fesm2022/primeng-types-scrollarea.mjs +0 -4
  430. package/fesm2022/primeng-types-scroller.mjs +0 -4
  431. package/fesm2022/primeng-types-scrollpanel.mjs +0 -4
  432. package/fesm2022/primeng-types-scrolltop.mjs +0 -4
  433. package/fesm2022/primeng-types-select.mjs +0 -4
  434. package/fesm2022/primeng-types-selectbutton.mjs +0 -4
  435. package/fesm2022/primeng-types-shared.mjs +0 -4
  436. package/fesm2022/primeng-types-sidebar.mjs +0 -4
  437. package/fesm2022/primeng-types-skeleton.mjs +0 -4
  438. package/fesm2022/primeng-types-slider.mjs +0 -4
  439. package/fesm2022/primeng-types-speeddial.mjs +0 -4
  440. package/fesm2022/primeng-types-splitbutton.mjs +0 -4
  441. package/fesm2022/primeng-types-splitter.mjs +0 -4
  442. package/fesm2022/primeng-types-stepper.mjs +0 -4
  443. package/fesm2022/primeng-types-table.mjs +0 -4
  444. package/fesm2022/primeng-types-tabs.mjs +0 -4
  445. package/fesm2022/primeng-types-tag.mjs +0 -4
  446. package/fesm2022/primeng-types-terminal.mjs +0 -4
  447. package/fesm2022/primeng-types-textarea.mjs +0 -4
  448. package/fesm2022/primeng-types-tieredmenu.mjs +0 -4
  449. package/fesm2022/primeng-types-timeline.mjs +0 -4
  450. package/fesm2022/primeng-types-toast.mjs +0 -4
  451. package/fesm2022/primeng-types-togglebutton.mjs +0 -4
  452. package/fesm2022/primeng-types-toggleswitch.mjs +0 -4
  453. package/fesm2022/primeng-types-toolbar.mjs +0 -4
  454. package/fesm2022/primeng-types-tooltip.mjs +0 -4
  455. package/fesm2022/primeng-types-tree.mjs +0 -4
  456. package/fesm2022/primeng-types-treeselect.mjs +0 -4
  457. package/fesm2022/primeng-types-treetable.mjs +0 -4
  458. package/fesm2022/primeng-usestyle.mjs +105 -113
  459. package/fesm2022/primeng-usestyle.mjs.map +1 -1
  460. package/fesm2022/primeng-utils.mjs +236 -317
  461. package/fesm2022/primeng-utils.mjs.map +1 -1
  462. package/fesm2022/primeng.mjs +1 -5
  463. package/fesm2022/primeng.mjs.map +1 -1
  464. package/package.json +6 -1
  465. package/types/primeng-accordion.d.ts +289 -219
  466. package/types/primeng-animateonscroll.d.ts +89 -61
  467. package/types/primeng-api.d.ts +1754 -1790
  468. package/types/primeng-autocomplete.d.ts +1053 -754
  469. package/types/primeng-autofocus.d.ts +27 -24
  470. package/types/primeng-avatar.d.ts +152 -114
  471. package/types/primeng-avatargroup.d.ts +45 -40
  472. package/types/primeng-badge.d.ts +104 -78
  473. package/types/primeng-base.d.ts +49 -52
  474. package/types/primeng-basecomponent.d.ts +191 -174
  475. package/types/primeng-baseeditableholder.d.ts +63 -45
  476. package/types/primeng-baseinput.d.ts +122 -74
  477. package/types/primeng-basemodelholder.d.ts +9 -12
  478. package/types/primeng-bind.d.ts +36 -32
  479. package/types/primeng-blockui.d.ts +99 -80
  480. package/types/primeng-breadcrumb.d.ts +159 -133
  481. package/types/primeng-button.d.ts +690 -425
  482. package/types/primeng-buttongroup.d.ts +26 -30
  483. package/types/primeng-card.d.ts +130 -119
  484. package/types/primeng-carousel.d.ts +799 -629
  485. package/types/primeng-cascadeselect.d.ts +753 -562
  486. package/types/primeng-chart.d.ts +158 -112
  487. package/types/primeng-checkbox.d.ts +298 -208
  488. package/types/primeng-chip.d.ts +187 -143
  489. package/types/primeng-classnames.d.ts +23 -21
  490. package/types/primeng-colorpicker.d.ts +324 -269
  491. package/types/primeng-commandmenu.d.ts +213 -165
  492. package/types/primeng-compare.d.ts +267 -189
  493. package/types/primeng-config.d.ts +294 -304
  494. package/types/primeng-confirmdialog.d.ts +504 -325
  495. package/types/primeng-confirmpopup.d.ts +253 -207
  496. package/types/primeng-contextmenu.d.ts +522 -366
  497. package/types/primeng-dataview.d.ts +497 -342
  498. package/types/primeng-datepicker.d.ts +1268 -969
  499. package/types/primeng-dialog.d.ts +667 -462
  500. package/types/primeng-divider.d.ts +112 -96
  501. package/types/primeng-dock.d.ts +206 -172
  502. package/types/primeng-dom.d.ts +97 -100
  503. package/types/primeng-dragdrop.d.ts +142 -107
  504. package/types/primeng-drawer.d.ts +354 -254
  505. package/types/primeng-dynamicdialog.d.ts +527 -535
  506. package/types/primeng-editor.d.ts +210 -162
  507. package/types/primeng-fieldset.d.ts +198 -163
  508. package/types/primeng-fileupload.d.ts +726 -523
  509. package/types/primeng-floatlabel.d.ts +54 -48
  510. package/types/primeng-fluid.d.ts +36 -36
  511. package/types/primeng-focustrap.d.ts +30 -27
  512. package/types/primeng-galleria.d.ts +569 -430
  513. package/types/primeng-gallery.d.ts +754 -552
  514. package/types/primeng-iconfield.d.ts +53 -42
  515. package/types/primeng-icons-angledoubledown.d.ts +6 -9
  516. package/types/primeng-icons-angledoubleleft.d.ts +6 -9
  517. package/types/primeng-icons-angledoubleright.d.ts +6 -9
  518. package/types/primeng-icons-angledoubleup.d.ts +6 -9
  519. package/types/primeng-icons-angledown.d.ts +6 -9
  520. package/types/primeng-icons-angleleft.d.ts +6 -9
  521. package/types/primeng-icons-angleright.d.ts +6 -9
  522. package/types/primeng-icons-angleup.d.ts +6 -9
  523. package/types/primeng-icons-arrowdown.d.ts +8 -11
  524. package/types/primeng-icons-arrowdownleft.d.ts +6 -9
  525. package/types/primeng-icons-arrowdownright.d.ts +6 -9
  526. package/types/primeng-icons-arrowleft.d.ts +8 -11
  527. package/types/primeng-icons-arrowright.d.ts +6 -9
  528. package/types/primeng-icons-arrowup.d.ts +8 -11
  529. package/types/primeng-icons-ban.d.ts +8 -11
  530. package/types/primeng-icons-bars.d.ts +6 -9
  531. package/types/primeng-icons-baseicon.d.ts +23 -22
  532. package/types/primeng-icons-blank.d.ts +6 -9
  533. package/types/primeng-icons-calendar.d.ts +6 -9
  534. package/types/primeng-icons-caretleft.d.ts +6 -9
  535. package/types/primeng-icons-caretright.d.ts +6 -9
  536. package/types/primeng-icons-check.d.ts +6 -9
  537. package/types/primeng-icons-chevrondown.d.ts +6 -9
  538. package/types/primeng-icons-chevronleft.d.ts +6 -9
  539. package/types/primeng-icons-chevronright.d.ts +6 -9
  540. package/types/primeng-icons-chevronup.d.ts +6 -9
  541. package/types/primeng-icons-exclamationtriangle.d.ts +8 -11
  542. package/types/primeng-icons-eye.d.ts +6 -9
  543. package/types/primeng-icons-eyeslash.d.ts +8 -11
  544. package/types/primeng-icons-filter.d.ts +8 -11
  545. package/types/primeng-icons-filterfill.d.ts +6 -9
  546. package/types/primeng-icons-filterslash.d.ts +8 -11
  547. package/types/primeng-icons-home.d.ts +8 -11
  548. package/types/primeng-icons-infocircle.d.ts +8 -11
  549. package/types/primeng-icons-minus.d.ts +6 -9
  550. package/types/primeng-icons-pencil.d.ts +8 -11
  551. package/types/primeng-icons-plus.d.ts +8 -11
  552. package/types/primeng-icons-refresh.d.ts +8 -11
  553. package/types/primeng-icons-search.d.ts +8 -11
  554. package/types/primeng-icons-searchminus.d.ts +8 -11
  555. package/types/primeng-icons-searchplus.d.ts +8 -11
  556. package/types/primeng-icons-sortalt.d.ts +8 -11
  557. package/types/primeng-icons-sortamountdown.d.ts +8 -11
  558. package/types/primeng-icons-sortamountupalt.d.ts +8 -11
  559. package/types/primeng-icons-spinner.d.ts +8 -11
  560. package/types/primeng-icons-star.d.ts +8 -11
  561. package/types/primeng-icons-starfill.d.ts +8 -11
  562. package/types/primeng-icons-thlarge.d.ts +8 -11
  563. package/types/primeng-icons-times.d.ts +6 -9
  564. package/types/primeng-icons-timescircle.d.ts +8 -11
  565. package/types/primeng-icons-trash.d.ts +8 -11
  566. package/types/primeng-icons-undo.d.ts +8 -11
  567. package/types/primeng-icons-upload.d.ts +8 -11
  568. package/types/primeng-icons-windowmaximize.d.ts +8 -11
  569. package/types/primeng-icons-windowminimize.d.ts +8 -11
  570. package/types/primeng-icons.d.ts +53 -53
  571. package/types/primeng-iftalabel.d.ts +37 -37
  572. package/types/primeng-image.d.ts +403 -308
  573. package/types/primeng-imagecompare.d.ts +93 -77
  574. package/types/primeng-inplace.d.ts +125 -111
  575. package/types/primeng-inputcolor.d.ts +646 -507
  576. package/types/primeng-inputgroup.d.ts +41 -41
  577. package/types/primeng-inputgroupaddon.d.ts +31 -31
  578. package/types/primeng-inputicon.d.ts +38 -32
  579. package/types/primeng-inputmask.d.ts +519 -362
  580. package/types/primeng-inputnumber.d.ts +572 -405
  581. package/types/primeng-inputotp.d.ts +205 -156
  582. package/types/primeng-inputpassword.d.ts +59 -43
  583. package/types/primeng-inputtags.d.ts +451 -297
  584. package/types/primeng-inputtext.d.ts +129 -93
  585. package/types/primeng-keyfilter.d.ts +62 -53
  586. package/types/primeng-knob.d.ts +256 -183
  587. package/types/primeng-label.d.ts +36 -36
  588. package/types/primeng-license.d.ts +1 -3
  589. package/types/primeng-listbox.d.ts +1040 -786
  590. package/types/primeng-megamenu.d.ts +535 -383
  591. package/types/primeng-menu.d.ts +478 -361
  592. package/types/primeng-menubar.d.ts +495 -354
  593. package/types/primeng-message.d.ts +191 -148
  594. package/types/primeng-metergroup.d.ts +249 -187
  595. package/types/primeng-motion.d.ts +602 -384
  596. package/types/primeng-multiselect.d.ts +1192 -858
  597. package/types/primeng-orderlist.d.ts +538 -390
  598. package/types/primeng-organizationchart.d.ts +235 -192
  599. package/types/primeng-overlay.d.ts +394 -294
  600. package/types/primeng-overlaybadge.d.ts +95 -64
  601. package/types/primeng-paginator.d.ts +409 -309
  602. package/types/primeng-panel.d.ts +267 -217
  603. package/types/primeng-panelmenu.d.ts +254 -228
  604. package/types/primeng-passthrough.d.ts +5 -7
  605. package/types/primeng-password.d.ts +605 -430
  606. package/types/primeng-picklist.d.ts +1041 -756
  607. package/types/primeng-popover.d.ts +235 -176
  608. package/types/primeng-progressbar.d.ts +130 -99
  609. package/types/primeng-progressspinner.d.ts +144 -108
  610. package/types/primeng-radiobutton.d.ts +218 -168
  611. package/types/primeng-rating.d.ts +239 -189
  612. package/types/primeng-ripple.d.ts +38 -42
  613. package/types/primeng-scrollarea.d.ts +290 -239
  614. package/types/primeng-scroller.d.ts +522 -387
  615. package/types/primeng-scrollpanel.d.ts +134 -128
  616. package/types/primeng-scrolltop.d.ts +169 -123
  617. package/types/primeng-select.d.ts +1013 -738
  618. package/types/primeng-selectbutton.d.ts +238 -164
  619. package/types/primeng-sidebar.d.ts +794 -561
  620. package/types/primeng-skeleton.d.ts +114 -83
  621. package/types/primeng-slider.d.ts +375 -306
  622. package/types/primeng-speeddial.d.ts +492 -370
  623. package/types/primeng-splitbutton.d.ts +381 -240
  624. package/types/primeng-splitter.d.ts +392 -299
  625. package/types/primeng-stepper.d.ts +422 -250
  626. package/types/primeng-steps.d.ts +157 -134
  627. package/types/primeng-styleclass.d.ts +163 -105
  628. package/types/primeng-table.d.ts +2898 -1911
  629. package/types/primeng-tabs.d.ts +467 -301
  630. package/types/primeng-tag.d.ts +106 -85
  631. package/types/primeng-terminal.d.ts +131 -117
  632. package/types/primeng-textarea.d.ts +145 -107
  633. package/types/primeng-tieredmenu.d.ts +572 -398
  634. package/types/primeng-timeline.d.ts +125 -109
  635. package/types/primeng-toast.d.ts +310 -247
  636. package/types/primeng-togglebutton.d.ts +254 -182
  637. package/types/primeng-toggleswitch.d.ts +188 -140
  638. package/types/primeng-toolbar.d.ts +82 -76
  639. package/types/primeng-tooltip.d.ts +334 -232
  640. package/types/primeng-tree.d.ts +762 -559
  641. package/types/primeng-treeselect.d.ts +749 -547
  642. package/types/primeng-treetable.d.ts +1839 -1313
  643. package/types/primeng-ts-helpers.d.ts +4 -6
  644. package/types/primeng-types-accordion.d.ts +58 -62
  645. package/types/primeng-types-autocomplete.d.ts +230 -233
  646. package/types/primeng-types-avatar.d.ts +25 -28
  647. package/types/primeng-types-avatargroup.d.ts +11 -14
  648. package/types/primeng-types-badge.d.ts +13 -16
  649. package/types/primeng-types-blockui.d.ts +18 -21
  650. package/types/primeng-types-breadcrumb.d.ts +65 -68
  651. package/types/primeng-types-button.d.ts +106 -109
  652. package/types/primeng-types-card.d.ts +54 -57
  653. package/types/primeng-types-carousel.d.ts +143 -146
  654. package/types/primeng-types-cascadeselect.d.ts +186 -192
  655. package/types/primeng-types-chart.d.ts +34 -39
  656. package/types/primeng-types-checkbox.d.ts +52 -55
  657. package/types/primeng-types-chip.d.ts +48 -51
  658. package/types/primeng-types-colorpicker.d.ts +59 -62
  659. package/types/primeng-types-commandmenu.d.ts +98 -101
  660. package/types/primeng-types-compare.d.ts +33 -36
  661. package/types/primeng-types-confirmdialog.d.ts +124 -127
  662. package/types/primeng-types-confirmpopup.d.ts +75 -78
  663. package/types/primeng-types-contextmenu.d.ts +100 -103
  664. package/types/primeng-types-dataview.d.ts +180 -183
  665. package/types/primeng-types-datepicker.d.ts +442 -445
  666. package/types/primeng-types-dialog.d.ts +93 -96
  667. package/types/primeng-types-divider.d.ts +14 -17
  668. package/types/primeng-types-dock.d.ts +45 -48
  669. package/types/primeng-types-drawer.d.ts +62 -65
  670. package/types/primeng-types-editor.d.ts +143 -146
  671. package/types/primeng-types-fieldset.d.ts +83 -87
  672. package/types/primeng-types-fileupload.d.ts +296 -301
  673. package/types/primeng-types-floatlabel.d.ts +12 -15
  674. package/types/primeng-types-fluid.d.ts +11 -14
  675. package/types/primeng-types-galleria.d.ts +209 -212
  676. package/types/primeng-types-gallery.d.ts +195 -198
  677. package/types/primeng-types-iconfield.d.ts +12 -15
  678. package/types/primeng-types-iftalabel.d.ts +11 -14
  679. package/types/primeng-types-image.d.ts +118 -121
  680. package/types/primeng-types-imagecompare.d.ts +22 -25
  681. package/types/primeng-types-inplace.d.ts +46 -49
  682. package/types/primeng-types-inputcolor.d.ts +86 -89
  683. package/types/primeng-types-inputgroup.d.ts +11 -14
  684. package/types/primeng-types-inputgroupaddon.d.ts +11 -14
  685. package/types/primeng-types-inputicon.d.ts +11 -14
  686. package/types/primeng-types-inputmask.d.ts +30 -33
  687. package/types/primeng-types-inputnumber.d.ts +72 -75
  688. package/types/primeng-types-inputotp.d.ts +67 -70
  689. package/types/primeng-types-inputpassword.d.ts +7 -10
  690. package/types/primeng-types-inputtags.d.ts +122 -125
  691. package/types/primeng-types-inputtext.d.ts +7 -10
  692. package/types/primeng-types-knob.d.ts +23 -26
  693. package/types/primeng-types-label.d.ts +7 -10
  694. package/types/primeng-types-listbox.d.ts +262 -266
  695. package/types/primeng-types-megamenu.d.ts +135 -138
  696. package/types/primeng-types-menu.d.ts +98 -101
  697. package/types/primeng-types-menubar.d.ts +122 -125
  698. package/types/primeng-types-message.d.ts +69 -72
  699. package/types/primeng-types-metergroup.d.ts +137 -140
  700. package/types/primeng-types-motion.d.ts +11 -14
  701. package/types/primeng-types-multiselect.d.ts +329 -333
  702. package/types/primeng-types-orderlist.d.ts +126 -129
  703. package/types/primeng-types-organizationchart.d.ts +147 -153
  704. package/types/primeng-types-overlay.d.ts +31 -34
  705. package/types/primeng-types-overlaybadge.d.ts +17 -20
  706. package/types/primeng-types-paginator.d.ts +131 -134
  707. package/types/primeng-types-panel.d.ts +91 -95
  708. package/types/primeng-types-panelmenu.d.ts +150 -153
  709. package/types/primeng-types-password.d.ts +94 -97
  710. package/types/primeng-types-picklist.d.ts +250 -260
  711. package/types/primeng-types-popover.d.ts +33 -36
  712. package/types/primeng-types-progressbar.d.ts +33 -36
  713. package/types/primeng-types-progressspinner.d.ts +27 -30
  714. package/types/primeng-types-radiobutton.d.ts +29 -32
  715. package/types/primeng-types-rating.d.ts +62 -65
  716. package/types/primeng-types-scrollarea.d.ts +35 -38
  717. package/types/primeng-types-scroller.d.ts +142 -146
  718. package/types/primeng-types-scrollpanel.d.ts +31 -34
  719. package/types/primeng-types-scrolltop.d.ts +37 -40
  720. package/types/primeng-types-select.d.ts +251 -254
  721. package/types/primeng-types-selectbutton.d.ts +56 -59
  722. package/types/primeng-types-shared.d.ts +6 -9
  723. package/types/primeng-types-sidebar.d.ts +105 -108
  724. package/types/primeng-types-skeleton.d.ts +11 -14
  725. package/types/primeng-types-slider.d.ts +59 -62
  726. package/types/primeng-types-speeddial.d.ts +71 -74
  727. package/types/primeng-types-splitbutton.d.ts +35 -38
  728. package/types/primeng-types-splitter.d.ts +58 -63
  729. package/types/primeng-types-stepper.d.ts +77 -80
  730. package/types/primeng-types-table.d.ts +743 -749
  731. package/types/primeng-types-tabs.d.ts +48 -51
  732. package/types/primeng-types-tag.d.ts +27 -30
  733. package/types/primeng-types-terminal.d.ts +43 -46
  734. package/types/primeng-types-textarea.d.ts +11 -14
  735. package/types/primeng-types-tieredmenu.d.ts +154 -157
  736. package/types/primeng-types-timeline.d.ts +60 -63
  737. package/types/primeng-types-toast.d.ts +92 -95
  738. package/types/primeng-types-togglebutton.d.ts +52 -55
  739. package/types/primeng-types-toggleswitch.d.ts +41 -44
  740. package/types/primeng-types-toolbar.d.ts +34 -37
  741. package/types/primeng-types-tooltip.d.ts +17 -20
  742. package/types/primeng-types-tree.d.ts +237 -246
  743. package/types/primeng-types-treeselect.d.ts +198 -202
  744. package/types/primeng-types-treetable.d.ts +492 -497
  745. package/types/primeng-usestyle.d.ts +28 -31
  746. package/types/primeng-utils.d.ts +37 -40
  747. package/types/primeng.d.ts +2 -2
  748. package/fesm2022/primeng-icons.mjs.map +0 -1
  749. package/fesm2022/primeng-ts-helpers.mjs.map +0 -1
  750. package/fesm2022/primeng-types-accordion.mjs.map +0 -1
  751. package/fesm2022/primeng-types-autocomplete.mjs.map +0 -1
  752. package/fesm2022/primeng-types-avatar.mjs.map +0 -1
  753. package/fesm2022/primeng-types-avatargroup.mjs.map +0 -1
  754. package/fesm2022/primeng-types-badge.mjs.map +0 -1
  755. package/fesm2022/primeng-types-blockui.mjs.map +0 -1
  756. package/fesm2022/primeng-types-breadcrumb.mjs.map +0 -1
  757. package/fesm2022/primeng-types-button.mjs.map +0 -1
  758. package/fesm2022/primeng-types-card.mjs.map +0 -1
  759. package/fesm2022/primeng-types-carousel.mjs.map +0 -1
  760. package/fesm2022/primeng-types-cascadeselect.mjs.map +0 -1
  761. package/fesm2022/primeng-types-chart.mjs.map +0 -1
  762. package/fesm2022/primeng-types-checkbox.mjs.map +0 -1
  763. package/fesm2022/primeng-types-chip.mjs.map +0 -1
  764. package/fesm2022/primeng-types-colorpicker.mjs.map +0 -1
  765. package/fesm2022/primeng-types-commandmenu.mjs.map +0 -1
  766. package/fesm2022/primeng-types-compare.mjs.map +0 -1
  767. package/fesm2022/primeng-types-confirmdialog.mjs.map +0 -1
  768. package/fesm2022/primeng-types-confirmpopup.mjs.map +0 -1
  769. package/fesm2022/primeng-types-contextmenu.mjs.map +0 -1
  770. package/fesm2022/primeng-types-dataview.mjs.map +0 -1
  771. package/fesm2022/primeng-types-datepicker.mjs.map +0 -1
  772. package/fesm2022/primeng-types-dialog.mjs.map +0 -1
  773. package/fesm2022/primeng-types-divider.mjs.map +0 -1
  774. package/fesm2022/primeng-types-dock.mjs.map +0 -1
  775. package/fesm2022/primeng-types-drawer.mjs.map +0 -1
  776. package/fesm2022/primeng-types-editor.mjs.map +0 -1
  777. package/fesm2022/primeng-types-fieldset.mjs.map +0 -1
  778. package/fesm2022/primeng-types-fileupload.mjs.map +0 -1
  779. package/fesm2022/primeng-types-floatlabel.mjs.map +0 -1
  780. package/fesm2022/primeng-types-fluid.mjs.map +0 -1
  781. package/fesm2022/primeng-types-galleria.mjs.map +0 -1
  782. package/fesm2022/primeng-types-gallery.mjs.map +0 -1
  783. package/fesm2022/primeng-types-iconfield.mjs.map +0 -1
  784. package/fesm2022/primeng-types-iftalabel.mjs.map +0 -1
  785. package/fesm2022/primeng-types-image.mjs.map +0 -1
  786. package/fesm2022/primeng-types-imagecompare.mjs.map +0 -1
  787. package/fesm2022/primeng-types-inplace.mjs.map +0 -1
  788. package/fesm2022/primeng-types-inputcolor.mjs.map +0 -1
  789. package/fesm2022/primeng-types-inputgroup.mjs.map +0 -1
  790. package/fesm2022/primeng-types-inputgroupaddon.mjs.map +0 -1
  791. package/fesm2022/primeng-types-inputicon.mjs.map +0 -1
  792. package/fesm2022/primeng-types-inputmask.mjs.map +0 -1
  793. package/fesm2022/primeng-types-inputnumber.mjs.map +0 -1
  794. package/fesm2022/primeng-types-inputotp.mjs.map +0 -1
  795. package/fesm2022/primeng-types-inputpassword.mjs.map +0 -1
  796. package/fesm2022/primeng-types-inputtags.mjs.map +0 -1
  797. package/fesm2022/primeng-types-inputtext.mjs.map +0 -1
  798. package/fesm2022/primeng-types-knob.mjs.map +0 -1
  799. package/fesm2022/primeng-types-label.mjs.map +0 -1
  800. package/fesm2022/primeng-types-listbox.mjs.map +0 -1
  801. package/fesm2022/primeng-types-megamenu.mjs.map +0 -1
  802. package/fesm2022/primeng-types-menu.mjs.map +0 -1
  803. package/fesm2022/primeng-types-menubar.mjs.map +0 -1
  804. package/fesm2022/primeng-types-message.mjs.map +0 -1
  805. package/fesm2022/primeng-types-metergroup.mjs.map +0 -1
  806. package/fesm2022/primeng-types-motion.mjs.map +0 -1
  807. package/fesm2022/primeng-types-multiselect.mjs.map +0 -1
  808. package/fesm2022/primeng-types-orderlist.mjs.map +0 -1
  809. package/fesm2022/primeng-types-organizationchart.mjs.map +0 -1
  810. package/fesm2022/primeng-types-overlay.mjs.map +0 -1
  811. package/fesm2022/primeng-types-overlaybadge.mjs.map +0 -1
  812. package/fesm2022/primeng-types-paginator.mjs.map +0 -1
  813. package/fesm2022/primeng-types-panel.mjs.map +0 -1
  814. package/fesm2022/primeng-types-panelmenu.mjs.map +0 -1
  815. package/fesm2022/primeng-types-password.mjs.map +0 -1
  816. package/fesm2022/primeng-types-picklist.mjs.map +0 -1
  817. package/fesm2022/primeng-types-popover.mjs.map +0 -1
  818. package/fesm2022/primeng-types-progressbar.mjs.map +0 -1
  819. package/fesm2022/primeng-types-progressspinner.mjs.map +0 -1
  820. package/fesm2022/primeng-types-radiobutton.mjs.map +0 -1
  821. package/fesm2022/primeng-types-rating.mjs.map +0 -1
  822. package/fesm2022/primeng-types-scrollarea.mjs.map +0 -1
  823. package/fesm2022/primeng-types-scroller.mjs.map +0 -1
  824. package/fesm2022/primeng-types-scrollpanel.mjs.map +0 -1
  825. package/fesm2022/primeng-types-scrolltop.mjs.map +0 -1
  826. package/fesm2022/primeng-types-select.mjs.map +0 -1
  827. package/fesm2022/primeng-types-selectbutton.mjs.map +0 -1
  828. package/fesm2022/primeng-types-shared.mjs.map +0 -1
  829. package/fesm2022/primeng-types-sidebar.mjs.map +0 -1
  830. package/fesm2022/primeng-types-skeleton.mjs.map +0 -1
  831. package/fesm2022/primeng-types-slider.mjs.map +0 -1
  832. package/fesm2022/primeng-types-speeddial.mjs.map +0 -1
  833. package/fesm2022/primeng-types-splitbutton.mjs.map +0 -1
  834. package/fesm2022/primeng-types-splitter.mjs.map +0 -1
  835. package/fesm2022/primeng-types-stepper.mjs.map +0 -1
  836. package/fesm2022/primeng-types-table.mjs.map +0 -1
  837. package/fesm2022/primeng-types-tabs.mjs.map +0 -1
  838. package/fesm2022/primeng-types-tag.mjs.map +0 -1
  839. package/fesm2022/primeng-types-terminal.mjs.map +0 -1
  840. package/fesm2022/primeng-types-textarea.mjs.map +0 -1
  841. package/fesm2022/primeng-types-tieredmenu.mjs.map +0 -1
  842. package/fesm2022/primeng-types-timeline.mjs.map +0 -1
  843. package/fesm2022/primeng-types-toast.mjs.map +0 -1
  844. package/fesm2022/primeng-types-togglebutton.mjs.map +0 -1
  845. package/fesm2022/primeng-types-toggleswitch.mjs.map +0 -1
  846. package/fesm2022/primeng-types-toolbar.mjs.map +0 -1
  847. package/fesm2022/primeng-types-tooltip.mjs.map +0 -1
  848. package/fesm2022/primeng-types-tree.mjs.map +0 -1
  849. package/fesm2022/primeng-types-treeselect.mjs.map +0 -1
  850. package/fesm2022/primeng-types-treetable.mjs.map +0 -1
@@ -1,1418 +1,1428 @@
1
- export * from 'primeng/types/inputcolor';
2
- import * as i0 from '@angular/core';
3
- import { InjectionToken, inject, computed, ViewEncapsulation, ChangeDetectionStrategy, Component, input, booleanAttribute, effect, Directive, Injectable, forwardRef, signal, output, NgModule } from '@angular/core';
4
- import { NG_VALUE_ACCESSOR } from '@angular/forms';
5
- import { SharedModule } from 'primeng/api';
6
- import { BaseComponent, PARENT_INSTANCE } from 'primeng/basecomponent';
7
- import * as i1 from 'primeng/bind';
8
- import { Bind } from 'primeng/bind';
9
- import { isPlatformBrowser, NgTemplateOutlet } from '@angular/common';
10
- import { ButtonDirective, ButtonIcon } from 'primeng/button';
11
- import * as i1$1 from 'primeng/inputtext';
12
- import { InputText } from 'primeng/inputtext';
13
- import { style } from '@primeuix/styles/inputcolor';
14
- import { BaseStyle } from 'primeng/base';
15
-
1
+ import * as i0 from "@angular/core";
2
+ import { ChangeDetectionStrategy, Component, Directive, Injectable, InjectionToken, NgModule, ViewEncapsulation, booleanAttribute, computed, effect, forwardRef, inject, input, output, signal } from "@angular/core";
3
+ import { NG_VALUE_ACCESSOR } from "@angular/forms";
4
+ import { SharedModule } from "primeng/api";
5
+ import { BaseComponent, PARENT_INSTANCE } from "primeng/basecomponent";
6
+ import * as i1$1 from "primeng/bind";
7
+ import { Bind } from "primeng/bind";
8
+ import { NgTemplateOutlet, isPlatformBrowser } from "@angular/common";
9
+ import { ButtonDirective, ButtonIcon } from "primeng/button";
10
+ import * as i1 from "primeng/inputtext";
11
+ import { InputText } from "primeng/inputtext";
12
+ import { style } from "@primeuix/styles/inputcolor";
13
+ import { BaseStyle } from "primeng/base";
14
+ export * from "primeng/types/inputcolor";
16
15
  function clamp(value, min, max) {
17
- return Math.min(Math.max(value, min), max);
16
+ return Math.min(Math.max(value, min), max);
18
17
  }
19
18
  function round(value, decimals = 0) {
20
- const factor = Math.pow(10, decimals);
21
- return Math.round(value * factor) / factor;
19
+ const factor = Math.pow(10, decimals);
20
+ return Math.round(value * factor) / factor;
22
21
  }
23
22
  function multiplyMatrices(matrix, vector) {
24
- return [matrix[0] * vector[0] + matrix[1] * vector[1] + matrix[2] * vector[2], matrix[3] * vector[0] + matrix[4] * vector[1] + matrix[5] * vector[2], matrix[6] * vector[0] + matrix[7] * vector[1] + matrix[8] * vector[2]];
23
+ return [
24
+ matrix[0] * vector[0] + matrix[1] * vector[1] + matrix[2] * vector[2],
25
+ matrix[3] * vector[0] + matrix[4] * vector[1] + matrix[5] * vector[2],
26
+ matrix[6] * vector[0] + matrix[7] * vector[1] + matrix[8] * vector[2]
27
+ ];
25
28
  }
26
29
  function mod(n, m) {
27
- return ((n % m) + m) % m;
30
+ return (n % m + m) % m;
28
31
  }
29
- /**
30
- * Snaps a value to the nearest step increment within min/max bounds.
31
- * @example snap(23.7, 0, 100, 5) => 25
32
- * @example snap(0.234, 0, 1, 0.01) => 0.23
33
- */
34
32
  function snapValue(value, min, max, step) {
35
- const clamped = clamp(value, min, max);
36
- const offset = clamped - min;
37
- const steps = Math.round(offset / step);
38
- const snapped = min + steps * step;
39
- const precision = (step.toString().split('.')[1] || '').length;
40
- return parseFloat(snapped.toFixed(precision));
41
- }
42
- class Color {
43
- get alpha() {
44
- return this.getChannelValue('alpha');
45
- }
46
- getSpaceAxes(xyChannels) {
47
- const { xChannel, yChannel } = xyChannels;
48
- if (xChannel === yChannel) {
49
- throw new Error('xChannel and yChannel cannot be the same');
50
- }
51
- const zChannel = this.getChannels().find((channel) => channel !== xChannel && channel !== yChannel);
52
- if (!zChannel) {
53
- throw new Error('zChannel not found');
54
- }
55
- return { xChannel, yChannel, zChannel: zChannel };
56
- }
57
- incChannelValue(channel, step) {
58
- const range = this.getChannelRange(channel);
59
- const currentValue = this.getChannelValue(channel);
60
- const newValue = snapValue(clamp(currentValue + step, range.minValue, range.maxValue), range.minValue, range.maxValue, range.step);
61
- return this.setChannelValue(channel, newValue);
62
- }
63
- decChannelValue(channel, step) {
64
- return this.incChannelValue(channel, -step);
65
- }
66
- toHex() {
67
- const rgb = this.toRGB();
68
- const r = Math.round(rgb.red).toString(16).padStart(2, '0');
69
- const g = Math.round(rgb.green).toString(16).padStart(2, '0');
70
- const b = Math.round(rgb.blue).toString(16).padStart(2, '0');
71
- return `#${r}${g}${b}`;
72
- }
73
- toHexa() {
74
- const hex = this.toHex();
75
- if (this.alpha < 1) {
76
- const a = Math.round(this.alpha * 255)
77
- .toString(16)
78
- .padStart(2, '0');
79
- return `${hex}${a}`;
80
- }
81
- return hex;
82
- }
83
- toHexInt() {
84
- const rgb = this.toRGB();
85
- return (Math.round(rgb.red) << 16) | (Math.round(rgb.green) << 8) | Math.round(rgb.blue);
86
- }
87
- toRgbString() {
88
- const rgb = this.toRGB();
89
- const r = Math.round(rgb.red);
90
- const g = Math.round(rgb.green);
91
- const b = Math.round(rgb.blue);
92
- if (this.alpha < 1) {
93
- return `rgba(${r}, ${g}, ${b}, ${round(this.alpha, 2)})`;
94
- }
95
- return `rgb(${r}, ${g}, ${b})`;
96
- }
97
- toHslString() {
98
- const hsl = this.toHSL();
99
- const h = Math.round(hsl.hue) % 360;
100
- const s = Math.round(hsl.saturation);
101
- const l = Math.round(hsl.lightness);
102
- if (this.alpha < 1) {
103
- return `hsla(${h}, ${s}%, ${l}%, ${round(this.alpha, 2)})`;
104
- }
105
- return `hsl(${h}, ${s}%, ${l}%)`;
106
- }
107
- toHsbString() {
108
- const hsb = this.toHSB();
109
- const h = Math.round(hsb.hue) % 360;
110
- const s = Math.round(hsb.saturation);
111
- const b = Math.round(hsb.brightness);
112
- if (this.alpha < 1) {
113
- return `hsba(${h}, ${s}%, ${b}%, ${round(this.alpha, 2)})`;
114
- }
115
- return `hsb(${h}, ${s}%, ${b}%)`;
116
- }
117
- toString(format) {
118
- const f = format || this.colorSpace;
119
- switch (f) {
120
- case 'hex':
121
- return this.toHex();
122
- case 'hexa':
123
- return this.toHexa();
124
- case 'rgb':
125
- case 'rgba':
126
- return this.toRgbString();
127
- case 'hsl':
128
- case 'hsla':
129
- return this.toHslString();
130
- case 'hsb':
131
- case 'hsba':
132
- return this.toHsbString();
133
- case 'oklch':
134
- return this.toOKLCH().toString('oklch');
135
- case 'oklcha':
136
- return this.toOKLCH().toString('oklcha');
137
- case 'css':
138
- return this.toHex();
139
- default:
140
- return this.toHex();
141
- }
142
- }
143
- toFormat(format) {
144
- switch (format) {
145
- case 'hsba':
146
- return this.toHSB();
147
- case 'hsla':
148
- return this.toHSL();
149
- case 'rgba':
150
- return this.toRGB();
151
- case 'hexa':
152
- return this.toRGB();
153
- case 'oklch':
154
- return this.toOKLCH();
155
- default:
156
- return this.toHSB();
157
- }
158
- }
159
- }
160
- class HSBColor extends Color {
161
- hue;
162
- saturation;
163
- brightness;
164
- _alpha;
165
- colorSpace = 'hsba';
166
- constructor(hue, saturation, brightness, _alpha = 1) {
167
- super();
168
- this.hue = hue;
169
- this.saturation = saturation;
170
- this.brightness = brightness;
171
- this._alpha = _alpha;
172
- this.hue = hue >= 0 && hue <= 360 ? hue : mod(hue, 360);
173
- this.saturation = clamp(saturation, 0, 100);
174
- this.brightness = clamp(brightness, 0, 100);
175
- this._alpha = clamp(_alpha, 0, 1);
176
- }
177
- getChannelValue(channel) {
178
- switch (channel) {
179
- case 'hue':
180
- return this.hue;
181
- case 'saturation':
182
- return this.saturation;
183
- case 'brightness':
184
- return this.brightness;
185
- case 'alpha':
186
- return this._alpha;
187
- case 'lightness':
188
- return this.toHSL().getChannelValue(channel);
189
- case 'L':
190
- case 'C':
191
- case 'H':
192
- case 'oklchLightness':
193
- case 'oklchChroma':
194
- case 'oklchHue':
195
- return this.toOKLCH().getChannelValue(channel);
196
- default:
197
- return this.toRGB().getChannelValue(channel);
198
- }
199
- }
200
- setChannelValue(channel, value) {
201
- switch (channel) {
202
- case 'hue':
203
- return new HSBColor(value, this.saturation, this.brightness, this._alpha);
204
- case 'saturation':
205
- return new HSBColor(this.hue, value, this.brightness, this._alpha);
206
- case 'brightness':
207
- return new HSBColor(this.hue, this.saturation, value, this._alpha);
208
- case 'alpha':
209
- return new HSBColor(this.hue, this.saturation, this.brightness, value);
210
- case 'lightness': {
211
- const hsl = this.toHSL().setChannelValue(channel, value);
212
- return hsl.toHSB();
213
- }
214
- case 'L':
215
- case 'C':
216
- case 'H':
217
- case 'oklchLightness':
218
- case 'oklchChroma':
219
- // falls through
220
- case 'oklchHue': {
221
- const oklch = this.toOKLCH().setChannelValue(channel, value);
222
- return oklch.toHSB();
223
- }
224
- default: {
225
- const rgb = this.toRGB().setChannelValue(channel, value);
226
- return rgb.toHSB();
227
- }
228
- }
229
- }
230
- toHSB() {
231
- return this.clone();
232
- }
233
- toHSL() {
234
- const h = this.hue;
235
- const s = this.saturation / 100;
236
- const b = this.brightness / 100;
237
- const l = b * (1 - s / 2);
238
- const sl = l === 0 || l === 1 ? 0 : ((b - l) / Math.min(l, 1 - l)) * 100;
239
- return new HSLColor(h, sl, l * 100, this._alpha);
240
- }
241
- toRGB() {
242
- const h = this.hue / 360;
243
- const s = this.saturation / 100;
244
- const b = this.brightness / 100;
245
- let r, g, bl;
246
- const i = Math.floor(h * 6);
247
- const f = h * 6 - i;
248
- const p = b * (1 - s);
249
- const q = b * (1 - f * s);
250
- const t = b * (1 - (1 - f) * s);
251
- switch (i % 6) {
252
- case 0:
253
- r = b;
254
- g = t;
255
- bl = p;
256
- break;
257
- case 1:
258
- r = q;
259
- g = b;
260
- bl = p;
261
- break;
262
- case 2:
263
- r = p;
264
- g = b;
265
- bl = t;
266
- break;
267
- case 3:
268
- r = p;
269
- g = q;
270
- bl = b;
271
- break;
272
- case 4:
273
- r = t;
274
- g = p;
275
- bl = b;
276
- break;
277
- case 5:
278
- r = b;
279
- g = p;
280
- bl = q;
281
- break;
282
- default:
283
- r = 0;
284
- g = 0;
285
- bl = 0;
286
- }
287
- return new RGBColor(r * 255, g * 255, bl * 255, this._alpha);
288
- }
289
- toOKLCH() {
290
- return this.toRGB().toOKLCH();
291
- }
292
- clone() {
293
- return new HSBColor(this.hue, this.saturation, this.brightness, this._alpha);
294
- }
295
- toJSON() {
296
- return {
297
- hue: this.hue,
298
- saturation: this.saturation,
299
- brightness: this.brightness,
300
- alpha: this._alpha
301
- };
302
- }
303
- getFormat() {
304
- return 'hsba';
305
- }
306
- getChannels() {
307
- return ['hue', 'saturation', 'brightness'];
308
- }
309
- getChannelRange(channel) {
310
- switch (channel) {
311
- case 'hue':
312
- return { minValue: 0, maxValue: 360, step: 1, pageStep: 15 };
313
- case 'saturation':
314
- case 'brightness':
315
- return { minValue: 0, maxValue: 100, step: 1, pageStep: 10 };
316
- case 'alpha':
317
- return { minValue: 0, maxValue: 1, step: 0.01, pageStep: 0.1 };
318
- case 'lightness':
319
- return this.toHSL().getChannelRange(channel);
320
- case 'L':
321
- case 'C':
322
- case 'H':
323
- case 'oklchLightness':
324
- case 'oklchChroma':
325
- case 'oklchHue':
326
- return this.toOKLCH().getChannelRange(channel);
327
- case 'red':
328
- case 'green':
329
- case 'blue':
330
- return this.toRGB().getChannelRange(channel);
331
- default:
332
- throw new Error(`Unknown color channel: ${channel}`);
333
- }
334
- }
335
- }
336
- class HSLColor extends Color {
337
- hue;
338
- saturation;
339
- lightness;
340
- _alpha;
341
- colorSpace = 'hsla';
342
- constructor(hue, saturation, lightness, _alpha = 1) {
343
- super();
344
- this.hue = hue;
345
- this.saturation = saturation;
346
- this.lightness = lightness;
347
- this._alpha = _alpha;
348
- this.hue = hue >= 0 && hue <= 360 ? hue : mod(hue, 360);
349
- this.saturation = clamp(saturation, 0, 100);
350
- this.lightness = clamp(lightness, 0, 100);
351
- this._alpha = clamp(_alpha, 0, 1);
352
- }
353
- getChannelValue(channel) {
354
- switch (channel) {
355
- case 'hue':
356
- return this.hue;
357
- case 'saturation':
358
- return this.saturation;
359
- case 'lightness':
360
- return this.lightness;
361
- case 'alpha':
362
- return this._alpha;
363
- case 'brightness':
364
- return this.toHSB().getChannelValue(channel);
365
- case 'L':
366
- case 'C':
367
- case 'H':
368
- case 'oklchLightness':
369
- case 'oklchChroma':
370
- case 'oklchHue':
371
- return this.toOKLCH().getChannelValue(channel);
372
- default:
373
- return this.toRGB().getChannelValue(channel);
374
- }
375
- }
376
- setChannelValue(channel, value) {
377
- switch (channel) {
378
- case 'hue':
379
- return new HSLColor(value, this.saturation, this.lightness, this._alpha);
380
- case 'saturation':
381
- return new HSLColor(this.hue, value, this.lightness, this._alpha);
382
- case 'lightness':
383
- return new HSLColor(this.hue, this.saturation, value, this._alpha);
384
- case 'alpha':
385
- return new HSLColor(this.hue, this.saturation, this.lightness, value);
386
- case 'brightness': {
387
- const hsb = this.toHSB().setChannelValue(channel, value);
388
- return hsb.toHSL();
389
- }
390
- case 'L':
391
- case 'C':
392
- case 'H':
393
- case 'oklchLightness':
394
- case 'oklchChroma':
395
- // falls through
396
- case 'oklchHue': {
397
- const oklch = this.toOKLCH().setChannelValue(channel, value);
398
- return oklch.toHSL();
399
- }
400
- default: {
401
- const rgb = this.toRGB().setChannelValue(channel, value);
402
- return rgb.toHSL();
403
- }
404
- }
405
- }
406
- toHSB() {
407
- const h = this.hue;
408
- const s = this.saturation / 100;
409
- const l = this.lightness / 100;
410
- const b = l + s * Math.min(l, 1 - l);
411
- const sb = b === 0 ? 0 : 2 * (1 - l / b);
412
- return new HSBColor(h, sb * 100, b * 100, this._alpha);
413
- }
414
- toHSL() {
415
- return this.clone();
416
- }
417
- toRGB() {
418
- const h = this.hue;
419
- const s = this.saturation / 100;
420
- const l = this.lightness / 100;
421
- const a = s * Math.min(l, 1 - l);
422
- const f = (n) => {
423
- const k = (n + h / 30) % 12;
424
- return l - a * Math.max(Math.min(k - 3, 9 - k, 1), -1);
425
- };
426
- return new RGBColor(f(0) * 255, f(8) * 255, f(4) * 255, this._alpha);
427
- }
428
- toOKLCH() {
429
- return this.toRGB().toOKLCH();
430
- }
431
- clone() {
432
- return new HSLColor(this.hue, this.saturation, this.lightness, this._alpha);
433
- }
434
- toJSON() {
435
- return {
436
- hue: this.hue,
437
- saturation: this.saturation,
438
- lightness: this.lightness,
439
- alpha: this._alpha
440
- };
441
- }
442
- getFormat() {
443
- return 'hsla';
444
- }
445
- getChannels() {
446
- return ['hue', 'saturation', 'lightness'];
447
- }
448
- getChannelRange(channel) {
449
- switch (channel) {
450
- case 'hue':
451
- return { minValue: 0, maxValue: 360, step: 1, pageStep: 15 };
452
- case 'saturation':
453
- case 'lightness':
454
- return { minValue: 0, maxValue: 100, step: 1, pageStep: 10 };
455
- case 'alpha':
456
- return { minValue: 0, maxValue: 1, step: 0.01, pageStep: 0.1 };
457
- case 'brightness':
458
- return this.toHSB().getChannelRange(channel);
459
- case 'L':
460
- case 'C':
461
- case 'H':
462
- case 'oklchLightness':
463
- case 'oklchChroma':
464
- case 'oklchHue':
465
- return this.toOKLCH().getChannelRange(channel);
466
- case 'red':
467
- case 'green':
468
- case 'blue':
469
- return this.toRGB().getChannelRange(channel);
470
- default:
471
- throw new Error(`Unknown color channel: ${channel}`);
472
- }
473
- }
474
- }
475
- class RGBColor extends Color {
476
- red;
477
- green;
478
- blue;
479
- _alpha;
480
- colorSpace = 'rgba';
481
- constructor(red, green, blue, _alpha = 1) {
482
- super();
483
- this.red = red;
484
- this.green = green;
485
- this.blue = blue;
486
- this._alpha = _alpha;
487
- this.red = clamp(red, 0, 255);
488
- this.green = clamp(green, 0, 255);
489
- this.blue = clamp(blue, 0, 255);
490
- this._alpha = clamp(_alpha, 0, 1);
491
- }
492
- getChannelValue(channel) {
493
- switch (channel) {
494
- case 'red':
495
- return this.red;
496
- case 'green':
497
- return this.green;
498
- case 'blue':
499
- return this.blue;
500
- case 'alpha':
501
- return this._alpha;
502
- case 'hue':
503
- case 'saturation':
504
- case 'brightness':
505
- return this.toHSB().getChannelValue(channel);
506
- case 'lightness':
507
- return this.toHSL().getChannelValue(channel);
508
- case 'L':
509
- case 'C':
510
- case 'H':
511
- case 'oklchLightness':
512
- case 'oklchChroma':
513
- case 'oklchHue':
514
- return this.toOKLCH().getChannelValue(channel);
515
- default:
516
- return this.toHSB().getChannelValue(channel);
517
- }
518
- }
519
- setChannelValue(channel, value) {
520
- switch (channel) {
521
- case 'red':
522
- return new RGBColor(value, this.green, this.blue, this._alpha);
523
- case 'green':
524
- return new RGBColor(this.red, value, this.blue, this._alpha);
525
- case 'blue':
526
- return new RGBColor(this.red, this.green, value, this._alpha);
527
- case 'alpha':
528
- return new RGBColor(this.red, this.green, this.blue, value);
529
- case 'hue':
530
- case 'saturation':
531
- // falls through
532
- case 'brightness': {
533
- const hsb = this.toHSB().setChannelValue(channel, value);
534
- return hsb.toRGB();
535
- }
536
- case 'lightness': {
537
- const hsl = this.toHSL().setChannelValue(channel, value);
538
- return hsl.toRGB();
539
- }
540
- case 'L':
541
- case 'C':
542
- case 'H':
543
- case 'oklchLightness':
544
- case 'oklchChroma':
545
- // falls through
546
- case 'oklchHue': {
547
- const oklch = this.toOKLCH().setChannelValue(channel, value);
548
- return oklch.toRGB();
549
- }
550
- default: {
551
- const hsb = this.toHSB().setChannelValue(channel, value);
552
- return hsb.toRGB();
553
- }
554
- }
555
- }
556
- toHSB() {
557
- const r = this.red / 255;
558
- const g = this.green / 255;
559
- const b = this.blue / 255;
560
- const max = Math.max(r, g, b);
561
- const min = Math.min(r, g, b);
562
- const d = max - min;
563
- let h = 0;
564
- const s = max === 0 ? 0 : d / max;
565
- const v = max;
566
- if (d !== 0) {
567
- switch (max) {
568
- case r:
569
- h = ((g - b) / d + (g < b ? 6 : 0)) / 6;
570
- break;
571
- case g:
572
- h = ((b - r) / d + 2) / 6;
573
- break;
574
- case b:
575
- h = ((r - g) / d + 4) / 6;
576
- break;
577
- }
578
- }
579
- return new HSBColor(h * 360, s * 100, v * 100, this._alpha);
580
- }
581
- toHSL() {
582
- const r = this.red / 255;
583
- const g = this.green / 255;
584
- const b = this.blue / 255;
585
- const max = Math.max(r, g, b);
586
- const min = Math.min(r, g, b);
587
- const d = max - min;
588
- const l = (max + min) / 2;
589
- let h = 0;
590
- let s = 0;
591
- if (d !== 0) {
592
- s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
593
- switch (max) {
594
- case r:
595
- h = ((g - b) / d + (g < b ? 6 : 0)) / 6;
596
- break;
597
- case g:
598
- h = ((b - r) / d + 2) / 6;
599
- break;
600
- case b:
601
- h = ((r - g) / d + 4) / 6;
602
- break;
603
- }
604
- }
605
- return new HSLColor(h * 360, s * 100, l * 100, this._alpha);
606
- }
607
- toRGB() {
608
- return this.clone();
609
- }
610
- toOKLCH() {
611
- const rgb = [this.red / 255, this.green / 255, this.blue / 255];
612
- const rgbLinear = rgb.map((c) => (Math.abs(c) <= 0.04045 ? c / 12.92 : (c < 0 ? -1 : 1) * ((Math.abs(c) + 0.055) / 1.055) ** 2.4));
613
- const xyz = multiplyMatrices([0.41239079926595934, 0.357584339383878, 0.1804807884018343, 0.21263900587151027, 0.715168678767756, 0.07219231536073371, 0.01933081871559182, 0.11919477979462598, 0.9505321522496607], rgbLinear);
614
- const LMS = multiplyMatrices([0.819022437996703, 0.3619062600528904, -0.1288737815209879, 0.0329836539323885, 0.9292868615863434, 0.0361446663506424, 0.0481771893596242, 0.2642395317527308, 0.6335478284694309], xyz);
615
- const LMSg = LMS.map((val) => Math.cbrt(val));
616
- const [L, a, b] = multiplyMatrices([0.210454268309314, 0.7936177747023054, -0.0040720430116193, 1.9779985324311684, -2.4285922420485799, 0.450593709617411, 0.0259040424655478, 0.7827717124575296, -0.8086757549230774], LMSg);
617
- const C = Math.sqrt(a ** 2 + b ** 2);
618
- const H = Math.abs(a) < 0.0002 && Math.abs(b) < 0.0002 ? NaN : ((((Math.atan2(b, a) * 180) / Math.PI) % 360) + 360) % 360;
619
- const outL = Number(Math.min(1, Math.max(0, L)).toFixed(4));
620
- const outC = Number(C.toFixed(4));
621
- const outH = Number.isNaN(H) ? NaN : Number(H.toFixed(2));
622
- return new OKLCHColor(outL, outC, outH, Number(this._alpha.toFixed(2)));
623
- }
624
- clone() {
625
- return new RGBColor(this.red, this.green, this.blue, this._alpha);
626
- }
627
- toJSON() {
628
- return {
629
- red: this.red,
630
- green: this.green,
631
- blue: this.blue,
632
- alpha: this._alpha
633
- };
634
- }
635
- getFormat() {
636
- return 'rgba';
637
- }
638
- getChannels() {
639
- return ['red', 'green', 'blue'];
640
- }
641
- getChannelRange(channel) {
642
- switch (channel) {
643
- case 'red':
644
- case 'green':
645
- case 'blue':
646
- return { minValue: 0, maxValue: 255, step: 1, pageStep: 17 };
647
- case 'alpha':
648
- return { minValue: 0, maxValue: 1, step: 0.01, pageStep: 0.1 };
649
- case 'hue':
650
- case 'saturation':
651
- case 'brightness':
652
- return this.toHSB().getChannelRange(channel);
653
- case 'lightness':
654
- return this.toHSL().getChannelRange(channel);
655
- case 'L':
656
- case 'C':
657
- case 'H':
658
- case 'oklchLightness':
659
- case 'oklchChroma':
660
- case 'oklchHue':
661
- return this.toOKLCH().getChannelRange(channel);
662
- default:
663
- throw new Error(`Unknown color channel: ${channel}`);
664
- }
665
- }
666
- }
667
- class OKLCHColor extends Color {
668
- L;
669
- C;
670
- H;
671
- _alpha;
672
- colorSpace = 'oklch';
673
- constructor(L, C, H, _alpha = 1) {
674
- super();
675
- this.L = L;
676
- this.C = C;
677
- this.H = H;
678
- this._alpha = _alpha;
679
- this.L = clamp(L, 0, 1);
680
- this.C = clamp(C, 0, 0.4);
681
- this.H = Number.isNaN(H) ? NaN : H >= 0 && H <= 360 ? H : mod(H, 360);
682
- this._alpha = clamp(_alpha, 0, 1);
683
- }
684
- getChannelValue(channel) {
685
- switch (channel) {
686
- case 'L':
687
- case 'oklchLightness':
688
- return this.L;
689
- case 'C':
690
- case 'oklchChroma':
691
- return this.C;
692
- case 'H':
693
- case 'oklchHue':
694
- return this.H;
695
- case 'alpha':
696
- return this._alpha;
697
- default:
698
- return this.toRGB().getChannelValue(channel);
699
- }
700
- }
701
- setChannelValue(channel, value) {
702
- switch (channel) {
703
- case 'L':
704
- case 'oklchLightness':
705
- return new OKLCHColor(value, this.C, this.H, this._alpha);
706
- case 'C':
707
- case 'oklchChroma':
708
- return new OKLCHColor(this.L, value, this.H, this._alpha);
709
- case 'H':
710
- case 'oklchHue':
711
- return new OKLCHColor(this.L, this.C, value, this._alpha);
712
- case 'alpha':
713
- return new OKLCHColor(this.L, this.C, this.H, value);
714
- default: {
715
- const rgb = this.toRGB().setChannelValue(channel, value);
716
- return rgb.toOKLCH();
717
- }
718
- }
719
- }
720
- toHSB() {
721
- return this.toRGB().toHSB();
722
- }
723
- toHSL() {
724
- return this.toRGB().toHSL();
725
- }
726
- toRGB() {
727
- const hRad = (this.H * Math.PI) / 180;
728
- const a = Number.isNaN(this.H) ? 0 : this.C * Math.cos(hRad);
729
- const b = Number.isNaN(this.H) ? 0 : this.C * Math.sin(hRad);
730
- const l_ = this.L + 0.3963377774 * a + 0.2158037573 * b;
731
- const m_ = this.L - 0.1055613458 * a - 0.0638541728 * b;
732
- const s_ = this.L - 0.0894841775 * a - 1.291485548 * b;
733
- const l = l_ * l_ * l_;
734
- const m = m_ * m_ * m_;
735
- const s = s_ * s_ * s_;
736
- const lr = 4.0767416621 * l - 3.3077115913 * m + 0.2309699292 * s;
737
- const lg = -1.2684380046 * l + 2.6097574011 * m - 0.3413193965 * s;
738
- const lb = -0.0041960863 * l - 0.7034186147 * m + 1.707614701 * s;
739
- const toSrgb = (c) => {
740
- if (c <= 0.0031308)
741
- return c * 12.92;
742
- return 1.055 * Math.pow(c, 1 / 2.4) - 0.055;
743
- };
744
- return new RGBColor(clamp(toSrgb(lr) * 255, 0, 255), clamp(toSrgb(lg) * 255, 0, 255), clamp(toSrgb(lb) * 255, 0, 255), this._alpha);
745
- }
746
- toOKLCH() {
747
- return this.clone();
748
- }
749
- toString(format) {
750
- const f = format || this.colorSpace;
751
- switch (f) {
752
- case 'oklch': {
753
- const l = Number.isNaN(this.L) ? 0 : Number((this.L * 100).toFixed(2));
754
- const c = Number.isNaN(this.C) ? 0 : Number(this.C.toFixed(4));
755
- const h = Number.isNaN(this.H) ? 0 : Number(this.H.toFixed(2));
756
- return `oklch(${l}% ${c} ${h})`;
757
- }
758
- case 'oklcha':
759
- // falls through
760
- case 'css': {
761
- const l = Number.isNaN(this.L) ? 0 : Number((this.L * 100).toFixed(2));
762
- const c = Number.isNaN(this.C) ? 0 : Number(this.C.toFixed(4));
763
- const h = Number.isNaN(this.H) ? 0 : Number(this.H.toFixed(2));
764
- const a = Number.isNaN(this._alpha) ? 1 : Number(this._alpha.toFixed(2));
765
- return `oklch(${l}% ${c} ${h} / ${a})`;
766
- }
767
- default:
768
- return super.toString(f);
769
- }
770
- }
771
- clone() {
772
- return new OKLCHColor(this.L, this.C, this.H, this._alpha);
773
- }
774
- toJSON() {
775
- return {
776
- L: this.L,
777
- C: this.C,
778
- H: this.H,
779
- alpha: this._alpha
780
- };
781
- }
782
- getFormat() {
783
- return 'oklch';
784
- }
785
- getChannels() {
786
- return ['L', 'C', 'H'];
787
- }
788
- getChannelRange(channel) {
789
- switch (channel) {
790
- case 'L':
791
- case 'oklchLightness':
792
- return { minValue: 0, maxValue: 1, step: 0.01, pageStep: 0.1 };
793
- case 'C':
794
- case 'oklchChroma':
795
- return { minValue: 0, maxValue: 0.4, step: 0.01, pageStep: 0.05 };
796
- case 'H':
797
- case 'oklchHue':
798
- return { minValue: 0, maxValue: 360, step: 1, pageStep: 15 };
799
- case 'alpha':
800
- return { minValue: 0, maxValue: 1, step: 0.01, pageStep: 0.1 };
801
- case 'hue':
802
- case 'saturation':
803
- case 'brightness':
804
- return this.toHSB().getChannelRange(channel);
805
- case 'lightness':
806
- return this.toHSL().getChannelRange(channel);
807
- case 'red':
808
- case 'green':
809
- case 'blue':
810
- return this.toRGB().getChannelRange(channel);
811
- default:
812
- throw new Error(`Unknown color channel: ${channel}`);
813
- }
814
- }
33
+ const offset = clamp(value, min, max) - min;
34
+ const snapped = min + Math.round(offset / step) * step;
35
+ const precision = (step.toString().split(".")[1] || "").length;
36
+ return parseFloat(snapped.toFixed(precision));
815
37
  }
38
+ var Color = class {
39
+ get alpha() {
40
+ return this.getChannelValue("alpha");
41
+ }
42
+ getSpaceAxes(xyChannels) {
43
+ const { xChannel, yChannel } = xyChannels;
44
+ if (xChannel === yChannel) throw new Error("xChannel and yChannel cannot be the same");
45
+ const zChannel = this.getChannels().find((channel) => channel !== xChannel && channel !== yChannel);
46
+ if (!zChannel) throw new Error("zChannel not found");
47
+ return {
48
+ xChannel,
49
+ yChannel,
50
+ zChannel
51
+ };
52
+ }
53
+ incChannelValue(channel, step) {
54
+ const range = this.getChannelRange(channel);
55
+ const newValue = snapValue(clamp(this.getChannelValue(channel) + step, range.minValue, range.maxValue), range.minValue, range.maxValue, range.step);
56
+ return this.setChannelValue(channel, newValue);
57
+ }
58
+ decChannelValue(channel, step) {
59
+ return this.incChannelValue(channel, -step);
60
+ }
61
+ toHex() {
62
+ const rgb = this.toRGB();
63
+ return `#${Math.round(rgb.red).toString(16).padStart(2, "0")}${Math.round(rgb.green).toString(16).padStart(2, "0")}${Math.round(rgb.blue).toString(16).padStart(2, "0")}`;
64
+ }
65
+ toHexa() {
66
+ const hex = this.toHex();
67
+ if (this.alpha < 1) return `${hex}${Math.round(this.alpha * 255).toString(16).padStart(2, "0")}`;
68
+ return hex;
69
+ }
70
+ toHexInt() {
71
+ const rgb = this.toRGB();
72
+ return Math.round(rgb.red) << 16 | Math.round(rgb.green) << 8 | Math.round(rgb.blue);
73
+ }
74
+ toRgbString() {
75
+ const rgb = this.toRGB();
76
+ const r = Math.round(rgb.red);
77
+ const g = Math.round(rgb.green);
78
+ const b = Math.round(rgb.blue);
79
+ if (this.alpha < 1) return `rgba(${r}, ${g}, ${b}, ${round(this.alpha, 2)})`;
80
+ return `rgb(${r}, ${g}, ${b})`;
81
+ }
82
+ toHslString() {
83
+ const hsl = this.toHSL();
84
+ const h = Math.round(hsl.hue) % 360;
85
+ const s = Math.round(hsl.saturation);
86
+ const l = Math.round(hsl.lightness);
87
+ if (this.alpha < 1) return `hsla(${h}, ${s}%, ${l}%, ${round(this.alpha, 2)})`;
88
+ return `hsl(${h}, ${s}%, ${l}%)`;
89
+ }
90
+ toHsbString() {
91
+ const hsb = this.toHSB();
92
+ const h = Math.round(hsb.hue) % 360;
93
+ const s = Math.round(hsb.saturation);
94
+ const b = Math.round(hsb.brightness);
95
+ if (this.alpha < 1) return `hsba(${h}, ${s}%, ${b}%, ${round(this.alpha, 2)})`;
96
+ return `hsb(${h}, ${s}%, ${b}%)`;
97
+ }
98
+ toString(format) {
99
+ switch (format || this.colorSpace) {
100
+ case "hex": return this.toHex();
101
+ case "hexa": return this.toHexa();
102
+ case "rgb":
103
+ case "rgba": return this.toRgbString();
104
+ case "hsl":
105
+ case "hsla": return this.toHslString();
106
+ case "hsb":
107
+ case "hsba": return this.toHsbString();
108
+ case "oklch": return this.toOKLCH().toString("oklch");
109
+ case "oklcha": return this.toOKLCH().toString("oklcha");
110
+ case "css": return this.toHex();
111
+ default: return this.toHex();
112
+ }
113
+ }
114
+ toFormat(format) {
115
+ switch (format) {
116
+ case "hsba": return this.toHSB();
117
+ case "hsla": return this.toHSL();
118
+ case "rgba": return this.toRGB();
119
+ case "hexa": return this.toRGB();
120
+ case "oklch": return this.toOKLCH();
121
+ default: return this.toHSB();
122
+ }
123
+ }
124
+ };
125
+ var HSBColor = class HSBColor extends Color {
126
+ hue;
127
+ saturation;
128
+ brightness;
129
+ _alpha;
130
+ colorSpace = "hsba";
131
+ constructor(hue, saturation, brightness, _alpha = 1) {
132
+ super();
133
+ this.hue = hue;
134
+ this.saturation = saturation;
135
+ this.brightness = brightness;
136
+ this._alpha = _alpha;
137
+ this.hue = hue >= 0 && hue <= 360 ? hue : mod(hue, 360);
138
+ this.saturation = clamp(saturation, 0, 100);
139
+ this.brightness = clamp(brightness, 0, 100);
140
+ this._alpha = clamp(_alpha, 0, 1);
141
+ }
142
+ getChannelValue(channel) {
143
+ switch (channel) {
144
+ case "hue": return this.hue;
145
+ case "saturation": return this.saturation;
146
+ case "brightness": return this.brightness;
147
+ case "alpha": return this._alpha;
148
+ case "lightness": return this.toHSL().getChannelValue(channel);
149
+ case "L":
150
+ case "C":
151
+ case "H":
152
+ case "oklchLightness":
153
+ case "oklchChroma":
154
+ case "oklchHue": return this.toOKLCH().getChannelValue(channel);
155
+ default: return this.toRGB().getChannelValue(channel);
156
+ }
157
+ }
158
+ setChannelValue(channel, value) {
159
+ switch (channel) {
160
+ case "hue": return new HSBColor(value, this.saturation, this.brightness, this._alpha);
161
+ case "saturation": return new HSBColor(this.hue, value, this.brightness, this._alpha);
162
+ case "brightness": return new HSBColor(this.hue, this.saturation, value, this._alpha);
163
+ case "alpha": return new HSBColor(this.hue, this.saturation, this.brightness, value);
164
+ case "lightness": return this.toHSL().setChannelValue(channel, value).toHSB();
165
+ case "L":
166
+ case "C":
167
+ case "H":
168
+ case "oklchLightness":
169
+ case "oklchChroma":
170
+ case "oklchHue": return this.toOKLCH().setChannelValue(channel, value).toHSB();
171
+ default: return this.toRGB().setChannelValue(channel, value).toHSB();
172
+ }
173
+ }
174
+ toHSB() {
175
+ return this.clone();
176
+ }
177
+ toHSL() {
178
+ const h = this.hue;
179
+ const s = this.saturation / 100;
180
+ const b = this.brightness / 100;
181
+ const l = b * (1 - s / 2);
182
+ return new HSLColor(h, l === 0 || l === 1 ? 0 : (b - l) / Math.min(l, 1 - l) * 100, l * 100, this._alpha);
183
+ }
184
+ toRGB() {
185
+ const h = this.hue / 360;
186
+ const s = this.saturation / 100;
187
+ const b = this.brightness / 100;
188
+ let r, g, bl;
189
+ const i = Math.floor(h * 6);
190
+ const f = h * 6 - i;
191
+ const p = b * (1 - s);
192
+ const q = b * (1 - f * s);
193
+ const t = b * (1 - (1 - f) * s);
194
+ switch (i % 6) {
195
+ case 0:
196
+ r = b;
197
+ g = t;
198
+ bl = p;
199
+ break;
200
+ case 1:
201
+ r = q;
202
+ g = b;
203
+ bl = p;
204
+ break;
205
+ case 2:
206
+ r = p;
207
+ g = b;
208
+ bl = t;
209
+ break;
210
+ case 3:
211
+ r = p;
212
+ g = q;
213
+ bl = b;
214
+ break;
215
+ case 4:
216
+ r = t;
217
+ g = p;
218
+ bl = b;
219
+ break;
220
+ case 5:
221
+ r = b;
222
+ g = p;
223
+ bl = q;
224
+ break;
225
+ default:
226
+ r = 0;
227
+ g = 0;
228
+ bl = 0;
229
+ }
230
+ return new RGBColor(r * 255, g * 255, bl * 255, this._alpha);
231
+ }
232
+ toOKLCH() {
233
+ return this.toRGB().toOKLCH();
234
+ }
235
+ clone() {
236
+ return new HSBColor(this.hue, this.saturation, this.brightness, this._alpha);
237
+ }
238
+ toJSON() {
239
+ return {
240
+ hue: this.hue,
241
+ saturation: this.saturation,
242
+ brightness: this.brightness,
243
+ alpha: this._alpha
244
+ };
245
+ }
246
+ getFormat() {
247
+ return "hsba";
248
+ }
249
+ getChannels() {
250
+ return [
251
+ "hue",
252
+ "saturation",
253
+ "brightness"
254
+ ];
255
+ }
256
+ getChannelRange(channel) {
257
+ switch (channel) {
258
+ case "hue": return {
259
+ minValue: 0,
260
+ maxValue: 360,
261
+ step: 1,
262
+ pageStep: 15
263
+ };
264
+ case "saturation":
265
+ case "brightness": return {
266
+ minValue: 0,
267
+ maxValue: 100,
268
+ step: 1,
269
+ pageStep: 10
270
+ };
271
+ case "alpha": return {
272
+ minValue: 0,
273
+ maxValue: 1,
274
+ step: .01,
275
+ pageStep: .1
276
+ };
277
+ case "lightness": return this.toHSL().getChannelRange(channel);
278
+ case "L":
279
+ case "C":
280
+ case "H":
281
+ case "oklchLightness":
282
+ case "oklchChroma":
283
+ case "oklchHue": return this.toOKLCH().getChannelRange(channel);
284
+ case "red":
285
+ case "green":
286
+ case "blue": return this.toRGB().getChannelRange(channel);
287
+ default: throw new Error(`Unknown color channel: ${channel}`);
288
+ }
289
+ }
290
+ };
291
+ var HSLColor = class HSLColor extends Color {
292
+ hue;
293
+ saturation;
294
+ lightness;
295
+ _alpha;
296
+ colorSpace = "hsla";
297
+ constructor(hue, saturation, lightness, _alpha = 1) {
298
+ super();
299
+ this.hue = hue;
300
+ this.saturation = saturation;
301
+ this.lightness = lightness;
302
+ this._alpha = _alpha;
303
+ this.hue = hue >= 0 && hue <= 360 ? hue : mod(hue, 360);
304
+ this.saturation = clamp(saturation, 0, 100);
305
+ this.lightness = clamp(lightness, 0, 100);
306
+ this._alpha = clamp(_alpha, 0, 1);
307
+ }
308
+ getChannelValue(channel) {
309
+ switch (channel) {
310
+ case "hue": return this.hue;
311
+ case "saturation": return this.saturation;
312
+ case "lightness": return this.lightness;
313
+ case "alpha": return this._alpha;
314
+ case "brightness": return this.toHSB().getChannelValue(channel);
315
+ case "L":
316
+ case "C":
317
+ case "H":
318
+ case "oklchLightness":
319
+ case "oklchChroma":
320
+ case "oklchHue": return this.toOKLCH().getChannelValue(channel);
321
+ default: return this.toRGB().getChannelValue(channel);
322
+ }
323
+ }
324
+ setChannelValue(channel, value) {
325
+ switch (channel) {
326
+ case "hue": return new HSLColor(value, this.saturation, this.lightness, this._alpha);
327
+ case "saturation": return new HSLColor(this.hue, value, this.lightness, this._alpha);
328
+ case "lightness": return new HSLColor(this.hue, this.saturation, value, this._alpha);
329
+ case "alpha": return new HSLColor(this.hue, this.saturation, this.lightness, value);
330
+ case "brightness": return this.toHSB().setChannelValue(channel, value).toHSL();
331
+ case "L":
332
+ case "C":
333
+ case "H":
334
+ case "oklchLightness":
335
+ case "oklchChroma":
336
+ case "oklchHue": return this.toOKLCH().setChannelValue(channel, value).toHSL();
337
+ default: return this.toRGB().setChannelValue(channel, value).toHSL();
338
+ }
339
+ }
340
+ toHSB() {
341
+ const h = this.hue;
342
+ const s = this.saturation / 100;
343
+ const l = this.lightness / 100;
344
+ const b = l + s * Math.min(l, 1 - l);
345
+ return new HSBColor(h, (b === 0 ? 0 : 2 * (1 - l / b)) * 100, b * 100, this._alpha);
346
+ }
347
+ toHSL() {
348
+ return this.clone();
349
+ }
350
+ toRGB() {
351
+ const h = this.hue;
352
+ const s = this.saturation / 100;
353
+ const l = this.lightness / 100;
354
+ const a = s * Math.min(l, 1 - l);
355
+ const f = (n) => {
356
+ const k = (n + h / 30) % 12;
357
+ return l - a * Math.max(Math.min(k - 3, 9 - k, 1), -1);
358
+ };
359
+ return new RGBColor(f(0) * 255, f(8) * 255, f(4) * 255, this._alpha);
360
+ }
361
+ toOKLCH() {
362
+ return this.toRGB().toOKLCH();
363
+ }
364
+ clone() {
365
+ return new HSLColor(this.hue, this.saturation, this.lightness, this._alpha);
366
+ }
367
+ toJSON() {
368
+ return {
369
+ hue: this.hue,
370
+ saturation: this.saturation,
371
+ lightness: this.lightness,
372
+ alpha: this._alpha
373
+ };
374
+ }
375
+ getFormat() {
376
+ return "hsla";
377
+ }
378
+ getChannels() {
379
+ return [
380
+ "hue",
381
+ "saturation",
382
+ "lightness"
383
+ ];
384
+ }
385
+ getChannelRange(channel) {
386
+ switch (channel) {
387
+ case "hue": return {
388
+ minValue: 0,
389
+ maxValue: 360,
390
+ step: 1,
391
+ pageStep: 15
392
+ };
393
+ case "saturation":
394
+ case "lightness": return {
395
+ minValue: 0,
396
+ maxValue: 100,
397
+ step: 1,
398
+ pageStep: 10
399
+ };
400
+ case "alpha": return {
401
+ minValue: 0,
402
+ maxValue: 1,
403
+ step: .01,
404
+ pageStep: .1
405
+ };
406
+ case "brightness": return this.toHSB().getChannelRange(channel);
407
+ case "L":
408
+ case "C":
409
+ case "H":
410
+ case "oklchLightness":
411
+ case "oklchChroma":
412
+ case "oklchHue": return this.toOKLCH().getChannelRange(channel);
413
+ case "red":
414
+ case "green":
415
+ case "blue": return this.toRGB().getChannelRange(channel);
416
+ default: throw new Error(`Unknown color channel: ${channel}`);
417
+ }
418
+ }
419
+ };
420
+ var RGBColor = class RGBColor extends Color {
421
+ red;
422
+ green;
423
+ blue;
424
+ _alpha;
425
+ colorSpace = "rgba";
426
+ constructor(red, green, blue, _alpha = 1) {
427
+ super();
428
+ this.red = red;
429
+ this.green = green;
430
+ this.blue = blue;
431
+ this._alpha = _alpha;
432
+ this.red = clamp(red, 0, 255);
433
+ this.green = clamp(green, 0, 255);
434
+ this.blue = clamp(blue, 0, 255);
435
+ this._alpha = clamp(_alpha, 0, 1);
436
+ }
437
+ getChannelValue(channel) {
438
+ switch (channel) {
439
+ case "red": return this.red;
440
+ case "green": return this.green;
441
+ case "blue": return this.blue;
442
+ case "alpha": return this._alpha;
443
+ case "hue":
444
+ case "saturation":
445
+ case "brightness": return this.toHSB().getChannelValue(channel);
446
+ case "lightness": return this.toHSL().getChannelValue(channel);
447
+ case "L":
448
+ case "C":
449
+ case "H":
450
+ case "oklchLightness":
451
+ case "oklchChroma":
452
+ case "oklchHue": return this.toOKLCH().getChannelValue(channel);
453
+ default: return this.toHSB().getChannelValue(channel);
454
+ }
455
+ }
456
+ setChannelValue(channel, value) {
457
+ switch (channel) {
458
+ case "red": return new RGBColor(value, this.green, this.blue, this._alpha);
459
+ case "green": return new RGBColor(this.red, value, this.blue, this._alpha);
460
+ case "blue": return new RGBColor(this.red, this.green, value, this._alpha);
461
+ case "alpha": return new RGBColor(this.red, this.green, this.blue, value);
462
+ case "hue":
463
+ case "saturation":
464
+ case "brightness": return this.toHSB().setChannelValue(channel, value).toRGB();
465
+ case "lightness": return this.toHSL().setChannelValue(channel, value).toRGB();
466
+ case "L":
467
+ case "C":
468
+ case "H":
469
+ case "oklchLightness":
470
+ case "oklchChroma":
471
+ case "oklchHue": return this.toOKLCH().setChannelValue(channel, value).toRGB();
472
+ default: return this.toHSB().setChannelValue(channel, value).toRGB();
473
+ }
474
+ }
475
+ toHSB() {
476
+ const r = this.red / 255;
477
+ const g = this.green / 255;
478
+ const b = this.blue / 255;
479
+ const max = Math.max(r, g, b);
480
+ const d = max - Math.min(r, g, b);
481
+ let h = 0;
482
+ const s = max === 0 ? 0 : d / max;
483
+ const v = max;
484
+ if (d !== 0) switch (max) {
485
+ case r:
486
+ h = ((g - b) / d + (g < b ? 6 : 0)) / 6;
487
+ break;
488
+ case g:
489
+ h = ((b - r) / d + 2) / 6;
490
+ break;
491
+ case b: h = ((r - g) / d + 4) / 6;
492
+ }
493
+ return new HSBColor(h * 360, s * 100, v * 100, this._alpha);
494
+ }
495
+ toHSL() {
496
+ const r = this.red / 255;
497
+ const g = this.green / 255;
498
+ const b = this.blue / 255;
499
+ const max = Math.max(r, g, b);
500
+ const min = Math.min(r, g, b);
501
+ const d = max - min;
502
+ const l = (max + min) / 2;
503
+ let h = 0;
504
+ let s = 0;
505
+ if (d !== 0) {
506
+ s = l > .5 ? d / (2 - max - min) : d / (max + min);
507
+ switch (max) {
508
+ case r:
509
+ h = ((g - b) / d + (g < b ? 6 : 0)) / 6;
510
+ break;
511
+ case g:
512
+ h = ((b - r) / d + 2) / 6;
513
+ break;
514
+ case b: h = ((r - g) / d + 4) / 6;
515
+ }
516
+ }
517
+ return new HSLColor(h * 360, s * 100, l * 100, this._alpha);
518
+ }
519
+ toRGB() {
520
+ return this.clone();
521
+ }
522
+ toOKLCH() {
523
+ const [L, a, b] = multiplyMatrices([
524
+ .210454268309314,
525
+ .7936177747023054,
526
+ -.0040720430116193,
527
+ 1.9779985324311684,
528
+ -2.42859224204858,
529
+ .450593709617411,
530
+ .0259040424655478,
531
+ .7827717124575296,
532
+ -.8086757549230774
533
+ ], multiplyMatrices([
534
+ .819022437996703,
535
+ .3619062600528904,
536
+ -.1288737815209879,
537
+ .0329836539323885,
538
+ .9292868615863434,
539
+ .0361446663506424,
540
+ .0481771893596242,
541
+ .2642395317527308,
542
+ .6335478284694309
543
+ ], multiplyMatrices([
544
+ .41239079926595934,
545
+ .357584339383878,
546
+ .1804807884018343,
547
+ .21263900587151027,
548
+ .715168678767756,
549
+ .07219231536073371,
550
+ .01933081871559182,
551
+ .11919477979462598,
552
+ .9505321522496607
553
+ ], [
554
+ this.red / 255,
555
+ this.green / 255,
556
+ this.blue / 255
557
+ ].map((c) => Math.abs(c) <= .04045 ? c / 12.92 : (c < 0 ? -1 : 1) * ((Math.abs(c) + .055) / 1.055) ** 2.4))).map((val) => Math.cbrt(val)));
558
+ const C = Math.sqrt(a ** 2 + b ** 2);
559
+ const H = Math.abs(a) < 2e-4 && Math.abs(b) < 2e-4 ? NaN : (Math.atan2(b, a) * 180 / Math.PI % 360 + 360) % 360;
560
+ return new OKLCHColor(Number(Math.min(1, Math.max(0, L)).toFixed(4)), Number(C.toFixed(4)), Number.isNaN(H) ? NaN : Number(H.toFixed(2)), Number(this._alpha.toFixed(2)));
561
+ }
562
+ clone() {
563
+ return new RGBColor(this.red, this.green, this.blue, this._alpha);
564
+ }
565
+ toJSON() {
566
+ return {
567
+ red: this.red,
568
+ green: this.green,
569
+ blue: this.blue,
570
+ alpha: this._alpha
571
+ };
572
+ }
573
+ getFormat() {
574
+ return "rgba";
575
+ }
576
+ getChannels() {
577
+ return [
578
+ "red",
579
+ "green",
580
+ "blue"
581
+ ];
582
+ }
583
+ getChannelRange(channel) {
584
+ switch (channel) {
585
+ case "red":
586
+ case "green":
587
+ case "blue": return {
588
+ minValue: 0,
589
+ maxValue: 255,
590
+ step: 1,
591
+ pageStep: 17
592
+ };
593
+ case "alpha": return {
594
+ minValue: 0,
595
+ maxValue: 1,
596
+ step: .01,
597
+ pageStep: .1
598
+ };
599
+ case "hue":
600
+ case "saturation":
601
+ case "brightness": return this.toHSB().getChannelRange(channel);
602
+ case "lightness": return this.toHSL().getChannelRange(channel);
603
+ case "L":
604
+ case "C":
605
+ case "H":
606
+ case "oklchLightness":
607
+ case "oklchChroma":
608
+ case "oklchHue": return this.toOKLCH().getChannelRange(channel);
609
+ default: throw new Error(`Unknown color channel: ${channel}`);
610
+ }
611
+ }
612
+ };
613
+ var OKLCHColor = class OKLCHColor extends Color {
614
+ L;
615
+ C;
616
+ H;
617
+ _alpha;
618
+ colorSpace = "oklch";
619
+ constructor(L, C, H, _alpha = 1) {
620
+ super();
621
+ this.L = L;
622
+ this.C = C;
623
+ this.H = H;
624
+ this._alpha = _alpha;
625
+ this.L = clamp(L, 0, 1);
626
+ this.C = clamp(C, 0, .4);
627
+ this.H = Number.isNaN(H) ? NaN : H >= 0 && H <= 360 ? H : mod(H, 360);
628
+ this._alpha = clamp(_alpha, 0, 1);
629
+ }
630
+ getChannelValue(channel) {
631
+ switch (channel) {
632
+ case "L":
633
+ case "oklchLightness": return this.L;
634
+ case "C":
635
+ case "oklchChroma": return this.C;
636
+ case "H":
637
+ case "oklchHue": return this.H;
638
+ case "alpha": return this._alpha;
639
+ default: return this.toRGB().getChannelValue(channel);
640
+ }
641
+ }
642
+ setChannelValue(channel, value) {
643
+ switch (channel) {
644
+ case "L":
645
+ case "oklchLightness": return new OKLCHColor(value, this.C, this.H, this._alpha);
646
+ case "C":
647
+ case "oklchChroma": return new OKLCHColor(this.L, value, this.H, this._alpha);
648
+ case "H":
649
+ case "oklchHue": return new OKLCHColor(this.L, this.C, value, this._alpha);
650
+ case "alpha": return new OKLCHColor(this.L, this.C, this.H, value);
651
+ default: return this.toRGB().setChannelValue(channel, value).toOKLCH();
652
+ }
653
+ }
654
+ toHSB() {
655
+ return this.toRGB().toHSB();
656
+ }
657
+ toHSL() {
658
+ return this.toRGB().toHSL();
659
+ }
660
+ toRGB() {
661
+ const hRad = this.H * Math.PI / 180;
662
+ const a = Number.isNaN(this.H) ? 0 : this.C * Math.cos(hRad);
663
+ const b = Number.isNaN(this.H) ? 0 : this.C * Math.sin(hRad);
664
+ const l_ = this.L + .3963377774 * a + .2158037573 * b;
665
+ const m_ = this.L - .1055613458 * a - .0638541728 * b;
666
+ const s_ = this.L - .0894841775 * a - 1.291485548 * b;
667
+ const l = l_ * l_ * l_;
668
+ const m = m_ * m_ * m_;
669
+ const s = s_ * s_ * s_;
670
+ const lr = 4.0767416621 * l - 3.3077115913 * m + .2309699292 * s;
671
+ const lg = -1.2684380046 * l + 2.6097574011 * m - .3413193965 * s;
672
+ const lb = -.0041960863 * l - .7034186147 * m + 1.707614701 * s;
673
+ const toSrgb = (c) => {
674
+ if (c <= .0031308) return c * 12.92;
675
+ return 1.055 * Math.pow(c, 1 / 2.4) - .055;
676
+ };
677
+ return new RGBColor(clamp(toSrgb(lr) * 255, 0, 255), clamp(toSrgb(lg) * 255, 0, 255), clamp(toSrgb(lb) * 255, 0, 255), this._alpha);
678
+ }
679
+ toOKLCH() {
680
+ return this.clone();
681
+ }
682
+ toString(format) {
683
+ const f = format || this.colorSpace;
684
+ switch (f) {
685
+ case "oklch": return `oklch(${Number.isNaN(this.L) ? 0 : Number((this.L * 100).toFixed(2))}% ${Number.isNaN(this.C) ? 0 : Number(this.C.toFixed(4))} ${Number.isNaN(this.H) ? 0 : Number(this.H.toFixed(2))})`;
686
+ case "oklcha":
687
+ case "css": return `oklch(${Number.isNaN(this.L) ? 0 : Number((this.L * 100).toFixed(2))}% ${Number.isNaN(this.C) ? 0 : Number(this.C.toFixed(4))} ${Number.isNaN(this.H) ? 0 : Number(this.H.toFixed(2))} / ${Number.isNaN(this._alpha) ? 1 : Number(this._alpha.toFixed(2))})`;
688
+ default: return super.toString(f);
689
+ }
690
+ }
691
+ clone() {
692
+ return new OKLCHColor(this.L, this.C, this.H, this._alpha);
693
+ }
694
+ toJSON() {
695
+ return {
696
+ L: this.L,
697
+ C: this.C,
698
+ H: this.H,
699
+ alpha: this._alpha
700
+ };
701
+ }
702
+ getFormat() {
703
+ return "oklch";
704
+ }
705
+ getChannels() {
706
+ return [
707
+ "L",
708
+ "C",
709
+ "H"
710
+ ];
711
+ }
712
+ getChannelRange(channel) {
713
+ switch (channel) {
714
+ case "L":
715
+ case "oklchLightness": return {
716
+ minValue: 0,
717
+ maxValue: 1,
718
+ step: .01,
719
+ pageStep: .1
720
+ };
721
+ case "C":
722
+ case "oklchChroma": return {
723
+ minValue: 0,
724
+ maxValue: .4,
725
+ step: .01,
726
+ pageStep: .05
727
+ };
728
+ case "H":
729
+ case "oklchHue": return {
730
+ minValue: 0,
731
+ maxValue: 360,
732
+ step: 1,
733
+ pageStep: 15
734
+ };
735
+ case "alpha": return {
736
+ minValue: 0,
737
+ maxValue: 1,
738
+ step: .01,
739
+ pageStep: .1
740
+ };
741
+ case "hue":
742
+ case "saturation":
743
+ case "brightness": return this.toHSB().getChannelRange(channel);
744
+ case "lightness": return this.toHSL().getChannelRange(channel);
745
+ case "red":
746
+ case "green":
747
+ case "blue": return this.toRGB().getChannelRange(channel);
748
+ default: throw new Error(`Unknown color channel: ${channel}`);
749
+ }
750
+ }
751
+ };
816
752
  function parseColor(value) {
817
- if (!value)
818
- return null;
819
- if (value instanceof Color) {
820
- return value;
821
- }
822
- if (typeof value !== 'string')
823
- return null;
824
- const str = value.trim();
825
- const hexMatch = str.match(/^#?([0-9a-f]{3,8})$/i);
826
- if (hexMatch) {
827
- let hex = hexMatch[1];
828
- if (hex.length === 3) {
829
- hex = hex[0] + hex[0] + hex[1] + hex[1] + hex[2] + hex[2];
830
- }
831
- else if (hex.length === 4) {
832
- hex = hex[0] + hex[0] + hex[1] + hex[1] + hex[2] + hex[2] + hex[3] + hex[3];
833
- }
834
- if (hex.length === 6) {
835
- const r = parseInt(hex.substring(0, 2), 16);
836
- const g = parseInt(hex.substring(2, 4), 16);
837
- const b = parseInt(hex.substring(4, 6), 16);
838
- return new RGBColor(r, g, b, 1);
839
- }
840
- if (hex.length === 8) {
841
- const r = parseInt(hex.substring(0, 2), 16);
842
- const g = parseInt(hex.substring(2, 4), 16);
843
- const b = parseInt(hex.substring(4, 6), 16);
844
- const a = parseInt(hex.substring(6, 8), 16) / 255;
845
- return new RGBColor(r, g, b, a);
846
- }
847
- }
848
- const rgbMatch = str.match(/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*([\d.]+))?\s*\)$/i);
849
- if (rgbMatch) {
850
- return new RGBColor(parseInt(rgbMatch[1]), parseInt(rgbMatch[2]), parseInt(rgbMatch[3]), rgbMatch[4] !== undefined ? parseFloat(rgbMatch[4]) : 1);
851
- }
852
- const hslMatch = str.match(/^hsla?\(\s*([\d.]+)\s*,\s*([\d.]+)%?\s*,\s*([\d.]+)%?\s*(?:,\s*([\d.]+))?\s*\)$/i);
853
- if (hslMatch) {
854
- return new HSLColor(parseFloat(hslMatch[1]), parseFloat(hslMatch[2]), parseFloat(hslMatch[3]), hslMatch[4] !== undefined ? parseFloat(hslMatch[4]) : 1);
855
- }
856
- const hsbMatch = str.match(/^hsba?\(\s*([\d.]+)\s*,\s*([\d.]+)%?\s*,\s*([\d.]+)%?\s*(?:,\s*([\d.]+))?\s*\)$/i);
857
- if (hsbMatch) {
858
- return new HSBColor(parseFloat(hsbMatch[1]), parseFloat(hsbMatch[2]), parseFloat(hsbMatch[3]), hsbMatch[4] !== undefined ? parseFloat(hsbMatch[4]) : 1);
859
- }
860
- const oklchMatch = str.match(/^oklch\(\s*([\d.]+)(%?)\s+([\d.]+)\s+([\d.]+)\s*(?:\/\s*([\d.]+))?\s*\)$/i);
861
- if (oklchMatch) {
862
- const lVal = parseFloat(oklchMatch[1]);
863
- const l = oklchMatch[2] === '%' ? lVal / 100 : lVal;
864
- return new OKLCHColor(l, parseFloat(oklchMatch[3]), parseFloat(oklchMatch[4]), oklchMatch[5] !== undefined ? parseFloat(oklchMatch[5]) : 1);
865
- }
866
- return null;
753
+ if (!value) return null;
754
+ if (value instanceof Color) return value;
755
+ if (typeof value !== "string") return null;
756
+ const str = value.trim();
757
+ const hexMatch = str.match(/^#?([0-9a-f]{3,8})$/i);
758
+ if (hexMatch) {
759
+ let hex = hexMatch[1];
760
+ if (hex.length === 3) hex = hex[0] + hex[0] + hex[1] + hex[1] + hex[2] + hex[2];
761
+ else if (hex.length === 4) hex = hex[0] + hex[0] + hex[1] + hex[1] + hex[2] + hex[2] + hex[3] + hex[3];
762
+ if (hex.length === 6) return new RGBColor(parseInt(hex.substring(0, 2), 16), parseInt(hex.substring(2, 4), 16), parseInt(hex.substring(4, 6), 16), 1);
763
+ if (hex.length === 8) return new RGBColor(parseInt(hex.substring(0, 2), 16), parseInt(hex.substring(2, 4), 16), parseInt(hex.substring(4, 6), 16), parseInt(hex.substring(6, 8), 16) / 255);
764
+ }
765
+ const rgbMatch = str.match(/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*([\d.]+))?\s*\)$/i);
766
+ if (rgbMatch) return new RGBColor(parseInt(rgbMatch[1]), parseInt(rgbMatch[2]), parseInt(rgbMatch[3]), rgbMatch[4] !== void 0 ? parseFloat(rgbMatch[4]) : 1);
767
+ const hslMatch = str.match(/^hsla?\(\s*([\d.]+)\s*,\s*([\d.]+)%?\s*,\s*([\d.]+)%?\s*(?:,\s*([\d.]+))?\s*\)$/i);
768
+ if (hslMatch) return new HSLColor(parseFloat(hslMatch[1]), parseFloat(hslMatch[2]), parseFloat(hslMatch[3]), hslMatch[4] !== void 0 ? parseFloat(hslMatch[4]) : 1);
769
+ const hsbMatch = str.match(/^hsba?\(\s*([\d.]+)\s*,\s*([\d.]+)%?\s*,\s*([\d.]+)%?\s*(?:,\s*([\d.]+))?\s*\)$/i);
770
+ if (hsbMatch) return new HSBColor(parseFloat(hsbMatch[1]), parseFloat(hsbMatch[2]), parseFloat(hsbMatch[3]), hsbMatch[4] !== void 0 ? parseFloat(hsbMatch[4]) : 1);
771
+ const oklchMatch = str.match(/^oklch\(\s*([\d.]+)(%?)\s+([\d.]+)\s+([\d.]+)\s*(?:\/\s*([\d.]+))?\s*\)$/i);
772
+ if (oklchMatch) {
773
+ const lVal = parseFloat(oklchMatch[1]);
774
+ return new OKLCHColor(oklchMatch[2] === "%" ? lVal / 100 : lVal, parseFloat(oklchMatch[3]), parseFloat(oklchMatch[4]), oklchMatch[5] !== void 0 ? parseFloat(oklchMatch[5]) : 1);
775
+ }
776
+ return null;
867
777
  }
868
778
  function getChannelRange(channel) {
869
- switch (channel) {
870
- case 'hue':
871
- return { minValue: 0, maxValue: 360, step: 1, pageStep: 15 };
872
- case 'H':
873
- case 'oklchHue':
874
- return { minValue: 0, maxValue: 360, step: 1, pageStep: 15 };
875
- case 'saturation':
876
- case 'brightness':
877
- case 'lightness':
878
- return { minValue: 0, maxValue: 100, step: 1, pageStep: 10 };
879
- case 'red':
880
- case 'green':
881
- case 'blue':
882
- return { minValue: 0, maxValue: 255, step: 1, pageStep: 17 };
883
- case 'alpha':
884
- return { minValue: 0, maxValue: 1, step: 0.01, pageStep: 0.1 };
885
- case 'L':
886
- case 'oklchLightness':
887
- return { minValue: 0, maxValue: 1, step: 0.01, pageStep: 0.1 };
888
- case 'C':
889
- case 'oklchChroma':
890
- return { minValue: 0, maxValue: 0.4, step: 0.01, pageStep: 0.05 };
891
- default:
892
- return { minValue: 0, maxValue: 100, step: 1, pageStep: 10 };
893
- }
779
+ switch (channel) {
780
+ case "hue": return {
781
+ minValue: 0,
782
+ maxValue: 360,
783
+ step: 1,
784
+ pageStep: 15
785
+ };
786
+ case "H":
787
+ case "oklchHue": return {
788
+ minValue: 0,
789
+ maxValue: 360,
790
+ step: 1,
791
+ pageStep: 15
792
+ };
793
+ case "saturation":
794
+ case "brightness":
795
+ case "lightness": return {
796
+ minValue: 0,
797
+ maxValue: 100,
798
+ step: 1,
799
+ pageStep: 10
800
+ };
801
+ case "red":
802
+ case "green":
803
+ case "blue": return {
804
+ minValue: 0,
805
+ maxValue: 255,
806
+ step: 1,
807
+ pageStep: 17
808
+ };
809
+ case "alpha": return {
810
+ minValue: 0,
811
+ maxValue: 1,
812
+ step: .01,
813
+ pageStep: .1
814
+ };
815
+ case "L":
816
+ case "oklchLightness": return {
817
+ minValue: 0,
818
+ maxValue: 1,
819
+ step: .01,
820
+ pageStep: .1
821
+ };
822
+ case "C":
823
+ case "oklchChroma": return {
824
+ minValue: 0,
825
+ maxValue: .4,
826
+ step: .01,
827
+ pageStep: .05
828
+ };
829
+ default: return {
830
+ minValue: 0,
831
+ maxValue: 100,
832
+ step: 1,
833
+ pageStep: 10
834
+ };
835
+ }
894
836
  }
895
837
  function getInputChannelRange(channel) {
896
- if (channel === 'hex') {
897
- return { minValue: 0, maxValue: 0xffffff, step: 1, pageStep: 1 };
898
- }
899
- return getChannelRange(channel);
838
+ if (channel === "hex") return {
839
+ minValue: 0,
840
+ maxValue: 16777215,
841
+ step: 1,
842
+ pageStep: 1
843
+ };
844
+ return getChannelRange(channel);
900
845
  }
901
- function getChannelGradient(color, channel, orientation = 'horizontal') {
902
- const range = getChannelRange(channel);
903
- const direction = orientation === 'horizontal' ? 'right' : 'top';
904
- switch (channel) {
905
- case 'hue':
906
- case 'H':
907
- case 'oklchHue':
908
- return `linear-gradient(to ${direction}, rgb(255, 0, 0) 0%, rgb(255, 255, 0) 17%, rgb(0, 255, 0) 33%, rgb(0, 255, 255) 50%, rgb(0, 0, 255) 67%, rgb(255, 0, 255) 83%, rgb(255, 0, 0) 100%)`;
909
- case 'lightness':
910
- case 'L':
911
- // falls through
912
- case 'oklchLightness': {
913
- const start = color.setChannelValue(channel, range.minValue).toRgbString();
914
- const middle = color.setChannelValue(channel, (range.maxValue - range.minValue) / 2).toRgbString();
915
- const end = color.setChannelValue(channel, range.maxValue).toRgbString();
916
- return `linear-gradient(to ${direction}, ${start}, ${middle}, ${end})`;
917
- }
918
- case 'alpha': {
919
- const start = color.setChannelValue('alpha', range.minValue).toRgbString();
920
- const end = color.setChannelValue('alpha', range.maxValue).toRgbString();
921
- return `linear-gradient(to ${direction}, ${start}, ${end})`;
922
- }
923
- default: {
924
- const start = color.setChannelValue(channel, range.minValue).toRgbString();
925
- const end = color.setChannelValue(channel, range.maxValue).toRgbString();
926
- return `linear-gradient(to ${direction}, ${start}, ${end})`;
927
- }
928
- }
846
+ function getChannelGradient(color, channel, orientation = "horizontal") {
847
+ const range = getChannelRange(channel);
848
+ const direction = orientation === "horizontal" ? "right" : "top";
849
+ switch (channel) {
850
+ case "hue":
851
+ case "H":
852
+ case "oklchHue": return `linear-gradient(to ${direction}, rgb(255, 0, 0) 0%, rgb(255, 255, 0) 17%, rgb(0, 255, 0) 33%, rgb(0, 255, 255) 50%, rgb(0, 0, 255) 67%, rgb(255, 0, 255) 83%, rgb(255, 0, 0) 100%)`;
853
+ case "lightness":
854
+ case "L":
855
+ case "oklchLightness": return `linear-gradient(to ${direction}, ${color.setChannelValue(channel, range.minValue).toRgbString()}, ${color.setChannelValue(channel, (range.maxValue - range.minValue) / 2).toRgbString()}, ${color.setChannelValue(channel, range.maxValue).toRgbString()})`;
856
+ case "alpha": return `linear-gradient(to ${direction}, ${color.setChannelValue("alpha", range.minValue).toRgbString()}, ${color.setChannelValue("alpha", range.maxValue).toRgbString()})`;
857
+ default: return `linear-gradient(to ${direction}, ${color.setChannelValue(channel, range.minValue).toRgbString()}, ${color.setChannelValue(channel, range.maxValue).toRgbString()})`;
858
+ }
929
859
  }
930
860
  const channelGenerators = {
931
- hue: (color) => [0, 60, 120, 180, 240, 300, 360].map((h) => color.setChannelValue('hue', h).toRgbString()).join(', '),
932
- saturation: (color) => `${color.setChannelValue('saturation', 0).toRgbString()}, transparent`,
933
- lightness: () => 'black, transparent, white',
934
- brightness: () => 'black, transparent'
861
+ hue: (color) => [
862
+ 0,
863
+ 60,
864
+ 120,
865
+ 180,
866
+ 240,
867
+ 300,
868
+ 360
869
+ ].map((h) => color.setChannelValue("hue", h).toRgbString()).join(", "),
870
+ saturation: (color) => `${color.setChannelValue("saturation", 0).toRgbString()}, transparent`,
871
+ lightness: () => "black, transparent, white",
872
+ brightness: () => "black, transparent"
935
873
  };
936
874
  function getAreaGradient(color, xChannel, yChannel, format) {
937
- const axes3d = getDefault3DAxes(format);
938
- const zChannel = axes3d.zChannel;
939
- const zValue = color.getChannelValue(zChannel);
940
- const isHSL = format === 'hsla';
941
- let base;
942
- if (isHSL) {
943
- base = parseColor('hsl(0, 100%, 50%)').setChannelValue(zChannel, zValue);
944
- }
945
- else {
946
- base = parseColor('hsb(0, 100%, 100%)').setChannelValue(zChannel, zValue);
947
- }
948
- const channels = [xChannel, yChannel];
949
- const direction = (c) => (c === xChannel ? 'right' : 'top');
950
- const layers = channels
951
- .map((c) => {
952
- const gen = channelGenerators[c];
953
- if (!gen)
954
- return null;
955
- return `linear-gradient(to ${direction(c)}, ${gen(base)})`;
956
- })
957
- .filter(Boolean)
958
- .reverse();
959
- const isHueZ = zChannel === 'hue' || zChannel === 'H' || zChannel === 'oklchHue';
960
- if (isHueZ) {
961
- layers.push(base.toRgbString());
962
- }
963
- return layers.join(', ');
875
+ const zChannel = getDefault3DAxes(format).zChannel;
876
+ const zValue = color.getChannelValue(zChannel);
877
+ const isHSL = format === "hsla";
878
+ let base;
879
+ if (isHSL) base = parseColor("hsl(0, 100%, 50%)").setChannelValue(zChannel, zValue);
880
+ else base = parseColor("hsb(0, 100%, 100%)").setChannelValue(zChannel, zValue);
881
+ const channels = [xChannel, yChannel];
882
+ const direction = (c) => c === xChannel ? "right" : "top";
883
+ const layers = channels.map((c) => {
884
+ const gen = channelGenerators[c];
885
+ if (!gen) return null;
886
+ return `linear-gradient(to ${direction(c)}, ${gen(base)})`;
887
+ }).filter(Boolean).reverse();
888
+ if (zChannel === "hue" || zChannel === "H" || zChannel === "oklchHue") layers.push(base.toRgbString());
889
+ return layers.join(", ");
964
890
  }
965
891
  function getChannelColor(color, channel) {
966
- switch (channel) {
967
- case 'hue':
968
- return parseColor(`hsl(${color.getChannelValue('hue')}, 100%, 50%)`);
969
- case 'red':
970
- case 'green':
971
- case 'blue':
972
- case 'lightness':
973
- case 'brightness':
974
- case 'saturation':
975
- return color.setChannelValue('alpha', 1);
976
- case 'alpha':
977
- return color;
978
- default:
979
- return color.setChannelValue('alpha', 1);
980
- }
892
+ switch (channel) {
893
+ case "hue": return parseColor(`hsl(${color.getChannelValue("hue")}, 100%, 50%)`);
894
+ case "red":
895
+ case "green":
896
+ case "blue":
897
+ case "lightness":
898
+ case "brightness":
899
+ case "saturation": return color.setChannelValue("alpha", 1);
900
+ case "alpha": return color;
901
+ default: return color.setChannelValue("alpha", 1);
902
+ }
981
903
  }
982
904
  function toCssString(color, format) {
983
- const a = round(color.alpha, 2);
984
- switch (format) {
985
- case 'rgba':
986
- // falls through
987
- case 'hexa': {
988
- const rgb = color.toRGB();
989
- return `rgba(${Math.round(rgb.red)}, ${Math.round(rgb.green)}, ${Math.round(rgb.blue)}, ${a})`;
990
- }
991
- case 'hsla': {
992
- const hsl = color.toHSL();
993
- return `hsla(${Math.round(hsl.hue) % 360}, ${hsl.saturation.toFixed(2)}%, ${hsl.lightness.toFixed(2)}%, ${a})`;
994
- }
995
- case 'hsba': {
996
- // CSS doesn't support hsb, convert to hsl
997
- const hsl = color.toHSL();
998
- return `hsla(${Math.round(hsl.hue) % 360}, ${hsl.saturation.toFixed(2)}%, ${hsl.lightness.toFixed(2)}%, ${a})`;
999
- }
1000
- case 'oklch': {
1001
- return color.toOKLCH().toString('css');
1002
- }
1003
- default:
1004
- return color.toOKLCH().toString('css');
1005
- }
905
+ const a = round(color.alpha, 2);
906
+ switch (format) {
907
+ case "rgba":
908
+ case "hexa": {
909
+ const rgb = color.toRGB();
910
+ return `rgba(${Math.round(rgb.red)}, ${Math.round(rgb.green)}, ${Math.round(rgb.blue)}, ${a})`;
911
+ }
912
+ case "hsla": {
913
+ const hsl = color.toHSL();
914
+ return `hsla(${Math.round(hsl.hue) % 360}, ${hsl.saturation.toFixed(2)}%, ${hsl.lightness.toFixed(2)}%, ${a})`;
915
+ }
916
+ case "hsba": {
917
+ const hsl = color.toHSL();
918
+ return `hsla(${Math.round(hsl.hue) % 360}, ${hsl.saturation.toFixed(2)}%, ${hsl.lightness.toFixed(2)}%, ${a})`;
919
+ }
920
+ case "oklch": return color.toOKLCH().toString("css");
921
+ default: return color.toOKLCH().toString("css");
922
+ }
1006
923
  }
1007
- function getInputChannelValue(color, channel, format = 'hsba') {
1008
- if (channel === 'hex') {
1009
- const alphaRange = getChannelRange('alpha');
1010
- if (color.alpha < alphaRange.maxValue) {
1011
- return color.toHexa();
1012
- }
1013
- return color.toHex();
1014
- }
1015
- if (channel === 'css') {
1016
- return toCssString(color, format);
1017
- }
1018
- const value = color.getChannelValue(channel);
1019
- if (Number.isNaN(value))
1020
- return 'NaN';
1021
- const range = getChannelRange(channel);
1022
- if (channel === 'H' || channel === 'oklchHue') {
1023
- const rounded = round(value, 2);
1024
- return rounded.toString();
1025
- }
1026
- if (channel === 'hue') {
1027
- const rounded = Math.round(value);
1028
- return rounded.toString();
1029
- }
1030
- if (range.step >= 1) {
1031
- return Math.round(value).toString();
1032
- }
1033
- return round(value, 4).toString();
924
+ function getInputChannelValue(color, channel, format = "hsba") {
925
+ if (channel === "hex") {
926
+ const alphaRange = getChannelRange("alpha");
927
+ if (color.alpha < alphaRange.maxValue) return color.toHexa();
928
+ return color.toHex();
929
+ }
930
+ if (channel === "css") return toCssString(color, format);
931
+ const value = color.getChannelValue(channel);
932
+ if (Number.isNaN(value)) return "NaN";
933
+ const range = getChannelRange(channel);
934
+ if (channel === "H" || channel === "oklchHue") return round(value, 2).toString();
935
+ if (channel === "hue") return Math.round(value).toString();
936
+ if (range.step >= 1) return Math.round(value).toString();
937
+ return round(value, 4).toString();
1034
938
  }
1035
939
  function getDefault2DAxes(format) {
1036
- switch (format) {
1037
- case 'hsla':
1038
- return { xChannel: 'saturation', yChannel: 'lightness' };
1039
- case 'hsba':
1040
- case 'rgba':
1041
- case 'oklch':
1042
- default:
1043
- return { xChannel: 'saturation', yChannel: 'brightness' };
1044
- }
940
+ switch (format) {
941
+ case "hsla": return {
942
+ xChannel: "saturation",
943
+ yChannel: "lightness"
944
+ };
945
+ default: return {
946
+ xChannel: "saturation",
947
+ yChannel: "brightness"
948
+ };
949
+ }
1045
950
  }
1046
951
  function getDefault3DAxes(format) {
1047
- switch (format) {
1048
- case 'hsla':
1049
- return { xChannel: 'saturation', yChannel: 'lightness', zChannel: 'hue' };
1050
- case 'hsba':
1051
- case 'rgba':
1052
- case 'oklch':
1053
- default:
1054
- return { xChannel: 'saturation', yChannel: 'brightness', zChannel: 'hue' };
1055
- }
1056
- }
1057
-
1058
- const INPUT_COLOR_INSTANCE = new InjectionToken('INPUT_COLOR_INSTANCE');
1059
- const INPUT_COLOR_SLIDER_INSTANCE = new InjectionToken('INPUT_COLOR_SLIDER_INSTANCE');
1060
-
1061
- /**
1062
- * InputColorArea is a helper component for InputColor component.
1063
- * @group Components
1064
- */
1065
- class InputColorArea extends BaseComponent {
1066
- componentName = 'InputColorArea';
1067
- bindDirectiveInstance = inject(Bind, { self: true });
1068
- $pc = inject(INPUT_COLOR_INSTANCE);
1069
- $xChannel = computed(() => this.$pc.$axes().xChannel, /* @ts-ignore */
1070
- ...(ngDevMode ? [{ debugName: "$xChannel" }] : /* istanbul ignore next */ []));
1071
- $yChannel = computed(() => this.$pc.$axes().yChannel, /* @ts-ignore */
1072
- ...(ngDevMode ? [{ debugName: "$yChannel" }] : /* istanbul ignore next */ []));
1073
- $areaGradient = computed(() => {
1074
- const color = this.$pc.$color();
1075
- const xCh = this.$xChannel();
1076
- const yCh = this.$yChannel();
1077
- const format = this.$pc.format();
1078
- return getAreaGradient(color, xCh, yCh, format);
1079
- }, /* @ts-ignore */
1080
- ...(ngDevMode ? [{ debugName: "$areaGradient" }] : /* istanbul ignore next */ []));
1081
- $handleBackground = computed(() => this.$pc.$color().setChannelValue('alpha', 1).toRgbString(), /* @ts-ignore */
1082
- ...(ngDevMode ? [{ debugName: "$handleBackground" }] : /* istanbul ignore next */ []));
1083
- $handleLeft = computed(() => {
1084
- const xCh = this.$xChannel();
1085
- const range = getChannelRange(xCh);
1086
- const value = this.$pc.$color().getChannelValue(xCh);
1087
- const pct = ((value - range.minValue) / (range.maxValue - range.minValue)) * 100;
1088
- return `${pct}%`;
1089
- }, /* @ts-ignore */
1090
- ...(ngDevMode ? [{ debugName: "$handleLeft" }] : /* istanbul ignore next */ []));
1091
- $handleTop = computed(() => {
1092
- const yCh = this.$yChannel();
1093
- const range = getChannelRange(yCh);
1094
- const value = this.$pc.$color().getChannelValue(yCh);
1095
- const pct = (1 - (value - range.minValue) / (range.maxValue - range.minValue)) * 100;
1096
- return `${pct}%`;
1097
- }, /* @ts-ignore */
1098
- ...(ngDevMode ? [{ debugName: "$handleTop" }] : /* istanbul ignore next */ []));
1099
- dragging = false;
1100
- dragOffset = { x: 0, y: 0 };
1101
- cleanupDrag = null;
1102
- onAfterViewChecked() {
1103
- this.bindDirectiveInstance.setAttrs(this.ptms(['host', 'root']));
1104
- }
1105
- onPointerDown(event) {
1106
- if (this.$pc.$disabled())
1107
- return;
1108
- event.preventDefault();
1109
- this.dragging = true;
1110
- const el = this.el.nativeElement;
1111
- el.setPointerCapture(event.pointerId);
1112
- const handle = event.target?.closest('[data-pc-section="areahandle"], .p-inputcolor-area-handle');
1113
- if (handle) {
1114
- const handleRect = handle.getBoundingClientRect();
1115
- this.dragOffset = {
1116
- x: event.clientX - (handleRect.left + handleRect.width / 2),
1117
- y: event.clientY - (handleRect.top + handleRect.height / 2)
1118
- };
1119
- }
1120
- else {
1121
- this.dragOffset = { x: 0, y: 0 };
1122
- }
1123
- this.updateFromPointer(event);
1124
- const onMove = (e) => {
1125
- if (!this.dragging)
1126
- return;
1127
- e.preventDefault();
1128
- this.updateFromPointer(e);
1129
- };
1130
- const cleanup = () => {
1131
- this.dragging = false;
1132
- this.cleanupDrag = null;
1133
- el.removeEventListener('pointermove', onMove);
1134
- el.removeEventListener('pointerup', onUp);
1135
- el.removeEventListener('pointercancel', onCancel);
1136
- el.removeEventListener('lostpointercapture', onLostCapture);
1137
- };
1138
- this.cleanupDrag = cleanup;
1139
- const onUp = (e) => {
1140
- if (!this.dragging)
1141
- return;
1142
- this.updateFromPointer(e, true);
1143
- this.dragOffset = { x: 0, y: 0 };
1144
- cleanup();
1145
- };
1146
- const onCancel = () => {
1147
- cleanup();
1148
- };
1149
- const onLostCapture = () => {
1150
- cleanup();
1151
- };
1152
- el.addEventListener('pointermove', onMove);
1153
- el.addEventListener('pointerup', onUp);
1154
- el.addEventListener('pointercancel', onCancel);
1155
- el.addEventListener('lostpointercapture', onLostCapture);
1156
- }
1157
- ngOnDestroy() {
1158
- this.cleanupDrag?.();
1159
- }
1160
- updateFromPointer(event, isEnd = false) {
1161
- const el = this.el.nativeElement;
1162
- const rect = el.getBoundingClientRect();
1163
- const xPercent = Math.max(0, Math.min(1, (event.clientX - this.dragOffset.x - rect.left) / rect.width));
1164
- const yPercent = Math.max(0, Math.min(1, (event.clientY - this.dragOffset.y - rect.top) / rect.height));
1165
- const xCh = this.$xChannel();
1166
- const yCh = this.$yChannel();
1167
- const xRange = getChannelRange(xCh);
1168
- const yRange = getChannelRange(yCh);
1169
- const xValue = snapValue(xRange.minValue + xPercent * (xRange.maxValue - xRange.minValue), xRange.minValue, xRange.maxValue, xRange.step);
1170
- const yValue = snapValue(yRange.maxValue - yPercent * (yRange.maxValue - yRange.minValue), yRange.minValue, yRange.maxValue, yRange.step);
1171
- const nativeColor = this.$pc.toChannelNativeFormat(this.$pc.$color(), xCh);
1172
- let color = nativeColor.setChannelValue(xCh, xValue);
1173
- color = color.setChannelValue(yCh, yValue);
1174
- this.$pc.updateColor(color, event, isEnd);
1175
- }
1176
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: InputColorArea, deps: null, target: i0.ɵɵFactoryTarget.Component });
1177
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "22.1.5", type: InputColorArea, isStandalone: true, selector: "p-inputcolor-area", host: { listeners: { "pointerdown": "onPointerDown($event)" }, properties: { "class": "$pc.cx(\"area\")", "style.--px-area-gradient": "$areaGradient()", "style.--px-handle-background": "$handleBackground()", "style.--px-handle-position-left": "$handleLeft()", "style.--px-handle-position-top": "$handleTop()" } }, providers: [{ provide: PARENT_INSTANCE, useExisting: InputColorArea }], usesInheritance: true, hostDirectives: [{ directive: i1.Bind }], ngImport: i0, template: `<ng-content></ng-content>`, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
1178
- }
1179
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: InputColorArea, decorators: [{
1180
- type: Component,
1181
- args: [{
1182
- selector: 'p-inputcolor-area',
1183
- standalone: true,
1184
- template: `<ng-content></ng-content>`,
1185
- changeDetection: ChangeDetectionStrategy.OnPush,
1186
- encapsulation: ViewEncapsulation.None,
1187
- host: {
1188
- '[class]': '$pc.cx("area")',
1189
- '[style.--px-area-gradient]': '$areaGradient()',
1190
- '[style.--px-handle-background]': '$handleBackground()',
1191
- '[style.--px-handle-position-left]': '$handleLeft()',
1192
- '[style.--px-handle-position-top]': '$handleTop()',
1193
- '(pointerdown)': 'onPointerDown($event)'
1194
- },
1195
- providers: [{ provide: PARENT_INSTANCE, useExisting: InputColorArea }],
1196
- hostDirectives: [Bind]
1197
- }]
1198
- }] });
1199
-
1200
- /**
1201
- * InputColorAreaBackground is a helper component for InputColor component.
1202
- * @group Components
1203
- */
1204
- class InputColorAreaBackground extends BaseComponent {
1205
- componentName = 'InputColorAreaBackground';
1206
- bindDirectiveInstance = inject(Bind, { self: true });
1207
- $pc = inject(INPUT_COLOR_INSTANCE);
1208
- onAfterViewChecked() {
1209
- this.bindDirectiveInstance.setAttrs(this.ptms(['host', 'root']));
1210
- }
1211
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: InputColorAreaBackground, deps: null, target: i0.ɵɵFactoryTarget.Component });
1212
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "22.1.5", type: InputColorAreaBackground, isStandalone: true, selector: "p-inputcolor-area-background", host: { properties: { "class": "$pc.cx(\"areaBackground\")" } }, providers: [{ provide: PARENT_INSTANCE, useExisting: InputColorAreaBackground }], usesInheritance: true, hostDirectives: [{ directive: i1.Bind }], ngImport: i0, template: `<ng-content></ng-content>`, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
1213
- }
1214
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: InputColorAreaBackground, decorators: [{
1215
- type: Component,
1216
- args: [{
1217
- selector: 'p-inputcolor-area-background',
1218
- standalone: true,
1219
- template: `<ng-content></ng-content>`,
1220
- changeDetection: ChangeDetectionStrategy.OnPush,
1221
- encapsulation: ViewEncapsulation.None,
1222
- host: {
1223
- '[class]': '$pc.cx("areaBackground")'
1224
- },
1225
- providers: [{ provide: PARENT_INSTANCE, useExisting: InputColorAreaBackground }],
1226
- hostDirectives: [Bind]
1227
- }]
1228
- }] });
1229
-
1230
- /**
1231
- * InputColorAreaHandle is a helper component for InputColor component.
1232
- * @group Components
1233
- */
1234
- class InputColorAreaHandle extends BaseComponent {
1235
- componentName = 'InputColorAreaHandle';
1236
- bindDirectiveInstance = inject(Bind, { self: true });
1237
- $pc = inject(INPUT_COLOR_INSTANCE);
1238
- $xChannel = computed(() => this.$pc.$axes().xChannel, /* @ts-ignore */
1239
- ...(ngDevMode ? [{ debugName: "$xChannel" }] : /* istanbul ignore next */ []));
1240
- $yChannel = computed(() => this.$pc.$axes().yChannel, /* @ts-ignore */
1241
- ...(ngDevMode ? [{ debugName: "$yChannel" }] : /* istanbul ignore next */ []));
1242
- $xRange = computed(() => getChannelRange(this.$xChannel()), /* @ts-ignore */
1243
- ...(ngDevMode ? [{ debugName: "$xRange" }] : /* istanbul ignore next */ []));
1244
- $yRange = computed(() => getChannelRange(this.$yChannel()), /* @ts-ignore */
1245
- ...(ngDevMode ? [{ debugName: "$yRange" }] : /* istanbul ignore next */ []));
1246
- $xValue = computed(() => this.$pc.$color().getChannelValue(this.$xChannel()), /* @ts-ignore */
1247
- ...(ngDevMode ? [{ debugName: "$xValue" }] : /* istanbul ignore next */ []));
1248
- $yValue = computed(() => this.$pc.$color().getChannelValue(this.$yChannel()), /* @ts-ignore */
1249
- ...(ngDevMode ? [{ debugName: "$yValue" }] : /* istanbul ignore next */ []));
1250
- $xMin = computed(() => this.$xRange().minValue, /* @ts-ignore */
1251
- ...(ngDevMode ? [{ debugName: "$xMin" }] : /* istanbul ignore next */ []));
1252
- $xMax = computed(() => this.$xRange().maxValue, /* @ts-ignore */
1253
- ...(ngDevMode ? [{ debugName: "$xMax" }] : /* istanbul ignore next */ []));
1254
- $tabindex = computed(() => (this.$pc.$disabled() ? -1 : 0), /* @ts-ignore */
1255
- ...(ngDevMode ? [{ debugName: "$tabindex" }] : /* istanbul ignore next */ []));
1256
- $ariaDisabled = computed(() => this.$pc.$disabled() || undefined, /* @ts-ignore */
1257
- ...(ngDevMode ? [{ debugName: "$ariaDisabled" }] : /* istanbul ignore next */ []));
1258
- $ariaValueText = computed(() => {
1259
- const xCh = this.$xChannel();
1260
- const yCh = this.$yChannel();
1261
- return `${xCh} ${this.$xValue()}, ${yCh} ${this.$yValue()}`;
1262
- }, /* @ts-ignore */
1263
- ...(ngDevMode ? [{ debugName: "$ariaValueText" }] : /* istanbul ignore next */ []));
1264
- onAfterViewChecked() {
1265
- this.bindDirectiveInstance.setAttrs(this.ptms(['host', 'root']));
1266
- }
1267
- onKeyDown(event) {
1268
- if (this.$pc.$disabled())
1269
- return;
1270
- const xCh = this.$xChannel();
1271
- const yCh = this.$yChannel();
1272
- const xRange = this.$xRange();
1273
- const yRange = this.$yRange();
1274
- let xVal = this.$xValue();
1275
- let yVal = this.$yValue();
1276
- let handled = false;
1277
- switch (event.key) {
1278
- case 'ArrowRight':
1279
- xVal = Math.min(xVal + xRange.step, xRange.maxValue);
1280
- handled = true;
1281
- break;
1282
- case 'ArrowLeft':
1283
- xVal = Math.max(xVal - xRange.step, xRange.minValue);
1284
- handled = true;
1285
- break;
1286
- case 'ArrowUp':
1287
- yVal = Math.min(yVal + yRange.step, yRange.maxValue);
1288
- handled = true;
1289
- break;
1290
- case 'ArrowDown':
1291
- yVal = Math.max(yVal - yRange.step, yRange.minValue);
1292
- handled = true;
1293
- break;
1294
- case 'PageUp':
1295
- yVal = Math.min(yVal + yRange.pageStep, yRange.maxValue);
1296
- handled = true;
1297
- break;
1298
- case 'PageDown':
1299
- yVal = Math.max(yVal - yRange.pageStep, yRange.minValue);
1300
- handled = true;
1301
- break;
1302
- case 'Home':
1303
- xVal = xRange.minValue;
1304
- handled = true;
1305
- break;
1306
- case 'End':
1307
- xVal = xRange.maxValue;
1308
- handled = true;
1309
- break;
1310
- }
1311
- if (handled) {
1312
- event.preventDefault();
1313
- const nativeColor = this.$pc.toChannelNativeFormat(this.$pc.$color(), xCh);
1314
- let color = nativeColor.setChannelValue(xCh, xVal);
1315
- color = color.setChannelValue(yCh, yVal);
1316
- this.$pc.updateColor(color, event, true);
1317
- }
1318
- }
1319
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: InputColorAreaHandle, deps: null, target: i0.ɵɵFactoryTarget.Component });
1320
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "22.1.5", type: InputColorAreaHandle, isStandalone: true, selector: "p-inputcolor-area-handle", host: { listeners: { "keydown": "onKeyDown($event)" }, properties: { "class": "$pc.cx(\"areaHandle\")", "attr.role": "'slider'", "attr.tabindex": "$tabindex()", "attr.aria-label": "'Color'", "attr.aria-roledescription": "'2d slider'", "attr.aria-disabled": "$ariaDisabled()", "attr.aria-valuemin": "$xMin()", "attr.aria-valuemax": "$xMax()", "attr.aria-valuenow": "$xValue()", "attr.aria-valuetext": "$ariaValueText()" } }, providers: [{ provide: PARENT_INSTANCE, useExisting: InputColorAreaHandle }], usesInheritance: true, hostDirectives: [{ directive: i1.Bind }], ngImport: i0, template: `<ng-content></ng-content>`, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
952
+ switch (format) {
953
+ case "hsla": return {
954
+ xChannel: "saturation",
955
+ yChannel: "lightness",
956
+ zChannel: "hue"
957
+ };
958
+ default: return {
959
+ xChannel: "saturation",
960
+ yChannel: "brightness",
961
+ zChannel: "hue"
962
+ };
963
+ }
1321
964
  }
1322
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: InputColorAreaHandle, decorators: [{
1323
- type: Component,
1324
- args: [{
1325
- selector: 'p-inputcolor-area-handle',
1326
- standalone: true,
1327
- template: `<ng-content></ng-content>`,
1328
- changeDetection: ChangeDetectionStrategy.OnPush,
1329
- encapsulation: ViewEncapsulation.None,
1330
- host: {
1331
- '[class]': '$pc.cx("areaHandle")',
1332
- '[attr.role]': "'slider'",
1333
- '[attr.tabindex]': '$tabindex()',
1334
- '[attr.aria-label]': "'Color'",
1335
- '[attr.aria-roledescription]': "'2d slider'",
1336
- '[attr.aria-disabled]': '$ariaDisabled()',
1337
- '[attr.aria-valuemin]': '$xMin()',
1338
- '[attr.aria-valuemax]': '$xMax()',
1339
- '[attr.aria-valuenow]': '$xValue()',
1340
- '[attr.aria-valuetext]': '$ariaValueText()',
1341
- '(keydown)': 'onKeyDown($event)'
1342
- },
1343
- providers: [{ provide: PARENT_INSTANCE, useExisting: InputColorAreaHandle }],
1344
- hostDirectives: [Bind]
1345
- }]
1346
- }] });
1347
-
1348
- /**
1349
- * InputColorEyeDropper is a helper component for InputColor component.
1350
- * @group Components
1351
- */
1352
- class InputColorEyeDropper extends BaseComponent {
1353
- componentName = 'InputColorEyeDropper';
1354
- bindDirectiveInstance = inject(Bind, { self: true });
1355
- $pc = inject(INPUT_COLOR_INSTANCE);
1356
- /**
1357
- * Whether to display button as text.
1358
- * @group Props
1359
- */
1360
- text = input(false, /* @ts-ignore */
1361
- ...(ngDevMode ? [{ debugName: "text" }] : /* istanbul ignore next */ []));
1362
- /**
1363
- * Whether to display a rounded button.
1364
- * @group Props
1365
- */
1366
- rounded = input(false, /* @ts-ignore */
1367
- ...(ngDevMode ? [{ debugName: "rounded" }] : /* istanbul ignore next */ []));
1368
- /**
1369
- * Whether to display button as outlined.
1370
- * @group Props
1371
- */
1372
- outlined = input(false, /* @ts-ignore */
1373
- ...(ngDevMode ? [{ debugName: "outlined" }] : /* istanbul ignore next */ []));
1374
- /**
1375
- * Whether to display an icon-only button.
1376
- * @group Props
1377
- */
1378
- iconOnly = input(false, /* @ts-ignore */
1379
- ...(ngDevMode ? [{ debugName: "iconOnly" }] : /* istanbul ignore next */ []));
1380
- /**
1381
- * Defines the color severity of the button.
1382
- * @group Props
1383
- */
1384
- severity = input(undefined, /* @ts-ignore */
1385
- ...(ngDevMode ? [{ debugName: "severity" }] : /* istanbul ignore next */ []));
1386
- /**
1387
- * Defines the size of the button.
1388
- * @group Props
1389
- */
1390
- size = input(undefined, /* @ts-ignore */
1391
- ...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
1392
- onAfterViewChecked() {
1393
- this.bindDirectiveInstance.setAttrs(this.ptms(['host', 'root']));
1394
- }
1395
- async onPickColor(event) {
1396
- if (this.$pc.$disabled())
1397
- return;
1398
- if (!isPlatformBrowser(this.platformId))
1399
- return;
1400
- try {
1401
- const eyeDropper = new window.EyeDropper();
1402
- const result = await eyeDropper.open();
1403
- if (result?.sRGBHex) {
1404
- const parsed = parseColor(result.sRGBHex);
1405
- if (parsed) {
1406
- this.$pc.updateColor(parsed, event, true);
1407
- }
1408
- }
1409
- }
1410
- catch {
1411
- // User cancelled or API not available
1412
- }
1413
- }
1414
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: InputColorEyeDropper, deps: null, target: i0.ɵɵFactoryTarget.Component });
1415
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.5", type: InputColorEyeDropper, isStandalone: true, selector: "p-inputcolor-eyedropper", inputs: { text: { classPropertyName: "text", publicName: "text", isSignal: true, isRequired: false, transformFunction: null }, rounded: { classPropertyName: "rounded", publicName: "rounded", isSignal: true, isRequired: false, transformFunction: null }, outlined: { classPropertyName: "outlined", publicName: "outlined", isSignal: true, isRequired: false, transformFunction: null }, iconOnly: { classPropertyName: "iconOnly", publicName: "iconOnly", isSignal: true, isRequired: false, transformFunction: null }, severity: { classPropertyName: "severity", publicName: "severity", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "$pc.cx(\"eyeDropper\")" } }, providers: [{ provide: PARENT_INSTANCE, useExisting: InputColorEyeDropper }], usesInheritance: true, hostDirectives: [{ directive: i1.Bind }], ngImport: i0, template: `
965
+ const INPUT_COLOR_INSTANCE = new InjectionToken("INPUT_COLOR_INSTANCE");
966
+ const INPUT_COLOR_SLIDER_INSTANCE = new InjectionToken("INPUT_COLOR_SLIDER_INSTANCE");
967
+ var InputColorArea = class InputColorArea extends BaseComponent {
968
+ componentName = "InputColorArea";
969
+ bindDirectiveInstance = inject(Bind, { self: true });
970
+ $pc = inject(INPUT_COLOR_INSTANCE);
971
+ $xChannel = computed(() => this.$pc.$axes().xChannel, ...ngDevMode ? [{ debugName: "$xChannel" }] : /* istanbul ignore next */ []);
972
+ $yChannel = computed(() => this.$pc.$axes().yChannel, ...ngDevMode ? [{ debugName: "$yChannel" }] : /* istanbul ignore next */ []);
973
+ $areaGradient = computed(() => {
974
+ return getAreaGradient(this.$pc.$color(), this.$xChannel(), this.$yChannel(), this.$pc.format());
975
+ }, ...ngDevMode ? [{ debugName: "$areaGradient" }] : /* istanbul ignore next */ []);
976
+ $handleBackground = computed(() => this.$pc.$color().setChannelValue("alpha", 1).toRgbString(), ...ngDevMode ? [{ debugName: "$handleBackground" }] : /* istanbul ignore next */ []);
977
+ $handleLeft = computed(() => {
978
+ const xCh = this.$xChannel();
979
+ const range = getChannelRange(xCh);
980
+ return `${(this.$pc.$color().getChannelValue(xCh) - range.minValue) / (range.maxValue - range.minValue) * 100}%`;
981
+ }, ...ngDevMode ? [{ debugName: "$handleLeft" }] : /* istanbul ignore next */ []);
982
+ $handleTop = computed(() => {
983
+ const yCh = this.$yChannel();
984
+ const range = getChannelRange(yCh);
985
+ return `${(1 - (this.$pc.$color().getChannelValue(yCh) - range.minValue) / (range.maxValue - range.minValue)) * 100}%`;
986
+ }, ...ngDevMode ? [{ debugName: "$handleTop" }] : /* istanbul ignore next */ []);
987
+ dragging = false;
988
+ dragOffset = {
989
+ x: 0,
990
+ y: 0
991
+ };
992
+ cleanupDrag = null;
993
+ onAfterViewChecked() {
994
+ this.bindDirectiveInstance.setAttrs(this.ptms(["host", "root"]));
995
+ }
996
+ onPointerDown(event) {
997
+ if (this.$pc.$disabled()) return;
998
+ event.preventDefault();
999
+ this.dragging = true;
1000
+ const el = this.el.nativeElement;
1001
+ el.setPointerCapture(event.pointerId);
1002
+ const handle = event.target?.closest("[data-pc-section=\"areahandle\"], .p-inputcolor-area-handle");
1003
+ if (handle) {
1004
+ const handleRect = handle.getBoundingClientRect();
1005
+ this.dragOffset = {
1006
+ x: event.clientX - (handleRect.left + handleRect.width / 2),
1007
+ y: event.clientY - (handleRect.top + handleRect.height / 2)
1008
+ };
1009
+ } else this.dragOffset = {
1010
+ x: 0,
1011
+ y: 0
1012
+ };
1013
+ this.updateFromPointer(event);
1014
+ const onMove = (e) => {
1015
+ if (!this.dragging) return;
1016
+ e.preventDefault();
1017
+ this.updateFromPointer(e);
1018
+ };
1019
+ const cleanup = () => {
1020
+ this.dragging = false;
1021
+ this.cleanupDrag = null;
1022
+ el.removeEventListener("pointermove", onMove);
1023
+ el.removeEventListener("pointerup", onUp);
1024
+ el.removeEventListener("pointercancel", onCancel);
1025
+ el.removeEventListener("lostpointercapture", onLostCapture);
1026
+ };
1027
+ this.cleanupDrag = cleanup;
1028
+ const onUp = (e) => {
1029
+ if (!this.dragging) return;
1030
+ this.updateFromPointer(e, true);
1031
+ this.dragOffset = {
1032
+ x: 0,
1033
+ y: 0
1034
+ };
1035
+ cleanup();
1036
+ };
1037
+ const onCancel = () => {
1038
+ cleanup();
1039
+ };
1040
+ const onLostCapture = () => {
1041
+ cleanup();
1042
+ };
1043
+ el.addEventListener("pointermove", onMove);
1044
+ el.addEventListener("pointerup", onUp);
1045
+ el.addEventListener("pointercancel", onCancel);
1046
+ el.addEventListener("lostpointercapture", onLostCapture);
1047
+ }
1048
+ ngOnDestroy() {
1049
+ this.cleanupDrag?.();
1050
+ }
1051
+ updateFromPointer(event, isEnd = false) {
1052
+ const rect = this.el.nativeElement.getBoundingClientRect();
1053
+ const xPercent = Math.max(0, Math.min(1, (event.clientX - this.dragOffset.x - rect.left) / rect.width));
1054
+ const yPercent = Math.max(0, Math.min(1, (event.clientY - this.dragOffset.y - rect.top) / rect.height));
1055
+ const xCh = this.$xChannel();
1056
+ const yCh = this.$yChannel();
1057
+ const xRange = getChannelRange(xCh);
1058
+ const yRange = getChannelRange(yCh);
1059
+ const xValue = snapValue(xRange.minValue + xPercent * (xRange.maxValue - xRange.minValue), xRange.minValue, xRange.maxValue, xRange.step);
1060
+ const yValue = snapValue(yRange.maxValue - yPercent * (yRange.maxValue - yRange.minValue), yRange.minValue, yRange.maxValue, yRange.step);
1061
+ let color = this.$pc.toChannelNativeFormat(this.$pc.$color(), xCh).setChannelValue(xCh, xValue);
1062
+ color = color.setChannelValue(yCh, yValue);
1063
+ this.$pc.updateColor(color, event, isEnd);
1064
+ }
1065
+ static ɵfac = i0.ɵɵngDeclareFactory({
1066
+ minVersion: "12.0.0",
1067
+ version: "22.2.0",
1068
+ ngImport: i0,
1069
+ type: InputColorArea,
1070
+ deps: null,
1071
+ target: i0.ɵɵFactoryTarget.Component
1072
+ });
1073
+ static ɵcmp = i0.ɵɵngDeclareComponent({
1074
+ minVersion: "14.0.0",
1075
+ version: "22.2.0",
1076
+ type: InputColorArea,
1077
+ isStandalone: true,
1078
+ selector: "p-inputcolor-area",
1079
+ host: {
1080
+ listeners: { "pointerdown": "onPointerDown($event)" },
1081
+ properties: {
1082
+ "class": "$pc.cx(\"area\")",
1083
+ "style.--px-area-gradient": "$areaGradient()",
1084
+ "style.--px-handle-background": "$handleBackground()",
1085
+ "style.--px-handle-position-left": "$handleLeft()",
1086
+ "style.--px-handle-position-top": "$handleTop()"
1087
+ }
1088
+ },
1089
+ providers: [{
1090
+ provide: PARENT_INSTANCE,
1091
+ useExisting: InputColorArea
1092
+ }],
1093
+ usesInheritance: true,
1094
+ hostDirectives: [{ directive: i1$1.Bind }],
1095
+ ngImport: i0,
1096
+ template: `<ng-content></ng-content>`,
1097
+ isInline: true,
1098
+ changeDetection: i0.ChangeDetectionStrategy.OnPush,
1099
+ encapsulation: i0.ViewEncapsulation.None
1100
+ });
1101
+ };
1102
+ i0.ɵɵngDeclareClassMetadata({
1103
+ minVersion: "12.0.0",
1104
+ version: "22.2.0",
1105
+ ngImport: i0,
1106
+ type: InputColorArea,
1107
+ decorators: [{
1108
+ type: Component,
1109
+ args: [{
1110
+ selector: "p-inputcolor-area",
1111
+ standalone: true,
1112
+ template: `<ng-content></ng-content>`,
1113
+ changeDetection: ChangeDetectionStrategy.OnPush,
1114
+ encapsulation: ViewEncapsulation.None,
1115
+ host: {
1116
+ "[class]": "$pc.cx(\"area\")",
1117
+ "[style.--px-area-gradient]": "$areaGradient()",
1118
+ "[style.--px-handle-background]": "$handleBackground()",
1119
+ "[style.--px-handle-position-left]": "$handleLeft()",
1120
+ "[style.--px-handle-position-top]": "$handleTop()",
1121
+ "(pointerdown)": "onPointerDown($event)"
1122
+ },
1123
+ providers: [{
1124
+ provide: PARENT_INSTANCE,
1125
+ useExisting: InputColorArea
1126
+ }],
1127
+ hostDirectives: [Bind]
1128
+ }]
1129
+ }]
1130
+ });
1131
+ var InputColorAreaBackground = class InputColorAreaBackground extends BaseComponent {
1132
+ componentName = "InputColorAreaBackground";
1133
+ bindDirectiveInstance = inject(Bind, { self: true });
1134
+ $pc = inject(INPUT_COLOR_INSTANCE);
1135
+ onAfterViewChecked() {
1136
+ this.bindDirectiveInstance.setAttrs(this.ptms(["host", "root"]));
1137
+ }
1138
+ static ɵfac = i0.ɵɵngDeclareFactory({
1139
+ minVersion: "12.0.0",
1140
+ version: "22.2.0",
1141
+ ngImport: i0,
1142
+ type: InputColorAreaBackground,
1143
+ deps: null,
1144
+ target: i0.ɵɵFactoryTarget.Component
1145
+ });
1146
+ static ɵcmp = i0.ɵɵngDeclareComponent({
1147
+ minVersion: "14.0.0",
1148
+ version: "22.2.0",
1149
+ type: InputColorAreaBackground,
1150
+ isStandalone: true,
1151
+ selector: "p-inputcolor-area-background",
1152
+ host: { properties: { "class": "$pc.cx(\"areaBackground\")" } },
1153
+ providers: [{
1154
+ provide: PARENT_INSTANCE,
1155
+ useExisting: InputColorAreaBackground
1156
+ }],
1157
+ usesInheritance: true,
1158
+ hostDirectives: [{ directive: i1$1.Bind }],
1159
+ ngImport: i0,
1160
+ template: `<ng-content></ng-content>`,
1161
+ isInline: true,
1162
+ changeDetection: i0.ChangeDetectionStrategy.OnPush,
1163
+ encapsulation: i0.ViewEncapsulation.None
1164
+ });
1165
+ };
1166
+ i0.ɵɵngDeclareClassMetadata({
1167
+ minVersion: "12.0.0",
1168
+ version: "22.2.0",
1169
+ ngImport: i0,
1170
+ type: InputColorAreaBackground,
1171
+ decorators: [{
1172
+ type: Component,
1173
+ args: [{
1174
+ selector: "p-inputcolor-area-background",
1175
+ standalone: true,
1176
+ template: `<ng-content></ng-content>`,
1177
+ changeDetection: ChangeDetectionStrategy.OnPush,
1178
+ encapsulation: ViewEncapsulation.None,
1179
+ host: { "[class]": "$pc.cx(\"areaBackground\")" },
1180
+ providers: [{
1181
+ provide: PARENT_INSTANCE,
1182
+ useExisting: InputColorAreaBackground
1183
+ }],
1184
+ hostDirectives: [Bind]
1185
+ }]
1186
+ }]
1187
+ });
1188
+ var InputColorAreaHandle = class InputColorAreaHandle extends BaseComponent {
1189
+ componentName = "InputColorAreaHandle";
1190
+ bindDirectiveInstance = inject(Bind, { self: true });
1191
+ $pc = inject(INPUT_COLOR_INSTANCE);
1192
+ $xChannel = computed(() => this.$pc.$axes().xChannel, ...ngDevMode ? [{ debugName: "$xChannel" }] : /* istanbul ignore next */ []);
1193
+ $yChannel = computed(() => this.$pc.$axes().yChannel, ...ngDevMode ? [{ debugName: "$yChannel" }] : /* istanbul ignore next */ []);
1194
+ $xRange = computed(() => getChannelRange(this.$xChannel()), ...ngDevMode ? [{ debugName: "$xRange" }] : /* istanbul ignore next */ []);
1195
+ $yRange = computed(() => getChannelRange(this.$yChannel()), ...ngDevMode ? [{ debugName: "$yRange" }] : /* istanbul ignore next */ []);
1196
+ $xValue = computed(() => this.$pc.$color().getChannelValue(this.$xChannel()), ...ngDevMode ? [{ debugName: "$xValue" }] : /* istanbul ignore next */ []);
1197
+ $yValue = computed(() => this.$pc.$color().getChannelValue(this.$yChannel()), ...ngDevMode ? [{ debugName: "$yValue" }] : /* istanbul ignore next */ []);
1198
+ $xMin = computed(() => this.$xRange().minValue, ...ngDevMode ? [{ debugName: "$xMin" }] : /* istanbul ignore next */ []);
1199
+ $xMax = computed(() => this.$xRange().maxValue, ...ngDevMode ? [{ debugName: "$xMax" }] : /* istanbul ignore next */ []);
1200
+ $tabindex = computed(() => this.$pc.$disabled() ? -1 : 0, ...ngDevMode ? [{ debugName: "$tabindex" }] : /* istanbul ignore next */ []);
1201
+ $ariaDisabled = computed(() => this.$pc.$disabled() || void 0, ...ngDevMode ? [{ debugName: "$ariaDisabled" }] : /* istanbul ignore next */ []);
1202
+ $ariaValueText = computed(() => {
1203
+ const xCh = this.$xChannel();
1204
+ const yCh = this.$yChannel();
1205
+ return `${xCh} ${this.$xValue()}, ${yCh} ${this.$yValue()}`;
1206
+ }, ...ngDevMode ? [{ debugName: "$ariaValueText" }] : /* istanbul ignore next */ []);
1207
+ onAfterViewChecked() {
1208
+ this.bindDirectiveInstance.setAttrs(this.ptms(["host", "root"]));
1209
+ }
1210
+ onKeyDown(event) {
1211
+ if (this.$pc.$disabled()) return;
1212
+ const xCh = this.$xChannel();
1213
+ const yCh = this.$yChannel();
1214
+ const xRange = this.$xRange();
1215
+ const yRange = this.$yRange();
1216
+ let xVal = this.$xValue();
1217
+ let yVal = this.$yValue();
1218
+ let handled = false;
1219
+ switch (event.key) {
1220
+ case "ArrowRight":
1221
+ xVal = Math.min(xVal + xRange.step, xRange.maxValue);
1222
+ handled = true;
1223
+ break;
1224
+ case "ArrowLeft":
1225
+ xVal = Math.max(xVal - xRange.step, xRange.minValue);
1226
+ handled = true;
1227
+ break;
1228
+ case "ArrowUp":
1229
+ yVal = Math.min(yVal + yRange.step, yRange.maxValue);
1230
+ handled = true;
1231
+ break;
1232
+ case "ArrowDown":
1233
+ yVal = Math.max(yVal - yRange.step, yRange.minValue);
1234
+ handled = true;
1235
+ break;
1236
+ case "PageUp":
1237
+ yVal = Math.min(yVal + yRange.pageStep, yRange.maxValue);
1238
+ handled = true;
1239
+ break;
1240
+ case "PageDown":
1241
+ yVal = Math.max(yVal - yRange.pageStep, yRange.minValue);
1242
+ handled = true;
1243
+ break;
1244
+ case "Home":
1245
+ xVal = xRange.minValue;
1246
+ handled = true;
1247
+ break;
1248
+ case "End":
1249
+ xVal = xRange.maxValue;
1250
+ handled = true;
1251
+ }
1252
+ if (handled) {
1253
+ event.preventDefault();
1254
+ let color = this.$pc.toChannelNativeFormat(this.$pc.$color(), xCh).setChannelValue(xCh, xVal);
1255
+ color = color.setChannelValue(yCh, yVal);
1256
+ this.$pc.updateColor(color, event, true);
1257
+ }
1258
+ }
1259
+ static ɵfac = i0.ɵɵngDeclareFactory({
1260
+ minVersion: "12.0.0",
1261
+ version: "22.2.0",
1262
+ ngImport: i0,
1263
+ type: InputColorAreaHandle,
1264
+ deps: null,
1265
+ target: i0.ɵɵFactoryTarget.Component
1266
+ });
1267
+ static ɵcmp = i0.ɵɵngDeclareComponent({
1268
+ minVersion: "14.0.0",
1269
+ version: "22.2.0",
1270
+ type: InputColorAreaHandle,
1271
+ isStandalone: true,
1272
+ selector: "p-inputcolor-area-handle",
1273
+ host: {
1274
+ listeners: { "keydown": "onKeyDown($event)" },
1275
+ properties: {
1276
+ "class": "$pc.cx(\"areaHandle\")",
1277
+ "attr.role": "'slider'",
1278
+ "attr.tabindex": "$tabindex()",
1279
+ "attr.aria-label": "'Color'",
1280
+ "attr.aria-roledescription": "'2d slider'",
1281
+ "attr.aria-disabled": "$ariaDisabled()",
1282
+ "attr.aria-valuemin": "$xMin()",
1283
+ "attr.aria-valuemax": "$xMax()",
1284
+ "attr.aria-valuenow": "$xValue()",
1285
+ "attr.aria-valuetext": "$ariaValueText()"
1286
+ }
1287
+ },
1288
+ providers: [{
1289
+ provide: PARENT_INSTANCE,
1290
+ useExisting: InputColorAreaHandle
1291
+ }],
1292
+ usesInheritance: true,
1293
+ hostDirectives: [{ directive: i1$1.Bind }],
1294
+ ngImport: i0,
1295
+ template: `<ng-content></ng-content>`,
1296
+ isInline: true,
1297
+ changeDetection: i0.ChangeDetectionStrategy.OnPush,
1298
+ encapsulation: i0.ViewEncapsulation.None
1299
+ });
1300
+ };
1301
+ i0.ɵɵngDeclareClassMetadata({
1302
+ minVersion: "12.0.0",
1303
+ version: "22.2.0",
1304
+ ngImport: i0,
1305
+ type: InputColorAreaHandle,
1306
+ decorators: [{
1307
+ type: Component,
1308
+ args: [{
1309
+ selector: "p-inputcolor-area-handle",
1310
+ standalone: true,
1311
+ template: `<ng-content></ng-content>`,
1312
+ changeDetection: ChangeDetectionStrategy.OnPush,
1313
+ encapsulation: ViewEncapsulation.None,
1314
+ host: {
1315
+ "[class]": "$pc.cx(\"areaHandle\")",
1316
+ "[attr.role]": "'slider'",
1317
+ "[attr.tabindex]": "$tabindex()",
1318
+ "[attr.aria-label]": "'Color'",
1319
+ "[attr.aria-roledescription]": "'2d slider'",
1320
+ "[attr.aria-disabled]": "$ariaDisabled()",
1321
+ "[attr.aria-valuemin]": "$xMin()",
1322
+ "[attr.aria-valuemax]": "$xMax()",
1323
+ "[attr.aria-valuenow]": "$xValue()",
1324
+ "[attr.aria-valuetext]": "$ariaValueText()",
1325
+ "(keydown)": "onKeyDown($event)"
1326
+ },
1327
+ providers: [{
1328
+ provide: PARENT_INSTANCE,
1329
+ useExisting: InputColorAreaHandle
1330
+ }],
1331
+ hostDirectives: [Bind]
1332
+ }]
1333
+ }]
1334
+ });
1335
+ var InputColorEyeDropper = class InputColorEyeDropper extends BaseComponent {
1336
+ componentName = "InputColorEyeDropper";
1337
+ bindDirectiveInstance = inject(Bind, { self: true });
1338
+ $pc = inject(INPUT_COLOR_INSTANCE);
1339
+ text = input(false, ...ngDevMode ? [{ debugName: "text" }] : /* istanbul ignore next */ []);
1340
+ rounded = input(false, ...ngDevMode ? [{ debugName: "rounded" }] : /* istanbul ignore next */ []);
1341
+ outlined = input(false, ...ngDevMode ? [{ debugName: "outlined" }] : /* istanbul ignore next */ []);
1342
+ iconOnly = input(false, ...ngDevMode ? [{ debugName: "iconOnly" }] : /* istanbul ignore next */ []);
1343
+ severity = input(void 0, ...ngDevMode ? [{ debugName: "severity" }] : /* istanbul ignore next */ []);
1344
+ size = input(void 0, ...ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []);
1345
+ onAfterViewChecked() {
1346
+ this.bindDirectiveInstance.setAttrs(this.ptms(["host", "root"]));
1347
+ }
1348
+ async onPickColor(event) {
1349
+ if (this.$pc.$disabled()) return;
1350
+ if (!isPlatformBrowser(this.platformId)) return;
1351
+ try {
1352
+ const result = await new window.EyeDropper().open();
1353
+ if (result?.sRGBHex) {
1354
+ const parsed = parseColor(result.sRGBHex);
1355
+ if (parsed) this.$pc.updateColor(parsed, event, true);
1356
+ }
1357
+ } catch {}
1358
+ }
1359
+ static ɵfac = i0.ɵɵngDeclareFactory({
1360
+ minVersion: "12.0.0",
1361
+ version: "22.2.0",
1362
+ ngImport: i0,
1363
+ type: InputColorEyeDropper,
1364
+ deps: null,
1365
+ target: i0.ɵɵFactoryTarget.Component
1366
+ });
1367
+ static ɵcmp = i0.ɵɵngDeclareComponent({
1368
+ minVersion: "17.0.0",
1369
+ version: "22.2.0",
1370
+ type: InputColorEyeDropper,
1371
+ isStandalone: true,
1372
+ selector: "p-inputcolor-eyedropper",
1373
+ inputs: {
1374
+ text: {
1375
+ classPropertyName: "text",
1376
+ publicName: "text",
1377
+ isSignal: true,
1378
+ isRequired: false,
1379
+ transformFunction: null
1380
+ },
1381
+ rounded: {
1382
+ classPropertyName: "rounded",
1383
+ publicName: "rounded",
1384
+ isSignal: true,
1385
+ isRequired: false,
1386
+ transformFunction: null
1387
+ },
1388
+ outlined: {
1389
+ classPropertyName: "outlined",
1390
+ publicName: "outlined",
1391
+ isSignal: true,
1392
+ isRequired: false,
1393
+ transformFunction: null
1394
+ },
1395
+ iconOnly: {
1396
+ classPropertyName: "iconOnly",
1397
+ publicName: "iconOnly",
1398
+ isSignal: true,
1399
+ isRequired: false,
1400
+ transformFunction: null
1401
+ },
1402
+ severity: {
1403
+ classPropertyName: "severity",
1404
+ publicName: "severity",
1405
+ isSignal: true,
1406
+ isRequired: false,
1407
+ transformFunction: null
1408
+ },
1409
+ size: {
1410
+ classPropertyName: "size",
1411
+ publicName: "size",
1412
+ isSignal: true,
1413
+ isRequired: false,
1414
+ transformFunction: null
1415
+ }
1416
+ },
1417
+ host: { properties: { "class": "$pc.cx(\"eyeDropper\")" } },
1418
+ providers: [{
1419
+ provide: PARENT_INSTANCE,
1420
+ useExisting: InputColorEyeDropper
1421
+ }],
1422
+ usesInheritance: true,
1423
+ hostDirectives: [{ directive: i1$1.Bind }],
1424
+ ngImport: i0,
1425
+ template: `
1416
1426
  <ng-template #contentTpl><ng-content /></ng-template>
1417
1427
  <button
1418
1428
  pButton
@@ -1435,15 +1445,69 @@ class InputColorEyeDropper extends BaseComponent {
1435
1445
  <ng-container *ngTemplateOutlet="contentTpl" />
1436
1446
  }
1437
1447
  </button>
1438
- `, isInline: true, dependencies: [{ kind: "directive", type: ButtonDirective, selector: "[pButton]", inputs: ["pButton", "pButtonPT", "pButtonUnstyled", "hostName", "text", "plain", "raised", "size", "outlined", "link", "rounded", "fluid", "variant", "iconOnly", "loading", "severity"] }, { kind: "directive", type: ButtonIcon, selector: "[pButtonIcon]", inputs: ["pButtonIconPT", "pButtonUnstyled"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
1439
- }
1440
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: InputColorEyeDropper, decorators: [{
1441
- type: Component,
1442
- args: [{
1443
- selector: 'p-inputcolor-eyedropper',
1444
- standalone: true,
1445
- imports: [ButtonDirective, ButtonIcon, NgTemplateOutlet],
1446
- template: `
1448
+ `,
1449
+ isInline: true,
1450
+ dependencies: [
1451
+ {
1452
+ kind: "directive",
1453
+ type: ButtonDirective,
1454
+ selector: "[pButton]",
1455
+ inputs: [
1456
+ "pButton",
1457
+ "pButtonPT",
1458
+ "pButtonUnstyled",
1459
+ "hostName",
1460
+ "text",
1461
+ "plain",
1462
+ "raised",
1463
+ "size",
1464
+ "outlined",
1465
+ "link",
1466
+ "rounded",
1467
+ "fluid",
1468
+ "variant",
1469
+ "iconOnly",
1470
+ "loading",
1471
+ "severity"
1472
+ ]
1473
+ },
1474
+ {
1475
+ kind: "directive",
1476
+ type: ButtonIcon,
1477
+ selector: "[pButtonIcon]",
1478
+ inputs: ["pButtonIconPT", "pButtonUnstyled"]
1479
+ },
1480
+ {
1481
+ kind: "directive",
1482
+ type: NgTemplateOutlet,
1483
+ selector: "[ngTemplateOutlet]",
1484
+ inputs: [
1485
+ "ngTemplateOutletContext",
1486
+ "ngTemplateOutlet",
1487
+ "ngTemplateOutletInjector"
1488
+ ]
1489
+ }
1490
+ ],
1491
+ changeDetection: i0.ChangeDetectionStrategy.OnPush,
1492
+ encapsulation: i0.ViewEncapsulation.None
1493
+ });
1494
+ };
1495
+ i0.ɵɵngDeclareClassMetadata({
1496
+ minVersion: "12.0.0",
1497
+ version: "22.2.0",
1498
+ ngImport: i0,
1499
+ type: InputColorEyeDropper,
1500
+ decorators: [{
1501
+ type: Component,
1502
+ args: [{
1503
+ selector: "p-inputcolor-eyedropper",
1504
+ standalone: true,
1505
+ imports: [
1506
+ ButtonDirective,
1507
+ ButtonIcon,
1508
+ NgTemplateOutlet
1509
+ ],
1510
+ template: `
1447
1511
  <ng-template #contentTpl><ng-content /></ng-template>
1448
1512
  <button
1449
1513
  pButton
@@ -1467,805 +1531,1183 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImpor
1467
1531
  }
1468
1532
  </button>
1469
1533
  `,
1470
- changeDetection: ChangeDetectionStrategy.OnPush,
1471
- encapsulation: ViewEncapsulation.None,
1472
- host: {
1473
- '[class]': '$pc.cx("eyeDropper")'
1474
- },
1475
- providers: [{ provide: PARENT_INSTANCE, useExisting: InputColorEyeDropper }],
1476
- hostDirectives: [Bind]
1477
- }]
1478
- }], propDecorators: { text: [{ type: i0.Input, args: [{ isSignal: true, alias: "text", required: false }] }], rounded: [{ type: i0.Input, args: [{ isSignal: true, alias: "rounded", required: false }] }], outlined: [{ type: i0.Input, args: [{ isSignal: true, alias: "outlined", required: false }] }], iconOnly: [{ type: i0.Input, args: [{ isSignal: true, alias: "iconOnly", required: false }] }], severity: [{ type: i0.Input, args: [{ isSignal: true, alias: "severity", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }] } });
1479
-
1480
- class InputColorInput extends BaseComponent {
1481
- componentName = 'InputColorInput';
1482
- $pc = inject(INPUT_COLOR_INSTANCE);
1483
- /**
1484
- * The color channel this input controls.
1485
- * @group Props
1486
- */
1487
- channel = input.required(/* @ts-ignore */
1488
- ...(ngDevMode ? [{ debugName: "channel" }] : /* istanbul ignore next */ []));
1489
- /**
1490
- * The input type attribute.
1491
- * @group Props
1492
- */
1493
- type = input(/* @ts-ignore */
1494
- ...(ngDevMode ? [undefined, { debugName: "type" }] : /* istanbul ignore next */ []));
1495
- /**
1496
- * When present, it specifies that the input should be disabled.
1497
- * @group Props
1498
- */
1499
- disabled = input(false, { ...(ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
1500
- $disabled = computed(() => this.disabled() || this.$pc.$disabled(), /* @ts-ignore */
1501
- ...(ngDevMode ? [{ debugName: "$disabled" }] : /* istanbul ignore next */ []));
1502
- $inputType = computed(() => {
1503
- const t = this.type();
1504
- if (t)
1505
- return t;
1506
- const ch = this.channel();
1507
- return ch === 'hex' || ch === 'css' ? 'text' : 'number';
1508
- }, /* @ts-ignore */
1509
- ...(ngDevMode ? [{ debugName: "$inputType" }] : /* istanbul ignore next */ []));
1510
- $displayValue = computed(() => {
1511
- const ch = this.channel();
1512
- const color = this.$pc.$color();
1513
- const format = this.$pc.format();
1514
- return getInputChannelValue(color, ch, format);
1515
- }, /* @ts-ignore */
1516
- ...(ngDevMode ? [{ debugName: "$displayValue" }] : /* istanbul ignore next */ []));
1517
- pendingValue = null;
1518
- constructor() {
1519
- super();
1520
- effect(() => {
1521
- this.el.nativeElement.type = this.$inputType();
1522
- });
1523
- effect(() => {
1524
- const el = this.el.nativeElement;
1525
- const ch = this.channel();
1526
- if (ch !== 'hex' && ch !== 'css') {
1527
- const range = getChannelRange(ch);
1528
- el.min = String(range.minValue);
1529
- el.max = String(range.maxValue);
1530
- el.step = String(range.step);
1531
- }
1532
- });
1533
- effect(() => {
1534
- this.el.nativeElement.value = String(this.$displayValue() ?? '');
1535
- });
1536
- }
1537
- onInput(event) {
1538
- const target = event.target;
1539
- this.pendingValue = target.value;
1540
- }
1541
- onBlur(event) {
1542
- this.commitValue(event);
1543
- }
1544
- onEnter(event) {
1545
- this.commitValue(event);
1546
- }
1547
- commitValue(event) {
1548
- if (this.pendingValue === null)
1549
- return;
1550
- const ch = this.channel();
1551
- const value = this.pendingValue;
1552
- this.pendingValue = null;
1553
- if (ch === 'hex') {
1554
- const hex = value.startsWith('#') ? value : `#${value}`;
1555
- const parsed = parseColor(hex);
1556
- if (parsed) {
1557
- this.$pc.updateColor(parsed, event, true);
1558
- }
1559
- }
1560
- else if (ch === 'css') {
1561
- const parsed = parseColor(value);
1562
- if (parsed) {
1563
- this.$pc.updateColor(parsed, event, true);
1564
- }
1565
- }
1566
- else {
1567
- const numValue = parseFloat(value);
1568
- if (!isNaN(numValue)) {
1569
- const range = getChannelRange(ch);
1570
- const clamped = Math.max(range.minValue, Math.min(range.maxValue, numValue));
1571
- this.$pc.setChannelValue(ch, clamped, event, true);
1572
- }
1573
- }
1574
- }
1575
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: InputColorInput, deps: [], target: i0.ɵɵFactoryTarget.Directive });
1576
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.1.5", type: InputColorInput, isStandalone: true, selector: "[pInputColorInput]", inputs: { channel: { classPropertyName: "channel", publicName: "channel", isSignal: true, isRequired: true, transformFunction: null }, type: { classPropertyName: "type", publicName: "type", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null } }, host: { listeners: { "input": "onInput($event)", "blur": "onBlur($event)", "keydown.enter": "onEnter($event)" }, properties: { "attr.disabled": "$disabled() || null", "attr.data-channel": "channel()" } }, providers: [{ provide: PARENT_INSTANCE, useExisting: InputColorInput }], usesInheritance: true, hostDirectives: [{ directive: i1$1.InputText, inputs: ["pSize", "pSize", "fluid", "fluid", "variant", "variant", "invalid", "invalid"] }], ngImport: i0 });
1577
- }
1578
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: InputColorInput, decorators: [{
1579
- type: Directive,
1580
- args: [{
1581
- selector: '[pInputColorInput]',
1582
- standalone: true,
1583
- host: {
1584
- '[attr.disabled]': '$disabled() || null',
1585
- '[attr.data-channel]': 'channel()',
1586
- '(input)': 'onInput($event)',
1587
- '(blur)': 'onBlur($event)',
1588
- '(keydown.enter)': 'onEnter($event)'
1589
- },
1590
- providers: [{ provide: PARENT_INSTANCE, useExisting: InputColorInput }],
1591
- hostDirectives: [
1592
- {
1593
- directive: InputText,
1594
- inputs: ['pSize', 'fluid', 'variant', 'invalid']
1595
- }
1596
- ]
1597
- }]
1598
- }], ctorParameters: () => [], propDecorators: { channel: [{ type: i0.Input, args: [{ isSignal: true, alias: "channel", required: true }] }], type: [{ type: i0.Input, args: [{ isSignal: true, alias: "type", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }] } });
1599
-
1600
- /**
1601
- * InputColorSlider is a helper component for InputColor component.
1602
- * @group Components
1603
- */
1604
- class InputColorSlider extends BaseComponent {
1605
- componentName = 'InputColorSlider';
1606
- bindDirectiveInstance = inject(Bind, { self: true });
1607
- $pc = inject(INPUT_COLOR_INSTANCE);
1608
- /**
1609
- * The color channel this slider controls.
1610
- * @group Props
1611
- */
1612
- channel = input('hue', /* @ts-ignore */
1613
- ...(ngDevMode ? [{ debugName: "channel" }] : /* istanbul ignore next */ []));
1614
- /**
1615
- * Orientation of the slider.
1616
- * @group Props
1617
- */
1618
- orientation = input('horizontal', /* @ts-ignore */
1619
- ...(ngDevMode ? [{ debugName: "orientation" }] : /* istanbul ignore next */ []));
1620
- dragging = false;
1621
- cleanupDrag = null;
1622
- onAfterViewChecked() {
1623
- this.bindDirectiveInstance.setAttrs(this.ptms(['host', 'root']));
1624
- }
1625
- onPointerDown(event) {
1626
- if (this.$pc.$disabled())
1627
- return;
1628
- event.preventDefault();
1629
- this.dragging = true;
1630
- const el = this.el.nativeElement;
1631
- el.setPointerCapture(event.pointerId);
1632
- this.updateFromPointer(event);
1633
- const onMove = (e) => {
1634
- if (!this.dragging)
1635
- return;
1636
- e.preventDefault();
1637
- this.updateFromPointer(e);
1638
- };
1639
- const cleanup = () => {
1640
- this.dragging = false;
1641
- this.cleanupDrag = null;
1642
- el.removeEventListener('pointermove', onMove);
1643
- el.removeEventListener('pointerup', onUp);
1644
- el.removeEventListener('pointercancel', onCancel);
1645
- el.removeEventListener('lostpointercapture', onLostCapture);
1646
- };
1647
- this.cleanupDrag = cleanup;
1648
- const onUp = (e) => {
1649
- if (!this.dragging)
1650
- return;
1651
- this.updateFromPointer(e, true);
1652
- cleanup();
1653
- };
1654
- const onCancel = () => {
1655
- cleanup();
1656
- };
1657
- const onLostCapture = () => {
1658
- cleanup();
1659
- };
1660
- el.addEventListener('pointermove', onMove);
1661
- el.addEventListener('pointerup', onUp);
1662
- el.addEventListener('pointercancel', onCancel);
1663
- el.addEventListener('lostpointercapture', onLostCapture);
1664
- }
1665
- ngOnDestroy() {
1666
- this.cleanupDrag?.();
1667
- }
1668
- updateFromPointer(event, isEnd = false) {
1669
- const el = this.el.nativeElement;
1670
- const rect = el.getBoundingClientRect();
1671
- const ch = this.channel();
1672
- const range = getChannelRange(ch);
1673
- let percent;
1674
- if (this.orientation() === 'vertical') {
1675
- percent = 1 - Math.max(0, Math.min(1, (event.clientY - rect.top) / rect.height));
1676
- }
1677
- else {
1678
- percent = Math.max(0, Math.min(1, (event.clientX - rect.left) / rect.width));
1679
- }
1680
- const rawValue = range.minValue + percent * (range.maxValue - range.minValue);
1681
- const value = snapValue(rawValue, range.minValue, range.maxValue, range.step);
1682
- this.$pc.setChannelValue(ch, value, event, isEnd);
1683
- }
1684
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: InputColorSlider, deps: null, target: i0.ɵɵFactoryTarget.Component });
1685
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.1.5", type: InputColorSlider, isStandalone: true, selector: "p-inputcolor-slider", inputs: { channel: { classPropertyName: "channel", publicName: "channel", isSignal: true, isRequired: false, transformFunction: null }, orientation: { classPropertyName: "orientation", publicName: "orientation", isSignal: true, isRequired: false, transformFunction: null } }, host: { listeners: { "pointerdown": "onPointerDown($event)" }, properties: { "class": "$pc.cx(\"slider\")", "class.p-inputcolor-slider-horizontal": "orientation() === \"horizontal\"", "class.p-inputcolor-slider-vertical": "orientation() === \"vertical\"", "attr.data-orientation": "orientation()" } }, providers: [
1686
- { provide: INPUT_COLOR_SLIDER_INSTANCE, useExisting: InputColorSlider },
1687
- { provide: PARENT_INSTANCE, useExisting: InputColorSlider }
1688
- ], usesInheritance: true, hostDirectives: [{ directive: i1.Bind }], ngImport: i0, template: `<ng-content></ng-content>`, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
1689
- }
1690
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: InputColorSlider, decorators: [{
1691
- type: Component,
1692
- args: [{
1693
- selector: 'p-inputcolor-slider',
1694
- standalone: true,
1695
- template: `<ng-content></ng-content>`,
1696
- changeDetection: ChangeDetectionStrategy.OnPush,
1697
- encapsulation: ViewEncapsulation.None,
1698
- host: {
1699
- '[class]': '$pc.cx("slider")',
1700
- '[class.p-inputcolor-slider-horizontal]': 'orientation() === "horizontal"',
1701
- '[class.p-inputcolor-slider-vertical]': 'orientation() === "vertical"',
1702
- '[attr.data-orientation]': 'orientation()',
1703
- '(pointerdown)': 'onPointerDown($event)'
1704
- },
1705
- providers: [
1706
- { provide: INPUT_COLOR_SLIDER_INSTANCE, useExisting: InputColorSlider },
1707
- { provide: PARENT_INSTANCE, useExisting: InputColorSlider }
1708
- ],
1709
- hostDirectives: [Bind]
1710
- }]
1711
- }], propDecorators: { channel: [{ type: i0.Input, args: [{ isSignal: true, alias: "channel", required: false }] }], orientation: [{ type: i0.Input, args: [{ isSignal: true, alias: "orientation", required: false }] }] } });
1712
-
1713
- /**
1714
- * InputColorSliderHandle is a helper component for InputColor component.
1715
- * @group Components
1716
- */
1717
- class InputColorSliderHandle extends BaseComponent {
1718
- componentName = 'InputColorSliderHandle';
1719
- bindDirectiveInstance = inject(Bind, { self: true });
1720
- $pc = inject(INPUT_COLOR_INSTANCE);
1721
- pcSlider = inject(INPUT_COLOR_SLIDER_INSTANCE);
1722
- $channel = computed(() => this.pcSlider.channel(), /* @ts-ignore */
1723
- ...(ngDevMode ? [{ debugName: "$channel" }] : /* istanbul ignore next */ []));
1724
- $isVertical = computed(() => this.pcSlider.orientation() === 'vertical', /* @ts-ignore */
1725
- ...(ngDevMode ? [{ debugName: "$isVertical" }] : /* istanbul ignore next */ []));
1726
- $range = computed(() => getChannelRange(this.$channel()), /* @ts-ignore */
1727
- ...(ngDevMode ? [{ debugName: "$range" }] : /* istanbul ignore next */ []));
1728
- $value = computed(() => this.$pc.$color().getChannelValue(this.$channel()), /* @ts-ignore */
1729
- ...(ngDevMode ? [{ debugName: "$value" }] : /* istanbul ignore next */ []));
1730
- $tabindex = computed(() => (this.$pc.$disabled() ? -1 : 0), /* @ts-ignore */
1731
- ...(ngDevMode ? [{ debugName: "$tabindex" }] : /* istanbul ignore next */ []));
1732
- $ariaDisabled = computed(() => this.$pc.$disabled() || undefined, /* @ts-ignore */
1733
- ...(ngDevMode ? [{ debugName: "$ariaDisabled" }] : /* istanbul ignore next */ []));
1734
- $handlePosition = computed(() => {
1735
- const range = this.$range();
1736
- const value = this.$value();
1737
- const pct = ((value - range.minValue) / (range.maxValue - range.minValue)) * 100;
1738
- return `${pct}%`;
1739
- }, /* @ts-ignore */
1740
- ...(ngDevMode ? [{ debugName: "$handlePosition" }] : /* istanbul ignore next */ []));
1741
- $handlePositionVertical = computed(() => {
1742
- const range = this.$range();
1743
- const value = this.$value();
1744
- const pct = 100 - ((value - range.minValue) / (range.maxValue - range.minValue)) * 100;
1745
- return `${pct}%`;
1746
- }, /* @ts-ignore */
1747
- ...(ngDevMode ? [{ debugName: "$handlePositionVertical" }] : /* istanbul ignore next */ []));
1748
- $left = computed(() => (this.$isVertical() ? null : this.$handlePosition()), /* @ts-ignore */
1749
- ...(ngDevMode ? [{ debugName: "$left" }] : /* istanbul ignore next */ []));
1750
- $top = computed(() => (this.$isVertical() ? this.$handlePositionVertical() : null), /* @ts-ignore */
1751
- ...(ngDevMode ? [{ debugName: "$top" }] : /* istanbul ignore next */ []));
1752
- $translate = computed(() => (this.$isVertical() ? '0 -50%' : '-50% 0'), /* @ts-ignore */
1753
- ...(ngDevMode ? [{ debugName: "$translate" }] : /* istanbul ignore next */ []));
1754
- $handleColor = computed(() => getChannelColor(this.$pc.$color(), this.$channel()).toRgbString(), /* @ts-ignore */
1755
- ...(ngDevMode ? [{ debugName: "$handleColor" }] : /* istanbul ignore next */ []));
1756
- onAfterViewChecked() {
1757
- this.bindDirectiveInstance.setAttrs(this.ptms(['host', 'root']));
1758
- }
1759
- onKeyDown(event) {
1760
- if (this.$pc.$disabled())
1761
- return;
1762
- const ch = this.$channel();
1763
- const range = this.$range();
1764
- let value = this.$value();
1765
- let handled = false;
1766
- switch (event.key) {
1767
- case 'ArrowRight':
1768
- case 'ArrowUp':
1769
- value = Math.min(value + range.step, range.maxValue);
1770
- handled = true;
1771
- break;
1772
- case 'ArrowLeft':
1773
- case 'ArrowDown':
1774
- value = Math.max(value - range.step, range.minValue);
1775
- handled = true;
1776
- break;
1777
- case 'PageUp':
1778
- value = Math.min(value + range.pageStep, range.maxValue);
1779
- handled = true;
1780
- break;
1781
- case 'PageDown':
1782
- value = Math.max(value - range.pageStep, range.minValue);
1783
- handled = true;
1784
- break;
1785
- case 'Home':
1786
- value = range.minValue;
1787
- handled = true;
1788
- break;
1789
- case 'End':
1790
- value = range.maxValue;
1791
- handled = true;
1792
- break;
1793
- }
1794
- if (handled) {
1795
- event.preventDefault();
1796
- this.$pc.setChannelValue(ch, value, event, true);
1797
- }
1798
- }
1799
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: InputColorSliderHandle, deps: null, target: i0.ɵɵFactoryTarget.Component });
1800
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "22.1.5", type: InputColorSliderHandle, isStandalone: true, selector: "p-inputcolor-slider-handle", host: { listeners: { "keydown": "onKeyDown($event)" }, properties: { "class": "$pc.cx(\"sliderHandle\")", "style.--px-slider-handle-background": "$handleColor()", "style.left": "$left()", "style.top": "$top()", "style.translate": "$translate()", "attr.role": "'slider'", "attr.tabindex": "$tabindex()", "attr.aria-label": "$channel()", "attr.aria-disabled": "$ariaDisabled()", "attr.aria-valuemin": "$range().minValue", "attr.aria-valuemax": "$range().maxValue", "attr.aria-valuenow": "$value()" } }, providers: [{ provide: PARENT_INSTANCE, useExisting: InputColorSliderHandle }], usesInheritance: true, hostDirectives: [{ directive: i1.Bind }], ngImport: i0, template: `<ng-content></ng-content>`, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
1801
- }
1802
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: InputColorSliderHandle, decorators: [{
1803
- type: Component,
1804
- args: [{
1805
- selector: 'p-inputcolor-slider-handle',
1806
- standalone: true,
1807
- template: `<ng-content></ng-content>`,
1808
- changeDetection: ChangeDetectionStrategy.OnPush,
1809
- encapsulation: ViewEncapsulation.None,
1810
- host: {
1811
- '[class]': '$pc.cx("sliderHandle")',
1812
- '[style.--px-slider-handle-background]': '$handleColor()',
1813
- '[style.left]': '$left()',
1814
- '[style.top]': '$top()',
1815
- '[style.translate]': '$translate()',
1816
- '[attr.role]': "'slider'",
1817
- '[attr.tabindex]': '$tabindex()',
1818
- '[attr.aria-label]': '$channel()',
1819
- '[attr.aria-disabled]': '$ariaDisabled()',
1820
- '[attr.aria-valuemin]': '$range().minValue',
1821
- '[attr.aria-valuemax]': '$range().maxValue',
1822
- '[attr.aria-valuenow]': '$value()',
1823
- '(keydown)': 'onKeyDown($event)'
1824
- },
1825
- providers: [{ provide: PARENT_INSTANCE, useExisting: InputColorSliderHandle }],
1826
- hostDirectives: [Bind]
1827
- }]
1828
- }] });
1829
-
1830
- /**
1831
- * InputColorSliderTrack is a helper component for InputColor component.
1832
- * @group Components
1833
- */
1834
- class InputColorSliderTrack extends BaseComponent {
1835
- componentName = 'InputColorSliderTrack';
1836
- bindDirectiveInstance = inject(Bind, { self: true });
1837
- $pc = inject(INPUT_COLOR_INSTANCE);
1838
- pcSlider = inject(INPUT_COLOR_SLIDER_INSTANCE);
1839
- $gradient = computed(() => {
1840
- const ch = this.pcSlider.channel();
1841
- const color = this.$pc.$color();
1842
- const orientation = this.pcSlider.orientation();
1843
- return getChannelGradient(color, ch, orientation);
1844
- }, /* @ts-ignore */
1845
- ...(ngDevMode ? [{ debugName: "$gradient" }] : /* istanbul ignore next */ []));
1846
- onAfterViewChecked() {
1847
- this.bindDirectiveInstance.setAttrs(this.ptms(['host', 'root']));
1848
- }
1849
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: InputColorSliderTrack, deps: null, target: i0.ɵɵFactoryTarget.Component });
1850
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "22.1.5", type: InputColorSliderTrack, isStandalone: true, selector: "p-inputcolor-slider-track", host: { properties: { "class": "$pc.cx(\"sliderTrack\")", "style.--px-slider-background": "$gradient()" } }, providers: [{ provide: PARENT_INSTANCE, useExisting: InputColorSliderTrack }], usesInheritance: true, hostDirectives: [{ directive: i1.Bind }], ngImport: i0, template: `<ng-content></ng-content>`, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
1851
- }
1852
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: InputColorSliderTrack, decorators: [{
1853
- type: Component,
1854
- args: [{
1855
- selector: 'p-inputcolor-slider-track',
1856
- standalone: true,
1857
- template: `<ng-content></ng-content>`,
1858
- changeDetection: ChangeDetectionStrategy.OnPush,
1859
- encapsulation: ViewEncapsulation.None,
1860
- host: {
1861
- '[class]': '$pc.cx("sliderTrack")',
1862
- '[style.--px-slider-background]': '$gradient()'
1863
- },
1864
- providers: [{ provide: PARENT_INSTANCE, useExisting: InputColorSliderTrack }],
1865
- hostDirectives: [Bind]
1866
- }]
1867
- }] });
1868
-
1869
- /**
1870
- * InputColorSwatch is a helper component for InputColor component.
1871
- * @group Components
1872
- */
1873
- class InputColorSwatch extends BaseComponent {
1874
- componentName = 'InputColorSwatch';
1875
- bindDirectiveInstance = inject(Bind, { self: true });
1876
- $pc = inject(INPUT_COLOR_INSTANCE);
1877
- onAfterViewChecked() {
1878
- this.bindDirectiveInstance.setAttrs(this.ptms(['host', 'root']));
1879
- }
1880
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: InputColorSwatch, deps: null, target: i0.ɵɵFactoryTarget.Component });
1881
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "22.1.5", type: InputColorSwatch, isStandalone: true, selector: "p-inputcolor-swatch", host: { properties: { "class": "$pc.cx(\"swatch\")" } }, providers: [{ provide: PARENT_INSTANCE, useExisting: InputColorSwatch }], usesInheritance: true, hostDirectives: [{ directive: i1.Bind }], ngImport: i0, template: `<ng-content></ng-content>`, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
1882
- }
1883
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: InputColorSwatch, decorators: [{
1884
- type: Component,
1885
- args: [{
1886
- selector: 'p-inputcolor-swatch',
1887
- standalone: true,
1888
- template: `<ng-content></ng-content>`,
1889
- changeDetection: ChangeDetectionStrategy.OnPush,
1890
- encapsulation: ViewEncapsulation.None,
1891
- host: {
1892
- '[class]': '$pc.cx("swatch")'
1893
- },
1894
- providers: [{ provide: PARENT_INSTANCE, useExisting: InputColorSwatch }],
1895
- hostDirectives: [Bind]
1896
- }]
1897
- }] });
1898
-
1899
- /**
1900
- * InputColorSwatchBackground is a helper component for InputColor component.
1901
- * @group Components
1902
- */
1903
- class InputColorSwatchBackground extends BaseComponent {
1904
- componentName = 'InputColorSwatchBackground';
1905
- bindDirectiveInstance = inject(Bind, { self: true });
1906
- $pc = inject(INPUT_COLOR_INSTANCE);
1907
- $swatchColor = computed(() => this.$pc.$color().toRgbString(), /* @ts-ignore */
1908
- ...(ngDevMode ? [{ debugName: "$swatchColor" }] : /* istanbul ignore next */ []));
1909
- onAfterViewChecked() {
1910
- this.bindDirectiveInstance.setAttrs(this.ptms(['host', 'root']));
1911
- }
1912
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: InputColorSwatchBackground, deps: null, target: i0.ɵɵFactoryTarget.Component });
1913
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "22.1.5", type: InputColorSwatchBackground, isStandalone: true, selector: "p-inputcolor-swatch-background", host: { properties: { "class": "$pc.cx(\"swatchBackground\")", "style.--px-swatch-background": "$swatchColor()" } }, providers: [{ provide: PARENT_INSTANCE, useExisting: InputColorSwatchBackground }], usesInheritance: true, hostDirectives: [{ directive: i1.Bind }], ngImport: i0, template: `<ng-content></ng-content>`, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
1914
- }
1915
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: InputColorSwatchBackground, decorators: [{
1916
- type: Component,
1917
- args: [{
1918
- selector: 'p-inputcolor-swatch-background',
1919
- standalone: true,
1920
- template: `<ng-content></ng-content>`,
1921
- changeDetection: ChangeDetectionStrategy.OnPush,
1922
- encapsulation: ViewEncapsulation.None,
1923
- host: {
1924
- '[class]': '$pc.cx("swatchBackground")',
1925
- '[style.--px-swatch-background]': '$swatchColor()'
1926
- },
1927
- providers: [{ provide: PARENT_INSTANCE, useExisting: InputColorSwatchBackground }],
1928
- hostDirectives: [Bind]
1929
- }]
1930
- }] });
1931
-
1932
- /**
1933
- * InputColorTransparencyGrid is a helper component for InputColor component.
1934
- * @group Components
1935
- */
1936
- class InputColorTransparencyGrid extends BaseComponent {
1937
- componentName = 'InputColorTransparencyGrid';
1938
- bindDirectiveInstance = inject(Bind, { self: true });
1939
- $pc = inject(INPUT_COLOR_INSTANCE);
1940
- onAfterViewChecked() {
1941
- this.bindDirectiveInstance.setAttrs(this.ptms(['host', 'root']));
1942
- }
1943
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: InputColorTransparencyGrid, deps: null, target: i0.ɵɵFactoryTarget.Component });
1944
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "22.1.5", type: InputColorTransparencyGrid, isStandalone: true, selector: "p-inputcolor-transparency-grid", host: { properties: { "class": "$pc.cx(\"transparencyGrid\")" } }, providers: [{ provide: PARENT_INSTANCE, useExisting: InputColorTransparencyGrid }], usesInheritance: true, hostDirectives: [{ directive: i1.Bind }], ngImport: i0, template: `<ng-content></ng-content>`, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
1945
- }
1946
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: InputColorTransparencyGrid, decorators: [{
1947
- type: Component,
1948
- args: [{
1949
- selector: 'p-inputcolor-transparency-grid',
1950
- standalone: true,
1951
- template: `<ng-content></ng-content>`,
1952
- changeDetection: ChangeDetectionStrategy.OnPush,
1953
- encapsulation: ViewEncapsulation.None,
1954
- host: {
1955
- '[class]': '$pc.cx("transparencyGrid")'
1956
- },
1957
- providers: [{ provide: PARENT_INSTANCE, useExisting: InputColorTransparencyGrid }],
1958
- hostDirectives: [Bind]
1959
- }]
1960
- }] });
1961
-
1534
+ changeDetection: ChangeDetectionStrategy.OnPush,
1535
+ encapsulation: ViewEncapsulation.None,
1536
+ host: { "[class]": "$pc.cx(\"eyeDropper\")" },
1537
+ providers: [{
1538
+ provide: PARENT_INSTANCE,
1539
+ useExisting: InputColorEyeDropper
1540
+ }],
1541
+ hostDirectives: [Bind]
1542
+ }]
1543
+ }],
1544
+ propDecorators: {
1545
+ text: [{
1546
+ type: i0.Input,
1547
+ args: [{
1548
+ isSignal: true,
1549
+ alias: "text",
1550
+ required: false
1551
+ }]
1552
+ }],
1553
+ rounded: [{
1554
+ type: i0.Input,
1555
+ args: [{
1556
+ isSignal: true,
1557
+ alias: "rounded",
1558
+ required: false
1559
+ }]
1560
+ }],
1561
+ outlined: [{
1562
+ type: i0.Input,
1563
+ args: [{
1564
+ isSignal: true,
1565
+ alias: "outlined",
1566
+ required: false
1567
+ }]
1568
+ }],
1569
+ iconOnly: [{
1570
+ type: i0.Input,
1571
+ args: [{
1572
+ isSignal: true,
1573
+ alias: "iconOnly",
1574
+ required: false
1575
+ }]
1576
+ }],
1577
+ severity: [{
1578
+ type: i0.Input,
1579
+ args: [{
1580
+ isSignal: true,
1581
+ alias: "severity",
1582
+ required: false
1583
+ }]
1584
+ }],
1585
+ size: [{
1586
+ type: i0.Input,
1587
+ args: [{
1588
+ isSignal: true,
1589
+ alias: "size",
1590
+ required: false
1591
+ }]
1592
+ }]
1593
+ }
1594
+ });
1595
+ var InputColorInput = class InputColorInput extends BaseComponent {
1596
+ componentName = "InputColorInput";
1597
+ $pc = inject(INPUT_COLOR_INSTANCE);
1598
+ channel = input.required(...ngDevMode ? [{ debugName: "channel" }] : /* istanbul ignore next */ []);
1599
+ type = input(...ngDevMode ? [void 0, { debugName: "type" }] : /* istanbul ignore next */ []);
1600
+ disabled = input(false, {
1601
+ ...ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {},
1602
+ transform: booleanAttribute
1603
+ });
1604
+ $disabled = computed(() => this.disabled() || this.$pc.$disabled(), ...ngDevMode ? [{ debugName: "$disabled" }] : /* istanbul ignore next */ []);
1605
+ $inputType = computed(() => {
1606
+ const t = this.type();
1607
+ if (t) return t;
1608
+ const ch = this.channel();
1609
+ return ch === "hex" || ch === "css" ? "text" : "number";
1610
+ }, ...ngDevMode ? [{ debugName: "$inputType" }] : /* istanbul ignore next */ []);
1611
+ $displayValue = computed(() => {
1612
+ const ch = this.channel();
1613
+ return getInputChannelValue(this.$pc.$color(), ch, this.$pc.format());
1614
+ }, ...ngDevMode ? [{ debugName: "$displayValue" }] : /* istanbul ignore next */ []);
1615
+ pendingValue = null;
1616
+ constructor() {
1617
+ super();
1618
+ effect(() => {
1619
+ this.el.nativeElement.type = this.$inputType();
1620
+ });
1621
+ effect(() => {
1622
+ const el = this.el.nativeElement;
1623
+ const ch = this.channel();
1624
+ if (ch !== "hex" && ch !== "css") {
1625
+ const range = getChannelRange(ch);
1626
+ el.min = String(range.minValue);
1627
+ el.max = String(range.maxValue);
1628
+ el.step = String(range.step);
1629
+ }
1630
+ });
1631
+ effect(() => {
1632
+ this.el.nativeElement.value = String(this.$displayValue() ?? "");
1633
+ });
1634
+ }
1635
+ onInput(event) {
1636
+ const target = event.target;
1637
+ this.pendingValue = target.value;
1638
+ }
1639
+ onBlur(event) {
1640
+ this.commitValue(event);
1641
+ }
1642
+ onEnter(event) {
1643
+ this.commitValue(event);
1644
+ }
1645
+ commitValue(event) {
1646
+ if (this.pendingValue === null) return;
1647
+ const ch = this.channel();
1648
+ const value = this.pendingValue;
1649
+ this.pendingValue = null;
1650
+ if (ch === "hex") {
1651
+ const parsed = parseColor(value.startsWith("#") ? value : `#${value}`);
1652
+ if (parsed) this.$pc.updateColor(parsed, event, true);
1653
+ } else if (ch === "css") {
1654
+ const parsed = parseColor(value);
1655
+ if (parsed) this.$pc.updateColor(parsed, event, true);
1656
+ } else {
1657
+ const numValue = parseFloat(value);
1658
+ if (!isNaN(numValue)) {
1659
+ const range = getChannelRange(ch);
1660
+ const clamped = Math.max(range.minValue, Math.min(range.maxValue, numValue));
1661
+ this.$pc.setChannelValue(ch, clamped, event, true);
1662
+ }
1663
+ }
1664
+ }
1665
+ static ɵfac = i0.ɵɵngDeclareFactory({
1666
+ minVersion: "12.0.0",
1667
+ version: "22.2.0",
1668
+ ngImport: i0,
1669
+ type: InputColorInput,
1670
+ deps: [],
1671
+ target: i0.ɵɵFactoryTarget.Directive
1672
+ });
1673
+ static ɵdir = i0.ɵɵngDeclareDirective({
1674
+ minVersion: "17.1.0",
1675
+ version: "22.2.0",
1676
+ type: InputColorInput,
1677
+ isStandalone: true,
1678
+ selector: "[pInputColorInput]",
1679
+ inputs: {
1680
+ channel: {
1681
+ classPropertyName: "channel",
1682
+ publicName: "channel",
1683
+ isSignal: true,
1684
+ isRequired: true,
1685
+ transformFunction: null
1686
+ },
1687
+ type: {
1688
+ classPropertyName: "type",
1689
+ publicName: "type",
1690
+ isSignal: true,
1691
+ isRequired: false,
1692
+ transformFunction: null
1693
+ },
1694
+ disabled: {
1695
+ classPropertyName: "disabled",
1696
+ publicName: "disabled",
1697
+ isSignal: true,
1698
+ isRequired: false,
1699
+ transformFunction: null
1700
+ }
1701
+ },
1702
+ host: {
1703
+ listeners: {
1704
+ "input": "onInput($event)",
1705
+ "blur": "onBlur($event)",
1706
+ "keydown.enter": "onEnter($event)"
1707
+ },
1708
+ properties: {
1709
+ "attr.disabled": "$disabled() || null",
1710
+ "attr.data-channel": "channel()"
1711
+ }
1712
+ },
1713
+ providers: [{
1714
+ provide: PARENT_INSTANCE,
1715
+ useExisting: InputColorInput
1716
+ }],
1717
+ usesInheritance: true,
1718
+ hostDirectives: [{
1719
+ directive: i1.InputText,
1720
+ inputs: [
1721
+ "pSize",
1722
+ "pSize",
1723
+ "fluid",
1724
+ "fluid",
1725
+ "variant",
1726
+ "variant",
1727
+ "invalid",
1728
+ "invalid"
1729
+ ]
1730
+ }],
1731
+ ngImport: i0
1732
+ });
1733
+ };
1734
+ i0.ɵɵngDeclareClassMetadata({
1735
+ minVersion: "12.0.0",
1736
+ version: "22.2.0",
1737
+ ngImport: i0,
1738
+ type: InputColorInput,
1739
+ decorators: [{
1740
+ type: Directive,
1741
+ args: [{
1742
+ selector: "[pInputColorInput]",
1743
+ standalone: true,
1744
+ host: {
1745
+ "[attr.disabled]": "$disabled() || null",
1746
+ "[attr.data-channel]": "channel()",
1747
+ "(input)": "onInput($event)",
1748
+ "(blur)": "onBlur($event)",
1749
+ "(keydown.enter)": "onEnter($event)"
1750
+ },
1751
+ providers: [{
1752
+ provide: PARENT_INSTANCE,
1753
+ useExisting: InputColorInput
1754
+ }],
1755
+ hostDirectives: [{
1756
+ directive: InputText,
1757
+ inputs: [
1758
+ "pSize",
1759
+ "fluid",
1760
+ "variant",
1761
+ "invalid"
1762
+ ]
1763
+ }]
1764
+ }]
1765
+ }],
1766
+ ctorParameters: () => [],
1767
+ propDecorators: {
1768
+ channel: [{
1769
+ type: i0.Input,
1770
+ args: [{
1771
+ isSignal: true,
1772
+ alias: "channel",
1773
+ required: true
1774
+ }]
1775
+ }],
1776
+ type: [{
1777
+ type: i0.Input,
1778
+ args: [{
1779
+ isSignal: true,
1780
+ alias: "type",
1781
+ required: false
1782
+ }]
1783
+ }],
1784
+ disabled: [{
1785
+ type: i0.Input,
1786
+ args: [{
1787
+ isSignal: true,
1788
+ alias: "disabled",
1789
+ required: false
1790
+ }]
1791
+ }]
1792
+ }
1793
+ });
1794
+ var InputColorSlider = class InputColorSlider extends BaseComponent {
1795
+ componentName = "InputColorSlider";
1796
+ bindDirectiveInstance = inject(Bind, { self: true });
1797
+ $pc = inject(INPUT_COLOR_INSTANCE);
1798
+ channel = input("hue", ...ngDevMode ? [{ debugName: "channel" }] : /* istanbul ignore next */ []);
1799
+ orientation = input("horizontal", ...ngDevMode ? [{ debugName: "orientation" }] : /* istanbul ignore next */ []);
1800
+ dragging = false;
1801
+ cleanupDrag = null;
1802
+ onAfterViewChecked() {
1803
+ this.bindDirectiveInstance.setAttrs(this.ptms(["host", "root"]));
1804
+ }
1805
+ onPointerDown(event) {
1806
+ if (this.$pc.$disabled()) return;
1807
+ event.preventDefault();
1808
+ this.dragging = true;
1809
+ const el = this.el.nativeElement;
1810
+ el.setPointerCapture(event.pointerId);
1811
+ this.updateFromPointer(event);
1812
+ const onMove = (e) => {
1813
+ if (!this.dragging) return;
1814
+ e.preventDefault();
1815
+ this.updateFromPointer(e);
1816
+ };
1817
+ const cleanup = () => {
1818
+ this.dragging = false;
1819
+ this.cleanupDrag = null;
1820
+ el.removeEventListener("pointermove", onMove);
1821
+ el.removeEventListener("pointerup", onUp);
1822
+ el.removeEventListener("pointercancel", onCancel);
1823
+ el.removeEventListener("lostpointercapture", onLostCapture);
1824
+ };
1825
+ this.cleanupDrag = cleanup;
1826
+ const onUp = (e) => {
1827
+ if (!this.dragging) return;
1828
+ this.updateFromPointer(e, true);
1829
+ cleanup();
1830
+ };
1831
+ const onCancel = () => {
1832
+ cleanup();
1833
+ };
1834
+ const onLostCapture = () => {
1835
+ cleanup();
1836
+ };
1837
+ el.addEventListener("pointermove", onMove);
1838
+ el.addEventListener("pointerup", onUp);
1839
+ el.addEventListener("pointercancel", onCancel);
1840
+ el.addEventListener("lostpointercapture", onLostCapture);
1841
+ }
1842
+ ngOnDestroy() {
1843
+ this.cleanupDrag?.();
1844
+ }
1845
+ updateFromPointer(event, isEnd = false) {
1846
+ const rect = this.el.nativeElement.getBoundingClientRect();
1847
+ const ch = this.channel();
1848
+ const range = getChannelRange(ch);
1849
+ let percent;
1850
+ if (this.orientation() === "vertical") percent = 1 - Math.max(0, Math.min(1, (event.clientY - rect.top) / rect.height));
1851
+ else percent = Math.max(0, Math.min(1, (event.clientX - rect.left) / rect.width));
1852
+ const value = snapValue(range.minValue + percent * (range.maxValue - range.minValue), range.minValue, range.maxValue, range.step);
1853
+ this.$pc.setChannelValue(ch, value, event, isEnd);
1854
+ }
1855
+ static ɵfac = i0.ɵɵngDeclareFactory({
1856
+ minVersion: "12.0.0",
1857
+ version: "22.2.0",
1858
+ ngImport: i0,
1859
+ type: InputColorSlider,
1860
+ deps: null,
1861
+ target: i0.ɵɵFactoryTarget.Component
1862
+ });
1863
+ static ɵcmp = i0.ɵɵngDeclareComponent({
1864
+ minVersion: "17.1.0",
1865
+ version: "22.2.0",
1866
+ type: InputColorSlider,
1867
+ isStandalone: true,
1868
+ selector: "p-inputcolor-slider",
1869
+ inputs: {
1870
+ channel: {
1871
+ classPropertyName: "channel",
1872
+ publicName: "channel",
1873
+ isSignal: true,
1874
+ isRequired: false,
1875
+ transformFunction: null
1876
+ },
1877
+ orientation: {
1878
+ classPropertyName: "orientation",
1879
+ publicName: "orientation",
1880
+ isSignal: true,
1881
+ isRequired: false,
1882
+ transformFunction: null
1883
+ }
1884
+ },
1885
+ host: {
1886
+ listeners: { "pointerdown": "onPointerDown($event)" },
1887
+ properties: {
1888
+ "class": "$pc.cx(\"slider\")",
1889
+ "class.p-inputcolor-slider-horizontal": "orientation() === \"horizontal\"",
1890
+ "class.p-inputcolor-slider-vertical": "orientation() === \"vertical\"",
1891
+ "attr.data-orientation": "orientation()"
1892
+ }
1893
+ },
1894
+ providers: [{
1895
+ provide: INPUT_COLOR_SLIDER_INSTANCE,
1896
+ useExisting: InputColorSlider
1897
+ }, {
1898
+ provide: PARENT_INSTANCE,
1899
+ useExisting: InputColorSlider
1900
+ }],
1901
+ usesInheritance: true,
1902
+ hostDirectives: [{ directive: i1$1.Bind }],
1903
+ ngImport: i0,
1904
+ template: `<ng-content></ng-content>`,
1905
+ isInline: true,
1906
+ changeDetection: i0.ChangeDetectionStrategy.OnPush,
1907
+ encapsulation: i0.ViewEncapsulation.None
1908
+ });
1909
+ };
1910
+ i0.ɵɵngDeclareClassMetadata({
1911
+ minVersion: "12.0.0",
1912
+ version: "22.2.0",
1913
+ ngImport: i0,
1914
+ type: InputColorSlider,
1915
+ decorators: [{
1916
+ type: Component,
1917
+ args: [{
1918
+ selector: "p-inputcolor-slider",
1919
+ standalone: true,
1920
+ template: `<ng-content></ng-content>`,
1921
+ changeDetection: ChangeDetectionStrategy.OnPush,
1922
+ encapsulation: ViewEncapsulation.None,
1923
+ host: {
1924
+ "[class]": "$pc.cx(\"slider\")",
1925
+ "[class.p-inputcolor-slider-horizontal]": "orientation() === \"horizontal\"",
1926
+ "[class.p-inputcolor-slider-vertical]": "orientation() === \"vertical\"",
1927
+ "[attr.data-orientation]": "orientation()",
1928
+ "(pointerdown)": "onPointerDown($event)"
1929
+ },
1930
+ providers: [{
1931
+ provide: INPUT_COLOR_SLIDER_INSTANCE,
1932
+ useExisting: InputColorSlider
1933
+ }, {
1934
+ provide: PARENT_INSTANCE,
1935
+ useExisting: InputColorSlider
1936
+ }],
1937
+ hostDirectives: [Bind]
1938
+ }]
1939
+ }],
1940
+ propDecorators: {
1941
+ channel: [{
1942
+ type: i0.Input,
1943
+ args: [{
1944
+ isSignal: true,
1945
+ alias: "channel",
1946
+ required: false
1947
+ }]
1948
+ }],
1949
+ orientation: [{
1950
+ type: i0.Input,
1951
+ args: [{
1952
+ isSignal: true,
1953
+ alias: "orientation",
1954
+ required: false
1955
+ }]
1956
+ }]
1957
+ }
1958
+ });
1959
+ var InputColorSliderHandle = class InputColorSliderHandle extends BaseComponent {
1960
+ componentName = "InputColorSliderHandle";
1961
+ bindDirectiveInstance = inject(Bind, { self: true });
1962
+ $pc = inject(INPUT_COLOR_INSTANCE);
1963
+ pcSlider = inject(INPUT_COLOR_SLIDER_INSTANCE);
1964
+ $channel = computed(() => this.pcSlider.channel(), ...ngDevMode ? [{ debugName: "$channel" }] : /* istanbul ignore next */ []);
1965
+ $isVertical = computed(() => this.pcSlider.orientation() === "vertical", ...ngDevMode ? [{ debugName: "$isVertical" }] : /* istanbul ignore next */ []);
1966
+ $range = computed(() => getChannelRange(this.$channel()), ...ngDevMode ? [{ debugName: "$range" }] : /* istanbul ignore next */ []);
1967
+ $value = computed(() => this.$pc.$color().getChannelValue(this.$channel()), ...ngDevMode ? [{ debugName: "$value" }] : /* istanbul ignore next */ []);
1968
+ $tabindex = computed(() => this.$pc.$disabled() ? -1 : 0, ...ngDevMode ? [{ debugName: "$tabindex" }] : /* istanbul ignore next */ []);
1969
+ $ariaDisabled = computed(() => this.$pc.$disabled() || void 0, ...ngDevMode ? [{ debugName: "$ariaDisabled" }] : /* istanbul ignore next */ []);
1970
+ $handlePosition = computed(() => {
1971
+ const range = this.$range();
1972
+ return `${(this.$value() - range.minValue) / (range.maxValue - range.minValue) * 100}%`;
1973
+ }, ...ngDevMode ? [{ debugName: "$handlePosition" }] : /* istanbul ignore next */ []);
1974
+ $handlePositionVertical = computed(() => {
1975
+ const range = this.$range();
1976
+ return `${100 - (this.$value() - range.minValue) / (range.maxValue - range.minValue) * 100}%`;
1977
+ }, ...ngDevMode ? [{ debugName: "$handlePositionVertical" }] : /* istanbul ignore next */ []);
1978
+ $left = computed(() => this.$isVertical() ? null : this.$handlePosition(), ...ngDevMode ? [{ debugName: "$left" }] : /* istanbul ignore next */ []);
1979
+ $top = computed(() => this.$isVertical() ? this.$handlePositionVertical() : null, ...ngDevMode ? [{ debugName: "$top" }] : /* istanbul ignore next */ []);
1980
+ $translate = computed(() => this.$isVertical() ? "0 -50%" : "-50% 0", ...ngDevMode ? [{ debugName: "$translate" }] : /* istanbul ignore next */ []);
1981
+ $handleColor = computed(() => getChannelColor(this.$pc.$color(), this.$channel()).toRgbString(), ...ngDevMode ? [{ debugName: "$handleColor" }] : /* istanbul ignore next */ []);
1982
+ onAfterViewChecked() {
1983
+ this.bindDirectiveInstance.setAttrs(this.ptms(["host", "root"]));
1984
+ }
1985
+ onKeyDown(event) {
1986
+ if (this.$pc.$disabled()) return;
1987
+ const ch = this.$channel();
1988
+ const range = this.$range();
1989
+ let value = this.$value();
1990
+ let handled = false;
1991
+ switch (event.key) {
1992
+ case "ArrowRight":
1993
+ case "ArrowUp":
1994
+ value = Math.min(value + range.step, range.maxValue);
1995
+ handled = true;
1996
+ break;
1997
+ case "ArrowLeft":
1998
+ case "ArrowDown":
1999
+ value = Math.max(value - range.step, range.minValue);
2000
+ handled = true;
2001
+ break;
2002
+ case "PageUp":
2003
+ value = Math.min(value + range.pageStep, range.maxValue);
2004
+ handled = true;
2005
+ break;
2006
+ case "PageDown":
2007
+ value = Math.max(value - range.pageStep, range.minValue);
2008
+ handled = true;
2009
+ break;
2010
+ case "Home":
2011
+ value = range.minValue;
2012
+ handled = true;
2013
+ break;
2014
+ case "End":
2015
+ value = range.maxValue;
2016
+ handled = true;
2017
+ }
2018
+ if (handled) {
2019
+ event.preventDefault();
2020
+ this.$pc.setChannelValue(ch, value, event, true);
2021
+ }
2022
+ }
2023
+ static ɵfac = i0.ɵɵngDeclareFactory({
2024
+ minVersion: "12.0.0",
2025
+ version: "22.2.0",
2026
+ ngImport: i0,
2027
+ type: InputColorSliderHandle,
2028
+ deps: null,
2029
+ target: i0.ɵɵFactoryTarget.Component
2030
+ });
2031
+ static ɵcmp = i0.ɵɵngDeclareComponent({
2032
+ minVersion: "14.0.0",
2033
+ version: "22.2.0",
2034
+ type: InputColorSliderHandle,
2035
+ isStandalone: true,
2036
+ selector: "p-inputcolor-slider-handle",
2037
+ host: {
2038
+ listeners: { "keydown": "onKeyDown($event)" },
2039
+ properties: {
2040
+ "class": "$pc.cx(\"sliderHandle\")",
2041
+ "style.--px-slider-handle-background": "$handleColor()",
2042
+ "style.left": "$left()",
2043
+ "style.top": "$top()",
2044
+ "style.translate": "$translate()",
2045
+ "attr.role": "'slider'",
2046
+ "attr.tabindex": "$tabindex()",
2047
+ "attr.aria-label": "$channel()",
2048
+ "attr.aria-disabled": "$ariaDisabled()",
2049
+ "attr.aria-valuemin": "$range().minValue",
2050
+ "attr.aria-valuemax": "$range().maxValue",
2051
+ "attr.aria-valuenow": "$value()"
2052
+ }
2053
+ },
2054
+ providers: [{
2055
+ provide: PARENT_INSTANCE,
2056
+ useExisting: InputColorSliderHandle
2057
+ }],
2058
+ usesInheritance: true,
2059
+ hostDirectives: [{ directive: i1$1.Bind }],
2060
+ ngImport: i0,
2061
+ template: `<ng-content></ng-content>`,
2062
+ isInline: true,
2063
+ changeDetection: i0.ChangeDetectionStrategy.OnPush,
2064
+ encapsulation: i0.ViewEncapsulation.None
2065
+ });
2066
+ };
2067
+ i0.ɵɵngDeclareClassMetadata({
2068
+ minVersion: "12.0.0",
2069
+ version: "22.2.0",
2070
+ ngImport: i0,
2071
+ type: InputColorSliderHandle,
2072
+ decorators: [{
2073
+ type: Component,
2074
+ args: [{
2075
+ selector: "p-inputcolor-slider-handle",
2076
+ standalone: true,
2077
+ template: `<ng-content></ng-content>`,
2078
+ changeDetection: ChangeDetectionStrategy.OnPush,
2079
+ encapsulation: ViewEncapsulation.None,
2080
+ host: {
2081
+ "[class]": "$pc.cx(\"sliderHandle\")",
2082
+ "[style.--px-slider-handle-background]": "$handleColor()",
2083
+ "[style.left]": "$left()",
2084
+ "[style.top]": "$top()",
2085
+ "[style.translate]": "$translate()",
2086
+ "[attr.role]": "'slider'",
2087
+ "[attr.tabindex]": "$tabindex()",
2088
+ "[attr.aria-label]": "$channel()",
2089
+ "[attr.aria-disabled]": "$ariaDisabled()",
2090
+ "[attr.aria-valuemin]": "$range().minValue",
2091
+ "[attr.aria-valuemax]": "$range().maxValue",
2092
+ "[attr.aria-valuenow]": "$value()",
2093
+ "(keydown)": "onKeyDown($event)"
2094
+ },
2095
+ providers: [{
2096
+ provide: PARENT_INSTANCE,
2097
+ useExisting: InputColorSliderHandle
2098
+ }],
2099
+ hostDirectives: [Bind]
2100
+ }]
2101
+ }]
2102
+ });
2103
+ var InputColorSliderTrack = class InputColorSliderTrack extends BaseComponent {
2104
+ componentName = "InputColorSliderTrack";
2105
+ bindDirectiveInstance = inject(Bind, { self: true });
2106
+ $pc = inject(INPUT_COLOR_INSTANCE);
2107
+ pcSlider = inject(INPUT_COLOR_SLIDER_INSTANCE);
2108
+ $gradient = computed(() => {
2109
+ const ch = this.pcSlider.channel();
2110
+ return getChannelGradient(this.$pc.$color(), ch, this.pcSlider.orientation());
2111
+ }, ...ngDevMode ? [{ debugName: "$gradient" }] : /* istanbul ignore next */ []);
2112
+ onAfterViewChecked() {
2113
+ this.bindDirectiveInstance.setAttrs(this.ptms(["host", "root"]));
2114
+ }
2115
+ static ɵfac = i0.ɵɵngDeclareFactory({
2116
+ minVersion: "12.0.0",
2117
+ version: "22.2.0",
2118
+ ngImport: i0,
2119
+ type: InputColorSliderTrack,
2120
+ deps: null,
2121
+ target: i0.ɵɵFactoryTarget.Component
2122
+ });
2123
+ static ɵcmp = i0.ɵɵngDeclareComponent({
2124
+ minVersion: "14.0.0",
2125
+ version: "22.2.0",
2126
+ type: InputColorSliderTrack,
2127
+ isStandalone: true,
2128
+ selector: "p-inputcolor-slider-track",
2129
+ host: { properties: {
2130
+ "class": "$pc.cx(\"sliderTrack\")",
2131
+ "style.--px-slider-background": "$gradient()"
2132
+ } },
2133
+ providers: [{
2134
+ provide: PARENT_INSTANCE,
2135
+ useExisting: InputColorSliderTrack
2136
+ }],
2137
+ usesInheritance: true,
2138
+ hostDirectives: [{ directive: i1$1.Bind }],
2139
+ ngImport: i0,
2140
+ template: `<ng-content></ng-content>`,
2141
+ isInline: true,
2142
+ changeDetection: i0.ChangeDetectionStrategy.OnPush,
2143
+ encapsulation: i0.ViewEncapsulation.None
2144
+ });
2145
+ };
2146
+ i0.ɵɵngDeclareClassMetadata({
2147
+ minVersion: "12.0.0",
2148
+ version: "22.2.0",
2149
+ ngImport: i0,
2150
+ type: InputColorSliderTrack,
2151
+ decorators: [{
2152
+ type: Component,
2153
+ args: [{
2154
+ selector: "p-inputcolor-slider-track",
2155
+ standalone: true,
2156
+ template: `<ng-content></ng-content>`,
2157
+ changeDetection: ChangeDetectionStrategy.OnPush,
2158
+ encapsulation: ViewEncapsulation.None,
2159
+ host: {
2160
+ "[class]": "$pc.cx(\"sliderTrack\")",
2161
+ "[style.--px-slider-background]": "$gradient()"
2162
+ },
2163
+ providers: [{
2164
+ provide: PARENT_INSTANCE,
2165
+ useExisting: InputColorSliderTrack
2166
+ }],
2167
+ hostDirectives: [Bind]
2168
+ }]
2169
+ }]
2170
+ });
2171
+ var InputColorSwatch = class InputColorSwatch extends BaseComponent {
2172
+ componentName = "InputColorSwatch";
2173
+ bindDirectiveInstance = inject(Bind, { self: true });
2174
+ $pc = inject(INPUT_COLOR_INSTANCE);
2175
+ onAfterViewChecked() {
2176
+ this.bindDirectiveInstance.setAttrs(this.ptms(["host", "root"]));
2177
+ }
2178
+ static ɵfac = i0.ɵɵngDeclareFactory({
2179
+ minVersion: "12.0.0",
2180
+ version: "22.2.0",
2181
+ ngImport: i0,
2182
+ type: InputColorSwatch,
2183
+ deps: null,
2184
+ target: i0.ɵɵFactoryTarget.Component
2185
+ });
2186
+ static ɵcmp = i0.ɵɵngDeclareComponent({
2187
+ minVersion: "14.0.0",
2188
+ version: "22.2.0",
2189
+ type: InputColorSwatch,
2190
+ isStandalone: true,
2191
+ selector: "p-inputcolor-swatch",
2192
+ host: { properties: { "class": "$pc.cx(\"swatch\")" } },
2193
+ providers: [{
2194
+ provide: PARENT_INSTANCE,
2195
+ useExisting: InputColorSwatch
2196
+ }],
2197
+ usesInheritance: true,
2198
+ hostDirectives: [{ directive: i1$1.Bind }],
2199
+ ngImport: i0,
2200
+ template: `<ng-content></ng-content>`,
2201
+ isInline: true,
2202
+ changeDetection: i0.ChangeDetectionStrategy.OnPush,
2203
+ encapsulation: i0.ViewEncapsulation.None
2204
+ });
2205
+ };
2206
+ i0.ɵɵngDeclareClassMetadata({
2207
+ minVersion: "12.0.0",
2208
+ version: "22.2.0",
2209
+ ngImport: i0,
2210
+ type: InputColorSwatch,
2211
+ decorators: [{
2212
+ type: Component,
2213
+ args: [{
2214
+ selector: "p-inputcolor-swatch",
2215
+ standalone: true,
2216
+ template: `<ng-content></ng-content>`,
2217
+ changeDetection: ChangeDetectionStrategy.OnPush,
2218
+ encapsulation: ViewEncapsulation.None,
2219
+ host: { "[class]": "$pc.cx(\"swatch\")" },
2220
+ providers: [{
2221
+ provide: PARENT_INSTANCE,
2222
+ useExisting: InputColorSwatch
2223
+ }],
2224
+ hostDirectives: [Bind]
2225
+ }]
2226
+ }]
2227
+ });
2228
+ var InputColorSwatchBackground = class InputColorSwatchBackground extends BaseComponent {
2229
+ componentName = "InputColorSwatchBackground";
2230
+ bindDirectiveInstance = inject(Bind, { self: true });
2231
+ $pc = inject(INPUT_COLOR_INSTANCE);
2232
+ $swatchColor = computed(() => this.$pc.$color().toRgbString(), ...ngDevMode ? [{ debugName: "$swatchColor" }] : /* istanbul ignore next */ []);
2233
+ onAfterViewChecked() {
2234
+ this.bindDirectiveInstance.setAttrs(this.ptms(["host", "root"]));
2235
+ }
2236
+ static ɵfac = i0.ɵɵngDeclareFactory({
2237
+ minVersion: "12.0.0",
2238
+ version: "22.2.0",
2239
+ ngImport: i0,
2240
+ type: InputColorSwatchBackground,
2241
+ deps: null,
2242
+ target: i0.ɵɵFactoryTarget.Component
2243
+ });
2244
+ static ɵcmp = i0.ɵɵngDeclareComponent({
2245
+ minVersion: "14.0.0",
2246
+ version: "22.2.0",
2247
+ type: InputColorSwatchBackground,
2248
+ isStandalone: true,
2249
+ selector: "p-inputcolor-swatch-background",
2250
+ host: { properties: {
2251
+ "class": "$pc.cx(\"swatchBackground\")",
2252
+ "style.--px-swatch-background": "$swatchColor()"
2253
+ } },
2254
+ providers: [{
2255
+ provide: PARENT_INSTANCE,
2256
+ useExisting: InputColorSwatchBackground
2257
+ }],
2258
+ usesInheritance: true,
2259
+ hostDirectives: [{ directive: i1$1.Bind }],
2260
+ ngImport: i0,
2261
+ template: `<ng-content></ng-content>`,
2262
+ isInline: true,
2263
+ changeDetection: i0.ChangeDetectionStrategy.OnPush,
2264
+ encapsulation: i0.ViewEncapsulation.None
2265
+ });
2266
+ };
2267
+ i0.ɵɵngDeclareClassMetadata({
2268
+ minVersion: "12.0.0",
2269
+ version: "22.2.0",
2270
+ ngImport: i0,
2271
+ type: InputColorSwatchBackground,
2272
+ decorators: [{
2273
+ type: Component,
2274
+ args: [{
2275
+ selector: "p-inputcolor-swatch-background",
2276
+ standalone: true,
2277
+ template: `<ng-content></ng-content>`,
2278
+ changeDetection: ChangeDetectionStrategy.OnPush,
2279
+ encapsulation: ViewEncapsulation.None,
2280
+ host: {
2281
+ "[class]": "$pc.cx(\"swatchBackground\")",
2282
+ "[style.--px-swatch-background]": "$swatchColor()"
2283
+ },
2284
+ providers: [{
2285
+ provide: PARENT_INSTANCE,
2286
+ useExisting: InputColorSwatchBackground
2287
+ }],
2288
+ hostDirectives: [Bind]
2289
+ }]
2290
+ }]
2291
+ });
2292
+ var InputColorTransparencyGrid = class InputColorTransparencyGrid extends BaseComponent {
2293
+ componentName = "InputColorTransparencyGrid";
2294
+ bindDirectiveInstance = inject(Bind, { self: true });
2295
+ $pc = inject(INPUT_COLOR_INSTANCE);
2296
+ onAfterViewChecked() {
2297
+ this.bindDirectiveInstance.setAttrs(this.ptms(["host", "root"]));
2298
+ }
2299
+ static ɵfac = i0.ɵɵngDeclareFactory({
2300
+ minVersion: "12.0.0",
2301
+ version: "22.2.0",
2302
+ ngImport: i0,
2303
+ type: InputColorTransparencyGrid,
2304
+ deps: null,
2305
+ target: i0.ɵɵFactoryTarget.Component
2306
+ });
2307
+ static ɵcmp = i0.ɵɵngDeclareComponent({
2308
+ minVersion: "14.0.0",
2309
+ version: "22.2.0",
2310
+ type: InputColorTransparencyGrid,
2311
+ isStandalone: true,
2312
+ selector: "p-inputcolor-transparency-grid",
2313
+ host: { properties: { "class": "$pc.cx(\"transparencyGrid\")" } },
2314
+ providers: [{
2315
+ provide: PARENT_INSTANCE,
2316
+ useExisting: InputColorTransparencyGrid
2317
+ }],
2318
+ usesInheritance: true,
2319
+ hostDirectives: [{ directive: i1$1.Bind }],
2320
+ ngImport: i0,
2321
+ template: `<ng-content></ng-content>`,
2322
+ isInline: true,
2323
+ changeDetection: i0.ChangeDetectionStrategy.OnPush,
2324
+ encapsulation: i0.ViewEncapsulation.None
2325
+ });
2326
+ };
2327
+ i0.ɵɵngDeclareClassMetadata({
2328
+ minVersion: "12.0.0",
2329
+ version: "22.2.0",
2330
+ ngImport: i0,
2331
+ type: InputColorTransparencyGrid,
2332
+ decorators: [{
2333
+ type: Component,
2334
+ args: [{
2335
+ selector: "p-inputcolor-transparency-grid",
2336
+ standalone: true,
2337
+ template: `<ng-content></ng-content>`,
2338
+ changeDetection: ChangeDetectionStrategy.OnPush,
2339
+ encapsulation: ViewEncapsulation.None,
2340
+ host: { "[class]": "$pc.cx(\"transparencyGrid\")" },
2341
+ providers: [{
2342
+ provide: PARENT_INSTANCE,
2343
+ useExisting: InputColorTransparencyGrid
2344
+ }],
2345
+ hostDirectives: [Bind]
2346
+ }]
2347
+ }]
2348
+ });
1962
2349
  const classes = {
1963
- root: 'p-inputcolor p-component',
1964
- area: 'p-inputcolor-area',
1965
- areaHandle: ({ instance }) => ['p-inputcolor-area-handle', { 'p-disabled': instance.$disabled() }],
1966
- areaBackground: 'p-inputcolor-area-background',
1967
- slider: 'p-inputcolor-slider',
1968
- sliderHandle: ({ instance }) => ['p-inputcolor-slider-handle', { 'p-disabled': instance.$disabled() }],
1969
- sliderTrack: 'p-inputcolor-slider-track',
1970
- transparencyGrid: 'p-inputcolor-transparency-grid',
1971
- swatch: 'p-inputcolor-swatch',
1972
- swatchBackground: 'p-inputcolor-swatch-background',
1973
- eyeDropper: 'p-inputcolor-eyedropper'
2350
+ root: "p-inputcolor p-component",
2351
+ area: "p-inputcolor-area",
2352
+ areaHandle: ({ instance }) => ["p-inputcolor-area-handle", { "p-disabled": instance.$disabled() }],
2353
+ areaBackground: "p-inputcolor-area-background",
2354
+ slider: "p-inputcolor-slider",
2355
+ sliderHandle: ({ instance }) => ["p-inputcolor-slider-handle", { "p-disabled": instance.$disabled() }],
2356
+ sliderTrack: "p-inputcolor-slider-track",
2357
+ transparencyGrid: "p-inputcolor-transparency-grid",
2358
+ swatch: "p-inputcolor-swatch",
2359
+ swatchBackground: "p-inputcolor-swatch-background",
2360
+ eyeDropper: "p-inputcolor-eyedropper"
1974
2361
  };
1975
- class InputColorStyle extends BaseStyle {
1976
- name = 'inputcolor';
1977
- style = style;
1978
- classes = classes;
1979
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: InputColorStyle, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
1980
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: InputColorStyle });
1981
- }
1982
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: InputColorStyle, decorators: [{
1983
- type: Injectable
1984
- }] });
1985
- /**
1986
- *
1987
- * InputColor is a composable color picker component.
1988
- *
1989
- * [Live Demo](https://www.primeng.org/inputcolor/)
1990
- *
1991
- * @module inputcolorstyle
1992
- *
1993
- */
2362
+ var InputColorStyle = class InputColorStyle extends BaseStyle {
2363
+ name = "inputcolor";
2364
+ style = style;
2365
+ classes = classes;
2366
+ static ɵfac = i0.ɵɵngDeclareFactory({
2367
+ minVersion: "12.0.0",
2368
+ version: "22.2.0",
2369
+ ngImport: i0,
2370
+ type: InputColorStyle,
2371
+ deps: null,
2372
+ target: i0.ɵɵFactoryTarget.Injectable
2373
+ });
2374
+ static ɵprov = i0.ɵɵngDeclareInjectable({
2375
+ minVersion: "12.0.0",
2376
+ version: "22.2.0",
2377
+ ngImport: i0,
2378
+ type: InputColorStyle
2379
+ });
2380
+ };
2381
+ i0.ɵɵngDeclareClassMetadata({
2382
+ minVersion: "12.0.0",
2383
+ version: "22.2.0",
2384
+ ngImport: i0,
2385
+ type: InputColorStyle,
2386
+ decorators: [{ type: Injectable }]
2387
+ });
1994
2388
  var InputColorClasses;
1995
- (function (InputColorClasses) {
1996
- /**
1997
- * Class name of the root element
1998
- */
1999
- InputColorClasses["root"] = "p-inputcolor";
2000
- /**
2001
- * Class name of the area element
2002
- */
2003
- InputColorClasses["area"] = "p-inputcolor-area";
2004
- /**
2005
- * Class name of the area background element
2006
- */
2007
- InputColorClasses["areaBackground"] = "p-inputcolor-area-background";
2008
- /**
2009
- * Class name of the area handle element
2010
- */
2011
- InputColorClasses["areaHandle"] = "p-inputcolor-area-handle";
2012
- /**
2013
- * Class name of the slider element
2014
- */
2015
- InputColorClasses["slider"] = "p-inputcolor-slider";
2016
- /**
2017
- * Class name of the slider track element
2018
- */
2019
- InputColorClasses["sliderTrack"] = "p-inputcolor-slider-track";
2020
- /**
2021
- * Class name of the slider handle element
2022
- */
2023
- InputColorClasses["sliderHandle"] = "p-inputcolor-slider-handle";
2024
- /**
2025
- * Class name of the swatch element
2026
- */
2027
- InputColorClasses["swatch"] = "p-inputcolor-swatch";
2028
- /**
2029
- * Class name of the swatch background element
2030
- */
2031
- InputColorClasses["swatchBackground"] = "p-inputcolor-swatch-background";
2032
- /**
2033
- * Class name of the transparency grid element
2034
- */
2035
- InputColorClasses["transparencyGrid"] = "p-inputcolor-transparency-grid";
2036
- /**
2037
- * Class name of the input element
2038
- */
2039
- InputColorClasses["input"] = "p-inputcolor-input";
2040
- /**
2041
- * Class name of the eye dropper element
2042
- */
2043
- InputColorClasses["eyeDropper"] = "p-inputcolor-eyedropper";
2389
+ (function(InputColorClasses) {
2390
+ InputColorClasses["root"] = "p-inputcolor";
2391
+ InputColorClasses["area"] = "p-inputcolor-area";
2392
+ InputColorClasses["areaBackground"] = "p-inputcolor-area-background";
2393
+ InputColorClasses["areaHandle"] = "p-inputcolor-area-handle";
2394
+ InputColorClasses["slider"] = "p-inputcolor-slider";
2395
+ InputColorClasses["sliderTrack"] = "p-inputcolor-slider-track";
2396
+ InputColorClasses["sliderHandle"] = "p-inputcolor-slider-handle";
2397
+ InputColorClasses["swatch"] = "p-inputcolor-swatch";
2398
+ InputColorClasses["swatchBackground"] = "p-inputcolor-swatch-background";
2399
+ InputColorClasses["transparencyGrid"] = "p-inputcolor-transparency-grid";
2400
+ InputColorClasses["input"] = "p-inputcolor-input";
2401
+ InputColorClasses["eyeDropper"] = "p-inputcolor-eyedropper";
2044
2402
  })(InputColorClasses || (InputColorClasses = {}));
2045
-
2046
2403
  const INPUT_COLOR_VALUE_ACCESSOR = {
2047
- provide: NG_VALUE_ACCESSOR,
2048
- useExisting: forwardRef(() => InputColor),
2049
- multi: true
2404
+ provide: NG_VALUE_ACCESSOR,
2405
+ useExisting: forwardRef(() => InputColor),
2406
+ multi: true
2050
2407
  };
2051
- /**
2052
- * InputColor is a composable color picker component.
2053
- * @group Components
2054
- */
2055
- class InputColor extends BaseComponent {
2056
- componentName = 'InputColor';
2057
- bindDirectiveInstance = inject(Bind, { self: true });
2058
- _componentStyle = inject(InputColorStyle);
2059
- /**
2060
- * Color format/space used internally.
2061
- * @group Props
2062
- */
2063
- format = input('hsba', /* @ts-ignore */
2064
- ...(ngDevMode ? [{ debugName: "format" }] : /* istanbul ignore next */ []));
2065
- /**
2066
- * When present, it specifies that the component should be disabled.
2067
- * @group Props
2068
- */
2069
- disabled = input(false, { ...(ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
2070
- _disabled = signal(false, /* @ts-ignore */
2071
- ...(ngDevMode ? [{ debugName: "_disabled" }] : /* istanbul ignore next */ []));
2072
- $disabled = computed(() => this.disabled() || this._disabled(), /* @ts-ignore */
2073
- ...(ngDevMode ? [{ debugName: "$disabled" }] : /* istanbul ignore next */ []));
2074
- /**
2075
- * Callback on value change (during interaction).
2076
- * @group Emits
2077
- */
2078
- onValueChange = output();
2079
- /**
2080
- * Callback when interaction ends (mouseup/touchend/keyup).
2081
- * @group Emits
2082
- */
2083
- onValueChangeEnd = output();
2084
- // Internal color state
2085
- _color = signal(null, /* @ts-ignore */
2086
- ...(ngDevMode ? [{ debugName: "_color" }] : /* istanbul ignore next */ []));
2087
- // Computed color - resolved from internal state or fallback
2088
- $color = computed(() => this._color() || parseColor('#ff0000').toFormat(this.format()), /* @ts-ignore */
2089
- ...(ngDevMode ? [{ debugName: "$color" }] : /* istanbul ignore next */ []));
2090
- // Computed 2D axes based on format
2091
- $axes = computed(() => getDefault2DAxes(this.format()), /* @ts-ignore */
2092
- ...(ngDevMode ? [{ debugName: "$axes" }] : /* istanbul ignore next */ []));
2093
- onAfterViewChecked() {
2094
- this.bindDirectiveInstance.setAttrs(this.ptms(['host', 'root']));
2095
- }
2096
- /**
2097
- * Update color and emit changes
2098
- */
2099
- updateColor(color, event, isEnd = false) {
2100
- this._color.set(color);
2101
- const outputValue = color.toString(this.format());
2102
- this.onModelChange(outputValue);
2103
- this.onValueChange.emit({ color, originalEvent: event });
2104
- if (isEnd) {
2105
- this.onValueChangeEnd.emit({ color, originalEvent: event });
2106
- this.onModelTouched();
2107
- }
2108
- }
2109
- /**
2110
- * Set a specific channel value
2111
- */
2112
- setChannelValue(channel, value, event, isEnd = false) {
2113
- const color = this.toChannelNativeFormat(this.$color(), channel);
2114
- const newColor = color.setChannelValue(channel, value);
2115
- this.updateColor(newColor, event, isEnd);
2116
- }
2117
- // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
2118
- onModelChange = () => { };
2119
- // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
2120
- onModelTouched = () => { };
2121
- // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
2122
- registerOnChange(fn) {
2123
- this.onModelChange = fn;
2124
- }
2125
- // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
2126
- registerOnTouched(fn) {
2127
- this.onModelTouched = fn;
2128
- }
2129
- setDisabledState(val) {
2130
- this._disabled.set(val);
2131
- }
2132
- writeValue(value) {
2133
- if (value) {
2134
- const current = this._color();
2135
- if (current && current.toString(this.format()) === value) {
2136
- return;
2137
- }
2138
- const parsed = parseColor(value);
2139
- if (parsed) {
2140
- this._color.set(parsed.toFormat(this.format()));
2141
- }
2142
- }
2143
- else {
2144
- this._color.set(null);
2145
- }
2146
- }
2147
- toChannelNativeFormat(color, channel) {
2148
- // If the current color natively supports this channel, don't convert
2149
- if (color instanceof HSBColor && (channel === 'hue' || channel === 'saturation' || channel === 'brightness'))
2150
- return color;
2151
- if (color instanceof HSLColor && (channel === 'hue' || channel === 'saturation' || channel === 'lightness'))
2152
- return color;
2153
- if (color instanceof RGBColor && (channel === 'red' || channel === 'green' || channel === 'blue'))
2154
- return color;
2155
- if (color instanceof OKLCHColor && (channel === 'oklchLightness' || channel === 'oklchChroma' || channel === 'oklchHue' || channel === 'L' || channel === 'C' || channel === 'H'))
2156
- return color;
2157
- // Otherwise convert to the appropriate format
2158
- switch (channel) {
2159
- case 'hue':
2160
- case 'saturation':
2161
- case 'brightness':
2162
- return color.toHSB();
2163
- case 'lightness':
2164
- return color.toHSL();
2165
- case 'red':
2166
- case 'green':
2167
- case 'blue':
2168
- return color.toRGB();
2169
- case 'oklchLightness':
2170
- case 'oklchChroma':
2171
- case 'oklchHue':
2172
- case 'L':
2173
- case 'C':
2174
- case 'H':
2175
- return color.toOKLCH();
2176
- case 'alpha':
2177
- default:
2178
- return color;
2179
- }
2180
- }
2181
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: InputColor, deps: null, target: i0.ɵɵFactoryTarget.Component });
2182
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.1.5", type: InputColor, isStandalone: true, selector: "p-inputcolor, p-input-color", inputs: { format: { classPropertyName: "format", publicName: "format", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { onValueChange: "onValueChange", onValueChangeEnd: "onValueChangeEnd" }, host: { properties: { "attr.data-pc-name": "'inputcolor'", "attr.data-pc-section": "'root'", "class": "cx('root')" } }, providers: [INPUT_COLOR_VALUE_ACCESSOR, InputColorStyle, { provide: INPUT_COLOR_INSTANCE, useExisting: InputColor }, { provide: PARENT_INSTANCE, useExisting: InputColor }], usesInheritance: true, hostDirectives: [{ directive: i1.Bind }], ngImport: i0, template: `<ng-content></ng-content>`, isInline: true, dependencies: [{ kind: "ngmodule", type: SharedModule }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
2183
- }
2184
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: InputColor, decorators: [{
2185
- type: Component,
2186
- args: [{
2187
- selector: 'p-inputcolor, p-input-color',
2188
- standalone: true,
2189
- imports: [SharedModule],
2190
- template: `<ng-content></ng-content>`,
2191
- providers: [INPUT_COLOR_VALUE_ACCESSOR, InputColorStyle, { provide: INPUT_COLOR_INSTANCE, useExisting: InputColor }, { provide: PARENT_INSTANCE, useExisting: InputColor }],
2192
- changeDetection: ChangeDetectionStrategy.OnPush,
2193
- encapsulation: ViewEncapsulation.None,
2194
- host: {
2195
- '[attr.data-pc-name]': "'inputcolor'",
2196
- '[attr.data-pc-section]': "'root'",
2197
- '[class]': "cx('root')"
2198
- },
2199
- hostDirectives: [Bind]
2200
- }]
2201
- }], propDecorators: { format: [{ type: i0.Input, args: [{ isSignal: true, alias: "format", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], onValueChange: [{ type: i0.Output, args: ["onValueChange"] }], onValueChangeEnd: [{ type: i0.Output, args: ["onValueChangeEnd"] }] } });
2202
- class InputColorModule {
2203
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: InputColorModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
2204
- static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "22.1.5", ngImport: i0, type: InputColorModule, imports: [InputColor, InputColorArea,
2205
- InputColorAreaHandle,
2206
- InputColorAreaBackground,
2207
- InputColorSlider,
2208
- InputColorSliderHandle,
2209
- InputColorSliderTrack,
2210
- InputColorSwatch,
2211
- InputColorSwatchBackground,
2212
- InputColorTransparencyGrid,
2213
- InputColorInput,
2214
- InputColorEyeDropper,
2215
- SharedModule], exports: [InputColor, InputColorArea,
2216
- InputColorAreaHandle,
2217
- InputColorAreaBackground,
2218
- InputColorSlider,
2219
- InputColorSliderHandle,
2220
- InputColorSliderTrack,
2221
- InputColorSwatch,
2222
- InputColorSwatchBackground,
2223
- InputColorTransparencyGrid,
2224
- InputColorInput,
2225
- InputColorEyeDropper,
2226
- SharedModule] });
2227
- static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: InputColorModule, imports: [InputColor,
2228
- SharedModule, SharedModule] });
2229
- }
2230
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: InputColorModule, decorators: [{
2231
- type: NgModule,
2232
- args: [{
2233
- imports: [
2234
- InputColor,
2235
- InputColorArea,
2236
- InputColorAreaHandle,
2237
- InputColorAreaBackground,
2238
- InputColorSlider,
2239
- InputColorSliderHandle,
2240
- InputColorSliderTrack,
2241
- InputColorSwatch,
2242
- InputColorSwatchBackground,
2243
- InputColorTransparencyGrid,
2244
- InputColorInput,
2245
- InputColorEyeDropper,
2246
- SharedModule
2247
- ],
2248
- exports: [
2249
- InputColor,
2250
- InputColorArea,
2251
- InputColorAreaHandle,
2252
- InputColorAreaBackground,
2253
- InputColorSlider,
2254
- InputColorSliderHandle,
2255
- InputColorSliderTrack,
2256
- InputColorSwatch,
2257
- InputColorSwatchBackground,
2258
- InputColorTransparencyGrid,
2259
- InputColorInput,
2260
- InputColorEyeDropper,
2261
- SharedModule
2262
- ]
2263
- }]
2264
- }] });
2265
-
2266
- /**
2267
- * Generated bundle index. Do not edit.
2268
- */
2269
-
2408
+ var InputColor = class InputColor extends BaseComponent {
2409
+ componentName = "InputColor";
2410
+ bindDirectiveInstance = inject(Bind, { self: true });
2411
+ _componentStyle = inject(InputColorStyle);
2412
+ format = input("hsba", ...ngDevMode ? [{ debugName: "format" }] : /* istanbul ignore next */ []);
2413
+ disabled = input(false, {
2414
+ ...ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {},
2415
+ transform: booleanAttribute
2416
+ });
2417
+ _disabled = signal(false, ...ngDevMode ? [{ debugName: "_disabled" }] : /* istanbul ignore next */ []);
2418
+ $disabled = computed(() => this.disabled() || this._disabled(), ...ngDevMode ? [{ debugName: "$disabled" }] : /* istanbul ignore next */ []);
2419
+ onValueChange = output();
2420
+ onValueChangeEnd = output();
2421
+ _color = signal(null, ...ngDevMode ? [{ debugName: "_color" }] : /* istanbul ignore next */ []);
2422
+ $color = computed(() => this._color() || parseColor("#ff0000").toFormat(this.format()), ...ngDevMode ? [{ debugName: "$color" }] : /* istanbul ignore next */ []);
2423
+ $axes = computed(() => getDefault2DAxes(this.format()), ...ngDevMode ? [{ debugName: "$axes" }] : /* istanbul ignore next */ []);
2424
+ onAfterViewChecked() {
2425
+ this.bindDirectiveInstance.setAttrs(this.ptms(["host", "root"]));
2426
+ }
2427
+ updateColor(color, event, isEnd = false) {
2428
+ this._color.set(color);
2429
+ const outputValue = color.toString(this.format());
2430
+ this.onModelChange(outputValue);
2431
+ this.onValueChange.emit({
2432
+ color,
2433
+ originalEvent: event
2434
+ });
2435
+ if (isEnd) {
2436
+ this.onValueChangeEnd.emit({
2437
+ color,
2438
+ originalEvent: event
2439
+ });
2440
+ this.onModelTouched();
2441
+ }
2442
+ }
2443
+ setChannelValue(channel, value, event, isEnd = false) {
2444
+ const newColor = this.toChannelNativeFormat(this.$color(), channel).setChannelValue(channel, value);
2445
+ this.updateColor(newColor, event, isEnd);
2446
+ }
2447
+ onModelChange = () => {};
2448
+ onModelTouched = () => {};
2449
+ registerOnChange(fn) {
2450
+ this.onModelChange = fn;
2451
+ }
2452
+ registerOnTouched(fn) {
2453
+ this.onModelTouched = fn;
2454
+ }
2455
+ setDisabledState(val) {
2456
+ this._disabled.set(val);
2457
+ }
2458
+ writeValue(value) {
2459
+ if (value) {
2460
+ const current = this._color();
2461
+ if (current && current.toString(this.format()) === value) return;
2462
+ const parsed = parseColor(value);
2463
+ if (parsed) this._color.set(parsed.toFormat(this.format()));
2464
+ } else this._color.set(null);
2465
+ }
2466
+ toChannelNativeFormat(color, channel) {
2467
+ if (color instanceof HSBColor && (channel === "hue" || channel === "saturation" || channel === "brightness")) return color;
2468
+ if (color instanceof HSLColor && (channel === "hue" || channel === "saturation" || channel === "lightness")) return color;
2469
+ if (color instanceof RGBColor && (channel === "red" || channel === "green" || channel === "blue")) return color;
2470
+ if (color instanceof OKLCHColor && (channel === "oklchLightness" || channel === "oklchChroma" || channel === "oklchHue" || channel === "L" || channel === "C" || channel === "H")) return color;
2471
+ switch (channel) {
2472
+ case "hue":
2473
+ case "saturation":
2474
+ case "brightness": return color.toHSB();
2475
+ case "lightness": return color.toHSL();
2476
+ case "red":
2477
+ case "green":
2478
+ case "blue": return color.toRGB();
2479
+ case "oklchLightness":
2480
+ case "oklchChroma":
2481
+ case "oklchHue":
2482
+ case "L":
2483
+ case "C":
2484
+ case "H": return color.toOKLCH();
2485
+ default: return color;
2486
+ }
2487
+ }
2488
+ static ɵfac = i0.ɵɵngDeclareFactory({
2489
+ minVersion: "12.0.0",
2490
+ version: "22.2.0",
2491
+ ngImport: i0,
2492
+ type: InputColor,
2493
+ deps: null,
2494
+ target: i0.ɵɵFactoryTarget.Component
2495
+ });
2496
+ static ɵcmp = i0.ɵɵngDeclareComponent({
2497
+ minVersion: "17.1.0",
2498
+ version: "22.2.0",
2499
+ type: InputColor,
2500
+ isStandalone: true,
2501
+ selector: "p-inputcolor, p-input-color",
2502
+ inputs: {
2503
+ format: {
2504
+ classPropertyName: "format",
2505
+ publicName: "format",
2506
+ isSignal: true,
2507
+ isRequired: false,
2508
+ transformFunction: null
2509
+ },
2510
+ disabled: {
2511
+ classPropertyName: "disabled",
2512
+ publicName: "disabled",
2513
+ isSignal: true,
2514
+ isRequired: false,
2515
+ transformFunction: null
2516
+ }
2517
+ },
2518
+ outputs: {
2519
+ onValueChange: "onValueChange",
2520
+ onValueChangeEnd: "onValueChangeEnd"
2521
+ },
2522
+ host: { properties: {
2523
+ "attr.data-pc-name": "'inputcolor'",
2524
+ "attr.data-pc-section": "'root'",
2525
+ "class": "cx('root')"
2526
+ } },
2527
+ providers: [
2528
+ INPUT_COLOR_VALUE_ACCESSOR,
2529
+ InputColorStyle,
2530
+ {
2531
+ provide: INPUT_COLOR_INSTANCE,
2532
+ useExisting: InputColor
2533
+ },
2534
+ {
2535
+ provide: PARENT_INSTANCE,
2536
+ useExisting: InputColor
2537
+ }
2538
+ ],
2539
+ usesInheritance: true,
2540
+ hostDirectives: [{ directive: i1$1.Bind }],
2541
+ ngImport: i0,
2542
+ template: `<ng-content></ng-content>`,
2543
+ isInline: true,
2544
+ dependencies: [{
2545
+ kind: "ngmodule",
2546
+ type: SharedModule
2547
+ }],
2548
+ changeDetection: i0.ChangeDetectionStrategy.OnPush,
2549
+ encapsulation: i0.ViewEncapsulation.None
2550
+ });
2551
+ };
2552
+ i0.ɵɵngDeclareClassMetadata({
2553
+ minVersion: "12.0.0",
2554
+ version: "22.2.0",
2555
+ ngImport: i0,
2556
+ type: InputColor,
2557
+ decorators: [{
2558
+ type: Component,
2559
+ args: [{
2560
+ selector: "p-inputcolor, p-input-color",
2561
+ standalone: true,
2562
+ imports: [SharedModule],
2563
+ template: `<ng-content></ng-content>`,
2564
+ providers: [
2565
+ INPUT_COLOR_VALUE_ACCESSOR,
2566
+ InputColorStyle,
2567
+ {
2568
+ provide: INPUT_COLOR_INSTANCE,
2569
+ useExisting: InputColor
2570
+ },
2571
+ {
2572
+ provide: PARENT_INSTANCE,
2573
+ useExisting: InputColor
2574
+ }
2575
+ ],
2576
+ changeDetection: ChangeDetectionStrategy.OnPush,
2577
+ encapsulation: ViewEncapsulation.None,
2578
+ host: {
2579
+ "[attr.data-pc-name]": "'inputcolor'",
2580
+ "[attr.data-pc-section]": "'root'",
2581
+ "[class]": "cx('root')"
2582
+ },
2583
+ hostDirectives: [Bind]
2584
+ }]
2585
+ }],
2586
+ propDecorators: {
2587
+ format: [{
2588
+ type: i0.Input,
2589
+ args: [{
2590
+ isSignal: true,
2591
+ alias: "format",
2592
+ required: false
2593
+ }]
2594
+ }],
2595
+ disabled: [{
2596
+ type: i0.Input,
2597
+ args: [{
2598
+ isSignal: true,
2599
+ alias: "disabled",
2600
+ required: false
2601
+ }]
2602
+ }],
2603
+ onValueChange: [{
2604
+ type: i0.Output,
2605
+ args: ["onValueChange"]
2606
+ }],
2607
+ onValueChangeEnd: [{
2608
+ type: i0.Output,
2609
+ args: ["onValueChangeEnd"]
2610
+ }]
2611
+ }
2612
+ });
2613
+ var InputColorModule = class InputColorModule {
2614
+ static ɵfac = i0.ɵɵngDeclareFactory({
2615
+ minVersion: "12.0.0",
2616
+ version: "22.2.0",
2617
+ ngImport: i0,
2618
+ type: InputColorModule,
2619
+ deps: [],
2620
+ target: i0.ɵɵFactoryTarget.NgModule
2621
+ });
2622
+ static ɵmod = i0.ɵɵngDeclareNgModule({
2623
+ minVersion: "14.0.0",
2624
+ version: "22.2.0",
2625
+ ngImport: i0,
2626
+ type: InputColorModule,
2627
+ imports: [
2628
+ InputColor,
2629
+ InputColorArea,
2630
+ InputColorAreaHandle,
2631
+ InputColorAreaBackground,
2632
+ InputColorSlider,
2633
+ InputColorSliderHandle,
2634
+ InputColorSliderTrack,
2635
+ InputColorSwatch,
2636
+ InputColorSwatchBackground,
2637
+ InputColorTransparencyGrid,
2638
+ InputColorInput,
2639
+ InputColorEyeDropper,
2640
+ SharedModule
2641
+ ],
2642
+ exports: [
2643
+ InputColor,
2644
+ InputColorArea,
2645
+ InputColorAreaHandle,
2646
+ InputColorAreaBackground,
2647
+ InputColorSlider,
2648
+ InputColorSliderHandle,
2649
+ InputColorSliderTrack,
2650
+ InputColorSwatch,
2651
+ InputColorSwatchBackground,
2652
+ InputColorTransparencyGrid,
2653
+ InputColorInput,
2654
+ InputColorEyeDropper,
2655
+ SharedModule
2656
+ ]
2657
+ });
2658
+ static ɵinj = i0.ɵɵngDeclareInjector({
2659
+ minVersion: "12.0.0",
2660
+ version: "22.2.0",
2661
+ ngImport: i0,
2662
+ type: InputColorModule,
2663
+ imports: [
2664
+ InputColor,
2665
+ SharedModule,
2666
+ SharedModule
2667
+ ]
2668
+ });
2669
+ };
2670
+ i0.ɵɵngDeclareClassMetadata({
2671
+ minVersion: "12.0.0",
2672
+ version: "22.2.0",
2673
+ ngImport: i0,
2674
+ type: InputColorModule,
2675
+ decorators: [{
2676
+ type: NgModule,
2677
+ args: [{
2678
+ imports: [
2679
+ InputColor,
2680
+ InputColorArea,
2681
+ InputColorAreaHandle,
2682
+ InputColorAreaBackground,
2683
+ InputColorSlider,
2684
+ InputColorSliderHandle,
2685
+ InputColorSliderTrack,
2686
+ InputColorSwatch,
2687
+ InputColorSwatchBackground,
2688
+ InputColorTransparencyGrid,
2689
+ InputColorInput,
2690
+ InputColorEyeDropper,
2691
+ SharedModule
2692
+ ],
2693
+ exports: [
2694
+ InputColor,
2695
+ InputColorArea,
2696
+ InputColorAreaHandle,
2697
+ InputColorAreaBackground,
2698
+ InputColorSlider,
2699
+ InputColorSliderHandle,
2700
+ InputColorSliderTrack,
2701
+ InputColorSwatch,
2702
+ InputColorSwatchBackground,
2703
+ InputColorTransparencyGrid,
2704
+ InputColorInput,
2705
+ InputColorEyeDropper,
2706
+ SharedModule
2707
+ ]
2708
+ }]
2709
+ }]
2710
+ });
2270
2711
  export { Color, HSBColor, HSLColor, INPUT_COLOR_INSTANCE, INPUT_COLOR_SLIDER_INSTANCE, INPUT_COLOR_VALUE_ACCESSOR, InputColor, InputColorArea, InputColorAreaBackground, InputColorAreaHandle, InputColorClasses, InputColorEyeDropper, InputColorInput, InputColorModule, InputColorSlider, InputColorSliderHandle, InputColorSliderTrack, InputColorStyle, InputColorSwatch, InputColorSwatchBackground, InputColorTransparencyGrid, OKLCHColor, RGBColor, getAreaGradient, getChannelColor, getChannelGradient, getChannelRange, getDefault2DAxes, getDefault3DAxes, getInputChannelRange, getInputChannelValue, parseColor, snapValue };
2271
- //# sourceMappingURL=primeng-inputcolor.mjs.map
2712
+
2713
+ //# sourceMappingURL=primeng-inputcolor.mjs.map