Skip to content

Commit 0ceac2b

Browse files
authored
chore: adjust default init and compatible version (#53)
* chore: use lower * chore: move back
1 parent 8f87486 commit 0ceac2b

2 files changed

Lines changed: 9 additions & 12 deletions

File tree

.fatherrc.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ import { defineConfig } from 'father';
33
export default defineConfig({
44
plugins: ['@rc-component/father-plugin'],
55
targets: {
6-
chrome: 74, // es2015, aligned with @ctrl/tinycolor
6+
// It's annoying ts will add prop def in class.
7+
// We have to use low version to compatible with this
8+
// Since some user not upgrade their webpack.
9+
chrome: 73,
710
},
811
});

src/FastColor.ts

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -61,27 +61,27 @@ export class FastColor {
6161
/**
6262
* All FastColor objects are valid. So isValid is always true. This property is kept to be compatible with TinyColor.
6363
*/
64-
isValid: boolean;
64+
isValid: boolean = true;
6565

6666
/**
6767
* Red, R in RGB
6868
*/
69-
r: number;
69+
r: number = 0;
7070

7171
/**
7272
* Green, G in RGB
7373
*/
74-
g: number;
74+
g: number = 0;
7575

7676
/**
7777
* Blue, B in RGB
7878
*/
79-
b: number;
79+
b: number = 0;
8080

8181
/**
8282
* Alpha/Opacity, A in RGBA/HSLA
8383
*/
84-
a: number;
84+
a: number = 1;
8585

8686
// HSV privates
8787
private _h?: number;
@@ -96,12 +96,6 @@ export class FastColor {
9696
private _brightness?: number;
9797

9898
constructor(input: ColorInput) {
99-
this.isValid = true;
100-
this.r = 0;
101-
this.g = 0;
102-
this.b = 0;
103-
this.a = 1;
104-
10599
/**
106100
* Always check 3 char in the object to determine the format.
107101
* We not use function in check to save bundle size.

0 commit comments

Comments
 (0)