primeng 22.1.1 → 22.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/fesm2022/primeng-accordion.mjs +998 -594
- package/fesm2022/primeng-accordion.mjs.map +1 -1
- package/fesm2022/primeng-animateonscroll.mjs +266 -174
- package/fesm2022/primeng-animateonscroll.mjs.map +1 -1
- package/fesm2022/primeng-api.mjs +888 -848
- package/fesm2022/primeng-api.mjs.map +1 -1
- package/fesm2022/primeng-autocomplete.mjs +2534 -1631
- package/fesm2022/primeng-autocomplete.mjs.map +1 -1
- package/fesm2022/primeng-autofocus.mjs +114 -77
- package/fesm2022/primeng-autofocus.mjs.map +1 -1
- package/fesm2022/primeng-avatar.mjs +330 -189
- package/fesm2022/primeng-avatar.mjs.map +1 -1
- package/fesm2022/primeng-avatargroup.mjs +178 -95
- package/fesm2022/primeng-avatargroup.mjs.map +1 -1
- package/fesm2022/primeng-badge.mjs +290 -156
- package/fesm2022/primeng-badge.mjs.map +1 -1
- package/fesm2022/primeng-base.mjs +95 -83
- package/fesm2022/primeng-base.mjs.map +1 -1
- package/fesm2022/primeng-basecomponent.mjs +528 -478
- package/fesm2022/primeng-basecomponent.mjs.map +1 -1
- package/fesm2022/primeng-baseeditableholder.mjs +131 -74
- package/fesm2022/primeng-baseeditableholder.mjs.map +1 -1
- package/fesm2022/primeng-baseinput.mjs +214 -99
- package/fesm2022/primeng-baseinput.mjs.map +1 -1
- package/fesm2022/primeng-basemodelholder.mjs +39 -26
- package/fesm2022/primeng-basemodelholder.mjs.map +1 -1
- package/fesm2022/primeng-bind.mjs +156 -97
- package/fesm2022/primeng-bind.mjs.map +1 -1
- package/fesm2022/primeng-blockui.mjs +360 -225
- package/fesm2022/primeng-blockui.mjs.map +1 -1
- package/fesm2022/primeng-breadcrumb.mjs +458 -220
- package/fesm2022/primeng-breadcrumb.mjs.map +1 -1
- package/fesm2022/primeng-button.mjs +1568 -710
- package/fesm2022/primeng-button.mjs.map +1 -1
- package/fesm2022/primeng-buttongroup.mjs +125 -73
- package/fesm2022/primeng-buttongroup.mjs.map +1 -1
- package/fesm2022/primeng-card.mjs +389 -178
- package/fesm2022/primeng-card.mjs.map +1 -1
- package/fesm2022/primeng-carousel.mjs +2393 -1772
- package/fesm2022/primeng-carousel.mjs.map +1 -1
- package/fesm2022/primeng-cascadeselect.mjs +2373 -1399
- package/fesm2022/primeng-cascadeselect.mjs.map +1 -1
- package/fesm2022/primeng-chart.mjs +402 -231
- package/fesm2022/primeng-chart.mjs.map +1 -1
- package/fesm2022/primeng-checkbox.mjs +650 -351
- package/fesm2022/primeng-checkbox.mjs.map +1 -1
- package/fesm2022/primeng-chip.mjs +411 -224
- package/fesm2022/primeng-chip.mjs.map +1 -1
- package/fesm2022/primeng-classnames.mjs +95 -48
- package/fesm2022/primeng-classnames.mjs.map +1 -1
- package/fesm2022/primeng-colorpicker.mjs +890 -635
- package/fesm2022/primeng-colorpicker.mjs.map +1 -1
- package/fesm2022/primeng-commandmenu.mjs +568 -313
- package/fesm2022/primeng-commandmenu.mjs.map +1 -1
- package/fesm2022/primeng-compare.mjs +843 -481
- package/fesm2022/primeng-compare.mjs.map +1 -1
- package/fesm2022/primeng-config.mjs +415 -321
- package/fesm2022/primeng-config.mjs.map +1 -1
- package/fesm2022/primeng-confirmdialog.mjs +1188 -536
- package/fesm2022/primeng-confirmdialog.mjs.map +1 -1
- package/fesm2022/primeng-confirmpopup.mjs +810 -518
- package/fesm2022/primeng-confirmpopup.mjs.map +1 -1
- package/fesm2022/primeng-contextmenu.mjs +1862 -1082
- package/fesm2022/primeng-contextmenu.mjs.map +1 -1
- package/fesm2022/primeng-dataview.mjs +1130 -550
- package/fesm2022/primeng-dataview.mjs.map +1 -1
- package/fesm2022/primeng-datepicker.mjs +3750 -3356
- package/fesm2022/primeng-datepicker.mjs.map +1 -1
- package/fesm2022/primeng-dialog.mjs +1635 -975
- package/fesm2022/primeng-dialog.mjs.map +1 -1
- package/fesm2022/primeng-divider.mjs +272 -146
- package/fesm2022/primeng-divider.mjs.map +1 -1
- package/fesm2022/primeng-dock.mjs +609 -391
- package/fesm2022/primeng-dock.mjs.map +1 -1
- package/fesm2022/primeng-dom.mjs +599 -767
- package/fesm2022/primeng-dom.mjs.map +1 -1
- package/fesm2022/primeng-dragdrop.mjs +323 -312
- package/fesm2022/primeng-dragdrop.mjs.map +1 -1
- package/fesm2022/primeng-drawer.mjs +913 -484
- package/fesm2022/primeng-drawer.mjs.map +1 -1
- package/fesm2022/primeng-dynamicdialog.mjs +828 -917
- package/fesm2022/primeng-dynamicdialog.mjs.map +1 -1
- package/fesm2022/primeng-editor.mjs +547 -391
- package/fesm2022/primeng-editor.mjs.map +1 -1
- package/fesm2022/primeng-fieldset.mjs +559 -271
- package/fesm2022/primeng-fieldset.mjs.map +1 -1
- package/fesm2022/primeng-fileupload.mjs +1836 -1054
- package/fesm2022/primeng-fileupload.mjs.map +1 -1
- package/fesm2022/primeng-floatlabel.mjs +187 -102
- package/fesm2022/primeng-floatlabel.mjs.map +1 -1
- package/fesm2022/primeng-fluid.mjs +156 -85
- package/fesm2022/primeng-fluid.mjs.map +1 -1
- package/fesm2022/primeng-focustrap.mjs +150 -112
- package/fesm2022/primeng-focustrap.mjs.map +1 -1
- package/fesm2022/primeng-galleria.mjs +2589 -1410
- package/fesm2022/primeng-galleria.mjs.map +1 -1
- package/fesm2022/primeng-gallery.mjs +2768 -1796
- package/fesm2022/primeng-gallery.mjs.map +1 -1
- package/fesm2022/primeng-iconfield.mjs +192 -93
- package/fesm2022/primeng-iconfield.mjs.map +1 -1
- package/fesm2022/primeng-icons-angledoubledown.mjs +41 -23
- package/fesm2022/primeng-icons-angledoubledown.mjs.map +1 -1
- package/fesm2022/primeng-icons-angledoubleleft.mjs +41 -23
- package/fesm2022/primeng-icons-angledoubleleft.mjs.map +1 -1
- package/fesm2022/primeng-icons-angledoubleright.mjs +41 -23
- package/fesm2022/primeng-icons-angledoubleright.mjs.map +1 -1
- package/fesm2022/primeng-icons-angledoubleup.mjs +41 -23
- package/fesm2022/primeng-icons-angledoubleup.mjs.map +1 -1
- package/fesm2022/primeng-icons-angledown.mjs +41 -23
- package/fesm2022/primeng-icons-angledown.mjs.map +1 -1
- package/fesm2022/primeng-icons-angleleft.mjs +41 -23
- package/fesm2022/primeng-icons-angleleft.mjs.map +1 -1
- package/fesm2022/primeng-icons-angleright.mjs +41 -23
- package/fesm2022/primeng-icons-angleright.mjs.map +1 -1
- package/fesm2022/primeng-icons-angleup.mjs +41 -23
- package/fesm2022/primeng-icons-angleup.mjs.map +1 -1
- package/fesm2022/primeng-icons-arrowdown.mjs +46 -28
- package/fesm2022/primeng-icons-arrowdown.mjs.map +1 -1
- package/fesm2022/primeng-icons-arrowdownleft.mjs +41 -23
- package/fesm2022/primeng-icons-arrowdownleft.mjs.map +1 -1
- package/fesm2022/primeng-icons-arrowdownright.mjs +41 -23
- package/fesm2022/primeng-icons-arrowdownright.mjs.map +1 -1
- package/fesm2022/primeng-icons-arrowleft.mjs +46 -28
- package/fesm2022/primeng-icons-arrowleft.mjs.map +1 -1
- package/fesm2022/primeng-icons-arrowright.mjs +41 -23
- package/fesm2022/primeng-icons-arrowright.mjs.map +1 -1
- package/fesm2022/primeng-icons-arrowup.mjs +46 -28
- package/fesm2022/primeng-icons-arrowup.mjs.map +1 -1
- package/fesm2022/primeng-icons-ban.mjs +46 -28
- package/fesm2022/primeng-icons-ban.mjs.map +1 -1
- package/fesm2022/primeng-icons-bars.mjs +41 -23
- package/fesm2022/primeng-icons-bars.mjs.map +1 -1
- package/fesm2022/primeng-icons-baseicon.mjs +111 -67
- package/fesm2022/primeng-icons-baseicon.mjs.map +1 -1
- package/fesm2022/primeng-icons-blank.mjs +40 -22
- package/fesm2022/primeng-icons-blank.mjs.map +1 -1
- package/fesm2022/primeng-icons-calendar.mjs +41 -23
- package/fesm2022/primeng-icons-calendar.mjs.map +1 -1
- package/fesm2022/primeng-icons-caretleft.mjs +41 -23
- package/fesm2022/primeng-icons-caretleft.mjs.map +1 -1
- package/fesm2022/primeng-icons-caretright.mjs +41 -23
- package/fesm2022/primeng-icons-caretright.mjs.map +1 -1
- package/fesm2022/primeng-icons-check.mjs +41 -23
- package/fesm2022/primeng-icons-check.mjs.map +1 -1
- package/fesm2022/primeng-icons-chevrondown.mjs +41 -23
- package/fesm2022/primeng-icons-chevrondown.mjs.map +1 -1
- package/fesm2022/primeng-icons-chevronleft.mjs +41 -23
- package/fesm2022/primeng-icons-chevronleft.mjs.map +1 -1
- package/fesm2022/primeng-icons-chevronright.mjs +41 -23
- package/fesm2022/primeng-icons-chevronright.mjs.map +1 -1
- package/fesm2022/primeng-icons-chevronup.mjs +41 -23
- package/fesm2022/primeng-icons-chevronup.mjs.map +1 -1
- package/fesm2022/primeng-icons-exclamationtriangle.mjs +46 -28
- package/fesm2022/primeng-icons-exclamationtriangle.mjs.map +1 -1
- package/fesm2022/primeng-icons-eye.mjs +41 -23
- package/fesm2022/primeng-icons-eye.mjs.map +1 -1
- package/fesm2022/primeng-icons-eyeslash.mjs +46 -28
- package/fesm2022/primeng-icons-eyeslash.mjs.map +1 -1
- package/fesm2022/primeng-icons-filter.mjs +46 -28
- package/fesm2022/primeng-icons-filter.mjs.map +1 -1
- package/fesm2022/primeng-icons-filterfill.mjs +41 -23
- package/fesm2022/primeng-icons-filterfill.mjs.map +1 -1
- package/fesm2022/primeng-icons-filterslash.mjs +46 -28
- package/fesm2022/primeng-icons-filterslash.mjs.map +1 -1
- package/fesm2022/primeng-icons-home.mjs +46 -28
- package/fesm2022/primeng-icons-home.mjs.map +1 -1
- package/fesm2022/primeng-icons-infocircle.mjs +46 -28
- package/fesm2022/primeng-icons-infocircle.mjs.map +1 -1
- package/fesm2022/primeng-icons-minus.mjs +41 -23
- package/fesm2022/primeng-icons-minus.mjs.map +1 -1
- package/fesm2022/primeng-icons-pencil.mjs +46 -28
- package/fesm2022/primeng-icons-pencil.mjs.map +1 -1
- package/fesm2022/primeng-icons-plus.mjs +46 -28
- package/fesm2022/primeng-icons-plus.mjs.map +1 -1
- package/fesm2022/primeng-icons-refresh.mjs +46 -28
- package/fesm2022/primeng-icons-refresh.mjs.map +1 -1
- package/fesm2022/primeng-icons-search.mjs +46 -28
- package/fesm2022/primeng-icons-search.mjs.map +1 -1
- package/fesm2022/primeng-icons-searchminus.mjs +46 -28
- package/fesm2022/primeng-icons-searchminus.mjs.map +1 -1
- package/fesm2022/primeng-icons-searchplus.mjs +46 -28
- package/fesm2022/primeng-icons-searchplus.mjs.map +1 -1
- package/fesm2022/primeng-icons-sortalt.mjs +46 -28
- package/fesm2022/primeng-icons-sortalt.mjs.map +1 -1
- package/fesm2022/primeng-icons-sortamountdown.mjs +46 -28
- package/fesm2022/primeng-icons-sortamountdown.mjs.map +1 -1
- package/fesm2022/primeng-icons-sortamountupalt.mjs +46 -28
- package/fesm2022/primeng-icons-sortamountupalt.mjs.map +1 -1
- package/fesm2022/primeng-icons-spinner.mjs +46 -28
- package/fesm2022/primeng-icons-spinner.mjs.map +1 -1
- package/fesm2022/primeng-icons-star.mjs +46 -28
- package/fesm2022/primeng-icons-star.mjs.map +1 -1
- package/fesm2022/primeng-icons-starfill.mjs +46 -28
- package/fesm2022/primeng-icons-starfill.mjs.map +1 -1
- package/fesm2022/primeng-icons-thlarge.mjs +46 -28
- package/fesm2022/primeng-icons-thlarge.mjs.map +1 -1
- package/fesm2022/primeng-icons-times.mjs +41 -23
- package/fesm2022/primeng-icons-times.mjs.map +1 -1
- package/fesm2022/primeng-icons-timescircle.mjs +46 -28
- package/fesm2022/primeng-icons-timescircle.mjs.map +1 -1
- package/fesm2022/primeng-icons-trash.mjs +46 -28
- package/fesm2022/primeng-icons-trash.mjs.map +1 -1
- package/fesm2022/primeng-icons-undo.mjs +46 -28
- package/fesm2022/primeng-icons-undo.mjs.map +1 -1
- package/fesm2022/primeng-icons-upload.mjs +46 -28
- package/fesm2022/primeng-icons-upload.mjs.map +1 -1
- package/fesm2022/primeng-icons-windowmaximize.mjs +46 -28
- package/fesm2022/primeng-icons-windowmaximize.mjs.map +1 -1
- package/fesm2022/primeng-icons-windowminimize.mjs +46 -28
- package/fesm2022/primeng-icons-windowminimize.mjs.map +1 -1
- package/fesm2022/primeng-icons.mjs +53 -63
- package/fesm2022/primeng-iftalabel.mjs +153 -86
- package/fesm2022/primeng-iftalabel.mjs.map +1 -1
- package/fesm2022/primeng-image.mjs +1006 -532
- package/fesm2022/primeng-image.mjs.map +1 -1
- package/fesm2022/primeng-imagecompare.mjs +325 -165
- package/fesm2022/primeng-imagecompare.mjs.map +1 -1
- package/fesm2022/primeng-inplace.mjs +401 -199
- package/fesm2022/primeng-inplace.mjs.map +1 -1
- package/fesm2022/primeng-inputcolor.mjs +2631 -2189
- package/fesm2022/primeng-inputcolor.mjs.map +1 -1
- package/fesm2022/primeng-inputgroup.mjs +159 -91
- package/fesm2022/primeng-inputgroup.mjs.map +1 -1
- package/fesm2022/primeng-inputgroupaddon.mjs +153 -68
- package/fesm2022/primeng-inputgroupaddon.mjs.map +1 -1
- package/fesm2022/primeng-inputicon.mjs +173 -72
- package/fesm2022/primeng-inputicon.mjs.map +1 -1
- package/fesm2022/primeng-inputmask.mjs +1607 -1387
- package/fesm2022/primeng-inputmask.mjs.map +1 -1
- package/fesm2022/primeng-inputnumber.mjs +1646 -1305
- package/fesm2022/primeng-inputnumber.mjs.map +1 -1
- package/fesm2022/primeng-inputotp.mjs +571 -376
- package/fesm2022/primeng-inputotp.mjs.map +1 -1
- package/fesm2022/primeng-inputpassword.mjs +179 -96
- package/fesm2022/primeng-inputpassword.mjs.map +1 -1
- package/fesm2022/primeng-inputtags.mjs +1212 -588
- package/fesm2022/primeng-inputtags.mjs.map +1 -1
- package/fesm2022/primeng-inputtext.mjs +325 -175
- package/fesm2022/primeng-inputtext.mjs.map +1 -1
- package/fesm2022/primeng-keyfilter.mjs +268 -244
- package/fesm2022/primeng-keyfilter.mjs.map +1 -1
- package/fesm2022/primeng-knob.mjs +627 -405
- package/fesm2022/primeng-knob.mjs.map +1 -1
- package/fesm2022/primeng-label.mjs +143 -81
- package/fesm2022/primeng-label.mjs.map +1 -1
- package/fesm2022/primeng-license.mjs +10 -36
- package/fesm2022/primeng-license.mjs.map +1 -1
- package/fesm2022/primeng-listbox.mjs +2409 -1608
- package/fesm2022/primeng-listbox.mjs.map +1 -1
- package/fesm2022/primeng-megamenu.mjs +2006 -1137
- package/fesm2022/primeng-megamenu.mjs.map +1 -1
- package/fesm2022/primeng-menu.mjs +1437 -848
- package/fesm2022/primeng-menu.mjs.map +1 -1
- package/fesm2022/primeng-menubar.mjs +1832 -994
- package/fesm2022/primeng-menubar.mjs.map +1 -1
- package/fesm2022/primeng-message.mjs +474 -239
- package/fesm2022/primeng-message.mjs.map +1 -1
- package/fesm2022/primeng-metergroup.mjs +663 -331
- package/fesm2022/primeng-metergroup.mjs.map +1 -1
- package/fesm2022/primeng-motion.mjs +1179 -690
- package/fesm2022/primeng-motion.mjs.map +1 -1
- package/fesm2022/primeng-multiselect.mjs +3406 -1932
- package/fesm2022/primeng-multiselect.mjs.map +1 -1
- package/fesm2022/primeng-orderlist.mjs +1308 -664
- package/fesm2022/primeng-orderlist.mjs.map +1 -1
- package/fesm2022/primeng-organizationchart.mjs +912 -595
- package/fesm2022/primeng-organizationchart.mjs.map +1 -1
- package/fesm2022/primeng-overlay.mjs +929 -624
- package/fesm2022/primeng-overlay.mjs.map +1 -1
- package/fesm2022/primeng-overlaybadge.mjs +291 -107
- package/fesm2022/primeng-overlaybadge.mjs.map +1 -1
- package/fesm2022/primeng-paginator.mjs +959 -503
- package/fesm2022/primeng-paginator.mjs.map +1 -1
- package/fesm2022/primeng-panel.mjs +668 -343
- package/fesm2022/primeng-panel.mjs.map +1 -1
- package/fesm2022/primeng-panelmenu.mjs +1842 -998
- package/fesm2022/primeng-panelmenu.mjs.map +1 -1
- package/fesm2022/primeng-passthrough.mjs +8 -16
- package/fesm2022/primeng-passthrough.mjs.map +1 -1
- package/fesm2022/primeng-password.mjs +1518 -866
- package/fesm2022/primeng-password.mjs.map +1 -1
- package/fesm2022/primeng-picklist.mjs +2270 -1256
- package/fesm2022/primeng-picklist.mjs.map +1 -1
- package/fesm2022/primeng-popover.mjs +656 -436
- package/fesm2022/primeng-popover.mjs.map +1 -1
- package/fesm2022/primeng-progressbar.mjs +346 -168
- package/fesm2022/primeng-progressbar.mjs.map +1 -1
- package/fesm2022/primeng-progressspinner.mjs +338 -188
- package/fesm2022/primeng-progressspinner.mjs.map +1 -1
- package/fesm2022/primeng-radiobutton.mjs +499 -292
- package/fesm2022/primeng-radiobutton.mjs.map +1 -1
- package/fesm2022/primeng-rating.mjs +583 -352
- package/fesm2022/primeng-rating.mjs.map +1 -1
- package/fesm2022/primeng-ripple.mjs +194 -184
- package/fesm2022/primeng-ripple.mjs.map +1 -1
- package/fesm2022/primeng-scrollarea.mjs +1018 -721
- package/fesm2022/primeng-scrollarea.mjs.map +1 -1
- package/fesm2022/primeng-scroller.mjs +1386 -1083
- package/fesm2022/primeng-scroller.mjs.map +1 -1
- package/fesm2022/primeng-scrollpanel.mjs +568 -480
- package/fesm2022/primeng-scrollpanel.mjs.map +1 -1
- package/fesm2022/primeng-scrolltop.mjs +509 -260
- package/fesm2022/primeng-scrolltop.mjs.map +1 -1
- package/fesm2022/primeng-select.mjs +2948 -1765
- package/fesm2022/primeng-select.mjs.map +1 -1
- package/fesm2022/primeng-selectbutton.mjs +629 -339
- package/fesm2022/primeng-selectbutton.mjs.map +1 -1
- package/fesm2022/primeng-sidebar.mjs +2561 -1416
- package/fesm2022/primeng-sidebar.mjs.map +1 -1
- package/fesm2022/primeng-skeleton.mjs +300 -157
- package/fesm2022/primeng-skeleton.mjs.map +1 -1
- package/fesm2022/primeng-slider.mjs +841 -604
- package/fesm2022/primeng-slider.mjs.map +1 -1
- package/fesm2022/primeng-speeddial.mjs +1115 -717
- package/fesm2022/primeng-speeddial.mjs.map +1 -1
- package/fesm2022/primeng-splitbutton.mjs +889 -339
- package/fesm2022/primeng-splitbutton.mjs.map +1 -1
- package/fesm2022/primeng-splitter.mjs +997 -759
- package/fesm2022/primeng-splitter.mjs.map +1 -1
- package/fesm2022/primeng-stepper.mjs +1355 -641
- package/fesm2022/primeng-stepper.mjs.map +1 -1
- package/fesm2022/primeng-steps.mjs +397 -304
- package/fesm2022/primeng-steps.mjs.map +1 -1
- package/fesm2022/primeng-styleclass.mjs +446 -334
- package/fesm2022/primeng-styleclass.mjs.map +1 -1
- package/fesm2022/primeng-table.mjs +9763 -5870
- package/fesm2022/primeng-table.mjs.map +1 -1
- package/fesm2022/primeng-tabs.mjs +1357 -831
- package/fesm2022/primeng-tabs.mjs.map +1 -1
- package/fesm2022/primeng-tag.mjs +305 -151
- package/fesm2022/primeng-tag.mjs.map +1 -1
- package/fesm2022/primeng-terminal.mjs +368 -216
- package/fesm2022/primeng-terminal.mjs.map +1 -1
- package/fesm2022/primeng-textarea.mjs +345 -208
- package/fesm2022/primeng-textarea.mjs.map +1 -1
- package/fesm2022/primeng-tieredmenu.mjs +1917 -1125
- package/fesm2022/primeng-tieredmenu.mjs.map +1 -1
- package/fesm2022/primeng-timeline.mjs +304 -165
- package/fesm2022/primeng-timeline.mjs.map +1 -1
- package/fesm2022/primeng-toast.mjs +1369 -922
- package/fesm2022/primeng-toast.mjs.map +1 -1
- package/fesm2022/primeng-togglebutton.mjs +563 -309
- package/fesm2022/primeng-togglebutton.mjs.map +1 -1
- package/fesm2022/primeng-toggleswitch.mjs +464 -237
- package/fesm2022/primeng-toggleswitch.mjs.map +1 -1
- package/fesm2022/primeng-toolbar.mjs +299 -129
- package/fesm2022/primeng-toolbar.mjs.map +1 -1
- package/fesm2022/primeng-tooltip.mjs +1018 -778
- package/fesm2022/primeng-tooltip.mjs.map +1 -1
- package/fesm2022/primeng-tree.mjs +2679 -1875
- package/fesm2022/primeng-tree.mjs.map +1 -1
- package/fesm2022/primeng-treeselect.mjs +1678 -939
- package/fesm2022/primeng-treeselect.mjs.map +1 -1
- package/fesm2022/primeng-treetable.mjs +5849 -3754
- package/fesm2022/primeng-treetable.mjs.map +1 -1
- package/fesm2022/primeng-ts-helpers.mjs +0 -4
- package/fesm2022/primeng-types-accordion.mjs +0 -4
- package/fesm2022/primeng-types-autocomplete.mjs +0 -4
- package/fesm2022/primeng-types-avatar.mjs +0 -4
- package/fesm2022/primeng-types-avatargroup.mjs +0 -4
- package/fesm2022/primeng-types-badge.mjs +0 -4
- package/fesm2022/primeng-types-blockui.mjs +0 -4
- package/fesm2022/primeng-types-breadcrumb.mjs +0 -4
- package/fesm2022/primeng-types-button.mjs +0 -4
- package/fesm2022/primeng-types-card.mjs +0 -4
- package/fesm2022/primeng-types-carousel.mjs +0 -4
- package/fesm2022/primeng-types-cascadeselect.mjs +0 -4
- package/fesm2022/primeng-types-chart.mjs +0 -4
- package/fesm2022/primeng-types-checkbox.mjs +0 -4
- package/fesm2022/primeng-types-chip.mjs +0 -4
- package/fesm2022/primeng-types-colorpicker.mjs +0 -4
- package/fesm2022/primeng-types-commandmenu.mjs +0 -4
- package/fesm2022/primeng-types-compare.mjs +0 -4
- package/fesm2022/primeng-types-confirmdialog.mjs +0 -4
- package/fesm2022/primeng-types-confirmpopup.mjs +0 -4
- package/fesm2022/primeng-types-contextmenu.mjs +0 -4
- package/fesm2022/primeng-types-dataview.mjs +0 -4
- package/fesm2022/primeng-types-datepicker.mjs +0 -4
- package/fesm2022/primeng-types-dialog.mjs +0 -4
- package/fesm2022/primeng-types-divider.mjs +0 -4
- package/fesm2022/primeng-types-dock.mjs +0 -4
- package/fesm2022/primeng-types-drawer.mjs +0 -4
- package/fesm2022/primeng-types-editor.mjs +0 -4
- package/fesm2022/primeng-types-fieldset.mjs +0 -4
- package/fesm2022/primeng-types-fileupload.mjs +0 -4
- package/fesm2022/primeng-types-floatlabel.mjs +0 -4
- package/fesm2022/primeng-types-fluid.mjs +0 -4
- package/fesm2022/primeng-types-galleria.mjs +0 -4
- package/fesm2022/primeng-types-gallery.mjs +0 -4
- package/fesm2022/primeng-types-iconfield.mjs +0 -4
- package/fesm2022/primeng-types-iftalabel.mjs +0 -4
- package/fesm2022/primeng-types-image.mjs +0 -4
- package/fesm2022/primeng-types-imagecompare.mjs +0 -4
- package/fesm2022/primeng-types-inplace.mjs +0 -4
- package/fesm2022/primeng-types-inputcolor.mjs +0 -4
- package/fesm2022/primeng-types-inputgroup.mjs +0 -4
- package/fesm2022/primeng-types-inputgroupaddon.mjs +0 -4
- package/fesm2022/primeng-types-inputicon.mjs +0 -4
- package/fesm2022/primeng-types-inputmask.mjs +0 -4
- package/fesm2022/primeng-types-inputnumber.mjs +0 -4
- package/fesm2022/primeng-types-inputotp.mjs +0 -4
- package/fesm2022/primeng-types-inputpassword.mjs +0 -4
- package/fesm2022/primeng-types-inputtags.mjs +0 -4
- package/fesm2022/primeng-types-inputtext.mjs +0 -4
- package/fesm2022/primeng-types-knob.mjs +0 -4
- package/fesm2022/primeng-types-label.mjs +0 -4
- package/fesm2022/primeng-types-listbox.mjs +0 -4
- package/fesm2022/primeng-types-megamenu.mjs +0 -4
- package/fesm2022/primeng-types-menu.mjs +0 -4
- package/fesm2022/primeng-types-menubar.mjs +0 -4
- package/fesm2022/primeng-types-message.mjs +0 -4
- package/fesm2022/primeng-types-metergroup.mjs +0 -4
- package/fesm2022/primeng-types-motion.mjs +0 -4
- package/fesm2022/primeng-types-multiselect.mjs +0 -4
- package/fesm2022/primeng-types-orderlist.mjs +0 -4
- package/fesm2022/primeng-types-organizationchart.mjs +0 -4
- package/fesm2022/primeng-types-overlay.mjs +0 -4
- package/fesm2022/primeng-types-overlaybadge.mjs +0 -4
- package/fesm2022/primeng-types-paginator.mjs +0 -4
- package/fesm2022/primeng-types-panel.mjs +0 -4
- package/fesm2022/primeng-types-panelmenu.mjs +0 -4
- package/fesm2022/primeng-types-password.mjs +0 -4
- package/fesm2022/primeng-types-picklist.mjs +0 -4
- package/fesm2022/primeng-types-popover.mjs +0 -4
- package/fesm2022/primeng-types-progressbar.mjs +0 -4
- package/fesm2022/primeng-types-progressspinner.mjs +0 -4
- package/fesm2022/primeng-types-radiobutton.mjs +0 -4
- package/fesm2022/primeng-types-rating.mjs +0 -4
- package/fesm2022/primeng-types-scrollarea.mjs +0 -4
- package/fesm2022/primeng-types-scroller.mjs +0 -4
- package/fesm2022/primeng-types-scrollpanel.mjs +0 -4
- package/fesm2022/primeng-types-scrolltop.mjs +0 -4
- package/fesm2022/primeng-types-select.mjs +0 -4
- package/fesm2022/primeng-types-selectbutton.mjs +0 -4
- package/fesm2022/primeng-types-shared.mjs +0 -4
- package/fesm2022/primeng-types-sidebar.mjs +0 -4
- package/fesm2022/primeng-types-skeleton.mjs +0 -4
- package/fesm2022/primeng-types-slider.mjs +0 -4
- package/fesm2022/primeng-types-speeddial.mjs +0 -4
- package/fesm2022/primeng-types-splitbutton.mjs +0 -4
- package/fesm2022/primeng-types-splitter.mjs +0 -4
- package/fesm2022/primeng-types-stepper.mjs +0 -4
- package/fesm2022/primeng-types-table.mjs +0 -4
- package/fesm2022/primeng-types-tabs.mjs +0 -4
- package/fesm2022/primeng-types-tag.mjs +0 -4
- package/fesm2022/primeng-types-terminal.mjs +0 -4
- package/fesm2022/primeng-types-textarea.mjs +0 -4
- package/fesm2022/primeng-types-tieredmenu.mjs +0 -4
- package/fesm2022/primeng-types-timeline.mjs +0 -4
- package/fesm2022/primeng-types-toast.mjs +0 -4
- package/fesm2022/primeng-types-togglebutton.mjs +0 -4
- package/fesm2022/primeng-types-toggleswitch.mjs +0 -4
- package/fesm2022/primeng-types-toolbar.mjs +0 -4
- package/fesm2022/primeng-types-tooltip.mjs +0 -4
- package/fesm2022/primeng-types-tree.mjs +0 -4
- package/fesm2022/primeng-types-treeselect.mjs +0 -4
- package/fesm2022/primeng-types-treetable.mjs +0 -4
- package/fesm2022/primeng-usestyle.mjs +105 -113
- package/fesm2022/primeng-usestyle.mjs.map +1 -1
- package/fesm2022/primeng-utils.mjs +236 -317
- package/fesm2022/primeng-utils.mjs.map +1 -1
- package/fesm2022/primeng.mjs +1 -5
- package/fesm2022/primeng.mjs.map +1 -1
- package/package.json +6 -1
- package/types/primeng-accordion.d.ts +289 -219
- package/types/primeng-animateonscroll.d.ts +89 -61
- package/types/primeng-api.d.ts +1754 -1790
- package/types/primeng-autocomplete.d.ts +1053 -754
- package/types/primeng-autofocus.d.ts +27 -24
- package/types/primeng-avatar.d.ts +152 -114
- package/types/primeng-avatargroup.d.ts +45 -40
- package/types/primeng-badge.d.ts +104 -78
- package/types/primeng-base.d.ts +49 -52
- package/types/primeng-basecomponent.d.ts +191 -174
- package/types/primeng-baseeditableholder.d.ts +63 -45
- package/types/primeng-baseinput.d.ts +122 -74
- package/types/primeng-basemodelholder.d.ts +9 -12
- package/types/primeng-bind.d.ts +36 -32
- package/types/primeng-blockui.d.ts +99 -80
- package/types/primeng-breadcrumb.d.ts +159 -133
- package/types/primeng-button.d.ts +690 -425
- package/types/primeng-buttongroup.d.ts +26 -30
- package/types/primeng-card.d.ts +130 -119
- package/types/primeng-carousel.d.ts +799 -629
- package/types/primeng-cascadeselect.d.ts +753 -562
- package/types/primeng-chart.d.ts +158 -112
- package/types/primeng-checkbox.d.ts +298 -208
- package/types/primeng-chip.d.ts +187 -143
- package/types/primeng-classnames.d.ts +23 -21
- package/types/primeng-colorpicker.d.ts +324 -269
- package/types/primeng-commandmenu.d.ts +213 -165
- package/types/primeng-compare.d.ts +267 -189
- package/types/primeng-config.d.ts +294 -304
- package/types/primeng-confirmdialog.d.ts +504 -325
- package/types/primeng-confirmpopup.d.ts +253 -207
- package/types/primeng-contextmenu.d.ts +522 -366
- package/types/primeng-dataview.d.ts +497 -342
- package/types/primeng-datepicker.d.ts +1268 -969
- package/types/primeng-dialog.d.ts +667 -462
- package/types/primeng-divider.d.ts +112 -96
- package/types/primeng-dock.d.ts +206 -172
- package/types/primeng-dom.d.ts +97 -100
- package/types/primeng-dragdrop.d.ts +142 -107
- package/types/primeng-drawer.d.ts +354 -254
- package/types/primeng-dynamicdialog.d.ts +527 -535
- package/types/primeng-editor.d.ts +210 -162
- package/types/primeng-fieldset.d.ts +198 -163
- package/types/primeng-fileupload.d.ts +726 -523
- package/types/primeng-floatlabel.d.ts +54 -48
- package/types/primeng-fluid.d.ts +36 -36
- package/types/primeng-focustrap.d.ts +30 -27
- package/types/primeng-galleria.d.ts +569 -430
- package/types/primeng-gallery.d.ts +754 -552
- package/types/primeng-iconfield.d.ts +53 -42
- package/types/primeng-icons-angledoubledown.d.ts +6 -9
- package/types/primeng-icons-angledoubleleft.d.ts +6 -9
- package/types/primeng-icons-angledoubleright.d.ts +6 -9
- package/types/primeng-icons-angledoubleup.d.ts +6 -9
- package/types/primeng-icons-angledown.d.ts +6 -9
- package/types/primeng-icons-angleleft.d.ts +6 -9
- package/types/primeng-icons-angleright.d.ts +6 -9
- package/types/primeng-icons-angleup.d.ts +6 -9
- package/types/primeng-icons-arrowdown.d.ts +8 -11
- package/types/primeng-icons-arrowdownleft.d.ts +6 -9
- package/types/primeng-icons-arrowdownright.d.ts +6 -9
- package/types/primeng-icons-arrowleft.d.ts +8 -11
- package/types/primeng-icons-arrowright.d.ts +6 -9
- package/types/primeng-icons-arrowup.d.ts +8 -11
- package/types/primeng-icons-ban.d.ts +8 -11
- package/types/primeng-icons-bars.d.ts +6 -9
- package/types/primeng-icons-baseicon.d.ts +23 -22
- package/types/primeng-icons-blank.d.ts +6 -9
- package/types/primeng-icons-calendar.d.ts +6 -9
- package/types/primeng-icons-caretleft.d.ts +6 -9
- package/types/primeng-icons-caretright.d.ts +6 -9
- package/types/primeng-icons-check.d.ts +6 -9
- package/types/primeng-icons-chevrondown.d.ts +6 -9
- package/types/primeng-icons-chevronleft.d.ts +6 -9
- package/types/primeng-icons-chevronright.d.ts +6 -9
- package/types/primeng-icons-chevronup.d.ts +6 -9
- package/types/primeng-icons-exclamationtriangle.d.ts +8 -11
- package/types/primeng-icons-eye.d.ts +6 -9
- package/types/primeng-icons-eyeslash.d.ts +8 -11
- package/types/primeng-icons-filter.d.ts +8 -11
- package/types/primeng-icons-filterfill.d.ts +6 -9
- package/types/primeng-icons-filterslash.d.ts +8 -11
- package/types/primeng-icons-home.d.ts +8 -11
- package/types/primeng-icons-infocircle.d.ts +8 -11
- package/types/primeng-icons-minus.d.ts +6 -9
- package/types/primeng-icons-pencil.d.ts +8 -11
- package/types/primeng-icons-plus.d.ts +8 -11
- package/types/primeng-icons-refresh.d.ts +8 -11
- package/types/primeng-icons-search.d.ts +8 -11
- package/types/primeng-icons-searchminus.d.ts +8 -11
- package/types/primeng-icons-searchplus.d.ts +8 -11
- package/types/primeng-icons-sortalt.d.ts +8 -11
- package/types/primeng-icons-sortamountdown.d.ts +8 -11
- package/types/primeng-icons-sortamountupalt.d.ts +8 -11
- package/types/primeng-icons-spinner.d.ts +8 -11
- package/types/primeng-icons-star.d.ts +8 -11
- package/types/primeng-icons-starfill.d.ts +8 -11
- package/types/primeng-icons-thlarge.d.ts +8 -11
- package/types/primeng-icons-times.d.ts +6 -9
- package/types/primeng-icons-timescircle.d.ts +8 -11
- package/types/primeng-icons-trash.d.ts +8 -11
- package/types/primeng-icons-undo.d.ts +8 -11
- package/types/primeng-icons-upload.d.ts +8 -11
- package/types/primeng-icons-windowmaximize.d.ts +8 -11
- package/types/primeng-icons-windowminimize.d.ts +8 -11
- package/types/primeng-icons.d.ts +53 -53
- package/types/primeng-iftalabel.d.ts +37 -37
- package/types/primeng-image.d.ts +403 -308
- package/types/primeng-imagecompare.d.ts +93 -77
- package/types/primeng-inplace.d.ts +125 -111
- package/types/primeng-inputcolor.d.ts +646 -507
- package/types/primeng-inputgroup.d.ts +41 -41
- package/types/primeng-inputgroupaddon.d.ts +31 -31
- package/types/primeng-inputicon.d.ts +38 -32
- package/types/primeng-inputmask.d.ts +519 -362
- package/types/primeng-inputnumber.d.ts +572 -405
- package/types/primeng-inputotp.d.ts +205 -156
- package/types/primeng-inputpassword.d.ts +59 -43
- package/types/primeng-inputtags.d.ts +451 -297
- package/types/primeng-inputtext.d.ts +129 -93
- package/types/primeng-keyfilter.d.ts +62 -53
- package/types/primeng-knob.d.ts +256 -183
- package/types/primeng-label.d.ts +36 -36
- package/types/primeng-license.d.ts +1 -3
- package/types/primeng-listbox.d.ts +1040 -786
- package/types/primeng-megamenu.d.ts +535 -383
- package/types/primeng-menu.d.ts +478 -361
- package/types/primeng-menubar.d.ts +495 -354
- package/types/primeng-message.d.ts +191 -148
- package/types/primeng-metergroup.d.ts +249 -187
- package/types/primeng-motion.d.ts +602 -384
- package/types/primeng-multiselect.d.ts +1192 -858
- package/types/primeng-orderlist.d.ts +538 -390
- package/types/primeng-organizationchart.d.ts +235 -192
- package/types/primeng-overlay.d.ts +394 -294
- package/types/primeng-overlaybadge.d.ts +95 -64
- package/types/primeng-paginator.d.ts +409 -309
- package/types/primeng-panel.d.ts +267 -217
- package/types/primeng-panelmenu.d.ts +254 -228
- package/types/primeng-passthrough.d.ts +5 -7
- package/types/primeng-password.d.ts +605 -430
- package/types/primeng-picklist.d.ts +1041 -756
- package/types/primeng-popover.d.ts +235 -176
- package/types/primeng-progressbar.d.ts +130 -99
- package/types/primeng-progressspinner.d.ts +144 -108
- package/types/primeng-radiobutton.d.ts +218 -168
- package/types/primeng-rating.d.ts +239 -189
- package/types/primeng-ripple.d.ts +38 -42
- package/types/primeng-scrollarea.d.ts +290 -239
- package/types/primeng-scroller.d.ts +522 -387
- package/types/primeng-scrollpanel.d.ts +134 -128
- package/types/primeng-scrolltop.d.ts +169 -123
- package/types/primeng-select.d.ts +1013 -738
- package/types/primeng-selectbutton.d.ts +238 -164
- package/types/primeng-sidebar.d.ts +794 -561
- package/types/primeng-skeleton.d.ts +114 -83
- package/types/primeng-slider.d.ts +375 -306
- package/types/primeng-speeddial.d.ts +492 -370
- package/types/primeng-splitbutton.d.ts +381 -240
- package/types/primeng-splitter.d.ts +392 -299
- package/types/primeng-stepper.d.ts +422 -250
- package/types/primeng-steps.d.ts +157 -134
- package/types/primeng-styleclass.d.ts +163 -105
- package/types/primeng-table.d.ts +2898 -1911
- package/types/primeng-tabs.d.ts +467 -301
- package/types/primeng-tag.d.ts +106 -85
- package/types/primeng-terminal.d.ts +131 -117
- package/types/primeng-textarea.d.ts +145 -107
- package/types/primeng-tieredmenu.d.ts +572 -398
- package/types/primeng-timeline.d.ts +125 -109
- package/types/primeng-toast.d.ts +310 -247
- package/types/primeng-togglebutton.d.ts +254 -182
- package/types/primeng-toggleswitch.d.ts +188 -140
- package/types/primeng-toolbar.d.ts +82 -76
- package/types/primeng-tooltip.d.ts +334 -232
- package/types/primeng-tree.d.ts +762 -559
- package/types/primeng-treeselect.d.ts +749 -547
- package/types/primeng-treetable.d.ts +1839 -1313
- package/types/primeng-ts-helpers.d.ts +4 -6
- package/types/primeng-types-accordion.d.ts +58 -62
- package/types/primeng-types-autocomplete.d.ts +230 -233
- package/types/primeng-types-avatar.d.ts +25 -28
- package/types/primeng-types-avatargroup.d.ts +11 -14
- package/types/primeng-types-badge.d.ts +13 -16
- package/types/primeng-types-blockui.d.ts +18 -21
- package/types/primeng-types-breadcrumb.d.ts +65 -68
- package/types/primeng-types-button.d.ts +106 -109
- package/types/primeng-types-card.d.ts +54 -57
- package/types/primeng-types-carousel.d.ts +143 -146
- package/types/primeng-types-cascadeselect.d.ts +186 -192
- package/types/primeng-types-chart.d.ts +34 -39
- package/types/primeng-types-checkbox.d.ts +52 -55
- package/types/primeng-types-chip.d.ts +48 -51
- package/types/primeng-types-colorpicker.d.ts +59 -62
- package/types/primeng-types-commandmenu.d.ts +98 -101
- package/types/primeng-types-compare.d.ts +33 -36
- package/types/primeng-types-confirmdialog.d.ts +124 -127
- package/types/primeng-types-confirmpopup.d.ts +75 -78
- package/types/primeng-types-contextmenu.d.ts +100 -103
- package/types/primeng-types-dataview.d.ts +180 -183
- package/types/primeng-types-datepicker.d.ts +442 -445
- package/types/primeng-types-dialog.d.ts +93 -96
- package/types/primeng-types-divider.d.ts +14 -17
- package/types/primeng-types-dock.d.ts +45 -48
- package/types/primeng-types-drawer.d.ts +62 -65
- package/types/primeng-types-editor.d.ts +143 -146
- package/types/primeng-types-fieldset.d.ts +83 -87
- package/types/primeng-types-fileupload.d.ts +296 -301
- package/types/primeng-types-floatlabel.d.ts +12 -15
- package/types/primeng-types-fluid.d.ts +11 -14
- package/types/primeng-types-galleria.d.ts +209 -212
- package/types/primeng-types-gallery.d.ts +195 -198
- package/types/primeng-types-iconfield.d.ts +12 -15
- package/types/primeng-types-iftalabel.d.ts +11 -14
- package/types/primeng-types-image.d.ts +118 -121
- package/types/primeng-types-imagecompare.d.ts +22 -25
- package/types/primeng-types-inplace.d.ts +46 -49
- package/types/primeng-types-inputcolor.d.ts +86 -89
- package/types/primeng-types-inputgroup.d.ts +11 -14
- package/types/primeng-types-inputgroupaddon.d.ts +11 -14
- package/types/primeng-types-inputicon.d.ts +11 -14
- package/types/primeng-types-inputmask.d.ts +30 -33
- package/types/primeng-types-inputnumber.d.ts +72 -75
- package/types/primeng-types-inputotp.d.ts +67 -70
- package/types/primeng-types-inputpassword.d.ts +7 -10
- package/types/primeng-types-inputtags.d.ts +122 -125
- package/types/primeng-types-inputtext.d.ts +7 -10
- package/types/primeng-types-knob.d.ts +23 -26
- package/types/primeng-types-label.d.ts +7 -10
- package/types/primeng-types-listbox.d.ts +262 -266
- package/types/primeng-types-megamenu.d.ts +135 -138
- package/types/primeng-types-menu.d.ts +98 -101
- package/types/primeng-types-menubar.d.ts +122 -125
- package/types/primeng-types-message.d.ts +69 -72
- package/types/primeng-types-metergroup.d.ts +137 -140
- package/types/primeng-types-motion.d.ts +11 -14
- package/types/primeng-types-multiselect.d.ts +329 -333
- package/types/primeng-types-orderlist.d.ts +126 -129
- package/types/primeng-types-organizationchart.d.ts +147 -153
- package/types/primeng-types-overlay.d.ts +31 -34
- package/types/primeng-types-overlaybadge.d.ts +17 -20
- package/types/primeng-types-paginator.d.ts +131 -134
- package/types/primeng-types-panel.d.ts +91 -95
- package/types/primeng-types-panelmenu.d.ts +150 -153
- package/types/primeng-types-password.d.ts +94 -97
- package/types/primeng-types-picklist.d.ts +250 -260
- package/types/primeng-types-popover.d.ts +33 -36
- package/types/primeng-types-progressbar.d.ts +33 -36
- package/types/primeng-types-progressspinner.d.ts +27 -30
- package/types/primeng-types-radiobutton.d.ts +29 -32
- package/types/primeng-types-rating.d.ts +62 -65
- package/types/primeng-types-scrollarea.d.ts +35 -38
- package/types/primeng-types-scroller.d.ts +142 -146
- package/types/primeng-types-scrollpanel.d.ts +31 -34
- package/types/primeng-types-scrolltop.d.ts +37 -40
- package/types/primeng-types-select.d.ts +251 -254
- package/types/primeng-types-selectbutton.d.ts +56 -59
- package/types/primeng-types-shared.d.ts +6 -9
- package/types/primeng-types-sidebar.d.ts +105 -108
- package/types/primeng-types-skeleton.d.ts +11 -14
- package/types/primeng-types-slider.d.ts +59 -62
- package/types/primeng-types-speeddial.d.ts +71 -74
- package/types/primeng-types-splitbutton.d.ts +35 -38
- package/types/primeng-types-splitter.d.ts +58 -63
- package/types/primeng-types-stepper.d.ts +77 -80
- package/types/primeng-types-table.d.ts +743 -749
- package/types/primeng-types-tabs.d.ts +48 -51
- package/types/primeng-types-tag.d.ts +27 -30
- package/types/primeng-types-terminal.d.ts +43 -46
- package/types/primeng-types-textarea.d.ts +11 -14
- package/types/primeng-types-tieredmenu.d.ts +154 -157
- package/types/primeng-types-timeline.d.ts +60 -63
- package/types/primeng-types-toast.d.ts +92 -95
- package/types/primeng-types-togglebutton.d.ts +52 -55
- package/types/primeng-types-toggleswitch.d.ts +41 -44
- package/types/primeng-types-toolbar.d.ts +34 -37
- package/types/primeng-types-tooltip.d.ts +17 -20
- package/types/primeng-types-tree.d.ts +237 -246
- package/types/primeng-types-treeselect.d.ts +198 -202
- package/types/primeng-types-treetable.d.ts +492 -497
- package/types/primeng-usestyle.d.ts +28 -31
- package/types/primeng-utils.d.ts +37 -40
- package/types/primeng.d.ts +2 -2
- package/fesm2022/primeng-icons.mjs.map +0 -1
- package/fesm2022/primeng-ts-helpers.mjs.map +0 -1
- package/fesm2022/primeng-types-accordion.mjs.map +0 -1
- package/fesm2022/primeng-types-autocomplete.mjs.map +0 -1
- package/fesm2022/primeng-types-avatar.mjs.map +0 -1
- package/fesm2022/primeng-types-avatargroup.mjs.map +0 -1
- package/fesm2022/primeng-types-badge.mjs.map +0 -1
- package/fesm2022/primeng-types-blockui.mjs.map +0 -1
- package/fesm2022/primeng-types-breadcrumb.mjs.map +0 -1
- package/fesm2022/primeng-types-button.mjs.map +0 -1
- package/fesm2022/primeng-types-card.mjs.map +0 -1
- package/fesm2022/primeng-types-carousel.mjs.map +0 -1
- package/fesm2022/primeng-types-cascadeselect.mjs.map +0 -1
- package/fesm2022/primeng-types-chart.mjs.map +0 -1
- package/fesm2022/primeng-types-checkbox.mjs.map +0 -1
- package/fesm2022/primeng-types-chip.mjs.map +0 -1
- package/fesm2022/primeng-types-colorpicker.mjs.map +0 -1
- package/fesm2022/primeng-types-commandmenu.mjs.map +0 -1
- package/fesm2022/primeng-types-compare.mjs.map +0 -1
- package/fesm2022/primeng-types-confirmdialog.mjs.map +0 -1
- package/fesm2022/primeng-types-confirmpopup.mjs.map +0 -1
- package/fesm2022/primeng-types-contextmenu.mjs.map +0 -1
- package/fesm2022/primeng-types-dataview.mjs.map +0 -1
- package/fesm2022/primeng-types-datepicker.mjs.map +0 -1
- package/fesm2022/primeng-types-dialog.mjs.map +0 -1
- package/fesm2022/primeng-types-divider.mjs.map +0 -1
- package/fesm2022/primeng-types-dock.mjs.map +0 -1
- package/fesm2022/primeng-types-drawer.mjs.map +0 -1
- package/fesm2022/primeng-types-editor.mjs.map +0 -1
- package/fesm2022/primeng-types-fieldset.mjs.map +0 -1
- package/fesm2022/primeng-types-fileupload.mjs.map +0 -1
- package/fesm2022/primeng-types-floatlabel.mjs.map +0 -1
- package/fesm2022/primeng-types-fluid.mjs.map +0 -1
- package/fesm2022/primeng-types-galleria.mjs.map +0 -1
- package/fesm2022/primeng-types-gallery.mjs.map +0 -1
- package/fesm2022/primeng-types-iconfield.mjs.map +0 -1
- package/fesm2022/primeng-types-iftalabel.mjs.map +0 -1
- package/fesm2022/primeng-types-image.mjs.map +0 -1
- package/fesm2022/primeng-types-imagecompare.mjs.map +0 -1
- package/fesm2022/primeng-types-inplace.mjs.map +0 -1
- package/fesm2022/primeng-types-inputcolor.mjs.map +0 -1
- package/fesm2022/primeng-types-inputgroup.mjs.map +0 -1
- package/fesm2022/primeng-types-inputgroupaddon.mjs.map +0 -1
- package/fesm2022/primeng-types-inputicon.mjs.map +0 -1
- package/fesm2022/primeng-types-inputmask.mjs.map +0 -1
- package/fesm2022/primeng-types-inputnumber.mjs.map +0 -1
- package/fesm2022/primeng-types-inputotp.mjs.map +0 -1
- package/fesm2022/primeng-types-inputpassword.mjs.map +0 -1
- package/fesm2022/primeng-types-inputtags.mjs.map +0 -1
- package/fesm2022/primeng-types-inputtext.mjs.map +0 -1
- package/fesm2022/primeng-types-knob.mjs.map +0 -1
- package/fesm2022/primeng-types-label.mjs.map +0 -1
- package/fesm2022/primeng-types-listbox.mjs.map +0 -1
- package/fesm2022/primeng-types-megamenu.mjs.map +0 -1
- package/fesm2022/primeng-types-menu.mjs.map +0 -1
- package/fesm2022/primeng-types-menubar.mjs.map +0 -1
- package/fesm2022/primeng-types-message.mjs.map +0 -1
- package/fesm2022/primeng-types-metergroup.mjs.map +0 -1
- package/fesm2022/primeng-types-motion.mjs.map +0 -1
- package/fesm2022/primeng-types-multiselect.mjs.map +0 -1
- package/fesm2022/primeng-types-orderlist.mjs.map +0 -1
- package/fesm2022/primeng-types-organizationchart.mjs.map +0 -1
- package/fesm2022/primeng-types-overlay.mjs.map +0 -1
- package/fesm2022/primeng-types-overlaybadge.mjs.map +0 -1
- package/fesm2022/primeng-types-paginator.mjs.map +0 -1
- package/fesm2022/primeng-types-panel.mjs.map +0 -1
- package/fesm2022/primeng-types-panelmenu.mjs.map +0 -1
- package/fesm2022/primeng-types-password.mjs.map +0 -1
- package/fesm2022/primeng-types-picklist.mjs.map +0 -1
- package/fesm2022/primeng-types-popover.mjs.map +0 -1
- package/fesm2022/primeng-types-progressbar.mjs.map +0 -1
- package/fesm2022/primeng-types-progressspinner.mjs.map +0 -1
- package/fesm2022/primeng-types-radiobutton.mjs.map +0 -1
- package/fesm2022/primeng-types-rating.mjs.map +0 -1
- package/fesm2022/primeng-types-scrollarea.mjs.map +0 -1
- package/fesm2022/primeng-types-scroller.mjs.map +0 -1
- package/fesm2022/primeng-types-scrollpanel.mjs.map +0 -1
- package/fesm2022/primeng-types-scrolltop.mjs.map +0 -1
- package/fesm2022/primeng-types-select.mjs.map +0 -1
- package/fesm2022/primeng-types-selectbutton.mjs.map +0 -1
- package/fesm2022/primeng-types-shared.mjs.map +0 -1
- package/fesm2022/primeng-types-sidebar.mjs.map +0 -1
- package/fesm2022/primeng-types-skeleton.mjs.map +0 -1
- package/fesm2022/primeng-types-slider.mjs.map +0 -1
- package/fesm2022/primeng-types-speeddial.mjs.map +0 -1
- package/fesm2022/primeng-types-splitbutton.mjs.map +0 -1
- package/fesm2022/primeng-types-splitter.mjs.map +0 -1
- package/fesm2022/primeng-types-stepper.mjs.map +0 -1
- package/fesm2022/primeng-types-table.mjs.map +0 -1
- package/fesm2022/primeng-types-tabs.mjs.map +0 -1
- package/fesm2022/primeng-types-tag.mjs.map +0 -1
- package/fesm2022/primeng-types-terminal.mjs.map +0 -1
- package/fesm2022/primeng-types-textarea.mjs.map +0 -1
- package/fesm2022/primeng-types-tieredmenu.mjs.map +0 -1
- package/fesm2022/primeng-types-timeline.mjs.map +0 -1
- package/fesm2022/primeng-types-toast.mjs.map +0 -1
- package/fesm2022/primeng-types-togglebutton.mjs.map +0 -1
- package/fesm2022/primeng-types-toggleswitch.mjs.map +0 -1
- package/fesm2022/primeng-types-toolbar.mjs.map +0 -1
- package/fesm2022/primeng-types-tooltip.mjs.map +0 -1
- package/fesm2022/primeng-types-tree.mjs.map +0 -1
- package/fesm2022/primeng-types-treeselect.mjs.map +0 -1
- package/fesm2022/primeng-types-treetable.mjs.map +0 -1
|
@@ -1,1418 +1,1428 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
|
|
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
|
-
|
|
16
|
+
return Math.min(Math.max(value, min), max);
|
|
18
17
|
}
|
|
19
18
|
function round(value, decimals = 0) {
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
const factor = Math.pow(10, decimals);
|
|
20
|
+
return Math.round(value * factor) / factor;
|
|
22
21
|
}
|
|
23
22
|
function multiplyMatrices(matrix, vector) {
|
|
24
|
-
|
|
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
|
-
|
|
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
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
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
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
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
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
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
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
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 =
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
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
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
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
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
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
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
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
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
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 =
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
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
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
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
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
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
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
965
|
+
const INPUT_COLOR_INSTANCE = new InjectionToken("INPUT_COLOR_INSTANCE");
|
|
966
|
+
const INPUT_COLOR_SLIDER_INSTANCE = new InjectionToken("INPUT_COLOR_SLIDER_INSTANCE");
|
|
967
|
+
var InputColorArea = class InputColorArea extends BaseComponent {
|
|
968
|
+
componentName = "InputColorArea";
|
|
969
|
+
bindDirectiveInstance = inject(Bind, { self: true });
|
|
970
|
+
$pc = inject(INPUT_COLOR_INSTANCE);
|
|
971
|
+
$xChannel = computed(() => this.$pc.$axes().xChannel, ...ngDevMode ? [{ debugName: "$xChannel" }] : /* istanbul ignore next */ []);
|
|
972
|
+
$yChannel = computed(() => this.$pc.$axes().yChannel, ...ngDevMode ? [{ debugName: "$yChannel" }] : /* istanbul ignore next */ []);
|
|
973
|
+
$areaGradient = computed(() => {
|
|
974
|
+
return getAreaGradient(this.$pc.$color(), this.$xChannel(), this.$yChannel(), this.$pc.format());
|
|
975
|
+
}, ...ngDevMode ? [{ debugName: "$areaGradient" }] : /* istanbul ignore next */ []);
|
|
976
|
+
$handleBackground = computed(() => this.$pc.$color().setChannelValue("alpha", 1).toRgbString(), ...ngDevMode ? [{ debugName: "$handleBackground" }] : /* istanbul ignore next */ []);
|
|
977
|
+
$handleLeft = computed(() => {
|
|
978
|
+
const xCh = this.$xChannel();
|
|
979
|
+
const range = getChannelRange(xCh);
|
|
980
|
+
return `${(this.$pc.$color().getChannelValue(xCh) - range.minValue) / (range.maxValue - range.minValue) * 100}%`;
|
|
981
|
+
}, ...ngDevMode ? [{ debugName: "$handleLeft" }] : /* istanbul ignore next */ []);
|
|
982
|
+
$handleTop = computed(() => {
|
|
983
|
+
const yCh = this.$yChannel();
|
|
984
|
+
const range = getChannelRange(yCh);
|
|
985
|
+
return `${(1 - (this.$pc.$color().getChannelValue(yCh) - range.minValue) / (range.maxValue - range.minValue)) * 100}%`;
|
|
986
|
+
}, ...ngDevMode ? [{ debugName: "$handleTop" }] : /* istanbul ignore next */ []);
|
|
987
|
+
dragging = false;
|
|
988
|
+
dragOffset = {
|
|
989
|
+
x: 0,
|
|
990
|
+
y: 0
|
|
991
|
+
};
|
|
992
|
+
cleanupDrag = null;
|
|
993
|
+
onAfterViewChecked() {
|
|
994
|
+
this.bindDirectiveInstance.setAttrs(this.ptms(["host", "root"]));
|
|
995
|
+
}
|
|
996
|
+
onPointerDown(event) {
|
|
997
|
+
if (this.$pc.$disabled()) return;
|
|
998
|
+
event.preventDefault();
|
|
999
|
+
this.dragging = true;
|
|
1000
|
+
const el = this.el.nativeElement;
|
|
1001
|
+
el.setPointerCapture(event.pointerId);
|
|
1002
|
+
const handle = event.target?.closest("[data-pc-section=\"areahandle\"], .p-inputcolor-area-handle");
|
|
1003
|
+
if (handle) {
|
|
1004
|
+
const handleRect = handle.getBoundingClientRect();
|
|
1005
|
+
this.dragOffset = {
|
|
1006
|
+
x: event.clientX - (handleRect.left + handleRect.width / 2),
|
|
1007
|
+
y: event.clientY - (handleRect.top + handleRect.height / 2)
|
|
1008
|
+
};
|
|
1009
|
+
} else this.dragOffset = {
|
|
1010
|
+
x: 0,
|
|
1011
|
+
y: 0
|
|
1012
|
+
};
|
|
1013
|
+
this.updateFromPointer(event);
|
|
1014
|
+
const onMove = (e) => {
|
|
1015
|
+
if (!this.dragging) return;
|
|
1016
|
+
e.preventDefault();
|
|
1017
|
+
this.updateFromPointer(e);
|
|
1018
|
+
};
|
|
1019
|
+
const cleanup = () => {
|
|
1020
|
+
this.dragging = false;
|
|
1021
|
+
this.cleanupDrag = null;
|
|
1022
|
+
el.removeEventListener("pointermove", onMove);
|
|
1023
|
+
el.removeEventListener("pointerup", onUp);
|
|
1024
|
+
el.removeEventListener("pointercancel", onCancel);
|
|
1025
|
+
el.removeEventListener("lostpointercapture", onLostCapture);
|
|
1026
|
+
};
|
|
1027
|
+
this.cleanupDrag = cleanup;
|
|
1028
|
+
const onUp = (e) => {
|
|
1029
|
+
if (!this.dragging) return;
|
|
1030
|
+
this.updateFromPointer(e, true);
|
|
1031
|
+
this.dragOffset = {
|
|
1032
|
+
x: 0,
|
|
1033
|
+
y: 0
|
|
1034
|
+
};
|
|
1035
|
+
cleanup();
|
|
1036
|
+
};
|
|
1037
|
+
const onCancel = () => {
|
|
1038
|
+
cleanup();
|
|
1039
|
+
};
|
|
1040
|
+
const onLostCapture = () => {
|
|
1041
|
+
cleanup();
|
|
1042
|
+
};
|
|
1043
|
+
el.addEventListener("pointermove", onMove);
|
|
1044
|
+
el.addEventListener("pointerup", onUp);
|
|
1045
|
+
el.addEventListener("pointercancel", onCancel);
|
|
1046
|
+
el.addEventListener("lostpointercapture", onLostCapture);
|
|
1047
|
+
}
|
|
1048
|
+
ngOnDestroy() {
|
|
1049
|
+
this.cleanupDrag?.();
|
|
1050
|
+
}
|
|
1051
|
+
updateFromPointer(event, isEnd = false) {
|
|
1052
|
+
const rect = this.el.nativeElement.getBoundingClientRect();
|
|
1053
|
+
const xPercent = Math.max(0, Math.min(1, (event.clientX - this.dragOffset.x - rect.left) / rect.width));
|
|
1054
|
+
const yPercent = Math.max(0, Math.min(1, (event.clientY - this.dragOffset.y - rect.top) / rect.height));
|
|
1055
|
+
const xCh = this.$xChannel();
|
|
1056
|
+
const yCh = this.$yChannel();
|
|
1057
|
+
const xRange = getChannelRange(xCh);
|
|
1058
|
+
const yRange = getChannelRange(yCh);
|
|
1059
|
+
const xValue = snapValue(xRange.minValue + xPercent * (xRange.maxValue - xRange.minValue), xRange.minValue, xRange.maxValue, xRange.step);
|
|
1060
|
+
const yValue = snapValue(yRange.maxValue - yPercent * (yRange.maxValue - yRange.minValue), yRange.minValue, yRange.maxValue, yRange.step);
|
|
1061
|
+
let color = this.$pc.toChannelNativeFormat(this.$pc.$color(), xCh).setChannelValue(xCh, xValue);
|
|
1062
|
+
color = color.setChannelValue(yCh, yValue);
|
|
1063
|
+
this.$pc.updateColor(color, event, isEnd);
|
|
1064
|
+
}
|
|
1065
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
1066
|
+
minVersion: "12.0.0",
|
|
1067
|
+
version: "22.2.0",
|
|
1068
|
+
ngImport: i0,
|
|
1069
|
+
type: InputColorArea,
|
|
1070
|
+
deps: null,
|
|
1071
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
1072
|
+
});
|
|
1073
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
1074
|
+
minVersion: "14.0.0",
|
|
1075
|
+
version: "22.2.0",
|
|
1076
|
+
type: InputColorArea,
|
|
1077
|
+
isStandalone: true,
|
|
1078
|
+
selector: "p-inputcolor-area",
|
|
1079
|
+
host: {
|
|
1080
|
+
listeners: { "pointerdown": "onPointerDown($event)" },
|
|
1081
|
+
properties: {
|
|
1082
|
+
"class": "$pc.cx(\"area\")",
|
|
1083
|
+
"style.--px-area-gradient": "$areaGradient()",
|
|
1084
|
+
"style.--px-handle-background": "$handleBackground()",
|
|
1085
|
+
"style.--px-handle-position-left": "$handleLeft()",
|
|
1086
|
+
"style.--px-handle-position-top": "$handleTop()"
|
|
1087
|
+
}
|
|
1088
|
+
},
|
|
1089
|
+
providers: [{
|
|
1090
|
+
provide: PARENT_INSTANCE,
|
|
1091
|
+
useExisting: InputColorArea
|
|
1092
|
+
}],
|
|
1093
|
+
usesInheritance: true,
|
|
1094
|
+
hostDirectives: [{ directive: i1$1.Bind }],
|
|
1095
|
+
ngImport: i0,
|
|
1096
|
+
template: `<ng-content></ng-content>`,
|
|
1097
|
+
isInline: true,
|
|
1098
|
+
changeDetection: i0.ChangeDetectionStrategy.OnPush,
|
|
1099
|
+
encapsulation: i0.ViewEncapsulation.None
|
|
1100
|
+
});
|
|
1101
|
+
};
|
|
1102
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
1103
|
+
minVersion: "12.0.0",
|
|
1104
|
+
version: "22.2.0",
|
|
1105
|
+
ngImport: i0,
|
|
1106
|
+
type: InputColorArea,
|
|
1107
|
+
decorators: [{
|
|
1108
|
+
type: Component,
|
|
1109
|
+
args: [{
|
|
1110
|
+
selector: "p-inputcolor-area",
|
|
1111
|
+
standalone: true,
|
|
1112
|
+
template: `<ng-content></ng-content>`,
|
|
1113
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
1114
|
+
encapsulation: ViewEncapsulation.None,
|
|
1115
|
+
host: {
|
|
1116
|
+
"[class]": "$pc.cx(\"area\")",
|
|
1117
|
+
"[style.--px-area-gradient]": "$areaGradient()",
|
|
1118
|
+
"[style.--px-handle-background]": "$handleBackground()",
|
|
1119
|
+
"[style.--px-handle-position-left]": "$handleLeft()",
|
|
1120
|
+
"[style.--px-handle-position-top]": "$handleTop()",
|
|
1121
|
+
"(pointerdown)": "onPointerDown($event)"
|
|
1122
|
+
},
|
|
1123
|
+
providers: [{
|
|
1124
|
+
provide: PARENT_INSTANCE,
|
|
1125
|
+
useExisting: InputColorArea
|
|
1126
|
+
}],
|
|
1127
|
+
hostDirectives: [Bind]
|
|
1128
|
+
}]
|
|
1129
|
+
}]
|
|
1130
|
+
});
|
|
1131
|
+
var InputColorAreaBackground = class InputColorAreaBackground extends BaseComponent {
|
|
1132
|
+
componentName = "InputColorAreaBackground";
|
|
1133
|
+
bindDirectiveInstance = inject(Bind, { self: true });
|
|
1134
|
+
$pc = inject(INPUT_COLOR_INSTANCE);
|
|
1135
|
+
onAfterViewChecked() {
|
|
1136
|
+
this.bindDirectiveInstance.setAttrs(this.ptms(["host", "root"]));
|
|
1137
|
+
}
|
|
1138
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
1139
|
+
minVersion: "12.0.0",
|
|
1140
|
+
version: "22.2.0",
|
|
1141
|
+
ngImport: i0,
|
|
1142
|
+
type: InputColorAreaBackground,
|
|
1143
|
+
deps: null,
|
|
1144
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
1145
|
+
});
|
|
1146
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
1147
|
+
minVersion: "14.0.0",
|
|
1148
|
+
version: "22.2.0",
|
|
1149
|
+
type: InputColorAreaBackground,
|
|
1150
|
+
isStandalone: true,
|
|
1151
|
+
selector: "p-inputcolor-area-background",
|
|
1152
|
+
host: { properties: { "class": "$pc.cx(\"areaBackground\")" } },
|
|
1153
|
+
providers: [{
|
|
1154
|
+
provide: PARENT_INSTANCE,
|
|
1155
|
+
useExisting: InputColorAreaBackground
|
|
1156
|
+
}],
|
|
1157
|
+
usesInheritance: true,
|
|
1158
|
+
hostDirectives: [{ directive: i1$1.Bind }],
|
|
1159
|
+
ngImport: i0,
|
|
1160
|
+
template: `<ng-content></ng-content>`,
|
|
1161
|
+
isInline: true,
|
|
1162
|
+
changeDetection: i0.ChangeDetectionStrategy.OnPush,
|
|
1163
|
+
encapsulation: i0.ViewEncapsulation.None
|
|
1164
|
+
});
|
|
1165
|
+
};
|
|
1166
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
1167
|
+
minVersion: "12.0.0",
|
|
1168
|
+
version: "22.2.0",
|
|
1169
|
+
ngImport: i0,
|
|
1170
|
+
type: InputColorAreaBackground,
|
|
1171
|
+
decorators: [{
|
|
1172
|
+
type: Component,
|
|
1173
|
+
args: [{
|
|
1174
|
+
selector: "p-inputcolor-area-background",
|
|
1175
|
+
standalone: true,
|
|
1176
|
+
template: `<ng-content></ng-content>`,
|
|
1177
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
1178
|
+
encapsulation: ViewEncapsulation.None,
|
|
1179
|
+
host: { "[class]": "$pc.cx(\"areaBackground\")" },
|
|
1180
|
+
providers: [{
|
|
1181
|
+
provide: PARENT_INSTANCE,
|
|
1182
|
+
useExisting: InputColorAreaBackground
|
|
1183
|
+
}],
|
|
1184
|
+
hostDirectives: [Bind]
|
|
1185
|
+
}]
|
|
1186
|
+
}]
|
|
1187
|
+
});
|
|
1188
|
+
var InputColorAreaHandle = class InputColorAreaHandle extends BaseComponent {
|
|
1189
|
+
componentName = "InputColorAreaHandle";
|
|
1190
|
+
bindDirectiveInstance = inject(Bind, { self: true });
|
|
1191
|
+
$pc = inject(INPUT_COLOR_INSTANCE);
|
|
1192
|
+
$xChannel = computed(() => this.$pc.$axes().xChannel, ...ngDevMode ? [{ debugName: "$xChannel" }] : /* istanbul ignore next */ []);
|
|
1193
|
+
$yChannel = computed(() => this.$pc.$axes().yChannel, ...ngDevMode ? [{ debugName: "$yChannel" }] : /* istanbul ignore next */ []);
|
|
1194
|
+
$xRange = computed(() => getChannelRange(this.$xChannel()), ...ngDevMode ? [{ debugName: "$xRange" }] : /* istanbul ignore next */ []);
|
|
1195
|
+
$yRange = computed(() => getChannelRange(this.$yChannel()), ...ngDevMode ? [{ debugName: "$yRange" }] : /* istanbul ignore next */ []);
|
|
1196
|
+
$xValue = computed(() => this.$pc.$color().getChannelValue(this.$xChannel()), ...ngDevMode ? [{ debugName: "$xValue" }] : /* istanbul ignore next */ []);
|
|
1197
|
+
$yValue = computed(() => this.$pc.$color().getChannelValue(this.$yChannel()), ...ngDevMode ? [{ debugName: "$yValue" }] : /* istanbul ignore next */ []);
|
|
1198
|
+
$xMin = computed(() => this.$xRange().minValue, ...ngDevMode ? [{ debugName: "$xMin" }] : /* istanbul ignore next */ []);
|
|
1199
|
+
$xMax = computed(() => this.$xRange().maxValue, ...ngDevMode ? [{ debugName: "$xMax" }] : /* istanbul ignore next */ []);
|
|
1200
|
+
$tabindex = computed(() => this.$pc.$disabled() ? -1 : 0, ...ngDevMode ? [{ debugName: "$tabindex" }] : /* istanbul ignore next */ []);
|
|
1201
|
+
$ariaDisabled = computed(() => this.$pc.$disabled() || void 0, ...ngDevMode ? [{ debugName: "$ariaDisabled" }] : /* istanbul ignore next */ []);
|
|
1202
|
+
$ariaValueText = computed(() => {
|
|
1203
|
+
const xCh = this.$xChannel();
|
|
1204
|
+
const yCh = this.$yChannel();
|
|
1205
|
+
return `${xCh} ${this.$xValue()}, ${yCh} ${this.$yValue()}`;
|
|
1206
|
+
}, ...ngDevMode ? [{ debugName: "$ariaValueText" }] : /* istanbul ignore next */ []);
|
|
1207
|
+
onAfterViewChecked() {
|
|
1208
|
+
this.bindDirectiveInstance.setAttrs(this.ptms(["host", "root"]));
|
|
1209
|
+
}
|
|
1210
|
+
onKeyDown(event) {
|
|
1211
|
+
if (this.$pc.$disabled()) return;
|
|
1212
|
+
const xCh = this.$xChannel();
|
|
1213
|
+
const yCh = this.$yChannel();
|
|
1214
|
+
const xRange = this.$xRange();
|
|
1215
|
+
const yRange = this.$yRange();
|
|
1216
|
+
let xVal = this.$xValue();
|
|
1217
|
+
let yVal = this.$yValue();
|
|
1218
|
+
let handled = false;
|
|
1219
|
+
switch (event.key) {
|
|
1220
|
+
case "ArrowRight":
|
|
1221
|
+
xVal = Math.min(xVal + xRange.step, xRange.maxValue);
|
|
1222
|
+
handled = true;
|
|
1223
|
+
break;
|
|
1224
|
+
case "ArrowLeft":
|
|
1225
|
+
xVal = Math.max(xVal - xRange.step, xRange.minValue);
|
|
1226
|
+
handled = true;
|
|
1227
|
+
break;
|
|
1228
|
+
case "ArrowUp":
|
|
1229
|
+
yVal = Math.min(yVal + yRange.step, yRange.maxValue);
|
|
1230
|
+
handled = true;
|
|
1231
|
+
break;
|
|
1232
|
+
case "ArrowDown":
|
|
1233
|
+
yVal = Math.max(yVal - yRange.step, yRange.minValue);
|
|
1234
|
+
handled = true;
|
|
1235
|
+
break;
|
|
1236
|
+
case "PageUp":
|
|
1237
|
+
yVal = Math.min(yVal + yRange.pageStep, yRange.maxValue);
|
|
1238
|
+
handled = true;
|
|
1239
|
+
break;
|
|
1240
|
+
case "PageDown":
|
|
1241
|
+
yVal = Math.max(yVal - yRange.pageStep, yRange.minValue);
|
|
1242
|
+
handled = true;
|
|
1243
|
+
break;
|
|
1244
|
+
case "Home":
|
|
1245
|
+
xVal = xRange.minValue;
|
|
1246
|
+
handled = true;
|
|
1247
|
+
break;
|
|
1248
|
+
case "End":
|
|
1249
|
+
xVal = xRange.maxValue;
|
|
1250
|
+
handled = true;
|
|
1251
|
+
}
|
|
1252
|
+
if (handled) {
|
|
1253
|
+
event.preventDefault();
|
|
1254
|
+
let color = this.$pc.toChannelNativeFormat(this.$pc.$color(), xCh).setChannelValue(xCh, xVal);
|
|
1255
|
+
color = color.setChannelValue(yCh, yVal);
|
|
1256
|
+
this.$pc.updateColor(color, event, true);
|
|
1257
|
+
}
|
|
1258
|
+
}
|
|
1259
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
1260
|
+
minVersion: "12.0.0",
|
|
1261
|
+
version: "22.2.0",
|
|
1262
|
+
ngImport: i0,
|
|
1263
|
+
type: InputColorAreaHandle,
|
|
1264
|
+
deps: null,
|
|
1265
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
1266
|
+
});
|
|
1267
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
1268
|
+
minVersion: "14.0.0",
|
|
1269
|
+
version: "22.2.0",
|
|
1270
|
+
type: InputColorAreaHandle,
|
|
1271
|
+
isStandalone: true,
|
|
1272
|
+
selector: "p-inputcolor-area-handle",
|
|
1273
|
+
host: {
|
|
1274
|
+
listeners: { "keydown": "onKeyDown($event)" },
|
|
1275
|
+
properties: {
|
|
1276
|
+
"class": "$pc.cx(\"areaHandle\")",
|
|
1277
|
+
"attr.role": "'slider'",
|
|
1278
|
+
"attr.tabindex": "$tabindex()",
|
|
1279
|
+
"attr.aria-label": "'Color'",
|
|
1280
|
+
"attr.aria-roledescription": "'2d slider'",
|
|
1281
|
+
"attr.aria-disabled": "$ariaDisabled()",
|
|
1282
|
+
"attr.aria-valuemin": "$xMin()",
|
|
1283
|
+
"attr.aria-valuemax": "$xMax()",
|
|
1284
|
+
"attr.aria-valuenow": "$xValue()",
|
|
1285
|
+
"attr.aria-valuetext": "$ariaValueText()"
|
|
1286
|
+
}
|
|
1287
|
+
},
|
|
1288
|
+
providers: [{
|
|
1289
|
+
provide: PARENT_INSTANCE,
|
|
1290
|
+
useExisting: InputColorAreaHandle
|
|
1291
|
+
}],
|
|
1292
|
+
usesInheritance: true,
|
|
1293
|
+
hostDirectives: [{ directive: i1$1.Bind }],
|
|
1294
|
+
ngImport: i0,
|
|
1295
|
+
template: `<ng-content></ng-content>`,
|
|
1296
|
+
isInline: true,
|
|
1297
|
+
changeDetection: i0.ChangeDetectionStrategy.OnPush,
|
|
1298
|
+
encapsulation: i0.ViewEncapsulation.None
|
|
1299
|
+
});
|
|
1300
|
+
};
|
|
1301
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
1302
|
+
minVersion: "12.0.0",
|
|
1303
|
+
version: "22.2.0",
|
|
1304
|
+
ngImport: i0,
|
|
1305
|
+
type: InputColorAreaHandle,
|
|
1306
|
+
decorators: [{
|
|
1307
|
+
type: Component,
|
|
1308
|
+
args: [{
|
|
1309
|
+
selector: "p-inputcolor-area-handle",
|
|
1310
|
+
standalone: true,
|
|
1311
|
+
template: `<ng-content></ng-content>`,
|
|
1312
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
1313
|
+
encapsulation: ViewEncapsulation.None,
|
|
1314
|
+
host: {
|
|
1315
|
+
"[class]": "$pc.cx(\"areaHandle\")",
|
|
1316
|
+
"[attr.role]": "'slider'",
|
|
1317
|
+
"[attr.tabindex]": "$tabindex()",
|
|
1318
|
+
"[attr.aria-label]": "'Color'",
|
|
1319
|
+
"[attr.aria-roledescription]": "'2d slider'",
|
|
1320
|
+
"[attr.aria-disabled]": "$ariaDisabled()",
|
|
1321
|
+
"[attr.aria-valuemin]": "$xMin()",
|
|
1322
|
+
"[attr.aria-valuemax]": "$xMax()",
|
|
1323
|
+
"[attr.aria-valuenow]": "$xValue()",
|
|
1324
|
+
"[attr.aria-valuetext]": "$ariaValueText()",
|
|
1325
|
+
"(keydown)": "onKeyDown($event)"
|
|
1326
|
+
},
|
|
1327
|
+
providers: [{
|
|
1328
|
+
provide: PARENT_INSTANCE,
|
|
1329
|
+
useExisting: InputColorAreaHandle
|
|
1330
|
+
}],
|
|
1331
|
+
hostDirectives: [Bind]
|
|
1332
|
+
}]
|
|
1333
|
+
}]
|
|
1334
|
+
});
|
|
1335
|
+
var InputColorEyeDropper = class InputColorEyeDropper extends BaseComponent {
|
|
1336
|
+
componentName = "InputColorEyeDropper";
|
|
1337
|
+
bindDirectiveInstance = inject(Bind, { self: true });
|
|
1338
|
+
$pc = inject(INPUT_COLOR_INSTANCE);
|
|
1339
|
+
text = input(false, ...ngDevMode ? [{ debugName: "text" }] : /* istanbul ignore next */ []);
|
|
1340
|
+
rounded = input(false, ...ngDevMode ? [{ debugName: "rounded" }] : /* istanbul ignore next */ []);
|
|
1341
|
+
outlined = input(false, ...ngDevMode ? [{ debugName: "outlined" }] : /* istanbul ignore next */ []);
|
|
1342
|
+
iconOnly = input(false, ...ngDevMode ? [{ debugName: "iconOnly" }] : /* istanbul ignore next */ []);
|
|
1343
|
+
severity = input(void 0, ...ngDevMode ? [{ debugName: "severity" }] : /* istanbul ignore next */ []);
|
|
1344
|
+
size = input(void 0, ...ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []);
|
|
1345
|
+
onAfterViewChecked() {
|
|
1346
|
+
this.bindDirectiveInstance.setAttrs(this.ptms(["host", "root"]));
|
|
1347
|
+
}
|
|
1348
|
+
async onPickColor(event) {
|
|
1349
|
+
if (this.$pc.$disabled()) return;
|
|
1350
|
+
if (!isPlatformBrowser(this.platformId)) return;
|
|
1351
|
+
try {
|
|
1352
|
+
const result = await new window.EyeDropper().open();
|
|
1353
|
+
if (result?.sRGBHex) {
|
|
1354
|
+
const parsed = parseColor(result.sRGBHex);
|
|
1355
|
+
if (parsed) this.$pc.updateColor(parsed, event, true);
|
|
1356
|
+
}
|
|
1357
|
+
} catch {}
|
|
1358
|
+
}
|
|
1359
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
1360
|
+
minVersion: "12.0.0",
|
|
1361
|
+
version: "22.2.0",
|
|
1362
|
+
ngImport: i0,
|
|
1363
|
+
type: InputColorEyeDropper,
|
|
1364
|
+
deps: null,
|
|
1365
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
1366
|
+
});
|
|
1367
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
1368
|
+
minVersion: "17.0.0",
|
|
1369
|
+
version: "22.2.0",
|
|
1370
|
+
type: InputColorEyeDropper,
|
|
1371
|
+
isStandalone: true,
|
|
1372
|
+
selector: "p-inputcolor-eyedropper",
|
|
1373
|
+
inputs: {
|
|
1374
|
+
text: {
|
|
1375
|
+
classPropertyName: "text",
|
|
1376
|
+
publicName: "text",
|
|
1377
|
+
isSignal: true,
|
|
1378
|
+
isRequired: false,
|
|
1379
|
+
transformFunction: null
|
|
1380
|
+
},
|
|
1381
|
+
rounded: {
|
|
1382
|
+
classPropertyName: "rounded",
|
|
1383
|
+
publicName: "rounded",
|
|
1384
|
+
isSignal: true,
|
|
1385
|
+
isRequired: false,
|
|
1386
|
+
transformFunction: null
|
|
1387
|
+
},
|
|
1388
|
+
outlined: {
|
|
1389
|
+
classPropertyName: "outlined",
|
|
1390
|
+
publicName: "outlined",
|
|
1391
|
+
isSignal: true,
|
|
1392
|
+
isRequired: false,
|
|
1393
|
+
transformFunction: null
|
|
1394
|
+
},
|
|
1395
|
+
iconOnly: {
|
|
1396
|
+
classPropertyName: "iconOnly",
|
|
1397
|
+
publicName: "iconOnly",
|
|
1398
|
+
isSignal: true,
|
|
1399
|
+
isRequired: false,
|
|
1400
|
+
transformFunction: null
|
|
1401
|
+
},
|
|
1402
|
+
severity: {
|
|
1403
|
+
classPropertyName: "severity",
|
|
1404
|
+
publicName: "severity",
|
|
1405
|
+
isSignal: true,
|
|
1406
|
+
isRequired: false,
|
|
1407
|
+
transformFunction: null
|
|
1408
|
+
},
|
|
1409
|
+
size: {
|
|
1410
|
+
classPropertyName: "size",
|
|
1411
|
+
publicName: "size",
|
|
1412
|
+
isSignal: true,
|
|
1413
|
+
isRequired: false,
|
|
1414
|
+
transformFunction: null
|
|
1415
|
+
}
|
|
1416
|
+
},
|
|
1417
|
+
host: { properties: { "class": "$pc.cx(\"eyeDropper\")" } },
|
|
1418
|
+
providers: [{
|
|
1419
|
+
provide: PARENT_INSTANCE,
|
|
1420
|
+
useExisting: InputColorEyeDropper
|
|
1421
|
+
}],
|
|
1422
|
+
usesInheritance: true,
|
|
1423
|
+
hostDirectives: [{ directive: i1$1.Bind }],
|
|
1424
|
+
ngImport: i0,
|
|
1425
|
+
template: `
|
|
1416
1426
|
<ng-template #contentTpl><ng-content /></ng-template>
|
|
1417
1427
|
<button
|
|
1418
1428
|
pButton
|
|
@@ -1435,15 +1445,69 @@ class InputColorEyeDropper extends BaseComponent {
|
|
|
1435
1445
|
<ng-container *ngTemplateOutlet="contentTpl" />
|
|
1436
1446
|
}
|
|
1437
1447
|
</button>
|
|
1438
|
-
`,
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1448
|
+
`,
|
|
1449
|
+
isInline: true,
|
|
1450
|
+
dependencies: [
|
|
1451
|
+
{
|
|
1452
|
+
kind: "directive",
|
|
1453
|
+
type: ButtonDirective,
|
|
1454
|
+
selector: "[pButton]",
|
|
1455
|
+
inputs: [
|
|
1456
|
+
"pButton",
|
|
1457
|
+
"pButtonPT",
|
|
1458
|
+
"pButtonUnstyled",
|
|
1459
|
+
"hostName",
|
|
1460
|
+
"text",
|
|
1461
|
+
"plain",
|
|
1462
|
+
"raised",
|
|
1463
|
+
"size",
|
|
1464
|
+
"outlined",
|
|
1465
|
+
"link",
|
|
1466
|
+
"rounded",
|
|
1467
|
+
"fluid",
|
|
1468
|
+
"variant",
|
|
1469
|
+
"iconOnly",
|
|
1470
|
+
"loading",
|
|
1471
|
+
"severity"
|
|
1472
|
+
]
|
|
1473
|
+
},
|
|
1474
|
+
{
|
|
1475
|
+
kind: "directive",
|
|
1476
|
+
type: ButtonIcon,
|
|
1477
|
+
selector: "[pButtonIcon]",
|
|
1478
|
+
inputs: ["pButtonIconPT", "pButtonUnstyled"]
|
|
1479
|
+
},
|
|
1480
|
+
{
|
|
1481
|
+
kind: "directive",
|
|
1482
|
+
type: NgTemplateOutlet,
|
|
1483
|
+
selector: "[ngTemplateOutlet]",
|
|
1484
|
+
inputs: [
|
|
1485
|
+
"ngTemplateOutletContext",
|
|
1486
|
+
"ngTemplateOutlet",
|
|
1487
|
+
"ngTemplateOutletInjector"
|
|
1488
|
+
]
|
|
1489
|
+
}
|
|
1490
|
+
],
|
|
1491
|
+
changeDetection: i0.ChangeDetectionStrategy.OnPush,
|
|
1492
|
+
encapsulation: i0.ViewEncapsulation.None
|
|
1493
|
+
});
|
|
1494
|
+
};
|
|
1495
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
1496
|
+
minVersion: "12.0.0",
|
|
1497
|
+
version: "22.2.0",
|
|
1498
|
+
ngImport: i0,
|
|
1499
|
+
type: InputColorEyeDropper,
|
|
1500
|
+
decorators: [{
|
|
1501
|
+
type: Component,
|
|
1502
|
+
args: [{
|
|
1503
|
+
selector: "p-inputcolor-eyedropper",
|
|
1504
|
+
standalone: true,
|
|
1505
|
+
imports: [
|
|
1506
|
+
ButtonDirective,
|
|
1507
|
+
ButtonIcon,
|
|
1508
|
+
NgTemplateOutlet
|
|
1509
|
+
],
|
|
1510
|
+
template: `
|
|
1447
1511
|
<ng-template #contentTpl><ng-content /></ng-template>
|
|
1448
1512
|
<button
|
|
1449
1513
|
pButton
|
|
@@ -1467,805 +1531,1183 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImpor
|
|
|
1467
1531
|
}
|
|
1468
1532
|
</button>
|
|
1469
1533
|
`,
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
}
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
*/
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
}
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1534
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
1535
|
+
encapsulation: ViewEncapsulation.None,
|
|
1536
|
+
host: { "[class]": "$pc.cx(\"eyeDropper\")" },
|
|
1537
|
+
providers: [{
|
|
1538
|
+
provide: PARENT_INSTANCE,
|
|
1539
|
+
useExisting: InputColorEyeDropper
|
|
1540
|
+
}],
|
|
1541
|
+
hostDirectives: [Bind]
|
|
1542
|
+
}]
|
|
1543
|
+
}],
|
|
1544
|
+
propDecorators: {
|
|
1545
|
+
text: [{
|
|
1546
|
+
type: i0.Input,
|
|
1547
|
+
args: [{
|
|
1548
|
+
isSignal: true,
|
|
1549
|
+
alias: "text",
|
|
1550
|
+
required: false
|
|
1551
|
+
}]
|
|
1552
|
+
}],
|
|
1553
|
+
rounded: [{
|
|
1554
|
+
type: i0.Input,
|
|
1555
|
+
args: [{
|
|
1556
|
+
isSignal: true,
|
|
1557
|
+
alias: "rounded",
|
|
1558
|
+
required: false
|
|
1559
|
+
}]
|
|
1560
|
+
}],
|
|
1561
|
+
outlined: [{
|
|
1562
|
+
type: i0.Input,
|
|
1563
|
+
args: [{
|
|
1564
|
+
isSignal: true,
|
|
1565
|
+
alias: "outlined",
|
|
1566
|
+
required: false
|
|
1567
|
+
}]
|
|
1568
|
+
}],
|
|
1569
|
+
iconOnly: [{
|
|
1570
|
+
type: i0.Input,
|
|
1571
|
+
args: [{
|
|
1572
|
+
isSignal: true,
|
|
1573
|
+
alias: "iconOnly",
|
|
1574
|
+
required: false
|
|
1575
|
+
}]
|
|
1576
|
+
}],
|
|
1577
|
+
severity: [{
|
|
1578
|
+
type: i0.Input,
|
|
1579
|
+
args: [{
|
|
1580
|
+
isSignal: true,
|
|
1581
|
+
alias: "severity",
|
|
1582
|
+
required: false
|
|
1583
|
+
}]
|
|
1584
|
+
}],
|
|
1585
|
+
size: [{
|
|
1586
|
+
type: i0.Input,
|
|
1587
|
+
args: [{
|
|
1588
|
+
isSignal: true,
|
|
1589
|
+
alias: "size",
|
|
1590
|
+
required: false
|
|
1591
|
+
}]
|
|
1592
|
+
}]
|
|
1593
|
+
}
|
|
1594
|
+
});
|
|
1595
|
+
var InputColorInput = class InputColorInput extends BaseComponent {
|
|
1596
|
+
componentName = "InputColorInput";
|
|
1597
|
+
$pc = inject(INPUT_COLOR_INSTANCE);
|
|
1598
|
+
channel = input.required(...ngDevMode ? [{ debugName: "channel" }] : /* istanbul ignore next */ []);
|
|
1599
|
+
type = input(...ngDevMode ? [void 0, { debugName: "type" }] : /* istanbul ignore next */ []);
|
|
1600
|
+
disabled = input(false, {
|
|
1601
|
+
...ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {},
|
|
1602
|
+
transform: booleanAttribute
|
|
1603
|
+
});
|
|
1604
|
+
$disabled = computed(() => this.disabled() || this.$pc.$disabled(), ...ngDevMode ? [{ debugName: "$disabled" }] : /* istanbul ignore next */ []);
|
|
1605
|
+
$inputType = computed(() => {
|
|
1606
|
+
const t = this.type();
|
|
1607
|
+
if (t) return t;
|
|
1608
|
+
const ch = this.channel();
|
|
1609
|
+
return ch === "hex" || ch === "css" ? "text" : "number";
|
|
1610
|
+
}, ...ngDevMode ? [{ debugName: "$inputType" }] : /* istanbul ignore next */ []);
|
|
1611
|
+
$displayValue = computed(() => {
|
|
1612
|
+
const ch = this.channel();
|
|
1613
|
+
return getInputChannelValue(this.$pc.$color(), ch, this.$pc.format());
|
|
1614
|
+
}, ...ngDevMode ? [{ debugName: "$displayValue" }] : /* istanbul ignore next */ []);
|
|
1615
|
+
pendingValue = null;
|
|
1616
|
+
constructor() {
|
|
1617
|
+
super();
|
|
1618
|
+
effect(() => {
|
|
1619
|
+
this.el.nativeElement.type = this.$inputType();
|
|
1620
|
+
});
|
|
1621
|
+
effect(() => {
|
|
1622
|
+
const el = this.el.nativeElement;
|
|
1623
|
+
const ch = this.channel();
|
|
1624
|
+
if (ch !== "hex" && ch !== "css") {
|
|
1625
|
+
const range = getChannelRange(ch);
|
|
1626
|
+
el.min = String(range.minValue);
|
|
1627
|
+
el.max = String(range.maxValue);
|
|
1628
|
+
el.step = String(range.step);
|
|
1629
|
+
}
|
|
1630
|
+
});
|
|
1631
|
+
effect(() => {
|
|
1632
|
+
this.el.nativeElement.value = String(this.$displayValue() ?? "");
|
|
1633
|
+
});
|
|
1634
|
+
}
|
|
1635
|
+
onInput(event) {
|
|
1636
|
+
const target = event.target;
|
|
1637
|
+
this.pendingValue = target.value;
|
|
1638
|
+
}
|
|
1639
|
+
onBlur(event) {
|
|
1640
|
+
this.commitValue(event);
|
|
1641
|
+
}
|
|
1642
|
+
onEnter(event) {
|
|
1643
|
+
this.commitValue(event);
|
|
1644
|
+
}
|
|
1645
|
+
commitValue(event) {
|
|
1646
|
+
if (this.pendingValue === null) return;
|
|
1647
|
+
const ch = this.channel();
|
|
1648
|
+
const value = this.pendingValue;
|
|
1649
|
+
this.pendingValue = null;
|
|
1650
|
+
if (ch === "hex") {
|
|
1651
|
+
const parsed = parseColor(value.startsWith("#") ? value : `#${value}`);
|
|
1652
|
+
if (parsed) this.$pc.updateColor(parsed, event, true);
|
|
1653
|
+
} else if (ch === "css") {
|
|
1654
|
+
const parsed = parseColor(value);
|
|
1655
|
+
if (parsed) this.$pc.updateColor(parsed, event, true);
|
|
1656
|
+
} else {
|
|
1657
|
+
const numValue = parseFloat(value);
|
|
1658
|
+
if (!isNaN(numValue)) {
|
|
1659
|
+
const range = getChannelRange(ch);
|
|
1660
|
+
const clamped = Math.max(range.minValue, Math.min(range.maxValue, numValue));
|
|
1661
|
+
this.$pc.setChannelValue(ch, clamped, event, true);
|
|
1662
|
+
}
|
|
1663
|
+
}
|
|
1664
|
+
}
|
|
1665
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
1666
|
+
minVersion: "12.0.0",
|
|
1667
|
+
version: "22.2.0",
|
|
1668
|
+
ngImport: i0,
|
|
1669
|
+
type: InputColorInput,
|
|
1670
|
+
deps: [],
|
|
1671
|
+
target: i0.ɵɵFactoryTarget.Directive
|
|
1672
|
+
});
|
|
1673
|
+
static ɵdir = i0.ɵɵngDeclareDirective({
|
|
1674
|
+
minVersion: "17.1.0",
|
|
1675
|
+
version: "22.2.0",
|
|
1676
|
+
type: InputColorInput,
|
|
1677
|
+
isStandalone: true,
|
|
1678
|
+
selector: "[pInputColorInput]",
|
|
1679
|
+
inputs: {
|
|
1680
|
+
channel: {
|
|
1681
|
+
classPropertyName: "channel",
|
|
1682
|
+
publicName: "channel",
|
|
1683
|
+
isSignal: true,
|
|
1684
|
+
isRequired: true,
|
|
1685
|
+
transformFunction: null
|
|
1686
|
+
},
|
|
1687
|
+
type: {
|
|
1688
|
+
classPropertyName: "type",
|
|
1689
|
+
publicName: "type",
|
|
1690
|
+
isSignal: true,
|
|
1691
|
+
isRequired: false,
|
|
1692
|
+
transformFunction: null
|
|
1693
|
+
},
|
|
1694
|
+
disabled: {
|
|
1695
|
+
classPropertyName: "disabled",
|
|
1696
|
+
publicName: "disabled",
|
|
1697
|
+
isSignal: true,
|
|
1698
|
+
isRequired: false,
|
|
1699
|
+
transformFunction: null
|
|
1700
|
+
}
|
|
1701
|
+
},
|
|
1702
|
+
host: {
|
|
1703
|
+
listeners: {
|
|
1704
|
+
"input": "onInput($event)",
|
|
1705
|
+
"blur": "onBlur($event)",
|
|
1706
|
+
"keydown.enter": "onEnter($event)"
|
|
1707
|
+
},
|
|
1708
|
+
properties: {
|
|
1709
|
+
"attr.disabled": "$disabled() || null",
|
|
1710
|
+
"attr.data-channel": "channel()"
|
|
1711
|
+
}
|
|
1712
|
+
},
|
|
1713
|
+
providers: [{
|
|
1714
|
+
provide: PARENT_INSTANCE,
|
|
1715
|
+
useExisting: InputColorInput
|
|
1716
|
+
}],
|
|
1717
|
+
usesInheritance: true,
|
|
1718
|
+
hostDirectives: [{
|
|
1719
|
+
directive: i1.InputText,
|
|
1720
|
+
inputs: [
|
|
1721
|
+
"pSize",
|
|
1722
|
+
"pSize",
|
|
1723
|
+
"fluid",
|
|
1724
|
+
"fluid",
|
|
1725
|
+
"variant",
|
|
1726
|
+
"variant",
|
|
1727
|
+
"invalid",
|
|
1728
|
+
"invalid"
|
|
1729
|
+
]
|
|
1730
|
+
}],
|
|
1731
|
+
ngImport: i0
|
|
1732
|
+
});
|
|
1733
|
+
};
|
|
1734
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
1735
|
+
minVersion: "12.0.0",
|
|
1736
|
+
version: "22.2.0",
|
|
1737
|
+
ngImport: i0,
|
|
1738
|
+
type: InputColorInput,
|
|
1739
|
+
decorators: [{
|
|
1740
|
+
type: Directive,
|
|
1741
|
+
args: [{
|
|
1742
|
+
selector: "[pInputColorInput]",
|
|
1743
|
+
standalone: true,
|
|
1744
|
+
host: {
|
|
1745
|
+
"[attr.disabled]": "$disabled() || null",
|
|
1746
|
+
"[attr.data-channel]": "channel()",
|
|
1747
|
+
"(input)": "onInput($event)",
|
|
1748
|
+
"(blur)": "onBlur($event)",
|
|
1749
|
+
"(keydown.enter)": "onEnter($event)"
|
|
1750
|
+
},
|
|
1751
|
+
providers: [{
|
|
1752
|
+
provide: PARENT_INSTANCE,
|
|
1753
|
+
useExisting: InputColorInput
|
|
1754
|
+
}],
|
|
1755
|
+
hostDirectives: [{
|
|
1756
|
+
directive: InputText,
|
|
1757
|
+
inputs: [
|
|
1758
|
+
"pSize",
|
|
1759
|
+
"fluid",
|
|
1760
|
+
"variant",
|
|
1761
|
+
"invalid"
|
|
1762
|
+
]
|
|
1763
|
+
}]
|
|
1764
|
+
}]
|
|
1765
|
+
}],
|
|
1766
|
+
ctorParameters: () => [],
|
|
1767
|
+
propDecorators: {
|
|
1768
|
+
channel: [{
|
|
1769
|
+
type: i0.Input,
|
|
1770
|
+
args: [{
|
|
1771
|
+
isSignal: true,
|
|
1772
|
+
alias: "channel",
|
|
1773
|
+
required: true
|
|
1774
|
+
}]
|
|
1775
|
+
}],
|
|
1776
|
+
type: [{
|
|
1777
|
+
type: i0.Input,
|
|
1778
|
+
args: [{
|
|
1779
|
+
isSignal: true,
|
|
1780
|
+
alias: "type",
|
|
1781
|
+
required: false
|
|
1782
|
+
}]
|
|
1783
|
+
}],
|
|
1784
|
+
disabled: [{
|
|
1785
|
+
type: i0.Input,
|
|
1786
|
+
args: [{
|
|
1787
|
+
isSignal: true,
|
|
1788
|
+
alias: "disabled",
|
|
1789
|
+
required: false
|
|
1790
|
+
}]
|
|
1791
|
+
}]
|
|
1792
|
+
}
|
|
1793
|
+
});
|
|
1794
|
+
var InputColorSlider = class InputColorSlider extends BaseComponent {
|
|
1795
|
+
componentName = "InputColorSlider";
|
|
1796
|
+
bindDirectiveInstance = inject(Bind, { self: true });
|
|
1797
|
+
$pc = inject(INPUT_COLOR_INSTANCE);
|
|
1798
|
+
channel = input("hue", ...ngDevMode ? [{ debugName: "channel" }] : /* istanbul ignore next */ []);
|
|
1799
|
+
orientation = input("horizontal", ...ngDevMode ? [{ debugName: "orientation" }] : /* istanbul ignore next */ []);
|
|
1800
|
+
dragging = false;
|
|
1801
|
+
cleanupDrag = null;
|
|
1802
|
+
onAfterViewChecked() {
|
|
1803
|
+
this.bindDirectiveInstance.setAttrs(this.ptms(["host", "root"]));
|
|
1804
|
+
}
|
|
1805
|
+
onPointerDown(event) {
|
|
1806
|
+
if (this.$pc.$disabled()) return;
|
|
1807
|
+
event.preventDefault();
|
|
1808
|
+
this.dragging = true;
|
|
1809
|
+
const el = this.el.nativeElement;
|
|
1810
|
+
el.setPointerCapture(event.pointerId);
|
|
1811
|
+
this.updateFromPointer(event);
|
|
1812
|
+
const onMove = (e) => {
|
|
1813
|
+
if (!this.dragging) return;
|
|
1814
|
+
e.preventDefault();
|
|
1815
|
+
this.updateFromPointer(e);
|
|
1816
|
+
};
|
|
1817
|
+
const cleanup = () => {
|
|
1818
|
+
this.dragging = false;
|
|
1819
|
+
this.cleanupDrag = null;
|
|
1820
|
+
el.removeEventListener("pointermove", onMove);
|
|
1821
|
+
el.removeEventListener("pointerup", onUp);
|
|
1822
|
+
el.removeEventListener("pointercancel", onCancel);
|
|
1823
|
+
el.removeEventListener("lostpointercapture", onLostCapture);
|
|
1824
|
+
};
|
|
1825
|
+
this.cleanupDrag = cleanup;
|
|
1826
|
+
const onUp = (e) => {
|
|
1827
|
+
if (!this.dragging) return;
|
|
1828
|
+
this.updateFromPointer(e, true);
|
|
1829
|
+
cleanup();
|
|
1830
|
+
};
|
|
1831
|
+
const onCancel = () => {
|
|
1832
|
+
cleanup();
|
|
1833
|
+
};
|
|
1834
|
+
const onLostCapture = () => {
|
|
1835
|
+
cleanup();
|
|
1836
|
+
};
|
|
1837
|
+
el.addEventListener("pointermove", onMove);
|
|
1838
|
+
el.addEventListener("pointerup", onUp);
|
|
1839
|
+
el.addEventListener("pointercancel", onCancel);
|
|
1840
|
+
el.addEventListener("lostpointercapture", onLostCapture);
|
|
1841
|
+
}
|
|
1842
|
+
ngOnDestroy() {
|
|
1843
|
+
this.cleanupDrag?.();
|
|
1844
|
+
}
|
|
1845
|
+
updateFromPointer(event, isEnd = false) {
|
|
1846
|
+
const rect = this.el.nativeElement.getBoundingClientRect();
|
|
1847
|
+
const ch = this.channel();
|
|
1848
|
+
const range = getChannelRange(ch);
|
|
1849
|
+
let percent;
|
|
1850
|
+
if (this.orientation() === "vertical") percent = 1 - Math.max(0, Math.min(1, (event.clientY - rect.top) / rect.height));
|
|
1851
|
+
else percent = Math.max(0, Math.min(1, (event.clientX - rect.left) / rect.width));
|
|
1852
|
+
const value = snapValue(range.minValue + percent * (range.maxValue - range.minValue), range.minValue, range.maxValue, range.step);
|
|
1853
|
+
this.$pc.setChannelValue(ch, value, event, isEnd);
|
|
1854
|
+
}
|
|
1855
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
1856
|
+
minVersion: "12.0.0",
|
|
1857
|
+
version: "22.2.0",
|
|
1858
|
+
ngImport: i0,
|
|
1859
|
+
type: InputColorSlider,
|
|
1860
|
+
deps: null,
|
|
1861
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
1862
|
+
});
|
|
1863
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
1864
|
+
minVersion: "17.1.0",
|
|
1865
|
+
version: "22.2.0",
|
|
1866
|
+
type: InputColorSlider,
|
|
1867
|
+
isStandalone: true,
|
|
1868
|
+
selector: "p-inputcolor-slider",
|
|
1869
|
+
inputs: {
|
|
1870
|
+
channel: {
|
|
1871
|
+
classPropertyName: "channel",
|
|
1872
|
+
publicName: "channel",
|
|
1873
|
+
isSignal: true,
|
|
1874
|
+
isRequired: false,
|
|
1875
|
+
transformFunction: null
|
|
1876
|
+
},
|
|
1877
|
+
orientation: {
|
|
1878
|
+
classPropertyName: "orientation",
|
|
1879
|
+
publicName: "orientation",
|
|
1880
|
+
isSignal: true,
|
|
1881
|
+
isRequired: false,
|
|
1882
|
+
transformFunction: null
|
|
1883
|
+
}
|
|
1884
|
+
},
|
|
1885
|
+
host: {
|
|
1886
|
+
listeners: { "pointerdown": "onPointerDown($event)" },
|
|
1887
|
+
properties: {
|
|
1888
|
+
"class": "$pc.cx(\"slider\")",
|
|
1889
|
+
"class.p-inputcolor-slider-horizontal": "orientation() === \"horizontal\"",
|
|
1890
|
+
"class.p-inputcolor-slider-vertical": "orientation() === \"vertical\"",
|
|
1891
|
+
"attr.data-orientation": "orientation()"
|
|
1892
|
+
}
|
|
1893
|
+
},
|
|
1894
|
+
providers: [{
|
|
1895
|
+
provide: INPUT_COLOR_SLIDER_INSTANCE,
|
|
1896
|
+
useExisting: InputColorSlider
|
|
1897
|
+
}, {
|
|
1898
|
+
provide: PARENT_INSTANCE,
|
|
1899
|
+
useExisting: InputColorSlider
|
|
1900
|
+
}],
|
|
1901
|
+
usesInheritance: true,
|
|
1902
|
+
hostDirectives: [{ directive: i1$1.Bind }],
|
|
1903
|
+
ngImport: i0,
|
|
1904
|
+
template: `<ng-content></ng-content>`,
|
|
1905
|
+
isInline: true,
|
|
1906
|
+
changeDetection: i0.ChangeDetectionStrategy.OnPush,
|
|
1907
|
+
encapsulation: i0.ViewEncapsulation.None
|
|
1908
|
+
});
|
|
1909
|
+
};
|
|
1910
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
1911
|
+
minVersion: "12.0.0",
|
|
1912
|
+
version: "22.2.0",
|
|
1913
|
+
ngImport: i0,
|
|
1914
|
+
type: InputColorSlider,
|
|
1915
|
+
decorators: [{
|
|
1916
|
+
type: Component,
|
|
1917
|
+
args: [{
|
|
1918
|
+
selector: "p-inputcolor-slider",
|
|
1919
|
+
standalone: true,
|
|
1920
|
+
template: `<ng-content></ng-content>`,
|
|
1921
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
1922
|
+
encapsulation: ViewEncapsulation.None,
|
|
1923
|
+
host: {
|
|
1924
|
+
"[class]": "$pc.cx(\"slider\")",
|
|
1925
|
+
"[class.p-inputcolor-slider-horizontal]": "orientation() === \"horizontal\"",
|
|
1926
|
+
"[class.p-inputcolor-slider-vertical]": "orientation() === \"vertical\"",
|
|
1927
|
+
"[attr.data-orientation]": "orientation()",
|
|
1928
|
+
"(pointerdown)": "onPointerDown($event)"
|
|
1929
|
+
},
|
|
1930
|
+
providers: [{
|
|
1931
|
+
provide: INPUT_COLOR_SLIDER_INSTANCE,
|
|
1932
|
+
useExisting: InputColorSlider
|
|
1933
|
+
}, {
|
|
1934
|
+
provide: PARENT_INSTANCE,
|
|
1935
|
+
useExisting: InputColorSlider
|
|
1936
|
+
}],
|
|
1937
|
+
hostDirectives: [Bind]
|
|
1938
|
+
}]
|
|
1939
|
+
}],
|
|
1940
|
+
propDecorators: {
|
|
1941
|
+
channel: [{
|
|
1942
|
+
type: i0.Input,
|
|
1943
|
+
args: [{
|
|
1944
|
+
isSignal: true,
|
|
1945
|
+
alias: "channel",
|
|
1946
|
+
required: false
|
|
1947
|
+
}]
|
|
1948
|
+
}],
|
|
1949
|
+
orientation: [{
|
|
1950
|
+
type: i0.Input,
|
|
1951
|
+
args: [{
|
|
1952
|
+
isSignal: true,
|
|
1953
|
+
alias: "orientation",
|
|
1954
|
+
required: false
|
|
1955
|
+
}]
|
|
1956
|
+
}]
|
|
1957
|
+
}
|
|
1958
|
+
});
|
|
1959
|
+
var InputColorSliderHandle = class InputColorSliderHandle extends BaseComponent {
|
|
1960
|
+
componentName = "InputColorSliderHandle";
|
|
1961
|
+
bindDirectiveInstance = inject(Bind, { self: true });
|
|
1962
|
+
$pc = inject(INPUT_COLOR_INSTANCE);
|
|
1963
|
+
pcSlider = inject(INPUT_COLOR_SLIDER_INSTANCE);
|
|
1964
|
+
$channel = computed(() => this.pcSlider.channel(), ...ngDevMode ? [{ debugName: "$channel" }] : /* istanbul ignore next */ []);
|
|
1965
|
+
$isVertical = computed(() => this.pcSlider.orientation() === "vertical", ...ngDevMode ? [{ debugName: "$isVertical" }] : /* istanbul ignore next */ []);
|
|
1966
|
+
$range = computed(() => getChannelRange(this.$channel()), ...ngDevMode ? [{ debugName: "$range" }] : /* istanbul ignore next */ []);
|
|
1967
|
+
$value = computed(() => this.$pc.$color().getChannelValue(this.$channel()), ...ngDevMode ? [{ debugName: "$value" }] : /* istanbul ignore next */ []);
|
|
1968
|
+
$tabindex = computed(() => this.$pc.$disabled() ? -1 : 0, ...ngDevMode ? [{ debugName: "$tabindex" }] : /* istanbul ignore next */ []);
|
|
1969
|
+
$ariaDisabled = computed(() => this.$pc.$disabled() || void 0, ...ngDevMode ? [{ debugName: "$ariaDisabled" }] : /* istanbul ignore next */ []);
|
|
1970
|
+
$handlePosition = computed(() => {
|
|
1971
|
+
const range = this.$range();
|
|
1972
|
+
return `${(this.$value() - range.minValue) / (range.maxValue - range.minValue) * 100}%`;
|
|
1973
|
+
}, ...ngDevMode ? [{ debugName: "$handlePosition" }] : /* istanbul ignore next */ []);
|
|
1974
|
+
$handlePositionVertical = computed(() => {
|
|
1975
|
+
const range = this.$range();
|
|
1976
|
+
return `${100 - (this.$value() - range.minValue) / (range.maxValue - range.minValue) * 100}%`;
|
|
1977
|
+
}, ...ngDevMode ? [{ debugName: "$handlePositionVertical" }] : /* istanbul ignore next */ []);
|
|
1978
|
+
$left = computed(() => this.$isVertical() ? null : this.$handlePosition(), ...ngDevMode ? [{ debugName: "$left" }] : /* istanbul ignore next */ []);
|
|
1979
|
+
$top = computed(() => this.$isVertical() ? this.$handlePositionVertical() : null, ...ngDevMode ? [{ debugName: "$top" }] : /* istanbul ignore next */ []);
|
|
1980
|
+
$translate = computed(() => this.$isVertical() ? "0 -50%" : "-50% 0", ...ngDevMode ? [{ debugName: "$translate" }] : /* istanbul ignore next */ []);
|
|
1981
|
+
$handleColor = computed(() => getChannelColor(this.$pc.$color(), this.$channel()).toRgbString(), ...ngDevMode ? [{ debugName: "$handleColor" }] : /* istanbul ignore next */ []);
|
|
1982
|
+
onAfterViewChecked() {
|
|
1983
|
+
this.bindDirectiveInstance.setAttrs(this.ptms(["host", "root"]));
|
|
1984
|
+
}
|
|
1985
|
+
onKeyDown(event) {
|
|
1986
|
+
if (this.$pc.$disabled()) return;
|
|
1987
|
+
const ch = this.$channel();
|
|
1988
|
+
const range = this.$range();
|
|
1989
|
+
let value = this.$value();
|
|
1990
|
+
let handled = false;
|
|
1991
|
+
switch (event.key) {
|
|
1992
|
+
case "ArrowRight":
|
|
1993
|
+
case "ArrowUp":
|
|
1994
|
+
value = Math.min(value + range.step, range.maxValue);
|
|
1995
|
+
handled = true;
|
|
1996
|
+
break;
|
|
1997
|
+
case "ArrowLeft":
|
|
1998
|
+
case "ArrowDown":
|
|
1999
|
+
value = Math.max(value - range.step, range.minValue);
|
|
2000
|
+
handled = true;
|
|
2001
|
+
break;
|
|
2002
|
+
case "PageUp":
|
|
2003
|
+
value = Math.min(value + range.pageStep, range.maxValue);
|
|
2004
|
+
handled = true;
|
|
2005
|
+
break;
|
|
2006
|
+
case "PageDown":
|
|
2007
|
+
value = Math.max(value - range.pageStep, range.minValue);
|
|
2008
|
+
handled = true;
|
|
2009
|
+
break;
|
|
2010
|
+
case "Home":
|
|
2011
|
+
value = range.minValue;
|
|
2012
|
+
handled = true;
|
|
2013
|
+
break;
|
|
2014
|
+
case "End":
|
|
2015
|
+
value = range.maxValue;
|
|
2016
|
+
handled = true;
|
|
2017
|
+
}
|
|
2018
|
+
if (handled) {
|
|
2019
|
+
event.preventDefault();
|
|
2020
|
+
this.$pc.setChannelValue(ch, value, event, true);
|
|
2021
|
+
}
|
|
2022
|
+
}
|
|
2023
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
2024
|
+
minVersion: "12.0.0",
|
|
2025
|
+
version: "22.2.0",
|
|
2026
|
+
ngImport: i0,
|
|
2027
|
+
type: InputColorSliderHandle,
|
|
2028
|
+
deps: null,
|
|
2029
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
2030
|
+
});
|
|
2031
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
2032
|
+
minVersion: "14.0.0",
|
|
2033
|
+
version: "22.2.0",
|
|
2034
|
+
type: InputColorSliderHandle,
|
|
2035
|
+
isStandalone: true,
|
|
2036
|
+
selector: "p-inputcolor-slider-handle",
|
|
2037
|
+
host: {
|
|
2038
|
+
listeners: { "keydown": "onKeyDown($event)" },
|
|
2039
|
+
properties: {
|
|
2040
|
+
"class": "$pc.cx(\"sliderHandle\")",
|
|
2041
|
+
"style.--px-slider-handle-background": "$handleColor()",
|
|
2042
|
+
"style.left": "$left()",
|
|
2043
|
+
"style.top": "$top()",
|
|
2044
|
+
"style.translate": "$translate()",
|
|
2045
|
+
"attr.role": "'slider'",
|
|
2046
|
+
"attr.tabindex": "$tabindex()",
|
|
2047
|
+
"attr.aria-label": "$channel()",
|
|
2048
|
+
"attr.aria-disabled": "$ariaDisabled()",
|
|
2049
|
+
"attr.aria-valuemin": "$range().minValue",
|
|
2050
|
+
"attr.aria-valuemax": "$range().maxValue",
|
|
2051
|
+
"attr.aria-valuenow": "$value()"
|
|
2052
|
+
}
|
|
2053
|
+
},
|
|
2054
|
+
providers: [{
|
|
2055
|
+
provide: PARENT_INSTANCE,
|
|
2056
|
+
useExisting: InputColorSliderHandle
|
|
2057
|
+
}],
|
|
2058
|
+
usesInheritance: true,
|
|
2059
|
+
hostDirectives: [{ directive: i1$1.Bind }],
|
|
2060
|
+
ngImport: i0,
|
|
2061
|
+
template: `<ng-content></ng-content>`,
|
|
2062
|
+
isInline: true,
|
|
2063
|
+
changeDetection: i0.ChangeDetectionStrategy.OnPush,
|
|
2064
|
+
encapsulation: i0.ViewEncapsulation.None
|
|
2065
|
+
});
|
|
2066
|
+
};
|
|
2067
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
2068
|
+
minVersion: "12.0.0",
|
|
2069
|
+
version: "22.2.0",
|
|
2070
|
+
ngImport: i0,
|
|
2071
|
+
type: InputColorSliderHandle,
|
|
2072
|
+
decorators: [{
|
|
2073
|
+
type: Component,
|
|
2074
|
+
args: [{
|
|
2075
|
+
selector: "p-inputcolor-slider-handle",
|
|
2076
|
+
standalone: true,
|
|
2077
|
+
template: `<ng-content></ng-content>`,
|
|
2078
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
2079
|
+
encapsulation: ViewEncapsulation.None,
|
|
2080
|
+
host: {
|
|
2081
|
+
"[class]": "$pc.cx(\"sliderHandle\")",
|
|
2082
|
+
"[style.--px-slider-handle-background]": "$handleColor()",
|
|
2083
|
+
"[style.left]": "$left()",
|
|
2084
|
+
"[style.top]": "$top()",
|
|
2085
|
+
"[style.translate]": "$translate()",
|
|
2086
|
+
"[attr.role]": "'slider'",
|
|
2087
|
+
"[attr.tabindex]": "$tabindex()",
|
|
2088
|
+
"[attr.aria-label]": "$channel()",
|
|
2089
|
+
"[attr.aria-disabled]": "$ariaDisabled()",
|
|
2090
|
+
"[attr.aria-valuemin]": "$range().minValue",
|
|
2091
|
+
"[attr.aria-valuemax]": "$range().maxValue",
|
|
2092
|
+
"[attr.aria-valuenow]": "$value()",
|
|
2093
|
+
"(keydown)": "onKeyDown($event)"
|
|
2094
|
+
},
|
|
2095
|
+
providers: [{
|
|
2096
|
+
provide: PARENT_INSTANCE,
|
|
2097
|
+
useExisting: InputColorSliderHandle
|
|
2098
|
+
}],
|
|
2099
|
+
hostDirectives: [Bind]
|
|
2100
|
+
}]
|
|
2101
|
+
}]
|
|
2102
|
+
});
|
|
2103
|
+
var InputColorSliderTrack = class InputColorSliderTrack extends BaseComponent {
|
|
2104
|
+
componentName = "InputColorSliderTrack";
|
|
2105
|
+
bindDirectiveInstance = inject(Bind, { self: true });
|
|
2106
|
+
$pc = inject(INPUT_COLOR_INSTANCE);
|
|
2107
|
+
pcSlider = inject(INPUT_COLOR_SLIDER_INSTANCE);
|
|
2108
|
+
$gradient = computed(() => {
|
|
2109
|
+
const ch = this.pcSlider.channel();
|
|
2110
|
+
return getChannelGradient(this.$pc.$color(), ch, this.pcSlider.orientation());
|
|
2111
|
+
}, ...ngDevMode ? [{ debugName: "$gradient" }] : /* istanbul ignore next */ []);
|
|
2112
|
+
onAfterViewChecked() {
|
|
2113
|
+
this.bindDirectiveInstance.setAttrs(this.ptms(["host", "root"]));
|
|
2114
|
+
}
|
|
2115
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
2116
|
+
minVersion: "12.0.0",
|
|
2117
|
+
version: "22.2.0",
|
|
2118
|
+
ngImport: i0,
|
|
2119
|
+
type: InputColorSliderTrack,
|
|
2120
|
+
deps: null,
|
|
2121
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
2122
|
+
});
|
|
2123
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
2124
|
+
minVersion: "14.0.0",
|
|
2125
|
+
version: "22.2.0",
|
|
2126
|
+
type: InputColorSliderTrack,
|
|
2127
|
+
isStandalone: true,
|
|
2128
|
+
selector: "p-inputcolor-slider-track",
|
|
2129
|
+
host: { properties: {
|
|
2130
|
+
"class": "$pc.cx(\"sliderTrack\")",
|
|
2131
|
+
"style.--px-slider-background": "$gradient()"
|
|
2132
|
+
} },
|
|
2133
|
+
providers: [{
|
|
2134
|
+
provide: PARENT_INSTANCE,
|
|
2135
|
+
useExisting: InputColorSliderTrack
|
|
2136
|
+
}],
|
|
2137
|
+
usesInheritance: true,
|
|
2138
|
+
hostDirectives: [{ directive: i1$1.Bind }],
|
|
2139
|
+
ngImport: i0,
|
|
2140
|
+
template: `<ng-content></ng-content>`,
|
|
2141
|
+
isInline: true,
|
|
2142
|
+
changeDetection: i0.ChangeDetectionStrategy.OnPush,
|
|
2143
|
+
encapsulation: i0.ViewEncapsulation.None
|
|
2144
|
+
});
|
|
2145
|
+
};
|
|
2146
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
2147
|
+
minVersion: "12.0.0",
|
|
2148
|
+
version: "22.2.0",
|
|
2149
|
+
ngImport: i0,
|
|
2150
|
+
type: InputColorSliderTrack,
|
|
2151
|
+
decorators: [{
|
|
2152
|
+
type: Component,
|
|
2153
|
+
args: [{
|
|
2154
|
+
selector: "p-inputcolor-slider-track",
|
|
2155
|
+
standalone: true,
|
|
2156
|
+
template: `<ng-content></ng-content>`,
|
|
2157
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
2158
|
+
encapsulation: ViewEncapsulation.None,
|
|
2159
|
+
host: {
|
|
2160
|
+
"[class]": "$pc.cx(\"sliderTrack\")",
|
|
2161
|
+
"[style.--px-slider-background]": "$gradient()"
|
|
2162
|
+
},
|
|
2163
|
+
providers: [{
|
|
2164
|
+
provide: PARENT_INSTANCE,
|
|
2165
|
+
useExisting: InputColorSliderTrack
|
|
2166
|
+
}],
|
|
2167
|
+
hostDirectives: [Bind]
|
|
2168
|
+
}]
|
|
2169
|
+
}]
|
|
2170
|
+
});
|
|
2171
|
+
var InputColorSwatch = class InputColorSwatch extends BaseComponent {
|
|
2172
|
+
componentName = "InputColorSwatch";
|
|
2173
|
+
bindDirectiveInstance = inject(Bind, { self: true });
|
|
2174
|
+
$pc = inject(INPUT_COLOR_INSTANCE);
|
|
2175
|
+
onAfterViewChecked() {
|
|
2176
|
+
this.bindDirectiveInstance.setAttrs(this.ptms(["host", "root"]));
|
|
2177
|
+
}
|
|
2178
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
2179
|
+
minVersion: "12.0.0",
|
|
2180
|
+
version: "22.2.0",
|
|
2181
|
+
ngImport: i0,
|
|
2182
|
+
type: InputColorSwatch,
|
|
2183
|
+
deps: null,
|
|
2184
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
2185
|
+
});
|
|
2186
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
2187
|
+
minVersion: "14.0.0",
|
|
2188
|
+
version: "22.2.0",
|
|
2189
|
+
type: InputColorSwatch,
|
|
2190
|
+
isStandalone: true,
|
|
2191
|
+
selector: "p-inputcolor-swatch",
|
|
2192
|
+
host: { properties: { "class": "$pc.cx(\"swatch\")" } },
|
|
2193
|
+
providers: [{
|
|
2194
|
+
provide: PARENT_INSTANCE,
|
|
2195
|
+
useExisting: InputColorSwatch
|
|
2196
|
+
}],
|
|
2197
|
+
usesInheritance: true,
|
|
2198
|
+
hostDirectives: [{ directive: i1$1.Bind }],
|
|
2199
|
+
ngImport: i0,
|
|
2200
|
+
template: `<ng-content></ng-content>`,
|
|
2201
|
+
isInline: true,
|
|
2202
|
+
changeDetection: i0.ChangeDetectionStrategy.OnPush,
|
|
2203
|
+
encapsulation: i0.ViewEncapsulation.None
|
|
2204
|
+
});
|
|
2205
|
+
};
|
|
2206
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
2207
|
+
minVersion: "12.0.0",
|
|
2208
|
+
version: "22.2.0",
|
|
2209
|
+
ngImport: i0,
|
|
2210
|
+
type: InputColorSwatch,
|
|
2211
|
+
decorators: [{
|
|
2212
|
+
type: Component,
|
|
2213
|
+
args: [{
|
|
2214
|
+
selector: "p-inputcolor-swatch",
|
|
2215
|
+
standalone: true,
|
|
2216
|
+
template: `<ng-content></ng-content>`,
|
|
2217
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
2218
|
+
encapsulation: ViewEncapsulation.None,
|
|
2219
|
+
host: { "[class]": "$pc.cx(\"swatch\")" },
|
|
2220
|
+
providers: [{
|
|
2221
|
+
provide: PARENT_INSTANCE,
|
|
2222
|
+
useExisting: InputColorSwatch
|
|
2223
|
+
}],
|
|
2224
|
+
hostDirectives: [Bind]
|
|
2225
|
+
}]
|
|
2226
|
+
}]
|
|
2227
|
+
});
|
|
2228
|
+
var InputColorSwatchBackground = class InputColorSwatchBackground extends BaseComponent {
|
|
2229
|
+
componentName = "InputColorSwatchBackground";
|
|
2230
|
+
bindDirectiveInstance = inject(Bind, { self: true });
|
|
2231
|
+
$pc = inject(INPUT_COLOR_INSTANCE);
|
|
2232
|
+
$swatchColor = computed(() => this.$pc.$color().toRgbString(), ...ngDevMode ? [{ debugName: "$swatchColor" }] : /* istanbul ignore next */ []);
|
|
2233
|
+
onAfterViewChecked() {
|
|
2234
|
+
this.bindDirectiveInstance.setAttrs(this.ptms(["host", "root"]));
|
|
2235
|
+
}
|
|
2236
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
2237
|
+
minVersion: "12.0.0",
|
|
2238
|
+
version: "22.2.0",
|
|
2239
|
+
ngImport: i0,
|
|
2240
|
+
type: InputColorSwatchBackground,
|
|
2241
|
+
deps: null,
|
|
2242
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
2243
|
+
});
|
|
2244
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
2245
|
+
minVersion: "14.0.0",
|
|
2246
|
+
version: "22.2.0",
|
|
2247
|
+
type: InputColorSwatchBackground,
|
|
2248
|
+
isStandalone: true,
|
|
2249
|
+
selector: "p-inputcolor-swatch-background",
|
|
2250
|
+
host: { properties: {
|
|
2251
|
+
"class": "$pc.cx(\"swatchBackground\")",
|
|
2252
|
+
"style.--px-swatch-background": "$swatchColor()"
|
|
2253
|
+
} },
|
|
2254
|
+
providers: [{
|
|
2255
|
+
provide: PARENT_INSTANCE,
|
|
2256
|
+
useExisting: InputColorSwatchBackground
|
|
2257
|
+
}],
|
|
2258
|
+
usesInheritance: true,
|
|
2259
|
+
hostDirectives: [{ directive: i1$1.Bind }],
|
|
2260
|
+
ngImport: i0,
|
|
2261
|
+
template: `<ng-content></ng-content>`,
|
|
2262
|
+
isInline: true,
|
|
2263
|
+
changeDetection: i0.ChangeDetectionStrategy.OnPush,
|
|
2264
|
+
encapsulation: i0.ViewEncapsulation.None
|
|
2265
|
+
});
|
|
2266
|
+
};
|
|
2267
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
2268
|
+
minVersion: "12.0.0",
|
|
2269
|
+
version: "22.2.0",
|
|
2270
|
+
ngImport: i0,
|
|
2271
|
+
type: InputColorSwatchBackground,
|
|
2272
|
+
decorators: [{
|
|
2273
|
+
type: Component,
|
|
2274
|
+
args: [{
|
|
2275
|
+
selector: "p-inputcolor-swatch-background",
|
|
2276
|
+
standalone: true,
|
|
2277
|
+
template: `<ng-content></ng-content>`,
|
|
2278
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
2279
|
+
encapsulation: ViewEncapsulation.None,
|
|
2280
|
+
host: {
|
|
2281
|
+
"[class]": "$pc.cx(\"swatchBackground\")",
|
|
2282
|
+
"[style.--px-swatch-background]": "$swatchColor()"
|
|
2283
|
+
},
|
|
2284
|
+
providers: [{
|
|
2285
|
+
provide: PARENT_INSTANCE,
|
|
2286
|
+
useExisting: InputColorSwatchBackground
|
|
2287
|
+
}],
|
|
2288
|
+
hostDirectives: [Bind]
|
|
2289
|
+
}]
|
|
2290
|
+
}]
|
|
2291
|
+
});
|
|
2292
|
+
var InputColorTransparencyGrid = class InputColorTransparencyGrid extends BaseComponent {
|
|
2293
|
+
componentName = "InputColorTransparencyGrid";
|
|
2294
|
+
bindDirectiveInstance = inject(Bind, { self: true });
|
|
2295
|
+
$pc = inject(INPUT_COLOR_INSTANCE);
|
|
2296
|
+
onAfterViewChecked() {
|
|
2297
|
+
this.bindDirectiveInstance.setAttrs(this.ptms(["host", "root"]));
|
|
2298
|
+
}
|
|
2299
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
2300
|
+
minVersion: "12.0.0",
|
|
2301
|
+
version: "22.2.0",
|
|
2302
|
+
ngImport: i0,
|
|
2303
|
+
type: InputColorTransparencyGrid,
|
|
2304
|
+
deps: null,
|
|
2305
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
2306
|
+
});
|
|
2307
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
2308
|
+
minVersion: "14.0.0",
|
|
2309
|
+
version: "22.2.0",
|
|
2310
|
+
type: InputColorTransparencyGrid,
|
|
2311
|
+
isStandalone: true,
|
|
2312
|
+
selector: "p-inputcolor-transparency-grid",
|
|
2313
|
+
host: { properties: { "class": "$pc.cx(\"transparencyGrid\")" } },
|
|
2314
|
+
providers: [{
|
|
2315
|
+
provide: PARENT_INSTANCE,
|
|
2316
|
+
useExisting: InputColorTransparencyGrid
|
|
2317
|
+
}],
|
|
2318
|
+
usesInheritance: true,
|
|
2319
|
+
hostDirectives: [{ directive: i1$1.Bind }],
|
|
2320
|
+
ngImport: i0,
|
|
2321
|
+
template: `<ng-content></ng-content>`,
|
|
2322
|
+
isInline: true,
|
|
2323
|
+
changeDetection: i0.ChangeDetectionStrategy.OnPush,
|
|
2324
|
+
encapsulation: i0.ViewEncapsulation.None
|
|
2325
|
+
});
|
|
2326
|
+
};
|
|
2327
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
2328
|
+
minVersion: "12.0.0",
|
|
2329
|
+
version: "22.2.0",
|
|
2330
|
+
ngImport: i0,
|
|
2331
|
+
type: InputColorTransparencyGrid,
|
|
2332
|
+
decorators: [{
|
|
2333
|
+
type: Component,
|
|
2334
|
+
args: [{
|
|
2335
|
+
selector: "p-inputcolor-transparency-grid",
|
|
2336
|
+
standalone: true,
|
|
2337
|
+
template: `<ng-content></ng-content>`,
|
|
2338
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
2339
|
+
encapsulation: ViewEncapsulation.None,
|
|
2340
|
+
host: { "[class]": "$pc.cx(\"transparencyGrid\")" },
|
|
2341
|
+
providers: [{
|
|
2342
|
+
provide: PARENT_INSTANCE,
|
|
2343
|
+
useExisting: InputColorTransparencyGrid
|
|
2344
|
+
}],
|
|
2345
|
+
hostDirectives: [Bind]
|
|
2346
|
+
}]
|
|
2347
|
+
}]
|
|
2348
|
+
});
|
|
1962
2349
|
const classes = {
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
2350
|
+
root: "p-inputcolor p-component",
|
|
2351
|
+
area: "p-inputcolor-area",
|
|
2352
|
+
areaHandle: ({ instance }) => ["p-inputcolor-area-handle", { "p-disabled": instance.$disabled() }],
|
|
2353
|
+
areaBackground: "p-inputcolor-area-background",
|
|
2354
|
+
slider: "p-inputcolor-slider",
|
|
2355
|
+
sliderHandle: ({ instance }) => ["p-inputcolor-slider-handle", { "p-disabled": instance.$disabled() }],
|
|
2356
|
+
sliderTrack: "p-inputcolor-slider-track",
|
|
2357
|
+
transparencyGrid: "p-inputcolor-transparency-grid",
|
|
2358
|
+
swatch: "p-inputcolor-swatch",
|
|
2359
|
+
swatchBackground: "p-inputcolor-swatch-background",
|
|
2360
|
+
eyeDropper: "p-inputcolor-eyedropper"
|
|
1974
2361
|
};
|
|
1975
|
-
class InputColorStyle extends BaseStyle {
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
2362
|
+
var InputColorStyle = class InputColorStyle extends BaseStyle {
|
|
2363
|
+
name = "inputcolor";
|
|
2364
|
+
style = style;
|
|
2365
|
+
classes = classes;
|
|
2366
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
2367
|
+
minVersion: "12.0.0",
|
|
2368
|
+
version: "22.2.0",
|
|
2369
|
+
ngImport: i0,
|
|
2370
|
+
type: InputColorStyle,
|
|
2371
|
+
deps: null,
|
|
2372
|
+
target: i0.ɵɵFactoryTarget.Injectable
|
|
2373
|
+
});
|
|
2374
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({
|
|
2375
|
+
minVersion: "12.0.0",
|
|
2376
|
+
version: "22.2.0",
|
|
2377
|
+
ngImport: i0,
|
|
2378
|
+
type: InputColorStyle
|
|
2379
|
+
});
|
|
2380
|
+
};
|
|
2381
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
2382
|
+
minVersion: "12.0.0",
|
|
2383
|
+
version: "22.2.0",
|
|
2384
|
+
ngImport: i0,
|
|
2385
|
+
type: InputColorStyle,
|
|
2386
|
+
decorators: [{ type: Injectable }]
|
|
2387
|
+
});
|
|
1994
2388
|
var InputColorClasses;
|
|
1995
|
-
(function
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
/**
|
|
2009
|
-
* Class name of the area handle element
|
|
2010
|
-
*/
|
|
2011
|
-
InputColorClasses["areaHandle"] = "p-inputcolor-area-handle";
|
|
2012
|
-
/**
|
|
2013
|
-
* Class name of the slider element
|
|
2014
|
-
*/
|
|
2015
|
-
InputColorClasses["slider"] = "p-inputcolor-slider";
|
|
2016
|
-
/**
|
|
2017
|
-
* Class name of the slider track element
|
|
2018
|
-
*/
|
|
2019
|
-
InputColorClasses["sliderTrack"] = "p-inputcolor-slider-track";
|
|
2020
|
-
/**
|
|
2021
|
-
* Class name of the slider handle element
|
|
2022
|
-
*/
|
|
2023
|
-
InputColorClasses["sliderHandle"] = "p-inputcolor-slider-handle";
|
|
2024
|
-
/**
|
|
2025
|
-
* Class name of the swatch element
|
|
2026
|
-
*/
|
|
2027
|
-
InputColorClasses["swatch"] = "p-inputcolor-swatch";
|
|
2028
|
-
/**
|
|
2029
|
-
* Class name of the swatch background element
|
|
2030
|
-
*/
|
|
2031
|
-
InputColorClasses["swatchBackground"] = "p-inputcolor-swatch-background";
|
|
2032
|
-
/**
|
|
2033
|
-
* Class name of the transparency grid element
|
|
2034
|
-
*/
|
|
2035
|
-
InputColorClasses["transparencyGrid"] = "p-inputcolor-transparency-grid";
|
|
2036
|
-
/**
|
|
2037
|
-
* Class name of the input element
|
|
2038
|
-
*/
|
|
2039
|
-
InputColorClasses["input"] = "p-inputcolor-input";
|
|
2040
|
-
/**
|
|
2041
|
-
* Class name of the eye dropper element
|
|
2042
|
-
*/
|
|
2043
|
-
InputColorClasses["eyeDropper"] = "p-inputcolor-eyedropper";
|
|
2389
|
+
(function(InputColorClasses) {
|
|
2390
|
+
InputColorClasses["root"] = "p-inputcolor";
|
|
2391
|
+
InputColorClasses["area"] = "p-inputcolor-area";
|
|
2392
|
+
InputColorClasses["areaBackground"] = "p-inputcolor-area-background";
|
|
2393
|
+
InputColorClasses["areaHandle"] = "p-inputcolor-area-handle";
|
|
2394
|
+
InputColorClasses["slider"] = "p-inputcolor-slider";
|
|
2395
|
+
InputColorClasses["sliderTrack"] = "p-inputcolor-slider-track";
|
|
2396
|
+
InputColorClasses["sliderHandle"] = "p-inputcolor-slider-handle";
|
|
2397
|
+
InputColorClasses["swatch"] = "p-inputcolor-swatch";
|
|
2398
|
+
InputColorClasses["swatchBackground"] = "p-inputcolor-swatch-background";
|
|
2399
|
+
InputColorClasses["transparencyGrid"] = "p-inputcolor-transparency-grid";
|
|
2400
|
+
InputColorClasses["input"] = "p-inputcolor-input";
|
|
2401
|
+
InputColorClasses["eyeDropper"] = "p-inputcolor-eyedropper";
|
|
2044
2402
|
})(InputColorClasses || (InputColorClasses = {}));
|
|
2045
|
-
|
|
2046
2403
|
const INPUT_COLOR_VALUE_ACCESSOR = {
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
|
|
2404
|
+
provide: NG_VALUE_ACCESSOR,
|
|
2405
|
+
useExisting: forwardRef(() => InputColor),
|
|
2406
|
+
multi: true
|
|
2050
2407
|
};
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
|
|
2180
|
-
|
|
2181
|
-
|
|
2182
|
-
|
|
2183
|
-
}
|
|
2184
|
-
|
|
2185
|
-
|
|
2186
|
-
|
|
2187
|
-
|
|
2188
|
-
|
|
2189
|
-
|
|
2190
|
-
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
|
|
2214
|
-
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
|
|
2221
|
-
|
|
2222
|
-
|
|
2223
|
-
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
|
|
2231
|
-
|
|
2232
|
-
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
|
|
2250
|
-
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
|
|
2265
|
-
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
|
|
2408
|
+
var InputColor = class InputColor extends BaseComponent {
|
|
2409
|
+
componentName = "InputColor";
|
|
2410
|
+
bindDirectiveInstance = inject(Bind, { self: true });
|
|
2411
|
+
_componentStyle = inject(InputColorStyle);
|
|
2412
|
+
format = input("hsba", ...ngDevMode ? [{ debugName: "format" }] : /* istanbul ignore next */ []);
|
|
2413
|
+
disabled = input(false, {
|
|
2414
|
+
...ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {},
|
|
2415
|
+
transform: booleanAttribute
|
|
2416
|
+
});
|
|
2417
|
+
_disabled = signal(false, ...ngDevMode ? [{ debugName: "_disabled" }] : /* istanbul ignore next */ []);
|
|
2418
|
+
$disabled = computed(() => this.disabled() || this._disabled(), ...ngDevMode ? [{ debugName: "$disabled" }] : /* istanbul ignore next */ []);
|
|
2419
|
+
onValueChange = output();
|
|
2420
|
+
onValueChangeEnd = output();
|
|
2421
|
+
_color = signal(null, ...ngDevMode ? [{ debugName: "_color" }] : /* istanbul ignore next */ []);
|
|
2422
|
+
$color = computed(() => this._color() || parseColor("#ff0000").toFormat(this.format()), ...ngDevMode ? [{ debugName: "$color" }] : /* istanbul ignore next */ []);
|
|
2423
|
+
$axes = computed(() => getDefault2DAxes(this.format()), ...ngDevMode ? [{ debugName: "$axes" }] : /* istanbul ignore next */ []);
|
|
2424
|
+
onAfterViewChecked() {
|
|
2425
|
+
this.bindDirectiveInstance.setAttrs(this.ptms(["host", "root"]));
|
|
2426
|
+
}
|
|
2427
|
+
updateColor(color, event, isEnd = false) {
|
|
2428
|
+
this._color.set(color);
|
|
2429
|
+
const outputValue = color.toString(this.format());
|
|
2430
|
+
this.onModelChange(outputValue);
|
|
2431
|
+
this.onValueChange.emit({
|
|
2432
|
+
color,
|
|
2433
|
+
originalEvent: event
|
|
2434
|
+
});
|
|
2435
|
+
if (isEnd) {
|
|
2436
|
+
this.onValueChangeEnd.emit({
|
|
2437
|
+
color,
|
|
2438
|
+
originalEvent: event
|
|
2439
|
+
});
|
|
2440
|
+
this.onModelTouched();
|
|
2441
|
+
}
|
|
2442
|
+
}
|
|
2443
|
+
setChannelValue(channel, value, event, isEnd = false) {
|
|
2444
|
+
const newColor = this.toChannelNativeFormat(this.$color(), channel).setChannelValue(channel, value);
|
|
2445
|
+
this.updateColor(newColor, event, isEnd);
|
|
2446
|
+
}
|
|
2447
|
+
onModelChange = () => {};
|
|
2448
|
+
onModelTouched = () => {};
|
|
2449
|
+
registerOnChange(fn) {
|
|
2450
|
+
this.onModelChange = fn;
|
|
2451
|
+
}
|
|
2452
|
+
registerOnTouched(fn) {
|
|
2453
|
+
this.onModelTouched = fn;
|
|
2454
|
+
}
|
|
2455
|
+
setDisabledState(val) {
|
|
2456
|
+
this._disabled.set(val);
|
|
2457
|
+
}
|
|
2458
|
+
writeValue(value) {
|
|
2459
|
+
if (value) {
|
|
2460
|
+
const current = this._color();
|
|
2461
|
+
if (current && current.toString(this.format()) === value) return;
|
|
2462
|
+
const parsed = parseColor(value);
|
|
2463
|
+
if (parsed) this._color.set(parsed.toFormat(this.format()));
|
|
2464
|
+
} else this._color.set(null);
|
|
2465
|
+
}
|
|
2466
|
+
toChannelNativeFormat(color, channel) {
|
|
2467
|
+
if (color instanceof HSBColor && (channel === "hue" || channel === "saturation" || channel === "brightness")) return color;
|
|
2468
|
+
if (color instanceof HSLColor && (channel === "hue" || channel === "saturation" || channel === "lightness")) return color;
|
|
2469
|
+
if (color instanceof RGBColor && (channel === "red" || channel === "green" || channel === "blue")) return color;
|
|
2470
|
+
if (color instanceof OKLCHColor && (channel === "oklchLightness" || channel === "oklchChroma" || channel === "oklchHue" || channel === "L" || channel === "C" || channel === "H")) return color;
|
|
2471
|
+
switch (channel) {
|
|
2472
|
+
case "hue":
|
|
2473
|
+
case "saturation":
|
|
2474
|
+
case "brightness": return color.toHSB();
|
|
2475
|
+
case "lightness": return color.toHSL();
|
|
2476
|
+
case "red":
|
|
2477
|
+
case "green":
|
|
2478
|
+
case "blue": return color.toRGB();
|
|
2479
|
+
case "oklchLightness":
|
|
2480
|
+
case "oklchChroma":
|
|
2481
|
+
case "oklchHue":
|
|
2482
|
+
case "L":
|
|
2483
|
+
case "C":
|
|
2484
|
+
case "H": return color.toOKLCH();
|
|
2485
|
+
default: return color;
|
|
2486
|
+
}
|
|
2487
|
+
}
|
|
2488
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
2489
|
+
minVersion: "12.0.0",
|
|
2490
|
+
version: "22.2.0",
|
|
2491
|
+
ngImport: i0,
|
|
2492
|
+
type: InputColor,
|
|
2493
|
+
deps: null,
|
|
2494
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
2495
|
+
});
|
|
2496
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
2497
|
+
minVersion: "17.1.0",
|
|
2498
|
+
version: "22.2.0",
|
|
2499
|
+
type: InputColor,
|
|
2500
|
+
isStandalone: true,
|
|
2501
|
+
selector: "p-inputcolor, p-input-color",
|
|
2502
|
+
inputs: {
|
|
2503
|
+
format: {
|
|
2504
|
+
classPropertyName: "format",
|
|
2505
|
+
publicName: "format",
|
|
2506
|
+
isSignal: true,
|
|
2507
|
+
isRequired: false,
|
|
2508
|
+
transformFunction: null
|
|
2509
|
+
},
|
|
2510
|
+
disabled: {
|
|
2511
|
+
classPropertyName: "disabled",
|
|
2512
|
+
publicName: "disabled",
|
|
2513
|
+
isSignal: true,
|
|
2514
|
+
isRequired: false,
|
|
2515
|
+
transformFunction: null
|
|
2516
|
+
}
|
|
2517
|
+
},
|
|
2518
|
+
outputs: {
|
|
2519
|
+
onValueChange: "onValueChange",
|
|
2520
|
+
onValueChangeEnd: "onValueChangeEnd"
|
|
2521
|
+
},
|
|
2522
|
+
host: { properties: {
|
|
2523
|
+
"attr.data-pc-name": "'inputcolor'",
|
|
2524
|
+
"attr.data-pc-section": "'root'",
|
|
2525
|
+
"class": "cx('root')"
|
|
2526
|
+
} },
|
|
2527
|
+
providers: [
|
|
2528
|
+
INPUT_COLOR_VALUE_ACCESSOR,
|
|
2529
|
+
InputColorStyle,
|
|
2530
|
+
{
|
|
2531
|
+
provide: INPUT_COLOR_INSTANCE,
|
|
2532
|
+
useExisting: InputColor
|
|
2533
|
+
},
|
|
2534
|
+
{
|
|
2535
|
+
provide: PARENT_INSTANCE,
|
|
2536
|
+
useExisting: InputColor
|
|
2537
|
+
}
|
|
2538
|
+
],
|
|
2539
|
+
usesInheritance: true,
|
|
2540
|
+
hostDirectives: [{ directive: i1$1.Bind }],
|
|
2541
|
+
ngImport: i0,
|
|
2542
|
+
template: `<ng-content></ng-content>`,
|
|
2543
|
+
isInline: true,
|
|
2544
|
+
dependencies: [{
|
|
2545
|
+
kind: "ngmodule",
|
|
2546
|
+
type: SharedModule
|
|
2547
|
+
}],
|
|
2548
|
+
changeDetection: i0.ChangeDetectionStrategy.OnPush,
|
|
2549
|
+
encapsulation: i0.ViewEncapsulation.None
|
|
2550
|
+
});
|
|
2551
|
+
};
|
|
2552
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
2553
|
+
minVersion: "12.0.0",
|
|
2554
|
+
version: "22.2.0",
|
|
2555
|
+
ngImport: i0,
|
|
2556
|
+
type: InputColor,
|
|
2557
|
+
decorators: [{
|
|
2558
|
+
type: Component,
|
|
2559
|
+
args: [{
|
|
2560
|
+
selector: "p-inputcolor, p-input-color",
|
|
2561
|
+
standalone: true,
|
|
2562
|
+
imports: [SharedModule],
|
|
2563
|
+
template: `<ng-content></ng-content>`,
|
|
2564
|
+
providers: [
|
|
2565
|
+
INPUT_COLOR_VALUE_ACCESSOR,
|
|
2566
|
+
InputColorStyle,
|
|
2567
|
+
{
|
|
2568
|
+
provide: INPUT_COLOR_INSTANCE,
|
|
2569
|
+
useExisting: InputColor
|
|
2570
|
+
},
|
|
2571
|
+
{
|
|
2572
|
+
provide: PARENT_INSTANCE,
|
|
2573
|
+
useExisting: InputColor
|
|
2574
|
+
}
|
|
2575
|
+
],
|
|
2576
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
2577
|
+
encapsulation: ViewEncapsulation.None,
|
|
2578
|
+
host: {
|
|
2579
|
+
"[attr.data-pc-name]": "'inputcolor'",
|
|
2580
|
+
"[attr.data-pc-section]": "'root'",
|
|
2581
|
+
"[class]": "cx('root')"
|
|
2582
|
+
},
|
|
2583
|
+
hostDirectives: [Bind]
|
|
2584
|
+
}]
|
|
2585
|
+
}],
|
|
2586
|
+
propDecorators: {
|
|
2587
|
+
format: [{
|
|
2588
|
+
type: i0.Input,
|
|
2589
|
+
args: [{
|
|
2590
|
+
isSignal: true,
|
|
2591
|
+
alias: "format",
|
|
2592
|
+
required: false
|
|
2593
|
+
}]
|
|
2594
|
+
}],
|
|
2595
|
+
disabled: [{
|
|
2596
|
+
type: i0.Input,
|
|
2597
|
+
args: [{
|
|
2598
|
+
isSignal: true,
|
|
2599
|
+
alias: "disabled",
|
|
2600
|
+
required: false
|
|
2601
|
+
}]
|
|
2602
|
+
}],
|
|
2603
|
+
onValueChange: [{
|
|
2604
|
+
type: i0.Output,
|
|
2605
|
+
args: ["onValueChange"]
|
|
2606
|
+
}],
|
|
2607
|
+
onValueChangeEnd: [{
|
|
2608
|
+
type: i0.Output,
|
|
2609
|
+
args: ["onValueChangeEnd"]
|
|
2610
|
+
}]
|
|
2611
|
+
}
|
|
2612
|
+
});
|
|
2613
|
+
var InputColorModule = class InputColorModule {
|
|
2614
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
2615
|
+
minVersion: "12.0.0",
|
|
2616
|
+
version: "22.2.0",
|
|
2617
|
+
ngImport: i0,
|
|
2618
|
+
type: InputColorModule,
|
|
2619
|
+
deps: [],
|
|
2620
|
+
target: i0.ɵɵFactoryTarget.NgModule
|
|
2621
|
+
});
|
|
2622
|
+
static ɵmod = i0.ɵɵngDeclareNgModule({
|
|
2623
|
+
minVersion: "14.0.0",
|
|
2624
|
+
version: "22.2.0",
|
|
2625
|
+
ngImport: i0,
|
|
2626
|
+
type: InputColorModule,
|
|
2627
|
+
imports: [
|
|
2628
|
+
InputColor,
|
|
2629
|
+
InputColorArea,
|
|
2630
|
+
InputColorAreaHandle,
|
|
2631
|
+
InputColorAreaBackground,
|
|
2632
|
+
InputColorSlider,
|
|
2633
|
+
InputColorSliderHandle,
|
|
2634
|
+
InputColorSliderTrack,
|
|
2635
|
+
InputColorSwatch,
|
|
2636
|
+
InputColorSwatchBackground,
|
|
2637
|
+
InputColorTransparencyGrid,
|
|
2638
|
+
InputColorInput,
|
|
2639
|
+
InputColorEyeDropper,
|
|
2640
|
+
SharedModule
|
|
2641
|
+
],
|
|
2642
|
+
exports: [
|
|
2643
|
+
InputColor,
|
|
2644
|
+
InputColorArea,
|
|
2645
|
+
InputColorAreaHandle,
|
|
2646
|
+
InputColorAreaBackground,
|
|
2647
|
+
InputColorSlider,
|
|
2648
|
+
InputColorSliderHandle,
|
|
2649
|
+
InputColorSliderTrack,
|
|
2650
|
+
InputColorSwatch,
|
|
2651
|
+
InputColorSwatchBackground,
|
|
2652
|
+
InputColorTransparencyGrid,
|
|
2653
|
+
InputColorInput,
|
|
2654
|
+
InputColorEyeDropper,
|
|
2655
|
+
SharedModule
|
|
2656
|
+
]
|
|
2657
|
+
});
|
|
2658
|
+
static ɵinj = i0.ɵɵngDeclareInjector({
|
|
2659
|
+
minVersion: "12.0.0",
|
|
2660
|
+
version: "22.2.0",
|
|
2661
|
+
ngImport: i0,
|
|
2662
|
+
type: InputColorModule,
|
|
2663
|
+
imports: [
|
|
2664
|
+
InputColor,
|
|
2665
|
+
SharedModule,
|
|
2666
|
+
SharedModule
|
|
2667
|
+
]
|
|
2668
|
+
});
|
|
2669
|
+
};
|
|
2670
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
2671
|
+
minVersion: "12.0.0",
|
|
2672
|
+
version: "22.2.0",
|
|
2673
|
+
ngImport: i0,
|
|
2674
|
+
type: InputColorModule,
|
|
2675
|
+
decorators: [{
|
|
2676
|
+
type: NgModule,
|
|
2677
|
+
args: [{
|
|
2678
|
+
imports: [
|
|
2679
|
+
InputColor,
|
|
2680
|
+
InputColorArea,
|
|
2681
|
+
InputColorAreaHandle,
|
|
2682
|
+
InputColorAreaBackground,
|
|
2683
|
+
InputColorSlider,
|
|
2684
|
+
InputColorSliderHandle,
|
|
2685
|
+
InputColorSliderTrack,
|
|
2686
|
+
InputColorSwatch,
|
|
2687
|
+
InputColorSwatchBackground,
|
|
2688
|
+
InputColorTransparencyGrid,
|
|
2689
|
+
InputColorInput,
|
|
2690
|
+
InputColorEyeDropper,
|
|
2691
|
+
SharedModule
|
|
2692
|
+
],
|
|
2693
|
+
exports: [
|
|
2694
|
+
InputColor,
|
|
2695
|
+
InputColorArea,
|
|
2696
|
+
InputColorAreaHandle,
|
|
2697
|
+
InputColorAreaBackground,
|
|
2698
|
+
InputColorSlider,
|
|
2699
|
+
InputColorSliderHandle,
|
|
2700
|
+
InputColorSliderTrack,
|
|
2701
|
+
InputColorSwatch,
|
|
2702
|
+
InputColorSwatchBackground,
|
|
2703
|
+
InputColorTransparencyGrid,
|
|
2704
|
+
InputColorInput,
|
|
2705
|
+
InputColorEyeDropper,
|
|
2706
|
+
SharedModule
|
|
2707
|
+
]
|
|
2708
|
+
}]
|
|
2709
|
+
}]
|
|
2710
|
+
});
|
|
2270
2711
|
export { Color, HSBColor, HSLColor, INPUT_COLOR_INSTANCE, INPUT_COLOR_SLIDER_INSTANCE, INPUT_COLOR_VALUE_ACCESSOR, InputColor, InputColorArea, InputColorAreaBackground, InputColorAreaHandle, InputColorClasses, InputColorEyeDropper, InputColorInput, InputColorModule, InputColorSlider, InputColorSliderHandle, InputColorSliderTrack, InputColorStyle, InputColorSwatch, InputColorSwatchBackground, InputColorTransparencyGrid, OKLCHColor, RGBColor, getAreaGradient, getChannelColor, getChannelGradient, getChannelRange, getDefault2DAxes, getDefault3DAxes, getInputChannelRange, getInputChannelValue, parseColor, snapValue };
|
|
2271
|
-
|
|
2712
|
+
|
|
2713
|
+
//# sourceMappingURL=primeng-inputcolor.mjs.map
|