mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-23 12:56:46 +08:00
Initial React v0.14 definitions
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
# React v0.13.3 Type Definitions
|
||||
# React v0.14 Type Definitions
|
||||
|
||||
This folder contains the following `.d.ts` files:
|
||||
* `react.d.ts` declares the module `"react"` and `"react/addons"`
|
||||
* `react-global.d.ts` declares the global namespace `React` (only include this if you are actually using the global `React`)
|
||||
If you are using modules you should use `react.d.ts`, `react-dom.d.ts` and any of the `react-addon-*.d.ts` definition files.
|
||||
|
||||
If you are using the global `React` variable, you should use `react-global.d.ts`.
|
||||
|
||||
18
react/react-addons-clone-with-props.d.ts
vendored
Normal file
18
react/react-addons-clone-with-props.d.ts
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
// Type definitions for React v0.14 (react-addons-clone-with-props)
|
||||
// Project: http://facebook.github.io/react/
|
||||
// Definitions by: Asana <https://asana.com>, AssureSign <http://www.assuresign.com>, Microsoft <https://microsoft.com>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="react.d.ts" />
|
||||
|
||||
declare namespace __React {
|
||||
namespace __Addons {
|
||||
export function cloneWithProps<P>(element: __React.DOMElement<P>, props: P): __React.DOMElement<P>;
|
||||
export function cloneWithProps<P>(element: __React.ClassicElement<P>, props: P): __React.ClassicElement<P>;
|
||||
export function cloneWithProps<P>(element: __React.ReactElement<P>, props: P): __React.ReactElement<P>;
|
||||
}
|
||||
}
|
||||
|
||||
declare module "react-addons-clone-with-props" {
|
||||
export = __React.__Addons.cloneWithProps;
|
||||
}
|
||||
16
react/react-addons-create-fragment.d.ts
vendored
Normal file
16
react/react-addons-create-fragment.d.ts
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
// Type definitions for React v0.14 (react-addons-create-fragment)
|
||||
// Project: http://facebook.github.io/react/
|
||||
// Definitions by: Asana <https://asana.com>, AssureSign <http://www.assuresign.com>, Microsoft <https://microsoft.com>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="react.d.ts" />
|
||||
|
||||
declare namespace __React {
|
||||
namespace __Addons {
|
||||
export function createFragment(object: { [key: string]: ReactNode }): ReactFragment;
|
||||
}
|
||||
}
|
||||
|
||||
declare module "react-addons-create-fragment" {
|
||||
export = __React.__Addons.createFragment;
|
||||
}
|
||||
25
react/react-addons-css-transition-group.d.ts
vendored
Normal file
25
react/react-addons-css-transition-group.d.ts
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
// Type definitions for React v0.14 (react-addons-css-transition-group)
|
||||
// Project: http://facebook.github.io/react/
|
||||
// Definitions by: Asana <https://asana.com>, AssureSign <http://www.assuresign.com>, Microsoft <https://microsoft.com>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="react.d.ts" />
|
||||
/// <reference path="react-addons-transition-group.d.ts" />
|
||||
|
||||
declare namespace __React {
|
||||
namespace __Addons {
|
||||
interface CSSTransitionGroupProps extends TransitionGroupProps {
|
||||
transitionName: string;
|
||||
transitionAppear?: boolean;
|
||||
transitionEnter?: boolean;
|
||||
transitionLeave?: boolean;
|
||||
}
|
||||
|
||||
type CSSTransitionGroup = ComponentClass<CSSTransitionGroupProps>;
|
||||
}
|
||||
}
|
||||
|
||||
declare module "react-addons-css-transition-group" {
|
||||
var CSSTransitionGroup: __React.__Addons.CSSTransitionGroup;
|
||||
export = CSSTransitionGroup;
|
||||
}
|
||||
24
react/react-addons-linked-state-mixin.d.ts
vendored
Normal file
24
react/react-addons-linked-state-mixin.d.ts
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
// Type definitions for React v0.14 (react-addons-linked-state-mixin)
|
||||
// Project: http://facebook.github.io/react/
|
||||
// Definitions by: Asana <https://asana.com>, AssureSign <http://www.assuresign.com>, Microsoft <https://microsoft.com>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="react.d.ts" />
|
||||
|
||||
declare namespace __React {
|
||||
namespace __Addons {
|
||||
interface ReactLink<T> {
|
||||
value: T;
|
||||
requestChange(newValue: T): void;
|
||||
}
|
||||
|
||||
interface LinkedStateMixin extends Mixin<any, any> {
|
||||
linkState<T>(key: string): ReactLink<T>;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
declare module "react-addons-linked-state-mixin" {
|
||||
var LinkedStateMixin: __React.__Addons.LinkedStateMixin;
|
||||
export = LinkedStateMixin;
|
||||
}
|
||||
46
react/react-addons-perf.d.ts
vendored
Normal file
46
react/react-addons-perf.d.ts
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
// Type definitions for React v0.14 (react-addons-perf)
|
||||
// Project: http://facebook.github.io/react/
|
||||
// Definitions by: Asana <https://asana.com>, AssureSign <http://www.assuresign.com>, Microsoft <https://microsoft.com>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="react.d.ts" />
|
||||
|
||||
declare namespace __React {
|
||||
namespace __Addons {
|
||||
interface ComponentPerfContext {
|
||||
current: string;
|
||||
owner: string;
|
||||
}
|
||||
|
||||
interface NumericPerfContext {
|
||||
[key: string]: number;
|
||||
}
|
||||
|
||||
interface Measurements {
|
||||
exclusive: NumericPerfContext;
|
||||
inclusive: NumericPerfContext;
|
||||
render: NumericPerfContext;
|
||||
counts: NumericPerfContext;
|
||||
writes: NumericPerfContext;
|
||||
displayNames: {
|
||||
[key: string]: ComponentPerfContext;
|
||||
};
|
||||
totalTime: number;
|
||||
}
|
||||
|
||||
namespace Perf {
|
||||
export function start(): void;
|
||||
export function stop(): void;
|
||||
export function printInclusive(measurements: Measurements[]): void;
|
||||
export function printExclusive(measurements: Measurements[]): void;
|
||||
export function printWasted(measurements: Measurements[]): void;
|
||||
export function printDOM(measurements: Measurements[]): void;
|
||||
export function getLastMeasurements(): Measurements[];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
declare module "react-addons-perf" {
|
||||
import Perf = __React.__Addons.Perf;
|
||||
export = Perf;
|
||||
}
|
||||
17
react/react-addons-pure-render-mixin.d.ts
vendored
Normal file
17
react/react-addons-pure-render-mixin.d.ts
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
// Type definitions for React v0.14 (react-addons-pure-render-mixin)
|
||||
// Project: http://facebook.github.io/react/
|
||||
// Definitions by: Asana <https://asana.com>, AssureSign <http://www.assuresign.com>, Microsoft <https://microsoft.com>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="react.d.ts" />
|
||||
|
||||
declare namespace __React {
|
||||
namespace __Addons {
|
||||
interface PureRenderMixin extends Mixin<any, any> {}
|
||||
}
|
||||
}
|
||||
|
||||
declare module "react-addons-pure-render-mixin" {
|
||||
var PureRenderMixin: __React.__Addons.PureRenderMixin;
|
||||
export = PureRenderMixin;
|
||||
}
|
||||
154
react/react-addons-test-utils.d.ts
vendored
Normal file
154
react/react-addons-test-utils.d.ts
vendored
Normal file
@@ -0,0 +1,154 @@
|
||||
// Type definitions for React v0.14 (react-addons-test-utils)
|
||||
// Project: http://facebook.github.io/react/
|
||||
// Definitions by: Asana <https://asana.com>, AssureSign <http://www.assuresign.com>, Microsoft <https://microsoft.com>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="react.d.ts" />
|
||||
|
||||
declare namespace __React {
|
||||
namespace __Addons {
|
||||
interface SyntheticEventData {
|
||||
altKey?: boolean;
|
||||
button?: number;
|
||||
buttons?: number;
|
||||
clientX?: number;
|
||||
clientY?: number;
|
||||
changedTouches?: TouchList;
|
||||
charCode?: boolean;
|
||||
clipboardData?: DataTransfer;
|
||||
ctrlKey?: boolean;
|
||||
deltaMode?: number;
|
||||
deltaX?: number;
|
||||
deltaY?: number;
|
||||
deltaZ?: number;
|
||||
detail?: number;
|
||||
getModifierState?(key: string): boolean;
|
||||
key?: string;
|
||||
keyCode?: number;
|
||||
locale?: string;
|
||||
location?: number;
|
||||
metaKey?: boolean;
|
||||
pageX?: number;
|
||||
pageY?: number;
|
||||
relatedTarget?: EventTarget;
|
||||
repeat?: boolean;
|
||||
screenX?: number;
|
||||
screenY?: number;
|
||||
shiftKey?: boolean;
|
||||
targetTouches?: TouchList;
|
||||
touches?: TouchList;
|
||||
view?: AbstractView;
|
||||
which?: number;
|
||||
}
|
||||
|
||||
interface EventSimulator {
|
||||
(element: Element, eventData?: SyntheticEventData): void;
|
||||
(component: Component<any, any>, eventData?: SyntheticEventData): void;
|
||||
}
|
||||
|
||||
interface MockedComponentClass {
|
||||
new(): any;
|
||||
}
|
||||
|
||||
class ShallowRenderer {
|
||||
getRenderOutput<E extends ReactElement<any>>(): E;
|
||||
getRenderOutput(): ReactElement<any>;
|
||||
render(element: ReactElement<any>, context?: any): void;
|
||||
unmount(): void;
|
||||
}
|
||||
|
||||
namespace TestUtils {
|
||||
namespace Simulate {
|
||||
export var blur: EventSimulator;
|
||||
export var change: EventSimulator;
|
||||
export var click: EventSimulator;
|
||||
export var cut: EventSimulator;
|
||||
export var doubleClick: EventSimulator;
|
||||
export var drag: EventSimulator;
|
||||
export var dragEnd: EventSimulator;
|
||||
export var dragEnter: EventSimulator;
|
||||
export var dragExit: EventSimulator;
|
||||
export var dragLeave: EventSimulator;
|
||||
export var dragOver: EventSimulator;
|
||||
export var dragStart: EventSimulator;
|
||||
export var drop: EventSimulator;
|
||||
export var focus: EventSimulator;
|
||||
export var input: EventSimulator;
|
||||
export var keyDown: EventSimulator;
|
||||
export var keyPress: EventSimulator;
|
||||
export var keyUp: EventSimulator;
|
||||
export var mouseDown: EventSimulator;
|
||||
export var mouseEnter: EventSimulator;
|
||||
export var mouseLeave: EventSimulator;
|
||||
export var mouseMove: EventSimulator;
|
||||
export var mouseOut: EventSimulator;
|
||||
export var mouseOver: EventSimulator;
|
||||
export var mouseUp: EventSimulator;
|
||||
export var paste: EventSimulator;
|
||||
export var scroll: EventSimulator;
|
||||
export var submit: EventSimulator;
|
||||
export var touchCancel: EventSimulator;
|
||||
export var touchEnd: EventSimulator;
|
||||
export var touchMove: EventSimulator;
|
||||
export var touchStart: EventSimulator;
|
||||
export var wheel: EventSimulator;
|
||||
}
|
||||
|
||||
export function renderIntoDocument<P>(
|
||||
element: ReactElement<P>): Component<P, any>;
|
||||
export function renderIntoDocument<C extends Component<any, any>>(
|
||||
element: ReactElement<any>): C;
|
||||
|
||||
export function mockComponent(
|
||||
mocked: MockedComponentClass, mockTagName?: string): typeof TestUtils;
|
||||
|
||||
export function isElementOfType(
|
||||
element: ReactElement<any>, type: ReactType): boolean;
|
||||
export function isTextComponent(instance: Component<any, any>): boolean;
|
||||
export function isDOMComponent(instance: Component<any, any>): boolean;
|
||||
export function isCompositeComponent(instance: Component<any, any>): boolean;
|
||||
export function isCompositeComponentWithType(
|
||||
instance: Component<any, any>,
|
||||
type: ComponentClass<any>): boolean;
|
||||
|
||||
export function findAllInRenderedTree(
|
||||
tree: Component<any, any>,
|
||||
fn: (i: Component<any, any>) => boolean): Component<any, any>;
|
||||
|
||||
export function scryRenderedDOMComponentsWithClass(
|
||||
tree: Component<any, any>,
|
||||
className: string): DOMComponent<any>[];
|
||||
export function findRenderedDOMComponentWithClass(
|
||||
tree: Component<any, any>,
|
||||
className: string): DOMComponent<any>;
|
||||
|
||||
export function scryRenderedDOMComponentsWithTag(
|
||||
tree: Component<any, any>,
|
||||
tagName: string): DOMComponent<any>[];
|
||||
export function findRenderedDOMComponentWithTag(
|
||||
tree: Component<any, any>,
|
||||
tagName: string): DOMComponent<any>;
|
||||
|
||||
export function scryRenderedComponentsWithType<P>(
|
||||
tree: Component<any, any>,
|
||||
type: ComponentClass<P>): Component<P, {}>[];
|
||||
export function scryRenderedComponentsWithType<C extends Component<any, any>>(
|
||||
tree: Component<any, any>,
|
||||
type: ComponentClass<any>): C[];
|
||||
|
||||
export function findRenderedComponentWithType<P>(
|
||||
tree: Component<any, any>,
|
||||
type: ComponentClass<P>): Component<P, {}>;
|
||||
export function findRenderedComponentWithType<C extends Component<any, any>>(
|
||||
tree: Component<any, any>,
|
||||
type: ComponentClass<any>): C;
|
||||
|
||||
export function createRenderer(): ShallowRenderer;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
declare module "react-addons-test-utils" {
|
||||
import TestUtils = __React.__Addons.TestUtils;
|
||||
export = TestUtils;
|
||||
}
|
||||
22
react/react-addons-transition-group.d.ts
vendored
Normal file
22
react/react-addons-transition-group.d.ts
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
// Type definitions for React v0.14 (react-addons-transition-group)
|
||||
// Project: http://facebook.github.io/react/
|
||||
// Definitions by: Asana <https://asana.com>, AssureSign <http://www.assuresign.com>, Microsoft <https://microsoft.com>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="react.d.ts" />
|
||||
|
||||
declare namespace __React {
|
||||
namespace __Addons {
|
||||
interface TransitionGroupProps {
|
||||
component?: ReactType;
|
||||
childFactory?: (child: ReactElement<any>) => ReactElement<any>;
|
||||
}
|
||||
|
||||
type TransitionGroup = ComponentClass<TransitionGroupProps>;
|
||||
}
|
||||
}
|
||||
|
||||
declare module "react-addons-transition-group" {
|
||||
var TransitionGroup: __React.__Addons.TransitionGroup;
|
||||
export = TransitionGroup;
|
||||
}
|
||||
35
react/react-addons-update.d.ts
vendored
Normal file
35
react/react-addons-update.d.ts
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
// Type definitions for React v0.14 (react-addons-update)
|
||||
// Project: http://facebook.github.io/react/
|
||||
// Definitions by: Asana <https://asana.com>, AssureSign <http://www.assuresign.com>, Microsoft <https://microsoft.com>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="react.d.ts" />
|
||||
|
||||
declare namespace __React {
|
||||
namespace __Addons {
|
||||
interface UpdateSpecCommand {
|
||||
$set?: any;
|
||||
$merge?: {};
|
||||
$apply?(value: any): any;
|
||||
}
|
||||
|
||||
interface UpdateSpecPath {
|
||||
[key: string]: UpdateSpec;
|
||||
}
|
||||
|
||||
type UpdateSpec = UpdateSpecCommand | UpdateSpecPath;
|
||||
|
||||
interface UpdateArraySpec extends UpdateSpecCommand {
|
||||
$push?: any[];
|
||||
$unshift?: any[];
|
||||
$splice?: any[][];
|
||||
}
|
||||
|
||||
export function update(value: any[], spec: UpdateArraySpec): any[];
|
||||
export function update(value: {}, spec: UpdateSpec): any;
|
||||
}
|
||||
}
|
||||
|
||||
declare module "react-addons-update" {
|
||||
export = __React.__Addons.update;
|
||||
}
|
||||
71
react/react-dom.d.ts
vendored
Normal file
71
react/react-dom.d.ts
vendored
Normal file
@@ -0,0 +1,71 @@
|
||||
// Type definitions for React v0.14 (react-dom)
|
||||
// Project: http://facebook.github.io/react/
|
||||
// Definitions by: Asana <https://asana.com>, AssureSign <http://www.assuresign.com>, Microsoft <https://microsoft.com>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="react.d.ts" />
|
||||
|
||||
declare namespace __React {
|
||||
|
||||
module __DOM {
|
||||
function findDOMNode<TElement extends Element>(
|
||||
componentOrElement: __React.Component<any, any> | Element): TElement;
|
||||
function findDOMNode(
|
||||
componentOrElement: __React.Component<any, any> | Element): Element;
|
||||
|
||||
function render<P>(
|
||||
element: DOMElement<P>,
|
||||
container: Element,
|
||||
callback?: () => any): DOMComponent<P>;
|
||||
function render<P, S>(
|
||||
element: ClassicElement<P>,
|
||||
container: Element,
|
||||
callback?: () => any): ClassicComponent<P, S>;
|
||||
function render<P, S>(
|
||||
element: ReactElement<P>,
|
||||
container: Element,
|
||||
callback?: () => any): Component<P, S>;
|
||||
|
||||
function unmountComponentAtNode(container: Element): boolean;
|
||||
|
||||
var version: string;
|
||||
|
||||
function unstable_batchedUpdates<A, B>(callback: (a: A, b: B) => any, a: A, b: B): void;
|
||||
function unstable_batchedUpdates<A>(callback: (a: A) => any, a: A): void;
|
||||
function unstable_batchedUpdates(callback: () => any): void;
|
||||
|
||||
function unstable_renderSubtreeIntoContainer<P>(
|
||||
parentComponent: Component<any, any>,
|
||||
nextElement: DOMElement<P>,
|
||||
container: Element,
|
||||
callback?: (component: DOMComponent<P>) => any): DOMComponent<P>;
|
||||
function unstable_renderSubtreeIntoContainer<P, S>(
|
||||
parentComponent: Component<any, any>,
|
||||
nextElement: ClassicElement<P>,
|
||||
container: Element,
|
||||
callback?: (component: ClassicComponent<P, S>) => any): ClassicComponent<P, S>;
|
||||
function unstable_renderSubtreeIntoContainer<P, S>(
|
||||
parentComponent: Component<any, any>,
|
||||
nextElement: ReactElement<P>,
|
||||
container: Element,
|
||||
callback?: (component: Component<P, S>) => any): Component<P, S>;
|
||||
|
||||
|
||||
}
|
||||
|
||||
namespace __DOMServer {
|
||||
function renderToString(element: ReactElement<any>): string;
|
||||
function renderToStaticMarkup(element: ReactElement<any>): string;
|
||||
var version: string;
|
||||
}
|
||||
}
|
||||
|
||||
declare module "react-dom" {
|
||||
import DOM = __React.__DOM;
|
||||
export = DOM;
|
||||
}
|
||||
|
||||
declare module "react-dom/server" {
|
||||
import DOMServer = __React.__DOMServer;
|
||||
export = DOMServer;
|
||||
}
|
||||
325
react/react-global.d.ts
vendored
325
react/react-global.d.ts
vendored
@@ -1,285 +1,66 @@
|
||||
// Type definitions for React v0.13.3 (namespace)
|
||||
// Type definitions for React v0.14 (namespace)
|
||||
// Project: http://facebook.github.io/react/
|
||||
// Definitions by: Asana <https://asana.com>, AssureSign <http://www.assuresign.com>, Microsoft <https://microsoft.com>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="react.d.ts" />
|
||||
/// <reference path="react-addons-clone-with-props.d.ts" />
|
||||
/// <reference path="react-addons-create-fragment.d.ts" />
|
||||
/// <reference path="react-addons-css-transition-group.d.ts" />
|
||||
/// <reference path="react-addons-linked-state-mixin.d.ts" />
|
||||
/// <reference path="react-addons-perf.d.ts" />
|
||||
/// <reference path="react-addons-pure-render-mixin.d.ts" />
|
||||
/// <reference path="react-addons-test-utils.d.ts" />
|
||||
/// <reference path="react-addons-transition-group.d.ts" />
|
||||
/// <reference path="react-addons-update.d.ts" />
|
||||
/// <reference path="react-dom.d.ts" />
|
||||
|
||||
import React = __React;
|
||||
import ReactDOM = __React.__DOM;
|
||||
|
||||
declare namespace __React {
|
||||
//
|
||||
// React.addons
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
export module addons {
|
||||
export var CSSTransitionGroup: CSSTransitionGroup;
|
||||
export var TransitionGroup: TransitionGroup;
|
||||
|
||||
export var LinkedStateMixin: LinkedStateMixin;
|
||||
export var PureRenderMixin: PureRenderMixin;
|
||||
|
||||
export function batchedUpdates<A, B>(
|
||||
callback: (a: A, b: B) => any, a: A, b: B): void;
|
||||
export function batchedUpdates<A>(callback: (a: A) => any, a: A): void;
|
||||
export function batchedUpdates(callback: () => any): void;
|
||||
|
||||
// deprecated: use petehunt/react-classset or JedWatson/classnames
|
||||
export function classSet(cx: { [key: string]: boolean }): string;
|
||||
export function classSet(...classList: string[]): string;
|
||||
|
||||
export function cloneWithProps<P>(
|
||||
element: DOMElement<P>, props: P): DOMElement<P>;
|
||||
export function cloneWithProps<P>(
|
||||
element: ClassicElement<P>, props: P): ClassicElement<P>;
|
||||
export function cloneWithProps<P>(
|
||||
element: ReactElement<P>, props: P): ReactElement<P>;
|
||||
|
||||
export function createFragment(
|
||||
object: { [key: string]: ReactNode }): ReactFragment;
|
||||
|
||||
export function update(value: any[], spec: UpdateArraySpec): any[];
|
||||
export function update(value: {}, spec: UpdateSpec): any;
|
||||
|
||||
// Development tools
|
||||
export import Perf = ReactPerf;
|
||||
export import TestUtils = ReactTestUtils;
|
||||
namespace addons {
|
||||
export var TransitionGroup: __React.__Addons.TransitionGroup;
|
||||
export var CSSTransitionGroup: __React.__Addons.CSSTransitionGroup;
|
||||
|
||||
export var LinkedStateMixin: __React.__Addons.LinkedStateMixin;
|
||||
export var PureRenderMixin: __React.__Addons.PureRenderMixin;
|
||||
|
||||
export import cloneWithProps = __React.__Addons.cloneWithProps;
|
||||
export import createFragment = __React.__Addons.createFragment;
|
||||
export import update = __React.__Addons.update;
|
||||
|
||||
export import Perf = __React.__Addons.Perf;
|
||||
export import TestUtils = __React.__Addons.TestUtils;
|
||||
}
|
||||
|
||||
//
|
||||
// React.addons (Transitions)
|
||||
// ----------------------------------------------------------------------
|
||||
// TransitionGroup types
|
||||
export import TransitionGroupProps = __React.__Addons.TransitionGroupProps;
|
||||
export import TransitionGroup = __React.__Addons.TransitionGroup;
|
||||
export import CSSTransitionGroupProps = __React.__Addons.CSSTransitionGroupProps;
|
||||
export import CSSTransitionGroup = __React.__Addons.CSSTransitionGroup;
|
||||
|
||||
// LinkedStateMixin types
|
||||
export import ReactLink = __React.__Addons.ReactLink;
|
||||
export import LinkedStateMixin = __React.__Addons.LinkedStateMixin;
|
||||
|
||||
// PureRenderMixin types
|
||||
export import PureRenderMixin = __React.__Addons.PureRenderMixin;
|
||||
|
||||
// update types
|
||||
export import UpdateSpecCommand = __React.__Addons.UpdateSpecCommand;
|
||||
export import UpdateSpecPath = __React.__Addons.UpdateSpecPath;
|
||||
export import UpdateSpec = __React.__Addons.UpdateSpec;
|
||||
export import UpdateArraySpec = __React.__Addons.UpdateArraySpec;
|
||||
|
||||
interface TransitionGroupProps {
|
||||
component?: ReactType;
|
||||
childFactory?: (child: ReactElement<any>) => ReactElement<any>;
|
||||
}
|
||||
|
||||
interface CSSTransitionGroupProps extends TransitionGroupProps {
|
||||
transitionName: string;
|
||||
transitionAppear?: boolean;
|
||||
transitionEnter?: boolean;
|
||||
transitionLeave?: boolean;
|
||||
}
|
||||
|
||||
type CSSTransitionGroup = ComponentClass<CSSTransitionGroupProps>;
|
||||
type TransitionGroup = ComponentClass<TransitionGroupProps>;
|
||||
|
||||
//
|
||||
// React.addons (Mixins)
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
interface ReactLink<T> {
|
||||
value: T;
|
||||
requestChange(newValue: T): void;
|
||||
}
|
||||
|
||||
interface LinkedStateMixin extends Mixin<any, any> {
|
||||
linkState<T>(key: string): ReactLink<T>;
|
||||
}
|
||||
|
||||
interface PureRenderMixin extends Mixin<any, any> {
|
||||
}
|
||||
|
||||
//
|
||||
// Reat.addons.update
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
interface UpdateSpecCommand {
|
||||
$set?: any;
|
||||
$merge?: {};
|
||||
$apply?(value: any): any;
|
||||
}
|
||||
|
||||
interface UpdateSpecPath {
|
||||
[key: string]: UpdateSpec;
|
||||
}
|
||||
|
||||
type UpdateSpec = UpdateSpecCommand | UpdateSpecPath;
|
||||
|
||||
interface UpdateArraySpec extends UpdateSpecCommand {
|
||||
$push?: any[];
|
||||
$unshift?: any[];
|
||||
$splice?: any[][];
|
||||
}
|
||||
|
||||
//
|
||||
// React.addons.Perf
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
interface ComponentPerfContext {
|
||||
current: string;
|
||||
owner: string;
|
||||
}
|
||||
|
||||
interface NumericPerfContext {
|
||||
[key: string]: number;
|
||||
}
|
||||
|
||||
interface Measurements {
|
||||
exclusive: NumericPerfContext;
|
||||
inclusive: NumericPerfContext;
|
||||
render: NumericPerfContext;
|
||||
counts: NumericPerfContext;
|
||||
writes: NumericPerfContext;
|
||||
displayNames: {
|
||||
[key: string]: ComponentPerfContext;
|
||||
};
|
||||
totalTime: number;
|
||||
}
|
||||
|
||||
module ReactPerf {
|
||||
export function start(): void;
|
||||
export function stop(): void;
|
||||
export function printInclusive(measurements: Measurements[]): void;
|
||||
export function printExclusive(measurements: Measurements[]): void;
|
||||
export function printWasted(measurements: Measurements[]): void;
|
||||
export function printDOM(measurements: Measurements[]): void;
|
||||
export function getLastMeasurements(): Measurements[];
|
||||
}
|
||||
|
||||
//
|
||||
// React.addons.TestUtils
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
interface MockedComponentClass {
|
||||
new(): any;
|
||||
}
|
||||
|
||||
module ReactTestUtils {
|
||||
export import Simulate = ReactSimulate;
|
||||
|
||||
export function renderIntoDocument<P>(
|
||||
element: ReactElement<P>): Component<P, any>;
|
||||
export function renderIntoDocument<C extends Component<any, any>>(
|
||||
element: ReactElement<any>): C;
|
||||
|
||||
export function mockComponent(
|
||||
mocked: MockedComponentClass, mockTagName?: string): typeof ReactTestUtils;
|
||||
|
||||
export function isElementOfType(
|
||||
element: ReactElement<any>, type: ReactType): boolean;
|
||||
export function isTextComponent(instance: Component<any, any>): boolean;
|
||||
export function isDOMComponent(instance: Component<any, any>): boolean;
|
||||
export function isCompositeComponent(instance: Component<any, any>): boolean;
|
||||
export function isCompositeComponentWithType(
|
||||
instance: Component<any, any>,
|
||||
type: ComponentClass<any>): boolean;
|
||||
|
||||
export function findAllInRenderedTree(
|
||||
tree: Component<any, any>,
|
||||
fn: (i: Component<any, any>) => boolean): Component<any, any>;
|
||||
|
||||
export function scryRenderedDOMComponentsWithClass(
|
||||
tree: Component<any, any>,
|
||||
className: string): DOMComponent<any>[];
|
||||
export function findRenderedDOMComponentWithClass(
|
||||
tree: Component<any, any>,
|
||||
className: string): DOMComponent<any>;
|
||||
|
||||
export function scryRenderedDOMComponentsWithTag(
|
||||
tree: Component<any, any>,
|
||||
tagName: string): DOMComponent<any>[];
|
||||
export function findRenderedDOMComponentWithTag(
|
||||
tree: Component<any, any>,
|
||||
tagName: string): DOMComponent<any>;
|
||||
|
||||
export function scryRenderedComponentsWithType<P>(
|
||||
tree: Component<any, any>,
|
||||
type: ComponentClass<P>): Component<P, {}>[];
|
||||
export function scryRenderedComponentsWithType<C extends Component<any, any>>(
|
||||
tree: Component<any, any>,
|
||||
type: ComponentClass<any>): C[];
|
||||
|
||||
export function findRenderedComponentWithType<P>(
|
||||
tree: Component<any, any>,
|
||||
type: ComponentClass<P>): Component<P, {}>;
|
||||
export function findRenderedComponentWithType<C extends Component<any, any>>(
|
||||
tree: Component<any, any>,
|
||||
type: ComponentClass<any>): C;
|
||||
|
||||
export function createRenderer(): ShallowRenderer;
|
||||
}
|
||||
|
||||
interface SyntheticEventData {
|
||||
altKey?: boolean;
|
||||
button?: number;
|
||||
buttons?: number;
|
||||
clientX?: number;
|
||||
clientY?: number;
|
||||
changedTouches?: TouchList;
|
||||
charCode?: boolean;
|
||||
clipboardData?: DataTransfer;
|
||||
ctrlKey?: boolean;
|
||||
deltaMode?: number;
|
||||
deltaX?: number;
|
||||
deltaY?: number;
|
||||
deltaZ?: number;
|
||||
detail?: number;
|
||||
getModifierState?(key: string): boolean;
|
||||
key?: string;
|
||||
keyCode?: number;
|
||||
locale?: string;
|
||||
location?: number;
|
||||
metaKey?: boolean;
|
||||
pageX?: number;
|
||||
pageY?: number;
|
||||
relatedTarget?: EventTarget;
|
||||
repeat?: boolean;
|
||||
screenX?: number;
|
||||
screenY?: number;
|
||||
shiftKey?: boolean;
|
||||
targetTouches?: TouchList;
|
||||
touches?: TouchList;
|
||||
view?: AbstractView;
|
||||
which?: number;
|
||||
}
|
||||
|
||||
interface EventSimulator {
|
||||
(element: Element, eventData?: SyntheticEventData): void;
|
||||
(component: Component<any, any>, eventData?: SyntheticEventData): void;
|
||||
}
|
||||
|
||||
module ReactSimulate {
|
||||
export var blur: EventSimulator;
|
||||
export var change: EventSimulator;
|
||||
export var click: EventSimulator;
|
||||
export var cut: EventSimulator;
|
||||
export var doubleClick: EventSimulator;
|
||||
export var drag: EventSimulator;
|
||||
export var dragEnd: EventSimulator;
|
||||
export var dragEnter: EventSimulator;
|
||||
export var dragExit: EventSimulator;
|
||||
export var dragLeave: EventSimulator;
|
||||
export var dragOver: EventSimulator;
|
||||
export var dragStart: EventSimulator;
|
||||
export var drop: EventSimulator;
|
||||
export var focus: EventSimulator;
|
||||
export var input: EventSimulator;
|
||||
export var keyDown: EventSimulator;
|
||||
export var keyPress: EventSimulator;
|
||||
export var keyUp: EventSimulator;
|
||||
export var mouseDown: EventSimulator;
|
||||
export var mouseEnter: EventSimulator;
|
||||
export var mouseLeave: EventSimulator;
|
||||
export var mouseMove: EventSimulator;
|
||||
export var mouseOut: EventSimulator;
|
||||
export var mouseOver: EventSimulator;
|
||||
export var mouseUp: EventSimulator;
|
||||
export var paste: EventSimulator;
|
||||
export var scroll: EventSimulator;
|
||||
export var submit: EventSimulator;
|
||||
export var touchCancel: EventSimulator;
|
||||
export var touchEnd: EventSimulator;
|
||||
export var touchMove: EventSimulator;
|
||||
export var touchStart: EventSimulator;
|
||||
export var wheel: EventSimulator;
|
||||
}
|
||||
|
||||
class ShallowRenderer {
|
||||
getRenderOutput<E extends ReactElement<any>>(): E;
|
||||
getRenderOutput(): ReactElement<any>;
|
||||
render(element: ReactElement<any>, context?: any): void;
|
||||
unmount(): void;
|
||||
}
|
||||
// Perf types
|
||||
export import ComponentPerfContext = __React.__Addons.ComponentPerfContext;
|
||||
export import NumericPerfContext = __React.__Addons.NumericPerfContext;
|
||||
export import Measurements = __React.__Addons.Measurements;
|
||||
|
||||
// TestUtil types
|
||||
export import SyntheticEventData = __React.__Addons.SyntheticEventData;
|
||||
export import EventSimulator = __React.__Addons.EventSimulator;
|
||||
export import MockedComponentClass = __React.__Addons.MockedComponentClass;
|
||||
export import ShallowRenderer = __React.__Addons.ShallowRenderer;
|
||||
}
|
||||
|
||||
1107
react/react.d.ts
vendored
1107
react/react.d.ts
vendored
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user