diff --git a/.flowconfig b/.flowconfig index 5fd4ff0a..012da30e 100644 --- a/.flowconfig +++ b/.flowconfig @@ -25,10 +25,10 @@ .*/node_modules/postcss-modules-scope/.* .*/node_modules/postcss-modules-values/.* .*/node_modules/postcss/.* -.*/node_modules/prosemirror-dev-tools/.* .*/node_modules/react-emotion/.* .*/node_modules/unstated/.* .*/node_modules/stylelint/.* +.*/node_modules/gensync/.* [libs] ./flow-typed/.* diff --git a/demo/ConvertApp.js b/demo/ConvertApp.js index 907ed439..6f26f918 100644 --- a/demo/ConvertApp.js +++ b/demo/ConvertApp.js @@ -1,7 +1,6 @@ // @flow import cx from 'classnames'; -import applyDevTools from 'prosemirror-dev-tools'; import {EditorState} from 'prosemirror-state'; import {EditorView} from 'prosemirror-view'; import React from 'react'; @@ -136,11 +135,7 @@ class ConvertApp extends React.PureComponent { ); } - _onReady = (editorView: EditorView): void => { - window.debugProseMirror = () => { - applyDevTools(editorView); - }; - }; + _onReady = (editorView: EditorView): void => {}; _onEditorChange = (editorState: EditorState): void => { this.setState({editorState}); diff --git a/demo/DemoApp.js b/demo/DemoApp.js index 317bb59e..9c655b34 100644 --- a/demo/DemoApp.js +++ b/demo/DemoApp.js @@ -1,6 +1,5 @@ // @flow -import applyDevTools from 'prosemirror-dev-tools'; import {EditorState} from 'prosemirror-state'; import {EditorView} from 'prosemirror-view'; import React from 'react'; @@ -12,8 +11,6 @@ import convertFromDOMElement from '../src/convertFromDOMElement'; import RichTextEditor from '../src/ui/RichTextEditor'; import DemoAppHTMLTemplate from './DemoAppHTMLTemplate'; import DemoAppRuntime from './DemoAppRuntime'; -/* eslint-disable-next-line */ -import preloadLoadableModules from './preloadLoadableModules'; import './demo-app.css'; @@ -58,9 +55,6 @@ class DemoApp extends React.PureComponent { }; _onReady = (editorView: EditorView): void => { - window.debugProseMirror = () => { - applyDevTools(editorView); - }; CZIProseMirror.registerCommand('hr', HR); window.CZIProseMirror = CZIProseMirror; }; diff --git a/demo/DemoAppHTMLTemplate.js b/demo/DemoAppHTMLTemplate.js index d56664ce..decc930e 100644 --- a/demo/DemoAppHTMLTemplate.js +++ b/demo/DemoAppHTMLTemplate.js @@ -174,9 +174,6 @@ class DemoAppHTMLTemplate extends React.PureComponent { l impedit quo minus id quod maxime placeat facere pos

-
- Singapura bombay for norwegian forest tom tabby. -
); } diff --git a/demo/UIExamples.js b/demo/UIExamples.js index 38dc7a7a..e9ff3d98 100644 --- a/demo/UIExamples.js +++ b/demo/UIExamples.js @@ -8,10 +8,10 @@ import ColorEditor from '../src/ui/ColorEditor'; import CustomButton from '../src/ui/CustomButton'; import CustomRadioButton from '../src/ui/CustomRadioButton'; import ImageURLEditor from '../src/ui/ImageURLEditor'; -import MathEditor from '../src/ui/MathEditor'; +// import MathEditor from '../src/ui/MathEditor'; import TableGridSizeEditor from '../src/ui/TableGridSizeEditor'; import createPopUp from '../src/ui/createPopUp'; -import renderLaTeXAsHTML from '../src/ui/renderLaTeXAsHTML'; +// import renderLaTeXAsHTML from '../src/ui/renderLaTeXAsHTML'; import uuid from '../src/ui/uuid'; import SimpleEditor from './SimpleEditor'; @@ -37,39 +37,39 @@ class SimpleEditorExample extends React.PureComponent { }; } -class MathEditorExample extends React.PureComponent { - _popup = null; - - state = { - latex: ' \\displaystyle\\sum_{ 1 }^{ 2 } \\left(3 \\right) ', - }; - - render() { - const html = renderLaTeXAsHTML(this.state.latex); - return ( -
- -
{JSON.stringify(this.state)}
- -
- ); - } - - _onClick = (): void => { - if (!this._popup) { - this._popup = createPopUp( - MathEditor, - {initialValue: this.state.latex}, - { - onClose: latex => { - latex && this.setState({latex}); - this._popup = null; - }, - } - ); - } - }; -} +// class MathEditorExample extends React.PureComponent { +// _popup = null; + +// state = { +// latex: ' \\displaystyle\\sum_{ 1 }^{ 2 } \\left(3 \\right) ', +// }; + +// render() { +// const html = renderLaTeXAsHTML(this.state.latex); +// return ( +//
+// +//
{JSON.stringify(this.state)}
+// +//
+// ); +// } + +// _onClick = (): void => { +// if (!this._popup) { +// this._popup = createPopUp( +// MathEditor, +// {initialValue: this.state.latex}, +// { +// onClose: latex => { +// latex && this.setState({latex}); +// this._popup = null; +// }, +// } +// ); +// } +// }; +// } class CustomRadioButtonExample extends React.PureComponent { state = { value: '', @@ -208,8 +208,8 @@ class Examples extends React.PureComponent {

- -
+ {/* +
*/}
diff --git a/dist/EditorCommands.js b/dist/EditorCommands.js index cf7f6994..834af107 100644 --- a/dist/EditorCommands.js +++ b/dist/EditorCommands.js @@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); -exports.UNDERLINE = exports.UL = exports.TEXT_LINE_SPACINGS = exports.TEXT_INSERT_TAB_SPACE = exports.TEXT_HIGHLIGHT = exports.TEXT_COLOR = exports.TEXT_ALIGN_RIGHT = exports.TEXT_ALIGN_LEFT = exports.TEXT_ALIGN_JUSTIFY = exports.TEXT_ALIGN_CENTER = exports.TABLE_TOGGLE_HEADER_ROW = exports.TABLE_TOGGLE_HEADER_COLUMN = exports.TABLE_TOGGLE_HEADER_CELL = exports.TABLE_SPLIT_ROW = exports.TABLE_MOVE_TO_PREV_CELL = exports.TABLE_MOVE_TO_NEXT_CELL = exports.TABLE_MERGE_CELLS = exports.TABLE_INSERT_TABLE = exports.TABLE_DELETE_TABLE = exports.TABLE_DELETE_ROW = exports.TABLE_DELETE_COLUMN = exports.TABLE_BORDER_COLOR = exports.TABLE_BACKGROUND_COLOR = exports.TABLE_ADD_ROW_BEFORE = exports.TABLE_ADD_ROW_AFTER = exports.TABLE_ADD_COLUMN_BEFORE = exports.TABLE_ADD_COLUMN_AFTER = exports.SUPER = exports.STRONG = exports.STRIKE = exports.PRINT = exports.OL = exports.MATH_EDIT = exports.LIST_SPLIT = exports.LIST_ITEM_MERGE_UP = exports.LIST_ITEM_MERGE_DOWN = exports.LIST_ITEM_INSERT_NEW_LINE = exports.LINK_SET_URL = exports.INDENT_MORE = exports.INDENT_LESS = exports.IMAGE_UPLOAD = exports.IMAGE_FROM_URL = exports.HR = exports.HISTORY_UNDO = exports.HISTORY_REDO = exports.H6 = exports.H5 = exports.H4 = exports.H3 = exports.H2 = exports.H1 = exports.EM = exports.DOC_LAYOUT = exports.CODE = exports.CLEAR_FORMAT = exports.BLOCKQUOTE_INSERT_NEW_LINE = exports.BLOCKQUOTE_TOGGLE = undefined; +exports.UNDERLINE = exports.UL = exports.TEXT_LINE_SPACINGS = exports.TEXT_INSERT_TAB_SPACE = exports.TEXT_HIGHLIGHT = exports.TEXT_COLOR = exports.TEXT_ALIGN_RIGHT = exports.TEXT_ALIGN_LEFT = exports.TEXT_ALIGN_JUSTIFY = exports.TEXT_ALIGN_CENTER = exports.TABLE_TOGGLE_HEADER_ROW = exports.TABLE_TOGGLE_HEADER_COLUMN = exports.TABLE_TOGGLE_HEADER_CELL = exports.TABLE_SPLIT_ROW = exports.TABLE_MOVE_TO_PREV_CELL = exports.TABLE_MOVE_TO_NEXT_CELL = exports.TABLE_MERGE_CELLS = exports.TABLE_INSERT_TABLE = exports.TABLE_DELETE_TABLE = exports.TABLE_DELETE_ROW = exports.TABLE_DELETE_COLUMN = exports.TABLE_BORDER_COLOR = exports.TABLE_BACKGROUND_COLOR = exports.TABLE_ADD_ROW_BEFORE = exports.TABLE_ADD_ROW_AFTER = exports.TABLE_ADD_COLUMN_BEFORE = exports.TABLE_ADD_COLUMN_AFTER = exports.SUPER = exports.STRONG = exports.STRIKE = exports.PRINT = exports.OL = exports.LIST_SPLIT = exports.LIST_ITEM_MERGE_UP = exports.LIST_ITEM_MERGE_DOWN = exports.LIST_ITEM_INSERT_NEW_LINE = exports.LINK_SET_URL = exports.INDENT_MORE = exports.INDENT_LESS = exports.IMAGE_UPLOAD = exports.IMAGE_FROM_URL = exports.HR = exports.HISTORY_UNDO = exports.HISTORY_REDO = exports.H6 = exports.H5 = exports.H4 = exports.H3 = exports.H2 = exports.H1 = exports.EM = exports.DOC_LAYOUT = exports.CODE = exports.CLEAR_FORMAT = exports.BLOCKQUOTE_INSERT_NEW_LINE = exports.BLOCKQUOTE_TOGGLE = undefined; var _prosemirrorTables = require('prosemirror-tables'); @@ -85,10 +85,6 @@ var _MarksClearCommand = require('./MarksClearCommand'); var _MarksClearCommand2 = _interopRequireDefault(_MarksClearCommand); -var _MathEditCommand = require('./MathEditCommand'); - -var _MathEditCommand2 = _interopRequireDefault(_MathEditCommand); - var _PrintCommand = require('./PrintCommand'); var _PrintCommand2 = _interopRequireDefault(_PrintCommand); @@ -149,6 +145,8 @@ var addColumnAfter = ProsemirrorTables.addColumnAfter, toggleHeaderCell = ProsemirrorTables.toggleHeaderCell, toggleHeaderColumn = ProsemirrorTables.toggleHeaderColumn, toggleHeaderRow = ProsemirrorTables.toggleHeaderRow; +// import MathEditCommand from './MathEditCommand'; + var MARK_STRONG = MarkNames.MARK_STRONG, MARK_EM = MarkNames.MARK_EM, MARK_STRIKE = MarkNames.MARK_STRIKE, @@ -187,7 +185,7 @@ var LIST_ITEM_INSERT_NEW_LINE = exports.LIST_ITEM_INSERT_NEW_LINE = new _ListIte var LIST_ITEM_MERGE_DOWN = exports.LIST_ITEM_MERGE_DOWN = new _ListItemMergeCommand2.default('down'); var LIST_ITEM_MERGE_UP = exports.LIST_ITEM_MERGE_UP = new _ListItemMergeCommand2.default('up'); var LIST_SPLIT = exports.LIST_SPLIT = new _ListSplitCommand2.default(); -var MATH_EDIT = exports.MATH_EDIT = new _MathEditCommand2.default(); +// export const MATH_EDIT = new MathEditCommand(); var OL = exports.OL = new _ListToggleCommand2.default(true); var PRINT = exports.PRINT = new _PrintCommand2.default(); var STRIKE = exports.STRIKE = new _MarkToggleCommand2.default(MARK_STRIKE); diff --git a/dist/EditorCommands.js.flow b/dist/EditorCommands.js.flow index bf5ee3b6..a8b209be 100644 --- a/dist/EditorCommands.js.flow +++ b/dist/EditorCommands.js.flow @@ -21,7 +21,7 @@ import ListToggleCommand from './ListToggleCommand'; import * as MarkNames from './MarkNames'; import MarkToggleCommand from './MarkToggleCommand'; import MarksClearCommand from './MarksClearCommand'; -import MathEditCommand from './MathEditCommand'; +// import MathEditCommand from './MathEditCommand'; import PrintCommand from './PrintCommand'; import TableBackgroundColorCommand from './TableBackgroundColorCommand'; import TableBorderColorCommand from './TableBorderColorCommand'; @@ -94,7 +94,7 @@ export const LIST_ITEM_INSERT_NEW_LINE = new ListItemInsertNewLineCommand(); export const LIST_ITEM_MERGE_DOWN = new ListItemMergeCommand('down'); export const LIST_ITEM_MERGE_UP = new ListItemMergeCommand('up'); export const LIST_SPLIT = new ListSplitCommand(); -export const MATH_EDIT = new MathEditCommand(); +// export const MATH_EDIT = new MathEditCommand(); export const OL = new ListToggleCommand(true); export const PRINT = new PrintCommand(); export const STRIKE = new MarkToggleCommand(MARK_STRIKE); diff --git a/dist/EditorKeyMap.js b/dist/EditorKeyMap.js index 97cf299b..b3b7d130 100644 --- a/dist/EditorKeyMap.js +++ b/dist/EditorKeyMap.js @@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); -exports.ALL_KEYS = exports.KEY_UNDO = exports.KEY_TOGGLE_UNDERLINE = exports.KEY_TOGGLE_STRIKETHROUGH = exports.KEY_TOGGLE_ORDERED_LIST = exports.KEY_TOGGLE_MONOSPACE = exports.KEY_TOGGLE_ITALIC = exports.KEY_TOGGLE_HEADING_6 = exports.KEY_TOGGLE_HEADING_5 = exports.KEY_TOGGLE_HEADING_4 = exports.KEY_TOGGLE_HEADING_3 = exports.KEY_TOGGLE_HEADING_2 = exports.KEY_TOGGLE_HEADING_1 = exports.KEY_TOGGLE_CODE_BLOCK = exports.KEY_TOGGLE_BULLET_LIST = exports.KEY_TOGGLE_BOLD = exports.KEY_TOGGLE_BLOCK_QUOTE = exports.KEY_TAB_SHIFT = exports.KEY_TAB = exports.KEY_SPLIT_LIST_ITEM = exports.KEY_SPLIT_CODEBLOCK = exports.KEY_SHIFT_BACKSPACE = exports.KEY_SET_NORMAL_TEXT = exports.KEY_REDO = exports.KEY_INSERT_NEW_LINE_IN_LIST_ITEM = exports.KEY_INSERT_NEW_LINE_IN_BLOCKQUOTE = exports.KEY_INSERT_NEW_LINE = exports.KEY_INSERT_HORIZONTAL_RULE = exports.KEY_FORWARD_DELETE = exports.KEY_BACK_DELETE = undefined; +exports.ALL_KEYS = exports.KEY_UNDO = exports.KEY_TOGGLE_UNDERLINE = exports.KEY_TOGGLE_STRIKETHROUGH = exports.KEY_TOGGLE_ORDERED_LIST = exports.KEY_TOGGLE_MONOSPACE = exports.KEY_TOGGLE_ITALIC = exports.KEY_TOGGLE_HEADING_6 = exports.KEY_TOGGLE_HEADING_5 = exports.KEY_TOGGLE_HEADING_4 = exports.KEY_TOGGLE_HEADING_3 = exports.KEY_TOGGLE_HEADING_2 = exports.KEY_TOGGLE_HEADING_1 = exports.KEY_TOGGLE_CODE_BLOCK = exports.KEY_TOGGLE_BULLET_LIST = exports.KEY_TOGGLE_BOLD = exports.KEY_TOGGLE_BLOCK_QUOTE = exports.KEY_TAB_SHIFT = exports.KEY_TAB = exports.KEY_SPLIT_LIST_ITEM = exports.KEY_SPLIT_CODEBLOCK = exports.KEY_SHIFT_BACKSPACE = exports.KEY_SET_NORMAL_TEXT = exports.KEY_REDO = exports.KEY_INSERT_NEW_LINE_IN_LIST_ITEM = exports.KEY_INSERT_NEW_LINE_IN_BLOCKQUOTE = exports.KEY_INSERT_NEW_LINE = exports.KEY_INSERT_HORIZONTAL_RULE = exports.KEY_FORWARD_DELETE = exports.KEY_BACK_DELETE = exports.KEY_SAVE = undefined; exports.tooltip = tooltip; exports.findKeymapByDescription = findKeymapByDescription; exports.findShortcutByDescription = findShortcutByDescription; @@ -74,6 +74,7 @@ function makeKeyMapWithCommon(description, common) { return makeKeyMap(description, windows, mac, common); } +var KEY_SAVE = exports.KEY_SAVE = makeKeyMapWithCommon('Save', 'Mod-s'); var KEY_BACK_DELETE = exports.KEY_BACK_DELETE = makeKeyMapWithCommon('', 'Backspace'); var KEY_FORWARD_DELETE = exports.KEY_FORWARD_DELETE = makeKeyMapWithCommon('', 'Delete'); var KEY_INSERT_HORIZONTAL_RULE = exports.KEY_INSERT_HORIZONTAL_RULE = makeKeyMapWithCommon('Insert horizontal rule', 'Mod-Shift--'); diff --git a/dist/EditorKeyMap.js.flow b/dist/EditorKeyMap.js.flow index 3c0bd5c0..4e2e2932 100644 --- a/dist/EditorKeyMap.js.flow +++ b/dist/EditorKeyMap.js.flow @@ -69,6 +69,7 @@ export function makeKeyMapWithCommon( return makeKeyMap(description, windows, mac, common); } +export const KEY_SAVE = makeKeyMapWithCommon('Save', 'Mod-s'); export const KEY_BACK_DELETE = makeKeyMapWithCommon('', 'Backspace'); export const KEY_FORWARD_DELETE = makeKeyMapWithCommon('', 'Delete'); export const KEY_INSERT_HORIZONTAL_RULE = makeKeyMapWithCommon( diff --git a/dist/EditorNodes.js b/dist/EditorNodes.js index a4a6e160..6805e948 100644 --- a/dist/EditorNodes.js +++ b/dist/EditorNodes.js @@ -9,6 +9,10 @@ var _defineProperty2 = require('babel-runtime/helpers/defineProperty'); var _defineProperty3 = _interopRequireDefault(_defineProperty2); var _nodes; +//import CodeBlockNodeSpec from './CodeBlockNodeSpec'; + +// import MathNodeSpec from './MathNodeSpec'; + var _prosemirrorModel = require('prosemirror-model'); @@ -24,10 +28,6 @@ var _BulletListNodeSpec = require('./BulletListNodeSpec'); var _BulletListNodeSpec2 = _interopRequireDefault(_BulletListNodeSpec); -var _CodeBlockNodeSpec = require('./CodeBlockNodeSpec'); - -var _CodeBlockNodeSpec2 = _interopRequireDefault(_CodeBlockNodeSpec); - var _DocNodeSpec = require('./DocNodeSpec'); var _DocNodeSpec2 = _interopRequireDefault(_DocNodeSpec); @@ -52,10 +52,6 @@ var _ListItemNodeSpec = require('./ListItemNodeSpec'); var _ListItemNodeSpec2 = _interopRequireDefault(_ListItemNodeSpec); -var _MathNodeSpec = require('./MathNodeSpec'); - -var _MathNodeSpec2 = _interopRequireDefault(_MathNodeSpec); - var _NodeNames = require('./NodeNames'); var NodeNames = _interopRequireWildcard(_NodeNames); @@ -83,14 +79,12 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de var BLOCKQUOTE = NodeNames.BLOCKQUOTE, BOOKMARK = NodeNames.BOOKMARK, BULLET_LIST = NodeNames.BULLET_LIST, - CODE_BLOCK = NodeNames.CODE_BLOCK, DOC = NodeNames.DOC, HARD_BREAK = NodeNames.HARD_BREAK, HEADING = NodeNames.HEADING, HORIZONTAL_RULE = NodeNames.HORIZONTAL_RULE, IMAGE = NodeNames.IMAGE, LIST_ITEM = NodeNames.LIST_ITEM, - MATH = NodeNames.MATH, ORDERED_LIST = NodeNames.ORDERED_LIST, PARAGRAPH = NodeNames.PARAGRAPH, TEXT = NodeNames.TEXT; @@ -100,7 +94,7 @@ var BLOCKQUOTE = NodeNames.BLOCKQUOTE, // !! Be careful with the order of these nodes, which may effect the parsing // outcome.!! -var nodes = (_nodes = {}, (0, _defineProperty3.default)(_nodes, DOC, _DocNodeSpec2.default), (0, _defineProperty3.default)(_nodes, PARAGRAPH, _ParagraphNodeSpec2.default), (0, _defineProperty3.default)(_nodes, BLOCKQUOTE, _BlockquoteNodeSpec2.default), (0, _defineProperty3.default)(_nodes, HORIZONTAL_RULE, _HorizontalRuleNodeSpec2.default), (0, _defineProperty3.default)(_nodes, HEADING, _HeadingNodeSpec2.default), (0, _defineProperty3.default)(_nodes, CODE_BLOCK, _CodeBlockNodeSpec2.default), (0, _defineProperty3.default)(_nodes, TEXT, _TextNodeSpec2.default), (0, _defineProperty3.default)(_nodes, IMAGE, _ImageNodeSpec2.default), (0, _defineProperty3.default)(_nodes, MATH, _MathNodeSpec2.default), (0, _defineProperty3.default)(_nodes, HARD_BREAK, _HardBreakNodeSpec2.default), (0, _defineProperty3.default)(_nodes, BULLET_LIST, _BulletListNodeSpec2.default), (0, _defineProperty3.default)(_nodes, ORDERED_LIST, _OrderedListNodeSpec2.default), (0, _defineProperty3.default)(_nodes, LIST_ITEM, _ListItemNodeSpec2.default), (0, _defineProperty3.default)(_nodes, BOOKMARK, _BookmarkNodeSpec2.default), _nodes); +var nodes = (_nodes = {}, (0, _defineProperty3.default)(_nodes, DOC, _DocNodeSpec2.default), (0, _defineProperty3.default)(_nodes, PARAGRAPH, _ParagraphNodeSpec2.default), (0, _defineProperty3.default)(_nodes, BLOCKQUOTE, _BlockquoteNodeSpec2.default), (0, _defineProperty3.default)(_nodes, HORIZONTAL_RULE, _HorizontalRuleNodeSpec2.default), (0, _defineProperty3.default)(_nodes, HEADING, _HeadingNodeSpec2.default), (0, _defineProperty3.default)(_nodes, TEXT, _TextNodeSpec2.default), (0, _defineProperty3.default)(_nodes, IMAGE, _ImageNodeSpec2.default), (0, _defineProperty3.default)(_nodes, HARD_BREAK, _HardBreakNodeSpec2.default), (0, _defineProperty3.default)(_nodes, BULLET_LIST, _BulletListNodeSpec2.default), (0, _defineProperty3.default)(_nodes, ORDERED_LIST, _OrderedListNodeSpec2.default), (0, _defineProperty3.default)(_nodes, LIST_ITEM, _ListItemNodeSpec2.default), (0, _defineProperty3.default)(_nodes, BOOKMARK, _BookmarkNodeSpec2.default), _nodes); var marks = {}; var schema = new _prosemirrorModel.Schema({ nodes: nodes, marks: marks }); diff --git a/dist/EditorNodes.js.flow b/dist/EditorNodes.js.flow index 898b0540..d61b6dc3 100644 --- a/dist/EditorNodes.js.flow +++ b/dist/EditorNodes.js.flow @@ -5,14 +5,14 @@ import {Schema} from 'prosemirror-model'; import BlockquoteNodeSpec from './BlockquoteNodeSpec'; import BookmarkNodeSpec from './BookmarkNodeSpec'; import BulletListNodeSpec from './BulletListNodeSpec'; -import CodeBlockNodeSpec from './CodeBlockNodeSpec'; +//import CodeBlockNodeSpec from './CodeBlockNodeSpec'; import DocNodeSpec from './DocNodeSpec'; import HardBreakNodeSpec from './HardBreakNodeSpec'; import HeadingNodeSpec from './HeadingNodeSpec'; import HorizontalRuleNodeSpec from './HorizontalRuleNodeSpec'; import ImageNodeSpec from './ImageNodeSpec'; import ListItemNodeSpec from './ListItemNodeSpec'; -import MathNodeSpec from './MathNodeSpec'; +// import MathNodeSpec from './MathNodeSpec'; import * as NodeNames from './NodeNames'; import OrderedListNodeSpec from './OrderedListNodeSpec'; import ParagraphNodeSpec from './ParagraphNodeSpec'; @@ -23,14 +23,14 @@ const { BLOCKQUOTE, BOOKMARK, BULLET_LIST, - CODE_BLOCK, + //CODE_BLOCK, DOC, HARD_BREAK, HEADING, HORIZONTAL_RULE, IMAGE, LIST_ITEM, - MATH, + // MATH, ORDERED_LIST, PARAGRAPH, TEXT, @@ -46,10 +46,10 @@ const nodes = { [BLOCKQUOTE]: BlockquoteNodeSpec, [HORIZONTAL_RULE]: HorizontalRuleNodeSpec, [HEADING]: HeadingNodeSpec, - [CODE_BLOCK]: CodeBlockNodeSpec, + //[CODE_BLOCK]: CodeBlockNodeSpec, [TEXT]: TextNodeSpec, [IMAGE]: ImageNodeSpec, - [MATH]: MathNodeSpec, + // [MATH]: MathNodeSpec, [HARD_BREAK]: HardBreakNodeSpec, [BULLET_LIST]: BulletListNodeSpec, [ORDERED_LIST]: OrderedListNodeSpec, diff --git a/dist/FontTypeMarkSpec.js b/dist/FontTypeMarkSpec.js index 52f48878..056afc43 100644 --- a/dist/FontTypeMarkSpec.js +++ b/dist/FontTypeMarkSpec.js @@ -21,9 +21,15 @@ var babelPluginFlowReactPropTypes_proptype_MarkSpec = require('./Types').babelPl var FONT_TYPE_NAMES = exports.FONT_TYPE_NAMES = [ // SERIF -'Arial', 'Arial Black', 'Georgia', 'Tahoma', 'Times New Roman', 'Times', 'Verdana', +'Arial', +'Arial Black', +'Georgia', +'Tahoma', +'Times New Roman', +'Times', +'Verdana', // MONOSPACE -'Courier New', 'Lucida Console', 'Monaco', 'monospace']; +'Courier New']; var RESOLVED_FONT_NAMES = new _set2.default(FONT_TYPE_NAMES); diff --git a/dist/FontTypeMarkSpec.js.flow b/dist/FontTypeMarkSpec.js.flow index a4c1e26a..96fe4f66 100644 --- a/dist/FontTypeMarkSpec.js.flow +++ b/dist/FontTypeMarkSpec.js.flow @@ -9,17 +9,17 @@ import type {MarkSpec} from './Types'; export const FONT_TYPE_NAMES = [ // SERIF 'Arial', - 'Arial Black', - 'Georgia', - 'Tahoma', - 'Times New Roman', + //'Arial Black', + //'Georgia', + //'Tahoma', + //'Times New Roman', 'Times', - 'Verdana', + //'Verdana', // MONOSPACE 'Courier New', - 'Lucida Console', - 'Monaco', - 'monospace', + //'Lucida Console', + //'Monaco', + //'monospace', ]; const RESOLVED_FONT_NAMES = new Set(FONT_TYPE_NAMES); diff --git a/dist/TableResizePlugin.js b/dist/TableResizePlugin.js index 37263b44..480ce12a 100644 --- a/dist/TableResizePlugin.js +++ b/dist/TableResizePlugin.js @@ -83,6 +83,23 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de // - Let user set the left margin of the table. // - Let user set the right margin of the table. +function setAttr(attrs, name, value) { + var result = {}; + for (var prop in attrs) { + result[prop] = attrs[prop]; + }result[name] = value; + return result; +} +function pointsAtCell($pos) { + return $pos.parent.type.spec.tableRole == 'row' && $pos.nodeAfter; +} + +function cellAround($pos) { + for (var d = $pos.depth - 1; d > 0; d--) { + if ($pos.node(d).type.spec.tableRole == 'row') return $pos.node(0).resolve($pos.before(d + 1)); + }return null; +} + var PLUGIN_KEY = new _prosemirrorState.PluginKey('tableColumnResizing'); var CELL_MIN_WIDTH = 25; var HANDLE_WIDTH = 20; @@ -115,7 +132,7 @@ var ResizeState = function () { if (state.cellPos && state.cellPos > -1 && tr.docChanged) { var cellPos = tr.mapping.map(state.cellPos, -1); - if (!(0, _prosemirrorTables.pointsAtCell)(tr.doc.resolve(cellPos))) { + if (!pointsAtCell(tr.doc.resolve(cellPos))) { cellPos = null; } state = new ResizeState(cellPos, cellPos ? state.forMarginLeft : false, state.draggingInfo); @@ -345,7 +362,7 @@ function handleDragEnd(view, event) { continue; } - tr = tr.setNodeMarkup(start + pos, null, (0, _prosemirrorTables.setAttr)(attrs, 'colwidth', colwidth)); + tr = tr.setNodeMarkup(start + pos, null, setAttr(attrs, 'colwidth', colwidth)); } } @@ -453,7 +470,7 @@ function edgeCell(view, event, side) { var _view$posAtCoords = view.posAtCoords({ left: event.clientX, top: event.clientY }), pos = _view$posAtCoords.pos; - var $cell = (0, _prosemirrorTables.cellAround)(view.state.doc.resolve(pos)); + var $cell = cellAround(view.state.doc.resolve(pos)); if (!$cell) { return -1; } @@ -556,7 +573,9 @@ var TableResizePlugin = function (_Plugin) { key: PLUGIN_KEY, state: { init: function init(_, state) { - this.spec.props.nodeViews[(0, _prosemirrorTables.tableNodeTypes)(state.schema).table.name] = createTableView; + this.spec.props.nodeViews[ + //tableNodeTypes(state.schema).table.name + state.schema.nodes.table.name] = createTableView; return new ResizeState(-1, null); }, apply: function apply(tr, prev) { diff --git a/dist/TableResizePlugin.js.flow b/dist/TableResizePlugin.js.flow index 7b19c2c6..82379c4f 100644 --- a/dist/TableResizePlugin.js.flow +++ b/dist/TableResizePlugin.js.flow @@ -37,14 +37,31 @@ import {Decoration, DecorationSet, EditorView} from 'prosemirror-view'; import {findParentNodeOfTypeClosestToPos} from 'prosemirror-utils'; import nullthrows from 'nullthrows'; import { - cellAround, - pointsAtCell, - setAttr, - tableNodeTypes, + //cellAround, + //pointsAtCell, + //setAttr, + //tableNodeTypes, TableMap, TableView, } from 'prosemirror-tables'; +function setAttr(attrs, name, value) { + const result = {}; + for (const prop in attrs) result[prop] = attrs[prop]; + result[name] = value; + return result; +} +function pointsAtCell($pos) { + return $pos.parent.type.spec.tableRole == 'row' && $pos.nodeAfter; +} + +function cellAround($pos) { + for (let d = $pos.depth - 1; d > 0; d--) + if ($pos.node(d).type.spec.tableRole == 'row') + return $pos.node(0).resolve($pos.before(d + 1)); + return null; +} + type DraggingInfo = { columnElements: Array, startX: number, @@ -569,7 +586,8 @@ export default class TableResizePlugin extends Plugin { state: { init(_: any, state: EditorState): ResizeState { this.spec.props.nodeViews[ - tableNodeTypes(state.schema).table.name + //tableNodeTypes(state.schema).table.name + state.schema.nodes.table.name ] = createTableView; return new ResizeState(-1, null); }, diff --git a/dist/convertToHTML.js b/dist/convertToHTML.js new file mode 100644 index 00000000..80682128 --- /dev/null +++ b/dist/convertToHTML.js @@ -0,0 +1,12 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = toHtml; +function toHtml(serializer, doc) { + var container = document.createElement('article'); + var serialized = serializer.serializeFragment(doc.content); + container.appendChild(serialized); + return container.innerHTML; +} \ No newline at end of file diff --git a/dist/convertToHTML.js.flow b/dist/convertToHTML.js.flow new file mode 100644 index 00000000..e7464667 --- /dev/null +++ b/dist/convertToHTML.js.flow @@ -0,0 +1,6 @@ +export default function toHtml(serializer, doc) { + const container = document.createElement('article'); + const serialized = serializer.serializeFragment(doc.content); + container.appendChild(serialized); + return container.innerHTML; +} diff --git a/dist/index.js b/dist/index.js index f457e372..41a08fbf 100644 --- a/dist/index.js +++ b/dist/index.js @@ -3,6 +3,19 @@ Object.defineProperty(exports, "__esModule", { value: true }); +exports.EnableImageUploadRuntime = exports.uuid = exports.isEditorStateEmpty = exports.createEmptyEditorState = exports.convertToHTML = exports.convertToJSON = exports.convertFromJSON = exports.convertFromHTML = exports.RichTextEditor = exports.EditorState = undefined; + +var _promise = require('babel-runtime/core-js/promise'); + +var _promise2 = _interopRequireDefault(_promise); + +var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck'); + +var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); + +var _createClass2 = require('babel-runtime/helpers/createClass'); + +var _createClass3 = _interopRequireDefault(_createClass2); var _prosemirrorState = require('prosemirror-state'); @@ -49,6 +62,15 @@ Object.defineProperty(exports, 'convertToJSON', { } }); +var _convertToHTML = require('./convertToHTML'); + +Object.defineProperty(exports, 'convertToHTML', { + enumerable: true, + get: function get() { + return _interopRequireDefault(_convertToHTML).default; + } +}); + var _createEmptyEditorState = require('./createEmptyEditorState'); Object.defineProperty(exports, 'createEmptyEditorState', { @@ -76,4 +98,45 @@ Object.defineProperty(exports, 'uuid', { } }); -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } \ No newline at end of file +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var EnableImageUploadRuntime = exports.EnableImageUploadRuntime = function () { + function EnableImageUploadRuntime() { + (0, _classCallCheck3.default)(this, EnableImageUploadRuntime); + } + + (0, _createClass3.default)(EnableImageUploadRuntime, [{ + key: 'canUploadImage', + + // Image Upload + value: function canUploadImage() { + return true; + } + }, { + key: 'uploadImage', + value: function uploadImage(file) { + return new _promise2.default(function (resolve, reject) { + var _window = window, + FileReader = _window.FileReader; + + if (FileReader) { + var reader = new FileReader(); + reader.onload = function (event) { + // base64 encoded url. + var src = event.target.result; + resolve({ src: src, height: 0, width: 0, id: '' }); + }; + reader.onerror = function () { + reject(new Error('FileReader failed')); + }; + reader.readAsDataURL(file); + } else { + reject(new Error('FileReader is not available')); + } + }); + } + }]); + return EnableImageUploadRuntime; +}(); + +; \ No newline at end of file diff --git a/dist/index.js.flow b/dist/index.js.flow index a6214df8..48d20f80 100644 --- a/dist/index.js.flow +++ b/dist/index.js.flow @@ -5,6 +5,33 @@ export {default as RichTextEditor} from './ui/RichTextEditor'; export {default as convertFromHTML} from './convertFromHTML'; export {default as convertFromJSON} from './convertFromJSON'; export {default as convertToJSON} from './convertToJSON'; +export {default as convertToHTML} from './convertToHTML'; export {default as createEmptyEditorState} from './createEmptyEditorState'; export {default as isEditorStateEmpty} from './isEditorStateEmpty'; export {default as uuid} from './ui/uuid'; +export class EnableImageUploadRuntime { + // Image Upload + canUploadImage(): boolean { + return true; + } + + uploadImage(file: File): Promise { + return new Promise((resolve, reject) => { + const {FileReader} = window; + if (FileReader) { + const reader = new FileReader(); + reader.onload = event => { + // base64 encoded url. + const src = event.target.result; + resolve({src, height: 0, width: 0, id: ''}); + }; + reader.onerror = () => { + reject(new Error('FileReader failed')); + }; + reader.readAsDataURL(file); + } else { + reject(new Error('FileReader is not available')); + } + }); + } +}; diff --git a/dist/ui/ColorEditor.js b/dist/ui/ColorEditor.js index e132a097..4eca1e9c 100644 --- a/dist/ui/ColorEditor.js +++ b/dist/ui/ColorEditor.js @@ -119,7 +119,7 @@ var ColorEditor = function (_React$PureComponent) { _react2.default.createElement(_CustomButton2.default, { active: !selectedColor, className: 'czi-color-editor-color-transparent', - label: 'Transparent', + label: 'Transparente', onClick: this._onSelectColor, value: 'rgba(0,0,0,0)' }) diff --git a/dist/ui/ColorEditor.js.flow b/dist/ui/ColorEditor.js.flow index add29cc2..baa226f3 100644 --- a/dist/ui/ColorEditor.js.flow +++ b/dist/ui/ColorEditor.js.flow @@ -55,7 +55,7 @@ class ColorEditor extends React.PureComponent { diff --git a/dist/ui/Editor.js b/dist/ui/Editor.js index 8f355aa6..75751d24 100644 --- a/dist/ui/Editor.js +++ b/dist/ui/Editor.js @@ -42,6 +42,8 @@ var _freeze = require('babel-runtime/core-js/object/freeze'); var _freeze2 = _interopRequireDefault(_freeze); var _Object$freeze2; +// import MathNodeView from './MathNodeView'; + var _classnames = require('classnames'); @@ -103,10 +105,6 @@ var _ListItemNodeView = require('./ListItemNodeView'); var _ListItemNodeView2 = _interopRequireDefault(_ListItemNodeView); -var _MathNodeView = require('./MathNodeView'); - -var _MathNodeView2 = _interopRequireDefault(_MathNodeView); - var _handleEditorDrop = require('./handleEditorDrop'); var _handleEditorDrop2 = _interopRequireDefault(_handleEditorDrop); @@ -144,7 +142,8 @@ if (typeof exports !== 'undefined') Object.defineProperty(exports, 'babelPluginF placeholder: require('prop-types').oneOfType([require('prop-types').string, require('prop-types').any]), readOnly: require('prop-types').bool, runtime: babelPluginFlowReactPropTypes_proptype_EditorRuntime, - transformPastedHTML: require('prop-types').func + transformPastedHTML: require('prop-types').func, + onSave: require('prop-types').any }) }); window.CZIProseMirror = { @@ -155,7 +154,7 @@ window.CZIProseMirror = { var AUTO_FOCUS_DELAY = 350; // Default custom node views. -var DEFAULT_NODE_VIEWS = exports.DEFAULT_NODE_VIEWS = (0, _freeze2.default)((_Object$freeze2 = {}, (0, _defineProperty3.default)(_Object$freeze2, _NodeNames.IMAGE, _ImageNodeView2.default), (0, _defineProperty3.default)(_Object$freeze2, _NodeNames.MATH, _MathNodeView2.default), (0, _defineProperty3.default)(_Object$freeze2, _NodeNames.BOOKMARK, _BookmarkNodeView2.default), (0, _defineProperty3.default)(_Object$freeze2, _NodeNames.LIST_ITEM, _ListItemNodeView2.default), _Object$freeze2)); +var DEFAULT_NODE_VIEWS = exports.DEFAULT_NODE_VIEWS = (0, _freeze2.default)((_Object$freeze2 = {}, (0, _defineProperty3.default)(_Object$freeze2, _NodeNames.IMAGE, _ImageNodeView2.default), (0, _defineProperty3.default)(_Object$freeze2, _NodeNames.BOOKMARK, _BookmarkNodeView2.default), (0, _defineProperty3.default)(_Object$freeze2, _NodeNames.LIST_ITEM, _ListItemNodeView2.default), _Object$freeze2)); var EDITOR_EMPTY_STATE = (0, _freeze2.default)((0, _createEmptyEditorState2.default)()); diff --git a/dist/ui/Editor.js.flow b/dist/ui/Editor.js.flow index 9c950038..b8e969e7 100644 --- a/dist/ui/Editor.js.flow +++ b/dist/ui/Editor.js.flow @@ -17,7 +17,12 @@ import { registeryKeys, releaseEditorView, } from '../CZIProseMirror'; -import {BOOKMARK, IMAGE, LIST_ITEM, MATH} from '../NodeNames'; +import { + BOOKMARK, + IMAGE, + LIST_ITEM, + // MATH +} from '../NodeNames'; import WebFontLoader from '../WebFontLoader'; import createEmptyEditorState from '../createEmptyEditorState'; import normalizeHTML from '../normalizeHTML'; @@ -26,7 +31,7 @@ import CustomEditorView from './CustomEditorView'; import CustomNodeView from './CustomNodeView'; import ImageNodeView from './ImageNodeView'; import ListItemNodeView from './ListItemNodeView'; -import MathNodeView from './MathNodeView'; +// import MathNodeView from './MathNodeView'; import handleEditorDrop from './handleEditorDrop'; import handleEditorKeyDown from './handleEditorKeyDown'; import handleEditorPaste from './handleEditorPaste'; @@ -51,6 +56,7 @@ export type EditorProps = { readOnly?: ?boolean, runtime?: ?EditorRuntime, transformPastedHTML?: (html: string) => string, + onSave?: any, }; // Export utilities for debugging. @@ -64,7 +70,7 @@ const AUTO_FOCUS_DELAY = 350; // Default custom node views. export const DEFAULT_NODE_VIEWS = Object.freeze({ [IMAGE]: ImageNodeView, - [MATH]: MathNodeView, + // [MATH]: MathNodeView, [BOOKMARK]: BookmarkNodeView, [LIST_ITEM]: ListItemNodeView, }); diff --git a/dist/ui/EditorToolbar.js b/dist/ui/EditorToolbar.js index e24aa112..1387cfb5 100644 --- a/dist/ui/EditorToolbar.js +++ b/dist/ui/EditorToolbar.js @@ -208,6 +208,7 @@ var EditorToolbar = function (_React$PureComponent) { var _state = this.state, wrapped = _state.wrapped, expanded = _state.expanded; + var onSave = this.props.onSave; var className = (0, _classnames2.default)('czi-editor-toolbar', { expanded: expanded, wrapped: wrapped }); var wrappedButton = wrapped ? _react2.default.createElement(_CustomButton2.default, { @@ -235,6 +236,15 @@ var EditorToolbar = function (_React$PureComponent) { ref: this._onBodyRef }, _react2.default.createElement('i', { className: 'czi-editor-toolbar-wrapped-anchor' }), + _react2.default.createElement( + 'div', + { className: 'czi-custom-buttons' }, + _react2.default.createElement(_CustomButton2.default, { + icon: _Icon2.default.get('save'), + onClick: onSave, + title: 'Salvar' + }) + ), _EditorToolbarConfig.COMMAND_GROUPS.map(this._renderButtonsGroup), _react2.default.createElement( 'div', diff --git a/dist/ui/EditorToolbar.js.flow b/dist/ui/EditorToolbar.js.flow index 27d9bdd1..83442066 100644 --- a/dist/ui/EditorToolbar.js.flow +++ b/dist/ui/EditorToolbar.js.flow @@ -28,6 +28,7 @@ class EditorToolbar extends React.PureComponent { editorView: ?EditorView, onReady?: ?(view: EditorView) => void, readOnly?: ?boolean, + onSave?: ?() => void, }; state = { @@ -37,6 +38,7 @@ class EditorToolbar extends React.PureComponent { render(): React.Element { const {wrapped, expanded} = this.state; + const {onSave} = this.props; const className = cx('czi-editor-toolbar', {expanded, wrapped}); const wrappedButton = wrapped ? ( { ref={this._onBodyRef} > +
+ +
{COMMAND_GROUPS.map(this._renderButtonsGroup)}
diff --git a/dist/ui/EditorToolbarConfig.js b/dist/ui/EditorToolbarConfig.js index a401beb4..303cb14d 100644 --- a/dist/ui/EditorToolbarConfig.js +++ b/dist/ui/EditorToolbarConfig.js @@ -59,26 +59,18 @@ function parseLabel(input) { }; } -var BLOCKQUOTE_TOGGLE = EditorCommands.BLOCKQUOTE_TOGGLE, - CLEAR_FORMAT = EditorCommands.CLEAR_FORMAT, - CODE = EditorCommands.CODE, - DOC_LAYOUT = EditorCommands.DOC_LAYOUT, +var CLEAR_FORMAT = EditorCommands.CLEAR_FORMAT, EM = EditorCommands.EM, H1 = EditorCommands.H1, H2 = EditorCommands.H2, H3 = EditorCommands.H3, - H4 = EditorCommands.H4, - H5 = EditorCommands.H5, - H6 = EditorCommands.H6, HISTORY_REDO = EditorCommands.HISTORY_REDO, HISTORY_UNDO = EditorCommands.HISTORY_UNDO, HR = EditorCommands.HR, - IMAGE_FROM_URL = EditorCommands.IMAGE_FROM_URL, IMAGE_UPLOAD = EditorCommands.IMAGE_UPLOAD, INDENT_LESS = EditorCommands.INDENT_LESS, INDENT_MORE = EditorCommands.INDENT_MORE, LINK_SET_URL = EditorCommands.LINK_SET_URL, - MATH_EDIT = EditorCommands.MATH_EDIT, OL = EditorCommands.OL, STRIKE = EditorCommands.STRIKE, STRONG = EditorCommands.STRONG, @@ -87,7 +79,6 @@ var BLOCKQUOTE_TOGGLE = EditorCommands.BLOCKQUOTE_TOGGLE, TABLE_ADD_COLUMN_BEFORE = EditorCommands.TABLE_ADD_COLUMN_BEFORE, TABLE_ADD_ROW_AFTER = EditorCommands.TABLE_ADD_ROW_AFTER, TABLE_ADD_ROW_BEFORE = EditorCommands.TABLE_ADD_ROW_BEFORE, - TABLE_BORDER_COLOR = EditorCommands.TABLE_BORDER_COLOR, TABLE_BACKGROUND_COLOR = EditorCommands.TABLE_BACKGROUND_COLOR, TABLE_DELETE_COLUMN = EditorCommands.TABLE_DELETE_COLUMN, TABLE_DELETE_ROW = EditorCommands.TABLE_DELETE_ROW, @@ -95,9 +86,6 @@ var BLOCKQUOTE_TOGGLE = EditorCommands.BLOCKQUOTE_TOGGLE, TABLE_INSERT_TABLE = EditorCommands.TABLE_INSERT_TABLE, TABLE_MERGE_CELLS = EditorCommands.TABLE_MERGE_CELLS, TABLE_SPLIT_ROW = EditorCommands.TABLE_SPLIT_ROW, - TABLE_TOGGLE_HEADER_CELL = EditorCommands.TABLE_TOGGLE_HEADER_CELL, - TABLE_TOGGLE_HEADER_COLUMN = EditorCommands.TABLE_TOGGLE_HEADER_COLUMN, - TABLE_TOGGLE_HEADER_ROW = EditorCommands.TABLE_TOGGLE_HEADER_ROW, TEXT_ALIGN_CENTER = EditorCommands.TEXT_ALIGN_CENTER, TEXT_ALIGN_JUSTIFY = EditorCommands.TEXT_ALIGN_JUSTIFY, TEXT_ALIGN_LEFT = EditorCommands.TEXT_ALIGN_LEFT, @@ -108,83 +96,82 @@ var BLOCKQUOTE_TOGGLE = EditorCommands.BLOCKQUOTE_TOGGLE, UL = EditorCommands.UL, UNDERLINE = EditorCommands.UNDERLINE; var TABLE_COMMANDS_GROUP = exports.TABLE_COMMANDS_GROUP = [{ - 'Insert Table...': TABLE_INSERT_TABLE + 'Inserir Tabela': TABLE_INSERT_TABLE }, { - 'Fill Color...': TABLE_BACKGROUND_COLOR, - 'Border Color....': TABLE_BORDER_COLOR + 'Cor de Fundo': TABLE_BACKGROUND_COLOR + //'Border Color....': TABLE_BORDER_COLOR, }, { - 'Insert Column Before': TABLE_ADD_COLUMN_BEFORE, - 'Insert Column After': TABLE_ADD_COLUMN_AFTER, - 'Delete Column': TABLE_DELETE_COLUMN + 'Inserir Coluna Antes': TABLE_ADD_COLUMN_BEFORE, + 'Inserir Coluna Depois': TABLE_ADD_COLUMN_AFTER, + 'Apagar Coluna': TABLE_DELETE_COLUMN }, { - 'Insert Row Before': TABLE_ADD_ROW_BEFORE, - 'Insert Row After': TABLE_ADD_ROW_AFTER, - 'Delete Row': TABLE_DELETE_ROW + 'Inserir Linha Antes': TABLE_ADD_ROW_BEFORE, + 'Inserir Linha Depois': TABLE_ADD_ROW_AFTER, + 'Apagar Linha': TABLE_DELETE_ROW }, { - 'Merge Cells': TABLE_MERGE_CELLS, - 'Split Row': TABLE_SPLIT_ROW + 'Mesclar Celulas': TABLE_MERGE_CELLS, + 'Dividir Celulas': TABLE_SPLIT_ROW }, // Disable these commands cause user rarely use them. +//{ +// 'Toggle Header Column': TABLE_TOGGLE_HEADER_COLUMN, +// 'Toggle Header Row': TABLE_TOGGLE_HEADER_ROW, +// 'Toggle Header Cells': TABLE_TOGGLE_HEADER_CELL, +//}, { - 'Toggle Header Column': TABLE_TOGGLE_HEADER_COLUMN, - 'Toggle Header Row': TABLE_TOGGLE_HEADER_ROW, - 'Toggle Header Cells': TABLE_TOGGLE_HEADER_CELL -}, { - 'Delete Table': TABLE_DELETE_TABLE + 'Apagar Tabela': TABLE_DELETE_TABLE }]; var COMMAND_GROUPS = exports.COMMAND_GROUPS = [{ - '[undo] Undo': HISTORY_UNDO, - '[redo] Redo': HISTORY_REDO -}, { - '[grid_on] Table...': TABLE_COMMANDS_GROUP -}, { - '[H1] Header 1': H1, - '[H2] Heading 2': H2, - '[keyboard_arrow_down] Headings...': [{ - 'Header 3': H3, - 'Header 4': H4, - 'Header 5': H5, - 'Header 6': H6 + '[undo] Desfazer': HISTORY_UNDO, + '[redo] Refazer': HISTORY_REDO +}, { + '[grid_on] Tabela...': TABLE_COMMANDS_GROUP +}, { + '[H] Títulos...': [{ + 'Título 1': H1, + 'Título 2': H2, + 'Título 3': H3 + // 'Header 4': H4, + // 'Header 5': H5, + // 'Header 6': H6, }] }, { - '[font_download] Font Type': _FontTypeCommandMenuButton2.default -}, { - '[format_size] Text Size': _FontSizeCommandMenuButton2.default + '[font_download] Fonte': _FontTypeCommandMenuButton2.default }, { - '[format_bold] Bold': STRONG, - '[format_italic] Italic': EM, - '[format_underline] Underline': UNDERLINE, - '[format_color_text] Text color': TEXT_COLOR, - '[border_color] Highlight color': TEXT_HIGHLIGHT, - '[superscript] Superscript': SUPER + '[format_size] Tamanho da Fonte': _FontSizeCommandMenuButton2.default }, { - '[link] Apply link': LINK_SET_URL, - '[image] Insert image': [{ - 'Insert image by URL': IMAGE_FROM_URL, - 'Upload image from computer': IMAGE_UPLOAD - }] + '[format_bold] Negrito': STRONG, + '[format_italic] Itálico': EM, + '[format_underline] Sublinhado': UNDERLINE, + '[format_strikethrough] Tachado': STRIKE, + '[superscript] Sobrescrito': SUPER }, { - '[format_align_left] Left align': TEXT_ALIGN_LEFT, - '[format_align_center] Center Align': TEXT_ALIGN_CENTER, - '[format_align_right] Right Align': TEXT_ALIGN_RIGHT, - '[format_align_justify] Justify': TEXT_ALIGN_JUSTIFY + '[format_color_text] Cor do texto': TEXT_COLOR, + '[border_color] Cor de fundo': TEXT_HIGHLIGHT }, { - '[format_line_spacing] Line spacing': TEXT_LINE_SPACINGS + '[link] Link': LINK_SET_URL, + '[image] Figura': IMAGE_UPLOAD + // '[image] Insert image': [ + // { + // 'Insert image by URL': IMAGE_FROM_URL, + // 'Upload image from computer': IMAGE_UPLOAD, + // }, + //], }, { - '[format_list_numbered] Ordered list': OL, - '[format_list_bulleted] Bulleted list': UL + '[format_align_left] Esquerda': TEXT_ALIGN_LEFT, + '[format_align_center] Centro': TEXT_ALIGN_CENTER, + '[format_align_right] Direita': TEXT_ALIGN_RIGHT, + '[format_align_justify] Justificado': TEXT_ALIGN_JUSTIFY }, { - '[format_indent_increase] Indent more': INDENT_MORE, - '[format_indent_decrease] Indent less': INDENT_LESS + '[format_line_spacing] Espaço entre linhas': TEXT_LINE_SPACINGS, + '[hr] Linha horizontal': HR }, { - '[format_clear] Clear formats': CLEAR_FORMAT + '[format_list_bulleted] Lista': UL, + '[format_list_numbered] Lista Ordenada': OL }, { - '[hr] Horizontal line': HR, - '[functions] Math': MATH_EDIT, - '[code] Code': CODE, - '[format_strikethrough] Strike through': STRIKE, - '[format_quote] Block quote': BLOCKQUOTE_TOGGLE + '[format_indent_increase] Identar mais': INDENT_MORE, + '[format_indent_decrease] Identar menos': INDENT_LESS }, { - '[settings_overscan] Page layout': DOC_LAYOUT + '[format_clear] Limpar formatação': CLEAR_FORMAT }]; \ No newline at end of file diff --git a/dist/ui/EditorToolbarConfig.js.flow b/dist/ui/EditorToolbarConfig.js.flow index a2e6fbf8..f878fe28 100644 --- a/dist/ui/EditorToolbarConfig.js.flow +++ b/dist/ui/EditorToolbarConfig.js.flow @@ -31,26 +31,26 @@ export function parseLabel(input: string): Object { } const { - BLOCKQUOTE_TOGGLE, + // BLOCKQUOTE_TOGGLE, CLEAR_FORMAT, - CODE, - DOC_LAYOUT, + // CODE, + // DOC_LAYOUT, EM, H1, H2, H3, - H4, - H5, - H6, + // H4, + // H5, + // H6, HISTORY_REDO, HISTORY_UNDO, HR, - IMAGE_FROM_URL, + // IMAGE_FROM_URL, IMAGE_UPLOAD, INDENT_LESS, INDENT_MORE, LINK_SET_URL, - MATH_EDIT, + // MATH_EDIT, OL, STRIKE, STRONG, @@ -59,19 +59,19 @@ const { TABLE_ADD_COLUMN_BEFORE, TABLE_ADD_ROW_AFTER, TABLE_ADD_ROW_BEFORE, - TABLE_BORDER_COLOR, + //TABLE_BORDER_COLOR, TABLE_BACKGROUND_COLOR, TABLE_DELETE_COLUMN, TABLE_DELETE_ROW, TABLE_DELETE_TABLE, TABLE_INSERT_TABLE, TABLE_MERGE_CELLS, - // TABLE_MOVE_TO_NEXT_CELL, - // TABLE_MOVE_TO_PREV_CELL, + //TABLE_MOVE_TO_NEXT_CELL, + //TABLE_MOVE_TO_PREV_CELL, TABLE_SPLIT_ROW, - TABLE_TOGGLE_HEADER_CELL, - TABLE_TOGGLE_HEADER_COLUMN, - TABLE_TOGGLE_HEADER_ROW, + //TABLE_TOGGLE_HEADER_CELL, + //TABLE_TOGGLE_HEADER_COLUMN, + //TABLE_TOGGLE_HEADER_ROW, TEXT_ALIGN_CENTER, TEXT_ALIGN_JUSTIFY, TEXT_ALIGN_LEFT, @@ -85,108 +85,113 @@ const { export const TABLE_COMMANDS_GROUP = [ { - 'Insert Table...': TABLE_INSERT_TABLE, + 'Inserir Tabela': TABLE_INSERT_TABLE, }, { - 'Fill Color...': TABLE_BACKGROUND_COLOR, - 'Border Color....': TABLE_BORDER_COLOR, + 'Cor de Fundo': TABLE_BACKGROUND_COLOR, + //'Border Color....': TABLE_BORDER_COLOR, }, { - 'Insert Column Before': TABLE_ADD_COLUMN_BEFORE, - 'Insert Column After': TABLE_ADD_COLUMN_AFTER, - 'Delete Column': TABLE_DELETE_COLUMN, + 'Inserir Coluna Antes': TABLE_ADD_COLUMN_BEFORE, + 'Inserir Coluna Depois': TABLE_ADD_COLUMN_AFTER, + 'Apagar Coluna': TABLE_DELETE_COLUMN, }, { - 'Insert Row Before': TABLE_ADD_ROW_BEFORE, - 'Insert Row After': TABLE_ADD_ROW_AFTER, - 'Delete Row': TABLE_DELETE_ROW, + 'Inserir Linha Antes': TABLE_ADD_ROW_BEFORE, + 'Inserir Linha Depois': TABLE_ADD_ROW_AFTER, + 'Apagar Linha': TABLE_DELETE_ROW, }, { - 'Merge Cells': TABLE_MERGE_CELLS, - 'Split Row': TABLE_SPLIT_ROW, + 'Mesclar Celulas': TABLE_MERGE_CELLS, + 'Dividir Celulas': TABLE_SPLIT_ROW, }, // Disable these commands cause user rarely use them. + //{ + // 'Toggle Header Column': TABLE_TOGGLE_HEADER_COLUMN, + // 'Toggle Header Row': TABLE_TOGGLE_HEADER_ROW, + // 'Toggle Header Cells': TABLE_TOGGLE_HEADER_CELL, + //}, { - 'Toggle Header Column': TABLE_TOGGLE_HEADER_COLUMN, - 'Toggle Header Row': TABLE_TOGGLE_HEADER_ROW, - 'Toggle Header Cells': TABLE_TOGGLE_HEADER_CELL, - }, - { - 'Delete Table': TABLE_DELETE_TABLE, + 'Apagar Tabela': TABLE_DELETE_TABLE, }, ]; export const COMMAND_GROUPS = [ { - '[undo] Undo': HISTORY_UNDO, - '[redo] Redo': HISTORY_REDO, + '[undo] Desfazer': HISTORY_UNDO, + '[redo] Refazer': HISTORY_REDO, }, { - '[grid_on] Table...': TABLE_COMMANDS_GROUP, + '[grid_on] Tabela...': TABLE_COMMANDS_GROUP, }, { - '[H1] Header 1': H1, - '[H2] Heading 2': H2, - '[keyboard_arrow_down] Headings...': [ + '[H] Títulos...': [ { - 'Header 3': H3, - 'Header 4': H4, - 'Header 5': H5, - 'Header 6': H6, + 'Título 1': H1, + 'Título 2': H2, + 'Título 3': H3, + // 'Header 4': H4, + // 'Header 5': H5, + // 'Header 6': H6, }, ], }, { - '[font_download] Font Type': FontTypeCommandMenuButton, - }, - { - '[format_size] Text Size': FontSizeCommandMenuButton, + '[font_download] Fonte': FontTypeCommandMenuButton, }, { - '[format_bold] Bold': STRONG, - '[format_italic] Italic': EM, - '[format_underline] Underline': UNDERLINE, - '[format_color_text] Text color': TEXT_COLOR, - '[border_color] Highlight color': TEXT_HIGHLIGHT, - '[superscript] Superscript': SUPER, + '[format_size] Tamanho da Fonte': FontSizeCommandMenuButton, }, { - '[link] Apply link': LINK_SET_URL, - '[image] Insert image': [ - { - 'Insert image by URL': IMAGE_FROM_URL, - 'Upload image from computer': IMAGE_UPLOAD, - }, - ], + '[format_bold] Negrito': STRONG, + '[format_italic] Itálico': EM, + '[format_underline] Sublinhado': UNDERLINE, + '[format_strikethrough] Tachado': STRIKE, + '[superscript] Sobrescrito': SUPER, }, { - '[format_align_left] Left align': TEXT_ALIGN_LEFT, - '[format_align_center] Center Align': TEXT_ALIGN_CENTER, - '[format_align_right] Right Align': TEXT_ALIGN_RIGHT, - '[format_align_justify] Justify': TEXT_ALIGN_JUSTIFY, + '[format_color_text] Cor do texto': TEXT_COLOR, + '[border_color] Cor de fundo': TEXT_HIGHLIGHT, }, { - '[format_line_spacing] Line spacing': TEXT_LINE_SPACINGS, + '[link] Link': LINK_SET_URL, + '[image] Figura': IMAGE_UPLOAD, + // '[image] Insert image': [ + // { + // 'Insert image by URL': IMAGE_FROM_URL, + // 'Upload image from computer': IMAGE_UPLOAD, + // }, + //], }, { - '[format_list_numbered] Ordered list': OL, - '[format_list_bulleted] Bulleted list': UL, + '[format_align_left] Esquerda': TEXT_ALIGN_LEFT, + '[format_align_center] Centro': TEXT_ALIGN_CENTER, + '[format_align_right] Direita': TEXT_ALIGN_RIGHT, + '[format_align_justify] Justificado': TEXT_ALIGN_JUSTIFY, }, { - '[format_indent_increase] Indent more': INDENT_MORE, - '[format_indent_decrease] Indent less': INDENT_LESS, + '[format_line_spacing] Espaço entre linhas': TEXT_LINE_SPACINGS, + '[hr] Linha horizontal': HR, }, { - '[format_clear] Clear formats': CLEAR_FORMAT, + '[format_list_bulleted] Lista': UL, + '[format_list_numbered] Lista Ordenada': OL, }, { - '[hr] Horizontal line': HR, - '[functions] Math': MATH_EDIT, - '[code] Code': CODE, - '[format_strikethrough] Strike through': STRIKE, - '[format_quote] Block quote': BLOCKQUOTE_TOGGLE, + '[format_indent_increase] Identar mais': INDENT_MORE, + '[format_indent_decrease] Identar menos': INDENT_LESS, }, { - '[settings_overscan] Page layout': DOC_LAYOUT, + '[format_clear] Limpar formatação': CLEAR_FORMAT, }, + // { + // '[hr] Horizontal line': HR, + // '[functions] Math': MATH_EDIT, + // '[code] Code': CODE, + // '[format_strikethrough] Strike through': STRIKE, + // '[format_quote] Block quote': BLOCKQUOTE_TOGGLE, + // }, + // { + // '[settings_overscan] Page layout': DOC_LAYOUT, + // }, ]; diff --git a/dist/ui/FontSizeCommandMenuButton.js b/dist/ui/FontSizeCommandMenuButton.js index c8e5d9ce..1d2b32b9 100644 --- a/dist/ui/FontSizeCommandMenuButton.js +++ b/dist/ui/FontSizeCommandMenuButton.js @@ -56,7 +56,7 @@ var FONT_PT_SIZE_COMMANDS = FONT_PT_SIZES.reduce(function (memo, size) { return memo; }, {}); -var COMMAND_GROUPS = [{ Default: new _FontSizeCommand2.default(0) }, FONT_PT_SIZE_COMMANDS]; +var COMMAND_GROUPS = [FONT_PT_SIZE_COMMANDS]; var FontSizeCommandMenuButton = function (_React$PureComponent) { (0, _inherits3.default)(FontSizeCommandMenuButton, _React$PureComponent); diff --git a/dist/ui/FontSizeCommandMenuButton.js.flow b/dist/ui/FontSizeCommandMenuButton.js.flow index 816aa60a..e903a989 100644 --- a/dist/ui/FontSizeCommandMenuButton.js.flow +++ b/dist/ui/FontSizeCommandMenuButton.js.flow @@ -31,10 +31,7 @@ const FONT_PT_SIZE_COMMANDS = FONT_PT_SIZES.reduce((memo, size) => { return memo; }, {}); -const COMMAND_GROUPS = [ - {Default: new FontSizeCommand(0)}, - FONT_PT_SIZE_COMMANDS, -]; +const COMMAND_GROUPS = [FONT_PT_SIZE_COMMANDS]; class FontSizeCommandMenuButton extends React.PureComponent { props: { diff --git a/dist/ui/ImageAlignEditor.js b/dist/ui/ImageAlignEditor.js index 0fa509d3..00f29bed 100644 --- a/dist/ui/ImageAlignEditor.js +++ b/dist/ui/ImageAlignEditor.js @@ -43,19 +43,19 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de var ImageAlignValues = { NONE: { value: null, - text: 'Inline' + text: 'No texto' }, LEFT: { value: 'left', - text: 'Float left' + text: 'Esquerda' }, CENTER: { value: 'center', - text: 'Center' + text: 'Centro' }, RIGHT: { value: 'right', - text: 'Float right' + text: 'Direita' } }; diff --git a/dist/ui/ImageAlignEditor.js.flow b/dist/ui/ImageAlignEditor.js.flow index c34f3cea..085cb0f4 100644 --- a/dist/ui/ImageAlignEditor.js.flow +++ b/dist/ui/ImageAlignEditor.js.flow @@ -7,19 +7,19 @@ import React from 'react'; const ImageAlignValues = { NONE: { value: null, - text: 'Inline', + text: 'No texto', }, LEFT: { value: 'left', - text: 'Float left', + text: 'Esquerda', }, CENTER: { value: 'center', - text: 'Center', + text: 'Centro', }, RIGHT: { value: 'right', - text: 'Float right', + text: 'Direita', }, }; diff --git a/dist/ui/ImageInlineEditor.js b/dist/ui/ImageInlineEditor.js index f623f027..f3ce4326 100644 --- a/dist/ui/ImageInlineEditor.js +++ b/dist/ui/ImageInlineEditor.js @@ -43,19 +43,19 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de var ImageAlignValues = { NONE: { value: null, - text: 'Inline' + text: 'No texto' }, LEFT: { value: 'left', - text: 'Float left' + text: 'Esquerda' }, CENTER: { value: 'center', - text: 'Break text' + text: 'Centro' }, RIGHT: { value: 'right', - text: 'Float right' + text: 'Direita' } }; diff --git a/dist/ui/ImageInlineEditor.js.flow b/dist/ui/ImageInlineEditor.js.flow index 3d7707a3..85bdbe90 100644 --- a/dist/ui/ImageInlineEditor.js.flow +++ b/dist/ui/ImageInlineEditor.js.flow @@ -7,19 +7,19 @@ import React from 'react'; const ImageAlignValues = { NONE: { value: null, - text: 'Inline', + text: 'No texto', }, LEFT: { value: 'left', - text: 'Float left', + text: 'Esquerda', }, CENTER: { value: 'center', - text: 'Break text', + text: 'Centro', }, RIGHT: { value: 'right', - text: 'Float right', + text: 'Direita', }, }; diff --git a/dist/ui/LinkTooltip.js b/dist/ui/LinkTooltip.js index 69ecb1b7..8e196684 100644 --- a/dist/ui/LinkTooltip.js +++ b/dist/ui/LinkTooltip.js @@ -124,7 +124,7 @@ var LinkTooltip = function (_React$PureComponent) { onRemove = _props.onRemove; var useBookMark = isBookMarkHref(href); - var editButton = !!useBookMark && _react2.default.createElement(_CustomButton2.default, { label: 'Change', onClick: onEdit, value: editorView }); + var editButton = !!useBookMark && _react2.default.createElement(_CustomButton2.default, { label: 'Trocar', onClick: onEdit, value: editorView }); return _react2.default.createElement( 'div', @@ -145,7 +145,7 @@ var LinkTooltip = function (_React$PureComponent) { }), editButton, _react2.default.createElement(_CustomButton2.default, { - label: 'Remove', + label: 'Remover', onClick: onRemove, value: editorView }) diff --git a/dist/ui/LinkTooltip.js.flow b/dist/ui/LinkTooltip.js.flow index 074176e1..6a6f803a 100644 --- a/dist/ui/LinkTooltip.js.flow +++ b/dist/ui/LinkTooltip.js.flow @@ -32,7 +32,7 @@ class LinkTooltip extends React.PureComponent { const {href, editorView, onEdit, onRemove} = this.props; const useBookMark = isBookMarkHref(href); const editButton = !!useBookMark && ( - + ); return ( @@ -49,7 +49,7 @@ class LinkTooltip extends React.PureComponent { /> {editButton} diff --git a/dist/ui/LinkURLEditor.js b/dist/ui/LinkURLEditor.js index 5d31ca17..676b02ba 100644 --- a/dist/ui/LinkURLEditor.js +++ b/dist/ui/LinkURLEditor.js @@ -96,10 +96,10 @@ var LinkURLEditor = function (_React$PureComponent) { var error = url ? BAD_CHARACTER_PATTER.test(url) : false; - var label = 'Apply'; + var label = 'Aplicar'; var disabled = !!error; if (href) { - label = url ? 'Apply' : 'Remove'; + label = url ? 'Aplicar' : 'Remover'; disabled = error; } else { disabled = error || !url; @@ -117,13 +117,13 @@ var LinkURLEditor = function (_React$PureComponent) { _react2.default.createElement( 'legend', null, - 'Add a Link' + 'Adicionar um Link' ), _react2.default.createElement('input', { autoFocus: true, onChange: this._onURLChange, onKeyDown: this._onKeyDown, - placeholder: 'Paste a URL', + placeholder: 'Colar a URL', spellCheck: false, type: 'text', value: url || '' @@ -132,7 +132,7 @@ var LinkURLEditor = function (_React$PureComponent) { _react2.default.createElement( 'div', { className: 'czi-form-buttons' }, - _react2.default.createElement(_CustomButton2.default, { label: 'Cancel', onClick: this._cancel }), + _react2.default.createElement(_CustomButton2.default, { label: 'Cancelar', onClick: this._cancel }), _react2.default.createElement(_CustomButton2.default, { active: true, disabled: disabled, diff --git a/dist/ui/LinkURLEditor.js.flow b/dist/ui/LinkURLEditor.js.flow index 2e8e1937..76922cd7 100644 --- a/dist/ui/LinkURLEditor.js.flow +++ b/dist/ui/LinkURLEditor.js.flow @@ -28,10 +28,10 @@ class LinkURLEditor extends React.PureComponent { const error = url ? BAD_CHARACTER_PATTER.test(url) : false; - let label = 'Apply'; + let label = 'Aplicar'; let disabled = !!error; if (href) { - label = url ? 'Apply' : 'Remove'; + label = url ? 'Aplicar' : 'Remover'; disabled = error; } else { disabled = error || !url; @@ -41,19 +41,19 @@ class LinkURLEditor extends React.PureComponent {
- Add a Link + Adicionar um Link
- + { - const dummy = {}; const {View, viewProps, close} = this.props; + const dummy = viewProps || {}; return (
- +
); } diff --git a/dist/ui/PopUpPosition.js b/dist/ui/PopUpPosition.js old mode 100755 new mode 100644 diff --git a/dist/ui/PopUpPosition.js.flow b/dist/ui/PopUpPosition.js.flow old mode 100755 new mode 100644 diff --git a/dist/ui/RichTextEditor.js b/dist/ui/RichTextEditor.js index 13432cf8..d7f6b917 100644 --- a/dist/ui/RichTextEditor.js +++ b/dist/ui/RichTextEditor.js @@ -56,6 +56,10 @@ var _uuid = require('./uuid'); var _uuid2 = _interopRequireDefault(_uuid); +var _CommandButton = require('./CommandButton'); + +var _CommandButton2 = _interopRequireDefault(_CommandButton); + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } var babelPluginFlowReactPropTypes_proptype_EditorFramesetProps = require('./EditorFrameset').babelPluginFlowReactPropTypes_proptype_EditorFramesetProps || require('prop-types').any; @@ -122,7 +126,8 @@ var RichTextEditor = function (_React$PureComponent) { nodeViews = _props.nodeViews, placeholder = _props.placeholder, readOnly = _props.readOnly, - width = _props.width; + width = _props.width, + onSave = _props.onSave; var _props2 = this.props, editorState = _props2.editorState, runtime = _props2.runtime; @@ -139,6 +144,7 @@ var RichTextEditor = function (_React$PureComponent) { dispatchTransaction: this._dispatchTransaction, editorState: editorState || _Editor2.default.EDITOR_EMPTY_STATE, editorView: editorView, + onSave: onSave, readOnly: readOnly }); diff --git a/dist/ui/RichTextEditor.js.flow b/dist/ui/RichTextEditor.js.flow index 8f2d3f30..efd964de 100644 --- a/dist/ui/RichTextEditor.js.flow +++ b/dist/ui/RichTextEditor.js.flow @@ -10,6 +10,7 @@ import EditorFrameset from './EditorFrameset'; import EditorToolbar from './EditorToolbar'; import Frag from './Frag'; import uuid from './uuid'; +import CommandButton from './CommandButton'; import type {EditorFramesetProps} from './EditorFrameset'; import type {EditorProps} from './Editor'; @@ -17,6 +18,7 @@ import type {EditorProps} from './Editor'; type Props = EditorFramesetProps & EditorProps & { children?: ?React.Children, + saveButton?: ?CommandButton, }; type State = { @@ -57,6 +59,7 @@ class RichTextEditor extends React.PureComponent { placeholder, readOnly, width, + onSave, } = this.props; let {editorState, runtime} = this.props; @@ -73,6 +76,7 @@ class RichTextEditor extends React.PureComponent { dispatchTransaction={this._dispatchTransaction} editorState={editorState || Editor.EDITOR_EMPTY_STATE} editorView={editorView} + onSave={onSave} readOnly={readOnly} /> ); diff --git a/dist/ui/TableCellMenu.js b/dist/ui/TableCellMenu.js index 7fb03d46..1a8d73fc 100644 --- a/dist/ui/TableCellMenu.js +++ b/dist/ui/TableCellMenu.js @@ -77,7 +77,7 @@ var TableCellMenu = function (_React$PureComponent) { editorState: editorState, editorView: editorView, icon: _Icon2.default.get('edit'), - title: 'Edit' + title: 'Editar' }); } }]); diff --git a/dist/ui/TableCellMenu.js.flow b/dist/ui/TableCellMenu.js.flow index 2d778533..ab68ae18 100644 --- a/dist/ui/TableCellMenu.js.flow +++ b/dist/ui/TableCellMenu.js.flow @@ -29,7 +29,7 @@ class TableCellMenu extends React.PureComponent { editorState={editorState} editorView={editorView} icon={Icon.get('edit')} - title="Edit" + title="Editar" /> ); } diff --git a/dist/ui/TableNodeView.js b/dist/ui/TableNodeView.js index dfe55ae3..e9875cf1 100644 --- a/dist/ui/TableNodeView.js +++ b/dist/ui/TableNodeView.js @@ -36,7 +36,32 @@ var _prosemirrorTables = require('prosemirror-tables'); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +var TableView = function TableView(node, cellMinWidth) { + this.node = node; + this.cellMinWidth = cellMinWidth; + this.dom = document.createElement('div'); + this.dom.className = 'tableWrapper'; + this.table = this.dom.appendChild(document.createElement('table')); + this.colgroup = this.table.appendChild(document.createElement('colgroup')); + (0, _prosemirrorTables.updateColumnsOnResize)(node, this.colgroup, this.table, cellMinWidth); + this.contentDOM = this.table.appendChild(document.createElement('tbody')); +}; + +TableView.prototype.update = function update(node) { + if (node.type != this.node.type) { + return false; + } + this.node = node; + (0, _prosemirrorTables.updateColumnsOnResize)(node, this.colgroup, this.table, this.cellMinWidth); + return true; +}; + +TableView.prototype.ignoreMutation = function ignoreMutation(record) { + return record.type == 'attributes' && (record.target == this.table || this.colgroup.contains(record.target)); +}; + // A custom table view that renders the margin-left style. + var TableNodeView = function (_TableView) { (0, _inherits3.default)(TableNodeView, _TableView); @@ -66,6 +91,6 @@ var TableNodeView = function (_TableView) { } }]); return TableNodeView; -}(_prosemirrorTables.TableView); +}(TableView); exports.default = TableNodeView; \ No newline at end of file diff --git a/dist/ui/TableNodeView.js.flow b/dist/ui/TableNodeView.js.flow index 62731ecc..486dc059 100644 --- a/dist/ui/TableNodeView.js.flow +++ b/dist/ui/TableNodeView.js.flow @@ -1,11 +1,39 @@ import {Node} from 'prosemirror-model'; import {EditorView} from 'prosemirror-view'; -import {TableView} from 'prosemirror-tables'; +import {updateColumnsOnResize} from 'prosemirror-tables'; + +const TableView = function TableView(node, cellMinWidth) { + this.node = node; + this.cellMinWidth = cellMinWidth; + this.dom = document.createElement('div'); + this.dom.className = 'tableWrapper'; + this.table = this.dom.appendChild(document.createElement('table')); + this.colgroup = this.table.appendChild(document.createElement('colgroup')); + updateColumnsOnResize(node, this.colgroup, this.table, cellMinWidth); + this.contentDOM = this.table.appendChild(document.createElement('tbody')); +}; + +TableView.prototype.update = function update(node) { + if (node.type != this.node.type) { + return false; + } + this.node = node; + updateColumnsOnResize(node, this.colgroup, this.table, this.cellMinWidth); + return true; +}; + +TableView.prototype.ignoreMutation = function ignoreMutation(record) { + return ( + record.type == 'attributes' && + (record.target == this.table || this.colgroup.contains(record.target)) + ); +}; // A custom table view that renders the margin-left style. export default class TableNodeView extends TableView { constructor(node: Node, colMinWidth: number, view: EditorView) { super(node, colMinWidth, view); + this._updateMargin(node); } update(node: Node): boolean { diff --git a/dist/ui/czi-table.css b/dist/ui/czi-table.css index 41f283eb..c6b1742d 100644 --- a/dist/ui/czi-table.css +++ b/dist/ui/czi-table.css @@ -6,23 +6,28 @@ overflow-x: auto; } +.prosemirror-mention-node { + background-color: red; +} + +[data-mention-name] { + background-color: greenyellow; +} + .ProseMirror table { - border-collapse: initial; + border-collapse: collapse; border-spacing: 0; - border: 1px solid var(--czi-table-border-color); - border-width: 0 thin thin 0; + border: thin solid var(--czi-table-border-color); table-layout: fixed; width: 100%; margin: 0; overflow: hidden; - page-break-inside: avoid; } .ProseMirror td, .ProseMirror th { - background-color: #fff; - border: 1px solid var(--czi-table-border-color); - border-width: thin 0 0 thin; + /*background-color: #fff;*/ + border: thin solid var(--czi-table-border-color); box-sizing: border-box; min-width: 1em; padding: 8px; diff --git a/dist/ui/czi-vars.css b/dist/ui/czi-vars.css index f1677359..ffb62b14 100644 --- a/dist/ui/czi-vars.css +++ b/dist/ui/czi-vars.css @@ -24,7 +24,7 @@ --czi-table-header-background-color: rgba(0, 0, 0, 0.05); --czi-table-border-color: #000; --czi-doc-padding-default: 14.5mm; - --czi-doc-width-us-letter-portrait: 216mm; + --czi-doc-width-us-letter-portrait: 210mm; --czi-doc-width-us-letter-landscape: 279mm; --czi-doc-width-us-desktop-screen-4-3: 120vh; --czi-doc-width-us-desktop-screen-16-9: 142vh; diff --git a/lint.sh b/lint.sh old mode 100755 new mode 100644 diff --git a/node_modules/.bin/katex b/node_modules/.bin/katex new file mode 100644 index 00000000..6b15751e --- /dev/null +++ b/node_modules/.bin/katex @@ -0,0 +1,15 @@ +#!/bin/sh +basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") + +case `uname` in + *CYGWIN*) basedir=`cygpath -w "$basedir"`;; +esac + +if [ -x "$basedir/node" ]; then + "$basedir/node" "$basedir/../../../../katex/cli.js" "$@" + ret=$? +else + node "$basedir/../../../../katex/cli.js" "$@" + ret=$? +fi +exit $ret diff --git a/node_modules/.bin/katex.cmd b/node_modules/.bin/katex.cmd new file mode 100644 index 00000000..c5a5290f --- /dev/null +++ b/node_modules/.bin/katex.cmd @@ -0,0 +1,7 @@ +@IF EXIST "%~dp0\node.exe" ( + "%~dp0\node.exe" "%~dp0\..\..\..\..\katex\cli.js" %* +) ELSE ( + @SETLOCAL + @SET PATHEXT=%PATHEXT:;.JS;=;% + node "%~dp0\..\..\..\..\katex\cli.js" %* +) \ No newline at end of file diff --git a/node_modules/.bin/uuid b/node_modules/.bin/uuid new file mode 100644 index 00000000..4481e8bd --- /dev/null +++ b/node_modules/.bin/uuid @@ -0,0 +1,15 @@ +#!/bin/sh +basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") + +case `uname` in + *CYGWIN*) basedir=`cygpath -w "$basedir"`;; +esac + +if [ -x "$basedir/node" ]; then + "$basedir/node" "$basedir/../../../../uuid/bin/uuid" "$@" + ret=$? +else + node "$basedir/../../../../uuid/bin/uuid" "$@" + ret=$? +fi +exit $ret diff --git a/node_modules/.bin/uuid.cmd b/node_modules/.bin/uuid.cmd new file mode 100644 index 00000000..b9ac0d54 --- /dev/null +++ b/node_modules/.bin/uuid.cmd @@ -0,0 +1,7 @@ +@IF EXIST "%~dp0\node.exe" ( + "%~dp0\node.exe" "%~dp0\..\..\..\..\uuid\bin\uuid" %* +) ELSE ( + @SETLOCAL + @SET PATHEXT=%PATHEXT:;.JS;=;% + node "%~dp0\..\..\..\..\uuid\bin\uuid" %* +) \ No newline at end of file diff --git a/node_modules/prosemirror-utils/CHANGELOG.md b/node_modules/prosemirror-utils/CHANGELOG.md new file mode 100644 index 00000000..da2ee690 --- /dev/null +++ b/node_modules/prosemirror-utils/CHANGELOG.md @@ -0,0 +1,20 @@ +## 0.9.6 (2018-08-07) + +### Changed + +- Upgrade prosemirror-tables dependecy to 0.9.1 + +### Fixed + +- Fix types for convertTableNodeToArrayOfRows and convertArrayOfRowsToTableNode, they were using ProsemirrorModel[] instead of Array + + +## 0.5.0 (2018-06-04) + +### Breaking changes + +Changed returning value of all selection utils to `{ node, start, pos}`, where + * `start` points to the start position of the node + * `pos` points directly before the node + * `node` ProseMirror node +Previously, `pos` used to point to the `start` position of the node. diff --git a/node_modules/prosemirror-utils/LICENSE b/node_modules/prosemirror-utils/LICENSE new file mode 100644 index 00000000..b7bb4793 --- /dev/null +++ b/node_modules/prosemirror-utils/LICENSE @@ -0,0 +1,13 @@ +Copyright 2018 Atlassian Pty Ltd + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. diff --git a/node_modules/prosemirror-utils/README.md b/node_modules/prosemirror-utils/README.md new file mode 100644 index 00000000..27e94124 --- /dev/null +++ b/node_modules/prosemirror-utils/README.md @@ -0,0 +1,964 @@ +# Utils library for ProseMirror + +[![npm](https://img.shields.io/npm/v/prosemirror-utils.svg?style=flat-square)](https://www.npmjs.com/package/prosemirror-utils) +[![License](https://img.shields.io/npm/l/prosemirror-utils.svg?style=flat-square)](http://www.apache.org/licenses/LICENSE-2.0) +[![Github Issues](https://img.shields.io/github/issues/atlassian/prosemirror-utils.svg?style=flat-square)](https://github.com/atlassian/prosemirror-utils/issues) +[![CircleCI](https://img.shields.io/circleci/project/github/atlassian/prosemirror-utils.svg?style=flat-square)](https://circleci.com/gh/atlassian/prosemirror-utils) +[![codecov](https://codecov.io/gh/atlassian/prosemirror-utils/branch/master/graph/badge.svg)](https://codecov.io/gh/atlassian/prosemirror-utils) +[![Downloads](https://img.shields.io/npm/dw/prosemirror-utils.svg?style=flat-square)](https://www.npmjs.com/package/prosemirror-utils) +[![Code size](https://img.shields.io/github/languages/code-size/atlassian/prosemirror-utils.svg?style=flat-square)](https://www.npmjs.com/package/prosemirror-utils) + +## Quick Start + +Install `prosemirror-utils` package from npm: + +```sh +npm install prosemirror-utils +``` + +## Public API documentation + +### Utils for working with `selection` + + * **`findParentNode`**`(predicate: fn(node: ProseMirrorNode) → boolean) → fn(selection: Selection) → ?{pos: number, start: number, depth: number, node: ProseMirrorNode}`\ + Iterates over parent nodes, returning the closest node and its start position `predicate` returns truthy for. `start` points to the start position of the node, `pos` points directly before the node. + + ```javascript + const predicate = node => node.type === schema.nodes.blockquote; + const parent = findParentNode(predicate)(selection); + ``` + + + * **`findParentNodeClosestToPos`**`($pos: ResolvedPos, predicate: fn(node: ProseMirrorNode) → boolean) → ?{pos: number, start: number, depth: number, node: ProseMirrorNode}`\ + Iterates over parent nodes starting from the given `$pos`, returning the closest node and its start position `predicate` returns truthy for. `start` points to the start position of the node, `pos` points directly before the node. + + ```javascript + const predicate = node => node.type === schema.nodes.blockquote; + const parent = findParentNodeClosestToPos(state.doc.resolve(5), predicate); + ``` + + + * **`findParentDomRef`**`(predicate: fn(node: ProseMirrorNode) → boolean, domAtPos: fn(pos: number) → {node: dom.Node, offset: number}) → fn(selection: Selection) → ?dom.Node`\ + Iterates over parent nodes, returning DOM reference of the closest node `predicate` returns truthy for. + + ```javascript + const domAtPos = view.domAtPos.bind(view); + const predicate = node => node.type === schema.nodes.table; + const parent = findParentDomRef(predicate, domAtPos)(selection); // + ``` + + + * **`hasParentNode`**`(predicate: fn(node: ProseMirrorNode) → boolean) → fn(selection: Selection) → boolean`\ + Checks if there's a parent node `predicate` returns truthy for. + + ```javascript + if (hasParentNode(node => node.type === schema.nodes.table)(selection)) { + // .... + } + ``` + + + * **`findParentNodeOfType`**`(nodeType: NodeType | [NodeType]) → fn(selection: Selection) → ?{pos: number, start: number, depth: number, node: ProseMirrorNode}`\ + Iterates over parent nodes, returning closest node of a given `nodeType`. `start` points to the start position of the node, `pos` points directly before the node. + + ```javascript + const parent = findParentNodeOfType(schema.nodes.paragraph)(selection); + ``` + + + * **`findParentNodeOfTypeClosestToPos`**`($pos: ResolvedPos, nodeType: NodeType | [NodeType]) → ?{pos: number, start: number, depth: number, node: ProseMirrorNode}`\ + Iterates over parent nodes starting from the given `$pos`, returning closest node of a given `nodeType`. `start` points to the start position of the node, `pos` points directly before the node. + + ```javascript + const parent = findParentNodeOfTypeClosestToPos(state.doc.resolve(10), schema.nodes.paragraph); + ``` + + + * **`hasParentNodeOfType`**`(nodeType: NodeType | [NodeType]) → fn(selection: Selection) → boolean`\ + Checks if there's a parent node of a given `nodeType`. + + ```javascript + if (hasParentNodeOfType(schema.nodes.table)(selection)) { + // .... + } + ``` + + + * **`findParentDomRefOfType`**`(nodeType: NodeType | [NodeType], domAtPos: fn(pos: number) → {node: dom.Node, offset: number}) → fn(selection: Selection) → ?dom.Node`\ + Iterates over parent nodes, returning DOM reference of the closest node of a given `nodeType`. + + ```javascript + const domAtPos = view.domAtPos.bind(view); + const parent = findParentDomRefOfType(schema.nodes.codeBlock, domAtPos)(selection); //
+   ```
+
+
+ * **`findSelectedNodeOfType`**`(nodeType: NodeType | [NodeType]) → fn(selection: Selection) → ?{pos: number, start: number, depth: number, node: ProseMirrorNode}`\
+   Returns a node of a given `nodeType` if it is selected. `start` points to the start position of the node, `pos` points directly before the node.
+
+   ```javascript
+   const { extension, inlineExtension, bodiedExtension } = schema.nodes;
+   const selectedNode = findSelectedNodeOfType([
+     extension,
+     inlineExtension,
+     bodiedExtension,
+   ])(selection);
+   ```
+
+
+ * **`isNodeSelection`**`(selection: Selection) → boolean`\
+   Checks if current selection is a `NodeSelection`.
+
+   ```javascript
+   if (isNodeSelection(tr.selection)) {
+     // ...
+   }
+   ```
+
+
+ * **`findPositionOfNodeBefore`**`(selection: Selection) → ?number`\
+   Returns position of the previous node.
+
+   ```javascript
+   const pos = findPositionOfNodeBefore(tr.selection);
+   ```
+
+
+ * **`findDomRefAtPos`**`(position: number, domAtPos: fn(pos: number) → {node: dom.Node, offset: number}) → dom.Node`\
+   Returns DOM reference of a node at a given `position`. If the node type is of type `TEXT_NODE` it will return the reference of the parent node.
+
+   ```javascript
+   const domAtPos = view.domAtPos.bind(view);
+   const ref = findDomRefAtPos($from.pos, domAtPos);
+   ```
+
+
+### Utils for working with ProseMirror `node`
+
+ * **`flatten`**`(node: ProseMirrorNode, descend: ?boolean = true) → [{node: ProseMirrorNode, pos: number}]`\
+   Flattens descendants of a given `node`. It doesn't descend into a node when descend argument is `false` (defaults to `true`).
+
+   ```javascript
+   const children = flatten(node);
+   ```
+
+
+ * **`findChildren`**`(node: ProseMirrorNode, predicate: fn(node: ProseMirrorNode) → boolean, descend: ?boolean) → [{node: ProseMirrorNode, pos: number}]`\
+   Iterates over descendants of a given `node`, returning child nodes predicate returns truthy for. It doesn't descend into a node when descend argument is `false` (defaults to `true`).
+
+   ```javascript
+   const textNodes = findChildren(node, child => child.isText, false);
+   ```
+
+
+ * **`findTextNodes`**`(node: ProseMirrorNode, descend: ?boolean) → [{node: ProseMirrorNode, pos: number}]`\
+   Returns text nodes of a given `node`. It doesn't descend into a node when descend argument is `false` (defaults to `true`).
+
+   ```javascript
+   const textNodes = findTextNodes(node);
+   ```
+
+
+ * **`findInlineNodes`**`(node: ProseMirrorNode, descend: ?boolean) → [{node: ProseMirrorNode, pos: number}]`\
+   Returns inline nodes of a given `node`. It doesn't descend into a node when descend argument is `false` (defaults to `true`).
+
+   ```javascript
+   const inlineNodes = findInlineNodes(node);
+   ```
+
+
+ * **`findBlockNodes`**`(node: ProseMirrorNode, descend: ?boolean) → [{node: ProseMirrorNode, pos: number}]`\
+   Returns block descendants of a given `node`. It doesn't descend into a node when descend argument is `false` (defaults to `true`).
+
+   ```javascript
+   const blockNodes = findBlockNodes(node);
+   ```
+
+
+ * **`findChildrenByAttr`**`(node: ProseMirrorNode, predicate: fn(attrs: ?Object) → boolean, descend: ?boolean) → [{node: ProseMirrorNode, pos: number}]`\
+   Iterates over descendants of a given `node`, returning child nodes predicate returns truthy for. It doesn't descend into a node when descend argument is `false` (defaults to `true`).
+
+   ```javascript
+   const mergedCells = findChildrenByAttr(table, attrs => attrs.colspan === 2);
+   ```
+
+
+ * **`findChildrenByType`**`(node: ProseMirrorNode, nodeType: NodeType, descend: ?boolean) → [{node: ProseMirrorNode, pos: number}]`\
+   Iterates over descendants of a given `node`, returning child nodes of a given nodeType. It doesn't descend into a node when descend argument is `false` (defaults to `true`).
+
+   ```javascript
+   const cells = findChildrenByType(table, schema.nodes.tableCell);
+   ```
+
+
+ * **`findChildrenByMark`**`(node: ProseMirrorNode, markType: markType, descend: ?boolean) → [{node: ProseMirrorNode, pos: number}]`\
+   Iterates over descendants of a given `node`, returning child nodes that have a mark of a given markType. It doesn't descend into a `node` when descend argument is `false` (defaults to `true`).
+
+   ```javascript
+   const nodes = findChildrenByMark(state.doc, schema.marks.strong);
+   ```
+
+
+ * **`contains`**`(node: ProseMirrorNode, nodeType: NodeType) → boolean`\
+   Returns `true` if a given node contains nodes of a given `nodeType`
+
+   ```javascript
+   if (contains(panel, schema.nodes.listItem)) {
+     // ...
+   }
+   ```
+
+
+### Utils for working with `table`
+
+ * **`findTable`**`(selection: Selection) → ?{pos: number, start: number, node: ProseMirrorNode}`\
+   Iterates over parent nodes, returning the closest table node.
+
+   ```javascript
+   const table = findTable(selection);
+   ```
+
+
+ * **`isCellSelection`**`(selection: Selection) → boolean`\
+   Checks if current selection is a `CellSelection`.
+
+   ```javascript
+   if (isCellSelection(selection)) {
+     // ...
+   }
+   ```
+
+
+ * **`isColumnSelected`**`(columnIndex: number) → fn(selection: Selection) → boolean`\
+   Checks if entire column at index `columnIndex` is selected.
+
+   ```javascript
+   const className = isColumnSelected(i)(selection) ? 'selected' : '';
+   ```
+
+
+ * **`isRowSelected`**`(rowIndex: number) → fn(selection: Selection) → boolean`\
+   Checks if entire row at index `rowIndex` is selected.
+
+   ```javascript
+   const className = isRowSelected(i)(selection) ? 'selected' : '';
+   ```
+
+
+ * **`isTableSelected`**`(selection: Selection) → boolean`\
+   Checks if entire table is selected
+
+   ```javascript
+   const className = isTableSelected(selection) ? 'selected' : '';
+   ```
+
+
+ * **`getCellsInColumn`**`(columnIndex: number | [number]) → fn(selection: Selection) → ?[{pos: number, start: number, node: ProseMirrorNode}]`\
+   Returns an array of cells in a column(s), where `columnIndex` could be a column index or an array of column indexes.
+
+   ```javascript
+   const cells = getCellsInColumn(i)(selection); // [{node, pos}, {node, pos}]
+   ```
+
+
+ * **`getCellsInRow`**`(rowIndex: number | [number]) → fn(selection: Selection) → ?[{pos: number, start: number, node: ProseMirrorNode}]`\
+   Returns an array of cells in a row(s), where `rowIndex` could be a row index or an array of row indexes.
+
+   ```javascript
+   const cells = getCellsInRow(i)(selection); // [{node, pos}, {node, pos}]
+   ```
+
+
+ * **`getCellsInTable`**`(selection: Selection) → ?[{pos: number, start: number, node: ProseMirrorNode}]`\
+   Returns an array of all cells in a table.
+
+   ```javascript
+   const cells = getCellsInTable(selection); // [{node, pos}, {node, pos}]
+   ```
+
+
+ * **`selectColumn`**`(columnIndex: number, expand: ?boolean) → fn(tr: Transaction) → Transaction`\
+   Returns a new transaction that creates a `CellSelection` on a column at index `columnIndex`.
+   Use the optional `expand` param to extend from current selection.
+
+   ```javascript
+   dispatch(
+     selectColumn(i)(state.tr)
+   );
+   ```
+
+
+ * **`selectRow`**`(rowIndex: number, expand: ?boolean) → fn(tr: Transaction) → Transaction`\
+   Returns a new transaction that creates a `CellSelection` on a column at index `rowIndex`.
+   Use the optional `expand` param to extend from current selection.
+
+   ```javascript
+   dispatch(
+     selectRow(i)(state.tr)
+   );
+   ```
+
+
+ * **`selectTable`**`(selection: Selection) → fn(tr: Transaction) → Transaction`\
+   Returns a new transaction that creates a `CellSelection` on the entire table.
+
+   ```javascript
+   dispatch(
+     selectTable(i)(state.tr)
+   );
+   ```
+
+
+ * **`emptyCell`**`(cell: {pos: number, node: ProseMirrorNode}, schema: Schema) → fn(tr: Transaction) → Transaction`\
+   Returns a new transaction that clears the content of a given `cell`.
+
+   ```javascript
+   const $pos = state.doc.resolve(13);
+   dispatch(
+     emptyCell(findCellClosestToPos($pos), state.schema)(state.tr)
+   );
+   ```
+
+
+ * **`addColumnAt`**`(columnIndex: number) → fn(tr: Transaction) → Transaction`\
+   Returns a new transaction that adds a new column at index `columnIndex`.
+
+   ```javascript
+   dispatch(
+     addColumnAt(i)(state.tr)
+   );
+   ```
+
+
+ * **`moveRow`**`(originRowIndex: number, targetRowIndex: targetColumnIndex, options: ?MovementOptions) → fn(tr: Transaction) → Transaction`\
+   Returns a new transaction that moves the origin row to the target index;
+
+   by default "tryToFit" is false, that means if you try to move a row to a place
+   where we will need to split a row with merged cells it'll throw an exception, for example:
+
+   ```
+        ____________________________
+       |      |      |             |
+    0  |  A1  |  B1  |     C1      |
+       |______|______|______ ______|
+       |      |             |      |
+    1  |  A2  |     B2      |      |
+       |______|______ ______|      |
+       |      |      |      |  D1  |
+    2  |  A3  |  B3  |  C2  |      |
+       |______|______|______|______|
+   ```
+
+   if you try to move the row 0 to the row index 1 with tryToFit false,
+   it'll throw an exception since you can't split the row 1;
+   but if "tryToFit" is true, it'll move the row using the current direction.
+
+   We defined current direction using the target and origin values
+   if the origin is greater than the target, that means the course is `bottom-to-top`,
+   so the `tryToFit` logic will use this direction to determine
+   if we should move the column to the right or the left.
+
+   for example, if you call the function using `moveRow(0, 1, { tryToFit: true })`
+   the result will be:
+   ```
+        ____________________________
+       |      |             |      |
+    0  |  A2  |     B2      |      |
+       |______|______ ______|      |
+       |      |      |      |  D1  |
+    1  |  A3  |  B3  |  C2  |      |
+       |______|______|______|______|
+       |      |      |             |
+    2  |  A1  |  B1  |     C1      |
+       |______|______|______ ______|
+   ```
+
+   since we could put the row zero on index one,
+   we pushed to the best place to fit the row index 0,
+   in this case, row index 2.
+
+
+   -------- HOW TO OVERRIDE DIRECTION --------
+
+   If you set "tryToFit" to "true", it will try to figure out the best direction
+   place to fit using the origin and target index, for example:
+
+
+   ```
+        ____________________________
+       |      |      |             |
+    0  |  A1  |  B1  |     C1      |
+       |______|______|______ ______|
+       |      |             |      |
+    1  |  A2  |     B2      |      |
+       |______|______ ______|      |
+       |      |      |      |  D1  |
+    2  |  A3  |  B3  |  C2  |      |
+       |______|______|______|______|
+       |      |             |      |
+    3  |  A4  |     B4      |      |
+       |______|______ ______|      |
+       |      |      |      |  D2  |
+    4  |  A5  |  B5  |  C3  |      |
+       |______|______|______|______|
+   ```
+
+
+   If you try to move the row 0 to row index 4 with "tryToFit" enabled, by default,
+   the code will put it on after the merged rows,
+   but you can override it using the "direction" option.
+
+   -1: Always put the origin before the target
+   ```
+        ____________________________
+       |      |             |      |
+    0  |  A2  |     B2      |      |
+       |______|______ ______|      |
+       |      |      |      |  D1  |
+    1  |  A3  |  B3  |  C2  |      |
+       |______|______|______|______|
+       |      |      |             |
+    2  |  A1  |  B1  |     C1      |
+       |______|______|______ ______|
+       |      |             |      |
+    3  |  A4  |     B4      |      |
+       |______|______ ______|      |
+       |      |      |      |  D2  |
+    4  |  A5  |  B5  |  C3  |      |
+       |______|______|______|______|
+   ```
+
+    0: Automatically decide the best place to fit
+   ```
+        ____________________________
+       |      |             |      |
+    0  |  A2  |     B2      |      |
+       |______|______ ______|      |
+       |      |      |      |  D1  |
+    1  |  A3  |  B3  |  C2  |      |
+       |______|______|______|______|
+       |      |             |      |
+    2  |  A4  |     B4      |      |
+       |______|______ ______|      |
+       |      |      |      |  D2  |
+    3  |  A5  |  B5  |  C3  |      |
+       |______|______|______|______|
+       |      |      |             |
+    4  |  A1  |  B1  |     C1      |
+       |______|______|______ ______|
+   ```
+
+    1: Always put the origin after the target
+   ```
+        ____________________________
+       |      |             |      |
+    0  |  A2  |     B2      |      |
+       |______|______ ______|      |
+       |      |      |      |  D1  |
+    1  |  A3  |  B3  |  C2  |      |
+       |______|______|______|______|
+       |      |             |      |
+    2  |  A4  |     B4      |      |
+       |______|______ ______|      |
+       |      |      |      |  D2  |
+    3  |  A5  |  B5  |  C3  |      |
+       |______|______|______|______|
+       |      |      |             |
+    4  |  A1  |  B1  |     C1      |
+       |______|______|______ ______|
+   ```
+
+   ```javascript
+   dispatch(
+     moveRow(x, y, options)(state.tr)
+   );
+   ```
+
+
+ * **`moveColumn`**`(originColumnIndex: number, targetColumnIndex: targetColumnIndex, options: ?MovementOptions) → fn(tr: Transaction) → Transaction`\
+   Returns a new transaction that moves the origin column to the target index;
+
+   by default "tryToFit" is false, that means if you try to move a column to a place
+   where we will need to split a column with merged cells it'll throw an exception, for example:
+
+   ```
+      0      1         2
+    ____________________________
+   |      |      |             |
+   |  A1  |  B1  |     C1      |
+   |______|______|______ ______|
+   |      |             |      |
+   |  A2  |     B2      |      |
+   |______|______ ______|      |
+   |      |      |      |  D1  |
+   |  A3  |  B3  |  C2  |      |
+   |______|______|______|______|
+   ```
+
+
+   if you try to move the column 0 to the column index 1 with tryToFit false,
+   it'll throw an exception since you can't split the column 1;
+   but if "tryToFit" is true, it'll move the column using the current direction.
+
+   We defined current direction using the target and origin values
+   if the origin is greater than the target, that means the course is `right-to-left`,
+   so the `tryToFit` logic will use this direction to determine
+   if we should move the column to the right or the left.
+
+   for example, if you call the function using `moveColumn(0, 1, { tryToFit: true })`
+   the result will be:
+
+   ```
+      0       1             2
+   _____________________ _______
+   |      |             |      |
+   |  B1  |     C1      |  A1  |
+   |______|______ ______|______|
+   |             |      |      |
+   |     B2      |      |  A2  |
+   |______ ______|      |______|
+   |      |      |  D1  |      |
+   |  B3  |  C2  |      |  A3  |
+   |______|______|______|______|
+   ```
+
+   since we could put the column zero on index one,
+   we pushed to the best place to fit the column 0, in this case, column index 2.
+
+   -------- HOW TO OVERRIDE DIRECTION --------
+
+   If you set "tryToFit" to "true", it will try to figure out the best direction
+   place to fit using the origin and target index, for example:
+
+
+   ```
+       0      1       2     3      4      5       6
+     _________________________________________________
+    |      |      |             |      |             |
+    |  A1  |  B1  |     C1      |  E1  |     F1      |
+    |______|______|______ ______|______|______ ______|
+    |      |             |      |             |      |
+    |  A2  |     B2      |      |     E2      |      |
+    |______|______ ______|      |______ ______|      |
+    |      |      |      |  D1  |      |      |  G2  |
+    |  A3  |  B3  |  C3  |      |  E3  |  F3  |      |
+    |______|______|______|______|______|______|______|
+   ```
+
+
+   If you try to move the column 0 to column index 5 with "tryToFit" enabled, by default,
+   the code will put it on after the merged columns,
+   but you can override it using the "direction" option.
+
+   -1: Always put the origin before the target
+
+   ```
+       0      1       2     3      4      5       6
+     _________________________________________________
+    |      |             |      |      |             |
+    |  B1  |     C1      |  A1  |  E1  |     F1      |
+    |______|______ ______|______|______|______ ______|
+    |             |      |      |             |      |
+    |     B2      |      |  A2  |     E2      |      |
+    |______ ______|      |______|______ ______|      |
+    |      |      |  D1  |      |      |      |  G2  |
+    |  B3  |  C3  |      |  A3  |  E3  |  F3  |      |
+    |______|______|______|______|______|______|______|
+   ```
+
+    0: Automatically decide the best place to fit
+
+   ```
+       0      1       2     3      4      5       6
+     _________________________________________________
+    |      |             |      |             |      |
+    |  B1  |     C1      |  E1  |     F1      |  A1  |
+    |______|______ ______|______|______ ______|______|
+    |             |      |             |      |      |
+    |     B2      |      |     E2      |      |  A2  |
+    |______ ______|      |______ ______|      |______|
+    |      |      |  D1  |      |      |  G2  |      |
+    |  B3  |  C3  |      |  E3  |  F3  |      |  A3  |
+    |______|______|______|______|______|______|______|
+   ```
+
+    1: Always put the origin after the target
+
+   ```
+       0      1       2     3      4      5       6
+     _________________________________________________
+    |      |             |      |             |      |
+    |  B1  |     C1      |  E1  |     F1      |  A1  |
+    |______|______ ______|______|______ ______|______|
+    |             |      |             |      |      |
+    |     B2      |      |     E2      |      |  A2  |
+    |______ ______|      |______ ______|      |______|
+    |      |      |  D1  |      |      |  G2  |      |
+    |  B3  |  C3  |      |  E3  |  F3  |      |  A3  |
+    |______|______|______|______|______|______|______|
+   ```
+
+   ```javascript
+   dispatch(
+     moveColumn(x, y, options)(state.tr)
+   );
+   ```
+
+
+ * **`addRowAt`**`(rowIndex: number, clonePreviousRow: ?boolean) → fn(tr: Transaction) → Transaction`\
+   Returns a new transaction that adds a new row at index `rowIndex`. Optionally clone the previous row.
+
+   ```javascript
+   dispatch(
+     addRowAt(i)(state.tr)
+   );
+   ```
+
+   ```javascript
+   dispatch(
+     addRowAt(i, true)(state.tr)
+   );
+   ```
+
+
+ * **`cloneRowAt`**`(cloneRowIndex: number) → fn(tr: Transaction) → Transaction`\
+   Returns a new transaction that adds a new row after `cloneRowIndex`, cloning the row attributes at `cloneRowIndex`.
+
+   ```javascript
+   dispatch(
+     cloneRowAt(i)(state.tr)
+   );
+   ```
+
+
+ * **`removeColumnAt`**`(columnIndex: number) → fn(tr: Transaction) → Transaction`\
+   Returns a new transaction that removes a column at index `columnIndex`. If there is only one column left, it will remove the entire table.
+
+   ```javascript
+   dispatch(
+     removeColumnAt(i)(state.tr)
+   );
+   ```
+
+
+ * **`removeRowAt`**`(rowIndex: number) → fn(tr: Transaction) → Transaction`\
+   Returns a new transaction that removes a row at index `rowIndex`. If there is only one row left, it will remove the entire table.
+
+   ```javascript
+   dispatch(
+     removeRowAt(i)(state.tr)
+   );
+   ```
+
+
+ * **`removeTable`**`(tr: Transaction) → Transaction`\
+   Returns a new transaction that removes a table node if the cursor is inside of it.
+
+   ```javascript
+   dispatch(
+     removeTable(state.tr)
+   );
+   ```
+
+
+ * **`removeSelectedColumns`**`(tr: Transaction) → Transaction`\
+   Returns a new transaction that removes selected columns.
+
+   ```javascript
+   dispatch(
+     removeSelectedColumns(state.tr)
+   );
+   ```
+
+
+ * **`removeSelectedRows`**`(tr: Transaction) → Transaction`\
+   Returns a new transaction that removes selected rows.
+
+   ```javascript
+   dispatch(
+     removeSelectedRows(state.tr)
+   );
+   ```
+
+
+ * **`removeColumnClosestToPos`**`($pos: ResolvedPos) → fn(tr: Transaction) → Transaction`\
+   Returns a new transaction that removes a column closest to a given `$pos`.
+
+   ```javascript
+   dispatch(
+     removeColumnClosestToPos(state.doc.resolve(3))(state.tr)
+   );
+   ```
+
+
+ * **`removeRowClosestToPos`**`($pos: ResolvedPos) → fn(tr: Transaction) → Transaction`\
+   Returns a new transaction that removes a row closest to a given `$pos`.
+
+   ```javascript
+   dispatch(
+     removeRowClosestToPos(state.doc.resolve(3))(state.tr)
+   );
+   ```
+
+
+ * **`findCellClosestToPos`**`($pos: ResolvedPos) → ?{pos: number, start: number, node: ProseMirrorNode}`\
+   Iterates over parent nodes, returning a table cell or a table header node closest to a given `$pos`.
+
+   ```javascript
+   const cell = findCellClosestToPos(state.selection.$from);
+   ```
+
+
+ * **`findCellRectClosestToPos`**`($pos: ResolvedPos) → ?{left: number, top: number, right: number, bottom: number}`\
+   Returns the rectangle spanning a cell closest to a given `$pos`.
+
+   ```javascript
+   dispatch(
+     findCellRectClosestToPos(state.selection.$from)
+   );
+   ```
+
+
+ * **`forEachCellInColumn`**`(columnIndex: number, cellTransform: fn(cell: {pos: number, start: number, node: ProseMirrorNode}, tr: Transaction) → Transaction, setCursorToLastCell: ?boolean) → fn(tr: Transaction) → Transaction`\
+   Returns a new transaction that maps a given `cellTransform` function to each cell in a column at a given `columnIndex`.
+   It will set the selection into the last cell of the column if `setCursorToLastCell` param is set to `true`.
+
+   ```javascript
+   dispatch(
+     forEachCellInColumn(0, (cell, tr) => emptyCell(cell, state.schema)(tr))(state.tr)
+   );
+   ```
+
+
+ * **`forEachCellInRow`**`(rowIndex: number, cellTransform: fn(cell: {pos: number, start: number, node: ProseMirrorNode}, tr: Transaction) → Transaction, setCursorToLastCell: ?boolean) → fn(tr: Transaction) → Transaction`\
+   Returns a new transaction that maps a given `cellTransform` function to each cell in a row at a given `rowIndex`.
+   It will set the selection into the last cell of the row if `setCursorToLastCell` param is set to `true`.
+
+   ```javascript
+   dispatch(
+     forEachCellInRow(0, (cell, tr) => setCellAttrs(cell, { background: 'red' })(tr))(state.tr)
+   );
+   ```
+
+
+ * **`setCellAttrs`**`(cell: {pos: number, start: number, node: ProseMirrorNode}, attrs: Object) → fn(tr: Transaction) → Transaction`\
+   Returns a new transaction that sets given `attrs` to a given `cell`.
+
+   ```javascript
+   dispatch(
+     setCellAttrs(findCellClosestToPos($pos), { background: 'blue' })(tr);
+   );
+   ```
+
+
+ * **`createTable`**`(schema: Schema, rowsCount: ?number = 3, colsCount: ?number = 3, withHeaderRow: ?boolean = true, cellContent: ?Node = null) → Node`\
+   Returns a table node of a given size.
+   `withHeaderRow` defines whether the first row of the table will be a header row.
+   `cellContent` defines the content of each cell.
+
+   ```javascript
+   const table = createTable(state.schema); // 3x3 table node
+   dispatch(
+     tr.replaceSelectionWith(table).scrollIntoView()
+   );
+   ```
+
+
+ * **`getSelectionRect`**`(selection: Selection) → ?{left: number, right: number, top: number, bottom: number}`\
+   Get the selection rectangle. Returns `undefined` if selection is not a CellSelection.
+
+   ```javascript
+   const rect = getSelectionRect(selection);
+   ```
+
+
+ * **`getSelectionRangeInColumn`**`(columnIndex: number) → fn(tr: Transaction) → {$anchor: ResolvedPos, $head: ResolvedPos, indexes: [number]}`\
+   Returns a range of rectangular selection spanning all merged cells around a column at index `columnIndex`.
+
+   ```javascript
+   const range = getSelectionRangeInColumn(3)(state.tr);
+   ```
+
+
+ * **`getSelectionRangeInRow`**`(rowIndex: number) → fn(tr: Transaction) → {$anchor: ResolvedPos, $head: ResolvedPos, indexes: [number]}`\
+   Returns a range of rectangular selection spanning all merged cells around a row at index `rowIndex`.
+
+   ```javascript
+   const range = getSelectionRangeInRow(3)(state.tr);
+   ```
+
+
+### Utils for document transformation
+
+ * **`removeParentNodeOfType`**`(nodeType: NodeType | [NodeType]) → fn(tr: Transaction) → Transaction`\
+   Returns a new transaction that removes a node of a given `nodeType`. It will return an original transaction if parent node hasn't been found.
+
+   ```javascript
+   dispatch(
+     removeParentNodeOfType(schema.nodes.table)(tr)
+   );
+   ```
+
+
+ * **`replaceParentNodeOfType`**`(nodeType: NodeType | [NodeType], content: ProseMirrorNode | Fragment) → fn(tr: Transaction) → Transaction`\
+   Returns a new transaction that replaces parent node of a given `nodeType` with the given `content`. It will return an original transaction if either parent node hasn't been found or replacing is not possible.
+
+   ```javascript
+   const node = schema.nodes.paragraph.createChecked({}, schema.text('new'));
+
+   dispatch(
+    replaceParentNodeOfType(schema.nodes.table, node)(tr)
+   );
+   ```
+
+
+ * **`removeSelectedNode`**`(tr: Transaction) → Transaction`\
+   Returns a new transaction that removes selected node. It will return an original transaction if current selection is not a `NodeSelection`.
+
+   ```javascript
+   dispatch(
+     removeSelectedNode(tr)
+   );
+   ```
+
+
+ * **`replaceSelectedNode`**`(content: ProseMirrorNode | ProseMirrorFragment) → fn(tr: Transaction) → Transaction`\
+   Returns a new transaction that replaces selected node with a given `node`, keeping NodeSelection on the new `node`.
+   It will return the original transaction if either current selection is not a NodeSelection or replacing is not possible.
+
+   ```javascript
+   const node = schema.nodes.paragraph.createChecked({}, schema.text('new'));
+   dispatch(
+     replaceSelectedNode(node)(tr)
+   );
+   ```
+
+
+ * **`canInsert`**`($pos: ResolvedPos, content: ProseMirrorNode | Fragment) → boolean`\
+   Checks if a given `content` can be inserted at the given `$pos`
+
+   ```javascript
+   const { selection: { $from } } = state;
+   const node = state.schema.nodes.atom.createChecked();
+   if (canInsert($from, node)) {
+     // ...
+   }
+   ```
+
+
+ * **`safeInsert`**`(content: ProseMirrorNode | Fragment, position: ?number, tryToReplace: ?boolean) → fn(tr: Transaction) → Transaction`\
+   Returns a new transaction that inserts a given `content` at the current cursor position, or at a given `position`, if it is allowed by schema. If schema restricts such nesting, it will try to find an appropriate place for a given node in the document, looping through parent nodes up until the root document node.
+   If `tryToReplace` is true and current selection is a NodeSelection, it will replace selected node with inserted content if its allowed by schema.
+   If cursor is inside of an empty paragraph, it will try to replace that paragraph with the given content. If insertion is successful and inserted node has content, it will set cursor inside of that content.
+   It will return an original transaction if the place for insertion hasn't been found.
+
+   ```javascript
+   const node = schema.nodes.extension.createChecked({});
+   dispatch(
+     safeInsert(node)(tr)
+   );
+   ```
+
+
+ * **`setParentNodeMarkup`**`(nodeType: NodeType | [NodeType], type: ?NodeType | null, attrs: ?Object | null, marks: ?[Mark]) → fn(tr: Transaction) → Transaction`\
+   Returns a transaction that changes the type, attributes, and/or marks of the parent node of a given `nodeType`.
+
+   ```javascript
+   const node = schema.nodes.extension.createChecked({});
+   dispatch(
+     setParentNodeMarkup(schema.nodes.panel, null, { panelType })(tr);
+   );
+   ```
+
+
+ * **`selectParentNodeOfType`**`(nodeType: NodeType | [NodeType]) → fn(tr: Transaction) → Transaction`\
+   Returns a new transaction that sets a `NodeSelection` on a parent node of a `given nodeType`.
+
+   ```javascript
+   dispatch(
+     selectParentNodeOfType([tableCell, tableHeader])(state.tr)
+   );
+   ```
+
+
+ * **`removeNodeBefore`**`(tr: Transaction) → Transaction`\
+   Returns a new transaction that deletes previous node.
+
+   ```javascript
+   dispatch(
+     removeNodeBefore(state.tr)
+   );
+   ```
+
+
+ * **`setTextSelection`**`(position: number, dir: ?number = 1) → fn(tr: Transaction) → Transaction`\
+   Returns a new transaction that tries to find a valid cursor selection starting at the given `position`
+   and searching back if `dir` is negative, and forward if positive.
+   If a valid cursor position hasn't been found, it will return the original transaction.
+
+   ```javascript
+   dispatch(
+     setTextSelection(5)(tr)
+   );
+   ```
+
+
+ * **`convertTableNodeToArrayOfRows`**`(tableNode: Node) → [Node]`\
+   This function will transform the table node
+   into a matrix of rows and columns respecting merged cells,
+   for example this table will be convert to the below:
+
+   ```
+    ____________________________
+   |      |      |             |
+   |  A1  |  B1  |     C1      |
+   |______|______|______ ______|
+   |      |             |      |
+   |  A2  |     B2      |      |
+   |______|______ ______|      |
+   |      |      |      |  D1  |
+   |  A3  |  B3  |  C2  |      |
+   |______|______|______|______|
+   ```
+
+
+   ```javascript
+   array = [
+     [A1, B1, C1, null],
+     [A2, B2, null, D1],
+     [A3. B3, C2, null],
+   ]
+   ```
+
+
+ * **`convertArrayOfRowsToTableNode`**`(tableNode: Node, tableArray: [Node]) → Node`\
+   This function will transform a matrix of nodes
+   into table node respecting merged cells and rows configurations,
+   for example this array will be convert to the table below:
+
+   ```javascript
+   array = [
+     [A1, B1, C1, null],
+     [A2, B2, null, D1],
+     [A3. B3, C2, null],
+   ]
+   ```
+
+   ```
+    ____________________________
+   |      |      |             |
+   |  A1  |  B1  |     C1      |
+   |______|______|______ ______|
+   |      |             |      |
+   |  A2  |     B2      |      |
+   |______|______ ______|      |
+   |      |      |      |  D1  |
+   |  A3  |  B3  |  C2  |      |
+   |______|______|______|______|
+   ```
+
+
+## License
+
+* **Apache 2.0** : http://www.apache.org/licenses/LICENSE-2.0
+
diff --git a/node_modules/prosemirror-utils/dist/index.js b/node_modules/prosemirror-utils/dist/index.js
new file mode 100644
index 00000000..b3dceb1b
--- /dev/null
+++ b/node_modules/prosemirror-utils/dist/index.js
@@ -0,0 +1,2269 @@
+'use strict';
+
+Object.defineProperty(exports, '__esModule', { value: true });
+
+var prosemirrorState = require('prosemirror-state');
+var prosemirrorModel = require('prosemirror-model');
+var prosemirrorTables = require('prosemirror-tables');
+
+// :: (nodeType: union) → (tr: Transaction) → Transaction
+// Returns a new transaction that removes a node of a given `nodeType`. It will return an original transaction if parent node hasn't been found.
+//
+// ```javascript
+// dispatch(
+//   removeParentNodeOfType(schema.nodes.table)(tr)
+// );
+// ```
+var removeParentNodeOfType = function removeParentNodeOfType(nodeType) {
+  return function (tr) {
+    var parent = findParentNodeOfType(nodeType)(tr.selection);
+    if (parent) {
+      return removeNodeAtPos(parent.pos)(tr);
+    }
+    return tr;
+  };
+};
+
+// :: (nodeType: union, content: union) → (tr: Transaction) → Transaction
+// Returns a new transaction that replaces parent node of a given `nodeType` with the given `content`. It will return an original transaction if either parent node hasn't been found or replacing is not possible.
+//
+// ```javascript
+// const node = schema.nodes.paragraph.createChecked({}, schema.text('new'));
+//
+// dispatch(
+//  replaceParentNodeOfType(schema.nodes.table, node)(tr)
+// );
+// ```
+var replaceParentNodeOfType = function replaceParentNodeOfType(nodeType, content) {
+  return function (tr) {
+    if (!Array.isArray(nodeType)) {
+      nodeType = [nodeType];
+    }
+    for (var i = 0, count = nodeType.length; i < count; i++) {
+      var parent = findParentNodeOfType(nodeType[i])(tr.selection);
+      if (parent) {
+        var newTr = replaceNodeAtPos(parent.pos, content)(tr);
+        if (newTr !== tr) {
+          return newTr;
+        }
+      }
+    }
+    return tr;
+  };
+};
+
+// :: (tr: Transaction) → Transaction
+// Returns a new transaction that removes selected node. It will return an original transaction if current selection is not a `NodeSelection`.
+//
+// ```javascript
+// dispatch(
+//   removeSelectedNode(tr)
+// );
+// ```
+var removeSelectedNode = function removeSelectedNode(tr) {
+  if (isNodeSelection(tr.selection)) {
+    var from = tr.selection.$from.pos;
+    var to = tr.selection.$to.pos;
+    return cloneTr(tr.delete(from, to));
+  }
+  return tr;
+};
+
+// :: (content: union) → (tr: Transaction) → Transaction
+// Returns a new transaction that replaces selected node with a given `node`, keeping NodeSelection on the new `node`.
+// It will return the original transaction if either current selection is not a NodeSelection or replacing is not possible.
+//
+// ```javascript
+// const node = schema.nodes.paragraph.createChecked({}, schema.text('new'));
+// dispatch(
+//   replaceSelectedNode(node)(tr)
+// );
+// ```
+var replaceSelectedNode = function replaceSelectedNode(content) {
+  return function (tr) {
+    if (isNodeSelection(tr.selection)) {
+      var _tr$selection = tr.selection,
+          $from = _tr$selection.$from,
+          $to = _tr$selection.$to;
+
+      if (content instanceof prosemirrorModel.Fragment && $from.parent.canReplace($from.index(), $from.indexAfter(), content) || $from.parent.canReplaceWith($from.index(), $from.indexAfter(), content.type)) {
+        return cloneTr(tr.replaceWith($from.pos, $to.pos, content)
+        // restore node selection
+        .setSelection(new prosemirrorState.NodeSelection(tr.doc.resolve($from.pos))));
+      }
+    }
+    return tr;
+  };
+};
+
+// :: (position: number, dir: ?number) → (tr: Transaction) → Transaction
+// Returns a new transaction that tries to find a valid cursor selection starting at the given `position`
+// and searching back if `dir` is negative, and forward if positive.
+// If a valid cursor position hasn't been found, it will return the original transaction.
+//
+// ```javascript
+// dispatch(
+//   setTextSelection(5)(tr)
+// );
+// ```
+var setTextSelection = function setTextSelection(position) {
+  var dir = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
+  return function (tr) {
+    var nextSelection = prosemirrorState.Selection.findFrom(tr.doc.resolve(position), dir, true);
+    if (nextSelection) {
+      return tr.setSelection(nextSelection);
+    }
+    return tr;
+  };
+};
+
+var isSelectableNode = function isSelectableNode(node) {
+  return node.type && node.type.spec.selectable;
+};
+var shouldSelectNode = function shouldSelectNode(node) {
+  return isSelectableNode(node) && node.type.isLeaf;
+};
+
+var setSelection = function setSelection(node, pos, tr) {
+  if (shouldSelectNode(node)) {
+    return tr.setSelection(new prosemirrorState.NodeSelection(tr.doc.resolve(pos)));
+  }
+  return setTextSelection(pos)(tr);
+};
+
+// :: (content: union, position: ?number, tryToReplace?: boolean) → (tr: Transaction) → Transaction
+// Returns a new transaction that inserts a given `content` at the current cursor position, or at a given `position`, if it is allowed by schema. If schema restricts such nesting, it will try to find an appropriate place for a given node in the document, looping through parent nodes up until the root document node.
+// If `tryToReplace` is true and current selection is a NodeSelection, it will replace selected node with inserted content if its allowed by schema.
+// If cursor is inside of an empty paragraph, it will try to replace that paragraph with the given content. If insertion is successful and inserted node has content, it will set cursor inside of that content.
+// It will return an original transaction if the place for insertion hasn't been found.
+//
+// ```javascript
+// const node = schema.nodes.extension.createChecked({});
+// dispatch(
+//   safeInsert(node)(tr)
+// );
+// ```
+var safeInsert = function safeInsert(content, position, tryToReplace) {
+  return function (tr) {
+    var hasPosition = typeof position === 'number';
+    var $from = tr.selection.$from;
+
+    var $insertPos = hasPosition ? tr.doc.resolve(position) : isNodeSelection(tr.selection) ? tr.doc.resolve($from.pos + 1) : $from;
+    var parent = $insertPos.parent;
+
+    // try to replace selected node
+
+    if (isNodeSelection(tr.selection) && tryToReplace) {
+      var oldTr = tr;
+      tr = replaceSelectedNode(content)(tr);
+      if (oldTr !== tr) {
+        return tr;
+      }
+    }
+
+    // try to replace an empty paragraph
+    if (isEmptyParagraph(parent)) {
+      var _oldTr = tr;
+      tr = replaceParentNodeOfType(parent.type, content)(tr);
+      if (_oldTr !== tr) {
+        var pos = isSelectableNode(content) ? // for selectable node, selection position would be the position of the replaced parent
+        $insertPos.before($insertPos.depth) : $insertPos.pos;
+        return setSelection(content, pos, tr);
+      }
+    }
+
+    // given node is allowed at the current cursor position
+    if (canInsert($insertPos, content)) {
+      tr.insert($insertPos.pos, content);
+      var _pos = hasPosition ? $insertPos.pos : isSelectableNode(content) ? // for atom nodes selection position after insertion is the previous pos
+      tr.selection.$anchor.pos - 1 : tr.selection.$anchor.pos;
+      return cloneTr(setSelection(content, _pos, tr));
+    }
+
+    // looking for a place in the doc where the node is allowed
+    for (var i = $insertPos.depth; i > 0; i--) {
+      var _pos2 = $insertPos.after(i);
+      var $pos = tr.doc.resolve(_pos2);
+      if (canInsert($pos, content)) {
+        tr.insert(_pos2, content);
+        return cloneTr(setSelection(content, _pos2, tr));
+      }
+    }
+    return tr;
+  };
+};
+
+// :: (nodeType: union, type: ?union, attrs: ?union, marks?: [Mark]) → (tr: Transaction) → Transaction
+// Returns a transaction that changes the type, attributes, and/or marks of the parent node of a given `nodeType`.
+//
+// ```javascript
+// const node = schema.nodes.extension.createChecked({});
+// dispatch(
+//   setParentNodeMarkup(schema.nodes.panel, null, { panelType })(tr);
+// );
+// ```
+var setParentNodeMarkup = function setParentNodeMarkup(nodeType, type, attrs, marks) {
+  return function (tr) {
+    var parent = findParentNodeOfType(nodeType)(tr.selection);
+    if (parent) {
+      return cloneTr(tr.setNodeMarkup(parent.pos, type, Object.assign({}, parent.node.attrs, attrs), marks));
+    }
+    return tr;
+  };
+};
+
+// :: (nodeType: union) → (tr: Transaction) → Transaction
+// Returns a new transaction that sets a `NodeSelection` on a parent node of a `given nodeType`.
+//
+// ```javascript
+// dispatch(
+//   selectParentNodeOfType([tableCell, tableHeader])(state.tr)
+// );
+// ```
+var selectParentNodeOfType = function selectParentNodeOfType(nodeType) {
+  return function (tr) {
+    if (!isNodeSelection(tr.selection)) {
+      var parent = findParentNodeOfType(nodeType)(tr.selection);
+      if (parent) {
+        return cloneTr(tr.setSelection(prosemirrorState.NodeSelection.create(tr.doc, parent.pos)));
+      }
+    }
+    return tr;
+  };
+};
+
+// :: (tr: Transaction) → Transaction
+// Returns a new transaction that deletes previous node.
+//
+// ```javascript
+// dispatch(
+//   removeNodeBefore(state.tr)
+// );
+// ```
+var removeNodeBefore = function removeNodeBefore(tr) {
+  var position = findPositionOfNodeBefore(tr.selection);
+  if (typeof position === 'number') {
+    return removeNodeAtPos(position)(tr);
+  }
+  return tr;
+};
+
+// :: (selection: Selection) → boolean
+// Checks if current selection is a `NodeSelection`.
+//
+// ```javascript
+// if (isNodeSelection(tr.selection)) {
+//   // ...
+// }
+// ```
+var isNodeSelection = function isNodeSelection(selection) {
+  return selection instanceof prosemirrorState.NodeSelection;
+};
+
+// (nodeType: union) → boolean
+// Checks if the type a given `node` equals to a given `nodeType`.
+var equalNodeType = function equalNodeType(nodeType, node) {
+  return Array.isArray(nodeType) && nodeType.indexOf(node.type) > -1 || node.type === nodeType;
+};
+
+// (tr: Transaction) → Transaction
+// Creates a new transaction object from a given transaction
+var cloneTr = function cloneTr(tr) {
+  return Object.assign(Object.create(tr), tr).setTime(Date.now());
+};
+
+// (position: number, content: union) → (tr: Transaction) → Transaction
+// Returns a `replace` transaction that replaces a node at a given position with the given `content`.
+// It will return the original transaction if replacing is not possible.
+// `position` should point at the position immediately before the node.
+var replaceNodeAtPos = function replaceNodeAtPos(position, content) {
+  return function (tr) {
+    var node = tr.doc.nodeAt(position);
+    var $pos = tr.doc.resolve(position);
+    if (canReplace($pos, content)) {
+      tr = tr.replaceWith(position, position + node.nodeSize, content);
+      var start = tr.selection.$from.pos - 1;
+      // put cursor inside of the inserted node
+      tr = setTextSelection(Math.max(start, 0), -1)(tr);
+      // move cursor to the start of the node
+      tr = setTextSelection(tr.selection.$from.start())(tr);
+      return cloneTr(tr);
+    }
+    return tr;
+  };
+};
+
+// ($pos: ResolvedPos, doc: ProseMirrorNode, content: union, ) → boolean
+// Checks if replacing a node at a given `$pos` inside of the `doc` node with the given `content` is possible.
+var canReplace = function canReplace($pos, content) {
+  var node = $pos.node($pos.depth);
+  return node && node.type.validContent(content instanceof prosemirrorModel.Fragment ? content : prosemirrorModel.Fragment.from(content));
+};
+
+// (position: number) → (tr: Transaction) → Transaction
+// Returns a `delete` transaction that removes a node at a given position with the given `node`.
+// `position` should point at the position immediately before the node.
+var removeNodeAtPos = function removeNodeAtPos(position) {
+  return function (tr) {
+    var node = tr.doc.nodeAt(position);
+    return cloneTr(tr.delete(position, position + node.nodeSize));
+  };
+};
+
+// (schema: Schema) → {[key: string]: NodeType}
+// Returns a map where keys are tableRoles and values are NodeTypes.
+var tableNodeTypes = function tableNodeTypes(schema) {
+  if (schema.cached.tableNodeTypes) {
+    return schema.cached.tableNodeTypes;
+  }
+  var roles = {};
+  Object.keys(schema.nodes).forEach(function (type) {
+    var nodeType = schema.nodes[type];
+    if (nodeType.spec.tableRole) {
+      roles[nodeType.spec.tableRole] = nodeType;
+    }
+  });
+  schema.cached.tableNodeTypes = roles;
+  return roles;
+};
+
+// :: ($pos: ResolvedPos, content: union) → boolean
+// Checks if a given `content` can be inserted at the given `$pos`
+//
+// ```javascript
+// const { selection: { $from } } = state;
+// const node = state.schema.nodes.atom.createChecked();
+// if (canInsert($from, node)) {
+//   // ...
+// }
+// ```
+var canInsert = function canInsert($pos, content) {
+  var index = $pos.index();
+
+  if (content instanceof prosemirrorModel.Fragment) {
+    return $pos.parent.canReplace(index, index, content);
+  } else if (content instanceof prosemirrorModel.Node) {
+    return $pos.parent.canReplaceWith(index, index, content.type);
+  }
+  return false;
+};
+
+// (node: ProseMirrorNode) → boolean
+// Checks if a given `node` is an empty paragraph
+var isEmptyParagraph = function isEmptyParagraph(node) {
+  return !node || node.type.name === 'paragraph' && node.nodeSize === 2;
+};
+
+// ($pos: ResolvedPos) → ?{pos: number, start: number, node: ProseMirrorNode}
+// Iterates over parent nodes, returning a table node closest to a given `$pos`.
+//
+// ```javascript
+// const table = findTableClosestToPos(state.doc.resolve(10));
+// ```
+var findTableClosestToPos = function findTableClosestToPos($pos) {
+  var predicate = function predicate(node) {
+    return node.type.spec.tableRole && /table/i.test(node.type.spec.tableRole);
+  };
+  return findParentNodeClosestToPos($pos, predicate);
+};
+
+var createCell = function createCell(cellType) {
+  var cellContent = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
+
+  if (cellContent) {
+    return cellType.createChecked(null, cellContent);
+  }
+
+  return cellType.createAndFill();
+};
+
+// (rect: {left: number, right: number, top: number, bottom: number}) → (selection: Selection) → boolean
+// Checks if a given CellSelection rect is selected
+var isRectSelected = function isRectSelected(rect) {
+  return function (selection) {
+    var map = prosemirrorTables.TableMap.get(selection.$anchorCell.node(-1));
+    var start = selection.$anchorCell.start(-1);
+    var cells = map.cellsInRect(rect);
+    var selectedCells = map.cellsInRect(map.rectBetween(selection.$anchorCell.pos - start, selection.$headCell.pos - start));
+
+    for (var i = 0, count = cells.length; i < count; i++) {
+      if (selectedCells.indexOf(cells[i]) === -1) {
+        return false;
+      }
+    }
+
+    return true;
+  };
+};
+
+// This function transposes an array of array flipping the columns for rows,
+// transposition is a familiar algebra concept;
+// you can get more details here:
+// https://en.wikipedia.org/wiki/Transpose
+//
+// ```javascript
+//
+//  const arr = [
+//    ['a1', 'a2', 'a3'],
+//    ['b1', 'b2', 'b3'],
+//    ['c1', 'c2', 'c3'],
+//    ['d1', 'd2', 'd3'],
+//  ];
+//
+//  const result = transpose(arr);
+//
+//  result === [
+//    ['a1', 'b1', 'c1', 'd1'],
+//    ['a2', 'b2', 'c2', 'd2'],
+//    ['a3', 'b3', 'c3', 'd3'],
+//  ]
+// ```
+var transpose = function transpose(array) {
+  return array[0].map(function (_, i) {
+    return array.map(function (column) {
+      return column[i];
+    });
+  });
+};
+
+// :: (tableNode: Node) -> Array
+// This function will transform the table node
+// into a matrix of rows and columns respecting merged cells,
+// for example this table will be convert to the below:
+//
+// ```
+//  ____________________________
+// |      |      |             |
+// |  A1  |  B1  |     C1      |
+// |______|______|______ ______|
+// |      |             |      |
+// |  A2  |     B2      |      |
+// |______|______ ______|      |
+// |      |      |      |  D1  |
+// |  A3  |  B3  |  C2  |      |
+// |______|______|______|______|
+// ```
+//
+//
+// ```javascript
+// array = [
+//   [A1, B1, C1, null],
+//   [A2, B2, null, D1],
+//   [A3. B3, C2, null],
+// ]
+// ```
+var convertTableNodeToArrayOfRows = function convertTableNodeToArrayOfRows(tableNode) {
+  var map = prosemirrorTables.TableMap.get(tableNode);
+  var rows = [];
+  for (var rowIndex = 0; rowIndex < map.height; rowIndex++) {
+    var rowCells = [];
+    var seen = {};
+
+    for (var colIndex = 0; colIndex < map.width; colIndex++) {
+      var cellPos = map.map[rowIndex * map.width + colIndex];
+      var cell = tableNode.nodeAt(cellPos);
+      var rect = map.findCell(cellPos);
+      if (seen[cellPos] || rect.top !== rowIndex) {
+        rowCells.push(null);
+        continue;
+      }
+      seen[cellPos] = true;
+
+      rowCells.push(cell);
+    }
+
+    rows.push(rowCells);
+  }
+
+  return rows;
+};
+
+// :: (tableNode: Node, tableArray: Array) -> Node
+// This function will transform a matrix of nodes
+// into table node respecting merged cells and rows configurations,
+// for example this array will be convert to the table below:
+//
+// ```javascript
+// array = [
+//   [A1, B1, C1, null],
+//   [A2, B2, null, D1],
+//   [A3. B3, C2, null],
+// ]
+// ```
+//
+// ```
+//  ____________________________
+// |      |      |             |
+// |  A1  |  B1  |     C1      |
+// |______|______|______ ______|
+// |      |             |      |
+// |  A2  |     B2      |      |
+// |______|______ ______|      |
+// |      |      |      |  D1  |
+// |  A3  |  B3  |  C2  |      |
+// |______|______|______|______|
+// ```
+//
+var convertArrayOfRowsToTableNode = function convertArrayOfRowsToTableNode(tableNode, arrayOfNodes) {
+  var rowsPM = [];
+  var map = prosemirrorTables.TableMap.get(tableNode);
+  for (var rowIndex = 0; rowIndex < map.height; rowIndex++) {
+    var row = tableNode.child(rowIndex);
+    var rowCells = [];
+
+    for (var colIndex = 0; colIndex < map.width; colIndex++) {
+      if (!arrayOfNodes[rowIndex][colIndex]) {
+        continue;
+      }
+      var cellPos = map.map[rowIndex * map.width + colIndex];
+
+      var cell = arrayOfNodes[rowIndex][colIndex];
+      var oldCell = tableNode.nodeAt(cellPos);
+      var newCell = oldCell.type.createChecked(Object.assign({}, cell.attrs), cell.content, cell.marks);
+      rowCells.push(newCell);
+    }
+
+    rowsPM.push(row.type.createChecked(row.attrs, rowCells, row.marks));
+  }
+
+  var newTable = tableNode.type.createChecked(tableNode.attrs, rowsPM, tableNode.marks);
+
+  return newTable;
+};
+
+var moveTableColumn = function moveTableColumn(table, indexesOrigin, indexesTarget, direction) {
+  var rows = transpose(convertTableNodeToArrayOfRows(table.node));
+
+  rows = moveRowInArrayOfRows(rows, indexesOrigin, indexesTarget, direction);
+  rows = transpose(rows);
+
+  return convertArrayOfRowsToTableNode(table.node, rows);
+};
+
+var moveTableRow = function moveTableRow(table, indexesOrigin, indexesTarget, direction) {
+  var rows = convertTableNodeToArrayOfRows(table.node);
+
+  rows = moveRowInArrayOfRows(rows, indexesOrigin, indexesTarget, direction);
+
+  return convertArrayOfRowsToTableNode(table.node, rows);
+};
+
+var moveRowInArrayOfRows = function moveRowInArrayOfRows(rows, indexesOrigin, indexesTarget, directionOverride) {
+  var direction = indexesOrigin[0] > indexesTarget[0] ? -1 : 1;
+
+  var rowsExtracted = rows.splice(indexesOrigin[0], indexesOrigin.length);
+  var positionOffset = rowsExtracted.length % 2 === 0 ? 1 : 0;
+  var target = void 0;
+
+  if (directionOverride === -1 && direction === 1) {
+    target = indexesTarget[0] - 1;
+  } else if (directionOverride === 1 && direction === -1) {
+    target = indexesTarget[indexesTarget.length - 1] - positionOffset + 1;
+  } else {
+    target = direction === -1 ? indexesTarget[0] : indexesTarget[indexesTarget.length - 1] - positionOffset;
+  }
+
+  rows.splice.apply(rows, [target, 0].concat(rowsExtracted));
+  return rows;
+};
+
+var checkInvalidMovements = function checkInvalidMovements(originIndex, targetIndex, targets, type) {
+  var direction = originIndex > targetIndex ? -1 : 1;
+  var errorMessage = 'Target position is invalid, you can\'t move the ' + type + ' ' + originIndex + ' to ' + targetIndex + ', the target can\'t be split. You could use tryToFit option.';
+
+  if (direction === 1) {
+    if (targets.slice(0, targets.length - 1).indexOf(targetIndex) !== -1) {
+      throw new Error(errorMessage);
+    }
+  } else {
+    if (targets.slice(1).indexOf(targetIndex) !== -1) {
+      throw new Error(errorMessage);
+    }
+  }
+
+  return true;
+};
+
+// :: (predicate: (node: ProseMirrorNode) → boolean) → (selection: Selection) → ?{pos: number, start: number, depth: number, node: ProseMirrorNode}
+// Iterates over parent nodes, returning the closest node and its start position `predicate` returns truthy for. `start` points to the start position of the node, `pos` points directly before the node.
+//
+// ```javascript
+// const predicate = node => node.type === schema.nodes.blockquote;
+// const parent = findParentNode(predicate)(selection);
+// ```
+var findParentNode = function findParentNode(predicate) {
+  return function (_ref) {
+    var $from = _ref.$from;
+    return findParentNodeClosestToPos($from, predicate);
+  };
+};
+
+// :: ($pos: ResolvedPos, predicate: (node: ProseMirrorNode) → boolean) → ?{pos: number, start: number, depth: number, node: ProseMirrorNode}
+// Iterates over parent nodes starting from the given `$pos`, returning the closest node and its start position `predicate` returns truthy for. `start` points to the start position of the node, `pos` points directly before the node.
+//
+// ```javascript
+// const predicate = node => node.type === schema.nodes.blockquote;
+// const parent = findParentNodeClosestToPos(state.doc.resolve(5), predicate);
+// ```
+var findParentNodeClosestToPos = function findParentNodeClosestToPos($pos, predicate) {
+  for (var i = $pos.depth; i > 0; i--) {
+    var node = $pos.node(i);
+    if (predicate(node)) {
+      return {
+        pos: i > 0 ? $pos.before(i) : 0,
+        start: $pos.start(i),
+        depth: i,
+        node: node
+      };
+    }
+  }
+};
+
+// :: (predicate: (node: ProseMirrorNode) → boolean, domAtPos: (pos: number) → {node: dom.Node, offset: number}) → (selection: Selection) → ?dom.Node
+// Iterates over parent nodes, returning DOM reference of the closest node `predicate` returns truthy for.
+//
+// ```javascript
+// const domAtPos = view.domAtPos.bind(view);
+// const predicate = node => node.type === schema.nodes.table;
+// const parent = findParentDomRef(predicate, domAtPos)(selection); // 
+// ``` +var findParentDomRef = function findParentDomRef(predicate, domAtPos) { + return function (selection) { + var parent = findParentNode(predicate)(selection); + if (parent) { + return findDomRefAtPos(parent.pos, domAtPos); + } + }; +}; + +// :: (predicate: (node: ProseMirrorNode) → boolean) → (selection: Selection) → boolean +// Checks if there's a parent node `predicate` returns truthy for. +// +// ```javascript +// if (hasParentNode(node => node.type === schema.nodes.table)(selection)) { +// // .... +// } +// ``` +var hasParentNode = function hasParentNode(predicate) { + return function (selection) { + return !!findParentNode(predicate)(selection); + }; +}; + +// :: (nodeType: union) → (selection: Selection) → ?{pos: number, start: number, depth: number, node: ProseMirrorNode} +// Iterates over parent nodes, returning closest node of a given `nodeType`. `start` points to the start position of the node, `pos` points directly before the node. +// +// ```javascript +// const parent = findParentNodeOfType(schema.nodes.paragraph)(selection); +// ``` +var findParentNodeOfType = function findParentNodeOfType(nodeType) { + return function (selection) { + return findParentNode(function (node) { + return equalNodeType(nodeType, node); + })(selection); + }; +}; + +// :: ($pos: ResolvedPos, nodeType: union) → ?{pos: number, start: number, depth: number, node: ProseMirrorNode} +// Iterates over parent nodes starting from the given `$pos`, returning closest node of a given `nodeType`. `start` points to the start position of the node, `pos` points directly before the node. +// +// ```javascript +// const parent = findParentNodeOfTypeClosestToPos(state.doc.resolve(10), schema.nodes.paragraph); +// ``` +var findParentNodeOfTypeClosestToPos = function findParentNodeOfTypeClosestToPos($pos, nodeType) { + return findParentNodeClosestToPos($pos, function (node) { + return equalNodeType(nodeType, node); + }); +}; + +// :: (nodeType: union) → (selection: Selection) → boolean +// Checks if there's a parent node of a given `nodeType`. +// +// ```javascript +// if (hasParentNodeOfType(schema.nodes.table)(selection)) { +// // .... +// } +// ``` +var hasParentNodeOfType = function hasParentNodeOfType(nodeType) { + return function (selection) { + return hasParentNode(function (node) { + return equalNodeType(nodeType, node); + })(selection); + }; +}; + +// :: (nodeType: union, domAtPos: (pos: number) → {node: dom.Node, offset: number}) → (selection: Selection) → ?dom.Node +// Iterates over parent nodes, returning DOM reference of the closest node of a given `nodeType`. +// +// ```javascript +// const domAtPos = view.domAtPos.bind(view); +// const parent = findParentDomRefOfType(schema.nodes.codeBlock, domAtPos)(selection); //
+// ```
+var findParentDomRefOfType = function findParentDomRefOfType(nodeType, domAtPos) {
+  return function (selection) {
+    return findParentDomRef(function (node) {
+      return equalNodeType(nodeType, node);
+    }, domAtPos)(selection);
+  };
+};
+
+// :: (nodeType: union) → (selection: Selection) → ?{pos: number, start: number, depth: number, node: ProseMirrorNode}
+// Returns a node of a given `nodeType` if it is selected. `start` points to the start position of the node, `pos` points directly before the node.
+//
+// ```javascript
+// const { extension, inlineExtension, bodiedExtension } = schema.nodes;
+// const selectedNode = findSelectedNodeOfType([
+//   extension,
+//   inlineExtension,
+//   bodiedExtension,
+// ])(selection);
+// ```
+var findSelectedNodeOfType = function findSelectedNodeOfType(nodeType) {
+  return function (selection) {
+    if (isNodeSelection(selection)) {
+      var node = selection.node,
+          $from = selection.$from;
+
+      if (equalNodeType(nodeType, node)) {
+        return { node: node, pos: $from.pos, depth: $from.depth };
+      }
+    }
+  };
+};
+
+// :: (selection: Selection) → ?number
+// Returns position of the previous node.
+//
+// ```javascript
+// const pos = findPositionOfNodeBefore(tr.selection);
+// ```
+var findPositionOfNodeBefore = function findPositionOfNodeBefore(selection) {
+  var nodeBefore = selection.$from.nodeBefore;
+
+  var maybeSelection = prosemirrorState.Selection.findFrom(selection.$from, -1);
+  if (maybeSelection && nodeBefore) {
+    // leaf node
+    var parent = findParentNodeOfType(nodeBefore.type)(maybeSelection);
+    if (parent) {
+      return parent.pos;
+    }
+    return maybeSelection.$from.pos;
+  }
+};
+
+// :: (position: number, domAtPos: (pos: number) → {node: dom.Node, offset: number}) → dom.Node
+// Returns DOM reference of a node at a given `position`. If the node type is of type `TEXT_NODE` it will return the reference of the parent node.
+//
+// ```javascript
+// const domAtPos = view.domAtPos.bind(view);
+// const ref = findDomRefAtPos($from.pos, domAtPos);
+// ```
+var findDomRefAtPos = function findDomRefAtPos(position, domAtPos) {
+  var dom = domAtPos(position);
+  var node = dom.node.childNodes[dom.offset];
+
+  if (dom.node.nodeType === Node.TEXT_NODE) {
+    return dom.node.parentNode;
+  }
+
+  if (!node || node.nodeType === Node.TEXT_NODE) {
+    return dom.node;
+  }
+
+  return node;
+};
+
+// :: (node: ProseMirrorNode, descend: ?boolean) → [{ node: ProseMirrorNode, pos: number }]
+// Flattens descendants of a given `node`. It doesn't descend into a node when descend argument is `false` (defaults to `true`).
+//
+// ```javascript
+// const children = flatten(node);
+// ```
+var flatten = function flatten(node) {
+  var descend = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
+
+  if (!node) {
+    throw new Error('Invalid "node" parameter');
+  }
+  var result = [];
+  node.descendants(function (child, pos) {
+    result.push({ node: child, pos: pos });
+    if (!descend) {
+      return false;
+    }
+  });
+  return result;
+};
+
+// :: (node: ProseMirrorNode, predicate: (node: ProseMirrorNode) → boolean, descend: ?boolean) → [{ node: ProseMirrorNode, pos: number }]
+// Iterates over descendants of a given `node`, returning child nodes predicate returns truthy for. It doesn't descend into a node when descend argument is `false` (defaults to `true`).
+//
+// ```javascript
+// const textNodes = findChildren(node, child => child.isText, false);
+// ```
+var findChildren = function findChildren(node, predicate, descend) {
+  if (!node) {
+    throw new Error('Invalid "node" parameter');
+  } else if (!predicate) {
+    throw new Error('Invalid "predicate" parameter');
+  }
+  return flatten(node, descend).filter(function (child) {
+    return predicate(child.node);
+  });
+};
+
+// :: (node: ProseMirrorNode, descend: ?boolean) → [{ node: ProseMirrorNode, pos: number }]
+// Returns text nodes of a given `node`. It doesn't descend into a node when descend argument is `false` (defaults to `true`).
+//
+// ```javascript
+// const textNodes = findTextNodes(node);
+// ```
+var findTextNodes = function findTextNodes(node, descend) {
+  return findChildren(node, function (child) {
+    return child.isText;
+  }, descend);
+};
+
+// :: (node: ProseMirrorNode, descend: ?boolean) → [{ node: ProseMirrorNode, pos: number }]
+// Returns inline nodes of a given `node`. It doesn't descend into a node when descend argument is `false` (defaults to `true`).
+//
+// ```javascript
+// const inlineNodes = findInlineNodes(node);
+// ```
+var findInlineNodes = function findInlineNodes(node, descend) {
+  return findChildren(node, function (child) {
+    return child.isInline;
+  }, descend);
+};
+
+// :: (node: ProseMirrorNode, descend: ?boolean) → [{ node: ProseMirrorNode, pos: number }]
+// Returns block descendants of a given `node`. It doesn't descend into a node when descend argument is `false` (defaults to `true`).
+//
+// ```javascript
+// const blockNodes = findBlockNodes(node);
+// ```
+var findBlockNodes = function findBlockNodes(node, descend) {
+  return findChildren(node, function (child) {
+    return child.isBlock;
+  }, descend);
+};
+
+// :: (node: ProseMirrorNode, predicate: (attrs: ?Object) → boolean, descend: ?boolean) → [{ node: ProseMirrorNode, pos: number }]
+// Iterates over descendants of a given `node`, returning child nodes predicate returns truthy for. It doesn't descend into a node when descend argument is `false` (defaults to `true`).
+//
+// ```javascript
+// const mergedCells = findChildrenByAttr(table, attrs => attrs.colspan === 2);
+// ```
+var findChildrenByAttr = function findChildrenByAttr(node, predicate, descend) {
+  return findChildren(node, function (child) {
+    return !!predicate(child.attrs);
+  }, descend);
+};
+
+// :: (node: ProseMirrorNode, nodeType: NodeType, descend: ?boolean) → [{ node: ProseMirrorNode, pos: number }]
+// Iterates over descendants of a given `node`, returning child nodes of a given nodeType. It doesn't descend into a node when descend argument is `false` (defaults to `true`).
+//
+// ```javascript
+// const cells = findChildrenByType(table, schema.nodes.tableCell);
+// ```
+var findChildrenByType = function findChildrenByType(node, nodeType, descend) {
+  return findChildren(node, function (child) {
+    return child.type === nodeType;
+  }, descend);
+};
+
+// :: (node: ProseMirrorNode, markType: markType, descend: ?boolean) → [{ node: ProseMirrorNode, pos: number }]
+// Iterates over descendants of a given `node`, returning child nodes that have a mark of a given markType. It doesn't descend into a `node` when descend argument is `false` (defaults to `true`).
+//
+// ```javascript
+// const nodes = findChildrenByMark(state.doc, schema.marks.strong);
+// ```
+var findChildrenByMark = function findChildrenByMark(node, markType, descend) {
+  return findChildren(node, function (child) {
+    return markType.isInSet(child.marks);
+  }, descend);
+};
+
+// :: (node: ProseMirrorNode, nodeType: NodeType) → boolean
+// Returns `true` if a given node contains nodes of a given `nodeType`
+//
+// ```javascript
+// if (contains(panel, schema.nodes.listItem)) {
+//   // ...
+// }
+// ```
+var contains = function contains(node, nodeType) {
+  return !!findChildrenByType(node, nodeType).length;
+};
+
+function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
+
+// :: (selection: Selection) → ?{pos: number, start: number, node: ProseMirrorNode}
+// Iterates over parent nodes, returning the closest table node.
+//
+// ```javascript
+// const table = findTable(selection);
+// ```
+var findTable = function findTable(selection) {
+  return findParentNode(function (node) {
+    return node.type.spec.tableRole && node.type.spec.tableRole === 'table';
+  })(selection);
+};
+
+// :: (selection: Selection) → boolean
+// Checks if current selection is a `CellSelection`.
+//
+// ```javascript
+// if (isCellSelection(selection)) {
+//   // ...
+// }
+// ```
+var isCellSelection = function isCellSelection(selection) {
+  return selection instanceof prosemirrorTables.CellSelection;
+};
+
+// :: (selection: Selection) → ?{left: number, right: number, top: number, bottom: number}
+// Get the selection rectangle. Returns `undefined` if selection is not a CellSelection.
+//
+// ```javascript
+// const rect = getSelectionRect(selection);
+// ```
+var getSelectionRect = function getSelectionRect(selection) {
+  if (!isCellSelection(selection)) {
+    return;
+  }
+  var start = selection.$anchorCell.start(-1);
+  var map = prosemirrorTables.TableMap.get(selection.$anchorCell.node(-1));
+  return map.rectBetween(selection.$anchorCell.pos - start, selection.$headCell.pos - start);
+};
+
+// :: (columnIndex: number) → (selection: Selection) → boolean
+// Checks if entire column at index `columnIndex` is selected.
+//
+// ```javascript
+// const className = isColumnSelected(i)(selection) ? 'selected' : '';
+// ```
+var isColumnSelected = function isColumnSelected(columnIndex) {
+  return function (selection) {
+    if (isCellSelection(selection)) {
+      var map = prosemirrorTables.TableMap.get(selection.$anchorCell.node(-1));
+      return isRectSelected({
+        left: columnIndex,
+        right: columnIndex + 1,
+        top: 0,
+        bottom: map.height
+      })(selection);
+    }
+
+    return false;
+  };
+};
+
+// :: (rowIndex: number) → (selection: Selection) → boolean
+// Checks if entire row at index `rowIndex` is selected.
+//
+// ```javascript
+// const className = isRowSelected(i)(selection) ? 'selected' : '';
+// ```
+var isRowSelected = function isRowSelected(rowIndex) {
+  return function (selection) {
+    if (isCellSelection(selection)) {
+      var map = prosemirrorTables.TableMap.get(selection.$anchorCell.node(-1));
+      return isRectSelected({
+        left: 0,
+        right: map.width,
+        top: rowIndex,
+        bottom: rowIndex + 1
+      })(selection);
+    }
+
+    return false;
+  };
+};
+
+// :: (selection: Selection) → boolean
+// Checks if entire table is selected
+//
+// ```javascript
+// const className = isTableSelected(selection) ? 'selected' : '';
+// ```
+var isTableSelected = function isTableSelected(selection) {
+  if (isCellSelection(selection)) {
+    var map = prosemirrorTables.TableMap.get(selection.$anchorCell.node(-1));
+    return isRectSelected({
+      left: 0,
+      right: map.width,
+      top: 0,
+      bottom: map.height
+    })(selection);
+  }
+
+  return false;
+};
+
+// :: (columnIndex: union) → (selection: Selection) → ?[{pos: number, start: number, node: ProseMirrorNode}]
+// Returns an array of cells in a column(s), where `columnIndex` could be a column index or an array of column indexes.
+//
+// ```javascript
+// const cells = getCellsInColumn(i)(selection); // [{node, pos}, {node, pos}]
+// ```
+var getCellsInColumn = function getCellsInColumn(columnIndex) {
+  return function (selection) {
+    var table = findTable(selection);
+    if (table) {
+      var map = prosemirrorTables.TableMap.get(table.node);
+      var indexes = Array.isArray(columnIndex) ? columnIndex : Array.from([columnIndex]);
+      return indexes.reduce(function (acc, index) {
+        if (index >= 0 && index <= map.width - 1) {
+          var cells = map.cellsInRect({
+            left: index,
+            right: index + 1,
+            top: 0,
+            bottom: map.height
+          });
+          return acc.concat(cells.map(function (nodePos) {
+            var node = table.node.nodeAt(nodePos);
+            var pos = nodePos + table.start;
+            return { pos: pos, start: pos + 1, node: node };
+          }));
+        }
+      }, []);
+    }
+  };
+};
+
+// :: (rowIndex: union) → (selection: Selection) → ?[{pos: number, start: number, node: ProseMirrorNode}]
+// Returns an array of cells in a row(s), where `rowIndex` could be a row index or an array of row indexes.
+//
+// ```javascript
+// const cells = getCellsInRow(i)(selection); // [{node, pos}, {node, pos}]
+// ```
+var getCellsInRow = function getCellsInRow(rowIndex) {
+  return function (selection) {
+    var table = findTable(selection);
+    if (table) {
+      var map = prosemirrorTables.TableMap.get(table.node);
+      var indexes = Array.isArray(rowIndex) ? rowIndex : Array.from([rowIndex]);
+      return indexes.reduce(function (acc, index) {
+        if (index >= 0 && index <= map.height - 1) {
+          var cells = map.cellsInRect({
+            left: 0,
+            right: map.width,
+            top: index,
+            bottom: index + 1
+          });
+          return acc.concat(cells.map(function (nodePos) {
+            var node = table.node.nodeAt(nodePos);
+            var pos = nodePos + table.start;
+            return { pos: pos, start: pos + 1, node: node };
+          }));
+        }
+      }, []);
+    }
+  };
+};
+
+// :: (selection: Selection) → ?[{pos: number, start: number, node: ProseMirrorNode}]
+// Returns an array of all cells in a table.
+//
+// ```javascript
+// const cells = getCellsInTable(selection); // [{node, pos}, {node, pos}]
+// ```
+var getCellsInTable = function getCellsInTable(selection) {
+  var table = findTable(selection);
+  if (table) {
+    var map = prosemirrorTables.TableMap.get(table.node);
+    var cells = map.cellsInRect({
+      left: 0,
+      right: map.width,
+      top: 0,
+      bottom: map.height
+    });
+    return cells.map(function (nodePos) {
+      var node = table.node.nodeAt(nodePos);
+      var pos = nodePos + table.start;
+      return { pos: pos, start: pos + 1, node: node };
+    });
+  }
+};
+
+var select = function select(type) {
+  return function (index, expand) {
+    return function (tr) {
+      var table = findTable(tr.selection);
+      var isRowSelection = type === 'row';
+      if (table) {
+        var map = prosemirrorTables.TableMap.get(table.node);
+
+        // Check if the index is valid
+        if (index >= 0 && index < (isRowSelection ? map.height : map.width)) {
+          var left = isRowSelection ? 0 : index;
+          var top = isRowSelection ? index : 0;
+          var right = isRowSelection ? map.width : index + 1;
+          var bottom = isRowSelection ? index + 1 : map.height;
+
+          if (expand) {
+            var cell = findCellClosestToPos(tr.selection.$from);
+            if (!cell) {
+              return tr;
+            }
+
+            var selRect = map.findCell(cell.pos - table.start);
+            if (isRowSelection) {
+              top = Math.min(top, selRect.top);
+              bottom = Math.max(bottom, selRect.bottom);
+            } else {
+              left = Math.min(left, selRect.left);
+              right = Math.max(right, selRect.right);
+            }
+          }
+
+          var cellsInFirstRow = map.cellsInRect({
+            left: left,
+            top: top,
+            right: isRowSelection ? right : left + 1,
+            bottom: isRowSelection ? top + 1 : bottom
+          });
+
+          var cellsInLastRow = bottom - top === 1 ? cellsInFirstRow : map.cellsInRect({
+            left: isRowSelection ? left : right - 1,
+            top: isRowSelection ? bottom - 1 : top,
+            right: right,
+            bottom: bottom
+          });
+
+          var head = table.start + cellsInFirstRow[0];
+          var anchor = table.start + cellsInLastRow[cellsInLastRow.length - 1];
+          var $head = tr.doc.resolve(head);
+          var $anchor = tr.doc.resolve(anchor);
+
+          return cloneTr(tr.setSelection(new prosemirrorTables.CellSelection($anchor, $head)));
+        }
+      }
+      return tr;
+    };
+  };
+};
+
+// :: (columnIndex: number, expand: ?boolean) → (tr: Transaction) → Transaction
+// Returns a new transaction that creates a `CellSelection` on a column at index `columnIndex`.
+// Use the optional `expand` param to extend from current selection.
+//
+// ```javascript
+// dispatch(
+//   selectColumn(i)(state.tr)
+// );
+// ```
+var selectColumn = select('column');
+
+// :: (rowIndex: number, expand: ?boolean) → (tr: Transaction) → Transaction
+// Returns a new transaction that creates a `CellSelection` on a column at index `rowIndex`.
+// Use the optional `expand` param to extend from current selection.
+//
+// ```javascript
+// dispatch(
+//   selectRow(i)(state.tr)
+// );
+// ```
+var selectRow = select('row');
+
+// :: (selection: Selection) → (tr: Transaction) → Transaction
+// Returns a new transaction that creates a `CellSelection` on the entire table.
+//
+// ```javascript
+// dispatch(
+//   selectTable(i)(state.tr)
+// );
+// ```
+var selectTable = function selectTable(tr) {
+  var table = findTable(tr.selection);
+  if (table) {
+    var _TableMap$get = prosemirrorTables.TableMap.get(table.node),
+        map = _TableMap$get.map;
+
+    if (map && map.length) {
+      var head = table.start + map[0];
+      var anchor = table.start + map[map.length - 1];
+      var $head = tr.doc.resolve(head);
+      var $anchor = tr.doc.resolve(anchor);
+
+      return cloneTr(tr.setSelection(new prosemirrorTables.CellSelection($anchor, $head)));
+    }
+  }
+  return tr;
+};
+
+// :: (cell: {pos: number, node: ProseMirrorNode}, schema: Schema) → (tr: Transaction) → Transaction
+// Returns a new transaction that clears the content of a given `cell`.
+//
+// ```javascript
+// const $pos = state.doc.resolve(13);
+// dispatch(
+//   emptyCell(findCellClosestToPos($pos), state.schema)(state.tr)
+// );
+// ```
+var emptyCell = function emptyCell(cell, schema) {
+  return function (tr) {
+    if (cell) {
+      var _tableNodeTypes$cell$ = tableNodeTypes(schema).cell.createAndFill(),
+          content = _tableNodeTypes$cell$.content;
+
+      if (!cell.node.content.eq(content)) {
+        tr.replaceWith(cell.pos + 1, cell.pos + cell.node.nodeSize, content);
+        return cloneTr(tr);
+      }
+    }
+    return tr;
+  };
+};
+
+// :: (columnIndex: number) → (tr: Transaction) → Transaction
+// Returns a new transaction that adds a new column at index `columnIndex`.
+//
+// ```javascript
+// dispatch(
+//   addColumnAt(i)(state.tr)
+// );
+// ```
+var addColumnAt = function addColumnAt(columnIndex) {
+  return function (tr) {
+    var table = findTable(tr.selection);
+    if (table) {
+      var map = prosemirrorTables.TableMap.get(table.node);
+      if (columnIndex >= 0 && columnIndex <= map.width) {
+        return cloneTr(prosemirrorTables.addColumn(tr, {
+          map: map,
+          tableStart: table.start,
+          table: table.node
+        }, columnIndex));
+      }
+    }
+    return tr;
+  };
+};
+
+// :: (originRowIndex: number, targetRowIndex: targetColumnIndex, options?: MovementOptions) → (tr: Transaction) → Transaction
+// Returns a new transaction that moves the origin row to the target index;
+//
+// by default "tryToFit" is false, that means if you try to move a row to a place
+// where we will need to split a row with merged cells it'll throw an exception, for example:
+//
+// ```
+//      ____________________________
+//     |      |      |             |
+//  0  |  A1  |  B1  |     C1      |
+//     |______|______|______ ______|
+//     |      |             |      |
+//  1  |  A2  |     B2      |      |
+//     |______|______ ______|      |
+//     |      |      |      |  D1  |
+//  2  |  A3  |  B3  |  C2  |      |
+//     |______|______|______|______|
+// ```
+//
+// if you try to move the row 0 to the row index 1 with tryToFit false,
+// it'll throw an exception since you can't split the row 1;
+// but if "tryToFit" is true, it'll move the row using the current direction.
+//
+// We defined current direction using the target and origin values
+// if the origin is greater than the target, that means the course is `bottom-to-top`,
+// so the `tryToFit` logic will use this direction to determine
+// if we should move the column to the right or the left.
+//
+// for example, if you call the function using `moveRow(0, 1, { tryToFit: true })`
+// the result will be:
+// ```
+//      ____________________________
+//     |      |             |      |
+//  0  |  A2  |     B2      |      |
+//     |______|______ ______|      |
+//     |      |      |      |  D1  |
+//  1  |  A3  |  B3  |  C2  |      |
+//     |______|______|______|______|
+//     |      |      |             |
+//  2  |  A1  |  B1  |     C1      |
+//     |______|______|______ ______|
+// ```
+//
+// since we could put the row zero on index one,
+// we pushed to the best place to fit the row index 0,
+// in this case, row index 2.
+//
+//
+// -------- HOW TO OVERRIDE DIRECTION --------
+//
+// If you set "tryToFit" to "true", it will try to figure out the best direction
+// place to fit using the origin and target index, for example:
+//
+//
+// ```
+//      ____________________________
+//     |      |      |             |
+//  0  |  A1  |  B1  |     C1      |
+//     |______|______|______ ______|
+//     |      |             |      |
+//  1  |  A2  |     B2      |      |
+//     |______|______ ______|      |
+//     |      |      |      |  D1  |
+//  2  |  A3  |  B3  |  C2  |      |
+//     |______|______|______|______|
+//     |      |             |      |
+//  3  |  A4  |     B4      |      |
+//     |______|______ ______|      |
+//     |      |      |      |  D2  |
+//  4  |  A5  |  B5  |  C3  |      |
+//     |______|______|______|______|
+// ```
+//
+//
+// If you try to move the row 0 to row index 4 with "tryToFit" enabled, by default,
+// the code will put it on after the merged rows,
+// but you can override it using the "direction" option.
+//
+// -1: Always put the origin before the target
+// ```
+//      ____________________________
+//     |      |             |      |
+//  0  |  A2  |     B2      |      |
+//     |______|______ ______|      |
+//     |      |      |      |  D1  |
+//  1  |  A3  |  B3  |  C2  |      |
+//     |______|______|______|______|
+//     |      |      |             |
+//  2  |  A1  |  B1  |     C1      |
+//     |______|______|______ ______|
+//     |      |             |      |
+//  3  |  A4  |     B4      |      |
+//     |______|______ ______|      |
+//     |      |      |      |  D2  |
+//  4  |  A5  |  B5  |  C3  |      |
+//     |______|______|______|______|
+// ```
+//
+//  0: Automatically decide the best place to fit
+// ```
+//      ____________________________
+//     |      |             |      |
+//  0  |  A2  |     B2      |      |
+//     |______|______ ______|      |
+//     |      |      |      |  D1  |
+//  1  |  A3  |  B3  |  C2  |      |
+//     |______|______|______|______|
+//     |      |             |      |
+//  2  |  A4  |     B4      |      |
+//     |______|______ ______|      |
+//     |      |      |      |  D2  |
+//  3  |  A5  |  B5  |  C3  |      |
+//     |______|______|______|______|
+//     |      |      |             |
+//  4  |  A1  |  B1  |     C1      |
+//     |______|______|______ ______|
+// ```
+//
+//  1: Always put the origin after the target
+// ```
+//      ____________________________
+//     |      |             |      |
+//  0  |  A2  |     B2      |      |
+//     |______|______ ______|      |
+//     |      |      |      |  D1  |
+//  1  |  A3  |  B3  |  C2  |      |
+//     |______|______|______|______|
+//     |      |             |      |
+//  2  |  A4  |     B4      |      |
+//     |______|______ ______|      |
+//     |      |      |      |  D2  |
+//  3  |  A5  |  B5  |  C3  |      |
+//     |______|______|______|______|
+//     |      |      |             |
+//  4  |  A1  |  B1  |     C1      |
+//     |______|______|______ ______|
+// ```
+//
+// ```javascript
+// dispatch(
+//   moveRow(x, y, options)(state.tr)
+// );
+// ```
+var moveRow = function moveRow(originRowIndex, targetRowIndex, opts) {
+  return function (tr) {
+    var defaultOptions = { tryToFit: false, direction: 0 };
+    var options = Object.assign(defaultOptions, opts);
+    var table = findTable(tr.selection);
+    if (!table) {
+      return tr;
+    }
+
+    var _getSelectionRangeInR = getSelectionRangeInRow(originRowIndex)(tr),
+        indexesOriginRow = _getSelectionRangeInR.indexes;
+
+    var _getSelectionRangeInR2 = getSelectionRangeInRow(targetRowIndex)(tr),
+        indexesTargetRow = _getSelectionRangeInR2.indexes;
+
+    if (indexesOriginRow.indexOf(targetRowIndex) > -1) {
+      return tr;
+    }
+
+    if (!options.tryToFit && indexesTargetRow.length > 1) {
+      checkInvalidMovements(originRowIndex, targetRowIndex, indexesTargetRow, 'row');
+    }
+
+    var newTable = moveTableRow(table, indexesOriginRow, indexesTargetRow, options.direction);
+
+    return cloneTr(tr).replaceWith(table.pos, table.pos + table.node.nodeSize, newTable);
+  };
+};
+
+// :: (originColumnIndex: number, targetColumnIndex: targetColumnIndex, options?: MovementOptions) → (tr: Transaction) → Transaction
+// Returns a new transaction that moves the origin column to the target index;
+//
+// by default "tryToFit" is false, that means if you try to move a column to a place
+// where we will need to split a column with merged cells it'll throw an exception, for example:
+//
+// ```
+//    0      1         2
+//  ____________________________
+// |      |      |             |
+// |  A1  |  B1  |     C1      |
+// |______|______|______ ______|
+// |      |             |      |
+// |  A2  |     B2      |      |
+// |______|______ ______|      |
+// |      |      |      |  D1  |
+// |  A3  |  B3  |  C2  |      |
+// |______|______|______|______|
+// ```
+//
+//
+// if you try to move the column 0 to the column index 1 with tryToFit false,
+// it'll throw an exception since you can't split the column 1;
+// but if "tryToFit" is true, it'll move the column using the current direction.
+//
+// We defined current direction using the target and origin values
+// if the origin is greater than the target, that means the course is `right-to-left`,
+// so the `tryToFit` logic will use this direction to determine
+// if we should move the column to the right or the left.
+//
+// for example, if you call the function using `moveColumn(0, 1, { tryToFit: true })`
+// the result will be:
+//
+// ```
+//    0       1             2
+// _____________________ _______
+// |      |             |      |
+// |  B1  |     C1      |  A1  |
+// |______|______ ______|______|
+// |             |      |      |
+// |     B2      |      |  A2  |
+// |______ ______|      |______|
+// |      |      |  D1  |      |
+// |  B3  |  C2  |      |  A3  |
+// |______|______|______|______|
+// ```
+//
+// since we could put the column zero on index one,
+// we pushed to the best place to fit the column 0, in this case, column index 2.
+//
+// -------- HOW TO OVERRIDE DIRECTION --------
+//
+// If you set "tryToFit" to "true", it will try to figure out the best direction
+// place to fit using the origin and target index, for example:
+//
+//
+// ```
+//     0      1       2     3      4      5       6
+//   _________________________________________________
+//  |      |      |             |      |             |
+//  |  A1  |  B1  |     C1      |  E1  |     F1      |
+//  |______|______|______ ______|______|______ ______|
+//  |      |             |      |             |      |
+//  |  A2  |     B2      |      |     E2      |      |
+//  |______|______ ______|      |______ ______|      |
+//  |      |      |      |  D1  |      |      |  G2  |
+//  |  A3  |  B3  |  C3  |      |  E3  |  F3  |      |
+//  |______|______|______|______|______|______|______|
+// ```
+//
+//
+// If you try to move the column 0 to column index 5 with "tryToFit" enabled, by default,
+// the code will put it on after the merged columns,
+// but you can override it using the "direction" option.
+//
+// -1: Always put the origin before the target
+//
+// ```
+//     0      1       2     3      4      5       6
+//   _________________________________________________
+//  |      |             |      |      |             |
+//  |  B1  |     C1      |  A1  |  E1  |     F1      |
+//  |______|______ ______|______|______|______ ______|
+//  |             |      |      |             |      |
+//  |     B2      |      |  A2  |     E2      |      |
+//  |______ ______|      |______|______ ______|      |
+//  |      |      |  D1  |      |      |      |  G2  |
+//  |  B3  |  C3  |      |  A3  |  E3  |  F3  |      |
+//  |______|______|______|______|______|______|______|
+// ```
+//
+//  0: Automatically decide the best place to fit
+//
+// ```
+//     0      1       2     3      4      5       6
+//   _________________________________________________
+//  |      |             |      |             |      |
+//  |  B1  |     C1      |  E1  |     F1      |  A1  |
+//  |______|______ ______|______|______ ______|______|
+//  |             |      |             |      |      |
+//  |     B2      |      |     E2      |      |  A2  |
+//  |______ ______|      |______ ______|      |______|
+//  |      |      |  D1  |      |      |  G2  |      |
+//  |  B3  |  C3  |      |  E3  |  F3  |      |  A3  |
+//  |______|______|______|______|______|______|______|
+// ```
+//
+//  1: Always put the origin after the target
+//
+// ```
+//     0      1       2     3      4      5       6
+//   _________________________________________________
+//  |      |             |      |             |      |
+//  |  B1  |     C1      |  E1  |     F1      |  A1  |
+//  |______|______ ______|______|______ ______|______|
+//  |             |      |             |      |      |
+//  |     B2      |      |     E2      |      |  A2  |
+//  |______ ______|      |______ ______|      |______|
+//  |      |      |  D1  |      |      |  G2  |      |
+//  |  B3  |  C3  |      |  E3  |  F3  |      |  A3  |
+//  |______|______|______|______|______|______|______|
+// ```
+//
+// ```javascript
+// dispatch(
+//   moveColumn(x, y, options)(state.tr)
+// );
+// ```
+var moveColumn = function moveColumn(originColumnIndex, targetColumnIndex, opts) {
+  return function (tr) {
+    var defaultOptions = { tryToFit: false, direction: 0 };
+    var options = Object.assign(defaultOptions, opts);
+    var table = findTable(tr.selection);
+    if (!table) {
+      return tr;
+    }
+
+    var _getSelectionRangeInC = getSelectionRangeInColumn(originColumnIndex)(tr),
+        indexesOriginColumn = _getSelectionRangeInC.indexes;
+
+    var _getSelectionRangeInC2 = getSelectionRangeInColumn(targetColumnIndex)(tr),
+        indexesTargetColumn = _getSelectionRangeInC2.indexes;
+
+    if (indexesOriginColumn.indexOf(targetColumnIndex) > -1) {
+      return tr;
+    }
+
+    if (!options.tryToFit && indexesTargetColumn.length > 1) {
+      checkInvalidMovements(originColumnIndex, targetColumnIndex, indexesTargetColumn, 'column');
+    }
+
+    var newTable = moveTableColumn(table, indexesOriginColumn, indexesTargetColumn, options.direction);
+
+    return cloneTr(tr).replaceWith(table.pos, table.pos + table.node.nodeSize, newTable);
+  };
+};
+
+// :: (rowIndex: number, clonePreviousRow?: boolean) → (tr: Transaction) → Transaction
+// Returns a new transaction that adds a new row at index `rowIndex`. Optionally clone the previous row.
+//
+// ```javascript
+// dispatch(
+//   addRowAt(i)(state.tr)
+// );
+// ```
+//
+// ```javascript
+// dispatch(
+//   addRowAt(i, true)(state.tr)
+// );
+// ```
+var addRowAt = function addRowAt(rowIndex, clonePreviousRow) {
+  return function (tr) {
+    var table = findTable(tr.selection);
+    if (table) {
+      var map = prosemirrorTables.TableMap.get(table.node);
+      var cloneRowIndex = rowIndex - 1;
+
+      if (clonePreviousRow && cloneRowIndex >= 0) {
+        return cloneTr(cloneRowAt(cloneRowIndex)(tr));
+      }
+
+      if (rowIndex >= 0 && rowIndex <= map.height) {
+        return cloneTr(prosemirrorTables.addRow(tr, {
+          map: map,
+          tableStart: table.start,
+          table: table.node
+        }, rowIndex));
+      }
+    }
+    return tr;
+  };
+};
+
+// :: (cloneRowIndex: number) → (tr: Transaction) → Transaction
+// Returns a new transaction that adds a new row after `cloneRowIndex`, cloning the row attributes at `cloneRowIndex`.
+//
+// ```javascript
+// dispatch(
+//   cloneRowAt(i)(state.tr)
+// );
+// ```
+var cloneRowAt = function cloneRowAt(rowIndex) {
+  return function (tr) {
+    var table = findTable(tr.selection);
+    if (table) {
+      var map = prosemirrorTables.TableMap.get(table.node);
+
+      if (rowIndex >= 0 && rowIndex <= map.height) {
+        var tableNode = table.node;
+        var tableNodes = tableNodeTypes(tableNode.type.schema);
+
+        var rowPos = table.start;
+        for (var i = 0; i < rowIndex + 1; i++) {
+          rowPos += tableNode.child(i).nodeSize;
+        }
+
+        var cloneRow = tableNode.child(rowIndex);
+        // Re-create the same nodes with same attrs, dropping the node content.
+        var cells = [];
+        var rowWidth = 0;
+        cloneRow.forEach(function (cell) {
+          // If we're copying a row with rowspan somewhere, we dont want to copy that cell
+          // We'll increment its span below.
+          if (cell.attrs.rowspan === 1) {
+            rowWidth += cell.attrs.colspan;
+            cells.push(tableNodes[cell.type.spec.tableRole].createAndFill(cell.attrs, cell.marks));
+          }
+        });
+
+        // If a higher row spans past our clone row, bump the higher row to cover this new row too.
+        if (rowWidth < map.width) {
+          var rowSpanCells = [];
+
+          var _loop = function _loop(_i) {
+            var foundCells = filterCellsInRow(_i, function (cell, tr) {
+              var rowspan = cell.node.attrs.rowspan;
+              var spanRange = _i + rowspan;
+              return rowspan > 1 && spanRange > rowIndex;
+            })(tr);
+            rowSpanCells.push.apply(rowSpanCells, _toConsumableArray(foundCells));
+          };
+
+          for (var _i = rowIndex; _i >= 0; _i--) {
+            _loop(_i);
+          }
+
+          if (rowSpanCells.length) {
+            rowSpanCells.forEach(function (cell) {
+              tr = setCellAttrs(cell, {
+                rowspan: cell.node.attrs.rowspan + 1
+              })(tr);
+            });
+          }
+        }
+
+        return safeInsert(tableNodes.row.create(cloneRow.attrs, cells), rowPos)(tr);
+      }
+    }
+    return tr;
+  };
+};
+
+// :: (columnIndex: number) → (tr: Transaction) → Transaction
+// Returns a new transaction that removes a column at index `columnIndex`. If there is only one column left, it will remove the entire table.
+//
+// ```javascript
+// dispatch(
+//   removeColumnAt(i)(state.tr)
+// );
+// ```
+var removeColumnAt = function removeColumnAt(columnIndex) {
+  return function (tr) {
+    var table = findTable(tr.selection);
+    if (table) {
+      var map = prosemirrorTables.TableMap.get(table.node);
+      if (columnIndex === 0 && map.width === 1) {
+        return removeTable(tr);
+      } else if (columnIndex >= 0 && columnIndex <= map.width) {
+        prosemirrorTables.removeColumn(tr, {
+          map: map,
+          tableStart: table.start,
+          table: table.node
+        }, columnIndex);
+        return cloneTr(tr);
+      }
+    }
+    return tr;
+  };
+};
+
+// :: (rowIndex: number) → (tr: Transaction) → Transaction
+// Returns a new transaction that removes a row at index `rowIndex`. If there is only one row left, it will remove the entire table.
+//
+// ```javascript
+// dispatch(
+//   removeRowAt(i)(state.tr)
+// );
+// ```
+var removeRowAt = function removeRowAt(rowIndex) {
+  return function (tr) {
+    var table = findTable(tr.selection);
+    if (table) {
+      var map = prosemirrorTables.TableMap.get(table.node);
+      if (rowIndex === 0 && map.height === 1) {
+        return removeTable(tr);
+      } else if (rowIndex >= 0 && rowIndex <= map.height) {
+        prosemirrorTables.removeRow(tr, {
+          map: map,
+          tableStart: table.start,
+          table: table.node
+        }, rowIndex);
+        return cloneTr(tr);
+      }
+    }
+    return tr;
+  };
+};
+
+// :: (tr: Transaction) → Transaction
+// Returns a new transaction that removes a table node if the cursor is inside of it.
+//
+// ```javascript
+// dispatch(
+//   removeTable(state.tr)
+// );
+// ```
+var removeTable = function removeTable(tr) {
+  var $from = tr.selection.$from;
+
+  for (var depth = $from.depth; depth > 0; depth--) {
+    var node = $from.node(depth);
+    if (node.type.spec.tableRole === 'table') {
+      return cloneTr(tr.delete($from.before(depth), $from.after(depth)));
+    }
+  }
+  return tr;
+};
+
+// :: (tr: Transaction) → Transaction
+// Returns a new transaction that removes selected columns.
+//
+// ```javascript
+// dispatch(
+//   removeSelectedColumns(state.tr)
+// );
+// ```
+var removeSelectedColumns = function removeSelectedColumns(tr) {
+  var selection = tr.selection;
+
+  if (isTableSelected(selection)) {
+    return removeTable(tr);
+  }
+  if (isCellSelection(selection)) {
+    var table = findTable(selection);
+    if (table) {
+      var map = prosemirrorTables.TableMap.get(table.node);
+      var rect = map.rectBetween(selection.$anchorCell.pos - table.start, selection.$headCell.pos - table.start);
+
+      if (rect.left == 0 && rect.right == map.width) {
+        return false;
+      }
+
+      var pmTableRect = Object.assign({}, rect, {
+        map: map,
+        table: table.node,
+        tableStart: table.start
+      });
+
+      for (var i = pmTableRect.right - 1;; i--) {
+        prosemirrorTables.removeColumn(tr, pmTableRect, i);
+        if (i === pmTableRect.left) {
+          break;
+        }
+        pmTableRect.table = pmTableRect.tableStart ? tr.doc.nodeAt(pmTableRect.tableStart - 1) : tr.doc;
+        pmTableRect.map = prosemirrorTables.TableMap.get(pmTableRect.table);
+      }
+      return cloneTr(tr);
+    }
+  }
+  return tr;
+};
+
+// :: (tr: Transaction) → Transaction
+// Returns a new transaction that removes selected rows.
+//
+// ```javascript
+// dispatch(
+//   removeSelectedRows(state.tr)
+// );
+// ```
+var removeSelectedRows = function removeSelectedRows(tr) {
+  var selection = tr.selection;
+
+  if (isTableSelected(selection)) {
+    return removeTable(tr);
+  }
+  if (isCellSelection(selection)) {
+    var table = findTable(selection);
+    if (table) {
+      var map = prosemirrorTables.TableMap.get(table.node);
+      var rect = map.rectBetween(selection.$anchorCell.pos - table.start, selection.$headCell.pos - table.start);
+
+      if (rect.top == 0 && rect.bottom == map.height) {
+        return false;
+      }
+
+      var pmTableRect = Object.assign({}, rect, {
+        map: map,
+        table: table.node,
+        tableStart: table.start
+      });
+
+      for (var i = pmTableRect.bottom - 1;; i--) {
+        prosemirrorTables.removeRow(tr, pmTableRect, i);
+        if (i === pmTableRect.top) {
+          break;
+        }
+        pmTableRect.table = pmTableRect.tableStart ? tr.doc.nodeAt(pmTableRect.tableStart - 1) : tr.doc;
+        pmTableRect.map = prosemirrorTables.TableMap.get(pmTableRect.table);
+      }
+
+      return cloneTr(tr);
+    }
+  }
+  return tr;
+};
+
+// :: ($pos: ResolvedPos) → (tr: Transaction) → Transaction
+// Returns a new transaction that removes a column closest to a given `$pos`.
+//
+// ```javascript
+// dispatch(
+//   removeColumnClosestToPos(state.doc.resolve(3))(state.tr)
+// );
+// ```
+var removeColumnClosestToPos = function removeColumnClosestToPos($pos) {
+  return function (tr) {
+    var rect = findCellRectClosestToPos($pos);
+    if (rect) {
+      return removeColumnAt(rect.left)(setTextSelection($pos.pos)(tr));
+    }
+    return tr;
+  };
+};
+
+// :: ($pos: ResolvedPos) → (tr: Transaction) → Transaction
+// Returns a new transaction that removes a row closest to a given `$pos`.
+//
+// ```javascript
+// dispatch(
+//   removeRowClosestToPos(state.doc.resolve(3))(state.tr)
+// );
+// ```
+var removeRowClosestToPos = function removeRowClosestToPos($pos) {
+  return function (tr) {
+    var rect = findCellRectClosestToPos($pos);
+    if (rect) {
+      return removeRowAt(rect.top)(setTextSelection($pos.pos)(tr));
+    }
+    return tr;
+  };
+};
+
+// :: (columnIndex: number, cellTransform: (cell: {pos: number, start: number, node: ProseMirrorNode}, tr: Transaction) → Transaction, setCursorToLastCell: ?boolean) → (tr: Transaction) → Transaction
+// Returns a new transaction that maps a given `cellTransform` function to each cell in a column at a given `columnIndex`.
+// It will set the selection into the last cell of the column if `setCursorToLastCell` param is set to `true`.
+//
+// ```javascript
+// dispatch(
+//   forEachCellInColumn(0, (cell, tr) => emptyCell(cell, state.schema)(tr))(state.tr)
+// );
+// ```
+var forEachCellInColumn = function forEachCellInColumn(columnIndex, cellTransform, setCursorToLastCell) {
+  return function (tr) {
+    var cells = getCellsInColumn(columnIndex)(tr.selection);
+    if (cells) {
+      for (var i = cells.length - 1; i >= 0; i--) {
+        tr = cellTransform(cells[i], tr);
+      }
+      if (setCursorToLastCell) {
+        var $pos = tr.doc.resolve(tr.mapping.map(cells[cells.length - 1].pos));
+        tr.setSelection(prosemirrorState.Selection.near($pos));
+      }
+      return cloneTr(tr);
+    }
+    return tr;
+  };
+};
+
+// :: (rowIndex: number, cellTransform: (cell: {pos: number, start: number, node: ProseMirrorNode}, tr: Transaction) → Transaction, setCursorToLastCell: ?boolean) → (tr: Transaction) → Transaction
+// Returns a new transaction that maps a given `cellTransform` function to each cell in a row at a given `rowIndex`.
+// It will set the selection into the last cell of the row if `setCursorToLastCell` param is set to `true`.
+//
+// ```javascript
+// dispatch(
+//   forEachCellInRow(0, (cell, tr) => setCellAttrs(cell, { background: 'red' })(tr))(state.tr)
+// );
+// ```
+var forEachCellInRow = function forEachCellInRow(rowIndex, cellTransform, setCursorToLastCell) {
+  return function (tr) {
+    var cells = getCellsInRow(rowIndex)(tr.selection);
+    if (cells) {
+      for (var i = cells.length - 1; i >= 0; i--) {
+        tr = cellTransform(cells[i], tr);
+      }
+      if (setCursorToLastCell) {
+        var $pos = tr.doc.resolve(tr.mapping.map(cells[cells.length - 1].pos));
+        tr.setSelection(prosemirrorState.Selection.near($pos));
+      }
+    }
+    return tr;
+  };
+};
+
+// :: (cell: {pos: number, start: number, node: ProseMirrorNode}, attrs: Object) → (tr: Transaction) → Transaction
+// Returns a new transaction that sets given `attrs` to a given `cell`.
+//
+// ```javascript
+// dispatch(
+//   setCellAttrs(findCellClosestToPos($pos), { background: 'blue' })(tr);
+// );
+// ```
+var setCellAttrs = function setCellAttrs(cell, attrs) {
+  return function (tr) {
+    if (cell) {
+      tr.setNodeMarkup(cell.pos, null, Object.assign({}, cell.node.attrs, attrs));
+      return cloneTr(tr);
+    }
+    return tr;
+  };
+};
+
+// :: (schema: Schema, rowsCount: ?number, colsCount: ?number, withHeaderRow: ?boolean, cellContent: ?Node) → Node
+// Returns a table node of a given size.
+// `withHeaderRow` defines whether the first row of the table will be a header row.
+// `cellContent` defines the content of each cell.
+//
+// ```javascript
+// const table = createTable(state.schema); // 3x3 table node
+// dispatch(
+//   tr.replaceSelectionWith(table).scrollIntoView()
+// );
+// ```
+var createTable = function createTable(schema) {
+  var rowsCount = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 3;
+  var colsCount = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 3;
+  var withHeaderRow = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
+  var cellContent = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : null;
+
+  var _tableNodeTypes = tableNodeTypes(schema),
+      tableCell = _tableNodeTypes.cell,
+      tableHeader = _tableNodeTypes.header_cell,
+      tableRow = _tableNodeTypes.row,
+      table = _tableNodeTypes.table;
+
+  var cells = [];
+  var headerCells = [];
+  for (var i = 0; i < colsCount; i++) {
+    cells.push(createCell(tableCell, cellContent));
+
+    if (withHeaderRow) {
+      headerCells.push(createCell(tableHeader, cellContent));
+    }
+  }
+
+  var rows = [];
+  for (var _i2 = 0; _i2 < rowsCount; _i2++) {
+    rows.push(tableRow.createChecked(null, withHeaderRow && _i2 === 0 ? headerCells : cells));
+  }
+
+  return table.createChecked(null, rows);
+};
+
+// :: ($pos: ResolvedPos) → ?{pos: number, start: number, node: ProseMirrorNode}
+// Iterates over parent nodes, returning a table cell or a table header node closest to a given `$pos`.
+//
+// ```javascript
+// const cell = findCellClosestToPos(state.selection.$from);
+// ```
+var findCellClosestToPos = function findCellClosestToPos($pos) {
+  var predicate = function predicate(node) {
+    return node.type.spec.tableRole && /cell/i.test(node.type.spec.tableRole);
+  };
+  return findParentNodeClosestToPos($pos, predicate);
+};
+
+// :: ($pos: ResolvedPos) → ?{left: number, top: number, right: number, bottom: number}
+// Returns the rectangle spanning a cell closest to a given `$pos`.
+//
+// ```javascript
+// dispatch(
+//   findCellRectClosestToPos(state.selection.$from)
+// );
+// ```
+var findCellRectClosestToPos = function findCellRectClosestToPos($pos) {
+  var cell = findCellClosestToPos($pos);
+  if (cell) {
+    var table = findTableClosestToPos($pos);
+    var map = prosemirrorTables.TableMap.get(table.node);
+    var cellPos = cell.pos - table.start;
+    return map.rectBetween(cellPos, cellPos);
+  }
+};
+
+var filterCellsInRow = function filterCellsInRow(rowIndex, predicate) {
+  return function (tr) {
+    var foundCells = [];
+    var cells = getCellsInRow(rowIndex)(tr.selection);
+    if (cells) {
+      for (var j = cells.length - 1; j >= 0; j--) {
+        if (predicate(cells[j], tr)) {
+          foundCells.push(cells[j]);
+        }
+      }
+    }
+
+    return foundCells;
+  };
+};
+
+// :: (columnIndex: number) → (tr: Transaction) → {$anchor: ResolvedPos, $head: ResolvedPos, indexes: [number]}
+// Returns a range of rectangular selection spanning all merged cells around a column at index `columnIndex`.
+//
+// ```javascript
+// const range = getSelectionRangeInColumn(3)(state.tr);
+// ```
+var getSelectionRangeInColumn = function getSelectionRangeInColumn(columnIndex) {
+  return function (tr) {
+    var startIndex = columnIndex;
+    var endIndex = columnIndex;
+
+    // looking for selection start column (startIndex)
+
+    var _loop2 = function _loop2(i) {
+      var cells = getCellsInColumn(i)(tr.selection);
+      if (cells) {
+        cells.forEach(function (cell) {
+          var maybeEndIndex = cell.node.attrs.colspan + i - 1;
+          if (maybeEndIndex >= startIndex) {
+            startIndex = i;
+          }
+          if (maybeEndIndex > endIndex) {
+            endIndex = maybeEndIndex;
+          }
+        });
+      }
+    };
+
+    for (var i = columnIndex; i >= 0; i--) {
+      _loop2(i);
+    }
+    // looking for selection end column (endIndex)
+
+    var _loop3 = function _loop3(i) {
+      var cells = getCellsInColumn(i)(tr.selection);
+      if (cells) {
+        cells.forEach(function (cell) {
+          var maybeEndIndex = cell.node.attrs.colspan + i - 1;
+          if (cell.node.attrs.colspan > 1 && maybeEndIndex > endIndex) {
+            endIndex = maybeEndIndex;
+          }
+        });
+      }
+    };
+
+    for (var i = columnIndex; i <= endIndex; i++) {
+      _loop3(i);
+    }
+
+    // filter out columns without cells (where all rows have colspan > 1 in the same column)
+    var indexes = [];
+    for (var i = startIndex; i <= endIndex; i++) {
+      var maybeCells = getCellsInColumn(i)(tr.selection);
+      if (maybeCells && maybeCells.length) {
+        indexes.push(i);
+      }
+    }
+    startIndex = indexes[0];
+    endIndex = indexes[indexes.length - 1];
+
+    var firstSelectedColumnCells = getCellsInColumn(startIndex)(tr.selection);
+    var firstRowCells = getCellsInRow(0)(tr.selection);
+    var $anchor = tr.doc.resolve(firstSelectedColumnCells[firstSelectedColumnCells.length - 1].pos);
+
+    var headCell = void 0;
+    for (var _i3 = endIndex; _i3 >= startIndex; _i3--) {
+      var columnCells = getCellsInColumn(_i3)(tr.selection);
+      if (columnCells && columnCells.length) {
+        for (var j = firstRowCells.length - 1; j >= 0; j--) {
+          if (firstRowCells[j].pos === columnCells[0].pos) {
+            headCell = columnCells[0];
+            break;
+          }
+        }
+        if (headCell) {
+          break;
+        }
+      }
+    }
+
+    var $head = tr.doc.resolve(headCell.pos);
+    return { $anchor: $anchor, $head: $head, indexes: indexes };
+  };
+};
+
+// :: (rowIndex: number) → (tr: Transaction) → {$anchor: ResolvedPos, $head: ResolvedPos, indexes: [number]}
+// Returns a range of rectangular selection spanning all merged cells around a row at index `rowIndex`.
+//
+// ```javascript
+// const range = getSelectionRangeInRow(3)(state.tr);
+// ```
+var getSelectionRangeInRow = function getSelectionRangeInRow(rowIndex) {
+  return function (tr) {
+    var startIndex = rowIndex;
+    var endIndex = rowIndex;
+    // looking for selection start row (startIndex)
+
+    var _loop4 = function _loop4(i) {
+      var cells = getCellsInRow(i)(tr.selection);
+      cells.forEach(function (cell) {
+        var maybeEndIndex = cell.node.attrs.rowspan + i - 1;
+        if (maybeEndIndex >= startIndex) {
+          startIndex = i;
+        }
+        if (maybeEndIndex > endIndex) {
+          endIndex = maybeEndIndex;
+        }
+      });
+    };
+
+    for (var i = rowIndex; i >= 0; i--) {
+      _loop4(i);
+    }
+    // looking for selection end row (endIndex)
+
+    var _loop5 = function _loop5(i) {
+      var cells = getCellsInRow(i)(tr.selection);
+      cells.forEach(function (cell) {
+        var maybeEndIndex = cell.node.attrs.rowspan + i - 1;
+        if (cell.node.attrs.rowspan > 1 && maybeEndIndex > endIndex) {
+          endIndex = maybeEndIndex;
+        }
+      });
+    };
+
+    for (var i = rowIndex; i <= endIndex; i++) {
+      _loop5(i);
+    }
+
+    // filter out rows without cells (where all columns have rowspan > 1 in the same row)
+    var indexes = [];
+    for (var i = startIndex; i <= endIndex; i++) {
+      var maybeCells = getCellsInRow(i)(tr.selection);
+      if (maybeCells && maybeCells.length) {
+        indexes.push(i);
+      }
+    }
+    startIndex = indexes[0];
+    endIndex = indexes[indexes.length - 1];
+
+    var firstSelectedRowCells = getCellsInRow(startIndex)(tr.selection);
+    var firstColumnCells = getCellsInColumn(0)(tr.selection);
+    var $anchor = tr.doc.resolve(firstSelectedRowCells[firstSelectedRowCells.length - 1].pos);
+
+    var headCell = void 0;
+    for (var _i4 = endIndex; _i4 >= startIndex; _i4--) {
+      var rowCells = getCellsInRow(_i4)(tr.selection);
+      if (rowCells && rowCells.length) {
+        for (var j = firstColumnCells.length - 1; j >= 0; j--) {
+          if (firstColumnCells[j].pos === rowCells[0].pos) {
+            headCell = rowCells[0];
+            break;
+          }
+        }
+        if (headCell) {
+          break;
+        }
+      }
+    }
+
+    var $head = tr.doc.resolve(headCell.pos);
+    return { $anchor: $anchor, $head: $head, indexes: indexes };
+  };
+};
+
+exports.isNodeSelection = isNodeSelection;
+exports.canInsert = canInsert;
+exports.convertTableNodeToArrayOfRows = convertTableNodeToArrayOfRows;
+exports.convertArrayOfRowsToTableNode = convertArrayOfRowsToTableNode;
+exports.findParentNode = findParentNode;
+exports.findParentNodeClosestToPos = findParentNodeClosestToPos;
+exports.findParentDomRef = findParentDomRef;
+exports.hasParentNode = hasParentNode;
+exports.findParentNodeOfType = findParentNodeOfType;
+exports.findParentNodeOfTypeClosestToPos = findParentNodeOfTypeClosestToPos;
+exports.hasParentNodeOfType = hasParentNodeOfType;
+exports.findParentDomRefOfType = findParentDomRefOfType;
+exports.findSelectedNodeOfType = findSelectedNodeOfType;
+exports.findPositionOfNodeBefore = findPositionOfNodeBefore;
+exports.findDomRefAtPos = findDomRefAtPos;
+exports.flatten = flatten;
+exports.findChildren = findChildren;
+exports.findTextNodes = findTextNodes;
+exports.findInlineNodes = findInlineNodes;
+exports.findBlockNodes = findBlockNodes;
+exports.findChildrenByAttr = findChildrenByAttr;
+exports.findChildrenByType = findChildrenByType;
+exports.findChildrenByMark = findChildrenByMark;
+exports.contains = contains;
+exports.findTable = findTable;
+exports.isCellSelection = isCellSelection;
+exports.getSelectionRect = getSelectionRect;
+exports.isColumnSelected = isColumnSelected;
+exports.isRowSelected = isRowSelected;
+exports.isTableSelected = isTableSelected;
+exports.getCellsInColumn = getCellsInColumn;
+exports.getCellsInRow = getCellsInRow;
+exports.getCellsInTable = getCellsInTable;
+exports.selectColumn = selectColumn;
+exports.selectRow = selectRow;
+exports.selectTable = selectTable;
+exports.emptyCell = emptyCell;
+exports.addColumnAt = addColumnAt;
+exports.moveRow = moveRow;
+exports.moveColumn = moveColumn;
+exports.addRowAt = addRowAt;
+exports.cloneRowAt = cloneRowAt;
+exports.removeColumnAt = removeColumnAt;
+exports.removeRowAt = removeRowAt;
+exports.removeTable = removeTable;
+exports.removeSelectedColumns = removeSelectedColumns;
+exports.removeSelectedRows = removeSelectedRows;
+exports.removeColumnClosestToPos = removeColumnClosestToPos;
+exports.removeRowClosestToPos = removeRowClosestToPos;
+exports.forEachCellInColumn = forEachCellInColumn;
+exports.forEachCellInRow = forEachCellInRow;
+exports.setCellAttrs = setCellAttrs;
+exports.createTable = createTable;
+exports.findCellClosestToPos = findCellClosestToPos;
+exports.findCellRectClosestToPos = findCellRectClosestToPos;
+exports.getSelectionRangeInColumn = getSelectionRangeInColumn;
+exports.getSelectionRangeInRow = getSelectionRangeInRow;
+exports.removeParentNodeOfType = removeParentNodeOfType;
+exports.replaceParentNodeOfType = replaceParentNodeOfType;
+exports.removeSelectedNode = removeSelectedNode;
+exports.replaceSelectedNode = replaceSelectedNode;
+exports.setTextSelection = setTextSelection;
+exports.safeInsert = safeInsert;
+exports.setParentNodeMarkup = setParentNodeMarkup;
+exports.selectParentNodeOfType = selectParentNodeOfType;
+exports.removeNodeBefore = removeNodeBefore;
+//# sourceMappingURL=index.js.map
diff --git a/node_modules/prosemirror-utils/dist/index.js.map b/node_modules/prosemirror-utils/dist/index.js.map
new file mode 100644
index 00000000..554b18ab
--- /dev/null
+++ b/node_modules/prosemirror-utils/dist/index.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"index.js","sources":["../src/transforms.js","../src/helpers.js","../src/selection.js","../src/node.js","../src/table.js"],"sourcesContent":["import { NodeSelection, Selection } from 'prosemirror-state';\nimport { Fragment } from 'prosemirror-model';\nimport { findParentNodeOfType, findPositionOfNodeBefore } from './selection';\nimport {\n  cloneTr,\n  isNodeSelection,\n  replaceNodeAtPos,\n  removeNodeAtPos,\n  canInsert,\n  isEmptyParagraph\n} from './helpers';\n\n// :: (nodeType: union) → (tr: Transaction) → Transaction\n// Returns a new transaction that removes a node of a given `nodeType`. It will return an original transaction if parent node hasn't been found.\n//\n// ```javascript\n// dispatch(\n//   removeParentNodeOfType(schema.nodes.table)(tr)\n// );\n// ```\nexport const removeParentNodeOfType = nodeType => tr => {\n  const parent = findParentNodeOfType(nodeType)(tr.selection);\n  if (parent) {\n    return removeNodeAtPos(parent.pos)(tr);\n  }\n  return tr;\n};\n\n// :: (nodeType: union, content: union) → (tr: Transaction) → Transaction\n// Returns a new transaction that replaces parent node of a given `nodeType` with the given `content`. It will return an original transaction if either parent node hasn't been found or replacing is not possible.\n//\n// ```javascript\n// const node = schema.nodes.paragraph.createChecked({}, schema.text('new'));\n//\n// dispatch(\n//  replaceParentNodeOfType(schema.nodes.table, node)(tr)\n// );\n// ```\nexport const replaceParentNodeOfType = (nodeType, content) => tr => {\n  if (!Array.isArray(nodeType)) {\n    nodeType = [nodeType];\n  }\n  for (let i = 0, count = nodeType.length; i < count; i++) {\n    const parent = findParentNodeOfType(nodeType[i])(tr.selection);\n    if (parent) {\n      const newTr = replaceNodeAtPos(parent.pos, content)(tr);\n      if (newTr !== tr) {\n        return newTr;\n      }\n    }\n  }\n  return tr;\n};\n\n// :: (tr: Transaction) → Transaction\n// Returns a new transaction that removes selected node. It will return an original transaction if current selection is not a `NodeSelection`.\n//\n// ```javascript\n// dispatch(\n//   removeSelectedNode(tr)\n// );\n// ```\nexport const removeSelectedNode = tr => {\n  if (isNodeSelection(tr.selection)) {\n    const from = tr.selection.$from.pos;\n    const to = tr.selection.$to.pos;\n    return cloneTr(tr.delete(from, to));\n  }\n  return tr;\n};\n\n// :: (content: union) → (tr: Transaction) → Transaction\n// Returns a new transaction that replaces selected node with a given `node`, keeping NodeSelection on the new `node`.\n// It will return the original transaction if either current selection is not a NodeSelection or replacing is not possible.\n//\n// ```javascript\n// const node = schema.nodes.paragraph.createChecked({}, schema.text('new'));\n// dispatch(\n//   replaceSelectedNode(node)(tr)\n// );\n// ```\nexport const replaceSelectedNode = content => tr => {\n  if (isNodeSelection(tr.selection)) {\n    const { $from, $to } = tr.selection;\n    if (\n      (content instanceof Fragment &&\n        $from.parent.canReplace($from.index(), $from.indexAfter(), content)) ||\n      $from.parent.canReplaceWith(\n        $from.index(),\n        $from.indexAfter(),\n        content.type\n      )\n    ) {\n      return cloneTr(\n        tr\n          .replaceWith($from.pos, $to.pos, content)\n          // restore node selection\n          .setSelection(new NodeSelection(tr.doc.resolve($from.pos)))\n      );\n    }\n  }\n  return tr;\n};\n\n// :: (position: number, dir: ?number) → (tr: Transaction) → Transaction\n// Returns a new transaction that tries to find a valid cursor selection starting at the given `position`\n// and searching back if `dir` is negative, and forward if positive.\n// If a valid cursor position hasn't been found, it will return the original transaction.\n//\n// ```javascript\n// dispatch(\n//   setTextSelection(5)(tr)\n// );\n// ```\nexport const setTextSelection = (position, dir = 1) => tr => {\n  const nextSelection = Selection.findFrom(tr.doc.resolve(position), dir, true);\n  if (nextSelection) {\n    return tr.setSelection(nextSelection);\n  }\n  return tr;\n};\n\nconst isSelectableNode = node => node.type && node.type.spec.selectable;\nconst shouldSelectNode = node => isSelectableNode(node) && node.type.isLeaf;\n\nconst setSelection = (node, pos, tr) => {\n  if (shouldSelectNode(node)) {\n    return tr.setSelection(new NodeSelection(tr.doc.resolve(pos)));\n  }\n  return setTextSelection(pos)(tr);\n};\n\n// :: (content: union, position: ?number, tryToReplace?: boolean) → (tr: Transaction) → Transaction\n// Returns a new transaction that inserts a given `content` at the current cursor position, or at a given `position`, if it is allowed by schema. If schema restricts such nesting, it will try to find an appropriate place for a given node in the document, looping through parent nodes up until the root document node.\n// If `tryToReplace` is true and current selection is a NodeSelection, it will replace selected node with inserted content if its allowed by schema.\n// If cursor is inside of an empty paragraph, it will try to replace that paragraph with the given content. If insertion is successful and inserted node has content, it will set cursor inside of that content.\n// It will return an original transaction if the place for insertion hasn't been found.\n//\n// ```javascript\n// const node = schema.nodes.extension.createChecked({});\n// dispatch(\n//   safeInsert(node)(tr)\n// );\n// ```\nexport const safeInsert = (content, position, tryToReplace) => tr => {\n  const hasPosition = typeof position === 'number';\n  const { $from } = tr.selection;\n  const $insertPos = hasPosition\n    ? tr.doc.resolve(position)\n    : isNodeSelection(tr.selection)\n    ? tr.doc.resolve($from.pos + 1)\n    : $from;\n  const { parent } = $insertPos;\n\n  // try to replace selected node\n  if (isNodeSelection(tr.selection) && tryToReplace) {\n    const oldTr = tr;\n    tr = replaceSelectedNode(content)(tr);\n    if (oldTr !== tr) {\n      return tr;\n    }\n  }\n\n  // try to replace an empty paragraph\n  if (isEmptyParagraph(parent)) {\n    const oldTr = tr;\n    tr = replaceParentNodeOfType(parent.type, content)(tr);\n    if (oldTr !== tr) {\n      const pos = isSelectableNode(content)\n        ? // for selectable node, selection position would be the position of the replaced parent\n          $insertPos.before($insertPos.depth)\n        : $insertPos.pos;\n      return setSelection(content, pos, tr);\n    }\n  }\n\n  // given node is allowed at the current cursor position\n  if (canInsert($insertPos, content)) {\n    tr.insert($insertPos.pos, content);\n    const pos = hasPosition\n      ? $insertPos.pos\n      : isSelectableNode(content)\n      ? // for atom nodes selection position after insertion is the previous pos\n        tr.selection.$anchor.pos - 1\n      : tr.selection.$anchor.pos;\n    return cloneTr(setSelection(content, pos, tr));\n  }\n\n  // looking for a place in the doc where the node is allowed\n  for (let i = $insertPos.depth; i > 0; i--) {\n    const pos = $insertPos.after(i);\n    const $pos = tr.doc.resolve(pos);\n    if (canInsert($pos, content)) {\n      tr.insert(pos, content);\n      return cloneTr(setSelection(content, pos, tr));\n    }\n  }\n  return tr;\n};\n\n// :: (nodeType: union, type: ?union, attrs: ?union, marks?: [Mark]) → (tr: Transaction) → Transaction\n// Returns a transaction that changes the type, attributes, and/or marks of the parent node of a given `nodeType`.\n//\n// ```javascript\n// const node = schema.nodes.extension.createChecked({});\n// dispatch(\n//   setParentNodeMarkup(schema.nodes.panel, null, { panelType })(tr);\n// );\n// ```\nexport const setParentNodeMarkup = (nodeType, type, attrs, marks) => tr => {\n  const parent = findParentNodeOfType(nodeType)(tr.selection);\n  if (parent) {\n    return cloneTr(\n      tr.setNodeMarkup(\n        parent.pos,\n        type,\n        Object.assign({}, parent.node.attrs, attrs),\n        marks\n      )\n    );\n  }\n  return tr;\n};\n\n// :: (nodeType: union) → (tr: Transaction) → Transaction\n// Returns a new transaction that sets a `NodeSelection` on a parent node of a `given nodeType`.\n//\n// ```javascript\n// dispatch(\n//   selectParentNodeOfType([tableCell, tableHeader])(state.tr)\n// );\n// ```\nexport const selectParentNodeOfType = nodeType => tr => {\n  if (!isNodeSelection(tr.selection)) {\n    const parent = findParentNodeOfType(nodeType)(tr.selection);\n    if (parent) {\n      return cloneTr(tr.setSelection(NodeSelection.create(tr.doc, parent.pos)));\n    }\n  }\n  return tr;\n};\n\n// :: (tr: Transaction) → Transaction\n// Returns a new transaction that deletes previous node.\n//\n// ```javascript\n// dispatch(\n//   removeNodeBefore(state.tr)\n// );\n// ```\nexport const removeNodeBefore = tr => {\n  const position = findPositionOfNodeBefore(tr.selection);\n  if (typeof position === 'number') {\n    return removeNodeAtPos(position)(tr);\n  }\n  return tr;\n};\n","import { NodeSelection } from 'prosemirror-state';\nimport { Fragment, Node as PMNode } from 'prosemirror-model';\nimport { TableMap } from 'prosemirror-tables';\nimport { setTextSelection } from './transforms';\nimport { findParentNodeClosestToPos } from './selection';\n\n// :: (selection: Selection) → boolean\n// Checks if current selection is a `NodeSelection`.\n//\n// ```javascript\n// if (isNodeSelection(tr.selection)) {\n//   // ...\n// }\n// ```\nexport const isNodeSelection = selection => {\n  return selection instanceof NodeSelection;\n};\n\n// (nodeType: union) → boolean\n// Checks if the type a given `node` equals to a given `nodeType`.\nexport const equalNodeType = (nodeType, node) => {\n  return (\n    (Array.isArray(nodeType) && nodeType.indexOf(node.type) > -1) ||\n    node.type === nodeType\n  );\n};\n\n// (tr: Transaction) → Transaction\n// Creates a new transaction object from a given transaction\nexport const cloneTr = tr => {\n  return Object.assign(Object.create(tr), tr).setTime(Date.now());\n};\n\n// (position: number, content: union) → (tr: Transaction) → Transaction\n// Returns a `replace` transaction that replaces a node at a given position with the given `content`.\n// It will return the original transaction if replacing is not possible.\n// `position` should point at the position immediately before the node.\nexport const replaceNodeAtPos = (position, content) => tr => {\n  const node = tr.doc.nodeAt(position);\n  const $pos = tr.doc.resolve(position);\n  if (canReplace($pos, content)) {\n    tr = tr.replaceWith(position, position + node.nodeSize, content);\n    const start = tr.selection.$from.pos - 1;\n    // put cursor inside of the inserted node\n    tr = setTextSelection(Math.max(start, 0), -1)(tr);\n    // move cursor to the start of the node\n    tr = setTextSelection(tr.selection.$from.start())(tr);\n    return cloneTr(tr);\n  }\n  return tr;\n};\n\n// ($pos: ResolvedPos, doc: ProseMirrorNode, content: union, ) → boolean\n// Checks if replacing a node at a given `$pos` inside of the `doc` node with the given `content` is possible.\nexport const canReplace = ($pos, content) => {\n  const node = $pos.node($pos.depth);\n  return (\n    node &&\n    node.type.validContent(\n      content instanceof Fragment ? content : Fragment.from(content)\n    )\n  );\n};\n\n// (position: number) → (tr: Transaction) → Transaction\n// Returns a `delete` transaction that removes a node at a given position with the given `node`.\n// `position` should point at the position immediately before the node.\nexport const removeNodeAtPos = position => tr => {\n  const node = tr.doc.nodeAt(position);\n  return cloneTr(tr.delete(position, position + node.nodeSize));\n};\n\n// (schema: Schema) → {[key: string]: NodeType}\n// Returns a map where keys are tableRoles and values are NodeTypes.\nexport const tableNodeTypes = schema => {\n  if (schema.cached.tableNodeTypes) {\n    return schema.cached.tableNodeTypes;\n  }\n  const roles = {};\n  Object.keys(schema.nodes).forEach(type => {\n    const nodeType = schema.nodes[type];\n    if (nodeType.spec.tableRole) {\n      roles[nodeType.spec.tableRole] = nodeType;\n    }\n  });\n  schema.cached.tableNodeTypes = roles;\n  return roles;\n};\n\n// :: ($pos: ResolvedPos, content: union) → boolean\n// Checks if a given `content` can be inserted at the given `$pos`\n//\n// ```javascript\n// const { selection: { $from } } = state;\n// const node = state.schema.nodes.atom.createChecked();\n// if (canInsert($from, node)) {\n//   // ...\n// }\n// ```\nexport const canInsert = ($pos, content) => {\n  const index = $pos.index();\n\n  if (content instanceof Fragment) {\n    return $pos.parent.canReplace(index, index, content);\n  } else if (content instanceof PMNode) {\n    return $pos.parent.canReplaceWith(index, index, content.type);\n  }\n  return false;\n};\n\n// (node: ProseMirrorNode) → boolean\n// Checks if a given `node` is an empty paragraph\nexport const isEmptyParagraph = node => {\n  return !node || (node.type.name === 'paragraph' && node.nodeSize === 2);\n};\n\n// ($pos: ResolvedPos) → ?{pos: number, start: number, node: ProseMirrorNode}\n// Iterates over parent nodes, returning a table node closest to a given `$pos`.\n//\n// ```javascript\n// const table = findTableClosestToPos(state.doc.resolve(10));\n// ```\nexport const findTableClosestToPos = $pos => {\n  const predicate = node =>\n    node.type.spec.tableRole && /table/i.test(node.type.spec.tableRole);\n  return findParentNodeClosestToPos($pos, predicate);\n};\n\nexport const createCell = (cellType, cellContent = null) => {\n  if (cellContent) {\n    return cellType.createChecked(null, cellContent);\n  }\n\n  return cellType.createAndFill();\n};\n\n// (rect: {left: number, right: number, top: number, bottom: number}) → (selection: Selection) → boolean\n// Checks if a given CellSelection rect is selected\nexport const isRectSelected = rect => selection => {\n  const map = TableMap.get(selection.$anchorCell.node(-1));\n  const start = selection.$anchorCell.start(-1);\n  const cells = map.cellsInRect(rect);\n  const selectedCells = map.cellsInRect(\n    map.rectBetween(\n      selection.$anchorCell.pos - start,\n      selection.$headCell.pos - start\n    )\n  );\n\n  for (let i = 0, count = cells.length; i < count; i++) {\n    if (selectedCells.indexOf(cells[i]) === -1) {\n      return false;\n    }\n  }\n\n  return true;\n};\n\n// This function transposes an array of array flipping the columns for rows,\n// transposition is a familiar algebra concept;\n// you can get more details here:\n// https://en.wikipedia.org/wiki/Transpose\n//\n// ```javascript\n//\n//  const arr = [\n//    ['a1', 'a2', 'a3'],\n//    ['b1', 'b2', 'b3'],\n//    ['c1', 'c2', 'c3'],\n//    ['d1', 'd2', 'd3'],\n//  ];\n//\n//  const result = transpose(arr);\n//\n//  result === [\n//    ['a1', 'b1', 'c1', 'd1'],\n//    ['a2', 'b2', 'c2', 'd2'],\n//    ['a3', 'b3', 'c3', 'd3'],\n//  ]\n// ```\nexport const transpose = array => {\n  return array[0].map((_, i) => {\n    return array.map(column => column[i]);\n  });\n};\n\n// :: (tableNode: Node) -> Array\n// This function will transform the table node\n// into a matrix of rows and columns respecting merged cells,\n// for example this table will be convert to the below:\n//\n// ```\n//  ____________________________\n// |      |      |             |\n// |  A1  |  B1  |     C1      |\n// |______|______|______ ______|\n// |      |             |      |\n// |  A2  |     B2      |      |\n// |______|______ ______|      |\n// |      |      |      |  D1  |\n// |  A3  |  B3  |  C2  |      |\n// |______|______|______|______|\n// ```\n//\n//\n// ```javascript\n// array = [\n//   [A1, B1, C1, null],\n//   [A2, B2, null, D1],\n//   [A3. B3, C2, null],\n// ]\n// ```\nexport const convertTableNodeToArrayOfRows = tableNode => {\n  const map = TableMap.get(tableNode);\n  const rows = [];\n  for (let rowIndex = 0; rowIndex < map.height; rowIndex++) {\n    const rowCells = [];\n    const seen = {};\n\n    for (let colIndex = 0; colIndex < map.width; colIndex++) {\n      const cellPos = map.map[rowIndex * map.width + colIndex];\n      const cell = tableNode.nodeAt(cellPos);\n      const rect = map.findCell(cellPos);\n      if (seen[cellPos] || rect.top !== rowIndex) {\n        rowCells.push(null);\n        continue;\n      }\n      seen[cellPos] = true;\n\n      rowCells.push(cell);\n    }\n\n    rows.push(rowCells);\n  }\n\n  return rows;\n};\n\n// :: (tableNode: Node, tableArray: Array) -> Node\n// This function will transform a matrix of nodes\n// into table node respecting merged cells and rows configurations,\n// for example this array will be convert to the table below:\n//\n// ```javascript\n// array = [\n//   [A1, B1, C1, null],\n//   [A2, B2, null, D1],\n//   [A3. B3, C2, null],\n// ]\n// ```\n//\n// ```\n//  ____________________________\n// |      |      |             |\n// |  A1  |  B1  |     C1      |\n// |______|______|______ ______|\n// |      |             |      |\n// |  A2  |     B2      |      |\n// |______|______ ______|      |\n// |      |      |      |  D1  |\n// |  A3  |  B3  |  C2  |      |\n// |______|______|______|______|\n// ```\n//\nexport const convertArrayOfRowsToTableNode = (tableNode, arrayOfNodes) => {\n  const rowsPM = [];\n  const map = TableMap.get(tableNode);\n  for (let rowIndex = 0; rowIndex < map.height; rowIndex++) {\n    const row = tableNode.child(rowIndex);\n    const rowCells = [];\n\n    for (let colIndex = 0; colIndex < map.width; colIndex++) {\n      if (!arrayOfNodes[rowIndex][colIndex]) {\n        continue;\n      }\n      const cellPos = map.map[rowIndex * map.width + colIndex];\n\n      const cell = arrayOfNodes[rowIndex][colIndex];\n      const oldCell = tableNode.nodeAt(cellPos);\n      const newCell = oldCell.type.createChecked(\n        Object.assign({}, cell.attrs),\n        cell.content,\n        cell.marks\n      );\n      rowCells.push(newCell);\n    }\n\n    rowsPM.push(row.type.createChecked(row.attrs, rowCells, row.marks));\n  }\n\n  const newTable = tableNode.type.createChecked(\n    tableNode.attrs,\n    rowsPM,\n    tableNode.marks\n  );\n\n  return newTable;\n};\n\nexport const moveTableColumn = (\n  table,\n  indexesOrigin,\n  indexesTarget,\n  direction\n) => {\n  let rows = transpose(convertTableNodeToArrayOfRows(table.node));\n\n  rows = moveRowInArrayOfRows(rows, indexesOrigin, indexesTarget, direction);\n  rows = transpose(rows);\n\n  return convertArrayOfRowsToTableNode(table.node, rows);\n};\n\nexport const moveTableRow = (\n  table,\n  indexesOrigin,\n  indexesTarget,\n  direction\n) => {\n  let rows = convertTableNodeToArrayOfRows(table.node);\n\n  rows = moveRowInArrayOfRows(rows, indexesOrigin, indexesTarget, direction);\n\n  return convertArrayOfRowsToTableNode(table.node, rows);\n};\n\nconst moveRowInArrayOfRows = (\n  rows,\n  indexesOrigin,\n  indexesTarget,\n  directionOverride\n) => {\n  let direction = indexesOrigin[0] > indexesTarget[0] ? -1 : 1;\n\n  const rowsExtracted = rows.splice(indexesOrigin[0], indexesOrigin.length);\n  const positionOffset = rowsExtracted.length % 2 === 0 ? 1 : 0;\n  let target;\n\n  if (directionOverride === -1 && direction === 1) {\n    target = indexesTarget[0] - 1;\n  } else if (directionOverride === 1 && direction === -1) {\n    target = indexesTarget[indexesTarget.length - 1] - positionOffset + 1;\n  } else {\n    target =\n      direction === -1\n        ? indexesTarget[0]\n        : indexesTarget[indexesTarget.length - 1] - positionOffset;\n  }\n\n  rows.splice.apply(rows, [target, 0].concat(rowsExtracted));\n  return rows;\n};\n\nexport const checkInvalidMovements = (\n  originIndex,\n  targetIndex,\n  targets,\n  type\n) => {\n  const direction = originIndex > targetIndex ? -1 : 1;\n  const errorMessage = `Target position is invalid, you can't move the ${type} ${originIndex} to ${targetIndex}, the target can't be split. You could use tryToFit option.`;\n\n  if (direction === 1) {\n    if (targets.slice(0, targets.length - 1).indexOf(targetIndex) !== -1) {\n      throw new Error(errorMessage);\n    }\n  } else {\n    if (targets.slice(1).indexOf(targetIndex) !== -1) {\n      throw new Error(errorMessage);\n    }\n  }\n\n  return true;\n};\n","import { Selection } from 'prosemirror-state';\nimport { equalNodeType, isNodeSelection } from './helpers';\n\n// :: (predicate: (node: ProseMirrorNode) → boolean) → (selection: Selection) → ?{pos: number, start: number, depth: number, node: ProseMirrorNode}\n// Iterates over parent nodes, returning the closest node and its start position `predicate` returns truthy for. `start` points to the start position of the node, `pos` points directly before the node.\n//\n// ```javascript\n// const predicate = node => node.type === schema.nodes.blockquote;\n// const parent = findParentNode(predicate)(selection);\n// ```\nexport const findParentNode = predicate => ({ $from }) =>\n  findParentNodeClosestToPos($from, predicate);\n\n// :: ($pos: ResolvedPos, predicate: (node: ProseMirrorNode) → boolean) → ?{pos: number, start: number, depth: number, node: ProseMirrorNode}\n// Iterates over parent nodes starting from the given `$pos`, returning the closest node and its start position `predicate` returns truthy for. `start` points to the start position of the node, `pos` points directly before the node.\n//\n// ```javascript\n// const predicate = node => node.type === schema.nodes.blockquote;\n// const parent = findParentNodeClosestToPos(state.doc.resolve(5), predicate);\n// ```\nexport const findParentNodeClosestToPos = ($pos, predicate) => {\n  for (let i = $pos.depth; i > 0; i--) {\n    const node = $pos.node(i);\n    if (predicate(node)) {\n      return {\n        pos: i > 0 ? $pos.before(i) : 0,\n        start: $pos.start(i),\n        depth: i,\n        node\n      };\n    }\n  }\n};\n\n// :: (predicate: (node: ProseMirrorNode) → boolean, domAtPos: (pos: number) → {node: dom.Node, offset: number}) → (selection: Selection) → ?dom.Node\n// Iterates over parent nodes, returning DOM reference of the closest node `predicate` returns truthy for.\n//\n// ```javascript\n// const domAtPos = view.domAtPos.bind(view);\n// const predicate = node => node.type === schema.nodes.table;\n// const parent = findParentDomRef(predicate, domAtPos)(selection); // 
\n// ```\nexport const findParentDomRef = (predicate, domAtPos) => selection => {\n const parent = findParentNode(predicate)(selection);\n if (parent) {\n return findDomRefAtPos(parent.pos, domAtPos);\n }\n};\n\n// :: (predicate: (node: ProseMirrorNode) → boolean) → (selection: Selection) → boolean\n// Checks if there's a parent node `predicate` returns truthy for.\n//\n// ```javascript\n// if (hasParentNode(node => node.type === schema.nodes.table)(selection)) {\n// // ....\n// }\n// ```\nexport const hasParentNode = predicate => selection => {\n return !!findParentNode(predicate)(selection);\n};\n\n// :: (nodeType: union) → (selection: Selection) → ?{pos: number, start: number, depth: number, node: ProseMirrorNode}\n// Iterates over parent nodes, returning closest node of a given `nodeType`. `start` points to the start position of the node, `pos` points directly before the node.\n//\n// ```javascript\n// const parent = findParentNodeOfType(schema.nodes.paragraph)(selection);\n// ```\nexport const findParentNodeOfType = nodeType => selection => {\n return findParentNode(node => equalNodeType(nodeType, node))(selection);\n};\n\n// :: ($pos: ResolvedPos, nodeType: union) → ?{pos: number, start: number, depth: number, node: ProseMirrorNode}\n// Iterates over parent nodes starting from the given `$pos`, returning closest node of a given `nodeType`. `start` points to the start position of the node, `pos` points directly before the node.\n//\n// ```javascript\n// const parent = findParentNodeOfTypeClosestToPos(state.doc.resolve(10), schema.nodes.paragraph);\n// ```\nexport const findParentNodeOfTypeClosestToPos = ($pos, nodeType) => {\n return findParentNodeClosestToPos($pos, node =>\n equalNodeType(nodeType, node)\n );\n};\n\n// :: (nodeType: union) → (selection: Selection) → boolean\n// Checks if there's a parent node of a given `nodeType`.\n//\n// ```javascript\n// if (hasParentNodeOfType(schema.nodes.table)(selection)) {\n// // ....\n// }\n// ```\nexport const hasParentNodeOfType = nodeType => selection => {\n return hasParentNode(node => equalNodeType(nodeType, node))(selection);\n};\n\n// :: (nodeType: union, domAtPos: (pos: number) → {node: dom.Node, offset: number}) → (selection: Selection) → ?dom.Node\n// Iterates over parent nodes, returning DOM reference of the closest node of a given `nodeType`.\n//\n// ```javascript\n// const domAtPos = view.domAtPos.bind(view);\n// const parent = findParentDomRefOfType(schema.nodes.codeBlock, domAtPos)(selection); //
\n// ```\nexport const findParentDomRefOfType = (nodeType, domAtPos) => selection => {\n  return findParentDomRef(node => equalNodeType(nodeType, node), domAtPos)(\n    selection\n  );\n};\n\n// :: (nodeType: union) → (selection: Selection) → ?{pos: number, start: number, depth: number, node: ProseMirrorNode}\n// Returns a node of a given `nodeType` if it is selected. `start` points to the start position of the node, `pos` points directly before the node.\n//\n// ```javascript\n// const { extension, inlineExtension, bodiedExtension } = schema.nodes;\n// const selectedNode = findSelectedNodeOfType([\n//   extension,\n//   inlineExtension,\n//   bodiedExtension,\n// ])(selection);\n// ```\nexport const findSelectedNodeOfType = nodeType => selection => {\n  if (isNodeSelection(selection)) {\n    const { node, $from } = selection;\n    if (equalNodeType(nodeType, node)) {\n      return { node, pos: $from.pos, depth: $from.depth };\n    }\n  }\n};\n\n// :: (selection: Selection) → ?number\n// Returns position of the previous node.\n//\n// ```javascript\n// const pos = findPositionOfNodeBefore(tr.selection);\n// ```\nexport const findPositionOfNodeBefore = selection => {\n  const { nodeBefore } = selection.$from;\n  const maybeSelection = Selection.findFrom(selection.$from, -1);\n  if (maybeSelection && nodeBefore) {\n    // leaf node\n    const parent = findParentNodeOfType(nodeBefore.type)(maybeSelection);\n    if (parent) {\n      return parent.pos;\n    }\n    return maybeSelection.$from.pos;\n  }\n};\n\n// :: (position: number, domAtPos: (pos: number) → {node: dom.Node, offset: number}) → dom.Node\n// Returns DOM reference of a node at a given `position`. If the node type is of type `TEXT_NODE` it will return the reference of the parent node.\n//\n// ```javascript\n// const domAtPos = view.domAtPos.bind(view);\n// const ref = findDomRefAtPos($from.pos, domAtPos);\n// ```\nexport const findDomRefAtPos = (position, domAtPos) => {\n  const dom = domAtPos(position);\n  const node = dom.node.childNodes[dom.offset];\n\n  if (dom.node.nodeType === Node.TEXT_NODE) {\n    return dom.node.parentNode;\n  }\n\n  if (!node || node.nodeType === Node.TEXT_NODE) {\n    return dom.node;\n  }\n\n  return node;\n};\n","// :: (node: ProseMirrorNode, descend: ?boolean) → [{ node: ProseMirrorNode, pos: number }]\n// Flattens descendants of a given `node`. It doesn't descend into a node when descend argument is `false` (defaults to `true`).\n//\n// ```javascript\n// const children = flatten(node);\n// ```\nexport const flatten = (node, descend = true) => {\n  if (!node) {\n    throw new Error('Invalid \"node\" parameter');\n  }\n  const result = [];\n  node.descendants((child, pos) => {\n    result.push({ node: child, pos });\n    if (!descend) {\n      return false;\n    }\n  });\n  return result;\n};\n\n// :: (node: ProseMirrorNode, predicate: (node: ProseMirrorNode) → boolean, descend: ?boolean) → [{ node: ProseMirrorNode, pos: number }]\n// Iterates over descendants of a given `node`, returning child nodes predicate returns truthy for. It doesn't descend into a node when descend argument is `false` (defaults to `true`).\n//\n// ```javascript\n// const textNodes = findChildren(node, child => child.isText, false);\n// ```\nexport const findChildren = (node, predicate, descend) => {\n  if (!node) {\n    throw new Error('Invalid \"node\" parameter');\n  } else if (!predicate) {\n    throw new Error('Invalid \"predicate\" parameter');\n  }\n  return flatten(node, descend).filter(child => predicate(child.node));\n};\n\n// :: (node: ProseMirrorNode, descend: ?boolean) → [{ node: ProseMirrorNode, pos: number }]\n// Returns text nodes of a given `node`. It doesn't descend into a node when descend argument is `false` (defaults to `true`).\n//\n// ```javascript\n// const textNodes = findTextNodes(node);\n// ```\nexport const findTextNodes = (node, descend) => {\n  return findChildren(node, child => child.isText, descend);\n};\n\n// :: (node: ProseMirrorNode, descend: ?boolean) → [{ node: ProseMirrorNode, pos: number }]\n// Returns inline nodes of a given `node`. It doesn't descend into a node when descend argument is `false` (defaults to `true`).\n//\n// ```javascript\n// const inlineNodes = findInlineNodes(node);\n// ```\nexport const findInlineNodes = (node, descend) => {\n  return findChildren(node, child => child.isInline, descend);\n};\n\n// :: (node: ProseMirrorNode, descend: ?boolean) → [{ node: ProseMirrorNode, pos: number }]\n// Returns block descendants of a given `node`. It doesn't descend into a node when descend argument is `false` (defaults to `true`).\n//\n// ```javascript\n// const blockNodes = findBlockNodes(node);\n// ```\nexport const findBlockNodes = (node, descend) => {\n  return findChildren(node, child => child.isBlock, descend);\n};\n\n// :: (node: ProseMirrorNode, predicate: (attrs: ?Object) → boolean, descend: ?boolean) → [{ node: ProseMirrorNode, pos: number }]\n// Iterates over descendants of a given `node`, returning child nodes predicate returns truthy for. It doesn't descend into a node when descend argument is `false` (defaults to `true`).\n//\n// ```javascript\n// const mergedCells = findChildrenByAttr(table, attrs => attrs.colspan === 2);\n// ```\nexport const findChildrenByAttr = (node, predicate, descend) => {\n  return findChildren(node, child => !!predicate(child.attrs), descend);\n};\n\n// :: (node: ProseMirrorNode, nodeType: NodeType, descend: ?boolean) → [{ node: ProseMirrorNode, pos: number }]\n// Iterates over descendants of a given `node`, returning child nodes of a given nodeType. It doesn't descend into a node when descend argument is `false` (defaults to `true`).\n//\n// ```javascript\n// const cells = findChildrenByType(table, schema.nodes.tableCell);\n// ```\nexport const findChildrenByType = (node, nodeType, descend) => {\n  return findChildren(node, child => child.type === nodeType, descend);\n};\n\n// :: (node: ProseMirrorNode, markType: markType, descend: ?boolean) → [{ node: ProseMirrorNode, pos: number }]\n// Iterates over descendants of a given `node`, returning child nodes that have a mark of a given markType. It doesn't descend into a `node` when descend argument is `false` (defaults to `true`).\n//\n// ```javascript\n// const nodes = findChildrenByMark(state.doc, schema.marks.strong);\n// ```\nexport const findChildrenByMark = (node, markType, descend) => {\n  return findChildren(node, child => markType.isInSet(child.marks), descend);\n};\n\n// :: (node: ProseMirrorNode, nodeType: NodeType) → boolean\n// Returns `true` if a given node contains nodes of a given `nodeType`\n//\n// ```javascript\n// if (contains(panel, schema.nodes.listItem)) {\n//   // ...\n// }\n// ```\nexport const contains = (node, nodeType) => {\n  return !!findChildrenByType(node, nodeType).length;\n};\n","import {\n  CellSelection,\n  TableMap,\n  addColumn,\n  addRow,\n  removeColumn,\n  removeRow\n} from 'prosemirror-tables';\nimport { Selection } from 'prosemirror-state';\nimport { findParentNode, findParentNodeClosestToPos } from './selection';\nimport { setTextSelection, safeInsert } from './transforms';\nimport {\n  cloneTr,\n  tableNodeTypes,\n  findTableClosestToPos,\n  createCell,\n  isRectSelected,\n  moveTableRow,\n  moveTableColumn,\n  checkInvalidMovements\n} from './helpers';\n\n// :: (selection: Selection) → ?{pos: number, start: number, node: ProseMirrorNode}\n// Iterates over parent nodes, returning the closest table node.\n//\n// ```javascript\n// const table = findTable(selection);\n// ```\nexport const findTable = selection =>\n  findParentNode(\n    node => node.type.spec.tableRole && node.type.spec.tableRole === 'table'\n  )(selection);\n\n// :: (selection: Selection) → boolean\n// Checks if current selection is a `CellSelection`.\n//\n// ```javascript\n// if (isCellSelection(selection)) {\n//   // ...\n// }\n// ```\nexport const isCellSelection = selection => {\n  return selection instanceof CellSelection;\n};\n\n// :: (selection: Selection) → ?{left: number, right: number, top: number, bottom: number}\n// Get the selection rectangle. Returns `undefined` if selection is not a CellSelection.\n//\n// ```javascript\n// const rect = getSelectionRect(selection);\n// ```\nexport const getSelectionRect = selection => {\n  if (!isCellSelection(selection)) {\n    return;\n  }\n  const start = selection.$anchorCell.start(-1);\n  const map = TableMap.get(selection.$anchorCell.node(-1));\n  return map.rectBetween(\n    selection.$anchorCell.pos - start,\n    selection.$headCell.pos - start\n  );\n};\n\n// :: (columnIndex: number) → (selection: Selection) → boolean\n// Checks if entire column at index `columnIndex` is selected.\n//\n// ```javascript\n// const className = isColumnSelected(i)(selection) ? 'selected' : '';\n// ```\nexport const isColumnSelected = columnIndex => selection => {\n  if (isCellSelection(selection)) {\n    const map = TableMap.get(selection.$anchorCell.node(-1));\n    return isRectSelected({\n      left: columnIndex,\n      right: columnIndex + 1,\n      top: 0,\n      bottom: map.height\n    })(selection);\n  }\n\n  return false;\n};\n\n// :: (rowIndex: number) → (selection: Selection) → boolean\n// Checks if entire row at index `rowIndex` is selected.\n//\n// ```javascript\n// const className = isRowSelected(i)(selection) ? 'selected' : '';\n// ```\nexport const isRowSelected = rowIndex => selection => {\n  if (isCellSelection(selection)) {\n    const map = TableMap.get(selection.$anchorCell.node(-1));\n    return isRectSelected({\n      left: 0,\n      right: map.width,\n      top: rowIndex,\n      bottom: rowIndex + 1\n    })(selection);\n  }\n\n  return false;\n};\n\n// :: (selection: Selection) → boolean\n// Checks if entire table is selected\n//\n// ```javascript\n// const className = isTableSelected(selection) ? 'selected' : '';\n// ```\nexport const isTableSelected = selection => {\n  if (isCellSelection(selection)) {\n    const map = TableMap.get(selection.$anchorCell.node(-1));\n    return isRectSelected({\n      left: 0,\n      right: map.width,\n      top: 0,\n      bottom: map.height\n    })(selection);\n  }\n\n  return false;\n};\n\n// :: (columnIndex: union) → (selection: Selection) → ?[{pos: number, start: number, node: ProseMirrorNode}]\n// Returns an array of cells in a column(s), where `columnIndex` could be a column index or an array of column indexes.\n//\n// ```javascript\n// const cells = getCellsInColumn(i)(selection); // [{node, pos}, {node, pos}]\n// ```\nexport const getCellsInColumn = columnIndex => selection => {\n  const table = findTable(selection);\n  if (table) {\n    const map = TableMap.get(table.node);\n    const indexes = Array.isArray(columnIndex)\n      ? columnIndex\n      : Array.from([columnIndex]);\n    return indexes.reduce((acc, index) => {\n      if (index >= 0 && index <= map.width - 1) {\n        const cells = map.cellsInRect({\n          left: index,\n          right: index + 1,\n          top: 0,\n          bottom: map.height\n        });\n        return acc.concat(\n          cells.map(nodePos => {\n            const node = table.node.nodeAt(nodePos);\n            const pos = nodePos + table.start;\n            return { pos, start: pos + 1, node };\n          })\n        );\n      }\n    }, []);\n  }\n};\n\n// :: (rowIndex: union) → (selection: Selection) → ?[{pos: number, start: number, node: ProseMirrorNode}]\n// Returns an array of cells in a row(s), where `rowIndex` could be a row index or an array of row indexes.\n//\n// ```javascript\n// const cells = getCellsInRow(i)(selection); // [{node, pos}, {node, pos}]\n// ```\nexport const getCellsInRow = rowIndex => selection => {\n  const table = findTable(selection);\n  if (table) {\n    const map = TableMap.get(table.node);\n    const indexes = Array.isArray(rowIndex) ? rowIndex : Array.from([rowIndex]);\n    return indexes.reduce((acc, index) => {\n      if (index >= 0 && index <= map.height - 1) {\n        const cells = map.cellsInRect({\n          left: 0,\n          right: map.width,\n          top: index,\n          bottom: index + 1\n        });\n        return acc.concat(\n          cells.map(nodePos => {\n            const node = table.node.nodeAt(nodePos);\n            const pos = nodePos + table.start;\n            return { pos, start: pos + 1, node };\n          })\n        );\n      }\n    }, []);\n  }\n};\n\n// :: (selection: Selection) → ?[{pos: number, start: number, node: ProseMirrorNode}]\n// Returns an array of all cells in a table.\n//\n// ```javascript\n// const cells = getCellsInTable(selection); // [{node, pos}, {node, pos}]\n// ```\nexport const getCellsInTable = selection => {\n  const table = findTable(selection);\n  if (table) {\n    const map = TableMap.get(table.node);\n    const cells = map.cellsInRect({\n      left: 0,\n      right: map.width,\n      top: 0,\n      bottom: map.height\n    });\n    return cells.map(nodePos => {\n      const node = table.node.nodeAt(nodePos);\n      const pos = nodePos + table.start;\n      return { pos, start: pos + 1, node };\n    });\n  }\n};\n\nconst select = type => (index, expand) => tr => {\n  const table = findTable(tr.selection);\n  const isRowSelection = type === 'row';\n  if (table) {\n    const map = TableMap.get(table.node);\n\n    // Check if the index is valid\n    if (index >= 0 && index < (isRowSelection ? map.height : map.width)) {\n      let left = isRowSelection ? 0 : index;\n      let top = isRowSelection ? index : 0;\n      let right = isRowSelection ? map.width : index + 1;\n      let bottom = isRowSelection ? index + 1 : map.height;\n\n      if (expand) {\n        const cell = findCellClosestToPos(tr.selection.$from);\n        if (!cell) {\n          return tr;\n        }\n\n        const selRect = map.findCell(cell.pos - table.start);\n        if (isRowSelection) {\n          top = Math.min(top, selRect.top);\n          bottom = Math.max(bottom, selRect.bottom);\n        } else {\n          left = Math.min(left, selRect.left);\n          right = Math.max(right, selRect.right);\n        }\n      }\n\n      const cellsInFirstRow = map.cellsInRect({\n        left,\n        top,\n        right: isRowSelection ? right : left + 1,\n        bottom: isRowSelection ? top + 1 : bottom\n      });\n\n      const cellsInLastRow =\n        bottom - top === 1\n          ? cellsInFirstRow\n          : map.cellsInRect({\n              left: isRowSelection ? left : right - 1,\n              top: isRowSelection ? bottom - 1 : top,\n              right,\n              bottom\n            });\n\n      const head = table.start + cellsInFirstRow[0];\n      const anchor = table.start + cellsInLastRow[cellsInLastRow.length - 1];\n      const $head = tr.doc.resolve(head);\n      const $anchor = tr.doc.resolve(anchor);\n\n      return cloneTr(tr.setSelection(new CellSelection($anchor, $head)));\n    }\n  }\n  return tr;\n};\n\n// :: (columnIndex: number, expand: ?boolean) → (tr: Transaction) → Transaction\n// Returns a new transaction that creates a `CellSelection` on a column at index `columnIndex`.\n// Use the optional `expand` param to extend from current selection.\n//\n// ```javascript\n// dispatch(\n//   selectColumn(i)(state.tr)\n// );\n// ```\nexport const selectColumn = select('column');\n\n// :: (rowIndex: number, expand: ?boolean) → (tr: Transaction) → Transaction\n// Returns a new transaction that creates a `CellSelection` on a column at index `rowIndex`.\n// Use the optional `expand` param to extend from current selection.\n//\n// ```javascript\n// dispatch(\n//   selectRow(i)(state.tr)\n// );\n// ```\nexport const selectRow = select('row');\n\n// :: (selection: Selection) → (tr: Transaction) → Transaction\n// Returns a new transaction that creates a `CellSelection` on the entire table.\n//\n// ```javascript\n// dispatch(\n//   selectTable(i)(state.tr)\n// );\n// ```\nexport const selectTable = tr => {\n  const table = findTable(tr.selection);\n  if (table) {\n    const { map } = TableMap.get(table.node);\n    if (map && map.length) {\n      const head = table.start + map[0];\n      const anchor = table.start + map[map.length - 1];\n      const $head = tr.doc.resolve(head);\n      const $anchor = tr.doc.resolve(anchor);\n\n      return cloneTr(tr.setSelection(new CellSelection($anchor, $head)));\n    }\n  }\n  return tr;\n};\n\n// :: (cell: {pos: number, node: ProseMirrorNode}, schema: Schema) → (tr: Transaction) → Transaction\n// Returns a new transaction that clears the content of a given `cell`.\n//\n// ```javascript\n// const $pos = state.doc.resolve(13);\n// dispatch(\n//   emptyCell(findCellClosestToPos($pos), state.schema)(state.tr)\n// );\n// ```\nexport const emptyCell = (cell, schema) => tr => {\n  if (cell) {\n    const { content } = tableNodeTypes(schema).cell.createAndFill();\n    if (!cell.node.content.eq(content)) {\n      tr.replaceWith(cell.pos + 1, cell.pos + cell.node.nodeSize, content);\n      return cloneTr(tr);\n    }\n  }\n  return tr;\n};\n\n// :: (columnIndex: number) → (tr: Transaction) → Transaction\n// Returns a new transaction that adds a new column at index `columnIndex`.\n//\n// ```javascript\n// dispatch(\n//   addColumnAt(i)(state.tr)\n// );\n// ```\nexport const addColumnAt = columnIndex => tr => {\n  const table = findTable(tr.selection);\n  if (table) {\n    const map = TableMap.get(table.node);\n    if (columnIndex >= 0 && columnIndex <= map.width) {\n      return cloneTr(\n        addColumn(\n          tr,\n          {\n            map,\n            tableStart: table.start,\n            table: table.node\n          },\n          columnIndex\n        )\n      );\n    }\n  }\n  return tr;\n};\n\n// :: (originRowIndex: number, targetRowIndex: targetColumnIndex, options?: MovementOptions) → (tr: Transaction) → Transaction\n// Returns a new transaction that moves the origin row to the target index;\n//\n// by default \"tryToFit\" is false, that means if you try to move a row to a place\n// where we will need to split a row with merged cells it'll throw an exception, for example:\n//\n// ```\n//      ____________________________\n//     |      |      |             |\n//  0  |  A1  |  B1  |     C1      |\n//     |______|______|______ ______|\n//     |      |             |      |\n//  1  |  A2  |     B2      |      |\n//     |______|______ ______|      |\n//     |      |      |      |  D1  |\n//  2  |  A3  |  B3  |  C2  |      |\n//     |______|______|______|______|\n// ```\n//\n// if you try to move the row 0 to the row index 1 with tryToFit false,\n// it'll throw an exception since you can't split the row 1;\n// but if \"tryToFit\" is true, it'll move the row using the current direction.\n//\n// We defined current direction using the target and origin values\n// if the origin is greater than the target, that means the course is `bottom-to-top`,\n// so the `tryToFit` logic will use this direction to determine\n// if we should move the column to the right or the left.\n//\n// for example, if you call the function using `moveRow(0, 1, { tryToFit: true })`\n// the result will be:\n// ```\n//      ____________________________\n//     |      |             |      |\n//  0  |  A2  |     B2      |      |\n//     |______|______ ______|      |\n//     |      |      |      |  D1  |\n//  1  |  A3  |  B3  |  C2  |      |\n//     |______|______|______|______|\n//     |      |      |             |\n//  2  |  A1  |  B1  |     C1      |\n//     |______|______|______ ______|\n// ```\n//\n// since we could put the row zero on index one,\n// we pushed to the best place to fit the row index 0,\n// in this case, row index 2.\n//\n//\n// -------- HOW TO OVERRIDE DIRECTION --------\n//\n// If you set \"tryToFit\" to \"true\", it will try to figure out the best direction\n// place to fit using the origin and target index, for example:\n//\n//\n// ```\n//      ____________________________\n//     |      |      |             |\n//  0  |  A1  |  B1  |     C1      |\n//     |______|______|______ ______|\n//     |      |             |      |\n//  1  |  A2  |     B2      |      |\n//     |______|______ ______|      |\n//     |      |      |      |  D1  |\n//  2  |  A3  |  B3  |  C2  |      |\n//     |______|______|______|______|\n//     |      |             |      |\n//  3  |  A4  |     B4      |      |\n//     |______|______ ______|      |\n//     |      |      |      |  D2  |\n//  4  |  A5  |  B5  |  C3  |      |\n//     |______|______|______|______|\n// ```\n//\n//\n// If you try to move the row 0 to row index 4 with \"tryToFit\" enabled, by default,\n// the code will put it on after the merged rows,\n// but you can override it using the \"direction\" option.\n//\n// -1: Always put the origin before the target\n// ```\n//      ____________________________\n//     |      |             |      |\n//  0  |  A2  |     B2      |      |\n//     |______|______ ______|      |\n//     |      |      |      |  D1  |\n//  1  |  A3  |  B3  |  C2  |      |\n//     |______|______|______|______|\n//     |      |      |             |\n//  2  |  A1  |  B1  |     C1      |\n//     |______|______|______ ______|\n//     |      |             |      |\n//  3  |  A4  |     B4      |      |\n//     |______|______ ______|      |\n//     |      |      |      |  D2  |\n//  4  |  A5  |  B5  |  C3  |      |\n//     |______|______|______|______|\n// ```\n//\n//  0: Automatically decide the best place to fit\n// ```\n//      ____________________________\n//     |      |             |      |\n//  0  |  A2  |     B2      |      |\n//     |______|______ ______|      |\n//     |      |      |      |  D1  |\n//  1  |  A3  |  B3  |  C2  |      |\n//     |______|______|______|______|\n//     |      |             |      |\n//  2  |  A4  |     B4      |      |\n//     |______|______ ______|      |\n//     |      |      |      |  D2  |\n//  3  |  A5  |  B5  |  C3  |      |\n//     |______|______|______|______|\n//     |      |      |             |\n//  4  |  A1  |  B1  |     C1      |\n//     |______|______|______ ______|\n// ```\n//\n//  1: Always put the origin after the target\n// ```\n//      ____________________________\n//     |      |             |      |\n//  0  |  A2  |     B2      |      |\n//     |______|______ ______|      |\n//     |      |      |      |  D1  |\n//  1  |  A3  |  B3  |  C2  |      |\n//     |______|______|______|______|\n//     |      |             |      |\n//  2  |  A4  |     B4      |      |\n//     |______|______ ______|      |\n//     |      |      |      |  D2  |\n//  3  |  A5  |  B5  |  C3  |      |\n//     |______|______|______|______|\n//     |      |      |             |\n//  4  |  A1  |  B1  |     C1      |\n//     |______|______|______ ______|\n// ```\n//\n// ```javascript\n// dispatch(\n//   moveRow(x, y, options)(state.tr)\n// );\n// ```\nexport const moveRow = (originRowIndex, targetRowIndex, opts) => tr => {\n  const defaultOptions = { tryToFit: false, direction: 0 };\n  const options = Object.assign(defaultOptions, opts);\n  const table = findTable(tr.selection);\n  if (!table) {\n    return tr;\n  }\n\n  const { indexes: indexesOriginRow } = getSelectionRangeInRow(originRowIndex)(\n    tr\n  );\n  const { indexes: indexesTargetRow } = getSelectionRangeInRow(targetRowIndex)(\n    tr\n  );\n\n  if (indexesOriginRow.indexOf(targetRowIndex) > -1) {\n    return tr;\n  }\n\n  if (!options.tryToFit && indexesTargetRow.length > 1) {\n    checkInvalidMovements(\n      originRowIndex,\n      targetRowIndex,\n      indexesTargetRow,\n      'row'\n    );\n  }\n\n  const newTable = moveTableRow(\n    table,\n    indexesOriginRow,\n    indexesTargetRow,\n    options.direction\n  );\n\n  return cloneTr(tr).replaceWith(\n    table.pos,\n    table.pos + table.node.nodeSize,\n    newTable\n  );\n};\n\n// :: (originColumnIndex: number, targetColumnIndex: targetColumnIndex, options?: MovementOptions) → (tr: Transaction) → Transaction\n// Returns a new transaction that moves the origin column to the target index;\n//\n// by default \"tryToFit\" is false, that means if you try to move a column to a place\n// where we will need to split a column with merged cells it'll throw an exception, for example:\n//\n// ```\n//    0      1         2\n//  ____________________________\n// |      |      |             |\n// |  A1  |  B1  |     C1      |\n// |______|______|______ ______|\n// |      |             |      |\n// |  A2  |     B2      |      |\n// |______|______ ______|      |\n// |      |      |      |  D1  |\n// |  A3  |  B3  |  C2  |      |\n// |______|______|______|______|\n// ```\n//\n//\n// if you try to move the column 0 to the column index 1 with tryToFit false,\n// it'll throw an exception since you can't split the column 1;\n// but if \"tryToFit\" is true, it'll move the column using the current direction.\n//\n// We defined current direction using the target and origin values\n// if the origin is greater than the target, that means the course is `right-to-left`,\n// so the `tryToFit` logic will use this direction to determine\n// if we should move the column to the right or the left.\n//\n// for example, if you call the function using `moveColumn(0, 1, { tryToFit: true })`\n// the result will be:\n//\n// ```\n//    0       1             2\n// _____________________ _______\n// |      |             |      |\n// |  B1  |     C1      |  A1  |\n// |______|______ ______|______|\n// |             |      |      |\n// |     B2      |      |  A2  |\n// |______ ______|      |______|\n// |      |      |  D1  |      |\n// |  B3  |  C2  |      |  A3  |\n// |______|______|______|______|\n// ```\n//\n// since we could put the column zero on index one,\n// we pushed to the best place to fit the column 0, in this case, column index 2.\n//\n// -------- HOW TO OVERRIDE DIRECTION --------\n//\n// If you set \"tryToFit\" to \"true\", it will try to figure out the best direction\n// place to fit using the origin and target index, for example:\n//\n//\n// ```\n//     0      1       2     3      4      5       6\n//   _________________________________________________\n//  |      |      |             |      |             |\n//  |  A1  |  B1  |     C1      |  E1  |     F1      |\n//  |______|______|______ ______|______|______ ______|\n//  |      |             |      |             |      |\n//  |  A2  |     B2      |      |     E2      |      |\n//  |______|______ ______|      |______ ______|      |\n//  |      |      |      |  D1  |      |      |  G2  |\n//  |  A3  |  B3  |  C3  |      |  E3  |  F3  |      |\n//  |______|______|______|______|______|______|______|\n// ```\n//\n//\n// If you try to move the column 0 to column index 5 with \"tryToFit\" enabled, by default,\n// the code will put it on after the merged columns,\n// but you can override it using the \"direction\" option.\n//\n// -1: Always put the origin before the target\n//\n// ```\n//     0      1       2     3      4      5       6\n//   _________________________________________________\n//  |      |             |      |      |             |\n//  |  B1  |     C1      |  A1  |  E1  |     F1      |\n//  |______|______ ______|______|______|______ ______|\n//  |             |      |      |             |      |\n//  |     B2      |      |  A2  |     E2      |      |\n//  |______ ______|      |______|______ ______|      |\n//  |      |      |  D1  |      |      |      |  G2  |\n//  |  B3  |  C3  |      |  A3  |  E3  |  F3  |      |\n//  |______|______|______|______|______|______|______|\n// ```\n//\n//  0: Automatically decide the best place to fit\n//\n// ```\n//     0      1       2     3      4      5       6\n//   _________________________________________________\n//  |      |             |      |             |      |\n//  |  B1  |     C1      |  E1  |     F1      |  A1  |\n//  |______|______ ______|______|______ ______|______|\n//  |             |      |             |      |      |\n//  |     B2      |      |     E2      |      |  A2  |\n//  |______ ______|      |______ ______|      |______|\n//  |      |      |  D1  |      |      |  G2  |      |\n//  |  B3  |  C3  |      |  E3  |  F3  |      |  A3  |\n//  |______|______|______|______|______|______|______|\n// ```\n//\n//  1: Always put the origin after the target\n//\n// ```\n//     0      1       2     3      4      5       6\n//   _________________________________________________\n//  |      |             |      |             |      |\n//  |  B1  |     C1      |  E1  |     F1      |  A1  |\n//  |______|______ ______|______|______ ______|______|\n//  |             |      |             |      |      |\n//  |     B2      |      |     E2      |      |  A2  |\n//  |______ ______|      |______ ______|      |______|\n//  |      |      |  D1  |      |      |  G2  |      |\n//  |  B3  |  C3  |      |  E3  |  F3  |      |  A3  |\n//  |______|______|______|______|______|______|______|\n// ```\n//\n// ```javascript\n// dispatch(\n//   moveColumn(x, y, options)(state.tr)\n// );\n// ```\nexport const moveColumn = (\n  originColumnIndex,\n  targetColumnIndex,\n  opts\n) => tr => {\n  const defaultOptions = { tryToFit: false, direction: 0 };\n  const options = Object.assign(defaultOptions, opts);\n  const table = findTable(tr.selection);\n  if (!table) {\n    return tr;\n  }\n\n  const { indexes: indexesOriginColumn } = getSelectionRangeInColumn(\n    originColumnIndex\n  )(tr);\n  const { indexes: indexesTargetColumn } = getSelectionRangeInColumn(\n    targetColumnIndex\n  )(tr);\n\n  if (indexesOriginColumn.indexOf(targetColumnIndex) > -1) {\n    return tr;\n  }\n\n  if (!options.tryToFit && indexesTargetColumn.length > 1) {\n    checkInvalidMovements(\n      originColumnIndex,\n      targetColumnIndex,\n      indexesTargetColumn,\n      'column'\n    );\n  }\n\n  const newTable = moveTableColumn(\n    table,\n    indexesOriginColumn,\n    indexesTargetColumn,\n    options.direction\n  );\n\n  return cloneTr(tr).replaceWith(\n    table.pos,\n    table.pos + table.node.nodeSize,\n    newTable\n  );\n};\n\n// :: (rowIndex: number, clonePreviousRow?: boolean) → (tr: Transaction) → Transaction\n// Returns a new transaction that adds a new row at index `rowIndex`. Optionally clone the previous row.\n//\n// ```javascript\n// dispatch(\n//   addRowAt(i)(state.tr)\n// );\n// ```\n//\n// ```javascript\n// dispatch(\n//   addRowAt(i, true)(state.tr)\n// );\n// ```\nexport const addRowAt = (rowIndex, clonePreviousRow) => tr => {\n  const table = findTable(tr.selection);\n  if (table) {\n    const map = TableMap.get(table.node);\n    const cloneRowIndex = rowIndex - 1;\n\n    if (clonePreviousRow && cloneRowIndex >= 0) {\n      return cloneTr(cloneRowAt(cloneRowIndex)(tr));\n    }\n\n    if (rowIndex >= 0 && rowIndex <= map.height) {\n      return cloneTr(\n        addRow(\n          tr,\n          {\n            map,\n            tableStart: table.start,\n            table: table.node\n          },\n          rowIndex\n        )\n      );\n    }\n  }\n  return tr;\n};\n\n// :: (cloneRowIndex: number) → (tr: Transaction) → Transaction\n// Returns a new transaction that adds a new row after `cloneRowIndex`, cloning the row attributes at `cloneRowIndex`.\n//\n// ```javascript\n// dispatch(\n//   cloneRowAt(i)(state.tr)\n// );\n// ```\nexport const cloneRowAt = rowIndex => tr => {\n  const table = findTable(tr.selection);\n  if (table) {\n    const map = TableMap.get(table.node);\n\n    if (rowIndex >= 0 && rowIndex <= map.height) {\n      const tableNode = table.node;\n      const tableNodes = tableNodeTypes(tableNode.type.schema);\n\n      let rowPos = table.start;\n      for (let i = 0; i < rowIndex + 1; i++) {\n        rowPos += tableNode.child(i).nodeSize;\n      }\n\n      const cloneRow = tableNode.child(rowIndex);\n      // Re-create the same nodes with same attrs, dropping the node content.\n      let cells = [];\n      let rowWidth = 0;\n      cloneRow.forEach(cell => {\n        // If we're copying a row with rowspan somewhere, we dont want to copy that cell\n        // We'll increment its span below.\n        if (cell.attrs.rowspan === 1) {\n          rowWidth += cell.attrs.colspan;\n          cells.push(\n            tableNodes[cell.type.spec.tableRole].createAndFill(\n              cell.attrs,\n              cell.marks\n            )\n          );\n        }\n      });\n\n      // If a higher row spans past our clone row, bump the higher row to cover this new row too.\n      if (rowWidth < map.width) {\n        let rowSpanCells = [];\n        for (let i = rowIndex; i >= 0; i--) {\n          let foundCells = filterCellsInRow(i, (cell, tr) => {\n            const rowspan = cell.node.attrs.rowspan;\n            const spanRange = i + rowspan;\n            return rowspan > 1 && spanRange > rowIndex;\n          })(tr);\n          rowSpanCells.push(...foundCells);\n        }\n\n        if (rowSpanCells.length) {\n          rowSpanCells.forEach(cell => {\n            tr = setCellAttrs(cell, {\n              rowspan: cell.node.attrs.rowspan + 1\n            })(tr);\n          });\n        }\n      }\n\n      return safeInsert(tableNodes.row.create(cloneRow.attrs, cells), rowPos)(\n        tr\n      );\n    }\n  }\n  return tr;\n};\n\n// :: (columnIndex: number) → (tr: Transaction) → Transaction\n// Returns a new transaction that removes a column at index `columnIndex`. If there is only one column left, it will remove the entire table.\n//\n// ```javascript\n// dispatch(\n//   removeColumnAt(i)(state.tr)\n// );\n// ```\nexport const removeColumnAt = columnIndex => tr => {\n  const table = findTable(tr.selection);\n  if (table) {\n    const map = TableMap.get(table.node);\n    if (columnIndex === 0 && map.width === 1) {\n      return removeTable(tr);\n    } else if (columnIndex >= 0 && columnIndex <= map.width) {\n      removeColumn(\n        tr,\n        {\n          map,\n          tableStart: table.start,\n          table: table.node\n        },\n        columnIndex\n      );\n      return cloneTr(tr);\n    }\n  }\n  return tr;\n};\n\n// :: (rowIndex: number) → (tr: Transaction) → Transaction\n// Returns a new transaction that removes a row at index `rowIndex`. If there is only one row left, it will remove the entire table.\n//\n// ```javascript\n// dispatch(\n//   removeRowAt(i)(state.tr)\n// );\n// ```\nexport const removeRowAt = rowIndex => tr => {\n  const table = findTable(tr.selection);\n  if (table) {\n    const map = TableMap.get(table.node);\n    if (rowIndex === 0 && map.height === 1) {\n      return removeTable(tr);\n    } else if (rowIndex >= 0 && rowIndex <= map.height) {\n      removeRow(\n        tr,\n        {\n          map,\n          tableStart: table.start,\n          table: table.node\n        },\n        rowIndex\n      );\n      return cloneTr(tr);\n    }\n  }\n  return tr;\n};\n\n// :: (tr: Transaction) → Transaction\n// Returns a new transaction that removes a table node if the cursor is inside of it.\n//\n// ```javascript\n// dispatch(\n//   removeTable(state.tr)\n// );\n// ```\nexport const removeTable = tr => {\n  const { $from } = tr.selection;\n  for (let depth = $from.depth; depth > 0; depth--) {\n    let node = $from.node(depth);\n    if (node.type.spec.tableRole === 'table') {\n      return cloneTr(tr.delete($from.before(depth), $from.after(depth)));\n    }\n  }\n  return tr;\n};\n\n// :: (tr: Transaction) → Transaction\n// Returns a new transaction that removes selected columns.\n//\n// ```javascript\n// dispatch(\n//   removeSelectedColumns(state.tr)\n// );\n// ```\nexport const removeSelectedColumns = tr => {\n  const { selection } = tr;\n  if (isTableSelected(selection)) {\n    return removeTable(tr);\n  }\n  if (isCellSelection(selection)) {\n    const table = findTable(selection);\n    if (table) {\n      const map = TableMap.get(table.node);\n      const rect = map.rectBetween(\n        selection.$anchorCell.pos - table.start,\n        selection.$headCell.pos - table.start\n      );\n\n      if (rect.left == 0 && rect.right == map.width) {\n        return false;\n      }\n\n      const pmTableRect = Object.assign({}, rect, {\n        map,\n        table: table.node,\n        tableStart: table.start\n      });\n\n      for (let i = pmTableRect.right - 1; ; i--) {\n        removeColumn(tr, pmTableRect, i);\n        if (i === pmTableRect.left) {\n          break;\n        }\n        pmTableRect.table = pmTableRect.tableStart\n          ? tr.doc.nodeAt(pmTableRect.tableStart - 1)\n          : tr.doc;\n        pmTableRect.map = TableMap.get(pmTableRect.table);\n      }\n      return cloneTr(tr);\n    }\n  }\n  return tr;\n};\n\n// :: (tr: Transaction) → Transaction\n// Returns a new transaction that removes selected rows.\n//\n// ```javascript\n// dispatch(\n//   removeSelectedRows(state.tr)\n// );\n// ```\nexport const removeSelectedRows = tr => {\n  const { selection } = tr;\n  if (isTableSelected(selection)) {\n    return removeTable(tr);\n  }\n  if (isCellSelection(selection)) {\n    const table = findTable(selection);\n    if (table) {\n      const map = TableMap.get(table.node);\n      const rect = map.rectBetween(\n        selection.$anchorCell.pos - table.start,\n        selection.$headCell.pos - table.start\n      );\n\n      if (rect.top == 0 && rect.bottom == map.height) {\n        return false;\n      }\n\n      const pmTableRect = Object.assign({}, rect, {\n        map,\n        table: table.node,\n        tableStart: table.start\n      });\n\n      for (let i = pmTableRect.bottom - 1; ; i--) {\n        removeRow(tr, pmTableRect, i);\n        if (i === pmTableRect.top) {\n          break;\n        }\n        pmTableRect.table = pmTableRect.tableStart\n          ? tr.doc.nodeAt(pmTableRect.tableStart - 1)\n          : tr.doc;\n        pmTableRect.map = TableMap.get(pmTableRect.table);\n      }\n\n      return cloneTr(tr);\n    }\n  }\n  return tr;\n};\n\n// :: ($pos: ResolvedPos) → (tr: Transaction) → Transaction\n// Returns a new transaction that removes a column closest to a given `$pos`.\n//\n// ```javascript\n// dispatch(\n//   removeColumnClosestToPos(state.doc.resolve(3))(state.tr)\n// );\n// ```\nexport const removeColumnClosestToPos = $pos => tr => {\n  const rect = findCellRectClosestToPos($pos);\n  if (rect) {\n    return removeColumnAt(rect.left)(setTextSelection($pos.pos)(tr));\n  }\n  return tr;\n};\n\n// :: ($pos: ResolvedPos) → (tr: Transaction) → Transaction\n// Returns a new transaction that removes a row closest to a given `$pos`.\n//\n// ```javascript\n// dispatch(\n//   removeRowClosestToPos(state.doc.resolve(3))(state.tr)\n// );\n// ```\nexport const removeRowClosestToPos = $pos => tr => {\n  const rect = findCellRectClosestToPos($pos);\n  if (rect) {\n    return removeRowAt(rect.top)(setTextSelection($pos.pos)(tr));\n  }\n  return tr;\n};\n\n// :: (columnIndex: number, cellTransform: (cell: {pos: number, start: number, node: ProseMirrorNode}, tr: Transaction) → Transaction, setCursorToLastCell: ?boolean) → (tr: Transaction) → Transaction\n// Returns a new transaction that maps a given `cellTransform` function to each cell in a column at a given `columnIndex`.\n// It will set the selection into the last cell of the column if `setCursorToLastCell` param is set to `true`.\n//\n// ```javascript\n// dispatch(\n//   forEachCellInColumn(0, (cell, tr) => emptyCell(cell, state.schema)(tr))(state.tr)\n// );\n// ```\nexport const forEachCellInColumn = (\n  columnIndex,\n  cellTransform,\n  setCursorToLastCell\n) => tr => {\n  const cells = getCellsInColumn(columnIndex)(tr.selection);\n  if (cells) {\n    for (let i = cells.length - 1; i >= 0; i--) {\n      tr = cellTransform(cells[i], tr);\n    }\n    if (setCursorToLastCell) {\n      const $pos = tr.doc.resolve(tr.mapping.map(cells[cells.length - 1].pos));\n      tr.setSelection(Selection.near($pos));\n    }\n    return cloneTr(tr);\n  }\n  return tr;\n};\n\n// :: (rowIndex: number, cellTransform: (cell: {pos: number, start: number, node: ProseMirrorNode}, tr: Transaction) → Transaction, setCursorToLastCell: ?boolean) → (tr: Transaction) → Transaction\n// Returns a new transaction that maps a given `cellTransform` function to each cell in a row at a given `rowIndex`.\n// It will set the selection into the last cell of the row if `setCursorToLastCell` param is set to `true`.\n//\n// ```javascript\n// dispatch(\n//   forEachCellInRow(0, (cell, tr) => setCellAttrs(cell, { background: 'red' })(tr))(state.tr)\n// );\n// ```\nexport const forEachCellInRow = (\n  rowIndex,\n  cellTransform,\n  setCursorToLastCell\n) => tr => {\n  const cells = getCellsInRow(rowIndex)(tr.selection);\n  if (cells) {\n    for (let i = cells.length - 1; i >= 0; i--) {\n      tr = cellTransform(cells[i], tr);\n    }\n    if (setCursorToLastCell) {\n      const $pos = tr.doc.resolve(tr.mapping.map(cells[cells.length - 1].pos));\n      tr.setSelection(Selection.near($pos));\n    }\n  }\n  return tr;\n};\n\n// :: (cell: {pos: number, start: number, node: ProseMirrorNode}, attrs: Object) → (tr: Transaction) → Transaction\n// Returns a new transaction that sets given `attrs` to a given `cell`.\n//\n// ```javascript\n// dispatch(\n//   setCellAttrs(findCellClosestToPos($pos), { background: 'blue' })(tr);\n// );\n// ```\nexport const setCellAttrs = (cell, attrs) => tr => {\n  if (cell) {\n    tr.setNodeMarkup(cell.pos, null, Object.assign({}, cell.node.attrs, attrs));\n    return cloneTr(tr);\n  }\n  return tr;\n};\n\n// :: (schema: Schema, rowsCount: ?number, colsCount: ?number, withHeaderRow: ?boolean, cellContent: ?Node) → Node\n// Returns a table node of a given size.\n// `withHeaderRow` defines whether the first row of the table will be a header row.\n// `cellContent` defines the content of each cell.\n//\n// ```javascript\n// const table = createTable(state.schema); // 3x3 table node\n// dispatch(\n//   tr.replaceSelectionWith(table).scrollIntoView()\n// );\n// ```\nexport const createTable = (\n  schema,\n  rowsCount = 3,\n  colsCount = 3,\n  withHeaderRow = true,\n  cellContent = null\n) => {\n  const {\n    cell: tableCell,\n    header_cell: tableHeader,\n    row: tableRow,\n    table\n  } = tableNodeTypes(schema);\n\n  const cells = [];\n  const headerCells = [];\n  for (let i = 0; i < colsCount; i++) {\n    cells.push(createCell(tableCell, cellContent));\n\n    if (withHeaderRow) {\n      headerCells.push(createCell(tableHeader, cellContent));\n    }\n  }\n\n  const rows = [];\n  for (let i = 0; i < rowsCount; i++) {\n    rows.push(\n      tableRow.createChecked(\n        null,\n        withHeaderRow && i === 0 ? headerCells : cells\n      )\n    );\n  }\n\n  return table.createChecked(null, rows);\n};\n\n// :: ($pos: ResolvedPos) → ?{pos: number, start: number, node: ProseMirrorNode}\n// Iterates over parent nodes, returning a table cell or a table header node closest to a given `$pos`.\n//\n// ```javascript\n// const cell = findCellClosestToPos(state.selection.$from);\n// ```\nexport const findCellClosestToPos = $pos => {\n  const predicate = node =>\n    node.type.spec.tableRole && /cell/i.test(node.type.spec.tableRole);\n  return findParentNodeClosestToPos($pos, predicate);\n};\n\n// :: ($pos: ResolvedPos) → ?{left: number, top: number, right: number, bottom: number}\n// Returns the rectangle spanning a cell closest to a given `$pos`.\n//\n// ```javascript\n// dispatch(\n//   findCellRectClosestToPos(state.selection.$from)\n// );\n// ```\nexport const findCellRectClosestToPos = $pos => {\n  const cell = findCellClosestToPos($pos);\n  if (cell) {\n    const table = findTableClosestToPos($pos);\n    const map = TableMap.get(table.node);\n    const cellPos = cell.pos - table.start;\n    return map.rectBetween(cellPos, cellPos);\n  }\n};\n\nconst filterCellsInRow = (rowIndex, predicate) => tr => {\n  let foundCells = [];\n  const cells = getCellsInRow(rowIndex)(tr.selection);\n  if (cells) {\n    for (let j = cells.length - 1; j >= 0; j--) {\n      if (predicate(cells[j], tr)) {\n        foundCells.push(cells[j]);\n      }\n    }\n  }\n\n  return foundCells;\n};\n\n// :: (columnIndex: number) → (tr: Transaction) → {$anchor: ResolvedPos, $head: ResolvedPos, indexes: [number]}\n// Returns a range of rectangular selection spanning all merged cells around a column at index `columnIndex`.\n//\n// ```javascript\n// const range = getSelectionRangeInColumn(3)(state.tr);\n// ```\nexport const getSelectionRangeInColumn = columnIndex => tr => {\n  let startIndex = columnIndex;\n  let endIndex = columnIndex;\n\n  // looking for selection start column (startIndex)\n  for (let i = columnIndex; i >= 0; i--) {\n    const cells = getCellsInColumn(i)(tr.selection);\n    if (cells) {\n      cells.forEach(cell => {\n        let maybeEndIndex = cell.node.attrs.colspan + i - 1;\n        if (maybeEndIndex >= startIndex) {\n          startIndex = i;\n        }\n        if (maybeEndIndex > endIndex) {\n          endIndex = maybeEndIndex;\n        }\n      });\n    }\n  }\n  // looking for selection end column (endIndex)\n  for (let i = columnIndex; i <= endIndex; i++) {\n    const cells = getCellsInColumn(i)(tr.selection);\n    if (cells) {\n      cells.forEach(cell => {\n        let maybeEndIndex = cell.node.attrs.colspan + i - 1;\n        if (cell.node.attrs.colspan > 1 && maybeEndIndex > endIndex) {\n          endIndex = maybeEndIndex;\n        }\n      });\n    }\n  }\n\n  // filter out columns without cells (where all rows have colspan > 1 in the same column)\n  const indexes = [];\n  for (let i = startIndex; i <= endIndex; i++) {\n    const maybeCells = getCellsInColumn(i)(tr.selection);\n    if (maybeCells && maybeCells.length) {\n      indexes.push(i);\n    }\n  }\n  startIndex = indexes[0];\n  endIndex = indexes[indexes.length - 1];\n\n  const firstSelectedColumnCells = getCellsInColumn(startIndex)(tr.selection);\n  const firstRowCells = getCellsInRow(0)(tr.selection);\n  const $anchor = tr.doc.resolve(\n    firstSelectedColumnCells[firstSelectedColumnCells.length - 1].pos\n  );\n\n  let headCell;\n  for (let i = endIndex; i >= startIndex; i--) {\n    const columnCells = getCellsInColumn(i)(tr.selection);\n    if (columnCells && columnCells.length) {\n      for (let j = firstRowCells.length - 1; j >= 0; j--) {\n        if (firstRowCells[j].pos === columnCells[0].pos) {\n          headCell = columnCells[0];\n          break;\n        }\n      }\n      if (headCell) {\n        break;\n      }\n    }\n  }\n\n  const $head = tr.doc.resolve(headCell.pos);\n  return { $anchor, $head, indexes };\n};\n\n// :: (rowIndex: number) → (tr: Transaction) → {$anchor: ResolvedPos, $head: ResolvedPos, indexes: [number]}\n// Returns a range of rectangular selection spanning all merged cells around a row at index `rowIndex`.\n//\n// ```javascript\n// const range = getSelectionRangeInRow(3)(state.tr);\n// ```\nexport const getSelectionRangeInRow = rowIndex => tr => {\n  let startIndex = rowIndex;\n  let endIndex = rowIndex;\n  // looking for selection start row (startIndex)\n  for (let i = rowIndex; i >= 0; i--) {\n    const cells = getCellsInRow(i)(tr.selection);\n    cells.forEach(cell => {\n      let maybeEndIndex = cell.node.attrs.rowspan + i - 1;\n      if (maybeEndIndex >= startIndex) {\n        startIndex = i;\n      }\n      if (maybeEndIndex > endIndex) {\n        endIndex = maybeEndIndex;\n      }\n    });\n  }\n  // looking for selection end row (endIndex)\n  for (let i = rowIndex; i <= endIndex; i++) {\n    const cells = getCellsInRow(i)(tr.selection);\n    cells.forEach(cell => {\n      let maybeEndIndex = cell.node.attrs.rowspan + i - 1;\n      if (cell.node.attrs.rowspan > 1 && maybeEndIndex > endIndex) {\n        endIndex = maybeEndIndex;\n      }\n    });\n  }\n\n  // filter out rows without cells (where all columns have rowspan > 1 in the same row)\n  const indexes = [];\n  for (let i = startIndex; i <= endIndex; i++) {\n    const maybeCells = getCellsInRow(i)(tr.selection);\n    if (maybeCells && maybeCells.length) {\n      indexes.push(i);\n    }\n  }\n  startIndex = indexes[0];\n  endIndex = indexes[indexes.length - 1];\n\n  const firstSelectedRowCells = getCellsInRow(startIndex)(tr.selection);\n  const firstColumnCells = getCellsInColumn(0)(tr.selection);\n  const $anchor = tr.doc.resolve(\n    firstSelectedRowCells[firstSelectedRowCells.length - 1].pos\n  );\n\n  let headCell;\n  for (let i = endIndex; i >= startIndex; i--) {\n    const rowCells = getCellsInRow(i)(tr.selection);\n    if (rowCells && rowCells.length) {\n      for (let j = firstColumnCells.length - 1; j >= 0; j--) {\n        if (firstColumnCells[j].pos === rowCells[0].pos) {\n          headCell = rowCells[0];\n          break;\n        }\n      }\n      if (headCell) {\n        break;\n      }\n    }\n  }\n\n  const $head = tr.doc.resolve(headCell.pos);\n  return { $anchor, $head, indexes };\n};\n"],"names":["removeParentNodeOfType","parent","findParentNodeOfType","nodeType","tr","selection","removeNodeAtPos","pos","replaceParentNodeOfType","content","Array","isArray","i","count","length","newTr","replaceNodeAtPos","removeSelectedNode","isNodeSelection","from","$from","to","$to","cloneTr","delete","replaceSelectedNode","Fragment","canReplace","index","indexAfter","canReplaceWith","type","replaceWith","setSelection","NodeSelection","doc","resolve","setTextSelection","position","dir","nextSelection","Selection","findFrom","isSelectableNode","node","spec","selectable","shouldSelectNode","isLeaf","safeInsert","tryToReplace","hasPosition","$insertPos","oldTr","isEmptyParagraph","before","depth","canInsert","insert","$anchor","after","$pos","setParentNodeMarkup","attrs","marks","setNodeMarkup","Object","assign","selectParentNodeOfType","create","removeNodeBefore","findPositionOfNodeBefore","equalNodeType","indexOf","setTime","Date","now","nodeAt","nodeSize","start","Math","max","validContent","tableNodeTypes","schema","cached","roles","keys","nodes","forEach","tableRole","PMNode","name","findTableClosestToPos","predicate","test","findParentNodeClosestToPos","createCell","cellType","cellContent","createChecked","createAndFill","isRectSelected","map","TableMap","get","$anchorCell","cells","cellsInRect","rect","selectedCells","rectBetween","$headCell","transpose","array","_","column","convertTableNodeToArrayOfRows","tableNode","rows","rowIndex","height","rowCells","seen","colIndex","width","cellPos","cell","findCell","top","push","convertArrayOfRowsToTableNode","arrayOfNodes","rowsPM","row","child","oldCell","newCell","newTable","moveTableColumn","table","indexesOrigin","indexesTarget","direction","moveRowInArrayOfRows","moveTableRow","directionOverride","rowsExtracted","splice","positionOffset","target","apply","concat","checkInvalidMovements","originIndex","targetIndex","targets","errorMessage","slice","Error","findParentNode","findParentDomRef","domAtPos","findDomRefAtPos","hasParentNode","findParentNodeOfTypeClosestToPos","hasParentNodeOfType","findParentDomRefOfType","findSelectedNodeOfType","nodeBefore","maybeSelection","dom","childNodes","offset","Node","TEXT_NODE","parentNode","flatten","descend","result","descendants","findChildren","filter","findTextNodes","isText","findInlineNodes","isInline","findBlockNodes","isBlock","findChildrenByAttr","findChildrenByType","findChildrenByMark","markType","isInSet","contains","findTable","isCellSelection","CellSelection","getSelectionRect","isColumnSelected","columnIndex","isRowSelected","isTableSelected","getCellsInColumn","indexes","reduce","acc","nodePos","getCellsInRow","getCellsInTable","select","expand","isRowSelection","left","right","bottom","findCellClosestToPos","selRect","min","cellsInFirstRow","cellsInLastRow","head","anchor","$head","selectColumn","selectRow","selectTable","emptyCell","eq","addColumnAt","addColumn","moveRow","originRowIndex","targetRowIndex","opts","defaultOptions","tryToFit","options","getSelectionRangeInRow","indexesOriginRow","indexesTargetRow","moveColumn","originColumnIndex","targetColumnIndex","getSelectionRangeInColumn","indexesOriginColumn","indexesTargetColumn","addRowAt","clonePreviousRow","cloneRowIndex","cloneRowAt","addRow","tableNodes","rowPos","cloneRow","rowWidth","rowspan","colspan","rowSpanCells","foundCells","filterCellsInRow","spanRange","setCellAttrs","removeColumnAt","removeTable","removeRowAt","removeSelectedColumns","pmTableRect","tableStart","removeSelectedRows","removeColumnClosestToPos","findCellRectClosestToPos","removeRowClosestToPos","forEachCellInColumn","cellTransform","setCursorToLastCell","mapping","near","forEachCellInRow","createTable","rowsCount","colsCount","withHeaderRow","tableCell","tableHeader","header_cell","tableRow","headerCells","j","startIndex","endIndex","maybeEndIndex","maybeCells","firstSelectedColumnCells","firstRowCells","headCell","columnCells","firstSelectedRowCells","firstColumnCells"],"mappings":"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"}
\ No newline at end of file
diff --git a/node_modules/prosemirror-utils/package.json b/node_modules/prosemirror-utils/package.json
new file mode 100644
index 00000000..43c04e7a
--- /dev/null
+++ b/node_modules/prosemirror-utils/package.json
@@ -0,0 +1,83 @@
+{
+  "name": "prosemirror-utils",
+  "version": "0.9.6",
+  "description": "Utils library for ProseMirror",
+  "main": "dist/index.js",
+  "author": {
+    "name": "Eduard Shvedai",
+    "email": "eshvedai@gmail.com",
+    "url": "https://github.com/eshvedai"
+  },
+  "maintainers": [
+    {
+      "name": "Eduard Shvedai",
+      "email": "eshvedai@atlassian.com"
+    }
+  ],
+  "license": "Apache-2.0",
+  "repository": {
+    "type": "git",
+    "url": "git://github.com/atlassian/prosemirror-utils.git"
+  },
+  "keywords": [
+    "ProseMirror",
+    "utils",
+    "helpers"
+  ],
+  "jest": {
+    "transform": {
+      "^.+\\.js$": "babel-jest"
+    },
+    "setupTestFrameworkScriptFile": "./jestFrameworkSetup.js",
+    "testURL": "http://localhost/"
+  },
+  "typings": "typings.d.ts",
+  "files": [
+    "dist",
+    "typings.d.ts"
+  ],
+  "scripts": {
+    "build": "NODE_ENV=production rollup -c",
+    "build_readme": "builddocs --name utils --format markdown --main src/README.md src/*.js > README.md",
+    "build_all": "npm run build && npm run build_readme",
+    "test": "NODE_ENV=testing jest",
+    "test-ci": "NODE_ENV=testing jest --coverage && codecov",
+    "prepare": "npm run build_all",
+    "precommit": "lint-staged"
+  },
+  "peerDependencies": {
+    "prosemirror-model": "^1.0.0",
+    "prosemirror-state": "^1.0.1",
+    "prosemirror-tables": "^0.9.1"
+  },
+  "devDependencies": {
+    "babel-core": "^6.26.3",
+    "babel-jest": "^23.6.0",
+    "babel-preset-env": "^1.7.0",
+    "builddocs": "^0.3.2",
+    "codecov": "^3.1.0",
+    "husky": "^1.3.0",
+    "jest": "^23.6.0",
+    "jest-diff": "^23.6.0",
+    "lint-staged": "^8.1.0",
+    "prettier": "^1.15.3",
+    "prosemirror-model": "^1.0.0",
+    "prosemirror-schema-basic": "^1.0.0",
+    "prosemirror-state": "^1.0.1",
+    "prosemirror-tables": "^0.9.1",
+    "prosemirror-test-builder": "^1.0.1",
+    "prosemirror-view": "^1.1.1",
+    "rollup": "^0.56.3",
+    "rollup-plugin-babel": "^3.0.3"
+  },
+  "lint-staged": {
+    "*.{js, md}": [
+      "prettier --write",
+      "git add"
+    ]
+  },
+  "prettier": {
+    "singleQuote": true,
+    "trailing-comma": "es5"
+  }
+}
diff --git a/node_modules/prosemirror-utils/typings.d.ts b/node_modules/prosemirror-utils/typings.d.ts
new file mode 100644
index 00000000..429ee94f
--- /dev/null
+++ b/node_modules/prosemirror-utils/typings.d.ts
@@ -0,0 +1,150 @@
+import { Node as ProsemirrorNode, Schema, NodeType, Mark, MarkType, ResolvedPos, Fragment } from 'prosemirror-model';
+import { Selection, Transaction } from 'prosemirror-state';
+
+export type Predicate = (node: ProsemirrorNode) => boolean;
+
+export type DomAtPos = (pos: number) => {node: Node, offset: number};
+
+export type ContentNodeWithPos = {pos: number, start: number, depth: number, node: ProsemirrorNode};
+
+export type NodeWithPos = {pos: number, node: ProsemirrorNode};
+
+export type CellTransform = (cell: ContentNodeWithPos, tr: Transaction) => Transaction;
+
+export type MovementOptions = { tryToFit: boolean, direction?: -1 | 0 | 1 };
+
+// Selection
+export function findParentNode(predicate: Predicate): (selection: Selection) => ContentNodeWithPos | undefined;
+
+export function findParentNodeClosestToPos($pos: ResolvedPos, predicate: Predicate): ContentNodeWithPos | undefined;
+
+export function findParentDomRef(predicate: Predicate, domAtPos: DomAtPos): (selection: Selection) => Node | undefined;
+
+export function hasParentNode(predicate: Predicate): (selection: Selection) => boolean;
+
+export function findParentNodeOfType(nodeType: NodeType | NodeType[]): (selection: Selection) => ContentNodeWithPos | undefined;
+
+export function findParentNodeOfTypeClosestToPos($pos: ResolvedPos, nodeType: NodeType | NodeType[]): ContentNodeWithPos | undefined;
+
+export function hasParentNodeOfType(nodeType: NodeType | NodeType[]): (selection: Selection) => boolean;
+
+export function findParentDomRefOfType(nodeType: NodeType | NodeType[], domAtPos: DomAtPos): (selection: Selection) => Node | undefined;
+
+export function findSelectedNodeOfType(nodeType: NodeType | NodeType[]): (selection: Selection) => ContentNodeWithPos | undefined;
+
+export function isNodeSelection(selection: Selection): boolean;
+
+export function findPositionOfNodeBefore(selection: Selection): number | undefined;
+
+export function findDomRefAtPos(position: number, domAtPos: DomAtPos): Node;
+
+// Node
+export function flatten(node: ProsemirrorNode, descend?: boolean): NodeWithPos[];
+
+export function findChildren(node: ProsemirrorNode, predicate: Predicate, descend?: boolean): NodeWithPos[];
+
+export function findTextNodes(node: ProsemirrorNode, descend?: boolean): NodeWithPos[];
+
+export function findInlineNodes(node: ProsemirrorNode, descend?: boolean): NodeWithPos[];
+
+export function findBlockNodes(node: ProsemirrorNode, descend?: boolean): NodeWithPos[];
+
+export function findChildrenByAttr(node: ProsemirrorNode, predicate: Predicate, descend?: boolean): NodeWithPos[];
+
+export function findChildrenByType(node: ProsemirrorNode, nodeType: NodeType, descend?: boolean): NodeWithPos[];
+
+export function findChildrenByMark(node: ProsemirrorNode, markType: MarkType, descend?: boolean): NodeWithPos[];
+
+export function contains(node: ProsemirrorNode, nodeType: NodeType): boolean;
+
+// Table
+export function findTable(selection: Selection): ContentNodeWithPos | undefined;
+
+export function isCellSelection(selection: Selection): boolean;
+
+export function isColumnSelected(columnIndex: number): (selection: Selection) => boolean;
+
+export function isRowSelected(rowIndex: number): (selection: Selection) =>  boolean;
+
+export function isTableSelected(selection: Selection): boolean;
+
+export function getCellsInColumn(columnIndex: number | number[]): (selection: Selection) => ContentNodeWithPos[] | undefined;
+
+export function getCellsInRow(rowIndex: number | number[]): (selection: Selection) => ContentNodeWithPos[] | undefined;
+
+export function getCellsInTable(selection: Selection): ContentNodeWithPos[] | undefined;
+
+export function selectColumn(columnIndex: number, expand?: boolean): (tr: Transaction) => Transaction;
+
+export function selectRow(rowIndex: number, expand?: boolean): (tr: Transaction) => Transaction;
+
+export function selectTable(tr: Transaction): Transaction;
+
+export function emptyCell(cell: ContentNodeWithPos, schema: Schema): (tr: Transaction) => Transaction;
+
+export function addColumnAt(columnIndex: number): (tr: Transaction) => Transaction;
+
+export function moveRow(originRowIndex: number, targetRowIndex: number, options?: MovementOptions): (tr: Transaction) => Transaction;
+
+export function moveColumn(originColumnIndex: number, targetColumnIndex: number, options?: MovementOptions): (tr: Transaction) => Transaction;
+
+export function addRowAt(rowIndex: number, clonePreviousRow?: boolean): (tr: Transaction) => Transaction;
+
+export function cloneRowAt(cloneRowIndex: number): (tr: Transaction) => Transaction;
+
+export function removeColumnAt(columnIndex: number): (tr: Transaction) => Transaction;
+
+export function removeRowAt(rowIndex: number): (tr: Transaction) => Transaction;
+
+export function removeSelectedColumns(tr: Transaction): Transaction;
+
+export function removeSelectedRows(tr: Transaction): Transaction;
+
+export function removeTable(tr: Transaction): Transaction;
+
+export function removeColumnClosestToPos($pos: ResolvedPos): (tr: Transaction) => Transaction;
+
+export function removeRowClosestToPos($pos: ResolvedPos): (tr: Transaction) => Transaction;
+
+export function forEachCellInColumn(columnIndex: number, cellTransform: CellTransform, moveCursorToLastCell?: boolean): (tr: Transaction) => Transaction;
+
+export function forEachCellInRow(rowIndex: number, cellTransform: CellTransform, moveCursorToLastCell?: boolean): (tr: Transaction) => Transaction;
+
+export function setCellAttrs(cell: ContentNodeWithPos, attrs: Object): (tr: Transaction) => Transaction;
+
+export function findCellClosestToPos($pos: ResolvedPos): ContentNodeWithPos | undefined;
+
+export function findCellRectClosestToPos($pos: ResolvedPos): {top: number, bottom: number, left: number, right: number} | undefined;
+
+export function createTable(schema: Schema, rowsCount?: number, colsCount?: number, withHeaderRow?: boolean, cellContent?: Node): ProsemirrorNode;
+
+export function getSelectionRect(selection: Selection): {top: number, bottom: number, left: number, right: number} | undefined;
+
+export function getSelectionRangeInColumn(columnIndex: number): (tr: Transaction) => {$anchor: ResolvedPos, $head: ResolvedPos, indexes: number[]};
+
+export function getSelectionRangeInRow(rowIndex: number): (tr: Transaction) => {$anchor: ResolvedPos, $head: ResolvedPos, indexes: number[]};
+
+// Transforms
+export function removeParentNodeOfType(nodeType: NodeType | NodeType[]): (tr: Transaction) => Transaction;
+
+export function replaceParentNodeOfType(nodeType: NodeType | NodeType[], node: ProsemirrorNode): (tr: Transaction) => Transaction;
+
+export function removeSelectedNode(tr: Transaction): Transaction;
+
+export function replaceSelectedNode(node: ProsemirrorNode): (tr: Transaction) => Transaction;
+
+export function convertTableNodeToArrayOfRows(tableNode: ProsemirrorNode): Array>;
+
+export function convertArrayOfRowsToTableNode(tableNode: ProsemirrorNode, tableArray: Array>): ProsemirrorNode;
+
+export function canInsert($pos: ResolvedPos, node: ProsemirrorNode | Fragment): boolean;
+
+export function safeInsert(node: ProsemirrorNode | Fragment, position?: number, tryToReplace?: boolean): (tr: Transaction) => Transaction;
+
+export function setParentNodeMarkup(nodeType: NodeType | NodeType[], type?: NodeType | null, attrs?: { [key: string]: any } | null, marks?: Mark[]): (tr: Transaction) => Transaction;
+
+export function selectParentNodeOfType(nodeType: NodeType | NodeType[]): (tr: Transaction) => Transaction;
+
+export function removeNodeBefore(tr: Transaction): Transaction;
+
+export function setTextSelection(position: number, dir?: number): (tr: Transaction) => Transaction;
diff --git a/node_modules/react-dom/LICENSE b/node_modules/react-dom/LICENSE
new file mode 100644
index 00000000..91b8f6f7
--- /dev/null
+++ b/node_modules/react-dom/LICENSE
@@ -0,0 +1,31 @@
+BSD License
+
+For React software
+
+Copyright (c) 2013-present, Facebook, Inc.
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification,
+are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice, this
+   list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above copyright notice,
+   this list of conditions and the following disclaimer in the documentation
+   and/or other materials provided with the distribution.
+
+ * Neither the name Facebook nor the names of its contributors may be used to
+   endorse or promote products derived from this software without specific
+   prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
+ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/node_modules/react-dom/PATENTS b/node_modules/react-dom/PATENTS
new file mode 100644
index 00000000..9c9f8e87
--- /dev/null
+++ b/node_modules/react-dom/PATENTS
@@ -0,0 +1,33 @@
+Additional Grant of Patent Rights Version 2
+
+"Software" means the React software distributed by Facebook, Inc.
+
+Facebook, Inc. ("Facebook") hereby grants to each recipient of the Software
+("you") a perpetual, worldwide, royalty-free, non-exclusive, irrevocable
+(subject to the termination provision below) license under any Necessary
+Claims, to make, have made, use, sell, offer to sell, import, and otherwise
+transfer the Software. For avoidance of doubt, no license is granted under
+Facebook's rights in any patent claims that are infringed by (i) modifications
+to the Software made by you or any third party or (ii) the Software in
+combination with any software or other technology.
+
+The license granted hereunder will terminate, automatically and without notice,
+if you (or any of your subsidiaries, corporate affiliates or agents) initiate
+directly or indirectly, or take a direct financial interest in, any Patent
+Assertion: (i) against Facebook or any of its subsidiaries or corporate
+affiliates, (ii) against any party if such Patent Assertion arises in whole or
+in part from any software, technology, product or service of Facebook or any of
+its subsidiaries or corporate affiliates, or (iii) against any party relating
+to the Software. Notwithstanding the foregoing, if Facebook or any of its
+subsidiaries or corporate affiliates files a lawsuit alleging patent
+infringement against you in the first instance, and you respond by filing a
+patent infringement counterclaim in that lawsuit against that party that is
+unrelated to the Software, the license granted hereunder will not terminate
+under section (i) of this paragraph due to such counterclaim.
+
+A "Necessary Claim" is a claim of a patent owned by Facebook that is
+necessarily infringed by the Software standing alone.
+
+A "Patent Assertion" is any lawsuit or other action alleging direct, indirect,
+or contributory infringement or inducement to infringe any patent, including a
+cross-claim or counterclaim.
diff --git a/node_modules/react-dom/README.md b/node_modules/react-dom/README.md
new file mode 100644
index 00000000..79e5133a
--- /dev/null
+++ b/node_modules/react-dom/README.md
@@ -0,0 +1,54 @@
+# `react-dom`
+
+This package serves as the entry point of the DOM-related rendering paths. It is intended to be paired with the isomorphic React, which will be shipped as `react` to npm.
+
+## Installation
+
+```sh
+npm install react react-dom
+```
+
+## Usage
+
+### In the browser
+
+```js
+var React = require('react');
+var ReactDOM = require('react-dom');
+
+class MyComponent extends React.Component {
+  render() {
+    return 
Hello World
; + } +} + +ReactDOM.render(, node); +``` + +### On the server + +```js +var React = require('react'); +var ReactDOMServer = require('react-dom/server'); + +class MyComponent extends React.Component { + render() { + return
Hello World
; + } +} + +ReactDOMServer.renderToString(); +``` + +## API + +### `react-dom` + +- `findDOMNode` +- `render` +- `unmountComponentAtNode` + +### `react-dom/server` + +- `renderToString` +- `renderToStaticMarkup` diff --git a/node_modules/react-dom/dist/react-dom-server.js b/node_modules/react-dom/dist/react-dom-server.js new file mode 100644 index 00000000..a00a5758 --- /dev/null +++ b/node_modules/react-dom/dist/react-dom-server.js @@ -0,0 +1,16871 @@ + /** + * ReactDOMServer v15.5.4 + */ + +;(function(f) { + // CommonJS + if (typeof exports === "object" && typeof module !== "undefined") { + module.exports = f(require('react')); + + // RequireJS + } else if (typeof define === "function" && define.amd) { + define(['react'], f); + + // + + + +``` + +## Usage + +PropTypes was originally exposed as part of the React core module, and is +commonly used with React components. +Here is an example of using PropTypes with a React component, which also +documents the different validators provided: + +```jsx +import React from 'react'; +import PropTypes from 'prop-types'; + +class MyComponent extends React.Component { + render() { + // ... do things with the props + } +} + +MyComponent.propTypes = { + // You can declare that a prop is a specific JS primitive. By default, these + // are all optional. + optionalArray: PropTypes.array, + optionalBool: PropTypes.bool, + optionalFunc: PropTypes.func, + optionalNumber: PropTypes.number, + optionalObject: PropTypes.object, + optionalString: PropTypes.string, + optionalSymbol: PropTypes.symbol, + + // Anything that can be rendered: numbers, strings, elements or an array + // (or fragment) containing these types. + optionalNode: PropTypes.node, + + // A React element. + optionalElement: PropTypes.element, + + // You can also declare that a prop is an instance of a class. This uses + // JS's instanceof operator. + optionalMessage: PropTypes.instanceOf(Message), + + // You can ensure that your prop is limited to specific values by treating + // it as an enum. + optionalEnum: PropTypes.oneOf(['News', 'Photos']), + + // An object that could be one of many types + optionalUnion: PropTypes.oneOfType([ + PropTypes.string, + PropTypes.number, + PropTypes.instanceOf(Message) + ]), + + // An array of a certain type + optionalArrayOf: PropTypes.arrayOf(PropTypes.number), + + // An object with property values of a certain type + optionalObjectOf: PropTypes.objectOf(PropTypes.number), + + // An object taking on a particular shape + optionalObjectWithShape: PropTypes.shape({ + color: PropTypes.string, + fontSize: PropTypes.number + }), + + // You can chain any of the above with `isRequired` to make sure a warning + // is shown if the prop isn't provided. + requiredFunc: PropTypes.func.isRequired, + + // A value of any data type + requiredAny: PropTypes.any.isRequired, + + // You can also specify a custom validator. It should return an Error + // object if the validation fails. Don't `console.warn` or throw, as this + // won't work inside `oneOfType`. + customProp: function(props, propName, componentName) { + if (!/matchme/.test(props[propName])) { + return new Error( + 'Invalid prop `' + propName + '` supplied to' + + ' `' + componentName + '`. Validation failed.' + ); + } + }, + + // You can also supply a custom validator to `arrayOf` and `objectOf`. + // It should return an Error object if the validation fails. The validator + // will be called for each key in the array or object. The first two + // arguments of the validator are the array or object itself, and the + // current item's key. + customArrayProp: PropTypes.arrayOf(function(propValue, key, componentName, location, propFullName) { + if (!/matchme/.test(propValue[key])) { + return new Error( + 'Invalid prop `' + propFullName + '` supplied to' + + ' `' + componentName + '`. Validation failed.' + ); + } + }) +}; +``` + +Refer to the [React documentation](https://facebook.github.io/react/docs/typechecking-with-proptypes.html) for more information. + +## Migrating from React.PropTypes + +Check out [Migrating from React.PropTypes](https://facebook.github.io/react/blog/2017/04/07/react-v15.5.0.html#migrating-from-react.proptypes) for details on how to migrate to `prop-types` from `React.PropTypes`. + +There are also important notes below. + +## How to Depend on This Package? + +For apps, we recommend putting it in `dependencies` with a caret range. +For example: + +```js + "dependencies": { + "prop-types": "^15.5.7" + } +``` + +For libraries, we *also* recommend leaving it in `dependencies`: + +```js + "dependencies": { + "prop-types": "^15.5.7" + }, + "peerDependencies": { + "react": "^15.5.0" + } +``` + +**Note:** there are known issues in versions before 15.5.7 so we recommend using it as the minimal version. + +Make sure that the version range uses a caret (`^`) and thus is broad enough for npm to efficiently deduplicate packages. + +For UMD bundles of your comoponents, make sure you **don’t** include `PropTypes` in the build. Usually this is done by marking it as an external (the specifics depend on your bundler), just like you do with React. + +## Compatibility + +### React 0.14 + +This package is compatible with **React 0.14.9**. Compared to 0.14.8 (which was released a year ago), there are no other changes in 0.14.9, so it should be a painless upgrade. + +```shell +# ATTENTION: Only run this if you still use React 0.14! +npm install --save react@^0.14.9 react-dom@^0.14.9 +``` + +### React 15+ + +This package is compatible with **React 15.3.0** and higher. + +``` +npm install --save react@^15.3.0 react-dom@^15.3.0 +``` + +### What happens on other React versions? + +It outputs warnings with the message below even though the developer doesn’t do anything wrong. Unfortunately there is no solution for this other than updating React to either 15.3.0 or higher, or 0.14.9 if you’re using React 0.14. + +## Difference from `React.PropTypes`: Don’t Call Validator Functions + +First of all, **which version of React are you using**? You might be seeing this message because a component library has updated to use `prop-types` package, but your version of React is incompatible with it. See the [above section](#compatibility) for more details. + +Are you using either React 0.14.9 or a version higher than React 15.3.0? Read on. + +When you migrate components to use the standalone `prop-types`, **all validator functions will start throwing an error if you call them directly**. This makes sure that nobody relies on them in production code, and it is safe to strip their implementations to optimize the bundle size. + +Code like this is still fine: + +```js +MyComponent.propTypes = { + myProp: PropTypes.bool +}; +``` + +However, code like this will not work with the `prop-types` package: + +```js +// Will not work with `prop-types` package! +var errorOrNull = PropTypes.bool(42, 'myProp', 'MyComponent', 'prop'); +``` + +It will throw an error: + +``` +Calling PropTypes validators directly is not supported by the `prop-types` package. +Use PropTypes.checkPropTypes() to call them. +``` + +(If you see **a warning** rather than an error with this message, please check the [above section about compatibility](#compatibility).) + +This is new behavior, and you will only encounter it when you migrate from `React.PropTypes` to the `prop-types` package. For the vast majority of components, this doesn’t matter, and if you didn’t see [this warning](https://facebook.github.io/react/warnings/dont-call-proptypes.html) in your components, your code is safe to migrate. This is not a breaking change in React because you are only opting into this change for a component by explicitly changing your imports to use `prop-types`. If you temporarily need the old behavior, you can keep using `React.PropTypes` until React 16. + +**If you absolutely need to trigger the validation manually**, call `PropTypes.checkPropTypes()`. Unlike the validators themselves, this function is safe to call in production, as it will be replaced by an empty function: + +```js +// Works with standalone PropTypes +PropTypes.checkPropTypes(MyComponent.propTypes, props, 'prop', 'MyComponent'); +``` +See below for more info. + +**You might also see this error** if you’re calling a `PropTypes` validator from your own custom `PropTypes` validator. In this case, the fix is to make sure that you are passing *all* of the arguments to the inner function. There is a more in-depth explanation of how to fix it [on this page](https://facebook.github.io/react/warnings/dont-call-proptypes.html#fixing-the-false-positive-in-third-party-proptypes). Alternatively, you can temporarily keep using `React.PropTypes` until React 16, as it would still only warn in this case. + +If you use a bundler like Browserify or Webpack, don’t forget to [follow these instructions](https://facebook.github.io/react/docs/installation.html#development-and-production-versions) to correctly bundle your application in development or production mode. Otherwise you’ll ship unnecessary code to your users. + +## PropTypes.checkPropTypes + +React will automatically check the propTypes you set on the component, but if +you are using PropTypes without React then you may want to manually call +`PropTypes.checkPropTypes`, like so: + +```js +const myPropTypes = { + name: PropTypes.string, + age: PropTypes. number, + // ... define your prop validations +}; + +const props = { + name: 'hello', // is valid + age: 'world', // not valid +}; + +// Let's say your component is called 'MyComponent' + +// Works with standalone PropTypes +PropTypes.checkPropTypes(myPropTypes, props, 'prop', 'MyComponent'); +// This will warn as follows: +// Warning: Failed prop type: Invalid prop `age` of type `string` supplied to +// `MyComponent`, expected `number`. +``` diff --git a/node_modules/react-dom/node_modules/prop-types/checkPropTypes.js b/node_modules/react-dom/node_modules/prop-types/checkPropTypes.js new file mode 100644 index 00000000..c2b536f9 --- /dev/null +++ b/node_modules/react-dom/node_modules/prop-types/checkPropTypes.js @@ -0,0 +1,61 @@ +/** + * Copyright 2013-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + */ + +'use strict'; + +if (process.env.NODE_ENV !== '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 (process.env.NODE_ENV !== '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 ' + 'React.PropTypes.', componentName || 'React class', location, 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; diff --git a/node_modules/react-dom/node_modules/prop-types/factory.js b/node_modules/react-dom/node_modules/prop-types/factory.js new file mode 100644 index 00000000..7758ec1b --- /dev/null +++ b/node_modules/react-dom/node_modules/prop-types/factory.js @@ -0,0 +1,21 @@ +/** + * Copyright 2013-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + */ + +'use strict'; + +// React 15.5 references this module, and assumes PropTypes are still callable in production. +// Therefore we re-export development-only version with all the PropTypes checks here. +// However if one is migrating to the `prop-types` npm library, they will go through the +// `index.js` entry point, and it will branch depending on the environment. +var factory = require('./factoryWithTypeCheckers'); +module.exports = function(isValidElement) { + // It is still allowed in 15.5. + var throwOnDirectAccess = false; + return factory(isValidElement, throwOnDirectAccess); +}; diff --git a/node_modules/react-dom/node_modules/prop-types/factoryWithThrowingShims.js b/node_modules/react-dom/node_modules/prop-types/factoryWithThrowingShims.js new file mode 100644 index 00000000..840f68ee --- /dev/null +++ b/node_modules/react-dom/node_modules/prop-types/factoryWithThrowingShims.js @@ -0,0 +1,59 @@ +/** + * Copyright 2013-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + */ + +'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 + }; + + ReactPropTypes.checkPropTypes = emptyFunction; + ReactPropTypes.PropTypes = ReactPropTypes; + + return ReactPropTypes; +}; diff --git a/node_modules/react-dom/node_modules/prop-types/factoryWithTypeCheckers.js b/node_modules/react-dom/node_modules/prop-types/factoryWithTypeCheckers.js new file mode 100644 index 00000000..b3246b0f --- /dev/null +++ b/node_modules/react-dom/node_modules/prop-types/factoryWithTypeCheckers.js @@ -0,0 +1,512 @@ +/** + * Copyright 2013-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + */ + +'use strict'; + +var emptyFunction = require('fbjs/lib/emptyFunction'); +var invariant = require('fbjs/lib/invariant'); +var warning = require('fbjs/lib/warning'); + +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 = '<>'; + + // 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 + }; + + /** + * 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 (process.env.NODE_ENV !== '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 (process.env.NODE_ENV !== '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)) { + process.env.NODE_ENV !== '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)) { + process.env.NODE_ENV !== '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 supplid 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 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; +}; diff --git a/node_modules/react-dom/node_modules/prop-types/index.js b/node_modules/react-dom/node_modules/prop-types/index.js new file mode 100644 index 00000000..8f94a31f --- /dev/null +++ b/node_modules/react-dom/node_modules/prop-types/index.js @@ -0,0 +1,30 @@ +/** + * Copyright 2013-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + */ + +if (process.env.NODE_ENV !== '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')(); +} diff --git a/node_modules/react-dom/node_modules/prop-types/lib/ReactPropTypesSecret.js b/node_modules/react-dom/node_modules/prop-types/lib/ReactPropTypesSecret.js new file mode 100644 index 00000000..15ca6a94 --- /dev/null +++ b/node_modules/react-dom/node_modules/prop-types/lib/ReactPropTypesSecret.js @@ -0,0 +1,14 @@ +/** + * Copyright 2013-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + */ + +'use strict'; + +var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED'; + +module.exports = ReactPropTypesSecret; diff --git a/node_modules/react-dom/node_modules/prop-types/node_modules/.bin/loose-envify b/node_modules/react-dom/node_modules/prop-types/node_modules/.bin/loose-envify new file mode 100644 index 00000000..3f07c362 --- /dev/null +++ b/node_modules/react-dom/node_modules/prop-types/node_modules/.bin/loose-envify @@ -0,0 +1,15 @@ +#!/bin/sh +basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") + +case `uname` in + *CYGWIN*) basedir=`cygpath -w "$basedir"`;; +esac + +if [ -x "$basedir/node" ]; then + "$basedir/node" "$basedir/../../../../../../../../loose-envify/cli.js" "$@" + ret=$? +else + node "$basedir/../../../../../../../../loose-envify/cli.js" "$@" + ret=$? +fi +exit $ret diff --git a/node_modules/react-dom/node_modules/prop-types/node_modules/.bin/loose-envify.cmd b/node_modules/react-dom/node_modules/prop-types/node_modules/.bin/loose-envify.cmd new file mode 100644 index 00000000..ad90e6e7 --- /dev/null +++ b/node_modules/react-dom/node_modules/prop-types/node_modules/.bin/loose-envify.cmd @@ -0,0 +1,7 @@ +@IF EXIST "%~dp0\node.exe" ( + "%~dp0\node.exe" "%~dp0\..\..\..\..\..\..\..\..\loose-envify\cli.js" %* +) ELSE ( + @SETLOCAL + @SET PATHEXT=%PATHEXT:;.JS;=;% + node "%~dp0\..\..\..\..\..\..\..\..\loose-envify\cli.js" %* +) \ No newline at end of file diff --git a/node_modules/react-dom/node_modules/prop-types/package.json b/node_modules/react-dom/node_modules/prop-types/package.json new file mode 100644 index 00000000..15eaa14c --- /dev/null +++ b/node_modules/react-dom/node_modules/prop-types/package.json @@ -0,0 +1,55 @@ +{ + "name": "prop-types", + "version": "15.5.10", + "description": "Runtime type checking for React props and similar objects.", + "main": "index.js", + "license": "BSD-3-Clause", + "files": [ + "LICENSE", + "PATENTS", + "README.md", + "checkPropTypes.js", + "factory.js", + "factoryWithThrowingShims.js", + "factoryWithTypeCheckers.js", + "index.js", + "prop-types.js", + "prop-types.min.js", + "lib" + ], + "repository": "reactjs/prop-types", + "keywords": [ + "react" + ], + "bugs": { + "url": "https://github.com/reactjs/prop-types/issues" + }, + "homepage": "https://facebook.github.io/react/", + "dependencies": { + "fbjs": "^0.8.9", + "loose-envify": "^1.3.1" + }, + "scripts": { + "test": "jest", + "umd": "NODE_ENV=development browserify index.js -t envify --standalone PropTypes -o prop-types.js", + "umd-min": "NODE_ENV=production browserify index.js -t envify -t uglifyify --standalone PropTypes -p bundle-collapser/plugin -o | uglifyjs --compress unused,dead_code -o prop-types.min.js", + "build": "yarn umd && yarn umd-min", + "prepublish": "yarn build" + }, + "devDependencies": { + "babel-jest": "^19.0.0", + "babel-preset-react": "^6.24.1", + "browserify": "^14.3.0", + "bundle-collapser": "^1.2.1", + "envify": "^4.0.0", + "jest": "^19.0.2", + "react": "^15.5.1", + "uglifyify": "^3.0.4", + "uglifyjs": "^2.4.10" + }, + "browserify": { + "transform": [ + "loose-envify" + ] + } +} diff --git a/node_modules/react-dom/node_modules/prop-types/prop-types.js b/node_modules/react-dom/node_modules/prop-types/prop-types.js new file mode 100644 index 00000000..148b65ea --- /dev/null +++ b/node_modules/react-dom/node_modules/prop-types/prop-types.js @@ -0,0 +1,850 @@ +(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 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}]},{},[4])(4) +}); \ No newline at end of file diff --git a/node_modules/react-dom/node_modules/prop-types/prop-types.min.js b/node_modules/react-dom/node_modules/prop-types/prop-types.min.js new file mode 100644 index 00000000..332bf898 --- /dev/null +++ b/node_modules/react-dom/node_modules/prop-types/prop-types.min.js @@ -0,0 +1 @@ +!function(f){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=f();else if("function"==typeof define&&define.amd)define([],f);else{var g;g="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,g.PropTypes=f()}}(function(){return function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a="function"==typeof require&&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}for(var i="function"==typeof require&&require,o=0;oHello World; + * } + * }); + * + * The class specification supports a specific protocol of methods that have + * special meaning (e.g. `render`). See `ReactClassInterface` for + * more the comprehensive protocol. Any other properties and methods in the + * class specification will be available on the prototype. + * + * @interface ReactClassInterface + * @internal + */ +var ReactClassInterface = { + + /** + * An array of Mixin objects to include when defining your component. + * + * @type {array} + * @optional + */ + mixins: 'DEFINE_MANY', + + /** + * An object containing properties and methods that should be defined on + * the component's constructor instead of its prototype (static methods). + * + * @type {object} + * @optional + */ + statics: 'DEFINE_MANY', + + /** + * Definition of prop types for this component. + * + * @type {object} + * @optional + */ + propTypes: 'DEFINE_MANY', + + /** + * Definition of context types for this component. + * + * @type {object} + * @optional + */ + contextTypes: 'DEFINE_MANY', + + /** + * Definition of context types this component sets for its children. + * + * @type {object} + * @optional + */ + childContextTypes: 'DEFINE_MANY', + + // ==== Definition methods ==== + + /** + * Invoked when the component is mounted. Values in the mapping will be set on + * `this.props` if that prop is not specified (i.e. using an `in` check). + * + * This method is invoked before `getInitialState` and therefore cannot rely + * on `this.state` or use `this.setState`. + * + * @return {object} + * @optional + */ + getDefaultProps: 'DEFINE_MANY_MERGED', + + /** + * Invoked once before the component is mounted. The return value will be used + * as the initial value of `this.state`. + * + * getInitialState: function() { + * return { + * isOn: false, + * fooBaz: new BazFoo() + * } + * } + * + * @return {object} + * @optional + */ + getInitialState: 'DEFINE_MANY_MERGED', + + /** + * @return {object} + * @optional + */ + getChildContext: 'DEFINE_MANY_MERGED', + + /** + * Uses props from `this.props` and state from `this.state` to render the + * structure of the component. + * + * No guarantees are made about when or how often this method is invoked, so + * it must not have side effects. + * + * render: function() { + * var name = this.props.name; + * return
Hello, {name}!
; + * } + * + * @return {ReactComponent} + * @required + */ + render: 'DEFINE_ONCE', + + // ==== Delegate methods ==== + + /** + * Invoked when the component is initially created and about to be mounted. + * This may have side effects, but any external subscriptions or data created + * by this method must be cleaned up in `componentWillUnmount`. + * + * @optional + */ + componentWillMount: 'DEFINE_MANY', + + /** + * Invoked when the component has been mounted and has a DOM representation. + * However, there is no guarantee that the DOM node is in the document. + * + * Use this as an opportunity to operate on the DOM when the component has + * been mounted (initialized and rendered) for the first time. + * + * @param {DOMElement} rootNode DOM element representing the component. + * @optional + */ + componentDidMount: 'DEFINE_MANY', + + /** + * Invoked before the component receives new props. + * + * Use this as an opportunity to react to a prop transition by updating the + * state using `this.setState`. Current props are accessed via `this.props`. + * + * componentWillReceiveProps: function(nextProps, nextContext) { + * this.setState({ + * likesIncreasing: nextProps.likeCount > this.props.likeCount + * }); + * } + * + * NOTE: There is no equivalent `componentWillReceiveState`. An incoming prop + * transition may cause a state change, but the opposite is not true. If you + * need it, you are probably looking for `componentWillUpdate`. + * + * @param {object} nextProps + * @optional + */ + componentWillReceiveProps: 'DEFINE_MANY', + + /** + * Invoked while deciding if the component should be updated as a result of + * receiving new props, state and/or context. + * + * Use this as an opportunity to `return false` when you're certain that the + * transition to the new props/state/context will not require a component + * update. + * + * shouldComponentUpdate: function(nextProps, nextState, nextContext) { + * return !equal(nextProps, this.props) || + * !equal(nextState, this.state) || + * !equal(nextContext, this.context); + * } + * + * @param {object} nextProps + * @param {?object} nextState + * @param {?object} nextContext + * @return {boolean} True if the component should update. + * @optional + */ + shouldComponentUpdate: 'DEFINE_ONCE', + + /** + * Invoked when the component is about to update due to a transition from + * `this.props`, `this.state` and `this.context` to `nextProps`, `nextState` + * and `nextContext`. + * + * Use this as an opportunity to perform preparation before an update occurs. + * + * NOTE: You **cannot** use `this.setState()` in this method. + * + * @param {object} nextProps + * @param {?object} nextState + * @param {?object} nextContext + * @param {ReactReconcileTransaction} transaction + * @optional + */ + componentWillUpdate: 'DEFINE_MANY', + + /** + * Invoked when the component's DOM representation has been updated. + * + * Use this as an opportunity to operate on the DOM when the component has + * been updated. + * + * @param {object} prevProps + * @param {?object} prevState + * @param {?object} prevContext + * @param {DOMElement} rootNode DOM element representing the component. + * @optional + */ + componentDidUpdate: 'DEFINE_MANY', + + /** + * Invoked when the component is about to be removed from its parent and have + * its DOM representation destroyed. + * + * Use this as an opportunity to deallocate any external resources. + * + * NOTE: There is no `componentDidUnmount` since your component will have been + * destroyed by that point. + * + * @optional + */ + componentWillUnmount: 'DEFINE_MANY', + + // ==== Advanced methods ==== + + /** + * Updates the component's currently mounted DOM representation. + * + * By default, this implements React's rendering and reconciliation algorithm. + * Sophisticated clients may wish to override this. + * + * @param {ReactReconcileTransaction} transaction + * @internal + * @overridable + */ + updateComponent: 'OVERRIDE_BASE' + +}; + +/** + * Mapping from class specification keys to special processing functions. + * + * Although these are declared like instance properties in the specification + * when defining classes using `React.createClass`, they are actually static + * and are accessible on the constructor instead of the prototype. Despite + * being static, they must be defined outside of the "statics" key under + * which all other static methods are defined. + */ +var RESERVED_SPEC_KEYS = { + displayName: function (Constructor, displayName) { + Constructor.displayName = displayName; + }, + mixins: function (Constructor, mixins) { + if (mixins) { + for (var i = 0; i < mixins.length; i++) { + mixSpecIntoComponent(Constructor, mixins[i]); + } + } + }, + childContextTypes: function (Constructor, childContextTypes) { + if ("development" !== 'production') { + validateTypeDef(Constructor, childContextTypes, 'childContext'); + } + Constructor.childContextTypes = _assign({}, Constructor.childContextTypes, childContextTypes); + }, + contextTypes: function (Constructor, contextTypes) { + if ("development" !== 'production') { + validateTypeDef(Constructor, contextTypes, 'context'); + } + Constructor.contextTypes = _assign({}, Constructor.contextTypes, contextTypes); + }, + /** + * Special case getDefaultProps which should move into statics but requires + * automatic merging. + */ + getDefaultProps: function (Constructor, getDefaultProps) { + if (Constructor.getDefaultProps) { + Constructor.getDefaultProps = createMergedResultFunction(Constructor.getDefaultProps, getDefaultProps); + } else { + Constructor.getDefaultProps = getDefaultProps; + } + }, + propTypes: function (Constructor, propTypes) { + if ("development" !== 'production') { + validateTypeDef(Constructor, propTypes, 'prop'); + } + Constructor.propTypes = _assign({}, Constructor.propTypes, propTypes); + }, + statics: function (Constructor, statics) { + mixStaticSpecIntoComponent(Constructor, statics); + }, + autobind: function () {} }; + +function validateTypeDef(Constructor, typeDef, location) { + for (var propName in typeDef) { + if (typeDef.hasOwnProperty(propName)) { + // use a warning instead of an invariant so components + // don't show up in prod but only in __DEV__ + "development" !== 'production' ? warning(typeof typeDef[propName] === 'function', '%s: %s type `%s` is invalid; it must be a function, usually from ' + 'React.PropTypes.', Constructor.displayName || 'ReactClass', ReactPropTypeLocationNames[location], propName) : void 0; + } + } +} + +function validateMethodOverride(isAlreadyDefined, name) { + var specPolicy = ReactClassInterface.hasOwnProperty(name) ? ReactClassInterface[name] : null; + + // Disallow overriding of base class methods unless explicitly allowed. + if (ReactClassMixin.hasOwnProperty(name)) { + !(specPolicy === 'OVERRIDE_BASE') ? "development" !== 'production' ? invariant(false, 'ReactClassInterface: You are attempting to override `%s` from your class specification. Ensure that your method names do not overlap with React methods.', name) : _prodInvariant('73', name) : void 0; + } + + // Disallow defining methods more than once unless explicitly allowed. + if (isAlreadyDefined) { + !(specPolicy === 'DEFINE_MANY' || specPolicy === 'DEFINE_MANY_MERGED') ? "development" !== 'production' ? invariant(false, 'ReactClassInterface: You are attempting to define `%s` on your component more than once. This conflict may be due to a mixin.', name) : _prodInvariant('74', name) : void 0; + } +} + +/** + * Mixin helper which handles policy validation and reserved + * specification keys when building React classes. + */ +function mixSpecIntoComponent(Constructor, spec) { + if (!spec) { + if ("development" !== 'production') { + var typeofSpec = typeof spec; + var isMixinValid = typeofSpec === 'object' && spec !== null; + + "development" !== 'production' ? warning(isMixinValid, '%s: You\'re attempting to include a mixin that is either null ' + 'or not an object. Check the mixins included by the component, ' + 'as well as any mixins they include themselves. ' + 'Expected object but got %s.', Constructor.displayName || 'ReactClass', spec === null ? null : typeofSpec) : void 0; + } + + return; + } + + !(typeof spec !== 'function') ? "development" !== 'production' ? invariant(false, 'ReactClass: You\'re attempting to use a component class or function as a mixin. Instead, just use a regular object.') : _prodInvariant('75') : void 0; + !!ReactElement.isValidElement(spec) ? "development" !== 'production' ? invariant(false, 'ReactClass: You\'re attempting to use a component as a mixin. Instead, just use a regular object.') : _prodInvariant('76') : void 0; + + var proto = Constructor.prototype; + var autoBindPairs = proto.__reactAutoBindPairs; + + // By handling mixins before any other properties, we ensure the same + // chaining order is applied to methods with DEFINE_MANY policy, whether + // mixins are listed before or after these methods in the spec. + if (spec.hasOwnProperty(MIXINS_KEY)) { + RESERVED_SPEC_KEYS.mixins(Constructor, spec.mixins); + } + + for (var name in spec) { + if (!spec.hasOwnProperty(name)) { + continue; + } + + if (name === MIXINS_KEY) { + // We have already handled mixins in a special case above. + continue; + } + + var property = spec[name]; + var isAlreadyDefined = proto.hasOwnProperty(name); + validateMethodOverride(isAlreadyDefined, name); + + if (RESERVED_SPEC_KEYS.hasOwnProperty(name)) { + RESERVED_SPEC_KEYS[name](Constructor, property); + } else { + // Setup methods on prototype: + // The following member methods should not be automatically bound: + // 1. Expected ReactClass methods (in the "interface"). + // 2. Overridden methods (that were mixed in). + var isReactClassMethod = ReactClassInterface.hasOwnProperty(name); + var isFunction = typeof property === 'function'; + var shouldAutoBind = isFunction && !isReactClassMethod && !isAlreadyDefined && spec.autobind !== false; + + if (shouldAutoBind) { + autoBindPairs.push(name, property); + proto[name] = property; + } else { + if (isAlreadyDefined) { + var specPolicy = ReactClassInterface[name]; + + // These cases should already be caught by validateMethodOverride. + !(isReactClassMethod && (specPolicy === 'DEFINE_MANY_MERGED' || specPolicy === 'DEFINE_MANY')) ? "development" !== 'production' ? invariant(false, 'ReactClass: Unexpected spec policy %s for key %s when mixing in component specs.', specPolicy, name) : _prodInvariant('77', specPolicy, name) : void 0; + + // For methods which are defined more than once, call the existing + // methods before calling the new property, merging if appropriate. + if (specPolicy === 'DEFINE_MANY_MERGED') { + proto[name] = createMergedResultFunction(proto[name], property); + } else if (specPolicy === 'DEFINE_MANY') { + proto[name] = createChainedFunction(proto[name], property); + } + } else { + proto[name] = property; + if ("development" !== 'production') { + // Add verbose displayName to the function, which helps when looking + // at profiling tools. + if (typeof property === 'function' && spec.displayName) { + proto[name].displayName = spec.displayName + '_' + name; + } + } + } + } + } + } +} + +function mixStaticSpecIntoComponent(Constructor, statics) { + if (!statics) { + return; + } + for (var name in statics) { + var property = statics[name]; + if (!statics.hasOwnProperty(name)) { + continue; + } + + var isReserved = name in RESERVED_SPEC_KEYS; + !!isReserved ? "development" !== 'production' ? invariant(false, 'ReactClass: You are attempting to define a reserved property, `%s`, that shouldn\'t be on the "statics" key. Define it as an instance property instead; it will still be accessible on the constructor.', name) : _prodInvariant('78', name) : void 0; + + var isInherited = name in Constructor; + !!isInherited ? "development" !== 'production' ? invariant(false, 'ReactClass: You are attempting to define `%s` on your component more than once. This conflict may be due to a mixin.', name) : _prodInvariant('79', name) : void 0; + Constructor[name] = property; + } +} + +/** + * Merge two objects, but throw if both contain the same key. + * + * @param {object} one The first object, which is mutated. + * @param {object} two The second object + * @return {object} one after it has been mutated to contain everything in two. + */ +function mergeIntoWithNoDuplicateKeys(one, two) { + !(one && two && typeof one === 'object' && typeof two === 'object') ? "development" !== 'production' ? invariant(false, 'mergeIntoWithNoDuplicateKeys(): Cannot merge non-objects.') : _prodInvariant('80') : void 0; + + for (var key in two) { + if (two.hasOwnProperty(key)) { + !(one[key] === undefined) ? "development" !== 'production' ? invariant(false, 'mergeIntoWithNoDuplicateKeys(): Tried to merge two objects with the same key: `%s`. This conflict may be due to a mixin; in particular, this may be caused by two getInitialState() or getDefaultProps() methods returning objects with clashing keys.', key) : _prodInvariant('81', key) : void 0; + one[key] = two[key]; + } + } + return one; +} + +/** + * Creates a function that invokes two functions and merges their return values. + * + * @param {function} one Function to invoke first. + * @param {function} two Function to invoke second. + * @return {function} Function that invokes the two argument functions. + * @private + */ +function createMergedResultFunction(one, two) { + return function mergedResult() { + var a = one.apply(this, arguments); + var b = two.apply(this, arguments); + if (a == null) { + return b; + } else if (b == null) { + return a; + } + var c = {}; + mergeIntoWithNoDuplicateKeys(c, a); + mergeIntoWithNoDuplicateKeys(c, b); + return c; + }; +} + +/** + * Creates a function that invokes two functions and ignores their return vales. + * + * @param {function} one Function to invoke first. + * @param {function} two Function to invoke second. + * @return {function} Function that invokes the two argument functions. + * @private + */ +function createChainedFunction(one, two) { + return function chainedFunction() { + one.apply(this, arguments); + two.apply(this, arguments); + }; +} + +/** + * Binds a method to the component. + * + * @param {object} component Component whose method is going to be bound. + * @param {function} method Method to be bound. + * @return {function} The bound method. + */ +function bindAutoBindMethod(component, method) { + var boundMethod = method.bind(component); + if ("development" !== 'production') { + boundMethod.__reactBoundContext = component; + boundMethod.__reactBoundMethod = method; + boundMethod.__reactBoundArguments = null; + var componentName = component.constructor.displayName; + var _bind = boundMethod.bind; + boundMethod.bind = function (newThis) { + for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { + args[_key - 1] = arguments[_key]; + } + + // User is trying to bind() an autobound method; we effectively will + // ignore the value of "this" that the user is trying to use, so + // let's warn. + if (newThis !== component && newThis !== null) { + "development" !== 'production' ? warning(false, 'bind(): React component methods may only be bound to the ' + 'component instance. See %s', componentName) : void 0; + } else if (!args.length) { + "development" !== 'production' ? warning(false, 'bind(): You are binding a component method to the component. ' + 'React does this for you automatically in a high-performance ' + 'way, so you can safely remove this call. See %s', componentName) : void 0; + return boundMethod; + } + var reboundMethod = _bind.apply(boundMethod, arguments); + reboundMethod.__reactBoundContext = component; + reboundMethod.__reactBoundMethod = method; + reboundMethod.__reactBoundArguments = args; + return reboundMethod; + }; + } + return boundMethod; +} + +/** + * Binds all auto-bound methods in a component. + * + * @param {object} component Component whose method is going to be bound. + */ +function bindAutoBindMethods(component) { + var pairs = component.__reactAutoBindPairs; + for (var i = 0; i < pairs.length; i += 2) { + var autoBindKey = pairs[i]; + var method = pairs[i + 1]; + component[autoBindKey] = bindAutoBindMethod(component, method); + } +} + +/** + * Add more to the ReactClass base class. These are all legacy features and + * therefore not already part of the modern ReactComponent. + */ +var ReactClassMixin = { + + /** + * TODO: This will be deprecated because state should always keep a consistent + * type signature and the only use case for this, is to avoid that. + */ + replaceState: function (newState, callback) { + this.updater.enqueueReplaceState(this, newState); + if (callback) { + this.updater.enqueueCallback(this, callback, 'replaceState'); + } + }, + + /** + * Checks whether or not this composite component is mounted. + * @return {boolean} True if mounted, false otherwise. + * @protected + * @final + */ + isMounted: function () { + return this.updater.isMounted(this); + } +}; + +var ReactClassComponent = function () {}; +_assign(ReactClassComponent.prototype, ReactComponent.prototype, ReactClassMixin); + +var didWarnDeprecated = false; + +/** + * Module for creating composite components. + * + * @class ReactClass + */ +var ReactClass = { + + /** + * Creates a composite component class given a class specification. + * See https://facebook.github.io/react/docs/top-level-api.html#react.createclass + * + * @param {object} spec Class specification (which must define `render`). + * @return {function} Component constructor function. + * @public + */ + createClass: function (spec) { + if ("development" !== 'production') { + "development" !== 'production' ? warning(didWarnDeprecated, '%s: React.createClass is deprecated and will be removed in version 16. ' + 'Use plain JavaScript classes instead. If you\'re not yet ready to ' + 'migrate, create-react-class is available on npm as a ' + 'drop-in replacement.', spec && spec.displayName || 'A Component') : void 0; + didWarnDeprecated = true; + } + + // To keep our warnings more understandable, we'll use a little hack here to + // ensure that Constructor.name !== 'Constructor'. This makes sure we don't + // unnecessarily identify a class without displayName as 'Constructor'. + var Constructor = identity(function (props, context, updater) { + // This constructor gets overridden by mocks. The argument is used + // by mocks to assert on what gets mounted. + + if ("development" !== 'production') { + "development" !== 'production' ? warning(this instanceof Constructor, 'Something is calling a React component directly. Use a factory or ' + 'JSX instead. See: https://fb.me/react-legacyfactory') : void 0; + } + + // Wire up auto-binding + if (this.__reactAutoBindPairs.length) { + bindAutoBindMethods(this); + } + + this.props = props; + this.context = context; + this.refs = emptyObject; + this.updater = updater || ReactNoopUpdateQueue; + + this.state = null; + + // ReactClasses doesn't have constructors. Instead, they use the + // getInitialState and componentWillMount methods for initialization. + + var initialState = this.getInitialState ? this.getInitialState() : null; + if ("development" !== 'production') { + // We allow auto-mocks to proceed as if they're returning null. + if (initialState === undefined && this.getInitialState._isMockFunction) { + // This is probably bad practice. Consider warning here and + // deprecating this convenience. + initialState = null; + } + } + !(typeof initialState === 'object' && !Array.isArray(initialState)) ? "development" !== 'production' ? invariant(false, '%s.getInitialState(): must return an object or null', Constructor.displayName || 'ReactCompositeComponent') : _prodInvariant('82', Constructor.displayName || 'ReactCompositeComponent') : void 0; + + this.state = initialState; + }); + Constructor.prototype = new ReactClassComponent(); + Constructor.prototype.constructor = Constructor; + Constructor.prototype.__reactAutoBindPairs = []; + + injectedMixins.forEach(mixSpecIntoComponent.bind(null, Constructor)); + + mixSpecIntoComponent(Constructor, spec); + + // Initialize the defaultProps property after all mixins have been merged. + if (Constructor.getDefaultProps) { + Constructor.defaultProps = Constructor.getDefaultProps(); + } + + if ("development" !== 'production') { + // This is a tag to indicate that the use of these method names is ok, + // since it's used with createClass. If it's not, then it's likely a + // mistake so we'll warn you to use the static property, property + // initializer or constructor respectively. + if (Constructor.getDefaultProps) { + Constructor.getDefaultProps.isReactClassApproved = {}; + } + if (Constructor.prototype.getInitialState) { + Constructor.prototype.getInitialState.isReactClassApproved = {}; + } + } + + !Constructor.prototype.render ? "development" !== 'production' ? invariant(false, 'createClass(...): Class specification must implement a `render` method.') : _prodInvariant('83') : void 0; + + if ("development" !== 'production') { + "development" !== 'production' ? warning(!Constructor.prototype.componentShouldUpdate, '%s has a method called ' + 'componentShouldUpdate(). Did you mean shouldComponentUpdate()? ' + 'The name is phrased as a question because the function is ' + 'expected to return a value.', spec.displayName || 'A component') : void 0; + "development" !== 'production' ? warning(!Constructor.prototype.componentWillRecieveProps, '%s has a method called ' + 'componentWillRecieveProps(). Did you mean componentWillReceiveProps()?', spec.displayName || 'A component') : void 0; + } + + // Reduce time spent doing lookups by setting these on the prototype. + for (var methodName in ReactClassInterface) { + if (!Constructor.prototype[methodName]) { + Constructor.prototype[methodName] = null; + } + } + + return Constructor; + }, + + injection: { + injectMixin: function (mixin) { + injectedMixins.push(mixin); + } + } + +}; + +module.exports = ReactClass; +},{"11":11,"16":16,"21":21,"22":22,"39":39,"46":46,"47":47,"49":49,"50":50}],11:[function(_dereq_,module,exports){ +/** + * Copyright 2013-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + */ + +'use strict'; + +var _prodInvariant = _dereq_(39); + +var ReactNoopUpdateQueue = _dereq_(21); + +var canDefineProperty = _dereq_(33); +var emptyObject = _dereq_(46); +var invariant = _dereq_(47); +var warning = _dereq_(49); + +/** + * Base class helpers for the updating state of a component. + */ +function ReactComponent(props, context, updater) { + this.props = props; + this.context = context; + this.refs = emptyObject; + // We initialize the default updater but the real one gets injected by the + // renderer. + this.updater = updater || ReactNoopUpdateQueue; +} + +ReactComponent.prototype.isReactComponent = {}; + +/** + * Sets a subset of the state. Always use this to mutate + * state. You should treat `this.state` as immutable. + * + * There is no guarantee that `this.state` will be immediately updated, so + * accessing `this.state` after calling this method may return the old value. + * + * There is no guarantee that calls to `setState` will run synchronously, + * as they may eventually be batched together. You can provide an optional + * callback that will be executed when the call to setState is actually + * completed. + * + * When a function is provided to setState, it will be called at some point in + * the future (not synchronously). It will be called with the up to date + * component arguments (state, props, context). These values can be different + * from this.* because your function may be called after receiveProps but before + * shouldComponentUpdate, and this new state, props, and context will not yet be + * assigned to this. + * + * @param {object|function} partialState Next partial state or function to + * produce next partial state to be merged with current state. + * @param {?function} callback Called after state is updated. + * @final + * @protected + */ +ReactComponent.prototype.setState = function (partialState, callback) { + !(typeof partialState === 'object' || typeof partialState === 'function' || partialState == null) ? "development" !== 'production' ? invariant(false, 'setState(...): takes an object of state variables to update or a function which returns an object of state variables.') : _prodInvariant('85') : void 0; + this.updater.enqueueSetState(this, partialState); + if (callback) { + this.updater.enqueueCallback(this, callback, 'setState'); + } +}; + +/** + * Forces an update. This should only be invoked when it is known with + * certainty that we are **not** in a DOM transaction. + * + * You may want to call this when you know that some deeper aspect of the + * component's state has changed but `setState` was not called. + * + * This will not invoke `shouldComponentUpdate`, but it will invoke + * `componentWillUpdate` and `componentDidUpdate`. + * + * @param {?function} callback Called after update is complete. + * @final + * @protected + */ +ReactComponent.prototype.forceUpdate = function (callback) { + this.updater.enqueueForceUpdate(this); + if (callback) { + this.updater.enqueueCallback(this, callback, 'forceUpdate'); + } +}; + +/** + * Deprecated APIs. These APIs used to exist on classic React classes but since + * we would like to deprecate them, we're not going to move them over to this + * modern base class. Instead, we define a getter that warns if it's accessed. + */ +if ("development" !== 'production') { + var deprecatedAPIs = { + isMounted: ['isMounted', 'Instead, make sure to clean up subscriptions and pending requests in ' + 'componentWillUnmount to prevent memory leaks.'], + replaceState: ['replaceState', 'Refactor your code to use setState instead (see ' + 'https://github.com/facebook/react/issues/3236).'] + }; + var defineDeprecationWarning = function (methodName, info) { + if (canDefineProperty) { + Object.defineProperty(ReactComponent.prototype, methodName, { + get: function () { + "development" !== 'production' ? warning(false, '%s(...) is deprecated in plain JavaScript React classes. %s', info[0], info[1]) : void 0; + return undefined; + } + }); + } + }; + for (var fnName in deprecatedAPIs) { + if (deprecatedAPIs.hasOwnProperty(fnName)) { + defineDeprecationWarning(fnName, deprecatedAPIs[fnName]); + } + } +} + +module.exports = ReactComponent; +},{"21":21,"33":33,"39":39,"46":46,"47":47,"49":49}],12:[function(_dereq_,module,exports){ +/** + * Copyright 2016-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + * + */ + +'use strict'; + +var _prodInvariant = _dereq_(39); + +var ReactCurrentOwner = _dereq_(14); + +var invariant = _dereq_(47); +var warning = _dereq_(49); + +function isNative(fn) { + // Based on isNative() from Lodash + var funcToString = Function.prototype.toString; + var hasOwnProperty = Object.prototype.hasOwnProperty; + var reIsNative = RegExp('^' + funcToString + // Take an example native function source for comparison + .call(hasOwnProperty) + // Strip regex characters so we can use it for regex + .replace(/[\\^$.*+?()[\]{}|]/g, '\\$&') + // Remove hasOwnProperty from the template to make it generic + .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'); + try { + var source = funcToString.call(fn); + return reIsNative.test(source); + } catch (err) { + return false; + } +} + +var canUseCollections = +// Array.from +typeof Array.from === 'function' && +// Map +typeof Map === 'function' && isNative(Map) && +// Map.prototype.keys +Map.prototype != null && typeof Map.prototype.keys === 'function' && isNative(Map.prototype.keys) && +// Set +typeof Set === 'function' && isNative(Set) && +// Set.prototype.keys +Set.prototype != null && typeof Set.prototype.keys === 'function' && isNative(Set.prototype.keys); + +var setItem; +var getItem; +var removeItem; +var getItemIDs; +var addRoot; +var removeRoot; +var getRootIDs; + +if (canUseCollections) { + var itemMap = new Map(); + var rootIDSet = new Set(); + + setItem = function (id, item) { + itemMap.set(id, item); + }; + getItem = function (id) { + return itemMap.get(id); + }; + removeItem = function (id) { + itemMap['delete'](id); + }; + getItemIDs = function () { + return Array.from(itemMap.keys()); + }; + + addRoot = function (id) { + rootIDSet.add(id); + }; + removeRoot = function (id) { + rootIDSet['delete'](id); + }; + getRootIDs = function () { + return Array.from(rootIDSet.keys()); + }; +} else { + var itemByKey = {}; + var rootByKey = {}; + + // Use non-numeric keys to prevent V8 performance issues: + // https://github.com/facebook/react/pull/7232 + var getKeyFromID = function (id) { + return '.' + id; + }; + var getIDFromKey = function (key) { + return parseInt(key.substr(1), 10); + }; + + setItem = function (id, item) { + var key = getKeyFromID(id); + itemByKey[key] = item; + }; + getItem = function (id) { + var key = getKeyFromID(id); + return itemByKey[key]; + }; + removeItem = function (id) { + var key = getKeyFromID(id); + delete itemByKey[key]; + }; + getItemIDs = function () { + return Object.keys(itemByKey).map(getIDFromKey); + }; + + addRoot = function (id) { + var key = getKeyFromID(id); + rootByKey[key] = true; + }; + removeRoot = function (id) { + var key = getKeyFromID(id); + delete rootByKey[key]; + }; + getRootIDs = function () { + return Object.keys(rootByKey).map(getIDFromKey); + }; +} + +var unmountedIDs = []; + +function purgeDeep(id) { + var item = getItem(id); + if (item) { + var childIDs = item.childIDs; + + removeItem(id); + childIDs.forEach(purgeDeep); + } +} + +function describeComponentFrame(name, source, ownerName) { + return '\n in ' + (name || 'Unknown') + (source ? ' (at ' + source.fileName.replace(/^.*[\\\/]/, '') + ':' + source.lineNumber + ')' : ownerName ? ' (created by ' + ownerName + ')' : ''); +} + +function getDisplayName(element) { + if (element == null) { + return '#empty'; + } else if (typeof element === 'string' || typeof element === 'number') { + return '#text'; + } else if (typeof element.type === 'string') { + return element.type; + } else { + return element.type.displayName || element.type.name || 'Unknown'; + } +} + +function describeID(id) { + var name = ReactComponentTreeHook.getDisplayName(id); + var element = ReactComponentTreeHook.getElement(id); + var ownerID = ReactComponentTreeHook.getOwnerID(id); + var ownerName; + if (ownerID) { + ownerName = ReactComponentTreeHook.getDisplayName(ownerID); + } + "development" !== 'production' ? warning(element, 'ReactComponentTreeHook: Missing React element for debugID %s when ' + 'building stack', id) : void 0; + return describeComponentFrame(name, element && element._source, ownerName); +} + +var ReactComponentTreeHook = { + onSetChildren: function (id, nextChildIDs) { + var item = getItem(id); + !item ? "development" !== 'production' ? invariant(false, 'Item must have been set') : _prodInvariant('144') : void 0; + item.childIDs = nextChildIDs; + + for (var i = 0; i < nextChildIDs.length; i++) { + var nextChildID = nextChildIDs[i]; + var nextChild = getItem(nextChildID); + !nextChild ? "development" !== 'production' ? invariant(false, 'Expected hook events to fire for the child before its parent includes it in onSetChildren().') : _prodInvariant('140') : void 0; + !(nextChild.childIDs != null || typeof nextChild.element !== 'object' || nextChild.element == null) ? "development" !== 'production' ? invariant(false, 'Expected onSetChildren() to fire for a container child before its parent includes it in onSetChildren().') : _prodInvariant('141') : void 0; + !nextChild.isMounted ? "development" !== 'production' ? invariant(false, 'Expected onMountComponent() to fire for the child before its parent includes it in onSetChildren().') : _prodInvariant('71') : void 0; + if (nextChild.parentID == null) { + nextChild.parentID = id; + // TODO: This shouldn't be necessary but mounting a new root during in + // componentWillMount currently causes not-yet-mounted components to + // be purged from our tree data so their parent id is missing. + } + !(nextChild.parentID === id) ? "development" !== 'production' ? invariant(false, 'Expected onBeforeMountComponent() parent and onSetChildren() to be consistent (%s has parents %s and %s).', nextChildID, nextChild.parentID, id) : _prodInvariant('142', nextChildID, nextChild.parentID, id) : void 0; + } + }, + onBeforeMountComponent: function (id, element, parentID) { + var item = { + element: element, + parentID: parentID, + text: null, + childIDs: [], + isMounted: false, + updateCount: 0 + }; + setItem(id, item); + }, + onBeforeUpdateComponent: function (id, element) { + var item = getItem(id); + if (!item || !item.isMounted) { + // We may end up here as a result of setState() in componentWillUnmount(). + // In this case, ignore the element. + return; + } + item.element = element; + }, + onMountComponent: function (id) { + var item = getItem(id); + !item ? "development" !== 'production' ? invariant(false, 'Item must have been set') : _prodInvariant('144') : void 0; + item.isMounted = true; + var isRoot = item.parentID === 0; + if (isRoot) { + addRoot(id); + } + }, + onUpdateComponent: function (id) { + var item = getItem(id); + if (!item || !item.isMounted) { + // We may end up here as a result of setState() in componentWillUnmount(). + // In this case, ignore the element. + return; + } + item.updateCount++; + }, + onUnmountComponent: function (id) { + var item = getItem(id); + if (item) { + // We need to check if it exists. + // `item` might not exist if it is inside an error boundary, and a sibling + // error boundary child threw while mounting. Then this instance never + // got a chance to mount, but it still gets an unmounting event during + // the error boundary cleanup. + item.isMounted = false; + var isRoot = item.parentID === 0; + if (isRoot) { + removeRoot(id); + } + } + unmountedIDs.push(id); + }, + purgeUnmountedComponents: function () { + if (ReactComponentTreeHook._preventPurging) { + // Should only be used for testing. + return; + } + + for (var i = 0; i < unmountedIDs.length; i++) { + var id = unmountedIDs[i]; + purgeDeep(id); + } + unmountedIDs.length = 0; + }, + isMounted: function (id) { + var item = getItem(id); + return item ? item.isMounted : false; + }, + getCurrentStackAddendum: function (topElement) { + var info = ''; + if (topElement) { + var name = getDisplayName(topElement); + var owner = topElement._owner; + info += describeComponentFrame(name, topElement._source, owner && owner.getName()); + } + + var currentOwner = ReactCurrentOwner.current; + var id = currentOwner && currentOwner._debugID; + + info += ReactComponentTreeHook.getStackAddendumByID(id); + return info; + }, + getStackAddendumByID: function (id) { + var info = ''; + while (id) { + info += describeID(id); + id = ReactComponentTreeHook.getParentID(id); + } + return info; + }, + getChildIDs: function (id) { + var item = getItem(id); + return item ? item.childIDs : []; + }, + getDisplayName: function (id) { + var element = ReactComponentTreeHook.getElement(id); + if (!element) { + return null; + } + return getDisplayName(element); + }, + getElement: function (id) { + var item = getItem(id); + return item ? item.element : null; + }, + getOwnerID: function (id) { + var element = ReactComponentTreeHook.getElement(id); + if (!element || !element._owner) { + return null; + } + return element._owner._debugID; + }, + getParentID: function (id) { + var item = getItem(id); + return item ? item.parentID : null; + }, + getSource: function (id) { + var item = getItem(id); + var element = item ? item.element : null; + var source = element != null ? element._source : null; + return source; + }, + getText: function (id) { + var element = ReactComponentTreeHook.getElement(id); + if (typeof element === 'string') { + return element; + } else if (typeof element === 'number') { + return '' + element; + } else { + return null; + } + }, + getUpdateCount: function (id) { + var item = getItem(id); + return item ? item.updateCount : 0; + }, + + + getRootIDs: getRootIDs, + getRegisteredIDs: getItemIDs +}; + +module.exports = ReactComponentTreeHook; +},{"14":14,"39":39,"47":47,"49":49}],13:[function(_dereq_,module,exports){ +/** + * Copyright 2013-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + */ + +'use strict'; + +var shallowCompare = _dereq_(40); + +/** + * If your React component's render function is "pure", e.g. it will render the + * same result given the same props and state, provide this mixin for a + * considerable performance boost. + * + * Most React components have pure render functions. + * + * Example: + * + * var ReactComponentWithPureRenderMixin = + * require('ReactComponentWithPureRenderMixin'); + * React.createClass({ + * mixins: [ReactComponentWithPureRenderMixin], + * + * render: function() { + * return
foo
; + * } + * }); + * + * Note: This only checks shallow equality for props and state. If these contain + * complex data structures this mixin may have false-negatives for deeper + * differences. Only mixin to components which have simple props and state, or + * use `forceUpdate()` when you know deep data structures have changed. + * + * See https://facebook.github.io/react/docs/pure-render-mixin.html + */ +var ReactComponentWithPureRenderMixin = { + shouldComponentUpdate: function (nextProps, nextState) { + return shallowCompare(this, nextProps, nextState); + } +}; + +module.exports = ReactComponentWithPureRenderMixin; +},{"40":40}],14:[function(_dereq_,module,exports){ +/** + * Copyright 2013-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + * + */ + +'use strict'; + +/** + * Keeps track of the current owner. + * + * The current owner is the component who should own any components that are + * currently being constructed. + */ +var ReactCurrentOwner = { + + /** + * @internal + * @type {ReactComponent} + */ + current: null + +}; + +module.exports = ReactCurrentOwner; +},{}],15:[function(_dereq_,module,exports){ +/** + * Copyright 2013-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + */ + +'use strict'; + +var ReactElement = _dereq_(16); + +/** + * Create a factory that creates HTML tag elements. + * + * @private + */ +var createDOMFactory = ReactElement.createFactory; +if ("development" !== 'production') { + var ReactElementValidator = _dereq_(18); + createDOMFactory = ReactElementValidator.createFactory; +} + +/** + * Creates a mapping from supported HTML tags to `ReactDOMComponent` classes. + * This is also accessible via `React.DOM`. + * + * @public + */ +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') +}; + +module.exports = ReactDOMFactories; +},{"16":16,"18":18}],16:[function(_dereq_,module,exports){ +/** + * Copyright 2014-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + */ + +'use strict'; + +var _assign = _dereq_(50); + +var ReactCurrentOwner = _dereq_(14); + +var warning = _dereq_(49); +var canDefineProperty = _dereq_(33); +var hasOwnProperty = Object.prototype.hasOwnProperty; + +var REACT_ELEMENT_TYPE = _dereq_(17); + +var RESERVED_PROPS = { + key: true, + ref: true, + __self: true, + __source: true +}; + +var specialPropKeyWarningShown, specialPropRefWarningShown; + +function hasValidRef(config) { + if ("development" !== 'production') { + if (hasOwnProperty.call(config, 'ref')) { + var getter = Object.getOwnPropertyDescriptor(config, 'ref').get; + if (getter && getter.isReactWarning) { + return false; + } + } + } + return config.ref !== undefined; +} + +function hasValidKey(config) { + if ("development" !== 'production') { + if (hasOwnProperty.call(config, 'key')) { + var getter = Object.getOwnPropertyDescriptor(config, 'key').get; + if (getter && getter.isReactWarning) { + return false; + } + } + } + return config.key !== undefined; +} + +function defineKeyPropWarningGetter(props, displayName) { + var warnAboutAccessingKey = function () { + if (!specialPropKeyWarningShown) { + specialPropKeyWarningShown = true; + "development" !== 'production' ? warning(false, '%s: `key` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://fb.me/react-special-props)', displayName) : void 0; + } + }; + warnAboutAccessingKey.isReactWarning = true; + Object.defineProperty(props, 'key', { + get: warnAboutAccessingKey, + configurable: true + }); +} + +function defineRefPropWarningGetter(props, displayName) { + var warnAboutAccessingRef = function () { + if (!specialPropRefWarningShown) { + specialPropRefWarningShown = true; + "development" !== 'production' ? warning(false, '%s: `ref` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://fb.me/react-special-props)', displayName) : void 0; + } + }; + warnAboutAccessingRef.isReactWarning = true; + Object.defineProperty(props, 'ref', { + get: warnAboutAccessingRef, + configurable: true + }); +} + +/** + * Factory method to create a new React element. This no longer adheres to + * the class pattern, so do not use new to call it. Also, no instanceof check + * will work. Instead test $$typeof field against Symbol.for('react.element') to check + * if something is a React Element. + * + * @param {*} type + * @param {*} key + * @param {string|object} ref + * @param {*} self A *temporary* helper to detect places where `this` is + * different from the `owner` when React.createElement is called, so that we + * can warn. We want to get rid of owner and replace string `ref`s with arrow + * functions, and as long as `this` and owner are the same, there will be no + * change in behavior. + * @param {*} source An annotation object (added by a transpiler or otherwise) + * indicating filename, line number, and/or other information. + * @param {*} owner + * @param {*} props + * @internal + */ +var ReactElement = function (type, key, ref, self, source, owner, props) { + var element = { + // This tag allow us to uniquely identify this as a React Element + $$typeof: REACT_ELEMENT_TYPE, + + // Built-in properties that belong on the element + type: type, + key: key, + ref: ref, + props: props, + + // Record the component responsible for creating this element. + _owner: owner + }; + + if ("development" !== 'production') { + // The validation flag is currently mutative. We put it on + // an external backing store so that we can freeze the whole object. + // This can be replaced with a WeakMap once they are implemented in + // commonly used development environments. + element._store = {}; + + // To make comparing ReactElements easier for testing purposes, we make + // the validation flag non-enumerable (where possible, which should + // include every environment we run tests in), so the test framework + // ignores it. + if (canDefineProperty) { + Object.defineProperty(element._store, 'validated', { + configurable: false, + enumerable: false, + writable: true, + value: false + }); + // self and source are DEV only properties. + Object.defineProperty(element, '_self', { + configurable: false, + enumerable: false, + writable: false, + value: self + }); + // Two elements created in two different places should be considered + // equal for testing purposes and therefore we hide it from enumeration. + Object.defineProperty(element, '_source', { + configurable: false, + enumerable: false, + writable: false, + value: source + }); + } else { + element._store.validated = false; + element._self = self; + element._source = source; + } + if (Object.freeze) { + Object.freeze(element.props); + Object.freeze(element); + } + } + + return element; +}; + +/** + * Create and return a new ReactElement of the given type. + * See https://facebook.github.io/react/docs/top-level-api.html#react.createelement + */ +ReactElement.createElement = function (type, config, children) { + var propName; + + // Reserved names are extracted + var props = {}; + + var key = null; + var ref = null; + var self = null; + var source = null; + + if (config != null) { + if (hasValidRef(config)) { + ref = config.ref; + } + if (hasValidKey(config)) { + key = '' + config.key; + } + + self = config.__self === undefined ? null : config.__self; + source = config.__source === undefined ? null : config.__source; + // Remaining properties are added to a new props object + for (propName in config) { + if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) { + props[propName] = config[propName]; + } + } + } + + // Children can be more than one argument, and those are transferred onto + // the newly allocated props object. + var childrenLength = arguments.length - 2; + if (childrenLength === 1) { + props.children = children; + } else if (childrenLength > 1) { + var childArray = Array(childrenLength); + for (var i = 0; i < childrenLength; i++) { + childArray[i] = arguments[i + 2]; + } + if ("development" !== 'production') { + if (Object.freeze) { + Object.freeze(childArray); + } + } + props.children = childArray; + } + + // Resolve default props + if (type && type.defaultProps) { + var defaultProps = type.defaultProps; + for (propName in defaultProps) { + if (props[propName] === undefined) { + props[propName] = defaultProps[propName]; + } + } + } + if ("development" !== 'production') { + if (key || ref) { + if (typeof props.$$typeof === 'undefined' || props.$$typeof !== REACT_ELEMENT_TYPE) { + var displayName = typeof type === 'function' ? type.displayName || type.name || 'Unknown' : type; + if (key) { + defineKeyPropWarningGetter(props, displayName); + } + if (ref) { + defineRefPropWarningGetter(props, displayName); + } + } + } + } + return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props); +}; + +/** + * Return a function that produces ReactElements of a given type. + * See https://facebook.github.io/react/docs/top-level-api.html#react.createfactory + */ +ReactElement.createFactory = function (type) { + var factory = ReactElement.createElement.bind(null, type); + // Expose the type on the factory and the prototype so that it can be + // easily accessed on elements. E.g. `.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. + // Legacy hook TODO: Warn if this is accessed + factory.type = type; + return factory; +}; + +ReactElement.cloneAndReplaceKey = function (oldElement, newKey) { + var newElement = ReactElement(oldElement.type, newKey, oldElement.ref, oldElement._self, oldElement._source, oldElement._owner, oldElement.props); + + return newElement; +}; + +/** + * Clone and return a new ReactElement using element as the starting point. + * See https://facebook.github.io/react/docs/top-level-api.html#react.cloneelement + */ +ReactElement.cloneElement = function (element, config, children) { + var propName; + + // Original props are copied + var props = _assign({}, element.props); + + // Reserved names are extracted + var key = element.key; + var ref = element.ref; + // Self is preserved since the owner is preserved. + var self = element._self; + // Source is preserved since cloneElement is unlikely to be targeted by a + // transpiler, and the original source is probably a better indicator of the + // true owner. + var source = element._source; + + // Owner will be preserved, unless ref is overridden + var owner = element._owner; + + if (config != null) { + if (hasValidRef(config)) { + // Silently steal the ref from the parent. + ref = config.ref; + owner = ReactCurrentOwner.current; + } + if (hasValidKey(config)) { + key = '' + config.key; + } + + // Remaining properties override existing props + var defaultProps; + if (element.type && element.type.defaultProps) { + defaultProps = element.type.defaultProps; + } + for (propName in config) { + if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) { + if (config[propName] === undefined && defaultProps !== undefined) { + // Resolve default props + props[propName] = defaultProps[propName]; + } else { + props[propName] = config[propName]; + } + } + } + } + + // Children can be more than one argument, and those are transferred onto + // the newly allocated props object. + var childrenLength = arguments.length - 2; + if (childrenLength === 1) { + props.children = children; + } else if (childrenLength > 1) { + var childArray = Array(childrenLength); + for (var i = 0; i < childrenLength; i++) { + childArray[i] = arguments[i + 2]; + } + props.children = childArray; + } + + return ReactElement(element.type, key, ref, self, source, owner, props); +}; + +/** + * Verifies the object is a ReactElement. + * See https://facebook.github.io/react/docs/top-level-api.html#react.isvalidelement + * @param {?object} object + * @return {boolean} True if `object` is a valid component. + * @final + */ +ReactElement.isValidElement = function (object) { + return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE; +}; + +module.exports = ReactElement; +},{"14":14,"17":17,"33":33,"49":49,"50":50}],17:[function(_dereq_,module,exports){ +/** + * Copyright 2014-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + * + */ + +'use strict'; + +// The Symbol used to tag the ReactElement type. If there is no native Symbol +// nor polyfill, then a plain number is used for performance. + +var REACT_ELEMENT_TYPE = typeof Symbol === 'function' && Symbol['for'] && Symbol['for']('react.element') || 0xeac7; + +module.exports = REACT_ELEMENT_TYPE; +},{}],18:[function(_dereq_,module,exports){ +/** + * Copyright 2014-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + */ + +/** + * ReactElementValidator provides a wrapper around a element factory + * which validates the props passed to the element. This is intended to be + * used only in DEV and could be replaced by a static type checker for languages + * that support it. + */ + +'use strict'; + +var ReactCurrentOwner = _dereq_(14); +var ReactComponentTreeHook = _dereq_(12); +var ReactElement = _dereq_(16); + +var checkReactTypeSpec = _dereq_(34); + +var canDefineProperty = _dereq_(33); +var getIteratorFn = _dereq_(36); +var warning = _dereq_(49); + +function getDeclarationErrorAddendum() { + if (ReactCurrentOwner.current) { + var name = ReactCurrentOwner.current.getName(); + if (name) { + return ' Check the render method of `' + name + '`.'; + } + } + return ''; +} + +function getSourceInfoErrorAddendum(elementProps) { + if (elementProps !== null && elementProps !== undefined && elementProps.__source !== undefined) { + var source = elementProps.__source; + var fileName = source.fileName.replace(/^.*[\\\/]/, ''); + var lineNumber = source.lineNumber; + return ' Check your code at ' + fileName + ':' + lineNumber + '.'; + } + return ''; +} + +/** + * Warn if there's no key explicitly set on dynamic arrays of children or + * object keys are not valid. This allows us to keep track of children between + * updates. + */ +var ownerHasKeyUseWarning = {}; + +function getCurrentComponentErrorInfo(parentType) { + var info = getDeclarationErrorAddendum(); + + if (!info) { + var parentName = typeof parentType === 'string' ? parentType : parentType.displayName || parentType.name; + if (parentName) { + info = ' Check the top-level render call using <' + parentName + '>.'; + } + } + return info; +} + +/** + * Warn if the element doesn't have an explicit key assigned to it. + * This element is in an array. The array could grow and shrink or be + * reordered. All children that haven't already been validated are required to + * have a "key" property assigned to it. Error statuses are cached so a warning + * will only be shown once. + * + * @internal + * @param {ReactElement} element Element that requires a key. + * @param {*} parentType element's parent's type. + */ +function validateExplicitKey(element, parentType) { + if (!element._store || element._store.validated || element.key != null) { + return; + } + element._store.validated = true; + + var memoizer = ownerHasKeyUseWarning.uniqueKey || (ownerHasKeyUseWarning.uniqueKey = {}); + + var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType); + if (memoizer[currentComponentErrorInfo]) { + return; + } + memoizer[currentComponentErrorInfo] = true; + + // Usually the current owner is the offender, but if it accepts children as a + // property, it may be the creator of the child that's responsible for + // assigning it a key. + var childOwner = ''; + if (element && element._owner && element._owner !== ReactCurrentOwner.current) { + // Give the component that originally created this child. + childOwner = ' It was passed a child from ' + element._owner.getName() + '.'; + } + + "development" !== 'production' ? warning(false, 'Each child in an array or iterator should have a unique "key" prop.' + '%s%s See https://fb.me/react-warning-keys for more information.%s', currentComponentErrorInfo, childOwner, ReactComponentTreeHook.getCurrentStackAddendum(element)) : void 0; +} + +/** + * Ensure that every element either is passed in a static location, in an + * array with an explicit keys property defined, or in an object literal + * with valid key property. + * + * @internal + * @param {ReactNode} node Statically passed child of any type. + * @param {*} parentType node's parent's type. + */ +function validateChildKeys(node, parentType) { + if (typeof node !== 'object') { + return; + } + if (Array.isArray(node)) { + for (var i = 0; i < node.length; i++) { + var child = node[i]; + if (ReactElement.isValidElement(child)) { + validateExplicitKey(child, parentType); + } + } + } else if (ReactElement.isValidElement(node)) { + // This element was passed in a valid location. + if (node._store) { + node._store.validated = true; + } + } else if (node) { + var iteratorFn = getIteratorFn(node); + // Entry iterators provide implicit keys. + if (iteratorFn) { + if (iteratorFn !== node.entries) { + var iterator = iteratorFn.call(node); + var step; + while (!(step = iterator.next()).done) { + if (ReactElement.isValidElement(step.value)) { + validateExplicitKey(step.value, parentType); + } + } + } + } + } +} + +/** + * Given an element, validate that its props follow the propTypes definition, + * provided by the type. + * + * @param {ReactElement} element + */ +function validatePropTypes(element) { + var componentClass = element.type; + if (typeof componentClass !== 'function') { + return; + } + var name = componentClass.displayName || componentClass.name; + if (componentClass.propTypes) { + checkReactTypeSpec(componentClass.propTypes, element.props, 'prop', name, element, null); + } + if (typeof componentClass.getDefaultProps === 'function') { + "development" !== 'production' ? warning(componentClass.getDefaultProps.isReactClassApproved, 'getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.') : void 0; + } +} + +var ReactElementValidator = { + + createElement: function (type, props, children) { + var validType = typeof type === 'string' || typeof type === 'function'; + // We warn in this case but don't throw. We expect the element creation to + // succeed and there will likely be errors in render. + if (!validType) { + if (typeof type !== 'function' && typeof type !== 'string') { + var info = ''; + if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) { + info += ' You likely forgot to export your component from the file ' + 'it\'s defined in.'; + } + + var sourceInfo = getSourceInfoErrorAddendum(props); + if (sourceInfo) { + info += sourceInfo; + } else { + info += getDeclarationErrorAddendum(); + } + + info += ReactComponentTreeHook.getCurrentStackAddendum(); + + "development" !== 'production' ? warning(false, 'React.createElement: type is invalid -- expected a string (for ' + 'built-in components) or a class/function (for composite ' + 'components) but got: %s.%s', type == null ? type : typeof type, info) : void 0; + } + } + + var element = ReactElement.createElement.apply(this, arguments); + + // The result can be nullish if a mock or a custom function is used. + // TODO: Drop this when these are no longer allowed as the type argument. + if (element == null) { + return element; + } + + // Skip key warning if the type isn't valid since our key validation logic + // doesn't expect a non-string/function type and can throw confusing errors. + // We don't want exception behavior to differ between dev and prod. + // (Rendering will throw with a helpful message and as soon as the type is + // fixed, the key warnings will appear.) + if (validType) { + for (var i = 2; i < arguments.length; i++) { + validateChildKeys(arguments[i], type); + } + } + + validatePropTypes(element); + + return element; + }, + + createFactory: function (type) { + var validatedFactory = ReactElementValidator.createElement.bind(null, type); + // Legacy hook TODO: Warn if this is accessed + validatedFactory.type = type; + + if ("development" !== 'production') { + if (canDefineProperty) { + Object.defineProperty(validatedFactory, 'type', { + enumerable: false, + get: function () { + "development" !== 'production' ? warning(false, 'Factory.type is deprecated. Access the class directly ' + 'before passing it to createFactory.') : void 0; + Object.defineProperty(this, 'type', { + value: type + }); + return type; + } + }); + } + } + + return validatedFactory; + }, + + cloneElement: function (element, props, children) { + var newElement = ReactElement.cloneElement.apply(this, arguments); + for (var i = 2; i < arguments.length; i++) { + validateChildKeys(arguments[i], newElement.type); + } + validatePropTypes(newElement); + return newElement; + } + +}; + +module.exports = ReactElementValidator; +},{"12":12,"14":14,"16":16,"33":33,"34":34,"36":36,"49":49}],19:[function(_dereq_,module,exports){ +/** + * Copyright 2015-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + */ + +'use strict'; + +var _prodInvariant = _dereq_(39); + +var ReactChildren = _dereq_(9); +var ReactElement = _dereq_(16); + +var emptyFunction = _dereq_(45); +var invariant = _dereq_(47); +var warning = _dereq_(49); + +/** + * We used to allow keyed objects to serve as a collection of ReactElements, + * or nested sets. This allowed us a way to explicitly key a set or fragment of + * components. This is now being replaced with an opaque data structure. + * The upgrade path is to call React.addons.createFragment({ key: value }) to + * create a keyed fragment. The resulting data structure is an array. + */ + +var numericPropertyRegex = /^\d+$/; + +var warnedAboutNumeric = false; + +var ReactFragment = { + /** + * Wrap a keyed object in an opaque proxy that warns you if you access any + * of its properties. + * See https://facebook.github.io/react/docs/create-fragment.html + */ + create: function (object) { + if (typeof object !== 'object' || !object || Array.isArray(object)) { + "development" !== 'production' ? warning(false, 'React.addons.createFragment only accepts a single object. Got: %s', object) : void 0; + return object; + } + if (ReactElement.isValidElement(object)) { + "development" !== 'production' ? warning(false, 'React.addons.createFragment does not accept a ReactElement ' + 'without a wrapper object.') : void 0; + return object; + } + + !(object.nodeType !== 1) ? "development" !== 'production' ? invariant(false, 'React.addons.createFragment(...): Encountered an invalid child; DOM elements are not valid children of React components.') : _prodInvariant('0') : void 0; + + var result = []; + + for (var key in object) { + if ("development" !== 'production') { + if (!warnedAboutNumeric && numericPropertyRegex.test(key)) { + "development" !== 'production' ? warning(false, 'React.addons.createFragment(...): Child objects should have ' + 'non-numeric keys so ordering is preserved.') : void 0; + warnedAboutNumeric = true; + } + } + ReactChildren.mapIntoWithKeyPrefixInternal(object[key], result, key, emptyFunction.thatReturnsArgument); + } + + return result; + } +}; + +module.exports = ReactFragment; +},{"16":16,"39":39,"45":45,"47":47,"49":49,"9":9}],20:[function(_dereq_,module,exports){ +/** + * Copyright 2013-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + */ + +'use strict'; + +/** + * ReactLink encapsulates a common pattern in which a component wants to modify + * a prop received from its parent. ReactLink allows the parent to pass down a + * value coupled with a callback that, when invoked, expresses an intent to + * modify that value. For example: + * + * React.createClass({ + * getInitialState: function() { + * return {value: ''}; + * }, + * render: function() { + * var valueLink = new ReactLink(this.state.value, this._handleValueChange); + * return ; + * }, + * _handleValueChange: function(newValue) { + * this.setState({value: newValue}); + * } + * }); + * + * We have provided some sugary mixins to make the creation and + * consumption of ReactLink easier; see LinkedValueUtils and LinkedStateMixin. + */ + +var React = _dereq_(5); + +/** + * Deprecated: An an easy way to express two-way binding with React. + * See https://facebook.github.io/react/docs/two-way-binding-helpers.html + * + * @param {*} value current value of the link + * @param {function} requestChange callback to request a change + */ +function ReactLink(value, requestChange) { + this.value = value; + this.requestChange = requestChange; +} + +/** + * Creates a PropType that enforces the ReactLink API and optionally checks the + * type of the value being passed inside the link. Example: + * + * MyComponent.propTypes = { + * tabIndexLink: ReactLink.PropTypes.link(React.PropTypes.number) + * } + */ +function createLinkTypeChecker(linkType) { + var shapes = { + value: linkType === undefined ? React.PropTypes.any.isRequired : linkType.isRequired, + requestChange: React.PropTypes.func.isRequired + }; + return React.PropTypes.shape(shapes); +} + +ReactLink.PropTypes = { + link: createLinkTypeChecker +}; + +module.exports = ReactLink; +},{"5":5}],21:[function(_dereq_,module,exports){ +/** + * Copyright 2015-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + */ + +'use strict'; + +var warning = _dereq_(49); + +function warnNoop(publicInstance, callerName) { + if ("development" !== 'production') { + var constructor = publicInstance.constructor; + "development" !== 'production' ? warning(false, '%s(...): Can only update a mounted or mounting component. ' + 'This usually means you called %s() on an unmounted component. ' + 'This is a no-op. Please check the code for the %s component.', callerName, callerName, constructor && (constructor.displayName || constructor.name) || 'ReactClass') : void 0; + } +} + +/** + * This is the abstract API for an update queue. + */ +var ReactNoopUpdateQueue = { + + /** + * Checks whether or not this composite component is mounted. + * @param {ReactClass} publicInstance The instance we want to test. + * @return {boolean} True if mounted, false otherwise. + * @protected + * @final + */ + isMounted: function (publicInstance) { + return false; + }, + + /** + * Enqueue a callback that will be executed after all the pending updates + * have processed. + * + * @param {ReactClass} publicInstance The instance to use as `this` context. + * @param {?function} callback Called after state is updated. + * @internal + */ + enqueueCallback: function (publicInstance, callback) {}, + + /** + * Forces an update. This should only be invoked when it is known with + * certainty that we are **not** in a DOM transaction. + * + * You may want to call this when you know that some deeper aspect of the + * component's state has changed but `setState` was not called. + * + * This will not invoke `shouldComponentUpdate`, but it will invoke + * `componentWillUpdate` and `componentDidUpdate`. + * + * @param {ReactClass} publicInstance The instance that should rerender. + * @internal + */ + enqueueForceUpdate: function (publicInstance) { + warnNoop(publicInstance, 'forceUpdate'); + }, + + /** + * Replaces all of the state. Always use this or `setState` to mutate state. + * You should treat `this.state` as immutable. + * + * There is no guarantee that `this.state` will be immediately updated, so + * accessing `this.state` after calling this method may return the old value. + * + * @param {ReactClass} publicInstance The instance that should rerender. + * @param {object} completeState Next state. + * @internal + */ + enqueueReplaceState: function (publicInstance, completeState) { + warnNoop(publicInstance, 'replaceState'); + }, + + /** + * Sets a subset of the state. This only exists because _pendingState is + * internal. This provides a merging strategy that is not available to deep + * properties which is confusing. TODO: Expose pendingState or don't use it + * during the merge. + * + * @param {ReactClass} publicInstance The instance that should rerender. + * @param {object} partialState Next partial state to be merged with state. + * @internal + */ + enqueueSetState: function (publicInstance, partialState) { + warnNoop(publicInstance, 'setState'); + } +}; + +module.exports = ReactNoopUpdateQueue; +},{"49":49}],22:[function(_dereq_,module,exports){ +/** + * Copyright 2013-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + * + */ + +'use strict'; + +var ReactPropTypeLocationNames = {}; + +if ("development" !== 'production') { + ReactPropTypeLocationNames = { + prop: 'prop', + context: 'context', + childContext: 'child context' + }; +} + +module.exports = ReactPropTypeLocationNames; +},{}],23:[function(_dereq_,module,exports){ +/** + * Copyright 2013-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + */ + +'use strict'; + +var _require = _dereq_(16), + isValidElement = _require.isValidElement; + +var factory = _dereq_(52); + +module.exports = factory(isValidElement); +},{"16":16,"52":52}],24:[function(_dereq_,module,exports){ +/** + * Copyright 2013-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + * + */ + +'use strict'; + +var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED'; + +module.exports = ReactPropTypesSecret; +},{}],25:[function(_dereq_,module,exports){ +/** + * Copyright 2013-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + */ + +'use strict'; + +var _assign = _dereq_(50); + +var ReactComponent = _dereq_(11); +var ReactNoopUpdateQueue = _dereq_(21); + +var emptyObject = _dereq_(46); + +/** + * Base class helpers for the updating state of a component. + */ +function ReactPureComponent(props, context, updater) { + // Duplicated from ReactComponent. + this.props = props; + this.context = context; + this.refs = emptyObject; + // We initialize the default updater but the real one gets injected by the + // renderer. + this.updater = updater || ReactNoopUpdateQueue; +} + +function ComponentDummy() {} +ComponentDummy.prototype = ReactComponent.prototype; +ReactPureComponent.prototype = new ComponentDummy(); +ReactPureComponent.prototype.constructor = ReactPureComponent; +// Avoid an extra prototype jump for these methods. +_assign(ReactPureComponent.prototype, ReactComponent.prototype); +ReactPureComponent.prototype.isPureReactComponent = true; + +module.exports = ReactPureComponent; +},{"11":11,"21":21,"46":46,"50":50}],26:[function(_dereq_,module,exports){ +/** + * Copyright 2013-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + */ + +'use strict'; + +var ReactStateSetters = { + /** + * Returns a function that calls the provided function, and uses the result + * of that to set the component's state. + * + * @param {ReactCompositeComponent} component + * @param {function} funcReturningState Returned callback uses this to + * determine how to update state. + * @return {function} callback that when invoked uses funcReturningState to + * determined the object literal to setState. + */ + createStateSetter: function (component, funcReturningState) { + return function (a, b, c, d, e, f) { + var partialState = funcReturningState.call(component, a, b, c, d, e, f); + if (partialState) { + component.setState(partialState); + } + }; + }, + + /** + * Returns a single-argument callback that can be used to update a single + * key in the component's state. + * + * Note: this is memoized function, which makes it inexpensive to call. + * + * @param {ReactCompositeComponent} component + * @param {string} key The key in the state that you should update. + * @return {function} callback of 1 argument which calls setState() with + * the provided keyName and callback argument. + */ + createStateKeySetter: function (component, key) { + // Memoize the setters. + var cache = component.__keySetters || (component.__keySetters = {}); + return cache[key] || (cache[key] = createStateKeySetter(component, key)); + } +}; + +function createStateKeySetter(component, key) { + // Partial state is allocated outside of the function closure so it can be + // reused with every call, avoiding memory allocation when this function + // is called. + var partialState = {}; + return function stateKeySetter(value) { + partialState[key] = value; + component.setState(partialState); + }; +} + +ReactStateSetters.Mixin = { + /** + * Returns a function that calls the provided function, and uses the result + * of that to set the component's state. + * + * For example, these statements are equivalent: + * + * this.setState({x: 1}); + * this.createStateSetter(function(xValue) { + * return {x: xValue}; + * })(1); + * + * @param {function} funcReturningState Returned callback uses this to + * determine how to update state. + * @return {function} callback that when invoked uses funcReturningState to + * determined the object literal to setState. + */ + createStateSetter: function (funcReturningState) { + return ReactStateSetters.createStateSetter(this, funcReturningState); + }, + + /** + * Returns a single-argument callback that can be used to update a single + * key in the component's state. + * + * For example, these statements are equivalent: + * + * this.setState({x: 1}); + * this.createStateKeySetter('x')(1); + * + * Note: this is memoized function, which makes it inexpensive to call. + * + * @param {string} key The key in the state that you should update. + * @return {function} callback of 1 argument which calls setState() with + * the provided keyName and callback argument. + */ + createStateKeySetter: function (key) { + return ReactStateSetters.createStateKeySetter(this, key); + } +}; + +module.exports = ReactStateSetters; +},{}],27:[function(_dereq_,module,exports){ +/** + * Copyright 2013-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + */ + +'use strict'; + +var flattenChildren = _dereq_(35); + +var ReactTransitionChildMapping = { + /** + * Given `this.props.children`, return an object mapping key to child. Just + * simple syntactic sugar around flattenChildren(). + * + * @param {*} children `this.props.children` + * @param {number=} selfDebugID Optional debugID of the current internal instance. + * @return {object} Mapping of key to child + */ + getChildMapping: function (children, selfDebugID) { + if (!children) { + return children; + } + + if ("development" !== 'production') { + return flattenChildren(children, selfDebugID); + } + + return flattenChildren(children); + }, + + /** + * When you're adding or removing children some may be added or removed in the + * same render pass. We want to show *both* since we want to simultaneously + * animate elements in and out. This function takes a previous set of keys + * and a new set of keys and merges them with its best guess of the correct + * ordering. In the future we may expose some of the utilities in + * ReactMultiChild to make this easy, but for now React itself does not + * directly have this concept of the union of prevChildren and nextChildren + * so we implement it here. + * + * @param {object} prev prev children as returned from + * `ReactTransitionChildMapping.getChildMapping()`. + * @param {object} next next children as returned from + * `ReactTransitionChildMapping.getChildMapping()`. + * @return {object} a key set that contains all keys in `prev` and all keys + * in `next` in a reasonable order. + */ + mergeChildMappings: function (prev, next) { + prev = prev || {}; + next = next || {}; + + function getValueForKey(key) { + if (next.hasOwnProperty(key)) { + return next[key]; + } else { + return prev[key]; + } + } + + // For each key of `next`, the list of keys to insert before that key in + // the combined list + var nextKeysPending = {}; + + var pendingKeys = []; + for (var prevKey in prev) { + if (next.hasOwnProperty(prevKey)) { + if (pendingKeys.length) { + nextKeysPending[prevKey] = pendingKeys; + pendingKeys = []; + } + } else { + pendingKeys.push(prevKey); + } + } + + var i; + var childMapping = {}; + for (var nextKey in next) { + if (nextKeysPending.hasOwnProperty(nextKey)) { + for (i = 0; i < nextKeysPending[nextKey].length; i++) { + var pendingNextKey = nextKeysPending[nextKey][i]; + childMapping[nextKeysPending[nextKey][i]] = getValueForKey(pendingNextKey); + } + } + childMapping[nextKey] = getValueForKey(nextKey); + } + + // Finally, add the keys which didn't appear before any key in `next` + for (i = 0; i < pendingKeys.length; i++) { + childMapping[pendingKeys[i]] = getValueForKey(pendingKeys[i]); + } + + return childMapping; + } +}; + +module.exports = ReactTransitionChildMapping; +},{"35":35}],28:[function(_dereq_,module,exports){ +/** + * Copyright 2013-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + */ + +'use strict'; + +var ExecutionEnvironment = _dereq_(44); + +var getVendorPrefixedEventName = _dereq_(1); + +var endEvents = []; + +function detectEvents() { + var animEnd = getVendorPrefixedEventName('animationend'); + var transEnd = getVendorPrefixedEventName('transitionend'); + + if (animEnd) { + endEvents.push(animEnd); + } + + if (transEnd) { + endEvents.push(transEnd); + } +} + +if (ExecutionEnvironment.canUseDOM) { + detectEvents(); +} + +// We use the raw {add|remove}EventListener() call because EventListener +// does not know how to remove event listeners and we really should +// clean up. Also, these events are not triggered in older browsers +// so we should be A-OK here. + +function addEventListener(node, eventName, eventListener) { + node.addEventListener(eventName, eventListener, false); +} + +function removeEventListener(node, eventName, eventListener) { + node.removeEventListener(eventName, eventListener, false); +} + +var ReactTransitionEvents = { + addEndEventListener: function (node, eventListener) { + if (endEvents.length === 0) { + // If CSS transitions are not supported, trigger an "end animation" + // event immediately. + window.setTimeout(eventListener, 0); + return; + } + endEvents.forEach(function (endEvent) { + addEventListener(node, endEvent, eventListener); + }); + }, + + removeEndEventListener: function (node, eventListener) { + if (endEvents.length === 0) { + return; + } + endEvents.forEach(function (endEvent) { + removeEventListener(node, endEvent, eventListener); + }); + } +}; + +module.exports = ReactTransitionEvents; +},{"1":1,"44":44}],29:[function(_dereq_,module,exports){ +/** + * Copyright 2013-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + */ + +'use strict'; + +var _assign = _dereq_(50); + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + +var React = _dereq_(5); +var ReactTransitionChildMapping = _dereq_(27); + +var propTypesFactory = _dereq_(52); +var PropTypes = propTypesFactory(React.isValidElement); + +var emptyFunction = _dereq_(45); + +/** + * A basis for animations. When children are declaratively added or removed, + * special lifecycle hooks are called. + * See https://facebook.github.io/react/docs/animation.html#low-level-api-reacttransitiongroup + */ + +var ReactTransitionGroup = function (_React$Component) { + _inherits(ReactTransitionGroup, _React$Component); + + function ReactTransitionGroup() { + var _temp, _this, _ret; + + _classCallCheck(this, ReactTransitionGroup); + + for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + return _ret = (_temp = (_this = _possibleConstructorReturn(this, _React$Component.call.apply(_React$Component, [this].concat(args))), _this), _this.state = { + // TODO: can we get useful debug information to show at this point? + children: ReactTransitionChildMapping.getChildMapping(_this.props.children) + }, _this.performAppear = function (key) { + _this.currentlyTransitioningKeys[key] = true; + + var component = _this.refs[key]; + + if (component.componentWillAppear) { + component.componentWillAppear(_this._handleDoneAppearing.bind(_this, key)); + } else { + _this._handleDoneAppearing(key); + } + }, _this._handleDoneAppearing = function (key) { + var component = _this.refs[key]; + if (component.componentDidAppear) { + component.componentDidAppear(); + } + + delete _this.currentlyTransitioningKeys[key]; + + var currentChildMapping = ReactTransitionChildMapping.getChildMapping(_this.props.children); + + if (!currentChildMapping || !currentChildMapping.hasOwnProperty(key)) { + // This was removed before it had fully appeared. Remove it. + _this.performLeave(key); + } + }, _this.performEnter = function (key) { + _this.currentlyTransitioningKeys[key] = true; + + var component = _this.refs[key]; + + if (component.componentWillEnter) { + component.componentWillEnter(_this._handleDoneEntering.bind(_this, key)); + } else { + _this._handleDoneEntering(key); + } + }, _this._handleDoneEntering = function (key) { + var component = _this.refs[key]; + if (component.componentDidEnter) { + component.componentDidEnter(); + } + + delete _this.currentlyTransitioningKeys[key]; + + var currentChildMapping = ReactTransitionChildMapping.getChildMapping(_this.props.children); + + if (!currentChildMapping || !currentChildMapping.hasOwnProperty(key)) { + // This was removed before it had fully entered. Remove it. + _this.performLeave(key); + } + }, _this.performLeave = function (key) { + _this.currentlyTransitioningKeys[key] = true; + + var component = _this.refs[key]; + if (component.componentWillLeave) { + component.componentWillLeave(_this._handleDoneLeaving.bind(_this, key)); + } else { + // Note that this is somewhat dangerous b/c it calls setState() + // again, effectively mutating the component before all the work + // is done. + _this._handleDoneLeaving(key); + } + }, _this._handleDoneLeaving = function (key) { + var component = _this.refs[key]; + + if (component.componentDidLeave) { + component.componentDidLeave(); + } + + delete _this.currentlyTransitioningKeys[key]; + + var currentChildMapping = ReactTransitionChildMapping.getChildMapping(_this.props.children); + + if (currentChildMapping && currentChildMapping.hasOwnProperty(key)) { + // This entered again before it fully left. Add it again. + _this.performEnter(key); + } else { + _this.setState(function (state) { + var newChildren = _assign({}, state.children); + delete newChildren[key]; + return { children: newChildren }; + }); + } + }, _temp), _possibleConstructorReturn(_this, _ret); + } + + ReactTransitionGroup.prototype.componentWillMount = function componentWillMount() { + this.currentlyTransitioningKeys = {}; + this.keysToEnter = []; + this.keysToLeave = []; + }; + + ReactTransitionGroup.prototype.componentDidMount = function componentDidMount() { + var initialChildMapping = this.state.children; + for (var key in initialChildMapping) { + if (initialChildMapping[key]) { + this.performAppear(key); + } + } + }; + + ReactTransitionGroup.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) { + var nextChildMapping = ReactTransitionChildMapping.getChildMapping(nextProps.children); + var prevChildMapping = this.state.children; + + this.setState({ + children: ReactTransitionChildMapping.mergeChildMappings(prevChildMapping, nextChildMapping) + }); + + var key; + + for (key in nextChildMapping) { + var hasPrev = prevChildMapping && prevChildMapping.hasOwnProperty(key); + if (nextChildMapping[key] && !hasPrev && !this.currentlyTransitioningKeys[key]) { + this.keysToEnter.push(key); + } + } + + for (key in prevChildMapping) { + var hasNext = nextChildMapping && nextChildMapping.hasOwnProperty(key); + if (prevChildMapping[key] && !hasNext && !this.currentlyTransitioningKeys[key]) { + this.keysToLeave.push(key); + } + } + + // If we want to someday check for reordering, we could do it here. + }; + + ReactTransitionGroup.prototype.componentDidUpdate = function componentDidUpdate() { + var keysToEnter = this.keysToEnter; + this.keysToEnter = []; + keysToEnter.forEach(this.performEnter); + + var keysToLeave = this.keysToLeave; + this.keysToLeave = []; + keysToLeave.forEach(this.performLeave); + }; + + ReactTransitionGroup.prototype.render = function render() { + // TODO: we could get rid of the need for the wrapper node + // by cloning a single child + var childrenToRender = []; + for (var key in this.state.children) { + var child = this.state.children[key]; + if (child) { + // You may need to apply reactive updates to a child as it is leaving. + // The normal React way to do it won't work since the child will have + // already been removed. In case you need this behavior you can provide + // a childFactory function to wrap every child, even the ones that are + // leaving. + childrenToRender.push(React.cloneElement(this.props.childFactory(child), { ref: key, key: key })); + } + } + + // Do not forward ReactTransitionGroup props to primitive DOM nodes + var props = _assign({}, this.props); + delete props.transitionLeave; + delete props.transitionName; + delete props.transitionAppear; + delete props.transitionEnter; + delete props.childFactory; + delete props.transitionLeaveTimeout; + delete props.transitionEnterTimeout; + delete props.transitionAppearTimeout; + delete props.component; + + return React.createElement(this.props.component, props, childrenToRender); + }; + + return ReactTransitionGroup; +}(React.Component); + +ReactTransitionGroup.displayName = 'ReactTransitionGroup'; +ReactTransitionGroup.propTypes = { + component: PropTypes.any, + childFactory: PropTypes.func +}; +ReactTransitionGroup.defaultProps = { + component: 'span', + childFactory: emptyFunction.thatReturnsArgument +}; + + +module.exports = ReactTransitionGroup; +},{"27":27,"45":45,"5":5,"50":50,"52":52}],30:[function(_dereq_,module,exports){ +/** + * Copyright 2013-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + */ + +'use strict'; + +module.exports = '15.5.4'; +},{}],31:[function(_dereq_,module,exports){ +/** + * Copyright 2013-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + */ + +'use strict'; + +var LinkedStateMixin = _dereq_(3); +var React = _dereq_(5); +var ReactAddonsDOMDependencies = _dereq_(6); +var ReactComponentWithPureRenderMixin = _dereq_(13); +var ReactCSSTransitionGroup = _dereq_(7); +var ReactFragment = _dereq_(19); +var ReactTransitionGroup = _dereq_(29); + +var shallowCompare = _dereq_(40); +var update = _dereq_(42); + +React.addons = { + CSSTransitionGroup: ReactCSSTransitionGroup, + LinkedStateMixin: LinkedStateMixin, + PureRenderMixin: ReactComponentWithPureRenderMixin, + TransitionGroup: ReactTransitionGroup, + + createFragment: ReactFragment.create, + shallowCompare: shallowCompare, + update: update +}; + +if ("development" !== 'production') { + // For the UMD build we get these lazily from the global since they're tied + // to the DOM renderer and it hasn't loaded yet. + Object.defineProperty(React.addons, 'Perf', { + enumerable: true, + get: function () { + return ReactAddonsDOMDependencies.getReactPerf(); + } + }); + Object.defineProperty(React.addons, 'TestUtils', { + enumerable: true, + get: function () { + return ReactAddonsDOMDependencies.getReactTestUtils(); + } + }); +} + +module.exports = React; +},{"13":13,"19":19,"29":29,"3":3,"40":40,"42":42,"5":5,"6":6,"7":7}],32:[function(_dereq_,module,exports){ +/** + * Copyright 2013-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + */ + +'use strict'; + +var _assign = _dereq_(50); + +var ReactWithAddons = _dereq_(31); + +// `version` will be added here by the React module. +var ReactWithAddonsUMDEntry = _assign(ReactWithAddons, { + __SECRET_INJECTED_REACT_DOM_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: null, // Will be injected by ReactDOM UMD build. + __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: { + ReactCurrentOwner: _dereq_(14) + } +}); + +if ("development" !== 'production') { + _assign(ReactWithAddonsUMDEntry.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED, { + // ReactComponentTreeHook should not be included in production. + ReactComponentTreeHook: _dereq_(12), + getNextDebugID: _dereq_(37) + }); +} + +module.exports = ReactWithAddonsUMDEntry; +},{"12":12,"14":14,"31":31,"37":37,"50":50}],33:[function(_dereq_,module,exports){ +/** + * Copyright 2013-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + * + */ + +'use strict'; + +var canDefineProperty = false; +if ("development" !== 'production') { + try { + // $FlowFixMe https://github.com/facebook/flow/issues/285 + Object.defineProperty({}, 'x', { get: function () {} }); + canDefineProperty = true; + } catch (x) { + // IE will fail on defineProperty + } +} + +module.exports = canDefineProperty; +},{}],34:[function(_dereq_,module,exports){ +(function (process){ +/** + * Copyright 2013-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + */ + +'use strict'; + +var _prodInvariant = _dereq_(39); + +var ReactPropTypeLocationNames = _dereq_(22); +var ReactPropTypesSecret = _dereq_(24); + +var invariant = _dereq_(47); +var warning = _dereq_(49); + +var ReactComponentTreeHook; + +if (typeof process !== 'undefined' && process.env && "development" === 'test') { + // Temporary hack. + // Inline requires don't work well with Jest: + // https://github.com/facebook/react/issues/7240 + // Remove the inline requires when we don't need them anymore: + // https://github.com/facebook/react/pull/7178 + ReactComponentTreeHook = _dereq_(12); +} + +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 {?object} element The React element that is being type-checked + * @param {?number} debugID The React component instance that is being type-checked + * @private + */ +function checkReactTypeSpec(typeSpecs, values, location, componentName, element, debugID) { + 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. + !(typeof typeSpecs[typeSpecName] === 'function') ? "development" !== 'production' ? invariant(false, '%s: %s type `%s` is invalid; it must be a function, usually from React.PropTypes.', componentName || 'React class', ReactPropTypeLocationNames[location], typeSpecName) : _prodInvariant('84', componentName || 'React class', ReactPropTypeLocationNames[location], typeSpecName) : void 0; + error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret); + } catch (ex) { + error = ex; + } + "development" !== 'production' ? 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', ReactPropTypeLocationNames[location], typeSpecName, typeof error) : void 0; + 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 componentStackInfo = ''; + + if ("development" !== 'production') { + if (!ReactComponentTreeHook) { + ReactComponentTreeHook = _dereq_(12); + } + if (debugID !== null) { + componentStackInfo = ReactComponentTreeHook.getStackAddendumByID(debugID); + } else if (element !== null) { + componentStackInfo = ReactComponentTreeHook.getCurrentStackAddendum(element); + } + } + + "development" !== 'production' ? warning(false, 'Failed %s type: %s%s', location, error.message, componentStackInfo) : void 0; + } + } + } +} + +module.exports = checkReactTypeSpec; +}).call(this,undefined) +},{"12":12,"22":22,"24":24,"39":39,"47":47,"49":49}],35:[function(_dereq_,module,exports){ +(function (process){ +/** + * Copyright 2013-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + * + */ + +'use strict'; + +var KeyEscapeUtils = _dereq_(2); +var traverseAllChildren = _dereq_(41); +var warning = _dereq_(49); + +var ReactComponentTreeHook; + +if (typeof process !== 'undefined' && process.env && "development" === 'test') { + // Temporary hack. + // Inline requires don't work well with Jest: + // https://github.com/facebook/react/issues/7240 + // Remove the inline requires when we don't need them anymore: + // https://github.com/facebook/react/pull/7178 + ReactComponentTreeHook = _dereq_(12); +} + +/** + * @param {function} traverseContext Context passed through traversal. + * @param {?ReactComponent} child React child component. + * @param {!string} name String name of key path to child. + * @param {number=} selfDebugID Optional debugID of the current internal instance. + */ +function flattenSingleChildIntoContext(traverseContext, child, name, selfDebugID) { + // We found a component instance. + if (traverseContext && typeof traverseContext === 'object') { + var result = traverseContext; + var keyUnique = result[name] === undefined; + if ("development" !== 'production') { + if (!ReactComponentTreeHook) { + ReactComponentTreeHook = _dereq_(12); + } + if (!keyUnique) { + "development" !== 'production' ? warning(false, 'flattenChildren(...): Encountered two children with the same key, ' + '`%s`. Child keys must be unique; when two children share a key, only ' + 'the first child will be used.%s', KeyEscapeUtils.unescape(name), ReactComponentTreeHook.getStackAddendumByID(selfDebugID)) : void 0; + } + } + if (keyUnique && child != null) { + result[name] = child; + } + } +} + +/** + * Flattens children that are typically specified as `props.children`. Any null + * children will not be included in the resulting object. + * @return {!object} flattened children keyed by name. + */ +function flattenChildren(children, selfDebugID) { + if (children == null) { + return children; + } + var result = {}; + + if ("development" !== 'production') { + traverseAllChildren(children, function (traverseContext, child, name) { + return flattenSingleChildIntoContext(traverseContext, child, name, selfDebugID); + }, result); + } else { + traverseAllChildren(children, flattenSingleChildIntoContext, result); + } + return result; +} + +module.exports = flattenChildren; +}).call(this,undefined) +},{"12":12,"2":2,"41":41,"49":49}],36:[function(_dereq_,module,exports){ +/** + * Copyright 2013-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + * + */ + +'use strict'; + +/* 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; + } +} + +module.exports = getIteratorFn; +},{}],37:[function(_dereq_,module,exports){ +/** + * Copyright 2013-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + * + */ + +'use strict'; + +var nextDebugID = 1; + +function getNextDebugID() { + return nextDebugID++; +} + +module.exports = getNextDebugID; +},{}],38:[function(_dereq_,module,exports){ +/** + * Copyright 2013-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + */ +'use strict'; + +var _prodInvariant = _dereq_(39); + +var ReactElement = _dereq_(16); + +var invariant = _dereq_(47); + +/** + * Returns the first child in a collection of children and verifies that there + * is only one child in the collection. + * + * See https://facebook.github.io/react/docs/top-level-api.html#react.children.only + * + * The current implementation of this function assumes that a single child gets + * passed without a wrapper, but the purpose of this helper function is to + * abstract away the particular structure of children. + * + * @param {?object} children Child collection structure. + * @return {ReactElement} The first and only `ReactElement` contained in the + * structure. + */ +function onlyChild(children) { + !ReactElement.isValidElement(children) ? "development" !== 'production' ? invariant(false, 'React.Children.only expected to receive a single React element child.') : _prodInvariant('143') : void 0; + return children; +} + +module.exports = onlyChild; +},{"16":16,"39":39,"47":47}],39:[function(_dereq_,module,exports){ +/** + * Copyright (c) 2013-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + * + */ +'use strict'; + +/** + * WARNING: DO NOT manually require this module. + * This is a replacement for `invariant(...)` used by the error code system + * and will _only_ be required by the corresponding babel pass. + * It always throws. + */ + +function reactProdInvariant(code) { + var argCount = arguments.length - 1; + + var message = 'Minified React error #' + code + '; visit ' + 'http://facebook.github.io/react/docs/error-decoder.html?invariant=' + code; + + for (var argIdx = 0; argIdx < argCount; argIdx++) { + message += '&args[]=' + encodeURIComponent(arguments[argIdx + 1]); + } + + message += ' for the full message or use the non-minified dev environment' + ' for full errors and additional helpful warnings.'; + + var error = new Error(message); + error.name = 'Invariant Violation'; + error.framesToPop = 1; // we don't care about reactProdInvariant's own frame + + throw error; +} + +module.exports = reactProdInvariant; +},{}],40:[function(_dereq_,module,exports){ +/** + * Copyright 2013-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + */ + +'use strict'; + +var shallowEqual = _dereq_(48); + +/** + * Does a shallow comparison for props and state. + * See ReactComponentWithPureRenderMixin + * See also https://facebook.github.io/react/docs/shallow-compare.html + */ +function shallowCompare(instance, nextProps, nextState) { + return !shallowEqual(instance.props, nextProps) || !shallowEqual(instance.state, nextState); +} + +module.exports = shallowCompare; +},{"48":48}],41:[function(_dereq_,module,exports){ +/** + * Copyright 2013-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + */ + +'use strict'; + +var _prodInvariant = _dereq_(39); + +var ReactCurrentOwner = _dereq_(14); +var REACT_ELEMENT_TYPE = _dereq_(17); + +var getIteratorFn = _dereq_(36); +var invariant = _dereq_(47); +var KeyEscapeUtils = _dereq_(2); +var warning = _dereq_(49); + +var SEPARATOR = '.'; +var SUBSEPARATOR = ':'; + +/** + * This is inlined from ReactElement since this file is shared between + * isomorphic and renderers. We could extract this to a + * + */ + +/** + * TODO: Test that a single child and an array with one item have the same key + * pattern. + */ + +var didWarnAboutMaps = false; + +/** + * Generate a key string that identifies a component within a set. + * + * @param {*} component A component that could contain a manual key. + * @param {number} index Index that is used if a manual key is not provided. + * @return {string} + */ +function getComponentKey(component, index) { + // Do some typechecking here since we call this blindly. We want to ensure + // that we don't block potential future ES APIs. + if (component && typeof component === 'object' && component.key != null) { + // Explicit key + return KeyEscapeUtils.escape(component.key); + } + // Implicit key determined by the index in the set + return index.toString(36); +} + +/** + * @param {?*} children Children tree container. + * @param {!string} nameSoFar Name of the key path so far. + * @param {!function} callback Callback to invoke with each child found. + * @param {?*} traverseContext Used to pass information throughout the traversal + * process. + * @return {!number} The number of children in this subtree. + */ +function traverseAllChildrenImpl(children, nameSoFar, callback, traverseContext) { + var type = typeof children; + + if (type === 'undefined' || type === 'boolean') { + // All of the above are perceived as null. + children = null; + } + + if (children === null || type === 'string' || type === 'number' || + // The following is inlined from ReactElement. This means we can optimize + // some checks. React Fiber also inlines this logic for similar purposes. + type === 'object' && children.$$typeof === REACT_ELEMENT_TYPE) { + callback(traverseContext, children, + // If it's the only child, treat the name as if it was wrapped in an array + // so that it's consistent if the number of children grows. + nameSoFar === '' ? SEPARATOR + getComponentKey(children, 0) : nameSoFar); + return 1; + } + + var child; + var nextName; + var subtreeCount = 0; // Count of children found in the current subtree. + var nextNamePrefix = nameSoFar === '' ? SEPARATOR : nameSoFar + SUBSEPARATOR; + + if (Array.isArray(children)) { + for (var i = 0; i < children.length; i++) { + child = children[i]; + nextName = nextNamePrefix + getComponentKey(child, i); + subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext); + } + } else { + var iteratorFn = getIteratorFn(children); + if (iteratorFn) { + var iterator = iteratorFn.call(children); + var step; + if (iteratorFn !== children.entries) { + var ii = 0; + while (!(step = iterator.next()).done) { + child = step.value; + nextName = nextNamePrefix + getComponentKey(child, ii++); + subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext); + } + } else { + if ("development" !== 'production') { + var mapsAsChildrenAddendum = ''; + if (ReactCurrentOwner.current) { + var mapsAsChildrenOwnerName = ReactCurrentOwner.current.getName(); + if (mapsAsChildrenOwnerName) { + mapsAsChildrenAddendum = ' Check the render method of `' + mapsAsChildrenOwnerName + '`.'; + } + } + "development" !== 'production' ? warning(didWarnAboutMaps, 'Using Maps as children is not yet fully supported. It is an ' + 'experimental feature that might be removed. Convert it to a ' + 'sequence / iterable of keyed ReactElements instead.%s', mapsAsChildrenAddendum) : void 0; + didWarnAboutMaps = true; + } + // Iterator will provide entry [k,v] tuples rather than values. + while (!(step = iterator.next()).done) { + var entry = step.value; + if (entry) { + child = entry[1]; + nextName = nextNamePrefix + KeyEscapeUtils.escape(entry[0]) + SUBSEPARATOR + getComponentKey(child, 0); + subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext); + } + } + } + } else if (type === 'object') { + var addendum = ''; + if ("development" !== 'production') { + addendum = ' If you meant to render a collection of children, use an array ' + 'instead or wrap the object using createFragment(object) from the ' + 'React add-ons.'; + if (children._isReactElement) { + addendum = ' It looks like you\'re using an element created by a different ' + 'version of React. Make sure to use only one copy of React.'; + } + if (ReactCurrentOwner.current) { + var name = ReactCurrentOwner.current.getName(); + if (name) { + addendum += ' Check the render method of `' + name + '`.'; + } + } + } + var childrenString = String(children); + !false ? "development" !== 'production' ? invariant(false, 'Objects are not valid as a React child (found: %s).%s', childrenString === '[object Object]' ? 'object with keys {' + Object.keys(children).join(', ') + '}' : childrenString, addendum) : _prodInvariant('31', childrenString === '[object Object]' ? 'object with keys {' + Object.keys(children).join(', ') + '}' : childrenString, addendum) : void 0; + } + } + + return subtreeCount; +} + +/** + * Traverses children that are typically specified as `props.children`, but + * might also be specified through attributes: + * + * - `traverseAllChildren(this.props.children, ...)` + * - `traverseAllChildren(this.props.leftPanelChildren, ...)` + * + * The `traverseContext` is an optional argument that is passed through the + * entire traversal. It can be used to store accumulations or anything else that + * the callback might find relevant. + * + * @param {?*} children Children tree object. + * @param {!function} callback To invoke upon traversing each child. + * @param {?*} traverseContext Context for traversal. + * @return {!number} The number of children in this subtree. + */ +function traverseAllChildren(children, callback, traverseContext) { + if (children == null) { + return 0; + } + + return traverseAllChildrenImpl(children, '', callback, traverseContext); +} + +module.exports = traverseAllChildren; +},{"14":14,"17":17,"2":2,"36":36,"39":39,"47":47,"49":49}],42:[function(_dereq_,module,exports){ +/** + * Copyright 2013-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + */ + +/* global hasOwnProperty:true */ + +'use strict'; + +var _prodInvariant = _dereq_(39), + _assign = _dereq_(50); + +var invariant = _dereq_(47); +var hasOwnProperty = {}.hasOwnProperty; + +function shallowCopy(x) { + if (Array.isArray(x)) { + return x.concat(); + } else if (x && typeof x === 'object') { + return _assign(new x.constructor(), x); + } else { + return x; + } +} + +var COMMAND_PUSH = '$push'; +var COMMAND_UNSHIFT = '$unshift'; +var COMMAND_SPLICE = '$splice'; +var COMMAND_SET = '$set'; +var COMMAND_MERGE = '$merge'; +var COMMAND_APPLY = '$apply'; + +var ALL_COMMANDS_LIST = [COMMAND_PUSH, COMMAND_UNSHIFT, COMMAND_SPLICE, COMMAND_SET, COMMAND_MERGE, COMMAND_APPLY]; + +var ALL_COMMANDS_SET = {}; + +ALL_COMMANDS_LIST.forEach(function (command) { + ALL_COMMANDS_SET[command] = true; +}); + +function invariantArrayCase(value, spec, command) { + !Array.isArray(value) ? "development" !== 'production' ? invariant(false, 'update(): expected target of %s to be an array; got %s.', command, value) : _prodInvariant('1', command, value) : void 0; + var specValue = spec[command]; + !Array.isArray(specValue) ? "development" !== 'production' ? invariant(false, 'update(): expected spec of %s to be an array; got %s. Did you forget to wrap your parameter in an array?', command, specValue) : _prodInvariant('2', command, specValue) : void 0; +} + +/** + * Returns a updated shallow copy of an object without mutating the original. + * See https://facebook.github.io/react/docs/update.html for details. + */ +function update(value, spec) { + !(typeof spec === 'object') ? "development" !== 'production' ? invariant(false, 'update(): You provided a key path to update() that did not contain one of %s. Did you forget to include {%s: ...}?', ALL_COMMANDS_LIST.join(', '), COMMAND_SET) : _prodInvariant('3', ALL_COMMANDS_LIST.join(', '), COMMAND_SET) : void 0; + + if (hasOwnProperty.call(spec, COMMAND_SET)) { + !(Object.keys(spec).length === 1) ? "development" !== 'production' ? invariant(false, 'Cannot have more than one key in an object with %s', COMMAND_SET) : _prodInvariant('4', COMMAND_SET) : void 0; + + return spec[COMMAND_SET]; + } + + var nextValue = shallowCopy(value); + + if (hasOwnProperty.call(spec, COMMAND_MERGE)) { + var mergeObj = spec[COMMAND_MERGE]; + !(mergeObj && typeof mergeObj === 'object') ? "development" !== 'production' ? invariant(false, 'update(): %s expects a spec of type \'object\'; got %s', COMMAND_MERGE, mergeObj) : _prodInvariant('5', COMMAND_MERGE, mergeObj) : void 0; + !(nextValue && typeof nextValue === 'object') ? "development" !== 'production' ? invariant(false, 'update(): %s expects a target of type \'object\'; got %s', COMMAND_MERGE, nextValue) : _prodInvariant('6', COMMAND_MERGE, nextValue) : void 0; + _assign(nextValue, spec[COMMAND_MERGE]); + } + + if (hasOwnProperty.call(spec, COMMAND_PUSH)) { + invariantArrayCase(value, spec, COMMAND_PUSH); + spec[COMMAND_PUSH].forEach(function (item) { + nextValue.push(item); + }); + } + + if (hasOwnProperty.call(spec, COMMAND_UNSHIFT)) { + invariantArrayCase(value, spec, COMMAND_UNSHIFT); + spec[COMMAND_UNSHIFT].forEach(function (item) { + nextValue.unshift(item); + }); + } + + if (hasOwnProperty.call(spec, COMMAND_SPLICE)) { + !Array.isArray(value) ? "development" !== 'production' ? invariant(false, 'Expected %s target to be an array; got %s', COMMAND_SPLICE, value) : _prodInvariant('7', COMMAND_SPLICE, value) : void 0; + !Array.isArray(spec[COMMAND_SPLICE]) ? "development" !== 'production' ? invariant(false, 'update(): expected spec of %s to be an array of arrays; got %s. Did you forget to wrap your parameters in an array?', COMMAND_SPLICE, spec[COMMAND_SPLICE]) : _prodInvariant('8', COMMAND_SPLICE, spec[COMMAND_SPLICE]) : void 0; + spec[COMMAND_SPLICE].forEach(function (args) { + !Array.isArray(args) ? "development" !== 'production' ? invariant(false, 'update(): expected spec of %s to be an array of arrays; got %s. Did you forget to wrap your parameters in an array?', COMMAND_SPLICE, spec[COMMAND_SPLICE]) : _prodInvariant('8', COMMAND_SPLICE, spec[COMMAND_SPLICE]) : void 0; + nextValue.splice.apply(nextValue, args); + }); + } + + if (hasOwnProperty.call(spec, COMMAND_APPLY)) { + !(typeof spec[COMMAND_APPLY] === 'function') ? "development" !== 'production' ? invariant(false, 'update(): expected spec of %s to be a function; got %s.', COMMAND_APPLY, spec[COMMAND_APPLY]) : _prodInvariant('9', COMMAND_APPLY, spec[COMMAND_APPLY]) : void 0; + nextValue = spec[COMMAND_APPLY](nextValue); + } + + for (var k in spec) { + if (!(ALL_COMMANDS_SET.hasOwnProperty(k) && ALL_COMMANDS_SET[k])) { + nextValue[k] = update(value[k], spec[k]); + } + } + + return nextValue; +} + +module.exports = update; +},{"39":39,"47":47,"50":50}],43:[function(_dereq_,module,exports){ +'use strict'; + +/** + * Copyright (c) 2013-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + * @typechecks + */ + +var invariant = _dereq_(47); + +/** + * The CSSCore module specifies the API (and implements most of the methods) + * that should be used when dealing with the display of elements (via their + * CSS classes and visibility on screen. It is an API focused on mutating the + * display and not reading it as no logical state should be encoded in the + * display of elements. + */ + +/* Slow implementation for browsers that don't natively support .matches() */ +function matchesSelector_SLOW(element, selector) { + var root = element; + while (root.parentNode) { + root = root.parentNode; + } + + var all = root.querySelectorAll(selector); + return Array.prototype.indexOf.call(all, element) !== -1; +} + +var CSSCore = { + + /** + * Adds the class passed in to the element if it doesn't already have it. + * + * @param {DOMElement} element the element to set the class on + * @param {string} className the CSS className + * @return {DOMElement} the element passed in + */ + addClass: function addClass(element, className) { + !!/\s/.test(className) ? "development" !== 'production' ? invariant(false, 'CSSCore.addClass takes only a single class name. "%s" contains ' + 'multiple classes.', className) : invariant(false) : void 0; + + if (className) { + if (element.classList) { + element.classList.add(className); + } else if (!CSSCore.hasClass(element, className)) { + element.className = element.className + ' ' + className; + } + } + return element; + }, + + /** + * Removes the class passed in from the element + * + * @param {DOMElement} element the element to set the class on + * @param {string} className the CSS className + * @return {DOMElement} the element passed in + */ + removeClass: function removeClass(element, className) { + !!/\s/.test(className) ? "development" !== 'production' ? invariant(false, 'CSSCore.removeClass takes only a single class name. "%s" contains ' + 'multiple classes.', className) : invariant(false) : void 0; + + if (className) { + if (element.classList) { + element.classList.remove(className); + } else if (CSSCore.hasClass(element, className)) { + element.className = element.className.replace(new RegExp('(^|\\s)' + className + '(?:\\s|$)', 'g'), '$1').replace(/\s+/g, ' ') // multiple spaces to one + .replace(/^\s*|\s*$/g, ''); // trim the ends + } + } + return element; + }, + + /** + * Helper to add or remove a class from an element based on a condition. + * + * @param {DOMElement} element the element to set the class on + * @param {string} className the CSS className + * @param {*} bool condition to whether to add or remove the class + * @return {DOMElement} the element passed in + */ + conditionClass: function conditionClass(element, className, bool) { + return (bool ? CSSCore.addClass : CSSCore.removeClass)(element, className); + }, + + /** + * Tests whether the element has the class specified. + * + * @param {DOMNode|DOMWindow} element the element to check the class on + * @param {string} className the CSS className + * @return {boolean} true if the element has the class, false if not + */ + hasClass: function hasClass(element, className) { + !!/\s/.test(className) ? "development" !== 'production' ? invariant(false, 'CSS.hasClass takes only a single class name.') : invariant(false) : void 0; + if (element.classList) { + return !!className && element.classList.contains(className); + } + return (' ' + element.className + ' ').indexOf(' ' + className + ' ') > -1; + }, + + /** + * Tests whether the element matches the selector specified + * + * @param {DOMNode|DOMWindow} element the element that we are querying + * @param {string} selector the CSS selector + * @return {boolean} true if the element matches the selector, false if not + */ + matchesSelector: function matchesSelector(element, selector) { + var matchesImpl = element.matches || element.webkitMatchesSelector || element.mozMatchesSelector || element.msMatchesSelector || function (s) { + return matchesSelector_SLOW(element, s); + }; + return matchesImpl.call(element, selector); + } + +}; + +module.exports = CSSCore; +},{"47":47}],44:[function(_dereq_,module,exports){ +/** + * Copyright (c) 2013-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + */ + +'use strict'; + +var canUseDOM = !!(typeof window !== 'undefined' && window.document && window.document.createElement); + +/** + * Simple, lightweight module assisting with the detection and context of + * Worker. Helps avoid circular dependencies and allows code to reason about + * whether or not they are in a Worker, even if they never include the main + * `ReactWorker` dependency. + */ +var ExecutionEnvironment = { + + canUseDOM: canUseDOM, + + canUseWorkers: typeof Worker !== 'undefined', + + canUseEventListeners: canUseDOM && !!(window.addEventListener || window.attachEvent), + + canUseViewport: canUseDOM && !!window.screen, + + isInWorker: !canUseDOM // For now, this is true - might change in the future. + +}; + +module.exports = ExecutionEnvironment; +},{}],45:[function(_dereq_,module,exports){ +"use strict"; + +/** + * Copyright (c) 2013-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + * + */ + +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; +},{}],46:[function(_dereq_,module,exports){ +/** + * Copyright (c) 2013-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + */ + +'use strict'; + +var emptyObject = {}; + +if ("development" !== 'production') { + Object.freeze(emptyObject); +} + +module.exports = emptyObject; +},{}],47:[function(_dereq_,module,exports){ +/** + * Copyright (c) 2013-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + */ + +'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; +},{}],48:[function(_dereq_,module,exports){ +/** + * Copyright (c) 2013-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + * @typechecks + * + */ + +/*eslint-disable no-self-compare */ + +'use strict'; + +var hasOwnProperty = Object.prototype.hasOwnProperty; + +/** + * 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 + */ +function is(x, y) { + // SameValue algorithm + if (x === y) { + // Steps 1-5, 7-10 + // Steps 6.b-6.e: +0 != -0 + // Added the nonzero y check to make Flow happy, but it is redundant + return x !== 0 || y !== 0 || 1 / x === 1 / y; + } else { + // Step 6.a: NaN == NaN + return x !== x && y !== y; + } +} + +/** + * Performs equality by iterating through keys on an object and returning false + * when any key has values which are not strictly equal between the arguments. + * Returns true when the values of all keys are strictly equal. + */ +function shallowEqual(objA, objB) { + if (is(objA, objB)) { + return true; + } + + if (typeof objA !== 'object' || objA === null || typeof objB !== 'object' || objB === null) { + return false; + } + + var keysA = Object.keys(objA); + var keysB = Object.keys(objB); + + if (keysA.length !== keysB.length) { + return false; + } + + // Test for A's keys different from B. + for (var i = 0; i < keysA.length; i++) { + if (!hasOwnProperty.call(objB, keysA[i]) || !is(objA[keysA[i]], objB[keysA[i]])) { + return false; + } + } + + return true; +} + +module.exports = shallowEqual; +},{}],49:[function(_dereq_,module,exports){ +/** + * Copyright 2014-2015, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + */ + +'use strict'; + +var emptyFunction = _dereq_(45); + +/** + * 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') { + (function () { + 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; +},{"45":45}],50:[function(_dereq_,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; +}; + +},{}],51:[function(_dereq_,module,exports){ +/** + * Copyright 2013-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + */ + +'use strict'; + +if ("development" !== 'production') { + var invariant = _dereq_(47); + var warning = _dereq_(49); + var ReactPropTypesSecret = _dereq_(54); + 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 ' + 'React.PropTypes.', componentName || 'React class', location, 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; + +},{"47":47,"49":49,"54":54}],52:[function(_dereq_,module,exports){ +/** + * Copyright 2013-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + */ + +'use strict'; + +// React 15.5 references this module, and assumes PropTypes are still callable in production. +// Therefore we re-export development-only version with all the PropTypes checks here. +// However if one is migrating to the `prop-types` npm library, they will go through the +// `index.js` entry point, and it will branch depending on the environment. +var factory = _dereq_(53); +module.exports = function(isValidElement) { + // It is still allowed in 15.5. + var throwOnDirectAccess = false; + return factory(isValidElement, throwOnDirectAccess); +}; + +},{"53":53}],53:[function(_dereq_,module,exports){ +/** + * Copyright 2013-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + */ + +'use strict'; + +var emptyFunction = _dereq_(45); +var invariant = _dereq_(47); +var warning = _dereq_(49); + +var ReactPropTypesSecret = _dereq_(54); +var checkPropTypes = _dereq_(51); + +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 = '<>'; + + // 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 + }; + + /** + * 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 = {}; + } + 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]) { + 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; + } + } + } + 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; + } + + 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 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) { + var propType = getPropType(propValue); + if (propType === 'object') { + if (propValue instanceof Date) { + return 'date'; + } else if (propValue instanceof RegExp) { + return 'regexp'; + } + } + return propType; + } + + // 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; +}; + +},{"45":45,"47":47,"49":49,"51":51,"54":54}],54:[function(_dereq_,module,exports){ +/** + * Copyright 2013-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + */ + +'use strict'; + +var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED'; + +module.exports = ReactPropTypesSecret; + +},{}]},{},[32])(32) +}); \ No newline at end of file diff --git a/node_modules/react/dist/react-with-addons.min.js b/node_modules/react/dist/react-with-addons.min.js new file mode 100644 index 00000000..c00a1ed9 --- /dev/null +++ b/node_modules/react/dist/react-with-addons.min.js @@ -0,0 +1,13 @@ +/** + * React (with addons) v15.5.4 + * + * Copyright 2013-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + */ +!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var t;t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,t.React=e()}}(function(){return function e(t,n,r){function o(a,s){if(!n[a]){if(!t[a]){var u="function"==typeof require&&require;if(!s&&u)return u(a,!0);if(i)return i(a,!0);var c=new Error("Cannot find module '"+a+"'");throw c.code="MODULE_NOT_FOUND",c}var p=n[a]={exports:{}};t[a][0].call(p.exports,function(e){var n=t[a][1][e];return o(n||e)},p,p.exports,e,t,n,r)}return n[a].exports}for(var i="function"==typeof require&&require,a=0;a1){for(var h=Array(d),y=0;y1){for(var m=Array(v),E=0;E-1},matchesSelector:function(e,t){return(e.matches||e.webkitMatchesSelector||e.mozMatchesSelector||e.msMatchesSelector||function(t){return r(e,t)}).call(e,t)}};t.exports=i},{42:42}],39:[function(e,t,n){"use strict";var r=!("undefined"==typeof window||!window.document||!window.document.createElement),o={canUseDOM:r,canUseWorkers:"undefined"!=typeof Worker,canUseEventListeners:r&&!(!window.addEventListener&&!window.attachEvent),canUseViewport:r&&!!window.screen,isInWorker:!r};t.exports=o},{}],40:[function(e,t,n){"use strict";function r(e){return function(){return e}}var o=function(){};o.thatReturns=r,o.thatReturnsFalse=r(!1),o.thatReturnsTrue=r(!0),o.thatReturnsNull=r(null),o.thatReturnsThis=function(){return this},o.thatReturnsArgument=function(e){return e},t.exports=o},{}],41:[function(e,t,n){"use strict";var r={};t.exports=r},{}],42:[function(e,t,n){"use strict";function r(e,t,n,r,i,a,s,u){if(o(t),!e){var c;if(void 0===t)c=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var p=[n,r,i,a,s,u],l=0;c=new Error(t.replace(/%s/g,function(){return p[l++]})),c.name="Invariant Violation"}throw c.framesToPop=1,c}}var o=function(e){};t.exports=r},{}],43:[function(e,t,n){"use strict";function r(e,t){return e===t?0!==e||0!==t||1/e==1/t:e!==e&&t!==t}function o(e,t){if(r(e,t))return!0;if("object"!=typeof e||null===e||"object"!=typeof t||null===t)return!1;var n=Object.keys(e),o=Object.keys(t);if(n.length!==o.length)return!1;for(var a=0;aHello World; + * } + * }); + * + * The class specification supports a specific protocol of methods that have + * special meaning (e.g. `render`). See `ReactClassInterface` for + * more the comprehensive protocol. Any other properties and methods in the + * class specification will be available on the prototype. + * + * @interface ReactClassInterface + * @internal + */ +var ReactClassInterface = { + + /** + * An array of Mixin objects to include when defining your component. + * + * @type {array} + * @optional + */ + mixins: 'DEFINE_MANY', + + /** + * An object containing properties and methods that should be defined on + * the component's constructor instead of its prototype (static methods). + * + * @type {object} + * @optional + */ + statics: 'DEFINE_MANY', + + /** + * Definition of prop types for this component. + * + * @type {object} + * @optional + */ + propTypes: 'DEFINE_MANY', + + /** + * Definition of context types for this component. + * + * @type {object} + * @optional + */ + contextTypes: 'DEFINE_MANY', + + /** + * Definition of context types this component sets for its children. + * + * @type {object} + * @optional + */ + childContextTypes: 'DEFINE_MANY', + + // ==== Definition methods ==== + + /** + * Invoked when the component is mounted. Values in the mapping will be set on + * `this.props` if that prop is not specified (i.e. using an `in` check). + * + * This method is invoked before `getInitialState` and therefore cannot rely + * on `this.state` or use `this.setState`. + * + * @return {object} + * @optional + */ + getDefaultProps: 'DEFINE_MANY_MERGED', + + /** + * Invoked once before the component is mounted. The return value will be used + * as the initial value of `this.state`. + * + * getInitialState: function() { + * return { + * isOn: false, + * fooBaz: new BazFoo() + * } + * } + * + * @return {object} + * @optional + */ + getInitialState: 'DEFINE_MANY_MERGED', + + /** + * @return {object} + * @optional + */ + getChildContext: 'DEFINE_MANY_MERGED', + + /** + * Uses props from `this.props` and state from `this.state` to render the + * structure of the component. + * + * No guarantees are made about when or how often this method is invoked, so + * it must not have side effects. + * + * render: function() { + * var name = this.props.name; + * return
Hello, {name}!
; + * } + * + * @return {ReactComponent} + * @required + */ + render: 'DEFINE_ONCE', + + // ==== Delegate methods ==== + + /** + * Invoked when the component is initially created and about to be mounted. + * This may have side effects, but any external subscriptions or data created + * by this method must be cleaned up in `componentWillUnmount`. + * + * @optional + */ + componentWillMount: 'DEFINE_MANY', + + /** + * Invoked when the component has been mounted and has a DOM representation. + * However, there is no guarantee that the DOM node is in the document. + * + * Use this as an opportunity to operate on the DOM when the component has + * been mounted (initialized and rendered) for the first time. + * + * @param {DOMElement} rootNode DOM element representing the component. + * @optional + */ + componentDidMount: 'DEFINE_MANY', + + /** + * Invoked before the component receives new props. + * + * Use this as an opportunity to react to a prop transition by updating the + * state using `this.setState`. Current props are accessed via `this.props`. + * + * componentWillReceiveProps: function(nextProps, nextContext) { + * this.setState({ + * likesIncreasing: nextProps.likeCount > this.props.likeCount + * }); + * } + * + * NOTE: There is no equivalent `componentWillReceiveState`. An incoming prop + * transition may cause a state change, but the opposite is not true. If you + * need it, you are probably looking for `componentWillUpdate`. + * + * @param {object} nextProps + * @optional + */ + componentWillReceiveProps: 'DEFINE_MANY', + + /** + * Invoked while deciding if the component should be updated as a result of + * receiving new props, state and/or context. + * + * Use this as an opportunity to `return false` when you're certain that the + * transition to the new props/state/context will not require a component + * update. + * + * shouldComponentUpdate: function(nextProps, nextState, nextContext) { + * return !equal(nextProps, this.props) || + * !equal(nextState, this.state) || + * !equal(nextContext, this.context); + * } + * + * @param {object} nextProps + * @param {?object} nextState + * @param {?object} nextContext + * @return {boolean} True if the component should update. + * @optional + */ + shouldComponentUpdate: 'DEFINE_ONCE', + + /** + * Invoked when the component is about to update due to a transition from + * `this.props`, `this.state` and `this.context` to `nextProps`, `nextState` + * and `nextContext`. + * + * Use this as an opportunity to perform preparation before an update occurs. + * + * NOTE: You **cannot** use `this.setState()` in this method. + * + * @param {object} nextProps + * @param {?object} nextState + * @param {?object} nextContext + * @param {ReactReconcileTransaction} transaction + * @optional + */ + componentWillUpdate: 'DEFINE_MANY', + + /** + * Invoked when the component's DOM representation has been updated. + * + * Use this as an opportunity to operate on the DOM when the component has + * been updated. + * + * @param {object} prevProps + * @param {?object} prevState + * @param {?object} prevContext + * @param {DOMElement} rootNode DOM element representing the component. + * @optional + */ + componentDidUpdate: 'DEFINE_MANY', + + /** + * Invoked when the component is about to be removed from its parent and have + * its DOM representation destroyed. + * + * Use this as an opportunity to deallocate any external resources. + * + * NOTE: There is no `componentDidUnmount` since your component will have been + * destroyed by that point. + * + * @optional + */ + componentWillUnmount: 'DEFINE_MANY', + + // ==== Advanced methods ==== + + /** + * Updates the component's currently mounted DOM representation. + * + * By default, this implements React's rendering and reconciliation algorithm. + * Sophisticated clients may wish to override this. + * + * @param {ReactReconcileTransaction} transaction + * @internal + * @overridable + */ + updateComponent: 'OVERRIDE_BASE' + +}; + +/** + * Mapping from class specification keys to special processing functions. + * + * Although these are declared like instance properties in the specification + * when defining classes using `React.createClass`, they are actually static + * and are accessible on the constructor instead of the prototype. Despite + * being static, they must be defined outside of the "statics" key under + * which all other static methods are defined. + */ +var RESERVED_SPEC_KEYS = { + displayName: function (Constructor, displayName) { + Constructor.displayName = displayName; + }, + mixins: function (Constructor, mixins) { + if (mixins) { + for (var i = 0; i < mixins.length; i++) { + mixSpecIntoComponent(Constructor, mixins[i]); + } + } + }, + childContextTypes: function (Constructor, childContextTypes) { + if ("development" !== 'production') { + validateTypeDef(Constructor, childContextTypes, 'childContext'); + } + Constructor.childContextTypes = _assign({}, Constructor.childContextTypes, childContextTypes); + }, + contextTypes: function (Constructor, contextTypes) { + if ("development" !== 'production') { + validateTypeDef(Constructor, contextTypes, 'context'); + } + Constructor.contextTypes = _assign({}, Constructor.contextTypes, contextTypes); + }, + /** + * Special case getDefaultProps which should move into statics but requires + * automatic merging. + */ + getDefaultProps: function (Constructor, getDefaultProps) { + if (Constructor.getDefaultProps) { + Constructor.getDefaultProps = createMergedResultFunction(Constructor.getDefaultProps, getDefaultProps); + } else { + Constructor.getDefaultProps = getDefaultProps; + } + }, + propTypes: function (Constructor, propTypes) { + if ("development" !== 'production') { + validateTypeDef(Constructor, propTypes, 'prop'); + } + Constructor.propTypes = _assign({}, Constructor.propTypes, propTypes); + }, + statics: function (Constructor, statics) { + mixStaticSpecIntoComponent(Constructor, statics); + }, + autobind: function () {} }; + +function validateTypeDef(Constructor, typeDef, location) { + for (var propName in typeDef) { + if (typeDef.hasOwnProperty(propName)) { + // use a warning instead of an invariant so components + // don't show up in prod but only in __DEV__ + "development" !== 'production' ? warning(typeof typeDef[propName] === 'function', '%s: %s type `%s` is invalid; it must be a function, usually from ' + 'React.PropTypes.', Constructor.displayName || 'ReactClass', ReactPropTypeLocationNames[location], propName) : void 0; + } + } +} + +function validateMethodOverride(isAlreadyDefined, name) { + var specPolicy = ReactClassInterface.hasOwnProperty(name) ? ReactClassInterface[name] : null; + + // Disallow overriding of base class methods unless explicitly allowed. + if (ReactClassMixin.hasOwnProperty(name)) { + !(specPolicy === 'OVERRIDE_BASE') ? "development" !== 'production' ? invariant(false, 'ReactClassInterface: You are attempting to override `%s` from your class specification. Ensure that your method names do not overlap with React methods.', name) : _prodInvariant('73', name) : void 0; + } + + // Disallow defining methods more than once unless explicitly allowed. + if (isAlreadyDefined) { + !(specPolicy === 'DEFINE_MANY' || specPolicy === 'DEFINE_MANY_MERGED') ? "development" !== 'production' ? invariant(false, 'ReactClassInterface: You are attempting to define `%s` on your component more than once. This conflict may be due to a mixin.', name) : _prodInvariant('74', name) : void 0; + } +} + +/** + * Mixin helper which handles policy validation and reserved + * specification keys when building React classes. + */ +function mixSpecIntoComponent(Constructor, spec) { + if (!spec) { + if ("development" !== 'production') { + var typeofSpec = typeof spec; + var isMixinValid = typeofSpec === 'object' && spec !== null; + + "development" !== 'production' ? warning(isMixinValid, '%s: You\'re attempting to include a mixin that is either null ' + 'or not an object. Check the mixins included by the component, ' + 'as well as any mixins they include themselves. ' + 'Expected object but got %s.', Constructor.displayName || 'ReactClass', spec === null ? null : typeofSpec) : void 0; + } + + return; + } + + !(typeof spec !== 'function') ? "development" !== 'production' ? invariant(false, 'ReactClass: You\'re attempting to use a component class or function as a mixin. Instead, just use a regular object.') : _prodInvariant('75') : void 0; + !!ReactElement.isValidElement(spec) ? "development" !== 'production' ? invariant(false, 'ReactClass: You\'re attempting to use a component as a mixin. Instead, just use a regular object.') : _prodInvariant('76') : void 0; + + var proto = Constructor.prototype; + var autoBindPairs = proto.__reactAutoBindPairs; + + // By handling mixins before any other properties, we ensure the same + // chaining order is applied to methods with DEFINE_MANY policy, whether + // mixins are listed before or after these methods in the spec. + if (spec.hasOwnProperty(MIXINS_KEY)) { + RESERVED_SPEC_KEYS.mixins(Constructor, spec.mixins); + } + + for (var name in spec) { + if (!spec.hasOwnProperty(name)) { + continue; + } + + if (name === MIXINS_KEY) { + // We have already handled mixins in a special case above. + continue; + } + + var property = spec[name]; + var isAlreadyDefined = proto.hasOwnProperty(name); + validateMethodOverride(isAlreadyDefined, name); + + if (RESERVED_SPEC_KEYS.hasOwnProperty(name)) { + RESERVED_SPEC_KEYS[name](Constructor, property); + } else { + // Setup methods on prototype: + // The following member methods should not be automatically bound: + // 1. Expected ReactClass methods (in the "interface"). + // 2. Overridden methods (that were mixed in). + var isReactClassMethod = ReactClassInterface.hasOwnProperty(name); + var isFunction = typeof property === 'function'; + var shouldAutoBind = isFunction && !isReactClassMethod && !isAlreadyDefined && spec.autobind !== false; + + if (shouldAutoBind) { + autoBindPairs.push(name, property); + proto[name] = property; + } else { + if (isAlreadyDefined) { + var specPolicy = ReactClassInterface[name]; + + // These cases should already be caught by validateMethodOverride. + !(isReactClassMethod && (specPolicy === 'DEFINE_MANY_MERGED' || specPolicy === 'DEFINE_MANY')) ? "development" !== 'production' ? invariant(false, 'ReactClass: Unexpected spec policy %s for key %s when mixing in component specs.', specPolicy, name) : _prodInvariant('77', specPolicy, name) : void 0; + + // For methods which are defined more than once, call the existing + // methods before calling the new property, merging if appropriate. + if (specPolicy === 'DEFINE_MANY_MERGED') { + proto[name] = createMergedResultFunction(proto[name], property); + } else if (specPolicy === 'DEFINE_MANY') { + proto[name] = createChainedFunction(proto[name], property); + } + } else { + proto[name] = property; + if ("development" !== 'production') { + // Add verbose displayName to the function, which helps when looking + // at profiling tools. + if (typeof property === 'function' && spec.displayName) { + proto[name].displayName = spec.displayName + '_' + name; + } + } + } + } + } + } +} + +function mixStaticSpecIntoComponent(Constructor, statics) { + if (!statics) { + return; + } + for (var name in statics) { + var property = statics[name]; + if (!statics.hasOwnProperty(name)) { + continue; + } + + var isReserved = name in RESERVED_SPEC_KEYS; + !!isReserved ? "development" !== 'production' ? invariant(false, 'ReactClass: You are attempting to define a reserved property, `%s`, that shouldn\'t be on the "statics" key. Define it as an instance property instead; it will still be accessible on the constructor.', name) : _prodInvariant('78', name) : void 0; + + var isInherited = name in Constructor; + !!isInherited ? "development" !== 'production' ? invariant(false, 'ReactClass: You are attempting to define `%s` on your component more than once. This conflict may be due to a mixin.', name) : _prodInvariant('79', name) : void 0; + Constructor[name] = property; + } +} + +/** + * Merge two objects, but throw if both contain the same key. + * + * @param {object} one The first object, which is mutated. + * @param {object} two The second object + * @return {object} one after it has been mutated to contain everything in two. + */ +function mergeIntoWithNoDuplicateKeys(one, two) { + !(one && two && typeof one === 'object' && typeof two === 'object') ? "development" !== 'production' ? invariant(false, 'mergeIntoWithNoDuplicateKeys(): Cannot merge non-objects.') : _prodInvariant('80') : void 0; + + for (var key in two) { + if (two.hasOwnProperty(key)) { + !(one[key] === undefined) ? "development" !== 'production' ? invariant(false, 'mergeIntoWithNoDuplicateKeys(): Tried to merge two objects with the same key: `%s`. This conflict may be due to a mixin; in particular, this may be caused by two getInitialState() or getDefaultProps() methods returning objects with clashing keys.', key) : _prodInvariant('81', key) : void 0; + one[key] = two[key]; + } + } + return one; +} + +/** + * Creates a function that invokes two functions and merges their return values. + * + * @param {function} one Function to invoke first. + * @param {function} two Function to invoke second. + * @return {function} Function that invokes the two argument functions. + * @private + */ +function createMergedResultFunction(one, two) { + return function mergedResult() { + var a = one.apply(this, arguments); + var b = two.apply(this, arguments); + if (a == null) { + return b; + } else if (b == null) { + return a; + } + var c = {}; + mergeIntoWithNoDuplicateKeys(c, a); + mergeIntoWithNoDuplicateKeys(c, b); + return c; + }; +} + +/** + * Creates a function that invokes two functions and ignores their return vales. + * + * @param {function} one Function to invoke first. + * @param {function} two Function to invoke second. + * @return {function} Function that invokes the two argument functions. + * @private + */ +function createChainedFunction(one, two) { + return function chainedFunction() { + one.apply(this, arguments); + two.apply(this, arguments); + }; +} + +/** + * Binds a method to the component. + * + * @param {object} component Component whose method is going to be bound. + * @param {function} method Method to be bound. + * @return {function} The bound method. + */ +function bindAutoBindMethod(component, method) { + var boundMethod = method.bind(component); + if ("development" !== 'production') { + boundMethod.__reactBoundContext = component; + boundMethod.__reactBoundMethod = method; + boundMethod.__reactBoundArguments = null; + var componentName = component.constructor.displayName; + var _bind = boundMethod.bind; + boundMethod.bind = function (newThis) { + for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { + args[_key - 1] = arguments[_key]; + } + + // User is trying to bind() an autobound method; we effectively will + // ignore the value of "this" that the user is trying to use, so + // let's warn. + if (newThis !== component && newThis !== null) { + "development" !== 'production' ? warning(false, 'bind(): React component methods may only be bound to the ' + 'component instance. See %s', componentName) : void 0; + } else if (!args.length) { + "development" !== 'production' ? warning(false, 'bind(): You are binding a component method to the component. ' + 'React does this for you automatically in a high-performance ' + 'way, so you can safely remove this call. See %s', componentName) : void 0; + return boundMethod; + } + var reboundMethod = _bind.apply(boundMethod, arguments); + reboundMethod.__reactBoundContext = component; + reboundMethod.__reactBoundMethod = method; + reboundMethod.__reactBoundArguments = args; + return reboundMethod; + }; + } + return boundMethod; +} + +/** + * Binds all auto-bound methods in a component. + * + * @param {object} component Component whose method is going to be bound. + */ +function bindAutoBindMethods(component) { + var pairs = component.__reactAutoBindPairs; + for (var i = 0; i < pairs.length; i += 2) { + var autoBindKey = pairs[i]; + var method = pairs[i + 1]; + component[autoBindKey] = bindAutoBindMethod(component, method); + } +} + +/** + * Add more to the ReactClass base class. These are all legacy features and + * therefore not already part of the modern ReactComponent. + */ +var ReactClassMixin = { + + /** + * TODO: This will be deprecated because state should always keep a consistent + * type signature and the only use case for this, is to avoid that. + */ + replaceState: function (newState, callback) { + this.updater.enqueueReplaceState(this, newState); + if (callback) { + this.updater.enqueueCallback(this, callback, 'replaceState'); + } + }, + + /** + * Checks whether or not this composite component is mounted. + * @return {boolean} True if mounted, false otherwise. + * @protected + * @final + */ + isMounted: function () { + return this.updater.isMounted(this); + } +}; + +var ReactClassComponent = function () {}; +_assign(ReactClassComponent.prototype, ReactComponent.prototype, ReactClassMixin); + +var didWarnDeprecated = false; + +/** + * Module for creating composite components. + * + * @class ReactClass + */ +var ReactClass = { + + /** + * Creates a composite component class given a class specification. + * See https://facebook.github.io/react/docs/top-level-api.html#react.createclass + * + * @param {object} spec Class specification (which must define `render`). + * @return {function} Component constructor function. + * @public + */ + createClass: function (spec) { + if ("development" !== 'production') { + "development" !== 'production' ? warning(didWarnDeprecated, '%s: React.createClass is deprecated and will be removed in version 16. ' + 'Use plain JavaScript classes instead. If you\'re not yet ready to ' + 'migrate, create-react-class is available on npm as a ' + 'drop-in replacement.', spec && spec.displayName || 'A Component') : void 0; + didWarnDeprecated = true; + } + + // To keep our warnings more understandable, we'll use a little hack here to + // ensure that Constructor.name !== 'Constructor'. This makes sure we don't + // unnecessarily identify a class without displayName as 'Constructor'. + var Constructor = identity(function (props, context, updater) { + // This constructor gets overridden by mocks. The argument is used + // by mocks to assert on what gets mounted. + + if ("development" !== 'production') { + "development" !== 'production' ? warning(this instanceof Constructor, 'Something is calling a React component directly. Use a factory or ' + 'JSX instead. See: https://fb.me/react-legacyfactory') : void 0; + } + + // Wire up auto-binding + if (this.__reactAutoBindPairs.length) { + bindAutoBindMethods(this); + } + + this.props = props; + this.context = context; + this.refs = emptyObject; + this.updater = updater || ReactNoopUpdateQueue; + + this.state = null; + + // ReactClasses doesn't have constructors. Instead, they use the + // getInitialState and componentWillMount methods for initialization. + + var initialState = this.getInitialState ? this.getInitialState() : null; + if ("development" !== 'production') { + // We allow auto-mocks to proceed as if they're returning null. + if (initialState === undefined && this.getInitialState._isMockFunction) { + // This is probably bad practice. Consider warning here and + // deprecating this convenience. + initialState = null; + } + } + !(typeof initialState === 'object' && !Array.isArray(initialState)) ? "development" !== 'production' ? invariant(false, '%s.getInitialState(): must return an object or null', Constructor.displayName || 'ReactCompositeComponent') : _prodInvariant('82', Constructor.displayName || 'ReactCompositeComponent') : void 0; + + this.state = initialState; + }); + Constructor.prototype = new ReactClassComponent(); + Constructor.prototype.constructor = Constructor; + Constructor.prototype.__reactAutoBindPairs = []; + + injectedMixins.forEach(mixSpecIntoComponent.bind(null, Constructor)); + + mixSpecIntoComponent(Constructor, spec); + + // Initialize the defaultProps property after all mixins have been merged. + if (Constructor.getDefaultProps) { + Constructor.defaultProps = Constructor.getDefaultProps(); + } + + if ("development" !== 'production') { + // This is a tag to indicate that the use of these method names is ok, + // since it's used with createClass. If it's not, then it's likely a + // mistake so we'll warn you to use the static property, property + // initializer or constructor respectively. + if (Constructor.getDefaultProps) { + Constructor.getDefaultProps.isReactClassApproved = {}; + } + if (Constructor.prototype.getInitialState) { + Constructor.prototype.getInitialState.isReactClassApproved = {}; + } + } + + !Constructor.prototype.render ? "development" !== 'production' ? invariant(false, 'createClass(...): Class specification must implement a `render` method.') : _prodInvariant('83') : void 0; + + if ("development" !== 'production') { + "development" !== 'production' ? warning(!Constructor.prototype.componentShouldUpdate, '%s has a method called ' + 'componentShouldUpdate(). Did you mean shouldComponentUpdate()? ' + 'The name is phrased as a question because the function is ' + 'expected to return a value.', spec.displayName || 'A component') : void 0; + "development" !== 'production' ? warning(!Constructor.prototype.componentWillRecieveProps, '%s has a method called ' + 'componentWillRecieveProps(). Did you mean componentWillReceiveProps()?', spec.displayName || 'A component') : void 0; + } + + // Reduce time spent doing lookups by setting these on the prototype. + for (var methodName in ReactClassInterface) { + if (!Constructor.prototype[methodName]) { + Constructor.prototype[methodName] = null; + } + } + + return Constructor; + }, + + injection: { + injectMixin: function (mixin) { + injectedMixins.push(mixin); + } + } + +}; + +module.exports = ReactClass; +},{"10":10,"13":13,"14":14,"25":25,"28":28,"29":29,"30":30,"31":31,"6":6}],6:[function(_dereq_,module,exports){ +/** + * Copyright 2013-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + */ + +'use strict'; + +var _prodInvariant = _dereq_(25); + +var ReactNoopUpdateQueue = _dereq_(13); + +var canDefineProperty = _dereq_(20); +var emptyObject = _dereq_(28); +var invariant = _dereq_(29); +var warning = _dereq_(30); + +/** + * Base class helpers for the updating state of a component. + */ +function ReactComponent(props, context, updater) { + this.props = props; + this.context = context; + this.refs = emptyObject; + // We initialize the default updater but the real one gets injected by the + // renderer. + this.updater = updater || ReactNoopUpdateQueue; +} + +ReactComponent.prototype.isReactComponent = {}; + +/** + * Sets a subset of the state. Always use this to mutate + * state. You should treat `this.state` as immutable. + * + * There is no guarantee that `this.state` will be immediately updated, so + * accessing `this.state` after calling this method may return the old value. + * + * There is no guarantee that calls to `setState` will run synchronously, + * as they may eventually be batched together. You can provide an optional + * callback that will be executed when the call to setState is actually + * completed. + * + * When a function is provided to setState, it will be called at some point in + * the future (not synchronously). It will be called with the up to date + * component arguments (state, props, context). These values can be different + * from this.* because your function may be called after receiveProps but before + * shouldComponentUpdate, and this new state, props, and context will not yet be + * assigned to this. + * + * @param {object|function} partialState Next partial state or function to + * produce next partial state to be merged with current state. + * @param {?function} callback Called after state is updated. + * @final + * @protected + */ +ReactComponent.prototype.setState = function (partialState, callback) { + !(typeof partialState === 'object' || typeof partialState === 'function' || partialState == null) ? "development" !== 'production' ? invariant(false, 'setState(...): takes an object of state variables to update or a function which returns an object of state variables.') : _prodInvariant('85') : void 0; + this.updater.enqueueSetState(this, partialState); + if (callback) { + this.updater.enqueueCallback(this, callback, 'setState'); + } +}; + +/** + * Forces an update. This should only be invoked when it is known with + * certainty that we are **not** in a DOM transaction. + * + * You may want to call this when you know that some deeper aspect of the + * component's state has changed but `setState` was not called. + * + * This will not invoke `shouldComponentUpdate`, but it will invoke + * `componentWillUpdate` and `componentDidUpdate`. + * + * @param {?function} callback Called after update is complete. + * @final + * @protected + */ +ReactComponent.prototype.forceUpdate = function (callback) { + this.updater.enqueueForceUpdate(this); + if (callback) { + this.updater.enqueueCallback(this, callback, 'forceUpdate'); + } +}; + +/** + * Deprecated APIs. These APIs used to exist on classic React classes but since + * we would like to deprecate them, we're not going to move them over to this + * modern base class. Instead, we define a getter that warns if it's accessed. + */ +if ("development" !== 'production') { + var deprecatedAPIs = { + isMounted: ['isMounted', 'Instead, make sure to clean up subscriptions and pending requests in ' + 'componentWillUnmount to prevent memory leaks.'], + replaceState: ['replaceState', 'Refactor your code to use setState instead (see ' + 'https://github.com/facebook/react/issues/3236).'] + }; + var defineDeprecationWarning = function (methodName, info) { + if (canDefineProperty) { + Object.defineProperty(ReactComponent.prototype, methodName, { + get: function () { + "development" !== 'production' ? warning(false, '%s(...) is deprecated in plain JavaScript React classes. %s', info[0], info[1]) : void 0; + return undefined; + } + }); + } + }; + for (var fnName in deprecatedAPIs) { + if (deprecatedAPIs.hasOwnProperty(fnName)) { + defineDeprecationWarning(fnName, deprecatedAPIs[fnName]); + } + } +} + +module.exports = ReactComponent; +},{"13":13,"20":20,"25":25,"28":28,"29":29,"30":30}],7:[function(_dereq_,module,exports){ +/** + * Copyright 2016-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + * + */ + +'use strict'; + +var _prodInvariant = _dereq_(25); + +var ReactCurrentOwner = _dereq_(8); + +var invariant = _dereq_(29); +var warning = _dereq_(30); + +function isNative(fn) { + // Based on isNative() from Lodash + var funcToString = Function.prototype.toString; + var hasOwnProperty = Object.prototype.hasOwnProperty; + var reIsNative = RegExp('^' + funcToString + // Take an example native function source for comparison + .call(hasOwnProperty) + // Strip regex characters so we can use it for regex + .replace(/[\\^$.*+?()[\]{}|]/g, '\\$&') + // Remove hasOwnProperty from the template to make it generic + .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'); + try { + var source = funcToString.call(fn); + return reIsNative.test(source); + } catch (err) { + return false; + } +} + +var canUseCollections = +// Array.from +typeof Array.from === 'function' && +// Map +typeof Map === 'function' && isNative(Map) && +// Map.prototype.keys +Map.prototype != null && typeof Map.prototype.keys === 'function' && isNative(Map.prototype.keys) && +// Set +typeof Set === 'function' && isNative(Set) && +// Set.prototype.keys +Set.prototype != null && typeof Set.prototype.keys === 'function' && isNative(Set.prototype.keys); + +var setItem; +var getItem; +var removeItem; +var getItemIDs; +var addRoot; +var removeRoot; +var getRootIDs; + +if (canUseCollections) { + var itemMap = new Map(); + var rootIDSet = new Set(); + + setItem = function (id, item) { + itemMap.set(id, item); + }; + getItem = function (id) { + return itemMap.get(id); + }; + removeItem = function (id) { + itemMap['delete'](id); + }; + getItemIDs = function () { + return Array.from(itemMap.keys()); + }; + + addRoot = function (id) { + rootIDSet.add(id); + }; + removeRoot = function (id) { + rootIDSet['delete'](id); + }; + getRootIDs = function () { + return Array.from(rootIDSet.keys()); + }; +} else { + var itemByKey = {}; + var rootByKey = {}; + + // Use non-numeric keys to prevent V8 performance issues: + // https://github.com/facebook/react/pull/7232 + var getKeyFromID = function (id) { + return '.' + id; + }; + var getIDFromKey = function (key) { + return parseInt(key.substr(1), 10); + }; + + setItem = function (id, item) { + var key = getKeyFromID(id); + itemByKey[key] = item; + }; + getItem = function (id) { + var key = getKeyFromID(id); + return itemByKey[key]; + }; + removeItem = function (id) { + var key = getKeyFromID(id); + delete itemByKey[key]; + }; + getItemIDs = function () { + return Object.keys(itemByKey).map(getIDFromKey); + }; + + addRoot = function (id) { + var key = getKeyFromID(id); + rootByKey[key] = true; + }; + removeRoot = function (id) { + var key = getKeyFromID(id); + delete rootByKey[key]; + }; + getRootIDs = function () { + return Object.keys(rootByKey).map(getIDFromKey); + }; +} + +var unmountedIDs = []; + +function purgeDeep(id) { + var item = getItem(id); + if (item) { + var childIDs = item.childIDs; + + removeItem(id); + childIDs.forEach(purgeDeep); + } +} + +function describeComponentFrame(name, source, ownerName) { + return '\n in ' + (name || 'Unknown') + (source ? ' (at ' + source.fileName.replace(/^.*[\\\/]/, '') + ':' + source.lineNumber + ')' : ownerName ? ' (created by ' + ownerName + ')' : ''); +} + +function getDisplayName(element) { + if (element == null) { + return '#empty'; + } else if (typeof element === 'string' || typeof element === 'number') { + return '#text'; + } else if (typeof element.type === 'string') { + return element.type; + } else { + return element.type.displayName || element.type.name || 'Unknown'; + } +} + +function describeID(id) { + var name = ReactComponentTreeHook.getDisplayName(id); + var element = ReactComponentTreeHook.getElement(id); + var ownerID = ReactComponentTreeHook.getOwnerID(id); + var ownerName; + if (ownerID) { + ownerName = ReactComponentTreeHook.getDisplayName(ownerID); + } + "development" !== 'production' ? warning(element, 'ReactComponentTreeHook: Missing React element for debugID %s when ' + 'building stack', id) : void 0; + return describeComponentFrame(name, element && element._source, ownerName); +} + +var ReactComponentTreeHook = { + onSetChildren: function (id, nextChildIDs) { + var item = getItem(id); + !item ? "development" !== 'production' ? invariant(false, 'Item must have been set') : _prodInvariant('144') : void 0; + item.childIDs = nextChildIDs; + + for (var i = 0; i < nextChildIDs.length; i++) { + var nextChildID = nextChildIDs[i]; + var nextChild = getItem(nextChildID); + !nextChild ? "development" !== 'production' ? invariant(false, 'Expected hook events to fire for the child before its parent includes it in onSetChildren().') : _prodInvariant('140') : void 0; + !(nextChild.childIDs != null || typeof nextChild.element !== 'object' || nextChild.element == null) ? "development" !== 'production' ? invariant(false, 'Expected onSetChildren() to fire for a container child before its parent includes it in onSetChildren().') : _prodInvariant('141') : void 0; + !nextChild.isMounted ? "development" !== 'production' ? invariant(false, 'Expected onMountComponent() to fire for the child before its parent includes it in onSetChildren().') : _prodInvariant('71') : void 0; + if (nextChild.parentID == null) { + nextChild.parentID = id; + // TODO: This shouldn't be necessary but mounting a new root during in + // componentWillMount currently causes not-yet-mounted components to + // be purged from our tree data so their parent id is missing. + } + !(nextChild.parentID === id) ? "development" !== 'production' ? invariant(false, 'Expected onBeforeMountComponent() parent and onSetChildren() to be consistent (%s has parents %s and %s).', nextChildID, nextChild.parentID, id) : _prodInvariant('142', nextChildID, nextChild.parentID, id) : void 0; + } + }, + onBeforeMountComponent: function (id, element, parentID) { + var item = { + element: element, + parentID: parentID, + text: null, + childIDs: [], + isMounted: false, + updateCount: 0 + }; + setItem(id, item); + }, + onBeforeUpdateComponent: function (id, element) { + var item = getItem(id); + if (!item || !item.isMounted) { + // We may end up here as a result of setState() in componentWillUnmount(). + // In this case, ignore the element. + return; + } + item.element = element; + }, + onMountComponent: function (id) { + var item = getItem(id); + !item ? "development" !== 'production' ? invariant(false, 'Item must have been set') : _prodInvariant('144') : void 0; + item.isMounted = true; + var isRoot = item.parentID === 0; + if (isRoot) { + addRoot(id); + } + }, + onUpdateComponent: function (id) { + var item = getItem(id); + if (!item || !item.isMounted) { + // We may end up here as a result of setState() in componentWillUnmount(). + // In this case, ignore the element. + return; + } + item.updateCount++; + }, + onUnmountComponent: function (id) { + var item = getItem(id); + if (item) { + // We need to check if it exists. + // `item` might not exist if it is inside an error boundary, and a sibling + // error boundary child threw while mounting. Then this instance never + // got a chance to mount, but it still gets an unmounting event during + // the error boundary cleanup. + item.isMounted = false; + var isRoot = item.parentID === 0; + if (isRoot) { + removeRoot(id); + } + } + unmountedIDs.push(id); + }, + purgeUnmountedComponents: function () { + if (ReactComponentTreeHook._preventPurging) { + // Should only be used for testing. + return; + } + + for (var i = 0; i < unmountedIDs.length; i++) { + var id = unmountedIDs[i]; + purgeDeep(id); + } + unmountedIDs.length = 0; + }, + isMounted: function (id) { + var item = getItem(id); + return item ? item.isMounted : false; + }, + getCurrentStackAddendum: function (topElement) { + var info = ''; + if (topElement) { + var name = getDisplayName(topElement); + var owner = topElement._owner; + info += describeComponentFrame(name, topElement._source, owner && owner.getName()); + } + + var currentOwner = ReactCurrentOwner.current; + var id = currentOwner && currentOwner._debugID; + + info += ReactComponentTreeHook.getStackAddendumByID(id); + return info; + }, + getStackAddendumByID: function (id) { + var info = ''; + while (id) { + info += describeID(id); + id = ReactComponentTreeHook.getParentID(id); + } + return info; + }, + getChildIDs: function (id) { + var item = getItem(id); + return item ? item.childIDs : []; + }, + getDisplayName: function (id) { + var element = ReactComponentTreeHook.getElement(id); + if (!element) { + return null; + } + return getDisplayName(element); + }, + getElement: function (id) { + var item = getItem(id); + return item ? item.element : null; + }, + getOwnerID: function (id) { + var element = ReactComponentTreeHook.getElement(id); + if (!element || !element._owner) { + return null; + } + return element._owner._debugID; + }, + getParentID: function (id) { + var item = getItem(id); + return item ? item.parentID : null; + }, + getSource: function (id) { + var item = getItem(id); + var element = item ? item.element : null; + var source = element != null ? element._source : null; + return source; + }, + getText: function (id) { + var element = ReactComponentTreeHook.getElement(id); + if (typeof element === 'string') { + return element; + } else if (typeof element === 'number') { + return '' + element; + } else { + return null; + } + }, + getUpdateCount: function (id) { + var item = getItem(id); + return item ? item.updateCount : 0; + }, + + + getRootIDs: getRootIDs, + getRegisteredIDs: getItemIDs +}; + +module.exports = ReactComponentTreeHook; +},{"25":25,"29":29,"30":30,"8":8}],8:[function(_dereq_,module,exports){ +/** + * Copyright 2013-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + * + */ + +'use strict'; + +/** + * Keeps track of the current owner. + * + * The current owner is the component who should own any components that are + * currently being constructed. + */ +var ReactCurrentOwner = { + + /** + * @internal + * @type {ReactComponent} + */ + current: null + +}; + +module.exports = ReactCurrentOwner; +},{}],9:[function(_dereq_,module,exports){ +/** + * Copyright 2013-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + */ + +'use strict'; + +var ReactElement = _dereq_(10); + +/** + * Create a factory that creates HTML tag elements. + * + * @private + */ +var createDOMFactory = ReactElement.createFactory; +if ("development" !== 'production') { + var ReactElementValidator = _dereq_(12); + createDOMFactory = ReactElementValidator.createFactory; +} + +/** + * Creates a mapping from supported HTML tags to `ReactDOMComponent` classes. + * This is also accessible via `React.DOM`. + * + * @public + */ +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') +}; + +module.exports = ReactDOMFactories; +},{"10":10,"12":12}],10:[function(_dereq_,module,exports){ +/** + * Copyright 2014-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + */ + +'use strict'; + +var _assign = _dereq_(31); + +var ReactCurrentOwner = _dereq_(8); + +var warning = _dereq_(30); +var canDefineProperty = _dereq_(20); +var hasOwnProperty = Object.prototype.hasOwnProperty; + +var REACT_ELEMENT_TYPE = _dereq_(11); + +var RESERVED_PROPS = { + key: true, + ref: true, + __self: true, + __source: true +}; + +var specialPropKeyWarningShown, specialPropRefWarningShown; + +function hasValidRef(config) { + if ("development" !== 'production') { + if (hasOwnProperty.call(config, 'ref')) { + var getter = Object.getOwnPropertyDescriptor(config, 'ref').get; + if (getter && getter.isReactWarning) { + return false; + } + } + } + return config.ref !== undefined; +} + +function hasValidKey(config) { + if ("development" !== 'production') { + if (hasOwnProperty.call(config, 'key')) { + var getter = Object.getOwnPropertyDescriptor(config, 'key').get; + if (getter && getter.isReactWarning) { + return false; + } + } + } + return config.key !== undefined; +} + +function defineKeyPropWarningGetter(props, displayName) { + var warnAboutAccessingKey = function () { + if (!specialPropKeyWarningShown) { + specialPropKeyWarningShown = true; + "development" !== 'production' ? warning(false, '%s: `key` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://fb.me/react-special-props)', displayName) : void 0; + } + }; + warnAboutAccessingKey.isReactWarning = true; + Object.defineProperty(props, 'key', { + get: warnAboutAccessingKey, + configurable: true + }); +} + +function defineRefPropWarningGetter(props, displayName) { + var warnAboutAccessingRef = function () { + if (!specialPropRefWarningShown) { + specialPropRefWarningShown = true; + "development" !== 'production' ? warning(false, '%s: `ref` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://fb.me/react-special-props)', displayName) : void 0; + } + }; + warnAboutAccessingRef.isReactWarning = true; + Object.defineProperty(props, 'ref', { + get: warnAboutAccessingRef, + configurable: true + }); +} + +/** + * Factory method to create a new React element. This no longer adheres to + * the class pattern, so do not use new to call it. Also, no instanceof check + * will work. Instead test $$typeof field against Symbol.for('react.element') to check + * if something is a React Element. + * + * @param {*} type + * @param {*} key + * @param {string|object} ref + * @param {*} self A *temporary* helper to detect places where `this` is + * different from the `owner` when React.createElement is called, so that we + * can warn. We want to get rid of owner and replace string `ref`s with arrow + * functions, and as long as `this` and owner are the same, there will be no + * change in behavior. + * @param {*} source An annotation object (added by a transpiler or otherwise) + * indicating filename, line number, and/or other information. + * @param {*} owner + * @param {*} props + * @internal + */ +var ReactElement = function (type, key, ref, self, source, owner, props) { + var element = { + // This tag allow us to uniquely identify this as a React Element + $$typeof: REACT_ELEMENT_TYPE, + + // Built-in properties that belong on the element + type: type, + key: key, + ref: ref, + props: props, + + // Record the component responsible for creating this element. + _owner: owner + }; + + if ("development" !== 'production') { + // The validation flag is currently mutative. We put it on + // an external backing store so that we can freeze the whole object. + // This can be replaced with a WeakMap once they are implemented in + // commonly used development environments. + element._store = {}; + + // To make comparing ReactElements easier for testing purposes, we make + // the validation flag non-enumerable (where possible, which should + // include every environment we run tests in), so the test framework + // ignores it. + if (canDefineProperty) { + Object.defineProperty(element._store, 'validated', { + configurable: false, + enumerable: false, + writable: true, + value: false + }); + // self and source are DEV only properties. + Object.defineProperty(element, '_self', { + configurable: false, + enumerable: false, + writable: false, + value: self + }); + // Two elements created in two different places should be considered + // equal for testing purposes and therefore we hide it from enumeration. + Object.defineProperty(element, '_source', { + configurable: false, + enumerable: false, + writable: false, + value: source + }); + } else { + element._store.validated = false; + element._self = self; + element._source = source; + } + if (Object.freeze) { + Object.freeze(element.props); + Object.freeze(element); + } + } + + return element; +}; + +/** + * Create and return a new ReactElement of the given type. + * See https://facebook.github.io/react/docs/top-level-api.html#react.createelement + */ +ReactElement.createElement = function (type, config, children) { + var propName; + + // Reserved names are extracted + var props = {}; + + var key = null; + var ref = null; + var self = null; + var source = null; + + if (config != null) { + if (hasValidRef(config)) { + ref = config.ref; + } + if (hasValidKey(config)) { + key = '' + config.key; + } + + self = config.__self === undefined ? null : config.__self; + source = config.__source === undefined ? null : config.__source; + // Remaining properties are added to a new props object + for (propName in config) { + if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) { + props[propName] = config[propName]; + } + } + } + + // Children can be more than one argument, and those are transferred onto + // the newly allocated props object. + var childrenLength = arguments.length - 2; + if (childrenLength === 1) { + props.children = children; + } else if (childrenLength > 1) { + var childArray = Array(childrenLength); + for (var i = 0; i < childrenLength; i++) { + childArray[i] = arguments[i + 2]; + } + if ("development" !== 'production') { + if (Object.freeze) { + Object.freeze(childArray); + } + } + props.children = childArray; + } + + // Resolve default props + if (type && type.defaultProps) { + var defaultProps = type.defaultProps; + for (propName in defaultProps) { + if (props[propName] === undefined) { + props[propName] = defaultProps[propName]; + } + } + } + if ("development" !== 'production') { + if (key || ref) { + if (typeof props.$$typeof === 'undefined' || props.$$typeof !== REACT_ELEMENT_TYPE) { + var displayName = typeof type === 'function' ? type.displayName || type.name || 'Unknown' : type; + if (key) { + defineKeyPropWarningGetter(props, displayName); + } + if (ref) { + defineRefPropWarningGetter(props, displayName); + } + } + } + } + return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props); +}; + +/** + * Return a function that produces ReactElements of a given type. + * See https://facebook.github.io/react/docs/top-level-api.html#react.createfactory + */ +ReactElement.createFactory = function (type) { + var factory = ReactElement.createElement.bind(null, type); + // Expose the type on the factory and the prototype so that it can be + // easily accessed on elements. E.g. `.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. + // Legacy hook TODO: Warn if this is accessed + factory.type = type; + return factory; +}; + +ReactElement.cloneAndReplaceKey = function (oldElement, newKey) { + var newElement = ReactElement(oldElement.type, newKey, oldElement.ref, oldElement._self, oldElement._source, oldElement._owner, oldElement.props); + + return newElement; +}; + +/** + * Clone and return a new ReactElement using element as the starting point. + * See https://facebook.github.io/react/docs/top-level-api.html#react.cloneelement + */ +ReactElement.cloneElement = function (element, config, children) { + var propName; + + // Original props are copied + var props = _assign({}, element.props); + + // Reserved names are extracted + var key = element.key; + var ref = element.ref; + // Self is preserved since the owner is preserved. + var self = element._self; + // Source is preserved since cloneElement is unlikely to be targeted by a + // transpiler, and the original source is probably a better indicator of the + // true owner. + var source = element._source; + + // Owner will be preserved, unless ref is overridden + var owner = element._owner; + + if (config != null) { + if (hasValidRef(config)) { + // Silently steal the ref from the parent. + ref = config.ref; + owner = ReactCurrentOwner.current; + } + if (hasValidKey(config)) { + key = '' + config.key; + } + + // Remaining properties override existing props + var defaultProps; + if (element.type && element.type.defaultProps) { + defaultProps = element.type.defaultProps; + } + for (propName in config) { + if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) { + if (config[propName] === undefined && defaultProps !== undefined) { + // Resolve default props + props[propName] = defaultProps[propName]; + } else { + props[propName] = config[propName]; + } + } + } + } + + // Children can be more than one argument, and those are transferred onto + // the newly allocated props object. + var childrenLength = arguments.length - 2; + if (childrenLength === 1) { + props.children = children; + } else if (childrenLength > 1) { + var childArray = Array(childrenLength); + for (var i = 0; i < childrenLength; i++) { + childArray[i] = arguments[i + 2]; + } + props.children = childArray; + } + + return ReactElement(element.type, key, ref, self, source, owner, props); +}; + +/** + * Verifies the object is a ReactElement. + * See https://facebook.github.io/react/docs/top-level-api.html#react.isvalidelement + * @param {?object} object + * @return {boolean} True if `object` is a valid component. + * @final + */ +ReactElement.isValidElement = function (object) { + return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE; +}; + +module.exports = ReactElement; +},{"11":11,"20":20,"30":30,"31":31,"8":8}],11:[function(_dereq_,module,exports){ +/** + * Copyright 2014-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + * + */ + +'use strict'; + +// The Symbol used to tag the ReactElement type. If there is no native Symbol +// nor polyfill, then a plain number is used for performance. + +var REACT_ELEMENT_TYPE = typeof Symbol === 'function' && Symbol['for'] && Symbol['for']('react.element') || 0xeac7; + +module.exports = REACT_ELEMENT_TYPE; +},{}],12:[function(_dereq_,module,exports){ +/** + * Copyright 2014-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + */ + +/** + * ReactElementValidator provides a wrapper around a element factory + * which validates the props passed to the element. This is intended to be + * used only in DEV and could be replaced by a static type checker for languages + * that support it. + */ + +'use strict'; + +var ReactCurrentOwner = _dereq_(8); +var ReactComponentTreeHook = _dereq_(7); +var ReactElement = _dereq_(10); + +var checkReactTypeSpec = _dereq_(21); + +var canDefineProperty = _dereq_(20); +var getIteratorFn = _dereq_(22); +var warning = _dereq_(30); + +function getDeclarationErrorAddendum() { + if (ReactCurrentOwner.current) { + var name = ReactCurrentOwner.current.getName(); + if (name) { + return ' Check the render method of `' + name + '`.'; + } + } + return ''; +} + +function getSourceInfoErrorAddendum(elementProps) { + if (elementProps !== null && elementProps !== undefined && elementProps.__source !== undefined) { + var source = elementProps.__source; + var fileName = source.fileName.replace(/^.*[\\\/]/, ''); + var lineNumber = source.lineNumber; + return ' Check your code at ' + fileName + ':' + lineNumber + '.'; + } + return ''; +} + +/** + * Warn if there's no key explicitly set on dynamic arrays of children or + * object keys are not valid. This allows us to keep track of children between + * updates. + */ +var ownerHasKeyUseWarning = {}; + +function getCurrentComponentErrorInfo(parentType) { + var info = getDeclarationErrorAddendum(); + + if (!info) { + var parentName = typeof parentType === 'string' ? parentType : parentType.displayName || parentType.name; + if (parentName) { + info = ' Check the top-level render call using <' + parentName + '>.'; + } + } + return info; +} + +/** + * Warn if the element doesn't have an explicit key assigned to it. + * This element is in an array. The array could grow and shrink or be + * reordered. All children that haven't already been validated are required to + * have a "key" property assigned to it. Error statuses are cached so a warning + * will only be shown once. + * + * @internal + * @param {ReactElement} element Element that requires a key. + * @param {*} parentType element's parent's type. + */ +function validateExplicitKey(element, parentType) { + if (!element._store || element._store.validated || element.key != null) { + return; + } + element._store.validated = true; + + var memoizer = ownerHasKeyUseWarning.uniqueKey || (ownerHasKeyUseWarning.uniqueKey = {}); + + var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType); + if (memoizer[currentComponentErrorInfo]) { + return; + } + memoizer[currentComponentErrorInfo] = true; + + // Usually the current owner is the offender, but if it accepts children as a + // property, it may be the creator of the child that's responsible for + // assigning it a key. + var childOwner = ''; + if (element && element._owner && element._owner !== ReactCurrentOwner.current) { + // Give the component that originally created this child. + childOwner = ' It was passed a child from ' + element._owner.getName() + '.'; + } + + "development" !== 'production' ? warning(false, 'Each child in an array or iterator should have a unique "key" prop.' + '%s%s See https://fb.me/react-warning-keys for more information.%s', currentComponentErrorInfo, childOwner, ReactComponentTreeHook.getCurrentStackAddendum(element)) : void 0; +} + +/** + * Ensure that every element either is passed in a static location, in an + * array with an explicit keys property defined, or in an object literal + * with valid key property. + * + * @internal + * @param {ReactNode} node Statically passed child of any type. + * @param {*} parentType node's parent's type. + */ +function validateChildKeys(node, parentType) { + if (typeof node !== 'object') { + return; + } + if (Array.isArray(node)) { + for (var i = 0; i < node.length; i++) { + var child = node[i]; + if (ReactElement.isValidElement(child)) { + validateExplicitKey(child, parentType); + } + } + } else if (ReactElement.isValidElement(node)) { + // This element was passed in a valid location. + if (node._store) { + node._store.validated = true; + } + } else if (node) { + var iteratorFn = getIteratorFn(node); + // Entry iterators provide implicit keys. + if (iteratorFn) { + if (iteratorFn !== node.entries) { + var iterator = iteratorFn.call(node); + var step; + while (!(step = iterator.next()).done) { + if (ReactElement.isValidElement(step.value)) { + validateExplicitKey(step.value, parentType); + } + } + } + } + } +} + +/** + * Given an element, validate that its props follow the propTypes definition, + * provided by the type. + * + * @param {ReactElement} element + */ +function validatePropTypes(element) { + var componentClass = element.type; + if (typeof componentClass !== 'function') { + return; + } + var name = componentClass.displayName || componentClass.name; + if (componentClass.propTypes) { + checkReactTypeSpec(componentClass.propTypes, element.props, 'prop', name, element, null); + } + if (typeof componentClass.getDefaultProps === 'function') { + "development" !== 'production' ? warning(componentClass.getDefaultProps.isReactClassApproved, 'getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.') : void 0; + } +} + +var ReactElementValidator = { + + createElement: function (type, props, children) { + var validType = typeof type === 'string' || typeof type === 'function'; + // We warn in this case but don't throw. We expect the element creation to + // succeed and there will likely be errors in render. + if (!validType) { + if (typeof type !== 'function' && typeof type !== 'string') { + var info = ''; + if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) { + info += ' You likely forgot to export your component from the file ' + 'it\'s defined in.'; + } + + var sourceInfo = getSourceInfoErrorAddendum(props); + if (sourceInfo) { + info += sourceInfo; + } else { + info += getDeclarationErrorAddendum(); + } + + info += ReactComponentTreeHook.getCurrentStackAddendum(); + + "development" !== 'production' ? warning(false, 'React.createElement: type is invalid -- expected a string (for ' + 'built-in components) or a class/function (for composite ' + 'components) but got: %s.%s', type == null ? type : typeof type, info) : void 0; + } + } + + var element = ReactElement.createElement.apply(this, arguments); + + // The result can be nullish if a mock or a custom function is used. + // TODO: Drop this when these are no longer allowed as the type argument. + if (element == null) { + return element; + } + + // Skip key warning if the type isn't valid since our key validation logic + // doesn't expect a non-string/function type and can throw confusing errors. + // We don't want exception behavior to differ between dev and prod. + // (Rendering will throw with a helpful message and as soon as the type is + // fixed, the key warnings will appear.) + if (validType) { + for (var i = 2; i < arguments.length; i++) { + validateChildKeys(arguments[i], type); + } + } + + validatePropTypes(element); + + return element; + }, + + createFactory: function (type) { + var validatedFactory = ReactElementValidator.createElement.bind(null, type); + // Legacy hook TODO: Warn if this is accessed + validatedFactory.type = type; + + if ("development" !== 'production') { + if (canDefineProperty) { + Object.defineProperty(validatedFactory, 'type', { + enumerable: false, + get: function () { + "development" !== 'production' ? warning(false, 'Factory.type is deprecated. Access the class directly ' + 'before passing it to createFactory.') : void 0; + Object.defineProperty(this, 'type', { + value: type + }); + return type; + } + }); + } + } + + return validatedFactory; + }, + + cloneElement: function (element, props, children) { + var newElement = ReactElement.cloneElement.apply(this, arguments); + for (var i = 2; i < arguments.length; i++) { + validateChildKeys(arguments[i], newElement.type); + } + validatePropTypes(newElement); + return newElement; + } + +}; + +module.exports = ReactElementValidator; +},{"10":10,"20":20,"21":21,"22":22,"30":30,"7":7,"8":8}],13:[function(_dereq_,module,exports){ +/** + * Copyright 2015-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + */ + +'use strict'; + +var warning = _dereq_(30); + +function warnNoop(publicInstance, callerName) { + if ("development" !== 'production') { + var constructor = publicInstance.constructor; + "development" !== 'production' ? warning(false, '%s(...): Can only update a mounted or mounting component. ' + 'This usually means you called %s() on an unmounted component. ' + 'This is a no-op. Please check the code for the %s component.', callerName, callerName, constructor && (constructor.displayName || constructor.name) || 'ReactClass') : void 0; + } +} + +/** + * This is the abstract API for an update queue. + */ +var ReactNoopUpdateQueue = { + + /** + * Checks whether or not this composite component is mounted. + * @param {ReactClass} publicInstance The instance we want to test. + * @return {boolean} True if mounted, false otherwise. + * @protected + * @final + */ + isMounted: function (publicInstance) { + return false; + }, + + /** + * Enqueue a callback that will be executed after all the pending updates + * have processed. + * + * @param {ReactClass} publicInstance The instance to use as `this` context. + * @param {?function} callback Called after state is updated. + * @internal + */ + enqueueCallback: function (publicInstance, callback) {}, + + /** + * Forces an update. This should only be invoked when it is known with + * certainty that we are **not** in a DOM transaction. + * + * You may want to call this when you know that some deeper aspect of the + * component's state has changed but `setState` was not called. + * + * This will not invoke `shouldComponentUpdate`, but it will invoke + * `componentWillUpdate` and `componentDidUpdate`. + * + * @param {ReactClass} publicInstance The instance that should rerender. + * @internal + */ + enqueueForceUpdate: function (publicInstance) { + warnNoop(publicInstance, 'forceUpdate'); + }, + + /** + * Replaces all of the state. Always use this or `setState` to mutate state. + * You should treat `this.state` as immutable. + * + * There is no guarantee that `this.state` will be immediately updated, so + * accessing `this.state` after calling this method may return the old value. + * + * @param {ReactClass} publicInstance The instance that should rerender. + * @param {object} completeState Next state. + * @internal + */ + enqueueReplaceState: function (publicInstance, completeState) { + warnNoop(publicInstance, 'replaceState'); + }, + + /** + * Sets a subset of the state. This only exists because _pendingState is + * internal. This provides a merging strategy that is not available to deep + * properties which is confusing. TODO: Expose pendingState or don't use it + * during the merge. + * + * @param {ReactClass} publicInstance The instance that should rerender. + * @param {object} partialState Next partial state to be merged with state. + * @internal + */ + enqueueSetState: function (publicInstance, partialState) { + warnNoop(publicInstance, 'setState'); + } +}; + +module.exports = ReactNoopUpdateQueue; +},{"30":30}],14:[function(_dereq_,module,exports){ +/** + * Copyright 2013-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + * + */ + +'use strict'; + +var ReactPropTypeLocationNames = {}; + +if ("development" !== 'production') { + ReactPropTypeLocationNames = { + prop: 'prop', + context: 'context', + childContext: 'child context' + }; +} + +module.exports = ReactPropTypeLocationNames; +},{}],15:[function(_dereq_,module,exports){ +/** + * Copyright 2013-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + */ + +'use strict'; + +var _require = _dereq_(10), + isValidElement = _require.isValidElement; + +var factory = _dereq_(33); + +module.exports = factory(isValidElement); +},{"10":10,"33":33}],16:[function(_dereq_,module,exports){ +/** + * Copyright 2013-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + * + */ + +'use strict'; + +var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED'; + +module.exports = ReactPropTypesSecret; +},{}],17:[function(_dereq_,module,exports){ +/** + * Copyright 2013-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + */ + +'use strict'; + +var _assign = _dereq_(31); + +var ReactComponent = _dereq_(6); +var ReactNoopUpdateQueue = _dereq_(13); + +var emptyObject = _dereq_(28); + +/** + * Base class helpers for the updating state of a component. + */ +function ReactPureComponent(props, context, updater) { + // Duplicated from ReactComponent. + this.props = props; + this.context = context; + this.refs = emptyObject; + // We initialize the default updater but the real one gets injected by the + // renderer. + this.updater = updater || ReactNoopUpdateQueue; +} + +function ComponentDummy() {} +ComponentDummy.prototype = ReactComponent.prototype; +ReactPureComponent.prototype = new ComponentDummy(); +ReactPureComponent.prototype.constructor = ReactPureComponent; +// Avoid an extra prototype jump for these methods. +_assign(ReactPureComponent.prototype, ReactComponent.prototype); +ReactPureComponent.prototype.isPureReactComponent = true; + +module.exports = ReactPureComponent; +},{"13":13,"28":28,"31":31,"6":6}],18:[function(_dereq_,module,exports){ +/** + * Copyright 2013-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + */ + +'use strict'; + +var _assign = _dereq_(31); + +var React = _dereq_(3); + +// `version` will be added here by the React module. +var ReactUMDEntry = _assign(React, { + __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: { + ReactCurrentOwner: _dereq_(8) + } +}); + +if ("development" !== 'production') { + _assign(ReactUMDEntry.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED, { + // ReactComponentTreeHook should not be included in production. + ReactComponentTreeHook: _dereq_(7), + getNextDebugID: _dereq_(23) + }); +} + +module.exports = ReactUMDEntry; +},{"23":23,"3":3,"31":31,"7":7,"8":8}],19:[function(_dereq_,module,exports){ +/** + * Copyright 2013-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + */ + +'use strict'; + +module.exports = '15.5.4'; +},{}],20:[function(_dereq_,module,exports){ +/** + * Copyright 2013-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + * + */ + +'use strict'; + +var canDefineProperty = false; +if ("development" !== 'production') { + try { + // $FlowFixMe https://github.com/facebook/flow/issues/285 + Object.defineProperty({}, 'x', { get: function () {} }); + canDefineProperty = true; + } catch (x) { + // IE will fail on defineProperty + } +} + +module.exports = canDefineProperty; +},{}],21:[function(_dereq_,module,exports){ +(function (process){ +/** + * Copyright 2013-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + */ + +'use strict'; + +var _prodInvariant = _dereq_(25); + +var ReactPropTypeLocationNames = _dereq_(14); +var ReactPropTypesSecret = _dereq_(16); + +var invariant = _dereq_(29); +var warning = _dereq_(30); + +var ReactComponentTreeHook; + +if (typeof process !== 'undefined' && process.env && "development" === 'test') { + // Temporary hack. + // Inline requires don't work well with Jest: + // https://github.com/facebook/react/issues/7240 + // Remove the inline requires when we don't need them anymore: + // https://github.com/facebook/react/pull/7178 + ReactComponentTreeHook = _dereq_(7); +} + +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 {?object} element The React element that is being type-checked + * @param {?number} debugID The React component instance that is being type-checked + * @private + */ +function checkReactTypeSpec(typeSpecs, values, location, componentName, element, debugID) { + 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. + !(typeof typeSpecs[typeSpecName] === 'function') ? "development" !== 'production' ? invariant(false, '%s: %s type `%s` is invalid; it must be a function, usually from React.PropTypes.', componentName || 'React class', ReactPropTypeLocationNames[location], typeSpecName) : _prodInvariant('84', componentName || 'React class', ReactPropTypeLocationNames[location], typeSpecName) : void 0; + error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret); + } catch (ex) { + error = ex; + } + "development" !== 'production' ? 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', ReactPropTypeLocationNames[location], typeSpecName, typeof error) : void 0; + 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 componentStackInfo = ''; + + if ("development" !== 'production') { + if (!ReactComponentTreeHook) { + ReactComponentTreeHook = _dereq_(7); + } + if (debugID !== null) { + componentStackInfo = ReactComponentTreeHook.getStackAddendumByID(debugID); + } else if (element !== null) { + componentStackInfo = ReactComponentTreeHook.getCurrentStackAddendum(element); + } + } + + "development" !== 'production' ? warning(false, 'Failed %s type: %s%s', location, error.message, componentStackInfo) : void 0; + } + } + } +} + +module.exports = checkReactTypeSpec; +}).call(this,undefined) +},{"14":14,"16":16,"25":25,"29":29,"30":30,"7":7}],22:[function(_dereq_,module,exports){ +/** + * Copyright 2013-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + * + */ + +'use strict'; + +/* 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; + } +} + +module.exports = getIteratorFn; +},{}],23:[function(_dereq_,module,exports){ +/** + * Copyright 2013-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + * + */ + +'use strict'; + +var nextDebugID = 1; + +function getNextDebugID() { + return nextDebugID++; +} + +module.exports = getNextDebugID; +},{}],24:[function(_dereq_,module,exports){ +/** + * Copyright 2013-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + */ +'use strict'; + +var _prodInvariant = _dereq_(25); + +var ReactElement = _dereq_(10); + +var invariant = _dereq_(29); + +/** + * Returns the first child in a collection of children and verifies that there + * is only one child in the collection. + * + * See https://facebook.github.io/react/docs/top-level-api.html#react.children.only + * + * The current implementation of this function assumes that a single child gets + * passed without a wrapper, but the purpose of this helper function is to + * abstract away the particular structure of children. + * + * @param {?object} children Child collection structure. + * @return {ReactElement} The first and only `ReactElement` contained in the + * structure. + */ +function onlyChild(children) { + !ReactElement.isValidElement(children) ? "development" !== 'production' ? invariant(false, 'React.Children.only expected to receive a single React element child.') : _prodInvariant('143') : void 0; + return children; +} + +module.exports = onlyChild; +},{"10":10,"25":25,"29":29}],25:[function(_dereq_,module,exports){ +/** + * Copyright (c) 2013-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + * + */ +'use strict'; + +/** + * WARNING: DO NOT manually require this module. + * This is a replacement for `invariant(...)` used by the error code system + * and will _only_ be required by the corresponding babel pass. + * It always throws. + */ + +function reactProdInvariant(code) { + var argCount = arguments.length - 1; + + var message = 'Minified React error #' + code + '; visit ' + 'http://facebook.github.io/react/docs/error-decoder.html?invariant=' + code; + + for (var argIdx = 0; argIdx < argCount; argIdx++) { + message += '&args[]=' + encodeURIComponent(arguments[argIdx + 1]); + } + + message += ' for the full message or use the non-minified dev environment' + ' for full errors and additional helpful warnings.'; + + var error = new Error(message); + error.name = 'Invariant Violation'; + error.framesToPop = 1; // we don't care about reactProdInvariant's own frame + + throw error; +} + +module.exports = reactProdInvariant; +},{}],26:[function(_dereq_,module,exports){ +/** + * Copyright 2013-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + */ + +'use strict'; + +var _prodInvariant = _dereq_(25); + +var ReactCurrentOwner = _dereq_(8); +var REACT_ELEMENT_TYPE = _dereq_(11); + +var getIteratorFn = _dereq_(22); +var invariant = _dereq_(29); +var KeyEscapeUtils = _dereq_(1); +var warning = _dereq_(30); + +var SEPARATOR = '.'; +var SUBSEPARATOR = ':'; + +/** + * This is inlined from ReactElement since this file is shared between + * isomorphic and renderers. We could extract this to a + * + */ + +/** + * TODO: Test that a single child and an array with one item have the same key + * pattern. + */ + +var didWarnAboutMaps = false; + +/** + * Generate a key string that identifies a component within a set. + * + * @param {*} component A component that could contain a manual key. + * @param {number} index Index that is used if a manual key is not provided. + * @return {string} + */ +function getComponentKey(component, index) { + // Do some typechecking here since we call this blindly. We want to ensure + // that we don't block potential future ES APIs. + if (component && typeof component === 'object' && component.key != null) { + // Explicit key + return KeyEscapeUtils.escape(component.key); + } + // Implicit key determined by the index in the set + return index.toString(36); +} + +/** + * @param {?*} children Children tree container. + * @param {!string} nameSoFar Name of the key path so far. + * @param {!function} callback Callback to invoke with each child found. + * @param {?*} traverseContext Used to pass information throughout the traversal + * process. + * @return {!number} The number of children in this subtree. + */ +function traverseAllChildrenImpl(children, nameSoFar, callback, traverseContext) { + var type = typeof children; + + if (type === 'undefined' || type === 'boolean') { + // All of the above are perceived as null. + children = null; + } + + if (children === null || type === 'string' || type === 'number' || + // The following is inlined from ReactElement. This means we can optimize + // some checks. React Fiber also inlines this logic for similar purposes. + type === 'object' && children.$$typeof === REACT_ELEMENT_TYPE) { + callback(traverseContext, children, + // If it's the only child, treat the name as if it was wrapped in an array + // so that it's consistent if the number of children grows. + nameSoFar === '' ? SEPARATOR + getComponentKey(children, 0) : nameSoFar); + return 1; + } + + var child; + var nextName; + var subtreeCount = 0; // Count of children found in the current subtree. + var nextNamePrefix = nameSoFar === '' ? SEPARATOR : nameSoFar + SUBSEPARATOR; + + if (Array.isArray(children)) { + for (var i = 0; i < children.length; i++) { + child = children[i]; + nextName = nextNamePrefix + getComponentKey(child, i); + subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext); + } + } else { + var iteratorFn = getIteratorFn(children); + if (iteratorFn) { + var iterator = iteratorFn.call(children); + var step; + if (iteratorFn !== children.entries) { + var ii = 0; + while (!(step = iterator.next()).done) { + child = step.value; + nextName = nextNamePrefix + getComponentKey(child, ii++); + subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext); + } + } else { + if ("development" !== 'production') { + var mapsAsChildrenAddendum = ''; + if (ReactCurrentOwner.current) { + var mapsAsChildrenOwnerName = ReactCurrentOwner.current.getName(); + if (mapsAsChildrenOwnerName) { + mapsAsChildrenAddendum = ' Check the render method of `' + mapsAsChildrenOwnerName + '`.'; + } + } + "development" !== 'production' ? warning(didWarnAboutMaps, 'Using Maps as children is not yet fully supported. It is an ' + 'experimental feature that might be removed. Convert it to a ' + 'sequence / iterable of keyed ReactElements instead.%s', mapsAsChildrenAddendum) : void 0; + didWarnAboutMaps = true; + } + // Iterator will provide entry [k,v] tuples rather than values. + while (!(step = iterator.next()).done) { + var entry = step.value; + if (entry) { + child = entry[1]; + nextName = nextNamePrefix + KeyEscapeUtils.escape(entry[0]) + SUBSEPARATOR + getComponentKey(child, 0); + subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext); + } + } + } + } else if (type === 'object') { + var addendum = ''; + if ("development" !== 'production') { + addendum = ' If you meant to render a collection of children, use an array ' + 'instead or wrap the object using createFragment(object) from the ' + 'React add-ons.'; + if (children._isReactElement) { + addendum = ' It looks like you\'re using an element created by a different ' + 'version of React. Make sure to use only one copy of React.'; + } + if (ReactCurrentOwner.current) { + var name = ReactCurrentOwner.current.getName(); + if (name) { + addendum += ' Check the render method of `' + name + '`.'; + } + } + } + var childrenString = String(children); + !false ? "development" !== 'production' ? invariant(false, 'Objects are not valid as a React child (found: %s).%s', childrenString === '[object Object]' ? 'object with keys {' + Object.keys(children).join(', ') + '}' : childrenString, addendum) : _prodInvariant('31', childrenString === '[object Object]' ? 'object with keys {' + Object.keys(children).join(', ') + '}' : childrenString, addendum) : void 0; + } + } + + return subtreeCount; +} + +/** + * Traverses children that are typically specified as `props.children`, but + * might also be specified through attributes: + * + * - `traverseAllChildren(this.props.children, ...)` + * - `traverseAllChildren(this.props.leftPanelChildren, ...)` + * + * The `traverseContext` is an optional argument that is passed through the + * entire traversal. It can be used to store accumulations or anything else that + * the callback might find relevant. + * + * @param {?*} children Children tree object. + * @param {!function} callback To invoke upon traversing each child. + * @param {?*} traverseContext Context for traversal. + * @return {!number} The number of children in this subtree. + */ +function traverseAllChildren(children, callback, traverseContext) { + if (children == null) { + return 0; + } + + return traverseAllChildrenImpl(children, '', callback, traverseContext); +} + +module.exports = traverseAllChildren; +},{"1":1,"11":11,"22":22,"25":25,"29":29,"30":30,"8":8}],27:[function(_dereq_,module,exports){ +"use strict"; + +/** + * Copyright (c) 2013-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + * + */ + +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; +},{}],28:[function(_dereq_,module,exports){ +/** + * Copyright (c) 2013-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + */ + +'use strict'; + +var emptyObject = {}; + +if ("development" !== 'production') { + Object.freeze(emptyObject); +} + +module.exports = emptyObject; +},{}],29:[function(_dereq_,module,exports){ +/** + * Copyright (c) 2013-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + */ + +'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; +},{}],30:[function(_dereq_,module,exports){ +/** + * Copyright 2014-2015, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + */ + +'use strict'; + +var emptyFunction = _dereq_(27); + +/** + * 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') { + (function () { + 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; +},{"27":27}],31:[function(_dereq_,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; +}; + +},{}],32:[function(_dereq_,module,exports){ +/** + * Copyright 2013-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + */ + +'use strict'; + +if ("development" !== 'production') { + var invariant = _dereq_(29); + var warning = _dereq_(30); + var ReactPropTypesSecret = _dereq_(35); + 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 ' + 'React.PropTypes.', componentName || 'React class', location, 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; + +},{"29":29,"30":30,"35":35}],33:[function(_dereq_,module,exports){ +/** + * Copyright 2013-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + */ + +'use strict'; + +// React 15.5 references this module, and assumes PropTypes are still callable in production. +// Therefore we re-export development-only version with all the PropTypes checks here. +// However if one is migrating to the `prop-types` npm library, they will go through the +// `index.js` entry point, and it will branch depending on the environment. +var factory = _dereq_(34); +module.exports = function(isValidElement) { + // It is still allowed in 15.5. + var throwOnDirectAccess = false; + return factory(isValidElement, throwOnDirectAccess); +}; + +},{"34":34}],34:[function(_dereq_,module,exports){ +/** + * Copyright 2013-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + */ + +'use strict'; + +var emptyFunction = _dereq_(27); +var invariant = _dereq_(29); +var warning = _dereq_(30); + +var ReactPropTypesSecret = _dereq_(35); +var checkPropTypes = _dereq_(32); + +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 = '<>'; + + // 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 + }; + + /** + * 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 = {}; + } + 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]) { + 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; + } + } + } + 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; + } + + 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 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) { + var propType = getPropType(propValue); + if (propType === 'object') { + if (propValue instanceof Date) { + return 'date'; + } else if (propValue instanceof RegExp) { + return 'regexp'; + } + } + return propType; + } + + // 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; +}; + +},{"27":27,"29":29,"30":30,"32":32,"35":35}],35:[function(_dereq_,module,exports){ +/** + * Copyright 2013-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + */ + +'use strict'; + +var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED'; + +module.exports = ReactPropTypesSecret; + +},{}]},{},[18])(18) +}); \ No newline at end of file diff --git a/node_modules/react/dist/react.min.js b/node_modules/react/dist/react.min.js new file mode 100644 index 00000000..d6a844b0 --- /dev/null +++ b/node_modules/react/dist/react.min.js @@ -0,0 +1,12 @@ +/** + * React v15.5.4 + * + * Copyright 2013-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + */ +!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var e;e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,e.React=t()}}(function(){return function t(e,n,r){function o(u,a){if(!n[u]){if(!e[u]){var s="function"==typeof require&&require;if(!a&&s)return s(u,!0);if(i)return i(u,!0);var c=new Error("Cannot find module '"+u+"'");throw c.code="MODULE_NOT_FOUND",c}var l=n[u]={exports:{}};e[u][0].call(l.exports,function(t){var n=e[u][1][t];return o(n||t)},l,l.exports,t,e,n,r)}return n[u].exports}for(var i="function"==typeof require&&require,u=0;u1){for(var y=Array(d),h=0;h1){for(var m=Array(v),b=0;bHello World; + * } + * }); + * + * The class specification supports a specific protocol of methods that have + * special meaning (e.g. `render`). See `ReactClassInterface` for + * more the comprehensive protocol. Any other properties and methods in the + * class specification will be available on the prototype. + * + * @interface ReactClassInterface + * @internal + */ +var ReactClassInterface = { + + /** + * An array of Mixin objects to include when defining your component. + * + * @type {array} + * @optional + */ + mixins: 'DEFINE_MANY', + + /** + * An object containing properties and methods that should be defined on + * the component's constructor instead of its prototype (static methods). + * + * @type {object} + * @optional + */ + statics: 'DEFINE_MANY', + + /** + * Definition of prop types for this component. + * + * @type {object} + * @optional + */ + propTypes: 'DEFINE_MANY', + + /** + * Definition of context types for this component. + * + * @type {object} + * @optional + */ + contextTypes: 'DEFINE_MANY', + + /** + * Definition of context types this component sets for its children. + * + * @type {object} + * @optional + */ + childContextTypes: 'DEFINE_MANY', + + // ==== Definition methods ==== + + /** + * Invoked when the component is mounted. Values in the mapping will be set on + * `this.props` if that prop is not specified (i.e. using an `in` check). + * + * This method is invoked before `getInitialState` and therefore cannot rely + * on `this.state` or use `this.setState`. + * + * @return {object} + * @optional + */ + getDefaultProps: 'DEFINE_MANY_MERGED', + + /** + * Invoked once before the component is mounted. The return value will be used + * as the initial value of `this.state`. + * + * getInitialState: function() { + * return { + * isOn: false, + * fooBaz: new BazFoo() + * } + * } + * + * @return {object} + * @optional + */ + getInitialState: 'DEFINE_MANY_MERGED', + + /** + * @return {object} + * @optional + */ + getChildContext: 'DEFINE_MANY_MERGED', + + /** + * Uses props from `this.props` and state from `this.state` to render the + * structure of the component. + * + * No guarantees are made about when or how often this method is invoked, so + * it must not have side effects. + * + * render: function() { + * var name = this.props.name; + * return
Hello, {name}!
; + * } + * + * @return {ReactComponent} + * @required + */ + render: 'DEFINE_ONCE', + + // ==== Delegate methods ==== + + /** + * Invoked when the component is initially created and about to be mounted. + * This may have side effects, but any external subscriptions or data created + * by this method must be cleaned up in `componentWillUnmount`. + * + * @optional + */ + componentWillMount: 'DEFINE_MANY', + + /** + * Invoked when the component has been mounted and has a DOM representation. + * However, there is no guarantee that the DOM node is in the document. + * + * Use this as an opportunity to operate on the DOM when the component has + * been mounted (initialized and rendered) for the first time. + * + * @param {DOMElement} rootNode DOM element representing the component. + * @optional + */ + componentDidMount: 'DEFINE_MANY', + + /** + * Invoked before the component receives new props. + * + * Use this as an opportunity to react to a prop transition by updating the + * state using `this.setState`. Current props are accessed via `this.props`. + * + * componentWillReceiveProps: function(nextProps, nextContext) { + * this.setState({ + * likesIncreasing: nextProps.likeCount > this.props.likeCount + * }); + * } + * + * NOTE: There is no equivalent `componentWillReceiveState`. An incoming prop + * transition may cause a state change, but the opposite is not true. If you + * need it, you are probably looking for `componentWillUpdate`. + * + * @param {object} nextProps + * @optional + */ + componentWillReceiveProps: 'DEFINE_MANY', + + /** + * Invoked while deciding if the component should be updated as a result of + * receiving new props, state and/or context. + * + * Use this as an opportunity to `return false` when you're certain that the + * transition to the new props/state/context will not require a component + * update. + * + * shouldComponentUpdate: function(nextProps, nextState, nextContext) { + * return !equal(nextProps, this.props) || + * !equal(nextState, this.state) || + * !equal(nextContext, this.context); + * } + * + * @param {object} nextProps + * @param {?object} nextState + * @param {?object} nextContext + * @return {boolean} True if the component should update. + * @optional + */ + shouldComponentUpdate: 'DEFINE_ONCE', + + /** + * Invoked when the component is about to update due to a transition from + * `this.props`, `this.state` and `this.context` to `nextProps`, `nextState` + * and `nextContext`. + * + * Use this as an opportunity to perform preparation before an update occurs. + * + * NOTE: You **cannot** use `this.setState()` in this method. + * + * @param {object} nextProps + * @param {?object} nextState + * @param {?object} nextContext + * @param {ReactReconcileTransaction} transaction + * @optional + */ + componentWillUpdate: 'DEFINE_MANY', + + /** + * Invoked when the component's DOM representation has been updated. + * + * Use this as an opportunity to operate on the DOM when the component has + * been updated. + * + * @param {object} prevProps + * @param {?object} prevState + * @param {?object} prevContext + * @param {DOMElement} rootNode DOM element representing the component. + * @optional + */ + componentDidUpdate: 'DEFINE_MANY', + + /** + * Invoked when the component is about to be removed from its parent and have + * its DOM representation destroyed. + * + * Use this as an opportunity to deallocate any external resources. + * + * NOTE: There is no `componentDidUnmount` since your component will have been + * destroyed by that point. + * + * @optional + */ + componentWillUnmount: 'DEFINE_MANY', + + // ==== Advanced methods ==== + + /** + * Updates the component's currently mounted DOM representation. + * + * By default, this implements React's rendering and reconciliation algorithm. + * Sophisticated clients may wish to override this. + * + * @param {ReactReconcileTransaction} transaction + * @internal + * @overridable + */ + updateComponent: 'OVERRIDE_BASE' + +}; + +/** + * Mapping from class specification keys to special processing functions. + * + * Although these are declared like instance properties in the specification + * when defining classes using `React.createClass`, they are actually static + * and are accessible on the constructor instead of the prototype. Despite + * being static, they must be defined outside of the "statics" key under + * which all other static methods are defined. + */ +var RESERVED_SPEC_KEYS = { + displayName: function (Constructor, displayName) { + Constructor.displayName = displayName; + }, + mixins: function (Constructor, mixins) { + if (mixins) { + for (var i = 0; i < mixins.length; i++) { + mixSpecIntoComponent(Constructor, mixins[i]); + } + } + }, + childContextTypes: function (Constructor, childContextTypes) { + if (process.env.NODE_ENV !== 'production') { + validateTypeDef(Constructor, childContextTypes, 'childContext'); + } + Constructor.childContextTypes = _assign({}, Constructor.childContextTypes, childContextTypes); + }, + contextTypes: function (Constructor, contextTypes) { + if (process.env.NODE_ENV !== 'production') { + validateTypeDef(Constructor, contextTypes, 'context'); + } + Constructor.contextTypes = _assign({}, Constructor.contextTypes, contextTypes); + }, + /** + * Special case getDefaultProps which should move into statics but requires + * automatic merging. + */ + getDefaultProps: function (Constructor, getDefaultProps) { + if (Constructor.getDefaultProps) { + Constructor.getDefaultProps = createMergedResultFunction(Constructor.getDefaultProps, getDefaultProps); + } else { + Constructor.getDefaultProps = getDefaultProps; + } + }, + propTypes: function (Constructor, propTypes) { + if (process.env.NODE_ENV !== 'production') { + validateTypeDef(Constructor, propTypes, 'prop'); + } + Constructor.propTypes = _assign({}, Constructor.propTypes, propTypes); + }, + statics: function (Constructor, statics) { + mixStaticSpecIntoComponent(Constructor, statics); + }, + autobind: function () {} }; + +function validateTypeDef(Constructor, typeDef, location) { + for (var propName in typeDef) { + if (typeDef.hasOwnProperty(propName)) { + // use a warning instead of an invariant so components + // don't show up in prod but only in __DEV__ + process.env.NODE_ENV !== 'production' ? warning(typeof typeDef[propName] === 'function', '%s: %s type `%s` is invalid; it must be a function, usually from ' + 'React.PropTypes.', Constructor.displayName || 'ReactClass', ReactPropTypeLocationNames[location], propName) : void 0; + } + } +} + +function validateMethodOverride(isAlreadyDefined, name) { + var specPolicy = ReactClassInterface.hasOwnProperty(name) ? ReactClassInterface[name] : null; + + // Disallow overriding of base class methods unless explicitly allowed. + if (ReactClassMixin.hasOwnProperty(name)) { + !(specPolicy === 'OVERRIDE_BASE') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactClassInterface: You are attempting to override `%s` from your class specification. Ensure that your method names do not overlap with React methods.', name) : _prodInvariant('73', name) : void 0; + } + + // Disallow defining methods more than once unless explicitly allowed. + if (isAlreadyDefined) { + !(specPolicy === 'DEFINE_MANY' || specPolicy === 'DEFINE_MANY_MERGED') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactClassInterface: You are attempting to define `%s` on your component more than once. This conflict may be due to a mixin.', name) : _prodInvariant('74', name) : void 0; + } +} + +/** + * Mixin helper which handles policy validation and reserved + * specification keys when building React classes. + */ +function mixSpecIntoComponent(Constructor, spec) { + if (!spec) { + if (process.env.NODE_ENV !== 'production') { + var typeofSpec = typeof spec; + var isMixinValid = typeofSpec === 'object' && spec !== null; + + process.env.NODE_ENV !== 'production' ? warning(isMixinValid, '%s: You\'re attempting to include a mixin that is either null ' + 'or not an object. Check the mixins included by the component, ' + 'as well as any mixins they include themselves. ' + 'Expected object but got %s.', Constructor.displayName || 'ReactClass', spec === null ? null : typeofSpec) : void 0; + } + + return; + } + + !(typeof spec !== 'function') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactClass: You\'re attempting to use a component class or function as a mixin. Instead, just use a regular object.') : _prodInvariant('75') : void 0; + !!ReactElement.isValidElement(spec) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactClass: You\'re attempting to use a component as a mixin. Instead, just use a regular object.') : _prodInvariant('76') : void 0; + + var proto = Constructor.prototype; + var autoBindPairs = proto.__reactAutoBindPairs; + + // By handling mixins before any other properties, we ensure the same + // chaining order is applied to methods with DEFINE_MANY policy, whether + // mixins are listed before or after these methods in the spec. + if (spec.hasOwnProperty(MIXINS_KEY)) { + RESERVED_SPEC_KEYS.mixins(Constructor, spec.mixins); + } + + for (var name in spec) { + if (!spec.hasOwnProperty(name)) { + continue; + } + + if (name === MIXINS_KEY) { + // We have already handled mixins in a special case above. + continue; + } + + var property = spec[name]; + var isAlreadyDefined = proto.hasOwnProperty(name); + validateMethodOverride(isAlreadyDefined, name); + + if (RESERVED_SPEC_KEYS.hasOwnProperty(name)) { + RESERVED_SPEC_KEYS[name](Constructor, property); + } else { + // Setup methods on prototype: + // The following member methods should not be automatically bound: + // 1. Expected ReactClass methods (in the "interface"). + // 2. Overridden methods (that were mixed in). + var isReactClassMethod = ReactClassInterface.hasOwnProperty(name); + var isFunction = typeof property === 'function'; + var shouldAutoBind = isFunction && !isReactClassMethod && !isAlreadyDefined && spec.autobind !== false; + + if (shouldAutoBind) { + autoBindPairs.push(name, property); + proto[name] = property; + } else { + if (isAlreadyDefined) { + var specPolicy = ReactClassInterface[name]; + + // These cases should already be caught by validateMethodOverride. + !(isReactClassMethod && (specPolicy === 'DEFINE_MANY_MERGED' || specPolicy === 'DEFINE_MANY')) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactClass: Unexpected spec policy %s for key %s when mixing in component specs.', specPolicy, name) : _prodInvariant('77', specPolicy, name) : void 0; + + // For methods which are defined more than once, call the existing + // methods before calling the new property, merging if appropriate. + if (specPolicy === 'DEFINE_MANY_MERGED') { + proto[name] = createMergedResultFunction(proto[name], property); + } else if (specPolicy === 'DEFINE_MANY') { + proto[name] = createChainedFunction(proto[name], property); + } + } else { + proto[name] = property; + if (process.env.NODE_ENV !== 'production') { + // Add verbose displayName to the function, which helps when looking + // at profiling tools. + if (typeof property === 'function' && spec.displayName) { + proto[name].displayName = spec.displayName + '_' + name; + } + } + } + } + } + } +} + +function mixStaticSpecIntoComponent(Constructor, statics) { + if (!statics) { + return; + } + for (var name in statics) { + var property = statics[name]; + if (!statics.hasOwnProperty(name)) { + continue; + } + + var isReserved = name in RESERVED_SPEC_KEYS; + !!isReserved ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactClass: You are attempting to define a reserved property, `%s`, that shouldn\'t be on the "statics" key. Define it as an instance property instead; it will still be accessible on the constructor.', name) : _prodInvariant('78', name) : void 0; + + var isInherited = name in Constructor; + !!isInherited ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactClass: You are attempting to define `%s` on your component more than once. This conflict may be due to a mixin.', name) : _prodInvariant('79', name) : void 0; + Constructor[name] = property; + } +} + +/** + * Merge two objects, but throw if both contain the same key. + * + * @param {object} one The first object, which is mutated. + * @param {object} two The second object + * @return {object} one after it has been mutated to contain everything in two. + */ +function mergeIntoWithNoDuplicateKeys(one, two) { + !(one && two && typeof one === 'object' && typeof two === 'object') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'mergeIntoWithNoDuplicateKeys(): Cannot merge non-objects.') : _prodInvariant('80') : void 0; + + for (var key in two) { + if (two.hasOwnProperty(key)) { + !(one[key] === undefined) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'mergeIntoWithNoDuplicateKeys(): Tried to merge two objects with the same key: `%s`. This conflict may be due to a mixin; in particular, this may be caused by two getInitialState() or getDefaultProps() methods returning objects with clashing keys.', key) : _prodInvariant('81', key) : void 0; + one[key] = two[key]; + } + } + return one; +} + +/** + * Creates a function that invokes two functions and merges their return values. + * + * @param {function} one Function to invoke first. + * @param {function} two Function to invoke second. + * @return {function} Function that invokes the two argument functions. + * @private + */ +function createMergedResultFunction(one, two) { + return function mergedResult() { + var a = one.apply(this, arguments); + var b = two.apply(this, arguments); + if (a == null) { + return b; + } else if (b == null) { + return a; + } + var c = {}; + mergeIntoWithNoDuplicateKeys(c, a); + mergeIntoWithNoDuplicateKeys(c, b); + return c; + }; +} + +/** + * Creates a function that invokes two functions and ignores their return vales. + * + * @param {function} one Function to invoke first. + * @param {function} two Function to invoke second. + * @return {function} Function that invokes the two argument functions. + * @private + */ +function createChainedFunction(one, two) { + return function chainedFunction() { + one.apply(this, arguments); + two.apply(this, arguments); + }; +} + +/** + * Binds a method to the component. + * + * @param {object} component Component whose method is going to be bound. + * @param {function} method Method to be bound. + * @return {function} The bound method. + */ +function bindAutoBindMethod(component, method) { + var boundMethod = method.bind(component); + if (process.env.NODE_ENV !== 'production') { + boundMethod.__reactBoundContext = component; + boundMethod.__reactBoundMethod = method; + boundMethod.__reactBoundArguments = null; + var componentName = component.constructor.displayName; + var _bind = boundMethod.bind; + boundMethod.bind = function (newThis) { + for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { + args[_key - 1] = arguments[_key]; + } + + // User is trying to bind() an autobound method; we effectively will + // ignore the value of "this" that the user is trying to use, so + // let's warn. + if (newThis !== component && newThis !== null) { + process.env.NODE_ENV !== 'production' ? warning(false, 'bind(): React component methods may only be bound to the ' + 'component instance. See %s', componentName) : void 0; + } else if (!args.length) { + process.env.NODE_ENV !== 'production' ? warning(false, 'bind(): You are binding a component method to the component. ' + 'React does this for you automatically in a high-performance ' + 'way, so you can safely remove this call. See %s', componentName) : void 0; + return boundMethod; + } + var reboundMethod = _bind.apply(boundMethod, arguments); + reboundMethod.__reactBoundContext = component; + reboundMethod.__reactBoundMethod = method; + reboundMethod.__reactBoundArguments = args; + return reboundMethod; + }; + } + return boundMethod; +} + +/** + * Binds all auto-bound methods in a component. + * + * @param {object} component Component whose method is going to be bound. + */ +function bindAutoBindMethods(component) { + var pairs = component.__reactAutoBindPairs; + for (var i = 0; i < pairs.length; i += 2) { + var autoBindKey = pairs[i]; + var method = pairs[i + 1]; + component[autoBindKey] = bindAutoBindMethod(component, method); + } +} + +/** + * Add more to the ReactClass base class. These are all legacy features and + * therefore not already part of the modern ReactComponent. + */ +var ReactClassMixin = { + + /** + * TODO: This will be deprecated because state should always keep a consistent + * type signature and the only use case for this, is to avoid that. + */ + replaceState: function (newState, callback) { + this.updater.enqueueReplaceState(this, newState); + if (callback) { + this.updater.enqueueCallback(this, callback, 'replaceState'); + } + }, + + /** + * Checks whether or not this composite component is mounted. + * @return {boolean} True if mounted, false otherwise. + * @protected + * @final + */ + isMounted: function () { + return this.updater.isMounted(this); + } +}; + +var ReactClassComponent = function () {}; +_assign(ReactClassComponent.prototype, ReactComponent.prototype, ReactClassMixin); + +var didWarnDeprecated = false; + +/** + * Module for creating composite components. + * + * @class ReactClass + */ +var ReactClass = { + + /** + * Creates a composite component class given a class specification. + * See https://facebook.github.io/react/docs/top-level-api.html#react.createclass + * + * @param {object} spec Class specification (which must define `render`). + * @return {function} Component constructor function. + * @public + */ + createClass: function (spec) { + if (process.env.NODE_ENV !== 'production') { + process.env.NODE_ENV !== 'production' ? warning(didWarnDeprecated, '%s: React.createClass is deprecated and will be removed in version 16. ' + 'Use plain JavaScript classes instead. If you\'re not yet ready to ' + 'migrate, create-react-class is available on npm as a ' + 'drop-in replacement.', spec && spec.displayName || 'A Component') : void 0; + didWarnDeprecated = true; + } + + // To keep our warnings more understandable, we'll use a little hack here to + // ensure that Constructor.name !== 'Constructor'. This makes sure we don't + // unnecessarily identify a class without displayName as 'Constructor'. + var Constructor = identity(function (props, context, updater) { + // This constructor gets overridden by mocks. The argument is used + // by mocks to assert on what gets mounted. + + if (process.env.NODE_ENV !== 'production') { + process.env.NODE_ENV !== 'production' ? warning(this instanceof Constructor, 'Something is calling a React component directly. Use a factory or ' + 'JSX instead. See: https://fb.me/react-legacyfactory') : void 0; + } + + // Wire up auto-binding + if (this.__reactAutoBindPairs.length) { + bindAutoBindMethods(this); + } + + this.props = props; + this.context = context; + this.refs = emptyObject; + this.updater = updater || ReactNoopUpdateQueue; + + this.state = null; + + // ReactClasses doesn't have constructors. Instead, they use the + // getInitialState and componentWillMount methods for initialization. + + var initialState = this.getInitialState ? this.getInitialState() : null; + if (process.env.NODE_ENV !== 'production') { + // We allow auto-mocks to proceed as if they're returning null. + if (initialState === undefined && this.getInitialState._isMockFunction) { + // This is probably bad practice. Consider warning here and + // deprecating this convenience. + initialState = null; + } + } + !(typeof initialState === 'object' && !Array.isArray(initialState)) ? process.env.NODE_ENV !== 'production' ? invariant(false, '%s.getInitialState(): must return an object or null', Constructor.displayName || 'ReactCompositeComponent') : _prodInvariant('82', Constructor.displayName || 'ReactCompositeComponent') : void 0; + + this.state = initialState; + }); + Constructor.prototype = new ReactClassComponent(); + Constructor.prototype.constructor = Constructor; + Constructor.prototype.__reactAutoBindPairs = []; + + injectedMixins.forEach(mixSpecIntoComponent.bind(null, Constructor)); + + mixSpecIntoComponent(Constructor, spec); + + // Initialize the defaultProps property after all mixins have been merged. + if (Constructor.getDefaultProps) { + Constructor.defaultProps = Constructor.getDefaultProps(); + } + + if (process.env.NODE_ENV !== 'production') { + // This is a tag to indicate that the use of these method names is ok, + // since it's used with createClass. If it's not, then it's likely a + // mistake so we'll warn you to use the static property, property + // initializer or constructor respectively. + if (Constructor.getDefaultProps) { + Constructor.getDefaultProps.isReactClassApproved = {}; + } + if (Constructor.prototype.getInitialState) { + Constructor.prototype.getInitialState.isReactClassApproved = {}; + } + } + + !Constructor.prototype.render ? process.env.NODE_ENV !== 'production' ? invariant(false, 'createClass(...): Class specification must implement a `render` method.') : _prodInvariant('83') : void 0; + + if (process.env.NODE_ENV !== 'production') { + process.env.NODE_ENV !== 'production' ? warning(!Constructor.prototype.componentShouldUpdate, '%s has a method called ' + 'componentShouldUpdate(). Did you mean shouldComponentUpdate()? ' + 'The name is phrased as a question because the function is ' + 'expected to return a value.', spec.displayName || 'A component') : void 0; + process.env.NODE_ENV !== 'production' ? warning(!Constructor.prototype.componentWillRecieveProps, '%s has a method called ' + 'componentWillRecieveProps(). Did you mean componentWillReceiveProps()?', spec.displayName || 'A component') : void 0; + } + + // Reduce time spent doing lookups by setting these on the prototype. + for (var methodName in ReactClassInterface) { + if (!Constructor.prototype[methodName]) { + Constructor.prototype[methodName] = null; + } + } + + return Constructor; + }, + + injection: { + injectMixin: function (mixin) { + injectedMixins.push(mixin); + } + } + +}; + +module.exports = ReactClass; \ No newline at end of file diff --git a/node_modules/react/lib/ReactComponent.js b/node_modules/react/lib/ReactComponent.js new file mode 100644 index 00000000..8e5c08f1 --- /dev/null +++ b/node_modules/react/lib/ReactComponent.js @@ -0,0 +1,117 @@ +/** + * Copyright 2013-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + */ + +'use strict'; + +var _prodInvariant = require('./reactProdInvariant'); + +var ReactNoopUpdateQueue = require('./ReactNoopUpdateQueue'); + +var canDefineProperty = require('./canDefineProperty'); +var emptyObject = require('fbjs/lib/emptyObject'); +var invariant = require('fbjs/lib/invariant'); +var warning = require('fbjs/lib/warning'); + +/** + * Base class helpers for the updating state of a component. + */ +function ReactComponent(props, context, updater) { + this.props = props; + this.context = context; + this.refs = emptyObject; + // We initialize the default updater but the real one gets injected by the + // renderer. + this.updater = updater || ReactNoopUpdateQueue; +} + +ReactComponent.prototype.isReactComponent = {}; + +/** + * Sets a subset of the state. Always use this to mutate + * state. You should treat `this.state` as immutable. + * + * There is no guarantee that `this.state` will be immediately updated, so + * accessing `this.state` after calling this method may return the old value. + * + * There is no guarantee that calls to `setState` will run synchronously, + * as they may eventually be batched together. You can provide an optional + * callback that will be executed when the call to setState is actually + * completed. + * + * When a function is provided to setState, it will be called at some point in + * the future (not synchronously). It will be called with the up to date + * component arguments (state, props, context). These values can be different + * from this.* because your function may be called after receiveProps but before + * shouldComponentUpdate, and this new state, props, and context will not yet be + * assigned to this. + * + * @param {object|function} partialState Next partial state or function to + * produce next partial state to be merged with current state. + * @param {?function} callback Called after state is updated. + * @final + * @protected + */ +ReactComponent.prototype.setState = function (partialState, callback) { + !(typeof partialState === 'object' || typeof partialState === 'function' || partialState == null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'setState(...): takes an object of state variables to update or a function which returns an object of state variables.') : _prodInvariant('85') : void 0; + this.updater.enqueueSetState(this, partialState); + if (callback) { + this.updater.enqueueCallback(this, callback, 'setState'); + } +}; + +/** + * Forces an update. This should only be invoked when it is known with + * certainty that we are **not** in a DOM transaction. + * + * You may want to call this when you know that some deeper aspect of the + * component's state has changed but `setState` was not called. + * + * This will not invoke `shouldComponentUpdate`, but it will invoke + * `componentWillUpdate` and `componentDidUpdate`. + * + * @param {?function} callback Called after update is complete. + * @final + * @protected + */ +ReactComponent.prototype.forceUpdate = function (callback) { + this.updater.enqueueForceUpdate(this); + if (callback) { + this.updater.enqueueCallback(this, callback, 'forceUpdate'); + } +}; + +/** + * Deprecated APIs. These APIs used to exist on classic React classes but since + * we would like to deprecate them, we're not going to move them over to this + * modern base class. Instead, we define a getter that warns if it's accessed. + */ +if (process.env.NODE_ENV !== 'production') { + var deprecatedAPIs = { + isMounted: ['isMounted', 'Instead, make sure to clean up subscriptions and pending requests in ' + 'componentWillUnmount to prevent memory leaks.'], + replaceState: ['replaceState', 'Refactor your code to use setState instead (see ' + 'https://github.com/facebook/react/issues/3236).'] + }; + var defineDeprecationWarning = function (methodName, info) { + if (canDefineProperty) { + Object.defineProperty(ReactComponent.prototype, methodName, { + get: function () { + process.env.NODE_ENV !== 'production' ? warning(false, '%s(...) is deprecated in plain JavaScript React classes. %s', info[0], info[1]) : void 0; + return undefined; + } + }); + } + }; + for (var fnName in deprecatedAPIs) { + if (deprecatedAPIs.hasOwnProperty(fnName)) { + defineDeprecationWarning(fnName, deprecatedAPIs[fnName]); + } + } +} + +module.exports = ReactComponent; \ No newline at end of file diff --git a/node_modules/react/lib/ReactComponentTreeDevtool.js b/node_modules/react/lib/ReactComponentTreeDevtool.js new file mode 100644 index 00000000..49012e74 --- /dev/null +++ b/node_modules/react/lib/ReactComponentTreeDevtool.js @@ -0,0 +1,14 @@ +/** + * Copyright 2016-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + */ +'use strict'; + +// TODO remove this proxy when RN/www gets updated + +module.exports = require('./ReactComponentTreeHook'); \ No newline at end of file diff --git a/node_modules/react/lib/ReactComponentTreeHook.js b/node_modules/react/lib/ReactComponentTreeHook.js new file mode 100644 index 00000000..b2faa205 --- /dev/null +++ b/node_modules/react/lib/ReactComponentTreeHook.js @@ -0,0 +1,333 @@ +/** + * Copyright 2016-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + * + */ + +'use strict'; + +var _prodInvariant = require('./reactProdInvariant'); + +var ReactCurrentOwner = require('./ReactCurrentOwner'); + +var invariant = require('fbjs/lib/invariant'); +var warning = require('fbjs/lib/warning'); + +function isNative(fn) { + // Based on isNative() from Lodash + var funcToString = Function.prototype.toString; + var hasOwnProperty = Object.prototype.hasOwnProperty; + var reIsNative = RegExp('^' + funcToString + // Take an example native function source for comparison + .call(hasOwnProperty) + // Strip regex characters so we can use it for regex + .replace(/[\\^$.*+?()[\]{}|]/g, '\\$&') + // Remove hasOwnProperty from the template to make it generic + .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'); + try { + var source = funcToString.call(fn); + return reIsNative.test(source); + } catch (err) { + return false; + } +} + +var canUseCollections = +// Array.from +typeof Array.from === 'function' && +// Map +typeof Map === 'function' && isNative(Map) && +// Map.prototype.keys +Map.prototype != null && typeof Map.prototype.keys === 'function' && isNative(Map.prototype.keys) && +// Set +typeof Set === 'function' && isNative(Set) && +// Set.prototype.keys +Set.prototype != null && typeof Set.prototype.keys === 'function' && isNative(Set.prototype.keys); + +var setItem; +var getItem; +var removeItem; +var getItemIDs; +var addRoot; +var removeRoot; +var getRootIDs; + +if (canUseCollections) { + var itemMap = new Map(); + var rootIDSet = new Set(); + + setItem = function (id, item) { + itemMap.set(id, item); + }; + getItem = function (id) { + return itemMap.get(id); + }; + removeItem = function (id) { + itemMap['delete'](id); + }; + getItemIDs = function () { + return Array.from(itemMap.keys()); + }; + + addRoot = function (id) { + rootIDSet.add(id); + }; + removeRoot = function (id) { + rootIDSet['delete'](id); + }; + getRootIDs = function () { + return Array.from(rootIDSet.keys()); + }; +} else { + var itemByKey = {}; + var rootByKey = {}; + + // Use non-numeric keys to prevent V8 performance issues: + // https://github.com/facebook/react/pull/7232 + var getKeyFromID = function (id) { + return '.' + id; + }; + var getIDFromKey = function (key) { + return parseInt(key.substr(1), 10); + }; + + setItem = function (id, item) { + var key = getKeyFromID(id); + itemByKey[key] = item; + }; + getItem = function (id) { + var key = getKeyFromID(id); + return itemByKey[key]; + }; + removeItem = function (id) { + var key = getKeyFromID(id); + delete itemByKey[key]; + }; + getItemIDs = function () { + return Object.keys(itemByKey).map(getIDFromKey); + }; + + addRoot = function (id) { + var key = getKeyFromID(id); + rootByKey[key] = true; + }; + removeRoot = function (id) { + var key = getKeyFromID(id); + delete rootByKey[key]; + }; + getRootIDs = function () { + return Object.keys(rootByKey).map(getIDFromKey); + }; +} + +var unmountedIDs = []; + +function purgeDeep(id) { + var item = getItem(id); + if (item) { + var childIDs = item.childIDs; + + removeItem(id); + childIDs.forEach(purgeDeep); + } +} + +function describeComponentFrame(name, source, ownerName) { + return '\n in ' + (name || 'Unknown') + (source ? ' (at ' + source.fileName.replace(/^.*[\\\/]/, '') + ':' + source.lineNumber + ')' : ownerName ? ' (created by ' + ownerName + ')' : ''); +} + +function getDisplayName(element) { + if (element == null) { + return '#empty'; + } else if (typeof element === 'string' || typeof element === 'number') { + return '#text'; + } else if (typeof element.type === 'string') { + return element.type; + } else { + return element.type.displayName || element.type.name || 'Unknown'; + } +} + +function describeID(id) { + var name = ReactComponentTreeHook.getDisplayName(id); + var element = ReactComponentTreeHook.getElement(id); + var ownerID = ReactComponentTreeHook.getOwnerID(id); + var ownerName; + if (ownerID) { + ownerName = ReactComponentTreeHook.getDisplayName(ownerID); + } + process.env.NODE_ENV !== 'production' ? warning(element, 'ReactComponentTreeHook: Missing React element for debugID %s when ' + 'building stack', id) : void 0; + return describeComponentFrame(name, element && element._source, ownerName); +} + +var ReactComponentTreeHook = { + onSetChildren: function (id, nextChildIDs) { + var item = getItem(id); + !item ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Item must have been set') : _prodInvariant('144') : void 0; + item.childIDs = nextChildIDs; + + for (var i = 0; i < nextChildIDs.length; i++) { + var nextChildID = nextChildIDs[i]; + var nextChild = getItem(nextChildID); + !nextChild ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Expected hook events to fire for the child before its parent includes it in onSetChildren().') : _prodInvariant('140') : void 0; + !(nextChild.childIDs != null || typeof nextChild.element !== 'object' || nextChild.element == null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Expected onSetChildren() to fire for a container child before its parent includes it in onSetChildren().') : _prodInvariant('141') : void 0; + !nextChild.isMounted ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Expected onMountComponent() to fire for the child before its parent includes it in onSetChildren().') : _prodInvariant('71') : void 0; + if (nextChild.parentID == null) { + nextChild.parentID = id; + // TODO: This shouldn't be necessary but mounting a new root during in + // componentWillMount currently causes not-yet-mounted components to + // be purged from our tree data so their parent id is missing. + } + !(nextChild.parentID === id) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Expected onBeforeMountComponent() parent and onSetChildren() to be consistent (%s has parents %s and %s).', nextChildID, nextChild.parentID, id) : _prodInvariant('142', nextChildID, nextChild.parentID, id) : void 0; + } + }, + onBeforeMountComponent: function (id, element, parentID) { + var item = { + element: element, + parentID: parentID, + text: null, + childIDs: [], + isMounted: false, + updateCount: 0 + }; + setItem(id, item); + }, + onBeforeUpdateComponent: function (id, element) { + var item = getItem(id); + if (!item || !item.isMounted) { + // We may end up here as a result of setState() in componentWillUnmount(). + // In this case, ignore the element. + return; + } + item.element = element; + }, + onMountComponent: function (id) { + var item = getItem(id); + !item ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Item must have been set') : _prodInvariant('144') : void 0; + item.isMounted = true; + var isRoot = item.parentID === 0; + if (isRoot) { + addRoot(id); + } + }, + onUpdateComponent: function (id) { + var item = getItem(id); + if (!item || !item.isMounted) { + // We may end up here as a result of setState() in componentWillUnmount(). + // In this case, ignore the element. + return; + } + item.updateCount++; + }, + onUnmountComponent: function (id) { + var item = getItem(id); + if (item) { + // We need to check if it exists. + // `item` might not exist if it is inside an error boundary, and a sibling + // error boundary child threw while mounting. Then this instance never + // got a chance to mount, but it still gets an unmounting event during + // the error boundary cleanup. + item.isMounted = false; + var isRoot = item.parentID === 0; + if (isRoot) { + removeRoot(id); + } + } + unmountedIDs.push(id); + }, + purgeUnmountedComponents: function () { + if (ReactComponentTreeHook._preventPurging) { + // Should only be used for testing. + return; + } + + for (var i = 0; i < unmountedIDs.length; i++) { + var id = unmountedIDs[i]; + purgeDeep(id); + } + unmountedIDs.length = 0; + }, + isMounted: function (id) { + var item = getItem(id); + return item ? item.isMounted : false; + }, + getCurrentStackAddendum: function (topElement) { + var info = ''; + if (topElement) { + var name = getDisplayName(topElement); + var owner = topElement._owner; + info += describeComponentFrame(name, topElement._source, owner && owner.getName()); + } + + var currentOwner = ReactCurrentOwner.current; + var id = currentOwner && currentOwner._debugID; + + info += ReactComponentTreeHook.getStackAddendumByID(id); + return info; + }, + getStackAddendumByID: function (id) { + var info = ''; + while (id) { + info += describeID(id); + id = ReactComponentTreeHook.getParentID(id); + } + return info; + }, + getChildIDs: function (id) { + var item = getItem(id); + return item ? item.childIDs : []; + }, + getDisplayName: function (id) { + var element = ReactComponentTreeHook.getElement(id); + if (!element) { + return null; + } + return getDisplayName(element); + }, + getElement: function (id) { + var item = getItem(id); + return item ? item.element : null; + }, + getOwnerID: function (id) { + var element = ReactComponentTreeHook.getElement(id); + if (!element || !element._owner) { + return null; + } + return element._owner._debugID; + }, + getParentID: function (id) { + var item = getItem(id); + return item ? item.parentID : null; + }, + getSource: function (id) { + var item = getItem(id); + var element = item ? item.element : null; + var source = element != null ? element._source : null; + return source; + }, + getText: function (id) { + var element = ReactComponentTreeHook.getElement(id); + if (typeof element === 'string') { + return element; + } else if (typeof element === 'number') { + return '' + element; + } else { + return null; + } + }, + getUpdateCount: function (id) { + var item = getItem(id); + return item ? item.updateCount : 0; + }, + + + getRootIDs: getRootIDs, + getRegisteredIDs: getItemIDs +}; + +module.exports = ReactComponentTreeHook; \ No newline at end of file diff --git a/node_modules/react/lib/ReactComponentTreeHookUMDShim.js b/node_modules/react/lib/ReactComponentTreeHookUMDShim.js new file mode 100644 index 00000000..00335b36 --- /dev/null +++ b/node_modules/react/lib/ReactComponentTreeHookUMDShim.js @@ -0,0 +1,17 @@ +/** + * Copyright 2013-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + */ + +/* globals React */ + +'use strict'; + +var ReactInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; + +module.exports = ReactInternals.ReactComponentTreeHook; \ No newline at end of file diff --git a/node_modules/react/lib/ReactComponentWithPureRenderMixin.js b/node_modules/react/lib/ReactComponentWithPureRenderMixin.js new file mode 100644 index 00000000..6f3868b8 --- /dev/null +++ b/node_modules/react/lib/ReactComponentWithPureRenderMixin.js @@ -0,0 +1,47 @@ +/** + * Copyright 2013-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + */ + +'use strict'; + +var shallowCompare = require('./shallowCompare'); + +/** + * If your React component's render function is "pure", e.g. it will render the + * same result given the same props and state, provide this mixin for a + * considerable performance boost. + * + * Most React components have pure render functions. + * + * Example: + * + * var ReactComponentWithPureRenderMixin = + * require('ReactComponentWithPureRenderMixin'); + * React.createClass({ + * mixins: [ReactComponentWithPureRenderMixin], + * + * render: function() { + * return
foo
; + * } + * }); + * + * Note: This only checks shallow equality for props and state. If these contain + * complex data structures this mixin may have false-negatives for deeper + * differences. Only mixin to components which have simple props and state, or + * use `forceUpdate()` when you know deep data structures have changed. + * + * See https://facebook.github.io/react/docs/pure-render-mixin.html + */ +var ReactComponentWithPureRenderMixin = { + shouldComponentUpdate: function (nextProps, nextState) { + return shallowCompare(this, nextProps, nextState); + } +}; + +module.exports = ReactComponentWithPureRenderMixin; \ No newline at end of file diff --git a/node_modules/react/lib/ReactCurrentOwner.js b/node_modules/react/lib/ReactCurrentOwner.js new file mode 100644 index 00000000..5ecf03e4 --- /dev/null +++ b/node_modules/react/lib/ReactCurrentOwner.js @@ -0,0 +1,30 @@ +/** + * Copyright 2013-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + * + */ + +'use strict'; + +/** + * Keeps track of the current owner. + * + * The current owner is the component who should own any components that are + * currently being constructed. + */ +var ReactCurrentOwner = { + + /** + * @internal + * @type {ReactComponent} + */ + current: null + +}; + +module.exports = ReactCurrentOwner; \ No newline at end of file diff --git a/node_modules/react/lib/ReactCurrentOwnerUMDShim.js b/node_modules/react/lib/ReactCurrentOwnerUMDShim.js new file mode 100644 index 00000000..a53f0a53 --- /dev/null +++ b/node_modules/react/lib/ReactCurrentOwnerUMDShim.js @@ -0,0 +1,17 @@ +/** + * Copyright 2013-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + */ + +/* globals React */ + +'use strict'; + +var ReactInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; + +module.exports = ReactInternals.ReactCurrentOwner; \ No newline at end of file diff --git a/node_modules/react/lib/ReactDOMFactories.js b/node_modules/react/lib/ReactDOMFactories.js new file mode 100644 index 00000000..d5aad6dd --- /dev/null +++ b/node_modules/react/lib/ReactDOMFactories.js @@ -0,0 +1,169 @@ +/** + * Copyright 2013-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + */ + +'use strict'; + +var ReactElement = require('./ReactElement'); + +/** + * Create a factory that creates HTML tag elements. + * + * @private + */ +var createDOMFactory = ReactElement.createFactory; +if (process.env.NODE_ENV !== 'production') { + var ReactElementValidator = require('./ReactElementValidator'); + createDOMFactory = ReactElementValidator.createFactory; +} + +/** + * Creates a mapping from supported HTML tags to `ReactDOMComponent` classes. + * This is also accessible via `React.DOM`. + * + * @public + */ +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') +}; + +module.exports = ReactDOMFactories; \ No newline at end of file diff --git a/node_modules/react/lib/ReactElement.js b/node_modules/react/lib/ReactElement.js new file mode 100644 index 00000000..97f4bf01 --- /dev/null +++ b/node_modules/react/lib/ReactElement.js @@ -0,0 +1,340 @@ +/** + * Copyright 2014-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + */ + +'use strict'; + +var _assign = require('object-assign'); + +var ReactCurrentOwner = require('./ReactCurrentOwner'); + +var warning = require('fbjs/lib/warning'); +var canDefineProperty = require('./canDefineProperty'); +var hasOwnProperty = Object.prototype.hasOwnProperty; + +var REACT_ELEMENT_TYPE = require('./ReactElementSymbol'); + +var RESERVED_PROPS = { + key: true, + ref: true, + __self: true, + __source: true +}; + +var specialPropKeyWarningShown, specialPropRefWarningShown; + +function hasValidRef(config) { + if (process.env.NODE_ENV !== 'production') { + if (hasOwnProperty.call(config, 'ref')) { + var getter = Object.getOwnPropertyDescriptor(config, 'ref').get; + if (getter && getter.isReactWarning) { + return false; + } + } + } + return config.ref !== undefined; +} + +function hasValidKey(config) { + if (process.env.NODE_ENV !== 'production') { + if (hasOwnProperty.call(config, 'key')) { + var getter = Object.getOwnPropertyDescriptor(config, 'key').get; + if (getter && getter.isReactWarning) { + return false; + } + } + } + return config.key !== undefined; +} + +function defineKeyPropWarningGetter(props, displayName) { + var warnAboutAccessingKey = function () { + if (!specialPropKeyWarningShown) { + specialPropKeyWarningShown = true; + process.env.NODE_ENV !== 'production' ? warning(false, '%s: `key` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://fb.me/react-special-props)', displayName) : void 0; + } + }; + warnAboutAccessingKey.isReactWarning = true; + Object.defineProperty(props, 'key', { + get: warnAboutAccessingKey, + configurable: true + }); +} + +function defineRefPropWarningGetter(props, displayName) { + var warnAboutAccessingRef = function () { + if (!specialPropRefWarningShown) { + specialPropRefWarningShown = true; + process.env.NODE_ENV !== 'production' ? warning(false, '%s: `ref` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://fb.me/react-special-props)', displayName) : void 0; + } + }; + warnAboutAccessingRef.isReactWarning = true; + Object.defineProperty(props, 'ref', { + get: warnAboutAccessingRef, + configurable: true + }); +} + +/** + * Factory method to create a new React element. This no longer adheres to + * the class pattern, so do not use new to call it. Also, no instanceof check + * will work. Instead test $$typeof field against Symbol.for('react.element') to check + * if something is a React Element. + * + * @param {*} type + * @param {*} key + * @param {string|object} ref + * @param {*} self A *temporary* helper to detect places where `this` is + * different from the `owner` when React.createElement is called, so that we + * can warn. We want to get rid of owner and replace string `ref`s with arrow + * functions, and as long as `this` and owner are the same, there will be no + * change in behavior. + * @param {*} source An annotation object (added by a transpiler or otherwise) + * indicating filename, line number, and/or other information. + * @param {*} owner + * @param {*} props + * @internal + */ +var ReactElement = function (type, key, ref, self, source, owner, props) { + var element = { + // This tag allow us to uniquely identify this as a React Element + $$typeof: REACT_ELEMENT_TYPE, + + // Built-in properties that belong on the element + type: type, + key: key, + ref: ref, + props: props, + + // Record the component responsible for creating this element. + _owner: owner + }; + + if (process.env.NODE_ENV !== 'production') { + // The validation flag is currently mutative. We put it on + // an external backing store so that we can freeze the whole object. + // This can be replaced with a WeakMap once they are implemented in + // commonly used development environments. + element._store = {}; + + // To make comparing ReactElements easier for testing purposes, we make + // the validation flag non-enumerable (where possible, which should + // include every environment we run tests in), so the test framework + // ignores it. + if (canDefineProperty) { + Object.defineProperty(element._store, 'validated', { + configurable: false, + enumerable: false, + writable: true, + value: false + }); + // self and source are DEV only properties. + Object.defineProperty(element, '_self', { + configurable: false, + enumerable: false, + writable: false, + value: self + }); + // Two elements created in two different places should be considered + // equal for testing purposes and therefore we hide it from enumeration. + Object.defineProperty(element, '_source', { + configurable: false, + enumerable: false, + writable: false, + value: source + }); + } else { + element._store.validated = false; + element._self = self; + element._source = source; + } + if (Object.freeze) { + Object.freeze(element.props); + Object.freeze(element); + } + } + + return element; +}; + +/** + * Create and return a new ReactElement of the given type. + * See https://facebook.github.io/react/docs/top-level-api.html#react.createelement + */ +ReactElement.createElement = function (type, config, children) { + var propName; + + // Reserved names are extracted + var props = {}; + + var key = null; + var ref = null; + var self = null; + var source = null; + + if (config != null) { + if (hasValidRef(config)) { + ref = config.ref; + } + if (hasValidKey(config)) { + key = '' + config.key; + } + + self = config.__self === undefined ? null : config.__self; + source = config.__source === undefined ? null : config.__source; + // Remaining properties are added to a new props object + for (propName in config) { + if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) { + props[propName] = config[propName]; + } + } + } + + // Children can be more than one argument, and those are transferred onto + // the newly allocated props object. + var childrenLength = arguments.length - 2; + if (childrenLength === 1) { + props.children = children; + } else if (childrenLength > 1) { + var childArray = Array(childrenLength); + for (var i = 0; i < childrenLength; i++) { + childArray[i] = arguments[i + 2]; + } + if (process.env.NODE_ENV !== 'production') { + if (Object.freeze) { + Object.freeze(childArray); + } + } + props.children = childArray; + } + + // Resolve default props + if (type && type.defaultProps) { + var defaultProps = type.defaultProps; + for (propName in defaultProps) { + if (props[propName] === undefined) { + props[propName] = defaultProps[propName]; + } + } + } + if (process.env.NODE_ENV !== 'production') { + if (key || ref) { + if (typeof props.$$typeof === 'undefined' || props.$$typeof !== REACT_ELEMENT_TYPE) { + var displayName = typeof type === 'function' ? type.displayName || type.name || 'Unknown' : type; + if (key) { + defineKeyPropWarningGetter(props, displayName); + } + if (ref) { + defineRefPropWarningGetter(props, displayName); + } + } + } + } + return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props); +}; + +/** + * Return a function that produces ReactElements of a given type. + * See https://facebook.github.io/react/docs/top-level-api.html#react.createfactory + */ +ReactElement.createFactory = function (type) { + var factory = ReactElement.createElement.bind(null, type); + // Expose the type on the factory and the prototype so that it can be + // easily accessed on elements. E.g. `.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. + // Legacy hook TODO: Warn if this is accessed + factory.type = type; + return factory; +}; + +ReactElement.cloneAndReplaceKey = function (oldElement, newKey) { + var newElement = ReactElement(oldElement.type, newKey, oldElement.ref, oldElement._self, oldElement._source, oldElement._owner, oldElement.props); + + return newElement; +}; + +/** + * Clone and return a new ReactElement using element as the starting point. + * See https://facebook.github.io/react/docs/top-level-api.html#react.cloneelement + */ +ReactElement.cloneElement = function (element, config, children) { + var propName; + + // Original props are copied + var props = _assign({}, element.props); + + // Reserved names are extracted + var key = element.key; + var ref = element.ref; + // Self is preserved since the owner is preserved. + var self = element._self; + // Source is preserved since cloneElement is unlikely to be targeted by a + // transpiler, and the original source is probably a better indicator of the + // true owner. + var source = element._source; + + // Owner will be preserved, unless ref is overridden + var owner = element._owner; + + if (config != null) { + if (hasValidRef(config)) { + // Silently steal the ref from the parent. + ref = config.ref; + owner = ReactCurrentOwner.current; + } + if (hasValidKey(config)) { + key = '' + config.key; + } + + // Remaining properties override existing props + var defaultProps; + if (element.type && element.type.defaultProps) { + defaultProps = element.type.defaultProps; + } + for (propName in config) { + if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) { + if (config[propName] === undefined && defaultProps !== undefined) { + // Resolve default props + props[propName] = defaultProps[propName]; + } else { + props[propName] = config[propName]; + } + } + } + } + + // Children can be more than one argument, and those are transferred onto + // the newly allocated props object. + var childrenLength = arguments.length - 2; + if (childrenLength === 1) { + props.children = children; + } else if (childrenLength > 1) { + var childArray = Array(childrenLength); + for (var i = 0; i < childrenLength; i++) { + childArray[i] = arguments[i + 2]; + } + props.children = childArray; + } + + return ReactElement(element.type, key, ref, self, source, owner, props); +}; + +/** + * Verifies the object is a ReactElement. + * See https://facebook.github.io/react/docs/top-level-api.html#react.isvalidelement + * @param {?object} object + * @return {boolean} True if `object` is a valid component. + * @final + */ +ReactElement.isValidElement = function (object) { + return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE; +}; + +module.exports = ReactElement; \ No newline at end of file diff --git a/node_modules/react/lib/ReactElementSymbol.js b/node_modules/react/lib/ReactElementSymbol.js new file mode 100644 index 00000000..c13765b9 --- /dev/null +++ b/node_modules/react/lib/ReactElementSymbol.js @@ -0,0 +1,19 @@ +/** + * Copyright 2014-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + * + */ + +'use strict'; + +// The Symbol used to tag the ReactElement type. If there is no native Symbol +// nor polyfill, then a plain number is used for performance. + +var REACT_ELEMENT_TYPE = typeof Symbol === 'function' && Symbol['for'] && Symbol['for']('react.element') || 0xeac7; + +module.exports = REACT_ELEMENT_TYPE; \ No newline at end of file diff --git a/node_modules/react/lib/ReactElementType.js b/node_modules/react/lib/ReactElementType.js new file mode 100644 index 00000000..2b2e7bbc --- /dev/null +++ b/node_modules/react/lib/ReactElementType.js @@ -0,0 +1,12 @@ +/** + * Copyright 2016-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + * + */ + +'use strict'; \ No newline at end of file diff --git a/node_modules/react/lib/ReactElementValidator.js b/node_modules/react/lib/ReactElementValidator.js new file mode 100644 index 00000000..bfffb0b6 --- /dev/null +++ b/node_modules/react/lib/ReactElementValidator.js @@ -0,0 +1,252 @@ +/** + * Copyright 2014-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + */ + +/** + * ReactElementValidator provides a wrapper around a element factory + * which validates the props passed to the element. This is intended to be + * used only in DEV and could be replaced by a static type checker for languages + * that support it. + */ + +'use strict'; + +var ReactCurrentOwner = require('./ReactCurrentOwner'); +var ReactComponentTreeHook = require('./ReactComponentTreeHook'); +var ReactElement = require('./ReactElement'); + +var checkReactTypeSpec = require('./checkReactTypeSpec'); + +var canDefineProperty = require('./canDefineProperty'); +var getIteratorFn = require('./getIteratorFn'); +var warning = require('fbjs/lib/warning'); + +function getDeclarationErrorAddendum() { + if (ReactCurrentOwner.current) { + var name = ReactCurrentOwner.current.getName(); + if (name) { + return ' Check the render method of `' + name + '`.'; + } + } + return ''; +} + +function getSourceInfoErrorAddendum(elementProps) { + if (elementProps !== null && elementProps !== undefined && elementProps.__source !== undefined) { + var source = elementProps.__source; + var fileName = source.fileName.replace(/^.*[\\\/]/, ''); + var lineNumber = source.lineNumber; + return ' Check your code at ' + fileName + ':' + lineNumber + '.'; + } + return ''; +} + +/** + * Warn if there's no key explicitly set on dynamic arrays of children or + * object keys are not valid. This allows us to keep track of children between + * updates. + */ +var ownerHasKeyUseWarning = {}; + +function getCurrentComponentErrorInfo(parentType) { + var info = getDeclarationErrorAddendum(); + + if (!info) { + var parentName = typeof parentType === 'string' ? parentType : parentType.displayName || parentType.name; + if (parentName) { + info = ' Check the top-level render call using <' + parentName + '>.'; + } + } + return info; +} + +/** + * Warn if the element doesn't have an explicit key assigned to it. + * This element is in an array. The array could grow and shrink or be + * reordered. All children that haven't already been validated are required to + * have a "key" property assigned to it. Error statuses are cached so a warning + * will only be shown once. + * + * @internal + * @param {ReactElement} element Element that requires a key. + * @param {*} parentType element's parent's type. + */ +function validateExplicitKey(element, parentType) { + if (!element._store || element._store.validated || element.key != null) { + return; + } + element._store.validated = true; + + var memoizer = ownerHasKeyUseWarning.uniqueKey || (ownerHasKeyUseWarning.uniqueKey = {}); + + var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType); + if (memoizer[currentComponentErrorInfo]) { + return; + } + memoizer[currentComponentErrorInfo] = true; + + // Usually the current owner is the offender, but if it accepts children as a + // property, it may be the creator of the child that's responsible for + // assigning it a key. + var childOwner = ''; + if (element && element._owner && element._owner !== ReactCurrentOwner.current) { + // Give the component that originally created this child. + childOwner = ' It was passed a child from ' + element._owner.getName() + '.'; + } + + process.env.NODE_ENV !== 'production' ? warning(false, 'Each child in an array or iterator should have a unique "key" prop.' + '%s%s See https://fb.me/react-warning-keys for more information.%s', currentComponentErrorInfo, childOwner, ReactComponentTreeHook.getCurrentStackAddendum(element)) : void 0; +} + +/** + * Ensure that every element either is passed in a static location, in an + * array with an explicit keys property defined, or in an object literal + * with valid key property. + * + * @internal + * @param {ReactNode} node Statically passed child of any type. + * @param {*} parentType node's parent's type. + */ +function validateChildKeys(node, parentType) { + if (typeof node !== 'object') { + return; + } + if (Array.isArray(node)) { + for (var i = 0; i < node.length; i++) { + var child = node[i]; + if (ReactElement.isValidElement(child)) { + validateExplicitKey(child, parentType); + } + } + } else if (ReactElement.isValidElement(node)) { + // This element was passed in a valid location. + if (node._store) { + node._store.validated = true; + } + } else if (node) { + var iteratorFn = getIteratorFn(node); + // Entry iterators provide implicit keys. + if (iteratorFn) { + if (iteratorFn !== node.entries) { + var iterator = iteratorFn.call(node); + var step; + while (!(step = iterator.next()).done) { + if (ReactElement.isValidElement(step.value)) { + validateExplicitKey(step.value, parentType); + } + } + } + } + } +} + +/** + * Given an element, validate that its props follow the propTypes definition, + * provided by the type. + * + * @param {ReactElement} element + */ +function validatePropTypes(element) { + var componentClass = element.type; + if (typeof componentClass !== 'function') { + return; + } + var name = componentClass.displayName || componentClass.name; + if (componentClass.propTypes) { + checkReactTypeSpec(componentClass.propTypes, element.props, 'prop', name, element, null); + } + if (typeof componentClass.getDefaultProps === 'function') { + process.env.NODE_ENV !== 'production' ? warning(componentClass.getDefaultProps.isReactClassApproved, 'getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.') : void 0; + } +} + +var ReactElementValidator = { + + createElement: function (type, props, children) { + var validType = typeof type === 'string' || typeof type === 'function'; + // We warn in this case but don't throw. We expect the element creation to + // succeed and there will likely be errors in render. + if (!validType) { + if (typeof type !== 'function' && typeof type !== 'string') { + var info = ''; + if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) { + info += ' You likely forgot to export your component from the file ' + 'it\'s defined in.'; + } + + var sourceInfo = getSourceInfoErrorAddendum(props); + if (sourceInfo) { + info += sourceInfo; + } else { + info += getDeclarationErrorAddendum(); + } + + info += ReactComponentTreeHook.getCurrentStackAddendum(); + + process.env.NODE_ENV !== 'production' ? warning(false, 'React.createElement: type is invalid -- expected a string (for ' + 'built-in components) or a class/function (for composite ' + 'components) but got: %s.%s', type == null ? type : typeof type, info) : void 0; + } + } + + var element = ReactElement.createElement.apply(this, arguments); + + // The result can be nullish if a mock or a custom function is used. + // TODO: Drop this when these are no longer allowed as the type argument. + if (element == null) { + return element; + } + + // Skip key warning if the type isn't valid since our key validation logic + // doesn't expect a non-string/function type and can throw confusing errors. + // We don't want exception behavior to differ between dev and prod. + // (Rendering will throw with a helpful message and as soon as the type is + // fixed, the key warnings will appear.) + if (validType) { + for (var i = 2; i < arguments.length; i++) { + validateChildKeys(arguments[i], type); + } + } + + validatePropTypes(element); + + return element; + }, + + createFactory: function (type) { + var validatedFactory = ReactElementValidator.createElement.bind(null, type); + // Legacy hook TODO: Warn if this is accessed + validatedFactory.type = type; + + if (process.env.NODE_ENV !== 'production') { + if (canDefineProperty) { + Object.defineProperty(validatedFactory, 'type', { + enumerable: false, + get: function () { + process.env.NODE_ENV !== 'production' ? warning(false, 'Factory.type is deprecated. Access the class directly ' + 'before passing it to createFactory.') : void 0; + Object.defineProperty(this, 'type', { + value: type + }); + return type; + } + }); + } + } + + return validatedFactory; + }, + + cloneElement: function (element, props, children) { + var newElement = ReactElement.cloneElement.apply(this, arguments); + for (var i = 2; i < arguments.length; i++) { + validateChildKeys(arguments[i], newElement.type); + } + validatePropTypes(newElement); + return newElement; + } + +}; + +module.exports = ReactElementValidator; \ No newline at end of file diff --git a/node_modules/react/lib/ReactFragment.js b/node_modules/react/lib/ReactFragment.js new file mode 100644 index 00000000..b35ced2d --- /dev/null +++ b/node_modules/react/lib/ReactFragment.js @@ -0,0 +1,68 @@ +/** + * Copyright 2015-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + */ + +'use strict'; + +var _prodInvariant = require('./reactProdInvariant'); + +var ReactChildren = require('./ReactChildren'); +var ReactElement = require('./ReactElement'); + +var emptyFunction = require('fbjs/lib/emptyFunction'); +var invariant = require('fbjs/lib/invariant'); +var warning = require('fbjs/lib/warning'); + +/** + * We used to allow keyed objects to serve as a collection of ReactElements, + * or nested sets. This allowed us a way to explicitly key a set or fragment of + * components. This is now being replaced with an opaque data structure. + * The upgrade path is to call React.addons.createFragment({ key: value }) to + * create a keyed fragment. The resulting data structure is an array. + */ + +var numericPropertyRegex = /^\d+$/; + +var warnedAboutNumeric = false; + +var ReactFragment = { + /** + * Wrap a keyed object in an opaque proxy that warns you if you access any + * of its properties. + * See https://facebook.github.io/react/docs/create-fragment.html + */ + create: function (object) { + if (typeof object !== 'object' || !object || Array.isArray(object)) { + process.env.NODE_ENV !== 'production' ? warning(false, 'React.addons.createFragment only accepts a single object. Got: %s', object) : void 0; + return object; + } + if (ReactElement.isValidElement(object)) { + process.env.NODE_ENV !== 'production' ? warning(false, 'React.addons.createFragment does not accept a ReactElement ' + 'without a wrapper object.') : void 0; + return object; + } + + !(object.nodeType !== 1) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'React.addons.createFragment(...): Encountered an invalid child; DOM elements are not valid children of React components.') : _prodInvariant('0') : void 0; + + var result = []; + + for (var key in object) { + if (process.env.NODE_ENV !== 'production') { + if (!warnedAboutNumeric && numericPropertyRegex.test(key)) { + process.env.NODE_ENV !== 'production' ? warning(false, 'React.addons.createFragment(...): Child objects should have ' + 'non-numeric keys so ordering is preserved.') : void 0; + warnedAboutNumeric = true; + } + } + ReactChildren.mapIntoWithKeyPrefixInternal(object[key], result, key, emptyFunction.thatReturnsArgument); + } + + return result; + } +}; + +module.exports = ReactFragment; \ No newline at end of file diff --git a/node_modules/react/lib/ReactLink.js b/node_modules/react/lib/ReactLink.js new file mode 100644 index 00000000..b0e88225 --- /dev/null +++ b/node_modules/react/lib/ReactLink.js @@ -0,0 +1,70 @@ +/** + * Copyright 2013-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + */ + +'use strict'; + +/** + * ReactLink encapsulates a common pattern in which a component wants to modify + * a prop received from its parent. ReactLink allows the parent to pass down a + * value coupled with a callback that, when invoked, expresses an intent to + * modify that value. For example: + * + * React.createClass({ + * getInitialState: function() { + * return {value: ''}; + * }, + * render: function() { + * var valueLink = new ReactLink(this.state.value, this._handleValueChange); + * return ; + * }, + * _handleValueChange: function(newValue) { + * this.setState({value: newValue}); + * } + * }); + * + * We have provided some sugary mixins to make the creation and + * consumption of ReactLink easier; see LinkedValueUtils and LinkedStateMixin. + */ + +var React = require('./React'); + +/** + * Deprecated: An an easy way to express two-way binding with React. + * See https://facebook.github.io/react/docs/two-way-binding-helpers.html + * + * @param {*} value current value of the link + * @param {function} requestChange callback to request a change + */ +function ReactLink(value, requestChange) { + this.value = value; + this.requestChange = requestChange; +} + +/** + * Creates a PropType that enforces the ReactLink API and optionally checks the + * type of the value being passed inside the link. Example: + * + * MyComponent.propTypes = { + * tabIndexLink: ReactLink.PropTypes.link(React.PropTypes.number) + * } + */ +function createLinkTypeChecker(linkType) { + var shapes = { + value: linkType === undefined ? React.PropTypes.any.isRequired : linkType.isRequired, + requestChange: React.PropTypes.func.isRequired + }; + return React.PropTypes.shape(shapes); +} + +ReactLink.PropTypes = { + link: createLinkTypeChecker +}; + +module.exports = ReactLink; \ No newline at end of file diff --git a/node_modules/react/lib/ReactNoopUpdateQueue.js b/node_modules/react/lib/ReactNoopUpdateQueue.js new file mode 100644 index 00000000..cf5fd7ca --- /dev/null +++ b/node_modules/react/lib/ReactNoopUpdateQueue.js @@ -0,0 +1,95 @@ +/** + * Copyright 2015-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + */ + +'use strict'; + +var warning = require('fbjs/lib/warning'); + +function warnNoop(publicInstance, callerName) { + if (process.env.NODE_ENV !== 'production') { + var constructor = publicInstance.constructor; + process.env.NODE_ENV !== 'production' ? warning(false, '%s(...): Can only update a mounted or mounting component. ' + 'This usually means you called %s() on an unmounted component. ' + 'This is a no-op. Please check the code for the %s component.', callerName, callerName, constructor && (constructor.displayName || constructor.name) || 'ReactClass') : void 0; + } +} + +/** + * This is the abstract API for an update queue. + */ +var ReactNoopUpdateQueue = { + + /** + * Checks whether or not this composite component is mounted. + * @param {ReactClass} publicInstance The instance we want to test. + * @return {boolean} True if mounted, false otherwise. + * @protected + * @final + */ + isMounted: function (publicInstance) { + return false; + }, + + /** + * Enqueue a callback that will be executed after all the pending updates + * have processed. + * + * @param {ReactClass} publicInstance The instance to use as `this` context. + * @param {?function} callback Called after state is updated. + * @internal + */ + enqueueCallback: function (publicInstance, callback) {}, + + /** + * Forces an update. This should only be invoked when it is known with + * certainty that we are **not** in a DOM transaction. + * + * You may want to call this when you know that some deeper aspect of the + * component's state has changed but `setState` was not called. + * + * This will not invoke `shouldComponentUpdate`, but it will invoke + * `componentWillUpdate` and `componentDidUpdate`. + * + * @param {ReactClass} publicInstance The instance that should rerender. + * @internal + */ + enqueueForceUpdate: function (publicInstance) { + warnNoop(publicInstance, 'forceUpdate'); + }, + + /** + * Replaces all of the state. Always use this or `setState` to mutate state. + * You should treat `this.state` as immutable. + * + * There is no guarantee that `this.state` will be immediately updated, so + * accessing `this.state` after calling this method may return the old value. + * + * @param {ReactClass} publicInstance The instance that should rerender. + * @param {object} completeState Next state. + * @internal + */ + enqueueReplaceState: function (publicInstance, completeState) { + warnNoop(publicInstance, 'replaceState'); + }, + + /** + * Sets a subset of the state. This only exists because _pendingState is + * internal. This provides a merging strategy that is not available to deep + * properties which is confusing. TODO: Expose pendingState or don't use it + * during the merge. + * + * @param {ReactClass} publicInstance The instance that should rerender. + * @param {object} partialState Next partial state to be merged with state. + * @internal + */ + enqueueSetState: function (publicInstance, partialState) { + warnNoop(publicInstance, 'setState'); + } +}; + +module.exports = ReactNoopUpdateQueue; \ No newline at end of file diff --git a/node_modules/react/lib/ReactPropTypeLocationNames.js b/node_modules/react/lib/ReactPropTypeLocationNames.js new file mode 100644 index 00000000..db033cda --- /dev/null +++ b/node_modules/react/lib/ReactPropTypeLocationNames.js @@ -0,0 +1,24 @@ +/** + * Copyright 2013-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + * + */ + +'use strict'; + +var ReactPropTypeLocationNames = {}; + +if (process.env.NODE_ENV !== 'production') { + ReactPropTypeLocationNames = { + prop: 'prop', + context: 'context', + childContext: 'child context' + }; +} + +module.exports = ReactPropTypeLocationNames; \ No newline at end of file diff --git a/node_modules/react/lib/ReactPropTypeLocations.js b/node_modules/react/lib/ReactPropTypeLocations.js new file mode 100644 index 00000000..6d94ca81 --- /dev/null +++ b/node_modules/react/lib/ReactPropTypeLocations.js @@ -0,0 +1,12 @@ +/** + * Copyright 2013-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + * + */ + +'use strict'; \ No newline at end of file diff --git a/node_modules/react/lib/ReactPropTypes.js b/node_modules/react/lib/ReactPropTypes.js new file mode 100644 index 00000000..982bba83 --- /dev/null +++ b/node_modules/react/lib/ReactPropTypes.js @@ -0,0 +1,18 @@ +/** + * Copyright 2013-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + */ + +'use strict'; + +var _require = require('./ReactElement'), + isValidElement = _require.isValidElement; + +var factory = require('prop-types/factory'); + +module.exports = factory(isValidElement); \ No newline at end of file diff --git a/node_modules/react/lib/ReactPropTypesSecret.js b/node_modules/react/lib/ReactPropTypesSecret.js new file mode 100644 index 00000000..33d3fac0 --- /dev/null +++ b/node_modules/react/lib/ReactPropTypesSecret.js @@ -0,0 +1,16 @@ +/** + * Copyright 2013-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + * + */ + +'use strict'; + +var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED'; + +module.exports = ReactPropTypesSecret; \ No newline at end of file diff --git a/node_modules/react/lib/ReactPureComponent.js b/node_modules/react/lib/ReactPureComponent.js new file mode 100644 index 00000000..64aea9ef --- /dev/null +++ b/node_modules/react/lib/ReactPureComponent.js @@ -0,0 +1,41 @@ +/** + * Copyright 2013-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + */ + +'use strict'; + +var _assign = require('object-assign'); + +var ReactComponent = require('./ReactComponent'); +var ReactNoopUpdateQueue = require('./ReactNoopUpdateQueue'); + +var emptyObject = require('fbjs/lib/emptyObject'); + +/** + * Base class helpers for the updating state of a component. + */ +function ReactPureComponent(props, context, updater) { + // Duplicated from ReactComponent. + this.props = props; + this.context = context; + this.refs = emptyObject; + // We initialize the default updater but the real one gets injected by the + // renderer. + this.updater = updater || ReactNoopUpdateQueue; +} + +function ComponentDummy() {} +ComponentDummy.prototype = ReactComponent.prototype; +ReactPureComponent.prototype = new ComponentDummy(); +ReactPureComponent.prototype.constructor = ReactPureComponent; +// Avoid an extra prototype jump for these methods. +_assign(ReactPureComponent.prototype, ReactComponent.prototype); +ReactPureComponent.prototype.isPureReactComponent = true; + +module.exports = ReactPureComponent; \ No newline at end of file diff --git a/node_modules/react/lib/ReactStateSetters.js b/node_modules/react/lib/ReactStateSetters.js new file mode 100644 index 00000000..0a18a918 --- /dev/null +++ b/node_modules/react/lib/ReactStateSetters.js @@ -0,0 +1,103 @@ +/** + * Copyright 2013-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + */ + +'use strict'; + +var ReactStateSetters = { + /** + * Returns a function that calls the provided function, and uses the result + * of that to set the component's state. + * + * @param {ReactCompositeComponent} component + * @param {function} funcReturningState Returned callback uses this to + * determine how to update state. + * @return {function} callback that when invoked uses funcReturningState to + * determined the object literal to setState. + */ + createStateSetter: function (component, funcReturningState) { + return function (a, b, c, d, e, f) { + var partialState = funcReturningState.call(component, a, b, c, d, e, f); + if (partialState) { + component.setState(partialState); + } + }; + }, + + /** + * Returns a single-argument callback that can be used to update a single + * key in the component's state. + * + * Note: this is memoized function, which makes it inexpensive to call. + * + * @param {ReactCompositeComponent} component + * @param {string} key The key in the state that you should update. + * @return {function} callback of 1 argument which calls setState() with + * the provided keyName and callback argument. + */ + createStateKeySetter: function (component, key) { + // Memoize the setters. + var cache = component.__keySetters || (component.__keySetters = {}); + return cache[key] || (cache[key] = createStateKeySetter(component, key)); + } +}; + +function createStateKeySetter(component, key) { + // Partial state is allocated outside of the function closure so it can be + // reused with every call, avoiding memory allocation when this function + // is called. + var partialState = {}; + return function stateKeySetter(value) { + partialState[key] = value; + component.setState(partialState); + }; +} + +ReactStateSetters.Mixin = { + /** + * Returns a function that calls the provided function, and uses the result + * of that to set the component's state. + * + * For example, these statements are equivalent: + * + * this.setState({x: 1}); + * this.createStateSetter(function(xValue) { + * return {x: xValue}; + * })(1); + * + * @param {function} funcReturningState Returned callback uses this to + * determine how to update state. + * @return {function} callback that when invoked uses funcReturningState to + * determined the object literal to setState. + */ + createStateSetter: function (funcReturningState) { + return ReactStateSetters.createStateSetter(this, funcReturningState); + }, + + /** + * Returns a single-argument callback that can be used to update a single + * key in the component's state. + * + * For example, these statements are equivalent: + * + * this.setState({x: 1}); + * this.createStateKeySetter('x')(1); + * + * Note: this is memoized function, which makes it inexpensive to call. + * + * @param {string} key The key in the state that you should update. + * @return {function} callback of 1 argument which calls setState() with + * the provided keyName and callback argument. + */ + createStateKeySetter: function (key) { + return ReactStateSetters.createStateKeySetter(this, key); + } +}; + +module.exports = ReactStateSetters; \ No newline at end of file diff --git a/node_modules/react/lib/ReactTransitionChildMapping.js b/node_modules/react/lib/ReactTransitionChildMapping.js new file mode 100644 index 00000000..ff3d0e62 --- /dev/null +++ b/node_modules/react/lib/ReactTransitionChildMapping.js @@ -0,0 +1,102 @@ +/** + * Copyright 2013-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + */ + +'use strict'; + +var flattenChildren = require('./flattenChildren'); + +var ReactTransitionChildMapping = { + /** + * Given `this.props.children`, return an object mapping key to child. Just + * simple syntactic sugar around flattenChildren(). + * + * @param {*} children `this.props.children` + * @param {number=} selfDebugID Optional debugID of the current internal instance. + * @return {object} Mapping of key to child + */ + getChildMapping: function (children, selfDebugID) { + if (!children) { + return children; + } + + if (process.env.NODE_ENV !== 'production') { + return flattenChildren(children, selfDebugID); + } + + return flattenChildren(children); + }, + + /** + * When you're adding or removing children some may be added or removed in the + * same render pass. We want to show *both* since we want to simultaneously + * animate elements in and out. This function takes a previous set of keys + * and a new set of keys and merges them with its best guess of the correct + * ordering. In the future we may expose some of the utilities in + * ReactMultiChild to make this easy, but for now React itself does not + * directly have this concept of the union of prevChildren and nextChildren + * so we implement it here. + * + * @param {object} prev prev children as returned from + * `ReactTransitionChildMapping.getChildMapping()`. + * @param {object} next next children as returned from + * `ReactTransitionChildMapping.getChildMapping()`. + * @return {object} a key set that contains all keys in `prev` and all keys + * in `next` in a reasonable order. + */ + mergeChildMappings: function (prev, next) { + prev = prev || {}; + next = next || {}; + + function getValueForKey(key) { + if (next.hasOwnProperty(key)) { + return next[key]; + } else { + return prev[key]; + } + } + + // For each key of `next`, the list of keys to insert before that key in + // the combined list + var nextKeysPending = {}; + + var pendingKeys = []; + for (var prevKey in prev) { + if (next.hasOwnProperty(prevKey)) { + if (pendingKeys.length) { + nextKeysPending[prevKey] = pendingKeys; + pendingKeys = []; + } + } else { + pendingKeys.push(prevKey); + } + } + + var i; + var childMapping = {}; + for (var nextKey in next) { + if (nextKeysPending.hasOwnProperty(nextKey)) { + for (i = 0; i < nextKeysPending[nextKey].length; i++) { + var pendingNextKey = nextKeysPending[nextKey][i]; + childMapping[nextKeysPending[nextKey][i]] = getValueForKey(pendingNextKey); + } + } + childMapping[nextKey] = getValueForKey(nextKey); + } + + // Finally, add the keys which didn't appear before any key in `next` + for (i = 0; i < pendingKeys.length; i++) { + childMapping[pendingKeys[i]] = getValueForKey(pendingKeys[i]); + } + + return childMapping; + } +}; + +module.exports = ReactTransitionChildMapping; \ No newline at end of file diff --git a/node_modules/react/lib/ReactTransitionEvents.js b/node_modules/react/lib/ReactTransitionEvents.js new file mode 100644 index 00000000..ca4b7e71 --- /dev/null +++ b/node_modules/react/lib/ReactTransitionEvents.js @@ -0,0 +1,72 @@ +/** + * Copyright 2013-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + */ + +'use strict'; + +var ExecutionEnvironment = require('fbjs/lib/ExecutionEnvironment'); + +var getVendorPrefixedEventName = require('react-dom/lib/getVendorPrefixedEventName'); + +var endEvents = []; + +function detectEvents() { + var animEnd = getVendorPrefixedEventName('animationend'); + var transEnd = getVendorPrefixedEventName('transitionend'); + + if (animEnd) { + endEvents.push(animEnd); + } + + if (transEnd) { + endEvents.push(transEnd); + } +} + +if (ExecutionEnvironment.canUseDOM) { + detectEvents(); +} + +// We use the raw {add|remove}EventListener() call because EventListener +// does not know how to remove event listeners and we really should +// clean up. Also, these events are not triggered in older browsers +// so we should be A-OK here. + +function addEventListener(node, eventName, eventListener) { + node.addEventListener(eventName, eventListener, false); +} + +function removeEventListener(node, eventName, eventListener) { + node.removeEventListener(eventName, eventListener, false); +} + +var ReactTransitionEvents = { + addEndEventListener: function (node, eventListener) { + if (endEvents.length === 0) { + // If CSS transitions are not supported, trigger an "end animation" + // event immediately. + window.setTimeout(eventListener, 0); + return; + } + endEvents.forEach(function (endEvent) { + addEventListener(node, endEvent, eventListener); + }); + }, + + removeEndEventListener: function (node, eventListener) { + if (endEvents.length === 0) { + return; + } + endEvents.forEach(function (endEvent) { + removeEventListener(node, endEvent, eventListener); + }); + } +}; + +module.exports = ReactTransitionEvents; \ No newline at end of file diff --git a/node_modules/react/lib/ReactTransitionGroup.js b/node_modules/react/lib/ReactTransitionGroup.js new file mode 100644 index 00000000..edc0e968 --- /dev/null +++ b/node_modules/react/lib/ReactTransitionGroup.js @@ -0,0 +1,231 @@ +/** + * Copyright 2013-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + */ + +'use strict'; + +var _assign = require('object-assign'); + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + +var React = require('./React'); +var ReactTransitionChildMapping = require('./ReactTransitionChildMapping'); + +var propTypesFactory = require('prop-types/factory'); +var PropTypes = propTypesFactory(React.isValidElement); + +var emptyFunction = require('fbjs/lib/emptyFunction'); + +/** + * A basis for animations. When children are declaratively added or removed, + * special lifecycle hooks are called. + * See https://facebook.github.io/react/docs/animation.html#low-level-api-reacttransitiongroup + */ + +var ReactTransitionGroup = function (_React$Component) { + _inherits(ReactTransitionGroup, _React$Component); + + function ReactTransitionGroup() { + var _temp, _this, _ret; + + _classCallCheck(this, ReactTransitionGroup); + + for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + return _ret = (_temp = (_this = _possibleConstructorReturn(this, _React$Component.call.apply(_React$Component, [this].concat(args))), _this), _this.state = { + // TODO: can we get useful debug information to show at this point? + children: ReactTransitionChildMapping.getChildMapping(_this.props.children) + }, _this.performAppear = function (key) { + _this.currentlyTransitioningKeys[key] = true; + + var component = _this.refs[key]; + + if (component.componentWillAppear) { + component.componentWillAppear(_this._handleDoneAppearing.bind(_this, key)); + } else { + _this._handleDoneAppearing(key); + } + }, _this._handleDoneAppearing = function (key) { + var component = _this.refs[key]; + if (component.componentDidAppear) { + component.componentDidAppear(); + } + + delete _this.currentlyTransitioningKeys[key]; + + var currentChildMapping = ReactTransitionChildMapping.getChildMapping(_this.props.children); + + if (!currentChildMapping || !currentChildMapping.hasOwnProperty(key)) { + // This was removed before it had fully appeared. Remove it. + _this.performLeave(key); + } + }, _this.performEnter = function (key) { + _this.currentlyTransitioningKeys[key] = true; + + var component = _this.refs[key]; + + if (component.componentWillEnter) { + component.componentWillEnter(_this._handleDoneEntering.bind(_this, key)); + } else { + _this._handleDoneEntering(key); + } + }, _this._handleDoneEntering = function (key) { + var component = _this.refs[key]; + if (component.componentDidEnter) { + component.componentDidEnter(); + } + + delete _this.currentlyTransitioningKeys[key]; + + var currentChildMapping = ReactTransitionChildMapping.getChildMapping(_this.props.children); + + if (!currentChildMapping || !currentChildMapping.hasOwnProperty(key)) { + // This was removed before it had fully entered. Remove it. + _this.performLeave(key); + } + }, _this.performLeave = function (key) { + _this.currentlyTransitioningKeys[key] = true; + + var component = _this.refs[key]; + if (component.componentWillLeave) { + component.componentWillLeave(_this._handleDoneLeaving.bind(_this, key)); + } else { + // Note that this is somewhat dangerous b/c it calls setState() + // again, effectively mutating the component before all the work + // is done. + _this._handleDoneLeaving(key); + } + }, _this._handleDoneLeaving = function (key) { + var component = _this.refs[key]; + + if (component.componentDidLeave) { + component.componentDidLeave(); + } + + delete _this.currentlyTransitioningKeys[key]; + + var currentChildMapping = ReactTransitionChildMapping.getChildMapping(_this.props.children); + + if (currentChildMapping && currentChildMapping.hasOwnProperty(key)) { + // This entered again before it fully left. Add it again. + _this.performEnter(key); + } else { + _this.setState(function (state) { + var newChildren = _assign({}, state.children); + delete newChildren[key]; + return { children: newChildren }; + }); + } + }, _temp), _possibleConstructorReturn(_this, _ret); + } + + ReactTransitionGroup.prototype.componentWillMount = function componentWillMount() { + this.currentlyTransitioningKeys = {}; + this.keysToEnter = []; + this.keysToLeave = []; + }; + + ReactTransitionGroup.prototype.componentDidMount = function componentDidMount() { + var initialChildMapping = this.state.children; + for (var key in initialChildMapping) { + if (initialChildMapping[key]) { + this.performAppear(key); + } + } + }; + + ReactTransitionGroup.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) { + var nextChildMapping = ReactTransitionChildMapping.getChildMapping(nextProps.children); + var prevChildMapping = this.state.children; + + this.setState({ + children: ReactTransitionChildMapping.mergeChildMappings(prevChildMapping, nextChildMapping) + }); + + var key; + + for (key in nextChildMapping) { + var hasPrev = prevChildMapping && prevChildMapping.hasOwnProperty(key); + if (nextChildMapping[key] && !hasPrev && !this.currentlyTransitioningKeys[key]) { + this.keysToEnter.push(key); + } + } + + for (key in prevChildMapping) { + var hasNext = nextChildMapping && nextChildMapping.hasOwnProperty(key); + if (prevChildMapping[key] && !hasNext && !this.currentlyTransitioningKeys[key]) { + this.keysToLeave.push(key); + } + } + + // If we want to someday check for reordering, we could do it here. + }; + + ReactTransitionGroup.prototype.componentDidUpdate = function componentDidUpdate() { + var keysToEnter = this.keysToEnter; + this.keysToEnter = []; + keysToEnter.forEach(this.performEnter); + + var keysToLeave = this.keysToLeave; + this.keysToLeave = []; + keysToLeave.forEach(this.performLeave); + }; + + ReactTransitionGroup.prototype.render = function render() { + // TODO: we could get rid of the need for the wrapper node + // by cloning a single child + var childrenToRender = []; + for (var key in this.state.children) { + var child = this.state.children[key]; + if (child) { + // You may need to apply reactive updates to a child as it is leaving. + // The normal React way to do it won't work since the child will have + // already been removed. In case you need this behavior you can provide + // a childFactory function to wrap every child, even the ones that are + // leaving. + childrenToRender.push(React.cloneElement(this.props.childFactory(child), { ref: key, key: key })); + } + } + + // Do not forward ReactTransitionGroup props to primitive DOM nodes + var props = _assign({}, this.props); + delete props.transitionLeave; + delete props.transitionName; + delete props.transitionAppear; + delete props.transitionEnter; + delete props.childFactory; + delete props.transitionLeaveTimeout; + delete props.transitionEnterTimeout; + delete props.transitionAppearTimeout; + delete props.component; + + return React.createElement(this.props.component, props, childrenToRender); + }; + + return ReactTransitionGroup; +}(React.Component); + +ReactTransitionGroup.displayName = 'ReactTransitionGroup'; +ReactTransitionGroup.propTypes = { + component: PropTypes.any, + childFactory: PropTypes.func +}; +ReactTransitionGroup.defaultProps = { + component: 'span', + childFactory: emptyFunction.thatReturnsArgument +}; + + +module.exports = ReactTransitionGroup; \ No newline at end of file diff --git a/node_modules/react/lib/ReactUMDEntry.js b/node_modules/react/lib/ReactUMDEntry.js new file mode 100644 index 00000000..b7e2e392 --- /dev/null +++ b/node_modules/react/lib/ReactUMDEntry.js @@ -0,0 +1,32 @@ +/** + * Copyright 2013-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + */ + +'use strict'; + +var _assign = require('object-assign'); + +var React = require('./React'); + +// `version` will be added here by the React module. +var ReactUMDEntry = _assign(React, { + __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: { + ReactCurrentOwner: require('./ReactCurrentOwner') + } +}); + +if (process.env.NODE_ENV !== 'production') { + _assign(ReactUMDEntry.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED, { + // ReactComponentTreeHook should not be included in production. + ReactComponentTreeHook: require('./ReactComponentTreeHook'), + getNextDebugID: require('./getNextDebugID') + }); +} + +module.exports = ReactUMDEntry; \ No newline at end of file diff --git a/node_modules/react/lib/ReactUMDShim.js b/node_modules/react/lib/ReactUMDShim.js new file mode 100644 index 00000000..51f60b20 --- /dev/null +++ b/node_modules/react/lib/ReactUMDShim.js @@ -0,0 +1,15 @@ +/** + * Copyright 2013-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + */ + +/* globals React */ + +'use strict'; + +module.exports = React; \ No newline at end of file diff --git a/node_modules/react/lib/ReactVersion.js b/node_modules/react/lib/ReactVersion.js new file mode 100644 index 00000000..07780696 --- /dev/null +++ b/node_modules/react/lib/ReactVersion.js @@ -0,0 +1,13 @@ +/** + * Copyright 2013-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + */ + +'use strict'; + +module.exports = '15.5.4'; \ No newline at end of file diff --git a/node_modules/react/lib/ReactWithAddons.js b/node_modules/react/lib/ReactWithAddons.js new file mode 100644 index 00000000..3263fad2 --- /dev/null +++ b/node_modules/react/lib/ReactWithAddons.js @@ -0,0 +1,52 @@ +/** + * Copyright 2013-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + */ + +'use strict'; + +var LinkedStateMixin = require('./LinkedStateMixin'); +var React = require('./React'); +var ReactAddonsDOMDependencies = require('./ReactAddonsDOMDependencies'); +var ReactComponentWithPureRenderMixin = require('./ReactComponentWithPureRenderMixin'); +var ReactCSSTransitionGroup = require('./ReactCSSTransitionGroup'); +var ReactFragment = require('./ReactFragment'); +var ReactTransitionGroup = require('./ReactTransitionGroup'); + +var shallowCompare = require('./shallowCompare'); +var update = require('./update'); + +React.addons = { + CSSTransitionGroup: ReactCSSTransitionGroup, + LinkedStateMixin: LinkedStateMixin, + PureRenderMixin: ReactComponentWithPureRenderMixin, + TransitionGroup: ReactTransitionGroup, + + createFragment: ReactFragment.create, + shallowCompare: shallowCompare, + update: update +}; + +if (process.env.NODE_ENV !== 'production') { + // For the UMD build we get these lazily from the global since they're tied + // to the DOM renderer and it hasn't loaded yet. + Object.defineProperty(React.addons, 'Perf', { + enumerable: true, + get: function () { + return ReactAddonsDOMDependencies.getReactPerf(); + } + }); + Object.defineProperty(React.addons, 'TestUtils', { + enumerable: true, + get: function () { + return ReactAddonsDOMDependencies.getReactTestUtils(); + } + }); +} + +module.exports = React; \ No newline at end of file diff --git a/node_modules/react/lib/ReactWithAddonsUMDEntry.js b/node_modules/react/lib/ReactWithAddonsUMDEntry.js new file mode 100644 index 00000000..6638f180 --- /dev/null +++ b/node_modules/react/lib/ReactWithAddonsUMDEntry.js @@ -0,0 +1,33 @@ +/** + * Copyright 2013-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + */ + +'use strict'; + +var _assign = require('object-assign'); + +var ReactWithAddons = require('./ReactWithAddons'); + +// `version` will be added here by the React module. +var ReactWithAddonsUMDEntry = _assign(ReactWithAddons, { + __SECRET_INJECTED_REACT_DOM_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: null, // Will be injected by ReactDOM UMD build. + __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: { + ReactCurrentOwner: require('./ReactCurrentOwner') + } +}); + +if (process.env.NODE_ENV !== 'production') { + _assign(ReactWithAddonsUMDEntry.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED, { + // ReactComponentTreeHook should not be included in production. + ReactComponentTreeHook: require('./ReactComponentTreeHook'), + getNextDebugID: require('./getNextDebugID') + }); +} + +module.exports = ReactWithAddonsUMDEntry; \ No newline at end of file diff --git a/node_modules/react/lib/canDefineProperty.js b/node_modules/react/lib/canDefineProperty.js new file mode 100644 index 00000000..cde9f5c5 --- /dev/null +++ b/node_modules/react/lib/canDefineProperty.js @@ -0,0 +1,25 @@ +/** + * Copyright 2013-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + * + */ + +'use strict'; + +var canDefineProperty = false; +if (process.env.NODE_ENV !== 'production') { + try { + // $FlowFixMe https://github.com/facebook/flow/issues/285 + Object.defineProperty({}, 'x', { get: function () {} }); + canDefineProperty = true; + } catch (x) { + // IE will fail on defineProperty + } +} + +module.exports = canDefineProperty; \ No newline at end of file diff --git a/node_modules/react/lib/checkReactTypeSpec.js b/node_modules/react/lib/checkReactTypeSpec.js new file mode 100644 index 00000000..9684d034 --- /dev/null +++ b/node_modules/react/lib/checkReactTypeSpec.js @@ -0,0 +1,86 @@ +/** + * Copyright 2013-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + */ + +'use strict'; + +var _prodInvariant = require('./reactProdInvariant'); + +var ReactPropTypeLocationNames = require('./ReactPropTypeLocationNames'); +var ReactPropTypesSecret = require('./ReactPropTypesSecret'); + +var invariant = require('fbjs/lib/invariant'); +var warning = require('fbjs/lib/warning'); + +var ReactComponentTreeHook; + +if (typeof process !== 'undefined' && process.env && process.env.NODE_ENV === 'test') { + // Temporary hack. + // Inline requires don't work well with Jest: + // https://github.com/facebook/react/issues/7240 + // Remove the inline requires when we don't need them anymore: + // https://github.com/facebook/react/pull/7178 + ReactComponentTreeHook = require('./ReactComponentTreeHook'); +} + +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 {?object} element The React element that is being type-checked + * @param {?number} debugID The React component instance that is being type-checked + * @private + */ +function checkReactTypeSpec(typeSpecs, values, location, componentName, element, debugID) { + 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. + !(typeof typeSpecs[typeSpecName] === 'function') ? process.env.NODE_ENV !== 'production' ? invariant(false, '%s: %s type `%s` is invalid; it must be a function, usually from React.PropTypes.', componentName || 'React class', ReactPropTypeLocationNames[location], typeSpecName) : _prodInvariant('84', componentName || 'React class', ReactPropTypeLocationNames[location], typeSpecName) : void 0; + error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret); + } catch (ex) { + error = ex; + } + process.env.NODE_ENV !== 'production' ? 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', ReactPropTypeLocationNames[location], typeSpecName, typeof error) : void 0; + 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 componentStackInfo = ''; + + if (process.env.NODE_ENV !== 'production') { + if (!ReactComponentTreeHook) { + ReactComponentTreeHook = require('./ReactComponentTreeHook'); + } + if (debugID !== null) { + componentStackInfo = ReactComponentTreeHook.getStackAddendumByID(debugID); + } else if (element !== null) { + componentStackInfo = ReactComponentTreeHook.getCurrentStackAddendum(element); + } + } + + process.env.NODE_ENV !== 'production' ? warning(false, 'Failed %s type: %s%s', location, error.message, componentStackInfo) : void 0; + } + } + } +} + +module.exports = checkReactTypeSpec; \ No newline at end of file diff --git a/node_modules/react/lib/deprecated.js b/node_modules/react/lib/deprecated.js new file mode 100644 index 00000000..aa0b49fc --- /dev/null +++ b/node_modules/react/lib/deprecated.js @@ -0,0 +1,56 @@ +/** + * Copyright 2013-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + * + */ + +'use strict'; + +var _assign = require('object-assign'); + +var warning = require('fbjs/lib/warning'); + +/** + * This will log a single deprecation notice per function and forward the call + * on to the new API. + * + * @param {string} fnName The name of the function + * @param {string} newModule The module that fn will exist in + * @param {string} newPackage The module that fn will exist in + * @param {*} ctx The context this forwarded call should run in + * @param {function} fn The function to forward on to + * @return {function} The function that will warn once and then call fn + */ +function deprecated(fnName, newModule, newPackage, ctx, fn) { + var warned = false; + if (process.env.NODE_ENV !== 'production') { + var newFn = function () { + process.env.NODE_ENV !== 'production' ? warning(warned, + /* eslint-disable no-useless-concat */ + // Require examples in this string must be split to prevent React's + // build tools from mistaking them for real requires. + // Otherwise the build tools will attempt to build a '%s' module. + 'React.%s is deprecated. Please use %s.%s from require' + '(\'%s\') ' + 'instead.', fnName, newModule, fnName, newPackage) : void 0; + /* eslint-enable no-useless-concat */ + warned = true; + return fn.apply(ctx, arguments); + }; + // We need to make sure all properties of the original fn are copied over. + // In particular, this is needed to support PropTypes + _assign(newFn, fn); + + // Flow is not smart enough to figure out that newFn is of the same type as + // fn. Since we don't want to lose out the type of the function, casting + // to any and force flow to use T. + return newFn; + } + + return fn; +} + +module.exports = deprecated; \ No newline at end of file diff --git a/node_modules/react/lib/flattenChildren.js b/node_modules/react/lib/flattenChildren.js new file mode 100644 index 00000000..005259a1 --- /dev/null +++ b/node_modules/react/lib/flattenChildren.js @@ -0,0 +1,75 @@ +/** + * Copyright 2013-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + * + */ + +'use strict'; + +var KeyEscapeUtils = require('./KeyEscapeUtils'); +var traverseAllChildren = require('./traverseAllChildren'); +var warning = require('fbjs/lib/warning'); + +var ReactComponentTreeHook; + +if (typeof process !== 'undefined' && process.env && process.env.NODE_ENV === 'test') { + // Temporary hack. + // Inline requires don't work well with Jest: + // https://github.com/facebook/react/issues/7240 + // Remove the inline requires when we don't need them anymore: + // https://github.com/facebook/react/pull/7178 + ReactComponentTreeHook = require('./ReactComponentTreeHook'); +} + +/** + * @param {function} traverseContext Context passed through traversal. + * @param {?ReactComponent} child React child component. + * @param {!string} name String name of key path to child. + * @param {number=} selfDebugID Optional debugID of the current internal instance. + */ +function flattenSingleChildIntoContext(traverseContext, child, name, selfDebugID) { + // We found a component instance. + if (traverseContext && typeof traverseContext === 'object') { + var result = traverseContext; + var keyUnique = result[name] === undefined; + if (process.env.NODE_ENV !== 'production') { + if (!ReactComponentTreeHook) { + ReactComponentTreeHook = require('./ReactComponentTreeHook'); + } + if (!keyUnique) { + process.env.NODE_ENV !== 'production' ? warning(false, 'flattenChildren(...): Encountered two children with the same key, ' + '`%s`. Child keys must be unique; when two children share a key, only ' + 'the first child will be used.%s', KeyEscapeUtils.unescape(name), ReactComponentTreeHook.getStackAddendumByID(selfDebugID)) : void 0; + } + } + if (keyUnique && child != null) { + result[name] = child; + } + } +} + +/** + * Flattens children that are typically specified as `props.children`. Any null + * children will not be included in the resulting object. + * @return {!object} flattened children keyed by name. + */ +function flattenChildren(children, selfDebugID) { + if (children == null) { + return children; + } + var result = {}; + + if (process.env.NODE_ENV !== 'production') { + traverseAllChildren(children, function (traverseContext, child, name) { + return flattenSingleChildIntoContext(traverseContext, child, name, selfDebugID); + }, result); + } else { + traverseAllChildren(children, flattenSingleChildIntoContext, result); + } + return result; +} + +module.exports = flattenChildren; \ No newline at end of file diff --git a/node_modules/react/lib/getIteratorFn.js b/node_modules/react/lib/getIteratorFn.js new file mode 100644 index 00000000..95eed422 --- /dev/null +++ b/node_modules/react/lib/getIteratorFn.js @@ -0,0 +1,40 @@ +/** + * Copyright 2013-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + * + */ + +'use strict'; + +/* 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; + } +} + +module.exports = getIteratorFn; \ No newline at end of file diff --git a/node_modules/react/lib/getNextDebugID.js b/node_modules/react/lib/getNextDebugID.js new file mode 100644 index 00000000..28cd78a7 --- /dev/null +++ b/node_modules/react/lib/getNextDebugID.js @@ -0,0 +1,20 @@ +/** + * Copyright 2013-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + * + */ + +'use strict'; + +var nextDebugID = 1; + +function getNextDebugID() { + return nextDebugID++; +} + +module.exports = getNextDebugID; \ No newline at end of file diff --git a/node_modules/react/lib/getNextDebugIDUMDShim.js b/node_modules/react/lib/getNextDebugIDUMDShim.js new file mode 100644 index 00000000..954f85cc --- /dev/null +++ b/node_modules/react/lib/getNextDebugIDUMDShim.js @@ -0,0 +1,17 @@ +/** + * Copyright 2013-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + */ + +/* globals React */ + +'use strict'; + +var ReactInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; + +module.exports = ReactInternals.getNextDebugID; \ No newline at end of file diff --git a/node_modules/react/lib/onlyChild.js b/node_modules/react/lib/onlyChild.js new file mode 100644 index 00000000..527d6e64 --- /dev/null +++ b/node_modules/react/lib/onlyChild.js @@ -0,0 +1,37 @@ +/** + * Copyright 2013-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + */ +'use strict'; + +var _prodInvariant = require('./reactProdInvariant'); + +var ReactElement = require('./ReactElement'); + +var invariant = require('fbjs/lib/invariant'); + +/** + * Returns the first child in a collection of children and verifies that there + * is only one child in the collection. + * + * See https://facebook.github.io/react/docs/top-level-api.html#react.children.only + * + * The current implementation of this function assumes that a single child gets + * passed without a wrapper, but the purpose of this helper function is to + * abstract away the particular structure of children. + * + * @param {?object} children Child collection structure. + * @return {ReactElement} The first and only `ReactElement` contained in the + * structure. + */ +function onlyChild(children) { + !ReactElement.isValidElement(children) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'React.Children.only expected to receive a single React element child.') : _prodInvariant('143') : void 0; + return children; +} + +module.exports = onlyChild; \ No newline at end of file diff --git a/node_modules/react/lib/reactProdInvariant.js b/node_modules/react/lib/reactProdInvariant.js new file mode 100644 index 00000000..b90f9eb0 --- /dev/null +++ b/node_modules/react/lib/reactProdInvariant.js @@ -0,0 +1,38 @@ +/** + * Copyright (c) 2013-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + * + */ +'use strict'; + +/** + * WARNING: DO NOT manually require this module. + * This is a replacement for `invariant(...)` used by the error code system + * and will _only_ be required by the corresponding babel pass. + * It always throws. + */ + +function reactProdInvariant(code) { + var argCount = arguments.length - 1; + + var message = 'Minified React error #' + code + '; visit ' + 'http://facebook.github.io/react/docs/error-decoder.html?invariant=' + code; + + for (var argIdx = 0; argIdx < argCount; argIdx++) { + message += '&args[]=' + encodeURIComponent(arguments[argIdx + 1]); + } + + message += ' for the full message or use the non-minified dev environment' + ' for full errors and additional helpful warnings.'; + + var error = new Error(message); + error.name = 'Invariant Violation'; + error.framesToPop = 1; // we don't care about reactProdInvariant's own frame + + throw error; +} + +module.exports = reactProdInvariant; \ No newline at end of file diff --git a/node_modules/react/lib/shallowCompare.js b/node_modules/react/lib/shallowCompare.js new file mode 100644 index 00000000..42f74ce0 --- /dev/null +++ b/node_modules/react/lib/shallowCompare.js @@ -0,0 +1,24 @@ +/** + * Copyright 2013-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + */ + +'use strict'; + +var shallowEqual = require('fbjs/lib/shallowEqual'); + +/** + * Does a shallow comparison for props and state. + * See ReactComponentWithPureRenderMixin + * See also https://facebook.github.io/react/docs/shallow-compare.html + */ +function shallowCompare(instance, nextProps, nextState) { + return !shallowEqual(instance.props, nextProps) || !shallowEqual(instance.state, nextState); +} + +module.exports = shallowCompare; \ No newline at end of file diff --git a/node_modules/react/lib/sliceChildren.js b/node_modules/react/lib/sliceChildren.js new file mode 100644 index 00000000..dc551188 --- /dev/null +++ b/node_modules/react/lib/sliceChildren.js @@ -0,0 +1,33 @@ +/** + * Copyright 2013-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + */ + +'use strict'; + +var ReactChildren = require('./ReactChildren'); + +/** + * Slice children that are typically specified as `props.children`. This version + * of slice children ignores empty child components. + * + * @param {*} children The children set to filter. + * @param {number} start The first zero-based index to include in the subset. + * @param {?number} end The non-inclusive last index of the subset. + * @return {object} mirrored array with mapped children + */ +function sliceChildren(children, start, end) { + if (children == null) { + return children; + } + + var array = ReactChildren.toArray(children); + return array.slice(start, end); +} + +module.exports = sliceChildren; \ No newline at end of file diff --git a/node_modules/react/lib/traverseAllChildren.js b/node_modules/react/lib/traverseAllChildren.js new file mode 100644 index 00000000..7c59e4a0 --- /dev/null +++ b/node_modules/react/lib/traverseAllChildren.js @@ -0,0 +1,175 @@ +/** + * Copyright 2013-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + */ + +'use strict'; + +var _prodInvariant = require('./reactProdInvariant'); + +var ReactCurrentOwner = require('./ReactCurrentOwner'); +var REACT_ELEMENT_TYPE = require('./ReactElementSymbol'); + +var getIteratorFn = require('./getIteratorFn'); +var invariant = require('fbjs/lib/invariant'); +var KeyEscapeUtils = require('./KeyEscapeUtils'); +var warning = require('fbjs/lib/warning'); + +var SEPARATOR = '.'; +var SUBSEPARATOR = ':'; + +/** + * This is inlined from ReactElement since this file is shared between + * isomorphic and renderers. We could extract this to a + * + */ + +/** + * TODO: Test that a single child and an array with one item have the same key + * pattern. + */ + +var didWarnAboutMaps = false; + +/** + * Generate a key string that identifies a component within a set. + * + * @param {*} component A component that could contain a manual key. + * @param {number} index Index that is used if a manual key is not provided. + * @return {string} + */ +function getComponentKey(component, index) { + // Do some typechecking here since we call this blindly. We want to ensure + // that we don't block potential future ES APIs. + if (component && typeof component === 'object' && component.key != null) { + // Explicit key + return KeyEscapeUtils.escape(component.key); + } + // Implicit key determined by the index in the set + return index.toString(36); +} + +/** + * @param {?*} children Children tree container. + * @param {!string} nameSoFar Name of the key path so far. + * @param {!function} callback Callback to invoke with each child found. + * @param {?*} traverseContext Used to pass information throughout the traversal + * process. + * @return {!number} The number of children in this subtree. + */ +function traverseAllChildrenImpl(children, nameSoFar, callback, traverseContext) { + var type = typeof children; + + if (type === 'undefined' || type === 'boolean') { + // All of the above are perceived as null. + children = null; + } + + if (children === null || type === 'string' || type === 'number' || + // The following is inlined from ReactElement. This means we can optimize + // some checks. React Fiber also inlines this logic for similar purposes. + type === 'object' && children.$$typeof === REACT_ELEMENT_TYPE) { + callback(traverseContext, children, + // If it's the only child, treat the name as if it was wrapped in an array + // so that it's consistent if the number of children grows. + nameSoFar === '' ? SEPARATOR + getComponentKey(children, 0) : nameSoFar); + return 1; + } + + var child; + var nextName; + var subtreeCount = 0; // Count of children found in the current subtree. + var nextNamePrefix = nameSoFar === '' ? SEPARATOR : nameSoFar + SUBSEPARATOR; + + if (Array.isArray(children)) { + for (var i = 0; i < children.length; i++) { + child = children[i]; + nextName = nextNamePrefix + getComponentKey(child, i); + subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext); + } + } else { + var iteratorFn = getIteratorFn(children); + if (iteratorFn) { + var iterator = iteratorFn.call(children); + var step; + if (iteratorFn !== children.entries) { + var ii = 0; + while (!(step = iterator.next()).done) { + child = step.value; + nextName = nextNamePrefix + getComponentKey(child, ii++); + subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext); + } + } else { + if (process.env.NODE_ENV !== 'production') { + var mapsAsChildrenAddendum = ''; + if (ReactCurrentOwner.current) { + var mapsAsChildrenOwnerName = ReactCurrentOwner.current.getName(); + if (mapsAsChildrenOwnerName) { + mapsAsChildrenAddendum = ' Check the render method of `' + mapsAsChildrenOwnerName + '`.'; + } + } + process.env.NODE_ENV !== 'production' ? warning(didWarnAboutMaps, 'Using Maps as children is not yet fully supported. It is an ' + 'experimental feature that might be removed. Convert it to a ' + 'sequence / iterable of keyed ReactElements instead.%s', mapsAsChildrenAddendum) : void 0; + didWarnAboutMaps = true; + } + // Iterator will provide entry [k,v] tuples rather than values. + while (!(step = iterator.next()).done) { + var entry = step.value; + if (entry) { + child = entry[1]; + nextName = nextNamePrefix + KeyEscapeUtils.escape(entry[0]) + SUBSEPARATOR + getComponentKey(child, 0); + subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext); + } + } + } + } else if (type === 'object') { + var addendum = ''; + if (process.env.NODE_ENV !== 'production') { + addendum = ' If you meant to render a collection of children, use an array ' + 'instead or wrap the object using createFragment(object) from the ' + 'React add-ons.'; + if (children._isReactElement) { + addendum = ' It looks like you\'re using an element created by a different ' + 'version of React. Make sure to use only one copy of React.'; + } + if (ReactCurrentOwner.current) { + var name = ReactCurrentOwner.current.getName(); + if (name) { + addendum += ' Check the render method of `' + name + '`.'; + } + } + } + var childrenString = String(children); + !false ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Objects are not valid as a React child (found: %s).%s', childrenString === '[object Object]' ? 'object with keys {' + Object.keys(children).join(', ') + '}' : childrenString, addendum) : _prodInvariant('31', childrenString === '[object Object]' ? 'object with keys {' + Object.keys(children).join(', ') + '}' : childrenString, addendum) : void 0; + } + } + + return subtreeCount; +} + +/** + * Traverses children that are typically specified as `props.children`, but + * might also be specified through attributes: + * + * - `traverseAllChildren(this.props.children, ...)` + * - `traverseAllChildren(this.props.leftPanelChildren, ...)` + * + * The `traverseContext` is an optional argument that is passed through the + * entire traversal. It can be used to store accumulations or anything else that + * the callback might find relevant. + * + * @param {?*} children Children tree object. + * @param {!function} callback To invoke upon traversing each child. + * @param {?*} traverseContext Context for traversal. + * @return {!number} The number of children in this subtree. + */ +function traverseAllChildren(children, callback, traverseContext) { + if (children == null) { + return 0; + } + + return traverseAllChildrenImpl(children, '', callback, traverseContext); +} + +module.exports = traverseAllChildren; \ No newline at end of file diff --git a/node_modules/react/lib/update.js b/node_modules/react/lib/update.js new file mode 100644 index 00000000..13a549f3 --- /dev/null +++ b/node_modules/react/lib/update.js @@ -0,0 +1,111 @@ +/** + * Copyright 2013-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + */ + +/* global hasOwnProperty:true */ + +'use strict'; + +var _prodInvariant = require('./reactProdInvariant'), + _assign = require('object-assign'); + +var invariant = require('fbjs/lib/invariant'); +var hasOwnProperty = {}.hasOwnProperty; + +function shallowCopy(x) { + if (Array.isArray(x)) { + return x.concat(); + } else if (x && typeof x === 'object') { + return _assign(new x.constructor(), x); + } else { + return x; + } +} + +var COMMAND_PUSH = '$push'; +var COMMAND_UNSHIFT = '$unshift'; +var COMMAND_SPLICE = '$splice'; +var COMMAND_SET = '$set'; +var COMMAND_MERGE = '$merge'; +var COMMAND_APPLY = '$apply'; + +var ALL_COMMANDS_LIST = [COMMAND_PUSH, COMMAND_UNSHIFT, COMMAND_SPLICE, COMMAND_SET, COMMAND_MERGE, COMMAND_APPLY]; + +var ALL_COMMANDS_SET = {}; + +ALL_COMMANDS_LIST.forEach(function (command) { + ALL_COMMANDS_SET[command] = true; +}); + +function invariantArrayCase(value, spec, command) { + !Array.isArray(value) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'update(): expected target of %s to be an array; got %s.', command, value) : _prodInvariant('1', command, value) : void 0; + var specValue = spec[command]; + !Array.isArray(specValue) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'update(): expected spec of %s to be an array; got %s. Did you forget to wrap your parameter in an array?', command, specValue) : _prodInvariant('2', command, specValue) : void 0; +} + +/** + * Returns a updated shallow copy of an object without mutating the original. + * See https://facebook.github.io/react/docs/update.html for details. + */ +function update(value, spec) { + !(typeof spec === 'object') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'update(): You provided a key path to update() that did not contain one of %s. Did you forget to include {%s: ...}?', ALL_COMMANDS_LIST.join(', '), COMMAND_SET) : _prodInvariant('3', ALL_COMMANDS_LIST.join(', '), COMMAND_SET) : void 0; + + if (hasOwnProperty.call(spec, COMMAND_SET)) { + !(Object.keys(spec).length === 1) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Cannot have more than one key in an object with %s', COMMAND_SET) : _prodInvariant('4', COMMAND_SET) : void 0; + + return spec[COMMAND_SET]; + } + + var nextValue = shallowCopy(value); + + if (hasOwnProperty.call(spec, COMMAND_MERGE)) { + var mergeObj = spec[COMMAND_MERGE]; + !(mergeObj && typeof mergeObj === 'object') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'update(): %s expects a spec of type \'object\'; got %s', COMMAND_MERGE, mergeObj) : _prodInvariant('5', COMMAND_MERGE, mergeObj) : void 0; + !(nextValue && typeof nextValue === 'object') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'update(): %s expects a target of type \'object\'; got %s', COMMAND_MERGE, nextValue) : _prodInvariant('6', COMMAND_MERGE, nextValue) : void 0; + _assign(nextValue, spec[COMMAND_MERGE]); + } + + if (hasOwnProperty.call(spec, COMMAND_PUSH)) { + invariantArrayCase(value, spec, COMMAND_PUSH); + spec[COMMAND_PUSH].forEach(function (item) { + nextValue.push(item); + }); + } + + if (hasOwnProperty.call(spec, COMMAND_UNSHIFT)) { + invariantArrayCase(value, spec, COMMAND_UNSHIFT); + spec[COMMAND_UNSHIFT].forEach(function (item) { + nextValue.unshift(item); + }); + } + + if (hasOwnProperty.call(spec, COMMAND_SPLICE)) { + !Array.isArray(value) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Expected %s target to be an array; got %s', COMMAND_SPLICE, value) : _prodInvariant('7', COMMAND_SPLICE, value) : void 0; + !Array.isArray(spec[COMMAND_SPLICE]) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'update(): expected spec of %s to be an array of arrays; got %s. Did you forget to wrap your parameters in an array?', COMMAND_SPLICE, spec[COMMAND_SPLICE]) : _prodInvariant('8', COMMAND_SPLICE, spec[COMMAND_SPLICE]) : void 0; + spec[COMMAND_SPLICE].forEach(function (args) { + !Array.isArray(args) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'update(): expected spec of %s to be an array of arrays; got %s. Did you forget to wrap your parameters in an array?', COMMAND_SPLICE, spec[COMMAND_SPLICE]) : _prodInvariant('8', COMMAND_SPLICE, spec[COMMAND_SPLICE]) : void 0; + nextValue.splice.apply(nextValue, args); + }); + } + + if (hasOwnProperty.call(spec, COMMAND_APPLY)) { + !(typeof spec[COMMAND_APPLY] === 'function') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'update(): expected spec of %s to be a function; got %s.', COMMAND_APPLY, spec[COMMAND_APPLY]) : _prodInvariant('9', COMMAND_APPLY, spec[COMMAND_APPLY]) : void 0; + nextValue = spec[COMMAND_APPLY](nextValue); + } + + for (var k in spec) { + if (!(ALL_COMMANDS_SET.hasOwnProperty(k) && ALL_COMMANDS_SET[k])) { + nextValue[k] = update(value[k], spec[k]); + } + } + + return nextValue; +} + +module.exports = update; \ No newline at end of file diff --git a/node_modules/react/node_modules/.bin/loose-envify b/node_modules/react/node_modules/.bin/loose-envify new file mode 100644 index 00000000..51ac9840 --- /dev/null +++ b/node_modules/react/node_modules/.bin/loose-envify @@ -0,0 +1,15 @@ +#!/bin/sh +basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") + +case `uname` in + *CYGWIN*) basedir=`cygpath -w "$basedir"`;; +esac + +if [ -x "$basedir/node" ]; then + "$basedir/node" "$basedir/../../../../../../loose-envify/cli.js" "$@" + ret=$? +else + node "$basedir/../../../../../../loose-envify/cli.js" "$@" + ret=$? +fi +exit $ret diff --git a/node_modules/react/node_modules/.bin/loose-envify.cmd b/node_modules/react/node_modules/.bin/loose-envify.cmd new file mode 100644 index 00000000..0154ca12 --- /dev/null +++ b/node_modules/react/node_modules/.bin/loose-envify.cmd @@ -0,0 +1,7 @@ +@IF EXIST "%~dp0\node.exe" ( + "%~dp0\node.exe" "%~dp0\..\..\..\..\..\..\loose-envify\cli.js" %* +) ELSE ( + @SETLOCAL + @SET PATHEXT=%PATHEXT:;.JS;=;% + node "%~dp0\..\..\..\..\..\..\loose-envify\cli.js" %* +) \ No newline at end of file diff --git a/node_modules/react/package.json b/node_modules/react/package.json new file mode 100644 index 00000000..e4d134f2 --- /dev/null +++ b/node_modules/react/package.json @@ -0,0 +1,36 @@ +{ + "name": "react", + "description": "React is a JavaScript library for building user interfaces.", + "version": "15.5.4", + "keywords": [ + "react" + ], + "homepage": "https://facebook.github.io/react/", + "bugs": "https://github.com/facebook/react/issues", + "license": "BSD-3-Clause", + "files": [ + "LICENSE", + "PATENTS", + "addons.js", + "react.js", + "addons/", + "dist/", + "lib/" + ], + "main": "react.js", + "repository": "facebook/react", + "engines": { + "node": ">=0.10.0" + }, + "dependencies": { + "fbjs": "^0.8.9", + "loose-envify": "^1.1.0", + "object-assign": "^4.1.0", + "prop-types": "^15.5.7" + }, + "browserify": { + "transform": [ + "loose-envify" + ] + } +} \ No newline at end of file diff --git a/node_modules/react/react.js b/node_modules/react/react.js new file mode 100644 index 00000000..53abd6f0 --- /dev/null +++ b/node_modules/react/react.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = require('./lib/React'); diff --git a/package.json b/package.json index 3896c382..6877f771 100644 --- a/package.json +++ b/package.json @@ -1,13 +1,15 @@ { - "name": "czi-prosemirror", - "version": "0.0.1", - "subversion": "1", + "name": "@mpes/react-prosemirror", + "version": "1.7.3", + "subversion": "2", "description": "rich text editor built with React and ProseMirror", "main": "dist/index.js", + "private": false, + "license": "MIT", "scripts": { "build:clean": "rm -rf dist/", - "build:css": "cp src/ui/*.css dist/ui && cp src/ui/mathquill-editor/*.css dist/ui/mathquill-editor", - "build:babel": "babel src --out-dir dist", + "build:css": "cp src/ui/*.css dist/ui", + "build:babel": "babel src --out-dir dist --copy-files", "build:flow": "flow-copy-source -v -i '**/__tests__/**' src dist", "build:dist": "npm run build:clean && npm run build:babel && npm run build:flow && npm run build:css", "build:demo": "node scripts/build_bin.js", @@ -17,6 +19,7 @@ "start": "node scripts/webserver.js" }, "devDependencies": { + "ajv": "^6.9.1", "async-await": "0.1.40", "babel-cli": "6.26.0", "babel-core": "6.26.3", @@ -49,7 +52,7 @@ "eslint-loader": "2.1.1", "eslint-plugin-babel": "5.3.0", "eslint-plugin-flowtype": "3.2.0", - "eslint-plugin-import": "2.14.0", + "eslint-plugin-import": "^2.17.2", "eslint-plugin-jsx-a11y": "6.1.2", "eslint-plugin-prettier": "^3.0.1", "eslint-plugin-react": "7.11.1", @@ -71,12 +74,11 @@ "prettier": "^1.17.0", "prop-types": "15.6.2", "prop-types-extra": "1.1.0", - "prosemirror-dev-tools": "2.1.1", "regenerator": "0.12.3", "stylelint": "^10.0.1", "stylelint-config-standard": "^18.3.0", "uglifyjs-webpack-plugin": "1.2.5", - "webpack": "3.5.4", + "webpack": "^2.2.0", "webpack-dev-server": "2.3.0", "write-file-webpack-plugin": "3.4.2" }, @@ -89,7 +91,6 @@ "invariant": "2.2.4", "jquery": "2.2.1", "katex": "0.10.1", - "node-mathquill": "0.10.0", "nullthrows": "1.0.1", "prosemirror-commands": "1.0.7", "prosemirror-dropcursor": "1.1.1", @@ -99,9 +100,9 @@ "prosemirror-model": "1.6.3", "prosemirror-schema-list": "1.0.1", "prosemirror-state": "1.2.2", - "prosemirror-tables": "github:chanzuckerberg/prosemirror-tables#2f2bd5eb94a640e3699ead6faa458c4a4d1e86c0", + "prosemirror-tables": "^0.9.1", "prosemirror-transform": "1.1.3", - "prosemirror-utils": "0.6.6", + "prosemirror-utils": "^0.9.6", "prosemirror-view": "1.6.7", "query-string": "3.0.3", "react": "15.5.4", diff --git a/scripts/build_bin.py b/scripts/build_bin.py old mode 100755 new mode 100644 diff --git a/scripts/ci_check_dist.sh b/scripts/ci_check_dist.sh old mode 100755 new mode 100644 diff --git a/src/EditorCommands.js b/src/EditorCommands.js index bf5ee3b6..a8b209be 100644 --- a/src/EditorCommands.js +++ b/src/EditorCommands.js @@ -21,7 +21,7 @@ import ListToggleCommand from './ListToggleCommand'; import * as MarkNames from './MarkNames'; import MarkToggleCommand from './MarkToggleCommand'; import MarksClearCommand from './MarksClearCommand'; -import MathEditCommand from './MathEditCommand'; +// import MathEditCommand from './MathEditCommand'; import PrintCommand from './PrintCommand'; import TableBackgroundColorCommand from './TableBackgroundColorCommand'; import TableBorderColorCommand from './TableBorderColorCommand'; @@ -94,7 +94,7 @@ export const LIST_ITEM_INSERT_NEW_LINE = new ListItemInsertNewLineCommand(); export const LIST_ITEM_MERGE_DOWN = new ListItemMergeCommand('down'); export const LIST_ITEM_MERGE_UP = new ListItemMergeCommand('up'); export const LIST_SPLIT = new ListSplitCommand(); -export const MATH_EDIT = new MathEditCommand(); +// export const MATH_EDIT = new MathEditCommand(); export const OL = new ListToggleCommand(true); export const PRINT = new PrintCommand(); export const STRIKE = new MarkToggleCommand(MARK_STRIKE); diff --git a/src/EditorKeyMap.js b/src/EditorKeyMap.js index 3c0bd5c0..4e2e2932 100644 --- a/src/EditorKeyMap.js +++ b/src/EditorKeyMap.js @@ -69,6 +69,7 @@ export function makeKeyMapWithCommon( return makeKeyMap(description, windows, mac, common); } +export const KEY_SAVE = makeKeyMapWithCommon('Save', 'Mod-s'); export const KEY_BACK_DELETE = makeKeyMapWithCommon('', 'Backspace'); export const KEY_FORWARD_DELETE = makeKeyMapWithCommon('', 'Delete'); export const KEY_INSERT_HORIZONTAL_RULE = makeKeyMapWithCommon( diff --git a/src/EditorNodes.js b/src/EditorNodes.js index 898b0540..d61b6dc3 100644 --- a/src/EditorNodes.js +++ b/src/EditorNodes.js @@ -5,14 +5,14 @@ import {Schema} from 'prosemirror-model'; import BlockquoteNodeSpec from './BlockquoteNodeSpec'; import BookmarkNodeSpec from './BookmarkNodeSpec'; import BulletListNodeSpec from './BulletListNodeSpec'; -import CodeBlockNodeSpec from './CodeBlockNodeSpec'; +//import CodeBlockNodeSpec from './CodeBlockNodeSpec'; import DocNodeSpec from './DocNodeSpec'; import HardBreakNodeSpec from './HardBreakNodeSpec'; import HeadingNodeSpec from './HeadingNodeSpec'; import HorizontalRuleNodeSpec from './HorizontalRuleNodeSpec'; import ImageNodeSpec from './ImageNodeSpec'; import ListItemNodeSpec from './ListItemNodeSpec'; -import MathNodeSpec from './MathNodeSpec'; +// import MathNodeSpec from './MathNodeSpec'; import * as NodeNames from './NodeNames'; import OrderedListNodeSpec from './OrderedListNodeSpec'; import ParagraphNodeSpec from './ParagraphNodeSpec'; @@ -23,14 +23,14 @@ const { BLOCKQUOTE, BOOKMARK, BULLET_LIST, - CODE_BLOCK, + //CODE_BLOCK, DOC, HARD_BREAK, HEADING, HORIZONTAL_RULE, IMAGE, LIST_ITEM, - MATH, + // MATH, ORDERED_LIST, PARAGRAPH, TEXT, @@ -46,10 +46,10 @@ const nodes = { [BLOCKQUOTE]: BlockquoteNodeSpec, [HORIZONTAL_RULE]: HorizontalRuleNodeSpec, [HEADING]: HeadingNodeSpec, - [CODE_BLOCK]: CodeBlockNodeSpec, + //[CODE_BLOCK]: CodeBlockNodeSpec, [TEXT]: TextNodeSpec, [IMAGE]: ImageNodeSpec, - [MATH]: MathNodeSpec, + // [MATH]: MathNodeSpec, [HARD_BREAK]: HardBreakNodeSpec, [BULLET_LIST]: BulletListNodeSpec, [ORDERED_LIST]: OrderedListNodeSpec, diff --git a/src/FontTypeMarkSpec.js b/src/FontTypeMarkSpec.js index a4c1e26a..96fe4f66 100644 --- a/src/FontTypeMarkSpec.js +++ b/src/FontTypeMarkSpec.js @@ -9,17 +9,17 @@ import type {MarkSpec} from './Types'; export const FONT_TYPE_NAMES = [ // SERIF 'Arial', - 'Arial Black', - 'Georgia', - 'Tahoma', - 'Times New Roman', + //'Arial Black', + //'Georgia', + //'Tahoma', + //'Times New Roman', 'Times', - 'Verdana', + //'Verdana', // MONOSPACE 'Courier New', - 'Lucida Console', - 'Monaco', - 'monospace', + //'Lucida Console', + //'Monaco', + //'monospace', ]; const RESOLVED_FONT_NAMES = new Set(FONT_TYPE_NAMES); diff --git a/src/TableResizePlugin.js b/src/TableResizePlugin.js index 7b19c2c6..82379c4f 100644 --- a/src/TableResizePlugin.js +++ b/src/TableResizePlugin.js @@ -37,14 +37,31 @@ import {Decoration, DecorationSet, EditorView} from 'prosemirror-view'; import {findParentNodeOfTypeClosestToPos} from 'prosemirror-utils'; import nullthrows from 'nullthrows'; import { - cellAround, - pointsAtCell, - setAttr, - tableNodeTypes, + //cellAround, + //pointsAtCell, + //setAttr, + //tableNodeTypes, TableMap, TableView, } from 'prosemirror-tables'; +function setAttr(attrs, name, value) { + const result = {}; + for (const prop in attrs) result[prop] = attrs[prop]; + result[name] = value; + return result; +} +function pointsAtCell($pos) { + return $pos.parent.type.spec.tableRole == 'row' && $pos.nodeAfter; +} + +function cellAround($pos) { + for (let d = $pos.depth - 1; d > 0; d--) + if ($pos.node(d).type.spec.tableRole == 'row') + return $pos.node(0).resolve($pos.before(d + 1)); + return null; +} + type DraggingInfo = { columnElements: Array, startX: number, @@ -569,7 +586,8 @@ export default class TableResizePlugin extends Plugin { state: { init(_: any, state: EditorState): ResizeState { this.spec.props.nodeViews[ - tableNodeTypes(state.schema).table.name + //tableNodeTypes(state.schema).table.name + state.schema.nodes.table.name ] = createTableView; return new ResizeState(-1, null); }, diff --git a/src/convertToHTML.js b/src/convertToHTML.js new file mode 100644 index 00000000..e7464667 --- /dev/null +++ b/src/convertToHTML.js @@ -0,0 +1,6 @@ +export default function toHtml(serializer, doc) { + const container = document.createElement('article'); + const serialized = serializer.serializeFragment(doc.content); + container.appendChild(serialized); + return container.innerHTML; +} diff --git a/src/index.js b/src/index.js index a6214df8..48d20f80 100644 --- a/src/index.js +++ b/src/index.js @@ -5,6 +5,33 @@ export {default as RichTextEditor} from './ui/RichTextEditor'; export {default as convertFromHTML} from './convertFromHTML'; export {default as convertFromJSON} from './convertFromJSON'; export {default as convertToJSON} from './convertToJSON'; +export {default as convertToHTML} from './convertToHTML'; export {default as createEmptyEditorState} from './createEmptyEditorState'; export {default as isEditorStateEmpty} from './isEditorStateEmpty'; export {default as uuid} from './ui/uuid'; +export class EnableImageUploadRuntime { + // Image Upload + canUploadImage(): boolean { + return true; + } + + uploadImage(file: File): Promise { + return new Promise((resolve, reject) => { + const {FileReader} = window; + if (FileReader) { + const reader = new FileReader(); + reader.onload = event => { + // base64 encoded url. + const src = event.target.result; + resolve({src, height: 0, width: 0, id: ''}); + }; + reader.onerror = () => { + reject(new Error('FileReader failed')); + }; + reader.readAsDataURL(file); + } else { + reject(new Error('FileReader is not available')); + } + }); + } +}; diff --git a/src/ui/ColorEditor.js b/src/ui/ColorEditor.js index add29cc2..baa226f3 100644 --- a/src/ui/ColorEditor.js +++ b/src/ui/ColorEditor.js @@ -55,7 +55,7 @@ class ColorEditor extends React.PureComponent { diff --git a/src/ui/Editor.js b/src/ui/Editor.js index 9c950038..b8e969e7 100644 --- a/src/ui/Editor.js +++ b/src/ui/Editor.js @@ -17,7 +17,12 @@ import { registeryKeys, releaseEditorView, } from '../CZIProseMirror'; -import {BOOKMARK, IMAGE, LIST_ITEM, MATH} from '../NodeNames'; +import { + BOOKMARK, + IMAGE, + LIST_ITEM, + // MATH +} from '../NodeNames'; import WebFontLoader from '../WebFontLoader'; import createEmptyEditorState from '../createEmptyEditorState'; import normalizeHTML from '../normalizeHTML'; @@ -26,7 +31,7 @@ import CustomEditorView from './CustomEditorView'; import CustomNodeView from './CustomNodeView'; import ImageNodeView from './ImageNodeView'; import ListItemNodeView from './ListItemNodeView'; -import MathNodeView from './MathNodeView'; +// import MathNodeView from './MathNodeView'; import handleEditorDrop from './handleEditorDrop'; import handleEditorKeyDown from './handleEditorKeyDown'; import handleEditorPaste from './handleEditorPaste'; @@ -51,6 +56,7 @@ export type EditorProps = { readOnly?: ?boolean, runtime?: ?EditorRuntime, transformPastedHTML?: (html: string) => string, + onSave?: any, }; // Export utilities for debugging. @@ -64,7 +70,7 @@ const AUTO_FOCUS_DELAY = 350; // Default custom node views. export const DEFAULT_NODE_VIEWS = Object.freeze({ [IMAGE]: ImageNodeView, - [MATH]: MathNodeView, + // [MATH]: MathNodeView, [BOOKMARK]: BookmarkNodeView, [LIST_ITEM]: ListItemNodeView, }); diff --git a/src/ui/EditorToolbar.js b/src/ui/EditorToolbar.js index 27d9bdd1..83442066 100644 --- a/src/ui/EditorToolbar.js +++ b/src/ui/EditorToolbar.js @@ -28,6 +28,7 @@ class EditorToolbar extends React.PureComponent { editorView: ?EditorView, onReady?: ?(view: EditorView) => void, readOnly?: ?boolean, + onSave?: ?() => void, }; state = { @@ -37,6 +38,7 @@ class EditorToolbar extends React.PureComponent { render(): React.Element { const {wrapped, expanded} = this.state; + const {onSave} = this.props; const className = cx('czi-editor-toolbar', {expanded, wrapped}); const wrappedButton = wrapped ? ( { ref={this._onBodyRef} > +
+ +
{COMMAND_GROUPS.map(this._renderButtonsGroup)}
diff --git a/src/ui/EditorToolbarConfig.js b/src/ui/EditorToolbarConfig.js index a2e6fbf8..f878fe28 100644 --- a/src/ui/EditorToolbarConfig.js +++ b/src/ui/EditorToolbarConfig.js @@ -31,26 +31,26 @@ export function parseLabel(input: string): Object { } const { - BLOCKQUOTE_TOGGLE, + // BLOCKQUOTE_TOGGLE, CLEAR_FORMAT, - CODE, - DOC_LAYOUT, + // CODE, + // DOC_LAYOUT, EM, H1, H2, H3, - H4, - H5, - H6, + // H4, + // H5, + // H6, HISTORY_REDO, HISTORY_UNDO, HR, - IMAGE_FROM_URL, + // IMAGE_FROM_URL, IMAGE_UPLOAD, INDENT_LESS, INDENT_MORE, LINK_SET_URL, - MATH_EDIT, + // MATH_EDIT, OL, STRIKE, STRONG, @@ -59,19 +59,19 @@ const { TABLE_ADD_COLUMN_BEFORE, TABLE_ADD_ROW_AFTER, TABLE_ADD_ROW_BEFORE, - TABLE_BORDER_COLOR, + //TABLE_BORDER_COLOR, TABLE_BACKGROUND_COLOR, TABLE_DELETE_COLUMN, TABLE_DELETE_ROW, TABLE_DELETE_TABLE, TABLE_INSERT_TABLE, TABLE_MERGE_CELLS, - // TABLE_MOVE_TO_NEXT_CELL, - // TABLE_MOVE_TO_PREV_CELL, + //TABLE_MOVE_TO_NEXT_CELL, + //TABLE_MOVE_TO_PREV_CELL, TABLE_SPLIT_ROW, - TABLE_TOGGLE_HEADER_CELL, - TABLE_TOGGLE_HEADER_COLUMN, - TABLE_TOGGLE_HEADER_ROW, + //TABLE_TOGGLE_HEADER_CELL, + //TABLE_TOGGLE_HEADER_COLUMN, + //TABLE_TOGGLE_HEADER_ROW, TEXT_ALIGN_CENTER, TEXT_ALIGN_JUSTIFY, TEXT_ALIGN_LEFT, @@ -85,108 +85,113 @@ const { export const TABLE_COMMANDS_GROUP = [ { - 'Insert Table...': TABLE_INSERT_TABLE, + 'Inserir Tabela': TABLE_INSERT_TABLE, }, { - 'Fill Color...': TABLE_BACKGROUND_COLOR, - 'Border Color....': TABLE_BORDER_COLOR, + 'Cor de Fundo': TABLE_BACKGROUND_COLOR, + //'Border Color....': TABLE_BORDER_COLOR, }, { - 'Insert Column Before': TABLE_ADD_COLUMN_BEFORE, - 'Insert Column After': TABLE_ADD_COLUMN_AFTER, - 'Delete Column': TABLE_DELETE_COLUMN, + 'Inserir Coluna Antes': TABLE_ADD_COLUMN_BEFORE, + 'Inserir Coluna Depois': TABLE_ADD_COLUMN_AFTER, + 'Apagar Coluna': TABLE_DELETE_COLUMN, }, { - 'Insert Row Before': TABLE_ADD_ROW_BEFORE, - 'Insert Row After': TABLE_ADD_ROW_AFTER, - 'Delete Row': TABLE_DELETE_ROW, + 'Inserir Linha Antes': TABLE_ADD_ROW_BEFORE, + 'Inserir Linha Depois': TABLE_ADD_ROW_AFTER, + 'Apagar Linha': TABLE_DELETE_ROW, }, { - 'Merge Cells': TABLE_MERGE_CELLS, - 'Split Row': TABLE_SPLIT_ROW, + 'Mesclar Celulas': TABLE_MERGE_CELLS, + 'Dividir Celulas': TABLE_SPLIT_ROW, }, // Disable these commands cause user rarely use them. + //{ + // 'Toggle Header Column': TABLE_TOGGLE_HEADER_COLUMN, + // 'Toggle Header Row': TABLE_TOGGLE_HEADER_ROW, + // 'Toggle Header Cells': TABLE_TOGGLE_HEADER_CELL, + //}, { - 'Toggle Header Column': TABLE_TOGGLE_HEADER_COLUMN, - 'Toggle Header Row': TABLE_TOGGLE_HEADER_ROW, - 'Toggle Header Cells': TABLE_TOGGLE_HEADER_CELL, - }, - { - 'Delete Table': TABLE_DELETE_TABLE, + 'Apagar Tabela': TABLE_DELETE_TABLE, }, ]; export const COMMAND_GROUPS = [ { - '[undo] Undo': HISTORY_UNDO, - '[redo] Redo': HISTORY_REDO, + '[undo] Desfazer': HISTORY_UNDO, + '[redo] Refazer': HISTORY_REDO, }, { - '[grid_on] Table...': TABLE_COMMANDS_GROUP, + '[grid_on] Tabela...': TABLE_COMMANDS_GROUP, }, { - '[H1] Header 1': H1, - '[H2] Heading 2': H2, - '[keyboard_arrow_down] Headings...': [ + '[H] Títulos...': [ { - 'Header 3': H3, - 'Header 4': H4, - 'Header 5': H5, - 'Header 6': H6, + 'Título 1': H1, + 'Título 2': H2, + 'Título 3': H3, + // 'Header 4': H4, + // 'Header 5': H5, + // 'Header 6': H6, }, ], }, { - '[font_download] Font Type': FontTypeCommandMenuButton, - }, - { - '[format_size] Text Size': FontSizeCommandMenuButton, + '[font_download] Fonte': FontTypeCommandMenuButton, }, { - '[format_bold] Bold': STRONG, - '[format_italic] Italic': EM, - '[format_underline] Underline': UNDERLINE, - '[format_color_text] Text color': TEXT_COLOR, - '[border_color] Highlight color': TEXT_HIGHLIGHT, - '[superscript] Superscript': SUPER, + '[format_size] Tamanho da Fonte': FontSizeCommandMenuButton, }, { - '[link] Apply link': LINK_SET_URL, - '[image] Insert image': [ - { - 'Insert image by URL': IMAGE_FROM_URL, - 'Upload image from computer': IMAGE_UPLOAD, - }, - ], + '[format_bold] Negrito': STRONG, + '[format_italic] Itálico': EM, + '[format_underline] Sublinhado': UNDERLINE, + '[format_strikethrough] Tachado': STRIKE, + '[superscript] Sobrescrito': SUPER, }, { - '[format_align_left] Left align': TEXT_ALIGN_LEFT, - '[format_align_center] Center Align': TEXT_ALIGN_CENTER, - '[format_align_right] Right Align': TEXT_ALIGN_RIGHT, - '[format_align_justify] Justify': TEXT_ALIGN_JUSTIFY, + '[format_color_text] Cor do texto': TEXT_COLOR, + '[border_color] Cor de fundo': TEXT_HIGHLIGHT, }, { - '[format_line_spacing] Line spacing': TEXT_LINE_SPACINGS, + '[link] Link': LINK_SET_URL, + '[image] Figura': IMAGE_UPLOAD, + // '[image] Insert image': [ + // { + // 'Insert image by URL': IMAGE_FROM_URL, + // 'Upload image from computer': IMAGE_UPLOAD, + // }, + //], }, { - '[format_list_numbered] Ordered list': OL, - '[format_list_bulleted] Bulleted list': UL, + '[format_align_left] Esquerda': TEXT_ALIGN_LEFT, + '[format_align_center] Centro': TEXT_ALIGN_CENTER, + '[format_align_right] Direita': TEXT_ALIGN_RIGHT, + '[format_align_justify] Justificado': TEXT_ALIGN_JUSTIFY, }, { - '[format_indent_increase] Indent more': INDENT_MORE, - '[format_indent_decrease] Indent less': INDENT_LESS, + '[format_line_spacing] Espaço entre linhas': TEXT_LINE_SPACINGS, + '[hr] Linha horizontal': HR, }, { - '[format_clear] Clear formats': CLEAR_FORMAT, + '[format_list_bulleted] Lista': UL, + '[format_list_numbered] Lista Ordenada': OL, }, { - '[hr] Horizontal line': HR, - '[functions] Math': MATH_EDIT, - '[code] Code': CODE, - '[format_strikethrough] Strike through': STRIKE, - '[format_quote] Block quote': BLOCKQUOTE_TOGGLE, + '[format_indent_increase] Identar mais': INDENT_MORE, + '[format_indent_decrease] Identar menos': INDENT_LESS, }, { - '[settings_overscan] Page layout': DOC_LAYOUT, + '[format_clear] Limpar formatação': CLEAR_FORMAT, }, + // { + // '[hr] Horizontal line': HR, + // '[functions] Math': MATH_EDIT, + // '[code] Code': CODE, + // '[format_strikethrough] Strike through': STRIKE, + // '[format_quote] Block quote': BLOCKQUOTE_TOGGLE, + // }, + // { + // '[settings_overscan] Page layout': DOC_LAYOUT, + // }, ]; diff --git a/src/ui/FontSizeCommandMenuButton.js b/src/ui/FontSizeCommandMenuButton.js index 816aa60a..e903a989 100644 --- a/src/ui/FontSizeCommandMenuButton.js +++ b/src/ui/FontSizeCommandMenuButton.js @@ -31,10 +31,7 @@ const FONT_PT_SIZE_COMMANDS = FONT_PT_SIZES.reduce((memo, size) => { return memo; }, {}); -const COMMAND_GROUPS = [ - {Default: new FontSizeCommand(0)}, - FONT_PT_SIZE_COMMANDS, -]; +const COMMAND_GROUPS = [FONT_PT_SIZE_COMMANDS]; class FontSizeCommandMenuButton extends React.PureComponent { props: { diff --git a/src/ui/ImageAlignEditor.js b/src/ui/ImageAlignEditor.js index c34f3cea..085cb0f4 100644 --- a/src/ui/ImageAlignEditor.js +++ b/src/ui/ImageAlignEditor.js @@ -7,19 +7,19 @@ import React from 'react'; const ImageAlignValues = { NONE: { value: null, - text: 'Inline', + text: 'No texto', }, LEFT: { value: 'left', - text: 'Float left', + text: 'Esquerda', }, CENTER: { value: 'center', - text: 'Center', + text: 'Centro', }, RIGHT: { value: 'right', - text: 'Float right', + text: 'Direita', }, }; diff --git a/src/ui/ImageInlineEditor.js b/src/ui/ImageInlineEditor.js index 3d7707a3..85bdbe90 100644 --- a/src/ui/ImageInlineEditor.js +++ b/src/ui/ImageInlineEditor.js @@ -7,19 +7,19 @@ import React from 'react'; const ImageAlignValues = { NONE: { value: null, - text: 'Inline', + text: 'No texto', }, LEFT: { value: 'left', - text: 'Float left', + text: 'Esquerda', }, CENTER: { value: 'center', - text: 'Break text', + text: 'Centro', }, RIGHT: { value: 'right', - text: 'Float right', + text: 'Direita', }, }; diff --git a/src/ui/LinkTooltip.js b/src/ui/LinkTooltip.js index 074176e1..6a6f803a 100644 --- a/src/ui/LinkTooltip.js +++ b/src/ui/LinkTooltip.js @@ -32,7 +32,7 @@ class LinkTooltip extends React.PureComponent { const {href, editorView, onEdit, onRemove} = this.props; const useBookMark = isBookMarkHref(href); const editButton = !!useBookMark && ( - + ); return ( @@ -49,7 +49,7 @@ class LinkTooltip extends React.PureComponent { /> {editButton} diff --git a/src/ui/LinkURLEditor.js b/src/ui/LinkURLEditor.js index 2e8e1937..76922cd7 100644 --- a/src/ui/LinkURLEditor.js +++ b/src/ui/LinkURLEditor.js @@ -28,10 +28,10 @@ class LinkURLEditor extends React.PureComponent { const error = url ? BAD_CHARACTER_PATTER.test(url) : false; - let label = 'Apply'; + let label = 'Aplicar'; let disabled = !!error; if (href) { - label = url ? 'Apply' : 'Remove'; + label = url ? 'Aplicar' : 'Remover'; disabled = error; } else { disabled = error || !url; @@ -41,19 +41,19 @@ class LinkURLEditor extends React.PureComponent {
- Add a Link + Adicionar um Link
- + { - const dummy = {}; const {View, viewProps, close} = this.props; + const dummy = viewProps || {}; return (
- +
); } diff --git a/src/ui/PopUpPosition.js b/src/ui/PopUpPosition.js old mode 100755 new mode 100644 diff --git a/src/ui/RichTextEditor.js b/src/ui/RichTextEditor.js index 8f2d3f30..efd964de 100644 --- a/src/ui/RichTextEditor.js +++ b/src/ui/RichTextEditor.js @@ -10,6 +10,7 @@ import EditorFrameset from './EditorFrameset'; import EditorToolbar from './EditorToolbar'; import Frag from './Frag'; import uuid from './uuid'; +import CommandButton from './CommandButton'; import type {EditorFramesetProps} from './EditorFrameset'; import type {EditorProps} from './Editor'; @@ -17,6 +18,7 @@ import type {EditorProps} from './Editor'; type Props = EditorFramesetProps & EditorProps & { children?: ?React.Children, + saveButton?: ?CommandButton, }; type State = { @@ -57,6 +59,7 @@ class RichTextEditor extends React.PureComponent { placeholder, readOnly, width, + onSave, } = this.props; let {editorState, runtime} = this.props; @@ -73,6 +76,7 @@ class RichTextEditor extends React.PureComponent { dispatchTransaction={this._dispatchTransaction} editorState={editorState || Editor.EDITOR_EMPTY_STATE} editorView={editorView} + onSave={onSave} readOnly={readOnly} /> ); diff --git a/src/ui/TableCellMenu.js b/src/ui/TableCellMenu.js index 2d778533..ab68ae18 100644 --- a/src/ui/TableCellMenu.js +++ b/src/ui/TableCellMenu.js @@ -29,7 +29,7 @@ class TableCellMenu extends React.PureComponent { editorState={editorState} editorView={editorView} icon={Icon.get('edit')} - title="Edit" + title="Editar" /> ); } diff --git a/src/ui/TableNodeView.js b/src/ui/TableNodeView.js index 62731ecc..486dc059 100644 --- a/src/ui/TableNodeView.js +++ b/src/ui/TableNodeView.js @@ -1,11 +1,39 @@ import {Node} from 'prosemirror-model'; import {EditorView} from 'prosemirror-view'; -import {TableView} from 'prosemirror-tables'; +import {updateColumnsOnResize} from 'prosemirror-tables'; + +const TableView = function TableView(node, cellMinWidth) { + this.node = node; + this.cellMinWidth = cellMinWidth; + this.dom = document.createElement('div'); + this.dom.className = 'tableWrapper'; + this.table = this.dom.appendChild(document.createElement('table')); + this.colgroup = this.table.appendChild(document.createElement('colgroup')); + updateColumnsOnResize(node, this.colgroup, this.table, cellMinWidth); + this.contentDOM = this.table.appendChild(document.createElement('tbody')); +}; + +TableView.prototype.update = function update(node) { + if (node.type != this.node.type) { + return false; + } + this.node = node; + updateColumnsOnResize(node, this.colgroup, this.table, this.cellMinWidth); + return true; +}; + +TableView.prototype.ignoreMutation = function ignoreMutation(record) { + return ( + record.type == 'attributes' && + (record.target == this.table || this.colgroup.contains(record.target)) + ); +}; // A custom table view that renders the margin-left style. export default class TableNodeView extends TableView { constructor(node: Node, colMinWidth: number, view: EditorView) { super(node, colMinWidth, view); + this._updateMargin(node); } update(node: Node): boolean { diff --git a/src/ui/czi-table.css b/src/ui/czi-table.css index 41f283eb..aff29c8c 100644 --- a/src/ui/czi-table.css +++ b/src/ui/czi-table.css @@ -6,23 +6,28 @@ overflow-x: auto; } +.prosemirror-mention-node { + background-color: red; +} + +[data-mention-name] { + background-color: greenyellow; +} + .ProseMirror table { - border-collapse: initial; + border-collapse: collapse; border-spacing: 0; - border: 1px solid var(--czi-table-border-color); - border-width: 0 thin thin 0; + border: thin solid var(--czi-table-border-color); table-layout: fixed; width: 100%; margin: 0; overflow: hidden; - page-break-inside: avoid; } .ProseMirror td, .ProseMirror th { background-color: #fff; - border: 1px solid var(--czi-table-border-color); - border-width: thin 0 0 thin; + border: thin solid var(--czi-table-border-color); box-sizing: border-box; min-width: 1em; padding: 8px; diff --git a/src/ui/czi-vars.css b/src/ui/czi-vars.css index f1677359..ffb62b14 100644 --- a/src/ui/czi-vars.css +++ b/src/ui/czi-vars.css @@ -24,7 +24,7 @@ --czi-table-header-background-color: rgba(0, 0, 0, 0.05); --czi-table-border-color: #000; --czi-doc-padding-default: 14.5mm; - --czi-doc-width-us-letter-portrait: 216mm; + --czi-doc-width-us-letter-portrait: 210mm; --czi-doc-width-us-letter-landscape: 279mm; --czi-doc-width-us-desktop-screen-4-3: 120vh; --czi-doc-width-us-desktop-screen-16-9: 142vh;