@oscarpalmer/atoms 0.74.1 → 0.76.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/dist/js/array/chunk.cjs +18 -0
- package/dist/js/array/{chunk.mjs → chunk.js} +2 -2
- package/dist/js/array/compact.cjs +6 -0
- package/dist/js/array/{compact.mjs → compact.js} +0 -1
- package/dist/js/array/count.cjs +14 -0
- package/dist/js/array/count.js +14 -0
- package/dist/js/array/exists.cjs +14 -0
- package/dist/js/array/exists.js +14 -0
- package/dist/js/array/filter.cjs +14 -0
- package/dist/js/array/filter.js +14 -0
- package/dist/js/array/find.cjs +14 -0
- package/dist/js/array/find.js +14 -0
- package/dist/js/array/group-by.cjs +35 -0
- package/dist/js/array/group-by.js +35 -0
- package/dist/js/array/index-of.cjs +14 -0
- package/dist/js/array/index-of.js +14 -0
- package/dist/js/array/index.cjs +40 -0
- package/dist/js/array/index.js +34 -381
- package/dist/js/array/insert.cjs +31 -0
- package/dist/js/array/insert.js +31 -0
- package/dist/js/array/models.cjs +1 -0
- package/dist/js/array/models.js +1 -0
- package/dist/js/array/shuffle.cjs +13 -0
- package/dist/js/array/{shuffle.mjs → shuffle.js} +2 -3
- package/dist/js/array/sort.cjs +53 -0
- package/dist/js/array/{sort.mjs → sort.js} +13 -9
- package/dist/js/array/splice.cjs +14 -0
- package/dist/js/array/splice.js +14 -0
- package/dist/js/array/to-map.cjs +27 -0
- package/dist/js/array/to-map.js +27 -0
- package/dist/js/array/to-record.cjs +12 -0
- package/dist/js/array/to-record.js +12 -0
- package/dist/js/array/unique.cjs +7 -0
- package/dist/js/array/unique.js +7 -0
- package/dist/js/colour/base.cjs +18 -0
- package/dist/js/colour/{base.mjs → base.js} +4 -3
- package/dist/js/colour/functions.cjs +96 -0
- package/dist/js/colour/{functions.mjs → functions.js} +18 -19
- package/dist/js/colour/hex.cjs +56 -0
- package/dist/js/colour/{hex.mjs → hex.js} +34 -15
- package/dist/js/colour/hsl.cjs +85 -0
- package/dist/js/colour/{hsl.mjs → hsl.js} +40 -12
- package/dist/js/colour/index.cjs +29 -0
- package/dist/js/colour/index.js +14 -272
- package/dist/js/colour/is.cjs +27 -0
- package/dist/js/colour/{is.mjs → is.js} +7 -6
- package/dist/js/colour/rgb.cjs +87 -0
- package/dist/js/colour/{rgb.mjs → rgb.js} +43 -12
- package/dist/js/{emitter.mjs → emitter.cjs} +88 -56
- package/dist/js/emitter.js +85 -56
- package/dist/js/{function.mjs → function.cjs} +66 -46
- package/dist/js/function.js +61 -48
- package/dist/js/index.cjs +136 -0
- package/dist/js/index.js +133 -1724
- package/dist/js/internal/array/callbacks.cjs +23 -0
- package/dist/js/internal/array/callbacks.js +23 -0
- package/dist/js/internal/array/find.cjs +51 -0
- package/dist/js/internal/array/find.js +51 -0
- package/dist/js/internal/value/handle.cjs +21 -0
- package/dist/js/internal/{value-handle.mjs → value/handle.js} +0 -1
- package/dist/js/{is.mjs → is.cjs} +17 -18
- package/dist/js/is.js +15 -27
- package/dist/js/logger.cjs +108 -0
- package/dist/js/logger.js +44 -8
- package/dist/js/{math.mjs → math.cjs} +7 -8
- package/dist/js/math.js +4 -5
- package/dist/js/models.cjs +1 -0
- package/dist/js/models.js +1 -0
- package/dist/js/{number.mjs → number.cjs} +8 -8
- package/dist/js/number.js +5 -5
- package/dist/js/{query.mjs → query.cjs} +18 -18
- package/dist/js/query.js +17 -86
- package/dist/js/{queue.mjs → queue.cjs} +12 -13
- package/dist/js/queue.js +9 -10
- package/dist/js/{random.mjs → random.cjs} +14 -21
- package/dist/js/random.js +9 -26
- package/dist/js/{sized.mjs → sized.cjs} +68 -33
- package/dist/js/sized.js +66 -38
- package/dist/js/string/case.cjs +41 -0
- package/dist/js/string/{case.mjs → case.js} +13 -9
- package/dist/js/string/index.cjs +59 -0
- package/dist/js/string/index.js +30 -100
- package/dist/js/string/template.cjs +21 -0
- package/dist/js/string/{template.mjs → template.js} +4 -5
- package/dist/js/{touch.mjs → touch.cjs} +4 -7
- package/dist/js/touch.js +3 -5
- package/dist/js/value/clone.cjs +76 -0
- package/dist/js/value/{clone.mjs → clone.js} +5 -6
- package/dist/js/value/compare.cjs +59 -0
- package/dist/js/value/{compare.mjs → compare.js} +4 -6
- package/dist/js/value/diff.cjs +75 -0
- package/dist/js/value/{diff.mjs → diff.js} +13 -11
- package/dist/js/value/equal.cjs +106 -0
- package/dist/js/value/{equal.mjs → equal.js} +13 -8
- package/dist/js/value/get.cjs +21 -0
- package/dist/js/value/{get.mjs → get.js} +9 -4
- package/dist/js/value/index.cjs +30 -0
- package/dist/js/value/index.js +19 -510
- package/dist/js/value/merge.cjs +35 -0
- package/dist/js/value/{merge.mjs → merge.js} +7 -6
- package/dist/js/value/set.cjs +25 -0
- package/dist/js/value/{set.mjs → set.js} +3 -4
- package/dist/js/value/smush.cjs +26 -0
- package/dist/js/value/{smush.mjs → smush.js} +3 -4
- package/dist/js/value/unsmush.cjs +39 -0
- package/dist/js/value/{unsmush.mjs → unsmush.js} +10 -7
- package/package.json +50 -47
- package/src/js/array/chunk.ts +6 -5
- package/src/js/array/compact.ts +8 -10
- package/src/js/array/count.ts +39 -19
- package/src/js/array/exists.ts +39 -15
- package/src/js/array/filter.ts +42 -20
- package/src/js/array/find.ts +45 -20
- package/src/js/array/group-by.ts +158 -27
- package/src/js/array/index-of.ts +40 -18
- package/src/js/array/index.ts +10 -9
- package/src/js/array/insert.ts +28 -14
- package/src/js/array/models.ts +18 -15
- package/src/js/array/shuffle.ts +3 -3
- package/src/js/array/sort.ts +32 -34
- package/src/js/array/splice.ts +22 -26
- package/src/js/array/to-map.ts +133 -45
- package/src/js/array/to-record.ts +137 -39
- package/src/js/array/unique.ts +20 -15
- package/src/js/colour/base.ts +3 -3
- package/src/js/colour/functions.ts +4 -6
- package/src/js/colour/hex.ts +5 -5
- package/src/js/colour/hsl.ts +18 -12
- package/src/js/colour/index.ts +1 -1
- package/src/js/colour/is.ts +3 -3
- package/src/js/colour/rgb.ts +17 -11
- package/src/js/emitter.ts +12 -9
- package/src/js/function.ts +17 -17
- package/src/js/index.ts +16 -16
- package/src/js/internal/array/callbacks.ts +33 -0
- package/src/js/internal/{array-find.ts → array/find.ts} +23 -24
- package/src/js/internal/{value-handle.ts → value/handle.ts} +1 -1
- package/src/js/is.ts +2 -2
- package/src/js/logger.ts +14 -14
- package/src/js/math.ts +1 -1
- package/src/js/models.ts +5 -5
- package/src/js/number.ts +2 -2
- package/src/js/query.ts +6 -10
- package/src/js/queue.ts +1 -1
- package/src/js/random.ts +9 -19
- package/src/js/sized.ts +145 -145
- package/src/js/string/case.ts +1 -1
- package/src/js/string/index.ts +13 -7
- package/src/js/string/template.ts +6 -3
- package/src/js/value/clone.ts +3 -7
- package/src/js/value/compare.ts +3 -5
- package/src/js/value/diff.ts +4 -4
- package/src/js/value/equal.ts +2 -2
- package/src/js/value/get.ts +3 -3
- package/src/js/value/index.ts +2 -2
- package/src/js/value/merge.ts +3 -3
- package/src/js/value/set.ts +3 -4
- package/src/js/value/smush.ts +4 -4
- package/src/js/value/unsmush.ts +4 -4
- package/types/array/chunk.d.cts +8 -0
- package/types/array/chunk.d.ts +2 -2
- package/types/array/compact.d.cts +12 -0
- package/types/array/compact.d.ts +4 -4
- package/types/array/count.d.cts +24 -0
- package/types/array/count.d.ts +13 -7
- package/types/array/exists.d.cts +26 -0
- package/types/array/exists.d.ts +11 -3
- package/types/array/filter.d.cts +26 -0
- package/types/array/filter.d.ts +14 -6
- package/types/array/find.d.cts +26 -0
- package/types/array/find.d.ts +14 -6
- package/types/array/group-by.d.cts +58 -0
- package/types/array/group-by.d.ts +49 -5
- package/types/array/index-of.d.cts +26 -0
- package/types/array/index-of.d.ts +14 -6
- package/types/array/index.d.cts +239 -95
- package/types/array/index.d.ts +7 -6
- package/types/array/insert.d.cts +16 -0
- package/types/array/insert.d.ts +10 -5
- package/types/array/models.d.cts +14 -11
- package/types/array/models.d.ts +14 -12
- package/types/array/shuffle.d.cts +8 -0
- package/types/array/shuffle.d.ts +2 -2
- package/types/array/sort.d.cts +24 -0
- package/types/array/sort.d.ts +10 -10
- package/types/array/splice.d.cts +22 -0
- package/types/array/splice.d.ts +4 -4
- package/types/array/to-map.d.cts +61 -0
- package/types/array/to-map.d.ts +42 -20
- package/types/array/to-record.d.cts +61 -0
- package/types/array/to-record.d.ts +42 -20
- package/types/array/unique.d.cts +21 -0
- package/types/array/unique.d.ts +10 -6
- package/types/colour/base.d.cts +153 -0
- package/types/colour/base.d.ts +2 -2
- package/types/colour/functions.d.cts +173 -0
- package/types/colour/functions.d.ts +3 -3
- package/types/colour/hex.d.cts +157 -0
- package/types/colour/hex.d.ts +4 -4
- package/types/colour/hsl.d.cts +157 -0
- package/types/colour/hsl.d.ts +16 -10
- package/types/colour/index.d.cts +28 -16
- package/types/colour/index.d.ts +1 -1
- package/types/colour/is.d.cts +170 -0
- package/types/colour/is.d.ts +3 -3
- package/types/colour/rgb.d.cts +157 -0
- package/types/colour/rgb.d.ts +15 -9
- package/types/emitter.d.cts +11 -8
- package/types/emitter.d.ts +11 -8
- package/types/function.d.cts +10 -10
- package/types/function.d.ts +11 -11
- package/types/index.d.cts +1120 -736
- package/types/index.d.ts +16 -16
- package/types/internal/array/callbacks.d.cts +11 -0
- package/types/internal/array/callbacks.d.ts +2 -0
- package/types/internal/array/find.d.cts +7 -0
- package/types/internal/array/find.d.ts +3 -0
- package/types/internal/value/handle.d.cts +37 -0
- package/types/internal/{value-handle.d.ts → value/handle.d.ts} +1 -1
- package/types/is.d.ts +1 -1
- package/types/logger.d.cts +13 -21
- package/types/logger.d.ts +13 -21
- package/types/math.d.cts +1 -1
- package/types/math.d.ts +1 -1
- package/types/models.d.cts +4 -4
- package/types/models.d.ts +1 -4
- package/types/number.d.cts +2 -2
- package/types/number.d.ts +2 -2
- package/types/query.d.cts +2 -2
- package/types/query.d.ts +3 -3
- package/types/queue.d.cts +1 -1
- package/types/queue.d.ts +1 -1
- package/types/random.d.cts +8 -12
- package/types/random.d.ts +8 -12
- package/types/sized.d.cts +6 -6
- package/types/sized.d.ts +6 -6
- package/types/string/case.d.cts +28 -0
- package/types/string/index.d.cts +30 -27
- package/types/string/index.d.ts +3 -3
- package/types/string/template.d.cts +50 -0
- package/types/string/template.d.ts +4 -1
- package/types/value/clone.d.cts +8 -0
- package/types/value/clone.d.ts +4 -2
- package/types/value/compare.d.cts +8 -0
- package/types/value/diff.d.cts +25 -0
- package/types/value/equal.d.cts +12 -0
- package/types/value/get.d.cts +1319 -0
- package/types/value/get.d.ts +1 -1
- package/types/value/index.d.cts +8 -6
- package/types/value/index.d.ts +2 -2
- package/types/value/merge.d.cts +72 -0
- package/types/value/merge.d.ts +2 -2
- package/types/value/set.d.cts +1011 -0
- package/types/value/set.d.ts +1 -1
- package/types/value/smush.d.cts +1368 -0
- package/types/value/smush.d.ts +2 -2
- package/types/value/unsmush.d.cts +141 -0
- package/types/value/unsmush.d.ts +2 -2
- package/dist/js/array/count.mjs +0 -8
- package/dist/js/array/exists.mjs +0 -8
- package/dist/js/array/filter.mjs +0 -8
- package/dist/js/array/find.mjs +0 -8
- package/dist/js/array/group-by.mjs +0 -33
- package/dist/js/array/index-of.mjs +0 -8
- package/dist/js/array/index.mjs +0 -34
- package/dist/js/array/insert.mjs +0 -22
- package/dist/js/array/models.mjs +0 -0
- package/dist/js/array/splice.mjs +0 -9
- package/dist/js/array/to-map.mjs +0 -27
- package/dist/js/array/to-record.mjs +0 -8
- package/dist/js/array/unique.mjs +0 -8
- package/dist/js/colour/index.mjs +0 -30
- package/dist/js/index.mjs +0 -17
- package/dist/js/internal/array-callbacks.mjs +0 -19
- package/dist/js/internal/array-find.mjs +0 -51
- package/dist/js/logger.mjs +0 -69
- package/dist/js/models.mjs +0 -0
- package/dist/js/string/index.mjs +0 -44
- package/dist/js/value/index.mjs +0 -23
- package/src/js/internal/array-callbacks.ts +0 -28
- package/types/internal/array-callbacks.d.ts +0 -2
- package/types/internal/array-find.d.ts +0 -4
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
// Generated by dts-bundle-generator v9.5.1
|
|
2
|
+
|
|
3
|
+
export type HSLColourValue = {
|
|
4
|
+
hue: number;
|
|
5
|
+
lightness: number;
|
|
6
|
+
saturation: number;
|
|
7
|
+
};
|
|
8
|
+
declare class HSLColour extends Colour<HSLColourValue> {
|
|
9
|
+
/**
|
|
10
|
+
* Get the current hue
|
|
11
|
+
*/
|
|
12
|
+
get hue(): number;
|
|
13
|
+
/**
|
|
14
|
+
* Set the current hue
|
|
15
|
+
*/
|
|
16
|
+
set hue(value: number);
|
|
17
|
+
/**
|
|
18
|
+
* Get the current lightness
|
|
19
|
+
*/
|
|
20
|
+
get lightness(): number;
|
|
21
|
+
/**
|
|
22
|
+
* Set the current lightness
|
|
23
|
+
*/
|
|
24
|
+
set lightness(value: number);
|
|
25
|
+
/**
|
|
26
|
+
* Get the current saturation
|
|
27
|
+
*/
|
|
28
|
+
get saturation(): number;
|
|
29
|
+
/**
|
|
30
|
+
* Set the current saturation
|
|
31
|
+
*/
|
|
32
|
+
set saturation(value: number);
|
|
33
|
+
constructor(value: HSLColourValue);
|
|
34
|
+
/**
|
|
35
|
+
* @inheritdoc
|
|
36
|
+
*/
|
|
37
|
+
toHex(): HexColour;
|
|
38
|
+
/**
|
|
39
|
+
* Convert the colour to an RGB-colour
|
|
40
|
+
*/
|
|
41
|
+
toRgb(): RGBColour;
|
|
42
|
+
/**
|
|
43
|
+
* @inheritdoc
|
|
44
|
+
*/
|
|
45
|
+
toString(): string;
|
|
46
|
+
/**
|
|
47
|
+
* Convert an HSL-colour to an RGB-colour
|
|
48
|
+
*/
|
|
49
|
+
static toRgb(value: HSLColourValue): RGBColour;
|
|
50
|
+
}
|
|
51
|
+
declare class HexColour {
|
|
52
|
+
private readonly $colour;
|
|
53
|
+
private readonly state;
|
|
54
|
+
/**
|
|
55
|
+
* Get the value of the colour
|
|
56
|
+
*/
|
|
57
|
+
get value(): string;
|
|
58
|
+
/**
|
|
59
|
+
* Set the value of the colour
|
|
60
|
+
*/
|
|
61
|
+
set value(value: string);
|
|
62
|
+
constructor(value: string);
|
|
63
|
+
/**
|
|
64
|
+
* Convert the colour to an RGB-colour
|
|
65
|
+
*/
|
|
66
|
+
toHsl(): HSLColour;
|
|
67
|
+
/**
|
|
68
|
+
* Convert the colour to an HSL-colour
|
|
69
|
+
*/
|
|
70
|
+
toRgb(): RGBColour;
|
|
71
|
+
/**
|
|
72
|
+
* Get the colour as a string _(prefixed with #)_
|
|
73
|
+
*/
|
|
74
|
+
toString(): string;
|
|
75
|
+
/**
|
|
76
|
+
* Convert a hex-colour to an RGB-colour
|
|
77
|
+
*/
|
|
78
|
+
static toRgb(value: string): RGBColour;
|
|
79
|
+
}
|
|
80
|
+
declare abstract class Colour<Model> {
|
|
81
|
+
private readonly $colour;
|
|
82
|
+
protected readonly state: ColourState<Model>;
|
|
83
|
+
/**
|
|
84
|
+
* Get the current value of the colour
|
|
85
|
+
*/
|
|
86
|
+
get value(): Model;
|
|
87
|
+
constructor(type: string, value: Model, defaults: Model, properties: Array<keyof Model>);
|
|
88
|
+
/**
|
|
89
|
+
* Convert the colour to a hex-colour
|
|
90
|
+
*/
|
|
91
|
+
abstract toHex(): HexColour;
|
|
92
|
+
/**
|
|
93
|
+
* Get the colour as a _CSS-formatted_ string
|
|
94
|
+
*/
|
|
95
|
+
abstract toString(): string;
|
|
96
|
+
}
|
|
97
|
+
export type ColourState<Model> = {
|
|
98
|
+
value: Model;
|
|
99
|
+
};
|
|
100
|
+
export type RGBColourValue = {
|
|
101
|
+
blue: number;
|
|
102
|
+
green: number;
|
|
103
|
+
red: number;
|
|
104
|
+
};
|
|
105
|
+
declare class RGBColour extends Colour<RGBColourValue> {
|
|
106
|
+
/**
|
|
107
|
+
* Get the current blue value
|
|
108
|
+
*/
|
|
109
|
+
get blue(): number;
|
|
110
|
+
/**
|
|
111
|
+
* Set the current blue value
|
|
112
|
+
*/
|
|
113
|
+
set blue(value: number);
|
|
114
|
+
/**
|
|
115
|
+
* Get the current green value
|
|
116
|
+
*/
|
|
117
|
+
get green(): number;
|
|
118
|
+
/**
|
|
119
|
+
* Set the current green value
|
|
120
|
+
*/
|
|
121
|
+
set green(value: number);
|
|
122
|
+
/**
|
|
123
|
+
* Get the current red value
|
|
124
|
+
*/
|
|
125
|
+
get red(): number;
|
|
126
|
+
/**
|
|
127
|
+
* Set the current red value
|
|
128
|
+
*/
|
|
129
|
+
set red(value: number);
|
|
130
|
+
constructor(value: RGBColourValue);
|
|
131
|
+
/**
|
|
132
|
+
* @inheritdoc
|
|
133
|
+
*/
|
|
134
|
+
toHex(): HexColour;
|
|
135
|
+
/**
|
|
136
|
+
* Convert the colour to an HSL-colour
|
|
137
|
+
*/
|
|
138
|
+
toHsl(): HSLColour;
|
|
139
|
+
/**
|
|
140
|
+
* @inheritdoc
|
|
141
|
+
*/
|
|
142
|
+
toString(): string;
|
|
143
|
+
/**
|
|
144
|
+
* Convert an RGB-colour to a hex-colour
|
|
145
|
+
*/
|
|
146
|
+
static toHex(value: RGBColourValue): HexColour;
|
|
147
|
+
/**
|
|
148
|
+
* - Convert an RGB-colour to an HSL-colour
|
|
149
|
+
*/
|
|
150
|
+
static toHsl(rgb: RGBColourValue): HSLColour;
|
|
151
|
+
}
|
|
152
|
+
export declare const anyPattern: RegExp;
|
|
153
|
+
export declare function getNormalisedHex(value: string): string;
|
|
154
|
+
/**
|
|
155
|
+
* Convert a hex-colour to an RGB-colour
|
|
156
|
+
*/
|
|
157
|
+
export declare function hexToRgb(value: string): RGBColour;
|
|
158
|
+
/**
|
|
159
|
+
* - Convert an HSL-colour to an RGB-colour
|
|
160
|
+
* - Thanks, https://github.com/color-js/color.js/blob/main/src/spaces/hsl.js#L61
|
|
161
|
+
*/
|
|
162
|
+
export declare function hslToRgb(value: HSLColourValue): RGBColour;
|
|
163
|
+
/**
|
|
164
|
+
* Convert an RGB-colour to a hex-colour
|
|
165
|
+
*/
|
|
166
|
+
export declare function rgbToHex(value: RGBColourValue): HexColour;
|
|
167
|
+
/**
|
|
168
|
+
* - Convert an RGB-colour to an HSL-colour
|
|
169
|
+
* - Thanks, https://github.com/color-js/color.js/blob/main/src/spaces/hsl.js#L26
|
|
170
|
+
*/
|
|
171
|
+
export declare function rgbToHsl(rgb: RGBColourValue): HSLColour;
|
|
172
|
+
|
|
173
|
+
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { HexColour } from '
|
|
2
|
-
import { HSLColour, type HSLColourValue } from '
|
|
3
|
-
import { RGBColour, type RGBColourValue } from '
|
|
1
|
+
import { HexColour } from '~/colour/hex';
|
|
2
|
+
import { HSLColour, type HSLColourValue } from '~/colour/hsl';
|
|
3
|
+
import { RGBColour, type RGBColourValue } from '~/colour/rgb';
|
|
4
4
|
export declare const anyPattern: RegExp;
|
|
5
5
|
export declare function getNormalisedHex(value: string): string;
|
|
6
6
|
/**
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
// Generated by dts-bundle-generator v9.5.1
|
|
2
|
+
|
|
3
|
+
export type HSLColourValue = {
|
|
4
|
+
hue: number;
|
|
5
|
+
lightness: number;
|
|
6
|
+
saturation: number;
|
|
7
|
+
};
|
|
8
|
+
declare class HSLColour extends Colour<HSLColourValue> {
|
|
9
|
+
/**
|
|
10
|
+
* Get the current hue
|
|
11
|
+
*/
|
|
12
|
+
get hue(): number;
|
|
13
|
+
/**
|
|
14
|
+
* Set the current hue
|
|
15
|
+
*/
|
|
16
|
+
set hue(value: number);
|
|
17
|
+
/**
|
|
18
|
+
* Get the current lightness
|
|
19
|
+
*/
|
|
20
|
+
get lightness(): number;
|
|
21
|
+
/**
|
|
22
|
+
* Set the current lightness
|
|
23
|
+
*/
|
|
24
|
+
set lightness(value: number);
|
|
25
|
+
/**
|
|
26
|
+
* Get the current saturation
|
|
27
|
+
*/
|
|
28
|
+
get saturation(): number;
|
|
29
|
+
/**
|
|
30
|
+
* Set the current saturation
|
|
31
|
+
*/
|
|
32
|
+
set saturation(value: number);
|
|
33
|
+
constructor(value: HSLColourValue);
|
|
34
|
+
/**
|
|
35
|
+
* @inheritdoc
|
|
36
|
+
*/
|
|
37
|
+
toHex(): HexColour;
|
|
38
|
+
/**
|
|
39
|
+
* Convert the colour to an RGB-colour
|
|
40
|
+
*/
|
|
41
|
+
toRgb(): RGBColour;
|
|
42
|
+
/**
|
|
43
|
+
* @inheritdoc
|
|
44
|
+
*/
|
|
45
|
+
toString(): string;
|
|
46
|
+
/**
|
|
47
|
+
* Convert an HSL-colour to an RGB-colour
|
|
48
|
+
*/
|
|
49
|
+
static toRgb(value: HSLColourValue): RGBColour;
|
|
50
|
+
}
|
|
51
|
+
export declare class HexColour {
|
|
52
|
+
private readonly $colour;
|
|
53
|
+
private readonly state;
|
|
54
|
+
/**
|
|
55
|
+
* Get the value of the colour
|
|
56
|
+
*/
|
|
57
|
+
get value(): string;
|
|
58
|
+
/**
|
|
59
|
+
* Set the value of the colour
|
|
60
|
+
*/
|
|
61
|
+
set value(value: string);
|
|
62
|
+
constructor(value: string);
|
|
63
|
+
/**
|
|
64
|
+
* Convert the colour to an RGB-colour
|
|
65
|
+
*/
|
|
66
|
+
toHsl(): HSLColour;
|
|
67
|
+
/**
|
|
68
|
+
* Convert the colour to an HSL-colour
|
|
69
|
+
*/
|
|
70
|
+
toRgb(): RGBColour;
|
|
71
|
+
/**
|
|
72
|
+
* Get the colour as a string _(prefixed with #)_
|
|
73
|
+
*/
|
|
74
|
+
toString(): string;
|
|
75
|
+
/**
|
|
76
|
+
* Convert a hex-colour to an RGB-colour
|
|
77
|
+
*/
|
|
78
|
+
static toRgb(value: string): RGBColour;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Get a hex-colour from a string
|
|
82
|
+
*/
|
|
83
|
+
export declare function getHexColour(value: string): HexColour;
|
|
84
|
+
declare abstract class Colour<Model> {
|
|
85
|
+
private readonly $colour;
|
|
86
|
+
protected readonly state: ColourState<Model>;
|
|
87
|
+
/**
|
|
88
|
+
* Get the current value of the colour
|
|
89
|
+
*/
|
|
90
|
+
get value(): Model;
|
|
91
|
+
constructor(type: string, value: Model, defaults: Model, properties: Array<keyof Model>);
|
|
92
|
+
/**
|
|
93
|
+
* Convert the colour to a hex-colour
|
|
94
|
+
*/
|
|
95
|
+
abstract toHex(): HexColour;
|
|
96
|
+
/**
|
|
97
|
+
* Get the colour as a _CSS-formatted_ string
|
|
98
|
+
*/
|
|
99
|
+
abstract toString(): string;
|
|
100
|
+
}
|
|
101
|
+
export type ColourState<Model> = {
|
|
102
|
+
value: Model;
|
|
103
|
+
};
|
|
104
|
+
export type RGBColourValue = {
|
|
105
|
+
blue: number;
|
|
106
|
+
green: number;
|
|
107
|
+
red: number;
|
|
108
|
+
};
|
|
109
|
+
declare class RGBColour extends Colour<RGBColourValue> {
|
|
110
|
+
/**
|
|
111
|
+
* Get the current blue value
|
|
112
|
+
*/
|
|
113
|
+
get blue(): number;
|
|
114
|
+
/**
|
|
115
|
+
* Set the current blue value
|
|
116
|
+
*/
|
|
117
|
+
set blue(value: number);
|
|
118
|
+
/**
|
|
119
|
+
* Get the current green value
|
|
120
|
+
*/
|
|
121
|
+
get green(): number;
|
|
122
|
+
/**
|
|
123
|
+
* Set the current green value
|
|
124
|
+
*/
|
|
125
|
+
set green(value: number);
|
|
126
|
+
/**
|
|
127
|
+
* Get the current red value
|
|
128
|
+
*/
|
|
129
|
+
get red(): number;
|
|
130
|
+
/**
|
|
131
|
+
* Set the current red value
|
|
132
|
+
*/
|
|
133
|
+
set red(value: number);
|
|
134
|
+
constructor(value: RGBColourValue);
|
|
135
|
+
/**
|
|
136
|
+
* @inheritdoc
|
|
137
|
+
*/
|
|
138
|
+
toHex(): HexColour;
|
|
139
|
+
/**
|
|
140
|
+
* Convert the colour to an HSL-colour
|
|
141
|
+
*/
|
|
142
|
+
toHsl(): HSLColour;
|
|
143
|
+
/**
|
|
144
|
+
* @inheritdoc
|
|
145
|
+
*/
|
|
146
|
+
toString(): string;
|
|
147
|
+
/**
|
|
148
|
+
* Convert an RGB-colour to a hex-colour
|
|
149
|
+
*/
|
|
150
|
+
static toHex(value: RGBColourValue): HexColour;
|
|
151
|
+
/**
|
|
152
|
+
* - Convert an RGB-colour to an HSL-colour
|
|
153
|
+
*/
|
|
154
|
+
static toHsl(rgb: RGBColourValue): HSLColour;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
export {};
|
package/types/colour/hex.d.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import type { HSLColour } from '
|
|
2
|
-
import type { RGBColour } from '
|
|
1
|
+
import type { HSLColour } from '~/colour/hsl';
|
|
2
|
+
import type { RGBColour } from '~/colour/rgb';
|
|
3
3
|
export declare class HexColour {
|
|
4
4
|
private readonly $colour;
|
|
5
5
|
private readonly state;
|
|
6
6
|
/**
|
|
7
|
-
*
|
|
7
|
+
* Get the value of the colour
|
|
8
8
|
*/
|
|
9
9
|
get value(): string;
|
|
10
10
|
/**
|
|
11
|
-
*
|
|
11
|
+
* Set the value of the colour
|
|
12
12
|
*/
|
|
13
13
|
set value(value: string);
|
|
14
14
|
constructor(value: string);
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
// Generated by dts-bundle-generator v9.5.1
|
|
2
|
+
|
|
3
|
+
export type HSLColourValue = {
|
|
4
|
+
hue: number;
|
|
5
|
+
lightness: number;
|
|
6
|
+
saturation: number;
|
|
7
|
+
};
|
|
8
|
+
export declare class HSLColour extends Colour<HSLColourValue> {
|
|
9
|
+
/**
|
|
10
|
+
* Get the current hue
|
|
11
|
+
*/
|
|
12
|
+
get hue(): number;
|
|
13
|
+
/**
|
|
14
|
+
* Set the current hue
|
|
15
|
+
*/
|
|
16
|
+
set hue(value: number);
|
|
17
|
+
/**
|
|
18
|
+
* Get the current lightness
|
|
19
|
+
*/
|
|
20
|
+
get lightness(): number;
|
|
21
|
+
/**
|
|
22
|
+
* Set the current lightness
|
|
23
|
+
*/
|
|
24
|
+
set lightness(value: number);
|
|
25
|
+
/**
|
|
26
|
+
* Get the current saturation
|
|
27
|
+
*/
|
|
28
|
+
get saturation(): number;
|
|
29
|
+
/**
|
|
30
|
+
* Set the current saturation
|
|
31
|
+
*/
|
|
32
|
+
set saturation(value: number);
|
|
33
|
+
constructor(value: HSLColourValue);
|
|
34
|
+
/**
|
|
35
|
+
* @inheritdoc
|
|
36
|
+
*/
|
|
37
|
+
toHex(): HexColour;
|
|
38
|
+
/**
|
|
39
|
+
* Convert the colour to an RGB-colour
|
|
40
|
+
*/
|
|
41
|
+
toRgb(): RGBColour;
|
|
42
|
+
/**
|
|
43
|
+
* @inheritdoc
|
|
44
|
+
*/
|
|
45
|
+
toString(): string;
|
|
46
|
+
/**
|
|
47
|
+
* Convert an HSL-colour to an RGB-colour
|
|
48
|
+
*/
|
|
49
|
+
static toRgb(value: HSLColourValue): RGBColour;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Get an HSL-colour from a value-object
|
|
53
|
+
*/
|
|
54
|
+
export declare function getHSLColour(value: HSLColourValue): HSLColour;
|
|
55
|
+
declare class HexColour {
|
|
56
|
+
private readonly $colour;
|
|
57
|
+
private readonly state;
|
|
58
|
+
/**
|
|
59
|
+
* Get the value of the colour
|
|
60
|
+
*/
|
|
61
|
+
get value(): string;
|
|
62
|
+
/**
|
|
63
|
+
* Set the value of the colour
|
|
64
|
+
*/
|
|
65
|
+
set value(value: string);
|
|
66
|
+
constructor(value: string);
|
|
67
|
+
/**
|
|
68
|
+
* Convert the colour to an RGB-colour
|
|
69
|
+
*/
|
|
70
|
+
toHsl(): HSLColour;
|
|
71
|
+
/**
|
|
72
|
+
* Convert the colour to an HSL-colour
|
|
73
|
+
*/
|
|
74
|
+
toRgb(): RGBColour;
|
|
75
|
+
/**
|
|
76
|
+
* Get the colour as a string _(prefixed with #)_
|
|
77
|
+
*/
|
|
78
|
+
toString(): string;
|
|
79
|
+
/**
|
|
80
|
+
* Convert a hex-colour to an RGB-colour
|
|
81
|
+
*/
|
|
82
|
+
static toRgb(value: string): RGBColour;
|
|
83
|
+
}
|
|
84
|
+
declare abstract class Colour<Model> {
|
|
85
|
+
private readonly $colour;
|
|
86
|
+
protected readonly state: ColourState<Model>;
|
|
87
|
+
/**
|
|
88
|
+
* Get the current value of the colour
|
|
89
|
+
*/
|
|
90
|
+
get value(): Model;
|
|
91
|
+
constructor(type: string, value: Model, defaults: Model, properties: Array<keyof Model>);
|
|
92
|
+
/**
|
|
93
|
+
* Convert the colour to a hex-colour
|
|
94
|
+
*/
|
|
95
|
+
abstract toHex(): HexColour;
|
|
96
|
+
/**
|
|
97
|
+
* Get the colour as a _CSS-formatted_ string
|
|
98
|
+
*/
|
|
99
|
+
abstract toString(): string;
|
|
100
|
+
}
|
|
101
|
+
export type ColourState<Model> = {
|
|
102
|
+
value: Model;
|
|
103
|
+
};
|
|
104
|
+
export type RGBColourValue = {
|
|
105
|
+
blue: number;
|
|
106
|
+
green: number;
|
|
107
|
+
red: number;
|
|
108
|
+
};
|
|
109
|
+
declare class RGBColour extends Colour<RGBColourValue> {
|
|
110
|
+
/**
|
|
111
|
+
* Get the current blue value
|
|
112
|
+
*/
|
|
113
|
+
get blue(): number;
|
|
114
|
+
/**
|
|
115
|
+
* Set the current blue value
|
|
116
|
+
*/
|
|
117
|
+
set blue(value: number);
|
|
118
|
+
/**
|
|
119
|
+
* Get the current green value
|
|
120
|
+
*/
|
|
121
|
+
get green(): number;
|
|
122
|
+
/**
|
|
123
|
+
* Set the current green value
|
|
124
|
+
*/
|
|
125
|
+
set green(value: number);
|
|
126
|
+
/**
|
|
127
|
+
* Get the current red value
|
|
128
|
+
*/
|
|
129
|
+
get red(): number;
|
|
130
|
+
/**
|
|
131
|
+
* Set the current red value
|
|
132
|
+
*/
|
|
133
|
+
set red(value: number);
|
|
134
|
+
constructor(value: RGBColourValue);
|
|
135
|
+
/**
|
|
136
|
+
* @inheritdoc
|
|
137
|
+
*/
|
|
138
|
+
toHex(): HexColour;
|
|
139
|
+
/**
|
|
140
|
+
* Convert the colour to an HSL-colour
|
|
141
|
+
*/
|
|
142
|
+
toHsl(): HSLColour;
|
|
143
|
+
/**
|
|
144
|
+
* @inheritdoc
|
|
145
|
+
*/
|
|
146
|
+
toString(): string;
|
|
147
|
+
/**
|
|
148
|
+
* Convert an RGB-colour to a hex-colour
|
|
149
|
+
*/
|
|
150
|
+
static toHex(value: RGBColourValue): HexColour;
|
|
151
|
+
/**
|
|
152
|
+
* - Convert an RGB-colour to an HSL-colour
|
|
153
|
+
*/
|
|
154
|
+
static toHsl(rgb: RGBColourValue): HSLColour;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
export {};
|
package/types/colour/hsl.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Colour } from '
|
|
2
|
-
import type { HexColour } from '
|
|
3
|
-
import type { RGBColour } from '
|
|
1
|
+
import { Colour } from '~/colour/base';
|
|
2
|
+
import type { HexColour } from '~/colour/hex';
|
|
3
|
+
import type { RGBColour } from '~/colour/rgb';
|
|
4
4
|
export type HSLColourValue = {
|
|
5
5
|
hue: number;
|
|
6
6
|
lightness: number;
|
|
@@ -8,35 +8,41 @@ export type HSLColourValue = {
|
|
|
8
8
|
};
|
|
9
9
|
export declare class HSLColour extends Colour<HSLColourValue> {
|
|
10
10
|
/**
|
|
11
|
-
*
|
|
11
|
+
* Get the current hue
|
|
12
12
|
*/
|
|
13
13
|
get hue(): number;
|
|
14
14
|
/**
|
|
15
|
-
*
|
|
15
|
+
* Set the current hue
|
|
16
16
|
*/
|
|
17
17
|
set hue(value: number);
|
|
18
18
|
/**
|
|
19
|
-
*
|
|
19
|
+
* Get the current lightness
|
|
20
20
|
*/
|
|
21
21
|
get lightness(): number;
|
|
22
22
|
/**
|
|
23
|
-
*
|
|
23
|
+
* Set the current lightness
|
|
24
24
|
*/
|
|
25
25
|
set lightness(value: number);
|
|
26
26
|
/**
|
|
27
|
-
*
|
|
27
|
+
* Get the current saturation
|
|
28
28
|
*/
|
|
29
29
|
get saturation(): number;
|
|
30
30
|
/**
|
|
31
|
-
*
|
|
31
|
+
* Set the current saturation
|
|
32
32
|
*/
|
|
33
33
|
set saturation(value: number);
|
|
34
34
|
constructor(value: HSLColourValue);
|
|
35
|
+
/**
|
|
36
|
+
* @inheritdoc
|
|
37
|
+
*/
|
|
35
38
|
toHex(): HexColour;
|
|
36
39
|
/**
|
|
37
|
-
*
|
|
40
|
+
* Convert the colour to an RGB-colour
|
|
38
41
|
*/
|
|
39
42
|
toRgb(): RGBColour;
|
|
43
|
+
/**
|
|
44
|
+
* @inheritdoc
|
|
45
|
+
*/
|
|
40
46
|
toString(): string;
|
|
41
47
|
/**
|
|
42
48
|
* Convert an HSL-colour to an RGB-colour
|
package/types/colour/index.d.cts
CHANGED
|
@@ -7,35 +7,41 @@ export type HSLColourValue = {
|
|
|
7
7
|
};
|
|
8
8
|
export declare class HSLColour extends Colour<HSLColourValue> {
|
|
9
9
|
/**
|
|
10
|
-
*
|
|
10
|
+
* Get the current hue
|
|
11
11
|
*/
|
|
12
12
|
get hue(): number;
|
|
13
13
|
/**
|
|
14
|
-
*
|
|
14
|
+
* Set the current hue
|
|
15
15
|
*/
|
|
16
16
|
set hue(value: number);
|
|
17
17
|
/**
|
|
18
|
-
*
|
|
18
|
+
* Get the current lightness
|
|
19
19
|
*/
|
|
20
20
|
get lightness(): number;
|
|
21
21
|
/**
|
|
22
|
-
*
|
|
22
|
+
* Set the current lightness
|
|
23
23
|
*/
|
|
24
24
|
set lightness(value: number);
|
|
25
25
|
/**
|
|
26
|
-
*
|
|
26
|
+
* Get the current saturation
|
|
27
27
|
*/
|
|
28
28
|
get saturation(): number;
|
|
29
29
|
/**
|
|
30
|
-
*
|
|
30
|
+
* Set the current saturation
|
|
31
31
|
*/
|
|
32
32
|
set saturation(value: number);
|
|
33
33
|
constructor(value: HSLColourValue);
|
|
34
|
+
/**
|
|
35
|
+
* @inheritdoc
|
|
36
|
+
*/
|
|
34
37
|
toHex(): HexColour;
|
|
35
38
|
/**
|
|
36
|
-
*
|
|
39
|
+
* Convert the colour to an RGB-colour
|
|
37
40
|
*/
|
|
38
41
|
toRgb(): RGBColour;
|
|
42
|
+
/**
|
|
43
|
+
* @inheritdoc
|
|
44
|
+
*/
|
|
39
45
|
toString(): string;
|
|
40
46
|
/**
|
|
41
47
|
* Convert an HSL-colour to an RGB-colour
|
|
@@ -50,11 +56,11 @@ export declare class HexColour {
|
|
|
50
56
|
private readonly $colour;
|
|
51
57
|
private readonly state;
|
|
52
58
|
/**
|
|
53
|
-
*
|
|
59
|
+
* Get the value of the colour
|
|
54
60
|
*/
|
|
55
61
|
get value(): string;
|
|
56
62
|
/**
|
|
57
|
-
*
|
|
63
|
+
* Set the value of the colour
|
|
58
64
|
*/
|
|
59
65
|
set value(value: string);
|
|
60
66
|
constructor(value: string);
|
|
@@ -83,7 +89,7 @@ declare abstract class Colour<Model> {
|
|
|
83
89
|
private readonly $colour;
|
|
84
90
|
protected readonly state: ColourState<Model>;
|
|
85
91
|
/**
|
|
86
|
-
*
|
|
92
|
+
* Get the current value of the colour
|
|
87
93
|
*/
|
|
88
94
|
get value(): Model;
|
|
89
95
|
constructor(type: string, value: Model, defaults: Model, properties: Array<keyof Model>);
|
|
@@ -106,35 +112,41 @@ export type RGBColourValue = {
|
|
|
106
112
|
};
|
|
107
113
|
export declare class RGBColour extends Colour<RGBColourValue> {
|
|
108
114
|
/**
|
|
109
|
-
*
|
|
115
|
+
* Get the current blue value
|
|
110
116
|
*/
|
|
111
117
|
get blue(): number;
|
|
112
118
|
/**
|
|
113
|
-
*
|
|
119
|
+
* Set the current blue value
|
|
114
120
|
*/
|
|
115
121
|
set blue(value: number);
|
|
116
122
|
/**
|
|
117
|
-
*
|
|
123
|
+
* Get the current green value
|
|
118
124
|
*/
|
|
119
125
|
get green(): number;
|
|
120
126
|
/**
|
|
121
|
-
*
|
|
127
|
+
* Set the current green value
|
|
122
128
|
*/
|
|
123
129
|
set green(value: number);
|
|
124
130
|
/**
|
|
125
|
-
*
|
|
131
|
+
* Get the current red value
|
|
126
132
|
*/
|
|
127
133
|
get red(): number;
|
|
128
134
|
/**
|
|
129
|
-
*
|
|
135
|
+
* Set the current red value
|
|
130
136
|
*/
|
|
131
137
|
set red(value: number);
|
|
132
138
|
constructor(value: RGBColourValue);
|
|
139
|
+
/**
|
|
140
|
+
* @inheritdoc
|
|
141
|
+
*/
|
|
133
142
|
toHex(): HexColour;
|
|
134
143
|
/**
|
|
135
144
|
* Convert the colour to an HSL-colour
|
|
136
145
|
*/
|
|
137
146
|
toHsl(): HSLColour;
|
|
147
|
+
/**
|
|
148
|
+
* @inheritdoc
|
|
149
|
+
*/
|
|
138
150
|
toString(): string;
|
|
139
151
|
/**
|
|
140
152
|
* Convert an RGB-colour to a hex-colour
|
package/types/colour/index.d.ts
CHANGED