@severfam/angular-color-picker 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,121 @@
1
+ # Angular Color Picker
2
+
3
+ Angular-компонент палитры цветов с выбором оттенка и насыщенности. Рендерится на Canvas, автоматически масштабируется и пересчитывает размеры при изменении контейнера.
4
+
5
+ ## Установка
6
+
7
+ ```bash
8
+ npm install color-picker
9
+ ```
10
+
11
+ ## Требования
12
+
13
+ - Angular 21.2+
14
+ - Используется `OnPush` change detection
15
+
16
+ ## Использование
17
+
18
+ ### 1. Импорт
19
+
20
+ Компонент standalone, импортируйте напрямую в `imports` вашего компонента:
21
+
22
+ ```typescript
23
+ import { Component } from '@angular/core';
24
+ import { ColorPicker } from 'color-picker';
25
+
26
+ @Component({
27
+ selector: 'app-root',
28
+ imports: [ColorPicker],
29
+ template: `
30
+ <lib-color-picker
31
+ [inColor]="color"
32
+ (changeModel)="onColorChange($event)"
33
+ />
34
+ `,
35
+ })
36
+ export class AppComponent {
37
+ color = '#2889e9';
38
+
39
+ onColorChange(color: string | null) {
40
+ this.color = color;
41
+ }
42
+ }
43
+ ```
44
+
45
+ ## API
46
+
47
+ ### Inputs
48
+
49
+ | Input | Тип | Дефолт | Описание |
50
+ |-------|-----|--------|----------|
51
+ | `inColor` | `string \| null` | — | Текущий цвет (hex). Поддерживает `#RGB` и `#RRGGBB`. |
52
+ | `colorDefault` | `string` | `'#000000'` | Цвет по умолчанию, если `hasTransparent = false` и цвет не выбран. |
53
+ | `hasTransparent` | `boolean` | `true` | Показывать ли кнопку «без цвета» (прозрачный). |
54
+ | `hasEyeDropper` | `boolean` | `false` | Показывать ли иконку пипетки. |
55
+ | `eyeColor` | `string \| null` | — | Цвет для превью пипетки (отдельно от выбранного). |
56
+
57
+ ### Outputs
58
+
59
+ | Output | Тип | Описание |
60
+ |--------|-----|----------|
61
+ | `changeModel` | `string \| null` | Эмитится при каждом изменении цвета (ввод в поле, выбор на палитре). |
62
+ | `changeEnd` | `void` | Эмитится при завершении выбора (отпускание кнопки мыши / пальца). |
63
+ | `startEye` | `Event` | Эмитится при клике на иконку пипетки. |
64
+
65
+ ### Селектор
66
+
67
+ ```html
68
+ <lib-color-picker></lib-color-picker>
69
+ ```
70
+
71
+ ## Примеры
72
+
73
+ ### Базовый
74
+
75
+ ```html
76
+ <lib-color-picker
77
+ [inColor]="'#ff5733'"
78
+ (changeModel)="onColorChange($event)"
79
+ />
80
+ ```
81
+
82
+ ### Без прозрачности
83
+
84
+ ```html
85
+ <lib-color-picker
86
+ [inColor]="color"
87
+ [hasTransparent]="false"
88
+ [colorDefault]="'#ffffff'"
89
+ (changeModel)="onColorChange($event)"
90
+ />
91
+ ```
92
+
93
+ ### С пипеткой
94
+
95
+ ```html
96
+ <lib-color-picker
97
+ [inColor]="color"
98
+ [hasEyeDropper]="true"
99
+ [eyeColor]="originalColor"
100
+ (changeModel)="onColorChange($event)"
101
+ (changeEnd)="saveColor()"
102
+ (startEye)="activateEyedropper()"
103
+ />
104
+ ```
105
+
106
+ ## Стили
107
+
108
+ Компонент использует SCSS. Базовые стили подключаются автоматически через `styleUrls`.
109
+
110
+ Для кастомизации переопределите CSS-переменные или стили через `::ng-deep`:
111
+
112
+ ```scss
113
+ lib-color-picker {
114
+ --color-box-border: #eaeaea;
115
+ --color-box-radius: 3px;
116
+ }
117
+ ```
118
+
119
+ ## Лицензия
120
+
121
+ MIT
@@ -0,0 +1,610 @@
1
+ import * as i0 from '@angular/core';
2
+ import { Injectable, InjectionToken, PLATFORM_ID, inject, ChangeDetectorRef, DOCUMENT, input, output, afterNextRender, effect, ElementRef, ViewChild, ChangeDetectionStrategy, Component, signal } from '@angular/core';
3
+ import * as i1 from '@angular/common';
4
+ import { isPlatformBrowser, CommonModule } from '@angular/common';
5
+ import { fromEvent, debounceTime } from 'rxjs';
6
+
7
+ class ColorBoxConvertService {
8
+ /**
9
+ * Converts an HSL color value to RGB. Conversion formula
10
+ * adapted from http://en.wikipedia.org/wiki/HSL_color_space.
11
+ * Assumes h, s, and l are contained in the set [0, 1] and
12
+ * returns r, g, and b in the set [0, 255].
13
+ *
14
+ * @param {number} h The hue
15
+ * @param {number} s The saturation
16
+ * @param {number} l The lightness
17
+ * @return {Array} The RGB representation
18
+ */
19
+ hslToRgb(h, s, l) {
20
+ const k = (n) => (n + h / 30) % 12;
21
+ const a = s * Math.min(l, 1 - l);
22
+ const f = (n) => l - a * Math.max(-1, Math.min(k(n) - 3, Math.min(9 - k(n), 1)));
23
+ return [
24
+ Math.round(255 * f(0)),
25
+ Math.round(255 * f(8)),
26
+ Math.round(255 * f(4)),
27
+ ];
28
+ }
29
+ hslToHex(h, s, l) {
30
+ let r, g, b;
31
+ if (isNaN(s)) {
32
+ s = 0;
33
+ }
34
+ if (s === 0) {
35
+ r = g = b = l; // achromatic
36
+ }
37
+ else {
38
+ const hue2rgb = (p, q, t) => {
39
+ if (t < 0)
40
+ t += 1;
41
+ if (t > 1)
42
+ t -= 1;
43
+ if (t < 1 / 6)
44
+ return p + (q - p) * 6 * t;
45
+ if (t < 1 / 2)
46
+ return q;
47
+ if (t < 2 / 3)
48
+ return p + (q - p) * (2 / 3 - t) * 6;
49
+ return p;
50
+ };
51
+ const q = l < 0.5 ? l * (1 + s) : l + s - l * s;
52
+ const p = 2 * l - q;
53
+ r = hue2rgb(p, q, h + 1 / 3);
54
+ g = hue2rgb(p, q, h);
55
+ b = hue2rgb(p, q, h - 1 / 3);
56
+ }
57
+ const toHex = (x) => {
58
+ const hex = Math.round(x * 255).toString(16);
59
+ return hex.length === 1 ? '0' + hex : hex;
60
+ };
61
+ return `#${toHex(r)}${toHex(g)}${toHex(b)}`;
62
+ }
63
+ //H = #000fff
64
+ hexToHsl(H) {
65
+ if (H === undefined) {
66
+ H = '#000000';
67
+ }
68
+ let r;
69
+ let g;
70
+ let b;
71
+ if (H.length === 4) {
72
+ r = '0x' + H[1] + H[1];
73
+ g = '0x' + H[2] + H[2];
74
+ b = '0x' + H[3] + H[3];
75
+ }
76
+ else if (H.length === 7) {
77
+ r = '0x' + H[1] + H[2];
78
+ g = '0x' + H[3] + H[4];
79
+ b = '0x' + H[5] + H[6];
80
+ }
81
+ // Then to HSL
82
+ r /= 255;
83
+ g /= 255;
84
+ b /= 255;
85
+ const cmin = Math.min(r, g, b);
86
+ const cmax = Math.max(r, g, b);
87
+ const delta = cmax - cmin;
88
+ let h = 0;
89
+ let s = 0;
90
+ let l = 0;
91
+ if (delta === 0)
92
+ h = 0;
93
+ else if (cmax === r)
94
+ h = ((g - b) / delta) % 6;
95
+ else if (cmax === g)
96
+ h = (b - r) / delta + 2;
97
+ else
98
+ h = (r - g) / delta + 4;
99
+ h = Math.round(h * 60);
100
+ if (h < 0)
101
+ h += 360;
102
+ l = (cmax + cmin) / 2;
103
+ s = delta === 0 ? 0 : delta / (1 - Math.abs(2 * l - 1));
104
+ s = +(s * 100).toFixed(1);
105
+ l = +(l * 100).toFixed(1);
106
+ return { h, s, l };
107
+ }
108
+ hexToRGB(hex = '') {
109
+ const red = parseInt(hex.substring(1, 3), 16);
110
+ const green = parseInt(hex.substring(3, 5), 16);
111
+ const blue = parseInt(hex.substring(5, 7), 16);
112
+ return [red, green, blue];
113
+ }
114
+ hexToHsv(hex) {
115
+ const rgb = this.hexToRGB(hex);
116
+ const result = this.rgbToHsv(rgb);
117
+ return result;
118
+ }
119
+ rgbToHsv([r, g, b]) {
120
+ (r /= 255), (g /= 255), (b /= 255);
121
+ const max = Math.max(r, g, b);
122
+ const min = Math.min(r, g, b);
123
+ let h = 0;
124
+ let s = 0;
125
+ const v = max;
126
+ const d = max - min;
127
+ s = max == 0 ? 0 : d / max;
128
+ if (max == min) {
129
+ h = 0; // achromatic
130
+ }
131
+ else {
132
+ switch (max) {
133
+ case r:
134
+ h = (g - b) / d + (g < b ? 6 : 0);
135
+ break;
136
+ case g:
137
+ h = (b - r) / d + 2;
138
+ break;
139
+ case b:
140
+ h = (r - g) / d + 4;
141
+ break;
142
+ }
143
+ h /= 6;
144
+ }
145
+ return [h * 360, s, v];
146
+ }
147
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.22", ngImport: i0, type: ColorBoxConvertService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
148
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.22", ngImport: i0, type: ColorBoxConvertService, providedIn: 'root' });
149
+ }
150
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.22", ngImport: i0, type: ColorBoxConvertService, decorators: [{
151
+ type: Injectable,
152
+ args: [{
153
+ providedIn: 'root',
154
+ }]
155
+ }] });
156
+
157
+ function isTouchEvent(event) {
158
+ try {
159
+ return event instanceof TouchEvent;
160
+ }
161
+ catch (e) {
162
+ return false;
163
+ }
164
+ }
165
+ function isSingleTouchEvent(event) {
166
+ return isTouchEvent(event) && event.touches.length === 1;
167
+ }
168
+ function isDoubleTouchEvent(event) {
169
+ return isTouchEvent(event) && event.touches.length === 2;
170
+ }
171
+ function getDistanceBetweenTouches(event) {
172
+ if (!isDoubleTouchEvent(event)) {
173
+ return 0;
174
+ }
175
+ const { touches } = event;
176
+ return Math.hypot(touches[0].clientX - touches[1].clientX, touches[0].clientY - touches[1].clientY);
177
+ }
178
+
179
+ function getEventRectCoords(e, { height, width, left, top }) {
180
+ let x = 0;
181
+ let y = 0;
182
+ if (e instanceof MouseEvent) {
183
+ x = e.pageX - left;
184
+ y = e.pageY - top;
185
+ }
186
+ if (isTouchEvent(e)) {
187
+ x = e.changedTouches[0].pageX - left;
188
+ y = e.changedTouches[0].pageY - top;
189
+ }
190
+ if (x > width) {
191
+ x = width;
192
+ }
193
+ if (x < 0) {
194
+ x = 0;
195
+ }
196
+ if (y > height) {
197
+ y = height;
198
+ }
199
+ if (y < 0) {
200
+ y = 0.1;
201
+ }
202
+ return { x, y };
203
+ }
204
+ function getValueStyle(element, parameter) {
205
+ const computedStyle = getComputedStyle(element);
206
+ let value;
207
+ if (parameter === 'width') {
208
+ value = (computedStyle.getPropertyValue(parameter) || '0px').match(/\d+/);
209
+ }
210
+ if (parameter === 'height') {
211
+ value = (computedStyle.getPropertyValue(parameter) || '0px').match(/\d+/);
212
+ }
213
+ if (parameter === 'left') {
214
+ value = (computedStyle.getPropertyValue(parameter) || '0px').match(/\d+/);
215
+ }
216
+ if (parameter === 'top') {
217
+ value = (computedStyle.getPropertyValue(parameter) || '0px').match(/\d+/);
218
+ }
219
+ const val = value || [];
220
+ let result = 0;
221
+ if (val[0]) {
222
+ result = +val[0];
223
+ }
224
+ return result || 0;
225
+ }
226
+ function isStartEvent(e) {
227
+ return e.type === 'mousedown' || e.type === 'touchstart';
228
+ }
229
+ function isMoveEvent(e) {
230
+ return e.type === 'mousemove' || e.type === 'touchmove';
231
+ }
232
+ function isEndEvent(e) {
233
+ return (e.type === 'mouseup' || e.type === 'touchend' || e.type === 'touchcancel');
234
+ }
235
+
236
+ class ColorBoxCanvasService {
237
+ _spectrumCanvas;
238
+ _hueCanvas;
239
+ get spectrumRect() {
240
+ return this._spectrumCanvas?.getBoundingClientRect() ?? new DOMRect();
241
+ }
242
+ get hueRect() {
243
+ return this._hueCanvas?.getBoundingClientRect() ?? new DOMRect();
244
+ }
245
+ _widthSpectrum = null;
246
+ get widthSpectrum() {
247
+ return this._widthSpectrum;
248
+ }
249
+ set widthSpectrum(value) {
250
+ this._widthSpectrum = value;
251
+ }
252
+ _heigthSpectrum = null;
253
+ get heigthSpectrum() {
254
+ return this._heigthSpectrum;
255
+ }
256
+ set heigthSpectrum(value) {
257
+ this._heigthSpectrum = value;
258
+ }
259
+ init(spectrumCanvas, hueCanvas) {
260
+ this._spectrumCanvas = spectrumCanvas;
261
+ this._hueCanvas = hueCanvas;
262
+ const spectrumWidth = getValueStyle(this._spectrumCanvas, 'width');
263
+ const spectrumHeight = getValueStyle(this._spectrumCanvas, 'height');
264
+ const hueWidth = getValueStyle(this._hueCanvas, 'width');
265
+ const hueHeight = getValueStyle(this._hueCanvas, 'height');
266
+ this._spectrumCanvas.width = spectrumWidth;
267
+ this._spectrumCanvas.height = spectrumHeight;
268
+ this._hueCanvas.width = hueWidth;
269
+ this._hueCanvas.height = hueHeight;
270
+ this._widthSpectrum = spectrumWidth;
271
+ this._heigthSpectrum = spectrumHeight;
272
+ this.createRectangleSpectrum('red', this._spectrumCanvas);
273
+ this.createHueSpectrum(this._hueCanvas);
274
+ }
275
+ createRectangleSpectrum(color, canvas) {
276
+ const context = canvas?.getContext('2d');
277
+ if (!canvas || !context) {
278
+ return;
279
+ }
280
+ context.clearRect(0, 0, canvas.width, canvas.height);
281
+ context.fillStyle = color;
282
+ context.fillRect(0, 0, canvas.width, canvas.height);
283
+ const whiteGradient = context.createLinearGradient(0, 0, canvas.width, 0);
284
+ whiteGradient.addColorStop(0, '#fff');
285
+ whiteGradient.addColorStop(1, 'transparent');
286
+ context.fillStyle = whiteGradient;
287
+ context.fillRect(0, 0, canvas.width, canvas.height);
288
+ const blackGradient = context.createLinearGradient(0, 0, 0, canvas.height);
289
+ blackGradient.addColorStop(0, 'transparent');
290
+ blackGradient.addColorStop(1, '#000');
291
+ context.fillStyle = blackGradient;
292
+ context.fillRect(0, 0, canvas.width, canvas.height);
293
+ }
294
+ createHueSpectrum(canvas) {
295
+ const context = canvas?.getContext('2d');
296
+ if (!canvas || !context) {
297
+ return;
298
+ }
299
+ const hueGradient = context.createLinearGradient(0, 0, canvas.width, 0);
300
+ hueGradient.addColorStop(0.0, 'hsl(360, 100%, 50%)');
301
+ hueGradient.addColorStop(0.17, 'hsl(61.2, 100%, 50%)');
302
+ hueGradient.addColorStop(0.33, 'hsl(118.8, 100%, 50%)');
303
+ hueGradient.addColorStop(0.5, 'hsl(180, 100%, 50%)');
304
+ hueGradient.addColorStop(0.67, 'hsl(241.2, 100%, 50%)');
305
+ hueGradient.addColorStop(0.83, 'hsl(298.8, 100%, 50%)');
306
+ hueGradient.addColorStop(1.0, 'hsl(0, 100%, 50%)');
307
+ context.fillStyle = hueGradient;
308
+ context.fillRect(0, 0, canvas.width, canvas.height);
309
+ }
310
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.22", ngImport: i0, type: ColorBoxCanvasService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
311
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.22", ngImport: i0, type: ColorBoxCanvasService });
312
+ }
313
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.22", ngImport: i0, type: ColorBoxCanvasService, decorators: [{
314
+ type: Injectable
315
+ }] });
316
+
317
+ const WINDOW = new InjectionToken('window');
318
+ /* eslint-disable @typescript-eslint/no-explicit-any */
319
+ const windowProvider = {
320
+ provide: WINDOW,
321
+ useFactory: (platformId) => {
322
+ if (isPlatformBrowser(platformId)) {
323
+ return window;
324
+ }
325
+ return {};
326
+ },
327
+ deps: [PLATFORM_ID],
328
+ };
329
+ const WINDOW_PROVIDERS = [windowProvider];
330
+
331
+ class ColorBoxComponent {
332
+ convertService = inject(ColorBoxConvertService);
333
+ canvasService = inject(ColorBoxCanvasService);
334
+ cdr = inject(ChangeDetectorRef);
335
+ window = inject(WINDOW);
336
+ document = inject(DOCUMENT);
337
+ inputColorPicker = input('#fff', ...(ngDevMode ? [{ debugName: "inputColorPicker" }] : /* istanbul ignore next */ []));
338
+ changeColor = output();
339
+ selectColor = output();
340
+ spectrumCursor;
341
+ spectrumCanvas;
342
+ hueCursor;
343
+ hueCanvas;
344
+ currentColor = '';
345
+ changeHex = '';
346
+ hue = 0;
347
+ saturation = 1;
348
+ lightness = 0.5;
349
+ red;
350
+ green;
351
+ blue;
352
+ hex;
353
+ _subs = [];
354
+ set subs(sub) {
355
+ this._subs.push(sub);
356
+ }
357
+ constructor() {
358
+ afterNextRender(() => {
359
+ this.init();
360
+ });
361
+ effect(() => {
362
+ const color = this.inputColorPicker();
363
+ if (color && color !== this.changeHex) {
364
+ this.changeHex = color;
365
+ const hsl = this.convertService.hexToHsl(this.changeHex);
366
+ this.hue = hsl.h;
367
+ this.colorToPosition(color);
368
+ }
369
+ });
370
+ }
371
+ init() {
372
+ const spectrumCanvasElement = this.spectrumCanvas?.nativeElement;
373
+ const hueCanvasElement = this.hueCanvas?.nativeElement;
374
+ this.canvasService.init(spectrumCanvasElement, hueCanvasElement);
375
+ this.createRectangleSpectrumListeners(spectrumCanvasElement);
376
+ this.createHueSpectrumListeners(hueCanvasElement);
377
+ this.colorToPosition(this.inputColorPicker());
378
+ this.subs = fromEvent(this.window, 'resize')
379
+ .pipe(debounceTime(300))
380
+ .subscribe(() => {
381
+ this.refreshColorPickerBox();
382
+ this.cdr.detectChanges();
383
+ });
384
+ }
385
+ ngOnDestroy() {
386
+ this._subs.forEach((s) => s.unsubscribe());
387
+ }
388
+ refreshColorPickerBox() {
389
+ const hsl = this.convertService.hexToHsl(this.changeHex);
390
+ this.hue = hsl.h;
391
+ this.canvasService.createRectangleSpectrum(this.getHueColor(this.hue), this.spectrumCanvas?.nativeElement);
392
+ this.refreshPositionCursors();
393
+ }
394
+ refreshPositionCursors() {
395
+ const spectrumCanvasElement = this.spectrumCanvas?.nativeElement;
396
+ const curWidth = getValueStyle(spectrumCanvasElement, 'width');
397
+ const curHeight = getValueStyle(spectrumCanvasElement, 'height');
398
+ const initWidth = this.canvasService.widthSpectrum;
399
+ const initHeight = this.canvasService.heigthSpectrum;
400
+ if (curWidth !== initWidth || curHeight !== initHeight) {
401
+ this.colorToPosition(this.changeHex);
402
+ this.canvasService.widthSpectrum = curWidth;
403
+ this.canvasService.heigthSpectrum = curHeight;
404
+ }
405
+ }
406
+ createRectangleSpectrumListeners(canvas) {
407
+ const getSpectrumColor = (e) => {
408
+ e.preventDefault();
409
+ const spectrumRect = this.canvasService.spectrumRect;
410
+ const { x, y } = getEventRectCoords(e, spectrumRect);
411
+ const xRatio = (x / spectrumRect.width) * 100;
412
+ const yRatio = (y / spectrumRect.height) * 100;
413
+ const hsvValue = 1 - yRatio / 100;
414
+ const hsvSaturation = xRatio / 100;
415
+ this.lightness = (hsvValue / 2) * (2 - hsvSaturation);
416
+ const saturationDevider = 1 - Math.abs(2 * this.lightness - 1);
417
+ this.saturation =
418
+ saturationDevider === 0 ? 0 : (hsvValue * hsvSaturation) / saturationDevider;
419
+ const color = `hsl ${this.hue} ${this.saturation} ${this.lightness}`;
420
+ this.updateSpectrumCursor(x, y);
421
+ this.setColorValues(color);
422
+ if (isStartEvent(e)) {
423
+ this.changeColorEmit(this.hex);
424
+ }
425
+ if (isMoveEvent(e)) {
426
+ this.changeColorEmit(this.hex);
427
+ }
428
+ if (isEndEvent(e)) {
429
+ this.changeColorEmit(this.hex);
430
+ this.selectColor.emit(this.hex);
431
+ }
432
+ };
433
+ canvas.addEventListener('mousedown', (e) => {
434
+ this.eventHandler(e, getSpectrumColor);
435
+ });
436
+ canvas.addEventListener('touchstart', (e) => {
437
+ this.eventHandler(e, getSpectrumColor);
438
+ });
439
+ }
440
+ createHueSpectrumListeners(canvas) {
441
+ const getHueColor = (e) => {
442
+ e.preventDefault();
443
+ const hueRect = this.canvasService.hueRect;
444
+ const { x } = getEventRectCoords(e, hueRect);
445
+ const percent = x / hueRect.width;
446
+ this.hue = 360 * percent;
447
+ const hueColor = `hsl(${this.hue} 100% 50%)`;
448
+ const color = `hsl(
449
+ ${this.hue}
450
+ ${this.saturation * 100}%
451
+ ${this.lightness * 100}%
452
+ )`;
453
+ this.canvasService.createRectangleSpectrum(hueColor, this.spectrumCanvas?.nativeElement);
454
+ this.updateHueCursor(x);
455
+ this.setColorValues(color);
456
+ if (isStartEvent(e)) {
457
+ this.changeColorEmit(this.hex);
458
+ }
459
+ if (isMoveEvent(e)) {
460
+ this.changeColorEmit(this.hex);
461
+ }
462
+ if (isEndEvent(e)) {
463
+ this.changeColorEmit(this.hex);
464
+ this.selectColor.emit(this.hex);
465
+ }
466
+ };
467
+ canvas.addEventListener('mousedown', (e) => {
468
+ this.eventHandler(e, getHueColor);
469
+ });
470
+ canvas.addEventListener('touchstart', (e) => {
471
+ this.eventHandler(e, getHueColor);
472
+ });
473
+ }
474
+ changeColorEmit(hex) {
475
+ this.changeHex = hex;
476
+ this.changeColor.emit(this.hex);
477
+ }
478
+ setColorValues(color) {
479
+ this.currentColor = color;
480
+ const [red, green, blue] = this.convertService.hslToRgb(this.hue, this.saturation, this.lightness);
481
+ this.red = red;
482
+ this.green = green;
483
+ this.blue = blue;
484
+ this.hex = this.convertService.hslToHex(this.hue / 360, this.saturation, this.lightness);
485
+ }
486
+ updateSpectrumCursor(x, y) {
487
+ if (this.spectrumCursor) {
488
+ this.spectrumCursor.nativeElement.style.left = x + 'px';
489
+ this.spectrumCursor.nativeElement.style.top = y + 'px';
490
+ }
491
+ }
492
+ updateHueCursor(x) {
493
+ if (this.hueCursor) {
494
+ this.hueCursor.nativeElement.style.left = x + 'px';
495
+ }
496
+ }
497
+ colorToPosition(hexColor) {
498
+ const spectrumRect = this.canvasService.spectrumRect;
499
+ const hueRect = this.canvasService.hueRect;
500
+ const hsl = this.convertService.hexToHsl(hexColor);
501
+ this.hue = hsl.h;
502
+ const [, hsvs, hsvv] = this.convertService.hexToHsv(hexColor);
503
+ const x = spectrumRect.width * hsvs;
504
+ const y = spectrumRect.height * (1 - hsvv);
505
+ const hueX = (this.hue / 360) * hueRect.width;
506
+ this.updateSpectrumCursor(x, y);
507
+ this.updateHueCursor(hueX);
508
+ this.canvasService.createRectangleSpectrum(this.getHueColor(this.hue), this.spectrumCanvas?.nativeElement);
509
+ }
510
+ getHueColor(h) {
511
+ return `hsl(${h} 100% 50%)`;
512
+ }
513
+ eventHandler(e, handler) {
514
+ handler(e);
515
+ if (!this.window || !this.document) {
516
+ return;
517
+ }
518
+ if (e instanceof MouseEvent) {
519
+ this.document.addEventListener('mousemove', handler);
520
+ const mouseUpEvent = (e) => {
521
+ handler(e);
522
+ this.document.removeEventListener('mousemove', handler);
523
+ this.document.removeEventListener('mouseup', mouseUpEvent);
524
+ };
525
+ this.document.addEventListener('mouseup', mouseUpEvent);
526
+ }
527
+ if (isTouchEvent(e)) {
528
+ this.document.addEventListener('touchmove', handler);
529
+ const touchUpEvent = (e) => {
530
+ handler(e);
531
+ this.document.removeEventListener('touchmove', handler);
532
+ this.document.removeEventListener('touchend', touchUpEvent);
533
+ this.document.removeEventListener('touchcancel', touchUpEvent);
534
+ };
535
+ this.document.addEventListener('touchend', touchUpEvent);
536
+ this.document.addEventListener('touchcancel', touchUpEvent);
537
+ }
538
+ }
539
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.22", ngImport: i0, type: ColorBoxComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
540
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.22", type: ColorBoxComponent, isStandalone: true, selector: "color-box", inputs: { inputColorPicker: { classPropertyName: "inputColorPicker", publicName: "inputColorPicker", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { changeColor: "changeColor", selectColor: "selectColor" }, providers: [...WINDOW_PROVIDERS, ColorBoxCanvasService], viewQueries: [{ propertyName: "spectrumCursor", first: true, predicate: ["spectrumCursor"], descendants: true, read: ElementRef }, { propertyName: "spectrumCanvas", first: true, predicate: ["spectrumCanvas"], descendants: true, read: ElementRef }, { propertyName: "hueCursor", first: true, predicate: ["hueCursor"], descendants: true, read: ElementRef }, { propertyName: "hueCanvas", first: true, predicate: ["hueCanvas"], descendants: true, read: ElementRef }], ngImport: i0, template: "<div class=\"panel\">\n <div class=\"spectrum-map\">\n <button\n id=\"spectrum-cursor\"\n class=\"color-spectrum-cursor\"\n #spectrumCursor\n ></button>\n <canvas id=\"spectrum-canvas\" #spectrumCanvas></canvas>\n </div>\n <div class=\"hue-map-wrapper\">\n <div class=\"hue-map\">\n <button id=\"hue-cursor\" class=\"color-hue-cursor\" #hueCursor></button>\n <canvas id=\"hue-canvas\" #hueCanvas></canvas>\n </div>\n <div class=\"content-fill-opacity\">\n <ng-content></ng-content>\n </div>\n </div>\n</div>\n", styles: [".panel{display:block;padding-bottom:20px}.panel .spectrum-map{border-radius:3px;cursor:pointer;height:120px;margin-bottom:15px;overflow:hidden;position:relative;width:100%}.panel .spectrum-map .color-spectrum-cursor{background:transparent;border:2px solid #fff;border-radius:100%;box-sizing:border-box;height:20px;margin-left:-10px;margin-top:-10px;box-shadow:0 0 4px #0006;padding:0;pointer-events:none;position:absolute;width:20px;z-index:2}.panel .spectrum-map #spectrum-canvas{background:#ccc;height:100%;inset:0;position:absolute;width:100%}.panel .hue-map{cursor:pointer;height:10px;position:relative;width:100%}.panel .hue-map .color-hue-cursor{background:transparent;border:2px solid #fff;border-radius:100%;box-sizing:border-box;box-shadow:0 0 4px #0006;height:20px;margin-left:-10px;padding:0;pointer-events:none;position:absolute;top:0;width:20px;z-index:2}.panel .hue-map #hue-canvas{background:#ccc;border-radius:8px;height:100%;width:100%}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
541
+ }
542
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.22", ngImport: i0, type: ColorBoxComponent, decorators: [{
543
+ type: Component,
544
+ args: [{ selector: 'color-box', changeDetection: ChangeDetectionStrategy.OnPush, providers: [...WINDOW_PROVIDERS, ColorBoxCanvasService], standalone: true, template: "<div class=\"panel\">\n <div class=\"spectrum-map\">\n <button\n id=\"spectrum-cursor\"\n class=\"color-spectrum-cursor\"\n #spectrumCursor\n ></button>\n <canvas id=\"spectrum-canvas\" #spectrumCanvas></canvas>\n </div>\n <div class=\"hue-map-wrapper\">\n <div class=\"hue-map\">\n <button id=\"hue-cursor\" class=\"color-hue-cursor\" #hueCursor></button>\n <canvas id=\"hue-canvas\" #hueCanvas></canvas>\n </div>\n <div class=\"content-fill-opacity\">\n <ng-content></ng-content>\n </div>\n </div>\n</div>\n", styles: [".panel{display:block;padding-bottom:20px}.panel .spectrum-map{border-radius:3px;cursor:pointer;height:120px;margin-bottom:15px;overflow:hidden;position:relative;width:100%}.panel .spectrum-map .color-spectrum-cursor{background:transparent;border:2px solid #fff;border-radius:100%;box-sizing:border-box;height:20px;margin-left:-10px;margin-top:-10px;box-shadow:0 0 4px #0006;padding:0;pointer-events:none;position:absolute;width:20px;z-index:2}.panel .spectrum-map #spectrum-canvas{background:#ccc;height:100%;inset:0;position:absolute;width:100%}.panel .hue-map{cursor:pointer;height:10px;position:relative;width:100%}.panel .hue-map .color-hue-cursor{background:transparent;border:2px solid #fff;border-radius:100%;box-sizing:border-box;box-shadow:0 0 4px #0006;height:20px;margin-left:-10px;padding:0;pointer-events:none;position:absolute;top:0;width:20px;z-index:2}.panel .hue-map #hue-canvas{background:#ccc;border-radius:8px;height:100%;width:100%}\n"] }]
545
+ }], ctorParameters: () => [], propDecorators: { inputColorPicker: [{ type: i0.Input, args: [{ isSignal: true, alias: "inputColorPicker", required: false }] }], changeColor: [{ type: i0.Output, args: ["changeColor"] }], selectColor: [{ type: i0.Output, args: ["selectColor"] }], spectrumCursor: [{
546
+ type: ViewChild,
547
+ args: ['spectrumCursor', { static: false, read: ElementRef }]
548
+ }], spectrumCanvas: [{
549
+ type: ViewChild,
550
+ args: ['spectrumCanvas', { static: false, read: ElementRef }]
551
+ }], hueCursor: [{
552
+ type: ViewChild,
553
+ args: ['hueCursor', { static: false, read: ElementRef }]
554
+ }], hueCanvas: [{
555
+ type: ViewChild,
556
+ args: ['hueCanvas', { static: false, read: ElementRef }]
557
+ }] } });
558
+
559
+ class ColorPicker {
560
+ inColor = input.required(...(ngDevMode ? [{ debugName: "inColor" }] : /* istanbul ignore next */ []));
561
+ eyeColor = input(null, ...(ngDevMode ? [{ debugName: "eyeColor" }] : /* istanbul ignore next */ []));
562
+ hasTransparent = input(true, ...(ngDevMode ? [{ debugName: "hasTransparent" }] : /* istanbul ignore next */ []));
563
+ hasEyeDropper = input(false, ...(ngDevMode ? [{ debugName: "hasEyeDropper" }] : /* istanbul ignore next */ []));
564
+ colorDefault = input('#000000', ...(ngDevMode ? [{ debugName: "colorDefault" }] : /* istanbul ignore next */ []));
565
+ changeModel = output();
566
+ changeEnd = output();
567
+ startEye = output();
568
+ currentColor = signal(null, ...(ngDevMode ? [{ debugName: "currentColor" }] : /* istanbul ignore next */ []));
569
+ constructor() {
570
+ effect(() => {
571
+ this.currentColor.set(this.inColor());
572
+ });
573
+ }
574
+ get defaultColor() {
575
+ return this.hasTransparent() ? null : this.colorDefault();
576
+ }
577
+ get isTransparent() {
578
+ return !this.currentColor() && this.hasTransparent();
579
+ }
580
+ changeInput(event) {
581
+ const color = event.target.value;
582
+ this.selectColor(color);
583
+ }
584
+ changeColor(color) {
585
+ this.currentColor.set(color);
586
+ this.changeModel.emit(color);
587
+ }
588
+ selectColor(color) {
589
+ this.currentColor.set(color || this.defaultColor);
590
+ this.changeModel.emit(color);
591
+ this.changeEnd.emit();
592
+ }
593
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.22", ngImport: i0, type: ColorPicker, deps: [], target: i0.ɵɵFactoryTarget.Component });
594
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.22", type: ColorPicker, isStandalone: true, selector: "lib-color-picker", inputs: { inColor: { classPropertyName: "inColor", publicName: "inColor", isSignal: true, isRequired: true, transformFunction: null }, eyeColor: { classPropertyName: "eyeColor", publicName: "eyeColor", isSignal: true, isRequired: false, transformFunction: null }, hasTransparent: { classPropertyName: "hasTransparent", publicName: "hasTransparent", isSignal: true, isRequired: false, transformFunction: null }, hasEyeDropper: { classPropertyName: "hasEyeDropper", publicName: "hasEyeDropper", isSignal: true, isRequired: false, transformFunction: null }, colorDefault: { classPropertyName: "colorDefault", publicName: "colorDefault", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { changeModel: "changeModel", changeEnd: "changeEnd", startEye: "startEye" }, ngImport: i0, template: "<div class=\"color-box\">\r\n <div class=\"design-color-box-wrapper\">\r\n <ng-container *ngTemplateOutlet=\"colorMapTemplate\"></ng-container>\r\n </div>\r\n\r\n <div class=\"color-box__info\">\r\n @if (hasEyeDropper()) {\r\n <div class=\"color-box__picker\" (click)=\"startEye.emit($event)\">\r\n <svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\r\n <path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M20.4227 4.27425L19.7257 3.57734C18.9559 2.80755 17.7079 2.80755 16.9381 3.57734L12.7565 7.75881L12.0596 7.0619C11.6747 6.677 11.0507 6.677 10.6658 7.0619C10.2809 7.44679 10.2809 8.07083 10.6658 8.45572L11.3626 9.15255L4.39341 16.1217C4.5402 17.3687 4.0452 19.2573 3 20.3027L3.69654 21C4.74192 19.9546 6.63098 19.4596 7.87801 19.6062L14.8472 12.6371L15.5442 13.3341C15.9291 13.719 16.5532 13.719 16.9381 13.3341C17.323 12.9492 17.323 12.3252 16.9381 11.9403L16.2411 11.2434L20.4227 7.0619C21.1924 6.29211 21.1924 5.04404 20.4227 4.27425ZM12.0595 9.84946L14.1503 11.9402L7.49458 18.5958C6.82993 18.5871 6.10446 18.7017 5.41883 18.915C5.24707 18.9685 5.07418 19.0292 4.90213 19.0976C4.97048 18.9256 5.03126 18.7527 5.0847 18.5809C5.29805 17.8953 5.41264 17.1698 5.40386 16.5051L12.0595 9.84946Z\" fill=\"#3D3D3D\"/>\r\n </svg>\r\n </div>\r\n }\r\n <div class=\"color-box__wrapperline\">\r\n @if (hasTransparent()) {\r\n <div\r\n class=\"color-box__transparent\"\r\n (click)=\"selectColor(null)\"\r\n >\r\n <svg version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 32 32\">\r\n <path fill=\"currentColor\" d=\"M8 25.333c0 1.467 1.2 2.667 2.667 2.667h10.667c1.467 0 2.667-1.2 2.667-2.667v-16h-16v16zM11.28 15.84l1.88-1.88 2.84 2.827 2.827-2.827 1.88 1.88-2.827 2.827 2.827 2.827-1.88 1.88-2.827-2.827-2.827 2.827-1.88-1.88 2.827-2.827-2.84-2.827zM20.667 5.333l-1.333-1.333h-6.667l-1.333 1.333h-4.667v2.667h18.667v-2.667z\"></path>\r\n </svg>\r\n </div>\r\n }\r\n <div\r\n class=\"color-box__wrapper\"\r\n [class.color-box__wrapper-withtransparent]=\"hasTransparent()\"\r\n >\r\n @if (eyeColor() || currentColor(); as color) {\r\n <div\r\n class=\"color-box__preview\"\r\n [style.background]=\"color\"\r\n ></div>\r\n }\r\n @if (isTransparent) {\r\n <div\r\n class=\"color-box__preview color-box__preview--transparent\"\r\n ></div>\r\n }\r\n <div class=\"color-box__form-element\">\r\n <input\r\n type=\"text\"\r\n [value]=\"\r\n currentColor() ||\r\n (hasTransparent() ? '\u0411\u0435\u0437 \u0446\u0432\u0435\u0442\u0430' : colorDefault())\r\n \"\r\n class=\"color-box__input\"\r\n [class.color-box__input-trasparent]=\"isTransparent\"\r\n [attr.readonly]=\"isTransparent || null\"\r\n (change)=\"changeInput($event)\"\r\n pattern=\"^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$\"\r\n maxlength=\"7\"\r\n />\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n</div>\r\n\r\n<ng-template #colorMapTemplate>\r\n <color-box\r\n [inputColorPicker]=\"currentColor() || colorDefault()\"\r\n (changeColor)=\"changeColor($event)\"\r\n (selectColor)=\"selectColor($event)\"\r\n >\r\n <ng-content></ng-content>\r\n </color-box>\r\n</ng-template>\r\n\r\n", styles: [".color-box{font-family:Open Sans}.color-box__wrapperline{display:flex;width:100%}.color-box__wrapper-usecolors--background-fill,.color-box__wrapper-usecolors--stroke{display:block}.color-box__transparent{display:flex;justify-content:center;align-items:center;cursor:pointer;height:37px;margin-right:4px;width:37px}.color-box__transparent:hover{background-color:#f6f6f6}.color-box__wrapper{border:1px solid #eaeaea;border-radius:3px;display:flex;overflow:hidden;width:100%}.color-box__wrapper-withtransparent{width:calc(100% - 42px)}.color-box__info{align-items:center;display:flex}.color-box__picker{cursor:pointer;display:flex;align-items:center;justify-content:center;width:37px;height:37px;margin-right:4px}.color-box__picker:hover{background-color:#f6f6f6}.color-box__preview{border-right:1px solid #e5e5e5;height:36px;width:40%}.color-box__preview--transparent{background-color:#fff;background-image:linear-gradient(45deg,#ccc 25%,transparent 25%,transparent 75%,#ccc 75%,#ccc),linear-gradient(45deg,#ccc 25%,transparent 25%,transparent 75%,#ccc 75%,#ccc);background-size:8px 8px;background-position:0 0,4px 4px}.color-box__form-element{width:60%}.color-box__input{border:0;border-bottom:1px solid #e5e5e5;font-size:15px;font-style:normal;font-weight:400;height:36px;text-align:center;text-transform:uppercase;width:100%}.color-box__input:focus{outline:0}.color-box__input-trasparent{text-transform:none}.color-box__usecolors-title{font-size:13px;font-style:normal;font-weight:400;line-height:normal;margin:15px 0}.color-box__usecolors-title--modal{font-size:13px;font-style:normal;font-weight:400;line-height:normal;margin:0 0 15px}.color-box__usecolors-wrapper{display:inline-flex;flex-wrap:wrap;gap:4px}.color-box__usecolors-wrapper--stroke{max-height:106px;overflow:auto}.color-box__usecolors-color{border:1px solid rgba(0,0,0,.1);border-radius:3px;cursor:pointer;height:32px;width:32px;min-width:32px;min-height:32px}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: ColorBoxComponent, selector: "color-box", inputs: ["inputColorPicker"], outputs: ["changeColor", "selectColor"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
595
+ }
596
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.22", ngImport: i0, type: ColorPicker, decorators: [{
597
+ type: Component,
598
+ args: [{ selector: 'lib-color-picker', imports: [CommonModule, ColorBoxComponent], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"color-box\">\r\n <div class=\"design-color-box-wrapper\">\r\n <ng-container *ngTemplateOutlet=\"colorMapTemplate\"></ng-container>\r\n </div>\r\n\r\n <div class=\"color-box__info\">\r\n @if (hasEyeDropper()) {\r\n <div class=\"color-box__picker\" (click)=\"startEye.emit($event)\">\r\n <svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\r\n <path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M20.4227 4.27425L19.7257 3.57734C18.9559 2.80755 17.7079 2.80755 16.9381 3.57734L12.7565 7.75881L12.0596 7.0619C11.6747 6.677 11.0507 6.677 10.6658 7.0619C10.2809 7.44679 10.2809 8.07083 10.6658 8.45572L11.3626 9.15255L4.39341 16.1217C4.5402 17.3687 4.0452 19.2573 3 20.3027L3.69654 21C4.74192 19.9546 6.63098 19.4596 7.87801 19.6062L14.8472 12.6371L15.5442 13.3341C15.9291 13.719 16.5532 13.719 16.9381 13.3341C17.323 12.9492 17.323 12.3252 16.9381 11.9403L16.2411 11.2434L20.4227 7.0619C21.1924 6.29211 21.1924 5.04404 20.4227 4.27425ZM12.0595 9.84946L14.1503 11.9402L7.49458 18.5958C6.82993 18.5871 6.10446 18.7017 5.41883 18.915C5.24707 18.9685 5.07418 19.0292 4.90213 19.0976C4.97048 18.9256 5.03126 18.7527 5.0847 18.5809C5.29805 17.8953 5.41264 17.1698 5.40386 16.5051L12.0595 9.84946Z\" fill=\"#3D3D3D\"/>\r\n </svg>\r\n </div>\r\n }\r\n <div class=\"color-box__wrapperline\">\r\n @if (hasTransparent()) {\r\n <div\r\n class=\"color-box__transparent\"\r\n (click)=\"selectColor(null)\"\r\n >\r\n <svg version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 32 32\">\r\n <path fill=\"currentColor\" d=\"M8 25.333c0 1.467 1.2 2.667 2.667 2.667h10.667c1.467 0 2.667-1.2 2.667-2.667v-16h-16v16zM11.28 15.84l1.88-1.88 2.84 2.827 2.827-2.827 1.88 1.88-2.827 2.827 2.827 2.827-1.88 1.88-2.827-2.827-2.827 2.827-1.88-1.88 2.827-2.827-2.84-2.827zM20.667 5.333l-1.333-1.333h-6.667l-1.333 1.333h-4.667v2.667h18.667v-2.667z\"></path>\r\n </svg>\r\n </div>\r\n }\r\n <div\r\n class=\"color-box__wrapper\"\r\n [class.color-box__wrapper-withtransparent]=\"hasTransparent()\"\r\n >\r\n @if (eyeColor() || currentColor(); as color) {\r\n <div\r\n class=\"color-box__preview\"\r\n [style.background]=\"color\"\r\n ></div>\r\n }\r\n @if (isTransparent) {\r\n <div\r\n class=\"color-box__preview color-box__preview--transparent\"\r\n ></div>\r\n }\r\n <div class=\"color-box__form-element\">\r\n <input\r\n type=\"text\"\r\n [value]=\"\r\n currentColor() ||\r\n (hasTransparent() ? '\u0411\u0435\u0437 \u0446\u0432\u0435\u0442\u0430' : colorDefault())\r\n \"\r\n class=\"color-box__input\"\r\n [class.color-box__input-trasparent]=\"isTransparent\"\r\n [attr.readonly]=\"isTransparent || null\"\r\n (change)=\"changeInput($event)\"\r\n pattern=\"^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$\"\r\n maxlength=\"7\"\r\n />\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n</div>\r\n\r\n<ng-template #colorMapTemplate>\r\n <color-box\r\n [inputColorPicker]=\"currentColor() || colorDefault()\"\r\n (changeColor)=\"changeColor($event)\"\r\n (selectColor)=\"selectColor($event)\"\r\n >\r\n <ng-content></ng-content>\r\n </color-box>\r\n</ng-template>\r\n\r\n", styles: [".color-box{font-family:Open Sans}.color-box__wrapperline{display:flex;width:100%}.color-box__wrapper-usecolors--background-fill,.color-box__wrapper-usecolors--stroke{display:block}.color-box__transparent{display:flex;justify-content:center;align-items:center;cursor:pointer;height:37px;margin-right:4px;width:37px}.color-box__transparent:hover{background-color:#f6f6f6}.color-box__wrapper{border:1px solid #eaeaea;border-radius:3px;display:flex;overflow:hidden;width:100%}.color-box__wrapper-withtransparent{width:calc(100% - 42px)}.color-box__info{align-items:center;display:flex}.color-box__picker{cursor:pointer;display:flex;align-items:center;justify-content:center;width:37px;height:37px;margin-right:4px}.color-box__picker:hover{background-color:#f6f6f6}.color-box__preview{border-right:1px solid #e5e5e5;height:36px;width:40%}.color-box__preview--transparent{background-color:#fff;background-image:linear-gradient(45deg,#ccc 25%,transparent 25%,transparent 75%,#ccc 75%,#ccc),linear-gradient(45deg,#ccc 25%,transparent 25%,transparent 75%,#ccc 75%,#ccc);background-size:8px 8px;background-position:0 0,4px 4px}.color-box__form-element{width:60%}.color-box__input{border:0;border-bottom:1px solid #e5e5e5;font-size:15px;font-style:normal;font-weight:400;height:36px;text-align:center;text-transform:uppercase;width:100%}.color-box__input:focus{outline:0}.color-box__input-trasparent{text-transform:none}.color-box__usecolors-title{font-size:13px;font-style:normal;font-weight:400;line-height:normal;margin:15px 0}.color-box__usecolors-title--modal{font-size:13px;font-style:normal;font-weight:400;line-height:normal;margin:0 0 15px}.color-box__usecolors-wrapper{display:inline-flex;flex-wrap:wrap;gap:4px}.color-box__usecolors-wrapper--stroke{max-height:106px;overflow:auto}.color-box__usecolors-color{border:1px solid rgba(0,0,0,.1);border-radius:3px;cursor:pointer;height:32px;width:32px;min-width:32px;min-height:32px}\n"] }]
599
+ }], ctorParameters: () => [], propDecorators: { inColor: [{ type: i0.Input, args: [{ isSignal: true, alias: "inColor", required: true }] }], eyeColor: [{ type: i0.Input, args: [{ isSignal: true, alias: "eyeColor", required: false }] }], hasTransparent: [{ type: i0.Input, args: [{ isSignal: true, alias: "hasTransparent", required: false }] }], hasEyeDropper: [{ type: i0.Input, args: [{ isSignal: true, alias: "hasEyeDropper", required: false }] }], colorDefault: [{ type: i0.Input, args: [{ isSignal: true, alias: "colorDefault", required: false }] }], changeModel: [{ type: i0.Output, args: ["changeModel"] }], changeEnd: [{ type: i0.Output, args: ["changeEnd"] }], startEye: [{ type: i0.Output, args: ["startEye"] }] } });
600
+
601
+ /*
602
+ * Public API Surface of color-picker
603
+ */
604
+
605
+ /**
606
+ * Generated bundle index. Do not edit.
607
+ */
608
+
609
+ export { ColorPicker };
610
+ //# sourceMappingURL=severfam-angular-color-picker.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"severfam-angular-color-picker.mjs","sources":["../../../projects/color-picker/src/lib/services/color-box-convert.service.ts","../../../projects/color-picker/src/lib/utils/touch-events.utils.ts","../../../projects/color-picker/src/lib/utils/color-box.util.ts","../../../projects/color-picker/src/lib/services/color-box-canvas.service.ts","../../../projects/color-picker/src/lib/providers/window.providers.ts","../../../projects/color-picker/src/lib/components/color-box/color-box.component.ts","../../../projects/color-picker/src/lib/components/color-box/color-box.component.html","../../../projects/color-picker/src/lib/color-picker.component.ts","../../../projects/color-picker/src/lib/color-picker.component.html","../../../projects/color-picker/src/public-api.ts","../../../projects/color-picker/src/severfam-angular-color-picker.ts"],"sourcesContent":["import { Injectable } from '@angular/core';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class ColorBoxConvertService {\n /**\n * Converts an HSL color value to RGB. Conversion formula\n * adapted from http://en.wikipedia.org/wiki/HSL_color_space.\n * Assumes h, s, and l are contained in the set [0, 1] and\n * returns r, g, and b in the set [0, 255].\n *\n * @param {number} h The hue\n * @param {number} s The saturation\n * @param {number} l The lightness\n * @return {Array} The RGB representation\n */\n\n public hslToRgb(h: number, s: number, l: number) {\n const k = (n: number) => (n + h / 30) % 12;\n const a = s * Math.min(l, 1 - l);\n const f = (n: number) =>\n l - a * Math.max(-1, Math.min(k(n) - 3, Math.min(9 - k(n), 1)));\n return [\n Math.round(255 * f(0)),\n Math.round(255 * f(8)),\n Math.round(255 * f(4)),\n ];\n }\n\n public hslToHex(h: number, s: number, l: number) {\n let r, g, b;\n\n if (isNaN(s)) {\n s = 0;\n }\n\n if (s === 0) {\n r = g = b = l; // achromatic\n } else {\n const hue2rgb = (p: number, q: number, t: number) => {\n if (t < 0) t += 1;\n if (t > 1) t -= 1;\n if (t < 1 / 6) return p + (q - p) * 6 * t;\n if (t < 1 / 2) return q;\n if (t < 2 / 3) return p + (q - p) * (2 / 3 - t) * 6;\n return p;\n };\n const q = l < 0.5 ? l * (1 + s) : l + s - l * s;\n const p = 2 * l - q;\n r = hue2rgb(p, q, h + 1 / 3);\n g = hue2rgb(p, q, h);\n b = hue2rgb(p, q, h - 1 / 3);\n }\n const toHex = (x: number) => {\n const hex = Math.round(x * 255).toString(16);\n return hex.length === 1 ? '0' + hex : hex;\n };\n\n return `#${toHex(r)}${toHex(g)}${toHex(b)}`;\n }\n //H = #000fff\n public hexToHsl(H: string) {\n if (H === undefined) {\n H = '#000000';\n }\n let r: any;\n let g: any;\n let b: any;\n if (H.length === 4) {\n r = '0x' + H[1] + H[1];\n g = '0x' + H[2] + H[2];\n b = '0x' + H[3] + H[3];\n } else if (H.length === 7) {\n r = '0x' + H[1] + H[2];\n g = '0x' + H[3] + H[4];\n b = '0x' + H[5] + H[6];\n }\n // Then to HSL\n r /= 255;\n g /= 255;\n b /= 255;\n const cmin = Math.min(r, g, b);\n const cmax = Math.max(r, g, b);\n const delta = cmax - cmin;\n let h = 0;\n let s = 0;\n let l = 0;\n\n if (delta === 0) h = 0;\n else if (cmax === r) h = ((g - b) / delta) % 6;\n else if (cmax === g) h = (b - r) / delta + 2;\n else h = (r - g) / delta + 4;\n\n h = Math.round(h * 60);\n\n if (h < 0) h += 360;\n\n l = (cmax + cmin) / 2;\n s = delta === 0 ? 0 : delta / (1 - Math.abs(2 * l - 1));\n s = +(s * 100).toFixed(1);\n l = +(l * 100).toFixed(1);\n return { h, s, l };\n }\n\n private hexToRGB(hex = '') {\n const red = parseInt(hex.substring(1, 3), 16);\n const green = parseInt(hex.substring(3, 5), 16);\n const blue = parseInt(hex.substring(5, 7), 16);\n\n return [red, green, blue];\n }\n\n public hexToHsv(hex: string) {\n const rgb = this.hexToRGB(hex);\n const result = this.rgbToHsv(rgb);\n return result;\n }\n\n private rgbToHsv([r, g, b]: number[]) {\n (r /= 255), (g /= 255), (b /= 255);\n\n const max = Math.max(r, g, b);\n const min = Math.min(r, g, b);\n let h = 0;\n let s = 0;\n const v = max;\n\n const d = max - min;\n\n s = max == 0 ? 0 : d / max;\n\n if (max == min) {\n h = 0; // achromatic\n } else {\n switch (max) {\n case r:\n h = (g - b) / d + (g < b ? 6 : 0);\n break;\n case g:\n h = (b - r) / d + 2;\n break;\n case b:\n h = (r - g) / d + 4;\n break;\n }\n\n h /= 6;\n }\n\n return [h * 360, s, v];\n }\n}\n","export function isTouchEvent(event: Event): event is TouchEvent {\n try {\n return event instanceof TouchEvent;\n } catch (e) {\n return false;\n }\n}\n\nexport function isSingleTouchEvent(event: Event): boolean {\n return isTouchEvent(event) && event.touches.length === 1;\n}\n\nexport function isDoubleTouchEvent(event: Event): boolean {\n return isTouchEvent(event) && event.touches.length === 2;\n}\n\nexport function getDistanceBetweenTouches(event: Event): number {\n if (!isDoubleTouchEvent(event)) {\n return 0;\n }\n\n const { touches } = event as TouchEvent;\n\n return Math.hypot(\n touches[0].clientX - touches[1].clientX,\n touches[0].clientY - touches[1].clientY\n );\n}\n","import { isTouchEvent } from './touch-events.utils';\n\nexport function getEventRectCoords(\n e: Event,\n { height, width, left, top }: DOMRect\n): { x: number; y: number } {\n let x = 0;\n let y = 0;\n\n if (e instanceof MouseEvent) {\n x = e.pageX - left;\n y = e.pageY - top;\n }\n\n if (isTouchEvent(e)) {\n x = e.changedTouches[0].pageX - left;\n y = e.changedTouches[0].pageY - top;\n }\n\n if (x > width) {\n x = width;\n }\n\n if (x < 0) {\n x = 0;\n }\n\n if (y > height) {\n y = height;\n }\n\n if (y < 0) {\n y = 0.1;\n }\n\n return { x, y };\n}\n\nexport function getValueStyle(\n element: Element,\n parameter: 'width' | 'height' | 'left' | 'top'\n): number {\n const computedStyle = getComputedStyle(element);\n let value;\n if (parameter === 'width') {\n value = (computedStyle.getPropertyValue(parameter) || '0px').match(/\\d+/);\n }\n\n if (parameter === 'height') {\n value = (computedStyle.getPropertyValue(parameter) || '0px').match(/\\d+/);\n }\n\n if (parameter === 'left') {\n value = (computedStyle.getPropertyValue(parameter) || '0px').match(/\\d+/);\n }\n\n if (parameter === 'top') {\n value = (computedStyle.getPropertyValue(parameter) || '0px').match(/\\d+/);\n }\n\n const val = value || [];\n let result = 0;\n if (val[0]) {\n result = +val[0];\n }\n\n return result || 0;\n}\n\nexport function isStartEvent(e: Event) {\n return e.type === 'mousedown' || e.type === 'touchstart';\n}\n\nexport function isMoveEvent(e: Event) {\n return e.type === 'mousemove' || e.type === 'touchmove';\n}\n\nexport function isEndEvent(e: Event) {\n return (\n e.type === 'mouseup' || e.type === 'touchend' || e.type === 'touchcancel'\n );\n}\n","import { Injectable } from '@angular/core';\nimport { getValueStyle } from '../utils/color-box.util';\n\n@Injectable()\nexport class ColorBoxCanvasService {\n private _spectrumCanvas?: HTMLCanvasElement;\n private _hueCanvas?: HTMLCanvasElement;\n\n get spectrumRect(): DOMRect {\n return this._spectrumCanvas?.getBoundingClientRect() ?? new DOMRect();\n }\n\n get hueRect(): DOMRect {\n return this._hueCanvas?.getBoundingClientRect() ?? new DOMRect();\n }\n\n _widthSpectrum: number | null = null;\n get widthSpectrum(): number | null {\n return this._widthSpectrum;\n }\n set widthSpectrum(value: number | null) {\n this._widthSpectrum = value;\n }\n\n _heigthSpectrum: number | null = null;\n get heigthSpectrum(): number | null {\n return this._heigthSpectrum;\n }\n set heigthSpectrum(value: number | null) {\n this._heigthSpectrum = value;\n }\n\n public init(spectrumCanvas: HTMLCanvasElement, hueCanvas: HTMLCanvasElement) {\n this._spectrumCanvas = spectrumCanvas;\n this._hueCanvas = hueCanvas;\n\n const spectrumWidth = getValueStyle(this._spectrumCanvas, 'width');\n const spectrumHeight = getValueStyle(this._spectrumCanvas, 'height');\n const hueWidth = getValueStyle(this._hueCanvas, 'width');\n const hueHeight = getValueStyle(this._hueCanvas, 'height');\n\n this._spectrumCanvas.width = spectrumWidth;\n this._spectrumCanvas.height = spectrumHeight;\n this._hueCanvas.width = hueWidth;\n this._hueCanvas.height = hueHeight;\n\n this._widthSpectrum = spectrumWidth;\n this._heigthSpectrum = spectrumHeight;\n\n this.createRectangleSpectrum('red', this._spectrumCanvas);\n this.createHueSpectrum(this._hueCanvas);\n }\n\n public createRectangleSpectrum(\n color: string,\n canvas?: HTMLCanvasElement\n ): void {\n const context = canvas?.getContext('2d');\n\n if (!canvas || !context) {\n return;\n }\n\n context.clearRect(0, 0, canvas.width, canvas.height);\n\n context.fillStyle = color;\n context.fillRect(0, 0, canvas.width, canvas.height);\n\n const whiteGradient = context.createLinearGradient(0, 0, canvas.width, 0);\n whiteGradient.addColorStop(0, '#fff');\n whiteGradient.addColorStop(1, 'transparent');\n context.fillStyle = whiteGradient;\n context.fillRect(0, 0, canvas.width, canvas.height);\n\n const blackGradient = context.createLinearGradient(0, 0, 0, canvas.height);\n blackGradient.addColorStop(0, 'transparent');\n blackGradient.addColorStop(1, '#000');\n context.fillStyle = blackGradient;\n context.fillRect(0, 0, canvas.width, canvas.height);\n }\n\n public createHueSpectrum(canvas?: HTMLCanvasElement): void {\n const context = canvas?.getContext('2d');\n\n if (!canvas || !context) {\n return;\n }\n\n const hueGradient = context.createLinearGradient(0, 0, canvas.width, 0);\n hueGradient.addColorStop(0.0, 'hsl(360, 100%, 50%)');\n hueGradient.addColorStop(0.17, 'hsl(61.2, 100%, 50%)');\n hueGradient.addColorStop(0.33, 'hsl(118.8, 100%, 50%)');\n hueGradient.addColorStop(0.5, 'hsl(180, 100%, 50%)');\n hueGradient.addColorStop(0.67, 'hsl(241.2, 100%, 50%)');\n hueGradient.addColorStop(0.83, 'hsl(298.8, 100%, 50%)');\n hueGradient.addColorStop(1.0, 'hsl(0, 100%, 50%)');\n context.fillStyle = hueGradient;\n context.fillRect(0, 0, canvas.width, canvas.height);\n }\n}\n","import { FactoryProvider, InjectionToken, PLATFORM_ID } from '@angular/core';\r\nimport { isPlatformBrowser } from '@angular/common';\r\n\r\n\r\nexport const WINDOW = new InjectionToken<Window>('window');\r\n\r\n\r\n/* eslint-disable @typescript-eslint/no-explicit-any */\r\nconst windowProvider: FactoryProvider = {\r\n provide: WINDOW,\r\n useFactory: (platformId: any) => {\r\n if (isPlatformBrowser(platformId)) {\r\n return window;\r\n }\r\n return {};\r\n },\r\n deps: [PLATFORM_ID],\r\n};\r\n\r\nexport const WINDOW_PROVIDERS = [windowProvider];\r\n","import { ColorBoxConvertService } from '../../services/color-box-convert.service';\nimport { ColorBoxCanvasService } from '../../services/color-box-canvas.service';\nimport {\n afterNextRender,\n ChangeDetectionStrategy,\n ChangeDetectorRef,\n Component,\n DOCUMENT,\n effect,\n ElementRef,\n inject,\n input,\n output,\n ViewChild,\n} from '@angular/core';\nimport { debounceTime, fromEvent, Subscription } from 'rxjs';\nimport {\n getEventRectCoords,\n getValueStyle,\n isEndEvent,\n isMoveEvent,\n isStartEvent,\n} from '../../utils/color-box.util';\nimport { WINDOW, WINDOW_PROVIDERS } from '../../providers/window.providers';\nimport { isTouchEvent } from '../../utils/touch-events.utils';\n\n\n@Component({\n selector: 'color-box',\n templateUrl: './color-box.component.html',\n styleUrls: ['./color-box.component.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n providers: [...WINDOW_PROVIDERS, ColorBoxCanvasService],\n standalone: true,\n})\nexport class ColorBoxComponent {\n private readonly convertService = inject(ColorBoxConvertService);\n private readonly canvasService = inject(ColorBoxCanvasService);\n private readonly cdr = inject(ChangeDetectorRef);\n\n private readonly window = inject(WINDOW);\n private readonly document = inject(DOCUMENT);\n\n inputColorPicker = input('#fff');\n\n changeColor = output<string>();\n selectColor = output<string>();\n\n @ViewChild('spectrumCursor', { static: false, read: ElementRef })\n spectrumCursor?: ElementRef;\n @ViewChild('spectrumCanvas', { static: false, read: ElementRef })\n spectrumCanvas?: ElementRef;\n @ViewChild('hueCursor', { static: false, read: ElementRef })\n hueCursor?: ElementRef;\n @ViewChild('hueCanvas', { static: false, read: ElementRef })\n hueCanvas?: ElementRef;\n\n currentColor = '';\n changeHex = '';\n\n hue = 0;\n saturation = 1;\n lightness = 0.5;\n\n red: unknown;\n green: unknown;\n blue: unknown;\n hex!: string;\n\n private _subs: Subscription[] = [];\n set subs(sub: Subscription) {\n this._subs.push(sub);\n }\n\n constructor() {\n afterNextRender(() => {\n this.init();\n });\n\n effect(() => {\n const color = this.inputColorPicker();\n if (color && color !== this.changeHex) {\n this.changeHex = color;\n const hsl = this.convertService.hexToHsl(this.changeHex);\n this.hue = hsl.h;\n this.colorToPosition(color);\n }\n });\n }\n\n private init(): void {\n const spectrumCanvasElement = this.spectrumCanvas?.nativeElement;\n const hueCanvasElement = this.hueCanvas?.nativeElement;\n\n this.canvasService.init(spectrumCanvasElement, hueCanvasElement);\n\n this.createRectangleSpectrumListeners(spectrumCanvasElement);\n this.createHueSpectrumListeners(hueCanvasElement);\n this.colorToPosition(this.inputColorPicker());\n\n this.subs = fromEvent(this.window, 'resize')\n .pipe(debounceTime(300))\n .subscribe(() => {\n this.refreshColorPickerBox();\n this.cdr.detectChanges();\n });\n }\n\n ngOnDestroy() {\n this._subs.forEach((s) => s.unsubscribe());\n }\n\n private refreshColorPickerBox(): void {\n const hsl = this.convertService.hexToHsl(this.changeHex);\n this.hue = hsl.h;\n this.canvasService.createRectangleSpectrum(\n this.getHueColor(this.hue),\n this.spectrumCanvas?.nativeElement,\n );\n this.refreshPositionCursors();\n }\n\n private refreshPositionCursors() {\n const spectrumCanvasElement = this.spectrumCanvas?.nativeElement;\n const curWidth = getValueStyle(spectrumCanvasElement, 'width');\n const curHeight = getValueStyle(spectrumCanvasElement, 'height');\n const initWidth = this.canvasService.widthSpectrum;\n const initHeight = this.canvasService.heigthSpectrum;\n\n if (curWidth !== initWidth || curHeight !== initHeight) {\n this.colorToPosition(this.changeHex);\n this.canvasService.widthSpectrum = curWidth;\n this.canvasService.heigthSpectrum = curHeight;\n }\n }\n\n private createRectangleSpectrumListeners(canvas: HTMLCanvasElement) {\n const getSpectrumColor = (e: MouseEvent | TouchEvent) => {\n e.preventDefault();\n\n const spectrumRect = this.canvasService.spectrumRect;\n const { x, y } = getEventRectCoords(e, spectrumRect);\n const xRatio = (x / spectrumRect.width) * 100;\n const yRatio = (y / spectrumRect.height) * 100;\n const hsvValue = 1 - yRatio / 100;\n const hsvSaturation = xRatio / 100;\n\n this.lightness = (hsvValue / 2) * (2 - hsvSaturation);\n\n const saturationDevider = 1 - Math.abs(2 * this.lightness - 1);\n this.saturation =\n saturationDevider === 0 ? 0 : (hsvValue * hsvSaturation) / saturationDevider;\n\n const color = `hsl ${this.hue} ${this.saturation} ${this.lightness}`;\n\n this.updateSpectrumCursor(x, y);\n this.setColorValues(color);\n\n if (isStartEvent(e)) {\n this.changeColorEmit(this.hex);\n }\n\n if (isMoveEvent(e)) {\n this.changeColorEmit(this.hex);\n }\n\n if (isEndEvent(e)) {\n this.changeColorEmit(this.hex);\n this.selectColor.emit(this.hex);\n }\n };\n\n canvas.addEventListener('mousedown', (e: MouseEvent) => {\n this.eventHandler(e, getSpectrumColor);\n });\n\n canvas.addEventListener('touchstart', (e: TouchEvent) => {\n this.eventHandler(e, getSpectrumColor);\n });\n }\n\n private createHueSpectrumListeners(canvas: HTMLCanvasElement) {\n const getHueColor = (e: MouseEvent | TouchEvent) => {\n e.preventDefault();\n\n const hueRect = this.canvasService.hueRect;\n const { x } = getEventRectCoords(e, hueRect);\n\n const percent = x / hueRect.width;\n this.hue = 360 * percent;\n\n const hueColor = `hsl(${this.hue} 100% 50%)`;\n const color = `hsl(\n ${this.hue}\n ${this.saturation * 100}%\n ${this.lightness * 100}%\n )`;\n\n this.canvasService.createRectangleSpectrum(hueColor, this.spectrumCanvas?.nativeElement);\n\n this.updateHueCursor(x);\n this.setColorValues(color);\n\n if (isStartEvent(e)) {\n this.changeColorEmit(this.hex);\n }\n\n if (isMoveEvent(e)) {\n this.changeColorEmit(this.hex);\n }\n\n if (isEndEvent(e)) {\n this.changeColorEmit(this.hex);\n this.selectColor.emit(this.hex);\n }\n };\n\n canvas.addEventListener('mousedown', (e: MouseEvent | TouchEvent) => {\n this.eventHandler(e, getHueColor);\n });\n\n canvas.addEventListener('touchstart', (e: TouchEvent) => {\n this.eventHandler(e, getHueColor);\n });\n }\n\n changeColorEmit(hex: string) {\n this.changeHex = hex;\n this.changeColor.emit(this.hex);\n }\n\n private setColorValues(color: string) {\n this.currentColor = color;\n\n const [red, green, blue] = this.convertService.hslToRgb(\n this.hue,\n this.saturation,\n this.lightness,\n );\n\n this.red = red;\n this.green = green;\n this.blue = blue;\n this.hex = this.convertService.hslToHex(this.hue / 360, this.saturation, this.lightness);\n }\n\n private updateSpectrumCursor(x: number, y: number): void {\n if (this.spectrumCursor) {\n this.spectrumCursor.nativeElement.style.left = x + 'px';\n this.spectrumCursor.nativeElement.style.top = y + 'px';\n }\n }\n\n private updateHueCursor(x: number): void {\n if (this.hueCursor) {\n this.hueCursor.nativeElement.style.left = x + 'px';\n }\n }\n\n private colorToPosition(hexColor: string) {\n const spectrumRect = this.canvasService.spectrumRect;\n const hueRect = this.canvasService.hueRect;\n\n const hsl = this.convertService.hexToHsl(hexColor);\n this.hue = hsl.h;\n\n const [, hsvs, hsvv] = this.convertService.hexToHsv(hexColor);\n const x = spectrumRect.width * hsvs;\n const y = spectrumRect.height * (1 - hsvv);\n const hueX = (this.hue / 360) * hueRect.width;\n\n this.updateSpectrumCursor(x, y);\n this.updateHueCursor(hueX);\n\n this.canvasService.createRectangleSpectrum(\n this.getHueColor(this.hue),\n this.spectrumCanvas?.nativeElement,\n );\n }\n\n private getHueColor(h: number): string {\n return `hsl(${h} 100% 50%)`;\n }\n\n private eventHandler(\n e: MouseEvent | TouchEvent,\n handler: (event: MouseEvent | TouchEvent) => void,\n ) {\n handler(e);\n\n if (!this.window || !this.document) {\n return;\n }\n\n if (e instanceof MouseEvent) {\n this.document.addEventListener('mousemove', handler);\n\n const mouseUpEvent = (e: MouseEvent) => {\n handler(e);\n this.document.removeEventListener('mousemove', handler);\n this.document.removeEventListener('mouseup', mouseUpEvent);\n };\n this.document.addEventListener('mouseup', mouseUpEvent);\n }\n\n if (isTouchEvent(e)) {\n this.document.addEventListener('touchmove', handler);\n\n const touchUpEvent = (e: TouchEvent) => {\n handler(e);\n this.document.removeEventListener('touchmove', handler);\n this.document.removeEventListener('touchend', touchUpEvent);\n this.document.removeEventListener('touchcancel', touchUpEvent);\n };\n this.document.addEventListener('touchend', touchUpEvent);\n this.document.addEventListener('touchcancel', touchUpEvent);\n }\n }\n}\n","<div class=\"panel\">\n <div class=\"spectrum-map\">\n <button\n id=\"spectrum-cursor\"\n class=\"color-spectrum-cursor\"\n #spectrumCursor\n ></button>\n <canvas id=\"spectrum-canvas\" #spectrumCanvas></canvas>\n </div>\n <div class=\"hue-map-wrapper\">\n <div class=\"hue-map\">\n <button id=\"hue-cursor\" class=\"color-hue-cursor\" #hueCursor></button>\n <canvas id=\"hue-canvas\" #hueCanvas></canvas>\n </div>\n <div class=\"content-fill-opacity\">\n <ng-content></ng-content>\n </div>\n </div>\n</div>\n","import {\n ChangeDetectionStrategy,\n Component,\n effect,\n input,\n output,\n signal,\n} from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { ColorBoxComponent } from './components/color-box/color-box.component';\n\n@Component({\n selector: 'lib-color-picker',\n imports: [CommonModule, ColorBoxComponent],\n templateUrl: './color-picker.component.html',\n styleUrls: ['./color-picker.component.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class ColorPicker {\n inColor = input.required<string | null>();\n eyeColor = input<string | null>(null);\n hasTransparent = input(true);\n hasEyeDropper = input(false);\n colorDefault = input('#000000');\n\n changeModel = output<string | null>();\n changeEnd = output();\n startEye = output<Event>();\n\n currentColor = signal<string | null>(null);\n\n constructor() {\n effect(() => {\n this.currentColor.set(this.inColor());\n });\n }\n\n get defaultColor(): string | null {\n return this.hasTransparent() ? null : this.colorDefault();\n }\n\n get isTransparent(): boolean {\n return !this.currentColor() && this.hasTransparent();\n }\n\n changeInput(event: Event) {\n const color = (event.target as HTMLInputElement).value;\n this.selectColor(color);\n }\n\n changeColor(color: string) {\n this.currentColor.set(color);\n this.changeModel.emit(color);\n }\n\n selectColor(color: string | null) {\n this.currentColor.set(color || this.defaultColor);\n this.changeModel.emit(color);\n this.changeEnd.emit();\n }\n}\n","<div class=\"color-box\">\r\n <div class=\"design-color-box-wrapper\">\r\n <ng-container *ngTemplateOutlet=\"colorMapTemplate\"></ng-container>\r\n </div>\r\n\r\n <div class=\"color-box__info\">\r\n @if (hasEyeDropper()) {\r\n <div class=\"color-box__picker\" (click)=\"startEye.emit($event)\">\r\n <svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\r\n <path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M20.4227 4.27425L19.7257 3.57734C18.9559 2.80755 17.7079 2.80755 16.9381 3.57734L12.7565 7.75881L12.0596 7.0619C11.6747 6.677 11.0507 6.677 10.6658 7.0619C10.2809 7.44679 10.2809 8.07083 10.6658 8.45572L11.3626 9.15255L4.39341 16.1217C4.5402 17.3687 4.0452 19.2573 3 20.3027L3.69654 21C4.74192 19.9546 6.63098 19.4596 7.87801 19.6062L14.8472 12.6371L15.5442 13.3341C15.9291 13.719 16.5532 13.719 16.9381 13.3341C17.323 12.9492 17.323 12.3252 16.9381 11.9403L16.2411 11.2434L20.4227 7.0619C21.1924 6.29211 21.1924 5.04404 20.4227 4.27425ZM12.0595 9.84946L14.1503 11.9402L7.49458 18.5958C6.82993 18.5871 6.10446 18.7017 5.41883 18.915C5.24707 18.9685 5.07418 19.0292 4.90213 19.0976C4.97048 18.9256 5.03126 18.7527 5.0847 18.5809C5.29805 17.8953 5.41264 17.1698 5.40386 16.5051L12.0595 9.84946Z\" fill=\"#3D3D3D\"/>\r\n </svg>\r\n </div>\r\n }\r\n <div class=\"color-box__wrapperline\">\r\n @if (hasTransparent()) {\r\n <div\r\n class=\"color-box__transparent\"\r\n (click)=\"selectColor(null)\"\r\n >\r\n <svg version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 32 32\">\r\n <path fill=\"currentColor\" d=\"M8 25.333c0 1.467 1.2 2.667 2.667 2.667h10.667c1.467 0 2.667-1.2 2.667-2.667v-16h-16v16zM11.28 15.84l1.88-1.88 2.84 2.827 2.827-2.827 1.88 1.88-2.827 2.827 2.827 2.827-1.88 1.88-2.827-2.827-2.827 2.827-1.88-1.88 2.827-2.827-2.84-2.827zM20.667 5.333l-1.333-1.333h-6.667l-1.333 1.333h-4.667v2.667h18.667v-2.667z\"></path>\r\n </svg>\r\n </div>\r\n }\r\n <div\r\n class=\"color-box__wrapper\"\r\n [class.color-box__wrapper-withtransparent]=\"hasTransparent()\"\r\n >\r\n @if (eyeColor() || currentColor(); as color) {\r\n <div\r\n class=\"color-box__preview\"\r\n [style.background]=\"color\"\r\n ></div>\r\n }\r\n @if (isTransparent) {\r\n <div\r\n class=\"color-box__preview color-box__preview--transparent\"\r\n ></div>\r\n }\r\n <div class=\"color-box__form-element\">\r\n <input\r\n type=\"text\"\r\n [value]=\"\r\n currentColor() ||\r\n (hasTransparent() ? 'Без цвета' : colorDefault())\r\n \"\r\n class=\"color-box__input\"\r\n [class.color-box__input-trasparent]=\"isTransparent\"\r\n [attr.readonly]=\"isTransparent || null\"\r\n (change)=\"changeInput($event)\"\r\n pattern=\"^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$\"\r\n maxlength=\"7\"\r\n />\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n</div>\r\n\r\n<ng-template #colorMapTemplate>\r\n <color-box\r\n [inputColorPicker]=\"currentColor() || colorDefault()\"\r\n (changeColor)=\"changeColor($event)\"\r\n (selectColor)=\"selectColor($event)\"\r\n >\r\n <ng-content></ng-content>\r\n </color-box>\r\n</ng-template>\r\n\r\n","/*\n * Public API Surface of color-picker\n */\n\nexport * from './lib/color-picker.component';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;MAKa,sBAAsB,CAAA;AACjC;;;;;;;;;;AAUG;AAEI,IAAA,QAAQ,CAAC,CAAS,EAAE,CAAS,EAAE,CAAS,EAAA;AAC7C,QAAA,MAAM,CAAC,GAAG,CAAC,CAAS,KAAK,CAAC,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,EAAE;AAC1C,QAAA,MAAM,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC;QAChC,MAAM,CAAC,GAAG,CAAC,CAAS,KAClB,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;QACjE,OAAO;YACL,IAAI,CAAC,KAAK,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;YACtB,IAAI,CAAC,KAAK,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;YACtB,IAAI,CAAC,KAAK,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;SACvB;IACH;AAEO,IAAA,QAAQ,CAAC,CAAS,EAAE,CAAS,EAAE,CAAS,EAAA;AAC7C,QAAA,IAAI,CAAC,EAAE,CAAC,EAAE,CAAC;AAEX,QAAA,IAAI,KAAK,CAAC,CAAC,CAAC,EAAE;YACZ,CAAC,GAAG,CAAC;QACP;AAEA,QAAA,IAAI,CAAC,KAAK,CAAC,EAAE;YACX,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QAChB;aAAO;YACL,MAAM,OAAO,GAAG,CAAC,CAAS,EA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,CAAC,YAAY,EAAE,iBAAiB,CAAC,EAAA,eAAA,EAGzB,uBAAuB,CAAC,MAAM,EAAA,QAAA,EAAA,s+GAAA,EAAA,MAAA,EAAA,CAAA,24DAAA,CAAA,EAAA;;;AEhBjD;;AAEG;;ACFH;;AAEG;;"}
package/package.json ADDED
@@ -0,0 +1,30 @@
1
+ {
2
+ "name": "@severfam/angular-color-picker",
3
+ "version": "0.1.0",
4
+ "description": "Angular color picker component with shade and saturation selection. Renders on Canvas, auto-scales and recalculates sizes on container resize.",
5
+ "license": "MIT",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "https://github.com/sashaseverfam/angular-color-picker.git"
9
+ },
10
+ "peerDependencies": {
11
+ "@angular/common": "^21.2.0",
12
+ "@angular/core": "^21.2.0"
13
+ },
14
+ "dependencies": {
15
+ "tslib": "^2.3.0"
16
+ },
17
+ "sideEffects": false,
18
+ "module": "fesm2022/severfam-angular-color-picker.mjs",
19
+ "typings": "types/severfam-angular-color-picker.d.ts",
20
+ "exports": {
21
+ "./package.json": {
22
+ "default": "./package.json"
23
+ },
24
+ ".": {
25
+ "types": "./types/severfam-angular-color-picker.d.ts",
26
+ "default": "./fesm2022/severfam-angular-color-picker.mjs"
27
+ }
28
+ },
29
+ "type": "module"
30
+ }
@@ -0,0 +1,23 @@
1
+ import * as _angular_core from '@angular/core';
2
+
3
+ declare class ColorPicker {
4
+ inColor: _angular_core.InputSignal<string | null>;
5
+ eyeColor: _angular_core.InputSignal<string | null>;
6
+ hasTransparent: _angular_core.InputSignal<boolean>;
7
+ hasEyeDropper: _angular_core.InputSignal<boolean>;
8
+ colorDefault: _angular_core.InputSignal<string>;
9
+ changeModel: _angular_core.OutputEmitterRef<string | null>;
10
+ changeEnd: _angular_core.OutputEmitterRef<void>;
11
+ startEye: _angular_core.OutputEmitterRef<Event>;
12
+ currentColor: _angular_core.WritableSignal<string | null>;
13
+ constructor();
14
+ get defaultColor(): string | null;
15
+ get isTransparent(): boolean;
16
+ changeInput(event: Event): void;
17
+ changeColor(color: string): void;
18
+ selectColor(color: string | null): void;
19
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<ColorPicker, never>;
20
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<ColorPicker, "lib-color-picker", never, { "inColor": { "alias": "inColor"; "required": true; "isSignal": true; }; "eyeColor": { "alias": "eyeColor"; "required": false; "isSignal": true; }; "hasTransparent": { "alias": "hasTransparent"; "required": false; "isSignal": true; }; "hasEyeDropper": { "alias": "hasEyeDropper"; "required": false; "isSignal": true; }; "colorDefault": { "alias": "colorDefault"; "required": false; "isSignal": true; }; }, { "changeModel": "changeModel"; "changeEnd": "changeEnd"; "startEye": "startEye"; }, never, ["*"], true, never>;
21
+ }
22
+
23
+ export { ColorPicker };