mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-12-03 11:41:44 +00:00
Convert react-router
This commit is contained in:
@@ -1,132 +0,0 @@
|
||||
|
||||
|
||||
import { createHistory, createLocation, useBeforeUnload, useQueries, useBasename } from 'history'
|
||||
import { getUserConfirmation } from 'history/lib/DOMUtils'
|
||||
|
||||
interface Promise<T> {
|
||||
then<TResult>(onfulfilled?: (value: T) => TResult): Promise<TResult>;
|
||||
}
|
||||
|
||||
let doSomethingAsync: () => Promise<Function>;
|
||||
let input = { value: "" };
|
||||
|
||||
{
|
||||
let history = createHistory()
|
||||
|
||||
// Listen for changes to the current location. The
|
||||
// listener is called once immediately.
|
||||
let unlisten = history.listen(function(location) {
|
||||
console.log(location.pathname)
|
||||
})
|
||||
|
||||
// When you're finished, stop the listener.
|
||||
unlisten()
|
||||
|
||||
// Push a new entry onto the history stack.
|
||||
history.push('/home')
|
||||
|
||||
// Replace the current entry on the history stack.
|
||||
history.replace('/profile')
|
||||
|
||||
// Push a new entry with state onto the history stack.
|
||||
history.push({
|
||||
pathname: '/about',
|
||||
search: '?the=search',
|
||||
state: { some: 'state' }
|
||||
});
|
||||
|
||||
// Change just the search on an existing location.
|
||||
//history.push({ ...location, search: '?the=other+search' })
|
||||
|
||||
// Go back to the previous history entry. The following
|
||||
// two lines are synonymous.
|
||||
history.go(-1)
|
||||
history.goBack()
|
||||
|
||||
let href = history.createHref('/the/path')
|
||||
}
|
||||
|
||||
{
|
||||
let history = createHistory()
|
||||
|
||||
// Pushing a path string.
|
||||
history.push('/the/path')
|
||||
|
||||
// Omitting location state when pushing a location descriptor.
|
||||
history.push({ pathname: '/the/path', search: '?the=search' })
|
||||
|
||||
// Extending an existing location object.
|
||||
//history.push({ ...location, search: '?other=search' })
|
||||
|
||||
let location = createLocation('/a/path?a=query', { the: 'state' })
|
||||
|
||||
location = history.createLocation('/a/path?a=query', { the: 'state' })
|
||||
}
|
||||
|
||||
{
|
||||
let history = createHistory()
|
||||
history.listenBefore(function(location) {
|
||||
if (input.value !== '')
|
||||
return 'Are you sure you want to leave this page?'
|
||||
})
|
||||
|
||||
history.listenBefore(function(location, callback) {
|
||||
doSomethingAsync().then(callback)
|
||||
})
|
||||
}
|
||||
|
||||
{
|
||||
let history = createHistory({
|
||||
getUserConfirmation(message, callback) {
|
||||
callback(window.confirm(message)) // The default behavior
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
{
|
||||
let history = useBeforeUnload(createHistory)()
|
||||
|
||||
history.listenBeforeUnload(function() {
|
||||
return 'Are you sure you want to leave this page?'
|
||||
})
|
||||
}
|
||||
|
||||
{
|
||||
let history = useQueries(createHistory)()
|
||||
|
||||
history.listen(function(location) {
|
||||
console.log(location.query)
|
||||
})
|
||||
}
|
||||
|
||||
{
|
||||
let history = useQueries(createHistory)({
|
||||
parseQueryString: function(queryString) {
|
||||
// TODO: return a parsed version of queryString
|
||||
return {};
|
||||
},
|
||||
stringifyQuery: function(query) {
|
||||
// TODO: return a query string created from query
|
||||
return "";
|
||||
}
|
||||
})
|
||||
|
||||
history.createPath({ pathname: '/the/path', query: { the: 'query' } })
|
||||
history.push({ pathname: '/the/path', query: { the: 'query' } })
|
||||
}
|
||||
|
||||
{
|
||||
// Run our app under the /base URL.
|
||||
let history = useBasename(createHistory)({
|
||||
basename: '/base'
|
||||
})
|
||||
|
||||
// At the /base/hello/world URL:
|
||||
history.listen(function(location) {
|
||||
console.log(location.pathname) // /hello/world
|
||||
console.log(location.basename) // /base
|
||||
})
|
||||
|
||||
history.createPath('/the/path') // /base/the/path
|
||||
history.push('/the/path') // push /base/the/path
|
||||
}
|
||||
Vendored
-233
@@ -1,233 +0,0 @@
|
||||
// Type definitions for history v2.0.0
|
||||
// Project: https://github.com/rackt/history
|
||||
// Definitions by: Sergey Buturlakin <https://github.com/sergey-buturlakin>, Nathan Brown <https://github.com/ngbrown>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
|
||||
declare namespace HistoryModule {
|
||||
|
||||
// types based on https://github.com/rackt/history/blob/master/docs/Terms.md
|
||||
|
||||
type Action = string
|
||||
|
||||
type BeforeUnloadHook = () => string | boolean
|
||||
|
||||
type CreateHistory<T> = (options?: HistoryOptions) => T
|
||||
|
||||
type CreateHistoryEnhancer<T, E> = (createHistory: CreateHistory<T>) => CreateHistory<T & E>
|
||||
|
||||
interface History {
|
||||
listenBefore(hook: TransitionHook): () => void
|
||||
listen(listener: LocationListener): () => void
|
||||
transitionTo(location: Location): void
|
||||
push(path: LocationDescriptor): void
|
||||
replace(path: LocationDescriptor): void
|
||||
go(n: number): void
|
||||
goBack(): void
|
||||
goForward(): void
|
||||
createKey(): LocationKey
|
||||
createPath(path: LocationDescriptor): Path
|
||||
createHref(path: LocationDescriptor): Href
|
||||
createLocation(path?: LocationDescriptor, action?: Action, key?: LocationKey): Location
|
||||
|
||||
/** @deprecated use a location descriptor instead */
|
||||
createLocation(path?: Path, state?: LocationState, action?: Action, key?: LocationKey): Location
|
||||
/** @deprecated use location.key to save state instead */
|
||||
pushState(state: LocationState, path: Path): void
|
||||
/** @deprecated use location.key to save state instead */
|
||||
replaceState(state: LocationState, path: Path): void
|
||||
/** @deprecated use location.key to save state instead */
|
||||
setState(state: LocationState): void
|
||||
/** @deprecated use listenBefore instead */
|
||||
registerTransitionHook(hook: TransitionHook): void
|
||||
/** @deprecated use the callback returned from listenBefore instead */
|
||||
unregisterTransitionHook(hook: TransitionHook): void
|
||||
}
|
||||
|
||||
type HistoryOptions = {
|
||||
getCurrentLocation?: () => Location
|
||||
finishTransition?: (nextLocation: Location) => boolean
|
||||
saveState?: (key: LocationKey, state: LocationState) => void
|
||||
go?: (n: number) => void
|
||||
getUserConfirmation?: (message: string, callback: (result: boolean) => void) => void
|
||||
keyLength?: number
|
||||
queryKey?: string | boolean
|
||||
stringifyQuery?: (obj: any) => string
|
||||
parseQueryString?: (str: string) => any
|
||||
basename?: string
|
||||
entries?: string | [any]
|
||||
current?: number
|
||||
}
|
||||
|
||||
type Href = string
|
||||
|
||||
type Location = {
|
||||
pathname: Pathname
|
||||
search: Search
|
||||
query: Query
|
||||
state: LocationState
|
||||
action: Action
|
||||
key: LocationKey
|
||||
basename?: string
|
||||
}
|
||||
|
||||
type LocationDescriptorObject = {
|
||||
pathname?: Pathname
|
||||
search?: Search
|
||||
query?: Query
|
||||
state?: LocationState
|
||||
}
|
||||
|
||||
type LocationDescriptor = LocationDescriptorObject | Path
|
||||
|
||||
type LocationKey = string
|
||||
|
||||
type LocationListener = (location: Location) => void
|
||||
|
||||
type LocationState = Object
|
||||
|
||||
type Path = string // Pathname + QueryString
|
||||
|
||||
type Pathname = string
|
||||
|
||||
type Query = Object
|
||||
|
||||
type QueryString = string
|
||||
|
||||
type Search = string
|
||||
|
||||
type TransitionHook = (location: Location, callback: (result: any) => void) => any
|
||||
|
||||
|
||||
interface HistoryBeforeUnload {
|
||||
listenBeforeUnload(hook: BeforeUnloadHook): () => void
|
||||
}
|
||||
|
||||
interface HistoryQueries {
|
||||
pushState(state: LocationState, pathname: Pathname | Path, query?: Query): void
|
||||
replaceState(state: LocationState, pathname: Pathname | Path, query?: Query): void
|
||||
createPath(path: Path, query?: Query): Path
|
||||
createHref(path: Path, query?: Query): Href
|
||||
}
|
||||
|
||||
|
||||
// Global usage, without modules, needs the small trick, because lib.d.ts
|
||||
// already has `history` and `History` global definitions:
|
||||
// var createHistory = ((window as any).History as HistoryModule.Module).createHistory;
|
||||
interface Module {
|
||||
createHistory: CreateHistory<History>
|
||||
createHashHistory: CreateHistory<History>
|
||||
createMemoryHistory: CreateHistory<History>
|
||||
createLocation(path?: Path, state?: LocationState, action?: Action, key?: LocationKey): Location
|
||||
useBasename<T>(createHistory: CreateHistory<T>): CreateHistory<T>
|
||||
useBeforeUnload<T>(createHistory: CreateHistory<T>): CreateHistory<T & HistoryBeforeUnload>
|
||||
useQueries<T>(createHistory: CreateHistory<T>): CreateHistory<T & HistoryQueries>
|
||||
actions: {
|
||||
PUSH: string
|
||||
REPLACE: string
|
||||
POP: string
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
declare module "history/lib/createBrowserHistory" {
|
||||
|
||||
export default function createBrowserHistory(options?: HistoryModule.HistoryOptions): HistoryModule.History
|
||||
|
||||
}
|
||||
|
||||
|
||||
declare module "history/lib/createHashHistory" {
|
||||
|
||||
export default function createHashHistory(options?: HistoryModule.HistoryOptions): HistoryModule.History
|
||||
|
||||
}
|
||||
|
||||
|
||||
declare module "history/lib/createMemoryHistory" {
|
||||
|
||||
export default function createMemoryHistory(options?: HistoryModule.HistoryOptions): HistoryModule.History
|
||||
|
||||
}
|
||||
|
||||
|
||||
declare module "history/lib/createLocation" {
|
||||
|
||||
export default function createLocation(path?: HistoryModule.Path, state?: HistoryModule.LocationState, action?: HistoryModule.Action, key?: HistoryModule.LocationKey): HistoryModule.Location
|
||||
|
||||
}
|
||||
|
||||
|
||||
declare module "history/lib/useBasename" {
|
||||
|
||||
export default function useBasename<T>(createHistory: HistoryModule.CreateHistory<T>): HistoryModule.CreateHistory<T>
|
||||
|
||||
}
|
||||
|
||||
|
||||
declare module "history/lib/useBeforeUnload" {
|
||||
|
||||
export default function useBeforeUnload<T>(createHistory: HistoryModule.CreateHistory<T>): HistoryModule.CreateHistory<T & HistoryModule.HistoryBeforeUnload>
|
||||
|
||||
}
|
||||
|
||||
|
||||
declare module "history/lib/useQueries" {
|
||||
|
||||
export default function useQueries<T>(createHistory: HistoryModule.CreateHistory<T>): HistoryModule.CreateHistory<T & HistoryModule.HistoryQueries>
|
||||
|
||||
}
|
||||
|
||||
|
||||
declare module "history/lib/actions" {
|
||||
|
||||
export const PUSH: string
|
||||
|
||||
export const REPLACE: string
|
||||
|
||||
export const POP: string
|
||||
|
||||
export default {
|
||||
PUSH,
|
||||
REPLACE,
|
||||
POP
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
declare module "history/lib/DOMUtils" {
|
||||
export function addEventListener(node: EventTarget, event: string, listener: EventListenerOrEventListenerObject): void;
|
||||
export function removeEventListener(node: EventTarget, event: string, listener: EventListenerOrEventListenerObject): void;
|
||||
export function getHashPath(): string;
|
||||
export function replaceHashPath(path: string): void;
|
||||
export function getWindowPath(): string;
|
||||
export function go(n: number): void;
|
||||
export function getUserConfirmation(message: string, callback: (result: boolean) => void): void;
|
||||
export function supportsHistory(): boolean;
|
||||
export function supportsGoWithoutReloadUsingHash(): boolean;
|
||||
}
|
||||
|
||||
|
||||
declare module "history" {
|
||||
|
||||
export { default as createHistory } from "history/lib/createBrowserHistory"
|
||||
|
||||
export { default as createHashHistory } from "history/lib/createHashHistory"
|
||||
|
||||
export { default as createMemoryHistory } from "history/lib/createMemoryHistory"
|
||||
|
||||
export { default as createLocation } from "history/lib/createLocation"
|
||||
|
||||
export { default as useBasename } from "history/lib/useBasename"
|
||||
|
||||
export { default as useBeforeUnload } from "history/lib/useBeforeUnload"
|
||||
|
||||
export { default as useQueries } from "history/lib/useQueries"
|
||||
|
||||
import * as Actions from "history/lib/actions"
|
||||
|
||||
export { Actions }
|
||||
|
||||
}
|
||||
Vendored
+69
-503
@@ -3,506 +3,72 @@
|
||||
// Definitions by: Sergey Buturlakin <https://github.com/sergey-buturlakin>, Yuichi Murata <https://github.com/mrk21>, Václav Ostrožlík <https://github.com/vasek17>, Nathan Brown <https://github.com/ngbrown>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
|
||||
/// <reference types="react" />
|
||||
/// <reference path="./history.d.ts"/>
|
||||
|
||||
|
||||
declare namespace ReactRouter {
|
||||
|
||||
import React = __React
|
||||
|
||||
import H = HistoryModule
|
||||
|
||||
// types based on https://github.com/rackt/react-router/blob/master/docs/Glossary.md
|
||||
|
||||
type Component = React.ReactType
|
||||
|
||||
type EnterHook = (nextState: RouterState, replace: RedirectFunction, callback?: Function) => void
|
||||
|
||||
type LeaveHook = () => void
|
||||
|
||||
type ChangeHook = (prevState: RouterState, nextState: RouterState, replace: RedirectFunction, callback: Function) => void;
|
||||
|
||||
type Params = { [param: string]: string }
|
||||
|
||||
type ParseQueryString = (queryString: H.QueryString) => H.Query
|
||||
|
||||
interface RedirectFunction {
|
||||
(location: H.LocationDescriptor): void;
|
||||
/**
|
||||
* @deprecated `replaceState(state, pathname, query) is deprecated; Use `replace(location)` with a location descriptor instead. http://tiny.cc/router-isActivedeprecated
|
||||
*/
|
||||
(state: H.LocationState, pathname: H.Pathname | H.Path, query?: H.Query): void;
|
||||
}
|
||||
|
||||
type RouteComponent = Component
|
||||
|
||||
// use the following interface in an app code to get access to route param values, history, location...
|
||||
// interface MyComponentProps extends ReactRouter.RouteComponentProps<{}, { id: number }> {}
|
||||
// somewhere in MyComponent
|
||||
// ...
|
||||
// let id = this.props.routeParams.id
|
||||
// ...
|
||||
// this.props.history. ...
|
||||
// ...
|
||||
interface RouteComponentProps<P, R> {
|
||||
history?: History
|
||||
location?: H.Location
|
||||
params?: P
|
||||
route?: PlainRoute
|
||||
routeParams?: R
|
||||
routes?: PlainRoute[]
|
||||
children?: React.ReactElement<any>
|
||||
}
|
||||
|
||||
type RouteComponents = { [key: string]: RouteComponent }
|
||||
|
||||
type RouteConfig = React.ReactNode | PlainRoute | PlainRoute[]
|
||||
|
||||
type RouteHook = (nextLocation?: H.Location) => any
|
||||
|
||||
type RoutePattern = string
|
||||
|
||||
type StringifyQuery = (queryObject: H.Query) => H.QueryString
|
||||
|
||||
type RouterListener = (error: Error, nextState: RouterState) => void
|
||||
|
||||
interface RouterState {
|
||||
location: H.Location
|
||||
routes: PlainRoute[]
|
||||
params: Params
|
||||
components: RouteComponent[]
|
||||
}
|
||||
|
||||
|
||||
interface HistoryBase extends H.History {
|
||||
routes: PlainRoute[]
|
||||
parseQueryString?: ParseQueryString
|
||||
stringifyQuery?: StringifyQuery
|
||||
}
|
||||
|
||||
type History = HistoryBase & H.HistoryQueries & HistoryRoutes
|
||||
const browserHistory: History;
|
||||
const hashHistory: History;
|
||||
|
||||
function createMemoryHistory(options?: H.HistoryOptions): H.History
|
||||
|
||||
/* components */
|
||||
|
||||
interface RouterProps extends React.Props<Router> {
|
||||
history?: H.History
|
||||
routes?: RouteConfig // alias for children
|
||||
createElement?: (component: RouteComponent, props: Object) => any
|
||||
onError?: (error: any) => any
|
||||
onUpdate?: () => any
|
||||
parseQueryString?: ParseQueryString
|
||||
stringifyQuery?: StringifyQuery
|
||||
}
|
||||
interface Router extends React.ComponentClass<RouterProps> {}
|
||||
interface RouterElement extends React.ReactElement<RouterProps> {}
|
||||
const Router: Router
|
||||
|
||||
|
||||
interface LinkProps extends React.HTMLAttributes, React.Props<Link> {
|
||||
activeStyle?: React.CSSProperties
|
||||
activeClassName?: string
|
||||
onlyActiveOnIndex?: boolean
|
||||
to: RoutePattern | H.LocationDescriptor
|
||||
query?: H.Query
|
||||
state?: H.LocationState
|
||||
}
|
||||
interface Link extends React.ComponentClass<LinkProps> {}
|
||||
interface LinkElement extends React.ReactElement<LinkProps> {}
|
||||
const Link: Link
|
||||
|
||||
|
||||
const IndexLink: Link
|
||||
|
||||
|
||||
interface RouterContextProps extends React.Props<RouterContext> {
|
||||
history?: H.History
|
||||
router: Router
|
||||
createElement: (component: RouteComponent, props: Object) => any
|
||||
location: H.Location
|
||||
routes: RouteConfig
|
||||
params: Params
|
||||
components?: RouteComponent[]
|
||||
}
|
||||
interface RouterContext extends React.ComponentClass<RouterContextProps> {}
|
||||
interface RouterContextElement extends React.ReactElement<RouterContextProps> {
|
||||
history?: H.History
|
||||
location: H.Location
|
||||
router?: Router
|
||||
}
|
||||
const RouterContext: RouterContext
|
||||
|
||||
|
||||
/* components (configuration) */
|
||||
|
||||
interface RouteProps extends React.Props<Route> {
|
||||
path?: RoutePattern
|
||||
component?: RouteComponent
|
||||
components?: RouteComponents
|
||||
getComponent?: (location: H.Location, cb: (error: any, component?: RouteComponent) => void) => void
|
||||
getComponents?: (location: H.Location, cb: (error: any, components?: RouteComponents) => void) => void
|
||||
onEnter?: EnterHook
|
||||
onLeave?: LeaveHook
|
||||
onChange?: ChangeHook
|
||||
getIndexRoute?: (location: H.Location, cb: (error: any, indexRoute: RouteConfig) => void) => void
|
||||
getChildRoutes?: (location: H.Location, cb: (error: any, childRoutes: RouteConfig) => void) => void
|
||||
}
|
||||
interface Route extends React.ComponentClass<RouteProps> {}
|
||||
interface RouteElement extends React.ReactElement<RouteProps> {}
|
||||
const Route: Route
|
||||
|
||||
|
||||
interface PlainRoute {
|
||||
path?: RoutePattern
|
||||
component?: RouteComponent
|
||||
components?: RouteComponents
|
||||
getComponent?: (location: H.Location, cb: (error: any, component?: RouteComponent) => void) => void
|
||||
getComponents?: (location: H.Location, cb: (error: any, components?: RouteComponents) => void) => void
|
||||
onEnter?: EnterHook
|
||||
onLeave?: LeaveHook
|
||||
indexRoute?: PlainRoute
|
||||
getIndexRoute?: (location: H.Location, cb: (error: any, indexRoute: RouteConfig) => void) => void
|
||||
childRoutes?: PlainRoute[]
|
||||
getChildRoutes?: (location: H.Location, cb: (error: any, childRoutes: RouteConfig) => void) => void
|
||||
}
|
||||
|
||||
|
||||
interface RedirectProps extends React.Props<Redirect> {
|
||||
path?: RoutePattern
|
||||
from?: RoutePattern // alias for path
|
||||
to: RoutePattern
|
||||
query?: H.Query
|
||||
state?: H.LocationState
|
||||
}
|
||||
interface Redirect extends React.ComponentClass<RedirectProps> {}
|
||||
interface RedirectElement extends React.ReactElement<RedirectProps> {}
|
||||
const Redirect: Redirect
|
||||
|
||||
|
||||
interface IndexRouteProps extends React.Props<IndexRoute> {
|
||||
component?: RouteComponent
|
||||
components?: RouteComponents
|
||||
getComponent?: (location: H.Location, cb: (error: any, component?: RouteComponent) => void) => void
|
||||
getComponents?: (location: H.Location, cb: (error: any, components?: RouteComponents) => void) => void
|
||||
onEnter?: EnterHook
|
||||
onLeave?: LeaveHook
|
||||
}
|
||||
interface IndexRoute extends React.ComponentClass<IndexRouteProps> {}
|
||||
interface IndexRouteElement extends React.ReactElement<IndexRouteProps> {}
|
||||
const IndexRoute: IndexRoute
|
||||
|
||||
|
||||
interface IndexRedirectProps extends React.Props<IndexRedirect> {
|
||||
to: RoutePattern
|
||||
query?: H.Query
|
||||
state?: H.LocationState
|
||||
}
|
||||
interface IndexRedirect extends React.ComponentClass<IndexRedirectProps> {}
|
||||
interface IndexRedirectElement extends React.ReactElement<IndexRedirectProps> {}
|
||||
const IndexRedirect: IndexRedirect
|
||||
|
||||
interface RouterOnContext extends H.History {
|
||||
setRouteLeaveHook(route: PlainRoute, hook?: RouteHook): () => void;
|
||||
isActive(pathOrLoc: H.LocationDescriptor, indexOnly?: boolean): boolean;
|
||||
}
|
||||
|
||||
/* mixins */
|
||||
|
||||
interface HistoryMixin {
|
||||
history: History
|
||||
}
|
||||
const History: React.Mixin<any, any>
|
||||
|
||||
|
||||
interface LifecycleMixin {
|
||||
routerWillLeave(nextLocation: H.Location): string | boolean
|
||||
}
|
||||
const Lifecycle: React.Mixin<any, any>
|
||||
|
||||
|
||||
const RouteContext: React.Mixin<any, any>
|
||||
|
||||
|
||||
/* utils */
|
||||
|
||||
interface HistoryRoutes {
|
||||
listen(listener: RouterListener): Function
|
||||
listenBeforeLeavingRoute(route: PlainRoute, hook: RouteHook): void
|
||||
match(location: H.Location, callback: (error: any, nextState: RouterState, nextLocation: H.Location) => void): void
|
||||
isActive(pathname: H.Pathname, query?: H.Query, indexOnly?: boolean): boolean
|
||||
setRouteLeaveHook(route: PlainRoute, callback: RouteHook): void
|
||||
}
|
||||
|
||||
function useRoutes<T>(createHistory: HistoryModule.CreateHistory<T>): HistoryModule.CreateHistory<T & HistoryRoutes>
|
||||
|
||||
|
||||
function createRoutes(routes: RouteConfig): PlainRoute[]
|
||||
|
||||
|
||||
interface MatchArgs {
|
||||
routes?: RouteConfig
|
||||
history?: H.History
|
||||
location?: H.Location | string
|
||||
parseQueryString?: ParseQueryString
|
||||
stringifyQuery?: StringifyQuery
|
||||
}
|
||||
interface MatchState extends RouterState {
|
||||
history: History
|
||||
}
|
||||
function match(args: MatchArgs, cb: (error: any, nextLocation: H.Location, nextState: MatchState) => void): void
|
||||
|
||||
}
|
||||
|
||||
|
||||
declare module "react-router/lib/Router" {
|
||||
|
||||
export default ReactRouter.Router
|
||||
|
||||
}
|
||||
|
||||
|
||||
declare module "react-router/lib/Link" {
|
||||
|
||||
export default ReactRouter.Link
|
||||
|
||||
}
|
||||
|
||||
|
||||
declare module "react-router/lib/IndexLink" {
|
||||
|
||||
export default ReactRouter.IndexLink
|
||||
|
||||
}
|
||||
|
||||
|
||||
declare module "react-router/lib/IndexRedirect" {
|
||||
|
||||
export default ReactRouter.IndexRedirect
|
||||
|
||||
}
|
||||
|
||||
|
||||
declare module "react-router/lib/IndexRoute" {
|
||||
|
||||
export default ReactRouter.IndexRoute
|
||||
|
||||
}
|
||||
|
||||
|
||||
declare module "react-router/lib/Redirect" {
|
||||
|
||||
export default ReactRouter.Redirect
|
||||
|
||||
}
|
||||
|
||||
|
||||
declare module "react-router/lib/Route" {
|
||||
|
||||
export default ReactRouter.Route
|
||||
|
||||
}
|
||||
|
||||
|
||||
declare module "react-router/lib/History" {
|
||||
|
||||
export default ReactRouter.History
|
||||
|
||||
}
|
||||
|
||||
|
||||
declare module "react-router/lib/Lifecycle" {
|
||||
|
||||
export default ReactRouter.Lifecycle
|
||||
|
||||
}
|
||||
|
||||
|
||||
declare module "react-router/lib/RouteContext" {
|
||||
|
||||
export default ReactRouter.RouteContext
|
||||
|
||||
}
|
||||
|
||||
|
||||
declare module "react-router/lib/useRoutes" {
|
||||
|
||||
export default ReactRouter.useRoutes
|
||||
|
||||
}
|
||||
|
||||
declare module "react-router/lib/PatternUtils" {
|
||||
|
||||
export function formatPattern(pattern: string, params: {}): string;
|
||||
|
||||
}
|
||||
|
||||
declare module "react-router/lib/RouteUtils" {
|
||||
|
||||
type E = __React.ReactElement<any>
|
||||
|
||||
export function isReactChildren(object: E | E[]): boolean
|
||||
|
||||
export function createRouteFromReactElement(element: E): ReactRouter.PlainRoute
|
||||
|
||||
export function createRoutesFromReactChildren(children: E | E[], parentRoute: ReactRouter.PlainRoute): ReactRouter.PlainRoute[]
|
||||
|
||||
export import createRoutes = ReactRouter.createRoutes
|
||||
|
||||
}
|
||||
|
||||
|
||||
declare module "react-router/lib/RouterContext" {
|
||||
|
||||
export default ReactRouter.RouterContext
|
||||
|
||||
}
|
||||
|
||||
|
||||
declare module "react-router/lib/PropTypes" {
|
||||
|
||||
import React = __React
|
||||
|
||||
export function falsy(props: any, propName: string, componentName: string): Error;
|
||||
|
||||
export const history: React.Requireable<any>
|
||||
|
||||
export const location: React.Requireable<any>
|
||||
|
||||
export const component: React.Requireable<any>
|
||||
|
||||
export const components: React.Requireable<any>
|
||||
|
||||
export const route: React.Requireable<any>
|
||||
|
||||
export const routes: React.Requireable<any>
|
||||
|
||||
export default {
|
||||
falsy,
|
||||
history,
|
||||
location,
|
||||
component,
|
||||
components,
|
||||
route
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
declare module "react-router/lib/browserHistory" {
|
||||
export default ReactRouter.browserHistory;
|
||||
}
|
||||
|
||||
declare module "react-router/lib/hashHistory" {
|
||||
export default ReactRouter.hashHistory;
|
||||
}
|
||||
|
||||
declare module "react-router/lib/match" {
|
||||
|
||||
export default ReactRouter.match
|
||||
|
||||
}
|
||||
|
||||
declare module "react-router/lib/useRouterHistory" {
|
||||
interface CreateRouterHistory {
|
||||
(options?: HistoryModule.HistoryOptions): HistoryModule.History & HistoryModule.HistoryQueries;
|
||||
}
|
||||
|
||||
export default function useRouterHistory<T>(createHistory: HistoryModule.CreateHistory<T>): CreateRouterHistory;
|
||||
}
|
||||
|
||||
declare module "react-router/lib/createMemoryHistory" {
|
||||
export default ReactRouter.createMemoryHistory;
|
||||
}
|
||||
|
||||
declare module "react-router" {
|
||||
|
||||
import Router from "react-router/lib/Router"
|
||||
|
||||
import Link from "react-router/lib/Link"
|
||||
|
||||
import IndexLink from "react-router/lib/IndexLink"
|
||||
|
||||
import IndexRedirect from "react-router/lib/IndexRedirect"
|
||||
|
||||
import IndexRoute from "react-router/lib/IndexRoute"
|
||||
|
||||
import Redirect from "react-router/lib/Redirect"
|
||||
|
||||
import Route from "react-router/lib/Route"
|
||||
|
||||
import History from "react-router/lib/History"
|
||||
|
||||
import Lifecycle from "react-router/lib/Lifecycle"
|
||||
|
||||
import RouteContext from "react-router/lib/RouteContext"
|
||||
|
||||
import browserHistory from "react-router/lib/browserHistory"
|
||||
|
||||
import hashHistory from "react-router/lib/hashHistory"
|
||||
|
||||
import useRoutes from "react-router/lib/useRoutes"
|
||||
|
||||
import { createRoutes } from "react-router/lib/RouteUtils"
|
||||
|
||||
import { formatPattern } from "react-router/lib/PatternUtils"
|
||||
|
||||
import RouterContext from "react-router/lib/RouterContext"
|
||||
|
||||
import PropTypes from "react-router/lib/PropTypes"
|
||||
|
||||
import match from "react-router/lib/match"
|
||||
|
||||
import useRouterHistory from "react-router/lib/useRouterHistory";
|
||||
|
||||
import createMemoryHistory from "react-router/lib/createMemoryHistory";
|
||||
|
||||
// PlainRoute is defined in the API documented at:
|
||||
// https://github.com/rackt/react-router/blob/master/docs/API.md
|
||||
// but not included in any of the .../lib modules above.
|
||||
export type PlainRoute = ReactRouter.PlainRoute
|
||||
|
||||
// The following definitions are also very useful to export
|
||||
// because by using these types lots of potential type errors
|
||||
// can be exposed:
|
||||
export type EnterHook = ReactRouter.EnterHook
|
||||
export type LeaveHook = ReactRouter.LeaveHook
|
||||
export type ParseQueryString = ReactRouter.ParseQueryString
|
||||
export type RedirectFunction = ReactRouter.RedirectFunction
|
||||
export type RouteComponentProps<P,R> = ReactRouter.RouteComponentProps<P,R>;
|
||||
export type RouteHook = ReactRouter.RouteHook
|
||||
export type StringifyQuery = ReactRouter.StringifyQuery
|
||||
export type RouterListener = ReactRouter.RouterListener
|
||||
export type RouterState = ReactRouter.RouterState
|
||||
export type HistoryBase = ReactRouter.HistoryBase
|
||||
export type RouterOnContext = ReactRouter.RouterOnContext
|
||||
|
||||
export {
|
||||
Router,
|
||||
Link,
|
||||
IndexLink,
|
||||
IndexRedirect,
|
||||
IndexRoute,
|
||||
Redirect,
|
||||
Route,
|
||||
History,
|
||||
browserHistory,
|
||||
hashHistory,
|
||||
Lifecycle,
|
||||
RouteContext,
|
||||
useRoutes,
|
||||
createRoutes,
|
||||
formatPattern,
|
||||
RouterContext,
|
||||
PropTypes,
|
||||
match,
|
||||
useRouterHistory,
|
||||
createMemoryHistory
|
||||
}
|
||||
|
||||
export default Router
|
||||
|
||||
}
|
||||
export as namespace ReactRouter;
|
||||
|
||||
import * as React from 'react';
|
||||
|
||||
import Router from "./lib/Router";
|
||||
import Link from "./lib/Link";
|
||||
import IndexLink from "./lib/IndexLink";
|
||||
import IndexRedirect from "./lib/IndexRedirect";
|
||||
import IndexRoute from "./lib/IndexRoute";
|
||||
import Redirect from "./lib/Redirect";
|
||||
import Route from "./lib/Route";
|
||||
import * as History from "./lib/History";
|
||||
import Lifecycle from "./lib/Lifecycle";
|
||||
import RouteContext from "./lib/RouteContext";
|
||||
import browserHistory from "./lib/browserHistory";
|
||||
import hashHistory from "./lib/hashHistory";
|
||||
import useRoutes from "./lib/useRoutes";
|
||||
import { createRoutes } from "./lib/RouteUtils";
|
||||
import { formatPattern } from "./lib/PatternUtils";
|
||||
import RouterContext from "./lib/RouterContext";
|
||||
import PropTypes from "./lib/PropTypes";
|
||||
import match from "./lib/match";
|
||||
import useRouterHistory from "./lib/useRouterHistory";
|
||||
import createMemoryHistory from "./lib/createMemoryHistory";
|
||||
|
||||
// PlainRoute is defined in the API documented at:
|
||||
// https://github.com/rackt/react-router/blob/master/docs/API.md
|
||||
// but not included in any of the .../lib modules above.
|
||||
export type PlainRoute = Router.PlainRoute;
|
||||
|
||||
// The following definitions are also very useful to export
|
||||
// because by using these types lots of potential type errors
|
||||
// can be exposed:
|
||||
export type EnterHook = Router.EnterHook;
|
||||
export type LeaveHook = Router.LeaveHook;
|
||||
export type ParseQueryString = Router.ParseQueryString;
|
||||
export type RedirectFunction = Router.RedirectFunction;
|
||||
export type RouteComponentProps<P,R> = Router.RouteComponentProps<P,R>;
|
||||
export type RouteHook = Router.RouteHook;
|
||||
export type StringifyQuery = Router.StringifyQuery;
|
||||
export type RouterListener = Router.RouterListener;
|
||||
export type RouterState = Router.RouterState;
|
||||
export type HistoryBase = History.HistoryBase;
|
||||
export type RouterOnContext = Router.RouterOnContext;
|
||||
|
||||
export {
|
||||
Router,
|
||||
Link,
|
||||
IndexLink,
|
||||
IndexRedirect,
|
||||
IndexRoute,
|
||||
Redirect,
|
||||
Route,
|
||||
History,
|
||||
browserHistory,
|
||||
hashHistory,
|
||||
Lifecycle,
|
||||
RouteContext,
|
||||
useRoutes,
|
||||
createRoutes,
|
||||
formatPattern,
|
||||
RouterContext,
|
||||
PropTypes,
|
||||
match,
|
||||
useRouterHistory,
|
||||
createMemoryHistory
|
||||
};
|
||||
|
||||
export default Router;
|
||||
|
||||
Vendored
+22
@@ -0,0 +1,22 @@
|
||||
import Router from './Router';
|
||||
import * as H from 'history';
|
||||
|
||||
export default History;
|
||||
|
||||
export interface HistoryRoutes {
|
||||
listen(listener: Router.RouterListener): Function
|
||||
listenBeforeLeavingRoute(route: Router.PlainRoute, hook: Router.RouteHook): void
|
||||
match(location: H.Location, callback: (error: any, nextState: Router.RouterState, nextLocation: H.Location) => void): void
|
||||
isActive(pathname: H.Pathname, query?: H.Query, indexOnly?: boolean): boolean
|
||||
setRouteLeaveHook(route: Router.PlainRoute, callback: Router.RouteHook): void
|
||||
}
|
||||
|
||||
export interface HistoryBase extends H.History {
|
||||
routes: Router.PlainRoute[];
|
||||
parseQueryString?: Router.ParseQueryString;
|
||||
stringifyQuery?: Router.StringifyQuery;
|
||||
}
|
||||
|
||||
export type History = HistoryBase & H.HistoryQueries & HistoryRoutes;
|
||||
export declare const browserHistory: History;
|
||||
export declare const hashHistory: History;
|
||||
Vendored
+5
@@ -0,0 +1,5 @@
|
||||
import Link from './Link';
|
||||
|
||||
declare const IndexLink: Link;
|
||||
export default IndexLink;
|
||||
|
||||
Vendored
+17
@@ -0,0 +1,17 @@
|
||||
import Router from './Router';
|
||||
import * as React from 'react';
|
||||
import * as H from 'history';
|
||||
|
||||
declare const self: self.IndexRedirect;
|
||||
type self = self.IndexRedirect;
|
||||
export default self;
|
||||
|
||||
declare namespace self {
|
||||
interface IndexRedirectProps extends React.Props<self> {
|
||||
to: Router.RoutePattern;
|
||||
query?: H.Query;
|
||||
state?: H.LocationState;
|
||||
}
|
||||
interface IndexRedirectElement extends React.ReactElement<IndexRedirectProps> { }
|
||||
interface IndexRedirect extends React.ComponentClass<self.IndexRedirectProps> { }
|
||||
}
|
||||
Vendored
+20
@@ -0,0 +1,20 @@
|
||||
import * as React from 'react';
|
||||
import Router from './Router';
|
||||
import * as H from 'history';
|
||||
|
||||
declare const self: self.IndexRoute;
|
||||
type self = self.IndexRoute;
|
||||
export default self;
|
||||
|
||||
declare namespace self {
|
||||
interface IndexRouteProps extends React.Props<IndexRoute> {
|
||||
component?: Router.RouteComponent;
|
||||
components?: Router.RouteComponents;
|
||||
getComponent?: (location: H.Location, cb: (error: any, component?: Router.RouteComponent) => void) => void;
|
||||
getComponents?: (location: H.Location, cb: (error: any, components?: Router.RouteComponents) => void) => void;
|
||||
onEnter?: Router.EnterHook;
|
||||
onLeave?: Router.LeaveHook;
|
||||
}
|
||||
interface IndexRoute extends React.ComponentClass<IndexRouteProps> { }
|
||||
interface IndexRouteElement extends React.ReactElement<IndexRouteProps> { }
|
||||
}
|
||||
Vendored
+4
@@ -0,0 +1,4 @@
|
||||
import * as React from 'react';
|
||||
|
||||
declare const Lifecycle: React.Mixin<any, any>;
|
||||
export default Lifecycle;
|
||||
Vendored
+22
@@ -0,0 +1,22 @@
|
||||
import * as React from 'react';
|
||||
import Router from './Router';
|
||||
import * as H from 'history';
|
||||
|
||||
declare const Link: Link;
|
||||
type Link = Link.Link;
|
||||
|
||||
export default Link;
|
||||
|
||||
declare namespace Link {
|
||||
interface LinkProps extends React.HTMLAttributes, React.Props<Link> {
|
||||
activeStyle?: React.CSSProperties;
|
||||
activeClassName?: string;
|
||||
onlyActiveOnIndex?: boolean;
|
||||
to: Router.RoutePattern | H.LocationDescriptor;
|
||||
query?: H.Query;
|
||||
state?: H.LocationState;
|
||||
}
|
||||
|
||||
interface Link extends React.ComponentClass<LinkProps> {}
|
||||
interface LinkElement extends React.ReactElement<LinkProps> {}
|
||||
}
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
export function formatPattern(pattern: string, params: {}): string;
|
||||
Vendored
+19
@@ -0,0 +1,19 @@
|
||||
import * as React from 'react';
|
||||
|
||||
export function falsy(props: any, propName: string, componentName: string): Error;
|
||||
export const history: React.Requireable<any>;
|
||||
export const location: React.Requireable<any>;
|
||||
export const component: React.Requireable<any>;
|
||||
export const components: React.Requireable<any>;
|
||||
export const route: React.Requireable<any>;
|
||||
export const routes: React.Requireable<any>;
|
||||
|
||||
export default {
|
||||
falsy,
|
||||
history,
|
||||
location,
|
||||
component,
|
||||
components,
|
||||
route
|
||||
};
|
||||
|
||||
Vendored
+19
@@ -0,0 +1,19 @@
|
||||
import * as React from 'react';
|
||||
import Router from './Router';
|
||||
import * as H from 'history';
|
||||
|
||||
declare const self: self.Redirect;
|
||||
type self = typeof self;
|
||||
export default self;
|
||||
|
||||
declare namespace self {
|
||||
interface RedirectProps extends React.Props<Redirect> {
|
||||
path?: Router.RoutePattern;
|
||||
from?: Router.RoutePattern; // alias for path
|
||||
to: Router.RoutePattern;
|
||||
query?: H.Query;
|
||||
state?: H.LocationState;
|
||||
}
|
||||
interface Redirect extends React.ComponentClass<RedirectProps> { }
|
||||
interface RedirectElement extends React.ReactElement<RedirectProps> { }
|
||||
}
|
||||
Vendored
+25
@@ -0,0 +1,25 @@
|
||||
import * as React from 'react';
|
||||
import Router from './Router';
|
||||
import { Location } from 'history';
|
||||
|
||||
declare const self: self.Route;
|
||||
type self = self.Route;
|
||||
export default self;
|
||||
|
||||
declare namespace self {
|
||||
|
||||
interface RouteProps extends React.Props<Route> {
|
||||
path?: Router.RoutePattern;
|
||||
component?: Router.RouteComponent;
|
||||
components?: Router.RouteComponents;
|
||||
getComponent?: (location: Location, cb: (error: any, component?: Router.RouteComponent) => void) => void;
|
||||
getComponents?: (location: Location, cb: (error: any, components?: Router.RouteComponents) => void) => void;
|
||||
onEnter?: Router.EnterHook;
|
||||
onLeave?: Router.LeaveHook;
|
||||
onChange?: Router.ChangeHook;
|
||||
getIndexRoute?: (location: Location, cb: (error: any, indexRoute: Router.RouteConfig) => void) => void;
|
||||
getChildRoutes?: (location: Location, cb: (error: any, childRoutes: Router.RouteConfig) => void) => void;
|
||||
}
|
||||
interface Route extends React.ComponentClass<RouteProps> {}
|
||||
interface RouteElement extends React.ReactElement<RouteProps> {}
|
||||
}
|
||||
Vendored
+5
@@ -0,0 +1,5 @@
|
||||
import * as React from 'react';
|
||||
|
||||
declare const RouteContext: React.Mixin<any, any>
|
||||
export default RouteContext;
|
||||
|
||||
Vendored
+8
@@ -0,0 +1,8 @@
|
||||
import * as React from 'react';
|
||||
import Router from './Router';
|
||||
|
||||
type E = React.ReactElement<any>;
|
||||
export function isReactChildren(object: E | E[]): boolean;
|
||||
export function createRouteFromReactElement(element: E): Router.PlainRoute;
|
||||
export function createRoutesFromReactChildren(children: E | E[], parentRoute: Router.PlainRoute): Router.PlainRoute[];
|
||||
export function createRoutes(routes: Router.RouteConfig): Router.PlainRoute[];
|
||||
Vendored
+89
@@ -0,0 +1,89 @@
|
||||
import * as React from 'react';
|
||||
import {
|
||||
QueryString, Query,
|
||||
Location, LocationDescriptor, LocationState,
|
||||
History,
|
||||
Pathname, Path } from 'history';
|
||||
|
||||
declare const Router: Router;
|
||||
interface Router extends React.ComponentClass<Router.RouterProps> { }
|
||||
|
||||
export default Router;
|
||||
|
||||
// types based on https://github.com/rackt/react-router/blob/master/docs/Glossary.md
|
||||
|
||||
declare namespace Router {
|
||||
type RouteConfig = React.ReactNode | PlainRoute | PlainRoute[];
|
||||
type RoutePattern = string;
|
||||
type RouteComponents = { [key: string]: RouteComponent };
|
||||
|
||||
type ParseQueryString = (queryString: QueryString) => Query;
|
||||
type StringifyQuery = (queryObject: Query) => QueryString;
|
||||
|
||||
type Component = React.ReactType;
|
||||
type RouteComponent = Component;
|
||||
|
||||
type EnterHook = (nextState: RouterState, replace: RedirectFunction, callback?: Function) => void;
|
||||
type LeaveHook = () => void;
|
||||
type ChangeHook = (prevState: RouterState, nextState: RouterState, replace: RedirectFunction, callback: Function) => void;
|
||||
type RouteHook = (nextLocation?: Location) => any;
|
||||
|
||||
type Params = { [param: string]: string };
|
||||
|
||||
type RouterListener = (error: Error, nextState: RouterState) => void;
|
||||
|
||||
|
||||
interface RedirectFunction {
|
||||
(location: LocationDescriptor): void;
|
||||
/**
|
||||
* @deprecated `replaceState(state, pathname, query) is deprecated; Use `replace(location)` with a location descriptor instead. http://tiny.cc/router-isActivedeprecated
|
||||
*/
|
||||
(state: LocationState, pathname: Pathname | Path, query?: Query): void;
|
||||
}
|
||||
|
||||
interface RouterState {
|
||||
location: Location;
|
||||
routes: PlainRoute[];
|
||||
params: Params;
|
||||
components: RouteComponent[];
|
||||
}
|
||||
|
||||
interface RouterProps extends React.Props<Router> {
|
||||
history?: History;
|
||||
routes?: RouteConfig; // alias for children
|
||||
createElement?: (component: RouteComponent, props: Object) => any;
|
||||
onError?: (error: any) => any;
|
||||
onUpdate?: () => any;
|
||||
parseQueryString?: ParseQueryString;
|
||||
stringifyQuery?: StringifyQuery;
|
||||
}
|
||||
|
||||
interface PlainRoute {
|
||||
path?: RoutePattern;
|
||||
component?: RouteComponent;
|
||||
components?: RouteComponents;
|
||||
getComponent?: (location: Location, cb: (error: any, component?: RouteComponent) => void) => void;
|
||||
getComponents?: (location: Location, cb: (error: any, components?: RouteComponents) => void) => void;
|
||||
onEnter?: EnterHook;
|
||||
onLeave?: LeaveHook;
|
||||
indexRoute?: PlainRoute;
|
||||
getIndexRoute?: (location: Location, cb: (error: any, indexRoute: RouteConfig) => void) => void;
|
||||
childRoutes?: PlainRoute[];
|
||||
getChildRoutes?: (location: Location, cb: (error: any, childRoutes: RouteConfig) => void) => void;
|
||||
}
|
||||
|
||||
interface RouteComponentProps<P, R> {
|
||||
history?: History;
|
||||
location?: Location;
|
||||
params?: P;
|
||||
route?: PlainRoute;
|
||||
routeParams?: R;
|
||||
routes?: PlainRoute[];
|
||||
children?: React.ReactElement<any>;
|
||||
}
|
||||
|
||||
interface RouterOnContext extends History {
|
||||
setRouteLeaveHook(route: PlainRoute, hook?: RouteHook): () => void;
|
||||
isActive(pathOrLoc: LocationDescriptor, indexOnly?: boolean): boolean;
|
||||
}
|
||||
}
|
||||
Vendored
+25
@@ -0,0 +1,25 @@
|
||||
import * as React from 'react';
|
||||
import * as H from 'history';
|
||||
import Router from './Router';
|
||||
|
||||
declare const self: self.RouterContext;
|
||||
type self = self.RouterContext;
|
||||
export default self;
|
||||
|
||||
declare namespace self {
|
||||
interface RouterContextProps extends React.Props<RouterContext> {
|
||||
history?: H.History;
|
||||
router: Router;
|
||||
createElement: (component: Router.RouteComponent, props: Object) => any;
|
||||
location: H.Location;
|
||||
routes: Router.RouteConfig;
|
||||
params: Router.Params;
|
||||
components?: Router.RouteComponent[];
|
||||
}
|
||||
interface RouterContext extends React.ComponentClass<RouterContextProps> {}
|
||||
interface RouterContextElement extends React.ReactElement<RouterContextProps> {
|
||||
history?: H.History;
|
||||
location: H.Location;
|
||||
router?: Router;
|
||||
}
|
||||
}
|
||||
Vendored
+3
@@ -0,0 +1,3 @@
|
||||
import { History } from './History';
|
||||
declare const browserHistory: History;
|
||||
export default browserHistory;
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
import * as H from 'history';
|
||||
|
||||
export default function createMemoryHistory(options?: H.HistoryOptions): H.History;
|
||||
Vendored
+3
@@ -0,0 +1,3 @@
|
||||
import { History } from './History';
|
||||
declare const hashHistory: History;
|
||||
export default hashHistory;
|
||||
Vendored
+15
@@ -0,0 +1,15 @@
|
||||
import * as H from 'history';
|
||||
import Router from './Router';
|
||||
|
||||
interface MatchArgs {
|
||||
routes?: Router.RouteConfig;
|
||||
history?: H.History;
|
||||
location?: H.Location | string;
|
||||
parseQueryString?: Router.ParseQueryString;
|
||||
stringifyQuery?: Router.StringifyQuery;
|
||||
}
|
||||
interface MatchState extends Router.RouterState {
|
||||
history: History;
|
||||
}
|
||||
export default function match(args: MatchArgs, cb: (error: any, nextLocation: H.Location, nextState: MatchState) => void): void;
|
||||
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
import { History, HistoryOptions, HistoryQueries, CreateHistory } from 'history';
|
||||
|
||||
interface CreateRouterHistory {
|
||||
(options?: HistoryOptions): History & HistoryQueries;
|
||||
}
|
||||
|
||||
export default function useRouterHistory<T>(createHistory: CreateHistory<T>): CreateRouterHistory;
|
||||
Vendored
+5
@@ -0,0 +1,5 @@
|
||||
import * as H from 'history';
|
||||
import { HistoryRoutes } from './History';
|
||||
|
||||
declare function useRoutes<T>(createHistory: H.CreateHistory<T>): H.CreateHistory<T & HistoryRoutes>;
|
||||
export default useRoutes;
|
||||
@@ -1,17 +1,10 @@
|
||||
|
||||
/// <reference types="react" />
|
||||
/// <reference types="react-dom" />
|
||||
|
||||
|
||||
|
||||
|
||||
import * as React from "react"
|
||||
import * as ReactDOM from "react-dom"
|
||||
|
||||
import { browserHistory, hashHistory, createMemoryHistory, Router, Route, IndexRoute, Link } from "react-router"
|
||||
import { browserHistory, hashHistory, createMemoryHistory, Router, Route, IndexRoute, Link, RouterOnContext } from "react-router"
|
||||
|
||||
interface MasterContext {
|
||||
router: ReactRouter.RouterOnContext;
|
||||
router: RouterOnContext;
|
||||
}
|
||||
|
||||
class Master extends React.Component<React.Props<{}>, {}> {
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
/// <reference path="./react-swf.d.ts"/>
|
||||
/// <reference types="react"/>
|
||||
/// <reference types="react" />
|
||||
var version = ReactSWF.getFPVersion();
|
||||
var isFPVersionSupported = ReactSWF.isFPVersionSupported('5');
|
||||
var reactSWF = new ReactSWF();
|
||||
|
||||
Vendored
+154
-155
@@ -3,7 +3,10 @@
|
||||
// Definitions by: Asana <https://asana.com>, AssureSign <http://www.assuresign.com>, Microsoft <https://microsoft.com>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare namespace __React {
|
||||
export = React;
|
||||
export as namespace React;
|
||||
|
||||
declare namespace React {
|
||||
|
||||
//
|
||||
// React Elements
|
||||
@@ -2315,160 +2318,156 @@ declare namespace __React {
|
||||
}
|
||||
}
|
||||
|
||||
declare module "react" {
|
||||
export = __React;
|
||||
}
|
||||
declare global {
|
||||
namespace JSX {
|
||||
interface Element extends React.ReactElement<any> { }
|
||||
interface ElementClass extends React.Component<any, any> {
|
||||
render(): JSX.Element;
|
||||
}
|
||||
interface ElementAttributesProperty { props: {}; }
|
||||
|
||||
declare namespace JSX {
|
||||
import React = __React;
|
||||
interface IntrinsicAttributes extends React.Attributes { }
|
||||
interface IntrinsicClassAttributes<T> extends React.ClassAttributes<T> { }
|
||||
|
||||
interface Element extends React.ReactElement<any> { }
|
||||
interface ElementClass extends React.Component<any, any> {
|
||||
render(): JSX.Element;
|
||||
interface IntrinsicElements {
|
||||
// HTML
|
||||
a: React.HTMLProps<HTMLAnchorElement>;
|
||||
abbr: React.HTMLProps<HTMLElement>;
|
||||
address: React.HTMLProps<HTMLElement>;
|
||||
area: React.HTMLProps<HTMLAreaElement>;
|
||||
article: React.HTMLProps<HTMLElement>;
|
||||
aside: React.HTMLProps<HTMLElement>;
|
||||
audio: React.HTMLProps<HTMLAudioElement>;
|
||||
b: React.HTMLProps<HTMLElement>;
|
||||
base: React.HTMLProps<HTMLBaseElement>;
|
||||
bdi: React.HTMLProps<HTMLElement>;
|
||||
bdo: React.HTMLProps<HTMLElement>;
|
||||
big: React.HTMLProps<HTMLElement>;
|
||||
blockquote: React.HTMLProps<HTMLElement>;
|
||||
body: React.HTMLProps<HTMLBodyElement>;
|
||||
br: React.HTMLProps<HTMLBRElement>;
|
||||
button: React.HTMLProps<HTMLButtonElement>;
|
||||
canvas: React.HTMLProps<HTMLCanvasElement>;
|
||||
caption: React.HTMLProps<HTMLElement>;
|
||||
cite: React.HTMLProps<HTMLElement>;
|
||||
code: React.HTMLProps<HTMLElement>;
|
||||
col: React.HTMLProps<HTMLTableColElement>;
|
||||
colgroup: React.HTMLProps<HTMLTableColElement>;
|
||||
data: React.HTMLProps<HTMLElement>;
|
||||
datalist: React.HTMLProps<HTMLDataListElement>;
|
||||
dd: React.HTMLProps<HTMLElement>;
|
||||
del: React.HTMLProps<HTMLElement>;
|
||||
details: React.HTMLProps<HTMLElement>;
|
||||
dfn: React.HTMLProps<HTMLElement>;
|
||||
dialog: React.HTMLProps<HTMLElement>;
|
||||
div: React.HTMLProps<HTMLDivElement>;
|
||||
dl: React.HTMLProps<HTMLDListElement>;
|
||||
dt: React.HTMLProps<HTMLElement>;
|
||||
em: React.HTMLProps<HTMLElement>;
|
||||
embed: React.HTMLProps<HTMLEmbedElement>;
|
||||
fieldset: React.HTMLProps<HTMLFieldSetElement>;
|
||||
figcaption: React.HTMLProps<HTMLElement>;
|
||||
figure: React.HTMLProps<HTMLElement>;
|
||||
footer: React.HTMLProps<HTMLElement>;
|
||||
form: React.HTMLProps<HTMLFormElement>;
|
||||
h1: React.HTMLProps<HTMLHeadingElement>;
|
||||
h2: React.HTMLProps<HTMLHeadingElement>;
|
||||
h3: React.HTMLProps<HTMLHeadingElement>;
|
||||
h4: React.HTMLProps<HTMLHeadingElement>;
|
||||
h5: React.HTMLProps<HTMLHeadingElement>;
|
||||
h6: React.HTMLProps<HTMLHeadingElement>;
|
||||
head: React.HTMLProps<HTMLHeadElement>;
|
||||
header: React.HTMLProps<HTMLElement>;
|
||||
hgroup: React.HTMLProps<HTMLElement>;
|
||||
hr: React.HTMLProps<HTMLHRElement>;
|
||||
html: React.HTMLProps<HTMLHtmlElement>;
|
||||
i: React.HTMLProps<HTMLElement>;
|
||||
iframe: React.HTMLProps<HTMLIFrameElement>;
|
||||
img: React.HTMLProps<HTMLImageElement>;
|
||||
input: React.HTMLProps<HTMLInputElement>;
|
||||
ins: React.HTMLProps<HTMLModElement>;
|
||||
kbd: React.HTMLProps<HTMLElement>;
|
||||
keygen: React.HTMLProps<HTMLElement>;
|
||||
label: React.HTMLProps<HTMLLabelElement>;
|
||||
legend: React.HTMLProps<HTMLLegendElement>;
|
||||
li: React.HTMLProps<HTMLLIElement>;
|
||||
link: React.HTMLProps<HTMLLinkElement>;
|
||||
main: React.HTMLProps<HTMLElement>;
|
||||
map: React.HTMLProps<HTMLMapElement>;
|
||||
mark: React.HTMLProps<HTMLElement>;
|
||||
menu: React.HTMLProps<HTMLElement>;
|
||||
menuitem: React.HTMLProps<HTMLElement>;
|
||||
meta: React.HTMLProps<HTMLMetaElement>;
|
||||
meter: React.HTMLProps<HTMLElement>;
|
||||
nav: React.HTMLProps<HTMLElement>;
|
||||
noscript: React.HTMLProps<HTMLElement>;
|
||||
object: React.HTMLProps<HTMLObjectElement>;
|
||||
ol: React.HTMLProps<HTMLOListElement>;
|
||||
optgroup: React.HTMLProps<HTMLOptGroupElement>;
|
||||
option: React.HTMLProps<HTMLOptionElement>;
|
||||
output: React.HTMLProps<HTMLElement>;
|
||||
p: React.HTMLProps<HTMLParagraphElement>;
|
||||
param: React.HTMLProps<HTMLParamElement>;
|
||||
picture: React.HTMLProps<HTMLElement>;
|
||||
pre: React.HTMLProps<HTMLPreElement>;
|
||||
progress: React.HTMLProps<HTMLProgressElement>;
|
||||
q: React.HTMLProps<HTMLQuoteElement>;
|
||||
rp: React.HTMLProps<HTMLElement>;
|
||||
rt: React.HTMLProps<HTMLElement>;
|
||||
ruby: React.HTMLProps<HTMLElement>;
|
||||
s: React.HTMLProps<HTMLElement>;
|
||||
samp: React.HTMLProps<HTMLElement>;
|
||||
script: React.HTMLProps<HTMLElement>;
|
||||
section: React.HTMLProps<HTMLElement>;
|
||||
select: React.HTMLProps<HTMLSelectElement>;
|
||||
small: React.HTMLProps<HTMLElement>;
|
||||
source: React.HTMLProps<HTMLSourceElement>;
|
||||
span: React.HTMLProps<HTMLSpanElement>;
|
||||
strong: React.HTMLProps<HTMLElement>;
|
||||
style: React.HTMLProps<HTMLStyleElement>;
|
||||
sub: React.HTMLProps<HTMLElement>;
|
||||
summary: React.HTMLProps<HTMLElement>;
|
||||
sup: React.HTMLProps<HTMLElement>;
|
||||
table: React.HTMLProps<HTMLTableElement>;
|
||||
tbody: React.HTMLProps<HTMLTableSectionElement>;
|
||||
td: React.HTMLProps<HTMLTableDataCellElement>;
|
||||
textarea: React.HTMLProps<HTMLTextAreaElement>;
|
||||
tfoot: React.HTMLProps<HTMLTableSectionElement>;
|
||||
th: React.HTMLProps<HTMLTableHeaderCellElement>;
|
||||
thead: React.HTMLProps<HTMLTableSectionElement>;
|
||||
time: React.HTMLProps<HTMLElement>;
|
||||
title: React.HTMLProps<HTMLTitleElement>;
|
||||
tr: React.HTMLProps<HTMLTableRowElement>;
|
||||
track: React.HTMLProps<HTMLTrackElement>;
|
||||
u: React.HTMLProps<HTMLElement>;
|
||||
ul: React.HTMLProps<HTMLUListElement>;
|
||||
"var": React.HTMLProps<HTMLElement>;
|
||||
video: React.HTMLProps<HTMLVideoElement>;
|
||||
wbr: React.HTMLProps<HTMLElement>;
|
||||
|
||||
// SVG
|
||||
svg: React.SVGProps;
|
||||
|
||||
circle: React.SVGProps;
|
||||
clipPath: React.SVGProps;
|
||||
defs: React.SVGProps;
|
||||
ellipse: React.SVGProps;
|
||||
g: React.SVGProps;
|
||||
image: React.SVGProps;
|
||||
line: React.SVGProps;
|
||||
linearGradient: React.SVGProps;
|
||||
mask: React.SVGProps;
|
||||
path: React.SVGProps;
|
||||
pattern: React.SVGProps;
|
||||
polygon: React.SVGProps;
|
||||
polyline: React.SVGProps;
|
||||
radialGradient: React.SVGProps;
|
||||
rect: React.SVGProps;
|
||||
stop: React.SVGProps;
|
||||
symbol: React.SVGProps;
|
||||
text: React.SVGProps;
|
||||
tspan: React.SVGProps;
|
||||
use: React.SVGProps;
|
||||
}
|
||||
}
|
||||
interface ElementAttributesProperty { props: {}; }
|
||||
|
||||
interface IntrinsicAttributes extends React.Attributes { }
|
||||
interface IntrinsicClassAttributes<T> extends React.ClassAttributes<T> { }
|
||||
|
||||
interface IntrinsicElements {
|
||||
// HTML
|
||||
a: React.HTMLProps<HTMLAnchorElement>;
|
||||
abbr: React.HTMLProps<HTMLElement>;
|
||||
address: React.HTMLProps<HTMLElement>;
|
||||
area: React.HTMLProps<HTMLAreaElement>;
|
||||
article: React.HTMLProps<HTMLElement>;
|
||||
aside: React.HTMLProps<HTMLElement>;
|
||||
audio: React.HTMLProps<HTMLAudioElement>;
|
||||
b: React.HTMLProps<HTMLElement>;
|
||||
base: React.HTMLProps<HTMLBaseElement>;
|
||||
bdi: React.HTMLProps<HTMLElement>;
|
||||
bdo: React.HTMLProps<HTMLElement>;
|
||||
big: React.HTMLProps<HTMLElement>;
|
||||
blockquote: React.HTMLProps<HTMLElement>;
|
||||
body: React.HTMLProps<HTMLBodyElement>;
|
||||
br: React.HTMLProps<HTMLBRElement>;
|
||||
button: React.HTMLProps<HTMLButtonElement>;
|
||||
canvas: React.HTMLProps<HTMLCanvasElement>;
|
||||
caption: React.HTMLProps<HTMLElement>;
|
||||
cite: React.HTMLProps<HTMLElement>;
|
||||
code: React.HTMLProps<HTMLElement>;
|
||||
col: React.HTMLProps<HTMLTableColElement>;
|
||||
colgroup: React.HTMLProps<HTMLTableColElement>;
|
||||
data: React.HTMLProps<HTMLElement>;
|
||||
datalist: React.HTMLProps<HTMLDataListElement>;
|
||||
dd: React.HTMLProps<HTMLElement>;
|
||||
del: React.HTMLProps<HTMLElement>;
|
||||
details: React.HTMLProps<HTMLElement>;
|
||||
dfn: React.HTMLProps<HTMLElement>;
|
||||
dialog: React.HTMLProps<HTMLElement>;
|
||||
div: React.HTMLProps<HTMLDivElement>;
|
||||
dl: React.HTMLProps<HTMLDListElement>;
|
||||
dt: React.HTMLProps<HTMLElement>;
|
||||
em: React.HTMLProps<HTMLElement>;
|
||||
embed: React.HTMLProps<HTMLEmbedElement>;
|
||||
fieldset: React.HTMLProps<HTMLFieldSetElement>;
|
||||
figcaption: React.HTMLProps<HTMLElement>;
|
||||
figure: React.HTMLProps<HTMLElement>;
|
||||
footer: React.HTMLProps<HTMLElement>;
|
||||
form: React.HTMLProps<HTMLFormElement>;
|
||||
h1: React.HTMLProps<HTMLHeadingElement>;
|
||||
h2: React.HTMLProps<HTMLHeadingElement>;
|
||||
h3: React.HTMLProps<HTMLHeadingElement>;
|
||||
h4: React.HTMLProps<HTMLHeadingElement>;
|
||||
h5: React.HTMLProps<HTMLHeadingElement>;
|
||||
h6: React.HTMLProps<HTMLHeadingElement>;
|
||||
head: React.HTMLProps<HTMLHeadElement>;
|
||||
header: React.HTMLProps<HTMLElement>;
|
||||
hgroup: React.HTMLProps<HTMLElement>;
|
||||
hr: React.HTMLProps<HTMLHRElement>;
|
||||
html: React.HTMLProps<HTMLHtmlElement>;
|
||||
i: React.HTMLProps<HTMLElement>;
|
||||
iframe: React.HTMLProps<HTMLIFrameElement>;
|
||||
img: React.HTMLProps<HTMLImageElement>;
|
||||
input: React.HTMLProps<HTMLInputElement>;
|
||||
ins: React.HTMLProps<HTMLModElement>;
|
||||
kbd: React.HTMLProps<HTMLElement>;
|
||||
keygen: React.HTMLProps<HTMLElement>;
|
||||
label: React.HTMLProps<HTMLLabelElement>;
|
||||
legend: React.HTMLProps<HTMLLegendElement>;
|
||||
li: React.HTMLProps<HTMLLIElement>;
|
||||
link: React.HTMLProps<HTMLLinkElement>;
|
||||
main: React.HTMLProps<HTMLElement>;
|
||||
map: React.HTMLProps<HTMLMapElement>;
|
||||
mark: React.HTMLProps<HTMLElement>;
|
||||
menu: React.HTMLProps<HTMLElement>;
|
||||
menuitem: React.HTMLProps<HTMLElement>;
|
||||
meta: React.HTMLProps<HTMLMetaElement>;
|
||||
meter: React.HTMLProps<HTMLElement>;
|
||||
nav: React.HTMLProps<HTMLElement>;
|
||||
noscript: React.HTMLProps<HTMLElement>;
|
||||
object: React.HTMLProps<HTMLObjectElement>;
|
||||
ol: React.HTMLProps<HTMLOListElement>;
|
||||
optgroup: React.HTMLProps<HTMLOptGroupElement>;
|
||||
option: React.HTMLProps<HTMLOptionElement>;
|
||||
output: React.HTMLProps<HTMLElement>;
|
||||
p: React.HTMLProps<HTMLParagraphElement>;
|
||||
param: React.HTMLProps<HTMLParamElement>;
|
||||
picture: React.HTMLProps<HTMLElement>;
|
||||
pre: React.HTMLProps<HTMLPreElement>;
|
||||
progress: React.HTMLProps<HTMLProgressElement>;
|
||||
q: React.HTMLProps<HTMLQuoteElement>;
|
||||
rp: React.HTMLProps<HTMLElement>;
|
||||
rt: React.HTMLProps<HTMLElement>;
|
||||
ruby: React.HTMLProps<HTMLElement>;
|
||||
s: React.HTMLProps<HTMLElement>;
|
||||
samp: React.HTMLProps<HTMLElement>;
|
||||
script: React.HTMLProps<HTMLElement>;
|
||||
section: React.HTMLProps<HTMLElement>;
|
||||
select: React.HTMLProps<HTMLSelectElement>;
|
||||
small: React.HTMLProps<HTMLElement>;
|
||||
source: React.HTMLProps<HTMLSourceElement>;
|
||||
span: React.HTMLProps<HTMLSpanElement>;
|
||||
strong: React.HTMLProps<HTMLElement>;
|
||||
style: React.HTMLProps<HTMLStyleElement>;
|
||||
sub: React.HTMLProps<HTMLElement>;
|
||||
summary: React.HTMLProps<HTMLElement>;
|
||||
sup: React.HTMLProps<HTMLElement>;
|
||||
table: React.HTMLProps<HTMLTableElement>;
|
||||
tbody: React.HTMLProps<HTMLTableSectionElement>;
|
||||
td: React.HTMLProps<HTMLTableDataCellElement>;
|
||||
textarea: React.HTMLProps<HTMLTextAreaElement>;
|
||||
tfoot: React.HTMLProps<HTMLTableSectionElement>;
|
||||
th: React.HTMLProps<HTMLTableHeaderCellElement>;
|
||||
thead: React.HTMLProps<HTMLTableSectionElement>;
|
||||
time: React.HTMLProps<HTMLElement>;
|
||||
title: React.HTMLProps<HTMLTitleElement>;
|
||||
tr: React.HTMLProps<HTMLTableRowElement>;
|
||||
track: React.HTMLProps<HTMLTrackElement>;
|
||||
u: React.HTMLProps<HTMLElement>;
|
||||
ul: React.HTMLProps<HTMLUListElement>;
|
||||
"var": React.HTMLProps<HTMLElement>;
|
||||
video: React.HTMLProps<HTMLVideoElement>;
|
||||
wbr: React.HTMLProps<HTMLElement>;
|
||||
|
||||
// SVG
|
||||
svg: React.SVGProps;
|
||||
|
||||
circle: React.SVGProps;
|
||||
clipPath: React.SVGProps;
|
||||
defs: React.SVGProps;
|
||||
ellipse: React.SVGProps;
|
||||
g: React.SVGProps;
|
||||
image: React.SVGProps;
|
||||
line: React.SVGProps;
|
||||
linearGradient: React.SVGProps;
|
||||
mask: React.SVGProps;
|
||||
path: React.SVGProps;
|
||||
pattern: React.SVGProps;
|
||||
polygon: React.SVGProps;
|
||||
polyline: React.SVGProps;
|
||||
radialGradient: React.SVGProps;
|
||||
rect: React.SVGProps;
|
||||
stop: React.SVGProps;
|
||||
symbol: React.SVGProps;
|
||||
text: React.SVGProps;
|
||||
tspan: React.SVGProps;
|
||||
use: React.SVGProps;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user