ngx-color 8.0.2 → 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.
- package/README.md +2 -3
- package/alpha/alpha-picker.component.d.ts +1 -1
- package/alpha.component.d.ts +1 -1
- package/block/block-swatches.component.d.ts +1 -1
- package/block/block.component.d.ts +1 -1
- package/checkboard.component.d.ts +1 -1
- package/chrome/chrome-fields.component.d.ts +1 -1
- package/chrome/chrome.component.d.ts +1 -1
- package/circle/circle-swatch.component.d.ts +1 -1
- package/circle/circle.component.d.ts +1 -1
- package/color-wrap.component.d.ts +1 -1
- package/compact/compact-color.component.d.ts +1 -1
- package/compact/compact-fields.component.d.ts +1 -1
- package/compact/compact.component.d.ts +1 -1
- package/coordinates.directive.d.ts +1 -1
- package/editable-input.component.d.ts +1 -1
- package/esm2022/alpha/alpha-picker.component.mjs +102 -0
- package/esm2022/alpha.component.mjs +146 -0
- package/esm2022/block/block-swatches.component.mjs +63 -0
- package/esm2022/block/block.component.mjs +160 -0
- package/esm2022/checkboard.component.mjs +53 -0
- package/esm2022/chrome/chrome-fields.component.mjs +317 -0
- package/esm2022/chrome/chrome.component.mjs +187 -0
- package/esm2022/circle/circle-swatch.component.mjs +69 -0
- package/esm2022/circle/circle.component.mjs +136 -0
- package/esm2022/color-wrap.component.mjs +173 -0
- package/esm2022/compact/compact-color.component.mjs +71 -0
- package/esm2022/compact/compact-fields.component.mjs +165 -0
- package/esm2022/compact/compact.component.mjs +156 -0
- package/esm2022/coordinates.directive.mjs +108 -0
- package/esm2022/editable-input.component.mjs +212 -0
- package/esm2022/github/github-swatch.component.mjs +53 -0
- package/esm2022/github/github.component.mjs +114 -0
- package/esm2022/hue/hue-picker.component.mjs +102 -0
- package/esm2022/hue.component.mjs +128 -0
- package/esm2022/material/material.component.mjs +188 -0
- package/esm2022/photoshop/photoshop-button.component.mjs +33 -0
- package/esm2022/photoshop/photoshop-fields.component.mjs +214 -0
- package/esm2022/photoshop/photoshop-previews.component.mjs +40 -0
- package/esm2022/photoshop/photoshop.component.mjs +187 -0
- package/esm2022/raised.component.mjs +50 -0
- package/esm2022/saturation.component.mjs +100 -0
- package/esm2022/shade/shade-picker.component.mjs +94 -0
- package/esm2022/shade.component.mjs +133 -0
- package/esm2022/sketch/sketch-fields.component.mjs +211 -0
- package/esm2022/sketch/sketch-preset-colors.component.mjs +68 -0
- package/esm2022/sketch/sketch.component.mjs +215 -0
- package/esm2022/slider/slider-swatch.component.mjs +55 -0
- package/esm2022/slider/slider-swatches.component.mjs +119 -0
- package/esm2022/slider/slider.component.mjs +104 -0
- package/esm2022/swatch.component.mjs +112 -0
- package/esm2022/swatches/swatches-color.component.mjs +105 -0
- package/esm2022/swatches/swatches-group.component.mjs +50 -0
- package/esm2022/swatches/swatches.component.mjs +244 -0
- package/esm2022/twitter/twitter.component.mjs +161 -0
- package/{fesm2020 → fesm2022}/ngx-color-alpha.mjs +30 -30
- package/fesm2022/ngx-color-alpha.mjs.map +1 -0
- package/{fesm2020 → fesm2022}/ngx-color-block.mjs +65 -66
- package/fesm2022/ngx-color-block.mjs.map +1 -0
- package/{fesm2015 → fesm2022}/ngx-color-chrome.mjs +77 -74
- package/{fesm2020 → fesm2022}/ngx-color-chrome.mjs.map +1 -1
- package/{fesm2015 → fesm2022}/ngx-color-circle.mjs +61 -62
- package/fesm2022/ngx-color-circle.mjs.map +1 -0
- package/{fesm2015 → fesm2022}/ngx-color-compact.mjs +136 -136
- package/{fesm2015 → fesm2022}/ngx-color-compact.mjs.map +1 -1
- package/{fesm2015 → fesm2022}/ngx-color-github.mjs +53 -54
- package/{fesm2020 → fesm2022}/ngx-color-github.mjs.map +1 -1
- package/{fesm2020 → fesm2022}/ngx-color-hue.mjs +32 -32
- package/fesm2022/ngx-color-hue.mjs.map +1 -0
- package/{fesm2015 → fesm2022}/ngx-color-material.mjs +59 -59
- package/{fesm2015 → fesm2022}/ngx-color-material.mjs.map +1 -1
- package/{fesm2020 → fesm2022}/ngx-color-photoshop.mjs +111 -113
- package/{fesm2015 → fesm2022}/ngx-color-photoshop.mjs.map +1 -1
- package/{fesm2015 → fesm2022}/ngx-color-shade.mjs +29 -29
- package/fesm2022/ngx-color-shade.mjs.map +1 -0
- package/{fesm2015 → fesm2022}/ngx-color-sketch.mjs +96 -95
- package/fesm2022/ngx-color-sketch.mjs.map +1 -0
- package/{fesm2020 → fesm2022}/ngx-color-slider.mjs +46 -45
- package/{fesm2015 → fesm2022}/ngx-color-slider.mjs.map +1 -1
- package/{fesm2015 → fesm2022}/ngx-color-swatches.mjs +182 -182
- package/fesm2022/ngx-color-swatches.mjs.map +1 -0
- package/{fesm2015 → fesm2022}/ngx-color-twitter.mjs +55 -55
- package/{fesm2015 → fesm2022}/ngx-color-twitter.mjs.map +1 -1
- package/{fesm2020 → fesm2022}/ngx-color.mjs +200 -160
- package/fesm2022/ngx-color.mjs.map +1 -0
- package/github/github-swatch.component.d.ts +1 -1
- package/github/github.component.d.ts +1 -1
- package/hue/hue-picker.component.d.ts +1 -1
- package/hue.component.d.ts +1 -1
- package/material/material.component.d.ts +1 -1
- package/package.json +59 -84
- package/photoshop/photoshop-button.component.d.ts +1 -1
- package/photoshop/photoshop-fields.component.d.ts +1 -1
- package/photoshop/photoshop-previews.component.d.ts +1 -1
- package/photoshop/photoshop.component.d.ts +1 -1
- package/raised.component.d.ts +2 -2
- package/saturation.component.d.ts +1 -1
- package/shade/shade-picker.component.d.ts +1 -1
- package/shade.component.d.ts +1 -1
- package/sketch/sketch-fields.component.d.ts +1 -1
- package/sketch/sketch-preset-colors.component.d.ts +1 -1
- package/sketch/sketch.component.d.ts +1 -1
- package/slider/slider-swatch.component.d.ts +1 -1
- package/slider/slider-swatches.component.d.ts +1 -1
- package/slider/slider.component.d.ts +1 -1
- package/swatch.component.d.ts +1 -1
- package/swatches/swatches-color.component.d.ts +1 -1
- package/swatches/swatches-group.component.d.ts +1 -1
- package/swatches/swatches.component.d.ts +1 -1
- package/twitter/twitter.component.d.ts +1 -1
- package/esm2020/alpha/alpha-picker.component.mjs +0 -100
- package/esm2020/alpha.component.mjs +0 -138
- package/esm2020/block/block-swatches.component.mjs +0 -63
- package/esm2020/block/block.component.mjs +0 -158
- package/esm2020/checkboard.component.mjs +0 -50
- package/esm2020/chrome/chrome-fields.component.mjs +0 -314
- package/esm2020/chrome/chrome.component.mjs +0 -184
- package/esm2020/circle/circle-swatch.component.mjs +0 -69
- package/esm2020/circle/circle.component.mjs +0 -134
- package/esm2020/color-wrap.component.mjs +0 -163
- package/esm2020/compact/compact-color.component.mjs +0 -70
- package/esm2020/compact/compact-fields.component.mjs +0 -164
- package/esm2020/compact/compact.component.mjs +0 -154
- package/esm2020/coordinates.directive.mjs +0 -104
- package/esm2020/editable-input.component.mjs +0 -199
- package/esm2020/github/github-swatch.component.mjs +0 -53
- package/esm2020/github/github.component.mjs +0 -112
- package/esm2020/hue/hue-picker.component.mjs +0 -100
- package/esm2020/hue.component.mjs +0 -124
- package/esm2020/material/material.component.mjs +0 -186
- package/esm2020/photoshop/photoshop-button.component.mjs +0 -34
- package/esm2020/photoshop/photoshop-fields.component.mjs +0 -212
- package/esm2020/photoshop/photoshop-previews.component.mjs +0 -40
- package/esm2020/photoshop/photoshop.component.mjs +0 -185
- package/esm2020/raised.component.mjs +0 -50
- package/esm2020/saturation.component.mjs +0 -92
- package/esm2020/shade/shade-picker.component.mjs +0 -92
- package/esm2020/shade.component.mjs +0 -125
- package/esm2020/sketch/sketch-fields.component.mjs +0 -209
- package/esm2020/sketch/sketch-preset-colors.component.mjs +0 -68
- package/esm2020/sketch/sketch.component.mjs +0 -212
- package/esm2020/slider/slider-swatch.component.mjs +0 -52
- package/esm2020/slider/slider-swatches.component.mjs +0 -119
- package/esm2020/slider/slider.component.mjs +0 -102
- package/esm2020/swatch.component.mjs +0 -110
- package/esm2020/swatches/swatches-color.component.mjs +0 -104
- package/esm2020/swatches/swatches-group.component.mjs +0 -49
- package/esm2020/swatches/swatches.component.mjs +0 -242
- package/esm2020/twitter/twitter.component.mjs +0 -159
- package/fesm2015/ngx-color-alpha.mjs +0 -107
- package/fesm2015/ngx-color-alpha.mjs.map +0 -1
- package/fesm2015/ngx-color-block.mjs +0 -223
- package/fesm2015/ngx-color-block.mjs.map +0 -1
- package/fesm2015/ngx-color-chrome.mjs.map +0 -1
- package/fesm2015/ngx-color-circle.mjs.map +0 -1
- package/fesm2015/ngx-color-github.mjs.map +0 -1
- package/fesm2015/ngx-color-hue.mjs +0 -107
- package/fesm2015/ngx-color-hue.mjs.map +0 -1
- package/fesm2015/ngx-color-photoshop.mjs +0 -467
- package/fesm2015/ngx-color-shade.mjs.map +0 -1
- package/fesm2015/ngx-color-sketch.mjs.map +0 -1
- package/fesm2015/ngx-color-slider.mjs +0 -273
- package/fesm2015/ngx-color-swatches.mjs.map +0 -1
- package/fesm2015/ngx-color.mjs +0 -1202
- package/fesm2015/ngx-color.mjs.map +0 -1
- package/fesm2020/ngx-color-alpha.mjs.map +0 -1
- package/fesm2020/ngx-color-block.mjs.map +0 -1
- package/fesm2020/ngx-color-chrome.mjs +0 -499
- package/fesm2020/ngx-color-circle.mjs +0 -207
- package/fesm2020/ngx-color-circle.mjs.map +0 -1
- package/fesm2020/ngx-color-compact.mjs +0 -385
- package/fesm2020/ngx-color-compact.mjs.map +0 -1
- package/fesm2020/ngx-color-github.mjs +0 -169
- package/fesm2020/ngx-color-hue.mjs.map +0 -1
- package/fesm2020/ngx-color-material.mjs +0 -193
- package/fesm2020/ngx-color-material.mjs.map +0 -1
- package/fesm2020/ngx-color-photoshop.mjs.map +0 -1
- package/fesm2020/ngx-color-shade.mjs +0 -99
- package/fesm2020/ngx-color-shade.mjs.map +0 -1
- package/fesm2020/ngx-color-sketch.mjs +0 -485
- package/fesm2020/ngx-color-sketch.mjs.map +0 -1
- package/fesm2020/ngx-color-slider.mjs.map +0 -1
- package/fesm2020/ngx-color-swatches.mjs +0 -391
- package/fesm2020/ngx-color-swatches.mjs.map +0 -1
- package/fesm2020/ngx-color-twitter.mjs +0 -166
- package/fesm2020/ngx-color-twitter.mjs.map +0 -1
- package/fesm2020/ngx-color.mjs.map +0 -1
- /package/{esm2020 → esm2022}/alpha/ngx-color-alpha.mjs +0 -0
- /package/{esm2020 → esm2022}/alpha/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/block/ngx-color-block.mjs +0 -0
- /package/{esm2020 → esm2022}/block/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/chrome/ngx-color-chrome.mjs +0 -0
- /package/{esm2020 → esm2022}/chrome/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/circle/ngx-color-circle.mjs +0 -0
- /package/{esm2020 → esm2022}/circle/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/compact/ngx-color-compact.mjs +0 -0
- /package/{esm2020 → esm2022}/compact/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/github/ngx-color-github.mjs +0 -0
- /package/{esm2020 → esm2022}/github/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/helpers/checkboard.mjs +0 -0
- /package/{esm2020 → esm2022}/helpers/color.interfaces.mjs +0 -0
- /package/{esm2020 → esm2022}/helpers/color.mjs +0 -0
- /package/{esm2020 → esm2022}/hue/ngx-color-hue.mjs +0 -0
- /package/{esm2020 → esm2022}/hue/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/material/ngx-color-material.mjs +0 -0
- /package/{esm2020 → esm2022}/material/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/ngx-color.mjs +0 -0
- /package/{esm2020 → esm2022}/photoshop/ngx-color-photoshop.mjs +0 -0
- /package/{esm2020 → esm2022}/photoshop/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/shade/ngx-color-shade.mjs +0 -0
- /package/{esm2020 → esm2022}/shade/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/sketch/ngx-color-sketch.mjs +0 -0
- /package/{esm2020 → esm2022}/sketch/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/slider/ngx-color-slider.mjs +0 -0
- /package/{esm2020 → esm2022}/slider/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/swatches/ngx-color-swatches.mjs +0 -0
- /package/{esm2020 → esm2022}/swatches/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/twitter/ngx-color-twitter.mjs +0 -0
- /package/{esm2020 → esm2022}/twitter/public_api.mjs +0 -0
@@ -1,499 +0,0 @@
|
|
1
|
-
import * as i0 from '@angular/core';
|
2
|
-
import { EventEmitter, Component, ChangeDetectionStrategy, Input, Output, forwardRef, NgModule } from '@angular/core';
|
3
|
-
import * as i2 from 'ngx-color';
|
4
|
-
import { isValidHex, ColorWrap, AlphaModule, CheckboardModule, EditableInputModule, HueModule, SaturationModule } from 'ngx-color';
|
5
|
-
import { TinyColor } from '@ctrl/tinycolor';
|
6
|
-
import * as i1 from '@angular/common';
|
7
|
-
import { CommonModule } from '@angular/common';
|
8
|
-
import { NG_VALUE_ACCESSOR } from '@angular/forms';
|
9
|
-
|
10
|
-
class ChromeFieldsComponent {
|
11
|
-
constructor() {
|
12
|
-
this.onChange = new EventEmitter();
|
13
|
-
this.view = '';
|
14
|
-
this.input = {
|
15
|
-
fontSize: '11px',
|
16
|
-
color: '#333',
|
17
|
-
width: '100%',
|
18
|
-
borderRadius: '2px',
|
19
|
-
border: 'none',
|
20
|
-
boxShadow: 'inset 0 0 0 1px #dadada',
|
21
|
-
height: '21px',
|
22
|
-
'text-align': 'center',
|
23
|
-
};
|
24
|
-
this.label = {
|
25
|
-
'text-transform': 'uppercase',
|
26
|
-
fontSize: '11px',
|
27
|
-
'line-height': '11px',
|
28
|
-
color: '#969696',
|
29
|
-
'text-align': 'center',
|
30
|
-
display: 'block',
|
31
|
-
marginTop: '12px',
|
32
|
-
};
|
33
|
-
}
|
34
|
-
ngOnInit() {
|
35
|
-
if (this.hsl.a === 1 && this.view !== 'hex') {
|
36
|
-
this.view = 'hex';
|
37
|
-
}
|
38
|
-
else if (this.view !== 'rgb' && this.view !== 'hsl') {
|
39
|
-
this.view = 'rgb';
|
40
|
-
}
|
41
|
-
}
|
42
|
-
toggleViews() {
|
43
|
-
if (this.view === 'hex') {
|
44
|
-
this.view = 'rgb';
|
45
|
-
}
|
46
|
-
else if (this.view === 'rgb') {
|
47
|
-
this.view = 'hsl';
|
48
|
-
}
|
49
|
-
else if (this.view === 'hsl') {
|
50
|
-
if (this.hsl.a === 1) {
|
51
|
-
this.view = 'hex';
|
52
|
-
}
|
53
|
-
else {
|
54
|
-
this.view = 'rgb';
|
55
|
-
}
|
56
|
-
}
|
57
|
-
}
|
58
|
-
round(value) {
|
59
|
-
return Math.round(value);
|
60
|
-
}
|
61
|
-
handleChange({ data, $event }) {
|
62
|
-
if (data.hex) {
|
63
|
-
if (isValidHex(data.hex)) {
|
64
|
-
const color = new TinyColor(data.hex);
|
65
|
-
this.onChange.emit({
|
66
|
-
data: {
|
67
|
-
hex: this.disableAlpha ? color.toHex() : color.toHex8(),
|
68
|
-
source: 'hex',
|
69
|
-
},
|
70
|
-
$event,
|
71
|
-
});
|
72
|
-
}
|
73
|
-
}
|
74
|
-
else if (data.r || data.g || data.b) {
|
75
|
-
this.onChange.emit({
|
76
|
-
data: {
|
77
|
-
r: data.r || this.rgb.r,
|
78
|
-
g: data.g || this.rgb.g,
|
79
|
-
b: data.b || this.rgb.b,
|
80
|
-
source: 'rgb',
|
81
|
-
},
|
82
|
-
$event,
|
83
|
-
});
|
84
|
-
}
|
85
|
-
else if (data.a) {
|
86
|
-
if (data.a < 0) {
|
87
|
-
data.a = 0;
|
88
|
-
}
|
89
|
-
else if (data.a > 1) {
|
90
|
-
data.a = 1;
|
91
|
-
}
|
92
|
-
if (this.disableAlpha) {
|
93
|
-
data.a = 1;
|
94
|
-
}
|
95
|
-
this.onChange.emit({
|
96
|
-
data: {
|
97
|
-
h: this.hsl.h,
|
98
|
-
s: this.hsl.s,
|
99
|
-
l: this.hsl.l,
|
100
|
-
a: Math.round(data.a * 100) / 100,
|
101
|
-
source: 'rgb',
|
102
|
-
},
|
103
|
-
$event,
|
104
|
-
});
|
105
|
-
}
|
106
|
-
else if (data.h || data.s || data.l) {
|
107
|
-
const s = data.s && data.s.replace('%', '');
|
108
|
-
const l = data.l && data.l.replace('%', '');
|
109
|
-
this.onChange.emit({
|
110
|
-
data: {
|
111
|
-
h: data.h || this.hsl.h,
|
112
|
-
s: Number(s || this.hsl.s),
|
113
|
-
l: Number(l || this.hsl.l),
|
114
|
-
source: 'hsl',
|
115
|
-
},
|
116
|
-
$event,
|
117
|
-
});
|
118
|
-
}
|
119
|
-
}
|
120
|
-
}
|
121
|
-
ChromeFieldsComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: ChromeFieldsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
122
|
-
ChromeFieldsComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.2", type: ChromeFieldsComponent, selector: "color-chrome-fields", inputs: { disableAlpha: "disableAlpha", hsl: "hsl", rgb: "rgb", hex: "hex" }, outputs: { onChange: "onChange" }, ngImport: i0, template: `
|
123
|
-
<div class="chrome-wrap">
|
124
|
-
<div class="chrome-fields">
|
125
|
-
<ng-template [ngIf]="view === 'hex'">
|
126
|
-
<div class="chrome-field">
|
127
|
-
<color-editable-input
|
128
|
-
[style]="{ input: input, label: label }"
|
129
|
-
label="hex" [value]="hex"
|
130
|
-
(onChange)="handleChange($event)"
|
131
|
-
></color-editable-input>
|
132
|
-
</div>
|
133
|
-
</ng-template>
|
134
|
-
<ng-template [ngIf]="view === 'rgb'">
|
135
|
-
<div class="chrome-field">
|
136
|
-
<color-editable-input
|
137
|
-
[style]="{ input: input, label: label }"
|
138
|
-
label="r" [value]="rgb.r"
|
139
|
-
(onChange)="handleChange($event)"
|
140
|
-
></color-editable-input>
|
141
|
-
</div>
|
142
|
-
<div class="chrome-field">
|
143
|
-
<color-editable-input
|
144
|
-
[style]="{ input: input, label: label }"
|
145
|
-
label="g" [value]="rgb.g"
|
146
|
-
(onChange)="handleChange($event)"
|
147
|
-
></color-editable-input>
|
148
|
-
</div>
|
149
|
-
<div class="chrome-field">
|
150
|
-
<color-editable-input
|
151
|
-
[style]="{ input: input, label: label }"
|
152
|
-
label="b" [value]="rgb.b"
|
153
|
-
(onChange)="handleChange($event)"
|
154
|
-
></color-editable-input>
|
155
|
-
</div>
|
156
|
-
<div class="chrome-field">
|
157
|
-
<color-editable-input *ngIf="!disableAlpha"
|
158
|
-
[style]="{ input: input, label: label }"
|
159
|
-
label="a" [value]="rgb.a"
|
160
|
-
[arrowOffset]="0.01"
|
161
|
-
(onChange)="handleChange($event)"
|
162
|
-
></color-editable-input>
|
163
|
-
</div>
|
164
|
-
</ng-template>
|
165
|
-
<ng-template [ngIf]="view === 'hsl'">
|
166
|
-
<div class="chrome-field">
|
167
|
-
<color-editable-input
|
168
|
-
[style]="{ input: input, label: label }"
|
169
|
-
label="h"
|
170
|
-
[value]="round(hsl.h)"
|
171
|
-
(onChange)="handleChange($event)"
|
172
|
-
></color-editable-input>
|
173
|
-
</div>
|
174
|
-
<div class="chrome-field">
|
175
|
-
<color-editable-input
|
176
|
-
[style]="{ input: input, label: label }"
|
177
|
-
label="s" [value]="round(hsl.s * 100) + '%'"
|
178
|
-
(onChange)="handleChange($event)"
|
179
|
-
></color-editable-input>
|
180
|
-
</div>
|
181
|
-
<div class="chrome-field">
|
182
|
-
<color-editable-input
|
183
|
-
[style]="{ input: input, label: label }"
|
184
|
-
label="l" [value]="round(hsl.l * 100) + '%'"
|
185
|
-
(onChange)="handleChange($event)"
|
186
|
-
></color-editable-input>
|
187
|
-
</div>
|
188
|
-
<div class="chrome-field">
|
189
|
-
<color-editable-input *ngIf="!disableAlpha"
|
190
|
-
[style]="{ input: input, label: label }"
|
191
|
-
label="a" [value]="hsl.a"
|
192
|
-
[arrowOffset]="0.01"
|
193
|
-
(onChange)="handleChange($event)"
|
194
|
-
></color-editable-input>
|
195
|
-
</div>
|
196
|
-
</ng-template>
|
197
|
-
</div>
|
198
|
-
|
199
|
-
<div class="chrome-toggle">
|
200
|
-
<div class="chrome-icon" (click)="toggleViews()" #icon>
|
201
|
-
<svg class="chrome-toggle-svg" viewBox="0 0 24 24">
|
202
|
-
<path #iconUp fill="#333"
|
203
|
-
d="M12,5.83L15.17,9L16.58,7.59L12,3L7.41,7.59L8.83,9L12,5.83Z"
|
204
|
-
/>
|
205
|
-
<path #iconDown fill="#333"
|
206
|
-
d="M12,18.17L8.83,15L7.42,16.41L12,21L16.59,16.41L15.17,15Z"
|
207
|
-
/>
|
208
|
-
</svg>
|
209
|
-
</div>
|
210
|
-
</div>
|
211
|
-
</div>
|
212
|
-
`, isInline: true, styles: [".chrome-wrap{padding-top:16px;display:flex}.chrome-fields{flex:1;display:flex;margin-left:-6px}.chrome-field{padding-left:6px;width:100%}.chrome-toggle{width:32px;text-align:right;position:relative}.chrome-icon{margin-right:-4px;margin-top:12px;cursor:pointer;position:relative}.chrome-toggle-svg{width:24px;height:24px;border:1px transparent solid;border-radius:5px}.chrome-toggle-svg:hover{background:#eee}\n"], dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i2.EditableInputComponent, selector: "color-editable-input", inputs: ["style", "label", "value", "arrowOffset", "dragLabel", "dragMax", "placeholder"], outputs: ["onChange"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
213
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: ChromeFieldsComponent, decorators: [{
|
214
|
-
type: Component,
|
215
|
-
args: [{ selector: 'color-chrome-fields', template: `
|
216
|
-
<div class="chrome-wrap">
|
217
|
-
<div class="chrome-fields">
|
218
|
-
<ng-template [ngIf]="view === 'hex'">
|
219
|
-
<div class="chrome-field">
|
220
|
-
<color-editable-input
|
221
|
-
[style]="{ input: input, label: label }"
|
222
|
-
label="hex" [value]="hex"
|
223
|
-
(onChange)="handleChange($event)"
|
224
|
-
></color-editable-input>
|
225
|
-
</div>
|
226
|
-
</ng-template>
|
227
|
-
<ng-template [ngIf]="view === 'rgb'">
|
228
|
-
<div class="chrome-field">
|
229
|
-
<color-editable-input
|
230
|
-
[style]="{ input: input, label: label }"
|
231
|
-
label="r" [value]="rgb.r"
|
232
|
-
(onChange)="handleChange($event)"
|
233
|
-
></color-editable-input>
|
234
|
-
</div>
|
235
|
-
<div class="chrome-field">
|
236
|
-
<color-editable-input
|
237
|
-
[style]="{ input: input, label: label }"
|
238
|
-
label="g" [value]="rgb.g"
|
239
|
-
(onChange)="handleChange($event)"
|
240
|
-
></color-editable-input>
|
241
|
-
</div>
|
242
|
-
<div class="chrome-field">
|
243
|
-
<color-editable-input
|
244
|
-
[style]="{ input: input, label: label }"
|
245
|
-
label="b" [value]="rgb.b"
|
246
|
-
(onChange)="handleChange($event)"
|
247
|
-
></color-editable-input>
|
248
|
-
</div>
|
249
|
-
<div class="chrome-field">
|
250
|
-
<color-editable-input *ngIf="!disableAlpha"
|
251
|
-
[style]="{ input: input, label: label }"
|
252
|
-
label="a" [value]="rgb.a"
|
253
|
-
[arrowOffset]="0.01"
|
254
|
-
(onChange)="handleChange($event)"
|
255
|
-
></color-editable-input>
|
256
|
-
</div>
|
257
|
-
</ng-template>
|
258
|
-
<ng-template [ngIf]="view === 'hsl'">
|
259
|
-
<div class="chrome-field">
|
260
|
-
<color-editable-input
|
261
|
-
[style]="{ input: input, label: label }"
|
262
|
-
label="h"
|
263
|
-
[value]="round(hsl.h)"
|
264
|
-
(onChange)="handleChange($event)"
|
265
|
-
></color-editable-input>
|
266
|
-
</div>
|
267
|
-
<div class="chrome-field">
|
268
|
-
<color-editable-input
|
269
|
-
[style]="{ input: input, label: label }"
|
270
|
-
label="s" [value]="round(hsl.s * 100) + '%'"
|
271
|
-
(onChange)="handleChange($event)"
|
272
|
-
></color-editable-input>
|
273
|
-
</div>
|
274
|
-
<div class="chrome-field">
|
275
|
-
<color-editable-input
|
276
|
-
[style]="{ input: input, label: label }"
|
277
|
-
label="l" [value]="round(hsl.l * 100) + '%'"
|
278
|
-
(onChange)="handleChange($event)"
|
279
|
-
></color-editable-input>
|
280
|
-
</div>
|
281
|
-
<div class="chrome-field">
|
282
|
-
<color-editable-input *ngIf="!disableAlpha"
|
283
|
-
[style]="{ input: input, label: label }"
|
284
|
-
label="a" [value]="hsl.a"
|
285
|
-
[arrowOffset]="0.01"
|
286
|
-
(onChange)="handleChange($event)"
|
287
|
-
></color-editable-input>
|
288
|
-
</div>
|
289
|
-
</ng-template>
|
290
|
-
</div>
|
291
|
-
|
292
|
-
<div class="chrome-toggle">
|
293
|
-
<div class="chrome-icon" (click)="toggleViews()" #icon>
|
294
|
-
<svg class="chrome-toggle-svg" viewBox="0 0 24 24">
|
295
|
-
<path #iconUp fill="#333"
|
296
|
-
d="M12,5.83L15.17,9L16.58,7.59L12,3L7.41,7.59L8.83,9L12,5.83Z"
|
297
|
-
/>
|
298
|
-
<path #iconDown fill="#333"
|
299
|
-
d="M12,18.17L8.83,15L7.42,16.41L12,21L16.59,16.41L15.17,15Z"
|
300
|
-
/>
|
301
|
-
</svg>
|
302
|
-
</div>
|
303
|
-
</div>
|
304
|
-
</div>
|
305
|
-
`, changeDetection: ChangeDetectionStrategy.OnPush, preserveWhitespaces: false, styles: [".chrome-wrap{padding-top:16px;display:flex}.chrome-fields{flex:1;display:flex;margin-left:-6px}.chrome-field{padding-left:6px;width:100%}.chrome-toggle{width:32px;text-align:right;position:relative}.chrome-icon{margin-right:-4px;margin-top:12px;cursor:pointer;position:relative}.chrome-toggle-svg{width:24px;height:24px;border:1px transparent solid;border-radius:5px}.chrome-toggle-svg:hover{background:#eee}\n"] }]
|
306
|
-
}], propDecorators: { disableAlpha: [{
|
307
|
-
type: Input
|
308
|
-
}], hsl: [{
|
309
|
-
type: Input
|
310
|
-
}], rgb: [{
|
311
|
-
type: Input
|
312
|
-
}], hex: [{
|
313
|
-
type: Input
|
314
|
-
}], onChange: [{
|
315
|
-
type: Output
|
316
|
-
}] } });
|
317
|
-
|
318
|
-
class ChromeComponent extends ColorWrap {
|
319
|
-
constructor() {
|
320
|
-
super();
|
321
|
-
/** Remove alpha slider and options from picker */
|
322
|
-
this.disableAlpha = false;
|
323
|
-
this.circle = {
|
324
|
-
width: '12px',
|
325
|
-
height: '12px',
|
326
|
-
borderRadius: '6px',
|
327
|
-
boxShadow: 'rgb(255, 255, 255) 0px 0px 0px 1px inset',
|
328
|
-
transform: 'translate(-6px, -8px)',
|
329
|
-
};
|
330
|
-
this.pointer = {
|
331
|
-
width: '12px',
|
332
|
-
height: '12px',
|
333
|
-
borderRadius: '6px',
|
334
|
-
transform: 'translate(-6px, -2px)',
|
335
|
-
backgroundColor: 'rgb(248, 248, 248)',
|
336
|
-
boxShadow: '0 1px 4px 0 rgba(0, 0, 0, 0.37)',
|
337
|
-
};
|
338
|
-
}
|
339
|
-
afterValidChange() {
|
340
|
-
const alpha = this.disableAlpha ? 1 : this.rgb.a;
|
341
|
-
this.activeBackground = `rgba(${this.rgb.r}, ${this.rgb.g}, ${this.rgb.b}, ${alpha})`;
|
342
|
-
}
|
343
|
-
handleValueChange({ data, $event }) {
|
344
|
-
this.handleChange(data, $event);
|
345
|
-
}
|
346
|
-
}
|
347
|
-
ChromeComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: ChromeComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
348
|
-
ChromeComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.2", type: ChromeComponent, selector: "color-chrome", inputs: { disableAlpha: "disableAlpha" }, providers: [
|
349
|
-
{
|
350
|
-
provide: NG_VALUE_ACCESSOR,
|
351
|
-
useExisting: forwardRef(() => ChromeComponent),
|
352
|
-
multi: true,
|
353
|
-
},
|
354
|
-
{
|
355
|
-
provide: ColorWrap,
|
356
|
-
useExisting: forwardRef(() => ChromeComponent),
|
357
|
-
},
|
358
|
-
], usesInheritance: true, ngImport: i0, template: `
|
359
|
-
<div class="chrome-picker {{ className }}">
|
360
|
-
<div class="saturation">
|
361
|
-
<color-saturation
|
362
|
-
[hsl]="hsl"
|
363
|
-
[hsv]="hsv"
|
364
|
-
[circle]="circle"
|
365
|
-
(onChange)="handleValueChange($event)"
|
366
|
-
></color-saturation>
|
367
|
-
</div>
|
368
|
-
<div class="chrome-body">
|
369
|
-
<div class="chrome-controls">
|
370
|
-
<div class="chrome-color">
|
371
|
-
<div class="chrome-swatch">
|
372
|
-
<div class="chrome-active"
|
373
|
-
[style.background]="activeBackground"
|
374
|
-
></div>
|
375
|
-
<color-checkboard></color-checkboard>
|
376
|
-
</div>
|
377
|
-
</div>
|
378
|
-
<div class="chrome-toggles">
|
379
|
-
<div class="chrome-hue">
|
380
|
-
<color-hue
|
381
|
-
[radius]="2"
|
382
|
-
[hsl]="hsl"
|
383
|
-
[pointer]="pointer"
|
384
|
-
(onChange)="handleValueChange($event)"
|
385
|
-
></color-hue>
|
386
|
-
</div>
|
387
|
-
<div class="chrome-alpha" *ngIf="!disableAlpha">
|
388
|
-
<color-alpha
|
389
|
-
[radius]="2" [rgb]="rgb" [hsl]="hsl"
|
390
|
-
[pointer]="pointer" (onChange)="handleValueChange($event)"
|
391
|
-
></color-alpha>
|
392
|
-
</div>
|
393
|
-
</div>
|
394
|
-
</div>
|
395
|
-
<color-chrome-fields
|
396
|
-
[rgb]="rgb" [hsl]="hsl" [hex]="hex"
|
397
|
-
[disableAlpha]="disableAlpha"
|
398
|
-
(onChange)="handleValueChange($event)"
|
399
|
-
></color-chrome-fields>
|
400
|
-
</div>
|
401
|
-
</div>
|
402
|
-
`, isInline: true, styles: [".chrome-picker{background:#fff;border-radius:2px;box-shadow:0 0 2px #0000004d,0 4px 8px #0000004d;box-sizing:initial;width:225px;font-family:Menlo}.chrome-controls{display:flex}.chrome-color{width:42px}.chrome-body{padding:14px 14px 12px}.chrome-active{position:absolute;top:0;bottom:0;left:0;right:0;border-radius:20px;box-shadow:inset 0 0 0 1px #0000001a;z-index:2}.chrome-swatch{width:28px;height:28px;border-radius:15px;position:relative;overflow:hidden}.saturation{width:100%;padding-bottom:55%;position:relative;border-radius:2px 2px 0 0;overflow:hidden}.chrome-toggles{flex:1}.chrome-hue{height:10px;position:relative;margin-bottom:8px}.chrome-alpha{height:10px;position:relative}\n"], dependencies: [{ kind: "directive", type: i0.forwardRef(function () { return i1.NgIf; }), selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i0.forwardRef(function () { return i2.AlphaComponent; }), selector: "color-alpha", inputs: ["hsl", "rgb", "pointer", "shadow", "radius", "direction"], outputs: ["onChange"] }, { kind: "component", type: i0.forwardRef(function () { return i2.CheckboardComponent; }), selector: "color-checkboard", inputs: ["white", "size", "grey", "boxShadow", "borderRadius"] }, { kind: "component", type: i0.forwardRef(function () { return i2.HueComponent; }), selector: "color-hue", inputs: ["hsl", "pointer", "radius", "shadow", "hidePointer", "direction"], outputs: ["onChange"] }, { kind: "component", type: i0.forwardRef(function () { return i2.SaturationComponent; }), selector: "color-saturation", inputs: ["hsl", "hsv", "radius", "pointer", "circle"], outputs: ["onChange"] }, { kind: "component", type: i0.forwardRef(function () { return ChromeFieldsComponent; }), selector: "color-chrome-fields", inputs: ["disableAlpha", "hsl", "rgb", "hex"], outputs: ["onChange"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
403
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: ChromeComponent, decorators: [{
|
404
|
-
type: Component,
|
405
|
-
args: [{ selector: 'color-chrome', template: `
|
406
|
-
<div class="chrome-picker {{ className }}">
|
407
|
-
<div class="saturation">
|
408
|
-
<color-saturation
|
409
|
-
[hsl]="hsl"
|
410
|
-
[hsv]="hsv"
|
411
|
-
[circle]="circle"
|
412
|
-
(onChange)="handleValueChange($event)"
|
413
|
-
></color-saturation>
|
414
|
-
</div>
|
415
|
-
<div class="chrome-body">
|
416
|
-
<div class="chrome-controls">
|
417
|
-
<div class="chrome-color">
|
418
|
-
<div class="chrome-swatch">
|
419
|
-
<div class="chrome-active"
|
420
|
-
[style.background]="activeBackground"
|
421
|
-
></div>
|
422
|
-
<color-checkboard></color-checkboard>
|
423
|
-
</div>
|
424
|
-
</div>
|
425
|
-
<div class="chrome-toggles">
|
426
|
-
<div class="chrome-hue">
|
427
|
-
<color-hue
|
428
|
-
[radius]="2"
|
429
|
-
[hsl]="hsl"
|
430
|
-
[pointer]="pointer"
|
431
|
-
(onChange)="handleValueChange($event)"
|
432
|
-
></color-hue>
|
433
|
-
</div>
|
434
|
-
<div class="chrome-alpha" *ngIf="!disableAlpha">
|
435
|
-
<color-alpha
|
436
|
-
[radius]="2" [rgb]="rgb" [hsl]="hsl"
|
437
|
-
[pointer]="pointer" (onChange)="handleValueChange($event)"
|
438
|
-
></color-alpha>
|
439
|
-
</div>
|
440
|
-
</div>
|
441
|
-
</div>
|
442
|
-
<color-chrome-fields
|
443
|
-
[rgb]="rgb" [hsl]="hsl" [hex]="hex"
|
444
|
-
[disableAlpha]="disableAlpha"
|
445
|
-
(onChange)="handleValueChange($event)"
|
446
|
-
></color-chrome-fields>
|
447
|
-
</div>
|
448
|
-
</div>
|
449
|
-
`, changeDetection: ChangeDetectionStrategy.OnPush, preserveWhitespaces: false, providers: [
|
450
|
-
{
|
451
|
-
provide: NG_VALUE_ACCESSOR,
|
452
|
-
useExisting: forwardRef(() => ChromeComponent),
|
453
|
-
multi: true,
|
454
|
-
},
|
455
|
-
{
|
456
|
-
provide: ColorWrap,
|
457
|
-
useExisting: forwardRef(() => ChromeComponent),
|
458
|
-
},
|
459
|
-
], styles: [".chrome-picker{background:#fff;border-radius:2px;box-shadow:0 0 2px #0000004d,0 4px 8px #0000004d;box-sizing:initial;width:225px;font-family:Menlo}.chrome-controls{display:flex}.chrome-color{width:42px}.chrome-body{padding:14px 14px 12px}.chrome-active{position:absolute;top:0;bottom:0;left:0;right:0;border-radius:20px;box-shadow:inset 0 0 0 1px #0000001a;z-index:2}.chrome-swatch{width:28px;height:28px;border-radius:15px;position:relative;overflow:hidden}.saturation{width:100%;padding-bottom:55%;position:relative;border-radius:2px 2px 0 0;overflow:hidden}.chrome-toggles{flex:1}.chrome-hue{height:10px;position:relative;margin-bottom:8px}.chrome-alpha{height:10px;position:relative}\n"] }]
|
460
|
-
}], ctorParameters: function () { return []; }, propDecorators: { disableAlpha: [{
|
461
|
-
type: Input
|
462
|
-
}] } });
|
463
|
-
class ColorChromeModule {
|
464
|
-
}
|
465
|
-
ColorChromeModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: ColorChromeModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
466
|
-
ColorChromeModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.1.2", ngImport: i0, type: ColorChromeModule, declarations: [ChromeComponent, ChromeFieldsComponent], imports: [CommonModule,
|
467
|
-
AlphaModule,
|
468
|
-
CheckboardModule,
|
469
|
-
EditableInputModule,
|
470
|
-
HueModule,
|
471
|
-
SaturationModule], exports: [ChromeComponent, ChromeFieldsComponent] });
|
472
|
-
ColorChromeModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: ColorChromeModule, imports: [CommonModule,
|
473
|
-
AlphaModule,
|
474
|
-
CheckboardModule,
|
475
|
-
EditableInputModule,
|
476
|
-
HueModule,
|
477
|
-
SaturationModule] });
|
478
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: ColorChromeModule, decorators: [{
|
479
|
-
type: NgModule,
|
480
|
-
args: [{
|
481
|
-
declarations: [ChromeComponent, ChromeFieldsComponent],
|
482
|
-
exports: [ChromeComponent, ChromeFieldsComponent],
|
483
|
-
imports: [
|
484
|
-
CommonModule,
|
485
|
-
AlphaModule,
|
486
|
-
CheckboardModule,
|
487
|
-
EditableInputModule,
|
488
|
-
HueModule,
|
489
|
-
SaturationModule,
|
490
|
-
],
|
491
|
-
}]
|
492
|
-
}] });
|
493
|
-
|
494
|
-
/**
|
495
|
-
* Generated bundle index. Do not edit.
|
496
|
-
*/
|
497
|
-
|
498
|
-
export { ChromeComponent, ChromeFieldsComponent, ColorChromeModule };
|
499
|
-
//# sourceMappingURL=ngx-color-chrome.mjs.map
|