4 | // Definitions: https://github.com/borisyankov/DefinitelyTyped
5 |
6 | ///
7 |
8 | declare namespace __ReactDom {
9 | function render(
10 | element: __React.DOMElement
,
11 | container: Element,
12 | callback?: () => any): __React.DOMComponent
;
13 | function render
(
14 | element: __React.ClassicElement
,
15 | container: Element,
16 | callback?: () => any): __React.ClassicComponent
;
17 | function render
(
18 | element: __React.ReactElement
,
19 | container: Element,
20 | callback?: () => any): __React.Component
;
21 |
22 | function findDOMNode(
23 | componentOrElement: __React.Component | Element): TElement;
24 | function findDOMNode(
25 | componentOrElement: __React.Component | Element): Element;
26 |
27 | function unmountComponentAtNode(container: Element): boolean;
28 | }
29 |
30 | declare namespace __ReactDomServer {
31 | function renderToString(element: __React.ReactElement): string;
32 | function renderToStaticMarkup(element: __React.ReactElement): string;
33 | }
34 | declare module "react-dom" {
35 | export = __ReactDom
36 | }
37 |
38 | declare module "react-dom/server" {
39 | export = __ReactDomServer
40 | }
41 |
--------------------------------------------------------------------------------
/typings/react-router/react-router.d.ts:
--------------------------------------------------------------------------------
1 | // Type definitions for React Router 0.13.3
2 | // Project: https://github.com/rackt/react-router
3 | // Definitions by: Yuichi Murata , Václav Ostrožlík
4 | // Definitions: https://github.com/borisyankov/DefinitelyTyped
5 |
6 | ///
7 |
8 | declare module ReactRouter {
9 | import React = __React;
10 |
11 | //
12 | // Transition
13 | // ----------------------------------------------------------------------
14 | interface Transition {
15 | path: string;
16 | abortReason: any;
17 | retry(): void;
18 | abort(reason?: any): void;
19 | redirect(to: string, params?: {}, query?: {}): void;
20 | cancel(): void;
21 | from: (transition: Transition, routes: Route[], components?: React.ReactElement[], callback?: (error?: any) => void) => void;
22 | to: (transition: Transition, routes: Route[], params?: {}, query?: {}, callback?: (error?: any) => void) => void;
23 | }
24 |
25 | interface TransitionStaticLifecycle {
26 | willTransitionTo?(
27 | transition: Transition,
28 | params: {},
29 | query: {},
30 | callback: Function
31 | ): void;
32 |
33 | willTransitionFrom?(
34 | transition: Transition,
35 | component: React.ReactElement,
36 | callback: Function
37 | ): void;
38 | }
39 |
40 | //
41 | // Route Configuration
42 | // ----------------------------------------------------------------------
43 | // DefaultRoute
44 | interface DefaultRouteProp {
45 | name?: string;
46 | handler: React.ComponentClass;
47 | }
48 | interface DefaultRoute extends React.ReactElement {}
49 | interface DefaultRouteClass extends React.ComponentClass {}
50 |
51 | // NotFoundRoute
52 | interface NotFoundRouteProp {
53 | name?: string;
54 | handler: React.ComponentClass;
55 | }
56 | interface NotFoundRoute extends React.ReactElement {}
57 | interface NotFoundRouteClass extends React.ComponentClass {}
58 |
59 | // Redirect
60 | interface RedirectProp {
61 | path?: string;
62 | from?: string;
63 | to?: string;
64 | }
65 | interface Redirect extends React.ReactElement {}
66 | interface RedirectClass extends React.ComponentClass {}
67 |
68 | // Route
69 | interface RouteProp {
70 | name?: string;
71 | path?: string;
72 | handler?: React.ComponentClass;
73 | ignoreScrollBehavior?: boolean;
74 | component?: React.ComponentClass;
75 | }
76 | interface Route extends React.ReactElement {}
77 | interface RouteClass extends React.ComponentClass {}
78 |
79 | // Route
80 | interface IndexRouteProp {
81 | name?: string;
82 | path?: string;
83 | handler?: React.ComponentClass;
84 | ignoreScrollBehavior?: boolean;
85 | component?: React.ComponentClass;
86 | }
87 | interface IndexRoute extends React.ReactElement {}
88 | interface IndexRouteClass extends React.ComponentClass {}
89 |
90 | // Router
91 | interface RouterProp {
92 | name?: string;
93 | path?: string;
94 | handler?: React.ComponentClass;
95 | ignoreScrollBehavior?: boolean;
96 | history?: any;
97 | }
98 | interface Router extends React.ReactElement {}
99 | interface RouterClass extends React.ComponentClass {}
100 |
101 | var DefaultRoute: DefaultRouteClass;
102 | var NotFoundRoute: NotFoundRouteClass;
103 | var Redirect: RedirectClass;
104 | var Route: RouteClass;
105 | var IndexRoute: IndexRouteClass;
106 | var Router: RouterClass;
107 |
108 | interface CreateRouteOptions {
109 | name?: string;
110 | path?: string;
111 | ignoreScrollBehavior?: boolean;
112 | isDefault?: boolean;
113 | isNotFound?: boolean;
114 | onEnter?: (transition: Transition, params: {}, query: {}, callback: Function) => void;
115 | onLeave?: (transition: Transition, wtf: any, callback: Function) => void;
116 | handler?: Function;
117 | parentRoute?: Route;
118 | }
119 |
120 | type CreateRouteCallback = (route: Route) => void;
121 |
122 | function createRoute(callback: CreateRouteCallback): Route;
123 | function createRoute(options: CreateRouteOptions | string, callback: CreateRouteCallback): Route;
124 | function createDefaultRoute(options?: CreateRouteOptions | string): Route;
125 | function createNotFoundRoute(options?: CreateRouteOptions | string): Route;
126 |
127 | interface CreateRedirectOptions extends CreateRouteOptions {
128 | path?: string;
129 | from?: string;
130 | to: string;
131 | params?: {};
132 | query?: {};
133 | }
134 | function createRedirect(options: CreateRedirectOptions): Redirect;
135 | function createRoutesFromReactChildren(children: Route): Route[];
136 |
137 | //
138 | // Components
139 | // ----------------------------------------------------------------------
140 | // Link
141 | interface LinkProp extends React.HTMLAttributes {
142 | activeClassName?: string;
143 | activeStyle?: {};
144 | to: string;
145 | params?: {};
146 | query?: {};
147 | }
148 | interface Link extends React.ReactElement, Navigation, State {
149 | handleClick(event: any): void;
150 | getHref(): string;
151 | getClassName(): string;
152 | getActiveState(): boolean;
153 | }
154 | interface LinkClass extends React.ComponentClass {}
155 |
156 | // RouteHandler
157 | interface RouteHandlerProp { }
158 | interface RouteHandlerChildContext {
159 | routeDepth: number;
160 | }
161 | interface RouteHandler extends React.ReactElement {
162 | getChildContext(): RouteHandlerChildContext;
163 | getRouteDepth(): number;
164 | createChildRouteHandler(props: {}): RouteHandler;
165 | }
166 | interface RouteHandlerClass extends React.ComponentClass {}
167 |
168 | var Link: LinkClass;
169 | var RouteHandler: RouteHandlerClass;
170 |
171 |
172 | //
173 | // Top-Level
174 | // ----------------------------------------------------------------------
175 | //interface Router extends React.ReactElement {
176 | // run(callback: RouterRunCallback): void;
177 | //}
178 | //
179 | //interface RouterState {
180 | // path: string;
181 | // action: string;
182 | // pathname: string;
183 | // params: {};
184 | // query: {};
185 | // routes: Route[];
186 | //}
187 | //
188 | //interface RouterCreateOption {
189 | // routes: Route;
190 | // location?: LocationBase;
191 | // scrollBehavior?: ScrollBehaviorBase;
192 | // onError?: (error: any) => void;
193 | // onAbort?: (error: any) => void;
194 | //}
195 | //
196 | //type RouterRunCallback = (Handler: RouteClass, state: RouterState) => void;
197 | //
198 | //function create(options: RouterCreateOption): Router;
199 | //function run(routes: Route, callback: RouterRunCallback): Router;
200 | //function run(routes: Route, location: LocationBase | string, callback: RouterRunCallback): Router;
201 |
202 | //
203 | // Location
204 | // ----------------------------------------------------------------------
205 | interface LocationBase {
206 | getCurrentPath(): void;
207 | toString(): string;
208 | }
209 | interface Location extends LocationBase {
210 | push(path: string): void;
211 | replace(path: string): void;
212 | pop(): void;
213 | }
214 |
215 | interface LocationListener {
216 | addChangeListener(listener: Function): void;
217 | removeChangeListener(listener: Function): void;
218 | }
219 |
220 | interface HashLocation extends Location, LocationListener { }
221 | interface HistoryLocation extends Location, LocationListener { }
222 | interface RefreshLocation extends Location { }
223 | interface StaticLocation extends LocationBase { }
224 | interface TestLocation extends Location, LocationListener { }
225 |
226 | var HashLocation: HashLocation;
227 | var HistoryLocation: HistoryLocation;
228 | var RefreshLocation: RefreshLocation;
229 | var StaticLocation: StaticLocation;
230 | var TestLocation: TestLocation;
231 |
232 |
233 | //
234 | // Behavior
235 | // ----------------------------------------------------------------------
236 | interface ScrollBehaviorBase {
237 | updateScrollPosition(position: { x: number; y: number; }, actionType: string): void;
238 | }
239 | interface ImitateBrowserBehavior extends ScrollBehaviorBase { }
240 | interface ScrollToTopBehavior extends ScrollBehaviorBase { }
241 |
242 | var ImitateBrowserBehavior: ImitateBrowserBehavior;
243 | var ScrollToTopBehavior: ScrollToTopBehavior;
244 |
245 |
246 | //
247 | // Mixin
248 | // ----------------------------------------------------------------------
249 | interface Navigation {
250 | makePath(to: string, params?: {}, query?: {}): string;
251 | makeHref(to: string, params?: {}, query?: {}): string;
252 | transitionTo(to: string, params?: {}, query?: {}): void;
253 | replaceWith(to: string, params?: {}, query?: {}): void;
254 | goBack(): void;
255 | }
256 |
257 | interface State {
258 | getPath(): string;
259 | getRoutes(): Route[];
260 | getPathname(): string;
261 | getParams(): {};
262 | getQuery(): {};
263 | isActive(to: string, params?: {}, query?: {}): boolean;
264 | }
265 |
266 | var Navigation: Navigation;
267 | var State: State;
268 |
269 |
270 | //
271 | // History
272 | // ----------------------------------------------------------------------
273 | interface History {
274 | back(): void;
275 | length: number;
276 | }
277 | var History: History;
278 |
279 |
280 | //
281 | // Context
282 | // ----------------------------------------------------------------------
283 | interface Context {
284 | makePath(to: string, params?: {}, query?: {}): string;
285 | makeHref(to: string, params?: {}, query?: {}): string;
286 | transitionTo(to: string, params?: {}, query?: {}): void;
287 | replaceWith(to: string, params?: {}, query?: {}): void;
288 | goBack(): void;
289 |
290 | getCurrentPath(): string;
291 | getCurrentRoutes(): Route[];
292 | getCurrentPathname(): string;
293 | getCurrentParams(): {};
294 | getCurrentQuery(): {};
295 | isActive(to: string, params?: {}, query?: {}): boolean;
296 | }
297 | }
298 |
299 | declare module "react-router" {
300 | export = ReactRouter;
301 | }
302 |
303 | declare module __React {
304 |
305 | // for DefaultRoute
306 | function createElement(
307 | type: ReactRouter.DefaultRouteClass,
308 | props: ReactRouter.DefaultRouteProp,
309 | ...children: __React.ReactNode[]): ReactRouter.DefaultRoute;
310 |
311 | // for Link
312 | function createElement(
313 | type: ReactRouter.LinkClass,
314 | props: ReactRouter.LinkProp,
315 | ...children: __React.ReactNode[]): ReactRouter.Link;
316 |
317 | // for NotFoundRoute
318 | function createElement(
319 | type: ReactRouter.NotFoundRouteClass,
320 | props: ReactRouter.NotFoundRouteProp,
321 | ...children: __React.ReactNode[]): ReactRouter.NotFoundRoute;
322 |
323 | // for Redirect
324 | function createElement(
325 | type: ReactRouter.RedirectClass,
326 | props: ReactRouter.RedirectProp,
327 | ...children: __React.ReactNode[]): ReactRouter.Redirect;
328 |
329 | // for Route
330 | function createElement(
331 | type: ReactRouter.RouteClass,
332 | props: ReactRouter.RouteProp,
333 | ...children: __React.ReactNode[]): ReactRouter.Route;
334 |
335 | // for RouteHandler
336 | function createElement(
337 | type: ReactRouter.RouteHandlerClass,
338 | props: ReactRouter.RouteHandlerProp,
339 | ...children: __React.ReactNode[]): ReactRouter.RouteHandler;
340 | }
341 |
342 | declare module "react/addons" {
343 | // for DefaultRoute
344 | function createElement(
345 | type: ReactRouter.DefaultRouteClass,
346 | props: ReactRouter.DefaultRouteProp,
347 | ...children: __React.ReactNode[]): ReactRouter.DefaultRoute;
348 |
349 | // for Link
350 | function createElement(
351 | type: ReactRouter.LinkClass,
352 | props: ReactRouter.LinkProp,
353 | ...children: __React.ReactNode[]): ReactRouter.Link;
354 |
355 | // for NotFoundRoute
356 | function createElement(
357 | type: ReactRouter.NotFoundRouteClass,
358 | props: ReactRouter.NotFoundRouteProp,
359 | ...children: __React.ReactNode[]): ReactRouter.NotFoundRoute;
360 |
361 | // for Redirect
362 | function createElement(
363 | type: ReactRouter.RedirectClass,
364 | props: ReactRouter.RedirectProp,
365 | ...children: __React.ReactNode[]): ReactRouter.Redirect;
366 |
367 | // for Route
368 | function createElement(
369 | type: ReactRouter.RouteClass,
370 | props: ReactRouter.RouteProp,
371 | ...children: __React.ReactNode[]): ReactRouter.Route;
372 |
373 | // for RouteHandler
374 | function createElement(
375 | type: ReactRouter.RouteHandlerClass,
376 | props: ReactRouter.RouteHandlerProp,
377 | ...children: __React.ReactNode[]): ReactRouter.RouteHandler;
378 | }
379 |
380 |
381 | declare var activeComponent: any;
382 |
383 | declare module "react-router-active-component" {
384 | export = activeComponent;
385 | }
--------------------------------------------------------------------------------
/typings/react/react.d.ts:
--------------------------------------------------------------------------------
1 | // Type definitions for React v0.13.3
2 | // Project: http://facebook.github.io/react/
3 | // Definitions by: Asana , AssureSign , Microsoft
4 | // Definitions: https://github.com/borisyankov/DefinitelyTyped
5 |
6 | declare namespace __React {
7 | //
8 | // React Elements
9 | // ----------------------------------------------------------------------
10 |
11 | type ReactType = ComponentClass | string;
12 |
13 | interface ReactElement {
14 | type: string | ComponentClass
;
15 | props: P;
16 | key: string | number;
17 | ref: string | ((component: Component
) => any);
18 | }
19 |
20 | interface ClassicElement
extends ReactElement
{
21 | type: string | ClassicComponentClass
;
22 | ref: string | ((component: ClassicComponent
) => any);
23 | }
24 |
25 | interface DOMElement
extends ClassicElement
{
26 | type: string;
27 | ref: string | ((component: DOMComponent
) => any);
28 | }
29 |
30 | type HTMLElement = DOMElement;
31 | type SVGElement = DOMElement;
32 |
33 | //
34 | // Factories
35 | // ----------------------------------------------------------------------
36 |
37 | interface Factory {
38 | (props?: P, ...children: ReactNode[]): ReactElement
;
39 | }
40 |
41 | interface ClassicFactory
extends Factory
{
42 | (props?: P, ...children: ReactNode[]): ClassicElement
;
43 | }
44 |
45 | interface DOMFactory
extends ClassicFactory
{
46 | (props?: P, ...children: ReactNode[]): DOMElement
;
47 | }
48 |
49 | type HTMLFactory = DOMFactory;
50 | type SVGFactory = DOMFactory;
51 | type SVGElementFactory = DOMFactory;
52 |
53 | //
54 | // React Nodes
55 | // http://facebook.github.io/react/docs/glossary.html
56 | // ----------------------------------------------------------------------
57 |
58 | type ReactText = string | number;
59 | type ReactChild = ReactElement | ReactText;
60 |
61 | // Should be Array but type aliases cannot be recursive
62 | type ReactFragment = {} | Array;
63 | type ReactNode = ReactChild | ReactFragment | boolean;
64 |
65 | //
66 | // Top Level API
67 | // ----------------------------------------------------------------------
68 |
69 | function createClass(spec: ComponentSpec
): ClassicComponentClass
;
70 |
71 | function createFactory
(type: string): DOMFactory
;
72 | function createFactory
(type: ClassicComponentClass
| string): ClassicFactory
;
73 | function createFactory
(type: ComponentClass
): Factory
;
74 |
75 | function createElement
(
76 | type: string,
77 | props?: P,
78 | ...children: ReactNode[]): DOMElement
;
79 | function createElement
(
80 | type: ClassicComponentClass
| string,
81 | props?: P,
82 | ...children: ReactNode[]): ClassicElement
;
83 | function createElement
(
84 | type: ComponentClass
,
85 | props?: P,
86 | ...children: ReactNode[]): ReactElement
;
87 |
88 | function cloneElement
(
89 | element: DOMElement
,
90 | props?: P,
91 | ...children: ReactNode[]): DOMElement
;
92 | function cloneElement
(
93 | element: ClassicElement
,
94 | props?: P,
95 | ...children: ReactNode[]): ClassicElement
;
96 | function cloneElement
(
97 | element: ReactElement
,
98 | props?: P,
99 | ...children: ReactNode[]): ReactElement
;
100 |
101 | function render
(
102 | element: DOMElement
,
103 | container: Element,
104 | callback?: () => any): DOMComponent
;
105 | function render
(
106 | element: ClassicElement
,
107 | container: Element,
108 | callback?: () => any): ClassicComponent
;
109 | function render
(
110 | element: ReactElement
,
111 | container: Element,
112 | callback?: () => any): Component
;
113 |
114 | function unmountComponentAtNode(container: Element): boolean;
115 | function renderToString(element: ReactElement): string;
116 | function renderToStaticMarkup(element: ReactElement): string;
117 | function isValidElement(object: {}): boolean;
118 | function initializeTouchEvents(shouldUseTouch: boolean): void;
119 |
120 | function findDOMNode(
121 | componentOrElement: Component | Element): TElement;
122 | function findDOMNode(
123 | componentOrElement: Component | Element): Element;
124 |
125 | var DOM: ReactDOM;
126 | var PropTypes: ReactPropTypes;
127 | var Children: ReactChildren;
128 |
129 | //
130 | // Component API
131 | // ----------------------------------------------------------------------
132 |
133 | // Base component for plain JS classes
134 | class Component implements ComponentLifecycle
{
135 | static propTypes: ValidationMap;
136 | static contextTypes: ValidationMap;
137 | static childContextTypes: ValidationMap;
138 | static defaultProps: Props;
139 |
140 | constructor(props?: P, context?: any);
141 | setState(f: (prevState: S, props: P) => S, callback?: () => any): void;
142 | setState(state: S, callback?: () => any): void;
143 | forceUpdate(callBack?: () => any): void;
144 | render(): JSX.Element;
145 | props: P;
146 | state: S;
147 | context: {};
148 | refs: {
149 | [key: string]: Component
150 | };
151 | }
152 |
153 | interface ClassicComponent extends Component
{
154 | replaceState(nextState: S, callback?: () => any): void;
155 | getDOMNode(): TElement;
156 | getDOMNode(): Element;
157 | isMounted(): boolean;
158 | getInitialState?(): S;
159 | setProps(nextProps: P, callback?: () => any): void;
160 | replaceProps(nextProps: P, callback?: () => any): void;
161 | }
162 |
163 | interface DOMComponent extends ClassicComponent
{
164 | tagName: string;
165 | }
166 |
167 | type HTMLComponent = DOMComponent;
168 | type SVGComponent = DOMComponent;
169 |
170 | interface ChildContextProvider {
171 | getChildContext(): CC;
172 | }
173 |
174 | //
175 | // Class Interfaces
176 | // ----------------------------------------------------------------------
177 |
178 | interface ComponentClass {
179 | new(props?: P, context?: any): Component
;
180 | propTypes?: ValidationMap
;
181 | contextTypes?: ValidationMap;
182 | childContextTypes?: ValidationMap;
183 | defaultProps?: P;
184 | }
185 |
186 | interface ClassicComponentClass extends ComponentClass
{
187 | new(props?: P, context?: any): ClassicComponent
;
188 | getDefaultProps?(): P;
189 | displayName?: string;
190 | }
191 |
192 | //
193 | // Component Specs and Lifecycle
194 | // ----------------------------------------------------------------------
195 |
196 | interface ComponentLifecycle
{
197 | componentWillMount?(): void;
198 | componentDidMount?(): void;
199 | componentWillReceiveProps?(nextProps: P, nextContext: any): void;
200 | shouldComponentUpdate?(nextProps: P, nextState: S, nextContext: any): boolean;
201 | componentWillUpdate?(nextProps: P, nextState: S, nextContext: any): void;
202 | componentDidUpdate?(prevProps: P, prevState: S, prevContext: any): void;
203 | componentWillUnmount?(): void;
204 | }
205 |
206 | interface Mixin
extends ComponentLifecycle
{
207 | mixins?: Mixin
;
208 | statics?: {
209 | [key: string]: any;
210 | };
211 |
212 | displayName?: string;
213 | propTypes?: ValidationMap;
214 | contextTypes?: ValidationMap;
215 | childContextTypes?: ValidationMap
216 |
217 | getDefaultProps?(): P;
218 | getInitialState?(): S;
219 | }
220 |
221 | interface ComponentSpec extends Mixin
{
222 | render(): ReactElement;
223 |
224 | [propertyName: string]: any;
225 | }
226 |
227 | //
228 | // Event System
229 | // ----------------------------------------------------------------------
230 |
231 | interface SyntheticEvent {
232 | bubbles: boolean;
233 | cancelable: boolean;
234 | currentTarget: EventTarget;
235 | defaultPrevented: boolean;
236 | eventPhase: number;
237 | isTrusted: boolean;
238 | nativeEvent: Event;
239 | preventDefault(): void;
240 | stopPropagation(): void;
241 | target: EventTarget;
242 | timeStamp: Date;
243 | type: string;
244 | }
245 |
246 | interface DragEvent extends SyntheticEvent {
247 | dataTransfer: DataTransfer;
248 | }
249 |
250 | interface ClipboardEvent extends SyntheticEvent {
251 | clipboardData: DataTransfer;
252 | }
253 |
254 | interface KeyboardEvent extends SyntheticEvent {
255 | altKey: boolean;
256 | charCode: number;
257 | ctrlKey: boolean;
258 | getModifierState(key: string): boolean;
259 | key: string;
260 | keyCode: number;
261 | locale: string;
262 | location: number;
263 | metaKey: boolean;
264 | repeat: boolean;
265 | shiftKey: boolean;
266 | which: number;
267 | }
268 |
269 | interface FocusEvent extends SyntheticEvent {
270 | relatedTarget: EventTarget;
271 | }
272 |
273 | interface FormEvent extends SyntheticEvent {
274 | }
275 |
276 | interface MouseEvent extends SyntheticEvent {
277 | altKey: boolean;
278 | button: number;
279 | buttons: number;
280 | clientX: number;
281 | clientY: number;
282 | ctrlKey: boolean;
283 | getModifierState(key: string): boolean;
284 | metaKey: boolean;
285 | pageX: number;
286 | pageY: number;
287 | relatedTarget: EventTarget;
288 | screenX: number;
289 | screenY: number;
290 | shiftKey: boolean;
291 | }
292 |
293 | interface TouchEvent extends SyntheticEvent {
294 | altKey: boolean;
295 | changedTouches: TouchList;
296 | ctrlKey: boolean;
297 | getModifierState(key: string): boolean;
298 | metaKey: boolean;
299 | shiftKey: boolean;
300 | targetTouches: TouchList;
301 | touches: TouchList;
302 | }
303 |
304 | interface UIEvent extends SyntheticEvent {
305 | detail: number;
306 | view: AbstractView;
307 | }
308 |
309 | interface WheelEvent extends SyntheticEvent {
310 | deltaMode: number;
311 | deltaX: number;
312 | deltaY: number;
313 | deltaZ: number;
314 | }
315 |
316 | //
317 | // Event Handler Types
318 | // ----------------------------------------------------------------------
319 |
320 | interface EventHandler {
321 | (event: E): void;
322 | }
323 |
324 | interface DragEventHandler extends EventHandler {}
325 | interface ClipboardEventHandler extends EventHandler {}
326 | interface KeyboardEventHandler extends EventHandler {}
327 | interface FocusEventHandler extends EventHandler {}
328 | interface FormEventHandler extends EventHandler {}
329 | interface MouseEventHandler extends EventHandler {}
330 | interface TouchEventHandler extends EventHandler {}
331 | interface UIEventHandler extends EventHandler {}
332 | interface WheelEventHandler extends EventHandler {}
333 |
334 | //
335 | // Props / DOM Attributes
336 | // ----------------------------------------------------------------------
337 |
338 | interface Props {
339 | children?: ReactNode;
340 | key?: string | number;
341 | ref?: string | ((component: T) => any);
342 | }
343 |
344 | interface DOMAttributesBase extends Props {
345 | onCopy?: ClipboardEventHandler;
346 | onCut?: ClipboardEventHandler;
347 | onPaste?: ClipboardEventHandler;
348 | onKeyDown?: KeyboardEventHandler;
349 | onKeyPress?: KeyboardEventHandler;
350 | onKeyUp?: KeyboardEventHandler;
351 | onFocus?: FocusEventHandler;
352 | onBlur?: FocusEventHandler;
353 | onChange?: FormEventHandler;
354 | onInput?: FormEventHandler;
355 | onSubmit?: FormEventHandler;
356 | onClick?: MouseEventHandler;
357 | onContextMenu?: MouseEventHandler;
358 | onDoubleClick?: MouseEventHandler;
359 | onDrag?: DragEventHandler;
360 | onDragEnd?: DragEventHandler;
361 | onDragEnter?: DragEventHandler;
362 | onDragExit?: DragEventHandler;
363 | onDragLeave?: DragEventHandler;
364 | onDragOver?: DragEventHandler;
365 | onDragStart?: DragEventHandler;
366 | onDrop?: DragEventHandler;
367 | onMouseDown?: MouseEventHandler;
368 | onMouseEnter?: MouseEventHandler;
369 | onMouseLeave?: MouseEventHandler;
370 | onMouseMove?: MouseEventHandler;
371 | onMouseOut?: MouseEventHandler;
372 | onMouseOver?: MouseEventHandler;
373 | onMouseUp?: MouseEventHandler;
374 | onTouchCancel?: TouchEventHandler;
375 | onTouchEnd?: TouchEventHandler;
376 | onTouchMove?: TouchEventHandler;
377 | onTouchStart?: TouchEventHandler;
378 | onScroll?: UIEventHandler;
379 | onWheel?: WheelEventHandler;
380 |
381 | className?: string;
382 | id?: string;
383 |
384 | dangerouslySetInnerHTML?: {
385 | __html: string;
386 | };
387 | }
388 |
389 | interface DOMAttributes extends DOMAttributesBase> {
390 | }
391 |
392 | // This interface is not complete. Only properties accepting
393 | // unitless numbers are listed here (see CSSProperty.js in React)
394 | interface CSSProperties {
395 | boxFlex?: number;
396 | boxFlexGroup?: number;
397 | columnCount?: number;
398 | flex?: number | string;
399 | flexGrow?: number;
400 | flexShrink?: number;
401 | fontWeight?: number | string;
402 | lineClamp?: number;
403 | lineHeight?: number | string;
404 | opacity?: number;
405 | order?: number;
406 | orphans?: number;
407 | widows?: number;
408 | zIndex?: number;
409 | zoom?: number;
410 |
411 | fontSize?: number | string;
412 |
413 | // SVG-related properties
414 | fillOpacity?: number;
415 | strokeOpacity?: number;
416 | strokeWidth?: number;
417 |
418 | [propertyName: string]: any;
419 | }
420 |
421 | interface HTMLAttributesBase extends DOMAttributesBase {
422 | accept?: string;
423 | acceptCharset?: string;
424 | accessKey?: string;
425 | action?: string;
426 | allowFullScreen?: boolean;
427 | allowTransparency?: boolean;
428 | alt?: string;
429 | async?: boolean;
430 | autoComplete?: boolean;
431 | autoFocus?: boolean;
432 | autoPlay?: boolean;
433 | cellPadding?: number | string;
434 | cellSpacing?: number | string;
435 | charSet?: string;
436 | checked?: boolean;
437 | classID?: string;
438 | cols?: number;
439 | colSpan?: number;
440 | content?: string;
441 | contentEditable?: boolean;
442 | contextMenu?: string;
443 | controls?: any;
444 | coords?: string;
445 | crossOrigin?: string;
446 | data?: string;
447 | dateTime?: string;
448 | defaultChecked?: boolean;
449 | defaultValue?: string;
450 | defer?: boolean;
451 | dir?: string;
452 | disabled?: boolean;
453 | download?: any;
454 | draggable?: boolean;
455 | encType?: string;
456 | form?: string;
457 | formAction?: string;
458 | formEncType?: string;
459 | formMethod?: string;
460 | formNoValidate?: boolean;
461 | formTarget?: string;
462 | frameBorder?: number | string;
463 | headers?: string;
464 | height?: number | string;
465 | hidden?: boolean;
466 | high?: number;
467 | href?: string;
468 | hrefLang?: string;
469 | htmlFor?: string;
470 | httpEquiv?: string;
471 | icon?: string;
472 | label?: string;
473 | lang?: string;
474 | list?: string;
475 | loop?: boolean;
476 | low?: number;
477 | manifest?: string;
478 | marginHeight?: number;
479 | marginWidth?: number;
480 | max?: number | string;
481 | maxLength?: number;
482 | media?: string;
483 | mediaGroup?: string;
484 | method?: string;
485 | min?: number | string;
486 | multiple?: boolean;
487 | muted?: boolean;
488 | name?: string;
489 | noValidate?: boolean;
490 | open?: boolean;
491 | optimum?: number;
492 | pattern?: string;
493 | placeholder?: string;
494 | poster?: string;
495 | preload?: string;
496 | radioGroup?: string;
497 | readOnly?: boolean;
498 | rel?: string;
499 | required?: boolean;
500 | role?: string;
501 | rows?: number;
502 | rowSpan?: number;
503 | sandbox?: string;
504 | scope?: string;
505 | scoped?: boolean;
506 | scrolling?: string;
507 | seamless?: boolean;
508 | selected?: boolean;
509 | shape?: string;
510 | size?: number;
511 | sizes?: string;
512 | span?: number;
513 | spellCheck?: boolean;
514 | src?: string;
515 | srcDoc?: string;
516 | srcSet?: string;
517 | start?: number;
518 | step?: number | string;
519 | style?: CSSProperties;
520 | tabIndex?: number;
521 | target?: string;
522 | title?: string;
523 | type?: string;
524 | useMap?: string;
525 | value?: string;
526 | width?: number | string;
527 | wmode?: string;
528 |
529 | // Non-standard Attributes
530 | autoCapitalize?: boolean;
531 | autoCorrect?: boolean;
532 | property?: string;
533 | itemProp?: string;
534 | itemScope?: boolean;
535 | itemType?: string;
536 | unselectable?: boolean;
537 | }
538 |
539 | interface HTMLAttributes extends HTMLAttributesBase {
540 | }
541 |
542 | interface SVGElementAttributes extends HTMLAttributes {
543 | viewBox?: string;
544 | preserveAspectRatio?: string;
545 | }
546 |
547 | interface SVGAttributes extends DOMAttributes {
548 | ref?: string | ((component: SVGComponent) => void);
549 |
550 | cx?: number | string;
551 | cy?: number | string;
552 | d?: string;
553 | dx?: number | string;
554 | dy?: number | string;
555 | fill?: string;
556 | fillOpacity?: number | string;
557 | fontFamily?: string;
558 | fontSize?: number | string;
559 | fx?: number | string;
560 | fy?: number | string;
561 | gradientTransform?: string;
562 | gradientUnits?: string;
563 | height?: number | string;
564 | markerEnd?: string;
565 | markerMid?: string;
566 | markerStart?: string;
567 | offset?: number | string;
568 | opacity?: number | string;
569 | patternContentUnits?: string;
570 | patternUnits?: string;
571 | points?: string;
572 | preserveAspectRatio?: string;
573 | r?: number | string;
574 | rx?: number | string;
575 | ry?: number | string;
576 | spreadMethod?: string;
577 | stopColor?: string;
578 | stopOpacity?: number | string;
579 | stroke?: string;
580 | strokeDasharray?: string;
581 | strokeLinecap?: string;
582 | strokeMiterlimit?: string;
583 | strokeOpacity?: number | string;
584 | strokeWidth?: number | string;
585 | textAnchor?: string;
586 | transform?: string;
587 | version?: string;
588 | viewBox?: string;
589 | width?: number | string;
590 | x1?: number | string;
591 | x2?: number | string;
592 | x?: number | string;
593 | y1?: number | string;
594 | y2?: number | string
595 | y?: number | string;
596 | }
597 |
598 | //
599 | // React.DOM
600 | // ----------------------------------------------------------------------
601 |
602 | interface ReactDOM {
603 | // HTML
604 | a: HTMLFactory;
605 | abbr: HTMLFactory;
606 | address: HTMLFactory;
607 | area: HTMLFactory;
608 | article: HTMLFactory;
609 | aside: HTMLFactory;
610 | audio: HTMLFactory;
611 | b: HTMLFactory;
612 | base: HTMLFactory;
613 | bdi: HTMLFactory;
614 | bdo: HTMLFactory;
615 | big: HTMLFactory;
616 | blockquote: HTMLFactory;
617 | body: HTMLFactory;
618 | br: HTMLFactory;
619 | button: HTMLFactory;
620 | canvas: HTMLFactory;
621 | caption: HTMLFactory;
622 | cite: HTMLFactory;
623 | code: HTMLFactory;
624 | col: HTMLFactory;
625 | colgroup: HTMLFactory;
626 | data: HTMLFactory;
627 | datalist: HTMLFactory;
628 | dd: HTMLFactory;
629 | del: HTMLFactory;
630 | details: HTMLFactory;
631 | dfn: HTMLFactory;
632 | dialog: HTMLFactory;
633 | div: HTMLFactory;
634 | dl: HTMLFactory;
635 | dt: HTMLFactory;
636 | em: HTMLFactory;
637 | embed: HTMLFactory;
638 | fieldset: HTMLFactory;
639 | figcaption: HTMLFactory;
640 | figure: HTMLFactory;
641 | footer: HTMLFactory;
642 | form: HTMLFactory;
643 | h1: HTMLFactory;
644 | h2: HTMLFactory;
645 | h3: HTMLFactory;
646 | h4: HTMLFactory;
647 | h5: HTMLFactory;
648 | h6: HTMLFactory;
649 | head: HTMLFactory;
650 | header: HTMLFactory;
651 | hr: HTMLFactory;
652 | html: HTMLFactory;
653 | i: HTMLFactory;
654 | iframe: HTMLFactory;
655 | img: HTMLFactory;
656 | input: HTMLFactory;
657 | ins: HTMLFactory;
658 | kbd: HTMLFactory;
659 | keygen: HTMLFactory;
660 | label: HTMLFactory;
661 | legend: HTMLFactory;
662 | li: HTMLFactory;
663 | link: HTMLFactory;
664 | main: HTMLFactory;
665 | map: HTMLFactory;
666 | mark: HTMLFactory;
667 | menu: HTMLFactory;
668 | menuitem: HTMLFactory;
669 | meta: HTMLFactory;
670 | meter: HTMLFactory;
671 | nav: HTMLFactory;
672 | noscript: HTMLFactory;
673 | object: HTMLFactory;
674 | ol: HTMLFactory;
675 | optgroup: HTMLFactory;
676 | option: HTMLFactory;
677 | output: HTMLFactory;
678 | p: HTMLFactory;
679 | param: HTMLFactory;
680 | picture: HTMLFactory;
681 | pre: HTMLFactory;
682 | progress: HTMLFactory;
683 | q: HTMLFactory;
684 | rp: HTMLFactory;
685 | rt: HTMLFactory;
686 | ruby: HTMLFactory;
687 | s: HTMLFactory;
688 | samp: HTMLFactory;
689 | script: HTMLFactory;
690 | section: HTMLFactory;
691 | select: HTMLFactory;
692 | small: HTMLFactory;
693 | source: HTMLFactory;
694 | span: HTMLFactory;
695 | strong: HTMLFactory;
696 | style: HTMLFactory;
697 | sub: HTMLFactory;
698 | summary: HTMLFactory;
699 | sup: HTMLFactory;
700 | table: HTMLFactory;
701 | tbody: HTMLFactory;
702 | td: HTMLFactory;
703 | textarea: HTMLFactory;
704 | tfoot: HTMLFactory;
705 | th: HTMLFactory;
706 | thead: HTMLFactory;
707 | time: HTMLFactory;
708 | title: HTMLFactory;
709 | tr: HTMLFactory;
710 | track: HTMLFactory;
711 | u: HTMLFactory;
712 | ul: HTMLFactory;
713 | "var": HTMLFactory;
714 | video: HTMLFactory;
715 | wbr: HTMLFactory;
716 |
717 | // SVG
718 | svg: SVGElementFactory;
719 | circle: SVGFactory;
720 | defs: SVGFactory;
721 | ellipse: SVGFactory;
722 | g: SVGFactory;
723 | line: SVGFactory;
724 | linearGradient: SVGFactory;
725 | mask: SVGFactory;
726 | path: SVGFactory;
727 | pattern: SVGFactory;
728 | polygon: SVGFactory;
729 | polyline: SVGFactory;
730 | radialGradient: SVGFactory;
731 | rect: SVGFactory;
732 | stop: SVGFactory;
733 | text: SVGFactory;
734 | tspan: SVGFactory;
735 | }
736 |
737 | //
738 | // React.PropTypes
739 | // ----------------------------------------------------------------------
740 |
741 | interface Validator {
742 | (object: T, key: string, componentName: string): Error;
743 | }
744 |
745 | interface Requireable extends Validator {
746 | isRequired: Validator;
747 | }
748 |
749 | interface ValidationMap {
750 | [key: string]: Validator;
751 | }
752 |
753 | interface ReactPropTypes {
754 | any: Requireable;
755 | array: Requireable;
756 | bool: Requireable;
757 | func: Requireable;
758 | number: Requireable;
759 | object: Requireable;
760 | string: Requireable;
761 | node: Requireable;
762 | element: Requireable;
763 | instanceOf(expectedClass: {}): Requireable;
764 | oneOf(types: any[]): Requireable;
765 | oneOfType(types: Validator[]): Requireable;
766 | arrayOf(type: Validator): Requireable;
767 | objectOf(type: Validator): Requireable;
768 | shape(type: ValidationMap): Requireable;
769 | }
770 |
771 | //
772 | // React.Children
773 | // ----------------------------------------------------------------------
774 |
775 | interface ReactChildren {
776 | map(children: ReactNode, fn: (child: ReactChild, index: number) => T): { [key:string]: T };
777 | forEach(children: ReactNode, fn: (child: ReactChild, index: number) => any): void;
778 | count(children: ReactNode): number;
779 | only(children: ReactNode): ReactChild;
780 | }
781 |
782 | //
783 | // Browser Interfaces
784 | // https://github.com/nikeee/2048-typescript/blob/master/2048/js/touch.d.ts
785 | // ----------------------------------------------------------------------
786 |
787 | interface AbstractView {
788 | styleMedia: StyleMedia;
789 | document: Document;
790 | }
791 |
792 | interface Touch {
793 | identifier: number;
794 | target: EventTarget;
795 | screenX: number;
796 | screenY: number;
797 | clientX: number;
798 | clientY: number;
799 | pageX: number;
800 | pageY: number;
801 | }
802 |
803 | interface TouchList {
804 | [index: number]: Touch;
805 | length: number;
806 | item(index: number): Touch;
807 | identifiedTouch(identifier: number): Touch;
808 | }
809 | }
810 |
811 | declare module "react" {
812 | export = __React;
813 | }
814 |
815 | declare module "react/addons" {
816 | //
817 | // React Elements
818 | // ----------------------------------------------------------------------
819 |
820 | type ReactType = ComponentClass | string;
821 |
822 | interface ReactElement {
823 | type: string | ComponentClass
;
824 | props: P;
825 | key: string | number;
826 | ref: string | ((component: Component
) => any);
827 | }
828 |
829 | interface ClassicElement
extends ReactElement
{
830 | type: string | ClassicComponentClass
;
831 | ref: string | ((component: ClassicComponent
) => any);
832 | }
833 |
834 | interface DOMElement
extends ClassicElement
{
835 | type: string;
836 | ref: string | ((component: DOMComponent
) => any);
837 | }
838 |
839 | type HTMLElement = DOMElement;
840 | type SVGElement = DOMElement;
841 |
842 | //
843 | // Factories
844 | // ----------------------------------------------------------------------
845 |
846 | interface Factory {
847 | (props?: P, ...children: ReactNode[]): ReactElement
;
848 | }
849 |
850 | interface ClassicFactory
extends Factory
{
851 | (props?: P, ...children: ReactNode[]): ClassicElement
;
852 | }
853 |
854 | interface DOMFactory
extends ClassicFactory
{
855 | (props?: P, ...children: ReactNode[]): DOMElement
;
856 | }
857 |
858 | type HTMLFactory = DOMFactory;
859 | type SVGFactory = DOMFactory;
860 | type SVGElementFactory = DOMFactory;
861 |
862 | //
863 | // React Nodes
864 | // http://facebook.github.io/react/docs/glossary.html
865 | // ----------------------------------------------------------------------
866 |
867 | type ReactText = string | number;
868 | type ReactChild = ReactElement | ReactText;
869 |
870 | // Should be Array but type aliases cannot be recursive
871 | type ReactFragment = {} | Array;
872 | type ReactNode = ReactChild | ReactFragment | boolean;
873 |
874 | //
875 | // Top Level API
876 | // ----------------------------------------------------------------------
877 |
878 | function createClass(spec: ComponentSpec
): ClassicComponentClass
;
879 |
880 | function createFactory
(type: string): DOMFactory
;
881 | function createFactory
(type: ClassicComponentClass
| string): ClassicFactory
;
882 | function createFactory
(type: ComponentClass
): Factory
;
883 |
884 | function createElement
(
885 | type: string,
886 | props?: P,
887 | ...children: ReactNode[]): DOMElement
;
888 | function createElement
(
889 | type: ClassicComponentClass
| string,
890 | props?: P,
891 | ...children: ReactNode[]): ClassicElement
;
892 | function createElement
(
893 | type: ComponentClass
,
894 | props?: P,
895 | ...children: ReactNode[]): ReactElement
;
896 |
897 | function cloneElement
(
898 | element: DOMElement
,
899 | props?: P,
900 | ...children: ReactNode[]): DOMElement
;
901 | function cloneElement
(
902 | element: ClassicElement
,
903 | props?: P,
904 | ...children: ReactNode[]): ClassicElement
;
905 | function cloneElement
(
906 | element: ReactElement
,
907 | props?: P,
908 | ...children: ReactNode[]): ReactElement
;
909 |
910 | function render
(
911 | element: DOMElement
,
912 | container: Element,
913 | callback?: () => any): DOMComponent
;
914 | function render
(
915 | element: ClassicElement
,
916 | container: Element,
917 | callback?: () => any): ClassicComponent
;
918 | function render
(
919 | element: ReactElement
,
920 | container: Element,
921 | callback?: () => any): Component
;
922 |
923 | function unmountComponentAtNode(container: Element): boolean;
924 | function renderToString(element: ReactElement): string;
925 | function renderToStaticMarkup(element: ReactElement): string;
926 | function isValidElement(object: {}): boolean;
927 | function initializeTouchEvents(shouldUseTouch: boolean): void;
928 |
929 | function findDOMNode(
930 | componentOrElement: Component | Element): TElement;
931 | function findDOMNode(
932 | componentOrElement: Component | Element): Element;
933 |
934 | var DOM: ReactDOM;
935 | var PropTypes: ReactPropTypes;
936 | var Children: ReactChildren;
937 |
938 | //
939 | // Component API
940 | // ----------------------------------------------------------------------
941 |
942 | // Base component for plain JS classes
943 | class Component implements ComponentLifecycle
{
944 | static propTypes: ValidationMap;
945 | static contextTypes: ValidationMap;
946 | static childContextTypes: ValidationMap;
947 | static defaultProps: Props;
948 |
949 | constructor(props?: P, context?: any);
950 | setState(f: (prevState: S, props: P) => S, callback?: () => any): void;
951 | setState(state: S, callback?: () => any): void;
952 | forceUpdate(callBack?: () => any): void;
953 | render(): JSX.Element;
954 | props: P;
955 | state: S;
956 | context: {};
957 | refs: {
958 | [key: string]: Component
959 | };
960 | }
961 |
962 | interface ClassicComponent extends Component
{
963 | replaceState(nextState: S, callback?: () => any): void;
964 | getDOMNode(): TElement;
965 | getDOMNode(): Element;
966 | isMounted(): boolean;
967 | getInitialState?(): S;
968 | setProps(nextProps: P, callback?: () => any): void;
969 | replaceProps(nextProps: P, callback?: () => any): void;
970 | }
971 |
972 | interface DOMComponent extends ClassicComponent
{
973 | tagName: string;
974 | }
975 |
976 | type HTMLComponent = DOMComponent;
977 | type SVGComponent = DOMComponent;
978 |
979 | interface ChildContextProvider {
980 | getChildContext(): CC;
981 | }
982 |
983 | //
984 | // Class Interfaces
985 | // ----------------------------------------------------------------------
986 |
987 | interface ComponentClass {
988 | new(props?: P, context?: any): Component
;
989 | propTypes?: ValidationMap
;
990 | contextTypes?: ValidationMap;
991 | childContextTypes?: ValidationMap;
992 | defaultProps?: P;
993 | }
994 |
995 | interface ClassicComponentClass extends ComponentClass
{
996 | new(props?: P, context?: any): ClassicComponent
;
997 | getDefaultProps?(): P;
998 | displayName?: string;
999 | }
1000 |
1001 | //
1002 | // Component Specs and Lifecycle
1003 | // ----------------------------------------------------------------------
1004 |
1005 | interface ComponentLifecycle
{
1006 | componentWillMount?(): void;
1007 | componentDidMount?(): void;
1008 | componentWillReceiveProps?(nextProps: P, nextContext: any): void;
1009 | shouldComponentUpdate?(nextProps: P, nextState: S, nextContext: any): boolean;
1010 | componentWillUpdate?(nextProps: P, nextState: S, nextContext: any): void;
1011 | componentDidUpdate?(prevProps: P, prevState: S, prevContext: any): void;
1012 | componentWillUnmount?(): void;
1013 | }
1014 |
1015 | interface Mixin
extends ComponentLifecycle
{
1016 | mixins?: Mixin
;
1017 | statics?: {
1018 | [key: string]: any;
1019 | };
1020 |
1021 | displayName?: string;
1022 | propTypes?: ValidationMap;
1023 | contextTypes?: ValidationMap;
1024 | childContextTypes?: ValidationMap
1025 |
1026 | getDefaultProps?(): P;
1027 | getInitialState?(): S;
1028 | }
1029 |
1030 | interface ComponentSpec extends Mixin
{
1031 | render(): ReactElement;
1032 |
1033 | [propertyName: string]: any;
1034 | }
1035 |
1036 | //
1037 | // Event System
1038 | // ----------------------------------------------------------------------
1039 |
1040 | interface SyntheticEvent {
1041 | bubbles: boolean;
1042 | cancelable: boolean;
1043 | currentTarget: EventTarget;
1044 | defaultPrevented: boolean;
1045 | eventPhase: number;
1046 | isTrusted: boolean;
1047 | nativeEvent: Event;
1048 | preventDefault(): void;
1049 | stopPropagation(): void;
1050 | target: EventTarget;
1051 | timeStamp: Date;
1052 | type: string;
1053 | }
1054 |
1055 | interface DragEvent extends SyntheticEvent {
1056 | dataTransfer: DataTransfer;
1057 | }
1058 |
1059 | interface ClipboardEvent extends SyntheticEvent {
1060 | clipboardData: DataTransfer;
1061 | }
1062 |
1063 | interface KeyboardEvent extends SyntheticEvent {
1064 | altKey: boolean;
1065 | charCode: number;
1066 | ctrlKey: boolean;
1067 | getModifierState(key: string): boolean;
1068 | key: string;
1069 | keyCode: number;
1070 | locale: string;
1071 | location: number;
1072 | metaKey: boolean;
1073 | repeat: boolean;
1074 | shiftKey: boolean;
1075 | which: number;
1076 | }
1077 |
1078 | interface FocusEvent extends SyntheticEvent {
1079 | relatedTarget: EventTarget;
1080 | }
1081 |
1082 | interface FormEvent extends SyntheticEvent {
1083 | }
1084 |
1085 | interface MouseEvent extends SyntheticEvent {
1086 | altKey: boolean;
1087 | button: number;
1088 | buttons: number;
1089 | clientX: number;
1090 | clientY: number;
1091 | ctrlKey: boolean;
1092 | getModifierState(key: string): boolean;
1093 | metaKey: boolean;
1094 | pageX: number;
1095 | pageY: number;
1096 | relatedTarget: EventTarget;
1097 | screenX: number;
1098 | screenY: number;
1099 | shiftKey: boolean;
1100 | }
1101 |
1102 | interface TouchEvent extends SyntheticEvent {
1103 | altKey: boolean;
1104 | changedTouches: TouchList;
1105 | ctrlKey: boolean;
1106 | getModifierState(key: string): boolean;
1107 | metaKey: boolean;
1108 | shiftKey: boolean;
1109 | targetTouches: TouchList;
1110 | touches: TouchList;
1111 | }
1112 |
1113 | interface UIEvent extends SyntheticEvent {
1114 | detail: number;
1115 | view: AbstractView;
1116 | }
1117 |
1118 | interface WheelEvent extends SyntheticEvent {
1119 | deltaMode: number;
1120 | deltaX: number;
1121 | deltaY: number;
1122 | deltaZ: number;
1123 | }
1124 |
1125 | //
1126 | // Event Handler Types
1127 | // ----------------------------------------------------------------------
1128 |
1129 | interface EventHandler {
1130 | (event: E): void;
1131 | }
1132 |
1133 | interface DragEventHandler extends EventHandler {}
1134 | interface ClipboardEventHandler extends EventHandler {}
1135 | interface KeyboardEventHandler extends EventHandler {}
1136 | interface FocusEventHandler extends EventHandler {}
1137 | interface FormEventHandler extends EventHandler {}
1138 | interface MouseEventHandler extends EventHandler {}
1139 | interface TouchEventHandler extends EventHandler {}
1140 | interface UIEventHandler extends EventHandler {}
1141 | interface WheelEventHandler extends EventHandler {}
1142 |
1143 | //
1144 | // Props / DOM Attributes
1145 | // ----------------------------------------------------------------------
1146 |
1147 | interface Props {
1148 | children?: ReactNode;
1149 | key?: string | number;
1150 | ref?: string | ((component: T) => any);
1151 | }
1152 |
1153 | interface DOMAttributesBase extends Props {
1154 | onCopy?: ClipboardEventHandler;
1155 | onCut?: ClipboardEventHandler;
1156 | onPaste?: ClipboardEventHandler;
1157 | onKeyDown?: KeyboardEventHandler;
1158 | onKeyPress?: KeyboardEventHandler;
1159 | onKeyUp?: KeyboardEventHandler;
1160 | onFocus?: FocusEventHandler;
1161 | onBlur?: FocusEventHandler;
1162 | onChange?: FormEventHandler;
1163 | onInput?: FormEventHandler;
1164 | onSubmit?: FormEventHandler;
1165 | onClick?: MouseEventHandler;
1166 | onDoubleClick?: MouseEventHandler;
1167 | onDrag?: DragEventHandler;
1168 | onDragEnd?: DragEventHandler;
1169 | onDragEnter?: DragEventHandler;
1170 | onDragExit?: DragEventHandler;
1171 | onDragLeave?: DragEventHandler;
1172 | onDragOver?: DragEventHandler;
1173 | onDragStart?: DragEventHandler;
1174 | onDrop?: DragEventHandler;
1175 | onMouseDown?: MouseEventHandler;
1176 | onMouseEnter?: MouseEventHandler;
1177 | onMouseLeave?: MouseEventHandler;
1178 | onMouseMove?: MouseEventHandler;
1179 | onMouseOut?: MouseEventHandler;
1180 | onMouseOver?: MouseEventHandler;
1181 | onMouseUp?: MouseEventHandler;
1182 | onTouchCancel?: TouchEventHandler;
1183 | onTouchEnd?: TouchEventHandler;
1184 | onTouchMove?: TouchEventHandler;
1185 | onTouchStart?: TouchEventHandler;
1186 | onScroll?: UIEventHandler;
1187 | onWheel?: WheelEventHandler;
1188 |
1189 | className?: string;
1190 | id?: string;
1191 |
1192 | dangerouslySetInnerHTML?: {
1193 | __html: string;
1194 | };
1195 | }
1196 |
1197 | interface DOMAttributes extends DOMAttributesBase> {
1198 | }
1199 |
1200 | // This interface is not complete. Only properties accepting
1201 | // unitless numbers are listed here (see CSSProperty.js in React)
1202 | interface CSSProperties {
1203 | boxFlex?: number;
1204 | boxFlexGroup?: number;
1205 | columnCount?: number;
1206 | flex?: number | string;
1207 | flexGrow?: number;
1208 | flexShrink?: number;
1209 | fontWeight?: number | string;
1210 | lineClamp?: number;
1211 | lineHeight?: number | string;
1212 | opacity?: number;
1213 | order?: number;
1214 | orphans?: number;
1215 | widows?: number;
1216 | zIndex?: number;
1217 | zoom?: number;
1218 |
1219 | fontSize?: number | string;
1220 |
1221 | // SVG-related properties
1222 | fillOpacity?: number;
1223 | strokeOpacity?: number;
1224 | strokeWidth?: number;
1225 |
1226 | [propertyName: string]: any;
1227 | }
1228 |
1229 | interface HTMLAttributesBase extends DOMAttributesBase {
1230 | accept?: string;
1231 | acceptCharset?: string;
1232 | accessKey?: string;
1233 | action?: string;
1234 | allowFullScreen?: boolean;
1235 | allowTransparency?: boolean;
1236 | alt?: string;
1237 | async?: boolean;
1238 | autoComplete?: boolean;
1239 | autoFocus?: boolean;
1240 | autoPlay?: boolean;
1241 | cellPadding?: number | string;
1242 | cellSpacing?: number | string;
1243 | charSet?: string;
1244 | checked?: boolean;
1245 | classID?: string;
1246 | cols?: number;
1247 | colSpan?: number;
1248 | content?: string;
1249 | contentEditable?: boolean;
1250 | contextMenu?: string;
1251 | controls?: any;
1252 | coords?: string;
1253 | crossOrigin?: string;
1254 | data?: string;
1255 | dateTime?: string;
1256 | defaultChecked?: boolean;
1257 | defaultValue?: string;
1258 | defer?: boolean;
1259 | dir?: string;
1260 | disabled?: boolean;
1261 | download?: any;
1262 | draggable?: boolean;
1263 | encType?: string;
1264 | form?: string;
1265 | formAction?: string;
1266 | formEncType?: string;
1267 | formMethod?: string;
1268 | formNoValidate?: boolean;
1269 | formTarget?: string;
1270 | frameBorder?: number | string;
1271 | headers?: string;
1272 | height?: number | string;
1273 | hidden?: boolean;
1274 | high?: number;
1275 | href?: string;
1276 | hrefLang?: string;
1277 | htmlFor?: string;
1278 | httpEquiv?: string;
1279 | icon?: string;
1280 | label?: string;
1281 | lang?: string;
1282 | list?: string;
1283 | loop?: boolean;
1284 | low?: number;
1285 | manifest?: string;
1286 | marginHeight?: number;
1287 | marginWidth?: number;
1288 | max?: number | string;
1289 | maxLength?: number;
1290 | media?: string;
1291 | mediaGroup?: string;
1292 | method?: string;
1293 | min?: number | string;
1294 | multiple?: boolean;
1295 | muted?: boolean;
1296 | name?: string;
1297 | noValidate?: boolean;
1298 | open?: boolean;
1299 | optimum?: number;
1300 | pattern?: string;
1301 | placeholder?: string;
1302 | poster?: string;
1303 | preload?: string;
1304 | radioGroup?: string;
1305 | readOnly?: boolean;
1306 | rel?: string;
1307 | required?: boolean;
1308 | role?: string;
1309 | rows?: number;
1310 | rowSpan?: number;
1311 | sandbox?: string;
1312 | scope?: string;
1313 | scoped?: boolean;
1314 | scrolling?: string;
1315 | seamless?: boolean;
1316 | selected?: boolean;
1317 | shape?: string;
1318 | size?: number;
1319 | sizes?: string;
1320 | span?: number;
1321 | spellCheck?: boolean;
1322 | src?: string;
1323 | srcDoc?: string;
1324 | srcSet?: string;
1325 | start?: number;
1326 | step?: number | string;
1327 | style?: CSSProperties;
1328 | tabIndex?: number;
1329 | target?: string;
1330 | title?: string;
1331 | type?: string;
1332 | useMap?: string;
1333 | value?: string;
1334 | width?: number | string;
1335 | wmode?: string;
1336 |
1337 | // Non-standard Attributes
1338 | autoCapitalize?: boolean;
1339 | autoCorrect?: boolean;
1340 | property?: string;
1341 | itemProp?: string;
1342 | itemScope?: boolean;
1343 | itemType?: string;
1344 | unselectable?: boolean;
1345 | }
1346 |
1347 | interface HTMLAttributes extends HTMLAttributesBase