-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update common/utils and common/primitives to v10.277
- Loading branch information
1 parent
2a4ce09
commit c7be8c2
Showing
14 changed files
with
377 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,3 +5,4 @@ import './number.mjs'; | |
import './regex.mjs'; | ||
import './set.mjs'; | ||
import './string.mjs'; | ||
import './url.mjs'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// Non-functional due to upstream | ||
// https://github.com/microsoft/TypeScript-DOM-lib-generator/pull/1379 | ||
// declare const URL: { | ||
// prototype: URL; | ||
// new (url: string | URL, base?: string | URL): URL; | ||
// createObjectURL(obj: Blob | MediaSource): string; | ||
// revokeObjectURL(url: string): void; | ||
|
||
// /** | ||
// * Attempt to parse a URL without throwing an error. | ||
// * @param url - The string to parse. | ||
// * @returns The parsed URL if successful, otherwise null. | ||
// */ | ||
// parseSafe(url: string): URL | null; | ||
// }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,152 @@ | ||
type RGBColorVector = [r: number, g: number, b: number]; | ||
type HSVColorVector = [h: number, s: number, v: number]; | ||
|
||
/** | ||
* A representation of a color in hexadecimal format. | ||
* This class provides methods for transformations and manipulations of colors. | ||
*/ | ||
//@ts-expect-error 2417: Override of Color.fromString does not match Number.fromString | ||
export default class Color extends Number { | ||
/** | ||
* A CSS-compatible color string. | ||
* An alias for Color#toString. | ||
*/ | ||
get css(): string; | ||
|
||
/** | ||
* The color represented as an RGB array. | ||
*/ | ||
get rgb(): RGBColorVector; | ||
|
||
/** | ||
* The numeric value of the red channel between [0, 1]. | ||
*/ | ||
get r(): number; | ||
|
||
/** | ||
* The numeric value of the green channel between [0, 1]. | ||
*/ | ||
get g(): number; | ||
|
||
/** | ||
* The numeric value of the blue channel between [0, 1]. | ||
*/ | ||
get b(): number; | ||
|
||
/** | ||
* The maximum value of all channels. | ||
*/ | ||
get maximum(): number; | ||
|
||
/** | ||
* The minimum value of all channels. | ||
*/ | ||
get minimum(): number; | ||
|
||
/** | ||
* Get the value of this color in little endian format. | ||
*/ | ||
get littleEndian(): number; | ||
|
||
/** | ||
* The color represented as an HSV array. | ||
* Conversion formula adapted from http://en.wikipedia.org/wiki/HSV_color_space. | ||
* Assumes r, g, and b are contained in the set [0, 1] and returns h, s, and v in the set [0, 1]. | ||
*/ | ||
get hsv(): HSVColorVector; | ||
|
||
/** @override */ | ||
toString(): string; | ||
|
||
/** | ||
* Test whether this color equals some other color | ||
* @param other - Some other color or hex number | ||
* @returns Are the colors equal? | ||
*/ | ||
equals(other: Color | number): string; | ||
|
||
/** | ||
* Get a CSS-compatible RGBA color string. | ||
* @param alpha - The desired alpha in the range [0, 1] | ||
* @returns A CSS-compatible RGBA string | ||
*/ | ||
toRGBA(alpha: number): string; | ||
|
||
/** | ||
* Mix this Color with some other Color using a provided interpolation weight. | ||
* @param other - Some other Color to mix with | ||
* @param weight - The mixing weight placed on this color where weight is placed on the other color | ||
* @returns The resulting mixed Color | ||
*/ | ||
mix(other: Color, weight: number): Color; | ||
|
||
/** | ||
* Multiply this Color by another Color or a static scalar. | ||
* @param other - Some other Color or a static scalar. | ||
* @returns The resulting Color. | ||
*/ | ||
multiply(other: Color | number): Color; | ||
|
||
/** | ||
* Add this Color by another Color or a static scalar. | ||
* @param other - Some other Color or a static scalar. | ||
* @returns The resulting Color. | ||
*/ | ||
add(other: Color | number): Color; | ||
|
||
/** | ||
* Subtract this Color by another Color or a static scalar. | ||
* @param other - Some other Color or a static scalar. | ||
* @returns The resulting Color. | ||
*/ | ||
subtract(other: Color | number): Color; | ||
|
||
/** | ||
* Max this color by another Color or a static scalar. | ||
* @param other - Some other Color or a static scalar. | ||
* @returns The resulting Color. | ||
*/ | ||
maximize(other: Color | number): Color; | ||
|
||
/** | ||
* Min this color by another Color or a static scalar. | ||
* @param other - Some other Color or a static scalar. | ||
* @returns The resulting Color. | ||
*/ | ||
minimize(other: Color | number): Color; | ||
|
||
/** | ||
* Iterating over a Color is equivalent to iterating over its [r,g,b] color channels. | ||
*/ | ||
[Symbol.iterator](): Generator<number>; | ||
|
||
/** | ||
* Create a Color instance from an RGB array. | ||
* @param color - A color input | ||
* @returns The hex color instance or NaN | ||
*/ | ||
static from(color: null | string | number | RGBColorVector | Color): Color | typeof NaN; | ||
|
||
/** | ||
* Create a Color instance from a color string which either includes or does not include a leading #. | ||
* @param color - A color string | ||
* @returns The hex color instance | ||
*/ | ||
static fromString(color: string): Color; | ||
|
||
/** | ||
* Create a Color instance from an RGB array. | ||
* @param rgb - An RGB tuple | ||
* @returns The hex color instance | ||
*/ | ||
static fromRGB(rgb: RGBColorVector): Color; | ||
|
||
/** | ||
* Create a Color instance from an HSV array. | ||
* Conversion formula adapted from http://en.wikipedia.org/wiki/HSV_color_space. | ||
* Assumes h, s, and v are contained in the set [0, 1]. | ||
* @param hsv - An HSV tuple | ||
* @returns The hex color instance | ||
*/ | ||
static fromHSV(hsv: HSVColorVector): Color; | ||
} |
Oops, something went wrong.