cmat 0.0.87 → 0.0.88

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (228) hide show
  1. package/fesm2022/cmat-components-adapter.mjs +9 -9
  2. package/fesm2022/cmat-components-adapter.mjs.map +1 -1
  3. package/fesm2022/cmat-components-breadcrumb.mjs +98 -80
  4. package/fesm2022/cmat-components-breadcrumb.mjs.map +1 -1
  5. package/fesm2022/cmat-components-card.mjs +26 -34
  6. package/fesm2022/cmat-components-card.mjs.map +1 -1
  7. package/fesm2022/cmat-components-carousel.mjs +467 -556
  8. package/fesm2022/cmat-components-carousel.mjs.map +1 -1
  9. package/fesm2022/cmat-components-cascade.mjs +270 -259
  10. package/fesm2022/cmat-components-cascade.mjs.map +1 -1
  11. package/fesm2022/cmat-components-chip-input.mjs +200 -116
  12. package/fesm2022/cmat-components-chip-input.mjs.map +1 -1
  13. package/fesm2022/cmat-components-code-editor.mjs +85 -38
  14. package/fesm2022/cmat-components-code-editor.mjs.map +1 -1
  15. package/fesm2022/cmat-components-color-picker.mjs +841 -0
  16. package/fesm2022/cmat-components-color-picker.mjs.map +1 -0
  17. package/fesm2022/cmat-components-custom-formly.mjs +1395 -838
  18. package/fesm2022/cmat-components-custom-formly.mjs.map +1 -1
  19. package/fesm2022/cmat-components-data-picker.mjs +996 -0
  20. package/fesm2022/cmat-components-data-picker.mjs.map +1 -0
  21. package/fesm2022/cmat-components-date-range.mjs +310 -264
  22. package/fesm2022/cmat-components-date-range.mjs.map +1 -1
  23. package/fesm2022/cmat-components-date-time-display.mjs +16 -20
  24. package/fesm2022/cmat-components-date-time-display.mjs.map +1 -1
  25. package/fesm2022/cmat-components-drawer.mjs +120 -137
  26. package/fesm2022/cmat-components-drawer.mjs.map +1 -1
  27. package/fesm2022/cmat-components-empty-state.mjs +17 -24
  28. package/fesm2022/cmat-components-empty-state.mjs.map +1 -1
  29. package/fesm2022/cmat-components-file-preview.mjs +18 -24
  30. package/fesm2022/cmat-components-file-preview.mjs.map +1 -1
  31. package/fesm2022/cmat-components-filter-toolbar.mjs +30 -39
  32. package/fesm2022/cmat-components-filter-toolbar.mjs.map +1 -1
  33. package/fesm2022/cmat-components-form-actions.mjs +12 -12
  34. package/fesm2022/cmat-components-form-actions.mjs.map +1 -1
  35. package/fesm2022/cmat-components-fullscreen.mjs +10 -10
  36. package/fesm2022/cmat-components-fullscreen.mjs.map +1 -1
  37. package/fesm2022/cmat-components-highlight.mjs +48 -41
  38. package/fesm2022/cmat-components-highlight.mjs.map +1 -1
  39. package/fesm2022/cmat-components-image-viewer.mjs +104 -107
  40. package/fesm2022/cmat-components-image-viewer.mjs.map +1 -1
  41. package/fesm2022/cmat-components-inline-loading.mjs +12 -15
  42. package/fesm2022/cmat-components-inline-loading.mjs.map +1 -1
  43. package/fesm2022/cmat-components-json-editor.mjs +118 -75
  44. package/fesm2022/cmat-components-json-editor.mjs.map +1 -1
  45. package/fesm2022/cmat-components-knob-input.mjs +196 -178
  46. package/fesm2022/cmat-components-knob-input.mjs.map +1 -1
  47. package/fesm2022/cmat-components-masonry.mjs +26 -41
  48. package/fesm2022/cmat-components-masonry.mjs.map +1 -1
  49. package/fesm2022/cmat-components-material-color-picker.mjs +81 -80
  50. package/fesm2022/cmat-components-material-color-picker.mjs.map +1 -1
  51. package/fesm2022/cmat-components-material-datetimepicker.mjs +1212 -1287
  52. package/fesm2022/cmat-components-material-datetimepicker.mjs.map +1 -1
  53. package/fesm2022/cmat-components-navigation.mjs +467 -450
  54. package/fesm2022/cmat-components-navigation.mjs.map +1 -1
  55. package/fesm2022/cmat-components-opt-input.mjs +143 -132
  56. package/fesm2022/cmat-components-opt-input.mjs.map +1 -1
  57. package/fesm2022/cmat-components-org-chart.mjs +68 -83
  58. package/fesm2022/cmat-components-org-chart.mjs.map +1 -1
  59. package/fesm2022/cmat-components-page-header.mjs +18 -24
  60. package/fesm2022/cmat-components-page-header.mjs.map +1 -1
  61. package/fesm2022/cmat-components-pagination.mjs +220 -136
  62. package/fesm2022/cmat-components-pagination.mjs.map +1 -1
  63. package/fesm2022/cmat-components-password-strength.mjs +262 -215
  64. package/fesm2022/cmat-components-password-strength.mjs.map +1 -1
  65. package/fesm2022/cmat-components-popover.mjs +227 -195
  66. package/fesm2022/cmat-components-popover.mjs.map +1 -1
  67. package/fesm2022/cmat-components-progress-bar.mjs +15 -34
  68. package/fesm2022/cmat-components-progress-bar.mjs.map +1 -1
  69. package/fesm2022/cmat-components-qrcode.mjs +95 -88
  70. package/fesm2022/cmat-components-qrcode.mjs.map +1 -1
  71. package/fesm2022/cmat-components-rating.mjs +70 -67
  72. package/fesm2022/cmat-components-rating.mjs.map +1 -1
  73. package/fesm2022/cmat-components-rich-text-editor.mjs +23 -26
  74. package/fesm2022/cmat-components-rich-text-editor.mjs.map +1 -1
  75. package/fesm2022/cmat-components-select-search.mjs +190 -159
  76. package/fesm2022/cmat-components-select-search.mjs.map +1 -1
  77. package/fesm2022/cmat-components-select-table.mjs +276 -213
  78. package/fesm2022/cmat-components-select-table.mjs.map +1 -1
  79. package/fesm2022/cmat-components-select-tree.mjs +178 -128
  80. package/fesm2022/cmat-components-select-tree.mjs.map +1 -1
  81. package/fesm2022/cmat-components-skeleton.mjs +44 -28
  82. package/fesm2022/cmat-components-skeleton.mjs.map +1 -1
  83. package/fesm2022/cmat-components-speed-dial.mjs +107 -163
  84. package/fesm2022/cmat-components-speed-dial.mjs.map +1 -1
  85. package/fesm2022/cmat-components-status-tag.mjs +29 -36
  86. package/fesm2022/cmat-components-status-tag.mjs.map +1 -1
  87. package/fesm2022/cmat-components-table-toolbar.mjs +14 -18
  88. package/fesm2022/cmat-components-table-toolbar.mjs.map +1 -1
  89. package/fesm2022/cmat-components-timeline.mjs +111 -118
  90. package/fesm2022/cmat-components-timeline.mjs.map +1 -1
  91. package/fesm2022/cmat-components-toast.mjs +65 -66
  92. package/fesm2022/cmat-components-toast.mjs.map +1 -1
  93. package/fesm2022/cmat-components-transfer-picker.mjs +130 -160
  94. package/fesm2022/cmat-components-transfer-picker.mjs.map +1 -1
  95. package/fesm2022/cmat-components-treetable.mjs +32 -39
  96. package/fesm2022/cmat-components-treetable.mjs.map +1 -1
  97. package/fesm2022/cmat-components-upload.mjs +186 -176
  98. package/fesm2022/cmat-components-upload.mjs.map +1 -1
  99. package/fesm2022/cmat-directives-animate-on-scroll.mjs +25 -28
  100. package/fesm2022/cmat-directives-animate-on-scroll.mjs.map +1 -1
  101. package/fesm2022/cmat-directives-arrow-cursor.mjs +85 -92
  102. package/fesm2022/cmat-directives-arrow-cursor.mjs.map +1 -1
  103. package/fesm2022/cmat-directives-autofocus.mjs +3 -3
  104. package/fesm2022/cmat-directives-autofocus.mjs.map +1 -1
  105. package/fesm2022/cmat-directives-data-exporter.mjs +49 -50
  106. package/fesm2022/cmat-directives-data-exporter.mjs.map +1 -1
  107. package/fesm2022/cmat-directives-debounce.mjs +16 -19
  108. package/fesm2022/cmat-directives-debounce.mjs.map +1 -1
  109. package/fesm2022/cmat-directives-digit-only.mjs +60 -69
  110. package/fesm2022/cmat-directives-digit-only.mjs.map +1 -1
  111. package/fesm2022/cmat-directives-equal-validator.mjs +3 -3
  112. package/fesm2022/cmat-directives-equal-validator.mjs.map +1 -1
  113. package/fesm2022/cmat-directives-seamless-auto-scroll.mjs +31 -30
  114. package/fesm2022/cmat-directives-seamless-auto-scroll.mjs.map +1 -1
  115. package/fesm2022/cmat-lib-mock-api.mjs +6 -6
  116. package/fesm2022/cmat-lib-mock-api.mjs.map +1 -1
  117. package/fesm2022/cmat-pipes-bytes.mjs +3 -3
  118. package/fesm2022/cmat-pipes-bytes.mjs.map +1 -1
  119. package/fesm2022/cmat-pipes-date-format.mjs +3 -3
  120. package/fesm2022/cmat-pipes-date-format.mjs.map +1 -1
  121. package/fesm2022/cmat-pipes-find-by-key.mjs +3 -3
  122. package/fesm2022/cmat-pipes-find-by-key.mjs.map +1 -1
  123. package/fesm2022/cmat-pipes-group-by.mjs +3 -3
  124. package/fesm2022/cmat-pipes-group-by.mjs.map +1 -1
  125. package/fesm2022/cmat-pipes-keys.mjs +3 -3
  126. package/fesm2022/cmat-pipes-keys.mjs.map +1 -1
  127. package/fesm2022/cmat-pipes-secure.mjs +7 -13
  128. package/fesm2022/cmat-pipes-secure.mjs.map +1 -1
  129. package/fesm2022/cmat-pipes-uppercase.mjs +3 -3
  130. package/fesm2022/cmat-pipes-uppercase.mjs.map +1 -1
  131. package/fesm2022/cmat-services-alert.mjs +26 -27
  132. package/fesm2022/cmat-services-alert.mjs.map +1 -1
  133. package/fesm2022/cmat-services-config.mjs +14 -23
  134. package/fesm2022/cmat-services-config.mjs.map +1 -1
  135. package/fesm2022/cmat-services-confirmation.mjs +8 -8
  136. package/fesm2022/cmat-services-confirmation.mjs.map +1 -1
  137. package/fesm2022/cmat-services-data.mjs +6 -10
  138. package/fesm2022/cmat-services-data.mjs.map +1 -1
  139. package/fesm2022/cmat-services-export-as.mjs +3 -3
  140. package/fesm2022/cmat-services-export-as.mjs.map +1 -1
  141. package/fesm2022/cmat-services-loading.mjs +30 -47
  142. package/fesm2022/cmat-services-loading.mjs.map +1 -1
  143. package/fesm2022/cmat-services-local-storage.mjs +3 -3
  144. package/fesm2022/cmat-services-local-storage.mjs.map +1 -1
  145. package/fesm2022/cmat-services-media-watcher.mjs +43 -34
  146. package/fesm2022/cmat-services-media-watcher.mjs.map +1 -1
  147. package/fesm2022/cmat-services-platform.mjs +3 -3
  148. package/fesm2022/cmat-services-platform.mjs.map +1 -1
  149. package/fesm2022/cmat-services-splash-screen.mjs +3 -3
  150. package/fesm2022/cmat-services-splash-screen.mjs.map +1 -1
  151. package/fesm2022/cmat-services-title.mjs +3 -3
  152. package/fesm2022/cmat-services-title.mjs.map +1 -1
  153. package/fesm2022/cmat-services-translation.mjs +11 -11
  154. package/fesm2022/cmat-services-translation.mjs.map +1 -1
  155. package/fesm2022/cmat-services-utils.mjs +3 -3
  156. package/fesm2022/cmat-services-utils.mjs.map +1 -1
  157. package/fesm2022/cmat.mjs +9228 -7507
  158. package/fesm2022/cmat.mjs.map +1 -1
  159. package/icons/material-icons/heroicons-outline.svg +3 -0
  160. package/icons/material-icons/heroicons-solid.svg +3 -0
  161. package/package.json +10 -1
  162. package/styles/components/bundle.scss +21 -0
  163. package/styles/overrides/angular-material.scss +22 -1
  164. package/tailwind/plugins/theming.js +183 -183
  165. package/types/cmat-components-breadcrumb.d.ts +40 -37
  166. package/types/cmat-components-card.d.ts +11 -13
  167. package/types/cmat-components-carousel.d.ts +87 -113
  168. package/types/cmat-components-cascade.d.ts +84 -65
  169. package/types/cmat-components-chip-input.d.ts +29 -24
  170. package/types/cmat-components-code-editor.d.ts +28 -12
  171. package/types/cmat-components-color-picker.d.ts +236 -0
  172. package/types/cmat-components-custom-formly.d.ts +316 -184
  173. package/types/cmat-components-data-picker.d.ts +372 -0
  174. package/types/cmat-components-date-range.d.ts +31 -36
  175. package/types/cmat-components-date-time-display.d.ts +8 -8
  176. package/types/cmat-components-drawer.d.ts +30 -32
  177. package/types/cmat-components-empty-state.d.ts +9 -10
  178. package/types/cmat-components-file-preview.d.ts +9 -9
  179. package/types/cmat-components-filter-toolbar.d.ts +15 -15
  180. package/types/cmat-components-form-actions.d.ts +5 -5
  181. package/types/cmat-components-fullscreen.d.ts +5 -5
  182. package/types/cmat-components-highlight.d.ts +13 -14
  183. package/types/cmat-components-image-viewer.d.ts +29 -33
  184. package/types/cmat-components-inline-loading.d.ts +6 -6
  185. package/types/cmat-components-json-editor.d.ts +15 -17
  186. package/types/cmat-components-knob-input.d.ts +58 -55
  187. package/types/cmat-components-masonry.d.ts +9 -12
  188. package/types/cmat-components-material-color-picker.d.ts +16 -21
  189. package/types/cmat-components-material-datetimepicker.d.ts +174 -216
  190. package/types/cmat-components-navigation.d.ts +34 -39
  191. package/types/cmat-components-opt-input.d.ts +35 -33
  192. package/types/cmat-components-org-chart.d.ts +8 -9
  193. package/types/cmat-components-page-header.d.ts +9 -9
  194. package/types/cmat-components-pagination.d.ts +36 -40
  195. package/types/cmat-components-password-strength.d.ts +58 -64
  196. package/types/cmat-components-popover.d.ts +22 -32
  197. package/types/cmat-components-progress-bar.d.ts +7 -10
  198. package/types/cmat-components-qrcode.d.ts +22 -22
  199. package/types/cmat-components-rating.d.ts +17 -19
  200. package/types/cmat-components-rich-text-editor.d.ts +11 -12
  201. package/types/cmat-components-select-search.d.ts +48 -36
  202. package/types/cmat-components-select-table.d.ts +38 -34
  203. package/types/cmat-components-select-tree.d.ts +17 -15
  204. package/types/cmat-components-skeleton.d.ts +27 -10
  205. package/types/cmat-components-speed-dial.d.ts +24 -33
  206. package/types/cmat-components-status-tag.d.ts +19 -9
  207. package/types/cmat-components-table-toolbar.d.ts +7 -7
  208. package/types/cmat-components-timeline.d.ts +33 -34
  209. package/types/cmat-components-toast.d.ts +26 -30
  210. package/types/cmat-components-transfer-picker.d.ts +51 -56
  211. package/types/cmat-components-treetable.d.ts +12 -13
  212. package/types/cmat-components-upload.d.ts +33 -38
  213. package/types/cmat-components-x6-angular-shape.d.ts +1 -1
  214. package/types/cmat-directives-animate-on-scroll.d.ts +7 -7
  215. package/types/cmat-directives-arrow-cursor.d.ts +18 -20
  216. package/types/cmat-directives-data-exporter.d.ts +10 -10
  217. package/types/cmat-directives-debounce.d.ts +5 -5
  218. package/types/cmat-directives-digit-only.d.ts +13 -13
  219. package/types/cmat-directives-seamless-auto-scroll.d.ts +7 -7
  220. package/types/cmat-pipes-secure.d.ts +1 -3
  221. package/types/cmat-services-alert.d.ts +11 -12
  222. package/types/cmat-services-config.d.ts +2 -7
  223. package/types/cmat-services-confirmation.d.ts +2 -2
  224. package/types/cmat-services-data.d.ts +0 -1
  225. package/types/cmat-services-loading.d.ts +14 -22
  226. package/types/cmat-services-media-watcher.d.ts +5 -5
  227. package/types/cmat-services-translation.d.ts +4 -5
  228. package/types/cmat.d.ts +2167 -1746
@@ -0,0 +1,841 @@
1
+ import { DOCUMENT, NgStyle, NgClass } from '@angular/common';
2
+ import * as i0 from '@angular/core';
3
+ import { input, output, inject, ElementRef, Directive, signal, effect, untracked, ChangeDetectionStrategy, ViewEncapsulation, Component, model, forwardRef } from '@angular/core';
4
+ import * as i1 from '@angular/forms';
5
+ import { NG_VALUE_ACCESSOR, FormsModule, ReactiveFormsModule } from '@angular/forms';
6
+ import { TinyColor } from '@ctrl/tinycolor';
7
+ import { CdkConnectedOverlay, CdkOverlayOrigin } from '@angular/cdk/overlay';
8
+ import * as i2 from '@angular/material/input';
9
+ import { MatInputModule } from '@angular/material/input';
10
+
11
+ class CmatColorCoordinates {
12
+ constructor() {
13
+ this.percentX = input(0, /* @ts-ignore */
14
+ ...(ngDevMode ? [{ debugName: "percentX" }] : /* istanbul ignore next */ []));
15
+ this.percentY = input(0, /* @ts-ignore */
16
+ ...(ngDevMode ? [{ debugName: "percentY" }] : /* istanbul ignore next */ []));
17
+ this.coordinatesChange = output();
18
+ this._document = inject(DOCUMENT);
19
+ this._el = inject(ElementRef);
20
+ this.onDrag = (e) => {
21
+ e.preventDefault();
22
+ this._handleChange(e);
23
+ };
24
+ this.onDragEnd = () => {
25
+ this._document.removeEventListener('pointermove', this.onDrag);
26
+ this._document.removeEventListener('pointerup', this.onDragEnd);
27
+ };
28
+ }
29
+ onDragStart(e) {
30
+ this._document.addEventListener('pointermove', this.onDrag, { passive: false });
31
+ this._document.addEventListener('pointerup', this.onDragEnd, { passive: false });
32
+ e.preventDefault();
33
+ this._handleChange(e);
34
+ }
35
+ onKeyDown(e) {
36
+ const arrowKeys = ['ArrowUp', 'ArrowDown', 'ArrowLeft', 'ArrowRight'];
37
+ if (!arrowKeys.includes(e.key))
38
+ return;
39
+ e.preventDefault();
40
+ const rect = this._el.nativeElement.getBoundingClientRect();
41
+ const multiplier = e.shiftKey ? 10 : 1;
42
+ const stepX = (rect.width / 100) * multiplier;
43
+ const stepY = (rect.height / 100) * multiplier;
44
+ let vX = 0;
45
+ let vY = 0;
46
+ if (this.percentX != null && this.percentY != null) {
47
+ vX = rect.left + rect.width * (this.percentX() / 100);
48
+ vY = rect.top + rect.height * (this.percentY() / 100);
49
+ switch (e.key) {
50
+ case 'ArrowLeft':
51
+ vX -= stepX;
52
+ break;
53
+ case 'ArrowRight':
54
+ vX += stepX;
55
+ break;
56
+ case 'ArrowUp':
57
+ vY -= stepY;
58
+ break;
59
+ case 'ArrowDown':
60
+ vY += stepY;
61
+ break;
62
+ }
63
+ }
64
+ else if (this.percentX != null) {
65
+ vX = rect.left + rect.width * (this.percentX() / 100);
66
+ switch (e.key) {
67
+ case 'ArrowLeft':
68
+ case 'ArrowDown':
69
+ vX -= stepX;
70
+ break;
71
+ case 'ArrowRight':
72
+ case 'ArrowUp':
73
+ vX += stepX;
74
+ break;
75
+ }
76
+ }
77
+ else if (this.percentY != null) {
78
+ vY = rect.top + rect.height * (this.percentY() / 100);
79
+ switch (e.key) {
80
+ case 'ArrowLeft':
81
+ case 'ArrowDown':
82
+ vY += stepY;
83
+ break;
84
+ case 'ArrowRight':
85
+ case 'ArrowUp':
86
+ vY -= stepY;
87
+ break;
88
+ }
89
+ }
90
+ this._handleChange({ clientX: vX, clientY: vY });
91
+ }
92
+ _handleChange(e) {
93
+ const containerRect = this._el.nativeElement.getBoundingClientRect();
94
+ const containerWidth = containerRect.width;
95
+ const containerHeight = containerRect.height;
96
+ const { clientX, clientY } = e;
97
+ const left = clientX - containerRect.left;
98
+ const top = clientY - containerRect.top;
99
+ this.coordinatesChange.emit({
100
+ containerWidth,
101
+ containerHeight,
102
+ left,
103
+ top,
104
+ });
105
+ }
106
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: CmatColorCoordinates, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
107
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.2", type: CmatColorCoordinates, isStandalone: true, selector: "[cmat-color-coordinates], [cmatColorCoordinates]", inputs: { percentX: { classPropertyName: "percentX", publicName: "percentX", isSignal: true, isRequired: false, transformFunction: null }, percentY: { classPropertyName: "percentY", publicName: "percentY", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { coordinatesChange: "coordinatesChange" }, host: { listeners: { "pointerdown": "onDragStart($event)", "keydown": "onKeyDown($event)" } }, ngImport: i0 }); }
108
+ }
109
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: CmatColorCoordinates, decorators: [{
110
+ type: Directive,
111
+ args: [{
112
+ selector: '[cmat-color-coordinates], [cmatColorCoordinates]',
113
+ host: {
114
+ // eslint-disable-next-line @typescript-eslint/naming-convention
115
+ '(pointerdown)': 'onDragStart($event)',
116
+ // eslint-disable-next-line @typescript-eslint/naming-convention
117
+ '(keydown)': 'onKeyDown($event)',
118
+ },
119
+ }]
120
+ }], propDecorators: { percentX: [{ type: i0.Input, args: [{ isSignal: true, alias: "percentX", required: false }] }], percentY: [{ type: i0.Input, args: [{ isSignal: true, alias: "percentY", required: false }] }], coordinatesChange: [{ type: i0.Output, args: ["coordinatesChange"] }] } });
121
+
122
+ class CmatColorAlphaSlider {
123
+ constructor() {
124
+ this.color = input.required(/* @ts-ignore */
125
+ ...(ngDevMode ? [{ debugName: "color" }] : /* istanbul ignore next */ []));
126
+ this.direction = input('horizontal', /* @ts-ignore */
127
+ ...(ngDevMode ? [{ debugName: "direction" }] : /* istanbul ignore next */ []));
128
+ this.change = output();
129
+ this.hsl = signal(null, /* @ts-ignore */
130
+ ...(ngDevMode ? [{ debugName: "hsl" }] : /* istanbul ignore next */ []));
131
+ this.rgb = signal(null, /* @ts-ignore */
132
+ ...(ngDevMode ? [{ debugName: "rgb" }] : /* istanbul ignore next */ []));
133
+ this.gradient = signal('', /* @ts-ignore */
134
+ ...(ngDevMode ? [{ debugName: "gradient" }] : /* istanbul ignore next */ []));
135
+ this.posX = signal(0, /* @ts-ignore */
136
+ ...(ngDevMode ? [{ debugName: "posX" }] : /* istanbul ignore next */ []));
137
+ this.posY = signal(0, /* @ts-ignore */
138
+ ...(ngDevMode ? [{ debugName: "posY" }] : /* istanbul ignore next */ []));
139
+ effect(() => {
140
+ const color = this.color();
141
+ this.hsl.set(color.hsl);
142
+ this.rgb.set(color.rgb);
143
+ const rgb = this.rgb();
144
+ if (rgb) {
145
+ if (this.direction() === 'vertical') {
146
+ untracked(() => {
147
+ this.gradient.set(`linear-gradient(to top, rgba(${rgb.r},${rgb.g},${rgb.b}, 0) 0%, rgba(${rgb.r},${rgb.g},${rgb.b}, 1) 100%)`);
148
+ this.posX.set(0);
149
+ this.posY.set((1 - rgb.a) * 100);
150
+ });
151
+ }
152
+ else {
153
+ untracked(() => {
154
+ this.gradient.set(`linear-gradient(to right, rgba(${rgb.r},${rgb.g},${rgb.b}, 0) 0%, rgba(${rgb.r},${rgb.g},${rgb.b}, 1) 100%)`);
155
+ this.posY.set(0);
156
+ this.posX.set(rgb.a * 100);
157
+ });
158
+ }
159
+ }
160
+ });
161
+ }
162
+ handleChange(e) {
163
+ const { top, left, containerHeight, containerWidth } = e;
164
+ const isVertical = this.direction() === 'vertical';
165
+ const pos = isVertical ? top : left;
166
+ const size = isVertical ? containerHeight : containerWidth;
167
+ const ratio = Math.max(0, Math.min(pos, size)) / size;
168
+ const alpha = isVertical ? 1 - ratio : ratio;
169
+ const a = Math.round(alpha * 100) / 100;
170
+ const hsl = this.hsl();
171
+ if (hsl && hsl.a !== a) {
172
+ this.change.emit({ ...hsl, a, source: 'rgb' });
173
+ }
174
+ }
175
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: CmatColorAlphaSlider, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
176
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.0.2", type: CmatColorAlphaSlider, isStandalone: true, selector: "cmat-color-alpha-slider", inputs: { color: { classPropertyName: "color", publicName: "color", isSignal: true, isRequired: true, transformFunction: null }, direction: { classPropertyName: "direction", publicName: "direction", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { change: "change" }, host: { properties: { "class.cmat-color-alpha-vertical": "direction()=== \"vertical\"", "class.cmat-color-alpha-horizontal": "direction() === \"horizontal\"" }, classAttribute: "cmat-color-alpha-slider" }, ngImport: i0, template: "<!-- eslint-disable @angular-eslint/template/no-inline-styles -->\r\n<div class=\"cmat-color-alpha-slider-track\" cmatColorCoordinates [style.background-image]=\"gradient()\" [percentX]=\"posX()\"\r\n [percentY]=\"posY()\" (coordinatesChange)=\"handleChange($event)\">\r\n <div class=\"cmat-color-alpha-slider-pointer\" [style.left.%]=\"posX()\" [style.top.%]=\"posY()\">\r\n <button class=\"cmat-color-alpha-slider-thumb\" type=\"button\">\r\n <!-- -->\r\n </button>\r\n </div>\r\n</div>", styles: [".cmat-color-alpha-slider{position:relative;display:block;width:var(--cp-slider-width, auto);height:var(--cp-slider-height, 10px);border-radius:var(--cp-slider-shape, 2px);background-color:#fff;background-image:conic-gradient(transparent 25%,#ccc 25% 50%,transparent 50% 75%,#ccc 75%);background-size:10px 10px}.cmat-color-alpha-slider.cmat-color-alpha-vertical{width:var(--cp-slider-width, 10px);height:var(--cp-slider-height, auto)}.cmat-color-alpha-slider-track{position:relative;width:100%;height:100%;border-radius:var(--cp-slider-shape, 2px);touch-action:none}.cmat-color-alpha-slider-pointer{position:absolute}.cmat-color-alpha-slider-thumb{display:block;width:var(--cp-slider-thumb-width, 12px);height:var(--cp-slider-thumb-height, 12px);padding:0;border:none;border-radius:var(--cp-slider-thumb-shape, 6px);transform:translate(-50%,calc((var(--cp-slider-thumb-height, 12px) - var(--cp-slider-height, 10px)) / -2));background-color:var(--cp-slider-thumb-background-color, #f2f2f2);outline:1px solid var(--cp-slider-thumb-outline-color, rgba(0, 0, 0, .04));box-shadow:var(--cp-slider-thumb-shadow, 0 1px 4px 0 rgba(0, 0, 0, .32), 0 2px 8px 0 rgba(0, 0, 0, .16))}.cmat-color-alpha-slider-thumb:focus-visible{outline-color:var(--cp-slider-thumb-focus-outline-color, var(--cp-input-focus-outline-color, #0d99ff))}.cmat-color-alpha-vertical .cmat-color-alpha-slider-thumb{transform:translate(calc((var(--cp-slider-thumb-width, 12px) - var(--cp-slider-width, 10px)) / -2),-50%)}\n"], dependencies: [{ kind: "directive", type: CmatColorCoordinates, selector: "[cmat-color-coordinates], [cmatColorCoordinates]", inputs: ["percentX", "percentY"], outputs: ["coordinatesChange"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
177
+ }
178
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: CmatColorAlphaSlider, decorators: [{
179
+ type: Component,
180
+ args: [{ selector: 'cmat-color-alpha-slider', imports: [CmatColorCoordinates], host: {
181
+ 'class': 'cmat-color-alpha-slider',
182
+ // eslint-disable-next-line @typescript-eslint/naming-convention
183
+ '[class.cmat-color-alpha-vertical]': 'direction()=== "vertical"',
184
+ // eslint-disable-next-line @typescript-eslint/naming-convention
185
+ '[class.cmat-color-alpha-horizontal]': 'direction() === "horizontal"',
186
+ }, encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, template: "<!-- eslint-disable @angular-eslint/template/no-inline-styles -->\r\n<div class=\"cmat-color-alpha-slider-track\" cmatColorCoordinates [style.background-image]=\"gradient()\" [percentX]=\"posX()\"\r\n [percentY]=\"posY()\" (coordinatesChange)=\"handleChange($event)\">\r\n <div class=\"cmat-color-alpha-slider-pointer\" [style.left.%]=\"posX()\" [style.top.%]=\"posY()\">\r\n <button class=\"cmat-color-alpha-slider-thumb\" type=\"button\">\r\n <!-- -->\r\n </button>\r\n </div>\r\n</div>", styles: [".cmat-color-alpha-slider{position:relative;display:block;width:var(--cp-slider-width, auto);height:var(--cp-slider-height, 10px);border-radius:var(--cp-slider-shape, 2px);background-color:#fff;background-image:conic-gradient(transparent 25%,#ccc 25% 50%,transparent 50% 75%,#ccc 75%);background-size:10px 10px}.cmat-color-alpha-slider.cmat-color-alpha-vertical{width:var(--cp-slider-width, 10px);height:var(--cp-slider-height, auto)}.cmat-color-alpha-slider-track{position:relative;width:100%;height:100%;border-radius:var(--cp-slider-shape, 2px);touch-action:none}.cmat-color-alpha-slider-pointer{position:absolute}.cmat-color-alpha-slider-thumb{display:block;width:var(--cp-slider-thumb-width, 12px);height:var(--cp-slider-thumb-height, 12px);padding:0;border:none;border-radius:var(--cp-slider-thumb-shape, 6px);transform:translate(-50%,calc((var(--cp-slider-thumb-height, 12px) - var(--cp-slider-height, 10px)) / -2));background-color:var(--cp-slider-thumb-background-color, #f2f2f2);outline:1px solid var(--cp-slider-thumb-outline-color, rgba(0, 0, 0, .04));box-shadow:var(--cp-slider-thumb-shadow, 0 1px 4px 0 rgba(0, 0, 0, .32), 0 2px 8px 0 rgba(0, 0, 0, .16))}.cmat-color-alpha-slider-thumb:focus-visible{outline-color:var(--cp-slider-thumb-focus-outline-color, var(--cp-input-focus-outline-color, #0d99ff))}.cmat-color-alpha-vertical .cmat-color-alpha-slider-thumb{transform:translate(calc((var(--cp-slider-thumb-width, 12px) - var(--cp-slider-width, 10px)) / -2),-50%)}\n"] }]
187
+ }], ctorParameters: () => [], propDecorators: { color: [{ type: i0.Input, args: [{ isSignal: true, alias: "color", required: true }] }], direction: [{ type: i0.Input, args: [{ isSignal: true, alias: "direction", required: false }] }], change: [{ type: i0.Output, args: ["change"] }] } });
188
+
189
+ class CmatColorHueSlider {
190
+ constructor() {
191
+ this.color = input.required(/* @ts-ignore */
192
+ ...(ngDevMode ? [{ debugName: "color" }] : /* istanbul ignore next */ []));
193
+ this.direction = input('horizontal', /* @ts-ignore */
194
+ ...(ngDevMode ? [{ debugName: "direction" }] : /* istanbul ignore next */ []));
195
+ this.change = output();
196
+ this.hsl = signal(null, /* @ts-ignore */
197
+ ...(ngDevMode ? [{ debugName: "hsl" }] : /* istanbul ignore next */ []));
198
+ this.posX = signal(0, /* @ts-ignore */
199
+ ...(ngDevMode ? [{ debugName: "posX" }] : /* istanbul ignore next */ []));
200
+ this.posY = signal(0, /* @ts-ignore */
201
+ ...(ngDevMode ? [{ debugName: "posY" }] : /* istanbul ignore next */ []));
202
+ effect(() => {
203
+ const color = this.color();
204
+ this.hsl.set(color.hsl);
205
+ if (!color.hsl) {
206
+ return;
207
+ }
208
+ if (this.direction() === 'vertical') {
209
+ untracked(() => {
210
+ this.posX.set(0);
211
+ this.posY.set(100 - (this.hsl().h * 100) / 360);
212
+ });
213
+ }
214
+ else {
215
+ untracked(() => {
216
+ this.posY.set(0);
217
+ this.posX.set((this.hsl().h * 100) / 360);
218
+ });
219
+ }
220
+ });
221
+ }
222
+ handleChange(e) {
223
+ const { top, left, containerHeight, containerWidth } = e;
224
+ const isVertical = this.direction() === 'vertical';
225
+ const pos = isVertical ? top : left;
226
+ const size = isVertical ? containerHeight : containerWidth;
227
+ const ratio = Math.max(0, Math.min(pos, size)) / size;
228
+ const hue = isVertical ? (1 - ratio) * 360 : ratio * 360;
229
+ const h = hue >= 360 ? 359 : hue;
230
+ const hsl = this.hsl();
231
+ if (hsl && hsl.h !== h) {
232
+ this.change.emit({ ...hsl, h, source: 'rgb' });
233
+ }
234
+ }
235
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: CmatColorHueSlider, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
236
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.0.2", type: CmatColorHueSlider, isStandalone: true, selector: "cmat-color-hue-slider", inputs: { color: { classPropertyName: "color", publicName: "color", isSignal: true, isRequired: true, transformFunction: null }, direction: { classPropertyName: "direction", publicName: "direction", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { change: "change" }, host: { properties: { "class.cmat-color-hue-vertical": "direction() === \"vertical\"", "class.cmat-color-hue-horizontal": "direction() === \"horizontal\"" }, classAttribute: "cmat-color-hue-slider" }, ngImport: i0, template: "<!-- eslint-disable @angular-eslint/template/no-inline-styles -->\r\n<div class=\"cmat-color-hue-slider-track\" cmatColorCoordinates [percentX]=\"posX()\" [percentY]=\"posY()\"\r\n (coordinatesChange)=\"handleChange($event)\">\r\n <div class=\"cmat-color-hue-slider-pointer\" [style.left.%]=\"posX()\" [style.top.%]=\"posY()\">\r\n <button class=\"cmat-color-hue-slider-thumb\" type=\"button\">\r\n <!-- -->\r\n </button>\r\n </div>\r\n</div>", styles: [".cmat-color-hue-slider{position:relative;display:block;width:var(--cp-slider-width, auto);height:var(--cp-slider-height, 10px);border-radius:var(--cp-slider-shape, 2px);background-image:linear-gradient(to right,red,#ff0 17%,#0f0 33%,#0ff,#00f 67%,#f0f 83%,red)}.cmat-color-hue-slider.cmat-color-hue-vertical{width:var(--cp-slider-width, 10px);height:var(--cp-slider-height, auto);background-image:linear-gradient(to top,red,#ff0 17%,#0f0 33%,#0ff,#00f 67%,#f0f 83%,red)}.cmat-color-hue-slider-track{position:relative;width:100%;height:100%;border-radius:var(--cp-slider-shape, 2px);touch-action:none}.cmat-color-hue-slider-pointer{position:absolute}.cmat-color-hue-slider-thumb{display:block;width:var(--cp-slider-thumb-width, 12px);height:var(--cp-slider-thumb-height, 12px);padding:0;border:none;border-radius:var(--cp-slider-thumb-shape, 6px);transform:translate(-50%,calc((var(--cp-slider-thumb-height, 12px) - var(--cp-slider-height, 10px)) / -2));background-color:var(--cp-slider-thumb-background-color, #f2f2f2);outline:1px solid var(--cp-slider-thumb-outline-color, rgba(0, 0, 0, .04));box-shadow:var(--cp-slider-thumb-shadow, 0 1px 4px 0 rgba(0, 0, 0, .32), 0 2px 8px 0 rgba(0, 0, 0, .16))}.cmat-color-hue-slider-thumb:focus-visible{outline-color:var(--cp-slider-thumb-focus-outline-color, var(--cp-input-focus-outline-color, #0d99ff))}.cmat-color-hue-vertical .cmat-color-hue-slider-thumb{transform:translate(calc((var(--cp-slider-thumb-width, 12px) - var(--cp-slider-width, 10px)) / -2),-50%)}\n"], dependencies: [{ kind: "directive", type: CmatColorCoordinates, selector: "[cmat-color-coordinates], [cmatColorCoordinates]", inputs: ["percentX", "percentY"], outputs: ["coordinatesChange"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
237
+ }
238
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: CmatColorHueSlider, decorators: [{
239
+ type: Component,
240
+ args: [{ selector: 'cmat-color-hue-slider', imports: [CmatColorCoordinates], host: {
241
+ 'class': 'cmat-color-hue-slider',
242
+ // eslint-disable-next-line @typescript-eslint/naming-convention
243
+ '[class.cmat-color-hue-vertical]': 'direction() === "vertical"',
244
+ // eslint-disable-next-line @typescript-eslint/naming-convention
245
+ '[class.cmat-color-hue-horizontal]': 'direction() === "horizontal"',
246
+ }, encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, template: "<!-- eslint-disable @angular-eslint/template/no-inline-styles -->\r\n<div class=\"cmat-color-hue-slider-track\" cmatColorCoordinates [percentX]=\"posX()\" [percentY]=\"posY()\"\r\n (coordinatesChange)=\"handleChange($event)\">\r\n <div class=\"cmat-color-hue-slider-pointer\" [style.left.%]=\"posX()\" [style.top.%]=\"posY()\">\r\n <button class=\"cmat-color-hue-slider-thumb\" type=\"button\">\r\n <!-- -->\r\n </button>\r\n </div>\r\n</div>", styles: [".cmat-color-hue-slider{position:relative;display:block;width:var(--cp-slider-width, auto);height:var(--cp-slider-height, 10px);border-radius:var(--cp-slider-shape, 2px);background-image:linear-gradient(to right,red,#ff0 17%,#0f0 33%,#0ff,#00f 67%,#f0f 83%,red)}.cmat-color-hue-slider.cmat-color-hue-vertical{width:var(--cp-slider-width, 10px);height:var(--cp-slider-height, auto);background-image:linear-gradient(to top,red,#ff0 17%,#0f0 33%,#0ff,#00f 67%,#f0f 83%,red)}.cmat-color-hue-slider-track{position:relative;width:100%;height:100%;border-radius:var(--cp-slider-shape, 2px);touch-action:none}.cmat-color-hue-slider-pointer{position:absolute}.cmat-color-hue-slider-thumb{display:block;width:var(--cp-slider-thumb-width, 12px);height:var(--cp-slider-thumb-height, 12px);padding:0;border:none;border-radius:var(--cp-slider-thumb-shape, 6px);transform:translate(-50%,calc((var(--cp-slider-thumb-height, 12px) - var(--cp-slider-height, 10px)) / -2));background-color:var(--cp-slider-thumb-background-color, #f2f2f2);outline:1px solid var(--cp-slider-thumb-outline-color, rgba(0, 0, 0, .04));box-shadow:var(--cp-slider-thumb-shadow, 0 1px 4px 0 rgba(0, 0, 0, .32), 0 2px 8px 0 rgba(0, 0, 0, .16))}.cmat-color-hue-slider-thumb:focus-visible{outline-color:var(--cp-slider-thumb-focus-outline-color, var(--cp-input-focus-outline-color, #0d99ff))}.cmat-color-hue-vertical .cmat-color-hue-slider-thumb{transform:translate(calc((var(--cp-slider-thumb-width, 12px) - var(--cp-slider-width, 10px)) / -2),-50%)}\n"] }]
247
+ }], ctorParameters: () => [], propDecorators: { color: [{ type: i0.Input, args: [{ isSignal: true, alias: "color", required: true }] }], direction: [{ type: i0.Input, args: [{ isSignal: true, alias: "direction", required: false }] }], change: [{ type: i0.Output, args: ["change"] }] } });
248
+
249
+ class CmatColorIconButton {
250
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: CmatColorIconButton, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
251
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "22.0.2", type: CmatColorIconButton, isStandalone: true, selector: "cmat-color-icon-button", host: { classAttribute: "cmat-color-icon-button" }, ngImport: i0, template: `
252
+ <ng-content />
253
+ `, isInline: true, styles: [".cmat-color-icon-button{display:inline-block;width:24px;height:24px}.cmat-color-icon-button button{width:100%;height:100%;padding:2px;color:var(--cp-icon-button-text-color, inherit);background-color:var(--cp-icon-button-background-color, transparent);border:none;border-radius:var(--cp-icon-button-shape, 4px)}.cmat-color-icon-button button:hover{background-color:var(--cp-icon-button-hover-background-color, rgba(0, 0, 0, .06))}.cmat-color-icon-button button:active{background-color:var(--cp-icon-button-active-background-color, rgba(0, 0, 0, .12))}.cmat-color-icon-button button:focus-visible{background-color:var(--cp-icon-button-focus-background-color, transparent);outline:1px solid var(--cp-icon-button-focus-outline-color, #0d99ff);outline-offset:-1px}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
254
+ }
255
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: CmatColorIconButton, decorators: [{
256
+ type: Component,
257
+ args: [{ selector: 'cmat-color-icon-button', imports: [], template: `
258
+ <ng-content />
259
+ `, host: {
260
+ class: 'cmat-color-icon-button',
261
+ }, encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, styles: [".cmat-color-icon-button{display:inline-block;width:24px;height:24px}.cmat-color-icon-button button{width:100%;height:100%;padding:2px;color:var(--cp-icon-button-text-color, inherit);background-color:var(--cp-icon-button-background-color, transparent);border:none;border-radius:var(--cp-icon-button-shape, 4px)}.cmat-color-icon-button button:hover{background-color:var(--cp-icon-button-hover-background-color, rgba(0, 0, 0, .06))}.cmat-color-icon-button button:active{background-color:var(--cp-icon-button-active-background-color, rgba(0, 0, 0, .12))}.cmat-color-icon-button button:focus-visible{background-color:var(--cp-icon-button-focus-background-color, transparent);outline:1px solid var(--cp-icon-button-focus-outline-color, #0d99ff);outline-offset:-1px}\n"] }]
262
+ }] });
263
+
264
+ let nextUniqueId = 0;
265
+ class CmatColorInputField {
266
+ constructor() {
267
+ this.label = input('', /* @ts-ignore */
268
+ ...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
269
+ this.step = input(1, /* @ts-ignore */
270
+ ...(ngDevMode ? [{ debugName: "step" }] : /* istanbul ignore next */ []));
271
+ this.placeholder = input('', /* @ts-ignore */
272
+ ...(ngDevMode ? [{ debugName: "placeholder" }] : /* istanbul ignore next */ []));
273
+ this.value = input('', /* @ts-ignore */
274
+ ...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
275
+ this.valueChange = output();
276
+ this.uniqueId = `cmat-color-input-${++nextUniqueId}`;
277
+ this.focus = signal(false, /* @ts-ignore */
278
+ ...(ngDevMode ? [{ debugName: "focus" }] : /* istanbul ignore next */ []));
279
+ this.currentValue = signal('', /* @ts-ignore */
280
+ ...(ngDevMode ? [{ debugName: "currentValue" }] : /* istanbul ignore next */ []));
281
+ this.blurValue = signal('', /* @ts-ignore */
282
+ ...(ngDevMode ? [{ debugName: "blurValue" }] : /* istanbul ignore next */ []));
283
+ effect(() => {
284
+ if (!this.focus()) {
285
+ this.currentValue.set(String(this.value()));
286
+ this.blurValue.set(String(this.value()));
287
+ }
288
+ else {
289
+ this.blurValue.set(String(this.value()));
290
+ }
291
+ });
292
+ }
293
+ handleFocus(e) {
294
+ this.focus.set(true);
295
+ e.preventDefault();
296
+ }
297
+ handleFocusOut(e) {
298
+ this.focus.set(false);
299
+ this.currentValue.set(this.blurValue());
300
+ e.preventDefault();
301
+ }
302
+ handleKeydown(e) {
303
+ const target = e.target;
304
+ const inputValue = String(target.value);
305
+ const isPercentage = inputValue.includes('%');
306
+ const num = Number(inputValue.replace(/%/g, ''));
307
+ if (isNaN(num)) {
308
+ return;
309
+ }
310
+ const step = this.step() || 1;
311
+ if (e.key === 'ArrowUp') {
312
+ if (this.label()) {
313
+ this.valueChange.emit({ [this.label()]: num + step });
314
+ }
315
+ else {
316
+ this.valueChange.emit(num + step);
317
+ }
318
+ if (isPercentage) {
319
+ this.currentValue.set(`${num + step}%`);
320
+ }
321
+ else {
322
+ this.currentValue.set(num + step);
323
+ }
324
+ }
325
+ if (e.key === 'ArrowDown') {
326
+ if (this.label()) {
327
+ this.valueChange.emit({ [this.label()]: num - step });
328
+ }
329
+ else {
330
+ this.valueChange.emit(num - step);
331
+ }
332
+ if (isPercentage) {
333
+ this.currentValue.set(`${num - step}%`);
334
+ }
335
+ else {
336
+ this.currentValue.set(num - step);
337
+ }
338
+ }
339
+ }
340
+ handleKeyup(e) {
341
+ const target = e.target;
342
+ if (e.key === 'ArrowDown' || e.key === 'ArrowUp') {
343
+ return;
344
+ }
345
+ if (`${this.currentValue()}` === target.value) {
346
+ return;
347
+ }
348
+ if (this.label()) {
349
+ this.valueChange.emit({ [this.label()]: target.value });
350
+ }
351
+ else {
352
+ this.valueChange.emit(target.value);
353
+ }
354
+ }
355
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: CmatColorInputField, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
356
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.2", type: CmatColorInputField, isStandalone: true, selector: "cmat-color-input-field", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, step: { classPropertyName: "step", publicName: "step", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { valueChange: "valueChange" }, host: { classAttribute: "cmat-color-input-field" }, ngImport: i0, template: "<input spellCheck=\"false\" [value]=\"currentValue()\" [placeholder]=\"placeholder()\" [attr.aria-labelledby]=\"uniqueId\"\r\n (keydown)=\"handleKeydown($event)\" (keyup)=\"handleKeyup($event)\" (focus)=\"handleFocus($event)\"\r\n (focusout)=\"handleFocusOut($event)\" />\r\n@if (label()) {\r\n<span [id]=\"uniqueId\">{{ label() }}</span>\r\n}", styles: [".cmat-color-input-field{font-size:11px;text-align:center}.cmat-color-input-field input{box-sizing:border-box;width:100%;height:24px;border:none;border-radius:var(--cp-input-shape, 4px);background-color:var(--cp-input-background-color, transparent);outline:1px solid var(--cp-input-outline-color, #e6e6e6);font-family:var(--cp-input-text-font, monospace);font-size:inherit;text-align:inherit}.cmat-color-input-field input:hover{outline-color:var(--cp-input-hover-outline-color, #d6d6d6)}.cmat-color-input-field input:focus{outline-color:var(--cp-input-focus-outline-color, #0d99ff)}.cmat-color-input-field span{display:block;margin-top:8px;color:#969696;text-transform:uppercase}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
357
+ }
358
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: CmatColorInputField, decorators: [{
359
+ type: Component,
360
+ args: [{ selector: 'cmat-color-input-field', host: {
361
+ class: 'cmat-color-input-field',
362
+ }, encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, template: "<input spellCheck=\"false\" [value]=\"currentValue()\" [placeholder]=\"placeholder()\" [attr.aria-labelledby]=\"uniqueId\"\r\n (keydown)=\"handleKeydown($event)\" (keyup)=\"handleKeyup($event)\" (focus)=\"handleFocus($event)\"\r\n (focusout)=\"handleFocusOut($event)\" />\r\n@if (label()) {\r\n<span [id]=\"uniqueId\">{{ label() }}</span>\r\n}", styles: [".cmat-color-input-field{font-size:11px;text-align:center}.cmat-color-input-field input{box-sizing:border-box;width:100%;height:24px;border:none;border-radius:var(--cp-input-shape, 4px);background-color:var(--cp-input-background-color, transparent);outline:1px solid var(--cp-input-outline-color, #e6e6e6);font-family:var(--cp-input-text-font, monospace);font-size:inherit;text-align:inherit}.cmat-color-input-field input:hover{outline-color:var(--cp-input-hover-outline-color, #d6d6d6)}.cmat-color-input-field input:focus{outline-color:var(--cp-input-focus-outline-color, #0d99ff)}.cmat-color-input-field span{display:block;margin-top:8px;color:#969696;text-transform:uppercase}\n"] }]
363
+ }], ctorParameters: () => [], propDecorators: { label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], step: [{ type: i0.Input, args: [{ isSignal: true, alias: "step", required: false }] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }], valueChange: [{ type: i0.Output, args: ["valueChange"] }] } });
364
+
365
+ /* eslint-disable @typescript-eslint/no-unsafe-member-access */
366
+ function simpleCheckForValidColor(data) {
367
+ const keysToCheck = ['r', 'g', 'b', 'a', 'h', 's', 'l', 'v'];
368
+ let checked = 0;
369
+ let passed = 0;
370
+ keysToCheck.forEach((letter) => {
371
+ if (!(letter in data)) {
372
+ return;
373
+ }
374
+ checked += 1;
375
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
376
+ const value = data[letter];
377
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
378
+ if (!isNaN(value)) {
379
+ passed += 1;
380
+ }
381
+ if (letter === 's' || letter === 'l') {
382
+ const percentPatt = /^\d+%$/;
383
+ if (percentPatt.test(String(value))) {
384
+ passed += 1;
385
+ }
386
+ }
387
+ });
388
+ return checked === passed;
389
+ }
390
+ function parseColor(data, oldHue = 0, hideAlpha = false) {
391
+ const color = data && typeof data !== 'string' && 'hex' in data
392
+ ? new TinyColor(data.hex)
393
+ : new TinyColor(data);
394
+ if (hideAlpha) {
395
+ color.setAlpha(1);
396
+ }
397
+ const rgb = color.toRgb();
398
+ let hsl;
399
+ let hsv;
400
+ // Check if data is HSLAsource
401
+ if (data && typeof data === 'object' && 's' in data && 'l' in data) {
402
+ hsl = {
403
+ h: data.h ?? oldHue,
404
+ s: data.s,
405
+ l: data.l,
406
+ a: data.a ?? 1,
407
+ };
408
+ hsv = hslToHsv(hsl.h, hsl.s, hsl.l, hsl.a);
409
+ }
410
+ else if (data && typeof data === 'object' && 's' in data && 'v' in data) {
411
+ // Check if data is HSVAsource
412
+ hsv = {
413
+ h: data.h ?? oldHue,
414
+ s: data.s,
415
+ v: data.v,
416
+ a: data.a ?? 1,
417
+ };
418
+ hsl = hsvToHsl(hsv.h, hsv.s, hsv.v, hsv.a);
419
+ }
420
+ else {
421
+ hsl = color.toHsl();
422
+ hsv = color.toHsv();
423
+ }
424
+ if (hsl.s === 0) {
425
+ hsl.h = oldHue;
426
+ hsv.h = oldHue;
427
+ }
428
+ return {
429
+ hsl,
430
+ hslString: toHslString(hsl),
431
+ hsv,
432
+ hsvString: toHsvString(hsv),
433
+ rgb,
434
+ rgbString: color.toRgbString(),
435
+ hex: rgb.a === 1 ? color.toHexString() : color.toHex8String(),
436
+ oldHue: data && typeof data === 'object' && 'h' in data ? (data.h ?? oldHue ?? hsl.h) : (oldHue ?? hsl.h),
437
+ source: data && typeof data === 'object' ? data.source : '',
438
+ };
439
+ }
440
+ function hslToHsv(h, s, l, a) {
441
+ const v = l + s * Math.min(l, 1 - l);
442
+ const sv = v === 0 ? 0 : 2 * (1 - l / v);
443
+ return { h, s: sv, v, a };
444
+ }
445
+ function hsvToHsl(h, s, v, a) {
446
+ const l = v * (1 - s / 2);
447
+ const sl = l === 0 || l === 1 ? 0 : (v - l) / Math.min(l, 1 - l);
448
+ return { h, s: sl, l, a };
449
+ }
450
+ function toHslString(hsl) {
451
+ const h = Math.round(hsl.h);
452
+ const s = Math.round(hsl.s * 100);
453
+ const l = Math.round(hsl.l * 100);
454
+ return hsl.a === 1 ? `hsl(${h}, ${s}%, ${l}%)` : `hsla(${h}, ${s}%, ${l}%, ${hsl.a})`;
455
+ }
456
+ function toHsvString(hsv) {
457
+ const h = Math.round(hsv.h);
458
+ const s = Math.round(hsv.s * 100);
459
+ const v = Math.round(hsv.v * 100);
460
+ return hsv.a === 1 ? `hsv(${h}, ${s}%, ${v}%)` : `hsva(${h}, ${s}%, ${v}%, ${hsv.a})`;
461
+ }
462
+ function isValidHex(hex) {
463
+ const tinyColor = new TinyColor(hex);
464
+ return tinyColor.isValid;
465
+ }
466
+
467
+ class CmatColorInputFields {
468
+ constructor() {
469
+ this.color = input.required(/* @ts-ignore */
470
+ ...(ngDevMode ? [{ debugName: "color" }] : /* istanbul ignore next */ []));
471
+ this.format = model('hex', /* @ts-ignore */
472
+ ...(ngDevMode ? [{ debugName: "format" }] : /* istanbul ignore next */ []));
473
+ this.hideAlpha = input(false, /* @ts-ignore */
474
+ ...(ngDevMode ? [{ debugName: "hideAlpha" }] : /* istanbul ignore next */ []));
475
+ this.formatChanged = output();
476
+ this.valueChange = output();
477
+ this.hsl = signal(null, /* @ts-ignore */
478
+ ...(ngDevMode ? [{ debugName: "hsl" }] : /* istanbul ignore next */ []));
479
+ this.rgb = signal(null, /* @ts-ignore */
480
+ ...(ngDevMode ? [{ debugName: "rgb" }] : /* istanbul ignore next */ []));
481
+ this.hex = signal('', /* @ts-ignore */
482
+ ...(ngDevMode ? [{ debugName: "hex" }] : /* istanbul ignore next */ []));
483
+ effect(() => {
484
+ const color = this.color();
485
+ this.hsl.set(color.hsl);
486
+ this.rgb.set(color.rgb);
487
+ this.hex.set(color.hex);
488
+ untracked(() => {
489
+ if (!this.format()) {
490
+ this.format.set('hex');
491
+ }
492
+ else if (this.format() === 'hsv') {
493
+ this.format.set('hsl');
494
+ }
495
+ });
496
+ });
497
+ }
498
+ round(value) {
499
+ return Math.round(value);
500
+ }
501
+ toggleColorFormat() {
502
+ let format;
503
+ let fieldVal = {};
504
+ if (this.format() === 'hex') {
505
+ format = 'rgb';
506
+ fieldVal = { ...this.rgb() };
507
+ }
508
+ else if (this.format() === 'rgb') {
509
+ format = 'hsl';
510
+ fieldVal = { ...this.hsl(), s: this.hsl().s * 100, l: this.hsl().l * 100 };
511
+ }
512
+ else if (this.format() === 'hsl') {
513
+ format = 'hex';
514
+ fieldVal = { hex: this.hex() };
515
+ }
516
+ this.format.set(format);
517
+ this.formatChanged.emit(format);
518
+ this.handleChange(fieldVal);
519
+ }
520
+ handleChange(e) {
521
+ if (typeof e === 'string' || typeof e === 'number') {
522
+ return;
523
+ }
524
+ if (e.hex) {
525
+ if (isValidHex(e.hex)) {
526
+ const color = new TinyColor(e.hex);
527
+ this.valueChange.emit({
528
+ hex: this.hideAlpha() ? color.toHex() : color.toHex8(),
529
+ source: 'hex',
530
+ });
531
+ }
532
+ }
533
+ else if (e.r || e.g || e.b) {
534
+ this.valueChange.emit({
535
+ r: e.r ?? this.rgb().r,
536
+ g: e.g ?? this.rgb().g,
537
+ b: e.b ?? this.rgb().b,
538
+ a: Math.round((e.a ?? this.rgb().a) * 100) / 100,
539
+ source: 'rgb',
540
+ });
541
+ }
542
+ else if (e.h || e.s || e.l) {
543
+ const s = (typeof e.s === 'string' ? Number(e.s.replace('%', '')) : e.s ?? 0) / 100;
544
+ const l = (typeof e.l === 'string' ? Number(e.l.replace('%', '')) : e.l ?? 0) / 100;
545
+ this.valueChange.emit({
546
+ h: e.h ?? this.hsl().h,
547
+ s: s ?? this.hsl().s,
548
+ l: l ?? this.hsl().l,
549
+ a: Math.round((e.a ?? this.hsl().a) * 100) / 100,
550
+ source: 'hsl',
551
+ });
552
+ }
553
+ else if (e.a) {
554
+ let a = Math.max(0, Math.min(1, e.a));
555
+ if (this.hideAlpha()) {
556
+ a = 1;
557
+ }
558
+ this.valueChange.emit({
559
+ h: this.hsl().h,
560
+ s: this.hsl().s,
561
+ l: this.hsl().l,
562
+ a: Math.round(a * 100) / 100,
563
+ source: 'rgb',
564
+ });
565
+ }
566
+ }
567
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: CmatColorInputFields, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
568
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.2", type: CmatColorInputFields, isStandalone: true, selector: "cmat-color-input-fields", inputs: { color: { classPropertyName: "color", publicName: "color", isSignal: true, isRequired: true, transformFunction: null }, format: { classPropertyName: "format", publicName: "format", isSignal: true, isRequired: false, transformFunction: null }, hideAlpha: { classPropertyName: "hideAlpha", publicName: "hideAlpha", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { format: "formatChange", formatChanged: "formatChanged", valueChange: "valueChange" }, host: { classAttribute: "cmat-color-input-fields" }, ngImport: i0, template: "<div class=\"cmat-color-input-field-wrapper\">\r\n @if (format() === 'hex') {\r\n <cmat-color-input-field label=\"hex\" [value]=\"hex()\" (valueChange)=\"handleChange($event)\" />\r\n }\r\n @if (format() === 'rgb') {\r\n <cmat-color-input-field label=\"r\" [value]=\"rgb()!.r\" (valueChange)=\"handleChange($event)\" />\r\n <cmat-color-input-field label=\"g\" [value]=\"rgb()!.g\" (valueChange)=\"handleChange($event)\" />\r\n <cmat-color-input-field label=\"b\" [value]=\"rgb()!.b\" (valueChange)=\"handleChange($event)\" />\r\n\r\n @if (!hideAlpha()) {\r\n <cmat-color-input-field label=\"a\" [step]=\"0.01\" [value]=\"rgb()!.a\" (valueChange)=\"handleChange($event)\" />\r\n }\r\n }\r\n @if (format() === 'hsl') {\r\n <cmat-color-input-field label=\"h\" [value]=\"round(hsl()!.h)\" (valueChange)=\"handleChange($event)\" />\r\n <cmat-color-input-field label=\"s\" [value]=\"round(hsl()!.s * 100) + '%'\" (valueChange)=\"handleChange($event)\" />\r\n <cmat-color-input-field label=\"l\" [value]=\"round(hsl()!.l * 100) + '%'\" (valueChange)=\"handleChange($event)\" />\r\n\r\n @if (!hideAlpha()) {\r\n <cmat-color-input-field label=\"a\" [step]=\"0.01\" [value]=\"hsl()!.a\" (valueChange)=\"handleChange($event)\" />\r\n }\r\n }\r\n</div>\r\n\r\n<cmat-color-icon-button>\r\n <button type=\"button\" (click)=\"toggleColorFormat()\">\r\n <svg viewBox=\"0 0 24 24\">\r\n <path fill=\"currentColor\"\r\n d=\"M12,18.17L8.83,15L7.42,16.41L12,21L16.59,16.41L15.17,15M12,5.83L15.17,9L16.58,7.59L12,3L7.41,7.59L8.83,9L12,5.83Z\" />\r\n </svg>\r\n </button>\r\n</cmat-color-icon-button>", styles: [".cmat-color-input-fields{display:flex;align-items:center;gap:8px;width:100%}.cmat-color-input-field-wrapper{flex:1;display:flex;gap:8px}.cmat-color-input-field-wrapper .cmat-color-input-field{flex:1}\n"], dependencies: [{ kind: "component", type: CmatColorInputField, selector: "cmat-color-input-field", inputs: ["label", "step", "placeholder", "value"], outputs: ["valueChange"] }, { kind: "component", type: CmatColorIconButton, selector: "cmat-color-icon-button" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
569
+ }
570
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: CmatColorInputFields, decorators: [{
571
+ type: Component,
572
+ args: [{ selector: 'cmat-color-input-fields', imports: [CmatColorInputField, CmatColorIconButton], host: {
573
+ class: 'cmat-color-input-fields',
574
+ }, encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"cmat-color-input-field-wrapper\">\r\n @if (format() === 'hex') {\r\n <cmat-color-input-field label=\"hex\" [value]=\"hex()\" (valueChange)=\"handleChange($event)\" />\r\n }\r\n @if (format() === 'rgb') {\r\n <cmat-color-input-field label=\"r\" [value]=\"rgb()!.r\" (valueChange)=\"handleChange($event)\" />\r\n <cmat-color-input-field label=\"g\" [value]=\"rgb()!.g\" (valueChange)=\"handleChange($event)\" />\r\n <cmat-color-input-field label=\"b\" [value]=\"rgb()!.b\" (valueChange)=\"handleChange($event)\" />\r\n\r\n @if (!hideAlpha()) {\r\n <cmat-color-input-field label=\"a\" [step]=\"0.01\" [value]=\"rgb()!.a\" (valueChange)=\"handleChange($event)\" />\r\n }\r\n }\r\n @if (format() === 'hsl') {\r\n <cmat-color-input-field label=\"h\" [value]=\"round(hsl()!.h)\" (valueChange)=\"handleChange($event)\" />\r\n <cmat-color-input-field label=\"s\" [value]=\"round(hsl()!.s * 100) + '%'\" (valueChange)=\"handleChange($event)\" />\r\n <cmat-color-input-field label=\"l\" [value]=\"round(hsl()!.l * 100) + '%'\" (valueChange)=\"handleChange($event)\" />\r\n\r\n @if (!hideAlpha()) {\r\n <cmat-color-input-field label=\"a\" [step]=\"0.01\" [value]=\"hsl()!.a\" (valueChange)=\"handleChange($event)\" />\r\n }\r\n }\r\n</div>\r\n\r\n<cmat-color-icon-button>\r\n <button type=\"button\" (click)=\"toggleColorFormat()\">\r\n <svg viewBox=\"0 0 24 24\">\r\n <path fill=\"currentColor\"\r\n d=\"M12,18.17L8.83,15L7.42,16.41L12,21L16.59,16.41L15.17,15M12,5.83L15.17,9L16.58,7.59L12,3L7.41,7.59L8.83,9L12,5.83Z\" />\r\n </svg>\r\n </button>\r\n</cmat-color-icon-button>", styles: [".cmat-color-input-fields{display:flex;align-items:center;gap:8px;width:100%}.cmat-color-input-field-wrapper{flex:1;display:flex;gap:8px}.cmat-color-input-field-wrapper .cmat-color-input-field{flex:1}\n"] }]
575
+ }], ctorParameters: () => [], propDecorators: { color: [{ type: i0.Input, args: [{ isSignal: true, alias: "color", required: true }] }], format: [{ type: i0.Input, args: [{ isSignal: true, alias: "format", required: false }] }, { type: i0.Output, args: ["formatChange"] }], hideAlpha: [{ type: i0.Input, args: [{ isSignal: true, alias: "hideAlpha", required: false }] }], formatChanged: [{ type: i0.Output, args: ["formatChanged"] }], valueChange: [{ type: i0.Output, args: ["valueChange"] }] } });
576
+
577
+ class CmatColorSaturationPicker {
578
+ constructor() {
579
+ this.color = input.required(/* @ts-ignore */
580
+ ...(ngDevMode ? [{ debugName: "color" }] : /* istanbul ignore next */ []));
581
+ this.change = output();
582
+ this.hsl = signal(null, /* @ts-ignore */
583
+ ...(ngDevMode ? [{ debugName: "hsl" }] : /* istanbul ignore next */ []));
584
+ this.hsv = signal(null, /* @ts-ignore */
585
+ ...(ngDevMode ? [{ debugName: "hsv" }] : /* istanbul ignore next */ []));
586
+ this.bgColor = signal('', /* @ts-ignore */
587
+ ...(ngDevMode ? [{ debugName: "bgColor" }] : /* istanbul ignore next */ []));
588
+ this.posX = signal(0, /* @ts-ignore */
589
+ ...(ngDevMode ? [{ debugName: "posX" }] : /* istanbul ignore next */ []));
590
+ this.posY = signal(0, /* @ts-ignore */
591
+ ...(ngDevMode ? [{ debugName: "posY" }] : /* istanbul ignore next */ []));
592
+ this._el = inject(ElementRef);
593
+ effect(() => {
594
+ const color = this.color();
595
+ this.hsl.set(color.hsl);
596
+ this.hsv.set(color.hsv);
597
+ untracked(() => {
598
+ if (this.hsl()) {
599
+ this.bgColor.set(`hsl(${this.hsl().h}, 100%, 50%)`);
600
+ }
601
+ if (this.hsv()) {
602
+ this.posX.set(this.hsv().s * 100);
603
+ this.posY.set(100 - this.hsv().v * 100);
604
+ }
605
+ });
606
+ });
607
+ }
608
+ handleChange(e) {
609
+ const { top, left, containerHeight, containerWidth } = e;
610
+ const s = Math.max(0, Math.min(left, containerWidth)) / containerWidth;
611
+ const v = 1 - Math.max(0, Math.min(top, containerHeight)) / containerHeight;
612
+ const hsv = this.hsv();
613
+ if (hsv) {
614
+ this.change.emit({ ...hsv, s, v, source: 'hsva' });
615
+ }
616
+ }
617
+ onScroll() {
618
+ const el = this._el.nativeElement;
619
+ if (el.scrollTop !== 0 || el.scrollLeft !== 0) {
620
+ el.scrollTop = 0;
621
+ el.scrollLeft = 0;
622
+ }
623
+ }
624
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: CmatColorSaturationPicker, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
625
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.0.2", type: CmatColorSaturationPicker, isStandalone: true, selector: "cmat-color-saturation-picker", inputs: { color: { classPropertyName: "color", publicName: "color", isSignal: true, isRequired: true, transformFunction: null } }, outputs: { change: "change" }, host: { listeners: { "scroll": "onScroll()" }, classAttribute: "cmat-color-saturation-picker" }, ngImport: i0, template: "<!-- eslint-disable @angular-eslint/template/no-inline-styles -->\r\n<div class=\"cmat-color-saturation-picker-content\" cmatColorCoordinates [percentX]=\"posX()\" [percentY]=\"posY()\"\r\n [style.background-color]=\"bgColor()\" (coordinatesChange)=\"handleChange($event)\">\r\n <div class=\"cmat-color-saturation-picker-pointer\"\r\n [style.left.%]=\"posX()\" [style.top.%]=\"posY()\">\r\n <button class=\"cmat-color-saturation-picker-thumb\" type=\"button\">\r\n <!-- -->\r\n </button>\r\n </div>\r\n</div>", styles: [".cmat-color-saturation-picker{position:relative;display:block;width:100%;padding-bottom:55%;border-radius:var(--cp-saturation-picker-shape, 4px);overflow:hidden;box-shadow:0 0 0 1px #ffffff1f,0 0 0 1px #0000001f}.cmat-color-saturation-picker-content{position:absolute;inset:0;touch-action:none;background-image:linear-gradient(to top,#000,#0000),linear-gradient(to right,#fff,#fff0)}.cmat-color-saturation-picker-pointer{position:absolute}.cmat-color-saturation-picker-thumb{display:block;width:var(--cp-saturation-picker-thumb-size, 12px);height:var(--cp-saturation-picker-thumb-size, 12px);padding:0;border-radius:var(--cp-saturation-picker-thumb-shape, 6px);border:none;background:none;outline:1px solid var(--cp-saturation-picker-thumb-outline-color, #fff);outline-offset:-1px;transform:translate(-50%,-50%);box-shadow:var(--cp-saturation-picker-thumb-shadow, 0 2px 6px 0 rgba(0, 0, 0, .32))}.cmat-color-saturation-picker-thumb:focus-visible{outline-color:var(--cp-saturation-picker-thumb-focus-outline-color, var(--cp-input-focus-outline-color, #0d99ff))}\n"], dependencies: [{ kind: "directive", type: CmatColorCoordinates, selector: "[cmat-color-coordinates], [cmatColorCoordinates]", inputs: ["percentX", "percentY"], outputs: ["coordinatesChange"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
626
+ }
627
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: CmatColorSaturationPicker, decorators: [{
628
+ type: Component,
629
+ args: [{ selector: 'cmat-color-saturation-picker', imports: [CmatColorCoordinates], host: {
630
+ 'class': 'cmat-color-saturation-picker',
631
+ // eslint-disable-next-line @typescript-eslint/naming-convention
632
+ '(scroll)': 'onScroll()',
633
+ }, encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, template: "<!-- eslint-disable @angular-eslint/template/no-inline-styles -->\r\n<div class=\"cmat-color-saturation-picker-content\" cmatColorCoordinates [percentX]=\"posX()\" [percentY]=\"posY()\"\r\n [style.background-color]=\"bgColor()\" (coordinatesChange)=\"handleChange($event)\">\r\n <div class=\"cmat-color-saturation-picker-pointer\"\r\n [style.left.%]=\"posX()\" [style.top.%]=\"posY()\">\r\n <button class=\"cmat-color-saturation-picker-thumb\" type=\"button\">\r\n <!-- -->\r\n </button>\r\n </div>\r\n</div>", styles: [".cmat-color-saturation-picker{position:relative;display:block;width:100%;padding-bottom:55%;border-radius:var(--cp-saturation-picker-shape, 4px);overflow:hidden;box-shadow:0 0 0 1px #ffffff1f,0 0 0 1px #0000001f}.cmat-color-saturation-picker-content{position:absolute;inset:0;touch-action:none;background-image:linear-gradient(to top,#000,#0000),linear-gradient(to right,#fff,#fff0)}.cmat-color-saturation-picker-pointer{position:absolute}.cmat-color-saturation-picker-thumb{display:block;width:var(--cp-saturation-picker-thumb-size, 12px);height:var(--cp-saturation-picker-thumb-size, 12px);padding:0;border-radius:var(--cp-saturation-picker-thumb-shape, 6px);border:none;background:none;outline:1px solid var(--cp-saturation-picker-thumb-outline-color, #fff);outline-offset:-1px;transform:translate(-50%,-50%);box-shadow:var(--cp-saturation-picker-thumb-shadow, 0 2px 6px 0 rgba(0, 0, 0, .32))}.cmat-color-saturation-picker-thumb:focus-visible{outline-color:var(--cp-saturation-picker-thumb-focus-outline-color, var(--cp-input-focus-outline-color, #0d99ff))}\n"] }]
634
+ }], ctorParameters: () => [], propDecorators: { color: [{ type: i0.Input, args: [{ isSignal: true, alias: "color", required: true }] }], change: [{ type: i0.Output, args: ["change"] }] } });
635
+
636
+ class CmatColorPickerComponent {
637
+ constructor() {
638
+ this.format = model('hex', /* @ts-ignore */
639
+ ...(ngDevMode ? [{ debugName: "format" }] : /* istanbul ignore next */ []));
640
+ this.value = model('#000', /* @ts-ignore */
641
+ ...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
642
+ this.hideAlpha = input(false, /* @ts-ignore */
643
+ ...(ngDevMode ? [{ debugName: "hideAlpha" }] : /* istanbul ignore next */ []));
644
+ this.disabled = model(false, /* @ts-ignore */
645
+ ...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
646
+ this.formatChanged = output();
647
+ this.valueChanged = output();
648
+ this.colorChanged = output();
649
+ this.parsedColor = signal(null, /* @ts-ignore */
650
+ ...(ngDevMode ? [{ debugName: "parsedColor" }] : /* istanbul ignore next */ []));
651
+ this.isCopied = signal(false, /* @ts-ignore */
652
+ ...(ngDevMode ? [{ debugName: "isCopied" }] : /* istanbul ignore next */ []));
653
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/naming-convention, @typescript-eslint/no-unsafe-member-access
654
+ this.EyeDropper = window.EyeDropper;
655
+ this.supportEyeDropper = !!this.EyeDropper;
656
+ this._oldHue = signal(0, /* @ts-ignore */
657
+ ...(ngDevMode ? [{ debugName: "_oldHue" }] : /* istanbul ignore next */ []));
658
+ this._oldValue = signal('', /* @ts-ignore */
659
+ ...(ngDevMode ? [{ debugName: "_oldValue" }] : /* istanbul ignore next */ []));
660
+ this.onChange = () => {
661
+ };
662
+ this.onTouched = () => {
663
+ };
664
+ effect(() => {
665
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
666
+ const format = this.format();
667
+ untracked(() => {
668
+ this.getColorFormat();
669
+ });
670
+ });
671
+ effect(() => {
672
+ const value = this.value();
673
+ untracked(() => {
674
+ if (value !== this._oldValue()) {
675
+ this.getParsedColor(this.value(), this._oldHue());
676
+ }
677
+ });
678
+ });
679
+ }
680
+ ngOnInit() {
681
+ this.getParsedColor(this.value());
682
+ }
683
+ writeValue(value) {
684
+ if (value) {
685
+ this.value.set(value);
686
+ this.getColorFormat();
687
+ this.getParsedColor(value, this._oldHue());
688
+ }
689
+ }
690
+ registerOnChange(fn) {
691
+ this.onChange = fn;
692
+ }
693
+ registerOnTouched(fn) {
694
+ this.onTouched = fn;
695
+ }
696
+ setDisabledState(isDisabled) {
697
+ this.disabled.set(isDisabled);
698
+ }
699
+ getParsedColor(data, oldHue = 0) {
700
+ this.parsedColor.set(parseColor(data, oldHue, this.hideAlpha()));
701
+ this._oldHue.set(this.parsedColor().oldHue);
702
+ }
703
+ handleChange(e) {
704
+ const isValidColor = simpleCheckForValidColor(e);
705
+ if (isValidColor) {
706
+ this.getParsedColor(e, e.h || this._oldHue());
707
+ this.getColorString(this.parsedColor());
708
+ this.onChange(this.value());
709
+ this.valueChanged.emit(this.value());
710
+ this.colorChanged.emit({ value: this.value(), color: this.parsedColor() });
711
+ }
712
+ }
713
+ getColorFormat() {
714
+ if (!this.format()) {
715
+ const color = new TinyColor(this.value());
716
+ if (color.format === 'rgb' || color.format === 'hsl' || color.format === 'hsv') {
717
+ this.format.set(color.format);
718
+ }
719
+ else {
720
+ this.format.set('hex');
721
+ }
722
+ }
723
+ }
724
+ getColorString(color) {
725
+ switch (this.format()) {
726
+ case 'rgb':
727
+ this.value.set(color.rgbString);
728
+ break;
729
+ case 'hsl':
730
+ this.value.set(color.hslString);
731
+ break;
732
+ case 'hsv':
733
+ this.value.set(color.hsvString);
734
+ break;
735
+ default:
736
+ this.value.set(color.hex);
737
+ break;
738
+ }
739
+ this._oldValue.set(this.value());
740
+ }
741
+ handleFormatChange() {
742
+ this.formatChanged.emit(this.format());
743
+ }
744
+ async openEyeDropper(e) {
745
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-call
746
+ const eyeDropper = new this.EyeDropper();
747
+ try {
748
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access
749
+ const result = await eyeDropper.open();
750
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access
751
+ this.handleChange({ hex: result.sRGBHex, source: 'rgb' });
752
+ e.preventDefault();
753
+ }
754
+ catch (err) {
755
+ console.warn(err);
756
+ }
757
+ }
758
+ async copyColor() {
759
+ try {
760
+ await navigator.clipboard.writeText(this.value());
761
+ this.isCopied.set(true);
762
+ setTimeout(() => {
763
+ this.isCopied.set(false);
764
+ }, 1000);
765
+ }
766
+ catch (err) {
767
+ console.warn(err);
768
+ }
769
+ }
770
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: CmatColorPickerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
771
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.2", type: CmatColorPickerComponent, isStandalone: true, selector: "cmat-color-picker", inputs: { format: { classPropertyName: "format", publicName: "format", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, hideAlpha: { classPropertyName: "hideAlpha", publicName: "hideAlpha", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { format: "formatChange", value: "valueChange", disabled: "disabledChange", formatChanged: "formatChanged", valueChanged: "valueChanged", colorChanged: "colorChanged" }, host: { classAttribute: "cmat-color-picker" }, providers: [
772
+ {
773
+ provide: NG_VALUE_ACCESSOR,
774
+ useExisting: forwardRef(() => CmatColorPickerComponent),
775
+ multi: true,
776
+ },
777
+ ], ngImport: i0, template: "<cmat-color-saturation-picker [color]=\"parsedColor()!\" (change)=\"handleChange($event)\" />\r\n\r\n<div class=\"cmat-color-picker-controls\">\r\n @if (supportEyeDropper) {\r\n <cmat-color-icon-button>\r\n <button type=\"button\" (click)=\"openEyeDropper($event)\">\r\n <svg viewBox=\"0 0 24 24\">\r\n <path fill=\"currentColor\"\r\n d=\"M19.35,11.72L17.22,13.85L15.81,12.43L8.1,20.14L3.5,22L2,20.5L3.86,15.9L11.57,8.19L10.15,6.78L12.28,4.65L19.35,11.72M16.76,3C17.93,1.83 19.83,1.83 21,3C22.17,4.17 22.17,6.07 21,7.24L19.08,9.16L14.84,4.92L16.76,3M5.56,17.03L4.5,19.5L6.97,18.44L14.4,11L13,9.6L5.56,17.03Z\" />\r\n </svg>\r\n </button>\r\n </cmat-color-icon-button>\r\n }\r\n\r\n <button class=\"cmat-color-preview\" type=\"button\" (click)=\"copyColor()\">\r\n <div class=\"cmat-color-preview-bg\" [ngStyle]=\"{'background-color':value()}\"></div>\r\n <div class=\"cmat-color-preview-backdrop\">\r\n @if (this.isCopied()) {\r\n <svg viewBox=\"0 0 24 24\">\r\n <path fill=\"currentColor\" d=\"M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z\" />\r\n </svg>\r\n } @else {\r\n <svg viewBox=\"0 0 24 24\">\r\n <path fill=\"currentColor\"\r\n d=\"M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z\" />\r\n </svg>\r\n }\r\n </div>\r\n </button>\r\n\r\n <div class=\"cmat-color-hue-alpha\">\r\n <cmat-color-hue-slider [color]=\"parsedColor()!\" (change)=\"handleChange($event)\" />\r\n\r\n @if (!hideAlpha()) {\r\n <cmat-color-alpha-slider [color]=\"parsedColor()!\" (change)=\"handleChange($event)\" />\r\n }\r\n </div>\r\n</div>\r\n\r\n<div class=\"cmat-color-picker-controls\">\r\n <cmat-color-input-fields [color]=\"parsedColor()!\" [hideAlpha]=\"hideAlpha()\" [(format)]=\"format\"\r\n (valueChange)=\"handleChange($event)\" (formatChange)=\"handleFormatChange()\" />\r\n</div>", styles: [".cmat-color-picker{--cp-container-text-color: rgba(0, 0, 0, .9);--cp-container-background-color: #fff;--cp-input-outline-color: #e6e6e6;--cp-input-hover-outline-color: #d6d6d6;--cp-input-focus-outline-color: #0d99ff;--cp-icon-button-hover-background-color: rgba(0, 0, 0, .06);--cp-icon-button-active-background-color: rgba(0, 0, 0, .12);--cp-slider-thumb-background-color: #f2f2f2;--cp-slider-thumb-outline-color: rgba(0, 0, 0, .04)}.cmat-color-picker:is(.dark *){--cp-container-text-color: #fff;--cp-container-background-color: #2c2c2c;--cp-input-outline-color: #444;--cp-input-hover-outline-color: #545454;--cp-input-focus-outline-color: #0c8ce9;--cp-icon-button-hover-background-color: rgba(255, 255, 255, .06);--cp-icon-button-active-background-color: rgba(255, 255, 255, .12);--cp-slider-thumb-background-color: #3c3c3c;--cp-slider-thumb-outline-color: rgba(255, 255, 255, .24)}.cmat-color-picker{box-sizing:border-box;display:block;width:var(--cp-container-width, 240px);padding:var(--cp-container-padding, 12px);margin:var(--cp-container-margin, 0);color:var(--cp-container-text-color);background-color:var(--cp-container-background-color);border-radius:var(--cp-container-shape, 8px);box-shadow:var(--cp-container-elevation-shadow, inset 0 0 1px 0 rgba(255, 255, 255, .64), 0 2px 4px 0 rgba(0, 0, 0, .16), 0 8px 16px 0 rgba(0, 0, 0, .12), 0 0 1px 0 rgba(0, 0, 0, .12))}.cmat-color-picker-controls{display:flex;align-items:center;gap:10px;margin-top:16px}.cmat-color-preview{width:32px;height:32px;border-radius:16px;position:relative;overflow:hidden;border:none;outline:none;background-color:#fff;background-image:conic-gradient(transparent 25%,#ccc 25% 50%,transparent 50% 75%,#ccc 75%);background-size:10px 10px;box-shadow:0 0 0 1px #ffffff1f,0 0 0 1px #0000001f;cursor:pointer}.cmat-color-preview:hover .cmat-color-preview-backdrop,.cmat-color-preview:focus-visible .cmat-color-preview-backdrop{opacity:1}.cmat-color-preview-bg{position:absolute;inset:0}.cmat-color-preview-backdrop{position:absolute;inset:0;padding:6px;background-color:#00000052;color:#fff;opacity:0;pointer-events:none}.cmat-color-hue-alpha{flex:1;display:flex;flex-direction:column;gap:8px}\n"], dependencies: [{ kind: "component", type: CmatColorSaturationPicker, selector: "cmat-color-saturation-picker", inputs: ["color"], outputs: ["change"] }, { kind: "component", type: CmatColorHueSlider, selector: "cmat-color-hue-slider", inputs: ["color", "direction"], outputs: ["change"] }, { kind: "component", type: CmatColorAlphaSlider, selector: "cmat-color-alpha-slider", inputs: ["color", "direction"], outputs: ["change"] }, { kind: "component", type: CmatColorInputFields, selector: "cmat-color-input-fields", inputs: ["color", "format", "hideAlpha"], outputs: ["formatChange", "formatChanged", "valueChange"] }, { kind: "component", type: CmatColorIconButton, selector: "cmat-color-icon-button" }, { kind: "directive", type: NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
778
+ }
779
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: CmatColorPickerComponent, decorators: [{
780
+ type: Component,
781
+ args: [{ selector: 'cmat-color-picker', imports: [
782
+ CmatColorSaturationPicker,
783
+ CmatColorHueSlider,
784
+ CmatColorAlphaSlider,
785
+ CmatColorInputFields,
786
+ CmatColorIconButton,
787
+ NgStyle
788
+ ], host: {
789
+ class: 'cmat-color-picker',
790
+ }, encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, providers: [
791
+ {
792
+ provide: NG_VALUE_ACCESSOR,
793
+ useExisting: forwardRef(() => CmatColorPickerComponent),
794
+ multi: true,
795
+ },
796
+ ], template: "<cmat-color-saturation-picker [color]=\"parsedColor()!\" (change)=\"handleChange($event)\" />\r\n\r\n<div class=\"cmat-color-picker-controls\">\r\n @if (supportEyeDropper) {\r\n <cmat-color-icon-button>\r\n <button type=\"button\" (click)=\"openEyeDropper($event)\">\r\n <svg viewBox=\"0 0 24 24\">\r\n <path fill=\"currentColor\"\r\n d=\"M19.35,11.72L17.22,13.85L15.81,12.43L8.1,20.14L3.5,22L2,20.5L3.86,15.9L11.57,8.19L10.15,6.78L12.28,4.65L19.35,11.72M16.76,3C17.93,1.83 19.83,1.83 21,3C22.17,4.17 22.17,6.07 21,7.24L19.08,9.16L14.84,4.92L16.76,3M5.56,17.03L4.5,19.5L6.97,18.44L14.4,11L13,9.6L5.56,17.03Z\" />\r\n </svg>\r\n </button>\r\n </cmat-color-icon-button>\r\n }\r\n\r\n <button class=\"cmat-color-preview\" type=\"button\" (click)=\"copyColor()\">\r\n <div class=\"cmat-color-preview-bg\" [ngStyle]=\"{'background-color':value()}\"></div>\r\n <div class=\"cmat-color-preview-backdrop\">\r\n @if (this.isCopied()) {\r\n <svg viewBox=\"0 0 24 24\">\r\n <path fill=\"currentColor\" d=\"M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z\" />\r\n </svg>\r\n } @else {\r\n <svg viewBox=\"0 0 24 24\">\r\n <path fill=\"currentColor\"\r\n d=\"M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z\" />\r\n </svg>\r\n }\r\n </div>\r\n </button>\r\n\r\n <div class=\"cmat-color-hue-alpha\">\r\n <cmat-color-hue-slider [color]=\"parsedColor()!\" (change)=\"handleChange($event)\" />\r\n\r\n @if (!hideAlpha()) {\r\n <cmat-color-alpha-slider [color]=\"parsedColor()!\" (change)=\"handleChange($event)\" />\r\n }\r\n </div>\r\n</div>\r\n\r\n<div class=\"cmat-color-picker-controls\">\r\n <cmat-color-input-fields [color]=\"parsedColor()!\" [hideAlpha]=\"hideAlpha()\" [(format)]=\"format\"\r\n (valueChange)=\"handleChange($event)\" (formatChange)=\"handleFormatChange()\" />\r\n</div>", styles: [".cmat-color-picker{--cp-container-text-color: rgba(0, 0, 0, .9);--cp-container-background-color: #fff;--cp-input-outline-color: #e6e6e6;--cp-input-hover-outline-color: #d6d6d6;--cp-input-focus-outline-color: #0d99ff;--cp-icon-button-hover-background-color: rgba(0, 0, 0, .06);--cp-icon-button-active-background-color: rgba(0, 0, 0, .12);--cp-slider-thumb-background-color: #f2f2f2;--cp-slider-thumb-outline-color: rgba(0, 0, 0, .04)}.cmat-color-picker:is(.dark *){--cp-container-text-color: #fff;--cp-container-background-color: #2c2c2c;--cp-input-outline-color: #444;--cp-input-hover-outline-color: #545454;--cp-input-focus-outline-color: #0c8ce9;--cp-icon-button-hover-background-color: rgba(255, 255, 255, .06);--cp-icon-button-active-background-color: rgba(255, 255, 255, .12);--cp-slider-thumb-background-color: #3c3c3c;--cp-slider-thumb-outline-color: rgba(255, 255, 255, .24)}.cmat-color-picker{box-sizing:border-box;display:block;width:var(--cp-container-width, 240px);padding:var(--cp-container-padding, 12px);margin:var(--cp-container-margin, 0);color:var(--cp-container-text-color);background-color:var(--cp-container-background-color);border-radius:var(--cp-container-shape, 8px);box-shadow:var(--cp-container-elevation-shadow, inset 0 0 1px 0 rgba(255, 255, 255, .64), 0 2px 4px 0 rgba(0, 0, 0, .16), 0 8px 16px 0 rgba(0, 0, 0, .12), 0 0 1px 0 rgba(0, 0, 0, .12))}.cmat-color-picker-controls{display:flex;align-items:center;gap:10px;margin-top:16px}.cmat-color-preview{width:32px;height:32px;border-radius:16px;position:relative;overflow:hidden;border:none;outline:none;background-color:#fff;background-image:conic-gradient(transparent 25%,#ccc 25% 50%,transparent 50% 75%,#ccc 75%);background-size:10px 10px;box-shadow:0 0 0 1px #ffffff1f,0 0 0 1px #0000001f;cursor:pointer}.cmat-color-preview:hover .cmat-color-preview-backdrop,.cmat-color-preview:focus-visible .cmat-color-preview-backdrop{opacity:1}.cmat-color-preview-bg{position:absolute;inset:0}.cmat-color-preview-backdrop{position:absolute;inset:0;padding:6px;background-color:#00000052;color:#fff;opacity:0;pointer-events:none}.cmat-color-hue-alpha{flex:1;display:flex;flex-direction:column;gap:8px}\n"] }]
797
+ }], ctorParameters: () => [], propDecorators: { format: [{ type: i0.Input, args: [{ isSignal: true, alias: "format", required: false }] }, { type: i0.Output, args: ["formatChange"] }], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], hideAlpha: [{ type: i0.Input, args: [{ isSignal: true, alias: "hideAlpha", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }, { type: i0.Output, args: ["disabledChange"] }], formatChanged: [{ type: i0.Output, args: ["formatChanged"] }], valueChanged: [{ type: i0.Output, args: ["valueChanged"] }], colorChanged: [{ type: i0.Output, args: ["colorChanged"] }] } });
798
+
799
+ class CmatColorPickerButtonComponent {
800
+ constructor() {
801
+ this.format = model('hex', /* @ts-ignore */
802
+ ...(ngDevMode ? [{ debugName: "format" }] : /* istanbul ignore next */ []));
803
+ this.value = model('#000', /* @ts-ignore */
804
+ ...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
805
+ this.hideAlpha = input(false, /* @ts-ignore */
806
+ ...(ngDevMode ? [{ debugName: "hideAlpha" }] : /* istanbul ignore next */ []));
807
+ this.disabled = model(false, /* @ts-ignore */
808
+ ...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
809
+ this.placeholder = input('请输入', /* @ts-ignore */
810
+ ...(ngDevMode ? [{ debugName: "placeholder" }] : /* istanbul ignore next */ []));
811
+ this.label = input('颜色', /* @ts-ignore */
812
+ ...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
813
+ this.formatChanged = output();
814
+ this.valueChanged = output();
815
+ this.colorChanged = output();
816
+ this.isOpen = signal(false, /* @ts-ignore */
817
+ ...(ngDevMode ? [{ debugName: "isOpen" }] : /* istanbul ignore next */ []));
818
+ }
819
+ toggleMenu() {
820
+ this.isOpen.update(v => !v);
821
+ }
822
+ closeMenu() {
823
+ this.isOpen.set(false);
824
+ }
825
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: CmatColorPickerButtonComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
826
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.0.2", type: CmatColorPickerButtonComponent, isStandalone: true, selector: "cmat-color-picker-button", inputs: { format: { classPropertyName: "format", publicName: "format", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, hideAlpha: { classPropertyName: "hideAlpha", publicName: "hideAlpha", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { format: "formatChange", value: "valueChange", disabled: "disabledChange", formatChanged: "formatChanged", valueChanged: "valueChanged", colorChanged: "colorChanged" }, ngImport: i0, template: "<!-- eslint-disable @angular-eslint/template/no-inline-styles -->\r\n<section>\r\n <mat-form-field class=\"w-full\">\r\n <mat-label>{{ label() }}</mat-label>\r\n <input matInput type=\"text\" [placeholder]=\"placeholder()\" [disabled]=\"disabled()\" [(ngModel)]=\"value\"\r\n (ngModelChange)=\"valueChanged.emit($event);colorChanged.emit($event);\" />\r\n <button #trigger=\"cdkOverlayOrigin\" matPrefix cdkOverlayOrigin class=\"ml-2\"\r\n [ngClass]=\"{'pointer-events-none':disabled()}\"\r\n [style.color]=\"value()\" (click)=\"toggleMenu()\">\r\n <span></span>\r\n </button>\r\n </mat-form-field>\r\n</section>\r\n\r\n<ng-template cdkConnectedOverlay [cdkConnectedOverlayOrigin]=\"trigger\" [cdkConnectedOverlayOpen]=\"isOpen()\"\r\n (overlayOutsideClick)=\"closeMenu()\" (detach)=\"closeMenu()\">\r\n <cmat-color-picker [format]=\"format()\" [hideAlpha]=\"hideAlpha()\" [disabled]=\"disabled()\" [(value)]=\"value\"\r\n (formatChanged)=\"formatChanged.emit($event)\" (valueChanged)=\"valueChanged.emit($event)\"\r\n (colorChanged)=\"colorChanged.emit($event)\" />\r\n</ng-template>", styles: ["cmat-color-picker-button section{--outline-color: #b4b4b4;--hover-outline-color: var(--cmat-primary)}cmat-color-picker-button section:is(.dark *){--outline-color: #4d4d4d}cmat-color-picker-button section{display:flex;gap:8px}cmat-color-picker-button .input-group{display:flex;gap:8px}cmat-color-picker-button .input-group input{flex:1}cmat-color-picker-button button{display:inline-flex;width:32px;height:32px;padding:4px;background:none;border-radius:8px;border:1px solid var(--outline-color);cursor:pointer}cmat-color-picker-button button:after{content:\"\";display:inline-block;width:100%;height:100%;background-color:currentColor;border-radius:3px}cmat-color-picker-button button:hover,cmat-color-picker-button button:focus{border-color:var(--hover-outline-color)}cmat-color-picker-button input{padding:4px 8px;border-radius:8px;border:1px solid var(--outline-color);display:flex;flex:1 auto}cmat-color-picker-button input:hover,cmat-color-picker-button input:focus{border-color:var(--hover-outline-color)}\n"], dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox]):not([ngNoCva])[formControlName],textarea:not([ngNoCva])[formControlName],input:not([type=checkbox]):not([ngNoCva])[formControl],textarea:not([ngNoCva])[formControl],input:not([type=checkbox]):not([ngNoCva])[ngModel],textarea:not([ngNoCva])[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: "component", type: CmatColorPickerComponent, selector: "cmat-color-picker", inputs: ["format", "value", "hideAlpha", "disabled"], outputs: ["formatChange", "valueChange", "disabledChange", "formatChanged", "valueChanged", "colorChanged"] }, { kind: "directive", type: CdkConnectedOverlay, selector: "[cdk-connected-overlay], [connected-overlay], [cdkConnectedOverlay]", inputs: ["cdkConnectedOverlayOrigin", "cdkConnectedOverlayPositions", "cdkConnectedOverlayPositionStrategy", "cdkConnectedOverlayOffsetX", "cdkConnectedOverlayOffsetY", "cdkConnectedOverlayWidth", "cdkConnectedOverlayHeight", "cdkConnectedOverlayMinWidth", "cdkConnectedOverlayMinHeight", "cdkConnectedOverlayBackdropClass", "cdkConnectedOverlayPanelClass", "cdkConnectedOverlayViewportMargin", "cdkConnectedOverlayScrollStrategy", "cdkConnectedOverlayOpen", "cdkConnectedOverlayDisableClose", "cdkConnectedOverlayTransformOriginOn", "cdkConnectedOverlayHasBackdrop", "cdkConnectedOverlayLockPosition", "cdkConnectedOverlayFlexibleDimensions", "cdkConnectedOverlayGrowAfterOpen", "cdkConnectedOverlayPush", "cdkConnectedOverlayDisposeOnNavigation", "cdkConnectedOverlayUsePopover", "cdkConnectedOverlayMatchWidth", "cdkConnectedOverlay"], outputs: ["backdropClick", "positionChange", "attach", "detach", "overlayKeydown", "overlayOutsideClick"], exportAs: ["cdkConnectedOverlay"] }, { kind: "directive", type: CdkOverlayOrigin, selector: "[cdk-overlay-origin], [overlay-origin], [cdkOverlayOrigin]", exportAs: ["cdkOverlayOrigin"] }, { kind: "ngmodule", type: MatInputModule }, { kind: "directive", type: i2.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly", "disabledInteractive"], exportAs: ["matInput"] }, { kind: "component", type: i2.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i2.MatLabel, selector: "mat-label" }, { kind: "directive", type: i2.MatPrefix, selector: "[matPrefix], [matIconPrefix], [matTextPrefix]", inputs: ["matTextPrefix"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
827
+ }
828
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: CmatColorPickerButtonComponent, decorators: [{
829
+ type: Component,
830
+ args: [{ selector: 'cmat-color-picker-button', imports: [
831
+ FormsModule, CmatColorPickerComponent, CdkConnectedOverlay, CdkOverlayOrigin,
832
+ MatInputModule, ReactiveFormsModule, NgClass
833
+ ], encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, template: "<!-- eslint-disable @angular-eslint/template/no-inline-styles -->\r\n<section>\r\n <mat-form-field class=\"w-full\">\r\n <mat-label>{{ label() }}</mat-label>\r\n <input matInput type=\"text\" [placeholder]=\"placeholder()\" [disabled]=\"disabled()\" [(ngModel)]=\"value\"\r\n (ngModelChange)=\"valueChanged.emit($event);colorChanged.emit($event);\" />\r\n <button #trigger=\"cdkOverlayOrigin\" matPrefix cdkOverlayOrigin class=\"ml-2\"\r\n [ngClass]=\"{'pointer-events-none':disabled()}\"\r\n [style.color]=\"value()\" (click)=\"toggleMenu()\">\r\n <span></span>\r\n </button>\r\n </mat-form-field>\r\n</section>\r\n\r\n<ng-template cdkConnectedOverlay [cdkConnectedOverlayOrigin]=\"trigger\" [cdkConnectedOverlayOpen]=\"isOpen()\"\r\n (overlayOutsideClick)=\"closeMenu()\" (detach)=\"closeMenu()\">\r\n <cmat-color-picker [format]=\"format()\" [hideAlpha]=\"hideAlpha()\" [disabled]=\"disabled()\" [(value)]=\"value\"\r\n (formatChanged)=\"formatChanged.emit($event)\" (valueChanged)=\"valueChanged.emit($event)\"\r\n (colorChanged)=\"colorChanged.emit($event)\" />\r\n</ng-template>", styles: ["cmat-color-picker-button section{--outline-color: #b4b4b4;--hover-outline-color: var(--cmat-primary)}cmat-color-picker-button section:is(.dark *){--outline-color: #4d4d4d}cmat-color-picker-button section{display:flex;gap:8px}cmat-color-picker-button .input-group{display:flex;gap:8px}cmat-color-picker-button .input-group input{flex:1}cmat-color-picker-button button{display:inline-flex;width:32px;height:32px;padding:4px;background:none;border-radius:8px;border:1px solid var(--outline-color);cursor:pointer}cmat-color-picker-button button:after{content:\"\";display:inline-block;width:100%;height:100%;background-color:currentColor;border-radius:3px}cmat-color-picker-button button:hover,cmat-color-picker-button button:focus{border-color:var(--hover-outline-color)}cmat-color-picker-button input{padding:4px 8px;border-radius:8px;border:1px solid var(--outline-color);display:flex;flex:1 auto}cmat-color-picker-button input:hover,cmat-color-picker-button input:focus{border-color:var(--hover-outline-color)}\n"] }]
834
+ }], propDecorators: { format: [{ type: i0.Input, args: [{ isSignal: true, alias: "format", required: false }] }, { type: i0.Output, args: ["formatChange"] }], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], hideAlpha: [{ type: i0.Input, args: [{ isSignal: true, alias: "hideAlpha", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }, { type: i0.Output, args: ["disabledChange"] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], formatChanged: [{ type: i0.Output, args: ["formatChanged"] }], valueChanged: [{ type: i0.Output, args: ["valueChanged"] }], colorChanged: [{ type: i0.Output, args: ["colorChanged"] }] } });
835
+
836
+ /**
837
+ * Generated bundle index. Do not edit.
838
+ */
839
+
840
+ export { CmatColorAlphaSlider, CmatColorCoordinates, CmatColorHueSlider, CmatColorIconButton, CmatColorInputField, CmatColorInputFields, CmatColorPickerButtonComponent, CmatColorPickerComponent, CmatColorSaturationPicker, hslToHsv, hsvToHsl, isValidHex, parseColor, simpleCheckForValidColor, toHslString, toHsvString };
841
+ //# sourceMappingURL=cmat-components-color-picker.mjs.map