ngx-color 7.3.1 → 8.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.
- package/LICENSE +21 -0
- package/README.md +281 -0
- package/alpha.component.d.ts +1 -1
- package/checkboard.component.d.ts +1 -1
- package/color-wrap.component.d.ts +1 -1
- package/coordinates.directive.d.ts +1 -1
- package/editable-input.component.d.ts +1 -1
- package/esm2020/alpha.component.mjs +13 -61
- package/esm2020/checkboard.component.mjs +9 -25
- package/esm2020/color-wrap.component.mjs +8 -8
- package/esm2020/coordinates.directive.mjs +7 -7
- package/esm2020/editable-input.component.mjs +11 -25
- package/esm2020/hue.component.mjs +13 -54
- package/esm2020/raised.component.mjs +10 -49
- package/esm2020/saturation.component.mjs +13 -57
- package/esm2020/shade.component.mjs +11 -51
- package/esm2020/swatch.component.mjs +13 -28
- package/fesm2015/ngx-color.mjs +92 -349
- package/fesm2015/ngx-color.mjs.map +1 -1
- package/fesm2020/ngx-color.mjs +92 -349
- package/fesm2020/ngx-color.mjs.map +1 -1
- package/hue.component.d.ts +1 -1
- package/{ngx-color.d.ts → index.d.ts} +0 -0
- package/package.json +11 -123
- package/raised.component.d.ts +1 -1
- package/saturation.component.d.ts +1 -1
- package/shade.component.d.ts +1 -1
- package/swatch.component.d.ts +1 -1
- package/alpha/alpha-picker.component.d.ts +0 -28
- package/alpha/ngx-color-alpha.d.ts +0 -5
- package/alpha/package.json +0 -17
- package/alpha/public_api.d.ts +0 -1
- package/block/block-swatches.component.d.ts +0 -24
- package/block/block.component.d.ts +0 -36
- package/block/ngx-color-block.d.ts +0 -5
- package/block/package.json +0 -16
- package/block/public_api.d.ts +0 -2
- package/chrome/chrome-fields.component.d.ts +0 -22
- package/chrome/chrome.component.d.ts +0 -25
- package/chrome/ngx-color-chrome.d.ts +0 -5
- package/chrome/package.json +0 -16
- package/chrome/public_api.d.ts +0 -2
- package/circle/circle-swatch.component.d.ts +0 -19
- package/circle/circle.component.d.ts +0 -32
- package/circle/ngx-color-circle.d.ts +0 -5
- package/circle/package.json +0 -19
- package/circle/public_api.d.ts +0 -2
- package/compact/compact-color.component.d.ts +0 -19
- package/compact/compact-fields.component.d.ts +0 -32
- package/compact/compact.component.d.ts +0 -30
- package/compact/ngx-color-compact.d.ts +0 -5
- package/compact/package.json +0 -16
- package/compact/public_api.d.ts +0 -3
- package/esm2020/alpha/alpha-picker.component.mjs +0 -116
- package/esm2020/alpha/ngx-color-alpha.mjs +0 -5
- package/esm2020/alpha/public_api.mjs +0 -2
- package/esm2020/block/block-swatches.component.mjs +0 -74
- package/esm2020/block/block.component.mjs +0 -199
- package/esm2020/block/ngx-color-block.mjs +0 -5
- package/esm2020/block/public_api.mjs +0 -3
- package/esm2020/chrome/chrome-fields.component.mjs +0 -356
- package/esm2020/chrome/chrome.component.mjs +0 -249
- package/esm2020/chrome/ngx-color-chrome.mjs +0 -5
- package/esm2020/chrome/public_api.mjs +0 -3
- package/esm2020/circle/circle-swatch.component.mjs +0 -85
- package/esm2020/circle/circle.component.mjs +0 -148
- package/esm2020/circle/ngx-color-circle.mjs +0 -5
- package/esm2020/circle/public_api.mjs +0 -3
- package/esm2020/compact/compact-color.component.mjs +0 -91
- package/esm2020/compact/compact-fields.component.mjs +0 -186
- package/esm2020/compact/compact.component.mjs +0 -177
- package/esm2020/compact/ngx-color-compact.mjs +0 -5
- package/esm2020/compact/public_api.mjs +0 -4
- package/esm2020/github/github-swatch.component.mjs +0 -67
- package/esm2020/github/github.component.mjs +0 -179
- package/esm2020/github/ngx-color-github.mjs +0 -5
- package/esm2020/github/public_api.mjs +0 -3
- package/esm2020/hue/hue-picker.component.mjs +0 -113
- package/esm2020/hue/ngx-color-hue.mjs +0 -5
- package/esm2020/hue/public_api.mjs +0 -2
- package/esm2020/material/material.component.mjs +0 -211
- package/esm2020/material/ngx-color-material.mjs +0 -5
- package/esm2020/material/public_api.mjs +0 -2
- package/esm2020/photoshop/ngx-color-photoshop.mjs +0 -5
- package/esm2020/photoshop/photoshop-button.component.mjs +0 -63
- package/esm2020/photoshop/photoshop-fields.component.mjs +0 -241
- package/esm2020/photoshop/photoshop-previews.component.mjs +0 -68
- package/esm2020/photoshop/photoshop.component.mjs +0 -258
- package/esm2020/photoshop/public_api.mjs +0 -5
- package/esm2020/shade/ngx-color-shade.mjs +0 -5
- package/esm2020/shade/public_api.mjs +0 -2
- package/esm2020/shade/shade-picker.component.mjs +0 -105
- package/esm2020/sketch/ngx-color-sketch.mjs +0 -5
- package/esm2020/sketch/public_api.mjs +0 -4
- package/esm2020/sketch/sketch-fields.component.mjs +0 -243
- package/esm2020/sketch/sketch-preset-colors.component.mjs +0 -98
- package/esm2020/sketch/sketch.component.mjs +0 -283
- package/esm2020/slider/ngx-color-slider.mjs +0 -5
- package/esm2020/slider/public_api.mjs +0 -4
- package/esm2020/slider/slider-swatch.component.mjs +0 -80
- package/esm2020/slider/slider-swatches.component.mjs +0 -135
- package/esm2020/slider/slider.component.mjs +0 -116
- package/esm2020/swatches/ngx-color-swatches.mjs +0 -5
- package/esm2020/swatches/public_api.mjs +0 -4
- package/esm2020/swatches/swatches-color.component.mjs +0 -123
- package/esm2020/swatches/swatches-group.component.mjs +0 -64
- package/esm2020/swatches/swatches.component.mjs +0 -258
- package/esm2020/twitter/ngx-color-twitter.mjs +0 -5
- package/esm2020/twitter/public_api.mjs +0 -2
- package/esm2020/twitter/twitter.component.mjs +0 -255
- package/fesm2015/ngx-color-alpha.mjs +0 -123
- package/fesm2015/ngx-color-alpha.mjs.map +0 -1
- package/fesm2015/ngx-color-block.mjs +0 -275
- package/fesm2015/ngx-color-block.mjs.map +0 -1
- package/fesm2015/ngx-color-chrome.mjs +0 -606
- package/fesm2015/ngx-color-chrome.mjs.map +0 -1
- package/fesm2015/ngx-color-circle.mjs +0 -237
- package/fesm2015/ngx-color-circle.mjs.map +0 -1
- package/fesm2015/ngx-color-compact.mjs +0 -451
- package/fesm2015/ngx-color-compact.mjs.map +0 -1
- package/fesm2015/ngx-color-github.mjs +0 -250
- package/fesm2015/ngx-color-github.mjs.map +0 -1
- package/fesm2015/ngx-color-hue.mjs +0 -120
- package/fesm2015/ngx-color-hue.mjs.map +0 -1
- package/fesm2015/ngx-color-material.mjs +0 -218
- package/fesm2015/ngx-color-material.mjs.map +0 -1
- package/fesm2015/ngx-color-photoshop.mjs +0 -626
- package/fesm2015/ngx-color-photoshop.mjs.map +0 -1
- package/fesm2015/ngx-color-shade.mjs +0 -112
- package/fesm2015/ngx-color-shade.mjs.map +0 -1
- package/fesm2015/ngx-color-sketch.mjs +0 -620
- package/fesm2015/ngx-color-sketch.mjs.map +0 -1
- package/fesm2015/ngx-color-slider.mjs +0 -331
- package/fesm2015/ngx-color-slider.mjs.map +0 -1
- package/fesm2015/ngx-color-swatches.mjs +0 -441
- package/fesm2015/ngx-color-swatches.mjs.map +0 -1
- package/fesm2015/ngx-color-twitter.mjs +0 -262
- package/fesm2015/ngx-color-twitter.mjs.map +0 -1
- package/fesm2020/ngx-color-alpha.mjs +0 -123
- package/fesm2020/ngx-color-alpha.mjs.map +0 -1
- package/fesm2020/ngx-color-block.mjs +0 -275
- package/fesm2020/ngx-color-block.mjs.map +0 -1
- package/fesm2020/ngx-color-chrome.mjs +0 -606
- package/fesm2020/ngx-color-chrome.mjs.map +0 -1
- package/fesm2020/ngx-color-circle.mjs +0 -237
- package/fesm2020/ngx-color-circle.mjs.map +0 -1
- package/fesm2020/ngx-color-compact.mjs +0 -451
- package/fesm2020/ngx-color-compact.mjs.map +0 -1
- package/fesm2020/ngx-color-github.mjs +0 -250
- package/fesm2020/ngx-color-github.mjs.map +0 -1
- package/fesm2020/ngx-color-hue.mjs +0 -120
- package/fesm2020/ngx-color-hue.mjs.map +0 -1
- package/fesm2020/ngx-color-material.mjs +0 -218
- package/fesm2020/ngx-color-material.mjs.map +0 -1
- package/fesm2020/ngx-color-photoshop.mjs +0 -626
- package/fesm2020/ngx-color-photoshop.mjs.map +0 -1
- package/fesm2020/ngx-color-shade.mjs +0 -112
- package/fesm2020/ngx-color-shade.mjs.map +0 -1
- package/fesm2020/ngx-color-sketch.mjs +0 -620
- package/fesm2020/ngx-color-sketch.mjs.map +0 -1
- package/fesm2020/ngx-color-slider.mjs +0 -331
- package/fesm2020/ngx-color-slider.mjs.map +0 -1
- package/fesm2020/ngx-color-swatches.mjs +0 -441
- package/fesm2020/ngx-color-swatches.mjs.map +0 -1
- package/fesm2020/ngx-color-twitter.mjs +0 -262
- package/fesm2020/ngx-color-twitter.mjs.map +0 -1
- package/github/github-swatch.component.d.ts +0 -19
- package/github/github.component.d.ts +0 -28
- package/github/ngx-color-github.d.ts +0 -5
- package/github/package.json +0 -16
- package/github/public_api.d.ts +0 -2
- package/hue/hue-picker.component.d.ts +0 -29
- package/hue/ngx-color-hue.d.ts +0 -5
- package/hue/package.json +0 -15
- package/hue/public_api.d.ts +0 -1
- package/material/material.component.d.ts +0 -39
- package/material/ngx-color-material.d.ts +0 -5
- package/material/package.json +0 -15
- package/material/public_api.d.ts +0 -1
- package/photoshop/ngx-color-photoshop.d.ts +0 -5
- package/photoshop/package.json +0 -15
- package/photoshop/photoshop-button.component.d.ts +0 -9
- package/photoshop/photoshop-fields.component.d.ts +0 -22
- package/photoshop/photoshop-previews.component.d.ts +0 -11
- package/photoshop/photoshop.component.d.ts +0 -33
- package/photoshop/public_api.d.ts +0 -4
- package/shade/ngx-color-shade.d.ts +0 -5
- package/shade/package.json +0 -17
- package/shade/public_api.d.ts +0 -1
- package/shade/shade-picker.component.d.ts +0 -27
- package/sketch/ngx-color-sketch.d.ts +0 -5
- package/sketch/package.json +0 -15
- package/sketch/public_api.d.ts +0 -3
- package/sketch/sketch-fields.component.d.ts +0 -23
- package/sketch/sketch-preset-colors.component.d.ts +0 -24
- package/sketch/sketch.component.d.ts +0 -32
- package/slider/ngx-color-slider.d.ts +0 -5
- package/slider/package.json +0 -15
- package/slider/public_api.d.ts +0 -3
- package/slider/slider-swatch.component.d.ts +0 -16
- package/slider/slider-swatches.component.d.ts +0 -15
- package/slider/slider.component.d.ts +0 -22
- package/swatches/ngx-color-swatches.d.ts +0 -5
- package/swatches/package.json +0 -18
- package/swatches/public_api.d.ts +0 -3
- package/swatches/swatches-color.component.d.ts +0 -18
- package/swatches/swatches-group.component.d.ts +0 -10
- package/swatches/swatches.component.d.ts +0 -29
- package/twitter/ngx-color-twitter.d.ts +0 -5
- package/twitter/package.json +0 -15
- package/twitter/public_api.d.ts +0 -1
- package/twitter/twitter.component.d.ts +0 -31
@@ -1,275 +0,0 @@
|
|
1
|
-
import * as i0 from '@angular/core';
|
2
|
-
import { EventEmitter, Component, Input, Output, forwardRef, ChangeDetectionStrategy, NgModule } from '@angular/core';
|
3
|
-
import * as i1 from 'ngx-color';
|
4
|
-
import { ColorWrap, getContrastingColor, isValidHex, CheckboardModule, SwatchModule, EditableInputModule } from 'ngx-color';
|
5
|
-
import * as i2 from '@angular/common';
|
6
|
-
import { CommonModule } from '@angular/common';
|
7
|
-
import { NG_VALUE_ACCESSOR } from '@angular/forms';
|
8
|
-
|
9
|
-
class BlockSwatchesComponent {
|
10
|
-
constructor() {
|
11
|
-
this.onClick = new EventEmitter();
|
12
|
-
this.onSwatchHover = new EventEmitter();
|
13
|
-
this.swatchStyle = {
|
14
|
-
width: '22px',
|
15
|
-
height: '22px',
|
16
|
-
float: 'left',
|
17
|
-
marginRight: '10px',
|
18
|
-
marginBottom: '10px',
|
19
|
-
borderRadius: '4px',
|
20
|
-
};
|
21
|
-
}
|
22
|
-
handleClick({ hex, $event }) {
|
23
|
-
this.onClick.emit({ hex, $event });
|
24
|
-
}
|
25
|
-
focusStyle(c) {
|
26
|
-
return {
|
27
|
-
boxShadow: `${c} 0 0 4px`,
|
28
|
-
};
|
29
|
-
}
|
30
|
-
}
|
31
|
-
BlockSwatchesComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: BlockSwatchesComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
32
|
-
BlockSwatchesComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.0", type: BlockSwatchesComponent, selector: "color-block-swatches", inputs: { colors: "colors" }, outputs: { onClick: "onClick", onSwatchHover: "onSwatchHover" }, ngImport: i0, template: `
|
33
|
-
<div class="block-swatches">
|
34
|
-
<color-swatch
|
35
|
-
*ngFor="let c of colors"
|
36
|
-
[color]="c"
|
37
|
-
[style]="swatchStyle"
|
38
|
-
[focusStyle]="focusStyle(c)"
|
39
|
-
(onClick)="handleClick($event)"
|
40
|
-
(onHover)="onSwatchHover.emit($event)"
|
41
|
-
></color-swatch>
|
42
|
-
<div class="clear"></div>
|
43
|
-
</div>
|
44
|
-
`, isInline: true, styles: [".block-swatches{margin-right:-10px}.clear{clear:both}\n"], components: [{ type: i1.SwatchComponent, selector: "color-swatch", inputs: ["color", "style", "focusStyle", "focus"], outputs: ["onClick", "onHover"] }], directives: [{ type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }] });
|
45
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: BlockSwatchesComponent, decorators: [{
|
46
|
-
type: Component,
|
47
|
-
args: [{
|
48
|
-
selector: 'color-block-swatches',
|
49
|
-
template: `
|
50
|
-
<div class="block-swatches">
|
51
|
-
<color-swatch
|
52
|
-
*ngFor="let c of colors"
|
53
|
-
[color]="c"
|
54
|
-
[style]="swatchStyle"
|
55
|
-
[focusStyle]="focusStyle(c)"
|
56
|
-
(onClick)="handleClick($event)"
|
57
|
-
(onHover)="onSwatchHover.emit($event)"
|
58
|
-
></color-swatch>
|
59
|
-
<div class="clear"></div>
|
60
|
-
</div>
|
61
|
-
`,
|
62
|
-
styles: [`
|
63
|
-
.block-swatches {
|
64
|
-
margin-right: -10px;
|
65
|
-
}
|
66
|
-
.clear {
|
67
|
-
clear: both;
|
68
|
-
}
|
69
|
-
`],
|
70
|
-
}]
|
71
|
-
}], propDecorators: { colors: [{
|
72
|
-
type: Input
|
73
|
-
}], onClick: [{
|
74
|
-
type: Output
|
75
|
-
}], onSwatchHover: [{
|
76
|
-
type: Output
|
77
|
-
}] } });
|
78
|
-
|
79
|
-
class BlockComponent extends ColorWrap {
|
80
|
-
constructor() {
|
81
|
-
super();
|
82
|
-
/** Pixel value for picker width */
|
83
|
-
this.width = 170;
|
84
|
-
/** Color squares to display */
|
85
|
-
this.colors = [
|
86
|
-
'#D9E3F0',
|
87
|
-
'#F47373',
|
88
|
-
'#697689',
|
89
|
-
'#37D67A',
|
90
|
-
'#2CCCE4',
|
91
|
-
'#555555',
|
92
|
-
'#dce775',
|
93
|
-
'#ff8a65',
|
94
|
-
'#ba68c8',
|
95
|
-
];
|
96
|
-
this.triangle = 'top';
|
97
|
-
this.input = {
|
98
|
-
width: '100%',
|
99
|
-
fontSize: '12px',
|
100
|
-
color: '#666',
|
101
|
-
border: '0px',
|
102
|
-
outline: 'none',
|
103
|
-
height: '22px',
|
104
|
-
boxShadow: 'inset 0 0 0 1px #ddd',
|
105
|
-
borderRadius: '4px',
|
106
|
-
padding: '0 7px',
|
107
|
-
boxSizing: 'border-box',
|
108
|
-
};
|
109
|
-
this.wrap = {
|
110
|
-
position: 'relative',
|
111
|
-
width: '100%',
|
112
|
-
};
|
113
|
-
this.disableAlpha = true;
|
114
|
-
}
|
115
|
-
handleValueChange({ data, $event }) {
|
116
|
-
this.handleBlockChange({ hex: data, $event });
|
117
|
-
}
|
118
|
-
getContrastingColor(hex) {
|
119
|
-
return getContrastingColor(hex);
|
120
|
-
}
|
121
|
-
handleBlockChange({ hex, $event }) {
|
122
|
-
if (isValidHex(hex)) {
|
123
|
-
// this.hex = hex;
|
124
|
-
this.handleChange({
|
125
|
-
hex,
|
126
|
-
source: 'hex',
|
127
|
-
}, $event);
|
128
|
-
}
|
129
|
-
}
|
130
|
-
}
|
131
|
-
BlockComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: BlockComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
132
|
-
BlockComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.0", type: BlockComponent, selector: "color-block", inputs: { width: "width", colors: "colors", triangle: "triangle" }, providers: [
|
133
|
-
{
|
134
|
-
provide: NG_VALUE_ACCESSOR,
|
135
|
-
useExisting: forwardRef(() => BlockComponent),
|
136
|
-
multi: true,
|
137
|
-
},
|
138
|
-
{
|
139
|
-
provide: ColorWrap,
|
140
|
-
useExisting: forwardRef(() => BlockComponent),
|
141
|
-
},
|
142
|
-
], usesInheritance: true, ngImport: i0, template: `
|
143
|
-
<div class="block-card block-picker {{ className }}">
|
144
|
-
<div class="block-triangle" *ngIf="triangle !== 'hide'"
|
145
|
-
[style.border-color]="'transparent transparent ' + this.hex + ' transparent'"
|
146
|
-
></div>
|
147
|
-
|
148
|
-
<div class="block-head" [style.background]="hex">
|
149
|
-
<color-checkboard *ngIf="hex === 'transparent'"
|
150
|
-
borderRadius="6px 6px 0 0"
|
151
|
-
></color-checkboard>
|
152
|
-
<div class="block-label" [style.color]="getContrastingColor(hex)">
|
153
|
-
{{ hex }}
|
154
|
-
</div>
|
155
|
-
</div>
|
156
|
-
|
157
|
-
<div class="block-body">
|
158
|
-
<color-block-swatches [colors]="colors"
|
159
|
-
(onClick)="handleBlockChange($event)"
|
160
|
-
(onSwatchHover)="onSwatchHover.emit($event)"
|
161
|
-
></color-block-swatches>
|
162
|
-
<color-editable-input [value]="hex"
|
163
|
-
(onChange)="handleValueChange($event)"
|
164
|
-
[style]="{input: input, wrap: wrap}"
|
165
|
-
></color-editable-input>
|
166
|
-
</div>
|
167
|
-
</div>
|
168
|
-
`, isInline: true, styles: [".block-card{background:#fff;border-radius:6px;box-shadow:0 1px #0000001a;position:relative}.block-head{align-items:center;border-radius:6px 6px 0 0;display:flex;height:110px;justify-content:center;position:relative}.block-body{padding:10px}.block-label{font-size:18px;position:relative}.block-triangle{border-style:solid;border-width:0 10px 10px 10px;height:0;left:50%;margin-left:-10px;position:absolute;top:-10px;width:0}\n"], components: [{ type: i0.forwardRef(function () { return i1.CheckboardComponent; }), selector: "color-checkboard", inputs: ["white", "size", "grey", "boxShadow", "borderRadius"] }, { type: i0.forwardRef(function () { return BlockSwatchesComponent; }), selector: "color-block-swatches", inputs: ["colors"], outputs: ["onClick", "onSwatchHover"] }, { type: i0.forwardRef(function () { return i1.EditableInputComponent; }), selector: "color-editable-input", inputs: ["style", "label", "value", "arrowOffset", "dragLabel", "dragMax", "placeholder"], outputs: ["onChange"] }], directives: [{ type: i0.forwardRef(function () { return i2.NgIf; }), selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
169
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: BlockComponent, decorators: [{
|
170
|
-
type: Component,
|
171
|
-
args: [{
|
172
|
-
selector: 'color-block',
|
173
|
-
template: `
|
174
|
-
<div class="block-card block-picker {{ className }}">
|
175
|
-
<div class="block-triangle" *ngIf="triangle !== 'hide'"
|
176
|
-
[style.border-color]="'transparent transparent ' + this.hex + ' transparent'"
|
177
|
-
></div>
|
178
|
-
|
179
|
-
<div class="block-head" [style.background]="hex">
|
180
|
-
<color-checkboard *ngIf="hex === 'transparent'"
|
181
|
-
borderRadius="6px 6px 0 0"
|
182
|
-
></color-checkboard>
|
183
|
-
<div class="block-label" [style.color]="getContrastingColor(hex)">
|
184
|
-
{{ hex }}
|
185
|
-
</div>
|
186
|
-
</div>
|
187
|
-
|
188
|
-
<div class="block-body">
|
189
|
-
<color-block-swatches [colors]="colors"
|
190
|
-
(onClick)="handleBlockChange($event)"
|
191
|
-
(onSwatchHover)="onSwatchHover.emit($event)"
|
192
|
-
></color-block-swatches>
|
193
|
-
<color-editable-input [value]="hex"
|
194
|
-
(onChange)="handleValueChange($event)"
|
195
|
-
[style]="{input: input, wrap: wrap}"
|
196
|
-
></color-editable-input>
|
197
|
-
</div>
|
198
|
-
</div>
|
199
|
-
`,
|
200
|
-
styles: [
|
201
|
-
`
|
202
|
-
.block-card {
|
203
|
-
background: #fff;
|
204
|
-
border-radius: 6px;
|
205
|
-
box-shadow: 0 1px rgba(0, 0, 0, .1);
|
206
|
-
position: relative;
|
207
|
-
}
|
208
|
-
.block-head {
|
209
|
-
align-items: center;
|
210
|
-
border-radius: 6px 6px 0 0;
|
211
|
-
display: flex;
|
212
|
-
height: 110px;
|
213
|
-
justify-content: center;
|
214
|
-
position: relative;
|
215
|
-
}
|
216
|
-
.block-body {
|
217
|
-
padding: 10px;
|
218
|
-
}
|
219
|
-
.block-label {
|
220
|
-
font-size: 18px;
|
221
|
-
position: relative;
|
222
|
-
}
|
223
|
-
.block-triangle {
|
224
|
-
border-style: solid;
|
225
|
-
border-width: 0 10px 10px 10px;
|
226
|
-
height: 0;
|
227
|
-
left: 50%;
|
228
|
-
margin-left: -10px;
|
229
|
-
position: absolute;
|
230
|
-
top: -10px;
|
231
|
-
width: 0;
|
232
|
-
}
|
233
|
-
`,
|
234
|
-
],
|
235
|
-
preserveWhitespaces: false,
|
236
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
237
|
-
providers: [
|
238
|
-
{
|
239
|
-
provide: NG_VALUE_ACCESSOR,
|
240
|
-
useExisting: forwardRef(() => BlockComponent),
|
241
|
-
multi: true,
|
242
|
-
},
|
243
|
-
{
|
244
|
-
provide: ColorWrap,
|
245
|
-
useExisting: forwardRef(() => BlockComponent),
|
246
|
-
},
|
247
|
-
]
|
248
|
-
}]
|
249
|
-
}], ctorParameters: function () { return []; }, propDecorators: { width: [{
|
250
|
-
type: Input
|
251
|
-
}], colors: [{
|
252
|
-
type: Input
|
253
|
-
}], triangle: [{
|
254
|
-
type: Input
|
255
|
-
}] } });
|
256
|
-
class ColorBlockModule {
|
257
|
-
}
|
258
|
-
ColorBlockModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: ColorBlockModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
259
|
-
ColorBlockModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: ColorBlockModule, declarations: [BlockComponent, BlockSwatchesComponent], imports: [CommonModule, CheckboardModule, SwatchModule, EditableInputModule], exports: [BlockComponent, BlockSwatchesComponent] });
|
260
|
-
ColorBlockModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: ColorBlockModule, imports: [[CommonModule, CheckboardModule, SwatchModule, EditableInputModule]] });
|
261
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: ColorBlockModule, decorators: [{
|
262
|
-
type: NgModule,
|
263
|
-
args: [{
|
264
|
-
declarations: [BlockComponent, BlockSwatchesComponent],
|
265
|
-
exports: [BlockComponent, BlockSwatchesComponent],
|
266
|
-
imports: [CommonModule, CheckboardModule, SwatchModule, EditableInputModule],
|
267
|
-
}]
|
268
|
-
}] });
|
269
|
-
|
270
|
-
/**
|
271
|
-
* Generated bundle index. Do not edit.
|
272
|
-
*/
|
273
|
-
|
274
|
-
export { BlockComponent, BlockSwatchesComponent, ColorBlockModule };
|
275
|
-
//# sourceMappingURL=ngx-color-block.mjs.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"ngx-color-block.mjs","sources":["../../src/lib/block/block-swatches.component.ts","../../src/lib/block/block.component.ts","../../src/lib/block/ngx-color-block.ts"],"sourcesContent":["import { Component, EventEmitter, Input, Output } from '@angular/core';\n@Component({\n selector: 'color-block-swatches',\n template: `\n <div class=\"block-swatches\">\n <color-swatch\n *ngFor=\"let c of colors\"\n [color]=\"c\"\n [style]=\"swatchStyle\"\n [focusStyle]=\"focusStyle(c)\"\n (onClick)=\"handleClick($event)\"\n (onHover)=\"onSwatchHover.emit($event)\"\n ></color-swatch>\n <div class=\"clear\"></div>\n </div>\n `,\n styles: [`\n .block-swatches {\n margin-right: -10px;\n }\n .clear {\n clear: both;\n }\n `],\n})\nexport class BlockSwatchesComponent {\n @Input() colors!: string[];\n @Output() onClick = new EventEmitter<any>();\n @Output() onSwatchHover = new EventEmitter<any>();\n\n swatchStyle = {\n width: '22px',\n height: '22px',\n float: 'left',\n marginRight: '10px',\n marginBottom: '10px',\n borderRadius: '4px',\n };\n\n handleClick({hex, $event}) {\n this.onClick.emit({hex, $event});\n }\n focusStyle(c) {\n return {\n boxShadow: `${ c } 0 0 4px`,\n };\n }\n\n}\n","import { CommonModule } from '@angular/common';\nimport { ChangeDetectionStrategy, Component, forwardRef, Input, NgModule } from '@angular/core';\n\nimport {\n CheckboardModule,\n ColorWrap,\n EditableInputModule,\n getContrastingColor,\n isValidHex,\n SwatchModule,\n} from 'ngx-color';\nimport { BlockSwatchesComponent } from './block-swatches.component';\nimport { NG_VALUE_ACCESSOR } from '@angular/forms';\n\n@Component({\n selector: 'color-block',\n template: `\n <div class=\"block-card block-picker {{ className }}\">\n <div class=\"block-triangle\" *ngIf=\"triangle !== 'hide'\"\n [style.border-color]=\"'transparent transparent ' + this.hex + ' transparent'\"\n ></div>\n\n <div class=\"block-head\" [style.background]=\"hex\">\n <color-checkboard *ngIf=\"hex === 'transparent'\"\n borderRadius=\"6px 6px 0 0\"\n ></color-checkboard>\n <div class=\"block-label\" [style.color]=\"getContrastingColor(hex)\">\n {{ hex }}\n </div>\n </div>\n\n <div class=\"block-body\">\n <color-block-swatches [colors]=\"colors\"\n (onClick)=\"handleBlockChange($event)\"\n (onSwatchHover)=\"onSwatchHover.emit($event)\"\n ></color-block-swatches>\n <color-editable-input [value]=\"hex\"\n (onChange)=\"handleValueChange($event)\"\n [style]=\"{input: input, wrap: wrap}\"\n ></color-editable-input>\n </div>\n </div>\n `,\n styles: [\n `\n .block-card {\n background: #fff;\n border-radius: 6px;\n box-shadow: 0 1px rgba(0, 0, 0, .1);\n position: relative;\n }\n .block-head {\n align-items: center;\n border-radius: 6px 6px 0 0;\n display: flex;\n height: 110px;\n justify-content: center;\n position: relative;\n }\n .block-body {\n padding: 10px;\n }\n .block-label {\n font-size: 18px;\n position: relative;\n }\n .block-triangle {\n border-style: solid;\n border-width: 0 10px 10px 10px;\n height: 0;\n left: 50%;\n margin-left: -10px;\n position: absolute;\n top: -10px;\n width: 0;\n }\n `,\n ],\n preserveWhitespaces: false,\n changeDetection: ChangeDetectionStrategy.OnPush,\n providers: [\n {\n provide: NG_VALUE_ACCESSOR,\n useExisting: forwardRef(() => BlockComponent),\n multi: true,\n },\n {\n provide: ColorWrap,\n useExisting: forwardRef(() => BlockComponent),\n },\n ]\n})\nexport class BlockComponent extends ColorWrap {\n /** Pixel value for picker width */\n @Input() width: string | number = 170;\n /** Color squares to display */\n @Input() colors = [\n '#D9E3F0',\n '#F47373',\n '#697689',\n '#37D67A',\n '#2CCCE4',\n '#555555',\n '#dce775',\n '#ff8a65',\n '#ba68c8',\n ];\n @Input() triangle: 'top' | 'hide' = 'top';\n input: {[key: string]: string} = {\n width: '100%',\n fontSize: '12px',\n color: '#666',\n border: '0px',\n outline: 'none',\n height: '22px',\n boxShadow: 'inset 0 0 0 1px #ddd',\n borderRadius: '4px',\n padding: '0 7px',\n boxSizing: 'border-box',\n };\n wrap: {[key: string]: string} = {\n position: 'relative',\n width: '100%',\n };\n disableAlpha = true;\n\n constructor() {\n super();\n }\n\n handleValueChange({ data, $event }) {\n this.handleBlockChange({ hex: data, $event });\n }\n getContrastingColor(hex) {\n return getContrastingColor(hex);\n }\n handleBlockChange({ hex, $event }) {\n if (isValidHex(hex)) {\n // this.hex = hex;\n this.handleChange(\n {\n hex,\n source: 'hex',\n },\n $event,\n );\n }\n }\n}\n\n@NgModule({\n declarations: [BlockComponent, BlockSwatchesComponent],\n exports: [BlockComponent, BlockSwatchesComponent],\n imports: [CommonModule, CheckboardModule, SwatchModule, EditableInputModule],\n})\nexport class ColorBlockModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":[],"mappings":";;;;;;;;MAyBa,sBAAsB;IAxBnC;QA0BY,YAAO,GAAG,IAAI,YAAY,EAAO,CAAC;QAClC,kBAAa,GAAG,IAAI,YAAY,EAAO,CAAC;QAElD,gBAAW,GAAG;YACZ,KAAK,EAAE,MAAM;YACb,MAAM,EAAE,MAAM;YACd,KAAK,EAAE,MAAM;YACb,WAAW,EAAE,MAAM;YACnB,YAAY,EAAE,MAAM;YACpB,YAAY,EAAE,KAAK;SACpB,CAAC;KAWH;IATC,WAAW,CAAC,EAAC,GAAG,EAAE,MAAM,EAAC;QACvB,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,EAAC,GAAG,EAAE,MAAM,EAAC,CAAC,CAAC;KAClC;IACD,UAAU,CAAC,CAAC;QACV,OAAO;YACL,SAAS,EAAE,GAAI,CAAE,UAAU;SAC5B,CAAC;KACH;;mHArBU,sBAAsB;uGAAtB,sBAAsB,2JAtBvB;;;;;;;;;;;;GAYT;2FAUU,sBAAsB;kBAxBlC,SAAS;mBAAC;oBACT,QAAQ,EAAE,sBAAsB;oBAChC,QAAQ,EAAE;;;;;;;;;;;;GAYT;oBACD,MAAM,EAAE,CAAC;;;;;;;GAOR,CAAC;iBACH;8BAEU,MAAM;sBAAd,KAAK;gBACI,OAAO;sBAAhB,MAAM;gBACG,aAAa;sBAAtB,MAAM;;;MCgEI,cAAe,SAAQ,SAAS;IAkC3C;QACE,KAAK,EAAE,CAAC;;QAjCD,UAAK,GAAoB,GAAG,CAAC;;QAE7B,WAAM,GAAG;YAChB,SAAS;YACT,SAAS;YACT,SAAS;YACT,SAAS;YACT,SAAS;YACT,SAAS;YACT,SAAS;YACT,SAAS;YACT,SAAS;SACV,CAAC;QACO,aAAQ,GAAmB,KAAK,CAAC;QAC1C,UAAK,GAA4B;YAC/B,KAAK,EAAE,MAAM;YACb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