зеркало из https://github.com/mozilla/gecko-dev.git
Backed out changeset 9029ee56b1ad (bug 1413860) for mochitest clipboard failures on browser_jsterm_selfxss.js. r=backout on a CLOSED TREE
--HG-- extra : amend_source : 905d4c8798d1e1947f716d350fd199ebd0d2ae79
This commit is contained in:
Родитель
ef4bd1778a
Коммит
0a20dc62d7
|
@ -33,10 +33,6 @@ require.config({
|
|||
JSONView.debug
|
||||
? "resource://devtools-client-shared/vendor/react-dom-dev"
|
||||
: "resource://devtools-client-shared/vendor/react-dom",
|
||||
"devtools/client/shared/vendor/react-prop-types":
|
||||
JSONView.debug
|
||||
? "resource://devtools-client-shared/vendor/react-prop-types-dev"
|
||||
: "resource://devtools-client-shared/vendor/react-prop-types",
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -107,8 +107,6 @@ function BrowserLoaderBuilder({ baseURI, window, useOnlyShared, commonLibRequire
|
|||
"resource://devtools/client/shared/vendor/react-dom-dev";
|
||||
dynamicPaths["devtools/client/shared/vendor/react-dom-server"] =
|
||||
"resource://devtools/client/shared/vendor/react-dom-server-dev";
|
||||
dynamicPaths["devtools/client/shared/vendor/react-prop-types"] =
|
||||
"resource://devtools/client/shared/vendor/react-prop-types-dev";
|
||||
}
|
||||
|
||||
const opts = {
|
||||
|
|
|
@ -4,9 +4,7 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
const { Component } = require("devtools/client/shared/vendor/react");
|
||||
const dom = require("devtools/client/shared/vendor/react-dom-factories");
|
||||
const PropTypes = require("devtools/client/shared/vendor/react-prop-types");
|
||||
const { DOM: dom, Component, PropTypes } = require("devtools/client/shared/vendor/react");
|
||||
|
||||
class AutocompletePopup extends Component {
|
||||
static get propTypes() {
|
||||
|
|
|
@ -4,11 +4,9 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
const { Component } = require("devtools/client/shared/vendor/react");
|
||||
const dom = require("devtools/client/shared/vendor/react-dom-factories");
|
||||
const PropTypes = require("devtools/client/shared/vendor/react-prop-types");
|
||||
const { getSourceNames, parseURL, isScratchpadScheme, getSourceMappedFile } =
|
||||
require("devtools/client/shared/source-utils");
|
||||
const { DOM: dom, Component, PropTypes } = require("devtools/client/shared/vendor/react");
|
||||
const { getSourceNames, parseURL,
|
||||
isScratchpadScheme, getSourceMappedFile } = require("devtools/client/shared/source-utils");
|
||||
const { LocalizationHelper } = require("devtools/shared/l10n");
|
||||
|
||||
const l10n = new LocalizationHelper("devtools/client/locales/components.properties");
|
||||
|
|
|
@ -23,9 +23,11 @@
|
|||
// | | |
|
||||
// +-----------------------+---------------------+
|
||||
|
||||
const { Component } = require("devtools/client/shared/vendor/react");
|
||||
const PropTypes = require("devtools/client/shared/vendor/react-prop-types");
|
||||
const dom = require("devtools/client/shared/vendor/react-dom-factories");
|
||||
const {
|
||||
DOM: dom,
|
||||
Component,
|
||||
PropTypes,
|
||||
} = require("devtools/client/shared/vendor/react");
|
||||
const { assert } = require("devtools/shared/DevToolsUtils");
|
||||
|
||||
class HSplitBox extends Component {
|
||||
|
|
|
@ -4,14 +4,14 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
const { Component } = require("devtools/client/shared/vendor/react");
|
||||
const PropTypes = require("devtools/client/shared/vendor/react-prop-types");
|
||||
const dom = require("devtools/client/shared/vendor/react-dom-factories");
|
||||
const React = require("devtools/client/shared/vendor/react");
|
||||
const Immutable = require("devtools/client/shared/vendor/immutable");
|
||||
const { LocalizationHelper } = require("devtools/shared/l10n");
|
||||
|
||||
const l10n = new LocalizationHelper("devtools/client/locales/components.properties");
|
||||
const { div, span, button } = dom;
|
||||
|
||||
// Shortcuts
|
||||
const { PropTypes, Component, DOM } = React;
|
||||
const { div, span, button } = DOM;
|
||||
|
||||
// Priority Levels
|
||||
const PriorityLevels = {
|
||||
|
@ -231,12 +231,12 @@ class NotificationBox extends Component {
|
|||
div({
|
||||
key: notification.value,
|
||||
className: "notification",
|
||||
"data-key": notification.value,
|
||||
"data-type": notification.type},
|
||||
div({className: "notificationInner"},
|
||||
div({className: "details"},
|
||||
div({
|
||||
className: "messageImage",
|
||||
"data-key": notification.value,
|
||||
"data-type": notification.type}),
|
||||
span({className: "messageText"},
|
||||
notification.label
|
||||
|
|
|
@ -6,9 +6,7 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
const { Component, createFactory } = require("devtools/client/shared/vendor/react");
|
||||
const PropTypes = require("devtools/client/shared/vendor/react-prop-types");
|
||||
const dom = require("devtools/client/shared/vendor/react-dom-factories");
|
||||
const { DOM: dom, Component, PropTypes, createFactory } = require("devtools/client/shared/vendor/react");
|
||||
const KeyShortcuts = require("devtools/client/shared/key-shortcuts");
|
||||
const AutocompletePopup = createFactory(require("devtools/client/shared/components/AutoCompletePopup"));
|
||||
|
||||
|
|
|
@ -6,12 +6,10 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
const { Component } = require("devtools/client/shared/vendor/react");
|
||||
const dom = require("devtools/client/shared/vendor/react-dom-factories");
|
||||
const PropTypes = require("devtools/client/shared/vendor/react-prop-types");
|
||||
const { DOM, Component, PropTypes } = require("devtools/client/shared/vendor/react");
|
||||
|
||||
// Shortcuts
|
||||
const { button } = dom;
|
||||
const { button } = DOM;
|
||||
|
||||
/**
|
||||
* Sidebar toggle button. This button is used to exapand
|
||||
|
|
|
@ -4,9 +4,8 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
const { Component, createFactory } = require("devtools/client/shared/vendor/react");
|
||||
const PropTypes = require("devtools/client/shared/vendor/react-prop-types");
|
||||
const dom = require("devtools/client/shared/vendor/react-dom-factories");
|
||||
const React = require("devtools/client/shared/vendor/react");
|
||||
const { DOM: dom, Component, createFactory, PropTypes } = React;
|
||||
const { LocalizationHelper } = require("devtools/shared/l10n");
|
||||
const Frame = createFactory(require("./Frame"));
|
||||
|
||||
|
|
|
@ -4,9 +4,8 @@
|
|||
/* eslint-env browser */
|
||||
"use strict";
|
||||
|
||||
const { Component, createFactory } = require("devtools/client/shared/vendor/react");
|
||||
const PropTypes = require("devtools/client/shared/vendor/react-prop-types");
|
||||
const dom = require("devtools/client/shared/vendor/react-dom-factories");
|
||||
const React = require("devtools/client/shared/vendor/react");
|
||||
const { DOM: dom, Component, createFactory, PropTypes } = React;
|
||||
|
||||
const AUTO_EXPAND_DEPTH = 0;
|
||||
const NUMBER_OF_OFFSCREEN_ITEMS = 1;
|
||||
|
|
|
@ -4,10 +4,9 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
const { Component } = require("devtools/client/shared/vendor/react");
|
||||
const PropTypes = require("devtools/client/shared/vendor/react-prop-types");
|
||||
const dom = require("devtools/client/shared/vendor/react-dom-factories");
|
||||
const React = require("devtools/client/shared/vendor/react");
|
||||
const ReactDOM = require("devtools/client/shared/vendor/react-dom");
|
||||
const { Component, DOM: dom, PropTypes } = React;
|
||||
|
||||
class Draggable extends Component {
|
||||
static get propTypes() {
|
||||
|
|
|
@ -4,11 +4,10 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
const { Component, createFactory } = require("devtools/client/shared/vendor/react");
|
||||
const PropTypes = require("devtools/client/shared/vendor/react-prop-types");
|
||||
const dom = require("devtools/client/shared/vendor/react-dom-factories");
|
||||
const React = require("devtools/client/shared/vendor/react");
|
||||
const ReactDOM = require("devtools/client/shared/vendor/react-dom");
|
||||
const Draggable = createFactory(require("devtools/client/shared/components/splitter/Draggable"));
|
||||
const Draggable = React.createFactory(require("devtools/client/shared/components/splitter/Draggable"));
|
||||
const { Component, DOM: dom, PropTypes } = React;
|
||||
|
||||
/**
|
||||
* This component represents a Splitter. The splitter supports vertical
|
||||
|
|
|
@ -8,16 +8,14 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
const { Component, createFactory } = require("devtools/client/shared/vendor/react");
|
||||
const PropTypes = require("devtools/client/shared/vendor/react-prop-types");
|
||||
const dom = require("devtools/client/shared/vendor/react-dom-factories");
|
||||
const { DOM, Component, PropTypes, createFactory } = require("devtools/client/shared/vendor/react");
|
||||
const Tabs = createFactory(require("devtools/client/shared/components/tabs/Tabs").Tabs);
|
||||
|
||||
const Menu = require("devtools/client/framework/menu");
|
||||
const MenuItem = require("devtools/client/framework/menu-item");
|
||||
|
||||
// Shortcuts
|
||||
const { div } = dom;
|
||||
const { div } = DOM;
|
||||
|
||||
/**
|
||||
* Renders Tabbar component.
|
||||
|
|
|
@ -7,9 +7,8 @@
|
|||
"use strict";
|
||||
|
||||
define(function (require, exports, module) {
|
||||
const { Component } = require("devtools/client/shared/vendor/react");
|
||||
const dom = require("devtools/client/shared/vendor/react-dom-factories");
|
||||
const PropTypes = require("devtools/client/shared/vendor/react-prop-types");
|
||||
const React = require("devtools/client/shared/vendor/react");
|
||||
const { Component, DOM } = React;
|
||||
const { findDOMNode } = require("devtools/client/shared/vendor/react-dom");
|
||||
|
||||
/**
|
||||
|
@ -35,26 +34,26 @@ define(function (require, exports, module) {
|
|||
class Tabs extends Component {
|
||||
static get propTypes() {
|
||||
return {
|
||||
className: PropTypes.oneOfType([
|
||||
PropTypes.array,
|
||||
PropTypes.string,
|
||||
PropTypes.object
|
||||
className: React.PropTypes.oneOfType([
|
||||
React.PropTypes.array,
|
||||
React.PropTypes.string,
|
||||
React.PropTypes.object
|
||||
]),
|
||||
tabActive: PropTypes.number,
|
||||
onMount: PropTypes.func,
|
||||
onBeforeChange: PropTypes.func,
|
||||
onAfterChange: PropTypes.func,
|
||||
children: PropTypes.oneOfType([
|
||||
PropTypes.array,
|
||||
PropTypes.element
|
||||
tabActive: React.PropTypes.number,
|
||||
onMount: React.PropTypes.func,
|
||||
onBeforeChange: React.PropTypes.func,
|
||||
onAfterChange: React.PropTypes.func,
|
||||
children: React.PropTypes.oneOfType([
|
||||
React.PropTypes.array,
|
||||
React.PropTypes.element
|
||||
]).isRequired,
|
||||
showAllTabsMenu: PropTypes.bool,
|
||||
onAllTabsMenuClick: PropTypes.func,
|
||||
showAllTabsMenu: React.PropTypes.bool,
|
||||
onAllTabsMenuClick: React.PropTypes.func,
|
||||
|
||||
// Set true will only render selected panel on DOM. It's complete
|
||||
// opposite of the created array, and it's useful if panels content
|
||||
// is unpredictable and update frequently.
|
||||
renderOnlySelected: PropTypes.bool,
|
||||
renderOnlySelected: React.PropTypes.bool,
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -268,14 +267,14 @@ define(function (require, exports, module) {
|
|||
// left and right arrow keys.
|
||||
// See also `onKeyDown()` event handler.
|
||||
return (
|
||||
dom.li({
|
||||
DOM.li({
|
||||
className,
|
||||
key: index,
|
||||
ref,
|
||||
role: "presentation",
|
||||
},
|
||||
dom.span({className: "devtools-tab-line"}),
|
||||
dom.a({
|
||||
DOM.span({className: "devtools-tab-line"}),
|
||||
DOM.a({
|
||||
id: id ? id + "-tab" : "tab-" + index,
|
||||
tabIndex: isTabSelected ? 0 : -1,
|
||||
"aria-controls": id ? id + "-panel" : "panel-" + index,
|
||||
|
@ -285,7 +284,7 @@ define(function (require, exports, module) {
|
|||
},
|
||||
title,
|
||||
badge && !isTabSelected && showBadge() ?
|
||||
dom.span({ className: "tab-badge" }, badge)
|
||||
DOM.span({ className: "tab-badge" }, badge)
|
||||
:
|
||||
null
|
||||
)
|
||||
|
@ -296,15 +295,15 @@ define(function (require, exports, module) {
|
|||
// Display the menu only if there is not enough horizontal
|
||||
// space for all tabs (and overflow happened).
|
||||
let allTabsMenu = this.state.overflow ? (
|
||||
dom.div({
|
||||
DOM.div({
|
||||
className: "all-tabs-menu",
|
||||
onClick: this.props.onAllTabsMenuClick,
|
||||
})
|
||||
) : null;
|
||||
|
||||
return (
|
||||
dom.nav({className: "tabs-navigation"},
|
||||
dom.ul({className: "tabs-menu", role: "tablist"},
|
||||
DOM.nav({className: "tabs-navigation"},
|
||||
DOM.ul({className: "tabs-menu", role: "tablist"},
|
||||
tabs
|
||||
),
|
||||
allTabsMenu
|
||||
|
@ -352,7 +351,7 @@ define(function (require, exports, module) {
|
|||
let panel = tab.panel || tab;
|
||||
|
||||
return (
|
||||
dom.div({
|
||||
DOM.div({
|
||||
id: id ? id + "-panel" : "panel-" + index,
|
||||
key: index,
|
||||
style: style,
|
||||
|
@ -366,7 +365,7 @@ define(function (require, exports, module) {
|
|||
});
|
||||
|
||||
return (
|
||||
dom.div({className: "panels"},
|
||||
DOM.div({className: "panels"},
|
||||
panels
|
||||
)
|
||||
);
|
||||
|
@ -374,7 +373,7 @@ define(function (require, exports, module) {
|
|||
|
||||
render() {
|
||||
return (
|
||||
dom.div({ className: ["tabs", this.props.className].join(" ") },
|
||||
DOM.div({ className: ["tabs", this.props.className].join(" ") },
|
||||
this.renderMenuItems(),
|
||||
this.renderPanels()
|
||||
)
|
||||
|
@ -388,16 +387,16 @@ define(function (require, exports, module) {
|
|||
class Panel extends Component {
|
||||
static get propTypes() {
|
||||
return {
|
||||
title: PropTypes.string.isRequired,
|
||||
children: PropTypes.oneOfType([
|
||||
PropTypes.array,
|
||||
PropTypes.element
|
||||
title: React.PropTypes.string.isRequired,
|
||||
children: React.PropTypes.oneOfType([
|
||||
React.PropTypes.array,
|
||||
React.PropTypes.element
|
||||
]).isRequired
|
||||
};
|
||||
}
|
||||
|
||||
render() {
|
||||
return dom.div({className: "tab-panel"},
|
||||
return DOM.div({className: "tab-panel"},
|
||||
this.props.children
|
||||
);
|
||||
}
|
||||
|
|
|
@ -28,9 +28,8 @@ var { require: browserRequire } = BrowserLoader({
|
|||
window
|
||||
});
|
||||
|
||||
let React = browserRequire("devtools/client/shared/vendor/react");
|
||||
let ReactDOM = browserRequire("devtools/client/shared/vendor/react-dom");
|
||||
let dom = browserRequire("devtools/client/shared/vendor/react-dom-factories");
|
||||
let React = browserRequire("devtools/client/shared/vendor/react");
|
||||
var TestUtils = React.addons.TestUtils;
|
||||
|
||||
var EXAMPLE_URL = "http://example.com/browser/browser/devtools/shared/test/";
|
||||
|
@ -201,7 +200,7 @@ function renderComponent(component, props) {
|
|||
// By default, renderIntoDocument() won't work for stateless components, but
|
||||
// it will work if the stateless component is wrapped in a stateful one.
|
||||
// See https://github.com/facebook/react/issues/4839
|
||||
const wrappedEl = dom.span({}, [el]);
|
||||
const wrappedEl = React.DOM.span({}, [el]);
|
||||
const renderedComponent = TestUtils.renderIntoDocument(wrappedEl);
|
||||
return ReactDOM.findDOMNode(renderedComponent).children[0];
|
||||
}
|
||||
|
|
|
@ -26,8 +26,7 @@ Test all-tabs menu.
|
|||
window.onload = Task.async(function* () {
|
||||
try {
|
||||
const ReactDOM = browserRequire("devtools/client/shared/vendor/react-dom");
|
||||
const { Component, createFactory } = browserRequire("devtools/client/shared/vendor/react");
|
||||
const dom = require("devtools/client/shared/vendor/react-dom-factories");
|
||||
const { Component, createFactory, DOM } = browserRequire("devtools/client/shared/vendor/react");
|
||||
const Tabbar = createFactory(browserRequire("devtools/client/shared/components/tabs/TabBar"));
|
||||
|
||||
// Create container for the TabBar. Set smaller width
|
||||
|
@ -48,7 +47,7 @@ window.onload = Task.async(function* () {
|
|||
|
||||
class TabPanelClass extends Component {
|
||||
render() {
|
||||
return dom.div({}, "content");
|
||||
return DOM.div({}, "content");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -21,13 +21,11 @@ window.onload = Task.async(function* () {
|
|||
try {
|
||||
const ReactDOM = browserRequire("devtools/client/shared/vendor/react-dom");
|
||||
const React = browserRequire("devtools/client/shared/vendor/react");
|
||||
const dom = require("devtools/client/shared/vendor/react-dom-factories");
|
||||
const Tree =
|
||||
React.createFactory(browserRequire("devtools/client/shared/components/Tree"));
|
||||
const Tree = React.createFactory(browserRequire("devtools/client/shared/components/Tree"));
|
||||
|
||||
const treeProps = Object.assign({}, TEST_TREE_INTERFACE, {
|
||||
renderItem: (item, depth, focused, arrow) => {
|
||||
return dom.div(
|
||||
return React.DOM.div(
|
||||
{
|
||||
id: item,
|
||||
style: { marginLeft: depth * 16 + "px" }
|
||||
|
|
|
@ -7,9 +7,9 @@
|
|||
|
||||
// Make this available to both AMD and CJS environments
|
||||
define(function (require, exports, module) {
|
||||
const { Component } = require("devtools/client/shared/vendor/react");
|
||||
const dom = require("devtools/client/shared/vendor/react-dom-factories");
|
||||
const PropTypes = require("devtools/client/shared/vendor/react-prop-types");
|
||||
// ReactJS
|
||||
const { Component, DOM: dom, PropTypes } =
|
||||
require("devtools/client/shared/vendor/react");
|
||||
|
||||
/**
|
||||
* Render the default cell used for toggle buttons
|
||||
|
|
|
@ -7,10 +7,9 @@
|
|||
|
||||
// Make this available to both AMD and CJS environments
|
||||
define(function (require, exports, module) {
|
||||
const { Component } = require("devtools/client/shared/vendor/react");
|
||||
const PropTypes = require("devtools/client/shared/vendor/react-prop-types");
|
||||
const dom = require("devtools/client/shared/vendor/react-dom-factories");
|
||||
const { input, span, td } = dom;
|
||||
const React = require("devtools/client/shared/vendor/react");
|
||||
const { Component, PropTypes } = React;
|
||||
const { input, span, td } = React.DOM;
|
||||
|
||||
/**
|
||||
* This template represents a cell in TreeView row. It's rendered
|
||||
|
|
|
@ -7,10 +7,9 @@
|
|||
|
||||
// Make this available to both AMD and CJS environments
|
||||
define(function (require, exports, module) {
|
||||
const { Component } = require("devtools/client/shared/vendor/react");
|
||||
const PropTypes = require("devtools/client/shared/vendor/react-prop-types");
|
||||
const dom = require("devtools/client/shared/vendor/react-dom-factories");
|
||||
const { thead, tr, td, div } = dom;
|
||||
const React = require("devtools/client/shared/vendor/react");
|
||||
const { Component, PropTypes } = React;
|
||||
const { thead, tr, td, div } = React.DOM;
|
||||
|
||||
/**
|
||||
* This component is responsible for rendering tree header.
|
||||
|
|
|
@ -7,11 +7,10 @@
|
|||
|
||||
// Make this available to both AMD and CJS environments
|
||||
define(function (require, exports, module) {
|
||||
const { Component, createFactory } = require("devtools/client/shared/vendor/react");
|
||||
const PropTypes = require("devtools/client/shared/vendor/react-prop-types");
|
||||
const dom = require("devtools/client/shared/vendor/react-dom-factories");
|
||||
const React = require("devtools/client/shared/vendor/react");
|
||||
const { Component, createFactory, PropTypes } = React;
|
||||
const { findDOMNode } = require("devtools/client/shared/vendor/react-dom");
|
||||
const { tr } = dom;
|
||||
const { tr } = React.DOM;
|
||||
|
||||
// Tree
|
||||
const TreeCell = createFactory(require("./TreeCell"));
|
||||
|
|
|
@ -7,11 +7,9 @@
|
|||
|
||||
// Make this available to both AMD and CJS environments
|
||||
define(function (require, exports, module) {
|
||||
const { cloneElement, Component, createFactory } =
|
||||
const { cloneElement, Component, createFactory, DOM: dom, PropTypes } =
|
||||
require("devtools/client/shared/vendor/react");
|
||||
const { findDOMNode } = require("devtools/client/shared/vendor/react-dom");
|
||||
const PropTypes = require("devtools/client/shared/vendor/react-prop-types");
|
||||
const dom = require("devtools/client/shared/vendor/react-dom-factories");
|
||||
|
||||
// Reps
|
||||
const { ObjectProvider } = require("./ObjectProvider");
|
||||
|
|
|
@ -1,37 +0,0 @@
|
|||
[//]: # (
|
||||
This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
)
|
||||
|
||||
# Upgrading react-prop-types
|
||||
|
||||
## Getting the Source
|
||||
|
||||
```bash
|
||||
git clone the latest version from https://github.com/facebook/prop-types
|
||||
cd prop-types
|
||||
```
|
||||
|
||||
## Building
|
||||
|
||||
```bash
|
||||
npm install
|
||||
NODE_ENV=development browserify index.js -t envify --standalone PropTypes -o react-prop-types-dev.js
|
||||
NODE_ENV=production browserify index.js -t envify --standalone PropTypes -o react-prop-types.js
|
||||
```
|
||||
|
||||
## Adding Version Info
|
||||
|
||||
Add the version to the top of `react-prop-types.js` and `react-prop-types-dev.js`.
|
||||
|
||||
```js
|
||||
/**
|
||||
* react-prop-types v15.6.0
|
||||
*/
|
||||
```
|
||||
|
||||
## Copying files to your Firefox repo
|
||||
|
||||
```bash
|
||||
mv react-prop-types.js /firefox/repo/devtools/client/shared/vendor/react-prop-types-dev.js
|
||||
mv react-prop-types-dev.js /firefox/repo/devtools/client/shared/vendor/react-prop-types-dev.js
|
||||
```
|
|
@ -1,5 +1,5 @@
|
|||
[//]: # (
|
||||
This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with thisfile, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
)
|
||||
|
||||
# Upgrading React
|
||||
|
|
|
@ -8,16 +8,28 @@ DIRS += [
|
|||
'stringvalidator',
|
||||
]
|
||||
|
||||
DevToolsModules(
|
||||
modules = []
|
||||
modules += [
|
||||
'immutable.js',
|
||||
'jsol.js',
|
||||
'jszip.js',
|
||||
'lodash.js',
|
||||
'react-addons-shallow-compare.js',
|
||||
'react-dom-factories.js',
|
||||
]
|
||||
|
||||
# react dev versions are used if either debug mode is enabled,
|
||||
# or enable-debug-js-modules is set in .mozconfig so include it for
|
||||
# both
|
||||
if CONFIG['DEBUG_JS_MODULES'] or CONFIG['MOZ_DEBUG']:
|
||||
modules += [
|
||||
'react-dev.js',
|
||||
'react-dom-dev.js',
|
||||
'react-dom-server-dev.js',
|
||||
]
|
||||
|
||||
modules += [
|
||||
'react-dom-server.js',
|
||||
'react-dom.js',
|
||||
'react-prop-types.js',
|
||||
'react-redux.js',
|
||||
'react-virtualized.js',
|
||||
'react.js',
|
||||
|
@ -26,15 +38,6 @@ DevToolsModules(
|
|||
'seamless-immutable.js',
|
||||
'WasmDis.js',
|
||||
'WasmParser.js',
|
||||
)
|
||||
]
|
||||
|
||||
# react dev versions are used if either debug mode is enabled,
|
||||
# or enable-debug-js-modules is set in .mozconfig so include it for
|
||||
# both
|
||||
if CONFIG['DEBUG_JS_MODULES'] or CONFIG['MOZ_DEBUG']:
|
||||
DevToolsModules(
|
||||
'react-dev.js',
|
||||
'react-dom-dev.js',
|
||||
'react-dom-server-dev.js',
|
||||
'react-prop-types-dev.js',
|
||||
)
|
||||
DevToolsModules(*modules)
|
||||
|
|
|
@ -1,195 +0,0 @@
|
|||
'use strict';
|
||||
|
||||
/**
|
||||
* Copyright (c) 2015-present, Facebook, Inc.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
(function(f) {
|
||||
if (typeof exports === 'object' && typeof module !== 'undefined') {
|
||||
module.exports = f(require('devtools/client/shared/vendor/react'));
|
||||
/* global define */
|
||||
} else if (typeof define === 'function' && define.amd) {
|
||||
define(['devtools/client/shared/vendor/react'], f);
|
||||
} else {
|
||||
var g;
|
||||
if (typeof window !== 'undefined') {
|
||||
g = window;
|
||||
} else if (typeof global !== 'undefined') {
|
||||
g = global;
|
||||
} else if (typeof self !== 'undefined') {
|
||||
g = self;
|
||||
} else {
|
||||
g = this;
|
||||
}
|
||||
|
||||
if (typeof g.React === 'undefined') {
|
||||
throw Error('React module should be required before ReactDOMFactories');
|
||||
}
|
||||
|
||||
g.ReactDOMFactories = f(g.React);
|
||||
}
|
||||
})(function(React) {
|
||||
/**
|
||||
* Create a factory that creates HTML tag elements.
|
||||
*/
|
||||
function createDOMFactory(type) {
|
||||
var factory = React.createElement.bind(null, type);
|
||||
// Expose the type on the factory and the prototype so that it can be
|
||||
// easily accessed on elements. E.g. `<Foo />.type === Foo`.
|
||||
// This should not be named `constructor` since this may not be the function
|
||||
// that created the element, and it may not even be a constructor.
|
||||
factory.type = type;
|
||||
return factory;
|
||||
};
|
||||
|
||||
/**
|
||||
* Creates a mapping from supported HTML tags to `ReactDOMComponent` classes.
|
||||
*/
|
||||
var ReactDOMFactories = {
|
||||
a: createDOMFactory('a'),
|
||||
abbr: createDOMFactory('abbr'),
|
||||
address: createDOMFactory('address'),
|
||||
area: createDOMFactory('area'),
|
||||
article: createDOMFactory('article'),
|
||||
aside: createDOMFactory('aside'),
|
||||
audio: createDOMFactory('audio'),
|
||||
b: createDOMFactory('b'),
|
||||
base: createDOMFactory('base'),
|
||||
bdi: createDOMFactory('bdi'),
|
||||
bdo: createDOMFactory('bdo'),
|
||||
big: createDOMFactory('big'),
|
||||
blockquote: createDOMFactory('blockquote'),
|
||||
body: createDOMFactory('body'),
|
||||
br: createDOMFactory('br'),
|
||||
button: createDOMFactory('button'),
|
||||
canvas: createDOMFactory('canvas'),
|
||||
caption: createDOMFactory('caption'),
|
||||
cite: createDOMFactory('cite'),
|
||||
code: createDOMFactory('code'),
|
||||
col: createDOMFactory('col'),
|
||||
colgroup: createDOMFactory('colgroup'),
|
||||
data: createDOMFactory('data'),
|
||||
datalist: createDOMFactory('datalist'),
|
||||
dd: createDOMFactory('dd'),
|
||||
del: createDOMFactory('del'),
|
||||
details: createDOMFactory('details'),
|
||||
dfn: createDOMFactory('dfn'),
|
||||
dialog: createDOMFactory('dialog'),
|
||||
div: createDOMFactory('div'),
|
||||
dl: createDOMFactory('dl'),
|
||||
dt: createDOMFactory('dt'),
|
||||
em: createDOMFactory('em'),
|
||||
embed: createDOMFactory('embed'),
|
||||
fieldset: createDOMFactory('fieldset'),
|
||||
figcaption: createDOMFactory('figcaption'),
|
||||
figure: createDOMFactory('figure'),
|
||||
footer: createDOMFactory('footer'),
|
||||
form: createDOMFactory('form'),
|
||||
h1: createDOMFactory('h1'),
|
||||
h2: createDOMFactory('h2'),
|
||||
h3: createDOMFactory('h3'),
|
||||
h4: createDOMFactory('h4'),
|
||||
h5: createDOMFactory('h5'),
|
||||
h6: createDOMFactory('h6'),
|
||||
head: createDOMFactory('head'),
|
||||
header: createDOMFactory('header'),
|
||||
hgroup: createDOMFactory('hgroup'),
|
||||
hr: createDOMFactory('hr'),
|
||||
html: createDOMFactory('html'),
|
||||
i: createDOMFactory('i'),
|
||||
iframe: createDOMFactory('iframe'),
|
||||
img: createDOMFactory('img'),
|
||||
input: createDOMFactory('input'),
|
||||
ins: createDOMFactory('ins'),
|
||||
kbd: createDOMFactory('kbd'),
|
||||
keygen: createDOMFactory('keygen'),
|
||||
label: createDOMFactory('label'),
|
||||
legend: createDOMFactory('legend'),
|
||||
li: createDOMFactory('li'),
|
||||
link: createDOMFactory('link'),
|
||||
main: createDOMFactory('main'),
|
||||
map: createDOMFactory('map'),
|
||||
mark: createDOMFactory('mark'),
|
||||
menu: createDOMFactory('menu'),
|
||||
menuitem: createDOMFactory('menuitem'),
|
||||
meta: createDOMFactory('meta'),
|
||||
meter: createDOMFactory('meter'),
|
||||
nav: createDOMFactory('nav'),
|
||||
noscript: createDOMFactory('noscript'),
|
||||
object: createDOMFactory('object'),
|
||||
ol: createDOMFactory('ol'),
|
||||
optgroup: createDOMFactory('optgroup'),
|
||||
option: createDOMFactory('option'),
|
||||
output: createDOMFactory('output'),
|
||||
p: createDOMFactory('p'),
|
||||
param: createDOMFactory('param'),
|
||||
picture: createDOMFactory('picture'),
|
||||
pre: createDOMFactory('pre'),
|
||||
progress: createDOMFactory('progress'),
|
||||
q: createDOMFactory('q'),
|
||||
rp: createDOMFactory('rp'),
|
||||
rt: createDOMFactory('rt'),
|
||||
ruby: createDOMFactory('ruby'),
|
||||
s: createDOMFactory('s'),
|
||||
samp: createDOMFactory('samp'),
|
||||
script: createDOMFactory('script'),
|
||||
section: createDOMFactory('section'),
|
||||
select: createDOMFactory('select'),
|
||||
small: createDOMFactory('small'),
|
||||
source: createDOMFactory('source'),
|
||||
span: createDOMFactory('span'),
|
||||
strong: createDOMFactory('strong'),
|
||||
style: createDOMFactory('style'),
|
||||
sub: createDOMFactory('sub'),
|
||||
summary: createDOMFactory('summary'),
|
||||
sup: createDOMFactory('sup'),
|
||||
table: createDOMFactory('table'),
|
||||
tbody: createDOMFactory('tbody'),
|
||||
td: createDOMFactory('td'),
|
||||
textarea: createDOMFactory('textarea'),
|
||||
tfoot: createDOMFactory('tfoot'),
|
||||
th: createDOMFactory('th'),
|
||||
thead: createDOMFactory('thead'),
|
||||
time: createDOMFactory('time'),
|
||||
title: createDOMFactory('title'),
|
||||
tr: createDOMFactory('tr'),
|
||||
track: createDOMFactory('track'),
|
||||
u: createDOMFactory('u'),
|
||||
ul: createDOMFactory('ul'),
|
||||
var: createDOMFactory('var'),
|
||||
video: createDOMFactory('video'),
|
||||
wbr: createDOMFactory('wbr'),
|
||||
|
||||
// SVG
|
||||
circle: createDOMFactory('circle'),
|
||||
clipPath: createDOMFactory('clipPath'),
|
||||
defs: createDOMFactory('defs'),
|
||||
ellipse: createDOMFactory('ellipse'),
|
||||
g: createDOMFactory('g'),
|
||||
image: createDOMFactory('image'),
|
||||
line: createDOMFactory('line'),
|
||||
linearGradient: createDOMFactory('linearGradient'),
|
||||
mask: createDOMFactory('mask'),
|
||||
path: createDOMFactory('path'),
|
||||
pattern: createDOMFactory('pattern'),
|
||||
polygon: createDOMFactory('polygon'),
|
||||
polyline: createDOMFactory('polyline'),
|
||||
radialGradient: createDOMFactory('radialGradient'),
|
||||
rect: createDOMFactory('rect'),
|
||||
stop: createDOMFactory('stop'),
|
||||
svg: createDOMFactory('svg'),
|
||||
text: createDOMFactory('text'),
|
||||
tspan: createDOMFactory('tspan'),
|
||||
};
|
||||
|
||||
// due to wrapper and conditionals at the top, this will either become
|
||||
// `module.exports ReactDOMFactories` if that is available,
|
||||
// otherwise it will be defined via `define(['react'], ReactDOMFactories)`
|
||||
// if that is available,
|
||||
// otherwise it will be defined as global variable.
|
||||
return ReactDOMFactories;
|
||||
});
|
||||
|
|
@ -1,960 +0,0 @@
|
|||
/**
|
||||
* react-prop-types v15.6.0
|
||||
*/
|
||||
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.PropTypes = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
|
||||
/**
|
||||
* Copyright (c) 2013-present, Facebook, Inc.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
if ("development" !== 'production') {
|
||||
var invariant = require('fbjs/lib/invariant');
|
||||
var warning = require('fbjs/lib/warning');
|
||||
var ReactPropTypesSecret = require('./lib/ReactPropTypesSecret');
|
||||
var loggedTypeFailures = {};
|
||||
}
|
||||
|
||||
/**
|
||||
* Assert that the values match with the type specs.
|
||||
* Error messages are memorized and will only be shown once.
|
||||
*
|
||||
* @param {object} typeSpecs Map of name to a ReactPropType
|
||||
* @param {object} values Runtime values that need to be type-checked
|
||||
* @param {string} location e.g. "prop", "context", "child context"
|
||||
* @param {string} componentName Name of the component for error messages.
|
||||
* @param {?Function} getStack Returns the component stack.
|
||||
* @private
|
||||
*/
|
||||
function checkPropTypes(typeSpecs, values, location, componentName, getStack) {
|
||||
if ("development" !== 'production') {
|
||||
for (var typeSpecName in typeSpecs) {
|
||||
if (typeSpecs.hasOwnProperty(typeSpecName)) {
|
||||
var error;
|
||||
// Prop type validation may throw. In case they do, we don't want to
|
||||
// fail the render phase where it didn't fail before. So we log it.
|
||||
// After these have been cleaned up, we'll let them throw.
|
||||
try {
|
||||
// This is intentionally an invariant that gets caught. It's the same
|
||||
// behavior as without this statement except with a better message.
|
||||
invariant(typeof typeSpecs[typeSpecName] === 'function', '%s: %s type `%s` is invalid; it must be a function, usually from ' + 'the `prop-types` package, but received `%s`.', componentName || 'React class', location, typeSpecName, typeof typeSpecs[typeSpecName]);
|
||||
error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret);
|
||||
} catch (ex) {
|
||||
error = ex;
|
||||
}
|
||||
warning(!error || error instanceof Error, '%s: type specification of %s `%s` is invalid; the type checker ' + 'function must return `null` or an `Error` but returned a %s. ' + 'You may have forgotten to pass an argument to the type checker ' + 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' + 'shape all require an argument).', componentName || 'React class', location, typeSpecName, typeof error);
|
||||
if (error instanceof Error && !(error.message in loggedTypeFailures)) {
|
||||
// Only monitor this failure once because there tends to be a lot of the
|
||||
// same error.
|
||||
loggedTypeFailures[error.message] = true;
|
||||
|
||||
var stack = getStack ? getStack() : '';
|
||||
|
||||
warning(false, 'Failed %s type: %s%s', location, error.message, stack != null ? stack : '');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = checkPropTypes;
|
||||
|
||||
},{"./lib/ReactPropTypesSecret":5,"fbjs/lib/invariant":7,"fbjs/lib/warning":8}],2:[function(require,module,exports){
|
||||
/**
|
||||
* Copyright (c) 2013-present, Facebook, Inc.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
var emptyFunction = require('fbjs/lib/emptyFunction');
|
||||
var invariant = require('fbjs/lib/invariant');
|
||||
var ReactPropTypesSecret = require('./lib/ReactPropTypesSecret');
|
||||
|
||||
module.exports = function() {
|
||||
function shim(props, propName, componentName, location, propFullName, secret) {
|
||||
if (secret === ReactPropTypesSecret) {
|
||||
// It is still safe when called from React.
|
||||
return;
|
||||
}
|
||||
invariant(
|
||||
false,
|
||||
'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
|
||||
'Use PropTypes.checkPropTypes() to call them. ' +
|
||||
'Read more at http://fb.me/use-check-prop-types'
|
||||
);
|
||||
};
|
||||
shim.isRequired = shim;
|
||||
function getShim() {
|
||||
return shim;
|
||||
};
|
||||
// Important!
|
||||
// Keep this list in sync with production version in `./factoryWithTypeCheckers.js`.
|
||||
var ReactPropTypes = {
|
||||
array: shim,
|
||||
bool: shim,
|
||||
func: shim,
|
||||
number: shim,
|
||||
object: shim,
|
||||
string: shim,
|
||||
symbol: shim,
|
||||
|
||||
any: shim,
|
||||
arrayOf: getShim,
|
||||
element: shim,
|
||||
instanceOf: getShim,
|
||||
node: shim,
|
||||
objectOf: getShim,
|
||||
oneOf: getShim,
|
||||
oneOfType: getShim,
|
||||
shape: getShim,
|
||||
exact: getShim
|
||||
};
|
||||
|
||||
ReactPropTypes.checkPropTypes = emptyFunction;
|
||||
ReactPropTypes.PropTypes = ReactPropTypes;
|
||||
|
||||
return ReactPropTypes;
|
||||
};
|
||||
|
||||
},{"./lib/ReactPropTypesSecret":5,"fbjs/lib/emptyFunction":6,"fbjs/lib/invariant":7}],3:[function(require,module,exports){
|
||||
/**
|
||||
* Copyright (c) 2013-present, Facebook, Inc.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
var emptyFunction = require('fbjs/lib/emptyFunction');
|
||||
var invariant = require('fbjs/lib/invariant');
|
||||
var warning = require('fbjs/lib/warning');
|
||||
var assign = require('object-assign');
|
||||
|
||||
var ReactPropTypesSecret = require('./lib/ReactPropTypesSecret');
|
||||
var checkPropTypes = require('./checkPropTypes');
|
||||
|
||||
module.exports = function(isValidElement, throwOnDirectAccess) {
|
||||
/* global Symbol */
|
||||
var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
|
||||
var FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec.
|
||||
|
||||
/**
|
||||
* Returns the iterator method function contained on the iterable object.
|
||||
*
|
||||
* Be sure to invoke the function with the iterable as context:
|
||||
*
|
||||
* var iteratorFn = getIteratorFn(myIterable);
|
||||
* if (iteratorFn) {
|
||||
* var iterator = iteratorFn.call(myIterable);
|
||||
* ...
|
||||
* }
|
||||
*
|
||||
* @param {?object} maybeIterable
|
||||
* @return {?function}
|
||||
*/
|
||||
function getIteratorFn(maybeIterable) {
|
||||
var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]);
|
||||
if (typeof iteratorFn === 'function') {
|
||||
return iteratorFn;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Collection of methods that allow declaration and validation of props that are
|
||||
* supplied to React components. Example usage:
|
||||
*
|
||||
* var Props = require('ReactPropTypes');
|
||||
* var MyArticle = React.createClass({
|
||||
* propTypes: {
|
||||
* // An optional string prop named "description".
|
||||
* description: Props.string,
|
||||
*
|
||||
* // A required enum prop named "category".
|
||||
* category: Props.oneOf(['News','Photos']).isRequired,
|
||||
*
|
||||
* // A prop named "dialog" that requires an instance of Dialog.
|
||||
* dialog: Props.instanceOf(Dialog).isRequired
|
||||
* },
|
||||
* render: function() { ... }
|
||||
* });
|
||||
*
|
||||
* A more formal specification of how these methods are used:
|
||||
*
|
||||
* type := array|bool|func|object|number|string|oneOf([...])|instanceOf(...)
|
||||
* decl := ReactPropTypes.{type}(.isRequired)?
|
||||
*
|
||||
* Each and every declaration produces a function with the same signature. This
|
||||
* allows the creation of custom validation functions. For example:
|
||||
*
|
||||
* var MyLink = React.createClass({
|
||||
* propTypes: {
|
||||
* // An optional string or URI prop named "href".
|
||||
* href: function(props, propName, componentName) {
|
||||
* var propValue = props[propName];
|
||||
* if (propValue != null && typeof propValue !== 'string' &&
|
||||
* !(propValue instanceof URI)) {
|
||||
* return new Error(
|
||||
* 'Expected a string or an URI for ' + propName + ' in ' +
|
||||
* componentName
|
||||
* );
|
||||
* }
|
||||
* }
|
||||
* },
|
||||
* render: function() {...}
|
||||
* });
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
|
||||
var ANONYMOUS = '<<anonymous>>';
|
||||
|
||||
// Important!
|
||||
// Keep this list in sync with production version in `./factoryWithThrowingShims.js`.
|
||||
var ReactPropTypes = {
|
||||
array: createPrimitiveTypeChecker('array'),
|
||||
bool: createPrimitiveTypeChecker('boolean'),
|
||||
func: createPrimitiveTypeChecker('function'),
|
||||
number: createPrimitiveTypeChecker('number'),
|
||||
object: createPrimitiveTypeChecker('object'),
|
||||
string: createPrimitiveTypeChecker('string'),
|
||||
symbol: createPrimitiveTypeChecker('symbol'),
|
||||
|
||||
any: createAnyTypeChecker(),
|
||||
arrayOf: createArrayOfTypeChecker,
|
||||
element: createElementTypeChecker(),
|
||||
instanceOf: createInstanceTypeChecker,
|
||||
node: createNodeChecker(),
|
||||
objectOf: createObjectOfTypeChecker,
|
||||
oneOf: createEnumTypeChecker,
|
||||
oneOfType: createUnionTypeChecker,
|
||||
shape: createShapeTypeChecker,
|
||||
exact: createStrictShapeTypeChecker,
|
||||
};
|
||||
|
||||
/**
|
||||
* inlined Object.is polyfill to avoid requiring consumers ship their own
|
||||
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
|
||||
*/
|
||||
/*eslint-disable no-self-compare*/
|
||||
function is(x, y) {
|
||||
// SameValue algorithm
|
||||
if (x === y) {
|
||||
// Steps 1-5, 7-10
|
||||
// Steps 6.b-6.e: +0 != -0
|
||||
return x !== 0 || 1 / x === 1 / y;
|
||||
} else {
|
||||
// Step 6.a: NaN == NaN
|
||||
return x !== x && y !== y;
|
||||
}
|
||||
}
|
||||
/*eslint-enable no-self-compare*/
|
||||
|
||||
/**
|
||||
* We use an Error-like object for backward compatibility as people may call
|
||||
* PropTypes directly and inspect their output. However, we don't use real
|
||||
* Errors anymore. We don't inspect their stack anyway, and creating them
|
||||
* is prohibitively expensive if they are created too often, such as what
|
||||
* happens in oneOfType() for any type before the one that matched.
|
||||
*/
|
||||
function PropTypeError(message) {
|
||||
this.message = message;
|
||||
this.stack = '';
|
||||
}
|
||||
// Make `instanceof Error` still work for returned errors.
|
||||
PropTypeError.prototype = Error.prototype;
|
||||
|
||||
function createChainableTypeChecker(validate) {
|
||||
if ("development" !== 'production') {
|
||||
var manualPropTypeCallCache = {};
|
||||
var manualPropTypeWarningCount = 0;
|
||||
}
|
||||
function checkType(isRequired, props, propName, componentName, location, propFullName, secret) {
|
||||
componentName = componentName || ANONYMOUS;
|
||||
propFullName = propFullName || propName;
|
||||
|
||||
if (secret !== ReactPropTypesSecret) {
|
||||
if (throwOnDirectAccess) {
|
||||
// New behavior only for users of `prop-types` package
|
||||
invariant(
|
||||
false,
|
||||
'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
|
||||
'Use `PropTypes.checkPropTypes()` to call them. ' +
|
||||
'Read more at http://fb.me/use-check-prop-types'
|
||||
);
|
||||
} else if ("development" !== 'production' && typeof console !== 'undefined') {
|
||||
// Old behavior for people using React.PropTypes
|
||||
var cacheKey = componentName + ':' + propName;
|
||||
if (
|
||||
!manualPropTypeCallCache[cacheKey] &&
|
||||
// Avoid spamming the console because they are often not actionable except for lib authors
|
||||
manualPropTypeWarningCount < 3
|
||||
) {
|
||||
warning(
|
||||
false,
|
||||
'You are manually calling a React.PropTypes validation ' +
|
||||
'function for the `%s` prop on `%s`. This is deprecated ' +
|
||||
'and will throw in the standalone `prop-types` package. ' +
|
||||
'You may be seeing this warning due to a third-party PropTypes ' +
|
||||
'library. See https://fb.me/react-warning-dont-call-proptypes ' + 'for details.',
|
||||
propFullName,
|
||||
componentName
|
||||
);
|
||||
manualPropTypeCallCache[cacheKey] = true;
|
||||
manualPropTypeWarningCount++;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (props[propName] == null) {
|
||||
if (isRequired) {
|
||||
if (props[propName] === null) {
|
||||
return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required ' + ('in `' + componentName + '`, but its value is `null`.'));
|
||||
}
|
||||
return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required in ' + ('`' + componentName + '`, but its value is `undefined`.'));
|
||||
}
|
||||
return null;
|
||||
} else {
|
||||
return validate(props, propName, componentName, location, propFullName);
|
||||
}
|
||||
}
|
||||
|
||||
var chainedCheckType = checkType.bind(null, false);
|
||||
chainedCheckType.isRequired = checkType.bind(null, true);
|
||||
|
||||
return chainedCheckType;
|
||||
}
|
||||
|
||||
function createPrimitiveTypeChecker(expectedType) {
|
||||
function validate(props, propName, componentName, location, propFullName, secret) {
|
||||
var propValue = props[propName];
|
||||
var propType = getPropType(propValue);
|
||||
if (propType !== expectedType) {
|
||||
// `propValue` being instance of, say, date/regexp, pass the 'object'
|
||||
// check, but we can offer a more precise error message here rather than
|
||||
// 'of type `object`'.
|
||||
var preciseType = getPreciseType(propValue);
|
||||
|
||||
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.'));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
return createChainableTypeChecker(validate);
|
||||
}
|
||||
|
||||
function createAnyTypeChecker() {
|
||||
return createChainableTypeChecker(emptyFunction.thatReturnsNull);
|
||||
}
|
||||
|
||||
function createArrayOfTypeChecker(typeChecker) {
|
||||
function validate(props, propName, componentName, location, propFullName) {
|
||||
if (typeof typeChecker !== 'function') {
|
||||
return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside arrayOf.');
|
||||
}
|
||||
var propValue = props[propName];
|
||||
if (!Array.isArray(propValue)) {
|
||||
var propType = getPropType(propValue);
|
||||
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an array.'));
|
||||
}
|
||||
for (var i = 0; i < propValue.length; i++) {
|
||||
var error = typeChecker(propValue, i, componentName, location, propFullName + '[' + i + ']', ReactPropTypesSecret);
|
||||
if (error instanceof Error) {
|
||||
return error;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
return createChainableTypeChecker(validate);
|
||||
}
|
||||
|
||||
function createElementTypeChecker() {
|
||||
function validate(props, propName, componentName, location, propFullName) {
|
||||
var propValue = props[propName];
|
||||
if (!isValidElement(propValue)) {
|
||||
var propType = getPropType(propValue);
|
||||
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement.'));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
return createChainableTypeChecker(validate);
|
||||
}
|
||||
|
||||
function createInstanceTypeChecker(expectedClass) {
|
||||
function validate(props, propName, componentName, location, propFullName) {
|
||||
if (!(props[propName] instanceof expectedClass)) {
|
||||
var expectedClassName = expectedClass.name || ANONYMOUS;
|
||||
var actualClassName = getClassName(props[propName]);
|
||||
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + actualClassName + '` supplied to `' + componentName + '`, expected ') + ('instance of `' + expectedClassName + '`.'));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
return createChainableTypeChecker(validate);
|
||||
}
|
||||
|
||||
function createEnumTypeChecker(expectedValues) {
|
||||
if (!Array.isArray(expectedValues)) {
|
||||
"development" !== 'production' ? warning(false, 'Invalid argument supplied to oneOf, expected an instance of array.') : void 0;
|
||||
return emptyFunction.thatReturnsNull;
|
||||
}
|
||||
|
||||
function validate(props, propName, componentName, location, propFullName) {
|
||||
var propValue = props[propName];
|
||||
for (var i = 0; i < expectedValues.length; i++) {
|
||||
if (is(propValue, expectedValues[i])) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
var valuesString = JSON.stringify(expectedValues);
|
||||
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of value `' + propValue + '` ' + ('supplied to `' + componentName + '`, expected one of ' + valuesString + '.'));
|
||||
}
|
||||
return createChainableTypeChecker(validate);
|
||||
}
|
||||
|
||||
function createObjectOfTypeChecker(typeChecker) {
|
||||
function validate(props, propName, componentName, location, propFullName) {
|
||||
if (typeof typeChecker !== 'function') {
|
||||
return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside objectOf.');
|
||||
}
|
||||
var propValue = props[propName];
|
||||
var propType = getPropType(propValue);
|
||||
if (propType !== 'object') {
|
||||
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an object.'));
|
||||
}
|
||||
for (var key in propValue) {
|
||||
if (propValue.hasOwnProperty(key)) {
|
||||
var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
|
||||
if (error instanceof Error) {
|
||||
return error;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
return createChainableTypeChecker(validate);
|
||||
}
|
||||
|
||||
function createUnionTypeChecker(arrayOfTypeCheckers) {
|
||||
if (!Array.isArray(arrayOfTypeCheckers)) {
|
||||
"development" !== 'production' ? warning(false, 'Invalid argument supplied to oneOfType, expected an instance of array.') : void 0;
|
||||
return emptyFunction.thatReturnsNull;
|
||||
}
|
||||
|
||||
for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
|
||||
var checker = arrayOfTypeCheckers[i];
|
||||
if (typeof checker !== 'function') {
|
||||
warning(
|
||||
false,
|
||||
'Invalid argument supplied to oneOfType. Expected an array of check functions, but ' +
|
||||
'received %s at index %s.',
|
||||
getPostfixForTypeWarning(checker),
|
||||
i
|
||||
);
|
||||
return emptyFunction.thatReturnsNull;
|
||||
}
|
||||
}
|
||||
|
||||
function validate(props, propName, componentName, location, propFullName) {
|
||||
for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
|
||||
var checker = arrayOfTypeCheckers[i];
|
||||
if (checker(props, propName, componentName, location, propFullName, ReactPropTypesSecret) == null) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`.'));
|
||||
}
|
||||
return createChainableTypeChecker(validate);
|
||||
}
|
||||
|
||||
function createNodeChecker() {
|
||||
function validate(props, propName, componentName, location, propFullName) {
|
||||
if (!isNode(props[propName])) {
|
||||
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a ReactNode.'));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
return createChainableTypeChecker(validate);
|
||||
}
|
||||
|
||||
function createShapeTypeChecker(shapeTypes) {
|
||||
function validate(props, propName, componentName, location, propFullName) {
|
||||
var propValue = props[propName];
|
||||
var propType = getPropType(propValue);
|
||||
if (propType !== 'object') {
|
||||
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
|
||||
}
|
||||
for (var key in shapeTypes) {
|
||||
var checker = shapeTypes[key];
|
||||
if (!checker) {
|
||||
continue;
|
||||
}
|
||||
var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
|
||||
if (error) {
|
||||
return error;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
return createChainableTypeChecker(validate);
|
||||
}
|
||||
|
||||
function createStrictShapeTypeChecker(shapeTypes) {
|
||||
function validate(props, propName, componentName, location, propFullName) {
|
||||
var propValue = props[propName];
|
||||
var propType = getPropType(propValue);
|
||||
if (propType !== 'object') {
|
||||
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
|
||||
}
|
||||
// We need to check all keys in case some are required but missing from
|
||||
// props.
|
||||
var allKeys = assign({}, props[propName], shapeTypes);
|
||||
for (var key in allKeys) {
|
||||
var checker = shapeTypes[key];
|
||||
if (!checker) {
|
||||
return new PropTypeError(
|
||||
'Invalid ' + location + ' `' + propFullName + '` key `' + key + '` supplied to `' + componentName + '`.' +
|
||||
'\nBad object: ' + JSON.stringify(props[propName], null, ' ') +
|
||||
'\nValid keys: ' + JSON.stringify(Object.keys(shapeTypes), null, ' ')
|
||||
);
|
||||
}
|
||||
var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
|
||||
if (error) {
|
||||
return error;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
return createChainableTypeChecker(validate);
|
||||
}
|
||||
|
||||
function isNode(propValue) {
|
||||
switch (typeof propValue) {
|
||||
case 'number':
|
||||
case 'string':
|
||||
case 'undefined':
|
||||
return true;
|
||||
case 'boolean':
|
||||
return !propValue;
|
||||
case 'object':
|
||||
if (Array.isArray(propValue)) {
|
||||
return propValue.every(isNode);
|
||||
}
|
||||
if (propValue === null || isValidElement(propValue)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
var iteratorFn = getIteratorFn(propValue);
|
||||
if (iteratorFn) {
|
||||
var iterator = iteratorFn.call(propValue);
|
||||
var step;
|
||||
if (iteratorFn !== propValue.entries) {
|
||||
while (!(step = iterator.next()).done) {
|
||||
if (!isNode(step.value)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Iterator will provide entry [k,v] tuples rather than values.
|
||||
while (!(step = iterator.next()).done) {
|
||||
var entry = step.value;
|
||||
if (entry) {
|
||||
if (!isNode(entry[1])) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function isSymbol(propType, propValue) {
|
||||
// Native Symbol.
|
||||
if (propType === 'symbol') {
|
||||
return true;
|
||||
}
|
||||
|
||||
// 19.4.3.5 Symbol.prototype[@@toStringTag] === 'Symbol'
|
||||
if (propValue['@@toStringTag'] === 'Symbol') {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Fallback for non-spec compliant Symbols which are polyfilled.
|
||||
if (typeof Symbol === 'function' && propValue instanceof Symbol) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// Equivalent of `typeof` but with special handling for array and regexp.
|
||||
function getPropType(propValue) {
|
||||
var propType = typeof propValue;
|
||||
if (Array.isArray(propValue)) {
|
||||
return 'array';
|
||||
}
|
||||
if (propValue instanceof RegExp) {
|
||||
// Old webkits (at least until Android 4.0) return 'function' rather than
|
||||
// 'object' for typeof a RegExp. We'll normalize this here so that /bla/
|
||||
// passes PropTypes.object.
|
||||
return 'object';
|
||||
}
|
||||
if (isSymbol(propType, propValue)) {
|
||||
return 'symbol';
|
||||
}
|
||||
return propType;
|
||||
}
|
||||
|
||||
// This handles more types than `getPropType`. Only used for error messages.
|
||||
// See `createPrimitiveTypeChecker`.
|
||||
function getPreciseType(propValue) {
|
||||
if (typeof propValue === 'undefined' || propValue === null) {
|
||||
return '' + propValue;
|
||||
}
|
||||
var propType = getPropType(propValue);
|
||||
if (propType === 'object') {
|
||||
if (propValue instanceof Date) {
|
||||
return 'date';
|
||||
} else if (propValue instanceof RegExp) {
|
||||
return 'regexp';
|
||||
}
|
||||
}
|
||||
return propType;
|
||||
}
|
||||
|
||||
// Returns a string that is postfixed to a warning about an invalid type.
|
||||
// For example, "undefined" or "of type array"
|
||||
function getPostfixForTypeWarning(value) {
|
||||
var type = getPreciseType(value);
|
||||
switch (type) {
|
||||
case 'array':
|
||||
case 'object':
|
||||
return 'an ' + type;
|
||||
case 'boolean':
|
||||
case 'date':
|
||||
case 'regexp':
|
||||
return 'a ' + type;
|
||||
default:
|
||||
return type;
|
||||
}
|
||||
}
|
||||
|
||||
// Returns class name of the object, if any.
|
||||
function getClassName(propValue) {
|
||||
if (!propValue.constructor || !propValue.constructor.name) {
|
||||
return ANONYMOUS;
|
||||
}
|
||||
return propValue.constructor.name;
|
||||
}
|
||||
|
||||
ReactPropTypes.checkPropTypes = checkPropTypes;
|
||||
ReactPropTypes.PropTypes = ReactPropTypes;
|
||||
|
||||
return ReactPropTypes;
|
||||
};
|
||||
|
||||
},{"./checkPropTypes":1,"./lib/ReactPropTypesSecret":5,"fbjs/lib/emptyFunction":6,"fbjs/lib/invariant":7,"fbjs/lib/warning":8,"object-assign":9}],4:[function(require,module,exports){
|
||||
/**
|
||||
* Copyright (c) 2013-present, Facebook, Inc.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
if ("development" !== 'production') {
|
||||
var REACT_ELEMENT_TYPE = (typeof Symbol === 'function' &&
|
||||
Symbol.for &&
|
||||
Symbol.for('react.element')) ||
|
||||
0xeac7;
|
||||
|
||||
var isValidElement = function(object) {
|
||||
return typeof object === 'object' &&
|
||||
object !== null &&
|
||||
object.$$typeof === REACT_ELEMENT_TYPE;
|
||||
};
|
||||
|
||||
// By explicitly using `prop-types` you are opting into new development behavior.
|
||||
// http://fb.me/prop-types-in-prod
|
||||
var throwOnDirectAccess = true;
|
||||
module.exports = require('./factoryWithTypeCheckers')(isValidElement, throwOnDirectAccess);
|
||||
} else {
|
||||
// By explicitly using `prop-types` you are opting into new production behavior.
|
||||
// http://fb.me/prop-types-in-prod
|
||||
module.exports = require('./factoryWithThrowingShims')();
|
||||
}
|
||||
|
||||
},{"./factoryWithThrowingShims":2,"./factoryWithTypeCheckers":3}],5:[function(require,module,exports){
|
||||
/**
|
||||
* Copyright (c) 2013-present, Facebook, Inc.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
|
||||
|
||||
module.exports = ReactPropTypesSecret;
|
||||
|
||||
},{}],6:[function(require,module,exports){
|
||||
"use strict";
|
||||
|
||||
/**
|
||||
* Copyright (c) 2013-present, Facebook, Inc.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
function makeEmptyFunction(arg) {
|
||||
return function () {
|
||||
return arg;
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* This function accepts and discards inputs; it has no side effects. This is
|
||||
* primarily useful idiomatically for overridable function endpoints which
|
||||
* always need to be callable, since JS lacks a null-call idiom ala Cocoa.
|
||||
*/
|
||||
var emptyFunction = function emptyFunction() {};
|
||||
|
||||
emptyFunction.thatReturns = makeEmptyFunction;
|
||||
emptyFunction.thatReturnsFalse = makeEmptyFunction(false);
|
||||
emptyFunction.thatReturnsTrue = makeEmptyFunction(true);
|
||||
emptyFunction.thatReturnsNull = makeEmptyFunction(null);
|
||||
emptyFunction.thatReturnsThis = function () {
|
||||
return this;
|
||||
};
|
||||
emptyFunction.thatReturnsArgument = function (arg) {
|
||||
return arg;
|
||||
};
|
||||
|
||||
module.exports = emptyFunction;
|
||||
},{}],7:[function(require,module,exports){
|
||||
/**
|
||||
* Copyright (c) 2013-present, Facebook, Inc.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* Use invariant() to assert state which your program assumes to be true.
|
||||
*
|
||||
* Provide sprintf-style format (only %s is supported) and arguments
|
||||
* to provide information about what broke and what you were
|
||||
* expecting.
|
||||
*
|
||||
* The invariant message will be stripped in production, but the invariant
|
||||
* will remain to ensure logic does not differ in production.
|
||||
*/
|
||||
|
||||
var validateFormat = function validateFormat(format) {};
|
||||
|
||||
if ("development" !== 'production') {
|
||||
validateFormat = function validateFormat(format) {
|
||||
if (format === undefined) {
|
||||
throw new Error('invariant requires an error message argument');
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
function invariant(condition, format, a, b, c, d, e, f) {
|
||||
validateFormat(format);
|
||||
|
||||
if (!condition) {
|
||||
var error;
|
||||
if (format === undefined) {
|
||||
error = new Error('Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.');
|
||||
} else {
|
||||
var args = [a, b, c, d, e, f];
|
||||
var argIndex = 0;
|
||||
error = new Error(format.replace(/%s/g, function () {
|
||||
return args[argIndex++];
|
||||
}));
|
||||
error.name = 'Invariant Violation';
|
||||
}
|
||||
|
||||
error.framesToPop = 1; // we don't care about invariant's own frame
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = invariant;
|
||||
},{}],8:[function(require,module,exports){
|
||||
/**
|
||||
* Copyright (c) 2014-present, Facebook, Inc.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
var emptyFunction = require('./emptyFunction');
|
||||
|
||||
/**
|
||||
* Similar to invariant but only logs a warning if the condition is not met.
|
||||
* This can be used to log issues in development environments in critical
|
||||
* paths. Removing the logging code for production environments will keep the
|
||||
* same logic and follow the same code paths.
|
||||
*/
|
||||
|
||||
var warning = emptyFunction;
|
||||
|
||||
if ("development" !== 'production') {
|
||||
var printWarning = function printWarning(format) {
|
||||
for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
||||
args[_key - 1] = arguments[_key];
|
||||
}
|
||||
|
||||
var argIndex = 0;
|
||||
var message = 'Warning: ' + format.replace(/%s/g, function () {
|
||||
return args[argIndex++];
|
||||
});
|
||||
if (typeof console !== 'undefined') {
|
||||
console.error(message);
|
||||
}
|
||||
try {
|
||||
// --- Welcome to debugging React ---
|
||||
// This error was thrown as a convenience so that you can use this stack
|
||||
// to find the callsite that caused this warning to fire.
|
||||
throw new Error(message);
|
||||
} catch (x) {}
|
||||
};
|
||||
|
||||
warning = function warning(condition, format) {
|
||||
if (format === undefined) {
|
||||
throw new Error('`warning(condition, format, ...args)` requires a warning ' + 'message argument');
|
||||
}
|
||||
|
||||
if (format.indexOf('Failed Composite propType: ') === 0) {
|
||||
return; // Ignore CompositeComponent proptype check.
|
||||
}
|
||||
|
||||
if (!condition) {
|
||||
for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
|
||||
args[_key2 - 2] = arguments[_key2];
|
||||
}
|
||||
|
||||
printWarning.apply(undefined, [format].concat(args));
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
module.exports = warning;
|
||||
},{"./emptyFunction":6}],9:[function(require,module,exports){
|
||||
/*
|
||||
object-assign
|
||||
(c) Sindre Sorhus
|
||||
@license MIT
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
/* eslint-disable no-unused-vars */
|
||||
var getOwnPropertySymbols = Object.getOwnPropertySymbols;
|
||||
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
||||
var propIsEnumerable = Object.prototype.propertyIsEnumerable;
|
||||
|
||||
function toObject(val) {
|
||||
if (val === null || val === undefined) {
|
||||
throw new TypeError('Object.assign cannot be called with null or undefined');
|
||||
}
|
||||
|
||||
return Object(val);
|
||||
}
|
||||
|
||||
function shouldUseNative() {
|
||||
try {
|
||||
if (!Object.assign) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Detect buggy property enumeration order in older V8 versions.
|
||||
|
||||
// https://bugs.chromium.org/p/v8/issues/detail?id=4118
|
||||
var test1 = new String('abc'); // eslint-disable-line no-new-wrappers
|
||||
test1[5] = 'de';
|
||||
if (Object.getOwnPropertyNames(test1)[0] === '5') {
|
||||
return false;
|
||||
}
|
||||
|
||||
// https://bugs.chromium.org/p/v8/issues/detail?id=3056
|
||||
var test2 = {};
|
||||
for (var i = 0; i < 10; i++) {
|
||||
test2['_' + String.fromCharCode(i)] = i;
|
||||
}
|
||||
var order2 = Object.getOwnPropertyNames(test2).map(function (n) {
|
||||
return test2[n];
|
||||
});
|
||||
if (order2.join('') !== '0123456789') {
|
||||
return false;
|
||||
}
|
||||
|
||||
// https://bugs.chromium.org/p/v8/issues/detail?id=3056
|
||||
var test3 = {};
|
||||
'abcdefghijklmnopqrst'.split('').forEach(function (letter) {
|
||||
test3[letter] = letter;
|
||||
});
|
||||
if (Object.keys(Object.assign({}, test3)).join('') !==
|
||||
'abcdefghijklmnopqrst') {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
} catch (err) {
|
||||
// We don't expect any of the above to throw, but better to be safe.
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = shouldUseNative() ? Object.assign : function (target, source) {
|
||||
var from;
|
||||
var to = toObject(target);
|
||||
var symbols;
|
||||
|
||||
for (var s = 1; s < arguments.length; s++) {
|
||||
from = Object(arguments[s]);
|
||||
|
||||
for (var key in from) {
|
||||
if (hasOwnProperty.call(from, key)) {
|
||||
to[key] = from[key];
|
||||
}
|
||||
}
|
||||
|
||||
if (getOwnPropertySymbols) {
|
||||
symbols = getOwnPropertySymbols(from);
|
||||
for (var i = 0; i < symbols.length; i++) {
|
||||
if (propIsEnumerable.call(from, symbols[i])) {
|
||||
to[symbols[i]] = from[symbols[i]];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return to;
|
||||
};
|
||||
|
||||
},{}]},{},[4])(4)
|
||||
});
|
|
@ -1,960 +0,0 @@
|
|||
/**
|
||||
* react-prop-types v15.6.0
|
||||
*/
|
||||
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.PropTypes = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
|
||||
/**
|
||||
* Copyright (c) 2013-present, Facebook, Inc.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
if ("production" !== 'production') {
|
||||
var invariant = require('fbjs/lib/invariant');
|
||||
var warning = require('fbjs/lib/warning');
|
||||
var ReactPropTypesSecret = require('./lib/ReactPropTypesSecret');
|
||||
var loggedTypeFailures = {};
|
||||
}
|
||||
|
||||
/**
|
||||
* Assert that the values match with the type specs.
|
||||
* Error messages are memorized and will only be shown once.
|
||||
*
|
||||
* @param {object} typeSpecs Map of name to a ReactPropType
|
||||
* @param {object} values Runtime values that need to be type-checked
|
||||
* @param {string} location e.g. "prop", "context", "child context"
|
||||
* @param {string} componentName Name of the component for error messages.
|
||||
* @param {?Function} getStack Returns the component stack.
|
||||
* @private
|
||||
*/
|
||||
function checkPropTypes(typeSpecs, values, location, componentName, getStack) {
|
||||
if ("production" !== 'production') {
|
||||
for (var typeSpecName in typeSpecs) {
|
||||
if (typeSpecs.hasOwnProperty(typeSpecName)) {
|
||||
var error;
|
||||
// Prop type validation may throw. In case they do, we don't want to
|
||||
// fail the render phase where it didn't fail before. So we log it.
|
||||
// After these have been cleaned up, we'll let them throw.
|
||||
try {
|
||||
// This is intentionally an invariant that gets caught. It's the same
|
||||
// behavior as without this statement except with a better message.
|
||||
invariant(typeof typeSpecs[typeSpecName] === 'function', '%s: %s type `%s` is invalid; it must be a function, usually from ' + 'the `prop-types` package, but received `%s`.', componentName || 'React class', location, typeSpecName, typeof typeSpecs[typeSpecName]);
|
||||
error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret);
|
||||
} catch (ex) {
|
||||
error = ex;
|
||||
}
|
||||
warning(!error || error instanceof Error, '%s: type specification of %s `%s` is invalid; the type checker ' + 'function must return `null` or an `Error` but returned a %s. ' + 'You may have forgotten to pass an argument to the type checker ' + 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' + 'shape all require an argument).', componentName || 'React class', location, typeSpecName, typeof error);
|
||||
if (error instanceof Error && !(error.message in loggedTypeFailures)) {
|
||||
// Only monitor this failure once because there tends to be a lot of the
|
||||
// same error.
|
||||
loggedTypeFailures[error.message] = true;
|
||||
|
||||
var stack = getStack ? getStack() : '';
|
||||
|
||||
warning(false, 'Failed %s type: %s%s', location, error.message, stack != null ? stack : '');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = checkPropTypes;
|
||||
|
||||
},{"./lib/ReactPropTypesSecret":5,"fbjs/lib/invariant":7,"fbjs/lib/warning":8}],2:[function(require,module,exports){
|
||||
/**
|
||||
* Copyright (c) 2013-present, Facebook, Inc.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
var emptyFunction = require('fbjs/lib/emptyFunction');
|
||||
var invariant = require('fbjs/lib/invariant');
|
||||
var ReactPropTypesSecret = require('./lib/ReactPropTypesSecret');
|
||||
|
||||
module.exports = function() {
|
||||
function shim(props, propName, componentName, location, propFullName, secret) {
|
||||
if (secret === ReactPropTypesSecret) {
|
||||
// It is still safe when called from React.
|
||||
return;
|
||||
}
|
||||
invariant(
|
||||
false,
|
||||
'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
|
||||
'Use PropTypes.checkPropTypes() to call them. ' +
|
||||
'Read more at http://fb.me/use-check-prop-types'
|
||||
);
|
||||
};
|
||||
shim.isRequired = shim;
|
||||
function getShim() {
|
||||
return shim;
|
||||
};
|
||||
// Important!
|
||||
// Keep this list in sync with production version in `./factoryWithTypeCheckers.js`.
|
||||
var ReactPropTypes = {
|
||||
array: shim,
|
||||
bool: shim,
|
||||
func: shim,
|
||||
number: shim,
|
||||
object: shim,
|
||||
string: shim,
|
||||
symbol: shim,
|
||||
|
||||
any: shim,
|
||||
arrayOf: getShim,
|
||||
element: shim,
|
||||
instanceOf: getShim,
|
||||
node: shim,
|
||||
objectOf: getShim,
|
||||
oneOf: getShim,
|
||||
oneOfType: getShim,
|
||||
shape: getShim,
|
||||
exact: getShim
|
||||
};
|
||||
|
||||
ReactPropTypes.checkPropTypes = emptyFunction;
|
||||
ReactPropTypes.PropTypes = ReactPropTypes;
|
||||
|
||||
return ReactPropTypes;
|
||||
};
|
||||
|
||||
},{"./lib/ReactPropTypesSecret":5,"fbjs/lib/emptyFunction":6,"fbjs/lib/invariant":7}],3:[function(require,module,exports){
|
||||
/**
|
||||
* Copyright (c) 2013-present, Facebook, Inc.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
var emptyFunction = require('fbjs/lib/emptyFunction');
|
||||
var invariant = require('fbjs/lib/invariant');
|
||||
var warning = require('fbjs/lib/warning');
|
||||
var assign = require('object-assign');
|
||||
|
||||
var ReactPropTypesSecret = require('./lib/ReactPropTypesSecret');
|
||||
var checkPropTypes = require('./checkPropTypes');
|
||||
|
||||
module.exports = function(isValidElement, throwOnDirectAccess) {
|
||||
/* global Symbol */
|
||||
var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
|
||||
var FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec.
|
||||
|
||||
/**
|
||||
* Returns the iterator method function contained on the iterable object.
|
||||
*
|
||||
* Be sure to invoke the function with the iterable as context:
|
||||
*
|
||||
* var iteratorFn = getIteratorFn(myIterable);
|
||||
* if (iteratorFn) {
|
||||
* var iterator = iteratorFn.call(myIterable);
|
||||
* ...
|
||||
* }
|
||||
*
|
||||
* @param {?object} maybeIterable
|
||||
* @return {?function}
|
||||
*/
|
||||
function getIteratorFn(maybeIterable) {
|
||||
var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]);
|
||||
if (typeof iteratorFn === 'function') {
|
||||
return iteratorFn;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Collection of methods that allow declaration and validation of props that are
|
||||
* supplied to React components. Example usage:
|
||||
*
|
||||
* var Props = require('ReactPropTypes');
|
||||
* var MyArticle = React.createClass({
|
||||
* propTypes: {
|
||||
* // An optional string prop named "description".
|
||||
* description: Props.string,
|
||||
*
|
||||
* // A required enum prop named "category".
|
||||
* category: Props.oneOf(['News','Photos']).isRequired,
|
||||
*
|
||||
* // A prop named "dialog" that requires an instance of Dialog.
|
||||
* dialog: Props.instanceOf(Dialog).isRequired
|
||||
* },
|
||||
* render: function() { ... }
|
||||
* });
|
||||
*
|
||||
* A more formal specification of how these methods are used:
|
||||
*
|
||||
* type := array|bool|func|object|number|string|oneOf([...])|instanceOf(...)
|
||||
* decl := ReactPropTypes.{type}(.isRequired)?
|
||||
*
|
||||
* Each and every declaration produces a function with the same signature. This
|
||||
* allows the creation of custom validation functions. For example:
|
||||
*
|
||||
* var MyLink = React.createClass({
|
||||
* propTypes: {
|
||||
* // An optional string or URI prop named "href".
|
||||
* href: function(props, propName, componentName) {
|
||||
* var propValue = props[propName];
|
||||
* if (propValue != null && typeof propValue !== 'string' &&
|
||||
* !(propValue instanceof URI)) {
|
||||
* return new Error(
|
||||
* 'Expected a string or an URI for ' + propName + ' in ' +
|
||||
* componentName
|
||||
* );
|
||||
* }
|
||||
* }
|
||||
* },
|
||||
* render: function() {...}
|
||||
* });
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
|
||||
var ANONYMOUS = '<<anonymous>>';
|
||||
|
||||
// Important!
|
||||
// Keep this list in sync with production version in `./factoryWithThrowingShims.js`.
|
||||
var ReactPropTypes = {
|
||||
array: createPrimitiveTypeChecker('array'),
|
||||
bool: createPrimitiveTypeChecker('boolean'),
|
||||
func: createPrimitiveTypeChecker('function'),
|
||||
number: createPrimitiveTypeChecker('number'),
|
||||
object: createPrimitiveTypeChecker('object'),
|
||||
string: createPrimitiveTypeChecker('string'),
|
||||
symbol: createPrimitiveTypeChecker('symbol'),
|
||||
|
||||
any: createAnyTypeChecker(),
|
||||
arrayOf: createArrayOfTypeChecker,
|
||||
element: createElementTypeChecker(),
|
||||
instanceOf: createInstanceTypeChecker,
|
||||
node: createNodeChecker(),
|
||||
objectOf: createObjectOfTypeChecker,
|
||||
oneOf: createEnumTypeChecker,
|
||||
oneOfType: createUnionTypeChecker,
|
||||
shape: createShapeTypeChecker,
|
||||
exact: createStrictShapeTypeChecker,
|
||||
};
|
||||
|
||||
/**
|
||||
* inlined Object.is polyfill to avoid requiring consumers ship their own
|
||||
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
|
||||
*/
|
||||
/*eslint-disable no-self-compare*/
|
||||
function is(x, y) {
|
||||
// SameValue algorithm
|
||||
if (x === y) {
|
||||
// Steps 1-5, 7-10
|
||||
// Steps 6.b-6.e: +0 != -0
|
||||
return x !== 0 || 1 / x === 1 / y;
|
||||
} else {
|
||||
// Step 6.a: NaN == NaN
|
||||
return x !== x && y !== y;
|
||||
}
|
||||
}
|
||||
/*eslint-enable no-self-compare*/
|
||||
|
||||
/**
|
||||
* We use an Error-like object for backward compatibility as people may call
|
||||
* PropTypes directly and inspect their output. However, we don't use real
|
||||
* Errors anymore. We don't inspect their stack anyway, and creating them
|
||||
* is prohibitively expensive if they are created too often, such as what
|
||||
* happens in oneOfType() for any type before the one that matched.
|
||||
*/
|
||||
function PropTypeError(message) {
|
||||
this.message = message;
|
||||
this.stack = '';
|
||||
}
|
||||
// Make `instanceof Error` still work for returned errors.
|
||||
PropTypeError.prototype = Error.prototype;
|
||||
|
||||
function createChainableTypeChecker(validate) {
|
||||
if ("production" !== 'production') {
|
||||
var manualPropTypeCallCache = {};
|
||||
var manualPropTypeWarningCount = 0;
|
||||
}
|
||||
function checkType(isRequired, props, propName, componentName, location, propFullName, secret) {
|
||||
componentName = componentName || ANONYMOUS;
|
||||
propFullName = propFullName || propName;
|
||||
|
||||
if (secret !== ReactPropTypesSecret) {
|
||||
if (throwOnDirectAccess) {
|
||||
// New behavior only for users of `prop-types` package
|
||||
invariant(
|
||||
false,
|
||||
'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
|
||||
'Use `PropTypes.checkPropTypes()` to call them. ' +
|
||||
'Read more at http://fb.me/use-check-prop-types'
|
||||
);
|
||||
} else if ("production" !== 'production' && typeof console !== 'undefined') {
|
||||
// Old behavior for people using React.PropTypes
|
||||
var cacheKey = componentName + ':' + propName;
|
||||
if (
|
||||
!manualPropTypeCallCache[cacheKey] &&
|
||||
// Avoid spamming the console because they are often not actionable except for lib authors
|
||||
manualPropTypeWarningCount < 3
|
||||
) {
|
||||
warning(
|
||||
false,
|
||||
'You are manually calling a React.PropTypes validation ' +
|
||||
'function for the `%s` prop on `%s`. This is deprecated ' +
|
||||
'and will throw in the standalone `prop-types` package. ' +
|
||||
'You may be seeing this warning due to a third-party PropTypes ' +
|
||||
'library. See https://fb.me/react-warning-dont-call-proptypes ' + 'for details.',
|
||||
propFullName,
|
||||
componentName
|
||||
);
|
||||
manualPropTypeCallCache[cacheKey] = true;
|
||||
manualPropTypeWarningCount++;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (props[propName] == null) {
|
||||
if (isRequired) {
|
||||
if (props[propName] === null) {
|
||||
return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required ' + ('in `' + componentName + '`, but its value is `null`.'));
|
||||
}
|
||||
return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required in ' + ('`' + componentName + '`, but its value is `undefined`.'));
|
||||
}
|
||||
return null;
|
||||
} else {
|
||||
return validate(props, propName, componentName, location, propFullName);
|
||||
}
|
||||
}
|
||||
|
||||
var chainedCheckType = checkType.bind(null, false);
|
||||
chainedCheckType.isRequired = checkType.bind(null, true);
|
||||
|
||||
return chainedCheckType;
|
||||
}
|
||||
|
||||
function createPrimitiveTypeChecker(expectedType) {
|
||||
function validate(props, propName, componentName, location, propFullName, secret) {
|
||||
var propValue = props[propName];
|
||||
var propType = getPropType(propValue);
|
||||
if (propType !== expectedType) {
|
||||
// `propValue` being instance of, say, date/regexp, pass the 'object'
|
||||
// check, but we can offer a more precise error message here rather than
|
||||
// 'of type `object`'.
|
||||
var preciseType = getPreciseType(propValue);
|
||||
|
||||
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.'));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
return createChainableTypeChecker(validate);
|
||||
}
|
||||
|
||||
function createAnyTypeChecker() {
|
||||
return createChainableTypeChecker(emptyFunction.thatReturnsNull);
|
||||
}
|
||||
|
||||
function createArrayOfTypeChecker(typeChecker) {
|
||||
function validate(props, propName, componentName, location, propFullName) {
|
||||
if (typeof typeChecker !== 'function') {
|
||||
return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside arrayOf.');
|
||||
}
|
||||
var propValue = props[propName];
|
||||
if (!Array.isArray(propValue)) {
|
||||
var propType = getPropType(propValue);
|
||||
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an array.'));
|
||||
}
|
||||
for (var i = 0; i < propValue.length; i++) {
|
||||
var error = typeChecker(propValue, i, componentName, location, propFullName + '[' + i + ']', ReactPropTypesSecret);
|
||||
if (error instanceof Error) {
|
||||
return error;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
return createChainableTypeChecker(validate);
|
||||
}
|
||||
|
||||
function createElementTypeChecker() {
|
||||
function validate(props, propName, componentName, location, propFullName) {
|
||||
var propValue = props[propName];
|
||||
if (!isValidElement(propValue)) {
|
||||
var propType = getPropType(propValue);
|
||||
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement.'));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
return createChainableTypeChecker(validate);
|
||||
}
|
||||
|
||||
function createInstanceTypeChecker(expectedClass) {
|
||||
function validate(props, propName, componentName, location, propFullName) {
|
||||
if (!(props[propName] instanceof expectedClass)) {
|
||||
var expectedClassName = expectedClass.name || ANONYMOUS;
|
||||
var actualClassName = getClassName(props[propName]);
|
||||
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + actualClassName + '` supplied to `' + componentName + '`, expected ') + ('instance of `' + expectedClassName + '`.'));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
return createChainableTypeChecker(validate);
|
||||
}
|
||||
|
||||
function createEnumTypeChecker(expectedValues) {
|
||||
if (!Array.isArray(expectedValues)) {
|
||||
"production" !== 'production' ? warning(false, 'Invalid argument supplied to oneOf, expected an instance of array.') : void 0;
|
||||
return emptyFunction.thatReturnsNull;
|
||||
}
|
||||
|
||||
function validate(props, propName, componentName, location, propFullName) {
|
||||
var propValue = props[propName];
|
||||
for (var i = 0; i < expectedValues.length; i++) {
|
||||
if (is(propValue, expectedValues[i])) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
var valuesString = JSON.stringify(expectedValues);
|
||||
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of value `' + propValue + '` ' + ('supplied to `' + componentName + '`, expected one of ' + valuesString + '.'));
|
||||
}
|
||||
return createChainableTypeChecker(validate);
|
||||
}
|
||||
|
||||
function createObjectOfTypeChecker(typeChecker) {
|
||||
function validate(props, propName, componentName, location, propFullName) {
|
||||
if (typeof typeChecker !== 'function') {
|
||||
return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside objectOf.');
|
||||
}
|
||||
var propValue = props[propName];
|
||||
var propType = getPropType(propValue);
|
||||
if (propType !== 'object') {
|
||||
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an object.'));
|
||||
}
|
||||
for (var key in propValue) {
|
||||
if (propValue.hasOwnProperty(key)) {
|
||||
var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
|
||||
if (error instanceof Error) {
|
||||
return error;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
return createChainableTypeChecker(validate);
|
||||
}
|
||||
|
||||
function createUnionTypeChecker(arrayOfTypeCheckers) {
|
||||
if (!Array.isArray(arrayOfTypeCheckers)) {
|
||||
"production" !== 'production' ? warning(false, 'Invalid argument supplied to oneOfType, expected an instance of array.') : void 0;
|
||||
return emptyFunction.thatReturnsNull;
|
||||
}
|
||||
|
||||
for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
|
||||
var checker = arrayOfTypeCheckers[i];
|
||||
if (typeof checker !== 'function') {
|
||||
warning(
|
||||
false,
|
||||
'Invalid argument supplied to oneOfType. Expected an array of check functions, but ' +
|
||||
'received %s at index %s.',
|
||||
getPostfixForTypeWarning(checker),
|
||||
i
|
||||
);
|
||||
return emptyFunction.thatReturnsNull;
|
||||
}
|
||||
}
|
||||
|
||||
function validate(props, propName, componentName, location, propFullName) {
|
||||
for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
|
||||
var checker = arrayOfTypeCheckers[i];
|
||||
if (checker(props, propName, componentName, location, propFullName, ReactPropTypesSecret) == null) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`.'));
|
||||
}
|
||||
return createChainableTypeChecker(validate);
|
||||
}
|
||||
|
||||
function createNodeChecker() {
|
||||
function validate(props, propName, componentName, location, propFullName) {
|
||||
if (!isNode(props[propName])) {
|
||||
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a ReactNode.'));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
return createChainableTypeChecker(validate);
|
||||
}
|
||||
|
||||
function createShapeTypeChecker(shapeTypes) {
|
||||
function validate(props, propName, componentName, location, propFullName) {
|
||||
var propValue = props[propName];
|
||||
var propType = getPropType(propValue);
|
||||
if (propType !== 'object') {
|
||||
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
|
||||
}
|
||||
for (var key in shapeTypes) {
|
||||
var checker = shapeTypes[key];
|
||||
if (!checker) {
|
||||
continue;
|
||||
}
|
||||
var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
|
||||
if (error) {
|
||||
return error;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
return createChainableTypeChecker(validate);
|
||||
}
|
||||
|
||||
function createStrictShapeTypeChecker(shapeTypes) {
|
||||
function validate(props, propName, componentName, location, propFullName) {
|
||||
var propValue = props[propName];
|
||||
var propType = getPropType(propValue);
|
||||
if (propType !== 'object') {
|
||||
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
|
||||
}
|
||||
// We need to check all keys in case some are required but missing from
|
||||
// props.
|
||||
var allKeys = assign({}, props[propName], shapeTypes);
|
||||
for (var key in allKeys) {
|
||||
var checker = shapeTypes[key];
|
||||
if (!checker) {
|
||||
return new PropTypeError(
|
||||
'Invalid ' + location + ' `' + propFullName + '` key `' + key + '` supplied to `' + componentName + '`.' +
|
||||
'\nBad object: ' + JSON.stringify(props[propName], null, ' ') +
|
||||
'\nValid keys: ' + JSON.stringify(Object.keys(shapeTypes), null, ' ')
|
||||
);
|
||||
}
|
||||
var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
|
||||
if (error) {
|
||||
return error;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
return createChainableTypeChecker(validate);
|
||||
}
|
||||
|
||||
function isNode(propValue) {
|
||||
switch (typeof propValue) {
|
||||
case 'number':
|
||||
case 'string':
|
||||
case 'undefined':
|
||||
return true;
|
||||
case 'boolean':
|
||||
return !propValue;
|
||||
case 'object':
|
||||
if (Array.isArray(propValue)) {
|
||||
return propValue.every(isNode);
|
||||
}
|
||||
if (propValue === null || isValidElement(propValue)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
var iteratorFn = getIteratorFn(propValue);
|
||||
if (iteratorFn) {
|
||||
var iterator = iteratorFn.call(propValue);
|
||||
var step;
|
||||
if (iteratorFn !== propValue.entries) {
|
||||
while (!(step = iterator.next()).done) {
|
||||
if (!isNode(step.value)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Iterator will provide entry [k,v] tuples rather than values.
|
||||
while (!(step = iterator.next()).done) {
|
||||
var entry = step.value;
|
||||
if (entry) {
|
||||
if (!isNode(entry[1])) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function isSymbol(propType, propValue) {
|
||||
// Native Symbol.
|
||||
if (propType === 'symbol') {
|
||||
return true;
|
||||
}
|
||||
|
||||
// 19.4.3.5 Symbol.prototype[@@toStringTag] === 'Symbol'
|
||||
if (propValue['@@toStringTag'] === 'Symbol') {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Fallback for non-spec compliant Symbols which are polyfilled.
|
||||
if (typeof Symbol === 'function' && propValue instanceof Symbol) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// Equivalent of `typeof` but with special handling for array and regexp.
|
||||
function getPropType(propValue) {
|
||||
var propType = typeof propValue;
|
||||
if (Array.isArray(propValue)) {
|
||||
return 'array';
|
||||
}
|
||||
if (propValue instanceof RegExp) {
|
||||
// Old webkits (at least until Android 4.0) return 'function' rather than
|
||||
// 'object' for typeof a RegExp. We'll normalize this here so that /bla/
|
||||
// passes PropTypes.object.
|
||||
return 'object';
|
||||
}
|
||||
if (isSymbol(propType, propValue)) {
|
||||
return 'symbol';
|
||||
}
|
||||
return propType;
|
||||
}
|
||||
|
||||
// This handles more types than `getPropType`. Only used for error messages.
|
||||
// See `createPrimitiveTypeChecker`.
|
||||
function getPreciseType(propValue) {
|
||||
if (typeof propValue === 'undefined' || propValue === null) {
|
||||
return '' + propValue;
|
||||
}
|
||||
var propType = getPropType(propValue);
|
||||
if (propType === 'object') {
|
||||
if (propValue instanceof Date) {
|
||||
return 'date';
|
||||
} else if (propValue instanceof RegExp) {
|
||||
return 'regexp';
|
||||
}
|
||||
}
|
||||
return propType;
|
||||
}
|
||||
|
||||
// Returns a string that is postfixed to a warning about an invalid type.
|
||||
// For example, "undefined" or "of type array"
|
||||
function getPostfixForTypeWarning(value) {
|
||||
var type = getPreciseType(value);
|
||||
switch (type) {
|
||||
case 'array':
|
||||
case 'object':
|
||||
return 'an ' + type;
|
||||
case 'boolean':
|
||||
case 'date':
|
||||
case 'regexp':
|
||||
return 'a ' + type;
|
||||
default:
|
||||
return type;
|
||||
}
|
||||
}
|
||||
|
||||
// Returns class name of the object, if any.
|
||||
function getClassName(propValue) {
|
||||
if (!propValue.constructor || !propValue.constructor.name) {
|
||||
return ANONYMOUS;
|
||||
}
|
||||
return propValue.constructor.name;
|
||||
}
|
||||
|
||||
ReactPropTypes.checkPropTypes = checkPropTypes;
|
||||
ReactPropTypes.PropTypes = ReactPropTypes;
|
||||
|
||||
return ReactPropTypes;
|
||||
};
|
||||
|
||||
},{"./checkPropTypes":1,"./lib/ReactPropTypesSecret":5,"fbjs/lib/emptyFunction":6,"fbjs/lib/invariant":7,"fbjs/lib/warning":8,"object-assign":9}],4:[function(require,module,exports){
|
||||
/**
|
||||
* Copyright (c) 2013-present, Facebook, Inc.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
if ("production" !== 'production') {
|
||||
var REACT_ELEMENT_TYPE = (typeof Symbol === 'function' &&
|
||||
Symbol.for &&
|
||||
Symbol.for('react.element')) ||
|
||||
0xeac7;
|
||||
|
||||
var isValidElement = function(object) {
|
||||
return typeof object === 'object' &&
|
||||
object !== null &&
|
||||
object.$$typeof === REACT_ELEMENT_TYPE;
|
||||
};
|
||||
|
||||
// By explicitly using `prop-types` you are opting into new development behavior.
|
||||
// http://fb.me/prop-types-in-prod
|
||||
var throwOnDirectAccess = true;
|
||||
module.exports = require('./factoryWithTypeCheckers')(isValidElement, throwOnDirectAccess);
|
||||
} else {
|
||||
// By explicitly using `prop-types` you are opting into new production behavior.
|
||||
// http://fb.me/prop-types-in-prod
|
||||
module.exports = require('./factoryWithThrowingShims')();
|
||||
}
|
||||
|
||||
},{"./factoryWithThrowingShims":2,"./factoryWithTypeCheckers":3}],5:[function(require,module,exports){
|
||||
/**
|
||||
* Copyright (c) 2013-present, Facebook, Inc.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
|
||||
|
||||
module.exports = ReactPropTypesSecret;
|
||||
|
||||
},{}],6:[function(require,module,exports){
|
||||
"use strict";
|
||||
|
||||
/**
|
||||
* Copyright (c) 2013-present, Facebook, Inc.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
function makeEmptyFunction(arg) {
|
||||
return function () {
|
||||
return arg;
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* This function accepts and discards inputs; it has no side effects. This is
|
||||
* primarily useful idiomatically for overridable function endpoints which
|
||||
* always need to be callable, since JS lacks a null-call idiom ala Cocoa.
|
||||
*/
|
||||
var emptyFunction = function emptyFunction() {};
|
||||
|
||||
emptyFunction.thatReturns = makeEmptyFunction;
|
||||
emptyFunction.thatReturnsFalse = makeEmptyFunction(false);
|
||||
emptyFunction.thatReturnsTrue = makeEmptyFunction(true);
|
||||
emptyFunction.thatReturnsNull = makeEmptyFunction(null);
|
||||
emptyFunction.thatReturnsThis = function () {
|
||||
return this;
|
||||
};
|
||||
emptyFunction.thatReturnsArgument = function (arg) {
|
||||
return arg;
|
||||
};
|
||||
|
||||
module.exports = emptyFunction;
|
||||
},{}],7:[function(require,module,exports){
|
||||
/**
|
||||
* Copyright (c) 2013-present, Facebook, Inc.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* Use invariant() to assert state which your program assumes to be true.
|
||||
*
|
||||
* Provide sprintf-style format (only %s is supported) and arguments
|
||||
* to provide information about what broke and what you were
|
||||
* expecting.
|
||||
*
|
||||
* The invariant message will be stripped in production, but the invariant
|
||||
* will remain to ensure logic does not differ in production.
|
||||
*/
|
||||
|
||||
var validateFormat = function validateFormat(format) {};
|
||||
|
||||
if ("production" !== 'production') {
|
||||
validateFormat = function validateFormat(format) {
|
||||
if (format === undefined) {
|
||||
throw new Error('invariant requires an error message argument');
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
function invariant(condition, format, a, b, c, d, e, f) {
|
||||
validateFormat(format);
|
||||
|
||||
if (!condition) {
|
||||
var error;
|
||||
if (format === undefined) {
|
||||
error = new Error('Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.');
|
||||
} else {
|
||||
var args = [a, b, c, d, e, f];
|
||||
var argIndex = 0;
|
||||
error = new Error(format.replace(/%s/g, function () {
|
||||
return args[argIndex++];
|
||||
}));
|
||||
error.name = 'Invariant Violation';
|
||||
}
|
||||
|
||||
error.framesToPop = 1; // we don't care about invariant's own frame
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = invariant;
|
||||
},{}],8:[function(require,module,exports){
|
||||
/**
|
||||
* Copyright (c) 2014-present, Facebook, Inc.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
var emptyFunction = require('./emptyFunction');
|
||||
|
||||
/**
|
||||
* Similar to invariant but only logs a warning if the condition is not met.
|
||||
* This can be used to log issues in development environments in critical
|
||||
* paths. Removing the logging code for production environments will keep the
|
||||
* same logic and follow the same code paths.
|
||||
*/
|
||||
|
||||
var warning = emptyFunction;
|
||||
|
||||
if ("production" !== 'production') {
|
||||
var printWarning = function printWarning(format) {
|
||||
for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
||||
args[_key - 1] = arguments[_key];
|
||||
}
|
||||
|
||||
var argIndex = 0;
|
||||
var message = 'Warning: ' + format.replace(/%s/g, function () {
|
||||
return args[argIndex++];
|
||||
});
|
||||
if (typeof console !== 'undefined') {
|
||||
console.error(message);
|
||||
}
|
||||
try {
|
||||
// --- Welcome to debugging React ---
|
||||
// This error was thrown as a convenience so that you can use this stack
|
||||
// to find the callsite that caused this warning to fire.
|
||||
throw new Error(message);
|
||||
} catch (x) {}
|
||||
};
|
||||
|
||||
warning = function warning(condition, format) {
|
||||
if (format === undefined) {
|
||||
throw new Error('`warning(condition, format, ...args)` requires a warning ' + 'message argument');
|
||||
}
|
||||
|
||||
if (format.indexOf('Failed Composite propType: ') === 0) {
|
||||
return; // Ignore CompositeComponent proptype check.
|
||||
}
|
||||
|
||||
if (!condition) {
|
||||
for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
|
||||
args[_key2 - 2] = arguments[_key2];
|
||||
}
|
||||
|
||||
printWarning.apply(undefined, [format].concat(args));
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
module.exports = warning;
|
||||
},{"./emptyFunction":6}],9:[function(require,module,exports){
|
||||
/*
|
||||
object-assign
|
||||
(c) Sindre Sorhus
|
||||
@license MIT
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
/* eslint-disable no-unused-vars */
|
||||
var getOwnPropertySymbols = Object.getOwnPropertySymbols;
|
||||
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
||||
var propIsEnumerable = Object.prototype.propertyIsEnumerable;
|
||||
|
||||
function toObject(val) {
|
||||
if (val === null || val === undefined) {
|
||||
throw new TypeError('Object.assign cannot be called with null or undefined');
|
||||
}
|
||||
|
||||
return Object(val);
|
||||
}
|
||||
|
||||
function shouldUseNative() {
|
||||
try {
|
||||
if (!Object.assign) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Detect buggy property enumeration order in older V8 versions.
|
||||
|
||||
// https://bugs.chromium.org/p/v8/issues/detail?id=4118
|
||||
var test1 = new String('abc'); // eslint-disable-line no-new-wrappers
|
||||
test1[5] = 'de';
|
||||
if (Object.getOwnPropertyNames(test1)[0] === '5') {
|
||||
return false;
|
||||
}
|
||||
|
||||
// https://bugs.chromium.org/p/v8/issues/detail?id=3056
|
||||
var test2 = {};
|
||||
for (var i = 0; i < 10; i++) {
|
||||
test2['_' + String.fromCharCode(i)] = i;
|
||||
}
|
||||
var order2 = Object.getOwnPropertyNames(test2).map(function (n) {
|
||||
return test2[n];
|
||||
});
|
||||
if (order2.join('') !== '0123456789') {
|
||||
return false;
|
||||
}
|
||||
|
||||
// https://bugs.chromium.org/p/v8/issues/detail?id=3056
|
||||
var test3 = {};
|
||||
'abcdefghijklmnopqrst'.split('').forEach(function (letter) {
|
||||
test3[letter] = letter;
|
||||
});
|
||||
if (Object.keys(Object.assign({}, test3)).join('') !==
|
||||
'abcdefghijklmnopqrst') {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
} catch (err) {
|
||||
// We don't expect any of the above to throw, but better to be safe.
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = shouldUseNative() ? Object.assign : function (target, source) {
|
||||
var from;
|
||||
var to = toObject(target);
|
||||
var symbols;
|
||||
|
||||
for (var s = 1; s < arguments.length; s++) {
|
||||
from = Object(arguments[s]);
|
||||
|
||||
for (var key in from) {
|
||||
if (hasOwnProperty.call(from, key)) {
|
||||
to[key] = from[key];
|
||||
}
|
||||
}
|
||||
|
||||
if (getOwnPropertySymbols) {
|
||||
symbols = getOwnPropertySymbols(from);
|
||||
for (var i = 0; i < symbols.length; i++) {
|
||||
if (propIsEnumerable.call(from, symbols[i])) {
|
||||
to[symbols[i]] = from[symbols[i]];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return to;
|
||||
};
|
||||
|
||||
},{}]},{},[4])(4)
|
||||
});
|
Загрузка…
Ссылка в новой задаче