ngx-color 8.0.3 → 9.0.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.
Files changed (219) hide show
  1. package/README.md +2 -3
  2. package/alpha/alpha-picker.component.d.ts +1 -1
  3. package/alpha.component.d.ts +1 -1
  4. package/block/block-swatches.component.d.ts +1 -1
  5. package/block/block.component.d.ts +1 -1
  6. package/checkboard.component.d.ts +1 -1
  7. package/chrome/chrome-fields.component.d.ts +1 -1
  8. package/chrome/chrome.component.d.ts +1 -1
  9. package/circle/circle-swatch.component.d.ts +1 -1
  10. package/circle/circle.component.d.ts +1 -1
  11. package/color-wrap.component.d.ts +1 -1
  12. package/compact/compact-color.component.d.ts +1 -1
  13. package/compact/compact-fields.component.d.ts +1 -1
  14. package/compact/compact.component.d.ts +1 -1
  15. package/coordinates.directive.d.ts +1 -1
  16. package/editable-input.component.d.ts +1 -1
  17. package/esm2022/alpha/alpha-picker.component.mjs +102 -0
  18. package/esm2022/alpha.component.mjs +146 -0
  19. package/esm2022/block/block-swatches.component.mjs +63 -0
  20. package/esm2022/block/block.component.mjs +160 -0
  21. package/esm2022/checkboard.component.mjs +53 -0
  22. package/esm2022/chrome/chrome-fields.component.mjs +317 -0
  23. package/esm2022/chrome/chrome.component.mjs +187 -0
  24. package/esm2022/circle/circle-swatch.component.mjs +69 -0
  25. package/esm2022/circle/circle.component.mjs +136 -0
  26. package/esm2022/color-wrap.component.mjs +173 -0
  27. package/esm2022/compact/compact-color.component.mjs +71 -0
  28. package/esm2022/compact/compact-fields.component.mjs +165 -0
  29. package/esm2022/compact/compact.component.mjs +156 -0
  30. package/esm2022/coordinates.directive.mjs +108 -0
  31. package/esm2022/editable-input.component.mjs +212 -0
  32. package/esm2022/github/github-swatch.component.mjs +53 -0
  33. package/esm2022/github/github.component.mjs +114 -0
  34. package/esm2022/hue/hue-picker.component.mjs +102 -0
  35. package/esm2022/hue.component.mjs +128 -0
  36. package/esm2022/material/material.component.mjs +188 -0
  37. package/esm2022/photoshop/photoshop-button.component.mjs +33 -0
  38. package/esm2022/photoshop/photoshop-fields.component.mjs +214 -0
  39. package/esm2022/photoshop/photoshop-previews.component.mjs +40 -0
  40. package/esm2022/photoshop/photoshop.component.mjs +187 -0
  41. package/esm2022/raised.component.mjs +50 -0
  42. package/esm2022/saturation.component.mjs +100 -0
  43. package/esm2022/shade/shade-picker.component.mjs +94 -0
  44. package/esm2022/shade.component.mjs +133 -0
  45. package/esm2022/sketch/sketch-fields.component.mjs +211 -0
  46. package/esm2022/sketch/sketch-preset-colors.component.mjs +68 -0
  47. package/esm2022/sketch/sketch.component.mjs +215 -0
  48. package/esm2022/slider/slider-swatch.component.mjs +55 -0
  49. package/esm2022/slider/slider-swatches.component.mjs +119 -0
  50. package/esm2022/slider/slider.component.mjs +104 -0
  51. package/esm2022/swatch.component.mjs +112 -0
  52. package/esm2022/swatches/swatches-color.component.mjs +105 -0
  53. package/esm2022/swatches/swatches-group.component.mjs +50 -0
  54. package/esm2022/swatches/swatches.component.mjs +244 -0
  55. package/esm2022/twitter/twitter.component.mjs +161 -0
  56. package/{fesm2020 → fesm2022}/ngx-color-alpha.mjs +30 -30
  57. package/fesm2022/ngx-color-alpha.mjs.map +1 -0
  58. package/{fesm2020 → fesm2022}/ngx-color-block.mjs +65 -66
  59. package/fesm2022/ngx-color-block.mjs.map +1 -0
  60. package/{fesm2020 → fesm2022}/ngx-color-chrome.mjs +77 -74
  61. package/{fesm2020 → fesm2022}/ngx-color-chrome.mjs.map +1 -1
  62. package/{fesm2015 → fesm2022}/ngx-color-circle.mjs +61 -62
  63. package/fesm2022/ngx-color-circle.mjs.map +1 -0
  64. package/{fesm2015 → fesm2022}/ngx-color-compact.mjs +136 -136
  65. package/{fesm2015 → fesm2022}/ngx-color-compact.mjs.map +1 -1
  66. package/{fesm2015 → fesm2022}/ngx-color-github.mjs +53 -54
  67. package/{fesm2020 → fesm2022}/ngx-color-github.mjs.map +1 -1
  68. package/{fesm2020 → fesm2022}/ngx-color-hue.mjs +32 -32
  69. package/fesm2022/ngx-color-hue.mjs.map +1 -0
  70. package/{fesm2015 → fesm2022}/ngx-color-material.mjs +59 -59
  71. package/{fesm2015 → fesm2022}/ngx-color-material.mjs.map +1 -1
  72. package/{fesm2020 → fesm2022}/ngx-color-photoshop.mjs +111 -113
  73. package/{fesm2015 → fesm2022}/ngx-color-photoshop.mjs.map +1 -1
  74. package/{fesm2015 → fesm2022}/ngx-color-shade.mjs +29 -29
  75. package/fesm2022/ngx-color-shade.mjs.map +1 -0
  76. package/{fesm2015 → fesm2022}/ngx-color-sketch.mjs +94 -93
  77. package/{fesm2015 → fesm2022}/ngx-color-sketch.mjs.map +1 -1
  78. package/{fesm2020 → fesm2022}/ngx-color-slider.mjs +46 -45
  79. package/{fesm2015 → fesm2022}/ngx-color-slider.mjs.map +1 -1
  80. package/{fesm2015 → fesm2022}/ngx-color-swatches.mjs +182 -182
  81. package/fesm2022/ngx-color-swatches.mjs.map +1 -0
  82. package/{fesm2015 → fesm2022}/ngx-color-twitter.mjs +55 -55
  83. package/{fesm2015 → fesm2022}/ngx-color-twitter.mjs.map +1 -1
  84. package/{fesm2020 → fesm2022}/ngx-color.mjs +200 -160
  85. package/fesm2022/ngx-color.mjs.map +1 -0
  86. package/github/github-swatch.component.d.ts +1 -1
  87. package/github/github.component.d.ts +1 -1
  88. package/hue/hue-picker.component.d.ts +1 -1
  89. package/hue.component.d.ts +1 -1
  90. package/material/material.component.d.ts +1 -1
  91. package/package.json +59 -84
  92. package/photoshop/photoshop-button.component.d.ts +1 -1
  93. package/photoshop/photoshop-fields.component.d.ts +1 -1
  94. package/photoshop/photoshop-previews.component.d.ts +1 -1
  95. package/photoshop/photoshop.component.d.ts +1 -1
  96. package/raised.component.d.ts +2 -2
  97. package/saturation.component.d.ts +1 -1
  98. package/shade/shade-picker.component.d.ts +1 -1
  99. package/shade.component.d.ts +1 -1
  100. package/sketch/sketch-fields.component.d.ts +1 -1
  101. package/sketch/sketch-preset-colors.component.d.ts +1 -1
  102. package/sketch/sketch.component.d.ts +1 -1
  103. package/slider/slider-swatch.component.d.ts +1 -1
  104. package/slider/slider-swatches.component.d.ts +1 -1
  105. package/slider/slider.component.d.ts +1 -1
  106. package/swatch.component.d.ts +1 -1
  107. package/swatches/swatches-color.component.d.ts +1 -1
  108. package/swatches/swatches-group.component.d.ts +1 -1
  109. package/swatches/swatches.component.d.ts +1 -1
  110. package/twitter/twitter.component.d.ts +1 -1
  111. package/esm2020/alpha/alpha-picker.component.mjs +0 -100
  112. package/esm2020/alpha.component.mjs +0 -138
  113. package/esm2020/block/block-swatches.component.mjs +0 -63
  114. package/esm2020/block/block.component.mjs +0 -158
  115. package/esm2020/checkboard.component.mjs +0 -50
  116. package/esm2020/chrome/chrome-fields.component.mjs +0 -314
  117. package/esm2020/chrome/chrome.component.mjs +0 -184
  118. package/esm2020/circle/circle-swatch.component.mjs +0 -69
  119. package/esm2020/circle/circle.component.mjs +0 -134
  120. package/esm2020/color-wrap.component.mjs +0 -163
  121. package/esm2020/compact/compact-color.component.mjs +0 -70
  122. package/esm2020/compact/compact-fields.component.mjs +0 -164
  123. package/esm2020/compact/compact.component.mjs +0 -154
  124. package/esm2020/coordinates.directive.mjs +0 -104
  125. package/esm2020/editable-input.component.mjs +0 -199
  126. package/esm2020/github/github-swatch.component.mjs +0 -53
  127. package/esm2020/github/github.component.mjs +0 -112
  128. package/esm2020/hue/hue-picker.component.mjs +0 -100
  129. package/esm2020/hue.component.mjs +0 -124
  130. package/esm2020/material/material.component.mjs +0 -186
  131. package/esm2020/photoshop/photoshop-button.component.mjs +0 -34
  132. package/esm2020/photoshop/photoshop-fields.component.mjs +0 -212
  133. package/esm2020/photoshop/photoshop-previews.component.mjs +0 -40
  134. package/esm2020/photoshop/photoshop.component.mjs +0 -185
  135. package/esm2020/raised.component.mjs +0 -50
  136. package/esm2020/saturation.component.mjs +0 -92
  137. package/esm2020/shade/shade-picker.component.mjs +0 -92
  138. package/esm2020/shade.component.mjs +0 -125
  139. package/esm2020/sketch/sketch-fields.component.mjs +0 -209
  140. package/esm2020/sketch/sketch-preset-colors.component.mjs +0 -68
  141. package/esm2020/sketch/sketch.component.mjs +0 -212
  142. package/esm2020/slider/slider-swatch.component.mjs +0 -52
  143. package/esm2020/slider/slider-swatches.component.mjs +0 -119
  144. package/esm2020/slider/slider.component.mjs +0 -102
  145. package/esm2020/swatch.component.mjs +0 -110
  146. package/esm2020/swatches/swatches-color.component.mjs +0 -104
  147. package/esm2020/swatches/swatches-group.component.mjs +0 -49
  148. package/esm2020/swatches/swatches.component.mjs +0 -242
  149. package/esm2020/twitter/twitter.component.mjs +0 -159
  150. package/fesm2015/ngx-color-alpha.mjs +0 -107
  151. package/fesm2015/ngx-color-alpha.mjs.map +0 -1
  152. package/fesm2015/ngx-color-block.mjs +0 -223
  153. package/fesm2015/ngx-color-block.mjs.map +0 -1
  154. package/fesm2015/ngx-color-chrome.mjs +0 -499
  155. package/fesm2015/ngx-color-chrome.mjs.map +0 -1
  156. package/fesm2015/ngx-color-circle.mjs.map +0 -1
  157. package/fesm2015/ngx-color-github.mjs.map +0 -1
  158. package/fesm2015/ngx-color-hue.mjs +0 -107
  159. package/fesm2015/ngx-color-hue.mjs.map +0 -1
  160. package/fesm2015/ngx-color-photoshop.mjs +0 -467
  161. package/fesm2015/ngx-color-shade.mjs.map +0 -1
  162. package/fesm2015/ngx-color-slider.mjs +0 -273
  163. package/fesm2015/ngx-color-swatches.mjs.map +0 -1
  164. package/fesm2015/ngx-color.mjs +0 -1202
  165. package/fesm2015/ngx-color.mjs.map +0 -1
  166. package/fesm2020/ngx-color-alpha.mjs.map +0 -1
  167. package/fesm2020/ngx-color-block.mjs.map +0 -1
  168. package/fesm2020/ngx-color-circle.mjs +0 -207
  169. package/fesm2020/ngx-color-circle.mjs.map +0 -1
  170. package/fesm2020/ngx-color-compact.mjs +0 -385
  171. package/fesm2020/ngx-color-compact.mjs.map +0 -1
  172. package/fesm2020/ngx-color-github.mjs +0 -169
  173. package/fesm2020/ngx-color-hue.mjs.map +0 -1
  174. package/fesm2020/ngx-color-material.mjs +0 -193
  175. package/fesm2020/ngx-color-material.mjs.map +0 -1
  176. package/fesm2020/ngx-color-photoshop.mjs.map +0 -1
  177. package/fesm2020/ngx-color-shade.mjs +0 -99
  178. package/fesm2020/ngx-color-shade.mjs.map +0 -1
  179. package/fesm2020/ngx-color-sketch.mjs +0 -485
  180. package/fesm2020/ngx-color-sketch.mjs.map +0 -1
  181. package/fesm2020/ngx-color-slider.mjs.map +0 -1
  182. package/fesm2020/ngx-color-swatches.mjs +0 -391
  183. package/fesm2020/ngx-color-swatches.mjs.map +0 -1
  184. package/fesm2020/ngx-color-twitter.mjs +0 -166
  185. package/fesm2020/ngx-color-twitter.mjs.map +0 -1
  186. package/fesm2020/ngx-color.mjs.map +0 -1
  187. /package/{esm2020 → esm2022}/alpha/ngx-color-alpha.mjs +0 -0
  188. /package/{esm2020 → esm2022}/alpha/public_api.mjs +0 -0
  189. /package/{esm2020 → esm2022}/block/ngx-color-block.mjs +0 -0
  190. /package/{esm2020 → esm2022}/block/public_api.mjs +0 -0
  191. /package/{esm2020 → esm2022}/chrome/ngx-color-chrome.mjs +0 -0
  192. /package/{esm2020 → esm2022}/chrome/public_api.mjs +0 -0
  193. /package/{esm2020 → esm2022}/circle/ngx-color-circle.mjs +0 -0
  194. /package/{esm2020 → esm2022}/circle/public_api.mjs +0 -0
  195. /package/{esm2020 → esm2022}/compact/ngx-color-compact.mjs +0 -0
  196. /package/{esm2020 → esm2022}/compact/public_api.mjs +0 -0
  197. /package/{esm2020 → esm2022}/github/ngx-color-github.mjs +0 -0
  198. /package/{esm2020 → esm2022}/github/public_api.mjs +0 -0
  199. /package/{esm2020 → esm2022}/helpers/checkboard.mjs +0 -0
  200. /package/{esm2020 → esm2022}/helpers/color.interfaces.mjs +0 -0
  201. /package/{esm2020 → esm2022}/helpers/color.mjs +0 -0
  202. /package/{esm2020 → esm2022}/hue/ngx-color-hue.mjs +0 -0
  203. /package/{esm2020 → esm2022}/hue/public_api.mjs +0 -0
  204. /package/{esm2020 → esm2022}/material/ngx-color-material.mjs +0 -0
  205. /package/{esm2020 → esm2022}/material/public_api.mjs +0 -0
  206. /package/{esm2020 → esm2022}/ngx-color.mjs +0 -0
  207. /package/{esm2020 → esm2022}/photoshop/ngx-color-photoshop.mjs +0 -0
  208. /package/{esm2020 → esm2022}/photoshop/public_api.mjs +0 -0
  209. /package/{esm2020 → esm2022}/public_api.mjs +0 -0
  210. /package/{esm2020 → esm2022}/shade/ngx-color-shade.mjs +0 -0
  211. /package/{esm2020 → esm2022}/shade/public_api.mjs +0 -0
  212. /package/{esm2020 → esm2022}/sketch/ngx-color-sketch.mjs +0 -0
  213. /package/{esm2020 → esm2022}/sketch/public_api.mjs +0 -0
  214. /package/{esm2020 → esm2022}/slider/ngx-color-slider.mjs +0 -0
  215. /package/{esm2020 → esm2022}/slider/public_api.mjs +0 -0
  216. /package/{esm2020 → esm2022}/swatches/ngx-color-swatches.mjs +0 -0
  217. /package/{esm2020 → esm2022}/swatches/public_api.mjs +0 -0
  218. /package/{esm2020 → esm2022}/twitter/ngx-color-twitter.mjs +0 -0
  219. /package/{esm2020 → esm2022}/twitter/public_api.mjs +0 -0
@@ -1,1202 +0,0 @@
1
- import * as i1 from '@angular/common';
2
- import { CommonModule } from '@angular/common';
3
- import * as i0 from '@angular/core';
4
- import { Component, ChangeDetectionStrategy, Input, NgModule, Directive, Output, HostListener, EventEmitter, isDevMode, forwardRef } from '@angular/core';
5
- import { Subject, Subscription, fromEvent } from 'rxjs';
6
- import { distinctUntilChanged, debounceTime, tap } from 'rxjs/operators';
7
- import { TinyColor } from '@ctrl/tinycolor';
8
- import { NG_VALUE_ACCESSOR } from '@angular/forms';
9
-
10
- const checkboardCache = {};
11
- function render(c1, c2, size) {
12
- if (typeof document === 'undefined') {
13
- return null;
14
- }
15
- const canvas = document.createElement('canvas');
16
- canvas.width = size * 2;
17
- canvas.height = size * 2;
18
- const ctx = canvas.getContext('2d');
19
- if (!ctx) {
20
- return null;
21
- } // If no context can be found, return early.
22
- ctx.fillStyle = c1;
23
- ctx.fillRect(0, 0, canvas.width, canvas.height);
24
- ctx.fillStyle = c2;
25
- ctx.fillRect(0, 0, size, size);
26
- ctx.translate(size, size);
27
- ctx.fillRect(0, 0, size, size);
28
- return canvas.toDataURL();
29
- }
30
- function getCheckerboard(c1, c2, size) {
31
- const key = `${c1}-${c2}-${size}`;
32
- if (checkboardCache[key]) {
33
- return checkboardCache[key];
34
- }
35
- const checkboard = render(c1, c2, size);
36
- if (!checkboard) {
37
- return null;
38
- }
39
- checkboardCache[key] = checkboard;
40
- return checkboard;
41
- }
42
-
43
- class CheckboardComponent {
44
- constructor() {
45
- this.white = 'transparent';
46
- this.size = 8;
47
- this.grey = 'rgba(0,0,0,.08)';
48
- }
49
- ngOnInit() {
50
- const background = getCheckerboard(this.white, this.grey, this.size);
51
- this.gridStyles = {
52
- borderRadius: this.borderRadius,
53
- boxShadow: this.boxShadow,
54
- background: `url(${background}) center left`,
55
- };
56
- }
57
- }
58
- CheckboardComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: CheckboardComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
59
- CheckboardComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.2", type: CheckboardComponent, selector: "color-checkboard", inputs: { white: "white", size: "size", grey: "grey", boxShadow: "boxShadow", borderRadius: "borderRadius" }, ngImport: i0, template: `<div class="grid" [ngStyle]="gridStyles"></div>`, isInline: true, styles: [".grid{top:0px;right:0px;bottom:0px;left:0px;position:absolute}\n"], dependencies: [{ kind: "directive", type: i1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
60
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: CheckboardComponent, decorators: [{
61
- type: Component,
62
- args: [{ selector: 'color-checkboard', template: `<div class="grid" [ngStyle]="gridStyles"></div>`, preserveWhitespaces: false, changeDetection: ChangeDetectionStrategy.OnPush, styles: [".grid{top:0px;right:0px;bottom:0px;left:0px;position:absolute}\n"] }]
63
- }], propDecorators: { white: [{
64
- type: Input
65
- }], size: [{
66
- type: Input
67
- }], grey: [{
68
- type: Input
69
- }], boxShadow: [{
70
- type: Input
71
- }], borderRadius: [{
72
- type: Input
73
- }] } });
74
- class CheckboardModule {
75
- }
76
- CheckboardModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: CheckboardModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
77
- CheckboardModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.1.2", ngImport: i0, type: CheckboardModule, declarations: [CheckboardComponent], imports: [CommonModule], exports: [CheckboardComponent] });
78
- CheckboardModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: CheckboardModule, imports: [CommonModule] });
79
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: CheckboardModule, decorators: [{
80
- type: NgModule,
81
- args: [{
82
- declarations: [CheckboardComponent],
83
- exports: [CheckboardComponent],
84
- imports: [CommonModule],
85
- }]
86
- }] });
87
-
88
- class CoordinatesDirective {
89
- constructor(el) {
90
- this.el = el;
91
- this.coordinatesChange = new Subject();
92
- this.mousechange = new Subject();
93
- this.mouseListening = false;
94
- }
95
- mousemove($event, x, y, isTouch = false) {
96
- if (this.mouseListening) {
97
- $event.preventDefault();
98
- this.mousechange.next({ $event, x, y, isTouch });
99
- }
100
- }
101
- mouseup() {
102
- this.mouseListening = false;
103
- }
104
- mousedown($event, x, y, isTouch = false) {
105
- $event.preventDefault();
106
- this.mouseListening = true;
107
- this.mousechange.next({ $event, x, y, isTouch });
108
- }
109
- ngOnInit() {
110
- this.sub = this.mousechange
111
- .pipe(
112
- // limit times it is updated for the same area
113
- distinctUntilChanged((p, q) => p.x === q.x && p.y === q.y))
114
- .subscribe(n => this.handleChange(n.x, n.y, n.$event, n.isTouch));
115
- }
116
- ngOnDestroy() {
117
- var _a;
118
- (_a = this.sub) === null || _a === void 0 ? void 0 : _a.unsubscribe();
119
- }
120
- handleChange(x, y, $event, isTouch) {
121
- const containerWidth = this.el.nativeElement.clientWidth;
122
- const containerHeight = this.el.nativeElement.clientHeight;
123
- const left = x -
124
- (this.el.nativeElement.getBoundingClientRect().left + window.pageXOffset);
125
- let top = y - this.el.nativeElement.getBoundingClientRect().top;
126
- if (!isTouch) {
127
- top = top - window.pageYOffset;
128
- }
129
- this.coordinatesChange.next({
130
- x,
131
- y,
132
- top,
133
- left,
134
- containerWidth,
135
- containerHeight,
136
- $event,
137
- });
138
- }
139
- }
140
- CoordinatesDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: CoordinatesDirective, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
141
- CoordinatesDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.1.2", type: CoordinatesDirective, selector: "[ngx-color-coordinates]", outputs: { coordinatesChange: "coordinatesChange" }, host: { listeners: { "window:mousemove": "mousemove($event,$event.pageX,$event.pageY)", "window:touchmove": "mousemove($event,$event.touches[0].clientX,$event.touches[0].clientY,true)", "window:mouseup": "mouseup()", "window:touchend": "mouseup()", "mousedown": "mousedown($event,$event.pageX,$event.pageY)", "touchstart": "mousedown($event,$event.touches[0].clientX,$event.touches[0].clientY,true)" } }, ngImport: i0 });
142
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: CoordinatesDirective, decorators: [{
143
- type: Directive,
144
- args: [{ selector: '[ngx-color-coordinates]' }]
145
- }], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { coordinatesChange: [{
146
- type: Output
147
- }], mousemove: [{
148
- type: HostListener,
149
- args: ['window:mousemove', ['$event', '$event.pageX', '$event.pageY']]
150
- }, {
151
- type: HostListener,
152
- args: ['window:touchmove', [
153
- '$event',
154
- '$event.touches[0].clientX',
155
- '$event.touches[0].clientY',
156
- 'true',
157
- ]]
158
- }], mouseup: [{
159
- type: HostListener,
160
- args: ['window:mouseup']
161
- }, {
162
- type: HostListener,
163
- args: ['window:touchend']
164
- }], mousedown: [{
165
- type: HostListener,
166
- args: ['mousedown', ['$event', '$event.pageX', '$event.pageY']]
167
- }, {
168
- type: HostListener,
169
- args: ['touchstart', [
170
- '$event',
171
- '$event.touches[0].clientX',
172
- '$event.touches[0].clientY',
173
- 'true',
174
- ]]
175
- }] } });
176
- class CoordinatesModule {
177
- }
178
- CoordinatesModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: CoordinatesModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
179
- CoordinatesModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.1.2", ngImport: i0, type: CoordinatesModule, declarations: [CoordinatesDirective], exports: [CoordinatesDirective] });
180
- CoordinatesModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: CoordinatesModule });
181
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: CoordinatesModule, decorators: [{
182
- type: NgModule,
183
- args: [{
184
- declarations: [CoordinatesDirective],
185
- exports: [CoordinatesDirective],
186
- }]
187
- }] });
188
-
189
- class AlphaComponent {
190
- constructor() {
191
- this.direction = 'horizontal';
192
- this.onChange = new EventEmitter();
193
- }
194
- ngOnChanges() {
195
- if (this.direction === 'vertical') {
196
- this.pointerLeft = 0;
197
- this.pointerTop = this.rgb.a * 100;
198
- this.gradient = {
199
- background: `linear-gradient(to bottom, rgba(${this.rgb.r},${this.rgb.g},${this.rgb.b}, 0) 0%,
200
- rgba(${this.rgb.r},${this.rgb.g},${this.rgb.b}, 1) 100%)`,
201
- };
202
- }
203
- else {
204
- this.gradient = {
205
- background: `linear-gradient(to right, rgba(${this.rgb.r},${this.rgb.g},${this.rgb.b}, 0) 0%,
206
- rgba(${this.rgb.r},${this.rgb.g},${this.rgb.b}, 1) 100%)`,
207
- };
208
- this.pointerLeft = this.rgb.a * 100;
209
- }
210
- }
211
- handleChange({ top, left, containerHeight, containerWidth, $event }) {
212
- let data;
213
- if (this.direction === 'vertical') {
214
- let a;
215
- if (top < 0) {
216
- a = 0;
217
- }
218
- else if (top > containerHeight) {
219
- a = 1;
220
- }
221
- else {
222
- a = Math.round(top * 100 / containerHeight) / 100;
223
- }
224
- if (this.hsl.a !== a) {
225
- data = {
226
- h: this.hsl.h,
227
- s: this.hsl.s,
228
- l: this.hsl.l,
229
- a,
230
- source: 'rgb',
231
- };
232
- }
233
- }
234
- else {
235
- let a;
236
- if (left < 0) {
237
- a = 0;
238
- }
239
- else if (left > containerWidth) {
240
- a = 1;
241
- }
242
- else {
243
- a = Math.round(left * 100 / containerWidth) / 100;
244
- }
245
- if (this.hsl.a !== a) {
246
- data = {
247
- h: this.hsl.h,
248
- s: this.hsl.s,
249
- l: this.hsl.l,
250
- a,
251
- source: 'rgb',
252
- };
253
- }
254
- }
255
- if (!data) {
256
- return;
257
- }
258
- this.onChange.emit({ data, $event });
259
- }
260
- }
261
- AlphaComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: AlphaComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
262
- AlphaComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.2", type: AlphaComponent, selector: "color-alpha", inputs: { hsl: "hsl", rgb: "rgb", pointer: "pointer", shadow: "shadow", radius: "radius", direction: "direction" }, outputs: { onChange: "onChange" }, usesOnChanges: true, ngImport: i0, template: `
263
- <div class="alpha" [style.border-radius]="radius">
264
- <div class="alpha-checkboard">
265
- <color-checkboard></color-checkboard>
266
- </div>
267
- <div class="alpha-gradient" [ngStyle]="gradient" [style.box-shadow]="shadow" [style.border-radius]="radius"></div>
268
- <div ngx-color-coordinates (coordinatesChange)="handleChange($event)" class="alpha-container color-alpha-{{direction}}">
269
- <div class="alpha-pointer" [style.left.%]="pointerLeft" [style.top.%]="pointerTop">
270
- <div class="alpha-slider" [ngStyle]="pointer"></div>
271
- </div>
272
- </div>
273
- </div>
274
- `, isInline: true, styles: [".alpha{position:absolute;top:0;bottom:0;left:0;right:0}.alpha-checkboard{position:absolute;top:0;bottom:0;left:0;right:0;overflow:hidden}.alpha-gradient{position:absolute;top:0;bottom:0;left:0;right:0}.alpha-container{position:relative;height:100%;margin:0 3px}.alpha-pointer{position:absolute}.alpha-slider{width:4px;border-radius:1px;height:8px;box-shadow:0 0 2px #0009;background:#fff;margin-top:1px;transform:translate(-2px)}\n"], dependencies: [{ kind: "directive", type: i1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "component", type: CheckboardComponent, selector: "color-checkboard", inputs: ["white", "size", "grey", "boxShadow", "borderRadius"] }, { kind: "directive", type: CoordinatesDirective, selector: "[ngx-color-coordinates]", outputs: ["coordinatesChange"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
275
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: AlphaComponent, decorators: [{
276
- type: Component,
277
- args: [{ selector: 'color-alpha', template: `
278
- <div class="alpha" [style.border-radius]="radius">
279
- <div class="alpha-checkboard">
280
- <color-checkboard></color-checkboard>
281
- </div>
282
- <div class="alpha-gradient" [ngStyle]="gradient" [style.box-shadow]="shadow" [style.border-radius]="radius"></div>
283
- <div ngx-color-coordinates (coordinatesChange)="handleChange($event)" class="alpha-container color-alpha-{{direction}}">
284
- <div class="alpha-pointer" [style.left.%]="pointerLeft" [style.top.%]="pointerTop">
285
- <div class="alpha-slider" [ngStyle]="pointer"></div>
286
- </div>
287
- </div>
288
- </div>
289
- `, changeDetection: ChangeDetectionStrategy.OnPush, preserveWhitespaces: false, styles: [".alpha{position:absolute;top:0;bottom:0;left:0;right:0}.alpha-checkboard{position:absolute;top:0;bottom:0;left:0;right:0;overflow:hidden}.alpha-gradient{position:absolute;top:0;bottom:0;left:0;right:0}.alpha-container{position:relative;height:100%;margin:0 3px}.alpha-pointer{position:absolute}.alpha-slider{width:4px;border-radius:1px;height:8px;box-shadow:0 0 2px #0009;background:#fff;margin-top:1px;transform:translate(-2px)}\n"] }]
290
- }], propDecorators: { hsl: [{
291
- type: Input
292
- }], rgb: [{
293
- type: Input
294
- }], pointer: [{
295
- type: Input
296
- }], shadow: [{
297
- type: Input
298
- }], radius: [{
299
- type: Input
300
- }], direction: [{
301
- type: Input
302
- }], onChange: [{
303
- type: Output
304
- }] } });
305
- class AlphaModule {
306
- }
307
- AlphaModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: AlphaModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
308
- AlphaModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.1.2", ngImport: i0, type: AlphaModule, declarations: [AlphaComponent], imports: [CommonModule, CheckboardModule, CoordinatesModule], exports: [AlphaComponent] });
309
- AlphaModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: AlphaModule, imports: [CommonModule, CheckboardModule, CoordinatesModule] });
310
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: AlphaModule, decorators: [{
311
- type: NgModule,
312
- args: [{
313
- declarations: [AlphaComponent],
314
- exports: [AlphaComponent],
315
- imports: [CommonModule, CheckboardModule, CoordinatesModule],
316
- }]
317
- }] });
318
-
319
- function simpleCheckForValidColor(data) {
320
- const keysToCheck = ['r', 'g', 'b', 'a', 'h', 's', 'l', 'v'];
321
- let checked = 0;
322
- let passed = 0;
323
- keysToCheck.forEach(letter => {
324
- if (!data[letter]) {
325
- return;
326
- }
327
- checked += 1;
328
- if (!isNaN(data[letter])) {
329
- passed += 1;
330
- }
331
- if (letter === 's' || letter === 'l') {
332
- const percentPatt = /^\d+%$/;
333
- if (percentPatt.test(data[letter])) {
334
- passed += 1;
335
- }
336
- }
337
- });
338
- return checked === passed ? data : false;
339
- }
340
- function toState(data, oldHue, disableAlpha) {
341
- const color = data.hex ? new TinyColor(data.hex) : new TinyColor(data);
342
- if (disableAlpha) {
343
- color.setAlpha(1);
344
- }
345
- const hsl = color.toHsl();
346
- const hsv = color.toHsv();
347
- const rgb = color.toRgb();
348
- const hex = color.toHex();
349
- if (hsl.s === 0) {
350
- hsl.h = oldHue || 0;
351
- hsv.h = oldHue || 0;
352
- }
353
- const transparent = hex === '000000' && rgb.a === 0;
354
- return {
355
- hsl,
356
- hex: transparent ? 'transparent' : color.toHexString(),
357
- rgb,
358
- hsv,
359
- oldHue: data.h || oldHue || hsl.h,
360
- source: data.source,
361
- };
362
- }
363
- function isValidHex(hex) {
364
- return new TinyColor(hex).isValid;
365
- }
366
- function getContrastingColor(data) {
367
- if (!data) {
368
- return '#fff';
369
- }
370
- const col = toState(data);
371
- if (col.hex === 'transparent') {
372
- return 'rgba(0,0,0,0.4)';
373
- }
374
- const yiq = (col.rgb.r * 299 + col.rgb.g * 587 + col.rgb.b * 114) / 1000;
375
- return yiq >= 128 ? '#000' : '#fff';
376
- }
377
-
378
- var ColorMode;
379
- (function (ColorMode) {
380
- ColorMode["HEX"] = "hex";
381
- ColorMode["HSL"] = "hsl";
382
- ColorMode["HSV"] = "hsv";
383
- ColorMode["RGB"] = "rgb";
384
- })(ColorMode || (ColorMode = {}));
385
- class ColorWrap {
386
- constructor() {
387
- /**
388
- * Descriptors the return color format if the component is used with two-way binding
389
- */
390
- this.mode = ColorMode.HEX;
391
- this.color = {
392
- h: 250,
393
- s: 0.5,
394
- l: 0.2,
395
- a: 1,
396
- };
397
- this.colorChange = new EventEmitter();
398
- this.onChange = new EventEmitter();
399
- this.onChangeComplete = new EventEmitter();
400
- this.onSwatchHover = new EventEmitter();
401
- this._onChangeCompleteSubscription = new Subscription();
402
- this._onSwatchHoverSubscription = new Subscription();
403
- }
404
- ngOnInit() {
405
- this.changes = this.onChange
406
- .pipe(debounceTime(100), tap(event => {
407
- this.onChangeComplete.emit(event);
408
- switch (this.mode) {
409
- case ColorMode.HEX:
410
- this.colorChange.emit(event.color.hex);
411
- break;
412
- case ColorMode.HSL:
413
- this.colorChange.emit(event.color.hsl);
414
- break;
415
- case ColorMode.HSV:
416
- this.colorChange.emit(event.color.hsv);
417
- break;
418
- case ColorMode.RGB:
419
- this.colorChange.emit(event.color.rgb);
420
- break;
421
- default:
422
- const msg = `The mode '${this.mode}' is not supported`;
423
- if (isDevMode()) {
424
- throw new Error(msg);
425
- }
426
- else {
427
- console.warn(msg);
428
- }
429
- break;
430
- }
431
- }))
432
- .subscribe();
433
- this.setState(toState(this.color, 0));
434
- this.currentColor = this.hex;
435
- }
436
- ngOnChanges() {
437
- this.setState(toState(this.color, this.oldHue));
438
- }
439
- ngOnDestroy() {
440
- var _a, _b, _c;
441
- (_a = this.changes) === null || _a === void 0 ? void 0 : _a.unsubscribe();
442
- (_b = this._onChangeCompleteSubscription) === null || _b === void 0 ? void 0 : _b.unsubscribe();
443
- (_c = this._onSwatchHoverSubscription) === null || _c === void 0 ? void 0 : _c.unsubscribe();
444
- }
445
- setState(data) {
446
- this.oldHue = data.oldHue;
447
- this.hsl = data.hsl;
448
- this.hsv = data.hsv;
449
- this.rgb = data.rgb;
450
- this.hex = data.hex;
451
- this.source = data.source;
452
- this.afterValidChange();
453
- }
454
- handleChange(data, $event) {
455
- const isValidColor = simpleCheckForValidColor(data);
456
- if (isValidColor) {
457
- const color = toState(data, data.h || this.oldHue, this.disableAlpha);
458
- this.setState(color);
459
- this.onChange.emit({ color, $event });
460
- this.afterValidChange();
461
- }
462
- }
463
- /** hook for components after a complete change */
464
- afterValidChange() { }
465
- handleSwatchHover(data, $event) {
466
- const isValidColor = simpleCheckForValidColor(data);
467
- if (isValidColor) {
468
- const color = toState(data, data.h || this.oldHue);
469
- this.setState(color);
470
- this.onSwatchHover.emit({ color, $event });
471
- }
472
- }
473
- registerOnChange(fn) {
474
- this._onChangeCompleteSubscription.add(this.onChangeComplete.pipe(tap(event => fn(event.color.hex))).subscribe());
475
- }
476
- registerOnTouched(fn) {
477
- this._onSwatchHoverSubscription.add(this.onSwatchHover.pipe(tap(() => fn())).subscribe());
478
- }
479
- setDisabledState(isDisabled) { }
480
- writeValue(hex) {
481
- this.color = hex;
482
- }
483
- }
484
- ColorWrap.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: ColorWrap, deps: [], target: i0.ɵɵFactoryTarget.Component });
485
- ColorWrap.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.2", type: ColorWrap, selector: "color-wrap", inputs: { className: "className", mode: "mode", color: "color" }, outputs: { colorChange: "colorChange", onChange: "onChange", onChangeComplete: "onChangeComplete", onSwatchHover: "onSwatchHover" }, providers: [
486
- {
487
- provide: NG_VALUE_ACCESSOR,
488
- useExisting: forwardRef(() => ColorWrap),
489
- multi: true,
490
- }
491
- ], usesOnChanges: true, ngImport: i0, template: ``, isInline: true });
492
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: ColorWrap, decorators: [{
493
- type: Component,
494
- args: [{
495
- // create seletor base for test override property
496
- selector: 'color-wrap',
497
- template: ``,
498
- providers: [
499
- {
500
- provide: NG_VALUE_ACCESSOR,
501
- useExisting: forwardRef(() => ColorWrap),
502
- multi: true,
503
- }
504
- ]
505
- }]
506
- }], propDecorators: { className: [{
507
- type: Input
508
- }], mode: [{
509
- type: Input
510
- }], color: [{
511
- type: Input
512
- }], colorChange: [{
513
- type: Output
514
- }], onChange: [{
515
- type: Output
516
- }], onChangeComplete: [{
517
- type: Output
518
- }], onSwatchHover: [{
519
- type: Output
520
- }] } });
521
- class ColorWrapModule {
522
- }
523
- ColorWrapModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: ColorWrapModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
524
- ColorWrapModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.1.2", ngImport: i0, type: ColorWrapModule, declarations: [ColorWrap], imports: [CommonModule], exports: [ColorWrap] });
525
- ColorWrapModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: ColorWrapModule, imports: [CommonModule] });
526
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: ColorWrapModule, decorators: [{
527
- type: NgModule,
528
- args: [{
529
- declarations: [ColorWrap],
530
- exports: [ColorWrap],
531
- imports: [CommonModule],
532
- }]
533
- }] });
534
-
535
- let nextUniqueId = 0;
536
- class EditableInputComponent {
537
- constructor() {
538
- this.placeholder = '';
539
- this.onChange = new EventEmitter();
540
- this.focus = false;
541
- this.uniqueId = `editableInput-${++nextUniqueId}`;
542
- }
543
- ngOnInit() {
544
- this.wrapStyle = this.style && this.style.wrap ? this.style.wrap : {};
545
- this.inputStyle = this.style && this.style.input ? this.style.input : {};
546
- this.labelStyle = this.style && this.style.label ? this.style.label : {};
547
- if (this.dragLabel) {
548
- this.labelStyle.cursor = 'ew-resize';
549
- }
550
- }
551
- handleFocus($event) {
552
- this.focus = true;
553
- }
554
- handleFocusOut($event) {
555
- this.focus = false;
556
- this.currentValue = this.blurValue;
557
- }
558
- handleKeydown($event) {
559
- // In case `e.target.value` is a percentage remove the `%` character
560
- // and update accordingly with a percentage
561
- // https://github.com/casesandberg/react-color/issues/383
562
- const stringValue = String($event.target.value);
563
- const isPercentage = stringValue.indexOf('%') > -1;
564
- const num = Number(stringValue.replace(/%/g, ''));
565
- if (isNaN(num)) {
566
- return;
567
- }
568
- const amount = this.arrowOffset || 1;
569
- // Up
570
- if ($event.keyCode === 38) {
571
- if (this.label) {
572
- this.onChange.emit({
573
- data: { [this.label]: num + amount },
574
- $event,
575
- });
576
- }
577
- else {
578
- this.onChange.emit({ data: num + amount, $event });
579
- }
580
- if (isPercentage) {
581
- this.currentValue = `${num + amount}%`;
582
- }
583
- else {
584
- this.currentValue = num + amount;
585
- }
586
- }
587
- // Down
588
- if ($event.keyCode === 40) {
589
- if (this.label) {
590
- this.onChange.emit({
591
- data: { [this.label]: num - amount },
592
- $event,
593
- });
594
- }
595
- else {
596
- this.onChange.emit({ data: num - amount, $event });
597
- }
598
- if (isPercentage) {
599
- this.currentValue = `${num - amount}%`;
600
- }
601
- else {
602
- this.currentValue = num - amount;
603
- }
604
- }
605
- }
606
- handleKeyup($event) {
607
- if ($event.keyCode === 40 || $event.keyCode === 38) {
608
- return;
609
- }
610
- if (`${this.currentValue}` === $event.target.value) {
611
- return;
612
- }
613
- if (this.label) {
614
- this.onChange.emit({
615
- data: { [this.label]: $event.target.value },
616
- $event,
617
- });
618
- }
619
- else {
620
- this.onChange.emit({ data: $event.target.value, $event });
621
- }
622
- }
623
- ngOnChanges() {
624
- if (!this.focus) {
625
- this.currentValue = String(this.value).toUpperCase();
626
- this.blurValue = String(this.value).toUpperCase();
627
- }
628
- else {
629
- this.blurValue = String(this.value).toUpperCase();
630
- }
631
- }
632
- ngOnDestroy() {
633
- this.unsubscribe();
634
- }
635
- subscribe() {
636
- this.mousemove = fromEvent(document, 'mousemove').subscribe((ev) => this.handleDrag(ev));
637
- this.mouseup = fromEvent(document, 'mouseup').subscribe(() => this.unsubscribe());
638
- }
639
- unsubscribe() {
640
- var _a, _b;
641
- (_a = this.mousemove) === null || _a === void 0 ? void 0 : _a.unsubscribe();
642
- (_b = this.mouseup) === null || _b === void 0 ? void 0 : _b.unsubscribe();
643
- }
644
- handleMousedown($event) {
645
- if (this.dragLabel) {
646
- $event.preventDefault();
647
- this.handleDrag($event);
648
- this.subscribe();
649
- }
650
- }
651
- handleDrag($event) {
652
- if (this.dragLabel) {
653
- const newValue = Math.round(this.value + $event.movementX);
654
- if (newValue >= 0 && newValue <= this.dragMax) {
655
- this.onChange.emit({ data: { [this.label]: newValue }, $event });
656
- }
657
- }
658
- }
659
- }
660
- EditableInputComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: EditableInputComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
661
- EditableInputComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.2", type: EditableInputComponent, selector: "color-editable-input", inputs: { style: "style", label: "label", value: "value", arrowOffset: "arrowOffset", dragLabel: "dragLabel", dragMax: "dragMax", placeholder: "placeholder" }, outputs: { onChange: "onChange" }, usesOnChanges: true, ngImport: i0, template: `
662
- <div class="wrap" [ngStyle]="wrapStyle">
663
- <input
664
- [ngStyle]="inputStyle"
665
- spellCheck="false"
666
- [value]="currentValue"
667
- [placeholder]="placeholder"
668
- (keydown)="handleKeydown($event)"
669
- (keyup)="handleKeyup($event)"
670
- (focus)="handleFocus($event)"
671
- (focusout)="handleFocusOut($event)"
672
- [attr.aria-labelledby]="uniqueId"
673
- />
674
- <span [id]="uniqueId" *ngIf="label" [ngStyle]="labelStyle" (mousedown)="handleMousedown($event)">
675
- {{ label }}
676
- </span>
677
- </div>
678
- `, isInline: true, styles: [":host{display:flex}.wrap{position:relative}\n"], dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
679
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: EditableInputComponent, decorators: [{
680
- type: Component,
681
- args: [{ selector: 'color-editable-input', template: `
682
- <div class="wrap" [ngStyle]="wrapStyle">
683
- <input
684
- [ngStyle]="inputStyle"
685
- spellCheck="false"
686
- [value]="currentValue"
687
- [placeholder]="placeholder"
688
- (keydown)="handleKeydown($event)"
689
- (keyup)="handleKeyup($event)"
690
- (focus)="handleFocus($event)"
691
- (focusout)="handleFocusOut($event)"
692
- [attr.aria-labelledby]="uniqueId"
693
- />
694
- <span [id]="uniqueId" *ngIf="label" [ngStyle]="labelStyle" (mousedown)="handleMousedown($event)">
695
- {{ label }}
696
- </span>
697
- </div>
698
- `, changeDetection: ChangeDetectionStrategy.OnPush, styles: [":host{display:flex}.wrap{position:relative}\n"] }]
699
- }], propDecorators: { style: [{
700
- type: Input
701
- }], label: [{
702
- type: Input
703
- }], value: [{
704
- type: Input
705
- }], arrowOffset: [{
706
- type: Input
707
- }], dragLabel: [{
708
- type: Input
709
- }], dragMax: [{
710
- type: Input
711
- }], placeholder: [{
712
- type: Input
713
- }], onChange: [{
714
- type: Output
715
- }] } });
716
- class EditableInputModule {
717
- }
718
- EditableInputModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: EditableInputModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
719
- EditableInputModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.1.2", ngImport: i0, type: EditableInputModule, declarations: [EditableInputComponent], imports: [CommonModule], exports: [EditableInputComponent] });
720
- EditableInputModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: EditableInputModule, imports: [CommonModule] });
721
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: EditableInputModule, decorators: [{
722
- type: NgModule,
723
- args: [{
724
- declarations: [EditableInputComponent],
725
- exports: [EditableInputComponent],
726
- imports: [CommonModule],
727
- }]
728
- }] });
729
-
730
- class HueComponent {
731
- constructor() {
732
- this.hidePointer = false;
733
- this.direction = 'horizontal';
734
- this.onChange = new EventEmitter();
735
- this.left = '0px';
736
- this.top = '';
737
- }
738
- ngOnChanges() {
739
- if (this.direction === 'horizontal') {
740
- this.left = `${this.hsl.h * 100 / 360}%`;
741
- }
742
- else {
743
- this.top = `${-(this.hsl.h * 100 / 360) + 100}%`;
744
- }
745
- }
746
- handleChange({ top, left, containerHeight, containerWidth, $event }) {
747
- let data;
748
- if (this.direction === 'vertical') {
749
- let h;
750
- if (top < 0) {
751
- h = 359;
752
- }
753
- else if (top > containerHeight) {
754
- h = 0;
755
- }
756
- else {
757
- const percent = -(top * 100 / containerHeight) + 100;
758
- h = 360 * percent / 100;
759
- }
760
- if (this.hsl.h !== h) {
761
- data = {
762
- h,
763
- s: this.hsl.s,
764
- l: this.hsl.l,
765
- a: this.hsl.a,
766
- source: 'rgb',
767
- };
768
- }
769
- }
770
- else {
771
- let h;
772
- if (left < 0) {
773
- h = 0;
774
- }
775
- else if (left > containerWidth) {
776
- h = 359;
777
- }
778
- else {
779
- const percent = left * 100 / containerWidth;
780
- h = 360 * percent / 100;
781
- }
782
- if (this.hsl.h !== h) {
783
- data = {
784
- h,
785
- s: this.hsl.s,
786
- l: this.hsl.l,
787
- a: this.hsl.a,
788
- source: 'rgb',
789
- };
790
- }
791
- }
792
- if (!data) {
793
- return;
794
- }
795
- this.onChange.emit({ data, $event });
796
- }
797
- }
798
- HueComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: HueComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
799
- HueComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.2", type: HueComponent, selector: "color-hue", inputs: { hsl: "hsl", pointer: "pointer", radius: "radius", shadow: "shadow", hidePointer: "hidePointer", direction: "direction" }, outputs: { onChange: "onChange" }, usesOnChanges: true, ngImport: i0, template: `
800
- <div class="color-hue color-hue-{{direction}}" [style.border-radius.px]="radius" [style.box-shadow]="shadow">
801
- <div ngx-color-coordinates (coordinatesChange)="handleChange($event)" class="color-hue-container">
802
- <div class="color-hue-pointer" [style.left]="left" [style.top]="top" *ngIf="!hidePointer">
803
- <div class="color-hue-slider" [ngStyle]="pointer"></div>
804
- </div>
805
- </div>
806
- </div>
807
- `, isInline: true, styles: [".color-hue{position:absolute;top:0;bottom:0;left:0;right:0}.color-hue-container{margin:0 2px;position:relative;height:100%}.color-hue-pointer{position:absolute}.color-hue-slider{margin-top:1px;width:4px;border-radius:1px;height:8px;box-shadow:0 0 2px #0009;background:#fff;transform:translate(-2px)}.color-hue-horizontal{background:linear-gradient(to right,#f00 0%,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,#f00 100%)}.color-hue-vertical{background:linear-gradient(to top,#f00 0%,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,#f00 100%)}\n"], dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "directive", type: CoordinatesDirective, selector: "[ngx-color-coordinates]", outputs: ["coordinatesChange"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
808
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: HueComponent, decorators: [{
809
- type: Component,
810
- args: [{ selector: 'color-hue', template: `
811
- <div class="color-hue color-hue-{{direction}}" [style.border-radius.px]="radius" [style.box-shadow]="shadow">
812
- <div ngx-color-coordinates (coordinatesChange)="handleChange($event)" class="color-hue-container">
813
- <div class="color-hue-pointer" [style.left]="left" [style.top]="top" *ngIf="!hidePointer">
814
- <div class="color-hue-slider" [ngStyle]="pointer"></div>
815
- </div>
816
- </div>
817
- </div>
818
- `, preserveWhitespaces: false, changeDetection: ChangeDetectionStrategy.OnPush, styles: [".color-hue{position:absolute;top:0;bottom:0;left:0;right:0}.color-hue-container{margin:0 2px;position:relative;height:100%}.color-hue-pointer{position:absolute}.color-hue-slider{margin-top:1px;width:4px;border-radius:1px;height:8px;box-shadow:0 0 2px #0009;background:#fff;transform:translate(-2px)}.color-hue-horizontal{background:linear-gradient(to right,#f00 0%,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,#f00 100%)}.color-hue-vertical{background:linear-gradient(to top,#f00 0%,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,#f00 100%)}\n"] }]
819
- }], propDecorators: { hsl: [{
820
- type: Input
821
- }], pointer: [{
822
- type: Input
823
- }], radius: [{
824
- type: Input
825
- }], shadow: [{
826
- type: Input
827
- }], hidePointer: [{
828
- type: Input
829
- }], direction: [{
830
- type: Input
831
- }], onChange: [{
832
- type: Output
833
- }] } });
834
- class HueModule {
835
- }
836
- HueModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: HueModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
837
- HueModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.1.2", ngImport: i0, type: HueModule, declarations: [HueComponent], imports: [CommonModule, CoordinatesModule], exports: [HueComponent] });
838
- HueModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: HueModule, imports: [CommonModule, CoordinatesModule] });
839
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: HueModule, decorators: [{
840
- type: NgModule,
841
- args: [{
842
- declarations: [HueComponent],
843
- exports: [HueComponent],
844
- imports: [CommonModule, CoordinatesModule],
845
- }]
846
- }] });
847
-
848
- class RaisedComponent {
849
- constructor() {
850
- this.zDepth = 1;
851
- this.radius = 1;
852
- this.background = '#fff';
853
- }
854
- }
855
- RaisedComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: RaisedComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
856
- RaisedComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.2", type: RaisedComponent, selector: "color-raised", inputs: { zDepth: "zDepth", radius: "radius", background: "background" }, ngImport: i0, template: `
857
- <div class="raised-wrap">
858
- <div class="raised-bg zDepth-{{zDepth}}" [style.background]="background"></div>
859
- <div class="raised-content">
860
- <ng-content></ng-content>
861
- </div>
862
- </div>
863
- `, isInline: true, styles: [".raised-wrap{position:relative;display:inline-block}.raised-bg{position:absolute;top:0px;right:0px;bottom:0px;left:0px}.raised-content{position:relative}.zDepth-0{box-shadow:none}.zDepth-1{box-shadow:0 2px 10px #0000001f,0 2px 5px #00000029}.zDepth-2{box-shadow:0 6px 20px #00000030,0 8px 17px #0003}.zDepth-3{box-shadow:0 17px 50px #00000030,0 12px 15px #0000003d}.zDepth-4{box-shadow:0 25px 55px #00000036,0 16px 28px #00000038}.zDepth-5{box-shadow:0 40px 77px #00000038,0 27px 24px #0003}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
864
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: RaisedComponent, decorators: [{
865
- type: Component,
866
- args: [{ selector: 'color-raised', template: `
867
- <div class="raised-wrap">
868
- <div class="raised-bg zDepth-{{zDepth}}" [style.background]="background"></div>
869
- <div class="raised-content">
870
- <ng-content></ng-content>
871
- </div>
872
- </div>
873
- `, preserveWhitespaces: false, changeDetection: ChangeDetectionStrategy.OnPush, styles: [".raised-wrap{position:relative;display:inline-block}.raised-bg{position:absolute;top:0px;right:0px;bottom:0px;left:0px}.raised-content{position:relative}.zDepth-0{box-shadow:none}.zDepth-1{box-shadow:0 2px 10px #0000001f,0 2px 5px #00000029}.zDepth-2{box-shadow:0 6px 20px #00000030,0 8px 17px #0003}.zDepth-3{box-shadow:0 17px 50px #00000030,0 12px 15px #0000003d}.zDepth-4{box-shadow:0 25px 55px #00000036,0 16px 28px #00000038}.zDepth-5{box-shadow:0 40px 77px #00000038,0 27px 24px #0003}\n"] }]
874
- }], propDecorators: { zDepth: [{
875
- type: Input
876
- }], radius: [{
877
- type: Input
878
- }], background: [{
879
- type: Input
880
- }] } });
881
- class RaisedModule {
882
- }
883
- RaisedModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: RaisedModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
884
- RaisedModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.1.2", ngImport: i0, type: RaisedModule, declarations: [RaisedComponent], imports: [CommonModule], exports: [RaisedComponent] });
885
- RaisedModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: RaisedModule, imports: [CommonModule] });
886
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: RaisedModule, decorators: [{
887
- type: NgModule,
888
- args: [{
889
- declarations: [RaisedComponent],
890
- exports: [RaisedComponent],
891
- imports: [CommonModule],
892
- }]
893
- }] });
894
-
895
- class SaturationComponent {
896
- constructor() {
897
- this.onChange = new EventEmitter();
898
- }
899
- ngOnChanges() {
900
- this.background = `hsl(${this.hsl.h}, 100%, 50%)`;
901
- this.pointerTop = -(this.hsv.v * 100) + 1 + 100 + '%';
902
- this.pointerLeft = this.hsv.s * 100 + '%';
903
- }
904
- handleChange({ top, left, containerHeight, containerWidth, $event }) {
905
- if (left < 0) {
906
- left = 0;
907
- }
908
- else if (left > containerWidth) {
909
- left = containerWidth;
910
- }
911
- else if (top < 0) {
912
- top = 0;
913
- }
914
- else if (top > containerHeight) {
915
- top = containerHeight;
916
- }
917
- const saturation = left / containerWidth;
918
- let bright = -(top / containerHeight) + 1;
919
- bright = bright > 0 ? bright : 0;
920
- bright = bright > 1 ? 1 : bright;
921
- const data = {
922
- h: this.hsl.h,
923
- s: saturation,
924
- v: bright,
925
- a: this.hsl.a,
926
- source: 'hsva',
927
- };
928
- this.onChange.emit({ data, $event });
929
- }
930
- }
931
- SaturationComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: SaturationComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
932
- SaturationComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.2", type: SaturationComponent, selector: "color-saturation", inputs: { hsl: "hsl", hsv: "hsv", radius: "radius", pointer: "pointer", circle: "circle" }, outputs: { onChange: "onChange" }, usesOnChanges: true, ngImport: i0, template: `
933
- <div class="color-saturation" ngx-color-coordinates (coordinatesChange)="handleChange($event)" [style.background]="background">
934
- <div class="saturation-white">
935
- <div class="saturation-black"></div>
936
- <div class="saturation-pointer" [ngStyle]="pointer" [style.top]="pointerTop" [style.left]="pointerLeft">
937
- <div class="saturation-circle" [ngStyle]="circle"></div>
938
- </div>
939
- </div>
940
- </div>
941
- `, isInline: true, styles: [".saturation-white{background:linear-gradient(to right,#fff,rgba(255,255,255,0));position:absolute;top:0;bottom:0;left:0;right:0}.saturation-black{background:linear-gradient(to top,#000,rgba(0,0,0,0));position:absolute;top:0;bottom:0;left:0;right:0}.color-saturation{position:absolute;top:0;bottom:0;left:0;right:0}.saturation-pointer{position:absolute;cursor:default}.saturation-circle{width:4px;height:4px;box-shadow:0 0 0 1.5px #fff,inset 0 0 1px 1px #0000004d,0 0 1px 2px #0006;border-radius:50%;cursor:hand;transform:translate(-2px,-4px)}\n"], dependencies: [{ kind: "directive", type: i1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "directive", type: CoordinatesDirective, selector: "[ngx-color-coordinates]", outputs: ["coordinatesChange"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
942
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: SaturationComponent, decorators: [{
943
- type: Component,
944
- args: [{ selector: 'color-saturation', template: `
945
- <div class="color-saturation" ngx-color-coordinates (coordinatesChange)="handleChange($event)" [style.background]="background">
946
- <div class="saturation-white">
947
- <div class="saturation-black"></div>
948
- <div class="saturation-pointer" [ngStyle]="pointer" [style.top]="pointerTop" [style.left]="pointerLeft">
949
- <div class="saturation-circle" [ngStyle]="circle"></div>
950
- </div>
951
- </div>
952
- </div>
953
- `, preserveWhitespaces: false, changeDetection: ChangeDetectionStrategy.OnPush, styles: [".saturation-white{background:linear-gradient(to right,#fff,rgba(255,255,255,0));position:absolute;top:0;bottom:0;left:0;right:0}.saturation-black{background:linear-gradient(to top,#000,rgba(0,0,0,0));position:absolute;top:0;bottom:0;left:0;right:0}.color-saturation{position:absolute;top:0;bottom:0;left:0;right:0}.saturation-pointer{position:absolute;cursor:default}.saturation-circle{width:4px;height:4px;box-shadow:0 0 0 1.5px #fff,inset 0 0 1px 1px #0000004d,0 0 1px 2px #0006;border-radius:50%;cursor:hand;transform:translate(-2px,-4px)}\n"] }]
954
- }], propDecorators: { hsl: [{
955
- type: Input
956
- }], hsv: [{
957
- type: Input
958
- }], radius: [{
959
- type: Input
960
- }], pointer: [{
961
- type: Input
962
- }], circle: [{
963
- type: Input
964
- }], onChange: [{
965
- type: Output
966
- }] } });
967
- class SaturationModule {
968
- }
969
- SaturationModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: SaturationModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
970
- SaturationModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.1.2", ngImport: i0, type: SaturationModule, declarations: [SaturationComponent], imports: [CommonModule, CoordinatesModule], exports: [SaturationComponent] });
971
- SaturationModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: SaturationModule, imports: [CommonModule, CoordinatesModule] });
972
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: SaturationModule, decorators: [{
973
- type: NgModule,
974
- args: [{
975
- declarations: [SaturationComponent],
976
- exports: [SaturationComponent],
977
- imports: [CommonModule, CoordinatesModule],
978
- }]
979
- }] });
980
-
981
- class SwatchComponent {
982
- constructor() {
983
- this.style = {};
984
- this.focusStyle = {};
985
- this.onClick = new EventEmitter();
986
- this.onHover = new EventEmitter();
987
- this.divStyles = {};
988
- this.focusStyles = {};
989
- this.inFocus = false;
990
- }
991
- ngOnInit() {
992
- this.divStyles = Object.assign({ background: this.color }, this.style);
993
- }
994
- currentStyles() {
995
- this.focusStyles = Object.assign(Object.assign({}, this.divStyles), this.focusStyle);
996
- return this.focus || this.inFocus ? this.focusStyles : this.divStyles;
997
- }
998
- handleFocusOut() {
999
- this.inFocus = false;
1000
- }
1001
- handleFocus() {
1002
- this.inFocus = true;
1003
- }
1004
- handleHover(hex, $event) {
1005
- this.onHover.emit({ hex, $event });
1006
- }
1007
- handleClick(hex, $event) {
1008
- this.onClick.emit({ hex, $event });
1009
- }
1010
- }
1011
- SwatchComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: SwatchComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1012
- SwatchComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.2", type: SwatchComponent, selector: "color-swatch", inputs: { color: "color", style: "style", focusStyle: "focusStyle", focus: "focus" }, outputs: { onClick: "onClick", onHover: "onHover" }, ngImport: i0, template: `
1013
- <div
1014
- class="swatch"
1015
- [ngStyle]="currentStyles()"
1016
- [attr.title]="color"
1017
- (click)="handleClick(color, $event)"
1018
- (keydown.enter)="handleClick(color, $event)"
1019
- (focus)="handleFocus()"
1020
- (blur)="handleFocusOut()"
1021
- (mouseover)="handleHover(color, $event)"
1022
- tabindex="0"
1023
- >
1024
- <ng-content></ng-content>
1025
- <color-checkboard
1026
- *ngIf="color === 'transparent'"
1027
- boxShadow="inset 0 0 0 1px rgba(0,0,0,0.1)"
1028
- ></color-checkboard>
1029
- </div>
1030
- `, isInline: true, styles: [".swatch{outline:none;height:100%;width:100%;cursor:pointer;position:relative}\n"], dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "component", type: CheckboardComponent, selector: "color-checkboard", inputs: ["white", "size", "grey", "boxShadow", "borderRadius"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
1031
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: SwatchComponent, decorators: [{
1032
- type: Component,
1033
- args: [{ selector: 'color-swatch', template: `
1034
- <div
1035
- class="swatch"
1036
- [ngStyle]="currentStyles()"
1037
- [attr.title]="color"
1038
- (click)="handleClick(color, $event)"
1039
- (keydown.enter)="handleClick(color, $event)"
1040
- (focus)="handleFocus()"
1041
- (blur)="handleFocusOut()"
1042
- (mouseover)="handleHover(color, $event)"
1043
- tabindex="0"
1044
- >
1045
- <ng-content></ng-content>
1046
- <color-checkboard
1047
- *ngIf="color === 'transparent'"
1048
- boxShadow="inset 0 0 0 1px rgba(0,0,0,0.1)"
1049
- ></color-checkboard>
1050
- </div>
1051
- `, changeDetection: ChangeDetectionStrategy.OnPush, styles: [".swatch{outline:none;height:100%;width:100%;cursor:pointer;position:relative}\n"] }]
1052
- }], propDecorators: { color: [{
1053
- type: Input
1054
- }], style: [{
1055
- type: Input
1056
- }], focusStyle: [{
1057
- type: Input
1058
- }], focus: [{
1059
- type: Input
1060
- }], onClick: [{
1061
- type: Output
1062
- }], onHover: [{
1063
- type: Output
1064
- }] } });
1065
- class SwatchModule {
1066
- }
1067
- SwatchModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: SwatchModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1068
- SwatchModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.1.2", ngImport: i0, type: SwatchModule, declarations: [SwatchComponent], imports: [CommonModule, CheckboardModule], exports: [SwatchComponent] });
1069
- SwatchModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: SwatchModule, imports: [CommonModule, CheckboardModule] });
1070
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: SwatchModule, decorators: [{
1071
- type: NgModule,
1072
- args: [{
1073
- declarations: [SwatchComponent],
1074
- exports: [SwatchComponent],
1075
- imports: [CommonModule, CheckboardModule],
1076
- }]
1077
- }] });
1078
-
1079
- class ShadeComponent {
1080
- constructor() {
1081
- this.onChange = new EventEmitter();
1082
- }
1083
- ngOnChanges() {
1084
- this.gradient = {
1085
- background: `linear-gradient(to right,
1086
- hsl(${this.hsl.h}, 90%, 55%),
1087
- #000)`,
1088
- };
1089
- const hsv = new TinyColor(this.hsl).toHsv();
1090
- this.pointerLeft = 100 - (hsv.v * 100);
1091
- }
1092
- handleChange({ left, containerWidth, $event }) {
1093
- let data;
1094
- let v;
1095
- if (left < 0) {
1096
- v = 0;
1097
- }
1098
- else if (left > containerWidth) {
1099
- v = 1;
1100
- }
1101
- else {
1102
- v = Math.round((left * 100) / containerWidth) / 100;
1103
- }
1104
- const hsv = new TinyColor(this.hsl).toHsv();
1105
- if (hsv.v !== v) {
1106
- data = {
1107
- h: this.hsl.h,
1108
- s: 100,
1109
- v: 1 - v,
1110
- l: this.hsl.l,
1111
- a: this.hsl.a,
1112
- source: 'rgb',
1113
- };
1114
- }
1115
- if (!data) {
1116
- return;
1117
- }
1118
- this.onChange.emit({ data, $event });
1119
- }
1120
- }
1121
- ShadeComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: ShadeComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1122
- ShadeComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.2", type: ShadeComponent, selector: "color-shade", inputs: { hsl: "hsl", rgb: "rgb", pointer: "pointer", shadow: "shadow", radius: "radius" }, outputs: { onChange: "onChange" }, usesOnChanges: true, ngImport: i0, template: `
1123
- <div class="shade" [style.border-radius]="radius">
1124
- <div
1125
- class="shade-gradient"
1126
- [ngStyle]="gradient"
1127
- [style.box-shadow]="shadow"
1128
- [style.border-radius]="radius"
1129
- ></div>
1130
- <div
1131
- ngx-color-coordinates
1132
- (coordinatesChange)="handleChange($event)"
1133
- class="shade-container"
1134
- >
1135
- <div
1136
- class="shade-pointer"
1137
- [style.left.%]="pointerLeft"
1138
- [style.top.%]="pointerTop"
1139
- >
1140
- <div class="shade-slider" [ngStyle]="pointer"></div>
1141
- </div>
1142
- </div>
1143
- </div>
1144
- `, isInline: true, styles: [".shade,.shade-gradient{position:absolute;top:0;bottom:0;left:0;right:0}.shade-container{position:relative;height:100%;margin:0 3px}.shade-pointer{position:absolute}.shade-slider{width:4px;border-radius:1px;height:8px;box-shadow:0 0 2px #0009;background:#fff;margin-top:1px;transform:translate(-2px)}\n"], dependencies: [{ kind: "directive", type: i1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "directive", type: CoordinatesDirective, selector: "[ngx-color-coordinates]", outputs: ["coordinatesChange"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
1145
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: ShadeComponent, decorators: [{
1146
- type: Component,
1147
- args: [{ selector: 'color-shade', template: `
1148
- <div class="shade" [style.border-radius]="radius">
1149
- <div
1150
- class="shade-gradient"
1151
- [ngStyle]="gradient"
1152
- [style.box-shadow]="shadow"
1153
- [style.border-radius]="radius"
1154
- ></div>
1155
- <div
1156
- ngx-color-coordinates
1157
- (coordinatesChange)="handleChange($event)"
1158
- class="shade-container"
1159
- >
1160
- <div
1161
- class="shade-pointer"
1162
- [style.left.%]="pointerLeft"
1163
- [style.top.%]="pointerTop"
1164
- >
1165
- <div class="shade-slider" [ngStyle]="pointer"></div>
1166
- </div>
1167
- </div>
1168
- </div>
1169
- `, changeDetection: ChangeDetectionStrategy.OnPush, preserveWhitespaces: false, styles: [".shade,.shade-gradient{position:absolute;top:0;bottom:0;left:0;right:0}.shade-container{position:relative;height:100%;margin:0 3px}.shade-pointer{position:absolute}.shade-slider{width:4px;border-radius:1px;height:8px;box-shadow:0 0 2px #0009;background:#fff;margin-top:1px;transform:translate(-2px)}\n"] }]
1170
- }], propDecorators: { hsl: [{
1171
- type: Input
1172
- }], rgb: [{
1173
- type: Input
1174
- }], pointer: [{
1175
- type: Input
1176
- }], shadow: [{
1177
- type: Input
1178
- }], radius: [{
1179
- type: Input
1180
- }], onChange: [{
1181
- type: Output
1182
- }] } });
1183
- class ShadeModule {
1184
- }
1185
- ShadeModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: ShadeModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1186
- ShadeModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.1.2", ngImport: i0, type: ShadeModule, declarations: [ShadeComponent], imports: [CommonModule, CoordinatesModule], exports: [ShadeComponent] });
1187
- ShadeModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: ShadeModule, imports: [CommonModule, CoordinatesModule] });
1188
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: ShadeModule, decorators: [{
1189
- type: NgModule,
1190
- args: [{
1191
- declarations: [ShadeComponent],
1192
- exports: [ShadeComponent],
1193
- imports: [CommonModule, CoordinatesModule],
1194
- }]
1195
- }] });
1196
-
1197
- /**
1198
- * Generated bundle index. Do not edit.
1199
- */
1200
-
1201
- export { AlphaComponent, AlphaModule, CheckboardComponent, CheckboardModule, ColorMode, ColorWrap, ColorWrapModule, CoordinatesDirective, CoordinatesModule, EditableInputComponent, EditableInputModule, HueComponent, HueModule, RaisedComponent, RaisedModule, SaturationComponent, SaturationModule, ShadeComponent, ShadeModule, SwatchComponent, SwatchModule, getCheckerboard, getContrastingColor, isValidHex, render, simpleCheckForValidColor, toState };
1202
- //# sourceMappingURL=ngx-color.mjs.map