@thednp/color-picker 0.0.1-alpha1 → 0.0.1-alpha2
Sign up to get free protection for your applications and to get access to all the features.
- package/LICENSE +1 -1
- package/README.md +40 -19
- package/dist/css/color-picker.css +481 -337
- package/dist/css/color-picker.min.css +2 -0
- package/dist/css/color-picker.rtl.css +506 -0
- package/dist/css/color-picker.rtl.min.css +2 -0
- package/dist/js/color-picker-element-esm.js +3810 -2
- package/dist/js/color-picker-element-esm.min.js +2 -0
- package/dist/js/color-picker-element.js +2009 -1242
- package/dist/js/color-picker-element.min.js +2 -2
- package/dist/js/color-picker-esm.js +3704 -0
- package/dist/js/color-picker-esm.min.js +2 -0
- package/dist/js/color-picker.js +1962 -1256
- package/dist/js/color-picker.min.js +2 -2
- package/package.json +18 -9
- package/src/js/color-palette.js +62 -0
- package/src/js/color-picker-element.js +55 -13
- package/src/js/color-picker.js +686 -595
- package/src/js/color.js +615 -349
- package/src/js/index.js +0 -9
- package/src/js/util/colorNames.js +2 -152
- package/src/js/util/colorPickerLabels.js +22 -0
- package/src/js/util/getColorControls.js +103 -0
- package/src/js/util/getColorForm.js +27 -19
- package/src/js/util/getColorMenu.js +95 -0
- package/src/js/util/isValidJSON.js +13 -0
- package/src/js/util/nonColors.js +5 -0
- package/src/js/util/templates.js +1 -0
- package/src/scss/color-picker.rtl.scss +23 -0
- package/src/scss/color-picker.scss +430 -0
- package/types/cp.d.ts +263 -160
- package/types/index.d.ts +9 -2
- package/types/source/source.ts +2 -1
- package/types/source/types.d.ts +28 -5
- package/dist/js/color-picker.esm.js +0 -2998
- package/dist/js/color-picker.esm.min.js +0 -2
- package/src/js/util/getColorControl.js +0 -49
- package/src/js/util/init.js +0 -14
package/types/index.d.ts
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
export as namespace CP;
|
2
|
-
export {Color, ColorPicker, ColorPickerElement};
|
2
|
+
export {Color, ColorPicker, ColorPalette, ColorPickerElement};
|
3
3
|
|
4
4
|
export {
|
5
5
|
HSL,
|
@@ -8,16 +8,19 @@ export {
|
|
8
8
|
RGBA,
|
9
9
|
HSV,
|
10
10
|
HSVA,
|
11
|
+
HWB,
|
12
|
+
HWBA,
|
13
|
+
ColorPickerOptions,
|
11
14
|
ColorObject,
|
12
15
|
ColorFormats,
|
13
16
|
ColorInput,
|
14
|
-
ColorOptions,
|
15
17
|
GetInstance,
|
16
18
|
InitCallback,
|
17
19
|
} from './source/types';
|
18
20
|
|
19
21
|
import './cp';
|
20
22
|
import { default as Color } from "color-picker/src/js/color";
|
23
|
+
import { default as ColorPalette } from "color-picker/src/js/color-palette";
|
21
24
|
import { default as ColorPicker } from "color-picker/src/js/color-picker";
|
22
25
|
import { default as ColorPickerElement } from "color-picker/src/js/color-picker-element";
|
23
26
|
|
@@ -29,6 +32,10 @@ declare module "@thednp/color-picker/src/js/color" {
|
|
29
32
|
export default Color;
|
30
33
|
}
|
31
34
|
|
35
|
+
declare module "@thednp/color-picker/src/js/color-palette" {
|
36
|
+
export default ColorPalette;
|
37
|
+
}
|
38
|
+
|
32
39
|
declare module "@thednp/color-picker/src/js/color-picker" {
|
33
40
|
export default ColorPicker;
|
34
41
|
}
|
package/types/source/source.ts
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
// export { default as Color } from "../../types/source/types";
|
2
2
|
export { default as Color } from "../../src/js/color";
|
3
|
+
export { default as ColorPalette } from "../../src/js/color-palette";
|
3
4
|
export { default as ColorPicker } from "../../src/js/color-picker";
|
4
|
-
export { default as ColorPickerElement } from "../../src/js/color-picker-element";
|
5
|
+
export { default as ColorPickerElement } from "../../src/js/color-picker-element";
|
package/types/source/types.d.ts
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
/**
|
2
2
|
* A `Color` compatible object.
|
3
3
|
*/
|
4
|
-
export interface ColorObject {
|
4
|
+
export interface ColorObject {
|
5
5
|
r: number;
|
6
6
|
g: number;
|
7
7
|
b: number;
|
@@ -59,9 +59,32 @@ export interface HSVA extends HSV {
|
|
59
59
|
a: number;
|
60
60
|
}
|
61
61
|
|
62
|
-
|
63
|
-
|
64
|
-
|
62
|
+
/**
|
63
|
+
* The HWB model describes colors in terms of
|
64
|
+
* hue, whiteness, and blackness.
|
65
|
+
* @link https://www.w3.org/TR/css-color-4/#hwb-to-rgb
|
66
|
+
* @link http://alvyray.com/Papers/CG/hwb2rgb.htm
|
67
|
+
*/
|
68
|
+
export interface HWB {
|
69
|
+
h: number;
|
70
|
+
w: number;
|
71
|
+
b: number;
|
72
|
+
}
|
73
|
+
|
74
|
+
export interface HWBA extends HWB {
|
75
|
+
a: number;
|
76
|
+
}
|
77
|
+
|
78
|
+
export interface ColorPickerOptions {
|
79
|
+
colorLabels?: string[];
|
80
|
+
componentLabels?: Record<string, string>;
|
81
|
+
format?: ColorFormats;
|
82
|
+
colorPresets?: string[];
|
83
|
+
colorKeywords?: string[];
|
84
|
+
}
|
85
|
+
|
86
|
+
export type ColorInput = string | number | RGB | RGBA | HSL | HSLA | HSV | HSVA | HWB | ColorObject;
|
87
|
+
export type ColorFormats = string | 'rgb' | 'hex' | 'hex3' | 'hex4' | 'hex6' | 'hex8' | 'hsl' | 'hsv' | 'hwb';
|
65
88
|
|
66
89
|
export type GetInstance<T> = (element: string | HTMLInputElement) => T | null;
|
67
|
-
export type InitCallback<T> = (element: string | HTMLInputElement
|
90
|
+
export type InitCallback<T> = (element: string | HTMLInputElement) => T;
|