mirror of
https://github.com/FlipsideCrypto/DefinitelyTyped.git
synced 2026-02-06 10:56:53 +00:00
[react-imgpro] initial definitions (#28739)
* react-imgpro: initial definitions * react-imgpro: remove extra rules of tslint.json * react-imgpro: format
This commit is contained in:
parent
e174f81551
commit
1b0e18e131
88
types/react-imgpro/index.d.ts
vendored
Normal file
88
types/react-imgpro/index.d.ts
vendored
Normal file
@ -0,0 +1,88 @@
|
||||
// Type definitions for react-imgpro 1.3
|
||||
// Project: https://github.com/nitin42/react-imgpro
|
||||
// Definitions by: Carlos Li <https://github.com/echoulen>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.8
|
||||
|
||||
import * as React from "react";
|
||||
|
||||
import ProcessImage = ReactImgpro.ProcessImage;
|
||||
export default ProcessImage;
|
||||
|
||||
declare namespace ReactImgpro {
|
||||
type Mode = "neighbor" | "bilinear" | "bicubic" | "hermite" | "bezier";
|
||||
interface Shape {
|
||||
width?: number;
|
||||
height?: number;
|
||||
mode?: Mode;
|
||||
}
|
||||
interface Size {
|
||||
width: number;
|
||||
height: number;
|
||||
mode:
|
||||
"horizontal_left" |
|
||||
"horizontal_center" |
|
||||
"horizontal_right" |
|
||||
"vertical_top" |
|
||||
"vertical_bottom" |
|
||||
"vertical_middle";
|
||||
}
|
||||
interface ProcessImageProps {
|
||||
image: string;
|
||||
resize?: Shape;
|
||||
quality?: number;
|
||||
greyscale?: boolean;
|
||||
normalize?: boolean;
|
||||
invert?: boolean;
|
||||
opaque?: boolean;
|
||||
sepia?: boolean;
|
||||
dither565?: boolean;
|
||||
scale?: boolean;
|
||||
scaleToFitImage?: {
|
||||
width: number;
|
||||
height: number;
|
||||
};
|
||||
flip?: {
|
||||
horizontal?: boolean;
|
||||
vertical?: boolean;
|
||||
};
|
||||
rotate?: {
|
||||
degree: number;
|
||||
mode: Mode;
|
||||
};
|
||||
brightness?: number; /* should be -1 to 1 */
|
||||
contrast?: number; /* should be -1 to 1 */
|
||||
fade?: number; /* should be 0 - 1 */
|
||||
opacity?: number; /* should be 0 - 1 */
|
||||
blur?: number; /* should be 0 - 100 */
|
||||
posterize?: number; /* should be 0 - 100 */
|
||||
cover?: Size;
|
||||
contain?: Size;
|
||||
colors?: {
|
||||
lighten?: number;
|
||||
brighten?: number;
|
||||
darken?: number;
|
||||
desaturate?: number;
|
||||
saturate?: number;
|
||||
greyscale?: number;
|
||||
spin?: number;
|
||||
mix?: {
|
||||
color?: string;
|
||||
amount?: number;
|
||||
},
|
||||
tint?: number;
|
||||
xor?: number;
|
||||
shade?: number;
|
||||
red?: number;
|
||||
green?: number;
|
||||
blue?: number;
|
||||
};
|
||||
storage?: boolean;
|
||||
disableWebWorker?: boolean;
|
||||
disableRerender?: boolean;
|
||||
customCdn?: string;
|
||||
onProcessFinish: () => void;
|
||||
}
|
||||
|
||||
class ProcessImage extends React.Component<ProcessImageProps> {}
|
||||
}
|
||||
25
types/react-imgpro/react-imgpro-tests.tsx
Normal file
25
types/react-imgpro/react-imgpro-tests.tsx
Normal file
@ -0,0 +1,25 @@
|
||||
import * as React from 'react';
|
||||
import ProcessImage from "react-imgpro";
|
||||
|
||||
class Test extends React.Component<any> {
|
||||
render() {
|
||||
return (
|
||||
<ProcessImage
|
||||
image="http://test-img.com"
|
||||
contain={{
|
||||
width: 500,
|
||||
height: 200,
|
||||
mode: "horizontal_right",
|
||||
}}
|
||||
customCdn="http://test.cdn"
|
||||
storage={true}
|
||||
scale={false}
|
||||
onProcessFinish={() => console.log("onProcessFinish")}
|
||||
>
|
||||
<div className="one"/>
|
||||
<div className="two"/>
|
||||
<div className="three"/>
|
||||
</ProcessImage>
|
||||
);
|
||||
}
|
||||
}
|
||||
25
types/react-imgpro/tsconfig.json
Normal file
25
types/react-imgpro/tsconfig.json
Normal file
@ -0,0 +1,25 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6",
|
||||
"dom"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"jsx": "react",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"react-imgpro-tests.tsx"
|
||||
]
|
||||
}
|
||||
3
types/react-imgpro/tslint.json
Normal file
3
types/react-imgpro/tslint.json
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json"
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user