toosoon-utils 4.3.1 → 4.4.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 CHANGED
@@ -333,7 +333,7 @@ toRadians(degrees: number): number;
333
333
 
334
334
  ##### angle(x1, y1, x2, y2)
335
335
 
336
- Calculate the angle from a point to another.
336
+ Calculate the angle (in radians) from a point to another.
337
337
 
338
338
  - `x1`: X-axis coordinate of the start point.
339
339
  - `y1`: Y-axis coordinate of the start point.
@@ -346,7 +346,7 @@ angle(x1: number, y1: number, x2: number, y2: number): number;
346
346
 
347
347
  ##### closestAngle(startAngle, endAngle)
348
348
 
349
- Find the closest angle between to angles.
349
+ Find the closest angle (in radians) between two angles.
350
350
 
351
351
  - `startAngle`: Start angle (in radians).
352
352
  - `endAngle`: End angle (in radians).
@@ -534,9 +534,9 @@ hsbToRgb([h, s, b]: [number, number, number]): [number, number, number];
534
534
 
535
535
  ##### labToHcl(lab)
536
536
 
537
- Convert LAB to HCL.
537
+ Convert L*a*b\* to HCL.
538
538
 
539
- - `lab`: LAB color.
539
+ - `lab`: L*a*b\* color.
540
540
 
541
541
  ```ts
542
542
  labToHcl([l, a, b]: [number, number, number]): [number, number, number];
@@ -544,7 +544,7 @@ labToHcl([l, a, b]: [number, number, number]): [number, number, number];
544
544
 
545
545
  ##### hclToLab(hcl)
546
546
 
547
- Convert HCL to LAB.
547
+ Convert HCL to L\*a\*b\*.
548
548
 
549
549
  - `hcl`: HCL color.
550
550
 
@@ -554,9 +554,9 @@ hclToLab([h, c, l]: [number, number, number]): [number, number, number];
554
554
 
555
555
  ##### labToRgb(lab)
556
556
 
557
- Convert LAB to RGB.
557
+ Convert L\*a\*b\* to RGB.
558
558
 
559
- - `lab`: LAB color.
559
+ - `lab`: L\*a\*b\* color.
560
560
 
561
561
  ```ts
562
562
  labToRgb([l, a, b]: [number, number, number]): [number, number, number];
@@ -564,7 +564,7 @@ labToRgb([l, a, b]: [number, number, number]): [number, number, number];
564
564
 
565
565
  ##### rgbToLab(rgb)
566
566
 
567
- Convert RGB to LAB.
567
+ Convert RGB to L\*a\*b\*.
568
568
 
569
569
  - `rgb`: RGB color.
570
570
 
@@ -574,10 +574,10 @@ rgbToLab([r, g, b]: [number, number, number]): [number, number, number];
574
574
 
575
575
  ##### deltaE(labA, labB)
576
576
 
577
- Get the delta from two LAB colors.
577
+ Get the delta from two L\*a\*b\* colors.
578
578
 
579
- - `labA`: First LAB color.
580
- - `labB`: Second LAB color.
579
+ - `labA`: First L\*a\*b\* color.
580
+ - `labB`: Second L\*a\*b\* color.
581
581
 
582
582
  ```ts
583
583
  deltaE(labA: [number, number, number], labB: [number, number, number]): number;
@@ -846,15 +846,26 @@ injectStyles(styles: string): void;
846
846
 
847
847
  ### Files <a id="files-functions"></a>
848
848
 
849
+ ##### load(file)
850
+
851
+ Load a file.
852
+
853
+ - `file`: File to load.
854
+
855
+ ```ts
856
+ async load(file: File): Promise<string>;
857
+ ```
858
+
849
859
  ##### download(blob, filename)
850
860
 
851
861
  Download a Blob object into user files.
852
862
 
853
863
  - `blob`: Blob object to download.
854
- - `filename`: Downloaded file name.
864
+ - `params`: Download parameters.
865
+ - `params.filename`: Downloaded file name.
855
866
 
856
867
  ```ts
857
- download(blob: Blob, filename: string): void;
868
+ download(blob: Blob, { filename }: { filename: string }): void;
858
869
  ```
859
870
 
860
871
  ##### upload(onLoad)
@@ -868,6 +879,18 @@ Upload a file from user files.
868
879
  upload(onLoad: (dataUrl: string) => void, accept?: string): void;
869
880
  ```
870
881
 
882
+ ##### share(blob)
883
+
884
+ Share a Blob object with the user's device.
885
+
886
+ - `blob`: Blob object to share.
887
+ - `params`: Share parameters.
888
+ - `params.filename`: Shared file name.
889
+
890
+ ```ts
891
+ async share(blob: Blob, { filename, ...data }: { filename: string } & ShareData): Promise<void>;
892
+ ```
893
+
871
894
  ### Random <a id="random-functions"></a>
872
895
 
873
896
  ##### randomBoolean(probability)
package/lib/colors.d.ts CHANGED
@@ -46,7 +46,7 @@ export declare function hexToRgb(hex: ColorHex | string): ColorRgb;
46
46
  /**
47
47
  * Lighten a color
48
48
  *
49
- * @param {string} hex Hexadecimal string
49
+ * @param {string} hex Hexadecimal string
50
50
  * @param {number} [amount=0] Amount of the color offset
51
51
  * @returns {string} Computed hexadecimal
52
52
  */
@@ -54,7 +54,7 @@ export declare function lighten(hex: string, amount?: number): string;
54
54
  /**
55
55
  * Darken a color
56
56
  *
57
- * @param {string} hex Hexadecimal string
57
+ * @param {string} hex Hexadecimal string
58
58
  * @param {number} [amount=0] Amount of the color offset
59
59
  * @returns {string} Computed hexadecimal
60
60
  */
@@ -142,7 +142,7 @@ export declare function hsbToRgb([h, s, b]: ColorHsb): ColorRgb;
142
142
  * - Chroma: [0, ~150]
143
143
  * - Lightness: [0, 100]
144
144
  *
145
- * @param {ColorLab} lab LAB color
145
+ * @param {ColorLab} lab L*a*b* color
146
146
  * @returns {ColorHcl} HCL color
147
147
  */
148
148
  export declare function labToHcl([l, a, b]: ColorLab): ColorHcl;
package/lib/colors.js CHANGED
@@ -98,7 +98,7 @@ export function hexToRgb(hex) {
98
98
  /**
99
99
  * Lighten a color
100
100
  *
101
- * @param {string} hex Hexadecimal string
101
+ * @param {string} hex Hexadecimal string
102
102
  * @param {number} [amount=0] Amount of the color offset
103
103
  * @returns {string} Computed hexadecimal
104
104
  */
@@ -121,7 +121,7 @@ export function lighten(hex, amount = 0) {
121
121
  /**
122
122
  * Darken a color
123
123
  *
124
- * @param {string} hex Hexadecimal string
124
+ * @param {string} hex Hexadecimal string
125
125
  * @param {number} [amount=0] Amount of the color offset
126
126
  * @returns {string} Computed hexadecimal
127
127
  */
@@ -247,7 +247,7 @@ export function hsbToRgb([h, s, b]) {
247
247
  * - Chroma: [0, ~150]
248
248
  * - Lightness: [0, 100]
249
249
  *
250
- * @param {ColorLab} lab LAB color
250
+ * @param {ColorLab} lab L*a*b* color
251
251
  * @returns {ColorHcl} HCL color
252
252
  */
253
253
  export function labToHcl([l, a, b]) {
package/lib/dom.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Find the closest parent that matches a selector
3
3
  *
4
- * @param {Element|null} element Target element
4
+ * @param {Element|null} element Target element
5
5
  * @param {Element|string} selector Selector or parent to match
6
6
  * @returns {Element|null}
7
7
  */
@@ -9,7 +9,7 @@ export declare function closest(element: Element | null, selector: Element | str
9
9
  /**
10
10
  * Create a canvas and 2d context
11
11
  *
12
- * @param {number} width Width of the canvas
12
+ * @param {number} width Width of the canvas
13
13
  * @param {number} height Height of the canvas
14
14
  * @returns {{ canvas: HTMLCanvasElement, ctx: CanvasRenderingContext2D }}
15
15
  */
package/lib/dom.js CHANGED
@@ -2,7 +2,7 @@ const DOCUMENT_NODE_TYPE = 9;
2
2
  /**
3
3
  * Find the closest parent that matches a selector
4
4
  *
5
- * @param {Element|null} element Target element
5
+ * @param {Element|null} element Target element
6
6
  * @param {Element|string} selector Selector or parent to match
7
7
  * @returns {Element|null}
8
8
  */
@@ -19,7 +19,7 @@ export function closest(element, selector) {
19
19
  /**
20
20
  * Create a canvas and 2d context
21
21
  *
22
- * @param {number} width Width of the canvas
22
+ * @param {number} width Width of the canvas
23
23
  * @param {number} height Height of the canvas
24
24
  * @returns {{ canvas: HTMLCanvasElement, ctx: CanvasRenderingContext2D }}
25
25
  */
@@ -38,9 +38,9 @@ export function createCanvas(width, height) {
38
38
  export function injectStyles(styles) {
39
39
  const $style = document.createElement('style');
40
40
  $style.innerHTML = styles;
41
- const $before = document.querySelector('head link[rel=stylesheet], head style');
42
- if ($before)
43
- document.head.insertBefore($style, $before);
41
+ const $headStyle = document.querySelector('head link[rel=stylesheet], head style');
42
+ if ($headStyle)
43
+ document.head.insertBefore($style, $headStyle);
44
44
  else
45
45
  document.head.appendChild($style);
46
46
  }
@@ -60,7 +60,6 @@ export default class Color {
60
60
  setColorName(colorName: ColorName): this;
61
61
  /**
62
62
  * Set this color values from a given RGB color
63
- *
64
63
  * Note:
65
64
  * - RGB values are contained in the interval [0, 1]
66
65
  *
@@ -77,7 +76,6 @@ export default class Color {
77
76
  setHex(hex: ColorHex): this;
78
77
  /**
79
78
  * Set this color values from a given HSL color
80
- *
81
79
  * Note:
82
80
  * - HSL values are contained in the intervals:
83
81
  * - Hue: [0, 360]
@@ -90,7 +88,6 @@ export default class Color {
90
88
  setHsl(hsl: ColorHsl | string): this;
91
89
  /**
92
90
  * Set this color values from a given HSB color
93
- *
94
91
  * Note:
95
92
  * - HSB values are contained in the intervals:
96
93
  * - Hue: [0, 360]
@@ -103,7 +100,6 @@ export default class Color {
103
100
  setHsb(hsb: ColorHsb): this;
104
101
  /**
105
102
  * Set this color values from a given L*a*b* color
106
- *
107
103
  * Note:
108
104
  * - L*a*b* values are contained in the intervals:
109
105
  * - Lightness: [0 à 100]
@@ -116,7 +112,6 @@ export default class Color {
116
112
  setLab(lab: ColorLab): this;
117
113
  /**
118
114
  * Set this color values from a given HCL color
119
- *
120
115
  * Note:
121
116
  * - HCL values are contained in the intervals:
122
117
  * - Hue: [0, 360]
@@ -140,7 +135,7 @@ export default class Color {
140
135
  *
141
136
  * @param {number} t Normalized time value to interpolate
142
137
  * @param {ColorRgb} rgb RGB values to interpolate towards
143
- * @param {object} [params] Interpolation parameters
138
+ * @param {Object} [params] Interpolation parameters
144
139
  * @param {number} [params.power] Interpolation exponent
145
140
  * @returns {this}
146
141
  */
@@ -150,7 +145,7 @@ export default class Color {
150
145
  *
151
146
  * @param {number} t Normalized time value to interpolate
152
147
  * @param {ColorHsl} hsl HSL values to interpolate towards
153
- * @param {object} [params] Interpolation parameters
148
+ * @param {Object} [params] Interpolation parameters
154
149
  * @param {number|number[]} [params.power] Interpolation exponent(s) : [h, s, l]
155
150
  * @param {string} [params.hueMode] Hue interpolation mode. Can be 'direct' | 'shortest' | 'longest'
156
151
  * @returns {this}
@@ -161,7 +156,7 @@ export default class Color {
161
156
  *
162
157
  * @param {number} t Normalized time value to interpolate
163
158
  * @param {ColorHsb} hsb HSB values to interpolate towards
164
- * @param {object} [params] Interpolation parameters
159
+ * @param {Object} [params] Interpolation parameters
165
160
  * @param {number|number[]} [params.power] Interpolation exponent(s) : [h, s, b]
166
161
  * @param {string} [params.hueMode] Hue interpolation mode. Can be 'direct' | 'shortest' | 'longest'
167
162
  * @returns {this}
@@ -172,7 +167,7 @@ export default class Color {
172
167
  *
173
168
  * @param {number} t Normalized time value to interpolate
174
169
  * @param {ColorHcl} hcl HCL values to interpolate towards
175
- * @param {object} [params] Interpolation parameters
170
+ * @param {Object} [params] Interpolation parameters
176
171
  * @param {string} [params.hueMode] Hue interpolation mode. Can be 'direct' | 'shortest' | 'longest'
177
172
  * @returns {this}
178
173
  */
@@ -182,7 +177,7 @@ export default class Color {
182
177
  *
183
178
  * @param {number} t Normalized time value to interpolate
184
179
  * @param {ColorHcl} hcl HCL values to interpolate towards
185
- * @param {object} [params] Interpolation parameters
180
+ * @param {Object} [params] Interpolation parameters
186
181
  * @param {number|number[]} [params.power] Interpolation exponent(s) : [c, l]
187
182
  * @param {string} [params.hueMode] Hue interpolation mode. Can be 'direct' | 'shortest' | 'longest'
188
183
  * @param {number} [params.chromaMax] Maximum chroma value
@@ -194,7 +189,7 @@ export default class Color {
194
189
  *
195
190
  * @param {number} t Normalized time value to interpolate
196
191
  * @param {ColorHcl} hcl HCL values to interpolate towards
197
- * @param {object} [params] Interpolation parameters
192
+ * @param {Object} [params] Interpolation parameters
198
193
  * @param {number|number[]} [params.power] Interpolation exponent(s) : ([c, l])
199
194
  * @returns {this}
200
195
  */
@@ -276,7 +271,7 @@ export default class Color {
276
271
  * @param {number} t Normalized time value to interpolate
277
272
  * @param {Color|ColorRgb} rgb1 Start color
278
273
  * @param {Color|ColorRgb} rgb2 End color
279
- * @param {object} [params] Interpolation parameters
274
+ * @param {Object} [params] Interpolation parameters
280
275
  * @param {number} [params.power=1] Interpolation exponent
281
276
  * @returns {ColorRgb} Interpolated RGB color
282
277
  */
@@ -289,7 +284,7 @@ export default class Color {
289
284
  * @param {number} t Normalized time value to interpolate
290
285
  * @param {ColorHsl} hsl1 Start color
291
286
  * @param {ColorHsl} hsl2 End color
292
- * @param {object} [params] Interpolation parameters
287
+ * @param {Object} [params] Interpolation parameters
293
288
  * @param {number|number[]} [params.power=1] Interpolation exponent(s) : [h, s, l]
294
289
  * @param {string} [params.hueMode] Hue interpolation mode. Can be 'direct' | 'shortest' | 'longest'
295
290
  * @returns {ColorHsl} Interpolated HSL color
@@ -304,7 +299,7 @@ export default class Color {
304
299
  * @param {number} t Normalized time value to interpolate
305
300
  * @param {ColorHsb} hsb1 Start color
306
301
  * @param {ColorHsb} hsb2 End color
307
- * @param {object} [params] Interpolation parameters
302
+ * @param {Object} [params] Interpolation parameters
308
303
  * @param {number|number[]} [params.power=1] Interpolation exponent(s) : [h, s, b]
309
304
  * @param {string} [params.hueMode] Hue interpolation mode. Can be 'direct' | 'shortest' | 'longest'
310
305
  * @returns {ColorHsb} Interpolated HSB color
@@ -329,7 +324,7 @@ export default class Color {
329
324
  * @param {number} t Normalized time value to interpolate
330
325
  * @param {ColorHcl} hcl1 Start color
331
326
  * @param {ColorHcl} hcl2 End color
332
- * @param {object} [params] Interpolation parameters
327
+ * @param {Object} [params] Interpolation parameters
333
328
  * @param {string} [params.hueMode] Hue interpolation mode. Can be 'direct' | 'shortest' | 'longest'
334
329
  * @returns {ColorHcl} Interpolated HCL color
335
330
  */
@@ -352,7 +347,7 @@ export default class Color {
352
347
  * @param {number} t Normalized time value to interpolate
353
348
  * @param {ColorHcl} hcl1 Start color
354
349
  * @param {ColorHcl} hcl2 End color
355
- * @param {object} [params] Interpolation parameters
350
+ * @param {Object} [params] Interpolation parameters
356
351
  * @param {number|number[]} [params.power=1] Interpolation exponent(s) : [c, l]
357
352
  * @param {string} [params.hueMode] Hue interpolation mode. Can be 'direct' | 'shortest' | 'longest'
358
353
  * @param {number} [params.chromaMax] Maximum chroma value
@@ -378,7 +373,7 @@ export default class Color {
378
373
  * @param {number} t Normalized time value to interpolate
379
374
  * @param {ColorHcl} hcl1 Start color
380
375
  * @param {ColorHcl} hcl2 End color
381
- * @param {object} [params] Interpolation parameters
376
+ * @param {Object} [params] Interpolation parameters
382
377
  * @param {number|number[]} [params.power=1] Interpolation exponent(s) : ([c, l])
383
378
  * @returns {ColorHcl} Interpolated HCL color
384
379
  */
@@ -64,7 +64,6 @@ export default class Color {
64
64
  }
65
65
  /**
66
66
  * Set this color values from a given RGB color
67
- *
68
67
  * Note:
69
68
  * - RGB values are contained in the interval [0, 1]
70
69
  *
@@ -89,7 +88,6 @@ export default class Color {
89
88
  }
90
89
  /**
91
90
  * Set this color values from a given HSL color
92
- *
93
91
  * Note:
94
92
  * - HSL values are contained in the intervals:
95
93
  * - Hue: [0, 360]
@@ -108,7 +106,6 @@ export default class Color {
108
106
  }
109
107
  /**
110
108
  * Set this color values from a given HSB color
111
- *
112
109
  * Note:
113
110
  * - HSB values are contained in the intervals:
114
111
  * - Hue: [0, 360]
@@ -124,7 +121,6 @@ export default class Color {
124
121
  }
125
122
  /**
126
123
  * Set this color values from a given L*a*b* color
127
- *
128
124
  * Note:
129
125
  * - L*a*b* values are contained in the intervals:
130
126
  * - Lightness: [0 à 100]
@@ -140,7 +136,6 @@ export default class Color {
140
136
  }
141
137
  /**
142
138
  * Set this color values from a given HCL color
143
- *
144
139
  * Note:
145
140
  * - HCL values are contained in the intervals:
146
141
  * - Hue: [0, 360]
@@ -172,7 +167,7 @@ export default class Color {
172
167
  *
173
168
  * @param {number} t Normalized time value to interpolate
174
169
  * @param {ColorRgb} rgb RGB values to interpolate towards
175
- * @param {object} [params] Interpolation parameters
170
+ * @param {Object} [params] Interpolation parameters
176
171
  * @param {number} [params.power] Interpolation exponent
177
172
  * @returns {this}
178
173
  */
@@ -184,7 +179,7 @@ export default class Color {
184
179
  *
185
180
  * @param {number} t Normalized time value to interpolate
186
181
  * @param {ColorHsl} hsl HSL values to interpolate towards
187
- * @param {object} [params] Interpolation parameters
182
+ * @param {Object} [params] Interpolation parameters
188
183
  * @param {number|number[]} [params.power] Interpolation exponent(s) : [h, s, l]
189
184
  * @param {string} [params.hueMode] Hue interpolation mode. Can be 'direct' | 'shortest' | 'longest'
190
185
  * @returns {this}
@@ -197,7 +192,7 @@ export default class Color {
197
192
  *
198
193
  * @param {number} t Normalized time value to interpolate
199
194
  * @param {ColorHsb} hsb HSB values to interpolate towards
200
- * @param {object} [params] Interpolation parameters
195
+ * @param {Object} [params] Interpolation parameters
201
196
  * @param {number|number[]} [params.power] Interpolation exponent(s) : [h, s, b]
202
197
  * @param {string} [params.hueMode] Hue interpolation mode. Can be 'direct' | 'shortest' | 'longest'
203
198
  * @returns {this}
@@ -210,7 +205,7 @@ export default class Color {
210
205
  *
211
206
  * @param {number} t Normalized time value to interpolate
212
207
  * @param {ColorHcl} hcl HCL values to interpolate towards
213
- * @param {object} [params] Interpolation parameters
208
+ * @param {Object} [params] Interpolation parameters
214
209
  * @param {string} [params.hueMode] Hue interpolation mode. Can be 'direct' | 'shortest' | 'longest'
215
210
  * @returns {this}
216
211
  */
@@ -222,7 +217,7 @@ export default class Color {
222
217
  *
223
218
  * @param {number} t Normalized time value to interpolate
224
219
  * @param {ColorHcl} hcl HCL values to interpolate towards
225
- * @param {object} [params] Interpolation parameters
220
+ * @param {Object} [params] Interpolation parameters
226
221
  * @param {number|number[]} [params.power] Interpolation exponent(s) : [c, l]
227
222
  * @param {string} [params.hueMode] Hue interpolation mode. Can be 'direct' | 'shortest' | 'longest'
228
223
  * @param {number} [params.chromaMax] Maximum chroma value
@@ -236,7 +231,7 @@ export default class Color {
236
231
  *
237
232
  * @param {number} t Normalized time value to interpolate
238
233
  * @param {ColorHcl} hcl HCL values to interpolate towards
239
- * @param {object} [params] Interpolation parameters
234
+ * @param {Object} [params] Interpolation parameters
240
235
  * @param {number|number[]} [params.power] Interpolation exponent(s) : ([c, l])
241
236
  * @returns {this}
242
237
  */
@@ -365,7 +360,7 @@ export default class Color {
365
360
  * @param {number} t Normalized time value to interpolate
366
361
  * @param {Color|ColorRgb} rgb1 Start color
367
362
  * @param {Color|ColorRgb} rgb2 End color
368
- * @param {object} [params] Interpolation parameters
363
+ * @param {Object} [params] Interpolation parameters
369
364
  * @param {number} [params.power=1] Interpolation exponent
370
365
  * @returns {ColorRgb} Interpolated RGB color
371
366
  */
@@ -382,7 +377,7 @@ export default class Color {
382
377
  * @param {number} t Normalized time value to interpolate
383
378
  * @param {ColorHsl} hsl1 Start color
384
379
  * @param {ColorHsl} hsl2 End color
385
- * @param {object} [params] Interpolation parameters
380
+ * @param {Object} [params] Interpolation parameters
386
381
  * @param {number|number[]} [params.power=1] Interpolation exponent(s) : [h, s, l]
387
382
  * @param {string} [params.hueMode] Hue interpolation mode. Can be 'direct' | 'shortest' | 'longest'
388
383
  * @returns {ColorHsl} Interpolated HSL color
@@ -405,7 +400,7 @@ export default class Color {
405
400
  * @param {number} t Normalized time value to interpolate
406
401
  * @param {ColorHsb} hsb1 Start color
407
402
  * @param {ColorHsb} hsb2 End color
408
- * @param {object} [params] Interpolation parameters
403
+ * @param {Object} [params] Interpolation parameters
409
404
  * @param {number|number[]} [params.power=1] Interpolation exponent(s) : [h, s, b]
410
405
  * @param {string} [params.hueMode] Hue interpolation mode. Can be 'direct' | 'shortest' | 'longest'
411
406
  * @returns {ColorHsb} Interpolated HSB color
@@ -438,7 +433,7 @@ export default class Color {
438
433
  * @param {number} t Normalized time value to interpolate
439
434
  * @param {ColorHcl} hcl1 Start color
440
435
  * @param {ColorHcl} hcl2 End color
441
- * @param {object} [params] Interpolation parameters
436
+ * @param {Object} [params] Interpolation parameters
442
437
  * @param {string} [params.hueMode] Hue interpolation mode. Can be 'direct' | 'shortest' | 'longest'
443
438
  * @returns {ColorHcl} Interpolated HCL color
444
439
  */
@@ -464,7 +459,7 @@ export default class Color {
464
459
  * @param {number} t Normalized time value to interpolate
465
460
  * @param {ColorHcl} hcl1 Start color
466
461
  * @param {ColorHcl} hcl2 End color
467
- * @param {object} [params] Interpolation parameters
462
+ * @param {Object} [params] Interpolation parameters
468
463
  * @param {number|number[]} [params.power=1] Interpolation exponent(s) : [c, l]
469
464
  * @param {string} [params.hueMode] Hue interpolation mode. Can be 'direct' | 'shortest' | 'longest'
470
465
  * @param {number} [params.chromaMax] Maximum chroma value
@@ -495,7 +490,7 @@ export default class Color {
495
490
  * @param {number} t Normalized time value to interpolate
496
491
  * @param {ColorHcl} hcl1 Start color
497
492
  * @param {ColorHcl} hcl2 End color
498
- * @param {object} [params] Interpolation parameters
493
+ * @param {Object} [params] Interpolation parameters
499
494
  * @param {number|number[]} [params.power=1] Interpolation exponent(s) : ([c, l])
500
495
  * @returns {ColorHcl} Interpolated HCL color
501
496
  */
@@ -65,8 +65,7 @@ export default class Path extends Curve {
65
65
  getPoints(divisions = 40) {
66
66
  const points = [];
67
67
  let lastPoint = null;
68
- for (let i = 0; i < this.curves.length; i++) {
69
- const curve = this.curves[i];
68
+ for (const curve of this.curves) {
70
69
  let resolution = divisions;
71
70
  if (curve instanceof LineCurve || curve instanceof LineCurve3) {
72
71
  resolution = 1;
@@ -80,9 +79,7 @@ export default class Path extends Curve {
80
79
  else if (curve instanceof EllipseCurve) {
81
80
  resolution *= 2;
82
81
  }
83
- const pts = this.curves[i].getPoints(resolution);
84
- for (let j = 0; j < pts.length; j++) {
85
- const point = pts[j];
82
+ for (const point of curve.getPoints(resolution)) {
86
83
  if (point?.equals(lastPoint))
87
84
  continue;
88
85
  points.push(point);
@@ -132,8 +129,8 @@ export default class Path extends Curve {
132
129
  }
133
130
  const lengths = [];
134
131
  let sums = 0;
135
- for (let i = 0, j = this.curves.length; i < j; i++) {
136
- sums += this.curves[i].getLength();
132
+ for (const curve of this.curves) {
133
+ sums += curve.getLength();
137
134
  lengths.push(sums);
138
135
  }
139
136
  this._cacheArcLengths = lengths;
@@ -113,7 +113,7 @@ export default class PathContext extends Path<Vector2> implements CanvasRenderin
113
113
  * @param {number} cy Y-axis coordinate of the center of the circle
114
114
  * @param {number} rx X-radius of the ellipse
115
115
  * @param {number} ry Y-radius of the ellipse
116
- * @param {number} rotation Rotation angle of the ellipse (in radians), counterclockwise from the positive X-axis
116
+ * @param {number} rotation Rotation angle of the ellipse (in radians), counterclockwise from the positive X-axis
117
117
  * @param {number} startAngle Start angle of the arc (in radians)
118
118
  * @param {number} endAngle End angle of the arc (in radians)
119
119
  * @param {boolean} [counterclockwise] Flag indicating the direction of the arc
@@ -149,9 +149,9 @@ export default class PathContext extends Path<Vector2> implements CanvasRenderin
149
149
  * Draw a rectangular path from the start position specified by `x` and `y` to the end position using `width` and `height`
150
150
  * Add an instance of {@link PolylineCurve} to this path
151
151
  *
152
- * @param {number} x X-axis coordinate of the rectangle starting point
153
- * @param {number} y Y-axis coordinate of the rectangle starting point
154
- * @param {number} width Rectangle width (Positive values are to the right and negative to the left)
152
+ * @param {number} x X-axis coordinate of the rectangle starting point
153
+ * @param {number} y Y-axis coordinate of the rectangle starting point
154
+ * @param {number} width Rectangle width (Positive values are to the right and negative to the left)
155
155
  * @param {number} height Rectangle height (Positive values are down, and negative are up)
156
156
  * @return {this}
157
157
  */
@@ -160,9 +160,9 @@ export default class PathContext extends Path<Vector2> implements CanvasRenderin
160
160
  * Draw a rounded rectangular path from the start position specified by `x` and `y` to the end position using `width` and `height`
161
161
  * Add an instance of {@link Path} to this path
162
162
  *
163
- * @param {number} x X-axis coordinate of the rectangle starting point
164
- * @param {number} y Y-axis coordinate of the rectangle starting point
165
- * @param {number} width Rectangle width (Positive values are to the right and negative to the left)
163
+ * @param {number} x X-axis coordinate of the rectangle starting point
164
+ * @param {number} y Y-axis coordinate of the rectangle starting point
165
+ * @param {number} width Rectangle width (Positive values are to the right and negative to the left)
166
166
  * @param {number} height Rectangle height (Positive values are down, and negative are up)
167
167
  * @param {number|number[]} radius Radius of the circular arc to be used for the corners of the rectangle
168
168
  * @return {this}
@@ -206,7 +206,6 @@ export default class PathContext extends Path<Vector2> implements CanvasRenderin
206
206
  getLineDash: CanvasRenderingContext2D['getLineDash'];
207
207
  fillText: CanvasRenderingContext2D['fillText'];
208
208
  strokeText: CanvasRenderingContext2D['strokeText'];
209
- miterLimit: CanvasRenderingContext2D['miterLimit'];
210
209
  fill: CanvasRenderingContext2D['fill'];
211
210
  stroke: CanvasRenderingContext2D['stroke'];
212
211
  clearRect: CanvasRenderingContext2D['clearRect'];
@@ -215,6 +214,7 @@ export default class PathContext extends Path<Vector2> implements CanvasRenderin
215
214
  drawImage: CanvasRenderingContext2D['drawImage'];
216
215
  clip: CanvasRenderingContext2D['clip'];
217
216
  filter: CanvasRenderingContext2D['filter'];
217
+ miterLimit: CanvasRenderingContext2D['miterLimit'];
218
218
  globalAlpha: CanvasRenderingContext2D['globalAlpha'];
219
219
  globalCompositeOperation: CanvasRenderingContext2D['globalCompositeOperation'];
220
220
  createLinearGradient: CanvasRenderingContext2D['createLinearGradient'];
@@ -28,8 +28,8 @@ export default class PathContext extends Path {
28
28
  */
29
29
  setFromPoints(points) {
30
30
  this.moveTo(...points[0]);
31
- for (let i = 1, l = points.length; i < l; i++) {
32
- this.lineTo(...points[i]);
31
+ for (const point of points) {
32
+ this.lineTo(...point);
33
33
  }
34
34
  return this;
35
35
  }
@@ -192,7 +192,7 @@ export default class PathContext extends Path {
192
192
  * @param {number} cy Y-axis coordinate of the center of the circle
193
193
  * @param {number} rx X-radius of the ellipse
194
194
  * @param {number} ry Y-radius of the ellipse
195
- * @param {number} rotation Rotation angle of the ellipse (in radians), counterclockwise from the positive X-axis
195
+ * @param {number} rotation Rotation angle of the ellipse (in radians), counterclockwise from the positive X-axis
196
196
  * @param {number} startAngle Start angle of the arc (in radians)
197
197
  * @param {number} endAngle End angle of the arc (in radians)
198
198
  * @param {boolean} [counterclockwise] Flag indicating the direction of the arc
@@ -303,9 +303,9 @@ export default class PathContext extends Path {
303
303
  * Draw a rectangular path from the start position specified by `x` and `y` to the end position using `width` and `height`
304
304
  * Add an instance of {@link PolylineCurve} to this path
305
305
  *
306
- * @param {number} x X-axis coordinate of the rectangle starting point
307
- * @param {number} y Y-axis coordinate of the rectangle starting point
308
- * @param {number} width Rectangle width (Positive values are to the right and negative to the left)
306
+ * @param {number} x X-axis coordinate of the rectangle starting point
307
+ * @param {number} y Y-axis coordinate of the rectangle starting point
308
+ * @param {number} width Rectangle width (Positive values are to the right and negative to the left)
309
309
  * @param {number} height Rectangle height (Positive values are down, and negative are up)
310
310
  * @return {this}
311
311
  */
@@ -324,9 +324,9 @@ export default class PathContext extends Path {
324
324
  * Draw a rounded rectangular path from the start position specified by `x` and `y` to the end position using `width` and `height`
325
325
  * Add an instance of {@link Path} to this path
326
326
  *
327
- * @param {number} x X-axis coordinate of the rectangle starting point
328
- * @param {number} y Y-axis coordinate of the rectangle starting point
329
- * @param {number} width Rectangle width (Positive values are to the right and negative to the left)
327
+ * @param {number} x X-axis coordinate of the rectangle starting point
328
+ * @param {number} y Y-axis coordinate of the rectangle starting point
329
+ * @param {number} width Rectangle width (Positive values are to the right and negative to the left)
330
330
  * @param {number} height Rectangle height (Positive values are down, and negative are up)
331
331
  * @param {number|number[]} radius Radius of the circular arc to be used for the corners of the rectangle
332
332
  * @return {this}
@@ -509,7 +509,6 @@ export default class PathContext extends Path {
509
509
  getLineDash;
510
510
  fillText;
511
511
  strokeText;
512
- miterLimit;
513
512
  fill;
514
513
  stroke;
515
514
  clearRect;
@@ -518,6 +517,7 @@ export default class PathContext extends Path {
518
517
  drawImage;
519
518
  clip;
520
519
  filter;
520
+ miterLimit;
521
521
  globalAlpha;
522
522
  globalCompositeOperation;
523
523
  createLinearGradient;