cmat 0.0.110 → 0.0.112
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/fesm2022/cmat-components-adapter.mjs +531 -536
- package/fesm2022/cmat-components-adapter.mjs.map +1 -1
- package/fesm2022/cmat-components-breadcrumb.mjs +521 -356
- package/fesm2022/cmat-components-breadcrumb.mjs.map +1 -1
- package/fesm2022/cmat-components-card.mjs +150 -42
- package/fesm2022/cmat-components-card.mjs.map +1 -1
- package/fesm2022/cmat-components-carousel.mjs +1120 -629
- package/fesm2022/cmat-components-carousel.mjs.map +1 -1
- package/fesm2022/cmat-components-cascade.mjs +861 -441
- package/fesm2022/cmat-components-cascade.mjs.map +1 -1
- package/fesm2022/cmat-components-chip-input.mjs +580 -335
- package/fesm2022/cmat-components-chip-input.mjs.map +1 -1
- package/fesm2022/cmat-components-code-editor.mjs +197 -105
- package/fesm2022/cmat-components-code-editor.mjs.map +1 -1
- package/fesm2022/cmat-components-color-picker.mjs +1762 -825
- package/fesm2022/cmat-components-color-picker.mjs.map +1 -1
- package/fesm2022/cmat-components-custom-formly.mjs +5196 -2531
- package/fesm2022/cmat-components-custom-formly.mjs.map +1 -1
- package/fesm2022/cmat-components-data-picker.mjs +1901 -1073
- package/fesm2022/cmat-components-data-picker.mjs.map +1 -1
- package/fesm2022/cmat-components-date-range.mjs +701 -456
- package/fesm2022/cmat-components-date-range.mjs.map +1 -1
- package/fesm2022/cmat-components-date-time-display.mjs +137 -30
- package/fesm2022/cmat-components-date-time-display.mjs.map +1 -1
- package/fesm2022/cmat-components-drawer.mjs +410 -258
- package/fesm2022/cmat-components-drawer.mjs.map +1 -1
- package/fesm2022/cmat-components-empty-state.mjs +201 -41
- package/fesm2022/cmat-components-empty-state.mjs.map +1 -1
- package/fesm2022/cmat-components-file-preview.mjs +198 -35
- package/fesm2022/cmat-components-file-preview.mjs.map +1 -1
- package/fesm2022/cmat-components-filter-toolbar.mjs +320 -72
- package/fesm2022/cmat-components-filter-toolbar.mjs.map +1 -1
- package/fesm2022/cmat-components-form-actions.mjs +102 -26
- package/fesm2022/cmat-components-form-actions.mjs.map +1 -1
- package/fesm2022/cmat-components-fullscreen.mjs +167 -47
- package/fesm2022/cmat-components-fullscreen.mjs.map +1 -1
- package/fesm2022/cmat-components-highlight.mjs +203 -112
- package/fesm2022/cmat-components-highlight.mjs.map +1 -1
- package/fesm2022/cmat-components-image-viewer.mjs +489 -215
- package/fesm2022/cmat-components-image-viewer.mjs.map +1 -1
- package/fesm2022/cmat-components-inline-loading.mjs +117 -27
- package/fesm2022/cmat-components-inline-loading.mjs.map +1 -1
- package/fesm2022/cmat-components-json-editor.mjs +276 -230
- package/fesm2022/cmat-components-json-editor.mjs.map +1 -1
- package/fesm2022/cmat-components-knob-input.mjs +615 -420
- package/fesm2022/cmat-components-knob-input.mjs.map +1 -1
- package/fesm2022/cmat-components-loading-overlay.mjs +53 -25
- package/fesm2022/cmat-components-loading-overlay.mjs.map +1 -1
- package/fesm2022/cmat-components-masonry.mjs +120 -40
- package/fesm2022/cmat-components-masonry.mjs.map +1 -1
- package/fesm2022/cmat-components-material-color-picker.mjs +332 -155
- package/fesm2022/cmat-components-material-color-picker.mjs.map +1 -1
- package/fesm2022/cmat-components-material-datetimepicker.mjs +4283 -2504
- package/fesm2022/cmat-components-material-datetimepicker.mjs.map +1 -1
- package/fesm2022/cmat-components-navigation.mjs +3080 -1404
- package/fesm2022/cmat-components-navigation.mjs.map +1 -1
- package/fesm2022/cmat-components-opt-input.mjs +540 -466
- package/fesm2022/cmat-components-opt-input.mjs.map +1 -1
- package/fesm2022/cmat-components-org-chart.mjs +528 -125
- package/fesm2022/cmat-components-org-chart.mjs.map +1 -1
- package/fesm2022/cmat-components-page-header.mjs +141 -32
- package/fesm2022/cmat-components-page-header.mjs.map +1 -1
- package/fesm2022/cmat-components-pagination.mjs +866 -534
- package/fesm2022/cmat-components-pagination.mjs.map +1 -1
- package/fesm2022/cmat-components-password-strength.mjs +873 -434
- package/fesm2022/cmat-components-password-strength.mjs.map +1 -1
- package/fesm2022/cmat-components-popover.mjs +1012 -731
- package/fesm2022/cmat-components-popover.mjs.map +1 -1
- package/fesm2022/cmat-components-progress-bar.mjs +98 -35
- package/fesm2022/cmat-components-progress-bar.mjs.map +1 -1
- package/fesm2022/cmat-components-qrcode.mjs +463 -287
- package/fesm2022/cmat-components-qrcode.mjs.map +1 -1
- package/fesm2022/cmat-components-rating.mjs +377 -203
- package/fesm2022/cmat-components-rating.mjs.map +1 -1
- package/fesm2022/cmat-components-rich-text-editor.mjs +153 -39
- package/fesm2022/cmat-components-rich-text-editor.mjs.map +1 -1
- package/fesm2022/cmat-components-select-search.mjs +926 -496
- package/fesm2022/cmat-components-select-search.mjs.map +1 -1
- package/fesm2022/cmat-components-select-table.mjs +1280 -842
- package/fesm2022/cmat-components-select-table.mjs.map +1 -1
- package/fesm2022/cmat-components-select-tree.mjs +998 -690
- package/fesm2022/cmat-components-select-tree.mjs.map +1 -1
- package/fesm2022/cmat-components-skeleton.mjs +143 -57
- package/fesm2022/cmat-components-skeleton.mjs.map +1 -1
- package/fesm2022/cmat-components-speed-dial.mjs +457 -303
- package/fesm2022/cmat-components-speed-dial.mjs.map +1 -1
- package/fesm2022/cmat-components-status-tag.mjs +136 -44
- package/fesm2022/cmat-components-status-tag.mjs.map +1 -1
- package/fesm2022/cmat-components-table-toolbar.mjs +120 -28
- package/fesm2022/cmat-components-table-toolbar.mjs.map +1 -1
- package/fesm2022/cmat-components-timeline.mjs +464 -168
- package/fesm2022/cmat-components-timeline.mjs.map +1 -1
- package/fesm2022/cmat-components-toast.mjs +346 -262
- package/fesm2022/cmat-components-toast.mjs.map +1 -1
- package/fesm2022/cmat-components-transfer-picker.mjs +1427 -593
- package/fesm2022/cmat-components-transfer-picker.mjs.map +1 -1
- package/fesm2022/cmat-components-treetable.mjs +372 -112
- package/fesm2022/cmat-components-treetable.mjs.map +1 -1
- package/fesm2022/cmat-components-upload.mjs +904 -410
- package/fesm2022/cmat-components-upload.mjs.map +1 -1
- package/fesm2022/cmat-components-x6-angular-shape.mjs +153 -170
- package/fesm2022/cmat-components-x6-angular-shape.mjs.map +1 -1
- package/fesm2022/cmat-directives-animate-on-scroll.mjs +220 -138
- package/fesm2022/cmat-directives-animate-on-scroll.mjs.map +1 -1
- package/fesm2022/cmat-directives-arrow-cursor.mjs +246 -193
- package/fesm2022/cmat-directives-arrow-cursor.mjs.map +1 -1
- package/fesm2022/cmat-directives-autofocus.mjs +43 -25
- package/fesm2022/cmat-directives-autofocus.mjs.map +1 -1
- package/fesm2022/cmat-directives-data-exporter.mjs +537 -338
- package/fesm2022/cmat-directives-data-exporter.mjs.map +1 -1
- package/fesm2022/cmat-directives-debounce.mjs +162 -76
- package/fesm2022/cmat-directives-debounce.mjs.map +1 -1
- package/fesm2022/cmat-directives-digit-only.mjs +457 -356
- package/fesm2022/cmat-directives-digit-only.mjs.map +1 -1
- package/fesm2022/cmat-directives-equal-validator.mjs +70 -53
- package/fesm2022/cmat-directives-equal-validator.mjs.map +1 -1
- package/fesm2022/cmat-directives-seamless-auto-scroll.mjs +180 -132
- package/fesm2022/cmat-directives-seamless-auto-scroll.mjs.map +1 -1
- package/fesm2022/cmat-lib-mock-api.mjs +207 -195
- package/fesm2022/cmat-lib-mock-api.mjs.map +1 -1
- package/fesm2022/cmat-pipes-bytes.mjs +50 -30
- package/fesm2022/cmat-pipes-bytes.mjs.map +1 -1
- package/fesm2022/cmat-pipes-date-format.mjs +41 -25
- package/fesm2022/cmat-pipes-date-format.mjs.map +1 -1
- package/fesm2022/cmat-pipes-find-by-key.mjs +44 -26
- package/fesm2022/cmat-pipes-find-by-key.mjs.map +1 -1
- package/fesm2022/cmat-pipes-group-by.mjs +50 -38
- package/fesm2022/cmat-pipes-group-by.mjs.map +1 -1
- package/fesm2022/cmat-pipes-keys.mjs +44 -31
- package/fesm2022/cmat-pipes-keys.mjs.map +1 -1
- package/fesm2022/cmat-pipes-secure.mjs +60 -49
- package/fesm2022/cmat-pipes-secure.mjs.map +1 -1
- package/fesm2022/cmat-pipes-uppercase.mjs +39 -22
- package/fesm2022/cmat-pipes-uppercase.mjs.map +1 -1
- package/fesm2022/cmat-reports.mjs +2751 -0
- package/fesm2022/cmat-reports.mjs.map +1 -0
- package/fesm2022/cmat-services-alert.mjs +249 -277
- package/fesm2022/cmat-services-alert.mjs.map +1 -1
- package/fesm2022/cmat-services-config.mjs +110 -81
- package/fesm2022/cmat-services-config.mjs.map +1 -1
- package/fesm2022/cmat-services-confirmation.mjs +184 -73
- package/fesm2022/cmat-services-confirmation.mjs.map +1 -1
- package/fesm2022/cmat-services-data.mjs +136 -125
- package/fesm2022/cmat-services-data.mjs.map +1 -1
- package/fesm2022/cmat-services-export-as.mjs +165 -183
- package/fesm2022/cmat-services-export-as.mjs.map +1 -1
- package/fesm2022/cmat-services-loading.mjs +116 -95
- package/fesm2022/cmat-services-loading.mjs.map +1 -1
- package/fesm2022/cmat-services-local-storage.mjs +75 -66
- package/fesm2022/cmat-services-local-storage.mjs.map +1 -1
- package/fesm2022/cmat-services-media-watcher.mjs +69 -64
- package/fesm2022/cmat-services-media-watcher.mjs.map +1 -1
- package/fesm2022/cmat-services-platform.mjs +48 -45
- package/fesm2022/cmat-services-platform.mjs.map +1 -1
- package/fesm2022/cmat-services-print.mjs +985 -669
- package/fesm2022/cmat-services-print.mjs.map +1 -1
- package/fesm2022/cmat-services-splash-screen.mjs +53 -38
- package/fesm2022/cmat-services-splash-screen.mjs.map +1 -1
- package/fesm2022/cmat-services-title.mjs +57 -47
- package/fesm2022/cmat-services-title.mjs.map +1 -1
- package/fesm2022/cmat-services-translation.mjs +79 -68
- package/fesm2022/cmat-services-translation.mjs.map +1 -1
- package/fesm2022/cmat-services-utils.mjs +424 -517
- package/fesm2022/cmat-services-utils.mjs.map +1 -1
- package/fesm2022/cmat-validators.mjs +23 -33
- package/fesm2022/cmat-validators.mjs.map +1 -1
- package/fesm2022/cmat-version.mjs +12 -16
- package/fesm2022/cmat-version.mjs.map +1 -1
- package/fesm2022/cmat.mjs +39806 -22071
- package/fesm2022/cmat.mjs.map +1 -1
- package/package.json +5 -1
- package/types/cmat-components-adapter.d.ts +145 -156
- package/types/cmat-components-breadcrumb.d.ts +108 -86
- package/types/cmat-components-card.d.ts +34 -18
- package/types/cmat-components-carousel.d.ts +251 -134
- package/types/cmat-components-cascade.d.ts +158 -117
- package/types/cmat-components-chip-input.d.ts +105 -71
- package/types/cmat-components-code-editor.d.ts +59 -34
- package/types/cmat-components-color-picker.d.ts +378 -236
- package/types/cmat-components-custom-formly.d.ts +776 -814
- package/types/cmat-components-data-picker.d.ts +502 -360
- package/types/cmat-components-date-range.d.ts +106 -77
- package/types/cmat-components-date-time-display.d.ts +36 -13
- package/types/cmat-components-drawer.d.ts +91 -61
- package/types/cmat-components-empty-state.d.ts +47 -17
- package/types/cmat-components-file-preview.d.ts +42 -14
- package/types/cmat-components-filter-toolbar.d.ts +57 -25
- package/types/cmat-components-form-actions.d.ts +18 -10
- package/types/cmat-components-fullscreen.d.ts +21 -13
- package/types/cmat-components-highlight.d.ts +33 -26
- package/types/cmat-components-image-viewer.d.ts +119 -58
- package/types/cmat-components-inline-loading.d.ts +24 -11
- package/types/cmat-components-json-editor.d.ts +39 -28
- package/types/cmat-components-knob-input.d.ts +172 -101
- package/types/cmat-components-loading-overlay.d.ts +8 -11
- package/types/cmat-components-masonry.d.ts +27 -14
- package/types/cmat-components-material-color-picker.d.ts +56 -42
- package/types/cmat-components-material-datetimepicker.d.ts +817 -454
- package/types/cmat-components-navigation.d.ts +295 -221
- package/types/cmat-components-opt-input.d.ts +111 -90
- package/types/cmat-components-org-chart.d.ts +53 -35
- package/types/cmat-components-page-header.d.ts +37 -14
- package/types/cmat-components-pagination.d.ts +144 -107
- package/types/cmat-components-password-strength.d.ts +197 -86
- package/types/cmat-components-popover.d.ts +264 -166
- package/types/cmat-components-progress-bar.d.ts +17 -14
- package/types/cmat-components-qrcode.d.ts +111 -42
- package/types/cmat-components-rating.d.ts +105 -59
- package/types/cmat-components-rich-text-editor.d.ts +39 -16
- package/types/cmat-components-select-search.d.ts +195 -99
- package/types/cmat-components-select-table.d.ts +241 -142
- package/types/cmat-components-select-tree.d.ts +185 -118
- package/types/cmat-components-skeleton.d.ts +55 -32
- package/types/cmat-components-speed-dial.d.ts +86 -61
- package/types/cmat-components-status-tag.d.ts +42 -24
- package/types/cmat-components-table-toolbar.d.ts +30 -12
- package/types/cmat-components-timeline.d.ts +83 -51
- package/types/cmat-components-toast.d.ts +84 -85
- package/types/cmat-components-transfer-picker.d.ts +228 -181
- package/types/cmat-components-treetable.d.ts +63 -39
- package/types/cmat-components-upload.d.ts +205 -106
- package/types/cmat-components-x6-angular-shape.d.ts +29 -37
- package/types/cmat-directives-animate-on-scroll.d.ts +48 -30
- package/types/cmat-directives-arrow-cursor.d.ts +55 -35
- package/types/cmat-directives-autofocus.d.ts +8 -11
- package/types/cmat-directives-data-exporter.d.ts +71 -40
- package/types/cmat-directives-debounce.d.ts +31 -28
- package/types/cmat-directives-digit-only.d.ts +90 -53
- package/types/cmat-directives-equal-validator.d.ts +11 -14
- package/types/cmat-directives-seamless-auto-scroll.d.ts +42 -29
- package/types/cmat-lib-mock-api.d.ts +46 -55
- package/types/cmat-pipes-bytes.d.ts +7 -10
- package/types/cmat-pipes-date-format.d.ts +7 -10
- package/types/cmat-pipes-find-by-key.d.ts +8 -12
- package/types/cmat-pipes-group-by.d.ts +11 -15
- package/types/cmat-pipes-keys.d.ts +10 -13
- package/types/cmat-pipes-secure.d.ts +14 -17
- package/types/cmat-pipes-uppercase.d.ts +7 -10
- package/types/cmat-reports.d.ts +1131 -0
- package/types/cmat-services-alert.d.ts +80 -87
- package/types/cmat-services-config.d.ts +37 -43
- package/types/cmat-services-confirmation.d.ts +31 -37
- package/types/cmat-services-data.d.ts +18 -21
- package/types/cmat-services-export-as.d.ts +28 -33
- package/types/cmat-services-loading.d.ts +27 -31
- package/types/cmat-services-local-storage.d.ts +17 -21
- package/types/cmat-services-media-watcher.d.ts +14 -18
- package/types/cmat-services-platform.d.ts +8 -11
- package/types/cmat-services-print.d.ts +97 -92
- package/types/cmat-services-splash-screen.d.ts +11 -14
- package/types/cmat-services-title.d.ts +9 -12
- package/types/cmat-services-translation.d.ts +19 -22
- package/types/cmat-services-utils.d.ts +76 -80
- package/types/cmat-validators.d.ts +5 -8
- package/types/cmat-version.d.ts +8 -10
- package/types/cmat.d.ts +7551 -5194
|
@@ -1,841 +1,1778 @@
|
|
|
1
|
-
import { DOCUMENT,
|
|
2
|
-
import * as i0 from
|
|
3
|
-
import {
|
|
4
|
-
import * as i1 from
|
|
5
|
-
import {
|
|
6
|
-
import { TinyColor } from
|
|
7
|
-
import { CdkConnectedOverlay, CdkOverlayOrigin } from
|
|
8
|
-
import * as i2 from
|
|
9
|
-
import { MatInputModule } from
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
1
|
+
import { DOCUMENT, NgClass, NgStyle } from "@angular/common";
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
import { ChangeDetectionStrategy, Component, Directive, ElementRef, ViewEncapsulation, effect, forwardRef, inject, input, model, output, signal, untracked } from "@angular/core";
|
|
4
|
+
import * as i1 from "@angular/forms";
|
|
5
|
+
import { FormsModule, NG_VALUE_ACCESSOR, 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
|
+
var CmatColorCoordinates = class CmatColorCoordinates {
|
|
11
|
+
constructor() {
|
|
12
|
+
this.percentX = input(0, ...ngDevMode ? [{ debugName: "percentX" }] : /* istanbul ignore next */ []);
|
|
13
|
+
this.percentY = input(0, ...ngDevMode ? [{ debugName: "percentY" }] : /* istanbul ignore next */ []);
|
|
14
|
+
this.coordinatesChange = output();
|
|
15
|
+
this._document = inject(DOCUMENT);
|
|
16
|
+
this._el = inject(ElementRef);
|
|
17
|
+
this.onDrag = (e) => {
|
|
18
|
+
e.preventDefault();
|
|
19
|
+
this._handleChange(e);
|
|
20
|
+
};
|
|
21
|
+
this.onDragEnd = () => {
|
|
22
|
+
this._document.removeEventListener("pointermove", this.onDrag);
|
|
23
|
+
this._document.removeEventListener("pointerup", this.onDragEnd);
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
onDragStart(e) {
|
|
27
|
+
this._document.addEventListener("pointermove", this.onDrag, { passive: false });
|
|
28
|
+
this._document.addEventListener("pointerup", this.onDragEnd, { passive: false });
|
|
29
|
+
e.preventDefault();
|
|
30
|
+
this._handleChange(e);
|
|
31
|
+
}
|
|
32
|
+
onKeyDown(e) {
|
|
33
|
+
if (![
|
|
34
|
+
"ArrowUp",
|
|
35
|
+
"ArrowDown",
|
|
36
|
+
"ArrowLeft",
|
|
37
|
+
"ArrowRight"
|
|
38
|
+
].includes(e.key)) 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": vY += stepY;
|
|
60
|
+
}
|
|
61
|
+
} else if (this.percentX != null) {
|
|
62
|
+
vX = rect.left + rect.width * (this.percentX() / 100);
|
|
63
|
+
switch (e.key) {
|
|
64
|
+
case "ArrowLeft":
|
|
65
|
+
case "ArrowDown":
|
|
66
|
+
vX -= stepX;
|
|
67
|
+
break;
|
|
68
|
+
case "ArrowRight":
|
|
69
|
+
case "ArrowUp": vX += stepX;
|
|
70
|
+
}
|
|
71
|
+
} else if (this.percentY != null) {
|
|
72
|
+
vY = rect.top + rect.height * (this.percentY() / 100);
|
|
73
|
+
switch (e.key) {
|
|
74
|
+
case "ArrowLeft":
|
|
75
|
+
case "ArrowDown":
|
|
76
|
+
vY += stepY;
|
|
77
|
+
break;
|
|
78
|
+
case "ArrowRight":
|
|
79
|
+
case "ArrowUp": vY -= stepY;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
this._handleChange({
|
|
83
|
+
clientX: vX,
|
|
84
|
+
clientY: vY
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
_handleChange(e) {
|
|
88
|
+
const containerRect = this._el.nativeElement.getBoundingClientRect();
|
|
89
|
+
const containerWidth = containerRect.width;
|
|
90
|
+
const containerHeight = containerRect.height;
|
|
91
|
+
const { clientX, clientY } = e;
|
|
92
|
+
const left = clientX - containerRect.left;
|
|
93
|
+
const top = clientY - containerRect.top;
|
|
94
|
+
this.coordinatesChange.emit({
|
|
95
|
+
containerWidth,
|
|
96
|
+
containerHeight,
|
|
97
|
+
left,
|
|
98
|
+
top
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
static {
|
|
102
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
103
|
+
minVersion: "12.0.0",
|
|
104
|
+
version: "22.2.3",
|
|
105
|
+
ngImport: i0,
|
|
106
|
+
type: CmatColorCoordinates,
|
|
107
|
+
deps: [],
|
|
108
|
+
target: i0.ɵɵFactoryTarget.Directive
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
static {
|
|
112
|
+
this.ɵdir = i0.ɵɵngDeclareDirective({
|
|
113
|
+
minVersion: "17.1.0",
|
|
114
|
+
version: "22.2.3",
|
|
115
|
+
type: CmatColorCoordinates,
|
|
116
|
+
isStandalone: true,
|
|
117
|
+
selector: "[cmat-color-coordinates], [cmatColorCoordinates]",
|
|
118
|
+
inputs: {
|
|
119
|
+
percentX: {
|
|
120
|
+
classPropertyName: "percentX",
|
|
121
|
+
publicName: "percentX",
|
|
122
|
+
isSignal: true,
|
|
123
|
+
isRequired: false,
|
|
124
|
+
transformFunction: null
|
|
125
|
+
},
|
|
126
|
+
percentY: {
|
|
127
|
+
classPropertyName: "percentY",
|
|
128
|
+
publicName: "percentY",
|
|
129
|
+
isSignal: true,
|
|
130
|
+
isRequired: false,
|
|
131
|
+
transformFunction: null
|
|
132
|
+
}
|
|
133
|
+
},
|
|
134
|
+
outputs: { coordinatesChange: "coordinatesChange" },
|
|
135
|
+
host: { listeners: {
|
|
136
|
+
"pointerdown": "onDragStart($event)",
|
|
137
|
+
"keydown": "onKeyDown($event)"
|
|
138
|
+
} },
|
|
139
|
+
ngImport: i0
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
};
|
|
143
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
144
|
+
minVersion: "12.0.0",
|
|
145
|
+
version: "22.2.3",
|
|
146
|
+
ngImport: i0,
|
|
147
|
+
type: CmatColorCoordinates,
|
|
148
|
+
decorators: [{
|
|
149
|
+
type: Directive,
|
|
150
|
+
args: [{
|
|
151
|
+
selector: "[cmat-color-coordinates], [cmatColorCoordinates]",
|
|
152
|
+
host: {
|
|
153
|
+
"(pointerdown)": "onDragStart($event)",
|
|
154
|
+
"(keydown)": "onKeyDown($event)"
|
|
155
|
+
}
|
|
156
|
+
}]
|
|
157
|
+
}],
|
|
158
|
+
propDecorators: {
|
|
159
|
+
percentX: [{
|
|
160
|
+
type: i0.Input,
|
|
161
|
+
args: [{
|
|
162
|
+
isSignal: true,
|
|
163
|
+
alias: "percentX",
|
|
164
|
+
required: false
|
|
165
|
+
}]
|
|
166
|
+
}],
|
|
167
|
+
percentY: [{
|
|
168
|
+
type: i0.Input,
|
|
169
|
+
args: [{
|
|
170
|
+
isSignal: true,
|
|
171
|
+
alias: "percentY",
|
|
172
|
+
required: false
|
|
173
|
+
}]
|
|
174
|
+
}],
|
|
175
|
+
coordinatesChange: [{
|
|
176
|
+
type: i0.Output,
|
|
177
|
+
args: ["coordinatesChange"]
|
|
178
|
+
}]
|
|
179
|
+
}
|
|
180
|
+
});
|
|
181
|
+
var CmatColorAlphaSlider = class CmatColorAlphaSlider {
|
|
182
|
+
constructor() {
|
|
183
|
+
this.color = input.required(...ngDevMode ? [{ debugName: "color" }] : /* istanbul ignore next */ []);
|
|
184
|
+
this.direction = input("horizontal", ...ngDevMode ? [{ debugName: "direction" }] : /* istanbul ignore next */ []);
|
|
185
|
+
this.change = output();
|
|
186
|
+
this.hsl = signal(null, ...ngDevMode ? [{ debugName: "hsl" }] : /* istanbul ignore next */ []);
|
|
187
|
+
this.rgb = signal(null, ...ngDevMode ? [{ debugName: "rgb" }] : /* istanbul ignore next */ []);
|
|
188
|
+
this.gradient = signal("", ...ngDevMode ? [{ debugName: "gradient" }] : /* istanbul ignore next */ []);
|
|
189
|
+
this.posX = signal(0, ...ngDevMode ? [{ debugName: "posX" }] : /* istanbul ignore next */ []);
|
|
190
|
+
this.posY = signal(0, ...ngDevMode ? [{ debugName: "posY" }] : /* istanbul ignore next */ []);
|
|
191
|
+
effect(() => {
|
|
192
|
+
const color = this.color();
|
|
193
|
+
this.hsl.set(color.hsl);
|
|
194
|
+
this.rgb.set(color.rgb);
|
|
195
|
+
const rgb = this.rgb();
|
|
196
|
+
if (rgb) {
|
|
197
|
+
if (this.direction() === "vertical") untracked(() => {
|
|
198
|
+
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%)`);
|
|
199
|
+
this.posX.set(0);
|
|
200
|
+
this.posY.set((1 - rgb.a) * 100);
|
|
201
|
+
});
|
|
202
|
+
else untracked(() => {
|
|
203
|
+
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%)`);
|
|
204
|
+
this.posY.set(0);
|
|
205
|
+
this.posX.set(rgb.a * 100);
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
handleChange(e) {
|
|
211
|
+
const { top, left, containerHeight, containerWidth } = e;
|
|
212
|
+
const isVertical = this.direction() === "vertical";
|
|
213
|
+
const pos = isVertical ? top : left;
|
|
214
|
+
const size = isVertical ? containerHeight : containerWidth;
|
|
215
|
+
const ratio = Math.max(0, Math.min(pos, size)) / size;
|
|
216
|
+
const alpha = isVertical ? 1 - ratio : ratio;
|
|
217
|
+
const a = Math.round(alpha * 100) / 100;
|
|
218
|
+
const hsl = this.hsl();
|
|
219
|
+
if (hsl && hsl.a !== a) this.change.emit({
|
|
220
|
+
...hsl,
|
|
221
|
+
a,
|
|
222
|
+
source: "rgb"
|
|
223
|
+
});
|
|
224
|
+
}
|
|
225
|
+
static {
|
|
226
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
227
|
+
minVersion: "12.0.0",
|
|
228
|
+
version: "22.2.3",
|
|
229
|
+
ngImport: i0,
|
|
230
|
+
type: CmatColorAlphaSlider,
|
|
231
|
+
deps: [],
|
|
232
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
233
|
+
});
|
|
234
|
+
}
|
|
235
|
+
static {
|
|
236
|
+
this.ɵcmp = i0.ɵɵngDeclareComponent({
|
|
237
|
+
minVersion: "17.1.0",
|
|
238
|
+
version: "22.2.3",
|
|
239
|
+
type: CmatColorAlphaSlider,
|
|
240
|
+
isStandalone: true,
|
|
241
|
+
selector: "cmat-color-alpha-slider",
|
|
242
|
+
inputs: {
|
|
243
|
+
color: {
|
|
244
|
+
classPropertyName: "color",
|
|
245
|
+
publicName: "color",
|
|
246
|
+
isSignal: true,
|
|
247
|
+
isRequired: true,
|
|
248
|
+
transformFunction: null
|
|
249
|
+
},
|
|
250
|
+
direction: {
|
|
251
|
+
classPropertyName: "direction",
|
|
252
|
+
publicName: "direction",
|
|
253
|
+
isSignal: true,
|
|
254
|
+
isRequired: false,
|
|
255
|
+
transformFunction: null
|
|
256
|
+
}
|
|
257
|
+
},
|
|
258
|
+
outputs: { change: "change" },
|
|
259
|
+
host: {
|
|
260
|
+
properties: {
|
|
261
|
+
"class.cmat-color-alpha-vertical": "direction()=== \"vertical\"",
|
|
262
|
+
"class.cmat-color-alpha-horizontal": "direction() === \"horizontal\""
|
|
263
|
+
},
|
|
264
|
+
classAttribute: "cmat-color-alpha-slider"
|
|
265
|
+
},
|
|
266
|
+
ngImport: i0,
|
|
267
|
+
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>",
|
|
268
|
+
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"],
|
|
269
|
+
dependencies: [{
|
|
270
|
+
kind: "directive",
|
|
271
|
+
type: CmatColorCoordinates,
|
|
272
|
+
selector: "[cmat-color-coordinates], [cmatColorCoordinates]",
|
|
273
|
+
inputs: ["percentX", "percentY"],
|
|
274
|
+
outputs: ["coordinatesChange"]
|
|
275
|
+
}],
|
|
276
|
+
changeDetection: i0.ChangeDetectionStrategy.OnPush,
|
|
277
|
+
encapsulation: i0.ViewEncapsulation.None
|
|
278
|
+
});
|
|
279
|
+
}
|
|
280
|
+
};
|
|
281
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
282
|
+
minVersion: "12.0.0",
|
|
283
|
+
version: "22.2.3",
|
|
284
|
+
ngImport: i0,
|
|
285
|
+
type: CmatColorAlphaSlider,
|
|
286
|
+
decorators: [{
|
|
287
|
+
type: Component,
|
|
288
|
+
args: [{
|
|
289
|
+
selector: "cmat-color-alpha-slider",
|
|
290
|
+
imports: [CmatColorCoordinates],
|
|
291
|
+
host: {
|
|
292
|
+
"class": "cmat-color-alpha-slider",
|
|
293
|
+
"[class.cmat-color-alpha-vertical]": "direction()=== \"vertical\"",
|
|
294
|
+
"[class.cmat-color-alpha-horizontal]": "direction() === \"horizontal\""
|
|
295
|
+
},
|
|
296
|
+
encapsulation: ViewEncapsulation.None,
|
|
297
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
298
|
+
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>",
|
|
299
|
+
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"]
|
|
300
|
+
}]
|
|
301
|
+
}],
|
|
302
|
+
ctorParameters: () => [],
|
|
303
|
+
propDecorators: {
|
|
304
|
+
color: [{
|
|
305
|
+
type: i0.Input,
|
|
306
|
+
args: [{
|
|
307
|
+
isSignal: true,
|
|
308
|
+
alias: "color",
|
|
309
|
+
required: true
|
|
310
|
+
}]
|
|
311
|
+
}],
|
|
312
|
+
direction: [{
|
|
313
|
+
type: i0.Input,
|
|
314
|
+
args: [{
|
|
315
|
+
isSignal: true,
|
|
316
|
+
alias: "direction",
|
|
317
|
+
required: false
|
|
318
|
+
}]
|
|
319
|
+
}],
|
|
320
|
+
change: [{
|
|
321
|
+
type: i0.Output,
|
|
322
|
+
args: ["change"]
|
|
323
|
+
}]
|
|
324
|
+
}
|
|
325
|
+
});
|
|
326
|
+
var CmatColorHueSlider = class CmatColorHueSlider {
|
|
327
|
+
constructor() {
|
|
328
|
+
this.color = input.required(...ngDevMode ? [{ debugName: "color" }] : /* istanbul ignore next */ []);
|
|
329
|
+
this.direction = input("horizontal", ...ngDevMode ? [{ debugName: "direction" }] : /* istanbul ignore next */ []);
|
|
330
|
+
this.change = output();
|
|
331
|
+
this.hsl = signal(null, ...ngDevMode ? [{ debugName: "hsl" }] : /* istanbul ignore next */ []);
|
|
332
|
+
this.posX = signal(0, ...ngDevMode ? [{ debugName: "posX" }] : /* istanbul ignore next */ []);
|
|
333
|
+
this.posY = signal(0, ...ngDevMode ? [{ debugName: "posY" }] : /* istanbul ignore next */ []);
|
|
334
|
+
effect(() => {
|
|
335
|
+
const color = this.color();
|
|
336
|
+
this.hsl.set(color.hsl);
|
|
337
|
+
if (!color.hsl) return;
|
|
338
|
+
if (this.direction() === "vertical") untracked(() => {
|
|
339
|
+
this.posX.set(0);
|
|
340
|
+
this.posY.set(100 - this.hsl().h * 100 / 360);
|
|
341
|
+
});
|
|
342
|
+
else untracked(() => {
|
|
343
|
+
this.posY.set(0);
|
|
344
|
+
this.posX.set(this.hsl().h * 100 / 360);
|
|
345
|
+
});
|
|
346
|
+
});
|
|
347
|
+
}
|
|
348
|
+
handleChange(e) {
|
|
349
|
+
const { top, left, containerHeight, containerWidth } = e;
|
|
350
|
+
const isVertical = this.direction() === "vertical";
|
|
351
|
+
const pos = isVertical ? top : left;
|
|
352
|
+
const size = isVertical ? containerHeight : containerWidth;
|
|
353
|
+
const ratio = Math.max(0, Math.min(pos, size)) / size;
|
|
354
|
+
const hue = isVertical ? (1 - ratio) * 360 : ratio * 360;
|
|
355
|
+
const h = hue >= 360 ? 359 : hue;
|
|
356
|
+
const hsl = this.hsl();
|
|
357
|
+
if (hsl && hsl.h !== h) this.change.emit({
|
|
358
|
+
...hsl,
|
|
359
|
+
h,
|
|
360
|
+
source: "rgb"
|
|
361
|
+
});
|
|
362
|
+
}
|
|
363
|
+
static {
|
|
364
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
365
|
+
minVersion: "12.0.0",
|
|
366
|
+
version: "22.2.3",
|
|
367
|
+
ngImport: i0,
|
|
368
|
+
type: CmatColorHueSlider,
|
|
369
|
+
deps: [],
|
|
370
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
371
|
+
});
|
|
372
|
+
}
|
|
373
|
+
static {
|
|
374
|
+
this.ɵcmp = i0.ɵɵngDeclareComponent({
|
|
375
|
+
minVersion: "17.1.0",
|
|
376
|
+
version: "22.2.3",
|
|
377
|
+
type: CmatColorHueSlider,
|
|
378
|
+
isStandalone: true,
|
|
379
|
+
selector: "cmat-color-hue-slider",
|
|
380
|
+
inputs: {
|
|
381
|
+
color: {
|
|
382
|
+
classPropertyName: "color",
|
|
383
|
+
publicName: "color",
|
|
384
|
+
isSignal: true,
|
|
385
|
+
isRequired: true,
|
|
386
|
+
transformFunction: null
|
|
387
|
+
},
|
|
388
|
+
direction: {
|
|
389
|
+
classPropertyName: "direction",
|
|
390
|
+
publicName: "direction",
|
|
391
|
+
isSignal: true,
|
|
392
|
+
isRequired: false,
|
|
393
|
+
transformFunction: null
|
|
394
|
+
}
|
|
395
|
+
},
|
|
396
|
+
outputs: { change: "change" },
|
|
397
|
+
host: {
|
|
398
|
+
properties: {
|
|
399
|
+
"class.cmat-color-hue-vertical": "direction() === \"vertical\"",
|
|
400
|
+
"class.cmat-color-hue-horizontal": "direction() === \"horizontal\""
|
|
401
|
+
},
|
|
402
|
+
classAttribute: "cmat-color-hue-slider"
|
|
403
|
+
},
|
|
404
|
+
ngImport: i0,
|
|
405
|
+
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>",
|
|
406
|
+
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"],
|
|
407
|
+
dependencies: [{
|
|
408
|
+
kind: "directive",
|
|
409
|
+
type: CmatColorCoordinates,
|
|
410
|
+
selector: "[cmat-color-coordinates], [cmatColorCoordinates]",
|
|
411
|
+
inputs: ["percentX", "percentY"],
|
|
412
|
+
outputs: ["coordinatesChange"]
|
|
413
|
+
}],
|
|
414
|
+
changeDetection: i0.ChangeDetectionStrategy.OnPush,
|
|
415
|
+
encapsulation: i0.ViewEncapsulation.None
|
|
416
|
+
});
|
|
417
|
+
}
|
|
418
|
+
};
|
|
419
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
420
|
+
minVersion: "12.0.0",
|
|
421
|
+
version: "22.2.3",
|
|
422
|
+
ngImport: i0,
|
|
423
|
+
type: CmatColorHueSlider,
|
|
424
|
+
decorators: [{
|
|
425
|
+
type: Component,
|
|
426
|
+
args: [{
|
|
427
|
+
selector: "cmat-color-hue-slider",
|
|
428
|
+
imports: [CmatColorCoordinates],
|
|
429
|
+
host: {
|
|
430
|
+
"class": "cmat-color-hue-slider",
|
|
431
|
+
"[class.cmat-color-hue-vertical]": "direction() === \"vertical\"",
|
|
432
|
+
"[class.cmat-color-hue-horizontal]": "direction() === \"horizontal\""
|
|
433
|
+
},
|
|
434
|
+
encapsulation: ViewEncapsulation.None,
|
|
435
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
436
|
+
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>",
|
|
437
|
+
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"]
|
|
438
|
+
}]
|
|
439
|
+
}],
|
|
440
|
+
ctorParameters: () => [],
|
|
441
|
+
propDecorators: {
|
|
442
|
+
color: [{
|
|
443
|
+
type: i0.Input,
|
|
444
|
+
args: [{
|
|
445
|
+
isSignal: true,
|
|
446
|
+
alias: "color",
|
|
447
|
+
required: true
|
|
448
|
+
}]
|
|
449
|
+
}],
|
|
450
|
+
direction: [{
|
|
451
|
+
type: i0.Input,
|
|
452
|
+
args: [{
|
|
453
|
+
isSignal: true,
|
|
454
|
+
alias: "direction",
|
|
455
|
+
required: false
|
|
456
|
+
}]
|
|
457
|
+
}],
|
|
458
|
+
change: [{
|
|
459
|
+
type: i0.Output,
|
|
460
|
+
args: ["change"]
|
|
461
|
+
}]
|
|
462
|
+
}
|
|
463
|
+
});
|
|
464
|
+
var CmatColorIconButton = class CmatColorIconButton {
|
|
465
|
+
static {
|
|
466
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
467
|
+
minVersion: "12.0.0",
|
|
468
|
+
version: "22.2.3",
|
|
469
|
+
ngImport: i0,
|
|
470
|
+
type: CmatColorIconButton,
|
|
471
|
+
deps: [],
|
|
472
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
473
|
+
});
|
|
474
|
+
}
|
|
475
|
+
static {
|
|
476
|
+
this.ɵcmp = i0.ɵɵngDeclareComponent({
|
|
477
|
+
minVersion: "14.0.0",
|
|
478
|
+
version: "22.2.3",
|
|
479
|
+
type: CmatColorIconButton,
|
|
480
|
+
isStandalone: true,
|
|
481
|
+
selector: "cmat-color-icon-button",
|
|
482
|
+
host: { classAttribute: "cmat-color-icon-button" },
|
|
483
|
+
ngImport: i0,
|
|
484
|
+
template: `
|
|
485
|
+
<ng-content />
|
|
486
|
+
`,
|
|
487
|
+
isInline: true,
|
|
488
|
+
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"],
|
|
489
|
+
changeDetection: i0.ChangeDetectionStrategy.OnPush,
|
|
490
|
+
encapsulation: i0.ViewEncapsulation.None
|
|
491
|
+
});
|
|
492
|
+
}
|
|
493
|
+
};
|
|
494
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
495
|
+
minVersion: "12.0.0",
|
|
496
|
+
version: "22.2.3",
|
|
497
|
+
ngImport: i0,
|
|
498
|
+
type: CmatColorIconButton,
|
|
499
|
+
decorators: [{
|
|
500
|
+
type: Component,
|
|
501
|
+
args: [{
|
|
502
|
+
selector: "cmat-color-icon-button",
|
|
503
|
+
imports: [],
|
|
504
|
+
template: `
|
|
505
|
+
<ng-content />
|
|
506
|
+
`,
|
|
507
|
+
host: { class: "cmat-color-icon-button" },
|
|
508
|
+
encapsulation: ViewEncapsulation.None,
|
|
509
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
510
|
+
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"]
|
|
511
|
+
}]
|
|
512
|
+
}]
|
|
513
|
+
});
|
|
264
514
|
let nextUniqueId = 0;
|
|
265
|
-
class CmatColorInputField {
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
}
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
515
|
+
var CmatColorInputField = class CmatColorInputField {
|
|
516
|
+
constructor() {
|
|
517
|
+
this.label = input("", ...ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []);
|
|
518
|
+
this.step = input(1, ...ngDevMode ? [{ debugName: "step" }] : /* istanbul ignore next */ []);
|
|
519
|
+
this.placeholder = input("", ...ngDevMode ? [{ debugName: "placeholder" }] : /* istanbul ignore next */ []);
|
|
520
|
+
this.value = input("", ...ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []);
|
|
521
|
+
this.valueChange = output();
|
|
522
|
+
this.uniqueId = `cmat-color-input-${++nextUniqueId}`;
|
|
523
|
+
this.focus = signal(false, ...ngDevMode ? [{ debugName: "focus" }] : /* istanbul ignore next */ []);
|
|
524
|
+
this.currentValue = signal("", ...ngDevMode ? [{ debugName: "currentValue" }] : /* istanbul ignore next */ []);
|
|
525
|
+
this.blurValue = signal("", ...ngDevMode ? [{ debugName: "blurValue" }] : /* istanbul ignore next */ []);
|
|
526
|
+
effect(() => {
|
|
527
|
+
if (!this.focus()) {
|
|
528
|
+
this.currentValue.set(String(this.value()));
|
|
529
|
+
this.blurValue.set(String(this.value()));
|
|
530
|
+
} else this.blurValue.set(String(this.value()));
|
|
531
|
+
});
|
|
532
|
+
}
|
|
533
|
+
handleFocus(e) {
|
|
534
|
+
this.focus.set(true);
|
|
535
|
+
e.preventDefault();
|
|
536
|
+
}
|
|
537
|
+
handleFocusOut(e) {
|
|
538
|
+
this.focus.set(false);
|
|
539
|
+
this.currentValue.set(this.blurValue());
|
|
540
|
+
e.preventDefault();
|
|
541
|
+
}
|
|
542
|
+
handleKeydown(e) {
|
|
543
|
+
const target = e.target;
|
|
544
|
+
const inputValue = String(target.value);
|
|
545
|
+
const isPercentage = inputValue.includes("%");
|
|
546
|
+
const num = Number(inputValue.replace(/%/g, ""));
|
|
547
|
+
if (isNaN(num)) return;
|
|
548
|
+
const step = this.step() || 1;
|
|
549
|
+
if (e.key === "ArrowUp") {
|
|
550
|
+
if (this.label()) this.valueChange.emit({ [this.label()]: num + step });
|
|
551
|
+
else this.valueChange.emit(num + step);
|
|
552
|
+
if (isPercentage) this.currentValue.set(`${num + step}%`);
|
|
553
|
+
else this.currentValue.set(num + step);
|
|
554
|
+
}
|
|
555
|
+
if (e.key === "ArrowDown") {
|
|
556
|
+
if (this.label()) this.valueChange.emit({ [this.label()]: num - step });
|
|
557
|
+
else this.valueChange.emit(num - step);
|
|
558
|
+
if (isPercentage) this.currentValue.set(`${num - step}%`);
|
|
559
|
+
else this.currentValue.set(num - step);
|
|
560
|
+
}
|
|
561
|
+
}
|
|
562
|
+
handleKeyup(e) {
|
|
563
|
+
const target = e.target;
|
|
564
|
+
if (e.key === "ArrowDown" || e.key === "ArrowUp") return;
|
|
565
|
+
if (`${this.currentValue()}` === target.value) return;
|
|
566
|
+
if (this.label()) this.valueChange.emit({ [this.label()]: target.value });
|
|
567
|
+
else this.valueChange.emit(target.value);
|
|
568
|
+
}
|
|
569
|
+
static {
|
|
570
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
571
|
+
minVersion: "12.0.0",
|
|
572
|
+
version: "22.2.3",
|
|
573
|
+
ngImport: i0,
|
|
574
|
+
type: CmatColorInputField,
|
|
575
|
+
deps: [],
|
|
576
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
577
|
+
});
|
|
578
|
+
}
|
|
579
|
+
static {
|
|
580
|
+
this.ɵcmp = i0.ɵɵngDeclareComponent({
|
|
581
|
+
minVersion: "17.0.0",
|
|
582
|
+
version: "22.2.3",
|
|
583
|
+
type: CmatColorInputField,
|
|
584
|
+
isStandalone: true,
|
|
585
|
+
selector: "cmat-color-input-field",
|
|
586
|
+
inputs: {
|
|
587
|
+
label: {
|
|
588
|
+
classPropertyName: "label",
|
|
589
|
+
publicName: "label",
|
|
590
|
+
isSignal: true,
|
|
591
|
+
isRequired: false,
|
|
592
|
+
transformFunction: null
|
|
593
|
+
},
|
|
594
|
+
step: {
|
|
595
|
+
classPropertyName: "step",
|
|
596
|
+
publicName: "step",
|
|
597
|
+
isSignal: true,
|
|
598
|
+
isRequired: false,
|
|
599
|
+
transformFunction: null
|
|
600
|
+
},
|
|
601
|
+
placeholder: {
|
|
602
|
+
classPropertyName: "placeholder",
|
|
603
|
+
publicName: "placeholder",
|
|
604
|
+
isSignal: true,
|
|
605
|
+
isRequired: false,
|
|
606
|
+
transformFunction: null
|
|
607
|
+
},
|
|
608
|
+
value: {
|
|
609
|
+
classPropertyName: "value",
|
|
610
|
+
publicName: "value",
|
|
611
|
+
isSignal: true,
|
|
612
|
+
isRequired: false,
|
|
613
|
+
transformFunction: null
|
|
614
|
+
}
|
|
615
|
+
},
|
|
616
|
+
outputs: { valueChange: "valueChange" },
|
|
617
|
+
host: { classAttribute: "cmat-color-input-field" },
|
|
618
|
+
ngImport: i0,
|
|
619
|
+
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}",
|
|
620
|
+
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"],
|
|
621
|
+
changeDetection: i0.ChangeDetectionStrategy.OnPush,
|
|
622
|
+
encapsulation: i0.ViewEncapsulation.None
|
|
623
|
+
});
|
|
624
|
+
}
|
|
625
|
+
};
|
|
626
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
627
|
+
minVersion: "12.0.0",
|
|
628
|
+
version: "22.2.3",
|
|
629
|
+
ngImport: i0,
|
|
630
|
+
type: CmatColorInputField,
|
|
631
|
+
decorators: [{
|
|
632
|
+
type: Component,
|
|
633
|
+
args: [{
|
|
634
|
+
selector: "cmat-color-input-field",
|
|
635
|
+
host: { class: "cmat-color-input-field" },
|
|
636
|
+
encapsulation: ViewEncapsulation.None,
|
|
637
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
638
|
+
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}",
|
|
639
|
+
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"]
|
|
640
|
+
}]
|
|
641
|
+
}],
|
|
642
|
+
ctorParameters: () => [],
|
|
643
|
+
propDecorators: {
|
|
644
|
+
label: [{
|
|
645
|
+
type: i0.Input,
|
|
646
|
+
args: [{
|
|
647
|
+
isSignal: true,
|
|
648
|
+
alias: "label",
|
|
649
|
+
required: false
|
|
650
|
+
}]
|
|
651
|
+
}],
|
|
652
|
+
step: [{
|
|
653
|
+
type: i0.Input,
|
|
654
|
+
args: [{
|
|
655
|
+
isSignal: true,
|
|
656
|
+
alias: "step",
|
|
657
|
+
required: false
|
|
658
|
+
}]
|
|
659
|
+
}],
|
|
660
|
+
placeholder: [{
|
|
661
|
+
type: i0.Input,
|
|
662
|
+
args: [{
|
|
663
|
+
isSignal: true,
|
|
664
|
+
alias: "placeholder",
|
|
665
|
+
required: false
|
|
666
|
+
}]
|
|
667
|
+
}],
|
|
668
|
+
value: [{
|
|
669
|
+
type: i0.Input,
|
|
670
|
+
args: [{
|
|
671
|
+
isSignal: true,
|
|
672
|
+
alias: "value",
|
|
673
|
+
required: false
|
|
674
|
+
}]
|
|
675
|
+
}],
|
|
676
|
+
valueChange: [{
|
|
677
|
+
type: i0.Output,
|
|
678
|
+
args: ["valueChange"]
|
|
679
|
+
}]
|
|
680
|
+
}
|
|
681
|
+
});
|
|
366
682
|
function simpleCheckForValidColor(data) {
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
683
|
+
const keysToCheck = [
|
|
684
|
+
"r",
|
|
685
|
+
"g",
|
|
686
|
+
"b",
|
|
687
|
+
"a",
|
|
688
|
+
"h",
|
|
689
|
+
"s",
|
|
690
|
+
"l",
|
|
691
|
+
"v"
|
|
692
|
+
];
|
|
693
|
+
let checked = 0;
|
|
694
|
+
let passed = 0;
|
|
695
|
+
keysToCheck.forEach((letter) => {
|
|
696
|
+
if (!(letter in data)) return;
|
|
697
|
+
checked += 1;
|
|
698
|
+
const value = data[letter];
|
|
699
|
+
if (!isNaN(value)) passed += 1;
|
|
700
|
+
if (letter === "s" || letter === "l") {
|
|
701
|
+
if (/^\d+%$/.test(String(value))) passed += 1;
|
|
702
|
+
}
|
|
703
|
+
});
|
|
704
|
+
return checked === passed;
|
|
389
705
|
}
|
|
390
706
|
function parseColor(data, oldHue = 0, hideAlpha = false) {
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
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
|
-
};
|
|
707
|
+
const color = data && typeof data !== "string" && "hex" in data ? new TinyColor(data.hex) : new TinyColor(data);
|
|
708
|
+
if (hideAlpha) color.setAlpha(1);
|
|
709
|
+
const rgb = color.toRgb();
|
|
710
|
+
let hsl;
|
|
711
|
+
let hsv;
|
|
712
|
+
if (data && typeof data === "object" && "s" in data && "l" in data) {
|
|
713
|
+
hsl = {
|
|
714
|
+
h: data.h ?? oldHue,
|
|
715
|
+
s: data.s,
|
|
716
|
+
l: data.l,
|
|
717
|
+
a: data.a ?? 1
|
|
718
|
+
};
|
|
719
|
+
hsv = hslToHsv(hsl.h, hsl.s, hsl.l, hsl.a);
|
|
720
|
+
} else if (data && typeof data === "object" && "s" in data && "v" in data) {
|
|
721
|
+
hsv = {
|
|
722
|
+
h: data.h ?? oldHue,
|
|
723
|
+
s: data.s,
|
|
724
|
+
v: data.v,
|
|
725
|
+
a: data.a ?? 1
|
|
726
|
+
};
|
|
727
|
+
hsl = hsvToHsl(hsv.h, hsv.s, hsv.v, hsv.a);
|
|
728
|
+
} else {
|
|
729
|
+
hsl = color.toHsl();
|
|
730
|
+
hsv = color.toHsv();
|
|
731
|
+
}
|
|
732
|
+
if (hsl.s === 0) {
|
|
733
|
+
hsl.h = oldHue;
|
|
734
|
+
hsv.h = oldHue;
|
|
735
|
+
}
|
|
736
|
+
return {
|
|
737
|
+
hsl,
|
|
738
|
+
hslString: toHslString(hsl),
|
|
739
|
+
hsv,
|
|
740
|
+
hsvString: toHsvString(hsv),
|
|
741
|
+
rgb,
|
|
742
|
+
rgbString: color.toRgbString(),
|
|
743
|
+
hex: rgb.a === 1 ? color.toHexString() : color.toHex8String(),
|
|
744
|
+
oldHue: data && typeof data === "object" && "h" in data ? data.h ?? oldHue ?? hsl.h : oldHue ?? hsl.h,
|
|
745
|
+
source: data && typeof data === "object" ? data.source : ""
|
|
746
|
+
};
|
|
439
747
|
}
|
|
440
748
|
function hslToHsv(h, s, l, a) {
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
749
|
+
const v = l + s * Math.min(l, 1 - l);
|
|
750
|
+
return {
|
|
751
|
+
h,
|
|
752
|
+
s: v === 0 ? 0 : 2 * (1 - l / v),
|
|
753
|
+
v,
|
|
754
|
+
a
|
|
755
|
+
};
|
|
444
756
|
}
|
|
445
757
|
function hsvToHsl(h, s, v, a) {
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
758
|
+
const l = v * (1 - s / 2);
|
|
759
|
+
return {
|
|
760
|
+
h,
|
|
761
|
+
s: l === 0 || l === 1 ? 0 : (v - l) / Math.min(l, 1 - l),
|
|
762
|
+
l,
|
|
763
|
+
a
|
|
764
|
+
};
|
|
449
765
|
}
|
|
450
766
|
function toHslString(hsl) {
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
767
|
+
const h = Math.round(hsl.h);
|
|
768
|
+
const s = Math.round(hsl.s * 100);
|
|
769
|
+
const l = Math.round(hsl.l * 100);
|
|
770
|
+
return hsl.a === 1 ? `hsl(${h}, ${s}%, ${l}%)` : `hsla(${h}, ${s}%, ${l}%, ${hsl.a})`;
|
|
455
771
|
}
|
|
456
772
|
function toHsvString(hsv) {
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
773
|
+
const h = Math.round(hsv.h);
|
|
774
|
+
const s = Math.round(hsv.s * 100);
|
|
775
|
+
const v = Math.round(hsv.v * 100);
|
|
776
|
+
return hsv.a === 1 ? `hsv(${h}, ${s}%, ${v}%)` : `hsva(${h}, ${s}%, ${v}%, ${hsv.a})`;
|
|
461
777
|
}
|
|
462
778
|
function isValidHex(hex) {
|
|
463
|
-
|
|
464
|
-
return tinyColor.isValid;
|
|
779
|
+
return new TinyColor(hex).isValid;
|
|
465
780
|
}
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
}
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
781
|
+
var CmatColorInputFields = class CmatColorInputFields {
|
|
782
|
+
constructor() {
|
|
783
|
+
this.color = input.required(...ngDevMode ? [{ debugName: "color" }] : /* istanbul ignore next */ []);
|
|
784
|
+
this.format = model("hex", ...ngDevMode ? [{ debugName: "format" }] : /* istanbul ignore next */ []);
|
|
785
|
+
this.hideAlpha = input(false, ...ngDevMode ? [{ debugName: "hideAlpha" }] : /* istanbul ignore next */ []);
|
|
786
|
+
this.formatChanged = output();
|
|
787
|
+
this.valueChange = output();
|
|
788
|
+
this.hsl = signal(null, ...ngDevMode ? [{ debugName: "hsl" }] : /* istanbul ignore next */ []);
|
|
789
|
+
this.rgb = signal(null, ...ngDevMode ? [{ debugName: "rgb" }] : /* istanbul ignore next */ []);
|
|
790
|
+
this.hex = signal("", ...ngDevMode ? [{ debugName: "hex" }] : /* istanbul ignore next */ []);
|
|
791
|
+
effect(() => {
|
|
792
|
+
const color = this.color();
|
|
793
|
+
this.hsl.set(color.hsl);
|
|
794
|
+
this.rgb.set(color.rgb);
|
|
795
|
+
this.hex.set(color.hex);
|
|
796
|
+
untracked(() => {
|
|
797
|
+
if (!this.format()) this.format.set("hex");
|
|
798
|
+
else if (this.format() === "hsv") this.format.set("hsl");
|
|
799
|
+
});
|
|
800
|
+
});
|
|
801
|
+
}
|
|
802
|
+
round(value) {
|
|
803
|
+
return Math.round(value);
|
|
804
|
+
}
|
|
805
|
+
toggleColorFormat() {
|
|
806
|
+
let format;
|
|
807
|
+
let fieldVal = {};
|
|
808
|
+
if (this.format() === "hex") {
|
|
809
|
+
format = "rgb";
|
|
810
|
+
fieldVal = { ...this.rgb() };
|
|
811
|
+
} else if (this.format() === "rgb") {
|
|
812
|
+
format = "hsl";
|
|
813
|
+
fieldVal = {
|
|
814
|
+
...this.hsl(),
|
|
815
|
+
s: this.hsl().s * 100,
|
|
816
|
+
l: this.hsl().l * 100
|
|
817
|
+
};
|
|
818
|
+
} else if (this.format() === "hsl") {
|
|
819
|
+
format = "hex";
|
|
820
|
+
fieldVal = { hex: this.hex() };
|
|
821
|
+
}
|
|
822
|
+
this.format.set(format);
|
|
823
|
+
this.formatChanged.emit(format);
|
|
824
|
+
this.handleChange(fieldVal);
|
|
825
|
+
}
|
|
826
|
+
handleChange(e) {
|
|
827
|
+
if (typeof e === "string" || typeof e === "number") return;
|
|
828
|
+
if (e.hex) {
|
|
829
|
+
if (isValidHex(e.hex)) {
|
|
830
|
+
const color = new TinyColor(e.hex);
|
|
831
|
+
this.valueChange.emit({
|
|
832
|
+
hex: this.hideAlpha() ? color.toHex() : color.toHex8(),
|
|
833
|
+
source: "hex"
|
|
834
|
+
});
|
|
835
|
+
}
|
|
836
|
+
} else if (e.r || e.g || e.b) this.valueChange.emit({
|
|
837
|
+
r: e.r ?? this.rgb().r,
|
|
838
|
+
g: e.g ?? this.rgb().g,
|
|
839
|
+
b: e.b ?? this.rgb().b,
|
|
840
|
+
a: Math.round((e.a ?? this.rgb().a) * 100) / 100,
|
|
841
|
+
source: "rgb"
|
|
842
|
+
});
|
|
843
|
+
else if (e.h || e.s || e.l) {
|
|
844
|
+
const s = (typeof e.s === "string" ? Number(e.s.replace("%", "")) : e.s ?? 0) / 100;
|
|
845
|
+
const l = (typeof e.l === "string" ? Number(e.l.replace("%", "")) : e.l ?? 0) / 100;
|
|
846
|
+
this.valueChange.emit({
|
|
847
|
+
h: e.h ?? this.hsl().h,
|
|
848
|
+
s: s ?? this.hsl().s,
|
|
849
|
+
l: l ?? this.hsl().l,
|
|
850
|
+
a: Math.round((e.a ?? this.hsl().a) * 100) / 100,
|
|
851
|
+
source: "hsl"
|
|
852
|
+
});
|
|
853
|
+
} else if (e.a) {
|
|
854
|
+
let a = Math.max(0, Math.min(1, e.a));
|
|
855
|
+
if (this.hideAlpha()) a = 1;
|
|
856
|
+
this.valueChange.emit({
|
|
857
|
+
h: this.hsl().h,
|
|
858
|
+
s: this.hsl().s,
|
|
859
|
+
l: this.hsl().l,
|
|
860
|
+
a: Math.round(a * 100) / 100,
|
|
861
|
+
source: "rgb"
|
|
862
|
+
});
|
|
863
|
+
}
|
|
864
|
+
}
|
|
865
|
+
static {
|
|
866
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
867
|
+
minVersion: "12.0.0",
|
|
868
|
+
version: "22.2.3",
|
|
869
|
+
ngImport: i0,
|
|
870
|
+
type: CmatColorInputFields,
|
|
871
|
+
deps: [],
|
|
872
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
873
|
+
});
|
|
874
|
+
}
|
|
875
|
+
static {
|
|
876
|
+
this.ɵcmp = i0.ɵɵngDeclareComponent({
|
|
877
|
+
minVersion: "17.0.0",
|
|
878
|
+
version: "22.2.3",
|
|
879
|
+
type: CmatColorInputFields,
|
|
880
|
+
isStandalone: true,
|
|
881
|
+
selector: "cmat-color-input-fields",
|
|
882
|
+
inputs: {
|
|
883
|
+
color: {
|
|
884
|
+
classPropertyName: "color",
|
|
885
|
+
publicName: "color",
|
|
886
|
+
isSignal: true,
|
|
887
|
+
isRequired: true,
|
|
888
|
+
transformFunction: null
|
|
889
|
+
},
|
|
890
|
+
format: {
|
|
891
|
+
classPropertyName: "format",
|
|
892
|
+
publicName: "format",
|
|
893
|
+
isSignal: true,
|
|
894
|
+
isRequired: false,
|
|
895
|
+
transformFunction: null
|
|
896
|
+
},
|
|
897
|
+
hideAlpha: {
|
|
898
|
+
classPropertyName: "hideAlpha",
|
|
899
|
+
publicName: "hideAlpha",
|
|
900
|
+
isSignal: true,
|
|
901
|
+
isRequired: false,
|
|
902
|
+
transformFunction: null
|
|
903
|
+
}
|
|
904
|
+
},
|
|
905
|
+
outputs: {
|
|
906
|
+
format: "formatChange",
|
|
907
|
+
formatChanged: "formatChanged",
|
|
908
|
+
valueChange: "valueChange"
|
|
909
|
+
},
|
|
910
|
+
host: { classAttribute: "cmat-color-input-fields" },
|
|
911
|
+
ngImport: i0,
|
|
912
|
+
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>",
|
|
913
|
+
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"],
|
|
914
|
+
dependencies: [{
|
|
915
|
+
kind: "component",
|
|
916
|
+
type: CmatColorInputField,
|
|
917
|
+
selector: "cmat-color-input-field",
|
|
918
|
+
inputs: [
|
|
919
|
+
"label",
|
|
920
|
+
"step",
|
|
921
|
+
"placeholder",
|
|
922
|
+
"value"
|
|
923
|
+
],
|
|
924
|
+
outputs: ["valueChange"]
|
|
925
|
+
}, {
|
|
926
|
+
kind: "component",
|
|
927
|
+
type: CmatColorIconButton,
|
|
928
|
+
selector: "cmat-color-icon-button"
|
|
929
|
+
}],
|
|
930
|
+
changeDetection: i0.ChangeDetectionStrategy.OnPush,
|
|
931
|
+
encapsulation: i0.ViewEncapsulation.None
|
|
932
|
+
});
|
|
933
|
+
}
|
|
934
|
+
};
|
|
935
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
936
|
+
minVersion: "12.0.0",
|
|
937
|
+
version: "22.2.3",
|
|
938
|
+
ngImport: i0,
|
|
939
|
+
type: CmatColorInputFields,
|
|
940
|
+
decorators: [{
|
|
941
|
+
type: Component,
|
|
942
|
+
args: [{
|
|
943
|
+
selector: "cmat-color-input-fields",
|
|
944
|
+
imports: [CmatColorInputField, CmatColorIconButton],
|
|
945
|
+
host: { class: "cmat-color-input-fields" },
|
|
946
|
+
encapsulation: ViewEncapsulation.None,
|
|
947
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
948
|
+
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>",
|
|
949
|
+
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"]
|
|
950
|
+
}]
|
|
951
|
+
}],
|
|
952
|
+
ctorParameters: () => [],
|
|
953
|
+
propDecorators: {
|
|
954
|
+
color: [{
|
|
955
|
+
type: i0.Input,
|
|
956
|
+
args: [{
|
|
957
|
+
isSignal: true,
|
|
958
|
+
alias: "color",
|
|
959
|
+
required: true
|
|
960
|
+
}]
|
|
961
|
+
}],
|
|
962
|
+
format: [{
|
|
963
|
+
type: i0.Input,
|
|
964
|
+
args: [{
|
|
965
|
+
isSignal: true,
|
|
966
|
+
alias: "format",
|
|
967
|
+
required: false
|
|
968
|
+
}]
|
|
969
|
+
}, {
|
|
970
|
+
type: i0.Output,
|
|
971
|
+
args: ["formatChange"]
|
|
972
|
+
}],
|
|
973
|
+
hideAlpha: [{
|
|
974
|
+
type: i0.Input,
|
|
975
|
+
args: [{
|
|
976
|
+
isSignal: true,
|
|
977
|
+
alias: "hideAlpha",
|
|
978
|
+
required: false
|
|
979
|
+
}]
|
|
980
|
+
}],
|
|
981
|
+
formatChanged: [{
|
|
982
|
+
type: i0.Output,
|
|
983
|
+
args: ["formatChanged"]
|
|
984
|
+
}],
|
|
985
|
+
valueChange: [{
|
|
986
|
+
type: i0.Output,
|
|
987
|
+
args: ["valueChange"]
|
|
988
|
+
}]
|
|
989
|
+
}
|
|
990
|
+
});
|
|
991
|
+
var CmatColorSaturationPicker = class CmatColorSaturationPicker {
|
|
992
|
+
constructor() {
|
|
993
|
+
this.color = input.required(...ngDevMode ? [{ debugName: "color" }] : /* istanbul ignore next */ []);
|
|
994
|
+
this.change = output();
|
|
995
|
+
this.hsl = signal(null, ...ngDevMode ? [{ debugName: "hsl" }] : /* istanbul ignore next */ []);
|
|
996
|
+
this.hsv = signal(null, ...ngDevMode ? [{ debugName: "hsv" }] : /* istanbul ignore next */ []);
|
|
997
|
+
this.bgColor = signal("", ...ngDevMode ? [{ debugName: "bgColor" }] : /* istanbul ignore next */ []);
|
|
998
|
+
this.posX = signal(0, ...ngDevMode ? [{ debugName: "posX" }] : /* istanbul ignore next */ []);
|
|
999
|
+
this.posY = signal(0, ...ngDevMode ? [{ debugName: "posY" }] : /* istanbul ignore next */ []);
|
|
1000
|
+
this._el = inject(ElementRef);
|
|
1001
|
+
effect(() => {
|
|
1002
|
+
const color = this.color();
|
|
1003
|
+
this.hsl.set(color.hsl);
|
|
1004
|
+
this.hsv.set(color.hsv);
|
|
1005
|
+
untracked(() => {
|
|
1006
|
+
if (this.hsl()) this.bgColor.set(`hsl(${this.hsl().h}, 100%, 50%)`);
|
|
1007
|
+
if (this.hsv()) {
|
|
1008
|
+
this.posX.set(this.hsv().s * 100);
|
|
1009
|
+
this.posY.set(100 - this.hsv().v * 100);
|
|
1010
|
+
}
|
|
1011
|
+
});
|
|
1012
|
+
});
|
|
1013
|
+
}
|
|
1014
|
+
handleChange(e) {
|
|
1015
|
+
const { top, left, containerHeight, containerWidth } = e;
|
|
1016
|
+
const s = Math.max(0, Math.min(left, containerWidth)) / containerWidth;
|
|
1017
|
+
const v = 1 - Math.max(0, Math.min(top, containerHeight)) / containerHeight;
|
|
1018
|
+
const hsv = this.hsv();
|
|
1019
|
+
if (hsv) this.change.emit({
|
|
1020
|
+
...hsv,
|
|
1021
|
+
s,
|
|
1022
|
+
v,
|
|
1023
|
+
source: "hsva"
|
|
1024
|
+
});
|
|
1025
|
+
}
|
|
1026
|
+
onScroll() {
|
|
1027
|
+
const el = this._el.nativeElement;
|
|
1028
|
+
if (el.scrollTop !== 0 || el.scrollLeft !== 0) {
|
|
1029
|
+
el.scrollTop = 0;
|
|
1030
|
+
el.scrollLeft = 0;
|
|
1031
|
+
}
|
|
1032
|
+
}
|
|
1033
|
+
static {
|
|
1034
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
1035
|
+
minVersion: "12.0.0",
|
|
1036
|
+
version: "22.2.3",
|
|
1037
|
+
ngImport: i0,
|
|
1038
|
+
type: CmatColorSaturationPicker,
|
|
1039
|
+
deps: [],
|
|
1040
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
1041
|
+
});
|
|
1042
|
+
}
|
|
1043
|
+
static {
|
|
1044
|
+
this.ɵcmp = i0.ɵɵngDeclareComponent({
|
|
1045
|
+
minVersion: "17.1.0",
|
|
1046
|
+
version: "22.2.3",
|
|
1047
|
+
type: CmatColorSaturationPicker,
|
|
1048
|
+
isStandalone: true,
|
|
1049
|
+
selector: "cmat-color-saturation-picker",
|
|
1050
|
+
inputs: { color: {
|
|
1051
|
+
classPropertyName: "color",
|
|
1052
|
+
publicName: "color",
|
|
1053
|
+
isSignal: true,
|
|
1054
|
+
isRequired: true,
|
|
1055
|
+
transformFunction: null
|
|
1056
|
+
} },
|
|
1057
|
+
outputs: { change: "change" },
|
|
1058
|
+
host: {
|
|
1059
|
+
listeners: { "scroll": "onScroll()" },
|
|
1060
|
+
classAttribute: "cmat-color-saturation-picker"
|
|
1061
|
+
},
|
|
1062
|
+
ngImport: i0,
|
|
1063
|
+
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>",
|
|
1064
|
+
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"],
|
|
1065
|
+
dependencies: [{
|
|
1066
|
+
kind: "directive",
|
|
1067
|
+
type: CmatColorCoordinates,
|
|
1068
|
+
selector: "[cmat-color-coordinates], [cmatColorCoordinates]",
|
|
1069
|
+
inputs: ["percentX", "percentY"],
|
|
1070
|
+
outputs: ["coordinatesChange"]
|
|
1071
|
+
}],
|
|
1072
|
+
changeDetection: i0.ChangeDetectionStrategy.OnPush,
|
|
1073
|
+
encapsulation: i0.ViewEncapsulation.None
|
|
1074
|
+
});
|
|
1075
|
+
}
|
|
1076
|
+
};
|
|
1077
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
1078
|
+
minVersion: "12.0.0",
|
|
1079
|
+
version: "22.2.3",
|
|
1080
|
+
ngImport: i0,
|
|
1081
|
+
type: CmatColorSaturationPicker,
|
|
1082
|
+
decorators: [{
|
|
1083
|
+
type: Component,
|
|
1084
|
+
args: [{
|
|
1085
|
+
selector: "cmat-color-saturation-picker",
|
|
1086
|
+
imports: [CmatColorCoordinates],
|
|
1087
|
+
host: {
|
|
1088
|
+
"class": "cmat-color-saturation-picker",
|
|
1089
|
+
"(scroll)": "onScroll()"
|
|
1090
|
+
},
|
|
1091
|
+
encapsulation: ViewEncapsulation.None,
|
|
1092
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
1093
|
+
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>",
|
|
1094
|
+
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"]
|
|
1095
|
+
}]
|
|
1096
|
+
}],
|
|
1097
|
+
ctorParameters: () => [],
|
|
1098
|
+
propDecorators: {
|
|
1099
|
+
color: [{
|
|
1100
|
+
type: i0.Input,
|
|
1101
|
+
args: [{
|
|
1102
|
+
isSignal: true,
|
|
1103
|
+
alias: "color",
|
|
1104
|
+
required: true
|
|
1105
|
+
}]
|
|
1106
|
+
}],
|
|
1107
|
+
change: [{
|
|
1108
|
+
type: i0.Output,
|
|
1109
|
+
args: ["change"]
|
|
1110
|
+
}]
|
|
1111
|
+
}
|
|
1112
|
+
});
|
|
1113
|
+
var CmatColorPickerComponent = class CmatColorPickerComponent {
|
|
1114
|
+
constructor() {
|
|
1115
|
+
this.format = model("hex", ...ngDevMode ? [{ debugName: "format" }] : /* istanbul ignore next */ []);
|
|
1116
|
+
this.value = model("#000", ...ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []);
|
|
1117
|
+
this.hideAlpha = input(false, ...ngDevMode ? [{ debugName: "hideAlpha" }] : /* istanbul ignore next */ []);
|
|
1118
|
+
this.disabled = model(false, ...ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []);
|
|
1119
|
+
this.formatChanged = output();
|
|
1120
|
+
this.valueChanged = output();
|
|
1121
|
+
this.colorChanged = output();
|
|
1122
|
+
this.parsedColor = signal(null, ...ngDevMode ? [{ debugName: "parsedColor" }] : /* istanbul ignore next */ []);
|
|
1123
|
+
this.isCopied = signal(false, ...ngDevMode ? [{ debugName: "isCopied" }] : /* istanbul ignore next */ []);
|
|
1124
|
+
this.EyeDropper = window.EyeDropper;
|
|
1125
|
+
this.supportEyeDropper = !!this.EyeDropper;
|
|
1126
|
+
this._oldHue = signal(0, ...ngDevMode ? [{ debugName: "_oldHue" }] : /* istanbul ignore next */ []);
|
|
1127
|
+
this._oldValue = signal("", ...ngDevMode ? [{ debugName: "_oldValue" }] : /* istanbul ignore next */ []);
|
|
1128
|
+
this.onChange = () => {};
|
|
1129
|
+
this.onTouched = () => {};
|
|
1130
|
+
effect(() => {
|
|
1131
|
+
this.format();
|
|
1132
|
+
untracked(() => {
|
|
1133
|
+
this.getColorFormat();
|
|
1134
|
+
});
|
|
1135
|
+
});
|
|
1136
|
+
effect(() => {
|
|
1137
|
+
const value = this.value();
|
|
1138
|
+
untracked(() => {
|
|
1139
|
+
if (value !== this._oldValue()) this.getParsedColor(this.value(), this._oldHue());
|
|
1140
|
+
});
|
|
1141
|
+
});
|
|
1142
|
+
}
|
|
1143
|
+
ngOnInit() {
|
|
1144
|
+
this.getParsedColor(this.value());
|
|
1145
|
+
}
|
|
1146
|
+
writeValue(value) {
|
|
1147
|
+
if (value) {
|
|
1148
|
+
this.value.set(value);
|
|
1149
|
+
this.getColorFormat();
|
|
1150
|
+
this.getParsedColor(value, this._oldHue());
|
|
1151
|
+
}
|
|
1152
|
+
}
|
|
1153
|
+
registerOnChange(fn) {
|
|
1154
|
+
this.onChange = fn;
|
|
1155
|
+
}
|
|
1156
|
+
registerOnTouched(fn) {
|
|
1157
|
+
this.onTouched = fn;
|
|
1158
|
+
}
|
|
1159
|
+
setDisabledState(isDisabled) {
|
|
1160
|
+
this.disabled.set(isDisabled);
|
|
1161
|
+
}
|
|
1162
|
+
getParsedColor(data, oldHue = 0) {
|
|
1163
|
+
this.parsedColor.set(parseColor(data, oldHue, this.hideAlpha()));
|
|
1164
|
+
this._oldHue.set(this.parsedColor().oldHue);
|
|
1165
|
+
}
|
|
1166
|
+
handleChange(e) {
|
|
1167
|
+
if (simpleCheckForValidColor(e)) {
|
|
1168
|
+
this.getParsedColor(e, e.h || this._oldHue());
|
|
1169
|
+
this.getColorString(this.parsedColor());
|
|
1170
|
+
this.onChange(this.value());
|
|
1171
|
+
this.valueChanged.emit(this.value());
|
|
1172
|
+
this.colorChanged.emit({
|
|
1173
|
+
value: this.value(),
|
|
1174
|
+
color: this.parsedColor()
|
|
1175
|
+
});
|
|
1176
|
+
}
|
|
1177
|
+
}
|
|
1178
|
+
getColorFormat() {
|
|
1179
|
+
if (!this.format()) {
|
|
1180
|
+
const color = new TinyColor(this.value());
|
|
1181
|
+
if (color.format === "rgb" || color.format === "hsl" || color.format === "hsv") this.format.set(color.format);
|
|
1182
|
+
else this.format.set("hex");
|
|
1183
|
+
}
|
|
1184
|
+
}
|
|
1185
|
+
getColorString(color) {
|
|
1186
|
+
switch (this.format()) {
|
|
1187
|
+
case "rgb":
|
|
1188
|
+
this.value.set(color.rgbString);
|
|
1189
|
+
break;
|
|
1190
|
+
case "hsl":
|
|
1191
|
+
this.value.set(color.hslString);
|
|
1192
|
+
break;
|
|
1193
|
+
case "hsv":
|
|
1194
|
+
this.value.set(color.hsvString);
|
|
1195
|
+
break;
|
|
1196
|
+
default: this.value.set(color.hex);
|
|
1197
|
+
}
|
|
1198
|
+
this._oldValue.set(this.value());
|
|
1199
|
+
}
|
|
1200
|
+
handleFormatChange() {
|
|
1201
|
+
this.formatChanged.emit(this.format());
|
|
1202
|
+
}
|
|
1203
|
+
async openEyeDropper(e) {
|
|
1204
|
+
const eyeDropper = new this.EyeDropper();
|
|
1205
|
+
try {
|
|
1206
|
+
const result = await eyeDropper.open();
|
|
1207
|
+
this.handleChange({
|
|
1208
|
+
hex: result.sRGBHex,
|
|
1209
|
+
source: "rgb"
|
|
1210
|
+
});
|
|
1211
|
+
e.preventDefault();
|
|
1212
|
+
} catch (err) {
|
|
1213
|
+
console.warn(err);
|
|
1214
|
+
}
|
|
1215
|
+
}
|
|
1216
|
+
async copyColor() {
|
|
1217
|
+
try {
|
|
1218
|
+
await navigator.clipboard.writeText(this.value());
|
|
1219
|
+
this.isCopied.set(true);
|
|
1220
|
+
setTimeout(() => {
|
|
1221
|
+
this.isCopied.set(false);
|
|
1222
|
+
}, 1e3);
|
|
1223
|
+
} catch (err) {
|
|
1224
|
+
console.warn(err);
|
|
1225
|
+
}
|
|
1226
|
+
}
|
|
1227
|
+
static {
|
|
1228
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
1229
|
+
minVersion: "12.0.0",
|
|
1230
|
+
version: "22.2.3",
|
|
1231
|
+
ngImport: i0,
|
|
1232
|
+
type: CmatColorPickerComponent,
|
|
1233
|
+
deps: [],
|
|
1234
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
1235
|
+
});
|
|
1236
|
+
}
|
|
1237
|
+
static {
|
|
1238
|
+
this.ɵcmp = i0.ɵɵngDeclareComponent({
|
|
1239
|
+
minVersion: "17.0.0",
|
|
1240
|
+
version: "22.2.3",
|
|
1241
|
+
type: CmatColorPickerComponent,
|
|
1242
|
+
isStandalone: true,
|
|
1243
|
+
selector: "cmat-color-picker",
|
|
1244
|
+
inputs: {
|
|
1245
|
+
format: {
|
|
1246
|
+
classPropertyName: "format",
|
|
1247
|
+
publicName: "format",
|
|
1248
|
+
isSignal: true,
|
|
1249
|
+
isRequired: false,
|
|
1250
|
+
transformFunction: null
|
|
1251
|
+
},
|
|
1252
|
+
value: {
|
|
1253
|
+
classPropertyName: "value",
|
|
1254
|
+
publicName: "value",
|
|
1255
|
+
isSignal: true,
|
|
1256
|
+
isRequired: false,
|
|
1257
|
+
transformFunction: null
|
|
1258
|
+
},
|
|
1259
|
+
hideAlpha: {
|
|
1260
|
+
classPropertyName: "hideAlpha",
|
|
1261
|
+
publicName: "hideAlpha",
|
|
1262
|
+
isSignal: true,
|
|
1263
|
+
isRequired: false,
|
|
1264
|
+
transformFunction: null
|
|
1265
|
+
},
|
|
1266
|
+
disabled: {
|
|
1267
|
+
classPropertyName: "disabled",
|
|
1268
|
+
publicName: "disabled",
|
|
1269
|
+
isSignal: true,
|
|
1270
|
+
isRequired: false,
|
|
1271
|
+
transformFunction: null
|
|
1272
|
+
}
|
|
1273
|
+
},
|
|
1274
|
+
outputs: {
|
|
1275
|
+
format: "formatChange",
|
|
1276
|
+
value: "valueChange",
|
|
1277
|
+
disabled: "disabledChange",
|
|
1278
|
+
formatChanged: "formatChanged",
|
|
1279
|
+
valueChanged: "valueChanged",
|
|
1280
|
+
colorChanged: "colorChanged"
|
|
1281
|
+
},
|
|
1282
|
+
host: { classAttribute: "cmat-color-picker" },
|
|
1283
|
+
providers: [{
|
|
1284
|
+
provide: NG_VALUE_ACCESSOR,
|
|
1285
|
+
useExisting: forwardRef(() => CmatColorPickerComponent),
|
|
1286
|
+
multi: true
|
|
1287
|
+
}],
|
|
1288
|
+
ngImport: i0,
|
|
1289
|
+
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>",
|
|
1290
|
+
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"],
|
|
1291
|
+
dependencies: [
|
|
1292
|
+
{
|
|
1293
|
+
kind: "component",
|
|
1294
|
+
type: CmatColorSaturationPicker,
|
|
1295
|
+
selector: "cmat-color-saturation-picker",
|
|
1296
|
+
inputs: ["color"],
|
|
1297
|
+
outputs: ["change"]
|
|
1298
|
+
},
|
|
1299
|
+
{
|
|
1300
|
+
kind: "component",
|
|
1301
|
+
type: CmatColorHueSlider,
|
|
1302
|
+
selector: "cmat-color-hue-slider",
|
|
1303
|
+
inputs: ["color", "direction"],
|
|
1304
|
+
outputs: ["change"]
|
|
1305
|
+
},
|
|
1306
|
+
{
|
|
1307
|
+
kind: "component",
|
|
1308
|
+
type: CmatColorAlphaSlider,
|
|
1309
|
+
selector: "cmat-color-alpha-slider",
|
|
1310
|
+
inputs: ["color", "direction"],
|
|
1311
|
+
outputs: ["change"]
|
|
1312
|
+
},
|
|
1313
|
+
{
|
|
1314
|
+
kind: "component",
|
|
1315
|
+
type: CmatColorInputFields,
|
|
1316
|
+
selector: "cmat-color-input-fields",
|
|
1317
|
+
inputs: [
|
|
1318
|
+
"color",
|
|
1319
|
+
"format",
|
|
1320
|
+
"hideAlpha"
|
|
1321
|
+
],
|
|
1322
|
+
outputs: [
|
|
1323
|
+
"formatChange",
|
|
1324
|
+
"formatChanged",
|
|
1325
|
+
"valueChange"
|
|
1326
|
+
]
|
|
1327
|
+
},
|
|
1328
|
+
{
|
|
1329
|
+
kind: "component",
|
|
1330
|
+
type: CmatColorIconButton,
|
|
1331
|
+
selector: "cmat-color-icon-button"
|
|
1332
|
+
},
|
|
1333
|
+
{
|
|
1334
|
+
kind: "directive",
|
|
1335
|
+
type: NgStyle,
|
|
1336
|
+
selector: "[ngStyle]",
|
|
1337
|
+
inputs: ["ngStyle"]
|
|
1338
|
+
}
|
|
1339
|
+
],
|
|
1340
|
+
changeDetection: i0.ChangeDetectionStrategy.OnPush,
|
|
1341
|
+
encapsulation: i0.ViewEncapsulation.None
|
|
1342
|
+
});
|
|
1343
|
+
}
|
|
1344
|
+
};
|
|
1345
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
1346
|
+
minVersion: "12.0.0",
|
|
1347
|
+
version: "22.2.3",
|
|
1348
|
+
ngImport: i0,
|
|
1349
|
+
type: CmatColorPickerComponent,
|
|
1350
|
+
decorators: [{
|
|
1351
|
+
type: Component,
|
|
1352
|
+
args: [{
|
|
1353
|
+
selector: "cmat-color-picker",
|
|
1354
|
+
imports: [
|
|
1355
|
+
CmatColorSaturationPicker,
|
|
1356
|
+
CmatColorHueSlider,
|
|
1357
|
+
CmatColorAlphaSlider,
|
|
1358
|
+
CmatColorInputFields,
|
|
1359
|
+
CmatColorIconButton,
|
|
1360
|
+
NgStyle
|
|
1361
|
+
],
|
|
1362
|
+
host: { class: "cmat-color-picker" },
|
|
1363
|
+
encapsulation: ViewEncapsulation.None,
|
|
1364
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
1365
|
+
providers: [{
|
|
1366
|
+
provide: NG_VALUE_ACCESSOR,
|
|
1367
|
+
useExisting: forwardRef(() => CmatColorPickerComponent),
|
|
1368
|
+
multi: true
|
|
1369
|
+
}],
|
|
1370
|
+
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>",
|
|
1371
|
+
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"]
|
|
1372
|
+
}]
|
|
1373
|
+
}],
|
|
1374
|
+
ctorParameters: () => [],
|
|
1375
|
+
propDecorators: {
|
|
1376
|
+
format: [{
|
|
1377
|
+
type: i0.Input,
|
|
1378
|
+
args: [{
|
|
1379
|
+
isSignal: true,
|
|
1380
|
+
alias: "format",
|
|
1381
|
+
required: false
|
|
1382
|
+
}]
|
|
1383
|
+
}, {
|
|
1384
|
+
type: i0.Output,
|
|
1385
|
+
args: ["formatChange"]
|
|
1386
|
+
}],
|
|
1387
|
+
value: [{
|
|
1388
|
+
type: i0.Input,
|
|
1389
|
+
args: [{
|
|
1390
|
+
isSignal: true,
|
|
1391
|
+
alias: "value",
|
|
1392
|
+
required: false
|
|
1393
|
+
}]
|
|
1394
|
+
}, {
|
|
1395
|
+
type: i0.Output,
|
|
1396
|
+
args: ["valueChange"]
|
|
1397
|
+
}],
|
|
1398
|
+
hideAlpha: [{
|
|
1399
|
+
type: i0.Input,
|
|
1400
|
+
args: [{
|
|
1401
|
+
isSignal: true,
|
|
1402
|
+
alias: "hideAlpha",
|
|
1403
|
+
required: false
|
|
1404
|
+
}]
|
|
1405
|
+
}],
|
|
1406
|
+
disabled: [{
|
|
1407
|
+
type: i0.Input,
|
|
1408
|
+
args: [{
|
|
1409
|
+
isSignal: true,
|
|
1410
|
+
alias: "disabled",
|
|
1411
|
+
required: false
|
|
1412
|
+
}]
|
|
1413
|
+
}, {
|
|
1414
|
+
type: i0.Output,
|
|
1415
|
+
args: ["disabledChange"]
|
|
1416
|
+
}],
|
|
1417
|
+
formatChanged: [{
|
|
1418
|
+
type: i0.Output,
|
|
1419
|
+
args: ["formatChanged"]
|
|
1420
|
+
}],
|
|
1421
|
+
valueChanged: [{
|
|
1422
|
+
type: i0.Output,
|
|
1423
|
+
args: ["valueChanged"]
|
|
1424
|
+
}],
|
|
1425
|
+
colorChanged: [{
|
|
1426
|
+
type: i0.Output,
|
|
1427
|
+
args: ["colorChanged"]
|
|
1428
|
+
}]
|
|
1429
|
+
}
|
|
1430
|
+
});
|
|
1431
|
+
var CmatColorPickerButtonComponent = class CmatColorPickerButtonComponent {
|
|
1432
|
+
constructor() {
|
|
1433
|
+
this.format = model("hex", ...ngDevMode ? [{ debugName: "format" }] : /* istanbul ignore next */ []);
|
|
1434
|
+
this.value = model("#000", ...ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []);
|
|
1435
|
+
this.hideAlpha = input(false, ...ngDevMode ? [{ debugName: "hideAlpha" }] : /* istanbul ignore next */ []);
|
|
1436
|
+
this.disabled = model(false, ...ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []);
|
|
1437
|
+
this.placeholder = input("请输入", ...ngDevMode ? [{ debugName: "placeholder" }] : /* istanbul ignore next */ []);
|
|
1438
|
+
this.label = input("颜色", ...ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []);
|
|
1439
|
+
this.formatChanged = output();
|
|
1440
|
+
this.valueChanged = output();
|
|
1441
|
+
this.colorChanged = output();
|
|
1442
|
+
this.isOpen = signal(false, ...ngDevMode ? [{ debugName: "isOpen" }] : /* istanbul ignore next */ []);
|
|
1443
|
+
}
|
|
1444
|
+
toggleMenu() {
|
|
1445
|
+
this.isOpen.update((v) => !v);
|
|
1446
|
+
}
|
|
1447
|
+
closeMenu() {
|
|
1448
|
+
this.isOpen.set(false);
|
|
1449
|
+
}
|
|
1450
|
+
static {
|
|
1451
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
1452
|
+
minVersion: "12.0.0",
|
|
1453
|
+
version: "22.2.3",
|
|
1454
|
+
ngImport: i0,
|
|
1455
|
+
type: CmatColorPickerButtonComponent,
|
|
1456
|
+
deps: [],
|
|
1457
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
1458
|
+
});
|
|
1459
|
+
}
|
|
1460
|
+
static {
|
|
1461
|
+
this.ɵcmp = i0.ɵɵngDeclareComponent({
|
|
1462
|
+
minVersion: "17.1.0",
|
|
1463
|
+
version: "22.2.3",
|
|
1464
|
+
type: CmatColorPickerButtonComponent,
|
|
1465
|
+
isStandalone: true,
|
|
1466
|
+
selector: "cmat-color-picker-button",
|
|
1467
|
+
inputs: {
|
|
1468
|
+
format: {
|
|
1469
|
+
classPropertyName: "format",
|
|
1470
|
+
publicName: "format",
|
|
1471
|
+
isSignal: true,
|
|
1472
|
+
isRequired: false,
|
|
1473
|
+
transformFunction: null
|
|
1474
|
+
},
|
|
1475
|
+
value: {
|
|
1476
|
+
classPropertyName: "value",
|
|
1477
|
+
publicName: "value",
|
|
1478
|
+
isSignal: true,
|
|
1479
|
+
isRequired: false,
|
|
1480
|
+
transformFunction: null
|
|
1481
|
+
},
|
|
1482
|
+
hideAlpha: {
|
|
1483
|
+
classPropertyName: "hideAlpha",
|
|
1484
|
+
publicName: "hideAlpha",
|
|
1485
|
+
isSignal: true,
|
|
1486
|
+
isRequired: false,
|
|
1487
|
+
transformFunction: null
|
|
1488
|
+
},
|
|
1489
|
+
disabled: {
|
|
1490
|
+
classPropertyName: "disabled",
|
|
1491
|
+
publicName: "disabled",
|
|
1492
|
+
isSignal: true,
|
|
1493
|
+
isRequired: false,
|
|
1494
|
+
transformFunction: null
|
|
1495
|
+
},
|
|
1496
|
+
placeholder: {
|
|
1497
|
+
classPropertyName: "placeholder",
|
|
1498
|
+
publicName: "placeholder",
|
|
1499
|
+
isSignal: true,
|
|
1500
|
+
isRequired: false,
|
|
1501
|
+
transformFunction: null
|
|
1502
|
+
},
|
|
1503
|
+
label: {
|
|
1504
|
+
classPropertyName: "label",
|
|
1505
|
+
publicName: "label",
|
|
1506
|
+
isSignal: true,
|
|
1507
|
+
isRequired: false,
|
|
1508
|
+
transformFunction: null
|
|
1509
|
+
}
|
|
1510
|
+
},
|
|
1511
|
+
outputs: {
|
|
1512
|
+
format: "formatChange",
|
|
1513
|
+
value: "valueChange",
|
|
1514
|
+
disabled: "disabledChange",
|
|
1515
|
+
formatChanged: "formatChanged",
|
|
1516
|
+
valueChanged: "valueChanged",
|
|
1517
|
+
colorChanged: "colorChanged"
|
|
1518
|
+
},
|
|
1519
|
+
ngImport: i0,
|
|
1520
|
+
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>",
|
|
1521
|
+
styles: ["cmat-color-picker-button{--cmat-prefix-label-offset: 20px}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"],
|
|
1522
|
+
dependencies: [
|
|
1523
|
+
{
|
|
1524
|
+
kind: "ngmodule",
|
|
1525
|
+
type: FormsModule
|
|
1526
|
+
},
|
|
1527
|
+
{
|
|
1528
|
+
kind: "directive",
|
|
1529
|
+
type: i1.DefaultValueAccessor,
|
|
1530
|
+
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]"
|
|
1531
|
+
},
|
|
1532
|
+
{
|
|
1533
|
+
kind: "directive",
|
|
1534
|
+
type: i1.NgControlStatus,
|
|
1535
|
+
selector: "[formControlName],[ngModel],[formControl]"
|
|
1536
|
+
},
|
|
1537
|
+
{
|
|
1538
|
+
kind: "directive",
|
|
1539
|
+
type: i1.NgModel,
|
|
1540
|
+
selector: "[ngModel]:not([formControlName]):not([formControl])",
|
|
1541
|
+
inputs: [
|
|
1542
|
+
"name",
|
|
1543
|
+
"disabled",
|
|
1544
|
+
"ngModel",
|
|
1545
|
+
"ngModelOptions"
|
|
1546
|
+
],
|
|
1547
|
+
outputs: ["ngModelChange"],
|
|
1548
|
+
exportAs: ["ngModel"]
|
|
1549
|
+
},
|
|
1550
|
+
{
|
|
1551
|
+
kind: "component",
|
|
1552
|
+
type: CmatColorPickerComponent,
|
|
1553
|
+
selector: "cmat-color-picker",
|
|
1554
|
+
inputs: [
|
|
1555
|
+
"format",
|
|
1556
|
+
"value",
|
|
1557
|
+
"hideAlpha",
|
|
1558
|
+
"disabled"
|
|
1559
|
+
],
|
|
1560
|
+
outputs: [
|
|
1561
|
+
"formatChange",
|
|
1562
|
+
"valueChange",
|
|
1563
|
+
"disabledChange",
|
|
1564
|
+
"formatChanged",
|
|
1565
|
+
"valueChanged",
|
|
1566
|
+
"colorChanged"
|
|
1567
|
+
]
|
|
1568
|
+
},
|
|
1569
|
+
{
|
|
1570
|
+
kind: "directive",
|
|
1571
|
+
type: CdkConnectedOverlay,
|
|
1572
|
+
selector: "[cdk-connected-overlay], [connected-overlay], [cdkConnectedOverlay]",
|
|
1573
|
+
inputs: [
|
|
1574
|
+
"cdkConnectedOverlayOrigin",
|
|
1575
|
+
"cdkConnectedOverlayPositions",
|
|
1576
|
+
"cdkConnectedOverlayPositionStrategy",
|
|
1577
|
+
"cdkConnectedOverlayOffsetX",
|
|
1578
|
+
"cdkConnectedOverlayOffsetY",
|
|
1579
|
+
"cdkConnectedOverlayWidth",
|
|
1580
|
+
"cdkConnectedOverlayHeight",
|
|
1581
|
+
"cdkConnectedOverlayMinWidth",
|
|
1582
|
+
"cdkConnectedOverlayMinHeight",
|
|
1583
|
+
"cdkConnectedOverlayBackdropClass",
|
|
1584
|
+
"cdkConnectedOverlayPanelClass",
|
|
1585
|
+
"cdkConnectedOverlayViewportMargin",
|
|
1586
|
+
"cdkConnectedOverlayScrollStrategy",
|
|
1587
|
+
"cdkConnectedOverlayOpen",
|
|
1588
|
+
"cdkConnectedOverlayDisableClose",
|
|
1589
|
+
"cdkConnectedOverlayTransformOriginOn",
|
|
1590
|
+
"cdkConnectedOverlayHasBackdrop",
|
|
1591
|
+
"cdkConnectedOverlayLockPosition",
|
|
1592
|
+
"cdkConnectedOverlayFlexibleDimensions",
|
|
1593
|
+
"cdkConnectedOverlayGrowAfterOpen",
|
|
1594
|
+
"cdkConnectedOverlayPush",
|
|
1595
|
+
"cdkConnectedOverlayDisposeOnNavigation",
|
|
1596
|
+
"cdkConnectedOverlayUsePopover",
|
|
1597
|
+
"cdkConnectedOverlayMatchWidth",
|
|
1598
|
+
"cdkConnectedOverlay"
|
|
1599
|
+
],
|
|
1600
|
+
outputs: [
|
|
1601
|
+
"backdropClick",
|
|
1602
|
+
"positionChange",
|
|
1603
|
+
"attach",
|
|
1604
|
+
"detach",
|
|
1605
|
+
"overlayKeydown",
|
|
1606
|
+
"overlayOutsideClick"
|
|
1607
|
+
],
|
|
1608
|
+
exportAs: ["cdkConnectedOverlay"]
|
|
1609
|
+
},
|
|
1610
|
+
{
|
|
1611
|
+
kind: "directive",
|
|
1612
|
+
type: CdkOverlayOrigin,
|
|
1613
|
+
selector: "[cdk-overlay-origin], [overlay-origin], [cdkOverlayOrigin]",
|
|
1614
|
+
exportAs: ["cdkOverlayOrigin"]
|
|
1615
|
+
},
|
|
1616
|
+
{
|
|
1617
|
+
kind: "ngmodule",
|
|
1618
|
+
type: MatInputModule
|
|
1619
|
+
},
|
|
1620
|
+
{
|
|
1621
|
+
kind: "directive",
|
|
1622
|
+
type: i2.MatInput,
|
|
1623
|
+
selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]",
|
|
1624
|
+
inputs: [
|
|
1625
|
+
"disabled",
|
|
1626
|
+
"id",
|
|
1627
|
+
"placeholder",
|
|
1628
|
+
"name",
|
|
1629
|
+
"required",
|
|
1630
|
+
"type",
|
|
1631
|
+
"errorStateMatcher",
|
|
1632
|
+
"aria-describedby",
|
|
1633
|
+
"value",
|
|
1634
|
+
"readonly",
|
|
1635
|
+
"disabledInteractive"
|
|
1636
|
+
],
|
|
1637
|
+
exportAs: ["matInput"]
|
|
1638
|
+
},
|
|
1639
|
+
{
|
|
1640
|
+
kind: "component",
|
|
1641
|
+
type: i2.MatFormField,
|
|
1642
|
+
selector: "mat-form-field",
|
|
1643
|
+
inputs: [
|
|
1644
|
+
"hideRequiredMarker",
|
|
1645
|
+
"color",
|
|
1646
|
+
"floatLabel",
|
|
1647
|
+
"appearance",
|
|
1648
|
+
"subscriptSizing",
|
|
1649
|
+
"hintLabel"
|
|
1650
|
+
],
|
|
1651
|
+
exportAs: ["matFormField"]
|
|
1652
|
+
},
|
|
1653
|
+
{
|
|
1654
|
+
kind: "directive",
|
|
1655
|
+
type: i2.MatLabel,
|
|
1656
|
+
selector: "mat-label"
|
|
1657
|
+
},
|
|
1658
|
+
{
|
|
1659
|
+
kind: "directive",
|
|
1660
|
+
type: i2.MatPrefix,
|
|
1661
|
+
selector: "[matPrefix], [matIconPrefix], [matTextPrefix]",
|
|
1662
|
+
inputs: ["matTextPrefix"]
|
|
1663
|
+
},
|
|
1664
|
+
{
|
|
1665
|
+
kind: "ngmodule",
|
|
1666
|
+
type: ReactiveFormsModule
|
|
1667
|
+
},
|
|
1668
|
+
{
|
|
1669
|
+
kind: "directive",
|
|
1670
|
+
type: NgClass,
|
|
1671
|
+
selector: "[ngClass]",
|
|
1672
|
+
inputs: ["class", "ngClass"]
|
|
1673
|
+
}
|
|
1674
|
+
],
|
|
1675
|
+
changeDetection: i0.ChangeDetectionStrategy.OnPush,
|
|
1676
|
+
encapsulation: i0.ViewEncapsulation.None
|
|
1677
|
+
});
|
|
1678
|
+
}
|
|
1679
|
+
};
|
|
1680
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
1681
|
+
minVersion: "12.0.0",
|
|
1682
|
+
version: "22.2.3",
|
|
1683
|
+
ngImport: i0,
|
|
1684
|
+
type: CmatColorPickerButtonComponent,
|
|
1685
|
+
decorators: [{
|
|
1686
|
+
type: Component,
|
|
1687
|
+
args: [{
|
|
1688
|
+
selector: "cmat-color-picker-button",
|
|
1689
|
+
imports: [
|
|
1690
|
+
FormsModule,
|
|
1691
|
+
CmatColorPickerComponent,
|
|
1692
|
+
CdkConnectedOverlay,
|
|
1693
|
+
CdkOverlayOrigin,
|
|
1694
|
+
MatInputModule,
|
|
1695
|
+
ReactiveFormsModule,
|
|
1696
|
+
NgClass
|
|
1697
|
+
],
|
|
1698
|
+
encapsulation: ViewEncapsulation.None,
|
|
1699
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
1700
|
+
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>",
|
|
1701
|
+
styles: ["cmat-color-picker-button{--cmat-prefix-label-offset: 20px}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"]
|
|
1702
|
+
}]
|
|
1703
|
+
}],
|
|
1704
|
+
propDecorators: {
|
|
1705
|
+
format: [{
|
|
1706
|
+
type: i0.Input,
|
|
1707
|
+
args: [{
|
|
1708
|
+
isSignal: true,
|
|
1709
|
+
alias: "format",
|
|
1710
|
+
required: false
|
|
1711
|
+
}]
|
|
1712
|
+
}, {
|
|
1713
|
+
type: i0.Output,
|
|
1714
|
+
args: ["formatChange"]
|
|
1715
|
+
}],
|
|
1716
|
+
value: [{
|
|
1717
|
+
type: i0.Input,
|
|
1718
|
+
args: [{
|
|
1719
|
+
isSignal: true,
|
|
1720
|
+
alias: "value",
|
|
1721
|
+
required: false
|
|
1722
|
+
}]
|
|
1723
|
+
}, {
|
|
1724
|
+
type: i0.Output,
|
|
1725
|
+
args: ["valueChange"]
|
|
1726
|
+
}],
|
|
1727
|
+
hideAlpha: [{
|
|
1728
|
+
type: i0.Input,
|
|
1729
|
+
args: [{
|
|
1730
|
+
isSignal: true,
|
|
1731
|
+
alias: "hideAlpha",
|
|
1732
|
+
required: false
|
|
1733
|
+
}]
|
|
1734
|
+
}],
|
|
1735
|
+
disabled: [{
|
|
1736
|
+
type: i0.Input,
|
|
1737
|
+
args: [{
|
|
1738
|
+
isSignal: true,
|
|
1739
|
+
alias: "disabled",
|
|
1740
|
+
required: false
|
|
1741
|
+
}]
|
|
1742
|
+
}, {
|
|
1743
|
+
type: i0.Output,
|
|
1744
|
+
args: ["disabledChange"]
|
|
1745
|
+
}],
|
|
1746
|
+
placeholder: [{
|
|
1747
|
+
type: i0.Input,
|
|
1748
|
+
args: [{
|
|
1749
|
+
isSignal: true,
|
|
1750
|
+
alias: "placeholder",
|
|
1751
|
+
required: false
|
|
1752
|
+
}]
|
|
1753
|
+
}],
|
|
1754
|
+
label: [{
|
|
1755
|
+
type: i0.Input,
|
|
1756
|
+
args: [{
|
|
1757
|
+
isSignal: true,
|
|
1758
|
+
alias: "label",
|
|
1759
|
+
required: false
|
|
1760
|
+
}]
|
|
1761
|
+
}],
|
|
1762
|
+
formatChanged: [{
|
|
1763
|
+
type: i0.Output,
|
|
1764
|
+
args: ["formatChanged"]
|
|
1765
|
+
}],
|
|
1766
|
+
valueChanged: [{
|
|
1767
|
+
type: i0.Output,
|
|
1768
|
+
args: ["valueChanged"]
|
|
1769
|
+
}],
|
|
1770
|
+
colorChanged: [{
|
|
1771
|
+
type: i0.Output,
|
|
1772
|
+
args: ["colorChanged"]
|
|
1773
|
+
}]
|
|
1774
|
+
}
|
|
1775
|
+
});
|
|
840
1776
|
export { CmatColorAlphaSlider, CmatColorCoordinates, CmatColorHueSlider, CmatColorIconButton, CmatColorInputField, CmatColorInputFields, CmatColorPickerButtonComponent, CmatColorPickerComponent, CmatColorSaturationPicker, hslToHsv, hsvToHsl, isValidHex, parseColor, simpleCheckForValidColor, toHslString, toHsvString };
|
|
841
|
-
|
|
1777
|
+
|
|
1778
|
+
//# sourceMappingURL=cmat-components-color-picker.mjs.map
|