primeng 22.1.1 → 22.1.3

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