Skip to content

Commit

Permalink
Update d.ts, version 0.4.1
Browse files Browse the repository at this point in the history
  • Loading branch information
mistic100 committed Sep 3, 2018
1 parent dd32237 commit 7e8f790
Show file tree
Hide file tree
Showing 4 changed files with 123 additions and 115 deletions.
3 changes: 2 additions & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "tinygradient",
"version": "0.4.0",
"version": "0.4.1",
"author": {
"name": "Damien \"Mistic\" Sorel",
"email": "contact@git.strangeplanet.fr",
Expand Down Expand Up @@ -34,6 +34,7 @@
"url": "https://github.com/mistic100/tinygradient/issues"
},
"scripts": {
"build": "grunt",
"test": "grunt test"
}
}
231 changes: 119 additions & 112 deletions tinygradient.d.ts
@@ -1,119 +1,126 @@
/*!
* TinyGradient 0.4.0
* TinyGradient 0.4.1
* Copyright 2014-2018 Damien "Mistic" Sorel (http://www.strangeplanet.fr)
* Licensed under MIT (http://opensource.org/licenses/MIT)
*/

declare var tinygradient: tinygradient;

type ArcMode = boolean | 'short' | 'long';

interface TinyGradient {

/**
* Return new instance with reversed stops
* @return {tinygradient}
*/
reverse(): tinygradient;

/**
* Generate gradient with RGBa interpolation
* @param {int} steps
* @return {tinycolorInstance[]}
*/
rgb(steps: number): tinycolorInstance[];

/**
* Generate gradient with HSVa interpolation
* @param {int} steps
* @param {Boolean|String} [mode=false]
* - false to step in clockwise
* - true to step in trigonometric order
* - 'short' to use the shortest way
* - 'long' to use the longest way
* @return {tinycolorInstance[]}
*/
hsv(steps: number, mode: ArcMode): tinycolorInstance[];

/**
* Generate CSS3 command (no prefix) for this gradient
* @param {String} [mode=linear] - 'linear' or 'radial'
* @param {String} [direction] - default is 'to right' or 'ellipse at center'
* @return {String}
*/
css(mode?: 'linear' | 'radial', direction?: string): string;

/**
* Returns the color at specific position with RGBa interpolation
* @param {float} pos, between 0 and 1
* @return {tinycolorInstance}
*/
rgbAt(pos: number): tinycolorInstance;

/**
* Returns the color at specific position with HSVa interpolation
* @param {float} pos, between 0 and 1
* @return {tinycolorInstance}
*/
hsvAt(pos: number): tinycolorInstance;

}

interface tinygradient {
/**
* @class tinygradient
* @param {ColorInput[]} stops
*/
(stops: ColorInput[]): TinyGradient;

/**
* Generate gradient with RGBa interpolation
* @param {ColorInput[]} stops
* @param {int} steps
* @return {tinycolorInstance[]}
*/
rgb(stops: ColorInput[], steps: number): tinycolorInstance[];

/**
* Generate gradient with HSVa interpolation
* @param {ColorInput[]} stops
* @param {int} steps
* @param {Boolean|String} [mode=false]
* - false to step in clockwise
* - true to step in trigonometric order
* - 'short' to use the shortest way
* - 'long' to use the longest way
* @return {tinycolorInstance[]}
*/
hsv(stops: ColorInput[], steps: number, mode: ArcMode): tinycolorInstance[];

/**
* Generate CSS3 command (no prefix) for this gradient
* @param {ColorInput[]} stops
* @param {String} [mode=linear] - 'linear' or 'radial'
* @param {String} [direction] - default is 'to right' or 'ellipse at center'
* @return {String}
*/
css(stops: ColorInput[], mode?: 'linear' | 'radial', direction?: string): string;

/**
* Returns the color at specific position with RGBa interpolation
* @param {ColorInput[]} stops
* @param {float} pos, between 0 and 1
* @return {tinycolorInstance}
*/
rgbAt(stops: ColorInput[], pos: number): tinycolorInstance;

/**
* Returns the color at specific position with HSVa interpolation
* @param {ColorInput[]} stops
* @param {float} pos, between 0 and 1
* @return {tinycolorInstance}
*/
hsvAt(stops: ColorInput[], pos: number): tinycolorInstance;
import * as tinycolor from 'tinycolor2';

declare namespace tinygradient {

type ArcMode = boolean | 'short' | 'long';

type CssMode = 'linear' | 'radial';

interface Instance {

/**
* Return new instance with reversed stops
* @return {Instance}
*/
reverse(): Instance;

/**
* Generate gradient with RGBa interpolation
* @param {int} steps
* @return {tinycolor.Instance[]}
*/
rgb(steps: number): tinycolor.Instance[];

/**
* Generate gradient with HSVa interpolation
* @param {int} steps
* @param {ArcMode} [mode=false]
* - false to step in clockwise
* - true to step in trigonometric order
* - 'short' to use the shortest way
* - 'long' to use the longest way
* @return {tinycolor.Instance[]}
*/
hsv(steps: number, mode: ArcMode): tinycolor.Instance[];

/**
* Generate CSS3 command (no prefix) for this gradient
* @param {CssMode} [mode=linear] - 'linear' or 'radial'
* @param {String} [direction] - default is 'to right' or 'ellipse at center'
* @return {String}
*/
css(mode?: CssMode, direction?: string): string;

/**
* Returns the color at specific position with RGBa interpolation
* @param {double} pos, between 0 and 1
* @return {tinycolor.Instance}
*/
rgbAt(pos: number): tinycolor.Instance;

/**
* Returns the color at specific position with HSVa interpolation
* @param {float} pos, between 0 and 1
* @return {tinycolor.Instance}
*/
hsvAt(pos: number): tinycolor.Instance;

}

interface Constructor {
/**
* @class tinygradient
* @param {tinycolor.ColorInput[]} stops
*/
new (stops: tinycolor.ColorInput[]): Instance;
new (...stops: tinycolor.ColorInput[]): Instance;
(stops: tinycolor.ColorInput[]): Instance;
(...stops: tinycolor.ColorInput[]): Instance;

/**
* Generate gradient with RGBa interpolation
* @param {tinycolor.ColorInput[]} stops
* @param {int} steps
* @return {tinycolor.Instance[]}
*/
rgb(stops: tinycolor.ColorInput[], steps: number): tinycolor.Instance[];

/**
* Generate gradient with HSVa interpolation
* @param {tinycolor.ColorInput[]} stops
* @param {int} steps
* @param {ArcMode} [mode=false]
* - false to step in clockwise
* - true to step in trigonometric order
* - 'short' to use the shortest way
* - 'long' to use the longest way
* @return {tinycolor.Instance[]}
*/
hsv(stops: tinycolor.ColorInput[], steps: number, mode: ArcMode): tinycolor.Instance[];

/**
* Generate CSS3 command (no prefix) for this gradient
* @param {tinycolor.ColorInput[]} stops
* @param {CssMode} [mode=linear] - 'linear' or 'radial'
* @param {String} [direction] - default is 'to right' or 'ellipse at center'
* @return {String}
*/
css(stops: tinycolor.ColorInput[], mode?: CssMode, direction?: string): string;

/**
* Returns the color at specific position with RGBa interpolation
* @param {tinycolor.ColorInput[]} stops
* @param {float} pos, between 0 and 1
* @return {tinycolor.Instance}
*/
rgbAt(stops: tinycolor.ColorInput[], pos: number): tinycolor.Instance;

/**
* Returns the color at specific position with HSVa interpolation
* @param {tinycolor.ColorInput[]} stops
* @param {float} pos, between 0 and 1
* @return {tinycolor.Instance}
*/
hsvAt(stops: tinycolor.ColorInput[], pos: number): tinycolor.Instance;
}
}

// export default tinygradient;
declare module 'tinygradient' {
export = tinygradient;
}
declare const tinygradient: tinygradient.Constructor;
export = tinygradient;
export as namespace tinygradient;
2 changes: 1 addition & 1 deletion tinygradient.js
@@ -1,5 +1,5 @@
/*!
* TinyGradient 0.4.0
* TinyGradient 0.4.1
* Copyright 2014-2018 Damien "Mistic" Sorel (http://www.strangeplanet.fr)
* Licensed under MIT (http://opensource.org/licenses/MIT)
*/
Expand Down
2 changes: 1 addition & 1 deletion tinygradient.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 7e8f790

Please sign in to comment.