primeng 22.1.0 → 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 -578
  2. package/fesm2022/primeng-accordion.mjs.map +1 -1
  3. package/fesm2022/primeng-animateonscroll.mjs +266 -165
  4. package/fesm2022/primeng-animateonscroll.mjs.map +1 -1
  5. package/fesm2022/primeng-api.mjs +888 -847
  6. package/fesm2022/primeng-api.mjs.map +1 -1
  7. package/fesm2022/primeng-autocomplete.mjs +2534 -1592
  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 -101
  18. package/fesm2022/primeng-base.mjs.map +1 -1
  19. package/fesm2022/primeng-basecomponent.mjs +528 -489
  20. package/fesm2022/primeng-basecomponent.mjs.map +1 -1
  21. package/fesm2022/primeng-baseeditableholder.mjs +131 -69
  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 -96
  28. package/fesm2022/primeng-bind.mjs.map +1 -1
  29. package/fesm2022/primeng-blockui.mjs +360 -228
  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 -703
  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 -1773
  40. package/fesm2022/primeng-carousel.mjs.map +1 -1
  41. package/fesm2022/primeng-cascadeselect.mjs +2373 -1364
  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 -353
  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 -315
  54. package/fesm2022/primeng-commandmenu.mjs.map +1 -1
  55. package/fesm2022/primeng-compare.mjs +843 -480
  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 -540
  60. package/fesm2022/primeng-confirmdialog.mjs.map +1 -1
  61. package/fesm2022/primeng-confirmpopup.mjs +810 -531
  62. package/fesm2022/primeng-confirmpopup.mjs.map +1 -1
  63. package/fesm2022/primeng-contextmenu.mjs +1862 -1051
  64. package/fesm2022/primeng-contextmenu.mjs.map +1 -1
  65. package/fesm2022/primeng-dataview.mjs +1130 -549
  66. package/fesm2022/primeng-dataview.mjs.map +1 -1
  67. package/fesm2022/primeng-datepicker.mjs +3750 -3354
  68. package/fesm2022/primeng-datepicker.mjs.map +1 -1
  69. package/fesm2022/primeng-dialog.mjs +1635 -968
  70. package/fesm2022/primeng-dialog.mjs.map +1 -1
  71. package/fesm2022/primeng-divider.mjs +272 -148
  72. package/fesm2022/primeng-divider.mjs.map +1 -1
  73. package/fesm2022/primeng-dock.mjs +609 -385
  74. package/fesm2022/primeng-dock.mjs.map +1 -1
  75. package/fesm2022/primeng-dom.mjs +599 -761
  76. package/fesm2022/primeng-dom.mjs.map +1 -1
  77. package/fesm2022/primeng-dragdrop.mjs +323 -311
  78. package/fesm2022/primeng-dragdrop.mjs.map +1 -1
  79. package/fesm2022/primeng-drawer.mjs +913 -482
  80. package/fesm2022/primeng-drawer.mjs.map +1 -1
  81. package/fesm2022/primeng-dynamicdialog.mjs +828 -928
  82. package/fesm2022/primeng-dynamicdialog.mjs.map +1 -1
  83. package/fesm2022/primeng-editor.mjs +547 -390
  84. package/fesm2022/primeng-editor.mjs.map +1 -1
  85. package/fesm2022/primeng-fieldset.mjs +559 -274
  86. package/fesm2022/primeng-fieldset.mjs.map +1 -1
  87. package/fesm2022/primeng-fileupload.mjs +1836 -1047
  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 -1406
  96. package/fesm2022/primeng-galleria.mjs.map +1 -1
  97. package/fesm2022/primeng-gallery.mjs +2768 -1798
  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 -534
  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 -2180
  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 -1379
  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 -375
  233. package/fesm2022/primeng-inputotp.mjs.map +1 -1
  234. package/fesm2022/primeng-inputpassword.mjs +179 -98
  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 -170
  239. package/fesm2022/primeng-inputtext.mjs.map +1 -1
  240. package/fesm2022/primeng-keyfilter.mjs +268 -243
  241. package/fesm2022/primeng-keyfilter.mjs.map +1 -1
  242. package/fesm2022/primeng-knob.mjs +627 -403
  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 -1593
  249. package/fesm2022/primeng-listbox.mjs.map +1 -1
  250. package/fesm2022/primeng-megamenu.mjs +2006 -1117
  251. package/fesm2022/primeng-megamenu.mjs.map +1 -1
  252. package/fesm2022/primeng-menu.mjs +1437 -845
  253. package/fesm2022/primeng-menu.mjs.map +1 -1
  254. package/fesm2022/primeng-menubar.mjs +1832 -972
  255. package/fesm2022/primeng-menubar.mjs.map +1 -1
  256. package/fesm2022/primeng-message.mjs +474 -243
  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 -1898
  263. package/fesm2022/primeng-multiselect.mjs.map +1 -1
  264. package/fesm2022/primeng-orderlist.mjs +1308 -678
  265. package/fesm2022/primeng-orderlist.mjs.map +1 -1
  266. package/fesm2022/primeng-organizationchart.mjs +912 -597
  267. package/fesm2022/primeng-organizationchart.mjs.map +1 -1
  268. package/fesm2022/primeng-overlay.mjs +929 -610
  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 +961 -505
  273. package/fesm2022/primeng-paginator.mjs.map +1 -1
  274. package/fesm2022/primeng-panel.mjs +668 -347
  275. package/fesm2022/primeng-panel.mjs.map +1 -1
  276. package/fesm2022/primeng-panelmenu.mjs +1842 -966
  277. package/fesm2022/primeng-panelmenu.mjs.map +1 -1
  278. package/fesm2022/primeng-passthrough.mjs +10 -20
  279. package/fesm2022/primeng-passthrough.mjs.map +1 -1
  280. package/fesm2022/primeng-password.mjs +1518 -858
  281. package/fesm2022/primeng-password.mjs.map +1 -1
  282. package/fesm2022/primeng-picklist.mjs +2270 -1253
  283. package/fesm2022/primeng-picklist.mjs.map +1 -1
  284. package/fesm2022/primeng-popover.mjs +656 -434
  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 -294
  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 -170
  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 -1047
  299. package/fesm2022/primeng-scroller.mjs.map +1 -1
  300. package/fesm2022/primeng-scrollpanel.mjs +568 -454
  301. package/fesm2022/primeng-scrollpanel.mjs.map +1 -1
  302. package/fesm2022/primeng-scrolltop.mjs +509 -261
  303. package/fesm2022/primeng-scrolltop.mjs.map +1 -1
  304. package/fesm2022/primeng-select.mjs +2948 -1714
  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 -1413
  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 -704
  315. package/fesm2022/primeng-speeddial.mjs.map +1 -1
  316. package/fesm2022/primeng-splitbutton.mjs +889 -340
  317. package/fesm2022/primeng-splitbutton.mjs.map +1 -1
  318. package/fesm2022/primeng-splitter.mjs +997 -762
  319. package/fesm2022/primeng-splitter.mjs.map +1 -1
  320. package/fesm2022/primeng-stepper.mjs +1355 -645
  321. package/fesm2022/primeng-stepper.mjs.map +1 -1
  322. package/fesm2022/primeng-steps.mjs +523 -407
  323. package/fesm2022/primeng-steps.mjs.map +1 -1
  324. package/fesm2022/primeng-styleclass.mjs +446 -330
  325. package/fesm2022/primeng-styleclass.mjs.map +1 -1
  326. package/fesm2022/primeng-table.mjs +9765 -5849
  327. package/fesm2022/primeng-table.mjs.map +1 -1
  328. package/fesm2022/primeng-tabs.mjs +1357 -815
  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 -204
  335. package/fesm2022/primeng-textarea.mjs.map +1 -1
  336. package/fesm2022/primeng-tieredmenu.mjs +1917 -1094
  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 -928
  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 -765
  349. package/fesm2022/primeng-tooltip.mjs.map +1 -1
  350. package/fesm2022/primeng-tree.mjs +2681 -1888
  351. package/fesm2022/primeng-tree.mjs.map +1 -1
  352. package/fesm2022/primeng-treeselect.mjs +1678 -927
  353. package/fesm2022/primeng-treeselect.mjs.map +1 -1
  354. package/fesm2022/primeng-treetable.mjs +5849 -3742
  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 -109
  459. package/fesm2022/primeng-usestyle.mjs.map +1 -1
  460. package/fesm2022/primeng-utils.mjs +238 -328
  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 +7 -2
  465. package/types/primeng-accordion.d.ts +289 -221
  466. package/types/primeng-animateonscroll.d.ts +89 -61
  467. package/types/primeng-api.d.ts +1760 -1790
  468. package/types/primeng-autocomplete.d.ts +1054 -757
  469. package/types/primeng-autofocus.d.ts +27 -24
  470. package/types/primeng-avatar.d.ts +153 -117
  471. package/types/primeng-avatargroup.d.ts +46 -43
  472. package/types/primeng-badge.d.ts +105 -81
  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 -427
  482. package/types/primeng-buttongroup.d.ts +27 -33
  483. package/types/primeng-card.d.ts +131 -122
  484. package/types/primeng-carousel.d.ts +800 -632
  485. package/types/primeng-cascadeselect.d.ts +754 -565
  486. package/types/primeng-chart.d.ts +160 -116
  487. package/types/primeng-checkbox.d.ts +299 -211
  488. package/types/primeng-chip.d.ts +189 -147
  489. package/types/primeng-classnames.d.ts +23 -21
  490. package/types/primeng-colorpicker.d.ts +325 -272
  491. package/types/primeng-commandmenu.d.ts +213 -165
  492. package/types/primeng-compare.d.ts +267 -191
  493. package/types/primeng-config.d.ts +294 -304
  494. package/types/primeng-confirmdialog.d.ts +505 -328
  495. package/types/primeng-confirmpopup.d.ts +254 -214
  496. package/types/primeng-contextmenu.d.ts +522 -368
  497. package/types/primeng-dataview.d.ts +498 -345
  498. package/types/primeng-datepicker.d.ts +1269 -972
  499. package/types/primeng-dialog.d.ts +668 -465
  500. package/types/primeng-divider.d.ts +114 -100
  501. package/types/primeng-dock.d.ts +207 -175
  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 +355 -257
  505. package/types/primeng-dynamicdialog.d.ts +528 -540
  506. package/types/primeng-editor.d.ts +211 -165
  507. package/types/primeng-fieldset.d.ts +199 -166
  508. package/types/primeng-fileupload.d.ts +727 -526
  509. package/types/primeng-floatlabel.d.ts +55 -51
  510. package/types/primeng-fluid.d.ts +37 -39
  511. package/types/primeng-focustrap.d.ts +30 -27
  512. package/types/primeng-galleria.d.ts +570 -433
  513. package/types/primeng-gallery.d.ts +754 -552
  514. package/types/primeng-iconfield.d.ts +54 -45
  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 +24 -25
  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 +38 -40
  572. package/types/primeng-image.d.ts +404 -311
  573. package/types/primeng-imagecompare.d.ts +94 -80
  574. package/types/primeng-inplace.d.ts +126 -114
  575. package/types/primeng-inputcolor.d.ts +645 -508
  576. package/types/primeng-inputgroup.d.ts +42 -44
  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 +520 -365
  580. package/types/primeng-inputnumber.d.ts +573 -408
  581. package/types/primeng-inputotp.d.ts +206 -159
  582. package/types/primeng-inputpassword.d.ts +60 -47
  583. package/types/primeng-inputtags.d.ts +453 -301
  584. package/types/primeng-inputtext.d.ts +130 -96
  585. package/types/primeng-keyfilter.d.ts +62 -53
  586. package/types/primeng-knob.d.ts +257 -186
  587. package/types/primeng-label.d.ts +37 -39
  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 +536 -386
  591. package/types/primeng-menu.d.ts +478 -363
  592. package/types/primeng-menubar.d.ts +495 -354
  593. package/types/primeng-message.d.ts +192 -151
  594. package/types/primeng-metergroup.d.ts +249 -189
  595. package/types/primeng-motion.d.ts +601 -385
  596. package/types/primeng-multiselect.d.ts +1193 -861
  597. package/types/primeng-orderlist.d.ts +539 -393
  598. package/types/primeng-organizationchart.d.ts +236 -195
  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 +410 -314
  602. package/types/primeng-panel.d.ts +267 -217
  603. package/types/primeng-panelmenu.d.ts +255 -231
  604. package/types/primeng-passthrough.d.ts +5 -7
  605. package/types/primeng-password.d.ts +606 -433
  606. package/types/primeng-picklist.d.ts +1042 -759
  607. package/types/primeng-popover.d.ts +235 -176
  608. package/types/primeng-progressbar.d.ts +131 -102
  609. package/types/primeng-progressspinner.d.ts +145 -111
  610. package/types/primeng-radiobutton.d.ts +219 -171
  611. package/types/primeng-rating.d.ts +240 -192
  612. package/types/primeng-ripple.d.ts +39 -45
  613. package/types/primeng-scrollarea.d.ts +292 -243
  614. package/types/primeng-scroller.d.ts +523 -390
  615. package/types/primeng-scrollpanel.d.ts +135 -131
  616. package/types/primeng-scrolltop.d.ts +170 -126
  617. package/types/primeng-select.d.ts +1014 -741
  618. package/types/primeng-selectbutton.d.ts +239 -167
  619. package/types/primeng-sidebar.d.ts +793 -562
  620. package/types/primeng-skeleton.d.ts +116 -87
  621. package/types/primeng-slider.d.ts +378 -311
  622. package/types/primeng-speeddial.d.ts +495 -375
  623. package/types/primeng-splitbutton.d.ts +382 -243
  624. package/types/primeng-splitter.d.ts +392 -301
  625. package/types/primeng-stepper.d.ts +417 -257
  626. package/types/primeng-steps.d.ts +158 -137
  627. package/types/primeng-styleclass.d.ts +163 -105
  628. package/types/primeng-table.d.ts +2898 -1912
  629. package/types/primeng-tabs.d.ts +463 -307
  630. package/types/primeng-tag.d.ts +107 -88
  631. package/types/primeng-terminal.d.ts +132 -120
  632. package/types/primeng-textarea.d.ts +146 -110
  633. package/types/primeng-tieredmenu.d.ts +573 -401
  634. package/types/primeng-timeline.d.ts +126 -112
  635. package/types/primeng-toast.d.ts +313 -252
  636. package/types/primeng-togglebutton.d.ts +255 -185
  637. package/types/primeng-toggleswitch.d.ts +190 -144
  638. package/types/primeng-toolbar.d.ts +83 -79
  639. package/types/primeng-tooltip.d.ts +335 -235
  640. package/types/primeng-tree.d.ts +763 -562
  641. package/types/primeng-treeselect.d.ts +750 -544
  642. package/types/primeng-treetable.d.ts +1839 -1315
  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,1411 +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
- case 'oklchHue': {
220
- const oklch = this.toOKLCH().setChannelValue(channel, value);
221
- return oklch.toHSB();
222
- }
223
- default: {
224
- const rgb = this.toRGB().setChannelValue(channel, value);
225
- return rgb.toHSB();
226
- }
227
- }
228
- }
229
- toHSB() {
230
- return this.clone();
231
- }
232
- toHSL() {
233
- const h = this.hue;
234
- const s = this.saturation / 100;
235
- const b = this.brightness / 100;
236
- const l = b * (1 - s / 2);
237
- const sl = l === 0 || l === 1 ? 0 : ((b - l) / Math.min(l, 1 - l)) * 100;
238
- return new HSLColor(h, sl, l * 100, this._alpha);
239
- }
240
- toRGB() {
241
- const h = this.hue / 360;
242
- const s = this.saturation / 100;
243
- const b = this.brightness / 100;
244
- let r, g, bl;
245
- const i = Math.floor(h * 6);
246
- const f = h * 6 - i;
247
- const p = b * (1 - s);
248
- const q = b * (1 - f * s);
249
- const t = b * (1 - (1 - f) * s);
250
- switch (i % 6) {
251
- case 0:
252
- r = b;
253
- g = t;
254
- bl = p;
255
- break;
256
- case 1:
257
- r = q;
258
- g = b;
259
- bl = p;
260
- break;
261
- case 2:
262
- r = p;
263
- g = b;
264
- bl = t;
265
- break;
266
- case 3:
267
- r = p;
268
- g = q;
269
- bl = b;
270
- break;
271
- case 4:
272
- r = t;
273
- g = p;
274
- bl = b;
275
- break;
276
- case 5:
277
- r = b;
278
- g = p;
279
- bl = q;
280
- break;
281
- default:
282
- r = 0;
283
- g = 0;
284
- bl = 0;
285
- }
286
- return new RGBColor(r * 255, g * 255, bl * 255, this._alpha);
287
- }
288
- toOKLCH() {
289
- return this.toRGB().toOKLCH();
290
- }
291
- clone() {
292
- return new HSBColor(this.hue, this.saturation, this.brightness, this._alpha);
293
- }
294
- toJSON() {
295
- return {
296
- hue: this.hue,
297
- saturation: this.saturation,
298
- brightness: this.brightness,
299
- alpha: this._alpha
300
- };
301
- }
302
- getFormat() {
303
- return 'hsba';
304
- }
305
- getChannels() {
306
- return ['hue', 'saturation', 'brightness'];
307
- }
308
- getChannelRange(channel) {
309
- switch (channel) {
310
- case 'hue':
311
- return { minValue: 0, maxValue: 360, step: 1, pageStep: 15 };
312
- case 'saturation':
313
- case 'brightness':
314
- return { minValue: 0, maxValue: 100, step: 1, pageStep: 10 };
315
- case 'alpha':
316
- return { minValue: 0, maxValue: 1, step: 0.01, pageStep: 0.1 };
317
- case 'lightness':
318
- return this.toHSL().getChannelRange(channel);
319
- case 'L':
320
- case 'C':
321
- case 'H':
322
- case 'oklchLightness':
323
- case 'oklchChroma':
324
- case 'oklchHue':
325
- return this.toOKLCH().getChannelRange(channel);
326
- case 'red':
327
- case 'green':
328
- case 'blue':
329
- return this.toRGB().getChannelRange(channel);
330
- default:
331
- throw new Error(`Unknown color channel: ${channel}`);
332
- }
333
- }
334
- }
335
- class HSLColor extends Color {
336
- hue;
337
- saturation;
338
- lightness;
339
- _alpha;
340
- colorSpace = 'hsla';
341
- constructor(hue, saturation, lightness, _alpha = 1) {
342
- super();
343
- this.hue = hue;
344
- this.saturation = saturation;
345
- this.lightness = lightness;
346
- this._alpha = _alpha;
347
- this.hue = hue >= 0 && hue <= 360 ? hue : mod(hue, 360);
348
- this.saturation = clamp(saturation, 0, 100);
349
- this.lightness = clamp(lightness, 0, 100);
350
- this._alpha = clamp(_alpha, 0, 1);
351
- }
352
- getChannelValue(channel) {
353
- switch (channel) {
354
- case 'hue':
355
- return this.hue;
356
- case 'saturation':
357
- return this.saturation;
358
- case 'lightness':
359
- return this.lightness;
360
- case 'alpha':
361
- return this._alpha;
362
- case 'brightness':
363
- return this.toHSB().getChannelValue(channel);
364
- case 'L':
365
- case 'C':
366
- case 'H':
367
- case 'oklchLightness':
368
- case 'oklchChroma':
369
- case 'oklchHue':
370
- return this.toOKLCH().getChannelValue(channel);
371
- default:
372
- return this.toRGB().getChannelValue(channel);
373
- }
374
- }
375
- setChannelValue(channel, value) {
376
- switch (channel) {
377
- case 'hue':
378
- return new HSLColor(value, this.saturation, this.lightness, this._alpha);
379
- case 'saturation':
380
- return new HSLColor(this.hue, value, this.lightness, this._alpha);
381
- case 'lightness':
382
- return new HSLColor(this.hue, this.saturation, value, this._alpha);
383
- case 'alpha':
384
- return new HSLColor(this.hue, this.saturation, this.lightness, value);
385
- case 'brightness': {
386
- const hsb = this.toHSB().setChannelValue(channel, value);
387
- return hsb.toHSL();
388
- }
389
- case 'L':
390
- case 'C':
391
- case 'H':
392
- case 'oklchLightness':
393
- case 'oklchChroma':
394
- case 'oklchHue': {
395
- const oklch = this.toOKLCH().setChannelValue(channel, value);
396
- return oklch.toHSL();
397
- }
398
- default: {
399
- const rgb = this.toRGB().setChannelValue(channel, value);
400
- return rgb.toHSL();
401
- }
402
- }
403
- }
404
- toHSB() {
405
- const h = this.hue;
406
- const s = this.saturation / 100;
407
- const l = this.lightness / 100;
408
- const b = l + s * Math.min(l, 1 - l);
409
- const sb = b === 0 ? 0 : 2 * (1 - l / b);
410
- return new HSBColor(h, sb * 100, b * 100, this._alpha);
411
- }
412
- toHSL() {
413
- return this.clone();
414
- }
415
- toRGB() {
416
- const h = this.hue;
417
- const s = this.saturation / 100;
418
- const l = this.lightness / 100;
419
- const a = s * Math.min(l, 1 - l);
420
- const f = (n) => {
421
- const k = (n + h / 30) % 12;
422
- return l - a * Math.max(Math.min(k - 3, 9 - k, 1), -1);
423
- };
424
- return new RGBColor(f(0) * 255, f(8) * 255, f(4) * 255, this._alpha);
425
- }
426
- toOKLCH() {
427
- return this.toRGB().toOKLCH();
428
- }
429
- clone() {
430
- return new HSLColor(this.hue, this.saturation, this.lightness, this._alpha);
431
- }
432
- toJSON() {
433
- return {
434
- hue: this.hue,
435
- saturation: this.saturation,
436
- lightness: this.lightness,
437
- alpha: this._alpha
438
- };
439
- }
440
- getFormat() {
441
- return 'hsla';
442
- }
443
- getChannels() {
444
- return ['hue', 'saturation', 'lightness'];
445
- }
446
- getChannelRange(channel) {
447
- switch (channel) {
448
- case 'hue':
449
- return { minValue: 0, maxValue: 360, step: 1, pageStep: 15 };
450
- case 'saturation':
451
- case 'lightness':
452
- return { minValue: 0, maxValue: 100, step: 1, pageStep: 10 };
453
- case 'alpha':
454
- return { minValue: 0, maxValue: 1, step: 0.01, pageStep: 0.1 };
455
- case 'brightness':
456
- return this.toHSB().getChannelRange(channel);
457
- case 'L':
458
- case 'C':
459
- case 'H':
460
- case 'oklchLightness':
461
- case 'oklchChroma':
462
- case 'oklchHue':
463
- return this.toOKLCH().getChannelRange(channel);
464
- case 'red':
465
- case 'green':
466
- case 'blue':
467
- return this.toRGB().getChannelRange(channel);
468
- default:
469
- throw new Error(`Unknown color channel: ${channel}`);
470
- }
471
- }
472
- }
473
- class RGBColor extends Color {
474
- red;
475
- green;
476
- blue;
477
- _alpha;
478
- colorSpace = 'rgba';
479
- constructor(red, green, blue, _alpha = 1) {
480
- super();
481
- this.red = red;
482
- this.green = green;
483
- this.blue = blue;
484
- this._alpha = _alpha;
485
- this.red = clamp(red, 0, 255);
486
- this.green = clamp(green, 0, 255);
487
- this.blue = clamp(blue, 0, 255);
488
- this._alpha = clamp(_alpha, 0, 1);
489
- }
490
- getChannelValue(channel) {
491
- switch (channel) {
492
- case 'red':
493
- return this.red;
494
- case 'green':
495
- return this.green;
496
- case 'blue':
497
- return this.blue;
498
- case 'alpha':
499
- return this._alpha;
500
- case 'hue':
501
- case 'saturation':
502
- case 'brightness':
503
- return this.toHSB().getChannelValue(channel);
504
- case 'lightness':
505
- return this.toHSL().getChannelValue(channel);
506
- case 'L':
507
- case 'C':
508
- case 'H':
509
- case 'oklchLightness':
510
- case 'oklchChroma':
511
- case 'oklchHue':
512
- return this.toOKLCH().getChannelValue(channel);
513
- default:
514
- return this.toHSB().getChannelValue(channel);
515
- }
516
- }
517
- setChannelValue(channel, value) {
518
- switch (channel) {
519
- case 'red':
520
- return new RGBColor(value, this.green, this.blue, this._alpha);
521
- case 'green':
522
- return new RGBColor(this.red, value, this.blue, this._alpha);
523
- case 'blue':
524
- return new RGBColor(this.red, this.green, value, this._alpha);
525
- case 'alpha':
526
- return new RGBColor(this.red, this.green, this.blue, value);
527
- case 'hue':
528
- case 'saturation':
529
- case 'brightness': {
530
- const hsb = this.toHSB().setChannelValue(channel, value);
531
- return hsb.toRGB();
532
- }
533
- case 'lightness': {
534
- const hsl = this.toHSL().setChannelValue(channel, value);
535
- return hsl.toRGB();
536
- }
537
- case 'L':
538
- case 'C':
539
- case 'H':
540
- case 'oklchLightness':
541
- case 'oklchChroma':
542
- case 'oklchHue': {
543
- const oklch = this.toOKLCH().setChannelValue(channel, value);
544
- return oklch.toRGB();
545
- }
546
- default: {
547
- const hsb = this.toHSB().setChannelValue(channel, value);
548
- return hsb.toRGB();
549
- }
550
- }
551
- }
552
- toHSB() {
553
- const r = this.red / 255;
554
- const g = this.green / 255;
555
- const b = this.blue / 255;
556
- const max = Math.max(r, g, b);
557
- const min = Math.min(r, g, b);
558
- const d = max - min;
559
- let h = 0;
560
- const s = max === 0 ? 0 : d / max;
561
- const v = max;
562
- if (d !== 0) {
563
- switch (max) {
564
- case r:
565
- h = ((g - b) / d + (g < b ? 6 : 0)) / 6;
566
- break;
567
- case g:
568
- h = ((b - r) / d + 2) / 6;
569
- break;
570
- case b:
571
- h = ((r - g) / d + 4) / 6;
572
- break;
573
- }
574
- }
575
- return new HSBColor(h * 360, s * 100, v * 100, this._alpha);
576
- }
577
- toHSL() {
578
- const r = this.red / 255;
579
- const g = this.green / 255;
580
- const b = this.blue / 255;
581
- const max = Math.max(r, g, b);
582
- const min = Math.min(r, g, b);
583
- const d = max - min;
584
- const l = (max + min) / 2;
585
- let h = 0;
586
- let s = 0;
587
- if (d !== 0) {
588
- s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
589
- switch (max) {
590
- case r:
591
- h = ((g - b) / d + (g < b ? 6 : 0)) / 6;
592
- break;
593
- case g:
594
- h = ((b - r) / d + 2) / 6;
595
- break;
596
- case b:
597
- h = ((r - g) / d + 4) / 6;
598
- break;
599
- }
600
- }
601
- return new HSLColor(h * 360, s * 100, l * 100, this._alpha);
602
- }
603
- toRGB() {
604
- return this.clone();
605
- }
606
- toOKLCH() {
607
- const rgb = [this.red / 255, this.green / 255, this.blue / 255];
608
- 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));
609
- const xyz = multiplyMatrices([0.41239079926595934, 0.357584339383878, 0.1804807884018343, 0.21263900587151027, 0.715168678767756, 0.07219231536073371, 0.01933081871559182, 0.11919477979462598, 0.9505321522496607], rgbLinear);
610
- const LMS = multiplyMatrices([0.819022437996703, 0.3619062600528904, -0.1288737815209879, 0.0329836539323885, 0.9292868615863434, 0.0361446663506424, 0.0481771893596242, 0.2642395317527308, 0.6335478284694309], xyz);
611
- const LMSg = LMS.map((val) => Math.cbrt(val));
612
- const [L, a, b] = multiplyMatrices([0.210454268309314, 0.7936177747023054, -0.0040720430116193, 1.9779985324311684, -2.4285922420485799, 0.450593709617411, 0.0259040424655478, 0.7827717124575296, -0.8086757549230774], LMSg);
613
- const C = Math.sqrt(a ** 2 + b ** 2);
614
- const H = Math.abs(a) < 0.0002 && Math.abs(b) < 0.0002 ? NaN : ((((Math.atan2(b, a) * 180) / Math.PI) % 360) + 360) % 360;
615
- const outL = Number(Math.min(1, Math.max(0, L)).toFixed(4));
616
- const outC = Number(C.toFixed(4));
617
- const outH = Number.isNaN(H) ? NaN : Number(H.toFixed(2));
618
- return new OKLCHColor(outL, outC, outH, Number(this._alpha.toFixed(2)));
619
- }
620
- clone() {
621
- return new RGBColor(this.red, this.green, this.blue, this._alpha);
622
- }
623
- toJSON() {
624
- return {
625
- red: this.red,
626
- green: this.green,
627
- blue: this.blue,
628
- alpha: this._alpha
629
- };
630
- }
631
- getFormat() {
632
- return 'rgba';
633
- }
634
- getChannels() {
635
- return ['red', 'green', 'blue'];
636
- }
637
- getChannelRange(channel) {
638
- switch (channel) {
639
- case 'red':
640
- case 'green':
641
- case 'blue':
642
- return { minValue: 0, maxValue: 255, step: 1, pageStep: 17 };
643
- case 'alpha':
644
- return { minValue: 0, maxValue: 1, step: 0.01, pageStep: 0.1 };
645
- case 'hue':
646
- case 'saturation':
647
- case 'brightness':
648
- return this.toHSB().getChannelRange(channel);
649
- case 'lightness':
650
- return this.toHSL().getChannelRange(channel);
651
- case 'L':
652
- case 'C':
653
- case 'H':
654
- case 'oklchLightness':
655
- case 'oklchChroma':
656
- case 'oklchHue':
657
- return this.toOKLCH().getChannelRange(channel);
658
- default:
659
- throw new Error(`Unknown color channel: ${channel}`);
660
- }
661
- }
662
- }
663
- class OKLCHColor extends Color {
664
- L;
665
- C;
666
- H;
667
- _alpha;
668
- colorSpace = 'oklch';
669
- constructor(L, C, H, _alpha = 1) {
670
- super();
671
- this.L = L;
672
- this.C = C;
673
- this.H = H;
674
- this._alpha = _alpha;
675
- this.L = clamp(L, 0, 1);
676
- this.C = clamp(C, 0, 0.4);
677
- this.H = Number.isNaN(H) ? NaN : H >= 0 && H <= 360 ? H : mod(H, 360);
678
- this._alpha = clamp(_alpha, 0, 1);
679
- }
680
- getChannelValue(channel) {
681
- switch (channel) {
682
- case 'L':
683
- case 'oklchLightness':
684
- return this.L;
685
- case 'C':
686
- case 'oklchChroma':
687
- return this.C;
688
- case 'H':
689
- case 'oklchHue':
690
- return this.H;
691
- case 'alpha':
692
- return this._alpha;
693
- default:
694
- return this.toRGB().getChannelValue(channel);
695
- }
696
- }
697
- setChannelValue(channel, value) {
698
- switch (channel) {
699
- case 'L':
700
- case 'oklchLightness':
701
- return new OKLCHColor(value, this.C, this.H, this._alpha);
702
- case 'C':
703
- case 'oklchChroma':
704
- return new OKLCHColor(this.L, value, this.H, this._alpha);
705
- case 'H':
706
- case 'oklchHue':
707
- return new OKLCHColor(this.L, this.C, value, this._alpha);
708
- case 'alpha':
709
- return new OKLCHColor(this.L, this.C, this.H, value);
710
- default: {
711
- const rgb = this.toRGB().setChannelValue(channel, value);
712
- return rgb.toOKLCH();
713
- }
714
- }
715
- }
716
- toHSB() {
717
- return this.toRGB().toHSB();
718
- }
719
- toHSL() {
720
- return this.toRGB().toHSL();
721
- }
722
- toRGB() {
723
- const hRad = (this.H * Math.PI) / 180;
724
- const a = Number.isNaN(this.H) ? 0 : this.C * Math.cos(hRad);
725
- const b = Number.isNaN(this.H) ? 0 : this.C * Math.sin(hRad);
726
- const l_ = this.L + 0.3963377774 * a + 0.2158037573 * b;
727
- const m_ = this.L - 0.1055613458 * a - 0.0638541728 * b;
728
- const s_ = this.L - 0.0894841775 * a - 1.291485548 * b;
729
- const l = l_ * l_ * l_;
730
- const m = m_ * m_ * m_;
731
- const s = s_ * s_ * s_;
732
- const lr = 4.0767416621 * l - 3.3077115913 * m + 0.2309699292 * s;
733
- const lg = -1.2684380046 * l + 2.6097574011 * m - 0.3413193965 * s;
734
- const lb = -0.0041960863 * l - 0.7034186147 * m + 1.707614701 * s;
735
- const toSrgb = (c) => {
736
- if (c <= 0.0031308)
737
- return c * 12.92;
738
- return 1.055 * Math.pow(c, 1 / 2.4) - 0.055;
739
- };
740
- return new RGBColor(clamp(toSrgb(lr) * 255, 0, 255), clamp(toSrgb(lg) * 255, 0, 255), clamp(toSrgb(lb) * 255, 0, 255), this._alpha);
741
- }
742
- toOKLCH() {
743
- return this.clone();
744
- }
745
- toString(format) {
746
- const f = format || this.colorSpace;
747
- switch (f) {
748
- case 'oklch': {
749
- const l = Number.isNaN(this.L) ? 0 : Number((this.L * 100).toFixed(2));
750
- const c = Number.isNaN(this.C) ? 0 : Number(this.C.toFixed(4));
751
- const h = Number.isNaN(this.H) ? 0 : Number(this.H.toFixed(2));
752
- return `oklch(${l}% ${c} ${h})`;
753
- }
754
- case 'oklcha':
755
- case 'css': {
756
- const l = Number.isNaN(this.L) ? 0 : Number((this.L * 100).toFixed(2));
757
- const c = Number.isNaN(this.C) ? 0 : Number(this.C.toFixed(4));
758
- const h = Number.isNaN(this.H) ? 0 : Number(this.H.toFixed(2));
759
- const a = Number.isNaN(this._alpha) ? 1 : Number(this._alpha.toFixed(2));
760
- return `oklch(${l}% ${c} ${h} / ${a})`;
761
- }
762
- default:
763
- return super.toString(f);
764
- }
765
- }
766
- clone() {
767
- return new OKLCHColor(this.L, this.C, this.H, this._alpha);
768
- }
769
- toJSON() {
770
- return {
771
- L: this.L,
772
- C: this.C,
773
- H: this.H,
774
- alpha: this._alpha
775
- };
776
- }
777
- getFormat() {
778
- return 'oklch';
779
- }
780
- getChannels() {
781
- return ['L', 'C', 'H'];
782
- }
783
- getChannelRange(channel) {
784
- switch (channel) {
785
- case 'L':
786
- case 'oklchLightness':
787
- return { minValue: 0, maxValue: 1, step: 0.01, pageStep: 0.1 };
788
- case 'C':
789
- case 'oklchChroma':
790
- return { minValue: 0, maxValue: 0.4, step: 0.01, pageStep: 0.05 };
791
- case 'H':
792
- case 'oklchHue':
793
- return { minValue: 0, maxValue: 360, step: 1, pageStep: 15 };
794
- case 'alpha':
795
- return { minValue: 0, maxValue: 1, step: 0.01, pageStep: 0.1 };
796
- case 'hue':
797
- case 'saturation':
798
- case 'brightness':
799
- return this.toHSB().getChannelRange(channel);
800
- case 'lightness':
801
- return this.toHSL().getChannelRange(channel);
802
- case 'red':
803
- case 'green':
804
- case 'blue':
805
- return this.toRGB().getChannelRange(channel);
806
- default:
807
- throw new Error(`Unknown color channel: ${channel}`);
808
- }
809
- }
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));
810
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
+ };
811
752
  function parseColor(value) {
812
- if (!value)
813
- return null;
814
- if (value instanceof Color) {
815
- return value;
816
- }
817
- if (typeof value !== 'string')
818
- return null;
819
- const str = value.trim();
820
- const hexMatch = str.match(/^#?([0-9a-f]{3,8})$/i);
821
- if (hexMatch) {
822
- let hex = hexMatch[1];
823
- if (hex.length === 3) {
824
- hex = hex[0] + hex[0] + hex[1] + hex[1] + hex[2] + hex[2];
825
- }
826
- else if (hex.length === 4) {
827
- hex = hex[0] + hex[0] + hex[1] + hex[1] + hex[2] + hex[2] + hex[3] + hex[3];
828
- }
829
- if (hex.length === 6) {
830
- const r = parseInt(hex.substring(0, 2), 16);
831
- const g = parseInt(hex.substring(2, 4), 16);
832
- const b = parseInt(hex.substring(4, 6), 16);
833
- return new RGBColor(r, g, b, 1);
834
- }
835
- if (hex.length === 8) {
836
- const r = parseInt(hex.substring(0, 2), 16);
837
- const g = parseInt(hex.substring(2, 4), 16);
838
- const b = parseInt(hex.substring(4, 6), 16);
839
- const a = parseInt(hex.substring(6, 8), 16) / 255;
840
- return new RGBColor(r, g, b, a);
841
- }
842
- }
843
- const rgbMatch = str.match(/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*([\d.]+))?\s*\)$/i);
844
- if (rgbMatch) {
845
- return new RGBColor(parseInt(rgbMatch[1]), parseInt(rgbMatch[2]), parseInt(rgbMatch[3]), rgbMatch[4] !== undefined ? parseFloat(rgbMatch[4]) : 1);
846
- }
847
- const hslMatch = str.match(/^hsla?\(\s*([\d.]+)\s*,\s*([\d.]+)%?\s*,\s*([\d.]+)%?\s*(?:,\s*([\d.]+))?\s*\)$/i);
848
- if (hslMatch) {
849
- return new HSLColor(parseFloat(hslMatch[1]), parseFloat(hslMatch[2]), parseFloat(hslMatch[3]), hslMatch[4] !== undefined ? parseFloat(hslMatch[4]) : 1);
850
- }
851
- const hsbMatch = str.match(/^hsba?\(\s*([\d.]+)\s*,\s*([\d.]+)%?\s*,\s*([\d.]+)%?\s*(?:,\s*([\d.]+))?\s*\)$/i);
852
- if (hsbMatch) {
853
- return new HSBColor(parseFloat(hsbMatch[1]), parseFloat(hsbMatch[2]), parseFloat(hsbMatch[3]), hsbMatch[4] !== undefined ? parseFloat(hsbMatch[4]) : 1);
854
- }
855
- const oklchMatch = str.match(/^oklch\(\s*([\d.]+)(%?)\s+([\d.]+)\s+([\d.]+)\s*(?:\/\s*([\d.]+))?\s*\)$/i);
856
- if (oklchMatch) {
857
- const lVal = parseFloat(oklchMatch[1]);
858
- const l = oklchMatch[2] === '%' ? lVal / 100 : lVal;
859
- return new OKLCHColor(l, parseFloat(oklchMatch[3]), parseFloat(oklchMatch[4]), oklchMatch[5] !== undefined ? parseFloat(oklchMatch[5]) : 1);
860
- }
861
- 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;
862
777
  }
863
778
  function getChannelRange(channel) {
864
- switch (channel) {
865
- case 'hue':
866
- return { minValue: 0, maxValue: 360, step: 1, pageStep: 15 };
867
- case 'H':
868
- case 'oklchHue':
869
- return { minValue: 0, maxValue: 360, step: 1, pageStep: 15 };
870
- case 'saturation':
871
- case 'brightness':
872
- case 'lightness':
873
- return { minValue: 0, maxValue: 100, step: 1, pageStep: 10 };
874
- case 'red':
875
- case 'green':
876
- case 'blue':
877
- return { minValue: 0, maxValue: 255, step: 1, pageStep: 17 };
878
- case 'alpha':
879
- return { minValue: 0, maxValue: 1, step: 0.01, pageStep: 0.1 };
880
- case 'L':
881
- case 'oklchLightness':
882
- return { minValue: 0, maxValue: 1, step: 0.01, pageStep: 0.1 };
883
- case 'C':
884
- case 'oklchChroma':
885
- return { minValue: 0, maxValue: 0.4, step: 0.01, pageStep: 0.05 };
886
- default:
887
- return { minValue: 0, maxValue: 100, step: 1, pageStep: 10 };
888
- }
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
+ }
889
836
  }
890
837
  function getInputChannelRange(channel) {
891
- if (channel === 'hex') {
892
- return { minValue: 0, maxValue: 0xffffff, step: 1, pageStep: 1 };
893
- }
894
- 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);
895
845
  }
896
- function getChannelGradient(color, channel, orientation = 'horizontal') {
897
- const range = getChannelRange(channel);
898
- const direction = orientation === 'horizontal' ? 'right' : 'top';
899
- switch (channel) {
900
- case 'hue':
901
- case 'H':
902
- case 'oklchHue':
903
- 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%)`;
904
- case 'lightness':
905
- case 'L':
906
- case 'oklchLightness': {
907
- const start = color.setChannelValue(channel, range.minValue).toRgbString();
908
- const middle = color.setChannelValue(channel, (range.maxValue - range.minValue) / 2).toRgbString();
909
- const end = color.setChannelValue(channel, range.maxValue).toRgbString();
910
- return `linear-gradient(to ${direction}, ${start}, ${middle}, ${end})`;
911
- }
912
- case 'alpha': {
913
- const start = color.setChannelValue('alpha', range.minValue).toRgbString();
914
- const end = color.setChannelValue('alpha', range.maxValue).toRgbString();
915
- return `linear-gradient(to ${direction}, ${start}, ${end})`;
916
- }
917
- default: {
918
- const start = color.setChannelValue(channel, range.minValue).toRgbString();
919
- const end = color.setChannelValue(channel, range.maxValue).toRgbString();
920
- return `linear-gradient(to ${direction}, ${start}, ${end})`;
921
- }
922
- }
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
+ }
923
859
  }
924
860
  const channelGenerators = {
925
- hue: (color) => [0, 60, 120, 180, 240, 300, 360].map((h) => color.setChannelValue('hue', h).toRgbString()).join(', '),
926
- saturation: (color) => `${color.setChannelValue('saturation', 0).toRgbString()}, transparent`,
927
- lightness: () => 'black, transparent, white',
928
- 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"
929
873
  };
930
874
  function getAreaGradient(color, xChannel, yChannel, format) {
931
- const axes3d = getDefault3DAxes(format);
932
- const zChannel = axes3d.zChannel;
933
- const zValue = color.getChannelValue(zChannel);
934
- const isHSL = format === 'hsla';
935
- let base;
936
- if (isHSL) {
937
- base = parseColor('hsl(0, 100%, 50%)').setChannelValue(zChannel, zValue);
938
- }
939
- else {
940
- base = parseColor('hsb(0, 100%, 100%)').setChannelValue(zChannel, zValue);
941
- }
942
- const channels = [xChannel, yChannel];
943
- const direction = (c) => (c === xChannel ? 'right' : 'top');
944
- const layers = channels
945
- .map((c) => {
946
- const gen = channelGenerators[c];
947
- if (!gen)
948
- return null;
949
- return `linear-gradient(to ${direction(c)}, ${gen(base)})`;
950
- })
951
- .filter(Boolean)
952
- .reverse();
953
- const isHueZ = zChannel === 'hue' || zChannel === 'H' || zChannel === 'oklchHue';
954
- if (isHueZ) {
955
- layers.push(base.toRgbString());
956
- }
957
- 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(", ");
958
890
  }
959
891
  function getChannelColor(color, channel) {
960
- switch (channel) {
961
- case 'hue':
962
- return parseColor(`hsl(${color.getChannelValue('hue')}, 100%, 50%)`);
963
- case 'red':
964
- case 'green':
965
- case 'blue':
966
- case 'lightness':
967
- case 'brightness':
968
- case 'saturation':
969
- return color.setChannelValue('alpha', 1);
970
- case 'alpha':
971
- return color;
972
- default:
973
- return color.setChannelValue('alpha', 1);
974
- }
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
+ }
975
903
  }
976
904
  function toCssString(color, format) {
977
- const a = round(color.alpha, 2);
978
- switch (format) {
979
- case 'rgba':
980
- case 'hexa': {
981
- const rgb = color.toRGB();
982
- return `rgba(${Math.round(rgb.red)}, ${Math.round(rgb.green)}, ${Math.round(rgb.blue)}, ${a})`;
983
- }
984
- case 'hsla': {
985
- const hsl = color.toHSL();
986
- return `hsla(${Math.round(hsl.hue) % 360}, ${hsl.saturation.toFixed(2)}%, ${hsl.lightness.toFixed(2)}%, ${a})`;
987
- }
988
- case 'hsba': {
989
- // CSS doesn't support hsb, convert to hsl
990
- const hsl = color.toHSL();
991
- return `hsla(${Math.round(hsl.hue) % 360}, ${hsl.saturation.toFixed(2)}%, ${hsl.lightness.toFixed(2)}%, ${a})`;
992
- }
993
- case 'oklch': {
994
- return color.toOKLCH().toString('css');
995
- }
996
- default:
997
- return color.toOKLCH().toString('css');
998
- }
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
+ }
999
923
  }
1000
- function getInputChannelValue(color, channel, format = 'hsba') {
1001
- if (channel === 'hex') {
1002
- const alphaRange = getChannelRange('alpha');
1003
- if (color.alpha < alphaRange.maxValue) {
1004
- return color.toHexa();
1005
- }
1006
- return color.toHex();
1007
- }
1008
- if (channel === 'css') {
1009
- return toCssString(color, format);
1010
- }
1011
- const value = color.getChannelValue(channel);
1012
- if (Number.isNaN(value))
1013
- return 'NaN';
1014
- const range = getChannelRange(channel);
1015
- if (channel === 'H' || channel === 'oklchHue') {
1016
- const rounded = round(value, 2);
1017
- return rounded.toString();
1018
- }
1019
- if (channel === 'hue') {
1020
- const rounded = Math.round(value);
1021
- return rounded.toString();
1022
- }
1023
- if (range.step >= 1) {
1024
- return Math.round(value).toString();
1025
- }
1026
- 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();
1027
938
  }
1028
939
  function getDefault2DAxes(format) {
1029
- switch (format) {
1030
- case 'hsla':
1031
- return { xChannel: 'saturation', yChannel: 'lightness' };
1032
- case 'hsba':
1033
- case 'rgba':
1034
- case 'oklch':
1035
- default:
1036
- return { xChannel: 'saturation', yChannel: 'brightness' };
1037
- }
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
+ }
1038
950
  }
1039
951
  function getDefault3DAxes(format) {
1040
- switch (format) {
1041
- case 'hsla':
1042
- return { xChannel: 'saturation', yChannel: 'lightness', zChannel: 'hue' };
1043
- case 'hsba':
1044
- case 'rgba':
1045
- case 'oklch':
1046
- default:
1047
- return { xChannel: 'saturation', yChannel: 'brightness', zChannel: 'hue' };
1048
- }
1049
- }
1050
-
1051
- const INPUT_COLOR_INSTANCE = new InjectionToken('INPUT_COLOR_INSTANCE');
1052
- const INPUT_COLOR_SLIDER_INSTANCE = new InjectionToken('INPUT_COLOR_SLIDER_INSTANCE');
1053
-
1054
- /**
1055
- * InputColorArea is a helper component for InputColor component.
1056
- * @group Components
1057
- */
1058
- class InputColorArea extends BaseComponent {
1059
- componentName = 'InputColorArea';
1060
- bindDirectiveInstance = inject(Bind, { self: true });
1061
- $pc = inject(INPUT_COLOR_INSTANCE);
1062
- $xChannel = computed(() => this.$pc.$axes().xChannel, /* @ts-ignore */
1063
- ...(ngDevMode ? [{ debugName: "$xChannel" }] : /* istanbul ignore next */ []));
1064
- $yChannel = computed(() => this.$pc.$axes().yChannel, /* @ts-ignore */
1065
- ...(ngDevMode ? [{ debugName: "$yChannel" }] : /* istanbul ignore next */ []));
1066
- $areaGradient = computed(() => {
1067
- const color = this.$pc.$color();
1068
- const xCh = this.$xChannel();
1069
- const yCh = this.$yChannel();
1070
- const format = this.$pc.format();
1071
- return getAreaGradient(color, xCh, yCh, format);
1072
- }, /* @ts-ignore */
1073
- ...(ngDevMode ? [{ debugName: "$areaGradient" }] : /* istanbul ignore next */ []));
1074
- $handleBackground = computed(() => this.$pc.$color().setChannelValue('alpha', 1).toRgbString(), /* @ts-ignore */
1075
- ...(ngDevMode ? [{ debugName: "$handleBackground" }] : /* istanbul ignore next */ []));
1076
- $handleLeft = computed(() => {
1077
- const xCh = this.$xChannel();
1078
- const range = getChannelRange(xCh);
1079
- const value = this.$pc.$color().getChannelValue(xCh);
1080
- const pct = ((value - range.minValue) / (range.maxValue - range.minValue)) * 100;
1081
- return `${pct}%`;
1082
- }, /* @ts-ignore */
1083
- ...(ngDevMode ? [{ debugName: "$handleLeft" }] : /* istanbul ignore next */ []));
1084
- $handleTop = computed(() => {
1085
- const yCh = this.$yChannel();
1086
- const range = getChannelRange(yCh);
1087
- const value = this.$pc.$color().getChannelValue(yCh);
1088
- const pct = (1 - (value - range.minValue) / (range.maxValue - range.minValue)) * 100;
1089
- return `${pct}%`;
1090
- }, /* @ts-ignore */
1091
- ...(ngDevMode ? [{ debugName: "$handleTop" }] : /* istanbul ignore next */ []));
1092
- dragging = false;
1093
- dragOffset = { x: 0, y: 0 };
1094
- cleanupDrag = null;
1095
- onAfterViewChecked() {
1096
- this.bindDirectiveInstance.setAttrs(this.ptms(['host', 'root']));
1097
- }
1098
- onPointerDown(event) {
1099
- if (this.$pc.$disabled())
1100
- return;
1101
- event.preventDefault();
1102
- this.dragging = true;
1103
- const el = this.el.nativeElement;
1104
- el.setPointerCapture(event.pointerId);
1105
- const handle = event.target?.closest('[data-pc-section="areahandle"], .p-inputcolor-area-handle');
1106
- if (handle) {
1107
- const handleRect = handle.getBoundingClientRect();
1108
- this.dragOffset = {
1109
- x: event.clientX - (handleRect.left + handleRect.width / 2),
1110
- y: event.clientY - (handleRect.top + handleRect.height / 2)
1111
- };
1112
- }
1113
- else {
1114
- this.dragOffset = { x: 0, y: 0 };
1115
- }
1116
- this.updateFromPointer(event);
1117
- const onMove = (e) => {
1118
- if (!this.dragging)
1119
- return;
1120
- e.preventDefault();
1121
- this.updateFromPointer(e);
1122
- };
1123
- const cleanup = () => {
1124
- this.dragging = false;
1125
- this.cleanupDrag = null;
1126
- el.removeEventListener('pointermove', onMove);
1127
- el.removeEventListener('pointerup', onUp);
1128
- el.removeEventListener('pointercancel', onCancel);
1129
- el.removeEventListener('lostpointercapture', onLostCapture);
1130
- };
1131
- this.cleanupDrag = cleanup;
1132
- const onUp = (e) => {
1133
- if (!this.dragging)
1134
- return;
1135
- this.updateFromPointer(e, true);
1136
- this.dragOffset = { x: 0, y: 0 };
1137
- cleanup();
1138
- };
1139
- const onCancel = () => {
1140
- cleanup();
1141
- };
1142
- const onLostCapture = () => {
1143
- cleanup();
1144
- };
1145
- el.addEventListener('pointermove', onMove);
1146
- el.addEventListener('pointerup', onUp);
1147
- el.addEventListener('pointercancel', onCancel);
1148
- el.addEventListener('lostpointercapture', onLostCapture);
1149
- }
1150
- ngOnDestroy() {
1151
- this.cleanupDrag?.();
1152
- }
1153
- updateFromPointer(event, isEnd = false) {
1154
- const el = this.el.nativeElement;
1155
- const rect = el.getBoundingClientRect();
1156
- const xPercent = Math.max(0, Math.min(1, (event.clientX - this.dragOffset.x - rect.left) / rect.width));
1157
- const yPercent = Math.max(0, Math.min(1, (event.clientY - this.dragOffset.y - rect.top) / rect.height));
1158
- const xCh = this.$xChannel();
1159
- const yCh = this.$yChannel();
1160
- const xRange = getChannelRange(xCh);
1161
- const yRange = getChannelRange(yCh);
1162
- const xValue = snapValue(xRange.minValue + xPercent * (xRange.maxValue - xRange.minValue), xRange.minValue, xRange.maxValue, xRange.step);
1163
- const yValue = snapValue(yRange.maxValue - yPercent * (yRange.maxValue - yRange.minValue), yRange.minValue, yRange.maxValue, yRange.step);
1164
- const nativeColor = this.$pc.toChannelNativeFormat(this.$pc.$color(), xCh);
1165
- let color = nativeColor.setChannelValue(xCh, xValue);
1166
- color = color.setChannelValue(yCh, yValue);
1167
- this.$pc.updateColor(color, event, isEnd);
1168
- }
1169
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.2", ngImport: i0, type: InputColorArea, deps: null, target: i0.ɵɵFactoryTarget.Component });
1170
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "22.1.2", 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 });
1171
- }
1172
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.2", ngImport: i0, type: InputColorArea, decorators: [{
1173
- type: Component,
1174
- args: [{
1175
- selector: 'p-inputcolor-area',
1176
- standalone: true,
1177
- template: `<ng-content></ng-content>`,
1178
- changeDetection: ChangeDetectionStrategy.OnPush,
1179
- encapsulation: ViewEncapsulation.None,
1180
- host: {
1181
- '[class]': '$pc.cx("area")',
1182
- '[style.--px-area-gradient]': '$areaGradient()',
1183
- '[style.--px-handle-background]': '$handleBackground()',
1184
- '[style.--px-handle-position-left]': '$handleLeft()',
1185
- '[style.--px-handle-position-top]': '$handleTop()',
1186
- '(pointerdown)': 'onPointerDown($event)'
1187
- },
1188
- providers: [{ provide: PARENT_INSTANCE, useExisting: InputColorArea }],
1189
- hostDirectives: [Bind]
1190
- }]
1191
- }] });
1192
-
1193
- /**
1194
- * InputColorAreaBackground is a helper component for InputColor component.
1195
- * @group Components
1196
- */
1197
- class InputColorAreaBackground extends BaseComponent {
1198
- componentName = 'InputColorAreaBackground';
1199
- bindDirectiveInstance = inject(Bind, { self: true });
1200
- $pc = inject(INPUT_COLOR_INSTANCE);
1201
- onAfterViewChecked() {
1202
- this.bindDirectiveInstance.setAttrs(this.ptms(['host', 'root']));
1203
- }
1204
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.2", ngImport: i0, type: InputColorAreaBackground, deps: null, target: i0.ɵɵFactoryTarget.Component });
1205
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "22.1.2", 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 });
1206
- }
1207
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.2", ngImport: i0, type: InputColorAreaBackground, decorators: [{
1208
- type: Component,
1209
- args: [{
1210
- selector: 'p-inputcolor-area-background',
1211
- standalone: true,
1212
- template: `<ng-content></ng-content>`,
1213
- changeDetection: ChangeDetectionStrategy.OnPush,
1214
- encapsulation: ViewEncapsulation.None,
1215
- host: {
1216
- '[class]': '$pc.cx("areaBackground")'
1217
- },
1218
- providers: [{ provide: PARENT_INSTANCE, useExisting: InputColorAreaBackground }],
1219
- hostDirectives: [Bind]
1220
- }]
1221
- }] });
1222
-
1223
- /**
1224
- * InputColorAreaHandle is a helper component for InputColor component.
1225
- * @group Components
1226
- */
1227
- class InputColorAreaHandle extends BaseComponent {
1228
- componentName = 'InputColorAreaHandle';
1229
- bindDirectiveInstance = inject(Bind, { self: true });
1230
- $pc = inject(INPUT_COLOR_INSTANCE);
1231
- $xChannel = computed(() => this.$pc.$axes().xChannel, /* @ts-ignore */
1232
- ...(ngDevMode ? [{ debugName: "$xChannel" }] : /* istanbul ignore next */ []));
1233
- $yChannel = computed(() => this.$pc.$axes().yChannel, /* @ts-ignore */
1234
- ...(ngDevMode ? [{ debugName: "$yChannel" }] : /* istanbul ignore next */ []));
1235
- $xRange = computed(() => getChannelRange(this.$xChannel()), /* @ts-ignore */
1236
- ...(ngDevMode ? [{ debugName: "$xRange" }] : /* istanbul ignore next */ []));
1237
- $yRange = computed(() => getChannelRange(this.$yChannel()), /* @ts-ignore */
1238
- ...(ngDevMode ? [{ debugName: "$yRange" }] : /* istanbul ignore next */ []));
1239
- $xValue = computed(() => this.$pc.$color().getChannelValue(this.$xChannel()), /* @ts-ignore */
1240
- ...(ngDevMode ? [{ debugName: "$xValue" }] : /* istanbul ignore next */ []));
1241
- $yValue = computed(() => this.$pc.$color().getChannelValue(this.$yChannel()), /* @ts-ignore */
1242
- ...(ngDevMode ? [{ debugName: "$yValue" }] : /* istanbul ignore next */ []));
1243
- $xMin = computed(() => this.$xRange().minValue, /* @ts-ignore */
1244
- ...(ngDevMode ? [{ debugName: "$xMin" }] : /* istanbul ignore next */ []));
1245
- $xMax = computed(() => this.$xRange().maxValue, /* @ts-ignore */
1246
- ...(ngDevMode ? [{ debugName: "$xMax" }] : /* istanbul ignore next */ []));
1247
- $tabindex = computed(() => (this.$pc.$disabled() ? -1 : 0), /* @ts-ignore */
1248
- ...(ngDevMode ? [{ debugName: "$tabindex" }] : /* istanbul ignore next */ []));
1249
- $ariaDisabled = computed(() => this.$pc.$disabled() || undefined, /* @ts-ignore */
1250
- ...(ngDevMode ? [{ debugName: "$ariaDisabled" }] : /* istanbul ignore next */ []));
1251
- $ariaValueText = computed(() => {
1252
- const xCh = this.$xChannel();
1253
- const yCh = this.$yChannel();
1254
- return `${xCh} ${this.$xValue()}, ${yCh} ${this.$yValue()}`;
1255
- }, /* @ts-ignore */
1256
- ...(ngDevMode ? [{ debugName: "$ariaValueText" }] : /* istanbul ignore next */ []));
1257
- onAfterViewChecked() {
1258
- this.bindDirectiveInstance.setAttrs(this.ptms(['host', 'root']));
1259
- }
1260
- onKeyDown(event) {
1261
- if (this.$pc.$disabled())
1262
- return;
1263
- const xCh = this.$xChannel();
1264
- const yCh = this.$yChannel();
1265
- const xRange = this.$xRange();
1266
- const yRange = this.$yRange();
1267
- let xVal = this.$xValue();
1268
- let yVal = this.$yValue();
1269
- let handled = false;
1270
- switch (event.key) {
1271
- case 'ArrowRight':
1272
- xVal = Math.min(xVal + xRange.step, xRange.maxValue);
1273
- handled = true;
1274
- break;
1275
- case 'ArrowLeft':
1276
- xVal = Math.max(xVal - xRange.step, xRange.minValue);
1277
- handled = true;
1278
- break;
1279
- case 'ArrowUp':
1280
- yVal = Math.min(yVal + yRange.step, yRange.maxValue);
1281
- handled = true;
1282
- break;
1283
- case 'ArrowDown':
1284
- yVal = Math.max(yVal - yRange.step, yRange.minValue);
1285
- handled = true;
1286
- break;
1287
- case 'PageUp':
1288
- yVal = Math.min(yVal + yRange.pageStep, yRange.maxValue);
1289
- handled = true;
1290
- break;
1291
- case 'PageDown':
1292
- yVal = Math.max(yVal - yRange.pageStep, yRange.minValue);
1293
- handled = true;
1294
- break;
1295
- case 'Home':
1296
- xVal = xRange.minValue;
1297
- handled = true;
1298
- break;
1299
- case 'End':
1300
- xVal = xRange.maxValue;
1301
- handled = true;
1302
- break;
1303
- }
1304
- if (handled) {
1305
- event.preventDefault();
1306
- const nativeColor = this.$pc.toChannelNativeFormat(this.$pc.$color(), xCh);
1307
- let color = nativeColor.setChannelValue(xCh, xVal);
1308
- color = color.setChannelValue(yCh, yVal);
1309
- this.$pc.updateColor(color, event, true);
1310
- }
1311
- }
1312
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.2", ngImport: i0, type: InputColorAreaHandle, deps: null, target: i0.ɵɵFactoryTarget.Component });
1313
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "22.1.2", 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
+ }
1314
964
  }
1315
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.2", ngImport: i0, type: InputColorAreaHandle, decorators: [{
1316
- type: Component,
1317
- args: [{
1318
- selector: 'p-inputcolor-area-handle',
1319
- standalone: true,
1320
- template: `<ng-content></ng-content>`,
1321
- changeDetection: ChangeDetectionStrategy.OnPush,
1322
- encapsulation: ViewEncapsulation.None,
1323
- host: {
1324
- '[class]': '$pc.cx("areaHandle")',
1325
- '[attr.role]': "'slider'",
1326
- '[attr.tabindex]': '$tabindex()',
1327
- '[attr.aria-label]': "'Color'",
1328
- '[attr.aria-roledescription]': "'2d slider'",
1329
- '[attr.aria-disabled]': '$ariaDisabled()',
1330
- '[attr.aria-valuemin]': '$xMin()',
1331
- '[attr.aria-valuemax]': '$xMax()',
1332
- '[attr.aria-valuenow]': '$xValue()',
1333
- '[attr.aria-valuetext]': '$ariaValueText()',
1334
- '(keydown)': 'onKeyDown($event)'
1335
- },
1336
- providers: [{ provide: PARENT_INSTANCE, useExisting: InputColorAreaHandle }],
1337
- hostDirectives: [Bind]
1338
- }]
1339
- }] });
1340
-
1341
- /**
1342
- * InputColorEyeDropper is a helper component for InputColor component.
1343
- * @group Components
1344
- */
1345
- class InputColorEyeDropper extends BaseComponent {
1346
- componentName = 'InputColorEyeDropper';
1347
- bindDirectiveInstance = inject(Bind, { self: true });
1348
- $pc = inject(INPUT_COLOR_INSTANCE);
1349
- /**
1350
- * Whether to display button as text.
1351
- * @group Props
1352
- */
1353
- text = input(false, /* @ts-ignore */
1354
- ...(ngDevMode ? [{ debugName: "text" }] : /* istanbul ignore next */ []));
1355
- /**
1356
- * Whether to display a rounded button.
1357
- * @group Props
1358
- */
1359
- rounded = input(false, /* @ts-ignore */
1360
- ...(ngDevMode ? [{ debugName: "rounded" }] : /* istanbul ignore next */ []));
1361
- /**
1362
- * Whether to display button as outlined.
1363
- * @group Props
1364
- */
1365
- outlined = input(false, /* @ts-ignore */
1366
- ...(ngDevMode ? [{ debugName: "outlined" }] : /* istanbul ignore next */ []));
1367
- /**
1368
- * Whether to display an icon-only button.
1369
- * @group Props
1370
- */
1371
- iconOnly = input(false, /* @ts-ignore */
1372
- ...(ngDevMode ? [{ debugName: "iconOnly" }] : /* istanbul ignore next */ []));
1373
- /**
1374
- * Defines the color severity of the button.
1375
- * @group Props
1376
- */
1377
- severity = input(undefined, /* @ts-ignore */
1378
- ...(ngDevMode ? [{ debugName: "severity" }] : /* istanbul ignore next */ []));
1379
- /**
1380
- * Defines the size of the button.
1381
- * @group Props
1382
- */
1383
- size = input(undefined, /* @ts-ignore */
1384
- ...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
1385
- onAfterViewChecked() {
1386
- this.bindDirectiveInstance.setAttrs(this.ptms(['host', 'root']));
1387
- }
1388
- async onPickColor(event) {
1389
- if (this.$pc.$disabled())
1390
- return;
1391
- if (!isPlatformBrowser(this.platformId))
1392
- return;
1393
- try {
1394
- const eyeDropper = new window.EyeDropper();
1395
- const result = await eyeDropper.open();
1396
- if (result?.sRGBHex) {
1397
- const parsed = parseColor(result.sRGBHex);
1398
- if (parsed) {
1399
- this.$pc.updateColor(parsed, event, true);
1400
- }
1401
- }
1402
- }
1403
- catch {
1404
- // User cancelled or API not available
1405
- }
1406
- }
1407
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.2", ngImport: i0, type: InputColorEyeDropper, deps: null, target: i0.ɵɵFactoryTarget.Component });
1408
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.2", 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: `
1409
1426
  <ng-template #contentTpl><ng-content /></ng-template>
1410
1427
  <button
1411
1428
  pButton
@@ -1428,15 +1445,69 @@ class InputColorEyeDropper extends BaseComponent {
1428
1445
  <ng-container *ngTemplateOutlet="contentTpl" />
1429
1446
  }
1430
1447
  </button>
1431
- `, 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 });
1432
- }
1433
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.2", ngImport: i0, type: InputColorEyeDropper, decorators: [{
1434
- type: Component,
1435
- args: [{
1436
- selector: 'p-inputcolor-eyedropper',
1437
- standalone: true,
1438
- imports: [ButtonDirective, ButtonIcon, NgTemplateOutlet],
1439
- 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: `
1440
1511
  <ng-template #contentTpl><ng-content /></ng-template>
1441
1512
  <button
1442
1513
  pButton
@@ -1460,803 +1531,1183 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.2", ngImpor
1460
1531
  }
1461
1532
  </button>
1462
1533
  `,
1463
- changeDetection: ChangeDetectionStrategy.OnPush,
1464
- encapsulation: ViewEncapsulation.None,
1465
- host: {
1466
- '[class]': '$pc.cx("eyeDropper")'
1467
- },
1468
- providers: [{ provide: PARENT_INSTANCE, useExisting: InputColorEyeDropper }],
1469
- hostDirectives: [Bind]
1470
- }]
1471
- }], 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 }] }] } });
1472
-
1473
- class InputColorInput extends BaseComponent {
1474
- componentName = 'InputColorInput';
1475
- $pc = inject(INPUT_COLOR_INSTANCE);
1476
- /**
1477
- * The color channel this input controls.
1478
- * @group Props
1479
- */
1480
- channel = input.required(/* @ts-ignore */
1481
- ...(ngDevMode ? [{ debugName: "channel" }] : /* istanbul ignore next */ []));
1482
- /**
1483
- * The input type attribute.
1484
- * @group Props
1485
- */
1486
- type = input(/* @ts-ignore */
1487
- ...(ngDevMode ? [undefined, { debugName: "type" }] : /* istanbul ignore next */ []));
1488
- /**
1489
- * When present, it specifies that the input should be disabled.
1490
- * @group Props
1491
- */
1492
- disabled = input(false, { ...(ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
1493
- $disabled = computed(() => this.disabled() || this.$pc.$disabled(), /* @ts-ignore */
1494
- ...(ngDevMode ? [{ debugName: "$disabled" }] : /* istanbul ignore next */ []));
1495
- $inputType = computed(() => {
1496
- const t = this.type();
1497
- if (t)
1498
- return t;
1499
- const ch = this.channel();
1500
- return ch === 'hex' || ch === 'css' ? 'text' : 'number';
1501
- }, /* @ts-ignore */
1502
- ...(ngDevMode ? [{ debugName: "$inputType" }] : /* istanbul ignore next */ []));
1503
- $displayValue = computed(() => {
1504
- const ch = this.channel();
1505
- const color = this.$pc.$color();
1506
- const format = this.$pc.format();
1507
- return getInputChannelValue(color, ch, format);
1508
- }, /* @ts-ignore */
1509
- ...(ngDevMode ? [{ debugName: "$displayValue" }] : /* istanbul ignore next */ []));
1510
- pendingValue = null;
1511
- constructor() {
1512
- super();
1513
- effect(() => {
1514
- this.el.nativeElement.type = this.$inputType();
1515
- });
1516
- effect(() => {
1517
- const el = this.el.nativeElement;
1518
- const ch = this.channel();
1519
- if (ch !== 'hex' && ch !== 'css') {
1520
- const range = getChannelRange(ch);
1521
- el.min = String(range.minValue);
1522
- el.max = String(range.maxValue);
1523
- el.step = String(range.step);
1524
- }
1525
- });
1526
- effect(() => {
1527
- this.el.nativeElement.value = String(this.$displayValue() ?? '');
1528
- });
1529
- }
1530
- onInput(event) {
1531
- const target = event.target;
1532
- this.pendingValue = target.value;
1533
- }
1534
- onBlur(event) {
1535
- this.commitValue(event);
1536
- }
1537
- onEnter(event) {
1538
- this.commitValue(event);
1539
- }
1540
- commitValue(event) {
1541
- if (this.pendingValue === null)
1542
- return;
1543
- const ch = this.channel();
1544
- const value = this.pendingValue;
1545
- this.pendingValue = null;
1546
- if (ch === 'hex') {
1547
- const hex = value.startsWith('#') ? value : `#${value}`;
1548
- const parsed = parseColor(hex);
1549
- if (parsed) {
1550
- this.$pc.updateColor(parsed, event, true);
1551
- }
1552
- }
1553
- else if (ch === 'css') {
1554
- const parsed = parseColor(value);
1555
- if (parsed) {
1556
- this.$pc.updateColor(parsed, event, true);
1557
- }
1558
- }
1559
- else {
1560
- const numValue = parseFloat(value);
1561
- if (!isNaN(numValue)) {
1562
- const range = getChannelRange(ch);
1563
- const clamped = Math.max(range.minValue, Math.min(range.maxValue, numValue));
1564
- this.$pc.setChannelValue(ch, clamped, event, true);
1565
- }
1566
- }
1567
- }
1568
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.2", ngImport: i0, type: InputColorInput, deps: [], target: i0.ɵɵFactoryTarget.Directive });
1569
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.1.2", 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 });
1570
- }
1571
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.2", ngImport: i0, type: InputColorInput, decorators: [{
1572
- type: Directive,
1573
- args: [{
1574
- selector: '[pInputColorInput]',
1575
- standalone: true,
1576
- host: {
1577
- '[attr.disabled]': '$disabled() || null',
1578
- '[attr.data-channel]': 'channel()',
1579
- '(input)': 'onInput($event)',
1580
- '(blur)': 'onBlur($event)',
1581
- '(keydown.enter)': 'onEnter($event)'
1582
- },
1583
- providers: [{ provide: PARENT_INSTANCE, useExisting: InputColorInput }],
1584
- hostDirectives: [
1585
- {
1586
- directive: InputText,
1587
- inputs: ['pSize', 'fluid', 'variant', 'invalid']
1588
- }
1589
- ]
1590
- }]
1591
- }], 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 }] }] } });
1592
-
1593
- /**
1594
- * InputColorSlider is a helper component for InputColor component.
1595
- * @group Components
1596
- */
1597
- class InputColorSlider extends BaseComponent {
1598
- componentName = 'InputColorSlider';
1599
- bindDirectiveInstance = inject(Bind, { self: true });
1600
- $pc = inject(INPUT_COLOR_INSTANCE);
1601
- /**
1602
- * The color channel this slider controls.
1603
- * @group Props
1604
- */
1605
- channel = input('hue', /* @ts-ignore */
1606
- ...(ngDevMode ? [{ debugName: "channel" }] : /* istanbul ignore next */ []));
1607
- /**
1608
- * Orientation of the slider.
1609
- * @group Props
1610
- */
1611
- orientation = input('horizontal', /* @ts-ignore */
1612
- ...(ngDevMode ? [{ debugName: "orientation" }] : /* istanbul ignore next */ []));
1613
- dragging = false;
1614
- cleanupDrag = null;
1615
- onAfterViewChecked() {
1616
- this.bindDirectiveInstance.setAttrs(this.ptms(['host', 'root']));
1617
- }
1618
- onPointerDown(event) {
1619
- if (this.$pc.$disabled())
1620
- return;
1621
- event.preventDefault();
1622
- this.dragging = true;
1623
- const el = this.el.nativeElement;
1624
- el.setPointerCapture(event.pointerId);
1625
- this.updateFromPointer(event);
1626
- const onMove = (e) => {
1627
- if (!this.dragging)
1628
- return;
1629
- e.preventDefault();
1630
- this.updateFromPointer(e);
1631
- };
1632
- const cleanup = () => {
1633
- this.dragging = false;
1634
- this.cleanupDrag = null;
1635
- el.removeEventListener('pointermove', onMove);
1636
- el.removeEventListener('pointerup', onUp);
1637
- el.removeEventListener('pointercancel', onCancel);
1638
- el.removeEventListener('lostpointercapture', onLostCapture);
1639
- };
1640
- this.cleanupDrag = cleanup;
1641
- const onUp = (e) => {
1642
- if (!this.dragging)
1643
- return;
1644
- this.updateFromPointer(e, true);
1645
- cleanup();
1646
- };
1647
- const onCancel = () => {
1648
- cleanup();
1649
- };
1650
- const onLostCapture = () => {
1651
- cleanup();
1652
- };
1653
- el.addEventListener('pointermove', onMove);
1654
- el.addEventListener('pointerup', onUp);
1655
- el.addEventListener('pointercancel', onCancel);
1656
- el.addEventListener('lostpointercapture', onLostCapture);
1657
- }
1658
- ngOnDestroy() {
1659
- this.cleanupDrag?.();
1660
- }
1661
- updateFromPointer(event, isEnd = false) {
1662
- const el = this.el.nativeElement;
1663
- const rect = el.getBoundingClientRect();
1664
- const ch = this.channel();
1665
- const range = getChannelRange(ch);
1666
- let percent;
1667
- if (this.orientation() === 'vertical') {
1668
- percent = 1 - Math.max(0, Math.min(1, (event.clientY - rect.top) / rect.height));
1669
- }
1670
- else {
1671
- percent = Math.max(0, Math.min(1, (event.clientX - rect.left) / rect.width));
1672
- }
1673
- const rawValue = range.minValue + percent * (range.maxValue - range.minValue);
1674
- const value = snapValue(rawValue, range.minValue, range.maxValue, range.step);
1675
- this.$pc.setChannelValue(ch, value, event, isEnd);
1676
- }
1677
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.2", ngImport: i0, type: InputColorSlider, deps: null, target: i0.ɵɵFactoryTarget.Component });
1678
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.1.2", 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: [
1679
- { provide: INPUT_COLOR_SLIDER_INSTANCE, useExisting: InputColorSlider },
1680
- { provide: PARENT_INSTANCE, useExisting: InputColorSlider }
1681
- ], usesInheritance: true, hostDirectives: [{ directive: i1.Bind }], ngImport: i0, template: `<ng-content></ng-content>`, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
1682
- }
1683
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.2", ngImport: i0, type: InputColorSlider, decorators: [{
1684
- type: Component,
1685
- args: [{
1686
- selector: 'p-inputcolor-slider',
1687
- standalone: true,
1688
- template: `<ng-content></ng-content>`,
1689
- changeDetection: ChangeDetectionStrategy.OnPush,
1690
- encapsulation: ViewEncapsulation.None,
1691
- host: {
1692
- '[class]': '$pc.cx("slider")',
1693
- '[class.p-inputcolor-slider-horizontal]': 'orientation() === "horizontal"',
1694
- '[class.p-inputcolor-slider-vertical]': 'orientation() === "vertical"',
1695
- '[attr.data-orientation]': 'orientation()',
1696
- '(pointerdown)': 'onPointerDown($event)'
1697
- },
1698
- providers: [
1699
- { provide: INPUT_COLOR_SLIDER_INSTANCE, useExisting: InputColorSlider },
1700
- { provide: PARENT_INSTANCE, useExisting: InputColorSlider }
1701
- ],
1702
- hostDirectives: [Bind]
1703
- }]
1704
- }], propDecorators: { channel: [{ type: i0.Input, args: [{ isSignal: true, alias: "channel", required: false }] }], orientation: [{ type: i0.Input, args: [{ isSignal: true, alias: "orientation", required: false }] }] } });
1705
-
1706
- /**
1707
- * InputColorSliderHandle is a helper component for InputColor component.
1708
- * @group Components
1709
- */
1710
- class InputColorSliderHandle extends BaseComponent {
1711
- componentName = 'InputColorSliderHandle';
1712
- bindDirectiveInstance = inject(Bind, { self: true });
1713
- $pc = inject(INPUT_COLOR_INSTANCE);
1714
- pcSlider = inject(INPUT_COLOR_SLIDER_INSTANCE);
1715
- $channel = computed(() => this.pcSlider.channel(), /* @ts-ignore */
1716
- ...(ngDevMode ? [{ debugName: "$channel" }] : /* istanbul ignore next */ []));
1717
- $isVertical = computed(() => this.pcSlider.orientation() === 'vertical', /* @ts-ignore */
1718
- ...(ngDevMode ? [{ debugName: "$isVertical" }] : /* istanbul ignore next */ []));
1719
- $range = computed(() => getChannelRange(this.$channel()), /* @ts-ignore */
1720
- ...(ngDevMode ? [{ debugName: "$range" }] : /* istanbul ignore next */ []));
1721
- $value = computed(() => this.$pc.$color().getChannelValue(this.$channel()), /* @ts-ignore */
1722
- ...(ngDevMode ? [{ debugName: "$value" }] : /* istanbul ignore next */ []));
1723
- $tabindex = computed(() => (this.$pc.$disabled() ? -1 : 0), /* @ts-ignore */
1724
- ...(ngDevMode ? [{ debugName: "$tabindex" }] : /* istanbul ignore next */ []));
1725
- $ariaDisabled = computed(() => this.$pc.$disabled() || undefined, /* @ts-ignore */
1726
- ...(ngDevMode ? [{ debugName: "$ariaDisabled" }] : /* istanbul ignore next */ []));
1727
- $handlePosition = computed(() => {
1728
- const range = this.$range();
1729
- const value = this.$value();
1730
- const pct = ((value - range.minValue) / (range.maxValue - range.minValue)) * 100;
1731
- return `${pct}%`;
1732
- }, /* @ts-ignore */
1733
- ...(ngDevMode ? [{ debugName: "$handlePosition" }] : /* istanbul ignore next */ []));
1734
- $handlePositionVertical = computed(() => {
1735
- const range = this.$range();
1736
- const value = this.$value();
1737
- const pct = 100 - ((value - range.minValue) / (range.maxValue - range.minValue)) * 100;
1738
- return `${pct}%`;
1739
- }, /* @ts-ignore */
1740
- ...(ngDevMode ? [{ debugName: "$handlePositionVertical" }] : /* istanbul ignore next */ []));
1741
- $left = computed(() => (this.$isVertical() ? null : this.$handlePosition()), /* @ts-ignore */
1742
- ...(ngDevMode ? [{ debugName: "$left" }] : /* istanbul ignore next */ []));
1743
- $top = computed(() => (this.$isVertical() ? this.$handlePositionVertical() : null), /* @ts-ignore */
1744
- ...(ngDevMode ? [{ debugName: "$top" }] : /* istanbul ignore next */ []));
1745
- $translate = computed(() => (this.$isVertical() ? '0 -50%' : '-50% 0'), /* @ts-ignore */
1746
- ...(ngDevMode ? [{ debugName: "$translate" }] : /* istanbul ignore next */ []));
1747
- $handleColor = computed(() => getChannelColor(this.$pc.$color(), this.$channel()).toRgbString(), /* @ts-ignore */
1748
- ...(ngDevMode ? [{ debugName: "$handleColor" }] : /* istanbul ignore next */ []));
1749
- onAfterViewChecked() {
1750
- this.bindDirectiveInstance.setAttrs(this.ptms(['host', 'root']));
1751
- }
1752
- onKeyDown(event) {
1753
- if (this.$pc.$disabled())
1754
- return;
1755
- const ch = this.$channel();
1756
- const range = this.$range();
1757
- let value = this.$value();
1758
- let handled = false;
1759
- switch (event.key) {
1760
- case 'ArrowRight':
1761
- case 'ArrowUp':
1762
- value = Math.min(value + range.step, range.maxValue);
1763
- handled = true;
1764
- break;
1765
- case 'ArrowLeft':
1766
- case 'ArrowDown':
1767
- value = Math.max(value - range.step, range.minValue);
1768
- handled = true;
1769
- break;
1770
- case 'PageUp':
1771
- value = Math.min(value + range.pageStep, range.maxValue);
1772
- handled = true;
1773
- break;
1774
- case 'PageDown':
1775
- value = Math.max(value - range.pageStep, range.minValue);
1776
- handled = true;
1777
- break;
1778
- case 'Home':
1779
- value = range.minValue;
1780
- handled = true;
1781
- break;
1782
- case 'End':
1783
- value = range.maxValue;
1784
- handled = true;
1785
- break;
1786
- }
1787
- if (handled) {
1788
- event.preventDefault();
1789
- this.$pc.setChannelValue(ch, value, event, true);
1790
- }
1791
- }
1792
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.2", ngImport: i0, type: InputColorSliderHandle, deps: null, target: i0.ɵɵFactoryTarget.Component });
1793
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "22.1.2", 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 });
1794
- }
1795
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.2", ngImport: i0, type: InputColorSliderHandle, decorators: [{
1796
- type: Component,
1797
- args: [{
1798
- selector: 'p-inputcolor-slider-handle',
1799
- standalone: true,
1800
- template: `<ng-content></ng-content>`,
1801
- changeDetection: ChangeDetectionStrategy.OnPush,
1802
- encapsulation: ViewEncapsulation.None,
1803
- host: {
1804
- '[class]': '$pc.cx("sliderHandle")',
1805
- '[style.--px-slider-handle-background]': '$handleColor()',
1806
- '[style.left]': '$left()',
1807
- '[style.top]': '$top()',
1808
- '[style.translate]': '$translate()',
1809
- '[attr.role]': "'slider'",
1810
- '[attr.tabindex]': '$tabindex()',
1811
- '[attr.aria-label]': '$channel()',
1812
- '[attr.aria-disabled]': '$ariaDisabled()',
1813
- '[attr.aria-valuemin]': '$range().minValue',
1814
- '[attr.aria-valuemax]': '$range().maxValue',
1815
- '[attr.aria-valuenow]': '$value()',
1816
- '(keydown)': 'onKeyDown($event)'
1817
- },
1818
- providers: [{ provide: PARENT_INSTANCE, useExisting: InputColorSliderHandle }],
1819
- hostDirectives: [Bind]
1820
- }]
1821
- }] });
1822
-
1823
- /**
1824
- * InputColorSliderTrack is a helper component for InputColor component.
1825
- * @group Components
1826
- */
1827
- class InputColorSliderTrack extends BaseComponent {
1828
- componentName = 'InputColorSliderTrack';
1829
- bindDirectiveInstance = inject(Bind, { self: true });
1830
- $pc = inject(INPUT_COLOR_INSTANCE);
1831
- pcSlider = inject(INPUT_COLOR_SLIDER_INSTANCE);
1832
- $gradient = computed(() => {
1833
- const ch = this.pcSlider.channel();
1834
- const color = this.$pc.$color();
1835
- const orientation = this.pcSlider.orientation();
1836
- return getChannelGradient(color, ch, orientation);
1837
- }, /* @ts-ignore */
1838
- ...(ngDevMode ? [{ debugName: "$gradient" }] : /* istanbul ignore next */ []));
1839
- onAfterViewChecked() {
1840
- this.bindDirectiveInstance.setAttrs(this.ptms(['host', 'root']));
1841
- }
1842
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.2", ngImport: i0, type: InputColorSliderTrack, deps: null, target: i0.ɵɵFactoryTarget.Component });
1843
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "22.1.2", 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 });
1844
- }
1845
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.2", ngImport: i0, type: InputColorSliderTrack, decorators: [{
1846
- type: Component,
1847
- args: [{
1848
- selector: 'p-inputcolor-slider-track',
1849
- standalone: true,
1850
- template: `<ng-content></ng-content>`,
1851
- changeDetection: ChangeDetectionStrategy.OnPush,
1852
- encapsulation: ViewEncapsulation.None,
1853
- host: {
1854
- '[class]': '$pc.cx("sliderTrack")',
1855
- '[style.--px-slider-background]': '$gradient()'
1856
- },
1857
- providers: [{ provide: PARENT_INSTANCE, useExisting: InputColorSliderTrack }],
1858
- hostDirectives: [Bind]
1859
- }]
1860
- }] });
1861
-
1862
- /**
1863
- * InputColorSwatch is a helper component for InputColor component.
1864
- * @group Components
1865
- */
1866
- class InputColorSwatch extends BaseComponent {
1867
- componentName = 'InputColorSwatch';
1868
- bindDirectiveInstance = inject(Bind, { self: true });
1869
- $pc = inject(INPUT_COLOR_INSTANCE);
1870
- onAfterViewChecked() {
1871
- this.bindDirectiveInstance.setAttrs(this.ptms(['host', 'root']));
1872
- }
1873
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.2", ngImport: i0, type: InputColorSwatch, deps: null, target: i0.ɵɵFactoryTarget.Component });
1874
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "22.1.2", 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 });
1875
- }
1876
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.2", ngImport: i0, type: InputColorSwatch, decorators: [{
1877
- type: Component,
1878
- args: [{
1879
- selector: 'p-inputcolor-swatch',
1880
- standalone: true,
1881
- template: `<ng-content></ng-content>`,
1882
- changeDetection: ChangeDetectionStrategy.OnPush,
1883
- encapsulation: ViewEncapsulation.None,
1884
- host: {
1885
- '[class]': '$pc.cx("swatch")'
1886
- },
1887
- providers: [{ provide: PARENT_INSTANCE, useExisting: InputColorSwatch }],
1888
- hostDirectives: [Bind]
1889
- }]
1890
- }] });
1891
-
1892
- /**
1893
- * InputColorSwatchBackground is a helper component for InputColor component.
1894
- * @group Components
1895
- */
1896
- class InputColorSwatchBackground extends BaseComponent {
1897
- componentName = 'InputColorSwatchBackground';
1898
- bindDirectiveInstance = inject(Bind, { self: true });
1899
- $pc = inject(INPUT_COLOR_INSTANCE);
1900
- $swatchColor = computed(() => this.$pc.$color().toRgbString(), /* @ts-ignore */
1901
- ...(ngDevMode ? [{ debugName: "$swatchColor" }] : /* istanbul ignore next */ []));
1902
- onAfterViewChecked() {
1903
- this.bindDirectiveInstance.setAttrs(this.ptms(['host', 'root']));
1904
- }
1905
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.2", ngImport: i0, type: InputColorSwatchBackground, deps: null, target: i0.ɵɵFactoryTarget.Component });
1906
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "22.1.2", 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 });
1907
- }
1908
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.2", ngImport: i0, type: InputColorSwatchBackground, decorators: [{
1909
- type: Component,
1910
- args: [{
1911
- selector: 'p-inputcolor-swatch-background',
1912
- standalone: true,
1913
- template: `<ng-content></ng-content>`,
1914
- changeDetection: ChangeDetectionStrategy.OnPush,
1915
- encapsulation: ViewEncapsulation.None,
1916
- host: {
1917
- '[class]': '$pc.cx("swatchBackground")',
1918
- '[style.--px-swatch-background]': '$swatchColor()'
1919
- },
1920
- providers: [{ provide: PARENT_INSTANCE, useExisting: InputColorSwatchBackground }],
1921
- hostDirectives: [Bind]
1922
- }]
1923
- }] });
1924
-
1925
- /**
1926
- * InputColorTransparencyGrid is a helper component for InputColor component.
1927
- * @group Components
1928
- */
1929
- class InputColorTransparencyGrid extends BaseComponent {
1930
- componentName = 'InputColorTransparencyGrid';
1931
- bindDirectiveInstance = inject(Bind, { self: true });
1932
- $pc = inject(INPUT_COLOR_INSTANCE);
1933
- onAfterViewChecked() {
1934
- this.bindDirectiveInstance.setAttrs(this.ptms(['host', 'root']));
1935
- }
1936
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.2", ngImport: i0, type: InputColorTransparencyGrid, deps: null, target: i0.ɵɵFactoryTarget.Component });
1937
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "22.1.2", 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 });
1938
- }
1939
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.2", ngImport: i0, type: InputColorTransparencyGrid, decorators: [{
1940
- type: Component,
1941
- args: [{
1942
- selector: 'p-inputcolor-transparency-grid',
1943
- standalone: true,
1944
- template: `<ng-content></ng-content>`,
1945
- changeDetection: ChangeDetectionStrategy.OnPush,
1946
- encapsulation: ViewEncapsulation.None,
1947
- host: {
1948
- '[class]': '$pc.cx("transparencyGrid")'
1949
- },
1950
- providers: [{ provide: PARENT_INSTANCE, useExisting: InputColorTransparencyGrid }],
1951
- hostDirectives: [Bind]
1952
- }]
1953
- }] });
1954
-
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
+ });
1955
2349
  const classes = {
1956
- root: 'p-inputcolor p-component',
1957
- area: 'p-inputcolor-area',
1958
- areaHandle: ({ instance }) => ['p-inputcolor-area-handle', { 'p-disabled': instance.$disabled() }],
1959
- areaBackground: 'p-inputcolor-area-background',
1960
- slider: 'p-inputcolor-slider',
1961
- sliderHandle: ({ instance }) => ['p-inputcolor-slider-handle', { 'p-disabled': instance.$disabled() }],
1962
- sliderTrack: 'p-inputcolor-slider-track',
1963
- transparencyGrid: 'p-inputcolor-transparency-grid',
1964
- swatch: 'p-inputcolor-swatch',
1965
- swatchBackground: 'p-inputcolor-swatch-background',
1966
- 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"
1967
2361
  };
1968
- class InputColorStyle extends BaseStyle {
1969
- name = 'inputcolor';
1970
- style = style;
1971
- classes = classes;
1972
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.2", ngImport: i0, type: InputColorStyle, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
1973
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.1.2", ngImport: i0, type: InputColorStyle });
1974
- }
1975
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.2", ngImport: i0, type: InputColorStyle, decorators: [{
1976
- type: Injectable
1977
- }] });
1978
- /**
1979
- *
1980
- * InputColor is a composable color picker component.
1981
- *
1982
- * [Live Demo](https://www.primeng.org/inputcolor/)
1983
- *
1984
- * @module inputcolorstyle
1985
- *
1986
- */
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
+ });
1987
2388
  var InputColorClasses;
1988
- (function (InputColorClasses) {
1989
- /**
1990
- * Class name of the root element
1991
- */
1992
- InputColorClasses["root"] = "p-inputcolor";
1993
- /**
1994
- * Class name of the area element
1995
- */
1996
- InputColorClasses["area"] = "p-inputcolor-area";
1997
- /**
1998
- * Class name of the area background element
1999
- */
2000
- InputColorClasses["areaBackground"] = "p-inputcolor-area-background";
2001
- /**
2002
- * Class name of the area handle element
2003
- */
2004
- InputColorClasses["areaHandle"] = "p-inputcolor-area-handle";
2005
- /**
2006
- * Class name of the slider element
2007
- */
2008
- InputColorClasses["slider"] = "p-inputcolor-slider";
2009
- /**
2010
- * Class name of the slider track element
2011
- */
2012
- InputColorClasses["sliderTrack"] = "p-inputcolor-slider-track";
2013
- /**
2014
- * Class name of the slider handle element
2015
- */
2016
- InputColorClasses["sliderHandle"] = "p-inputcolor-slider-handle";
2017
- /**
2018
- * Class name of the swatch element
2019
- */
2020
- InputColorClasses["swatch"] = "p-inputcolor-swatch";
2021
- /**
2022
- * Class name of the swatch background element
2023
- */
2024
- InputColorClasses["swatchBackground"] = "p-inputcolor-swatch-background";
2025
- /**
2026
- * Class name of the transparency grid element
2027
- */
2028
- InputColorClasses["transparencyGrid"] = "p-inputcolor-transparency-grid";
2029
- /**
2030
- * Class name of the input element
2031
- */
2032
- InputColorClasses["input"] = "p-inputcolor-input";
2033
- /**
2034
- * Class name of the eye dropper element
2035
- */
2036
- 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";
2037
2402
  })(InputColorClasses || (InputColorClasses = {}));
2038
-
2039
2403
  const INPUT_COLOR_VALUE_ACCESSOR = {
2040
- provide: NG_VALUE_ACCESSOR,
2041
- useExisting: forwardRef(() => InputColor),
2042
- multi: true
2404
+ provide: NG_VALUE_ACCESSOR,
2405
+ useExisting: forwardRef(() => InputColor),
2406
+ multi: true
2043
2407
  };
2044
- /**
2045
- * InputColor is a composable color picker component.
2046
- * @group Components
2047
- */
2048
- class InputColor extends BaseComponent {
2049
- componentName = 'InputColor';
2050
- bindDirectiveInstance = inject(Bind, { self: true });
2051
- _componentStyle = inject(InputColorStyle);
2052
- /**
2053
- * Color format/space used internally.
2054
- * @group Props
2055
- */
2056
- format = input('hsba', /* @ts-ignore */
2057
- ...(ngDevMode ? [{ debugName: "format" }] : /* istanbul ignore next */ []));
2058
- /**
2059
- * When present, it specifies that the component should be disabled.
2060
- * @group Props
2061
- */
2062
- disabled = input(false, { ...(ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
2063
- _disabled = signal(false, /* @ts-ignore */
2064
- ...(ngDevMode ? [{ debugName: "_disabled" }] : /* istanbul ignore next */ []));
2065
- $disabled = computed(() => this.disabled() || this._disabled(), /* @ts-ignore */
2066
- ...(ngDevMode ? [{ debugName: "$disabled" }] : /* istanbul ignore next */ []));
2067
- /**
2068
- * Callback on value change (during interaction).
2069
- * @group Emits
2070
- */
2071
- onValueChange = output();
2072
- /**
2073
- * Callback when interaction ends (mouseup/touchend/keyup).
2074
- * @group Emits
2075
- */
2076
- onValueChangeEnd = output();
2077
- // Internal color state
2078
- _color = signal(null, /* @ts-ignore */
2079
- ...(ngDevMode ? [{ debugName: "_color" }] : /* istanbul ignore next */ []));
2080
- // Computed color - resolved from internal state or fallback
2081
- $color = computed(() => {
2082
- return this._color() || parseColor('#ff0000').toFormat(this.format());
2083
- }, /* @ts-ignore */
2084
- ...(ngDevMode ? [{ debugName: "$color" }] : /* istanbul ignore next */ []));
2085
- // Computed 2D axes based on format
2086
- $axes = computed(() => getDefault2DAxes(this.format()), /* @ts-ignore */
2087
- ...(ngDevMode ? [{ debugName: "$axes" }] : /* istanbul ignore next */ []));
2088
- onAfterViewChecked() {
2089
- this.bindDirectiveInstance.setAttrs(this.ptms(['host', 'root']));
2090
- }
2091
- /**
2092
- * Update color and emit changes
2093
- */
2094
- updateColor(color, event, isEnd = false) {
2095
- this._color.set(color);
2096
- const outputValue = color.toString(this.format());
2097
- this.onModelChange(outputValue);
2098
- this.onValueChange.emit({ color, originalEvent: event });
2099
- if (isEnd) {
2100
- this.onValueChangeEnd.emit({ color, originalEvent: event });
2101
- this.onModelTouched();
2102
- }
2103
- }
2104
- /**
2105
- * Set a specific channel value
2106
- */
2107
- setChannelValue(channel, value, event, isEnd = false) {
2108
- const color = this.toChannelNativeFormat(this.$color(), channel);
2109
- const newColor = color.setChannelValue(channel, value);
2110
- this.updateColor(newColor, event, isEnd);
2111
- }
2112
- onModelChange = () => { };
2113
- onModelTouched = () => { };
2114
- registerOnChange(fn) {
2115
- this.onModelChange = fn;
2116
- }
2117
- registerOnTouched(fn) {
2118
- this.onModelTouched = fn;
2119
- }
2120
- setDisabledState(val) {
2121
- this._disabled.set(val);
2122
- }
2123
- writeValue(value) {
2124
- if (value) {
2125
- const current = this._color();
2126
- if (current && current.toString(this.format()) === value) {
2127
- return;
2128
- }
2129
- const parsed = parseColor(value);
2130
- if (parsed) {
2131
- this._color.set(parsed.toFormat(this.format()));
2132
- }
2133
- }
2134
- else {
2135
- this._color.set(null);
2136
- }
2137
- }
2138
- toChannelNativeFormat(color, channel) {
2139
- // If the current color natively supports this channel, don't convert
2140
- if (color instanceof HSBColor && (channel === 'hue' || channel === 'saturation' || channel === 'brightness'))
2141
- return color;
2142
- if (color instanceof HSLColor && (channel === 'hue' || channel === 'saturation' || channel === 'lightness'))
2143
- return color;
2144
- if (color instanceof RGBColor && (channel === 'red' || channel === 'green' || channel === 'blue'))
2145
- return color;
2146
- if (color instanceof OKLCHColor && (channel === 'oklchLightness' || channel === 'oklchChroma' || channel === 'oklchHue' || channel === 'L' || channel === 'C' || channel === 'H'))
2147
- return color;
2148
- // Otherwise convert to the appropriate format
2149
- switch (channel) {
2150
- case 'hue':
2151
- case 'saturation':
2152
- case 'brightness':
2153
- return color.toHSB();
2154
- case 'lightness':
2155
- return color.toHSL();
2156
- case 'red':
2157
- case 'green':
2158
- case 'blue':
2159
- return color.toRGB();
2160
- case 'oklchLightness':
2161
- case 'oklchChroma':
2162
- case 'oklchHue':
2163
- case 'L':
2164
- case 'C':
2165
- case 'H':
2166
- return color.toOKLCH();
2167
- case 'alpha':
2168
- default:
2169
- return color;
2170
- }
2171
- }
2172
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.2", ngImport: i0, type: InputColor, deps: null, target: i0.ɵɵFactoryTarget.Component });
2173
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.1.2", 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 });
2174
- }
2175
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.2", ngImport: i0, type: InputColor, decorators: [{
2176
- type: Component,
2177
- args: [{
2178
- selector: 'p-inputcolor, p-input-color',
2179
- standalone: true,
2180
- imports: [SharedModule],
2181
- template: `<ng-content></ng-content>`,
2182
- providers: [INPUT_COLOR_VALUE_ACCESSOR, InputColorStyle, { provide: INPUT_COLOR_INSTANCE, useExisting: InputColor }, { provide: PARENT_INSTANCE, useExisting: InputColor }],
2183
- changeDetection: ChangeDetectionStrategy.OnPush,
2184
- encapsulation: ViewEncapsulation.None,
2185
- host: {
2186
- '[attr.data-pc-name]': "'inputcolor'",
2187
- '[attr.data-pc-section]': "'root'",
2188
- '[class]': "cx('root')"
2189
- },
2190
- hostDirectives: [Bind]
2191
- }]
2192
- }], 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"] }] } });
2193
- class InputColorModule {
2194
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.2", ngImport: i0, type: InputColorModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
2195
- static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "22.1.2", ngImport: i0, type: InputColorModule, imports: [InputColor, InputColorArea,
2196
- InputColorAreaHandle,
2197
- InputColorAreaBackground,
2198
- InputColorSlider,
2199
- InputColorSliderHandle,
2200
- InputColorSliderTrack,
2201
- InputColorSwatch,
2202
- InputColorSwatchBackground,
2203
- InputColorTransparencyGrid,
2204
- InputColorInput,
2205
- InputColorEyeDropper,
2206
- SharedModule], exports: [InputColor, InputColorArea,
2207
- InputColorAreaHandle,
2208
- InputColorAreaBackground,
2209
- InputColorSlider,
2210
- InputColorSliderHandle,
2211
- InputColorSliderTrack,
2212
- InputColorSwatch,
2213
- InputColorSwatchBackground,
2214
- InputColorTransparencyGrid,
2215
- InputColorInput,
2216
- InputColorEyeDropper,
2217
- SharedModule] });
2218
- static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "22.1.2", ngImport: i0, type: InputColorModule, imports: [InputColor,
2219
- SharedModule, SharedModule] });
2220
- }
2221
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.2", ngImport: i0, type: InputColorModule, decorators: [{
2222
- type: NgModule,
2223
- args: [{
2224
- imports: [
2225
- InputColor,
2226
- InputColorArea,
2227
- InputColorAreaHandle,
2228
- InputColorAreaBackground,
2229
- InputColorSlider,
2230
- InputColorSliderHandle,
2231
- InputColorSliderTrack,
2232
- InputColorSwatch,
2233
- InputColorSwatchBackground,
2234
- InputColorTransparencyGrid,
2235
- InputColorInput,
2236
- InputColorEyeDropper,
2237
- SharedModule
2238
- ],
2239
- exports: [
2240
- InputColor,
2241
- InputColorArea,
2242
- InputColorAreaHandle,
2243
- InputColorAreaBackground,
2244
- InputColorSlider,
2245
- InputColorSliderHandle,
2246
- InputColorSliderTrack,
2247
- InputColorSwatch,
2248
- InputColorSwatchBackground,
2249
- InputColorTransparencyGrid,
2250
- InputColorInput,
2251
- InputColorEyeDropper,
2252
- SharedModule
2253
- ]
2254
- }]
2255
- }] });
2256
-
2257
- /**
2258
- * Generated bundle index. Do not edit.
2259
- */
2260
-
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
+ });
2261
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 };
2262
- //# sourceMappingURL=primeng-inputcolor.mjs.map
2712
+
2713
+ //# sourceMappingURL=primeng-inputcolor.mjs.map