mirror of
https://github.com/idanoo/GoScrobble
synced 2025-07-01 13:42:20 +00:00
0.2.0 - Mid migration
This commit is contained in:
parent
139e6a915e
commit
7e38fdbd7d
42393 changed files with 5358157 additions and 62 deletions
36
web/node_modules/react-router-dom/modules/BrowserRouter.js
generated
vendored
Normal file
36
web/node_modules/react-router-dom/modules/BrowserRouter.js
generated
vendored
Normal file
|
@ -0,0 +1,36 @@
|
|||
import React from "react";
|
||||
import { Router } from "react-router";
|
||||
import { createBrowserHistory as createHistory } from "history";
|
||||
import PropTypes from "prop-types";
|
||||
import warning from "tiny-warning";
|
||||
|
||||
/**
|
||||
* The public API for a <Router> that uses HTML5 history.
|
||||
*/
|
||||
class BrowserRouter extends React.Component {
|
||||
history = createHistory(this.props);
|
||||
|
||||
render() {
|
||||
return <Router history={this.history} children={this.props.children} />;
|
||||
}
|
||||
}
|
||||
|
||||
if (__DEV__) {
|
||||
BrowserRouter.propTypes = {
|
||||
basename: PropTypes.string,
|
||||
children: PropTypes.node,
|
||||
forceRefresh: PropTypes.bool,
|
||||
getUserConfirmation: PropTypes.func,
|
||||
keyLength: PropTypes.number
|
||||
};
|
||||
|
||||
BrowserRouter.prototype.componentDidMount = function() {
|
||||
warning(
|
||||
!this.props.history,
|
||||
"<BrowserRouter> ignores the history prop. To use a custom history, " +
|
||||
"use `import { Router }` instead of `import { BrowserRouter as Router }`."
|
||||
);
|
||||
};
|
||||
}
|
||||
|
||||
export default BrowserRouter;
|
35
web/node_modules/react-router-dom/modules/HashRouter.js
generated
vendored
Normal file
35
web/node_modules/react-router-dom/modules/HashRouter.js
generated
vendored
Normal file
|
@ -0,0 +1,35 @@
|
|||
import React from "react";
|
||||
import { Router } from "react-router";
|
||||
import { createHashHistory as createHistory } from "history";
|
||||
import PropTypes from "prop-types";
|
||||
import warning from "tiny-warning";
|
||||
|
||||
/**
|
||||
* The public API for a <Router> that uses window.location.hash.
|
||||
*/
|
||||
class HashRouter extends React.Component {
|
||||
history = createHistory(this.props);
|
||||
|
||||
render() {
|
||||
return <Router history={this.history} children={this.props.children} />;
|
||||
}
|
||||
}
|
||||
|
||||
if (__DEV__) {
|
||||
HashRouter.propTypes = {
|
||||
basename: PropTypes.string,
|
||||
children: PropTypes.node,
|
||||
getUserConfirmation: PropTypes.func,
|
||||
hashType: PropTypes.oneOf(["hashbang", "noslash", "slash"])
|
||||
};
|
||||
|
||||
HashRouter.prototype.componentDidMount = function() {
|
||||
warning(
|
||||
!this.props.history,
|
||||
"<HashRouter> ignores the history prop. To use a custom history, " +
|
||||
"use `import { Router }` instead of `import { HashRouter as Router }`."
|
||||
);
|
||||
};
|
||||
}
|
||||
|
||||
export default HashRouter;
|
146
web/node_modules/react-router-dom/modules/Link.js
generated
vendored
Normal file
146
web/node_modules/react-router-dom/modules/Link.js
generated
vendored
Normal file
|
@ -0,0 +1,146 @@
|
|||
import React from "react";
|
||||
import { __RouterContext as RouterContext } from "react-router";
|
||||
import PropTypes from "prop-types";
|
||||
import invariant from "tiny-invariant";
|
||||
import {
|
||||
resolveToLocation,
|
||||
normalizeToLocation
|
||||
} from "./utils/locationUtils.js";
|
||||
|
||||
// React 15 compat
|
||||
const forwardRefShim = C => C;
|
||||
let { forwardRef } = React;
|
||||
if (typeof forwardRef === "undefined") {
|
||||
forwardRef = forwardRefShim;
|
||||
}
|
||||
|
||||
function isModifiedEvent(event) {
|
||||
return !!(event.metaKey || event.altKey || event.ctrlKey || event.shiftKey);
|
||||
}
|
||||
|
||||
const LinkAnchor = forwardRef(
|
||||
(
|
||||
{
|
||||
innerRef, // TODO: deprecate
|
||||
navigate,
|
||||
onClick,
|
||||
...rest
|
||||
},
|
||||
forwardedRef
|
||||
) => {
|
||||
const { target } = rest;
|
||||
|
||||
let props = {
|
||||
...rest,
|
||||
onClick: event => {
|
||||
try {
|
||||
if (onClick) onClick(event);
|
||||
} catch (ex) {
|
||||
event.preventDefault();
|
||||
throw ex;
|
||||
}
|
||||
|
||||
if (
|
||||
!event.defaultPrevented && // onClick prevented default
|
||||
event.button === 0 && // ignore everything but left clicks
|
||||
(!target || target === "_self") && // let browser handle "target=_blank" etc.
|
||||
!isModifiedEvent(event) // ignore clicks with modifier keys
|
||||
) {
|
||||
event.preventDefault();
|
||||
navigate();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// React 15 compat
|
||||
if (forwardRefShim !== forwardRef) {
|
||||
props.ref = forwardedRef || innerRef;
|
||||
} else {
|
||||
props.ref = innerRef;
|
||||
}
|
||||
|
||||
/* eslint-disable-next-line jsx-a11y/anchor-has-content */
|
||||
return <a {...props} />;
|
||||
}
|
||||
);
|
||||
|
||||
if (__DEV__) {
|
||||
LinkAnchor.displayName = "LinkAnchor";
|
||||
}
|
||||
|
||||
/**
|
||||
* The public API for rendering a history-aware <a>.
|
||||
*/
|
||||
const Link = forwardRef(
|
||||
(
|
||||
{
|
||||
component = LinkAnchor,
|
||||
replace,
|
||||
to,
|
||||
innerRef, // TODO: deprecate
|
||||
...rest
|
||||
},
|
||||
forwardedRef
|
||||
) => {
|
||||
return (
|
||||
<RouterContext.Consumer>
|
||||
{context => {
|
||||
invariant(context, "You should not use <Link> outside a <Router>");
|
||||
|
||||
const { history } = context;
|
||||
|
||||
const location = normalizeToLocation(
|
||||
resolveToLocation(to, context.location),
|
||||
context.location
|
||||
);
|
||||
|
||||
const href = location ? history.createHref(location) : "";
|
||||
const props = {
|
||||
...rest,
|
||||
href,
|
||||
navigate() {
|
||||
const location = resolveToLocation(to, context.location);
|
||||
const method = replace ? history.replace : history.push;
|
||||
|
||||
method(location);
|
||||
}
|
||||
};
|
||||
|
||||
// React 15 compat
|
||||
if (forwardRefShim !== forwardRef) {
|
||||
props.ref = forwardedRef || innerRef;
|
||||
} else {
|
||||
props.innerRef = innerRef;
|
||||
}
|
||||
|
||||
return React.createElement(component, props);
|
||||
}}
|
||||
</RouterContext.Consumer>
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
if (__DEV__) {
|
||||
const toType = PropTypes.oneOfType([
|
||||
PropTypes.string,
|
||||
PropTypes.object,
|
||||
PropTypes.func
|
||||
]);
|
||||
const refType = PropTypes.oneOfType([
|
||||
PropTypes.string,
|
||||
PropTypes.func,
|
||||
PropTypes.shape({ current: PropTypes.any })
|
||||
]);
|
||||
|
||||
Link.displayName = "Link";
|
||||
|
||||
Link.propTypes = {
|
||||
innerRef: refType,
|
||||
onClick: PropTypes.func,
|
||||
replace: PropTypes.bool,
|
||||
target: PropTypes.string,
|
||||
to: toType.isRequired
|
||||
};
|
||||
}
|
||||
|
||||
export default Link;
|
125
web/node_modules/react-router-dom/modules/NavLink.js
generated
vendored
Normal file
125
web/node_modules/react-router-dom/modules/NavLink.js
generated
vendored
Normal file
|
@ -0,0 +1,125 @@
|
|||
import React from "react";
|
||||
import { __RouterContext as RouterContext, matchPath } from "react-router";
|
||||
import PropTypes from "prop-types";
|
||||
import invariant from "tiny-invariant";
|
||||
import Link from "./Link.js";
|
||||
import {
|
||||
resolveToLocation,
|
||||
normalizeToLocation
|
||||
} from "./utils/locationUtils.js";
|
||||
|
||||
// React 15 compat
|
||||
const forwardRefShim = C => C;
|
||||
let { forwardRef } = React;
|
||||
if (typeof forwardRef === "undefined") {
|
||||
forwardRef = forwardRefShim;
|
||||
}
|
||||
|
||||
function joinClassnames(...classnames) {
|
||||
return classnames.filter(i => i).join(" ");
|
||||
}
|
||||
|
||||
/**
|
||||
* A <Link> wrapper that knows if it's "active" or not.
|
||||
*/
|
||||
const NavLink = forwardRef(
|
||||
(
|
||||
{
|
||||
"aria-current": ariaCurrent = "page",
|
||||
activeClassName = "active",
|
||||
activeStyle,
|
||||
className: classNameProp,
|
||||
exact,
|
||||
isActive: isActiveProp,
|
||||
location: locationProp,
|
||||
sensitive,
|
||||
strict,
|
||||
style: styleProp,
|
||||
to,
|
||||
innerRef, // TODO: deprecate
|
||||
...rest
|
||||
},
|
||||
forwardedRef
|
||||
) => {
|
||||
return (
|
||||
<RouterContext.Consumer>
|
||||
{context => {
|
||||
invariant(context, "You should not use <NavLink> outside a <Router>");
|
||||
|
||||
const currentLocation = locationProp || context.location;
|
||||
const toLocation = normalizeToLocation(
|
||||
resolveToLocation(to, currentLocation),
|
||||
currentLocation
|
||||
);
|
||||
const { pathname: path } = toLocation;
|
||||
// Regex taken from: https://github.com/pillarjs/path-to-regexp/blob/master/index.js#L202
|
||||
const escapedPath =
|
||||
path && path.replace(/([.+*?=^!:${}()[\]|/\\])/g, "\\$1");
|
||||
|
||||
const match = escapedPath
|
||||
? matchPath(currentLocation.pathname, {
|
||||
path: escapedPath,
|
||||
exact,
|
||||
sensitive,
|
||||
strict
|
||||
})
|
||||
: null;
|
||||
const isActive = !!(isActiveProp
|
||||
? isActiveProp(match, currentLocation)
|
||||
: match);
|
||||
|
||||
const className = isActive
|
||||
? joinClassnames(classNameProp, activeClassName)
|
||||
: classNameProp;
|
||||
const style = isActive ? { ...styleProp, ...activeStyle } : styleProp;
|
||||
|
||||
const props = {
|
||||
"aria-current": (isActive && ariaCurrent) || null,
|
||||
className,
|
||||
style,
|
||||
to: toLocation,
|
||||
...rest
|
||||
};
|
||||
|
||||
// React 15 compat
|
||||
if (forwardRefShim !== forwardRef) {
|
||||
props.ref = forwardedRef || innerRef;
|
||||
} else {
|
||||
props.innerRef = innerRef;
|
||||
}
|
||||
|
||||
return <Link {...props} />;
|
||||
}}
|
||||
</RouterContext.Consumer>
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
if (__DEV__) {
|
||||
NavLink.displayName = "NavLink";
|
||||
|
||||
const ariaCurrentType = PropTypes.oneOf([
|
||||
"page",
|
||||
"step",
|
||||
"location",
|
||||
"date",
|
||||
"time",
|
||||
"true"
|
||||
]);
|
||||
|
||||
NavLink.propTypes = {
|
||||
...Link.propTypes,
|
||||
"aria-current": ariaCurrentType,
|
||||
activeClassName: PropTypes.string,
|
||||
activeStyle: PropTypes.object,
|
||||
className: PropTypes.string,
|
||||
exact: PropTypes.bool,
|
||||
isActive: PropTypes.func,
|
||||
location: PropTypes.object,
|
||||
sensitive: PropTypes.bool,
|
||||
strict: PropTypes.bool,
|
||||
style: PropTypes.object
|
||||
};
|
||||
}
|
||||
|
||||
export default NavLink;
|
21
web/node_modules/react-router-dom/modules/index.js
generated
vendored
Normal file
21
web/node_modules/react-router-dom/modules/index.js
generated
vendored
Normal file
|
@ -0,0 +1,21 @@
|
|||
export {
|
||||
MemoryRouter,
|
||||
Prompt,
|
||||
Redirect,
|
||||
Route,
|
||||
Router,
|
||||
StaticRouter,
|
||||
Switch,
|
||||
generatePath,
|
||||
matchPath,
|
||||
withRouter,
|
||||
useHistory,
|
||||
useLocation,
|
||||
useParams,
|
||||
useRouteMatch
|
||||
} from "react-router";
|
||||
|
||||
export { default as BrowserRouter } from "./BrowserRouter.js";
|
||||
export { default as HashRouter } from "./HashRouter.js";
|
||||
export { default as Link } from "./Link.js";
|
||||
export { default as NavLink } from "./NavLink.js";
|
10
web/node_modules/react-router-dom/modules/utils/locationUtils.js
generated
vendored
Normal file
10
web/node_modules/react-router-dom/modules/utils/locationUtils.js
generated
vendored
Normal file
|
@ -0,0 +1,10 @@
|
|||
import { createLocation } from "history";
|
||||
|
||||
export const resolveToLocation = (to, currentLocation) =>
|
||||
typeof to === "function" ? to(currentLocation) : to;
|
||||
|
||||
export const normalizeToLocation = (to, currentLocation) => {
|
||||
return typeof to === "string"
|
||||
? createLocation(to, null, null, currentLocation)
|
||||
: to;
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue