UNPKG

yhtml5-test

Version:

A test framework for front-end projects

1,213 lines (1,026 loc) 160 kB
// Type definitions for React 15.6 // Project: http://facebook.github.io/react/ // Definitions by: Asana <https://asana.com> // AssureSign <http://www.assuresign.com> // Microsoft <https://microsoft.com> // John Reilly <https://github.com/johnnyreilly/> // Benoit Benezech <https://github.com/bbenezech> // Patricio Zavolinsky <https://github.com/pzavolinsky> // Digiguru <https://github.com/digiguru> // Eric Anderson <https://github.com/ericanderson> // Albert Kurniawan <https://github.com/morcerf> // Tanguy Krotoff <https://github.com/tkrotoff> // Dovydas Navickas <https://github.com/DovydasNavickas> // Stéphane Goetz <https://github.com/onigoetz> // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 /* Known Problems & Workarounds 1. The type of cloneElement is incorrect. cloneElement(element, props) should accept props object with a subset of properties on element.props. React attributes, such as key and ref, should also be accepted in props, but should not exist on element.props. The "correct" way to model this, then, is with: declare function cloneElement<P extends Q, Q>( element: ReactElement<P>, props?: Q & Attributes, ...children: ReactNode[]): ReactElement<P>; However, type inference for Q defaults to {} when intersected with another type. (https://github.com/Microsoft/TypeScript/pull/5738#issuecomment-181904905) And since any object is assignable to {}, we would lose the type safety of the P extends Q constraint. Therefore, the type of props is left as Q, which should work for most cases. If you need to call cloneElement with key or ref, you'll need a type cast: interface ButtonProps { label: string, isDisabled?: boolean; } var element: React.CElement<ButtonProps, Button>; React.cloneElement(element, { label: "label" }); // cloning with optional props requires a cast React.cloneElement(element, <{ isDisabled?: boolean }>{ isDisabled: true }); // cloning with key or ref requires a cast React.cloneElement(element, <React.ClassAttributes<Button>>{ ref: button => button.reset() }); React.cloneElement(element, <{ isDisabled?: boolean } & React.Attributes>{ key: "disabledButton", isDisabled: true }); */ type NativeAnimationEvent = AnimationEvent; type NativeClipboardEvent = ClipboardEvent; type NativeCompositionEvent = CompositionEvent; type NativeDragEvent = DragEvent; type NativeFocusEvent = FocusEvent; type NativeKeyboardEvent = KeyboardEvent; type NativeMouseEvent = MouseEvent; type NativeTouchEvent = TouchEvent; type NativeTransitionEvent = TransitionEvent; type NativeUIEvent = UIEvent; type NativeWheelEvent = WheelEvent; // tslint:disable-next-line:export-just-namespace export = React; export as namespace React; declare namespace React { // // React Elements // ---------------------------------------------------------------------- type ReactType = string | ComponentType<any>; type ComponentType<P = {}> = ComponentClass<P> | StatelessComponent<P>; type Key = string | number; type Ref<T> = string | ((instance: T | null) => any); // tslint:disable-next-line:interface-over-type-literal type ComponentState = {}; interface Attributes { key?: Key; } interface ClassAttributes<T> extends Attributes { ref?: Ref<T>; } interface ReactElement<P> { type: string | ComponentClass<P> | SFC<P>; props: P; key: Key | null; } interface SFCElement<P> extends ReactElement<P> { type: SFC<P>; } type CElement<P, T extends Component<P, ComponentState>> = ComponentElement<P, T>; interface ComponentElement<P, T extends Component<P, ComponentState>> extends ReactElement<P> { type: ComponentClass<P>; ref?: Ref<T>; } type ClassicElement<P> = CElement<P, ClassicComponent<P, ComponentState>>; // string fallback for custom web-components interface DOMElement<P extends HTMLAttributes<T> | SVGAttributes<T>, T extends Element> extends ReactElement<P> { type: string; ref: Ref<T>; } // ReactHTML for ReactHTMLElement // tslint:disable-next-line:no-empty-interface interface ReactHTMLElement<T extends HTMLElement> extends DetailedReactHTMLElement<AllHTMLAttributes<T>, T> { } interface DetailedReactHTMLElement<P extends HTMLAttributes<T>, T extends HTMLElement> extends DOMElement<P, T> { type: keyof ReactHTML; } // ReactSVG for ReactSVGElement interface ReactSVGElement extends DOMElement<SVGAttributes<SVGElement>, SVGElement> { type: keyof ReactSVG; } // // Factories // ---------------------------------------------------------------------- type Factory<P> = (props?: Attributes & P, ...children: ReactNode[]) => ReactElement<P>; type SFCFactory<P> = (props?: Attributes & P, ...children: ReactNode[]) => SFCElement<P>; type ComponentFactory<P, T extends Component<P, ComponentState>> = (props?: ClassAttributes<T> & P, ...children: ReactNode[]) => CElement<P, T>; type CFactory<P, T extends Component<P, ComponentState>> = ComponentFactory<P, T>; type ClassicFactory<P> = CFactory<P, ClassicComponent<P, ComponentState>>; type DOMFactory<P extends DOMAttributes<T>, T extends Element> = (props?: ClassAttributes<T> & P | null, ...children: ReactNode[]) => DOMElement<P, T>; // tslint:disable-next-line:no-empty-interface interface HTMLFactory<T extends HTMLElement> extends DetailedHTMLFactory<AllHTMLAttributes<T>, T> {} interface DetailedHTMLFactory<P extends HTMLAttributes<T>, T extends HTMLElement> extends DOMFactory<P, T> { (props?: ClassAttributes<T> & P | null, ...children: ReactNode[]): DetailedReactHTMLElement<P, T>; } interface SVGFactory extends DOMFactory<SVGAttributes<SVGElement>, SVGElement> { (props?: ClassAttributes<SVGElement> & SVGAttributes<SVGElement> | null, ...children: ReactNode[]): ReactSVGElement; } // // React Nodes // http://facebook.github.io/react/docs/glossary.html // ---------------------------------------------------------------------- type ReactText = string | number; type ReactChild = ReactElement<any> | ReactText; // Should be Array<ReactNode> but type aliases cannot be recursive type ReactFragment = {} | Array<ReactChild | any[] | boolean>; type ReactNode = ReactChild | ReactFragment | boolean | null | undefined; // // Top Level API // ---------------------------------------------------------------------- function createClass<P, S>(spec: ComponentSpec<P, S>): ClassicComponentClass<P>; // DOM Elements function createFactory<T extends HTMLElement>( type: keyof ReactHTML): HTMLFactory<T>; function createFactory( type: keyof ReactSVG): SVGFactory; function createFactory<P extends DOMAttributes<T>, T extends Element>( type: string): DOMFactory<P, T>; // Custom components function createFactory<P>(type: SFC<P>): SFCFactory<P>; function createFactory<P>( type: ClassType<P, ClassicComponent<P, ComponentState>, ClassicComponentClass<P>>): CFactory<P, ClassicComponent<P, ComponentState>>; function createFactory<P, T extends Component<P, ComponentState>, C extends ComponentClass<P>>( type: ClassType<P, T, C>): CFactory<P, T>; function createFactory<P>(type: ComponentClass<P>): Factory<P>; // DOM Elements // TODO: generalize this to everything in `keyof ReactHTML`, not just "input" function createElement( type: "input", props?: InputHTMLAttributes<HTMLInputElement> & ClassAttributes<HTMLInputElement>, ...children: ReactNode[]): DetailedReactHTMLElement<InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>; function createElement<P extends HTMLAttributes<T>, T extends HTMLElement>( type: keyof ReactHTML, props?: ClassAttributes<T> & P, ...children: ReactNode[]): DetailedReactHTMLElement<P, T>; function createElement<P extends SVGAttributes<T>, T extends SVGElement>( type: keyof ReactSVG, props?: ClassAttributes<T> & P, ...children: ReactNode[]): ReactSVGElement; function createElement<P extends DOMAttributes<T>, T extends Element>( type: string, props?: ClassAttributes<T> & P, ...children: ReactNode[]): DOMElement<P, T>; // Custom components function createElement<P>( type: SFC<P>, props?: Attributes & P, ...children: ReactNode[]): SFCElement<P>; function createElement<P>( type: ClassType<P, ClassicComponent<P, ComponentState>, ClassicComponentClass<P>>, props?: ClassAttributes<ClassicComponent<P, ComponentState>> & P, ...children: ReactNode[]): CElement<P, ClassicComponent<P, ComponentState>>; function createElement<P, T extends Component<P, ComponentState>, C extends ComponentClass<P>>( type: ClassType<P, T, C>, props?: ClassAttributes<T> & P, ...children: ReactNode[]): CElement<P, T>; function createElement<P>( type: SFC<P> | ComponentClass<P> | string, props?: Attributes & P, ...children: ReactNode[]): ReactElement<P>; // DOM Elements // ReactHTMLElement function cloneElement<P extends HTMLAttributes<T>, T extends HTMLElement>( element: DetailedReactHTMLElement<P, T>, props?: P, ...children: ReactNode[]): DetailedReactHTMLElement<P, T>; // ReactHTMLElement, less specific function cloneElement<P extends HTMLAttributes<T>, T extends HTMLElement>( element: ReactHTMLElement<T>, props?: P, ...children: ReactNode[]): ReactHTMLElement<T>; // SVGElement function cloneElement<P extends SVGAttributes<T>, T extends SVGElement>( element: ReactSVGElement, props?: P, ...children: ReactNode[]): ReactSVGElement; // DOM Element (has to be the last, because type checking stops at first overload that fits) function cloneElement<P extends DOMAttributes<T>, T extends Element>( element: DOMElement<P, T>, props?: DOMAttributes<T> & P, ...children: ReactNode[]): DOMElement<P, T>; // Custom components function cloneElement<P extends Q, Q>( element: SFCElement<P>, props?: Q, // should be Q & Attributes, but then Q is inferred as {} ...children: ReactNode[]): SFCElement<P>; function cloneElement<P extends Q, Q, T extends Component<P, ComponentState>>( element: CElement<P, T>, props?: Q, // should be Q & ClassAttributes<T> ...children: ReactNode[]): CElement<P, T>; function cloneElement<P extends Q, Q>( element: ReactElement<P>, props?: Q, // should be Q & Attributes ...children: ReactNode[]): ReactElement<P>; function isValidElement<P>(object: {}): object is ReactElement<P>; const DOM: ReactDOM; const PropTypes: ReactPropTypes; const Children: ReactChildren; const version: string; // // Component API // ---------------------------------------------------------------------- type ReactInstance = Component<any> | Element; // Base component for plain JS classes // tslint:disable-next-line:no-empty-interface interface Component<P = {}, S = {}> extends ComponentLifecycle<P, S> { } class Component<P, S> { constructor(props?: P, context?: any); // Disabling unified-signatures to have separate overloads. It's easier to understand this way. // tslint:disable:unified-signatures setState<K extends keyof S>(f: (prevState: S, props: P) => Pick<S, K>, callback?: () => any): void; setState<K extends keyof S>(state: Pick<S, K>, callback?: () => any): void; // tslint:enable:unified-signatures forceUpdate(callBack?: () => any): void; render(): JSX.Element | null | false; // React.Props<T> is now deprecated, which means that the `children` // property is not available on `P` by default, even though you can // always pass children as variadic arguments to `createElement`. // In the future, if we can define its call signature conditionally // on the existence of `children` in `P`, then we should remove this. props: Readonly<{ children?: ReactNode }> & Readonly<P>; state: Readonly<S>; context: any; refs: { [key: string]: ReactInstance }; } class PureComponent<P = {}, S = {}> extends Component<P, S> { } interface ClassicComponent<P = {}, S = {}> extends Component<P, S> { replaceState(nextState: S, callback?: () => any): void; isMounted(): boolean; getInitialState?(): S; } interface ChildContextProvider<CC> { getChildContext(): CC; } // // Class Interfaces // ---------------------------------------------------------------------- type SFC<P = {}> = StatelessComponent<P>; interface StatelessComponent<P = {}> { (props: P & { children?: ReactNode }, context?: any): ReactElement<any> | null; propTypes?: ValidationMap<P>; contextTypes?: ValidationMap<any>; defaultProps?: Partial<P>; displayName?: string; } interface ComponentClass<P = {}> { new (props?: P, context?: any): Component<P, ComponentState>; propTypes?: ValidationMap<P>; contextTypes?: ValidationMap<any>; childContextTypes?: ValidationMap<any>; defaultProps?: Partial<P>; displayName?: string; } interface ClassicComponentClass<P = {}> extends ComponentClass<P> { new (props?: P, context?: any): ClassicComponent<P, ComponentState>; getDefaultProps?(): P; } /** * We use an intersection type to infer multiple type parameters from * a single argument, which is useful for many top-level API defs. * See https://github.com/Microsoft/TypeScript/issues/7234 for more info. */ type ClassType<P, T extends Component<P, ComponentState>, C extends ComponentClass<P>> = C & (new (props?: P, context?: any) => T) & (new (props?: P, context?: any) => { props: P }); // // Component Specs and Lifecycle // ---------------------------------------------------------------------- interface ComponentLifecycle<P, S> { componentWillMount?(): void; componentDidMount?(): void; componentWillReceiveProps?(nextProps: Readonly<P>, nextContext: any): void; shouldComponentUpdate?(nextProps: Readonly<P>, nextState: Readonly<S>, nextContext: any): boolean; componentWillUpdate?(nextProps: Readonly<P>, nextState: Readonly<S>, nextContext: any): void; componentDidUpdate?(prevProps: Readonly<P>, prevState: Readonly<S>, prevContext: any): void; componentWillUnmount?(): void; } interface Mixin<P, S> extends ComponentLifecycle<P, S> { mixins?: Array<Mixin<P, S>>; statics?: { [key: string]: any; }; displayName?: string; propTypes?: ValidationMap<any>; contextTypes?: ValidationMap<any>; childContextTypes?: ValidationMap<any>; getDefaultProps?(): P; getInitialState?(): S; } interface ComponentSpec<P, S> extends Mixin<P, S> { render(): ReactElement<any> | null; [propertyName: string]: any; } // // Event System // ---------------------------------------------------------------------- interface SyntheticEvent<T> { bubbles: boolean; currentTarget: EventTarget & T; cancelable: boolean; defaultPrevented: boolean; eventPhase: number; isTrusted: boolean; nativeEvent: Event; preventDefault(): void; isDefaultPrevented(): boolean; stopPropagation(): void; isPropagationStopped(): boolean; persist(): void; // If you thought this should be `EventTarget & T`, see https://github.com/DefinitelyTyped/DefinitelyTyped/pull/12239 target: EventTarget; timeStamp: number; type: string; } interface ClipboardEvent<T> extends SyntheticEvent<T> { clipboardData: DataTransfer; nativeEvent: NativeClipboardEvent; } interface CompositionEvent<T> extends SyntheticEvent<T> { data: string; nativeEvent: NativeCompositionEvent; } interface DragEvent<T> extends MouseEvent<T> { dataTransfer: DataTransfer; nativeEvent: NativeDragEvent; } interface FocusEvent<T> extends SyntheticEvent<T> { nativeEvent: NativeFocusEvent; relatedTarget: EventTarget; } // tslint:disable-next-line:no-empty-interface interface FormEvent<T> extends SyntheticEvent<T> { } interface InvalidEvent<T> extends SyntheticEvent<T> { target: EventTarget & T; } interface ChangeEvent<T> extends SyntheticEvent<T> { target: EventTarget & T; } interface KeyboardEvent<T> extends SyntheticEvent<T> { altKey: boolean; charCode: number; ctrlKey: boolean; getModifierState(key: string): boolean; key: string; keyCode: number; locale: string; location: number; metaKey: boolean; nativeEvent: NativeKeyboardEvent; repeat: boolean; shiftKey: boolean; which: number; } interface MouseEvent<T> extends SyntheticEvent<T> { altKey: boolean; button: number; buttons: number; clientX: number; clientY: number; ctrlKey: boolean; getModifierState(key: string): boolean; metaKey: boolean; nativeEvent: NativeMouseEvent; pageX: number; pageY: number; relatedTarget: EventTarget; screenX: number; screenY: number; shiftKey: boolean; } interface TouchEvent<T> extends SyntheticEvent<T> { altKey: boolean; changedTouches: TouchList; ctrlKey: boolean; getModifierState(key: string): boolean; metaKey: boolean; nativeEvent: NativeTouchEvent; shiftKey: boolean; targetTouches: TouchList; touches: TouchList; } interface UIEvent<T> extends SyntheticEvent<T> { detail: number; nativeEvent: NativeUIEvent; view: AbstractView; } interface WheelEvent<T> extends MouseEvent<T> { deltaMode: number; deltaX: number; deltaY: number; deltaZ: number; nativeEvent: NativeWheelEvent; } interface AnimationEvent<T> extends SyntheticEvent<T> { animationName: string; elapsedTime: number; nativeEvent: NativeAnimationEvent; pseudoElement: string; } interface TransitionEvent<T> extends SyntheticEvent<T> { elapsedTime: number; nativeEvent: NativeTransitionEvent; propertyName: string; pseudoElement: string; } // // Event Handler Types // ---------------------------------------------------------------------- type EventHandler<E extends SyntheticEvent<any>> = (event: E) => void; type ReactEventHandler<T> = EventHandler<SyntheticEvent<T>>; type ClipboardEventHandler<T> = EventHandler<ClipboardEvent<T>>; type CompositionEventHandler<T> = EventHandler<CompositionEvent<T>>; type DragEventHandler<T> = EventHandler<DragEvent<T>>; type FocusEventHandler<T> = EventHandler<FocusEvent<T>>; type FormEventHandler<T> = EventHandler<FormEvent<T>>; type ChangeEventHandler<T> = EventHandler<ChangeEvent<T>>; type KeyboardEventHandler<T> = EventHandler<KeyboardEvent<T>>; type MouseEventHandler<T> = EventHandler<MouseEvent<T>>; type TouchEventHandler<T> = EventHandler<TouchEvent<T>>; type UIEventHandler<T> = EventHandler<UIEvent<T>>; type WheelEventHandler<T> = EventHandler<WheelEvent<T>>; type AnimationEventHandler<T> = EventHandler<AnimationEvent<T>>; type TransitionEventHandler<T> = EventHandler<TransitionEvent<T>>; // // Props / DOM Attributes // ---------------------------------------------------------------------- /** * @deprecated. This was used to allow clients to pass `ref` and `key` * to `createElement`, which is no longer necessary due to intersection * types. If you need to declare a props object before passing it to * `createElement` or a factory, use `ClassAttributes<T>`: * * ```ts * var b: Button | null; * var props: ButtonProps & ClassAttributes<Button> = { * ref: b => button = b, // ok! * label: "I'm a Button" * }; * ``` */ interface Props<T> { children?: ReactNode; key?: Key; ref?: Ref<T>; } interface HTMLProps<T> extends AllHTMLAttributes<T>, ClassAttributes<T> { } type DetailedHTMLProps<E extends HTMLAttributes<T>, T> = ClassAttributes<T> & E; interface SVGProps<T> extends SVGAttributes<T>, ClassAttributes<T> { } interface DOMAttributes<T> { children?: ReactNode; dangerouslySetInnerHTML?: { __html: string; }; // Clipboard Events onCopy?: ClipboardEventHandler<T>; onCopyCapture?: ClipboardEventHandler<T>; onCut?: ClipboardEventHandler<T>; onCutCapture?: ClipboardEventHandler<T>; onPaste?: ClipboardEventHandler<T>; onPasteCapture?: ClipboardEventHandler<T>; // Composition Events onCompositionEnd?: CompositionEventHandler<T>; onCompositionEndCapture?: CompositionEventHandler<T>; onCompositionStart?: CompositionEventHandler<T>; onCompositionStartCapture?: CompositionEventHandler<T>; onCompositionUpdate?: CompositionEventHandler<T>; onCompositionUpdateCapture?: CompositionEventHandler<T>; // Focus Events onFocus?: FocusEventHandler<T>; onFocusCapture?: FocusEventHandler<T>; onBlur?: FocusEventHandler<T>; onBlurCapture?: FocusEventHandler<T>; // Form Events onChange?: FormEventHandler<T>; onChangeCapture?: FormEventHandler<T>; onInput?: FormEventHandler<T>; onInputCapture?: FormEventHandler<T>; onReset?: FormEventHandler<T>; onResetCapture?: FormEventHandler<T>; onSubmit?: FormEventHandler<T>; onSubmitCapture?: FormEventHandler<T>; onInvalid?: FormEventHandler<T>; onInvalidCapture?: FormEventHandler<T>; // Image Events onLoad?: ReactEventHandler<T>; onLoadCapture?: ReactEventHandler<T>; onError?: ReactEventHandler<T>; // also a Media Event onErrorCapture?: ReactEventHandler<T>; // also a Media Event // Keyboard Events onKeyDown?: KeyboardEventHandler<T>; onKeyDownCapture?: KeyboardEventHandler<T>; onKeyPress?: KeyboardEventHandler<T>; onKeyPressCapture?: KeyboardEventHandler<T>; onKeyUp?: KeyboardEventHandler<T>; onKeyUpCapture?: KeyboardEventHandler<T>; // Media Events onAbort?: ReactEventHandler<T>; onAbortCapture?: ReactEventHandler<T>; onCanPlay?: ReactEventHandler<T>; onCanPlayCapture?: ReactEventHandler<T>; onCanPlayThrough?: ReactEventHandler<T>; onCanPlayThroughCapture?: ReactEventHandler<T>; onDurationChange?: ReactEventHandler<T>; onDurationChangeCapture?: ReactEventHandler<T>; onEmptied?: ReactEventHandler<T>; onEmptiedCapture?: ReactEventHandler<T>; onEncrypted?: ReactEventHandler<T>; onEncryptedCapture?: ReactEventHandler<T>; onEnded?: ReactEventHandler<T>; onEndedCapture?: ReactEventHandler<T>; onLoadedData?: ReactEventHandler<T>; onLoadedDataCapture?: ReactEventHandler<T>; onLoadedMetadata?: ReactEventHandler<T>; onLoadedMetadataCapture?: ReactEventHandler<T>; onLoadStart?: ReactEventHandler<T>; onLoadStartCapture?: ReactEventHandler<T>; onPause?: ReactEventHandler<T>; onPauseCapture?: ReactEventHandler<T>; onPlay?: ReactEventHandler<T>; onPlayCapture?: ReactEventHandler<T>; onPlaying?: ReactEventHandler<T>; onPlayingCapture?: ReactEventHandler<T>; onProgress?: ReactEventHandler<T>; onProgressCapture?: ReactEventHandler<T>; onRateChange?: ReactEventHandler<T>; onRateChangeCapture?: ReactEventHandler<T>; onSeeked?: ReactEventHandler<T>; onSeekedCapture?: ReactEventHandler<T>; onSeeking?: ReactEventHandler<T>; onSeekingCapture?: ReactEventHandler<T>; onStalled?: ReactEventHandler<T>; onStalledCapture?: ReactEventHandler<T>; onSuspend?: ReactEventHandler<T>; onSuspendCapture?: ReactEventHandler<T>; onTimeUpdate?: ReactEventHandler<T>; onTimeUpdateCapture?: ReactEventHandler<T>; onVolumeChange?: ReactEventHandler<T>; onVolumeChangeCapture?: ReactEventHandler<T>; onWaiting?: ReactEventHandler<T>; onWaitingCapture?: ReactEventHandler<T>; // MouseEvents onClick?: MouseEventHandler<T>; onClickCapture?: MouseEventHandler<T>; onContextMenu?: MouseEventHandler<T>; onContextMenuCapture?: MouseEventHandler<T>; onDoubleClick?: MouseEventHandler<T>; onDoubleClickCapture?: MouseEventHandler<T>; onDrag?: DragEventHandler<T>; onDragCapture?: DragEventHandler<T>; onDragEnd?: DragEventHandler<T>; onDragEndCapture?: DragEventHandler<T>; onDragEnter?: DragEventHandler<T>; onDragEnterCapture?: DragEventHandler<T>; onDragExit?: DragEventHandler<T>; onDragExitCapture?: DragEventHandler<T>; onDragLeave?: DragEventHandler<T>; onDragLeaveCapture?: DragEventHandler<T>; onDragOver?: DragEventHandler<T>; onDragOverCapture?: DragEventHandler<T>; onDragStart?: DragEventHandler<T>; onDragStartCapture?: DragEventHandler<T>; onDrop?: DragEventHandler<T>; onDropCapture?: DragEventHandler<T>; onMouseDown?: MouseEventHandler<T>; onMouseDownCapture?: MouseEventHandler<T>; onMouseEnter?: MouseEventHandler<T>; onMouseLeave?: MouseEventHandler<T>; onMouseMove?: MouseEventHandler<T>; onMouseMoveCapture?: MouseEventHandler<T>; onMouseOut?: MouseEventHandler<T>; onMouseOutCapture?: MouseEventHandler<T>; onMouseOver?: MouseEventHandler<T>; onMouseOverCapture?: MouseEventHandler<T>; onMouseUp?: MouseEventHandler<T>; onMouseUpCapture?: MouseEventHandler<T>; // Selection Events onSelect?: ReactEventHandler<T>; onSelectCapture?: ReactEventHandler<T>; // Touch Events onTouchCancel?: TouchEventHandler<T>; onTouchCancelCapture?: TouchEventHandler<T>; onTouchEnd?: TouchEventHandler<T>; onTouchEndCapture?: TouchEventHandler<T>; onTouchMove?: TouchEventHandler<T>; onTouchMoveCapture?: TouchEventHandler<T>; onTouchStart?: TouchEventHandler<T>; onTouchStartCapture?: TouchEventHandler<T>; // UI Events onScroll?: UIEventHandler<T>; onScrollCapture?: UIEventHandler<T>; // Wheel Events onWheel?: WheelEventHandler<T>; onWheelCapture?: WheelEventHandler<T>; // Animation Events onAnimationStart?: AnimationEventHandler<T>; onAnimationStartCapture?: AnimationEventHandler<T>; onAnimationEnd?: AnimationEventHandler<T>; onAnimationEndCapture?: AnimationEventHandler<T>; onAnimationIteration?: AnimationEventHandler<T>; onAnimationIterationCapture?: AnimationEventHandler<T>; // Transition Events onTransitionEnd?: TransitionEventHandler<T>; onTransitionEndCapture?: TransitionEventHandler<T>; } // See CSS 3 CSS-wide keywords https://www.w3.org/TR/css3-values/#common-keywords // See CSS 3 Explicit Defaulting https://www.w3.org/TR/css-cascade-3/#defaulting-keywords // "all CSS properties can accept these values" type CSSWideKeyword = "initial" | "inherit" | "unset"; // See CSS 3 <percentage> type https://drafts.csswg.org/css-values-3/#percentages type CSSPercentage = string; // See CSS 3 <length> type https://drafts.csswg.org/css-values-3/#lengths type CSSLength = number | string; // This interface is not complete. Only properties accepting // unitless numbers are listed here (see CSSProperty.js in React) interface CSSProperties { /** * Aligns a flex container's lines within the flex container when there is extra space in the cross-axis, similar to how justify-content aligns individual items within the main-axis. */ alignContent?: CSSWideKeyword | "flex-start" | "flex-end" | "center" | "space-between" | "space-around" | "stretch"; /** * Sets the default alignment in the cross axis for all of the flex container's items, including anonymous flex items, similarly to how justify-content aligns items along the main axis. */ alignItems?: CSSWideKeyword | "flex-start" | "flex-end" | "center" | "baseline" | "stretch"; /** * Allows the default alignment to be overridden for individual flex items. */ alignSelf?: CSSWideKeyword | "auto" | "flex-start" | "flex-end" | "center" | "baseline" | "stretch"; /** * This property allows precise alignment of elements, such as graphics, * that do not have a baseline-table or lack the desired baseline in their baseline-table. * With the alignment-adjust property, the position of the baseline identified by the alignment-baseline * can be explicitly determined. It also determines precisely the alignment point for each glyph within a textual element. */ alignmentAdjust?: CSSWideKeyword | any; alignmentBaseline?: CSSWideKeyword | any; /** * Defines a length of time to elapse before an animation starts, allowing an animation to begin execution some time after it is applied. */ animationDelay?: CSSWideKeyword | any; /** * Defines whether an animation should run in reverse on some or all cycles. */ animationDirection?: CSSWideKeyword | any; /** * Specifies how many times an animation cycle should play. */ animationIterationCount?: CSSWideKeyword | any; /** * Defines the list of animations that apply to the element. */ animationName?: CSSWideKeyword | any; /** * Defines whether an animation is running or paused. */ animationPlayState?: CSSWideKeyword | any; /** * Allows changing the style of any element to platform-based interface elements or vice versa. */ appearance?: CSSWideKeyword | any; /** * Determines whether or not the “back” side of a transformed element is visible when facing the viewer. */ backfaceVisibility?: CSSWideKeyword | any; /** * Shorthand property to set the values for one or more of: * background-clip, background-color, background-image, * background-origin, background-position, background-repeat, * background-size, and background-attachment. */ background?: CSSWideKeyword | any; /** * If a background-image is specified, this property determines * whether that image's position is fixed within the viewport, * or scrolls along with its containing block. * See CSS 3 background-attachment property https://drafts.csswg.org/css-backgrounds-3/#the-background-attachment */ backgroundAttachment?: CSSWideKeyword | "scroll" | "fixed" | "local"; /** * This property describes how the element's background images should blend with each other and the element's background color. * The value is a list of blend modes that corresponds to each background image. Each element in the list will apply to the * corresponding element of background-image. If a property doesn’t have enough comma-separated values to match the number of layers, * the UA must calculate its used value by repeating the list of values until there are enough. */ backgroundBlendMode?: CSSWideKeyword | any; /** * Sets the background color of an element. */ backgroundColor?: CSSWideKeyword | any; backgroundComposite?: CSSWideKeyword | any; /** * Applies one or more background images to an element. These can be any valid CSS image, including url() paths to image files or CSS gradients. */ backgroundImage?: CSSWideKeyword | any; /** * Specifies what the background-position property is relative to. */ backgroundOrigin?: CSSWideKeyword | any; /** * Sets the position of a background image. */ backgroundPosition?: CSSWideKeyword | any; /** * Background-repeat defines if and how background images will be repeated after they have been sized and positioned */ backgroundRepeat?: CSSWideKeyword | any; /** * Obsolete - spec retired, not implemented. */ baselineShift?: CSSWideKeyword | any; /** * Non standard. Sets or retrieves the location of the Dynamic HTML (DHTML) behavior. */ behavior?: CSSWideKeyword | any; /** * Shorthand property that defines the different properties of all four sides of an element's border in a single declaration. * It can be used to set border-width, border-style and border-color, or a subset of these. */ border?: CSSWideKeyword | any; /** * Shorthand that sets the values of border-bottom-color, * border-bottom-style, and border-bottom-width. */ borderBottom?: CSSWideKeyword | any; /** * Sets the color of the bottom border of an element. */ borderBottomColor?: CSSWideKeyword | any; /** * Defines the shape of the border of the bottom-left corner. */ borderBottomLeftRadius?: CSSWideKeyword | any; /** * Defines the shape of the border of the bottom-right corner. */ borderBottomRightRadius?: CSSWideKeyword | any; /** * Sets the line style of the bottom border of a box. */ borderBottomStyle?: CSSWideKeyword | any; /** * Sets the width of an element's bottom border. To set all four borders, * use the border-width shorthand property which sets the values simultaneously for border-top-width, * border-right-width, border-bottom-width, and border-left-width. */ borderBottomWidth?: CSSWideKeyword | any; /** * Border-collapse can be used for collapsing the borders between table cells */ borderCollapse?: CSSWideKeyword | any; /** * The CSS border-color property sets the color of an element's four borders. * This property can have from one to four values, made up of the elementary properties: * • border-top-color * • border-right-color * • border-bottom-color * • border-left-color The default color is the currentColor of each of these values. * If you provide one value, it sets the color for the element. Two values set the horizontal and vertical values, * respectively. Providing three values sets the top, vertical, and bottom values, in that order. * Four values set all for sides: top, right, bottom, and left, in that order. */ borderColor?: CSSWideKeyword | any; /** * Specifies different corner clipping effects, such as scoop (inner curves), bevel (straight cuts) or notch (cut-off rectangles). * Works along with border-radius to specify the size of each corner effect. */ borderCornerShape?: CSSWideKeyword | any; /** * The property border-image-source is used to set the image to be used instead of the border style. * If this is set to none the border-style is used instead. */ borderImageSource?: CSSWideKeyword | any; /** * The border-image-width CSS property defines the offset to use for dividing the border image in nine parts, * the top-left corner, central top edge, top-right-corner, central right edge, bottom-right corner, central bottom edge, * bottom-left corner, and central right edge. They represent inward distance from the top, right, bottom, and left edges. */ borderImageWidth?: CSSWideKeyword | any; /** * Shorthand property that defines the border-width, border-style and border-color of an element's left border in a single declaration. * Note that you can use the corresponding longhand properties to set specific individual properties of the left border — border-left-width, * border-left-style and border-left-color. */ borderLeft?: CSSWideKeyword | any; /** * The CSS border-left-color property sets the color of an element's left border. This page explains the border-left-color value, * but often you will find it more convenient to fix the border's left color as part of a shorthand set, either border-left or border-color. * Colors can be defined several ways. For more information, see Usage. */ borderLeftColor?: CSSWideKeyword | any; /** * Sets the style of an element's left border. To set all four borders, use the shorthand property, border-style. * Otherwise, you can set the borders individually with border-top-style, border-right-style, border-bottom-style, border-left-style. */ borderLeftStyle?: CSSWideKeyword | any; /** * Sets the width of an element's left border. To set all four borders, * use the border-width shorthand property which sets the values simultaneously for border-top-width, * border-right-width, border-bottom-width, and border-left-width. */ borderLeftWidth?: CSSWideKeyword | any; /** * Shorthand property that defines the border-width, border-style and border-color of an element's right border * in a single declaration. Note that you can use the corresponding longhand properties to set specific * individual properties of the right border — border-right-width, border-right-style and border-right-color. */ borderRight?: CSSWideKeyword | any; /** * Sets the color of an element's right border. This page explains the border-right-color value, * but often you will find it more convenient to fix the border's right color as part of a shorthand set, * either border-right or border-color. * Colors can be defined several ways. For more information, see Usage. */ borderRightColor?: CSSWideKeyword | any; /** * Sets the style of an element's right border. To set all four borders, use the shorthand property, * border-style. Otherwise, you can set the borders individually with border-top-style, border-right-style, * border-bottom-style, border-left-style. */ borderRightStyle?: CSSWideKeyword | any; /** * Sets the width of an element's right border. To set all four borders, * use the border-width shorthand property which sets the values simultaneously for border-top-width, * border-right-width, border-bottom-width, and border-left-width. */ borderRightWidth?: CSSWideKeyword | any; /** * Specifies the distance between the borders of adjacent cells. */ borderSpacing?: CSSWideKeyword | any; /** * Sets the style of an element's four borders. This property can have from one to four values. * With only one value, the value will be applied to all four borders; * otherwise, this works as a shorthand property for each of border-top-style, border-right-style, * border-bottom-style, border-left-style, where each border style may be assigned a separate value. */ borderStyle?: CSSWideKeyword | any; /** * Shorthand property that defines the border-width, border-style and border-color of an element's top border * in a single declaration. Note that you can use the corresponding longhand properties to set specific * individual properties of the top border — border-top-width, border-top-style and border-top-color. */ borderTop?: CSSWideKeyword | any; /** * Sets the color of an element's top border. This page explains the border-top-color value, * but often you will find it more convenient to fix the border's top color as part of a shorthand set, * either border-top or border-color. * Colors can be defined several ways. For more information, see Usage. */ borderTopColor?: CSSWideKeyword | any; /** * Sets the rounding of the top-left corner of the element. */ borderTopLeftRadius?: CSSWideKeyword | any; /** * Sets the rounding of the top-right corner of the element. */ borderTopRightRadius?: CSSWideKeyword | any; /** * Sets the style of an element's top border. To set all four borders, use the shorthand property, border-style. * Otherwise, you can set the borders individually with border-top-style, border-right-style, border-bottom-style, border-left-style. */ borderTopStyle?: CSSWideKeyword | any; /** * Sets the width of an element's top border. To set all four borders, * use the border-width shorthand property which sets the values simultaneously for border-top-width, * border-right-width, border-bottom-width, and border-left-width. */ borderTopWidth?: CSSWideKeyword | any; /** * Sets the width of an element's four borders. This property can have from one to four values. * This is a shorthand property for setting values simultaneously for border-top-width, * border-right-width, border-bottom-width, and border-left-width. */ borderWidth?: CSSWideKeyword | any; /** * This property specifies how far an absolutely positioned box's bottom margin edge * is offset above the bottom edge of the box's containing block. For relatively positioned boxes, * the offset is with respect to the bottom edges of the box itself * (i.e., the box is given a position in the normal flow, then offset from that position according to these properties). */ bottom?: CSSWideKeyword | any; /** * Obsolete. */ boxAlign?: CSSWideKeyword | any; /** * Breaks a box into fragments creating new borders, * padding and repeating backgrounds or lets it stay as a continuous box on a page break, * column break, or, for inline elements, at a line break. */ boxDecorationBreak?: CSSWideKeyword | any; /** * Deprecated */ boxDirection?: CSSWideKeyword | any; /** * Do not use. This property has been replaced by the flex-wrap property. * Gets or sets a value that specifies the direction to add successive rows or columns when the value of box-lines is set to multiple. */ boxLineProgression?: CSSWideKeyword | any; /** * Do not use. This property has been replaced by the flex-wrap property. * Gets or sets a value that specifies whether child elements wrap onto multiple lines or columns based on the space available in the object. */ boxLines?: CSSWideKeyword | any; /** * Do not use. This property has been replaced by flex-order. * Specifies the ordinal group that a child element of the object belongs to. * This ordinal value identifies the display order (along the axis defined by the box-orient property) for the group. */ boxOrdinalGroup?: CSSWideKeyword | any; /** * Deprecated. */ boxFlex?: CSSWideKeyword | number; /** * Deprecated. */ boxFlexGroup?: CSSWideKeyword | number; /** * Cast a drop shadow from the frame of almost any element. * MDN: https://developer.mozilla.org/en-US/docs/Web/CSS/box-shadow */ boxShadow?: CSSWideKeyword | any; /** * The CSS break-after property allows you to force a break on multi-column layouts. * More specifically, it allows you to force a break after an element. * It allows you to determine if a break should occur, and what type of break it should be. * The break-after CSS property describes how the page, column or region break behaves after the generated box. * If there is no generated box, the property is ignored. */ breakAfter?: CSSWideKeyword | any; /** * Control page/column/region breaks that fall above a block of content */ breakBefore?: CSSWideKeyword | any; /** * Control page/column/region breaks that fall within a block of content */ breakInside?: CSSWideKeyword | any; /** * The clear CSS property specifies if an element can be positioned next to * or must be positioned below the floating elements that precede it in the markup. */ clear?: CSSWideKeyword | any; /** * Deprecated; see clip-path. * Lets you specify the dimensions of an absolutely positioned element that should be visible, * and the element is clipped into this shape, and displayed. */ clip?: CSSWideKeyword | any; /** * Clipping crops an graphic, so that only a portion of the graphic is rendered, or filled. * This clip-rule property, when used with the clip-path property, defines which clip rule, or algorithm, * to use when filling the different parts of a graphics. */ clipRule?: CSSWideKeyword | any; /** * The color property sets the color of an element's foreground content (usually text), * accepting any standard CSS color from keywords and hex values to RGB(a) and HSL(a). */ color?: CSSWideKeyword | any; /** * Describes the number of columns of the element. * See CSS 3 column-count property https://www.w3.org/TR/css3-multicol/#cc */ columnCount?: CSSWideKeyword | number | "auto"; /** * Specifies how to fill columns (balanced or sequential). */ columnFill?: CSSWideKeyword | any; /** * The column-gap property controls the width of the gap between columns in multi-column elements. */ columnGap?: CSSWideKeyword | any; /** * Sets the width, style, and color of the rule between columns. */ columnRule?: CSSWideKeyword | any; /** * Specifies the color of the rule between columns. */ columnRuleColor?: CSSWideKeyword | any; /** * Specifies the width of the rule between columns. */ columnRuleWidth?: CSSWideKeyword | any; /** * The column-span CSS property makes it possible for an element to span across all columns when its value is set to all. * An element that spans more than one column is called a spanning element. */ columnSpan?: CSSWideKeyword | any; /** * Specifies the width of col