@fragiola/primitives-angular 0.0.0-stage → 0.1.0
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/CHANGELOG.md +67 -0
- package/LICENSE +21 -0
- package/README.md +54 -2
- package/fesm2022/fragiola-primitives-angular-accordion.mjs +567 -0
- package/fesm2022/fragiola-primitives-angular-accordion.mjs.map +1 -0
- package/fesm2022/fragiola-primitives-angular-alert-dialog.mjs +562 -0
- package/fesm2022/fragiola-primitives-angular-alert-dialog.mjs.map +1 -0
- package/fesm2022/fragiola-primitives-angular-aspect-ratio.mjs +79 -0
- package/fesm2022/fragiola-primitives-angular-aspect-ratio.mjs.map +1 -0
- package/fesm2022/fragiola-primitives-angular-async-list.mjs +44 -0
- package/fesm2022/fragiola-primitives-angular-async-list.mjs.map +1 -0
- package/fesm2022/fragiola-primitives-angular-autocomplete-virtual.mjs +243 -0
- package/fesm2022/fragiola-primitives-angular-autocomplete-virtual.mjs.map +1 -0
- package/fesm2022/fragiola-primitives-angular-autocomplete.mjs +1751 -0
- package/fesm2022/fragiola-primitives-angular-autocomplete.mjs.map +1 -0
- package/fesm2022/fragiola-primitives-angular-avatar.mjs +308 -0
- package/fesm2022/fragiola-primitives-angular-avatar.mjs.map +1 -0
- package/fesm2022/fragiola-primitives-angular-breadcrumbs.mjs +355 -0
- package/fesm2022/fragiola-primitives-angular-breadcrumbs.mjs.map +1 -0
- package/fesm2022/fragiola-primitives-angular-button.mjs +156 -0
- package/fesm2022/fragiola-primitives-angular-button.mjs.map +1 -0
- package/fesm2022/fragiola-primitives-angular-calendar-preset.mjs +126 -0
- package/fesm2022/fragiola-primitives-angular-calendar-preset.mjs.map +1 -0
- package/fesm2022/fragiola-primitives-angular-calendar-view.mjs +289 -0
- package/fesm2022/fragiola-primitives-angular-calendar-view.mjs.map +1 -0
- package/fesm2022/fragiola-primitives-angular-calendar.mjs +1222 -0
- package/fesm2022/fragiola-primitives-angular-calendar.mjs.map +1 -0
- package/fesm2022/fragiola-primitives-angular-carousel.mjs +1031 -0
- package/fesm2022/fragiola-primitives-angular-carousel.mjs.map +1 -0
- package/fesm2022/fragiola-primitives-angular-cascade-select.mjs +1391 -0
- package/fesm2022/fragiola-primitives-angular-cascade-select.mjs.map +1 -0
- package/fesm2022/fragiola-primitives-angular-checkbox-group.mjs +221 -0
- package/fesm2022/fragiola-primitives-angular-checkbox-group.mjs.map +1 -0
- package/fesm2022/fragiola-primitives-angular-checkbox.mjs +474 -0
- package/fesm2022/fragiola-primitives-angular-checkbox.mjs.map +1 -0
- package/fesm2022/fragiola-primitives-angular-clipboard.mjs +389 -0
- package/fesm2022/fragiola-primitives-angular-clipboard.mjs.map +1 -0
- package/fesm2022/fragiola-primitives-angular-collapsible.mjs +314 -0
- package/fesm2022/fragiola-primitives-angular-collapsible.mjs.map +1 -0
- package/fesm2022/fragiola-primitives-angular-color-area.mjs +609 -0
- package/fesm2022/fragiola-primitives-angular-color-area.mjs.map +1 -0
- package/fesm2022/fragiola-primitives-angular-color-field.mjs +675 -0
- package/fesm2022/fragiola-primitives-angular-color-field.mjs.map +1 -0
- package/fesm2022/fragiola-primitives-angular-color-picker-popover.mjs +572 -0
- package/fesm2022/fragiola-primitives-angular-color-picker-popover.mjs.map +1 -0
- package/fesm2022/fragiola-primitives-angular-color-picker.mjs +528 -0
- package/fesm2022/fragiola-primitives-angular-color-picker.mjs.map +1 -0
- package/fesm2022/fragiola-primitives-angular-color-slider.mjs +868 -0
- package/fesm2022/fragiola-primitives-angular-color-slider.mjs.map +1 -0
- package/fesm2022/fragiola-primitives-angular-color-swatch-picker.mjs +503 -0
- package/fesm2022/fragiola-primitives-angular-color-swatch-picker.mjs.map +1 -0
- package/fesm2022/fragiola-primitives-angular-color-swatch.mjs +141 -0
- package/fesm2022/fragiola-primitives-angular-color-swatch.mjs.map +1 -0
- package/fesm2022/fragiola-primitives-angular-color-wheel.mjs +554 -0
- package/fesm2022/fragiola-primitives-angular-color-wheel.mjs.map +1 -0
- package/fesm2022/fragiola-primitives-angular-combobox-virtual.mjs +247 -0
- package/fesm2022/fragiola-primitives-angular-combobox-virtual.mjs.map +1 -0
- package/fesm2022/fragiola-primitives-angular-combobox.mjs +2083 -0
- package/fesm2022/fragiola-primitives-angular-combobox.mjs.map +1 -0
- package/fesm2022/fragiola-primitives-angular-command-virtual.mjs +263 -0
- package/fesm2022/fragiola-primitives-angular-command-virtual.mjs.map +1 -0
- package/fesm2022/fragiola-primitives-angular-command.mjs +977 -0
- package/fesm2022/fragiola-primitives-angular-command.mjs.map +1 -0
- package/fesm2022/fragiola-primitives-angular-context-menu.mjs +1012 -0
- package/fesm2022/fragiola-primitives-angular-context-menu.mjs.map +1 -0
- package/fesm2022/fragiola-primitives-angular-date-field.mjs +1030 -0
- package/fesm2022/fragiola-primitives-angular-date-field.mjs.map +1 -0
- package/fesm2022/fragiola-primitives-angular-date-picker-input.mjs +511 -0
- package/fesm2022/fragiola-primitives-angular-date-picker-input.mjs.map +1 -0
- package/fesm2022/fragiola-primitives-angular-date-picker.mjs +991 -0
- package/fesm2022/fragiola-primitives-angular-date-picker.mjs.map +1 -0
- package/fesm2022/fragiola-primitives-angular-date-range-field.mjs +847 -0
- package/fesm2022/fragiola-primitives-angular-date-range-field.mjs.map +1 -0
- package/fesm2022/fragiola-primitives-angular-date-range-picker-input.mjs +260 -0
- package/fesm2022/fragiola-primitives-angular-date-range-picker-input.mjs.map +1 -0
- package/fesm2022/fragiola-primitives-angular-date-range-picker.mjs +128 -0
- package/fesm2022/fragiola-primitives-angular-date-range-picker.mjs.map +1 -0
- package/fesm2022/fragiola-primitives-angular-dialog.mjs +1076 -0
- package/fesm2022/fragiola-primitives-angular-dialog.mjs.map +1 -0
- package/fesm2022/fragiola-primitives-angular-direction.mjs +82 -0
- package/fesm2022/fragiola-primitives-angular-direction.mjs.map +1 -0
- package/fesm2022/fragiola-primitives-angular-drawer.mjs +890 -0
- package/fesm2022/fragiola-primitives-angular-drawer.mjs.map +1 -0
- package/fesm2022/fragiola-primitives-angular-drop-zone.mjs +189 -0
- package/fesm2022/fragiola-primitives-angular-drop-zone.mjs.map +1 -0
- package/fesm2022/fragiola-primitives-angular-editable.mjs +955 -0
- package/fesm2022/fragiola-primitives-angular-editable.mjs.map +1 -0
- package/fesm2022/fragiola-primitives-angular-field.mjs +929 -0
- package/fesm2022/fragiola-primitives-angular-field.mjs.map +1 -0
- package/fesm2022/fragiola-primitives-angular-fieldset.mjs +164 -0
- package/fesm2022/fragiola-primitives-angular-fieldset.mjs.map +1 -0
- package/fesm2022/fragiola-primitives-angular-file-upload.mjs +1370 -0
- package/fesm2022/fragiola-primitives-angular-file-upload.mjs.map +1 -0
- package/fesm2022/fragiola-primitives-angular-form.mjs +162 -0
- package/fesm2022/fragiola-primitives-angular-form.mjs.map +1 -0
- package/fesm2022/fragiola-primitives-angular-hover-card.mjs +906 -0
- package/fesm2022/fragiola-primitives-angular-hover-card.mjs.map +1 -0
- package/fesm2022/fragiola-primitives-angular-internal.mjs +980 -0
- package/fesm2022/fragiola-primitives-angular-internal.mjs.map +1 -0
- package/fesm2022/fragiola-primitives-angular-label.mjs +65 -0
- package/fesm2022/fragiola-primitives-angular-label.mjs.map +1 -0
- package/fesm2022/fragiola-primitives-angular-link.mjs +109 -0
- package/fesm2022/fragiola-primitives-angular-link.mjs.map +1 -0
- package/fesm2022/fragiola-primitives-angular-listbox-virtual.mjs +657 -0
- package/fesm2022/fragiola-primitives-angular-listbox-virtual.mjs.map +1 -0
- package/fesm2022/fragiola-primitives-angular-listbox.mjs +851 -0
- package/fesm2022/fragiola-primitives-angular-listbox.mjs.map +1 -0
- package/fesm2022/fragiola-primitives-angular-menu.mjs +2258 -0
- package/fesm2022/fragiola-primitives-angular-menu.mjs.map +1 -0
- package/fesm2022/fragiola-primitives-angular-menubar.mjs +303 -0
- package/fesm2022/fragiola-primitives-angular-menubar.mjs.map +1 -0
- package/fesm2022/fragiola-primitives-angular-meter.mjs +410 -0
- package/fesm2022/fragiola-primitives-angular-meter.mjs.map +1 -0
- package/fesm2022/fragiola-primitives-angular-month-calendar.mjs +1066 -0
- package/fesm2022/fragiola-primitives-angular-month-calendar.mjs.map +1 -0
- package/fesm2022/fragiola-primitives-angular-month-picker.mjs +514 -0
- package/fesm2022/fragiola-primitives-angular-month-picker.mjs.map +1 -0
- package/fesm2022/fragiola-primitives-angular-month-range-calendar.mjs +163 -0
- package/fesm2022/fragiola-primitives-angular-month-range-calendar.mjs.map +1 -0
- package/fesm2022/fragiola-primitives-angular-month-range-picker.mjs +177 -0
- package/fesm2022/fragiola-primitives-angular-month-range-picker.mjs.map +1 -0
- package/fesm2022/fragiola-primitives-angular-multiple-calendar.mjs +216 -0
- package/fesm2022/fragiola-primitives-angular-multiple-calendar.mjs.map +1 -0
- package/fesm2022/fragiola-primitives-angular-navigation-menu.mjs +1413 -0
- package/fesm2022/fragiola-primitives-angular-navigation-menu.mjs.map +1 -0
- package/fesm2022/fragiola-primitives-angular-number-field.mjs +1210 -0
- package/fesm2022/fragiola-primitives-angular-number-field.mjs.map +1 -0
- package/fesm2022/fragiola-primitives-angular-otp-field.mjs +751 -0
- package/fesm2022/fragiola-primitives-angular-otp-field.mjs.map +1 -0
- package/fesm2022/fragiola-primitives-angular-pagination.mjs +758 -0
- package/fesm2022/fragiola-primitives-angular-pagination.mjs.map +1 -0
- package/fesm2022/fragiola-primitives-angular-password-input.mjs +542 -0
- package/fesm2022/fragiola-primitives-angular-password-input.mjs.map +1 -0
- package/fesm2022/fragiola-primitives-angular-popover.mjs +1011 -0
- package/fesm2022/fragiola-primitives-angular-popover.mjs.map +1 -0
- package/fesm2022/fragiola-primitives-angular-progress.mjs +472 -0
- package/fesm2022/fragiola-primitives-angular-progress.mjs.map +1 -0
- package/fesm2022/fragiola-primitives-angular-radio-group.mjs +321 -0
- package/fesm2022/fragiola-primitives-angular-radio-group.mjs.map +1 -0
- package/fesm2022/fragiola-primitives-angular-radio.mjs +273 -0
- package/fesm2022/fragiola-primitives-angular-radio.mjs.map +1 -0
- package/fesm2022/fragiola-primitives-angular-range-calendar.mjs +108 -0
- package/fesm2022/fragiola-primitives-angular-range-calendar.mjs.map +1 -0
- package/fesm2022/fragiola-primitives-angular-rating.mjs +643 -0
- package/fesm2022/fragiola-primitives-angular-rating.mjs.map +1 -0
- package/fesm2022/fragiola-primitives-angular-render.mjs +1 -0
- package/fesm2022/fragiola-primitives-angular-scroll-area.mjs +553 -0
- package/fesm2022/fragiola-primitives-angular-scroll-area.mjs.map +1 -0
- package/fesm2022/fragiola-primitives-angular-search-field.mjs +487 -0
- package/fesm2022/fragiola-primitives-angular-search-field.mjs.map +1 -0
- package/fesm2022/fragiola-primitives-angular-segmented-control.mjs +762 -0
- package/fesm2022/fragiola-primitives-angular-segmented-control.mjs.map +1 -0
- package/fesm2022/fragiola-primitives-angular-select-virtual.mjs +246 -0
- package/fesm2022/fragiola-primitives-angular-select-virtual.mjs.map +1 -0
- package/fesm2022/fragiola-primitives-angular-select.mjs +1433 -0
- package/fesm2022/fragiola-primitives-angular-select.mjs.map +1 -0
- package/fesm2022/fragiola-primitives-angular-separator.mjs +102 -0
- package/fesm2022/fragiola-primitives-angular-separator.mjs.map +1 -0
- package/fesm2022/fragiola-primitives-angular-slider.mjs +1090 -0
- package/fesm2022/fragiola-primitives-angular-slider.mjs.map +1 -0
- package/fesm2022/fragiola-primitives-angular-steps.mjs +819 -0
- package/fesm2022/fragiola-primitives-angular-steps.mjs.map +1 -0
- package/fesm2022/fragiola-primitives-angular-switch.mjs +422 -0
- package/fesm2022/fragiola-primitives-angular-switch.mjs.map +1 -0
- package/fesm2022/fragiola-primitives-angular-tabs.mjs +726 -0
- package/fesm2022/fragiola-primitives-angular-tabs.mjs.map +1 -0
- package/fesm2022/fragiola-primitives-angular-tag-group.mjs +768 -0
- package/fesm2022/fragiola-primitives-angular-tag-group.mjs.map +1 -0
- package/fesm2022/fragiola-primitives-angular-tags-input.mjs +1126 -0
- package/fesm2022/fragiola-primitives-angular-tags-input.mjs.map +1 -0
- package/fesm2022/fragiola-primitives-angular-time-field.mjs +187 -0
- package/fesm2022/fragiola-primitives-angular-time-field.mjs.map +1 -0
- package/fesm2022/fragiola-primitives-angular-time-range-field.mjs +188 -0
- package/fesm2022/fragiola-primitives-angular-time-range-field.mjs.map +1 -0
- package/fesm2022/fragiola-primitives-angular-toast.mjs +744 -0
- package/fesm2022/fragiola-primitives-angular-toast.mjs.map +1 -0
- package/fesm2022/fragiola-primitives-angular-toggle-group.mjs +245 -0
- package/fesm2022/fragiola-primitives-angular-toggle-group.mjs.map +1 -0
- package/fesm2022/fragiola-primitives-angular-toggle.mjs +229 -0
- package/fesm2022/fragiola-primitives-angular-toggle.mjs.map +1 -0
- package/fesm2022/fragiola-primitives-angular-toolbar.mjs +623 -0
- package/fesm2022/fragiola-primitives-angular-toolbar.mjs.map +1 -0
- package/fesm2022/fragiola-primitives-angular-tooltip.mjs +975 -0
- package/fesm2022/fragiola-primitives-angular-tooltip.mjs.map +1 -0
- package/fesm2022/fragiola-primitives-angular-year-calendar.mjs +163 -0
- package/fesm2022/fragiola-primitives-angular-year-calendar.mjs.map +1 -0
- package/fesm2022/fragiola-primitives-angular-year-picker.mjs +177 -0
- package/fesm2022/fragiola-primitives-angular-year-picker.mjs.map +1 -0
- package/fesm2022/fragiola-primitives-angular-year-range-calendar.mjs +163 -0
- package/fesm2022/fragiola-primitives-angular-year-range-calendar.mjs.map +1 -0
- package/fesm2022/fragiola-primitives-angular-year-range-picker.mjs +177 -0
- package/fesm2022/fragiola-primitives-angular-year-range-picker.mjs.map +1 -0
- package/fesm2022/fragiola-primitives-angular.mjs +94 -0
- package/package.json +437 -3
- package/types/fragiola-primitives-angular-accordion.d.ts +154 -0
- package/types/fragiola-primitives-angular-alert-dialog.d.ts +176 -0
- package/types/fragiola-primitives-angular-aspect-ratio.d.ts +25 -0
- package/types/fragiola-primitives-angular-async-list.d.ts +32 -0
- package/types/fragiola-primitives-angular-autocomplete-virtual.d.ts +82 -0
- package/types/fragiola-primitives-angular-autocomplete.d.ts +496 -0
- package/types/fragiola-primitives-angular-avatar.d.ts +94 -0
- package/types/fragiola-primitives-angular-breadcrumbs.d.ts +62 -0
- package/types/fragiola-primitives-angular-button.d.ts +66 -0
- package/types/fragiola-primitives-angular-calendar-preset.d.ts +35 -0
- package/types/fragiola-primitives-angular-calendar-view.d.ts +80 -0
- package/types/fragiola-primitives-angular-calendar.d.ts +414 -0
- package/types/fragiola-primitives-angular-carousel.d.ts +300 -0
- package/types/fragiola-primitives-angular-cascade-select.d.ts +404 -0
- package/types/fragiola-primitives-angular-checkbox-group.d.ts +74 -0
- package/types/fragiola-primitives-angular-checkbox.d.ts +111 -0
- package/types/fragiola-primitives-angular-clipboard.d.ts +106 -0
- package/types/fragiola-primitives-angular-collapsible.d.ts +88 -0
- package/types/fragiola-primitives-angular-color-area.d.ts +174 -0
- package/types/fragiola-primitives-angular-color-field.d.ts +174 -0
- package/types/fragiola-primitives-angular-color-picker-popover.d.ts +180 -0
- package/types/fragiola-primitives-angular-color-picker.d.ts +137 -0
- package/types/fragiola-primitives-angular-color-slider.d.ts +228 -0
- package/types/fragiola-primitives-angular-color-swatch-picker.d.ts +146 -0
- package/types/fragiola-primitives-angular-color-swatch.d.ts +43 -0
- package/types/fragiola-primitives-angular-color-wheel.d.ts +144 -0
- package/types/fragiola-primitives-angular-combobox-virtual.d.ts +84 -0
- package/types/fragiola-primitives-angular-combobox.d.ts +582 -0
- package/types/fragiola-primitives-angular-command-virtual.d.ts +93 -0
- package/types/fragiola-primitives-angular-command.d.ts +283 -0
- package/types/fragiola-primitives-angular-context-menu.d.ts +278 -0
- package/types/fragiola-primitives-angular-date-field.d.ts +486 -0
- package/types/fragiola-primitives-angular-date-picker-input.d.ts +139 -0
- package/types/fragiola-primitives-angular-date-picker.d.ts +331 -0
- package/types/fragiola-primitives-angular-date-range-field.d.ts +333 -0
- package/types/fragiola-primitives-angular-date-range-picker-input.d.ts +89 -0
- package/types/fragiola-primitives-angular-date-range-picker.d.ts +35 -0
- package/types/fragiola-primitives-angular-dialog.d.ts +359 -0
- package/types/fragiola-primitives-angular-direction.d.ts +31 -0
- package/types/fragiola-primitives-angular-drawer.d.ts +242 -0
- package/types/fragiola-primitives-angular-drop-zone.d.ts +68 -0
- package/types/fragiola-primitives-angular-editable.d.ts +219 -0
- package/types/fragiola-primitives-angular-field.d.ts +397 -0
- package/types/fragiola-primitives-angular-fieldset.d.ts +47 -0
- package/types/fragiola-primitives-angular-file-upload.d.ts +351 -0
- package/types/fragiola-primitives-angular-form.d.ts +44 -0
- package/types/fragiola-primitives-angular-hover-card.d.ts +279 -0
- package/types/fragiola-primitives-angular-internal.d.ts +695 -0
- package/types/fragiola-primitives-angular-label.d.ts +14 -0
- package/types/fragiola-primitives-angular-link.d.ts +33 -0
- package/types/fragiola-primitives-angular-listbox-virtual.d.ts +193 -0
- package/types/fragiola-primitives-angular-listbox.d.ts +237 -0
- package/types/fragiola-primitives-angular-menu.d.ts +758 -0
- package/types/fragiola-primitives-angular-menubar.d.ts +76 -0
- package/types/fragiola-primitives-angular-meter.d.ts +117 -0
- package/types/fragiola-primitives-angular-month-calendar.d.ts +380 -0
- package/types/fragiola-primitives-angular-month-picker.d.ts +183 -0
- package/types/fragiola-primitives-angular-month-range-calendar.d.ts +54 -0
- package/types/fragiola-primitives-angular-month-range-picker.d.ts +56 -0
- package/types/fragiola-primitives-angular-multiple-calendar.d.ts +73 -0
- package/types/fragiola-primitives-angular-navigation-menu.d.ts +355 -0
- package/types/fragiola-primitives-angular-number-field.d.ts +305 -0
- package/types/fragiola-primitives-angular-otp-field.d.ts +210 -0
- package/types/fragiola-primitives-angular-pagination.d.ts +239 -0
- package/types/fragiola-primitives-angular-password-input.d.ts +149 -0
- package/types/fragiola-primitives-angular-popover.d.ts +303 -0
- package/types/fragiola-primitives-angular-progress.d.ts +126 -0
- package/types/fragiola-primitives-angular-radio-group.d.ts +123 -0
- package/types/fragiola-primitives-angular-radio.d.ts +67 -0
- package/types/fragiola-primitives-angular-range-calendar.d.ts +33 -0
- package/types/fragiola-primitives-angular-rating.d.ts +195 -0
- package/types/fragiola-primitives-angular-render.d.ts +2 -0
- package/types/fragiola-primitives-angular-scroll-area.d.ts +134 -0
- package/types/fragiola-primitives-angular-search-field.d.ts +129 -0
- package/types/fragiola-primitives-angular-segmented-control.d.ts +232 -0
- package/types/fragiola-primitives-angular-select-virtual.d.ts +81 -0
- package/types/fragiola-primitives-angular-select.d.ts +403 -0
- package/types/fragiola-primitives-angular-separator.d.ts +32 -0
- package/types/fragiola-primitives-angular-slider.d.ts +297 -0
- package/types/fragiola-primitives-angular-steps.d.ts +194 -0
- package/types/fragiola-primitives-angular-switch.d.ts +102 -0
- package/types/fragiola-primitives-angular-tabs.d.ts +215 -0
- package/types/fragiola-primitives-angular-tag-group.d.ts +232 -0
- package/types/fragiola-primitives-angular-tags-input.d.ts +318 -0
- package/types/fragiola-primitives-angular-time-field.d.ts +63 -0
- package/types/fragiola-primitives-angular-time-range-field.d.ts +65 -0
- package/types/fragiola-primitives-angular-toast.d.ts +196 -0
- package/types/fragiola-primitives-angular-toggle-group.d.ts +89 -0
- package/types/fragiola-primitives-angular-toggle.d.ts +86 -0
- package/types/fragiola-primitives-angular-toolbar.d.ts +187 -0
- package/types/fragiola-primitives-angular-tooltip.d.ts +330 -0
- package/types/fragiola-primitives-angular-year-calendar.d.ts +54 -0
- package/types/fragiola-primitives-angular-year-picker.d.ts +56 -0
- package/types/fragiola-primitives-angular-year-range-calendar.d.ts +54 -0
- package/types/fragiola-primitives-angular-year-range-picker.d.ts +56 -0
- package/types/fragiola-primitives-angular.d.ts +94 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fragiola-primitives-angular-color-picker-popover.mjs","names":[],"sources":["../../color-picker-popover/directives/color-picker-popover-root.directive.ts","../../color-picker-popover/directives/color-picker-popover-popup.directive.ts","../../color-picker-popover/directives/color-picker-popover-portal.directive.ts","../../color-picker-popover/directives/color-picker-popover-positioner.directive.ts","../../color-picker-popover/directives/color-picker-popover-trigger.directive.ts"],"sourcesContent":["import {\n computed,\n Directive,\n effect,\n input,\n output,\n untracked,\n} from \"@angular/core\";\nimport {\n createOverlayRoot,\n injectColorPickerBinding,\n type OpenChangeEvent,\n type OverlayActions,\n placementSignal,\n} from \"@fragiola/primitives-angular/internal\";\n\nexport interface ColorPickerPopoverState {\n open: boolean;\n disabled: boolean;\n}\n\n/**\n * The open state of a ColorPicker's popup (spec/color-picker.md, `/color-picker-popover`):\n * `<ng-container colorPickerPopoverRoot [(open)]=\"open\">`, inside a `[colorPickerRoot]`, on\n * Popover's overlay lifecycle. `close()` and `unmount()` are its actions.\n */\n@Directive({\n selector: \"[colorPickerPopoverRoot]\",\n exportAs: \"colorPickerPopoverRoot\",\n})\nexport class ColorPickerPopoverRoot implements OverlayActions {\n readonly open = input<boolean | undefined>(undefined);\n readonly openChange = output<boolean>();\n readonly defaultOpen = input(false);\n /** Every requested change with its details, before it happens (`details.cancel()` keeps it). */\n readonly openChangeDetails = output<OpenChangeEvent>();\n /** An opening's or a closing's transition has finished (spec/README.md, \"Lifecycle\"). */\n readonly openChangeComplete = output<boolean>();\n\n readonly overlay = createOverlayRoot(\n this,\n (event) => this.openChangeDetails.emit(event),\n \"primitives-color-picker-popover\",\n );\n private readonly picker = injectColorPickerBinding();\n /** The enclosing ColorPicker is disabled: the trigger opens nothing. */\n readonly disabled = computed(() => this.picker?.disabled() ?? false);\n readonly placed = placementSignal({ side: \"bottom\", align: \"start\" });\n readonly state = computed<ColorPickerPopoverState>(() => ({\n open: this.overlay.open(),\n disabled: this.disabled(),\n }));\n\n constructor() {\n // the popup is part of the picker: focus in it is no blur of the picker's Field (an effect\n // runs before the popup's after-render focus moves in)\n effect((onCleanup) => {\n const positioner = this.overlay.positioner();\n const picker = this.picker;\n if (positioner !== null && picker !== null) {\n onCleanup(untracked(() => picker.registerPopup(positioner)));\n }\n });\n }\n\n /** Closes the popup (reason `imperative-action`). */\n close(): void {\n this.overlay.close();\n }\n\n /** Ends a running exit now, or the exit held by `preventUnmountOnClose()`. */\n unmount(): void {\n this.overlay.unmount();\n }\n}\n","import {\n afterRenderEffect,\n computed,\n Directive,\n inject,\n untracked,\n} from \"@angular/core\";\nimport {\n focusInitial,\n getTabbables,\n nextTabbableAfter,\n} from \"@fragiola/primitives/focus\";\nimport { openOverlaySession } from \"@fragiola/primitives/overlay\";\nimport type { Align, Side } from \"@fragiola/primitives/positioning\";\nimport {\n dataValues,\n registerHost,\n} from \"@fragiola/primitives-angular/internal\";\nimport { ColorPickerPopoverRoot } from \"./color-picker-popover-root.directive.ts\";\n\nexport interface ColorPickerPopoverPopupState {\n open: boolean;\n side: Side;\n align: Align;\n}\n\n// Closing by these returns focus to the trigger; focus leaving does not (spec/popover.md).\nconst RETURNS_FOCUS = new Set([\"escape-key\", \"trigger-press\"]);\n// an outside press returns it only when the press focused nothing (D4 §3, Base UI), as a close\n// made through the bound `open` (`none`) or the actions (`imperative-action`) does\nconst RETURNS_FOCUS_UNFOCUSED = new Set([\n \"outside-press\",\n \"none\",\n \"imperative-action\",\n]);\n\n/**\n * The picker's non-modal dialog (spec/color-picker.md, Popover's focus and dismissal):\n * `<div colorPickerPopoverPopup aria-label=\"...\">`. Not trapped, it closes when focus leaves it;\n * on open, its first tabbable element takes the focus.\n */\n@Directive({\n selector: \"[colorPickerPopoverPopup]\",\n exportAs: \"colorPickerPopoverPopup\",\n host: {\n role: \"dialog\",\n tabindex: \"-1\",\n \"data-primitives-part\": \"color-picker-popover-popup\",\n \"[attr.id]\": \"root.overlay.popupId\",\n \"[attr.data-open]\": \"data().open\",\n \"[attr.data-closed]\": \"data().closed\",\n \"[attr.data-side]\": \"data().side\",\n \"[attr.data-align]\": \"data().align\",\n \"[attr.data-starting-style]\": \"data()['starting-style']\",\n \"[attr.data-ending-style]\": \"data()['ending-style']\",\n \"(keydown)\": \"onKeyDown($event)\",\n },\n})\nexport class ColorPickerPopoverPopup {\n protected readonly root = inject(ColorPickerPopoverRoot);\n readonly state = computed<ColorPickerPopoverPopupState>(() => ({\n open: this.root.overlay.open(),\n ...this.root.placed(),\n }));\n protected readonly data = computed(() => {\n const status = this.root.overlay.presence.status();\n const state = this.state();\n return dataValues({\n ...state,\n closed: !state.open,\n \"starting-style\": status === \"starting\",\n \"ending-style\": status === \"ending\",\n });\n });\n private readonly popup = registerHost(this.root.overlay.popup);\n\n constructor() {\n const overlay = this.root.overlay;\n const popup = this.popup;\n afterRenderEffect((onCleanup) => {\n const open = overlay.open();\n const positioner = overlay.positioner();\n const trigger = overlay.trigger();\n if (!open) {\n return;\n }\n untracked(() => {\n const session = openOverlaySession(popup.ownerDocument, {\n elements: () => [positioner ?? popup],\n ignore: () => [trigger],\n dismiss: (reason, event) =>\n overlay.setOpen(false, reason, event),\n focusOut: () => [trigger],\n returnFocus: {\n when: RETURNS_FOCUS,\n whenUnfocused: RETURNS_FOCUS_UNFOCUSED,\n reason: () => overlay.lastReason.current ?? \"none\",\n to: () => trigger,\n },\n });\n onCleanup(session.end);\n });\n });\n // on open: the first tabbable element, else the popup (D4 §3 \"Popover focus on open\")\n afterRenderEffect(() => {\n if (overlay.open()) {\n untracked(() => focusInitial(popup, undefined));\n }\n });\n }\n\n protected onKeyDown(event: KeyboardEvent): void {\n if (event.key !== \"Tab\" || event.defaultPrevented) {\n return;\n }\n const overlay = this.root.overlay;\n const popup = this.popup;\n const trigger = overlay.trigger();\n // in the tab order, the popup's content comes right after the trigger (as popover.md)\n const tabbables = getTabbables(popup);\n const active = popup.ownerDocument.activeElement;\n const first = tabbables[0] ?? popup;\n const last = tabbables.at(-1) ?? popup;\n if (event.shiftKey && (active === first || active === popup)) {\n event.preventDefault();\n overlay.setOpen(false, \"focus-out\", event);\n trigger?.focus();\n } else if (!event.shiftKey && active === last) {\n event.preventDefault();\n const next = trigger\n ? nextTabbableAfter(trigger, [overlay.positioner(), popup])\n : null;\n overlay.setOpen(false, \"focus-out\", event);\n next?.focus();\n }\n }\n}\n","import { Directive, inject, input } from \"@angular/core\";\nimport {\n mountPortal,\n type OverlayPortalOptions,\n portalOptions,\n} from \"@fragiola/primitives-angular/internal\";\nimport { ColorPickerPopoverRoot } from \"./color-picker-popover-root.directive.ts\";\n\n/**\n * Moves the positioner to the end of `body` while the popup is open or closing (always with\n * `keepMounted`): `<div *colorPickerPopoverPortal>`.\n */\n@Directive({ selector: \"[colorPickerPopoverPortal]\" })\nexport class ColorPickerPopoverPortal {\n /**\n * `container` (default: `document.body`), `keepMounted` (default `false`: rendered, hidden, while\n * closed); an element: the container alone (`*colorPickerPopoverPortal=\"element\"`).\n */\n readonly options = input<OverlayPortalOptions, unknown>(\n {},\n { alias: \"colorPickerPopoverPortal\", transform: portalOptions },\n );\n\n constructor() {\n mountPortal(\n inject(ColorPickerPopoverRoot).overlay.presence.mounted,\n this.options,\n );\n }\n}\n","import { computed, Directive, inject, input } from \"@angular/core\";\nimport type { Align, Side } from \"@fragiola/primitives/positioning\";\nimport {\n dataValues,\n positionOverlay,\n registerHost,\n} from \"@fragiola/primitives-angular/internal\";\nimport { ColorPickerPopoverRoot } from \"./color-picker-popover-root.directive.ts\";\n\nexport interface ColorPickerPopoverPositionerState {\n open: boolean;\n side: Side;\n align: Align;\n}\n\n/**\n * Places the popup next to the trigger, below it and aligned to its start (a picker's default):\n * `<div colorPickerPopoverPositioner>`.\n */\n@Directive({\n selector: \"[colorPickerPopoverPositioner]\",\n exportAs: \"colorPickerPopoverPositioner\",\n host: {\n role: \"presentation\",\n \"data-primitives-part\": \"color-picker-popover-positioner\",\n \"[attr.hidden]\": \"root.overlay.presence.mounted() ? null : ''\",\n \"[attr.data-open]\": \"data().open\",\n \"[attr.data-closed]\": \"data().closed\",\n \"[attr.data-side]\": \"data().side\",\n \"[attr.data-align]\": \"data().align\",\n },\n})\nexport class ColorPickerPopoverPositioner {\n protected readonly root = inject(ColorPickerPopoverRoot);\n readonly side = input<Side | undefined>(undefined);\n readonly align = input<Align | undefined>(undefined);\n readonly sideOffset = input<number | undefined>(undefined);\n readonly alignOffset = input<number | undefined>(undefined);\n readonly collisionPadding = input<number | undefined>(undefined);\n readonly anchor = input<Element | null | undefined>(undefined);\n readonly state = computed<ColorPickerPopoverPositionerState>(() => ({\n open: this.root.overlay.open(),\n ...this.root.placed(),\n }));\n protected readonly data = computed(() =>\n dataValues({ ...this.state(), closed: !this.state().open }),\n );\n\n constructor() {\n const overlay = this.root.overlay;\n positionOverlay(\n this,\n { side: \"bottom\", align: \"start\" },\n {\n anchor: overlay.trigger,\n positioner: registerHost(overlay.positioner),\n mounted: overlay.presence.mounted,\n },\n this.root.placed,\n );\n }\n}\n","import { computed, Directive, inject } from \"@angular/core\";\nimport {\n dataValues,\n registerHost,\n} from \"@fragiola/primitives-angular/internal\";\nimport {\n ColorPickerPopoverRoot,\n type ColorPickerPopoverState,\n} from \"./color-picker-popover-root.directive.ts\";\n\n/**\n * Opens the picker's popup; its content is the app's (a `[colorSwatch]` of the picker's color):\n * `<button colorPickerPopoverTrigger>`. Disabled while the picker is.\n */\n@Directive({\n selector: \"[colorPickerPopoverTrigger]\",\n exportAs: \"colorPickerPopoverTrigger\",\n host: {\n type: \"button\",\n \"aria-haspopup\": \"dialog\",\n \"data-primitives-part\": \"color-picker-popover-trigger\",\n \"[attr.id]\": \"root.overlay.triggerId\",\n \"[attr.disabled]\": \"data().disabled\",\n \"[attr.aria-expanded]\": \"String(state().open)\",\n \"[attr.aria-controls]\": \"state().open ? root.overlay.popupId : null\",\n \"[attr.data-popup-open]\": \"data().open\",\n \"[attr.data-disabled]\": \"data().disabled\",\n \"(click)\": \"onClick($event)\",\n },\n})\nexport class ColorPickerPopoverTrigger {\n protected readonly root = inject(ColorPickerPopoverRoot);\n readonly state = computed<ColorPickerPopoverState>(() => this.root.state());\n protected readonly data = computed(() => dataValues(this.state()));\n protected readonly String = String;\n\n constructor() {\n registerHost(this.root.overlay.singleTrigger);\n }\n\n protected onClick(event: MouseEvent): void {\n if (this.root.disabled()) {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;GAAyB,cAAA;GAAA,UAAA;GAAA,MAAA;IAAA,YAAA;KAAA,QAAA;KAAA,iBAAA;KAAA,wBAAA;IAAA;IAAA,WAAA,EAAA,SAAA,kBAAA;IAAA,YAAA;KAAA,WAAA;KAAA,iBAAA;KAAA,sBAAA;KAAA,sBAAA;KAAA,wBAAA;KAAA,sBAAA;IAAA;GAAA;GAAA,UAAA,CAAA,2BAAA;GAAA,UAAA;EAAA,CAAA;CAAA;;AAAzB,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAyB,YAAA,CAAA;EAhBrC,MAAA;EAAU,MAAA,CAAA;GACP,UAAU;GACV,UAAU;GACV,MAAM;IACF,MAAM;IACN,iBAAiB;IACjB,wBAAwB;IACxB,aAAa;IACb,mBAAmB;IACnB,wBAAwB;IACxB,wBAAwB;IACxB,0BAA0B;IAC1B,wBAAwB;IACxB,WAAW;GACd;EACJ,CAAA"}
|
|
@@ -0,0 +1,528 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
import { DestroyRef, Directive, PLATFORM_ID, afterNextRender, afterRenderEffect, booleanAttribute, computed, effect, forwardRef, inject, input, output, signal, untracked } from "@angular/core";
|
|
3
|
+
import { convertColor, formatColor, isSameColor, openEyeDropper, parseColor, supportsEyeDropper } from "@fragiola/primitives/color";
|
|
4
|
+
import { COLOR_PICKER_BINDING, conditionalView, controllable, dataValues, injectHost } from "@fragiola/primitives-angular/internal";
|
|
5
|
+
import { getTabbables } from "@fragiola/primitives/focus";
|
|
6
|
+
import { bridgeForm } from "@fragiola/primitives/form";
|
|
7
|
+
import { fieldControl, writeFieldAria } from "@fragiola/primitives-angular/field";
|
|
8
|
+
const COLOR_PICKER_FORMATS = [
|
|
9
|
+
"hex",
|
|
10
|
+
"rgb",
|
|
11
|
+
"hsl",
|
|
12
|
+
"hsb"
|
|
13
|
+
];
|
|
14
|
+
const BLACK = {
|
|
15
|
+
space: "rgb",
|
|
16
|
+
red: 0,
|
|
17
|
+
green: 0,
|
|
18
|
+
blue: 0,
|
|
19
|
+
alpha: 1
|
|
20
|
+
};
|
|
21
|
+
function toColor(value) {
|
|
22
|
+
return parseColor(value) ?? BLACK;
|
|
23
|
+
}
|
|
24
|
+
function formatSpace(format) {
|
|
25
|
+
return format === "hsl" || format === "hsb" ? format : null;
|
|
26
|
+
}
|
|
27
|
+
var ColorPickerRoot = class ColorPickerRoot {
|
|
28
|
+
constructor() {
|
|
29
|
+
this.value = input(void 0, ...ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []);
|
|
30
|
+
this.valueChange = output();
|
|
31
|
+
this.defaultValue = input("#000000", ...ngDevMode ? [{ debugName: "defaultValue" }] : /* istanbul ignore next */ []);
|
|
32
|
+
this.valueChangeDetails = output();
|
|
33
|
+
this.valueCommit = output();
|
|
34
|
+
this.format = input(void 0, ...ngDevMode ? [{ debugName: "format" }] : /* istanbul ignore next */ []);
|
|
35
|
+
this.formatChange = output();
|
|
36
|
+
this.defaultFormat = input("hex", ...ngDevMode ? [{ debugName: "defaultFormat" }] : /* istanbul ignore next */ []);
|
|
37
|
+
this.formatChangeDetails = output();
|
|
38
|
+
this.disabled = input(false, {
|
|
39
|
+
...ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {},
|
|
40
|
+
transform: booleanAttribute
|
|
41
|
+
});
|
|
42
|
+
this.name = input(void 0, ...ngDevMode ? [{ debugName: "name" }] : /* istanbul ignore next */ []);
|
|
43
|
+
this.host = injectHost();
|
|
44
|
+
this.current = controllable(computed(() => {
|
|
45
|
+
const value = this.value();
|
|
46
|
+
return value === void 0 ? void 0 : toColor(value);
|
|
47
|
+
}), this.valueChange, () => toColor(this.defaultValue()), (value, details) => this.valueChangeDetails.emit({
|
|
48
|
+
value,
|
|
49
|
+
details
|
|
50
|
+
}));
|
|
51
|
+
this.ownFormat = controllable(this.format, this.formatChange, () => this.defaultFormat(), (value, details) => this.formatChangeDetails.emit({
|
|
52
|
+
value,
|
|
53
|
+
details
|
|
54
|
+
}));
|
|
55
|
+
this.color = this.current.value;
|
|
56
|
+
this.currentFormat = this.ownFormat.value;
|
|
57
|
+
this.hex = computed(() => formatColor(this.color(), "hex"), ...ngDevMode ? [{ debugName: "hex" }] : /* istanbul ignore next */ []);
|
|
58
|
+
this.css = computed(() => formatColor(this.color(), "css"), ...ngDevMode ? [{ debugName: "css" }] : /* istanbul ignore next */ []);
|
|
59
|
+
this.hidden = null;
|
|
60
|
+
this.field = fieldControl({
|
|
61
|
+
id: computed(() => void 0),
|
|
62
|
+
labelable: false,
|
|
63
|
+
value: this.hex,
|
|
64
|
+
filled: computed(() => true),
|
|
65
|
+
input: () => this.hidden,
|
|
66
|
+
element: () => this.host,
|
|
67
|
+
focusTarget: () => getTabbables(this.host)[0] ?? null
|
|
68
|
+
});
|
|
69
|
+
this.isDisabled = computed(() => this.disabled() || this.field.disabled(), ...ngDevMode ? [{ debugName: "isDisabled" }] : /* istanbul ignore next */ []);
|
|
70
|
+
this.state = computed(() => ({
|
|
71
|
+
color: this.color(),
|
|
72
|
+
format: this.currentFormat(),
|
|
73
|
+
disabled: this.isDisabled()
|
|
74
|
+
}), ...ngDevMode ? [{ debugName: "state" }] : /* istanbul ignore next */ []);
|
|
75
|
+
this.data = computed(() => dataValues({
|
|
76
|
+
format: this.currentFormat(),
|
|
77
|
+
disabled: this.isDisabled()
|
|
78
|
+
}), ...ngDevMode ? [{ debugName: "data" }] : /* istanbul ignore next */ []);
|
|
79
|
+
this.binding = {
|
|
80
|
+
value: this.color,
|
|
81
|
+
disabled: this.isDisabled,
|
|
82
|
+
setValue: (color, details) => this.current.set(color, details),
|
|
83
|
+
commit: (color) => this.valueCommit.emit(color),
|
|
84
|
+
registerPopup: (element) => this.registerPopup(element)
|
|
85
|
+
};
|
|
86
|
+
this.popups = /* @__PURE__ */ new Set();
|
|
87
|
+
this.stopReturnWatch = null;
|
|
88
|
+
const host = this.host;
|
|
89
|
+
writeFieldAria(this.field, host, {
|
|
90
|
+
"aria-labelledby": this.field.labelledBy,
|
|
91
|
+
"aria-describedby": this.field.describedBy,
|
|
92
|
+
"aria-invalid": this.field.ariaInvalid
|
|
93
|
+
});
|
|
94
|
+
const browser = inject(PLATFORM_ID) === "browser";
|
|
95
|
+
effect(() => {
|
|
96
|
+
if (!browser) return;
|
|
97
|
+
const hex = this.hex();
|
|
98
|
+
const name = this.field.name() ?? this.name();
|
|
99
|
+
const disabled = this.isDisabled();
|
|
100
|
+
untracked(() => {
|
|
101
|
+
if (this.hidden === null) {
|
|
102
|
+
const element = host.ownerDocument.createElement("input");
|
|
103
|
+
element.type = "hidden";
|
|
104
|
+
element.setAttribute("data-primitives-part", "color-picker-input");
|
|
105
|
+
host.appendChild(element);
|
|
106
|
+
this.hidden = element;
|
|
107
|
+
}
|
|
108
|
+
const hidden = this.hidden;
|
|
109
|
+
if (name === void 0) hidden.removeAttribute("name");
|
|
110
|
+
else hidden.name = name;
|
|
111
|
+
hidden.value = hex;
|
|
112
|
+
hidden.disabled = disabled;
|
|
113
|
+
});
|
|
114
|
+
});
|
|
115
|
+
let stop = null;
|
|
116
|
+
afterNextRender(() => {
|
|
117
|
+
const hidden = this.hidden;
|
|
118
|
+
if (hidden !== null) stop = bridgeForm(hidden, { reset: () => {
|
|
119
|
+
const next = toColor(untracked(this.defaultValue));
|
|
120
|
+
if (!isSameColor(next, untracked(this.color))) {
|
|
121
|
+
this.field.reset();
|
|
122
|
+
this.current.set(next, { reason: "none" });
|
|
123
|
+
}
|
|
124
|
+
} });
|
|
125
|
+
});
|
|
126
|
+
inject(DestroyRef).onDestroy(() => {
|
|
127
|
+
stop?.();
|
|
128
|
+
this.hidden?.remove();
|
|
129
|
+
this.stopReturnWatch?.();
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
setFormat(format, event) {
|
|
133
|
+
const details = {
|
|
134
|
+
reason: "input-change",
|
|
135
|
+
event
|
|
136
|
+
};
|
|
137
|
+
this.ownFormat.set(format, details);
|
|
138
|
+
const now = untracked(this.color);
|
|
139
|
+
const space = formatSpace(format);
|
|
140
|
+
if (space !== null && now.space !== space) this.current.set(convertColor(now, space), details);
|
|
141
|
+
}
|
|
142
|
+
pick(picked, event) {
|
|
143
|
+
const now = untracked(this.color);
|
|
144
|
+
const next = convertColor({
|
|
145
|
+
...picked,
|
|
146
|
+
alpha: now.alpha
|
|
147
|
+
}, now.space);
|
|
148
|
+
this.current.set(next, {
|
|
149
|
+
reason: "trigger-press",
|
|
150
|
+
event
|
|
151
|
+
});
|
|
152
|
+
this.valueCommit.emit(next);
|
|
153
|
+
}
|
|
154
|
+
onFocusOut(event) {
|
|
155
|
+
const next = event.relatedTarget;
|
|
156
|
+
const inPicker = (node) => this.host.contains(node) || [...this.popups].some((popup) => popup.contains(node));
|
|
157
|
+
this.stopReturnWatch?.();
|
|
158
|
+
if (next === null && event.target instanceof Node && [...this.popups].some((popup) => popup.contains(event.target))) {
|
|
159
|
+
const doc = this.host.ownerDocument;
|
|
160
|
+
const onFocusIn = (focus) => {
|
|
161
|
+
this.stopReturnWatch?.();
|
|
162
|
+
if (!(focus.target instanceof Node) || !inPicker(focus.target)) this.field.blurred();
|
|
163
|
+
};
|
|
164
|
+
doc.addEventListener("focusin", onFocusIn, true);
|
|
165
|
+
this.stopReturnWatch = () => {
|
|
166
|
+
doc.removeEventListener("focusin", onFocusIn, true);
|
|
167
|
+
this.stopReturnWatch = null;
|
|
168
|
+
};
|
|
169
|
+
return;
|
|
170
|
+
}
|
|
171
|
+
if (!(next instanceof Node) || !inPicker(next)) this.field.blurred();
|
|
172
|
+
}
|
|
173
|
+
registerPopup(element) {
|
|
174
|
+
this.popups.add(element);
|
|
175
|
+
const onFocusIn = () => this.field.focused();
|
|
176
|
+
const onFocusOut = (event) => this.onFocusOut(event);
|
|
177
|
+
element.addEventListener("focusin", onFocusIn);
|
|
178
|
+
element.addEventListener("focusout", onFocusOut);
|
|
179
|
+
return () => {
|
|
180
|
+
this.popups.delete(element);
|
|
181
|
+
element.removeEventListener("focusin", onFocusIn);
|
|
182
|
+
element.removeEventListener("focusout", onFocusOut);
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
static {
|
|
186
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
187
|
+
minVersion: "12.0.0",
|
|
188
|
+
version: "22.2.6",
|
|
189
|
+
ngImport: i0,
|
|
190
|
+
type: ColorPickerRoot,
|
|
191
|
+
deps: [],
|
|
192
|
+
target: i0.ɵɵFactoryTarget.Directive
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
static {
|
|
196
|
+
this.ɵdir = i0.ɵɵngDeclareDirective({
|
|
197
|
+
minVersion: "17.1.0",
|
|
198
|
+
version: "22.2.6",
|
|
199
|
+
type: ColorPickerRoot,
|
|
200
|
+
isStandalone: true,
|
|
201
|
+
selector: "[colorPickerRoot]",
|
|
202
|
+
inputs: {
|
|
203
|
+
value: {
|
|
204
|
+
classPropertyName: "value",
|
|
205
|
+
publicName: "value",
|
|
206
|
+
isSignal: true,
|
|
207
|
+
isRequired: false,
|
|
208
|
+
transformFunction: null
|
|
209
|
+
},
|
|
210
|
+
defaultValue: {
|
|
211
|
+
classPropertyName: "defaultValue",
|
|
212
|
+
publicName: "defaultValue",
|
|
213
|
+
isSignal: true,
|
|
214
|
+
isRequired: false,
|
|
215
|
+
transformFunction: null
|
|
216
|
+
},
|
|
217
|
+
format: {
|
|
218
|
+
classPropertyName: "format",
|
|
219
|
+
publicName: "format",
|
|
220
|
+
isSignal: true,
|
|
221
|
+
isRequired: false,
|
|
222
|
+
transformFunction: null
|
|
223
|
+
},
|
|
224
|
+
defaultFormat: {
|
|
225
|
+
classPropertyName: "defaultFormat",
|
|
226
|
+
publicName: "defaultFormat",
|
|
227
|
+
isSignal: true,
|
|
228
|
+
isRequired: false,
|
|
229
|
+
transformFunction: null
|
|
230
|
+
},
|
|
231
|
+
disabled: {
|
|
232
|
+
classPropertyName: "disabled",
|
|
233
|
+
publicName: "disabled",
|
|
234
|
+
isSignal: true,
|
|
235
|
+
isRequired: false,
|
|
236
|
+
transformFunction: null
|
|
237
|
+
},
|
|
238
|
+
name: {
|
|
239
|
+
classPropertyName: "name",
|
|
240
|
+
publicName: "name",
|
|
241
|
+
isSignal: true,
|
|
242
|
+
isRequired: false,
|
|
243
|
+
transformFunction: null
|
|
244
|
+
}
|
|
245
|
+
},
|
|
246
|
+
outputs: {
|
|
247
|
+
valueChange: "valueChange",
|
|
248
|
+
valueChangeDetails: "valueChangeDetails",
|
|
249
|
+
valueCommit: "valueCommit",
|
|
250
|
+
formatChange: "formatChange",
|
|
251
|
+
formatChangeDetails: "formatChangeDetails"
|
|
252
|
+
},
|
|
253
|
+
host: {
|
|
254
|
+
attributes: {
|
|
255
|
+
"role": "group",
|
|
256
|
+
"data-primitives-part": "color-picker-root"
|
|
257
|
+
},
|
|
258
|
+
listeners: {
|
|
259
|
+
"focusin": "field.focused()",
|
|
260
|
+
"focusout": "onFocusOut($event)"
|
|
261
|
+
},
|
|
262
|
+
properties: {
|
|
263
|
+
"style.--color-picker-color": "css()",
|
|
264
|
+
"attr.data-invalid": "field.data().invalid",
|
|
265
|
+
"attr.data-valid": "field.data().valid",
|
|
266
|
+
"attr.data-dirty": "field.data().dirty",
|
|
267
|
+
"attr.data-touched": "field.data().touched",
|
|
268
|
+
"attr.data-filled": "field.data().filled",
|
|
269
|
+
"attr.data-focused": "field.data().focused",
|
|
270
|
+
"attr.data-format": "data().format",
|
|
271
|
+
"attr.data-disabled": "data().disabled"
|
|
272
|
+
}
|
|
273
|
+
},
|
|
274
|
+
providers: [{
|
|
275
|
+
provide: COLOR_PICKER_BINDING,
|
|
276
|
+
useFactory: () => inject(forwardRef(() => ColorPickerRoot)).binding
|
|
277
|
+
}],
|
|
278
|
+
exportAs: ["colorPickerRoot"],
|
|
279
|
+
ngImport: i0
|
|
280
|
+
});
|
|
281
|
+
}
|
|
282
|
+
};
|
|
283
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
284
|
+
minVersion: "12.0.0",
|
|
285
|
+
version: "22.2.6",
|
|
286
|
+
ngImport: i0,
|
|
287
|
+
type: ColorPickerRoot,
|
|
288
|
+
decorators: [{
|
|
289
|
+
type: Directive,
|
|
290
|
+
args: [{
|
|
291
|
+
selector: "[colorPickerRoot]",
|
|
292
|
+
exportAs: "colorPickerRoot",
|
|
293
|
+
providers: [{
|
|
294
|
+
provide: COLOR_PICKER_BINDING,
|
|
295
|
+
useFactory: () => inject(forwardRef(() => ColorPickerRoot)).binding
|
|
296
|
+
}],
|
|
297
|
+
host: {
|
|
298
|
+
role: "group",
|
|
299
|
+
"data-primitives-part": "color-picker-root",
|
|
300
|
+
"[style.--color-picker-color]": "css()",
|
|
301
|
+
"[attr.data-invalid]": "field.data().invalid",
|
|
302
|
+
"[attr.data-valid]": "field.data().valid",
|
|
303
|
+
"[attr.data-dirty]": "field.data().dirty",
|
|
304
|
+
"[attr.data-touched]": "field.data().touched",
|
|
305
|
+
"[attr.data-filled]": "field.data().filled",
|
|
306
|
+
"[attr.data-focused]": "field.data().focused",
|
|
307
|
+
"[attr.data-format]": "data().format",
|
|
308
|
+
"[attr.data-disabled]": "data().disabled",
|
|
309
|
+
"(focusin)": "field.focused()",
|
|
310
|
+
"(focusout)": "onFocusOut($event)"
|
|
311
|
+
}
|
|
312
|
+
}]
|
|
313
|
+
}],
|
|
314
|
+
ctorParameters: () => [],
|
|
315
|
+
propDecorators: {
|
|
316
|
+
value: [{
|
|
317
|
+
type: i0.Input,
|
|
318
|
+
args: [{
|
|
319
|
+
isSignal: true,
|
|
320
|
+
alias: "value",
|
|
321
|
+
required: false
|
|
322
|
+
}]
|
|
323
|
+
}],
|
|
324
|
+
valueChange: [{
|
|
325
|
+
type: i0.Output,
|
|
326
|
+
args: ["valueChange"]
|
|
327
|
+
}],
|
|
328
|
+
defaultValue: [{
|
|
329
|
+
type: i0.Input,
|
|
330
|
+
args: [{
|
|
331
|
+
isSignal: true,
|
|
332
|
+
alias: "defaultValue",
|
|
333
|
+
required: false
|
|
334
|
+
}]
|
|
335
|
+
}],
|
|
336
|
+
valueChangeDetails: [{
|
|
337
|
+
type: i0.Output,
|
|
338
|
+
args: ["valueChangeDetails"]
|
|
339
|
+
}],
|
|
340
|
+
valueCommit: [{
|
|
341
|
+
type: i0.Output,
|
|
342
|
+
args: ["valueCommit"]
|
|
343
|
+
}],
|
|
344
|
+
format: [{
|
|
345
|
+
type: i0.Input,
|
|
346
|
+
args: [{
|
|
347
|
+
isSignal: true,
|
|
348
|
+
alias: "format",
|
|
349
|
+
required: false
|
|
350
|
+
}]
|
|
351
|
+
}],
|
|
352
|
+
formatChange: [{
|
|
353
|
+
type: i0.Output,
|
|
354
|
+
args: ["formatChange"]
|
|
355
|
+
}],
|
|
356
|
+
defaultFormat: [{
|
|
357
|
+
type: i0.Input,
|
|
358
|
+
args: [{
|
|
359
|
+
isSignal: true,
|
|
360
|
+
alias: "defaultFormat",
|
|
361
|
+
required: false
|
|
362
|
+
}]
|
|
363
|
+
}],
|
|
364
|
+
formatChangeDetails: [{
|
|
365
|
+
type: i0.Output,
|
|
366
|
+
args: ["formatChangeDetails"]
|
|
367
|
+
}],
|
|
368
|
+
disabled: [{
|
|
369
|
+
type: i0.Input,
|
|
370
|
+
args: [{
|
|
371
|
+
isSignal: true,
|
|
372
|
+
alias: "disabled",
|
|
373
|
+
required: false
|
|
374
|
+
}]
|
|
375
|
+
}],
|
|
376
|
+
name: [{
|
|
377
|
+
type: i0.Input,
|
|
378
|
+
args: [{
|
|
379
|
+
isSignal: true,
|
|
380
|
+
alias: "name",
|
|
381
|
+
required: false
|
|
382
|
+
}]
|
|
383
|
+
}]
|
|
384
|
+
}
|
|
385
|
+
});
|
|
386
|
+
var ColorPickerEyeDropperTrigger = class ColorPickerEyeDropperTrigger {
|
|
387
|
+
constructor() {
|
|
388
|
+
this.root = inject(ColorPickerRoot);
|
|
389
|
+
this.state = computed(() => this.root.state(), ...ngDevMode ? [{ debugName: "state" }] : /* istanbul ignore next */ []);
|
|
390
|
+
this.supported = signal(false, ...ngDevMode ? [{ debugName: "supported" }] : /* istanbul ignore next */ []);
|
|
391
|
+
this.pending = null;
|
|
392
|
+
this.element = conditionalView(this.supported, (element) => {
|
|
393
|
+
element.setAttribute("type", "button");
|
|
394
|
+
element.setAttribute("data-primitives-part", "color-picker-eye-dropper-trigger");
|
|
395
|
+
element.addEventListener("click", (event) => {
|
|
396
|
+
if (untracked(this.state).disabled) return;
|
|
397
|
+
this.pending?.abort();
|
|
398
|
+
const controller = new AbortController();
|
|
399
|
+
this.pending = controller;
|
|
400
|
+
openEyeDropper(element, controller.signal).then((picked) => {
|
|
401
|
+
if (picked !== null && !controller.signal.aborted && !untracked(this.state).disabled) this.root.pick(picked, event);
|
|
402
|
+
});
|
|
403
|
+
});
|
|
404
|
+
});
|
|
405
|
+
inject(DestroyRef).onDestroy(() => this.pending?.abort());
|
|
406
|
+
afterNextRender(() => this.supported.set(supportsEyeDropper(this.root.host)));
|
|
407
|
+
effect(() => {
|
|
408
|
+
const element = this.element();
|
|
409
|
+
const disabled = this.state().disabled;
|
|
410
|
+
if (element === null) return;
|
|
411
|
+
element.disabled = disabled;
|
|
412
|
+
if (disabled) element.setAttribute("data-disabled", "");
|
|
413
|
+
else element.removeAttribute("data-disabled");
|
|
414
|
+
});
|
|
415
|
+
}
|
|
416
|
+
static {
|
|
417
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
418
|
+
minVersion: "12.0.0",
|
|
419
|
+
version: "22.2.6",
|
|
420
|
+
ngImport: i0,
|
|
421
|
+
type: ColorPickerEyeDropperTrigger,
|
|
422
|
+
deps: [],
|
|
423
|
+
target: i0.ɵɵFactoryTarget.Directive
|
|
424
|
+
});
|
|
425
|
+
}
|
|
426
|
+
static {
|
|
427
|
+
this.ɵdir = i0.ɵɵngDeclareDirective({
|
|
428
|
+
minVersion: "14.0.0",
|
|
429
|
+
version: "22.2.6",
|
|
430
|
+
type: ColorPickerEyeDropperTrigger,
|
|
431
|
+
isStandalone: true,
|
|
432
|
+
selector: "[colorPickerEyeDropperTrigger]",
|
|
433
|
+
exportAs: ["colorPickerEyeDropperTrigger"],
|
|
434
|
+
ngImport: i0
|
|
435
|
+
});
|
|
436
|
+
}
|
|
437
|
+
};
|
|
438
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
439
|
+
minVersion: "12.0.0",
|
|
440
|
+
version: "22.2.6",
|
|
441
|
+
ngImport: i0,
|
|
442
|
+
type: ColorPickerEyeDropperTrigger,
|
|
443
|
+
decorators: [{
|
|
444
|
+
type: Directive,
|
|
445
|
+
args: [{
|
|
446
|
+
selector: "[colorPickerEyeDropperTrigger]",
|
|
447
|
+
exportAs: "colorPickerEyeDropperTrigger"
|
|
448
|
+
}]
|
|
449
|
+
}],
|
|
450
|
+
ctorParameters: () => []
|
|
451
|
+
});
|
|
452
|
+
var ColorPickerFormatSelect = class ColorPickerFormatSelect {
|
|
453
|
+
constructor() {
|
|
454
|
+
this.root = inject(ColorPickerRoot);
|
|
455
|
+
this.state = computed(() => this.root.state(), ...ngDevMode ? [{ debugName: "state" }] : /* istanbul ignore next */ []);
|
|
456
|
+
this.data = computed(() => dataValues({
|
|
457
|
+
format: this.state().format,
|
|
458
|
+
disabled: this.state().disabled
|
|
459
|
+
}), ...ngDevMode ? [{ debugName: "data" }] : /* istanbul ignore next */ []);
|
|
460
|
+
const select = injectHost();
|
|
461
|
+
afterRenderEffect(() => {
|
|
462
|
+
const format = this.state().format;
|
|
463
|
+
untracked(() => {
|
|
464
|
+
for (const option of select.options) option.defaultSelected = option.value === format;
|
|
465
|
+
select.value = format;
|
|
466
|
+
});
|
|
467
|
+
});
|
|
468
|
+
}
|
|
469
|
+
onChange(event) {
|
|
470
|
+
const next = event.target.value;
|
|
471
|
+
if (COLOR_PICKER_FORMATS.includes(next)) this.root.setFormat(next, event);
|
|
472
|
+
event.target.value = untracked(this.root.currentFormat);
|
|
473
|
+
}
|
|
474
|
+
static {
|
|
475
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
476
|
+
minVersion: "12.0.0",
|
|
477
|
+
version: "22.2.6",
|
|
478
|
+
ngImport: i0,
|
|
479
|
+
type: ColorPickerFormatSelect,
|
|
480
|
+
deps: [],
|
|
481
|
+
target: i0.ɵɵFactoryTarget.Directive
|
|
482
|
+
});
|
|
483
|
+
}
|
|
484
|
+
static {
|
|
485
|
+
this.ɵdir = i0.ɵɵngDeclareDirective({
|
|
486
|
+
minVersion: "14.0.0",
|
|
487
|
+
version: "22.2.6",
|
|
488
|
+
type: ColorPickerFormatSelect,
|
|
489
|
+
isStandalone: true,
|
|
490
|
+
selector: "select[colorPickerFormatSelect]",
|
|
491
|
+
host: {
|
|
492
|
+
attributes: { "data-primitives-part": "color-picker-format-select" },
|
|
493
|
+
listeners: { "change": "onChange($event)" },
|
|
494
|
+
properties: {
|
|
495
|
+
"disabled": "state().disabled",
|
|
496
|
+
"attr.data-format": "data().format",
|
|
497
|
+
"attr.data-disabled": "data().disabled"
|
|
498
|
+
}
|
|
499
|
+
},
|
|
500
|
+
exportAs: ["colorPickerFormatSelect"],
|
|
501
|
+
ngImport: i0
|
|
502
|
+
});
|
|
503
|
+
}
|
|
504
|
+
};
|
|
505
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
506
|
+
minVersion: "12.0.0",
|
|
507
|
+
version: "22.2.6",
|
|
508
|
+
ngImport: i0,
|
|
509
|
+
type: ColorPickerFormatSelect,
|
|
510
|
+
decorators: [{
|
|
511
|
+
type: Directive,
|
|
512
|
+
args: [{
|
|
513
|
+
selector: "select[colorPickerFormatSelect]",
|
|
514
|
+
exportAs: "colorPickerFormatSelect",
|
|
515
|
+
host: {
|
|
516
|
+
"data-primitives-part": "color-picker-format-select",
|
|
517
|
+
"[disabled]": "state().disabled",
|
|
518
|
+
"[attr.data-format]": "data().format",
|
|
519
|
+
"[attr.data-disabled]": "data().disabled",
|
|
520
|
+
"(change)": "onChange($event)"
|
|
521
|
+
}
|
|
522
|
+
}]
|
|
523
|
+
}],
|
|
524
|
+
ctorParameters: () => []
|
|
525
|
+
});
|
|
526
|
+
export { ColorPickerEyeDropperTrigger, ColorPickerFormatSelect, ColorPickerRoot };
|
|
527
|
+
|
|
528
|
+
//# sourceMappingURL=fragiola-primitives-angular-color-picker.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fragiola-primitives-angular-color-picker.mjs","names":[],"sources":["../../color-picker/directives/color-picker-root.directive.ts","../../color-picker/directives/color-picker-eye-dropper-trigger.directive.ts","../../color-picker/directives/color-picker-format-select.directive.ts"],"sourcesContent":["import {\n afterNextRender,\n booleanAttribute,\n computed,\n DestroyRef,\n Directive,\n effect,\n forwardRef,\n inject,\n input,\n output,\n PLATFORM_ID,\n untracked,\n} from \"@angular/core\";\nimport {\n type Color,\n type ColorSpace,\n convertColor,\n formatColor,\n isSameColor,\n parseColor,\n} from \"@fragiola/primitives/color\";\nimport { getTabbables } from \"@fragiola/primitives/focus\";\nimport { bridgeForm } from \"@fragiola/primitives/form\";\nimport {\n fieldControl,\n writeFieldAria,\n} from \"@fragiola/primitives-angular/field\";\nimport {\n type ChangeDetails,\n COLOR_PICKER_BINDING,\n type ColorPickerBinding,\n controllable,\n dataValues,\n injectHost,\n type ValueChangeEvent,\n} from \"@fragiola/primitives-angular/internal\";\n\n/** The picker's format: which channel controls the app shows (spec/color-picker.md, \"The format\"). */\nexport type ColorPickerFormat = \"hex\" | \"rgb\" | \"hsl\" | \"hsb\";\n\nexport const COLOR_PICKER_FORMATS: readonly ColorPickerFormat[] = [\n \"hex\",\n \"rgb\",\n \"hsl\",\n \"hsb\",\n];\n\n/** The state every ColorPicker part renders with. */\nexport interface ColorPickerState {\n /** The picker's color. */\n color: Color;\n format: ColorPickerFormat;\n disabled: boolean;\n}\n\nconst BLACK: Color = { space: \"rgb\", red: 0, green: 0, blue: 0, alpha: 1 };\n\n/** A `Color`, or a string `parseColor` reads (black when it reads none). */\nfunction toColor(value: Color | string): Color {\n return parseColor(value) ?? BLACK;\n}\n\n/**\n * The space a format converts the value to: hsl and hsb (they share `saturation`, so the value's\n * space decides); none for hex and rgb (red, green and blue are rgb's only, a hex reads any space,\n * and a conversion to rgb would round the channels away: a gray's hue).\n */\nfunction formatSpace(format: ColorPickerFormat): ColorSpace | null {\n return format === \"hsl\" || format === \"hsb\" ? format : null;\n}\n\n/**\n * Holds one color and shares it with the color controls inside it (spec/color-picker.md):\n * `<div colorPickerRoot [(value)]=\"color\" name=\"color\">`, a `group` with its format, its form value\n * as hex (a hidden input at its end) and its Field binding.\n */\n@Directive({\n selector: \"[colorPickerRoot]\",\n exportAs: \"colorPickerRoot\",\n providers: [\n {\n provide: COLOR_PICKER_BINDING,\n useFactory: () => inject(forwardRef(() => ColorPickerRoot)).binding,\n },\n ],\n host: {\n role: \"group\",\n \"data-primitives-part\": \"color-picker-root\",\n \"[style.--color-picker-color]\": \"css()\",\n \"[attr.data-invalid]\": \"field.data().invalid\",\n \"[attr.data-valid]\": \"field.data().valid\",\n \"[attr.data-dirty]\": \"field.data().dirty\",\n \"[attr.data-touched]\": \"field.data().touched\",\n \"[attr.data-filled]\": \"field.data().filled\",\n \"[attr.data-focused]\": \"field.data().focused\",\n \"[attr.data-format]\": \"data().format\",\n \"[attr.data-disabled]\": \"data().disabled\",\n \"(focusin)\": \"field.focused()\",\n \"(focusout)\": \"onFocusOut($event)\",\n },\n})\nexport class ColorPickerRoot {\n /** A `Color`, or a string `parseColor` reads; bound, the picker is controlled. */\n readonly value = input<Color | string | undefined>(undefined);\n readonly valueChange = output<Color>();\n readonly defaultValue = input<Color | string>(\"#000000\");\n /** The color, as the control that changed it reports it, with the change's details. */\n readonly valueChangeDetails = output<ValueChangeEvent<Color>>();\n /** Once a control's change is complete (a drag ended, a key, a commit, a choice, a pick). */\n readonly valueCommit = output<Color>();\n /** The format (bound: controlled). */\n readonly format = input<ColorPickerFormat | undefined>(undefined);\n readonly formatChange = output<ColorPickerFormat>();\n readonly defaultFormat = input<ColorPickerFormat>(\"hex\");\n readonly formatChangeDetails =\n output<ValueChangeEvent<ColorPickerFormat>>();\n /** Every control inside is disabled. */\n readonly disabled = input(false, { transform: booleanAttribute });\n readonly name = input<string | undefined>(undefined);\n\n /** The Root's element (the eyedropper's API is read on its window). */\n readonly host = injectHost();\n private readonly current = controllable<Color, ChangeDetails>(\n computed(() => {\n const value = this.value();\n return value === undefined ? undefined : toColor(value);\n }),\n this.valueChange,\n () => toColor(this.defaultValue()),\n (value, details) => this.valueChangeDetails.emit({ value, details }),\n );\n private readonly ownFormat = controllable<ColorPickerFormat, ChangeDetails>(\n this.format,\n this.formatChange,\n () => this.defaultFormat(),\n (value, details) => this.formatChangeDetails.emit({ value, details }),\n );\n /** The picker's color. */\n readonly color = this.current.value;\n /** The picker's format. */\n readonly currentFormat = this.ownFormat.value;\n private readonly hex = computed(() => formatColor(this.color(), \"hex\"));\n protected readonly css = computed(() => formatColor(this.color(), \"css\"));\n /** The hidden input, once created (in the browser). */\n private hidden: HTMLInputElement | null = null;\n /** The enclosing field's binding: the picker is the field's control (a `group`). */\n readonly field = fieldControl({\n id: computed(() => undefined),\n labelable: false,\n value: this.hex,\n // a picker always has a color\n filled: computed(() => true),\n input: () => this.hidden,\n element: () => this.host,\n focusTarget: () => getTabbables(this.host)[0] ?? null,\n });\n /** Its own `disabled`, or the field's. */\n readonly isDisabled = computed(\n () => this.disabled() || this.field.disabled(),\n );\n readonly state = computed<ColorPickerState>(() => ({\n color: this.color(),\n format: this.currentFormat(),\n disabled: this.isDisabled(),\n }));\n protected readonly data = computed(() =>\n dataValues({\n format: this.currentFormat(),\n disabled: this.isDisabled(),\n }),\n );\n /** What the controls inside read (spec/color-picker.md, \"Sharing the color\"). */\n readonly binding: ColorPickerBinding = {\n value: this.color,\n disabled: this.isDisabled,\n setValue: (color, details) => this.current.set(color, details),\n commit: (color) => this.valueCommit.emit(color),\n registerPopup: (element) => this.registerPopup(element),\n };\n /** The popups' positioners, portalled out of the Root: inside the picker for its Field. */\n private readonly popups = new Set<HTMLElement>();\n /** Focus left a popup for nowhere: the next focus decides whether the picker was left. */\n private stopReturnWatch: (() => void) | null = null;\n\n constructor() {\n const host = this.host;\n writeFieldAria(this.field, host, {\n \"aria-labelledby\": this.field.labelledBy,\n \"aria-describedby\": this.field.describedBy,\n \"aria-invalid\": this.field.ariaInvalid,\n });\n // the `type=\"hidden\"` input with the color as hex, after the consumer's children (as React\n // renders it); in the browser only (a server's would be a second one once hydrated)\n const browser = inject(PLATFORM_ID) === \"browser\";\n effect(() => {\n if (!browser) {\n return;\n }\n const hex = this.hex();\n const name = this.field.name() ?? this.name();\n const disabled = this.isDisabled();\n untracked(() => {\n if (this.hidden === null) {\n const element = host.ownerDocument.createElement(\"input\");\n element.type = \"hidden\";\n element.setAttribute(\n \"data-primitives-part\",\n \"color-picker-input\",\n );\n host.appendChild(element);\n this.hidden = element;\n }\n const hidden = this.hidden;\n if (name === undefined) {\n hidden.removeAttribute(\"name\");\n } else {\n hidden.name = name;\n }\n hidden.value = hex;\n hidden.disabled = disabled;\n });\n });\n // a form reset returns the picker to its default, and every bound control with it\n let stop: (() => void) | null = null;\n afterNextRender(() => {\n const hidden = this.hidden;\n if (hidden !== null) {\n stop = bridgeForm(hidden, {\n reset: () => {\n const next = toColor(untracked(this.defaultValue));\n if (!isSameColor(next, untracked(this.color))) {\n this.field.reset();\n this.current.set(next, { reason: \"none\" });\n }\n },\n });\n }\n });\n inject(DestroyRef).onDestroy(() => {\n stop?.();\n this.hidden?.remove();\n this.stopReturnWatch?.();\n });\n }\n\n /** The FormatSelect chose a format: it converts the value to the format's space. */\n setFormat(format: ColorPickerFormat, event: Event): void {\n const details = { reason: \"input-change\" as const, event };\n this.ownFormat.set(format, details);\n const now = untracked(this.color);\n const space = formatSpace(format);\n if (space !== null && now.space !== space) {\n this.current.set(convertColor(now, space), details);\n }\n }\n\n /** The eyedropper picked a color: set in the value's space, its alpha kept, and committed. */\n pick(picked: Color, event: Event | undefined): void {\n const now = untracked(this.color);\n const next = convertColor({ ...picked, alpha: now.alpha }, now.space);\n this.current.set(next, { reason: \"trigger-press\", event });\n this.valueCommit.emit(next);\n }\n\n protected onFocusOut(event: FocusEvent): void {\n const next = event.relatedTarget;\n const inPicker = (node: Node) =>\n this.host.contains(node) ||\n [...this.popups].some((popup) => popup.contains(node));\n this.stopReturnWatch?.();\n // focus that leaves a closing popup for nowhere is returned to its trigger (Popover's\n // focus return): no blur. The next focus decides: the popup's Tab out closes it (its view\n // removed at once, zoneless) before it focuses the element after the trigger\n if (\n next === null &&\n event.target instanceof Node &&\n [...this.popups].some((popup) =>\n popup.contains(event.target as Node),\n )\n ) {\n const doc = this.host.ownerDocument;\n const onFocusIn = (focus: FocusEvent) => {\n this.stopReturnWatch?.();\n if (\n !(focus.target instanceof Node) ||\n !inPicker(focus.target)\n ) {\n this.field.blurred();\n }\n };\n doc.addEventListener(\"focusin\", onFocusIn, true);\n this.stopReturnWatch = () => {\n doc.removeEventListener(\"focusin\", onFocusIn, true);\n this.stopReturnWatch = null;\n };\n return;\n }\n if (!(next instanceof Node) || !inPicker(next)) {\n this.field.blurred();\n }\n }\n\n /** A popup's positioner is part of the picker: its focus is the Field's (native listeners). */\n private registerPopup(element: HTMLElement): () => void {\n this.popups.add(element);\n const onFocusIn = () => this.field.focused();\n const onFocusOut = (event: FocusEvent) => this.onFocusOut(event);\n element.addEventListener(\"focusin\", onFocusIn);\n element.addEventListener(\"focusout\", onFocusOut);\n return () => {\n this.popups.delete(element);\n element.removeEventListener(\"focusin\", onFocusIn);\n element.removeEventListener(\"focusout\", onFocusOut);\n };\n }\n}\n","import {\n afterNextRender,\n computed,\n DestroyRef,\n Directive,\n effect,\n inject,\n signal,\n untracked,\n} from \"@angular/core\";\nimport { openEyeDropper, supportsEyeDropper } from \"@fragiola/primitives/color\";\nimport { conditionalView } from \"@fragiola/primitives-angular/internal\";\nimport {\n ColorPickerRoot,\n type ColorPickerState,\n} from \"./color-picker-root.directive.ts\";\n\n/**\n * Picks a color on screen with the browser's eyedropper (spec/color-picker.md,\n * \"EyeDropperTrigger\"); structural, rendered only once in the browser where `EyeDropper` exists:\n * `<button *colorPickerEyeDropperTrigger>Pick a color</button>`. The directive writes its\n * attributes on the element it renders.\n */\n@Directive({\n selector: \"[colorPickerEyeDropperTrigger]\",\n exportAs: \"colorPickerEyeDropperTrigger\",\n})\nexport class ColorPickerEyeDropperTrigger {\n private readonly root = inject(ColorPickerRoot);\n readonly state = computed<ColorPickerState>(() => this.root.state());\n // the API is the browser's: read after the first render, so the server render and hydration\n // match\n private readonly supported = signal(false);\n /** The pick in progress: aborted by the next press and when the trigger is destroyed. */\n private pending: AbortController | null = null;\n protected readonly element = conditionalView(this.supported, (element) => {\n element.setAttribute(\"type\", \"button\");\n element.setAttribute(\n \"data-primitives-part\",\n \"color-picker-eye-dropper-trigger\",\n );\n element.addEventListener(\"click\", (event) => {\n if (untracked(this.state).disabled) {\n return;\n }\n this.pending?.abort();\n const controller = new AbortController();\n this.pending = controller;\n void openEyeDropper(element, controller.signal).then((picked) => {\n // a pick that resolves once the picker is disabled, or the trigger destroyed,\n // is dropped\n if (\n picked !== null &&\n !controller.signal.aborted &&\n !untracked(this.state).disabled\n ) {\n this.root.pick(picked, event);\n }\n });\n });\n });\n\n constructor() {\n inject(DestroyRef).onDestroy(() => this.pending?.abort());\n afterNextRender(() =>\n this.supported.set(supportsEyeDropper(this.root.host)),\n );\n effect(() => {\n const element = this.element();\n const disabled = this.state().disabled;\n if (element === null) {\n return;\n }\n (element as HTMLButtonElement).disabled = disabled;\n if (disabled) {\n element.setAttribute(\"data-disabled\", \"\");\n } else {\n element.removeAttribute(\"data-disabled\");\n }\n });\n }\n}\n","import {\n afterRenderEffect,\n computed,\n Directive,\n inject,\n untracked,\n} from \"@angular/core\";\nimport { dataValues, injectHost } from \"@fragiola/primitives-angular/internal\";\nimport {\n COLOR_PICKER_FORMATS,\n type ColorPickerFormat,\n ColorPickerRoot,\n type ColorPickerState,\n} from \"./color-picker-root.directive.ts\";\n\n/**\n * A native `select` of the picker's format (spec/color-picker.md, \"The format\"):\n * `<select colorPickerFormatSelect aria-label=\"Format\">` holding the app's `<option value=\"hex\">`s.\n */\n@Directive({\n selector: \"select[colorPickerFormatSelect]\",\n exportAs: \"colorPickerFormatSelect\",\n host: {\n \"data-primitives-part\": \"color-picker-format-select\",\n \"[disabled]\": \"state().disabled\",\n \"[attr.data-format]\": \"data().format\",\n \"[attr.data-disabled]\": \"data().disabled\",\n \"(change)\": \"onChange($event)\",\n },\n})\nexport class ColorPickerFormatSelect {\n protected readonly root = inject(ColorPickerRoot);\n readonly state = computed<ColorPickerState>(() => this.root.state());\n protected readonly data = computed(() =>\n dataValues({\n format: this.state().format,\n disabled: this.state().disabled,\n }),\n );\n\n constructor() {\n const select = injectHost() as HTMLSelectElement;\n // the selected option is the select's own state, set after the render (a server marks no\n // option); its default too, so a form reset shows the picker's format again\n afterRenderEffect(() => {\n const format = this.state().format;\n untracked(() => {\n for (const option of select.options) {\n option.defaultSelected = option.value === format;\n }\n select.value = format;\n });\n });\n }\n\n protected onChange(event: Event): void {\n const next = (event.target as HTMLSelectElement)\n .value as ColorPickerFormat;\n if (COLOR_PICKER_FORMATS.includes(next)) {\n this.root.setFormat(next, event);\n }\n // a refused change shows the format again\n (event.target as HTMLSelectElement).value = untracked(\n this.root.currentFormat,\n );\n }\n}\n"],"mappings":";;;;;;;AAyCA,MAAa,uBAAqD;CAC9D;CACA;CACA;CACA;AACH;AAUD,MAAM,QAAe;CAAE,OAAO;CAAO,KAAK;CAAG,OAAO;CAAG,MAAM;CAAG,OAAO;AAAC;AAGxE,SAAS,QAAQ,OAAqB;CAClC,OAAO,WAAW,KAAK,KAAK;AAChC;AAOA,SAAS,YAAY,QAAyB;CAC1C,OAAO,WAAW,SAAS,WAAW,QAAQ,SAAS;AAC3D;AAgCA,IAAa,kBAAb,MAAa,gBAAe;CAmFxB,cAAA;EAjFS,KAAA,QAAQ,MAAkC,QAAU,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