@vallift/ngl 0.0.10 → 0.0.11

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.
@@ -1,5 +1,5 @@
1
1
  import * as i0 from '@angular/core';
2
- import { InjectionToken, inject, Injectable, signal, input, output, Component, Input, ElementRef, Renderer2, EventEmitter, Output, RendererFactory2, HostListener, Directive, computed, ViewChild, Inject, Pipe, ViewContainerRef, ContentChildren, ChangeDetectionStrategy, ChangeDetectorRef, viewChild } from '@angular/core';
2
+ import { InjectionToken, inject, Injectable, signal, input, output, Component, Input, ElementRef, Renderer2, EventEmitter, Output, RendererFactory2, HostListener, Directive, computed, ChangeDetectorRef, model, ViewChild, ViewContainerRef, ComponentFactoryResolver, ApplicationRef, Injector, Inject, Pipe, ContentChildren, ChangeDetectionStrategy, viewChild } from '@angular/core';
3
3
  import * as i1$1 from '@angular/common/http';
4
4
  import { HttpClient, HttpHeaders, HttpRequest } from '@angular/common/http';
5
5
  import { retry, throwError, Subject, debounceTime, fromEvent, filter as filter$1, take, of } from 'rxjs';
@@ -10,7 +10,7 @@ import { Router, NavigationStart, NavigationEnd } from '@angular/router';
10
10
  import { DialogRef, DIALOG_DATA, Dialog } from '@angular/cdk/dialog';
11
11
  import { Overlay, OverlayConfig, CdkConnectedOverlay } from '@angular/cdk/overlay';
12
12
  import { BreakpointObserver, Breakpoints } from '@angular/cdk/layout';
13
- import { NgClass, DOCUMENT, CommonModule, DatePipe, NgStyle } from '@angular/common';
13
+ import { NgClass, DOCUMENT, NgStyle, CommonModule, DatePipe } from '@angular/common';
14
14
  import { SvgIconComponent } from 'angular-svg-icon';
15
15
  import { CdkPortal } from '@angular/cdk/portal';
16
16
  import { NgxMaskDirective } from 'ngx-mask';
@@ -1593,11 +1593,868 @@ class CloseButtonComponent {
1593
1593
  }
1594
1594
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: CloseButtonComponent, decorators: [{
1595
1595
  type: Component,
1596
- args: [{ selector: 'app-close-button', standalone: true, imports: [
1597
- AppSvgIconComponent
1598
- ], template: "<p class=\"rounded-lg p-3 border border-neutral-300 cursor-pointer hover:bg-neutral-50\">\n <svg class=\"w-12 h-12 text-neutral-800\" xmlns=\"http://www.w3.org/2000/svg\" id=\"mdi-window-close\" viewBox=\"0 0 24 24\">\n <path\n fill=\"currentColor\"\n d=\"M13.46,12L19,17.54V19H17.54L12,13.46L6.46,19H5V17.54L10.54,12L5,6.46V5H6.46L12,10.54L17.54,5H19V6.46L13.46,12Z\"/>\n </svg>\n\n</p>\n" }]
1596
+ args: [{ selector: 'app-close-button', standalone: true, imports: [], template: "<p class=\"rounded-lg p-3 border border-neutral-300 cursor-pointer hover:bg-neutral-50\">\n <svg class=\"w-12 h-12 text-neutral-800\" xmlns=\"http://www.w3.org/2000/svg\" id=\"mdi-window-close\" viewBox=\"0 0 24 24\">\n <path\n fill=\"currentColor\"\n d=\"M13.46,12L19,17.54V19H17.54L12,13.46L6.46,19H5V17.54L10.54,12L5,6.46V5H6.46L12,10.54L17.54,5H19V6.46L13.46,12Z\"/>\n </svg>\n\n</p>\n" }]
1599
1597
  }] });
1600
1598
 
1599
+ class Rgba {
1600
+ r;
1601
+ g;
1602
+ b;
1603
+ a;
1604
+ constructor(r, g, b, a) {
1605
+ this.r = r;
1606
+ this.g = g;
1607
+ this.b = b;
1608
+ this.a = a;
1609
+ }
1610
+ denormalize() {
1611
+ this.r = Math.round(this.r * 255);
1612
+ this.g = Math.round(this.g * 255);
1613
+ this.b = Math.round(this.b * 255);
1614
+ return this;
1615
+ }
1616
+ toString() {
1617
+ this.denormalize();
1618
+ let output = 'rgb' +
1619
+ (this.a != 1 ? 'a(' : '(') +
1620
+ this.r + ', ' +
1621
+ this.g + ', ' +
1622
+ this.b +
1623
+ (this.a != 1 ? ', ' + this.a.toPrecision(2) + ')' : ')');
1624
+ return output;
1625
+ }
1626
+ }
1627
+ class Hsva {
1628
+ h;
1629
+ s;
1630
+ v;
1631
+ a;
1632
+ onChange = new EventEmitter(true);
1633
+ constructor(h, s, v, a) {
1634
+ this.h = h;
1635
+ this.s = s;
1636
+ this.v = v;
1637
+ this.a = a;
1638
+ }
1639
+ onColorChange(value) {
1640
+ this.s = value.s / value.rgX;
1641
+ this.v = value.v / value.rgY;
1642
+ }
1643
+ onHueChange(value) {
1644
+ this.h = value.v / value.rgX;
1645
+ // this.sliderH = this.hsva.h;
1646
+ }
1647
+ onValueChange(value) {
1648
+ this.v = value.v / value.rgX;
1649
+ }
1650
+ onAlphaChange(value) {
1651
+ this.a = value.v / value.rgX;
1652
+ }
1653
+ }
1654
+ class Hsla {
1655
+ h;
1656
+ s;
1657
+ l;
1658
+ a;
1659
+ constructor(h, s, l, a) {
1660
+ this.h = h;
1661
+ this.s = s;
1662
+ this.l = l;
1663
+ this.a = a;
1664
+ }
1665
+ denormalize() {
1666
+ this.h = Math.round(this.h * 360);
1667
+ this.s = Math.round(this.s * 100);
1668
+ this.l = Math.round(this.l * 100);
1669
+ return this;
1670
+ }
1671
+ toString() {
1672
+ let output = 'hsl' +
1673
+ (this.a != 1 ? 'a(' : '(') +
1674
+ this.h + ', ' +
1675
+ this.s + '%, ' +
1676
+ this.l + '%' +
1677
+ (this.a != 1 ? ', ' + this.a.toPrecision(2) + ')' : ')');
1678
+ return output;
1679
+ }
1680
+ }
1681
+ class Cmyk {
1682
+ c;
1683
+ m;
1684
+ y;
1685
+ k;
1686
+ a;
1687
+ constructor(c, m, y, k, a = 1) {
1688
+ this.c = c;
1689
+ this.m = m;
1690
+ this.y = y;
1691
+ this.k = k;
1692
+ this.a = a;
1693
+ }
1694
+ }
1695
+
1696
+ var ColorFormats;
1697
+ (function (ColorFormats) {
1698
+ ColorFormats[ColorFormats["HEX"] = 0] = "HEX";
1699
+ ColorFormats[ColorFormats["RGBA"] = 1] = "RGBA";
1700
+ ColorFormats[ColorFormats["HSLA"] = 2] = "HSLA";
1701
+ ColorFormats[ColorFormats["CMYK"] = 3] = "CMYK";
1702
+ })(ColorFormats || (ColorFormats = {}));
1703
+
1704
+ class ColorConverterService {
1705
+ // private active: ColorPickerComponent | null = null;
1706
+ constructor() { }
1707
+ // public setActive(active: ColorPickerComponent | null): void {
1708
+ // this.active = active;
1709
+ // }
1710
+ toFormat(hsva, format) {
1711
+ var output = "";
1712
+ if (hsva) {
1713
+ switch (format) {
1714
+ case ColorFormats.HEX:
1715
+ var rgba = this.hsvaToRgba(hsva);
1716
+ rgba.denormalize();
1717
+ var output = this.rgbaToHex(rgba, true);
1718
+ break;
1719
+ case ColorFormats.HSLA:
1720
+ var hsla = this.hsva2hsla(hsva);
1721
+ hsla.denormalize();
1722
+ var output = hsla.toString();
1723
+ break;
1724
+ case ColorFormats.RGBA:
1725
+ var rgba = this.hsvaToRgba(hsva);
1726
+ var output = rgba.toString();
1727
+ break;
1728
+ case ColorFormats.CMYK:
1729
+ var rgba = this.hsvaToRgba(hsva);
1730
+ var cmyk = this.rgbaToCmyk(rgba);
1731
+ break;
1732
+ }
1733
+ }
1734
+ return output;
1735
+ }
1736
+ stringToFormat(color, format) {
1737
+ var hsva = this.stringToHsva(color, true);
1738
+ return this.toFormat(hsva, format);
1739
+ }
1740
+ hsva2hsla(hsva) {
1741
+ const h = hsva.h, s = hsva.s, v = hsva.v, a = hsva.a;
1742
+ if (v === 0) {
1743
+ return new Hsla(h, 0, 0, a);
1744
+ }
1745
+ else if (s === 0 && v === 1) {
1746
+ return new Hsla(h, 1, 1, a);
1747
+ }
1748
+ else {
1749
+ const l = (v * (2 - s)) / 2;
1750
+ return new Hsla(h, (v * s) / (1 - Math.abs(2 * l - 1)), l, a);
1751
+ }
1752
+ }
1753
+ hsla2hsva(hsla) {
1754
+ const h = Math.min(hsla.h, 1), s = Math.min(hsla.s, 1);
1755
+ const l = Math.min(hsla.l, 1), a = Math.min(hsla.a, 1);
1756
+ if (l === 0) {
1757
+ return new Hsva(h, 0, 0, a);
1758
+ }
1759
+ else {
1760
+ const v = l + (s * (1 - Math.abs(2 * l - 1))) / 2;
1761
+ return new Hsva(h, (2 * (v - l)) / v, v, a);
1762
+ }
1763
+ }
1764
+ hsvaToRgba(hsva) {
1765
+ let r, g, b;
1766
+ const h = hsva.h, s = hsva.s, v = hsva.v, a = hsva.a;
1767
+ const i = Math.floor(h * 6);
1768
+ const f = h * 6 - i;
1769
+ const p = v * (1 - s);
1770
+ const q = v * (1 - f * s);
1771
+ const t = v * (1 - (1 - f) * s);
1772
+ switch (i % 6) {
1773
+ case 0:
1774
+ (r = v), (g = t), (b = p);
1775
+ break;
1776
+ case 1:
1777
+ (r = q), (g = v), (b = p);
1778
+ break;
1779
+ case 2:
1780
+ (r = p), (g = v), (b = t);
1781
+ break;
1782
+ case 3:
1783
+ (r = p), (g = q), (b = v);
1784
+ break;
1785
+ case 4:
1786
+ (r = t), (g = p), (b = v);
1787
+ break;
1788
+ case 5:
1789
+ (r = v), (g = p), (b = q);
1790
+ break;
1791
+ default:
1792
+ (r = 0), (g = 0), (b = 0);
1793
+ }
1794
+ return new Rgba(r, g, b, a);
1795
+ }
1796
+ cmykToRgb(cmyk) {
1797
+ const r = (1 - cmyk.c) * (1 - cmyk.k);
1798
+ const g = (1 - cmyk.m) * (1 - cmyk.k);
1799
+ const b = (1 - cmyk.y) * (1 - cmyk.k);
1800
+ return new Rgba(r, g, b, cmyk.a);
1801
+ }
1802
+ rgbaToCmyk(rgba) {
1803
+ const k = 1 - Math.max(rgba.r, rgba.g, rgba.b);
1804
+ if (k === 1) {
1805
+ return new Cmyk(0, 0, 0, 1, rgba.a);
1806
+ }
1807
+ else {
1808
+ const c = (1 - rgba.r - k) / (1 - k);
1809
+ const m = (1 - rgba.g - k) / (1 - k);
1810
+ const y = (1 - rgba.b - k) / (1 - k);
1811
+ return new Cmyk(c, m, y, k, rgba.a);
1812
+ }
1813
+ }
1814
+ rgbaToHsva(rgba) {
1815
+ let h, s;
1816
+ const r = Math.min(rgba.r, 1), g = Math.min(rgba.g, 1);
1817
+ const b = Math.min(rgba.b, 1), a = Math.min(rgba.a, 1);
1818
+ const max = Math.max(r, g, b), min = Math.min(r, g, b);
1819
+ const v = max, d = max - min;
1820
+ s = max === 0 ? 0 : d / max;
1821
+ if (max === min) {
1822
+ h = 0;
1823
+ }
1824
+ else {
1825
+ switch (max) {
1826
+ case r:
1827
+ h = (g - b) / d + (g < b ? 6 : 0);
1828
+ break;
1829
+ case g:
1830
+ h = (b - r) / d + 2;
1831
+ break;
1832
+ case b:
1833
+ h = (r - g) / d + 4;
1834
+ break;
1835
+ default:
1836
+ h = 0;
1837
+ }
1838
+ h /= 6;
1839
+ }
1840
+ return new Hsva(h, s, v, a);
1841
+ }
1842
+ rgbaToHex(rgba, allowHex8) {
1843
+ /* tslint:disable:no-bitwise */
1844
+ let hex = "#" +
1845
+ ((1 << 24) | (rgba.r << 16) | (rgba.g << 8) | rgba.b)
1846
+ .toString(16)
1847
+ .substr(1);
1848
+ if (rgba.a != 1) {
1849
+ hex += ((1 << 8) | Math.round(rgba.a * 255)).toString(16).substr(1);
1850
+ }
1851
+ /* tslint:enable:no-bitwise */
1852
+ return hex;
1853
+ }
1854
+ normalizeCMYK(cmyk) {
1855
+ return new Cmyk(cmyk.c / 100, cmyk.m / 100, cmyk.y / 100, cmyk.k / 100, cmyk.a);
1856
+ }
1857
+ denormalizeCMYK(cmyk) {
1858
+ return new Cmyk(Math.floor(cmyk.c * 100), Math.floor(cmyk.m * 100), Math.floor(cmyk.y * 100), Math.floor(cmyk.k * 100), cmyk.a);
1859
+ }
1860
+ denormalizeRGBA(rgba) {
1861
+ return new Rgba(Math.round(rgba.r * 255), Math.round(rgba.g * 255), Math.round(rgba.b * 255), rgba.a);
1862
+ }
1863
+ stringToHsva(colorString = "", allowHex8 = true) {
1864
+ let hsva = null;
1865
+ colorString = (colorString || "").toLowerCase();
1866
+ const stringParsers = [
1867
+ {
1868
+ re: /(rgb)a?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*%?,\s*(\d{1,3})\s*%?(?:,\s*(\d+(?:\.\d+)?)\s*)?\)/,
1869
+ parse: function (execResult) {
1870
+ return new Rgba(parseInt(execResult[2], 10) / 255, parseInt(execResult[3], 10) / 255, parseInt(execResult[4], 10) / 255, isNaN(parseFloat(execResult[5])) ? 1 : parseFloat(execResult[5]));
1871
+ },
1872
+ },
1873
+ {
1874
+ re: /(hsl)a?\(\s*(\d{1,3})\s*,\s*(\d{1,3})%\s*,\s*(\d{1,3})%\s*(?:,\s*(\d+(?:\.\d+)?)\s*)?\)/,
1875
+ parse: function (execResult) {
1876
+ return new Hsla(parseInt(execResult[2], 10) / 360, parseInt(execResult[3], 10) / 100, parseInt(execResult[4], 10) / 100, isNaN(parseFloat(execResult[5])) ? 1 : parseFloat(execResult[5]));
1877
+ },
1878
+ },
1879
+ ];
1880
+ if (allowHex8) {
1881
+ stringParsers.push({
1882
+ re: /#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})?$/,
1883
+ parse: function (execResult) {
1884
+ return new Rgba(parseInt(execResult[1], 16) / 255, parseInt(execResult[2], 16) / 255, parseInt(execResult[3], 16) / 255, parseInt(execResult[4] || "FF", 16) / 255);
1885
+ },
1886
+ });
1887
+ }
1888
+ else {
1889
+ stringParsers.push({
1890
+ re: /#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})$/,
1891
+ parse: function (execResult) {
1892
+ return new Rgba(parseInt(execResult[1], 16) / 255, parseInt(execResult[2], 16) / 255, parseInt(execResult[3], 16) / 255, 1);
1893
+ },
1894
+ });
1895
+ }
1896
+ stringParsers.push({
1897
+ re: /#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])$/,
1898
+ parse: function (execResult) {
1899
+ return new Rgba(parseInt(execResult[1] + execResult[1], 16) / 255, parseInt(execResult[2] + execResult[2], 16) / 255, parseInt(execResult[3] + execResult[3], 16) / 255, 1);
1900
+ },
1901
+ });
1902
+ for (const key in stringParsers) {
1903
+ if (stringParsers.hasOwnProperty(key)) {
1904
+ const parser = stringParsers[key];
1905
+ const match = parser.re.exec(colorString), color = match && parser.parse(match);
1906
+ if (color) {
1907
+ if (color instanceof Rgba) {
1908
+ hsva = this.rgbaToHsva(color);
1909
+ }
1910
+ else if (color instanceof Hsla) {
1911
+ hsva = this.hsla2hsva(color);
1912
+ }
1913
+ return hsva;
1914
+ }
1915
+ }
1916
+ }
1917
+ return hsva;
1918
+ }
1919
+ outputFormat(hsva) {
1920
+ return this.hsvaToRgba(hsva).toString();
1921
+ }
1922
+ getFormatByString(color) {
1923
+ if (color) {
1924
+ color = color.toLowerCase();
1925
+ let regexHex = /(#([\da-f]{3}(?:[\da-f]{3})?(?:[\da-f]{2})?))/;
1926
+ let regexRGBA = /(rgba\((\d{1,3},\s?){3}(1|0?\.\d+)\)|rgb\(\d{1,3}(,\s?\d{1,3}){2}\))/;
1927
+ let regexHSLA = /(hsla\((\d{1,3}%?,\s?){3}(1|0?\.\d+)\)|hsl\(\d{1,3}%?(,\s?\d{1,3}%?){2}\))/;
1928
+ if (regexHex.test(color)) {
1929
+ return "hex";
1930
+ }
1931
+ else if (regexRGBA.test(color)) {
1932
+ return "rgba";
1933
+ }
1934
+ else if (regexHSLA.test(color)) {
1935
+ return "hsla";
1936
+ }
1937
+ }
1938
+ return "hex";
1939
+ }
1940
+ isValidHexColor(hex) {
1941
+ if (!hex) {
1942
+ return false;
1943
+ }
1944
+ const hexColorPattern = /^#?([A-Fa-f0-9]{3}|[A-Fa-f0-9]{6}|[A-Fa-f0-9]{8})$/;
1945
+ return hexColorPattern.test(hex);
1946
+ }
1947
+ addHexPrefixIfMissing(hex) {
1948
+ if (!hex.startsWith('#')) {
1949
+ return '#' + hex;
1950
+ }
1951
+ return hex;
1952
+ }
1953
+ removeAlpha(hex) {
1954
+ const cleanHex = hex.startsWith('#') ? hex.slice(1) : hex;
1955
+ const rgbHex = cleanHex.length === 8 ? cleanHex.slice(0, 6) : cleanHex;
1956
+ return `#${rgbHex.toUpperCase()}`;
1957
+ }
1958
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: ColorConverterService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
1959
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: ColorConverterService, providedIn: 'root' });
1960
+ }
1961
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: ColorConverterService, decorators: [{
1962
+ type: Injectable,
1963
+ args: [{
1964
+ providedIn: 'root'
1965
+ }]
1966
+ }], ctorParameters: () => [] });
1967
+
1968
+ class SliderPosition {
1969
+ h;
1970
+ s;
1971
+ v;
1972
+ a;
1973
+ constructor(h, s, v, a) {
1974
+ this.h = h;
1975
+ this.s = s;
1976
+ this.v = v;
1977
+ this.a = a;
1978
+ }
1979
+ }
1980
+ class SliderDimension {
1981
+ h;
1982
+ s;
1983
+ v;
1984
+ a;
1985
+ constructor(h, s, v, a) {
1986
+ this.h = h;
1987
+ this.s = s;
1988
+ this.v = v;
1989
+ this.a = a;
1990
+ }
1991
+ }
1992
+
1993
+ class ColorPickerSliderDirective {
1994
+ listenerMove;
1995
+ listenerStop;
1996
+ rgX;
1997
+ rgY;
1998
+ dragEnd = new EventEmitter();
1999
+ dragStart = new EventEmitter();
2000
+ valueChanged = new EventEmitter();
2001
+ elementRef = inject(ElementRef);
2002
+ mouseDown(event) {
2003
+ this.start(event);
2004
+ }
2005
+ touchStart(event) {
2006
+ this.start(event);
2007
+ }
2008
+ constructor() {
2009
+ this.listenerMove = (event) => this.move(event);
2010
+ this.listenerStop = () => this.stop();
2011
+ }
2012
+ move(event) {
2013
+ event.preventDefault();
2014
+ this.setCursor(event);
2015
+ }
2016
+ start(event) {
2017
+ this.setCursor(event);
2018
+ event.stopPropagation();
2019
+ document.addEventListener('mouseup', this.listenerStop);
2020
+ document.addEventListener('touchend', this.listenerStop);
2021
+ document.addEventListener('mousemove', this.listenerMove);
2022
+ document.addEventListener('touchmove', this.listenerMove);
2023
+ this.dragStart.emit();
2024
+ }
2025
+ stop() {
2026
+ document.removeEventListener('mouseup', this.listenerStop);
2027
+ document.removeEventListener('touchend', this.listenerStop);
2028
+ document.removeEventListener('mousemove', this.listenerMove);
2029
+ document.removeEventListener('touchmove', this.listenerMove);
2030
+ this.dragEnd.emit();
2031
+ }
2032
+ getXAxis(event) {
2033
+ const position = this.elementRef.nativeElement.getBoundingClientRect();
2034
+ const pageX = (event.pageX !== undefined) ? event.pageX : event.touches[0].pageX;
2035
+ return pageX - position.left - window.pageXOffset;
2036
+ }
2037
+ getYAxis(event) {
2038
+ const position = this.elementRef.nativeElement.getBoundingClientRect();
2039
+ const pageY = (event.pageY !== undefined) ? event.pageY : event.touches[0].pageY;
2040
+ return pageY - position.top - window.pageXOffset;
2041
+ }
2042
+ setCursor(event) {
2043
+ const width = this.elementRef.nativeElement.offsetWidth;
2044
+ const height = this.elementRef.nativeElement.offsetHeight;
2045
+ const x = Math.max(0, Math.min(this.getXAxis(event), width));
2046
+ const y = Math.max(0, Math.min(this.getYAxis(event), height));
2047
+ if (this.rgX !== undefined && this.rgY !== undefined) {
2048
+ this.valueChanged.emit({ x: x, y: y, s: x / width, v: (1 - y / height), rgX: this.rgX, rgY: this.rgY });
2049
+ }
2050
+ else if (this.rgX === undefined && this.rgY !== undefined) {
2051
+ this.valueChanged.emit({ x: x, y: y, v: y / height, rgY: this.rgY });
2052
+ }
2053
+ else if (this.rgX !== undefined && this.rgY === undefined) {
2054
+ this.valueChanged.emit({ x: x, y: y, v: x / width, rgX: this.rgX });
2055
+ }
2056
+ }
2057
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: ColorPickerSliderDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
2058
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.7", type: ColorPickerSliderDirective, isStandalone: true, selector: "[colorPickerSlider]", inputs: { rgX: "rgX", rgY: "rgY" }, outputs: { dragEnd: "dragEnd", dragStart: "dragStart", valueChanged: "valueChanged" }, host: { listeners: { "mousedown": "mouseDown($event)", "touchstart": "touchStart($event)" } }, ngImport: i0 });
2059
+ }
2060
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: ColorPickerSliderDirective, decorators: [{
2061
+ type: Directive,
2062
+ args: [{
2063
+ selector: '[colorPickerSlider]',
2064
+ standalone: true
2065
+ }]
2066
+ }], ctorParameters: () => [], propDecorators: { rgX: [{
2067
+ type: Input
2068
+ }], rgY: [{
2069
+ type: Input
2070
+ }], dragEnd: [{
2071
+ type: Output
2072
+ }], dragStart: [{
2073
+ type: Output
2074
+ }], valueChanged: [{
2075
+ type: Output
2076
+ }], mouseDown: [{
2077
+ type: HostListener,
2078
+ args: ['mousedown', ['$event']]
2079
+ }], touchStart: [{
2080
+ type: HostListener,
2081
+ args: ['touchstart', ['$event']]
2082
+ }] } });
2083
+
2084
+ class ColorPickerComponent extends BaseControlValueAccessorV3 {
2085
+ hexColor = input('#00FF00F8');
2086
+ enableAdditionalColor = input(false);
2087
+ additionalColors = input([
2088
+ // Gray shades
2089
+ '#FFFFFF', // White
2090
+ '#F5F5F5',
2091
+ '#E0E0E0',
2092
+ '#BDBDBD',
2093
+ '#9E9E9E',
2094
+ '#757575',
2095
+ '#616161',
2096
+ '#424242',
2097
+ '#212121',
2098
+ '#000000', // Black
2099
+ '',
2100
+ // Row 1 – Reds to Purples
2101
+ '#F44336', // Red
2102
+ '#EF5350', // Coral red
2103
+ '#AB47BC', // Orchid
2104
+ '#EC407A', // Pink
2105
+ '#7E57C2', // Lavender purple
2106
+ '#5C6BC0', // Indigo
2107
+ // Row 2 – Teal to Blue
2108
+ '#4DB6AC', // Teal
2109
+ '#4FC3F7', // Sky blue
2110
+ '#4DD0E1', // Cyan
2111
+ '#42A5F5', // Blue
2112
+ '#5C6BC0', // Blue-violet
2113
+ '#1E88E5', // Strong blue
2114
+ // Row 3 – Greens to Oranges
2115
+ '#66BB6A', // Green
2116
+ '#9CCC65', // Lime green
2117
+ '#D4E157', // Light lime
2118
+ '#FFEB3B', // Yellow
2119
+ '#FFCA28', // Gold
2120
+ '#FFA726', // Orange
2121
+ '',
2122
+ // Calm / soft colors
2123
+ '#A8DADC', // Soft teal
2124
+ '#F4A261', // Muted orange
2125
+ '#E9C46A', // Soft yellow
2126
+ '#B5EAD7', // Mint green
2127
+ '#C7CEEA', // Soft blue
2128
+ '#FFDAC1', // Peach
2129
+ '#E2F0CB', // Light green
2130
+ '#D0C9FF', // Lavender
2131
+ '#FFB7B2', // Blush pink
2132
+ '#F1C0E8', // Light magenta
2133
+ ]);
2134
+ enableAlpha = input(true);
2135
+ controls = "default";
2136
+ colorChanged = new EventEmitter(false);
2137
+ onAlphaChange = new EventEmitter(false);
2138
+ closeColorPicker = new EventEmitter();
2139
+ color = new Hsva(0, 1, 1, 1);
2140
+ COLOR_PICKER_HEIGHT = signal(140);
2141
+ COLOR_PICKER_WIDTH = signal(250);
2142
+ converterService = inject(ColorConverterService);
2143
+ cdr = inject(ChangeDetectorRef);
2144
+ hsva = signal(new Hsva(0, 1, 1, 1));
2145
+ outputColor;
2146
+ selectedColor = signal("#000000");
2147
+ sliderDimMax = signal(new SliderDimension(0, 1, 1, 1));
2148
+ slider = signal(new SliderPosition(0, 1, 1, 1));
2149
+ hueSliderColor = signal(null);
2150
+ alphaSliderColor = signal(null);
2151
+ hueSlider;
2152
+ alphaSlider;
2153
+ height = computed(() => {
2154
+ return `${this.COLOR_PICKER_HEIGHT()}px`;
2155
+ });
2156
+ width = computed(() => {
2157
+ return `${this.COLOR_PICKER_WIDTH()}px`;
2158
+ });
2159
+ // height = signal(`${this.COLOR_PICKER_HEIGHT()}px`);
2160
+ // width = signal(`${this.COLOR_PICKER_WIDTH()}px`);
2161
+ isTooltip = signal(false);
2162
+ format = ColorFormats.HEX;
2163
+ hexColorValue = model('');
2164
+ alphaValue = signal(1);
2165
+ click(event) {
2166
+ if (this.isOutside(event)) {
2167
+ // this.emitClose('cancel');
2168
+ this.closeColorPicker.emit();
2169
+ }
2170
+ }
2171
+ isOutside(event) {
2172
+ return event.target.classList.contains('ng-color-picker');
2173
+ }
2174
+ onValueReady(value) {
2175
+ if (this.converterService.isValidHexColor(value)) {
2176
+ this.setHexColor(this.hexColor());
2177
+ }
2178
+ }
2179
+ ngOnInit() {
2180
+ this.setHexColor(this.hexColor());
2181
+ }
2182
+ ngOnChanges(changes) {
2183
+ if (changes?.hexColor?.currentValue) {
2184
+ this.setHexColor(changes.hexColor.currentValue);
2185
+ }
2186
+ }
2187
+ ngAfterViewInit() {
2188
+ const hueWidth = this.hueSlider?.nativeElement.offsetWidth || 140;
2189
+ const alphaWidth = this.alphaSlider?.nativeElement.offsetWidth || 140;
2190
+ const sliderDimensionMax = new SliderDimension(hueWidth, this.COLOR_PICKER_WIDTH(), this.COLOR_PICKER_HEIGHT(), alphaWidth);
2191
+ this.sliderDimMax.set(sliderDimensionMax);
2192
+ this.update();
2193
+ }
2194
+ setHexColor(hexColor) {
2195
+ if (!this.enableAlpha()) {
2196
+ hexColor = this.converterService.removeAlpha(hexColor);
2197
+ }
2198
+ if (hexColor != null && hexColor != '') {
2199
+ const hexToHsva = this.converterService.stringToHsva(hexColor);
2200
+ if (hexToHsva) {
2201
+ this.color = hexToHsva;
2202
+ this.hexColorValue.set(hexColor);
2203
+ let alphaPercentage = this.mapRange(this.color.a);
2204
+ this.alphaValue.set(alphaPercentage);
2205
+ }
2206
+ }
2207
+ if (this.color) {
2208
+ this.slider.set(new SliderPosition(this.color.h, this.color.s, this.color.v, this.color.a));
2209
+ this.update();
2210
+ }
2211
+ else {
2212
+ this.slider.set(new SliderPosition(0, 0, 0, 0));
2213
+ this.update();
2214
+ }
2215
+ if (this.converterService.isValidHexColor(hexColor)) {
2216
+ this.onValueChange(hexColor);
2217
+ }
2218
+ }
2219
+ mapRange(value) {
2220
+ return Math.round(1 + value * (100 - 1));
2221
+ }
2222
+ onSliderChange(type, event) {
2223
+ switch (type) {
2224
+ case 'saturation-lightness':
2225
+ this.hsva().onColorChange(event);
2226
+ break;
2227
+ case 'hue':
2228
+ this.hsva().onHueChange(event);
2229
+ break;
2230
+ case 'alpha':
2231
+ this.hsva().onAlphaChange(event);
2232
+ this.onAlphaChange.emit(event);
2233
+ break;
2234
+ case 'value':
2235
+ this.hsva().onValueChange(event);
2236
+ break;
2237
+ }
2238
+ this.update();
2239
+ this.setColor(this.outputColor);
2240
+ this.hexColorValue.set(this.converterService.toFormat(this.hsva(), ColorFormats.HEX));
2241
+ this.alphaValue.set(this.mapRange(this.outputColor.a));
2242
+ }
2243
+ setColor(color) {
2244
+ this.color = color;
2245
+ if (!this.isTooltip()) {
2246
+ this.colorChanged.emit(this.converterService.toFormat(this.color, ColorFormats.HEX));
2247
+ }
2248
+ }
2249
+ getBackgroundColor(color) {
2250
+ return {
2251
+ background: "linear-gradient(90deg, rgba(36,0,0,0) 0%, " + color + " 100%)",
2252
+ };
2253
+ }
2254
+ update() {
2255
+ this.hsva.set(this.color);
2256
+ if (this.sliderDimMax) {
2257
+ let rgba = this.converterService.hsvaToRgba(this.hsva()).denormalize();
2258
+ let hue = this.converterService
2259
+ .hsvaToRgba(new Hsva(this.hsva().h, 1, 1, 1))
2260
+ .denormalize();
2261
+ this.hueSliderColor.set("rgb(" + hue.r + "," + hue.g + "," + hue.b + ")");
2262
+ this.alphaSliderColor.set("rgb(" + rgba.r + "," + rgba.g + "," + rgba.b + ")");
2263
+ this.outputColor = this.hsva();
2264
+ this.selectedColor.set(this.converterService.hsvaToRgba(this.hsva()).toString());
2265
+ const sliderPosition = new SliderPosition(
2266
+ // (this.sHue || this.hsva.h) * this.sliderDimMax.h - 8,
2267
+ this.hsva().h * this.sliderDimMax().h - 5, this.hsva().s * this.sliderDimMax().s, (1 - this.hsva().v) * this.sliderDimMax().v, this.hsva().a * this.sliderDimMax().a - 5);
2268
+ this.slider.set(sliderPosition);
2269
+ this.cdr.detectChanges();
2270
+ }
2271
+ }
2272
+ onHexColorChange(event) {
2273
+ const hexCode = event.target.value.toString().trim();
2274
+ if (this.converterService.isValidHexColor(hexCode)) {
2275
+ this.setHexColor(this.converterService.addHexPrefixIfMissing(hexCode));
2276
+ }
2277
+ }
2278
+ alphaChanged(event) {
2279
+ const input = event.target.value.trim();
2280
+ let value = parseInt(input, 10);
2281
+ if (isNaN(value)) {
2282
+ value = 0;
2283
+ }
2284
+ value = Math.max(0, Math.min(100, value));
2285
+ this.alphaValue.set(value);
2286
+ }
2287
+ onApplyCLicked() {
2288
+ this.colorChanged.emit(this.converterService.toFormat(this.color, ColorFormats.HEX));
2289
+ }
2290
+ getColorRows() {
2291
+ const rows = [];
2292
+ let currentRow = [];
2293
+ for (const color of this.additionalColors()) {
2294
+ if (color === '') {
2295
+ if (currentRow.length) {
2296
+ rows.push(currentRow);
2297
+ currentRow = [];
2298
+ }
2299
+ }
2300
+ else {
2301
+ currentRow.push(color);
2302
+ }
2303
+ }
2304
+ if (currentRow.length) {
2305
+ rows.push(currentRow);
2306
+ }
2307
+ return rows;
2308
+ }
2309
+ onColorSelected(color) {
2310
+ this.setHexColor(color);
2311
+ }
2312
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: ColorPickerComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
2313
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.7", type: ColorPickerComponent, isStandalone: true, selector: "app-color-picker", inputs: { hexColor: { classPropertyName: "hexColor", publicName: "hexColor", isSignal: true, isRequired: false, transformFunction: null }, enableAdditionalColor: { classPropertyName: "enableAdditionalColor", publicName: "enableAdditionalColor", isSignal: true, isRequired: false, transformFunction: null }, additionalColors: { classPropertyName: "additionalColors", publicName: "additionalColors", isSignal: true, isRequired: false, transformFunction: null }, enableAlpha: { classPropertyName: "enableAlpha", publicName: "enableAlpha", isSignal: true, isRequired: false, transformFunction: null }, controls: { classPropertyName: "controls", publicName: "controls", isSignal: false, isRequired: false, transformFunction: null }, hexColorValue: { classPropertyName: "hexColorValue", publicName: "hexColorValue", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { colorChanged: "colorChanged", onAlphaChange: "onAlphaChange", closeColorPicker: "closeColorPicker", hexColorValue: "hexColorValueChange" }, host: { listeners: { "document:mousedown": "click($event)" } }, viewQueries: [{ propertyName: "hueSlider", first: true, predicate: ["hueSlider"], descendants: true }, { propertyName: "alphaSlider", first: true, predicate: ["alphaSlider"], descendants: true }], usesInheritance: true, usesOnChanges: true, ngImport: i0, template: "<div [ngClass]=\"isTooltip() ? 'shadow-1 bg-white' : ''\">\n\n <div [style.width]=\"width()\">\n\n <!--Saturation and Lightness-->\n <div\n class=\"sl\"\n [style.height]=\"height()\"\n [style.width]=\"width()\"\n colorPickerSlider\n [rgX]=\"1\"\n [rgY]=\"1\"\n (valueChanged)=\"onSliderChange('saturation-lightness', $event)\"\n [style.background-color]=\"hueSliderColor()\">\n\n <!--Saturation & Lightness pointer-->\n <div\n class=\"sl-pointer\"\n [style.left.px]=\"slider().s\"\n [style.top.px]=\"slider().v\">\n </div>\n\n </div>\n\n <div class=\"flex flex-col gap-4 mt-4\" [ngClass]=\"isTooltip() ? 'p-4' : ''\">\n <!--Selected Color-->\n <div class=\"flex gap-5 items-center\">\n\n <!-- <div class=\"relative\">-->\n <!-- <div class=\"selected-color-background\"></div>-->\n <!-- <div-->\n <!-- class=\"h-10 w-10 rounded-xl selected-color\"-->\n <!-- [style.background-color]=\"selectedColor()\">-->\n <!-- </div>-->\n <!-- </div>-->\n\n\n <div class=\"flex flex-col w-full gap-4\">\n <div #hueSlider\n class=\"hue\"\n colorPickerSlider\n (valueChanged)=\"onSliderChange('hue', $event)\"\n [rgX]=\"1\">\n <div class=\"hue-pointer\"\n [style.left.px]=\"slider().h\"></div>\n </div>\n\n @if(enableAlpha()) {\n <div #alphaSlider\n class=\"alpha\"\n colorPickerSlider\n [rgX]=\"1\"\n (valueChanged)=\"onSliderChange('alpha', $event)\">\n <div class=\"alpha-gradient\" [ngStyle]=\"getBackgroundColor(alphaSliderColor())\"></div>\n <div class=\"alpha-pointer\"\n [style.left.px]=\"slider().a\"></div>\n </div>\n }\n </div>\n\n </div>\n\n <div class=\"flex items-center gap-3\">\n <div class=\"relative rounded w-full flex items-center bg-gray-50 focus-within:text-neutral-600\">\n <p class=\"absolute text-sm text-blue-500 px-3 pointer-events-none\">HEX</p>\n <input [(ngModel)]=\"hexColorValue\" (input)=\"onHexColorChange($event)\"\n class=\"py-2 pl-12 pr-3 w-36 bg-gray-50 focus:outline-none rounded uppercase\">\n\n </div>\n @if (isTooltip()) {\n <div class=\"px-3 py-2 border border-neutral-300 h-min rounded-md cursor-pointer text-primary-500\"\n (click)=\"onApplyCLicked()\">Apply\n </div>\n }\n </div>\n </div>\n\n </div>\n\n <div class=\"mt-4\">\n @for (row of getColorRows(); let $isLast = $last; track $index) {\n <div class=\"grid grid-cols-8 gap-2 mb-1\">\n @for (color of row; track $index) {\n <div\n (click)=\"onColorSelected(color)\"\n class=\"h-6 w-6 rounded cursor-pointer border border-gray-200\"\n [style.background-color]=\"color\">\n </div>\n }\n </div>\n\n <!-- Separator line unless it's the last row -->\n @if (!$isLast) {\n <div class=\"h-[1px] bg-gray-100 my-2.5 w-full\"></div>\n }\n }\n </div>\n\n\n</div>\n\n\n\n", styles: [".sl{@apply rounded;direction:ltr;cursor:crosshair;position:relative;touch-action:manipulation;background-image:linear-gradient(to top,#000 0%,transparent 100%),linear-gradient(to right,#fff 0%,transparent 100%)}.sl-pointer{@apply absolute rounded-full transform -translate-y-1/2 -translate-x-1/2 bg-transparent h-5 w-5 border-4 shadow-1 border-white;}.hue{direction:ltr;height:14px;width:100%;border:none;border-radius:100px;position:relative;cursor:pointer;background-size:100% 100%;background:linear-gradient(to right,red,#ff0 17%,#0f0 33%,#0ff 50%,#00f 66%,#f0f,red)}.hue-pointer{@apply absolute rounded-full top-1/2 transform -translate-y-1/2 -translate-x-1/2 bg-white h-6 w-6 shadow-1 border border-neutral-300;}.alpha{direction:ltr;position:relative;width:100%;height:14px;border:none;border-radius:100px;cursor:pointer;background-image:linear-gradient(45deg,#ccc 25%,transparent 25%),linear-gradient(-45deg,#ccc 25%,transparent 25%),linear-gradient(45deg,transparent 75%,#ccc 75%),linear-gradient(-45deg,transparent 75%,#ccc 75%);background-size:16px 16px;background-position:0 0,0 8px,8px -8px,-8px 0px}.alpha-pointer{@apply absolute rounded-full top-1/2 transform -translate-y-1/2 -translate-x-1/2 bg-white h-6 w-6 shadow-1 border border-neutral-300;}.alpha-gradient{width:100%;height:100%;border-radius:5px;position:absolute}.selected-color-background{@apply h-10 w-10 rounded-xl;background-image:linear-gradient(45deg,#ccc 25%,transparent 25%),linear-gradient(-45deg,#ccc 25%,transparent 25%),linear-gradient(45deg,transparent 75%,#ccc 75%),linear-gradient(-45deg,transparent 75%,#ccc 75%);background-size:16px 16px;background-position:0 0,0 8px,8px -8px,-8px 0px}.selected-color{position:absolute;@apply h-10 w-10 shadow-md;top:0;left:0}\n"], dependencies: [{ kind: "directive", type: ColorPickerSliderDirective, selector: "[colorPickerSlider]", inputs: ["rgX", "rgY"], outputs: ["dragEnd", "dragStart", "valueChanged"] }, { kind: "directive", type: NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }] });
2314
+ }
2315
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: ColorPickerComponent, decorators: [{
2316
+ type: Component,
2317
+ args: [{ selector: 'app-color-picker', standalone: true, imports: [
2318
+ ColorPickerSliderDirective,
2319
+ NgStyle,
2320
+ FormsModule,
2321
+ NgClass
2322
+ ], template: "<div [ngClass]=\"isTooltip() ? 'shadow-1 bg-white' : ''\">\n\n <div [style.width]=\"width()\">\n\n <!--Saturation and Lightness-->\n <div\n class=\"sl\"\n [style.height]=\"height()\"\n [style.width]=\"width()\"\n colorPickerSlider\n [rgX]=\"1\"\n [rgY]=\"1\"\n (valueChanged)=\"onSliderChange('saturation-lightness', $event)\"\n [style.background-color]=\"hueSliderColor()\">\n\n <!--Saturation & Lightness pointer-->\n <div\n class=\"sl-pointer\"\n [style.left.px]=\"slider().s\"\n [style.top.px]=\"slider().v\">\n </div>\n\n </div>\n\n <div class=\"flex flex-col gap-4 mt-4\" [ngClass]=\"isTooltip() ? 'p-4' : ''\">\n <!--Selected Color-->\n <div class=\"flex gap-5 items-center\">\n\n <!-- <div class=\"relative\">-->\n <!-- <div class=\"selected-color-background\"></div>-->\n <!-- <div-->\n <!-- class=\"h-10 w-10 rounded-xl selected-color\"-->\n <!-- [style.background-color]=\"selectedColor()\">-->\n <!-- </div>-->\n <!-- </div>-->\n\n\n <div class=\"flex flex-col w-full gap-4\">\n <div #hueSlider\n class=\"hue\"\n colorPickerSlider\n (valueChanged)=\"onSliderChange('hue', $event)\"\n [rgX]=\"1\">\n <div class=\"hue-pointer\"\n [style.left.px]=\"slider().h\"></div>\n </div>\n\n @if(enableAlpha()) {\n <div #alphaSlider\n class=\"alpha\"\n colorPickerSlider\n [rgX]=\"1\"\n (valueChanged)=\"onSliderChange('alpha', $event)\">\n <div class=\"alpha-gradient\" [ngStyle]=\"getBackgroundColor(alphaSliderColor())\"></div>\n <div class=\"alpha-pointer\"\n [style.left.px]=\"slider().a\"></div>\n </div>\n }\n </div>\n\n </div>\n\n <div class=\"flex items-center gap-3\">\n <div class=\"relative rounded w-full flex items-center bg-gray-50 focus-within:text-neutral-600\">\n <p class=\"absolute text-sm text-blue-500 px-3 pointer-events-none\">HEX</p>\n <input [(ngModel)]=\"hexColorValue\" (input)=\"onHexColorChange($event)\"\n class=\"py-2 pl-12 pr-3 w-36 bg-gray-50 focus:outline-none rounded uppercase\">\n\n </div>\n @if (isTooltip()) {\n <div class=\"px-3 py-2 border border-neutral-300 h-min rounded-md cursor-pointer text-primary-500\"\n (click)=\"onApplyCLicked()\">Apply\n </div>\n }\n </div>\n </div>\n\n </div>\n\n <div class=\"mt-4\">\n @for (row of getColorRows(); let $isLast = $last; track $index) {\n <div class=\"grid grid-cols-8 gap-2 mb-1\">\n @for (color of row; track $index) {\n <div\n (click)=\"onColorSelected(color)\"\n class=\"h-6 w-6 rounded cursor-pointer border border-gray-200\"\n [style.background-color]=\"color\">\n </div>\n }\n </div>\n\n <!-- Separator line unless it's the last row -->\n @if (!$isLast) {\n <div class=\"h-[1px] bg-gray-100 my-2.5 w-full\"></div>\n }\n }\n </div>\n\n\n</div>\n\n\n\n", styles: [".sl{@apply rounded;direction:ltr;cursor:crosshair;position:relative;touch-action:manipulation;background-image:linear-gradient(to top,#000 0%,transparent 100%),linear-gradient(to right,#fff 0%,transparent 100%)}.sl-pointer{@apply absolute rounded-full transform -translate-y-1/2 -translate-x-1/2 bg-transparent h-5 w-5 border-4 shadow-1 border-white;}.hue{direction:ltr;height:14px;width:100%;border:none;border-radius:100px;position:relative;cursor:pointer;background-size:100% 100%;background:linear-gradient(to right,red,#ff0 17%,#0f0 33%,#0ff 50%,#00f 66%,#f0f,red)}.hue-pointer{@apply absolute rounded-full top-1/2 transform -translate-y-1/2 -translate-x-1/2 bg-white h-6 w-6 shadow-1 border border-neutral-300;}.alpha{direction:ltr;position:relative;width:100%;height:14px;border:none;border-radius:100px;cursor:pointer;background-image:linear-gradient(45deg,#ccc 25%,transparent 25%),linear-gradient(-45deg,#ccc 25%,transparent 25%),linear-gradient(45deg,transparent 75%,#ccc 75%),linear-gradient(-45deg,transparent 75%,#ccc 75%);background-size:16px 16px;background-position:0 0,0 8px,8px -8px,-8px 0px}.alpha-pointer{@apply absolute rounded-full top-1/2 transform -translate-y-1/2 -translate-x-1/2 bg-white h-6 w-6 shadow-1 border border-neutral-300;}.alpha-gradient{width:100%;height:100%;border-radius:5px;position:absolute}.selected-color-background{@apply h-10 w-10 rounded-xl;background-image:linear-gradient(45deg,#ccc 25%,transparent 25%),linear-gradient(-45deg,#ccc 25%,transparent 25%),linear-gradient(45deg,transparent 75%,#ccc 75%),linear-gradient(-45deg,transparent 75%,#ccc 75%);background-size:16px 16px;background-position:0 0,0 8px,8px -8px,-8px 0px}.selected-color{position:absolute;@apply h-10 w-10 shadow-md;top:0;left:0}\n"] }]
2323
+ }], propDecorators: { controls: [{
2324
+ type: Input
2325
+ }], colorChanged: [{
2326
+ type: Output
2327
+ }], onAlphaChange: [{
2328
+ type: Output
2329
+ }], closeColorPicker: [{
2330
+ type: Output
2331
+ }], hueSlider: [{
2332
+ type: ViewChild,
2333
+ args: ["hueSlider", { static: false }]
2334
+ }], alphaSlider: [{
2335
+ type: ViewChild,
2336
+ args: ["alphaSlider", { static: false }]
2337
+ }], click: [{
2338
+ type: HostListener,
2339
+ args: ['document:mousedown', ['$event']]
2340
+ }] } });
2341
+
2342
+ class ColorPickerDirective {
2343
+ colorChanged = new EventEmitter(false);
2344
+ componentRef = null;
2345
+ elementRef = inject(ElementRef);
2346
+ viewContainerRef = inject(ViewContainerRef);
2347
+ componentFactoryResolver = inject(ComponentFactoryResolver);
2348
+ appRef = inject(ApplicationRef);
2349
+ injector = inject(Injector);
2350
+ overlay;
2351
+ onClick() {
2352
+ if (this.componentRef) {
2353
+ this.closeColorPicker();
2354
+ return;
2355
+ }
2356
+ this.initializeColorPicker();
2357
+ }
2358
+ initializeColorPicker() {
2359
+ if (this.componentRef === null) {
2360
+ const componentFactory = this.componentFactoryResolver.resolveComponentFactory(ColorPickerComponent);
2361
+ this.componentRef = componentFactory.create(this.injector);
2362
+ this.appRef.attachView(this.componentRef.hostView);
2363
+ const [domElement] = this.componentRef.hostView.rootNodes;
2364
+ const elementRect = this.elementRef.nativeElement.getBoundingClientRect();
2365
+ this.overlay = document.createElement("div");
2366
+ this.overlay.id = "ng-color-picker";
2367
+ this.overlay.classList.add("ng-color-picker");
2368
+ this.overlay.style['position'] = 'fixed';
2369
+ this.overlay.style['height'] = '100%';
2370
+ this.overlay.style['width'] = '100%';
2371
+ this.overlay.style['z-index'] = 2000;
2372
+ this.overlay.style['top'] = '0';
2373
+ this.overlay.style['left'] = '0';
2374
+ this.componentRef.location.nativeElement.style.position = 'absolute';
2375
+ this.componentRef.location.nativeElement.style['z-index'] = 2001;
2376
+ this.componentRef.location.nativeElement.style.top = `${elementRect.bottom + 20}px`;
2377
+ this.componentRef.location.nativeElement.style.left = `${elementRect.left}px`;
2378
+ this.componentRef.instance.COLOR_PICKER_HEIGHT.set(140);
2379
+ this.componentRef.instance.COLOR_PICKER_WIDTH.set(250);
2380
+ this.componentRef.instance.isTooltip.set(true);
2381
+ this.componentRef.instance.colorChanged.subscribe((colorCode) => {
2382
+ this.colorChanged.emit(colorCode);
2383
+ this.closeColorPicker();
2384
+ });
2385
+ this.componentRef.instance.closeColorPicker.subscribe(() => {
2386
+ this.closeColorPicker();
2387
+ });
2388
+ document.body.appendChild(this.overlay);
2389
+ document.body.appendChild(domElement);
2390
+ }
2391
+ }
2392
+ // private initializeColorPicker() {
2393
+ // if(this.componentRef === null) {
2394
+ // const componentFactory = this.componentFactoryResolver.resolveComponentFactory(ColorPickerComponent);
2395
+ // this.componentRef = componentFactory.create(this.injector);
2396
+ //
2397
+ // this.appRef.attachView(this.componentRef.hostView);
2398
+ // const [domElement] = (this.componentRef.hostView as EmbeddedViewRef<any>).rootNodes;
2399
+ //
2400
+ // this.setColorPickerProperties();
2401
+ //
2402
+ // document.body.appendChild(domElement);
2403
+ //
2404
+ // }
2405
+ // }
2406
+ //
2407
+ // private setColorPickerProperties() {
2408
+ // if (this.componentRef !== null) {
2409
+ // const elementRect = this.elementRef.nativeElement.getBoundingClientRect();
2410
+ //
2411
+ //
2412
+ // this.componentRef.location.nativeElement.style.position = 'absolute';
2413
+ // this.componentRef.location.nativeElement.style.top = `${elementRect.bottom + 20}px`;
2414
+ // this.componentRef.location.nativeElement.style.left = `${elementRect.left}px`;
2415
+ // this.componentRef.instance.COLOR_PICKER_HEIGHT.set(140);
2416
+ // this.componentRef.instance.COLOR_PICKER_WIDTH.set(250);
2417
+ // this.componentRef.instance.isTooltip.set(true);
2418
+ //
2419
+ // this.componentRef.instance.colorChanged.subscribe((colorCode: string) => {
2420
+ // this.colorChanged.emit(colorCode);
2421
+ // this.closeColorPicker();
2422
+ // });
2423
+ //
2424
+ // this.componentRef.instance.closeColorPicker.subscribe(() => {
2425
+ // this.closeColorPicker();
2426
+ // });
2427
+ // }
2428
+ // }
2429
+ closeColorPicker() {
2430
+ if (this.componentRef) {
2431
+ this.appRef.detachView(this.componentRef.hostView);
2432
+ this.componentRef.destroy();
2433
+ this.overlay.remove();
2434
+ this.componentRef = null;
2435
+ }
2436
+ // this.viewContainerRef.clear();
2437
+ // this.componentRef = null;
2438
+ }
2439
+ ngOnDestroy() {
2440
+ this.closeColorPicker();
2441
+ }
2442
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: ColorPickerDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
2443
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.7", type: ColorPickerDirective, isStandalone: true, selector: "[appColorPicker]", outputs: { colorChanged: "colorChanged" }, host: { listeners: { "click": "onClick()" } }, ngImport: i0 });
2444
+ }
2445
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: ColorPickerDirective, decorators: [{
2446
+ type: Directive,
2447
+ args: [{
2448
+ selector: '[appColorPicker]',
2449
+ standalone: true
2450
+ }]
2451
+ }], propDecorators: { colorChanged: [{
2452
+ type: Output
2453
+ }], onClick: [{
2454
+ type: HostListener,
2455
+ args: ['click']
2456
+ }] } });
2457
+
1601
2458
  class OverlayContextMenuComponent {
1602
2459
  dialogRef = inject(DialogRef);
1603
2460
  actions = inject(DIALOG_DATA);
@@ -5612,5 +6469,5 @@ function provideNglConfig(config) {
5612
6469
  * Generated bundle index. Do not edit.
5613
6470
  */
5614
6471
 
5615
- export { AlertDialogComponent, AppErrorComponent, AppSvgIconComponent, BaseApiService, BaseControlValueAccessor, BaseControlValueAccessorV2, BaseControlValueAccessorV3, BaseInputComponent, BaseOverlayComponent, BaseTableComponent, BreadcrumbComponent, ButtonComponent, CheckboxComponent, ClickOutsideDirective, CloseButtonComponent, ContextMenuButtonComponent, ContextMenuIconComponent, DataTableComponent, DateInputComponent, DatePickerComponent, DatePickerOverlayComponent, DateRangePickerComponent, DateUtils, DropdownComponent, DynamicRendererComponent, EnvBannerComponent, FORM_ERRORS, FileUploaderComponent, FormValidationUtils, HumanizeFormMessagesPipe, InputDateFormat, InvalidControlScrollContainerDirective, InvalidControlScrollDirective, InvalidTokenError, ListviewComponent, LoaderComponent, LoaderService, MultiSelectDropdownAppearance, MultiSelectDropdownComponent, MultiSelectionFieldComponent, NGL_CONFIG, NetworkImageComponent, NglService, NoDataComponent, NoDataTableComponent, NumberInputComponent, OverlayContextMenuComponent, OverlayService, OverlayWizardUtils, PaginationComponent, PaginationState, PhoneNumberInputComponent, RadioButtonComponent, RequestState, ResizableColumnDirective, ResponsiveHelperComponent, SharedConstants, ShimmerComponent, SingleItemPickerInputComponent, SingleSelectionFieldComponent, SortableTableDirective, SpinnerComponent, State, StatusBadgeComponent, SvgUrlIconComponent, SwitchComponent, TableCustomComponent, TableResizableColumnsDirective, TemplateResolverArrayUtil, TemplateResolverFormat, TextAreaInputComponent, TextInputComponent, TimePickerComponent, ToastComponent, ToastService, ToasterComponent, TooltipComponent, UnsavedAwareDirective, arrayToCSV, arrayToSeparator, arrayToSpaceSeparator, deepEqual, defaultErrors, getDynamicTypeStructure, isDynamicType, isValid, jsonEqual, jwtDecode, mmddyyyyDateValidatorAsync, onlyFutureDateValidator, onlyPastDateValidator, openLink, printInvalidFields, provideNglConfig, resolveTemplateWithObject, toSentenceCase };
6472
+ export { AlertDialogComponent, AppErrorComponent, AppSvgIconComponent, BaseApiService, BaseControlValueAccessor, BaseControlValueAccessorV2, BaseControlValueAccessorV3, BaseInputComponent, BaseOverlayComponent, BaseTableComponent, BreadcrumbComponent, ButtonComponent, CheckboxComponent, ClickOutsideDirective, CloseButtonComponent, ColorConverterService, ColorFormats, ColorPickerComponent, ColorPickerDirective, ContextMenuButtonComponent, ContextMenuIconComponent, DataTableComponent, DateInputComponent, DatePickerComponent, DatePickerOverlayComponent, DateRangePickerComponent, DateUtils, DropdownComponent, DynamicRendererComponent, EnvBannerComponent, FORM_ERRORS, FileUploaderComponent, FormValidationUtils, HumanizeFormMessagesPipe, InputDateFormat, InvalidControlScrollContainerDirective, InvalidControlScrollDirective, InvalidTokenError, ListviewComponent, LoaderComponent, LoaderService, MultiSelectDropdownAppearance, MultiSelectDropdownComponent, MultiSelectionFieldComponent, NGL_CONFIG, NetworkImageComponent, NglService, NoDataComponent, NoDataTableComponent, NumberInputComponent, OverlayContextMenuComponent, OverlayService, OverlayWizardUtils, PaginationComponent, PaginationState, PhoneNumberInputComponent, RadioButtonComponent, RequestState, ResizableColumnDirective, ResponsiveHelperComponent, SharedConstants, ShimmerComponent, SingleItemPickerInputComponent, SingleSelectionFieldComponent, SortableTableDirective, SpinnerComponent, State, StatusBadgeComponent, SvgUrlIconComponent, SwitchComponent, TableCustomComponent, TableResizableColumnsDirective, TemplateResolverArrayUtil, TemplateResolverFormat, TextAreaInputComponent, TextInputComponent, TimePickerComponent, ToastComponent, ToastService, ToasterComponent, TooltipComponent, UnsavedAwareDirective, arrayToCSV, arrayToSeparator, arrayToSpaceSeparator, deepEqual, defaultErrors, getDynamicTypeStructure, isDynamicType, isValid, jsonEqual, jwtDecode, mmddyyyyDateValidatorAsync, onlyFutureDateValidator, onlyPastDateValidator, openLink, printInvalidFields, provideNglConfig, resolveTemplateWithObject, toSentenceCase };
5616
6473
  //# sourceMappingURL=vallift-ngl.mjs.map