diff options
Diffstat (limited to 'libmproxy/web/static/js')
-rw-r--r-- | libmproxy/web/static/js/app.js | 1672 | ||||
-rw-r--r-- | libmproxy/web/static/js/vendor.js | 15652 |
2 files changed, 5531 insertions, 11793 deletions
diff --git a/libmproxy/web/static/js/app.js b/libmproxy/web/static/js/app.js index fe317d7f..d90610de 100644 --- a/libmproxy/web/static/js/app.js +++ b/libmproxy/web/static/js/app.js @@ -12,6 +12,7 @@ var AutoScrollMixin = { }, }; + var StickyHeadMixin = { adjustHead: function () { // Abusing CSS transforms to set the element @@ -21,6 +22,7 @@ var StickyHeadMixin = { } }; + var Key = { UP: 38, DOWN: 40, @@ -38,17 +40,19 @@ var Key = { L: 76 }; + var formatSize = function (bytes) { var size = bytes; var prefix = ["B", "KB", "MB", "GB", "TB"]; - var i=0; - while (Math.abs(size) >= 1024 && i < prefix.length-1) { + var i = 0; + while (Math.abs(size) >= 1024 && i < prefix.length - 1) { i++; size = size / 1024; } return (Math.floor(size * 100) / 100.0).toFixed(2) + prefix[i]; }; + var formatTimeDelta = function (milliseconds) { var time = milliseconds; var prefix = ["ms", "s", "min", "h"]; @@ -60,6 +64,43 @@ var formatTimeDelta = function (milliseconds) { } return Math.round(time) + prefix[i]; }; + + +var formatTimeStamp = function (seconds) { + var ts = (new Date(seconds * 1000)).toISOString(); + return ts.replace("T", " ").replace("Z", ""); +}; + + +function EventEmitter() { + this.listeners = {}; +} +EventEmitter.prototype.emit = function (event) { + if (!(event in this.listeners)) { + return; + } + var args = Array.prototype.slice.call(arguments, 1); + this.listeners[event].forEach(function (listener) { + listener.apply(this, args); + }.bind(this)); +}; +EventEmitter.prototype.addListener = function (events, f) { + events.split(" ").forEach(function (event) { + this.listeners[event] = this.listeners[event] || []; + this.listeners[event].push(f); + }.bind(this)); +}; +EventEmitter.prototype.removeListener = function (events, f) { + if (!(events in this.listeners)) { + return false; + } + events.split(" ").forEach(function (event) { + var index = this.listeners[event].indexOf(f); + if (index >= 0) { + this.listeners[event].splice(index, 1); + } + }.bind(this)); +}; const PayloadSources = { VIEW: "view", SERVER: "server" @@ -73,14 +114,14 @@ Dispatcher.prototype.register = function (callback) { this.callbacks.push(callback); }; Dispatcher.prototype.unregister = function (callback) { - var index = this.callbacks.indexOf(f); + var index = this.callbacks.indexOf(callback); if (index >= 0) { - this.callbacks.splice(this.callbacks.indexOf(f), 1); + this.callbacks.splice(index, 1); } }; Dispatcher.prototype.dispatch = function (payload) { console.debug("dispatch", payload); - for(var i = 0; i < this.callbacks.length; i++){ + for (var i = 0; i < this.callbacks.length; i++) { this.callbacks[i](payload); } }; @@ -97,39 +138,66 @@ AppDispatcher.dispatchServerAction = function (action) { }; var ActionTypes = { - //Settings - UPDATE_SETTINGS: "update_settings", + // Connection + CONNECTION_OPEN: "connection_open", + CONNECTION_CLOSE: "connection_close", + CONNECTION_ERROR: "connection_error", + + // Stores + SETTINGS_STORE: "settings", + EVENT_STORE: "events", + FLOW_STORE: "flows", +}; - //EventLog - ADD_EVENT: "add_event", +var StoreCmds = { + ADD: "add", + UPDATE: "update", + REMOVE: "remove", + RESET: "reset" +}; - //Flow - ADD_FLOW: "add_flow", - UPDATE_FLOW: "update_flow", +var ConnectionActions = { + open: function () { + AppDispatcher.dispatchViewAction({ + type: ActionTypes.CONNECTION_OPEN + }); + }, + close: function () { + AppDispatcher.dispatchViewAction({ + type: ActionTypes.CONNECTION_CLOSE + }); + }, + error: function () { + AppDispatcher.dispatchViewAction({ + type: ActionTypes.CONNECTION_ERROR + }); + } }; var SettingsActions = { update: function (settings) { - settings = _.merge({}, SettingsStore.getAll(), settings); + //TODO: Update server. //Facebook Flux: We do an optimistic update on the client already. AppDispatcher.dispatchViewAction({ - type: ActionTypes.UPDATE_SETTINGS, - settings: settings + type: ActionTypes.SETTINGS_STORE, + cmd: StoreCmds.UPDATE, + data: settings }); } }; -var event_id = 0; +var EventLogActions_event_id = 0; var EventLogActions = { - add_event: function(message){ + add_event: function (message) { AppDispatcher.dispatchViewAction({ - type: ActionTypes.ADD_EVENT, + type: ActionTypes.EVENT_STORE, + cmd: StoreCmds.ADD, data: { message: message, level: "web", - id: "viewAction-"+event_id++ + id: "viewAction-" + EventLogActions_event_id++ } }); } @@ -181,288 +249,294 @@ var RequestUtils = _.extend(_MessageUtils, { }); var ResponseUtils = _.extend(_MessageUtils, {}); -function EventEmitter() { - this.listeners = {}; +function ListStore() { + EventEmitter.call(this); + this.reset(); } -EventEmitter.prototype.emit = function (event) { - if (!(event in this.listeners)) { - return; - } - var args = Array.prototype.slice.call(arguments, 1); - this.listeners[event].forEach(function (listener) { - listener.apply(this, args); - }.bind(this)); -}; -EventEmitter.prototype.addListener = function (event, f) { - this.listeners[event] = this.listeners[event] || []; - this.listeners[event].push(f); -}; -EventEmitter.prototype.removeListener = function (event, f) { - if (!(event in this.listeners)) { - return false; - } - var index = this.listeners[event].indexOf(f); - if (index >= 0) { - this.listeners[event].splice(index, 1); +_.extend(ListStore.prototype, EventEmitter.prototype, { + add: function (elem) { + if (elem.id in this._pos_map) { + return; + } + this._pos_map[elem.id] = this.list.length; + this.list.push(elem); + this.emit("add", elem); + }, + update: function (elem) { + if (!(elem.id in this._pos_map)) { + return; + } + this.list[this._pos_map[elem.id]] = elem; + this.emit("update", elem); + }, + remove: function (elem_id) { + if (!(elem.id in this._pos_map)) { + return; + } + this.list.splice(this._pos_map[elem_id], 1); + this._build_map(); + this.emit("remove", elem_id); + }, + reset: function (elems) { + this.list = elems || []; + this._build_map(); + this.emit("recalculate", this.list); + }, + _build_map: function () { + this._pos_map = {}; + for (var i = 0; i < this.list.length; i++) { + var elem = this.list[i]; + this._pos_map[elem.id] = i; + } + }, + get: function (elem_id) { + return this.list[this._pos_map[elem_id]]; + }, + index: function (elem_id) { + return this._pos_map[elem_id]; } -}; +}); -function _SettingsStore() { - EventEmitter.call(this); - //FIXME: What do we do if we haven't requested anything from the server yet? - this.settings = { - version: "0.12", - showEventLog: true, - mode: "transparent", - }; +function DictStore() { + EventEmitter.call(this); + this.reset(); } -_.extend(_SettingsStore.prototype, EventEmitter.prototype, { - getAll: function () { - return this.settings; - }, - handle: function (action) { - switch (action.type) { - case ActionTypes.UPDATE_SETTINGS: - this.settings = action.settings; - this.emit("change"); - break; - default: - return; - } +_.extend(DictStore.prototype, EventEmitter.prototype, { + update: function (dict) { + _.merge(this.dict, dict); + this.emit("recalculate", this.dict); + }, + reset: function (dict) { + this.dict = dict || {}; + this.emit("recalculate", this.dict); } }); -var SettingsStore = new _SettingsStore(); -AppDispatcher.register(SettingsStore.handle.bind(SettingsStore)); - -// -// We have an EventLogView and an EventLogStore: -// The basic architecture is that one can request views on the event log -// from the store, which returns a view object and then deals with getting the data required for the view. -// The view object is accessed by React components and distributes updates etc. -// -// See also: components/EventLog.react.js -function EventLogView(store, live) { - EventEmitter.call(this); - this._store = store; - this.live = live; - this.log = []; +function LiveStoreMixin(type) { + this.type = type; - this.add = this.add.bind(this); + this._updates_before_fetch = undefined; + this._fetchxhr = false; + + this.handle = this.handle.bind(this); + AppDispatcher.register(this.handle); - if (live) { - this._store.addListener(ActionTypes.ADD_EVENT, this.add); + // Avoid double-fetch on startup. + if (!(window.ws && window.ws.readyState === WebSocket.CONNECTING)) { + this.fetch(); } } -_.extend(EventLogView.prototype, EventEmitter.prototype, { +_.extend(LiveStoreMixin.prototype, { + handle: function (event) { + if (event.type === ActionTypes.CONNECTION_OPEN) { + return this.fetch(); + } + if (event.type === this.type) { + if (event.cmd === StoreCmds.RESET) { + this.fetch(); + } else if (this._updates_before_fetch) { + console.log("defer update", event); + this._updates_before_fetch.push(event); + } else { + this[event.cmd](event.data); + } + } + }, close: function () { - this._store.removeListener(ActionTypes.ADD_EVENT, this.add); + AppDispatcher.unregister(this.handle); }, - getAll: function () { - return this.log; + fetch: function (data) { + console.log("fetch " + this.type); + if (this._fetchxhr) { + this._fetchxhr.abort(); + } + this._updates_before_fetch = []; // (JS: empty array is true) + if (data) { + this.handle_fetch(data); + } else { + this._fetchxhr = $.getJSON("/" + this.type) + .done(function (message) { + this.handle_fetch(message.data); + }.bind(this)) + .fail(function () { + EventLogActions.add_event("Could not fetch " + this.type); + }.bind(this)); + } }, - add: function (entry) { - this.log.push(entry); - if(this.log.length > 200){ - this.log.shift(); + handle_fetch: function (data) { + this._fetchxhr = false; + console.log(this.type + " fetched.", this._updates_before_fetch); + this.reset(data); + var updates = this._updates_before_fetch; + this._updates_before_fetch = false; + for (var i = 0; i < updates.length; i++) { + this.handle(updates[i]); } - this.emit("change"); }, - add_bulk: function (messages) { - var log = messages; - var last_id = log[log.length - 1].id; - var to_add = _.filter(this.log, function (entry) { - return entry.id > last_id; - }); - this.log = log.concat(to_add); - this.emit("change"); - } }); +function LiveListStore(type) { + ListStore.call(this); + LiveStoreMixin.call(this, type); +} +_.extend(LiveListStore.prototype, ListStore.prototype, LiveStoreMixin.prototype); -function _EventLogStore() { - EventEmitter.call(this); +function LiveDictStore(type) { + DictStore.call(this); + LiveStoreMixin.call(this, type); } -_.extend(_EventLogStore.prototype, EventEmitter.prototype, { - getView: function (since) { - var view = new EventLogView(this, !since); - return view; - /* - //TODO: Really do bulk retrieval of last messages. - window.setTimeout(function () { - view.add_bulk([ - { - id: 1, - message: "Hello World" - }, - { - id: 2, - message: "I was already transmitted as an event." - } - ]); - }, 100); +_.extend(LiveDictStore.prototype, DictStore.prototype, LiveStoreMixin.prototype); - var id = 2; - view.add({ - id: id++, - message: "I was already transmitted as an event." - }); - view.add({ - id: id++, - message: "I was only transmitted as an event before the bulk was added.." - }); - window.setInterval(function () { - view.add({ - id: id++, - message: "." - }); - }, 1000); - return view; - */ - }, - handle: function (action) { - switch (action.type) { - case ActionTypes.ADD_EVENT: - this.emit(ActionTypes.ADD_EVENT, action.data); - break; - default: - return; + +function FlowStore() { + return new LiveListStore(ActionTypes.FLOW_STORE); +} + +function SettingsStore() { + return new LiveDictStore(ActionTypes.SETTINGS_STORE); +} + +function EventLogStore() { + LiveListStore.call(this, ActionTypes.EVENT_STORE); +} +_.extend(EventLogStore.prototype, LiveListStore.prototype, { + fetch: function(){ + LiveListStore.prototype.fetch.apply(this, arguments); + + // Make sure to display updates even if fetching all events failed. + // This way, we can send "fetch failed" log messages to the log. + if(this._fetchxhr){ + this._fetchxhr.fail(function(){ + this.handle_fetch(null); + }.bind(this)); } } }); +function SortByStoreOrder(elem) { + return this.store.index(elem.id); +} +var default_sort = SortByStoreOrder; +var default_filt = function(elem){ + return true; +}; -var EventLogStore = new _EventLogStore(); -AppDispatcher.register(EventLogStore.handle.bind(EventLogStore)); -function FlowView(store, live) { +function StoreView(store, filt, sortfun) { EventEmitter.call(this); - this._store = store; - this.live = live; - this.flows = []; + filt = filt || default_filt; + sortfun = sortfun || default_sort; + + this.store = store; this.add = this.add.bind(this); this.update = this.update.bind(this); - - if (live) { - this._store.addListener(ActionTypes.ADD_FLOW, this.add); - this._store.addListener(ActionTypes.UPDATE_FLOW, this.update); - } + this.remove = this.remove.bind(this); + this.recalculate = this.recalculate.bind(this); + this.store.addListener("add", this.add); + this.store.addListener("update", this.update); + this.store.addListener("remove", this.remove); + this.store.addListener("recalculate", this.recalculate); + + this.recalculate(this.store.list, filt, sortfun); } -_.extend(FlowView.prototype, EventEmitter.prototype, { +_.extend(StoreView.prototype, EventEmitter.prototype, { close: function () { - this._store.removeListener(ActionTypes.ADD_FLOW, this.add); - this._store.removeListener(ActionTypes.UPDATE_FLOW, this.update); - }, - getAll: function () { - return this.flows; - }, - add: function (flow) { - return this.update(flow); - }, - add_bulk: function (flows) { - //Treat all previously received updates as newer than the bulk update. - //If they weren't newer, we're about to receive an update for them very soon. - var updates = this.flows; - this.flows = flows; - updates.forEach(function(flow){ - this._update(flow); + this.store.removeListener("add", this.add); + this.store.removeListener("update", this.update); + this.store.removeListener("remove", this.remove); + this.store.removeListener("recalculate", this.recalculate); + }, + recalculate: function (elems, filt, sortfun) { + if (filt) { + this.filt = filt; + } + if (sortfun) { + this.sortfun = sortfun.bind(this); + } + + this.list = elems.filter(this.filt); + this.list.sort(function (a, b) { + return this.sortfun(a) - this.sortfun(b); }.bind(this)); - this.emit("change"); + this.emit("recalculate"); }, - _update: function(flow){ - var idx = _.findIndex(this.flows, function(f){ - return flow.id === f.id; - }); - - if(idx < 0){ - this.flows.push(flow); - //if(this.flows.length > 100){ - // this.flows.shift(); - //} - } else { - this.flows[idx] = flow; - } + index: function (elem) { + return _.sortedIndex(this.list, elem, this.sortfun); }, - update: function(flow){ - this._update(flow); - this.emit("change"); + add: function (elem) { + if (this.filt(elem)) { + var idx = this.index(elem); + if (idx === this.list.length) { //happens often, .push is way faster. + this.list.push(elem); + } else { + this.list.splice(idx, 0, elem); + } + this.emit("add", elem, idx); + } }, -}); - - -function _FlowStore() { - EventEmitter.call(this); -} -_.extend(_FlowStore.prototype, EventEmitter.prototype, { - getView: function (since) { - var view = new FlowView(this, !since); - - $.getJSON("/static/flows.json", function(flows){ - flows = flows.concat(_.cloneDeep(flows)).concat(_.cloneDeep(flows)); - var id = 1; - flows.forEach(function(flow){ - flow.id = "uuid-" + id++; - }); - view.add_bulk(flows); - - }); + update: function (elem) { + var idx; + var i = this.list.length; + // Search from the back, we usually update the latest entries. + while (i--) { + if (this.list[i].id === elem.id) { + idx = i; + break; + } + } - return view; + if (idx === -1) { //not contained in list + this.add(elem); + } else if (!this.filt(elem)) { + this.remove(elem.id); + } else { + if (this.sortfun(this.list[idx]) !== this.sortfun(elem)) { //sortpos has changed + this.remove(this.list[idx]); + this.add(elem); + } else { + this.list[idx] = elem; + this.emit("update", elem, idx); + } + } }, - handle: function (action) { - switch (action.type) { - case ActionTypes.ADD_FLOW: - case ActionTypes.UPDATE_FLOW: - this.emit(action.type, action.data); + remove: function (elem_id) { + var idx = this.list.length; + while (idx--) { + if (this.list[idx].id === elem_id) { + this.list.splice(idx, 1); + this.emit("remove", elem_id, idx); break; - default: - return; + } } } }); +function Connection(url) { -var FlowStore = new _FlowStore(); -AppDispatcher.register(FlowStore.handle.bind(FlowStore)); + if (url[0] === "/") { + url = location.origin.replace("http", "ws") + url; + } -function _Connection(url) { - this.url = url; + var ws = new WebSocket(url); + ws.onopen = function () { + ConnectionActions.open(); + }; + ws.onmessage = function (message) { + var m = JSON.parse(message.data); + AppDispatcher.dispatchServerAction(m); + }; + ws.onerror = function () { + ConnectionActions.error(); + EventLogActions.add_event("WebSocket connection error."); + }; + ws.onclose = function () { + ConnectionActions.close(); + EventLogActions.add_event("WebSocket connection closed."); + }; + return ws; } -_Connection.prototype.init = function () { - this.openWebSocketConnection(); -}; -_Connection.prototype.openWebSocketConnection = function () { - this.ws = new WebSocket(this.url.replace("http", "ws")); - var ws = this.ws; - - ws.onopen = this.onopen.bind(this); - ws.onmessage = this.onmessage.bind(this); - ws.onerror = this.onerror.bind(this); - ws.onclose = this.onclose.bind(this); -}; -_Connection.prototype.onopen = function (open) { - console.debug("onopen", this, arguments); -}; -_Connection.prototype.onmessage = function (message) { - //AppDispatcher.dispatchServerAction(...); - var m = JSON.parse(message.data); - AppDispatcher.dispatchServerAction(m); -}; -_Connection.prototype.onerror = function (error) { - EventLogActions.add_event("WebSocket Connection Error."); - console.debug("onerror", this, arguments); -}; -_Connection.prototype.onclose = function (close) { - EventLogActions.add_event("WebSocket Connection closed."); - console.debug("onclose", this, arguments); -}; - -var Connection = new _Connection(location.origin + "/updates"); - -/** @jsx React.DOM */ - //React utils. For other utilities, see ../utils.js var Splitter = React.createClass({displayName: 'Splitter', @@ -471,98 +545,202 @@ var Splitter = React.createClass({displayName: 'Splitter', axis: "x" }; }, - getInitialState: function(){ + getInitialState: function () { return { applied: false, startX: false, startY: false }; }, - onMouseDown: function(e){ + onMouseDown: function (e) { this.setState({ startX: e.pageX, startY: e.pageY }); - window.addEventListener("mousemove",this.onMouseMove); - window.addEventListener("mouseup",this.onMouseUp); + window.addEventListener("mousemove", this.onMouseMove); + window.addEventListener("mouseup", this.onMouseUp); // Occasionally, only a dragEnd event is triggered, but no mouseUp. - window.addEventListener("dragend",this.onDragEnd); + window.addEventListener("dragend", this.onDragEnd); }, - onDragEnd: function(){ - this.getDOMNode().style.transform=""; - window.removeEventListener("dragend",this.onDragEnd); - window.removeEventListener("mouseup",this.onMouseUp); - window.removeEventListener("mousemove",this.onMouseMove); + onDragEnd: function () { + this.getDOMNode().style.transform = ""; + window.removeEventListener("dragend", this.onDragEnd); + window.removeEventListener("mouseup", this.onMouseUp); + window.removeEventListener("mousemove", this.onMouseMove); }, - onMouseUp: function(e){ + onMouseUp: function (e) { this.onDragEnd(); var node = this.getDOMNode(); var prev = node.previousElementSibling; var next = node.nextElementSibling; - var dX = e.pageX-this.state.startX; - var dY = e.pageY-this.state.startY; + var dX = e.pageX - this.state.startX; + var dY = e.pageY - this.state.startY; var flexBasis; - if(this.props.axis === "x"){ + if (this.props.axis === "x") { flexBasis = prev.offsetWidth + dX; } else { flexBasis = prev.offsetHeight + dY; } - prev.style.flex = "0 0 "+Math.max(0, flexBasis)+"px"; + prev.style.flex = "0 0 " + Math.max(0, flexBasis) + "px"; next.style.flex = "1 1 auto"; this.setState({ applied: true }); + this.onResize(); }, - onMouseMove: function(e){ + onMouseMove: function (e) { var dX = 0, dY = 0; - if(this.props.axis === "x"){ - dX = e.pageX-this.state.startX; + if (this.props.axis === "x") { + dX = e.pageX - this.state.startX; } else { - dY = e.pageY-this.state.startY; + dY = e.pageY - this.state.startY; } - this.getDOMNode().style.transform = "translate("+dX+"px,"+dY+"px)"; + this.getDOMNode().style.transform = "translate(" + dX + "px," + dY + "px)"; + }, + onResize: function () { + // Trigger a global resize event. This notifies components that employ virtual scrolling + // that their viewport may have changed. + window.setTimeout(function () { + window.dispatchEvent(new CustomEvent("resize")); + }, 1); }, - reset: function(willUnmount) { + reset: function (willUnmount) { if (!this.state.applied) { return; } var node = this.getDOMNode(); var prev = node.previousElementSibling; var next = node.nextElementSibling; - + prev.style.flex = ""; next.style.flex = ""; - if(!willUnmount){ + if (!willUnmount) { this.setState({ applied: false }); } - + this.onResize(); }, - componentWillUnmount: function(){ + componentWillUnmount: function () { this.reset(true); }, - render: function(){ + render: function () { var className = "splitter"; - if(this.props.axis === "x"){ + if (this.props.axis === "x") { className += " splitter-x"; } else { className += " splitter-y"; } return ( - React.DOM.div({className: className}, - React.DOM.div({onMouseDown: this.onMouseDown, draggable: "true"}) + React.createElement("div", {className: className}, + React.createElement("div", {onMouseDown: this.onMouseDown, draggable: "true"}) ) ); } }); -/** @jsx React.DOM */ +function getCookie(name) { + var r = document.cookie.match("\\b" + name + "=([^;]*)\\b"); + return r ? r[1] : undefined; +} +var xsrf = $.param({_xsrf: getCookie("_xsrf")}); + +//Tornado XSRF Protection. +$.ajaxPrefilter(function (options) { + if (options.type === "post" && options.url[0] === "/") { + if (options.data) { + options.data += ("&" + xsrf); + } else { + options.data = xsrf; + } + } +}); +var VirtualScrollMixin = { + getInitialState: function () { + return { + start: 0, + stop: 0 + }; + }, + componentWillMount: function () { + if (!this.props.rowHeight) { + console.warn("VirtualScrollMixin: No rowHeight specified", this); + } + }, + getPlaceholderTop: function (total) { + var Tag = this.props.placeholderTagName || "tr"; + // When a large trunk of elements is removed from the button, start may be far off the viewport. + // To make this issue less severe, limit the top placeholder to the total number of rows. + var style = { + height: Math.min(this.state.start, total) * this.props.rowHeight + }; + var spacer = React.createElement(Tag, {key: "placeholder-top", style: style}); + + if (this.state.start % 2 === 1) { + // fix even/odd rows + return [spacer, React.createElement(Tag, {key: "placeholder-top-2"})]; + } else { + return spacer; + } + }, + getPlaceholderBottom: function (total) { + var Tag = this.props.placeholderTagName || "tr"; + var style = { + height: Math.max(0, total - this.state.stop) * this.props.rowHeight + }; + return React.createElement(Tag, {key: "placeholder-bottom", style: style}); + }, + componentDidMount: function () { + this.onScroll(); + window.addEventListener('resize', this.onScroll); + }, + componentWillUnmount: function(){ + window.removeEventListener('resize', this.onScroll); + }, + onScroll: function () { + var viewport = this.getDOMNode(); + var top = viewport.scrollTop; + var height = viewport.offsetHeight; + var start = Math.floor(top / this.props.rowHeight); + var stop = start + Math.ceil(height / (this.props.rowHeightMin || this.props.rowHeight)); + + this.setState({ + start: start, + stop: stop + }); + }, + renderRows: function (elems) { + var rows = []; + var max = Math.min(elems.length, this.state.stop); + + for (var i = this.state.start; i < max; i++) { + var elem = elems[i]; + rows.push(this.renderRow(elem)); + } + return rows; + }, + scrollRowIntoView: function (index, head_height) { + + var row_top = (index * this.props.rowHeight) + head_height; + var row_bottom = row_top + this.props.rowHeight; + + var viewport = this.getDOMNode(); + var viewport_top = viewport.scrollTop; + var viewport_bottom = viewport_top + viewport.offsetHeight; + + // Account for pinned thead + if (row_top - head_height < viewport_top) { + viewport.scrollTop = row_top - head_height; + } else if (row_bottom > viewport_bottom) { + viewport.scrollTop = row_bottom - viewport.offsetHeight; + } + }, +}; var MainMenu = React.createClass({displayName: 'MainMenu', statics: { title: "Traffic", @@ -573,14 +751,23 @@ var MainMenu = React.createClass({displayName: 'MainMenu', showEventLog: !this.props.settings.showEventLog }); }, + clearFlows: function () { + $.post("/flows/clear"); + }, render: function () { return ( - React.DOM.div(null, - React.DOM.button({className: "btn " + (this.props.settings.showEventLog ? "btn-primary" : "btn-default"), onClick: this.toggleEventLog}, - React.DOM.i({className: "fa fa-database"}), " Display Event Log" + React.createElement("div", null, + React.createElement("button", {className: "btn " + (this.props.settings.showEventLog ? "btn-primary" : "btn-default"), onClick: this.toggleEventLog}, + React.createElement("i", {className: "fa fa-database"}), + " Display Event Log" + ), + " ", + React.createElement("button", {className: "btn btn-default", onClick: this.clearFlows}, + React.createElement("i", {className: "fa fa-eraser"}), + " Clear Flows" ) ) - ); + ); } }); @@ -591,7 +778,7 @@ var ToolsMenu = React.createClass({displayName: 'ToolsMenu', route: "flows" }, render: function () { - return React.DOM.div(null, "Tools Menu"); + return React.createElement("div", null, "Tools Menu"); } }); @@ -602,7 +789,81 @@ var ReportsMenu = React.createClass({displayName: 'ReportsMenu', route: "reports" }, render: function () { - return React.DOM.div(null, "Reports Menu"); + return React.createElement("div", null, "Reports Menu"); + } +}); + +var FileMenu = React.createClass({displayName: 'FileMenu', + getInitialState: function () { + return { + showFileMenu: false + }; + }, + handleFileClick: function (e) { + e.preventDefault(); + if (!this.state.showFileMenu) { + var close = function () { + this.setState({showFileMenu: false}); + document.removeEventListener("click", close); + }.bind(this); + document.addEventListener("click", close); + + this.setState({ + showFileMenu: true + }); + } + }, + handleNewClick: function(e){ + e.preventDefault(); + console.error("unimplemented: handleNewClick"); + }, + handleOpenClick: function(e){ + e.preventDefault(); + console.error("unimplemented: handleOpenClick"); + }, + handleSaveClick: function(e){ + e.preventDefault(); + console.error("unimplemented: handleSaveClick"); + }, + handleShutdownClick: function(e){ + e.preventDefault(); + console.error("unimplemented: handleShutdownClick"); + }, + render: function () { + var fileMenuClass = "dropdown pull-left" + (this.state.showFileMenu ? " open" : ""); + + return ( + React.createElement("div", {className: fileMenuClass}, + React.createElement("a", {href: "#", className: "special", onClick: this.handleFileClick}, " File "), + React.createElement("ul", {className: "dropdown-menu", role: "menu"}, + React.createElement("li", null, + React.createElement("a", {href: "#", onClick: this.handleNewClick}, + React.createElement("i", {className: "fa fa-fw fa-file"}), + "New" + ) + ), + React.createElement("li", null, + React.createElement("a", {href: "#", onClick: this.handleOpenClick}, + React.createElement("i", {className: "fa fa-fw fa-folder-open"}), + "Open" + ) + ), + React.createElement("li", null, + React.createElement("a", {href: "#", onClick: this.handleSaveClick}, + React.createElement("i", {className: "fa fa-fw fa-save"}), + "Save" + ) + ), + React.createElement("li", {role: "presentation", className: "divider"}), + React.createElement("li", null, + React.createElement("a", {href: "#", onClick: this.handleShutdownClick}, + React.createElement("i", {className: "fa fa-fw fa-plug"}), + "Shutdown" + ) + ) + ) + ) + ); } }); @@ -611,94 +872,89 @@ var header_entries = [MainMenu, ToolsMenu, ReportsMenu]; var Header = React.createClass({displayName: 'Header', + mixins: [ReactRouter.Navigation], getInitialState: function () { return { active: header_entries[0] }; }, - handleClick: function (active) { - ReactRouter.transitionTo(active.route); + handleClick: function (active, e) { + e.preventDefault(); + this.transitionTo(active.route); this.setState({active: active}); - return false; - }, - handleFileClick: function () { - console.log("File click"); }, render: function () { - var header = header_entries.map(function(entry, i){ + var header = header_entries.map(function (entry, i) { var classes = React.addons.classSet({ active: entry == this.state.active }); return ( - React.DOM.a({key: i, - href: "#", - className: classes, - onClick: this.handleClick.bind(this, entry) + React.createElement("a", {key: i, + href: "#", + className: classes, + onClick: this.handleClick.bind(this, entry) }, entry.title ) - ); + ); }.bind(this)); - + return ( - React.DOM.header(null, - React.DOM.div({className: "title-bar"}, + React.createElement("header", null, + React.createElement("div", {className: "title-bar"}, "mitmproxy ", this.props.settings.version ), - React.DOM.nav({className: "nav-tabs nav-tabs-lg"}, - React.DOM.a({href: "#", className: "special", onClick: this.handleFileClick}, " File "), + React.createElement("nav", {className: "nav-tabs nav-tabs-lg"}, + React.createElement(FileMenu, null), header ), - React.DOM.div({className: "menu"}, - this.state.active({settings: this.props.settings}) + React.createElement("div", {className: "menu"}, + React.createElement(this.state.active, {settings: this.props.settings}) ) ) - ); + ); } }); -/** @jsx React.DOM */ - - var TLSColumn = React.createClass({displayName: 'TLSColumn', statics: { - renderTitle: function(){ - return React.DOM.th({key: "tls", className: "col-tls"}); + renderTitle: function () { + return React.createElement("th", {key: "tls", className: "col-tls"}); } }, - render: function(){ + render: function () { var flow = this.props.flow; var ssl = (flow.request.scheme == "https"); var classes; - if(ssl){ + if (ssl) { classes = "col-tls col-tls-https"; } else { classes = "col-tls col-tls-http"; } - return React.DOM.td({className: classes}); + return React.createElement("td", {className: classes}); } }); var IconColumn = React.createClass({displayName: 'IconColumn', statics: { - renderTitle: function(){ - return React.DOM.th({key: "icon", className: "col-icon"}); + renderTitle: function () { + return React.createElement("th", {key: "icon", className: "col-icon"}); } }, - render: function(){ + render: function () { var flow = this.props.flow; var icon; - if(flow.response){ + if (flow.response) { var contentType = ResponseUtils.getContentType(flow.response); //TODO: We should assign a type to the flow somewhere else. - if(flow.response.code == 304) { + if (flow.response.code == 304) { icon = "resource-icon-not-modified"; - } else if(300 <= flow.response.code && flow.response.code < 400) { + } else if (300 <= flow.response.code && flow.response.code < 400) { icon = "resource-icon-redirect"; - } else if(contentType && contentType.indexOf("image") >= 0) { + } else if (contentType && contentType.indexOf("image") >= 0) { icon = "resource-icon-image"; } else if (contentType && contentType.indexOf("javascript") >= 0) { icon = "resource-icon-js"; @@ -708,95 +964,97 @@ var IconColumn = React.createClass({displayName: 'IconColumn', icon = "resource-icon-document"; } } - if(!icon){ + if (!icon) { icon = "resource-icon-plain"; } icon += " resource-icon"; - return React.DOM.td({className: "col-icon"}, React.DOM.div({className: icon})); + return React.createElement("td", {className: "col-icon"}, + React.createElement("div", {className: icon}) + ); } }); var PathColumn = React.createClass({displayName: 'PathColumn', statics: { - renderTitle: function(){ - return React.DOM.th({key: "path", className: "col-path"}, "Path"); + renderTitle: function () { + return React.createElement("th", {key: "path", className: "col-path"}, "Path"); } }, - render: function(){ + render: function () { var flow = this.props.flow; - return React.DOM.td({className: "col-path"}, flow.request.scheme + "://" + flow.request.host + flow.request.path); + return React.createElement("td", {className: "col-path"}, flow.request.scheme + "://" + flow.request.host + flow.request.path); } }); var MethodColumn = React.createClass({displayName: 'MethodColumn', statics: { - renderTitle: function(){ - return React.DOM.th({key: "method", className: "col-method"}, "Method"); + renderTitle: function () { + return React.createElement("th", {key: "method", className: "col-method"}, "Method"); } }, - render: function(){ + render: function () { var flow = this.props.flow; - return React.DOM.td({className: "col-method"}, flow.request.method); + return React.createElement("td", {className: "col-method"}, flow.request.method); } }); var StatusColumn = React.createClass({displayName: 'StatusColumn', statics: { - renderTitle: function(){ - return React.DOM.th({key: "status", className: "col-status"}, "Status"); + renderTitle: function () { + return React.createElement("th", {key: "status", className: "col-status"}, "Status"); } }, - render: function(){ + render: function () { var flow = this.props.flow; var status; - if(flow.response){ + if (flow.response) { status = flow.response.code; } else { status = null; } - return React.DOM.td({className: "col-status"}, status); + return React.createElement("td", {className: "col-status"}, status); } }); var SizeColumn = React.createClass({displayName: 'SizeColumn', statics: { - renderTitle: function(){ - return React.DOM.th({key: "size", className: "col-size"}, "Size"); + renderTitle: function () { + return React.createElement("th", {key: "size", className: "col-size"}, "Size"); } }, - render: function(){ + render: function () { var flow = this.props.flow; var total = flow.request.contentLength; - if(flow.response){ + if (flow.response) { total += flow.response.contentLength || 0; } var size = formatSize(total); - return React.DOM.td({className: "col-size"}, size); + return React.createElement("td", {className: "col-size"}, size); } }); var TimeColumn = React.createClass({displayName: 'TimeColumn', statics: { - renderTitle: function(){ - return React.DOM.th({key: "time", className: "col-time"}, "Time"); + renderTitle: function () { + return React.createElement("th", {key: "time", className: "col-time"}, "Time"); } }, - render: function(){ + render: function () { var flow = this.props.flow; var time; - if(flow.response){ + if (flow.response) { time = formatTimeDelta(1000 * (flow.response.timestamp_end - flow.request.timestamp_start)); } else { time = "..."; } - return React.DOM.td({className: "col-time"}, time); + return React.createElement("td", {className: "col-time"}, time); } }); @@ -811,139 +1069,152 @@ var all_columns = [ TimeColumn]; -/** @jsx React.DOM */ - var FlowRow = React.createClass({displayName: 'FlowRow', - render: function(){ + render: function () { var flow = this.props.flow; - var columns = this.props.columns.map(function(column){ - return column({key: column.displayName, flow: flow}); + var columns = this.props.columns.map(function (Column) { + return React.createElement(Column, {key: Column.displayName, flow: flow}); }.bind(this)); var className = ""; - if(this.props.selected){ + if (this.props.selected) { className += "selected"; } return ( - React.DOM.tr({className: className, onClick: this.props.selectFlow.bind(null, flow)}, + React.createElement("tr", {className: className, onClick: this.props.selectFlow.bind(null, flow)}, columns )); }, - shouldComponentUpdate: function(nextProps){ - var isEqual = ( - this.props.columns.length === nextProps.columns.length && - this.props.selected === nextProps.selected && - this.props.flow.response === nextProps.flow.response); - return !isEqual; + shouldComponentUpdate: function (nextProps) { + return true; + // Further optimization could be done here + // by calling forceUpdate on flow updates, selection changes and column changes. + //return ( + //(this.props.columns.length !== nextProps.columns.length) || + //(this.props.selected !== nextProps.selected) + //); } }); var FlowTableHead = React.createClass({displayName: 'FlowTableHead', - render: function(){ - var columns = this.props.columns.map(function(column){ + render: function () { + var columns = this.props.columns.map(function (column) { return column.renderTitle(); }.bind(this)); - return React.DOM.thead(null, React.DOM.tr(null, columns)); + return React.createElement("thead", null, + React.createElement("tr", null, columns) + ); } }); -var FlowTableBody = React.createClass({displayName: 'FlowTableBody', - render: function(){ - var rows = this.props.flows.map(function(flow){ - var selected = (flow == this.props.selected); - return FlowRow({key: flow.id, - ref: flow.id, - flow: flow, - columns: this.props.columns, - selected: selected, - selectFlow: this.props.selectFlow} - ); - }.bind(this)); - return React.DOM.tbody(null, rows); - } -}); +var ROW_HEIGHT = 32; var FlowTable = React.createClass({displayName: 'FlowTable', - mixins: [StickyHeadMixin, AutoScrollMixin], + mixins: [StickyHeadMixin, AutoScrollMixin, VirtualScrollMixin], getInitialState: function () { return { columns: all_columns }; }, - scrollIntoView: function(flow){ - // Now comes the fun part: Scroll the flow into the view. - var viewport = this.getDOMNode(); - var flowNode = this.refs.body.refs[flow.id].getDOMNode(); - var viewport_top = viewport.scrollTop; - var viewport_bottom = viewport_top + viewport.offsetHeight; - var flowNode_top = flowNode.offsetTop; - var flowNode_bottom = flowNode_top + flowNode.offsetHeight; - - // Account for pinned thead by pretending that the flowNode starts - // -thead_height pixel earlier. - flowNode_top -= this.refs.body.getDOMNode().offsetTop; - - if(flowNode_top < viewport_top){ - viewport.scrollTop = flowNode_top; - } else if(flowNode_bottom > viewport_bottom) { - viewport.scrollTop = flowNode_bottom - viewport.offsetHeight; + componentWillMount: function () { + if (this.props.view) { + this.props.view.addListener("add update remove recalculate", this.onChange); + } + }, + componentWillReceiveProps: function (nextProps) { + if (nextProps.view !== this.props.view) { + if (this.props.view) { + this.props.view.removeListener("add update remove recalculate"); + } + nextProps.view.addListener("add update remove recalculate", this.onChange); } }, + getDefaultProps: function () { + return { + rowHeight: ROW_HEIGHT + }; + }, + onScrollFlowTable: function () { + this.adjustHead(); + this.onScroll(); + }, + onChange: function () { + this.forceUpdate(); + }, + scrollIntoView: function (flow) { + this.scrollRowIntoView( + this.props.view.index(flow), + this.refs.body.getDOMNode().offsetTop + ); + }, + renderRow: function (flow) { + var selected = (flow === this.props.selected); + return React.createElement(FlowRow, {key: flow.id, + ref: flow.id, + flow: flow, + columns: this.state.columns, + selected: selected, + selectFlow: this.props.selectFlow} + ); + }, render: function () { + //console.log("render flowtable", this.state.start, this.state.stop, this.props.selected); + var flows = this.props.view ? this.props.view.list : []; + + var rows = this.renderRows(flows); + return ( - React.DOM.div({className: "flow-table", onScroll: this.adjustHead}, - React.DOM.table(null, - FlowTableHead({ref: "head", - columns: this.state.columns}), - FlowTableBody({ref: "body", - flows: this.props.flows, - selected: this.props.selected, - selectFlow: this.props.selectFlow, - columns: this.state.columns}) + React.createElement("div", {className: "flow-table", onScroll: this.onScrollFlowTable}, + React.createElement("table", null, + React.createElement(FlowTableHead, {ref: "head", + columns: this.state.columns}), + React.createElement("tbody", {ref: "body"}, + this.getPlaceholderTop(flows.length), + rows, + this.getPlaceholderBottom(flows.length) + ) ) ) - ); + ); } }); -/** @jsx React.DOM */ - var FlowDetailNav = React.createClass({displayName: 'FlowDetailNav', - render: function(){ + render: function () { - var items = this.props.tabs.map(function(e){ + var items = this.props.tabs.map(function (e) { var str = e.charAt(0).toUpperCase() + e.slice(1); var className = this.props.active === e ? "active" : ""; - var onClick = function(){ + var onClick = function (event) { this.props.selectTab(e); - return false; + event.preventDefault(); }.bind(this); - return React.DOM.a({key: e, - href: "#", - className: className, - onClick: onClick}, str); + return React.createElement("a", {key: e, + href: "#", + className: className, + onClick: onClick}, str); }.bind(this)); return ( - React.DOM.nav({ref: "head", className: "nav-tabs nav-tabs-sm"}, + React.createElement("nav", {ref: "head", className: "nav-tabs nav-tabs-sm"}, items ) ); - } + } }); var Headers = React.createClass({displayName: 'Headers', - render: function(){ - var rows = this.props.message.headers.map(function(header, i){ + render: function () { + var rows = this.props.message.headers.map(function (header, i) { return ( - React.DOM.tr({key: i}, - React.DOM.td({className: "header-name"}, header[0]+":"), - React.DOM.td({className: "header-value"}, header[1]) + React.createElement("tr", {key: i}, + React.createElement("td", {className: "header-name"}, header[0] + ":"), + React.createElement("td", {className: "header-value"}, header[1]) ) ); }); return ( - React.DOM.table({className: "header-table"}, - React.DOM.tbody(null, + React.createElement("table", {className: "header-table"}, + React.createElement("tbody", null, rows ) ) @@ -952,27 +1223,27 @@ var Headers = React.createClass({displayName: 'Headers', }); var FlowDetailRequest = React.createClass({displayName: 'FlowDetailRequest', - render: function(){ + render: function () { var flow = this.props.flow; var first_line = [ - flow.request.method, - RequestUtils.pretty_url(flow.request), - "HTTP/"+ flow.response.httpversion.join(".") - ].join(" "); + flow.request.method, + RequestUtils.pretty_url(flow.request), + "HTTP/" + flow.request.httpversion.join(".") + ].join(" "); var content = null; - if(flow.request.contentLength > 0){ - content = "Request Content Size: "+ formatSize(flow.request.contentLength); + if (flow.request.contentLength > 0) { + content = "Request Content Size: " + formatSize(flow.request.contentLength); } else { - content = React.DOM.div({className: "alert alert-info"}, "No Content"); + content = React.createElement("div", {className: "alert alert-info"}, "No Content"); } //TODO: Styling return ( - React.DOM.section(null, - React.DOM.div({className: "first-line"}, first_line ), - Headers({message: flow.request}), - React.DOM.hr(null), + React.createElement("section", null, + React.createElement("div", {className: "first-line"}, first_line ), + React.createElement(Headers, {message: flow.request}), + React.createElement("hr", null), content ) ); @@ -980,70 +1251,94 @@ var FlowDetailRequest = React.createClass({displayName: 'FlowDetailRequest', }); var FlowDetailResponse = React.createClass({displayName: 'FlowDetailResponse', - render: function(){ + render: function () { var flow = this.props.flow; var first_line = [ - "HTTP/"+ flow.response.httpversion.join("."), - flow.response.code, - flow.response.msg - ].join(" "); + "HTTP/" + flow.response.httpversion.join("."), + flow.response.code, + flow.response.msg + ].join(" "); var content = null; - if(flow.response.contentLength > 0){ - content = "Response Content Size: "+ formatSize(flow.response.contentLength); + if (flow.response.contentLength > 0) { + content = "Response Content Size: " + formatSize(flow.response.contentLength); } else { - content = React.DOM.div({className: "alert alert-info"}, "No Content"); + content = React.createElement("div", {className: "alert alert-info"}, "No Content"); } //TODO: Styling return ( - React.DOM.section(null, - React.DOM.div({className: "first-line"}, first_line ), - Headers({message: flow.response}), - React.DOM.hr(null), + React.createElement("section", null, + React.createElement("div", {className: "first-line"}, first_line ), + React.createElement(Headers, {message: flow.response}), + React.createElement("hr", null), content ) ); } }); +var FlowDetailError = React.createClass({displayName: 'FlowDetailError', + render: function () { + var flow = this.props.flow; + return ( + React.createElement("section", null, + React.createElement("div", {className: "alert alert-warning"}, + flow.error.msg, + React.createElement("div", null, React.createElement("small", null, formatTimeStamp(flow.error.timestamp) )) + ) + ) + ); + } +}); + var TimeStamp = React.createClass({displayName: 'TimeStamp', - render: function() { + render: function () { - if(!this.props.t){ + if (!this.props.t) { //should be return null, but that triggers a React bug. - return React.DOM.tr(null); + return React.createElement("tr", null); } - var ts = (new Date(this.props.t * 1000)).toISOString(); - ts = ts.replace("T", " ").replace("Z",""); + var ts = formatTimeStamp(this.props.t); var delta; - if(this.props.deltaTo){ - delta = formatTimeDelta(1000 * (this.props.t-this.props.deltaTo)); - delta = React.DOM.span({className: "text-muted"}, "(" + delta + ")"); + if (this.props.deltaTo) { + delta = formatTimeDelta(1000 * (this.props.t - this.props.deltaTo)); + delta = React.createElement("span", {className: "text-muted"}, "(" + delta + ")"); } else { delta = null; } - return React.DOM.tr(null, React.DOM.td(null, this.props.title + ":"), React.DOM.td(null, ts, " ", delta)); + return React.createElement("tr", null, + React.createElement("td", null, this.props.title + ":"), + React.createElement("td", null, ts, " ", delta) + ); } }); var ConnectionInfo = React.createClass({displayName: 'ConnectionInfo', - render: function() { + render: function () { var conn = this.props.conn; var address = conn.address.address.join(":"); - var sni = React.DOM.tr({key: "sni"}); //should be null, but that triggers a React bug. - if(conn.sni){ - sni = React.DOM.tr({key: "sni"}, React.DOM.td(null, React.DOM.abbr({title: "TLS Server Name Indication"}, "TLS SNI:")), React.DOM.td(null, conn.sni)); + var sni = React.createElement("tr", {key: "sni"}); //should be null, but that triggers a React bug. + if (conn.sni) { + sni = React.createElement("tr", {key: "sni"}, + React.createElement("td", null, + React.createElement("abbr", {title: "TLS Server Name Indication"}, "TLS SNI:") + ), + React.createElement("td", null, conn.sni) + ); } return ( - React.DOM.table({className: "connection-table"}, - React.DOM.tbody(null, - React.DOM.tr({key: "address"}, React.DOM.td(null, "Address:"), React.DOM.td(null, address)), + React.createElement("table", {className: "connection-table"}, + React.createElement("tbody", null, + React.createElement("tr", {key: "address"}, + React.createElement("td", null, "Address:"), + React.createElement("td", null, address) + ), sni ) ) @@ -1052,7 +1347,7 @@ var ConnectionInfo = React.createClass({displayName: 'ConnectionInfo', }); var CertificateInfo = React.createClass({displayName: 'CertificateInfo', - render: function(){ + render: function () { //TODO: We should fetch human-readable certificate representation // from the server var flow = this.props.flow; @@ -1061,19 +1356,19 @@ var CertificateInfo = React.createClass({displayName: 'CertificateInfo', var preStyle = {maxHeight: 100}; return ( - React.DOM.div(null, - client_conn.cert ? React.DOM.h4(null, "Client Certificate") : null, - client_conn.cert ? React.DOM.pre({style: preStyle}, client_conn.cert) : null, + React.createElement("div", null, + client_conn.cert ? React.createElement("h4", null, "Client Certificate") : null, + client_conn.cert ? React.createElement("pre", {style: preStyle}, client_conn.cert) : null, - server_conn.cert ? React.DOM.h4(null, "Server Certificate") : null, - server_conn.cert ? React.DOM.pre({style: preStyle}, server_conn.cert) : null + server_conn.cert ? React.createElement("h4", null, "Server Certificate") : null, + server_conn.cert ? React.createElement("pre", {style: preStyle}, server_conn.cert) : null ) ); } }); var Timing = React.createClass({displayName: 'Timing', - render: function(){ + render: function () { var flow = this.props.flow; var sc = flow.server_conn; var cc = flow.client_conn; @@ -1126,147 +1421,198 @@ var Timing = React.createClass({displayName: 'Timing', } //Add unique key for each row. - timestamps.forEach(function(e){ + timestamps.forEach(function (e) { e.key = e.title; }); timestamps = _.sortBy(timestamps, 't'); - var rows = timestamps.map(function(e){ - return TimeStamp(e); + var rows = timestamps.map(function (e) { + return React.createElement(TimeStamp, React.__spread({}, e)); }); return ( - React.DOM.div(null, - React.DOM.h4(null, "Timing"), - React.DOM.table({className: "timing-table"}, - React.DOM.tbody(null, + React.createElement("div", null, + React.createElement("h4", null, "Timing"), + React.createElement("table", {className: "timing-table"}, + React.createElement("tbody", null, rows + ) ) ) - ) ); } }); var FlowDetailConnectionInfo = React.createClass({displayName: 'FlowDetailConnectionInfo', - render: function(){ + render: function () { var flow = this.props.flow; var client_conn = flow.client_conn; var server_conn = flow.server_conn; return ( - React.DOM.section(null, + React.createElement("section", null, - React.DOM.h4(null, "Client Connection"), - ConnectionInfo({conn: client_conn}), + React.createElement("h4", null, "Client Connection"), + React.createElement(ConnectionInfo, {conn: client_conn}), - React.DOM.h4(null, "Server Connection"), - ConnectionInfo({conn: server_conn}), + React.createElement("h4", null, "Server Connection"), + React.createElement(ConnectionInfo, {conn: server_conn}), - CertificateInfo({flow: flow}), + React.createElement(CertificateInfo, {flow: flow}), - Timing({flow: flow}) + React.createElement(Timing, {flow: flow}) ) ); } }); -var tabs = { +var allTabs = { request: FlowDetailRequest, response: FlowDetailResponse, + error: FlowDetailError, details: FlowDetailConnectionInfo }; var FlowDetail = React.createClass({displayName: 'FlowDetail', - getDefaultProps: function(){ - return { - tabs: ["request","response", "details"] - }; + mixins: [StickyHeadMixin, ReactRouter.Navigation, ReactRouter.State], + getTabs: function (flow) { + var tabs = []; + ["request", "response", "error"].forEach(function (e) { + if (flow[e]) { + tabs.push(e); + } + }); + tabs.push("details"); + return tabs; }, - mixins: [StickyHeadMixin], - nextTab: function(i) { - var currentIndex = this.props.tabs.indexOf(this.props.active); + nextTab: function (i) { + var tabs = this.getTabs(this.props.flow); + var currentIndex = tabs.indexOf(this.getParams().detailTab); // JS modulo operator doesn't correct negative numbers, make sure that we are positive. - var nextIndex = (currentIndex + i + this.props.tabs.length) % this.props.tabs.length; - this.props.selectTab(this.props.tabs[nextIndex]); + var nextIndex = (currentIndex + i + tabs.length) % tabs.length; + this.selectTab(tabs[nextIndex]); + }, + selectTab: function (panel) { + this.replaceWith( + "flow", + { + flowId: this.getParams().flowId, + detailTab: panel + } + ); }, - render: function(){ - var flow = JSON.stringify(this.props.flow, null, 2); - var Tab = tabs[this.props.active]; + render: function () { + var flow = this.props.flow; + var tabs = this.getTabs(flow); + var active = this.getParams().detailTab; + + if (!_.contains(tabs, active)) { + if (active === "response" && flow.error) { + active = "error"; + } else if (active === "error" && flow.response) { + active = "response"; + } else { + active = tabs[0]; + } + this.selectTab(active); + } + + var Tab = allTabs[active]; return ( - React.DOM.div({className: "flow-detail", onScroll: this.adjustHead}, - FlowDetailNav({ref: "head", - tabs: this.props.tabs, - active: this.props.active, - selectTab: this.props.selectTab}), - Tab({flow: this.props.flow}) + React.createElement("div", {className: "flow-detail", onScroll: this.adjustHead}, + React.createElement(FlowDetailNav, {ref: "head", + tabs: tabs, + active: active, + selectTab: this.selectTab}), + React.createElement(Tab, {flow: flow}) ) - ); - } + ); + } }); -/** @jsx React.DOM */ - var MainView = React.createClass({displayName: 'MainView', - getInitialState: function() { + mixins: [ReactRouter.Navigation, ReactRouter.State], + getInitialState: function () { return { - flows: [], + flows: [] }; }, - componentDidMount: function () { - this.flowStore = FlowStore.getView(); - this.flowStore.addListener("change",this.onFlowChange); - }, - componentWillUnmount: function () { - this.flowStore.removeListener("change",this.onFlowChange); - this.flowStore.close(); + componentWillReceiveProps: function (nextProps) { + if (nextProps.flowStore !== this.props.flowStore) { + this.closeView(); + this.openView(nextProps.flowStore); + } }, - onFlowChange: function () { + openView: function (store) { + var view = new StoreView(store); this.setState({ - flows: this.flowStore.getAll() + view: view }); + + view.addListener("recalculate", this.onRecalculate); + view.addListener("add update remove", this.onUpdate); }, - selectDetailTab: function(panel) { - ReactRouter.replaceWith( - "flow", - { - flowId: this.props.params.flowId, - detailTab: panel - } - ); + onRecalculate: function(){ + this.forceUpdate(); + var selected = this.getSelected(); + if(selected){ + this.refs.flowTable.scrollIntoView(selected); + } + }, + onUpdate: function (flow) { + if (flow.id === this.getParams().flowId) { + this.forceUpdate(); + } + }, + closeView: function () { + this.state.view.close(); + }, + componentWillMount: function () { + this.openView(this.props.flowStore); }, - selectFlow: function(flow) { - if(flow){ - ReactRouter.replaceWith( - "flow", + componentWillUnmount: function () { + this.closeView(); + }, + selectFlow: function (flow) { + if (flow) { + this.replaceWith( + "flow", { flowId: flow.id, - detailTab: this.props.params.detailTab || "request" + detailTab: this.getParams().detailTab || "request" } ); this.refs.flowTable.scrollIntoView(flow); } else { - ReactRouter.replaceWith("flows"); + this.replaceWith("flows"); } }, - selectFlowRelative: function(i){ + selectFlowRelative: function (shift) { + var flows = this.state.view.list; var index; - if(!this.props.params.flowId){ - if(i > 0){ - index = this.state.flows.length-1; + if (!this.getParams().flowId) { + if (shift > 0) { + index = flows.length - 1; } else { index = 0; } } else { - index = _.findIndex(this.state.flows, function(f){ - return f.id === this.props.params.flowId; - }.bind(this)); - index = Math.min(Math.max(0, index+i), this.state.flows.length-1); + var currFlowId = this.getParams().flowId; + var i = flows.length; + while (i--) { + if (flows[i].id === currFlowId) { + index = i; + break; + } + } + index = Math.min( + Math.max(0, index + shift), + flows.length - 1); } - this.selectFlow(this.state.flows[index]); + this.selectFlow(flows[index]); }, - onKeyDown: function(e){ - switch(e.keyCode){ + onKeyDown: function (e) { + switch (e.keyCode) { case Key.K: case Key.UP: this.selectFlowRelative(-1); @@ -1287,14 +1633,14 @@ var MainView = React.createClass({displayName: 'MainView', break; case Key.H: case Key.LEFT: - if(this.refs.flowDetails){ + if (this.refs.flowDetails) { this.refs.flowDetails.nextTab(-1); } break; case Key.L: case Key.TAB: case Key.RIGHT: - if(this.refs.flowDetails){ + if (this.refs.flowDetails) { this.refs.flowDetails.nextTab(+1); } break; @@ -1302,98 +1648,128 @@ var MainView = React.createClass({displayName: 'MainView', console.debug("keydown", e.keyCode); return; } - return false; + e.preventDefault(); }, - render: function() { - var selected = _.find(this.state.flows, { id: this.props.params.flowId }); + getSelected: function(){ + return this.props.flowStore.get(this.getParams().flowId); + }, + render: function () { + var selected = this.getSelected(); var details; - if(selected){ - details = ( - FlowDetail({ref: "flowDetails", - flow: selected, - selectTab: this.selectDetailTab, - active: this.props.params.detailTab}) - ); + if (selected) { + details = [ + React.createElement(Splitter, {key: "splitter"}), + React.createElement(FlowDetail, {key: "flowDetails", ref: "flowDetails", flow: selected}) + ]; } else { details = null; } return ( - React.DOM.div({className: "main-view", onKeyDown: this.onKeyDown, tabIndex: "0"}, - FlowTable({ref: "flowTable", - flows: this.state.flows, - selectFlow: this.selectFlow, - selected: selected}), - details ? Splitter(null) : null, + React.createElement("div", {className: "main-view", onKeyDown: this.onKeyDown, tabIndex: "0"}, + React.createElement(FlowTable, {ref: "flowTable", + view: this.state.view, + selectFlow: this.selectFlow, + selected: selected}), details ) ); } }); -/** @jsx React.DOM */ - var LogMessage = React.createClass({displayName: 'LogMessage', - render: function(){ + render: function () { var entry = this.props.entry; var indicator; - switch(entry.level){ + switch (entry.level) { case "web": - indicator = React.DOM.i({className: "fa fa-fw fa-html5"}); + indicator = React.createElement("i", {className: "fa fa-fw fa-html5"}); break; case "debug": - indicator = React.DOM.i({className: "fa fa-fw fa-bug"}); + indicator = React.createElement("i", {className: "fa fa-fw fa-bug"}); break; default: - indicator = React.DOM.i({className: "fa fa-fw fa-info"}); + indicator = React.createElement("i", {className: "fa fa-fw fa-info"}); } return ( - React.DOM.div(null, + React.createElement("div", null, indicator, " ", entry.message ) ); }, - shouldComponentUpdate: function(){ + shouldComponentUpdate: function () { return false; // log entries are immutable. } }); var EventLogContents = React.createClass({displayName: 'EventLogContents', - mixins:[AutoScrollMixin], + mixins: [AutoScrollMixin, VirtualScrollMixin], getInitialState: function () { return { log: [] }; }, - componentDidMount: function () { - this.log = EventLogStore.getView(); - this.log.addListener("change", this.onEventLogChange); + componentWillMount: function () { + this.openView(this.props.eventStore); }, componentWillUnmount: function () { - this.log.removeListener("change", this.onEventLogChange); - this.log.close(); + this.closeView(); + }, + openView: function (store) { + var view = new StoreView(store, function (entry) { + return this.props.filter[entry.level]; + }.bind(this)); + this.setState({ + view: view + }); + + view.addListener("add recalculate", this.onEventLogChange); + }, + closeView: function () { + this.state.view.close(); }, onEventLogChange: function () { this.setState({ - log: this.log.getAll() + log: this.state.view.list }); }, + componentWillReceiveProps: function (nextProps) { + if (nextProps.filter !== this.props.filter) { + this.props.filter = nextProps.filter; // Dirty: Make sure that view filter sees the update. + this.state.view.recalculate(this.props.eventStore.list); + } + if (nextProps.eventStore !== this.props.eventStore) { + this.closeView(); + this.openView(nextProps.eventStore); + } + }, + getDefaultProps: function () { + return { + rowHeight: 45, + rowHeightMin: 15, + placeholderTagName: "div" + }; + }, + renderRow: function (elem) { + return React.createElement(LogMessage, {key: elem.id, entry: elem}); + }, render: function () { - var messages = this.state.log.map(function(row) { - if(!this.props.filter[row.level]){ - return null; - } - return LogMessage({key: row.id, entry: row}); - }.bind(this)); - return React.DOM.pre(null, messages); + var rows = this.renderRows(this.state.log); + + return React.createElement("pre", {onScroll: this.onScroll}, + this.getPlaceholderTop(this.state.log.length), + rows, + this.getPlaceholderBottom(this.state.log.length) + ); } }); var ToggleFilter = React.createClass({displayName: 'ToggleFilter', - toggle: function(){ + toggle: function (e) { + e.preventDefault(); return this.props.toggleLevel(this.props.name); }, - render: function(){ + render: function () { var className = "label "; if (this.props.active) { className += "label-primary"; @@ -1401,18 +1777,18 @@ var ToggleFilter = React.createClass({displayName: 'ToggleFilter', className += "label-default"; } return ( - React.DOM.a({ + React.createElement("a", { href: "#", className: className, onClick: this.toggle}, this.props.name ) ); - } + } }); var EventLog = React.createClass({displayName: 'EventLog', - getInitialState: function(){ + getInitialState: function () { return { filter: { "debug": false, @@ -1426,99 +1802,119 @@ var EventLog = React.createClass({displayName: 'EventLog', showEventLog: false }); }, - toggleLevel: function(level){ - var filter = this.state.filter; + toggleLevel: function (level) { + var filter = _.extend({}, this.state.filter); filter[level] = !filter[level]; this.setState({filter: filter}); - return false; }, render: function () { return ( - React.DOM.div({className: "eventlog"}, - React.DOM.div(null, + React.createElement("div", {className: "eventlog"}, + React.createElement("div", null, "Eventlog", - React.DOM.div({className: "pull-right"}, - ToggleFilter({name: "debug", active: this.state.filter.debug, toggleLevel: this.toggleLevel}), - ToggleFilter({name: "info", active: this.state.filter.info, toggleLevel: this.toggleLevel}), - ToggleFilter({name: "web", active: this.state.filter.web, toggleLevel: this.toggleLevel}), - React.DOM.i({onClick: this.close, className: "fa fa-close"}) + React.createElement("div", {className: "pull-right"}, + React.createElement(ToggleFilter, {name: "debug", active: this.state.filter.debug, toggleLevel: this.toggleLevel}), + React.createElement(ToggleFilter, {name: "info", active: this.state.filter.info, toggleLevel: this.toggleLevel}), + React.createElement(ToggleFilter, {name: "web", active: this.state.filter.web, toggleLevel: this.toggleLevel}), + React.createElement("i", {onClick: this.close, className: "fa fa-close"}) ) ), - EventLogContents({filter: this.state.filter}) + React.createElement(EventLogContents, {filter: this.state.filter, eventStore: this.props.eventStore}) ) ); } }); -/** @jsx React.DOM */ - var Footer = React.createClass({displayName: 'Footer', render: function () { var mode = this.props.settings.mode; return ( - React.DOM.footer(null, - mode != "regular" ? React.DOM.span({className: "label label-success"}, mode, " mode") : null + React.createElement("footer", null, + mode != "regular" ? React.createElement("span", {className: "label label-success"}, mode, " mode") : null ) - ); + ); } }); -/** @jsx React.DOM */ - //TODO: Move out of here, just a stub. var Reports = React.createClass({displayName: 'Reports', render: function () { - return React.DOM.div(null, "ReportEditor"); + return React.createElement("div", null, "ReportEditor"); } }); var ProxyAppMain = React.createClass({displayName: 'ProxyAppMain', getInitialState: function () { - return { settings: SettingsStore.getAll() }; + var eventStore = new EventLogStore(); + var flowStore = new FlowStore(); + var settings = new SettingsStore(); + + // Default Settings before fetch + _.extend(settings.dict,{ + showEventLog: true + }); + return { + settings: settings, + flowStore: flowStore, + eventStore: eventStore + }; }, componentDidMount: function () { - SettingsStore.addListener("change", this.onSettingsChange); + this.state.settings.addListener("recalculate", this.onSettingsChange); }, componentWillUnmount: function () { - SettingsStore.removeListener("change", this.onSettingsChange); + this.state.settings.removeListener("recalculate", this.onSettingsChange); }, - onSettingsChange: function () { - this.setState({settings: SettingsStore.getAll()}); + onSettingsChange: function(){ + this.setState({ + settings: this.state.settings + }); }, render: function () { + + var eventlog; + if (this.state.settings.dict.showEventLog) { + eventlog = [ + React.createElement(Splitter, {key: "splitter", axis: "y"}), + React.createElement(EventLog, {key: "eventlog", eventStore: this.state.eventStore}) + ]; + } else { + eventlog = null; + } + return ( - React.DOM.div({id: "container"}, - Header({settings: this.state.settings}), - this.props.activeRouteHandler({settings: this.state.settings}), - this.state.settings.showEventLog ? Splitter({axis: "y"}) : null, - this.state.settings.showEventLog ? EventLog(null) : null, - Footer({settings: this.state.settings}) + React.createElement("div", {id: "container"}, + React.createElement(Header, {settings: this.state.settings.dict}), + React.createElement(RouteHandler, {settings: this.state.settings.dict, flowStore: this.state.flowStore}), + eventlog, + React.createElement(Footer, {settings: this.state.settings.dict}) ) - ); + ); } }); -var Routes = ReactRouter.Routes; var Route = ReactRouter.Route; +var RouteHandler = ReactRouter.RouteHandler; var Redirect = ReactRouter.Redirect; var DefaultRoute = ReactRouter.DefaultRoute; var NotFoundRoute = ReactRouter.NotFoundRoute; -var ProxyApp = ( - Routes({location: "hash"}, - Route({path: "/", handler: ProxyAppMain}, - Route({name: "flows", path: "flows", handler: MainView}), - Route({name: "flow", path: "flows/:flowId/:detailTab", handler: MainView}), - Route({name: "reports", handler: Reports}), - Redirect({path: "/", to: "flows"}) - ) +var routes = ( + React.createElement(Route, {path: "/", handler: ProxyAppMain}, + React.createElement(Route, {name: "flows", path: "flows", handler: MainView}), + React.createElement(Route, {name: "flow", path: "flows/:flowId/:detailTab", handler: MainView}), + React.createElement(Route, {name: "reports", handler: Reports}), + React.createElement(Redirect, {path: "/", to: "flows"}) ) - ); +); $(function () { - Connection.init(); - app = React.renderComponent(ProxyApp, document.body); + window.ws = new Connection("/updates"); + + ReactRouter.run(routes, function (Handler) { + React.render(React.createElement(Handler, null), document.body); + }); }); //# sourceMappingURL=app.js.map
\ No newline at end of file diff --git a/libmproxy/web/static/js/vendor.js b/libmproxy/web/static/js/vendor.js index c4a12946..7d65bd88 100644 --- a/libmproxy/web/static/js/vendor.js +++ b/libmproxy/web/static/js/vendor.js @@ -15976,23 +15976,68 @@ return jQuery; }.call(this)); /** - * React (with addons) v0.11.1 + * React (with addons) v0.12.1 */ -!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var f;"undefined"!=typeof window?f=window:"undefined"!=typeof global?f=global:"undefined"!=typeof self&&(f=self),f.React=e()}}(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);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(_dereq_,module,exports){ +!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var f;"undefined"!=typeof window?f=window:"undefined"!=typeof global?f=global:"undefined"!=typeof self&&(f=self),f.React=e()}}(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * 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 + * 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. * - * http://www.apache.org/licenses/LICENSE-2.0 + * @providesModule ReactWithAddons + */ + +/** + * This module exists purely in the open source project, and is meant as a way + * to create a separate standalone build of React. This build has "addons", or + * functionality we've built and think might be useful but doesn't have a good + * place to live inside React core. + */ + +"use strict"; + +var LinkedStateMixin = _dereq_("./LinkedStateMixin"); +var React = _dereq_("./React"); +var ReactComponentWithPureRenderMixin = + _dereq_("./ReactComponentWithPureRenderMixin"); +var ReactCSSTransitionGroup = _dereq_("./ReactCSSTransitionGroup"); +var ReactTransitionGroup = _dereq_("./ReactTransitionGroup"); +var ReactUpdates = _dereq_("./ReactUpdates"); + +var cx = _dereq_("./cx"); +var cloneWithProps = _dereq_("./cloneWithProps"); +var update = _dereq_("./update"); + +React.addons = { + CSSTransitionGroup: ReactCSSTransitionGroup, + LinkedStateMixin: LinkedStateMixin, + PureRenderMixin: ReactComponentWithPureRenderMixin, + TransitionGroup: ReactTransitionGroup, + + batchedUpdates: ReactUpdates.batchedUpdates, + classSet: cx, + cloneWithProps: cloneWithProps, + update: update +}; + +if ("production" !== "development") { + React.addons.Perf = _dereq_("./ReactDefaultPerf"); + React.addons.TestUtils = _dereq_("./ReactTestUtils"); +} + +module.exports = React; + +},{"./LinkedStateMixin":25,"./React":31,"./ReactCSSTransitionGroup":34,"./ReactComponentWithPureRenderMixin":39,"./ReactDefaultPerf":56,"./ReactTestUtils":86,"./ReactTransitionGroup":90,"./ReactUpdates":91,"./cloneWithProps":113,"./cx":118,"./update":159}],2:[function(_dereq_,module,exports){ +/** + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * 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. + * 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. * * @providesModule AutoFocusMixin * @typechecks static-only @@ -16012,21 +16057,14 @@ var AutoFocusMixin = { module.exports = AutoFocusMixin; -},{"./focusNode":120}],2:[function(_dereq_,module,exports){ +},{"./focusNode":125}],3:[function(_dereq_,module,exports){ /** * Copyright 2013 Facebook, Inc. + * All rights reserved. * - * 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. + * 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. * * @providesModule BeforeInputEventPlugin * @typechecks static-only @@ -16084,6 +16122,9 @@ var eventTypes = { // Track characters inserted via keypress and composition events. var fallbackChars = null; +// Track whether we've ever handled a keypress on the space key. +var hasSpaceKeypress = false; + /** * Return whether a native keypress event is assumed to be a command. * This is required because Firefox fires `keypress` events for key commands @@ -16153,7 +16194,8 @@ var BeforeInputEventPlugin = { return; } - chars = String.fromCharCode(which); + hasSpaceKeypress = true; + chars = SPACEBAR_CHAR; break; case topLevelTypes.topTextInput: @@ -16161,8 +16203,9 @@ var BeforeInputEventPlugin = { chars = nativeEvent.data; // If it's a spacebar character, assume that we have already handled - // it at the keypress level and bail immediately. - if (chars === SPACEBAR_CHAR) { + // it at the keypress level and bail immediately. Android Chrome + // doesn't give us keycodes, so we need to blacklist it. + if (chars === SPACEBAR_CHAR && hasSpaceKeypress) { return; } @@ -16236,21 +16279,14 @@ var BeforeInputEventPlugin = { module.exports = BeforeInputEventPlugin; -},{"./EventConstants":16,"./EventPropagators":21,"./ExecutionEnvironment":22,"./SyntheticInputEvent":98,"./keyOf":141}],3:[function(_dereq_,module,exports){ +},{"./EventConstants":17,"./EventPropagators":22,"./ExecutionEnvironment":23,"./SyntheticInputEvent":101,"./keyOf":147}],4:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * 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 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * 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. + * 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. * * @providesModule CSSCore * @typechecks @@ -16336,7 +16372,7 @@ var CSSCore = { * * @param {DOMNode|DOMWindow} element the element to set the class on * @param {string} className the CSS className - * @returns {boolean} true if the element has the class, false if not + * @return {boolean} true if the element has the class, false if not */ hasClass: function(element, className) { ("production" !== "development" ? invariant( @@ -16353,21 +16389,14 @@ var CSSCore = { module.exports = CSSCore; -},{"./invariant":134}],4:[function(_dereq_,module,exports){ +},{"./invariant":140}],5:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * 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 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * 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. + * 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. * * @providesModule CSSProperty */ @@ -16476,21 +16505,14 @@ var CSSProperty = { module.exports = CSSProperty; -},{}],5:[function(_dereq_,module,exports){ +},{}],6:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * 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 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * 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. + * 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. * * @providesModule CSSPropertyOperations * @typechecks static-only @@ -16499,15 +16521,43 @@ module.exports = CSSProperty; "use strict"; var CSSProperty = _dereq_("./CSSProperty"); +var ExecutionEnvironment = _dereq_("./ExecutionEnvironment"); +var camelizeStyleName = _dereq_("./camelizeStyleName"); var dangerousStyleValue = _dereq_("./dangerousStyleValue"); var hyphenateStyleName = _dereq_("./hyphenateStyleName"); var memoizeStringOnly = _dereq_("./memoizeStringOnly"); +var warning = _dereq_("./warning"); var processStyleName = memoizeStringOnly(function(styleName) { return hyphenateStyleName(styleName); }); +var styleFloatAccessor = 'cssFloat'; +if (ExecutionEnvironment.canUseDOM) { + // IE8 only supports accessing cssFloat (standard) as styleFloat + if (document.documentElement.style.cssFloat === undefined) { + styleFloatAccessor = 'styleFloat'; + } +} + +if ("production" !== "development") { + var warnedStyleNames = {}; + + var warnHyphenatedStyleName = function(name) { + if (warnedStyleNames.hasOwnProperty(name) && warnedStyleNames[name]) { + return; + } + + warnedStyleNames[name] = true; + ("production" !== "development" ? warning( + false, + 'Unsupported style property ' + name + '. Did you mean ' + + camelizeStyleName(name) + '?' + ) : null); + }; +} + /** * Operations for dealing with CSS properties. */ @@ -16531,6 +16581,11 @@ var CSSPropertyOperations = { if (!styles.hasOwnProperty(styleName)) { continue; } + if ("production" !== "development") { + if (styleName.indexOf('-') > -1) { + warnHyphenatedStyleName(styleName); + } + } var styleValue = styles[styleName]; if (styleValue != null) { serialized += processStyleName(styleName) + ':'; @@ -16553,7 +16608,15 @@ var CSSPropertyOperations = { if (!styles.hasOwnProperty(styleName)) { continue; } + if ("production" !== "development") { + if (styleName.indexOf('-') > -1) { + warnHyphenatedStyleName(styleName); + } + } var styleValue = dangerousStyleValue(styleName, styles[styleName]); + if (styleName === 'float') { + styleName = styleFloatAccessor; + } if (styleValue) { style[styleName] = styleValue; } else { @@ -16575,21 +16638,14 @@ var CSSPropertyOperations = { module.exports = CSSPropertyOperations; -},{"./CSSProperty":4,"./dangerousStyleValue":115,"./hyphenateStyleName":132,"./memoizeStringOnly":143}],6:[function(_dereq_,module,exports){ +},{"./CSSProperty":5,"./ExecutionEnvironment":23,"./camelizeStyleName":112,"./dangerousStyleValue":119,"./hyphenateStyleName":138,"./memoizeStringOnly":149,"./warning":160}],7:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * 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 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * 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. + * 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. * * @providesModule CallbackQueue */ @@ -16598,8 +16654,8 @@ module.exports = CSSPropertyOperations; var PooledClass = _dereq_("./PooledClass"); +var assign = _dereq_("./Object.assign"); var invariant = _dereq_("./invariant"); -var mixInto = _dereq_("./mixInto"); /** * A specialized pseudo-event module to help keep track of components waiting to @@ -16617,7 +16673,7 @@ function CallbackQueue() { this._contexts = null; } -mixInto(CallbackQueue, { +assign(CallbackQueue.prototype, { /** * Enqueues a callback to be invoked when `notifyAll` is invoked. @@ -16680,21 +16736,14 @@ PooledClass.addPoolingTo(CallbackQueue); module.exports = CallbackQueue; -},{"./PooledClass":28,"./invariant":134,"./mixInto":147}],7:[function(_dereq_,module,exports){ +},{"./Object.assign":29,"./PooledClass":30,"./invariant":140}],8:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * 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 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * 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. + * 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. * * @providesModule ChangeEventPlugin */ @@ -17069,21 +17118,14 @@ var ChangeEventPlugin = { module.exports = ChangeEventPlugin; -},{"./EventConstants":16,"./EventPluginHub":18,"./EventPropagators":21,"./ExecutionEnvironment":22,"./ReactUpdates":87,"./SyntheticEvent":96,"./isEventSupported":135,"./isTextInputElement":137,"./keyOf":141}],8:[function(_dereq_,module,exports){ +},{"./EventConstants":17,"./EventPluginHub":19,"./EventPropagators":22,"./ExecutionEnvironment":23,"./ReactUpdates":91,"./SyntheticEvent":99,"./isEventSupported":141,"./isTextInputElement":143,"./keyOf":147}],9:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * 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 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * 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. + * 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. * * @providesModule ClientReactRootIndex * @typechecks @@ -17101,21 +17143,14 @@ var ClientReactRootIndex = { module.exports = ClientReactRootIndex; -},{}],9:[function(_dereq_,module,exports){ +},{}],10:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * 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 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * 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. + * 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. * * @providesModule CompositionEventPlugin * @typechecks static-only @@ -17367,21 +17402,14 @@ var CompositionEventPlugin = { module.exports = CompositionEventPlugin; -},{"./EventConstants":16,"./EventPropagators":21,"./ExecutionEnvironment":22,"./ReactInputSelection":63,"./SyntheticCompositionEvent":94,"./getTextContentAccessor":129,"./keyOf":141}],10:[function(_dereq_,module,exports){ +},{"./EventConstants":17,"./EventPropagators":22,"./ExecutionEnvironment":23,"./ReactInputSelection":65,"./SyntheticCompositionEvent":97,"./getTextContentAccessor":135,"./keyOf":147}],11:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * 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 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * 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. + * 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. * * @providesModule DOMChildrenOperations * @typechecks static-only @@ -17489,9 +17517,9 @@ var DOMChildrenOperations = { 'processUpdates(): Unable to find child %s of element. This ' + 'probably means the DOM was unexpectedly mutated (e.g., by the ' + 'browser), usually due to forgetting a <tbody> when using tables, ' + - 'nesting <p> or <a> tags, or using non-SVG elements in an <svg> '+ - 'parent. Try inspecting the child nodes of the element with React ' + - 'ID `%s`.', + 'nesting tags like <form>, <p>, or <a>, or using non-SVG elements '+ + 'in an <svg> parent. Try inspecting the child nodes of the element ' + + 'with React ID `%s`.', updatedIndex, parentID ) : invariant(updatedChild)); @@ -17547,21 +17575,14 @@ var DOMChildrenOperations = { module.exports = DOMChildrenOperations; -},{"./Danger":13,"./ReactMultiChildUpdateTypes":69,"./getTextContentAccessor":129,"./invariant":134}],11:[function(_dereq_,module,exports){ +},{"./Danger":14,"./ReactMultiChildUpdateTypes":72,"./getTextContentAccessor":135,"./invariant":140}],12:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * 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 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * 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. + * 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. * * @providesModule DOMProperty * @typechecks static-only @@ -17573,6 +17594,10 @@ module.exports = DOMChildrenOperations; var invariant = _dereq_("./invariant"); +function checkMask(value, bitmask) { + return (value & bitmask) === bitmask; +} + var DOMPropertyInjection = { /** * Mapping from normalized, camelcased property names to a configuration that @@ -17659,19 +17684,19 @@ var DOMPropertyInjection = { var propConfig = Properties[propName]; DOMProperty.mustUseAttribute[propName] = - propConfig & DOMPropertyInjection.MUST_USE_ATTRIBUTE; + checkMask(propConfig, DOMPropertyInjection.MUST_USE_ATTRIBUTE); DOMProperty.mustUseProperty[propName] = - propConfig & DOMPropertyInjection.MUST_USE_PROPERTY; + checkMask(propConfig, DOMPropertyInjection.MUST_USE_PROPERTY); DOMProperty.hasSideEffects[propName] = - propConfig & DOMPropertyInjection.HAS_SIDE_EFFECTS; + checkMask(propConfig, DOMPropertyInjection.HAS_SIDE_EFFECTS); DOMProperty.hasBooleanValue[propName] = - propConfig & DOMPropertyInjection.HAS_BOOLEAN_VALUE; + checkMask(propConfig, DOMPropertyInjection.HAS_BOOLEAN_VALUE); DOMProperty.hasNumericValue[propName] = - propConfig & DOMPropertyInjection.HAS_NUMERIC_VALUE; + checkMask(propConfig, DOMPropertyInjection.HAS_NUMERIC_VALUE); DOMProperty.hasPositiveNumericValue[propName] = - propConfig & DOMPropertyInjection.HAS_POSITIVE_NUMERIC_VALUE; + checkMask(propConfig, DOMPropertyInjection.HAS_POSITIVE_NUMERIC_VALUE); DOMProperty.hasOverloadedBooleanValue[propName] = - propConfig & DOMPropertyInjection.HAS_OVERLOADED_BOOLEAN_VALUE; + checkMask(propConfig, DOMPropertyInjection.HAS_OVERLOADED_BOOLEAN_VALUE); ("production" !== "development" ? invariant( !DOMProperty.mustUseAttribute[propName] || @@ -17847,21 +17872,14 @@ var DOMProperty = { module.exports = DOMProperty; -},{"./invariant":134}],12:[function(_dereq_,module,exports){ +},{"./invariant":140}],13:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * 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 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * 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. + * 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. * * @providesModule DOMPropertyOperations * @typechecks static-only @@ -17988,10 +18006,17 @@ var DOMPropertyOperations = { } else if (shouldIgnoreValue(name, value)) { this.deleteValueForProperty(node, name); } else if (DOMProperty.mustUseAttribute[name]) { + // `setAttribute` with objects becomes only `[object]` in IE8/9, + // ('' + value) makes it output the correct toString()-value. node.setAttribute(DOMProperty.getAttributeName[name], '' + value); } else { var propName = DOMProperty.getPropertyName[name]; - if (!DOMProperty.hasSideEffects[name] || node[propName] !== value) { + // Must explicitly cast values for HAS_SIDE_EFFECTS-properties to the + // property type before comparing; only `value` does and is string. + if (!DOMProperty.hasSideEffects[name] || + ('' + node[propName]) !== ('' + value)) { + // Contrary to `setAttribute`, object properties are properly + // `toString`ed by IE8/9. node[propName] = value; } } @@ -18027,7 +18052,7 @@ var DOMPropertyOperations = { propName ); if (!DOMProperty.hasSideEffects[name] || - node[propName] !== defaultValue) { + ('' + node[propName]) !== defaultValue) { node[propName] = defaultValue; } } @@ -18042,21 +18067,14 @@ var DOMPropertyOperations = { module.exports = DOMPropertyOperations; -},{"./DOMProperty":11,"./escapeTextForBrowser":118,"./memoizeStringOnly":143,"./warning":158}],13:[function(_dereq_,module,exports){ +},{"./DOMProperty":12,"./escapeTextForBrowser":123,"./memoizeStringOnly":149,"./warning":160}],14:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * 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 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * 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. + * 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. * * @providesModule Danger * @typechecks static-only @@ -18105,9 +18123,10 @@ var Danger = { dangerouslyRenderMarkup: function(markupList) { ("production" !== "development" ? invariant( ExecutionEnvironment.canUseDOM, - 'dangerouslyRenderMarkup(...): Cannot render markup in a Worker ' + - 'thread. This is likely a bug in the framework. Please report ' + - 'immediately.' + 'dangerouslyRenderMarkup(...): Cannot render markup in a worker ' + + 'thread. Make sure `window` and `document` are available globally ' + + 'before requiring React when unit testing or use ' + + 'React.renderToString for server rendering.' ) : invariant(ExecutionEnvironment.canUseDOM)); var nodeName; var markupByNodeName = {}; @@ -18211,8 +18230,9 @@ var Danger = { ("production" !== "development" ? invariant( ExecutionEnvironment.canUseDOM, 'dangerouslyReplaceNodeWithMarkup(...): Cannot render markup in a ' + - 'worker thread. This is likely a bug in the framework. Please report ' + - 'immediately.' + 'worker thread. Make sure `window` and `document` are available ' + + 'globally before requiring React when unit testing or use ' + + 'React.renderToString for server rendering.' ) : invariant(ExecutionEnvironment.canUseDOM)); ("production" !== "development" ? invariant(markup, 'dangerouslyReplaceNodeWithMarkup(...): Missing markup.') : invariant(markup)); ("production" !== "development" ? invariant( @@ -18231,21 +18251,14 @@ var Danger = { module.exports = Danger; -},{"./ExecutionEnvironment":22,"./createNodesFromMarkup":113,"./emptyFunction":116,"./getMarkupWrap":126,"./invariant":134}],14:[function(_dereq_,module,exports){ +},{"./ExecutionEnvironment":23,"./createNodesFromMarkup":117,"./emptyFunction":121,"./getMarkupWrap":132,"./invariant":140}],15:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * 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 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * 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. + * 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. * * @providesModule DefaultEventPluginOrder */ @@ -18278,21 +18291,14 @@ var DefaultEventPluginOrder = [ module.exports = DefaultEventPluginOrder; -},{"./keyOf":141}],15:[function(_dereq_,module,exports){ +},{"./keyOf":147}],16:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * 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 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * 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. + * 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. * * @providesModule EnterLeaveEventPlugin * @typechecks static-only @@ -18425,21 +18431,14 @@ var EnterLeaveEventPlugin = { module.exports = EnterLeaveEventPlugin; -},{"./EventConstants":16,"./EventPropagators":21,"./ReactMount":67,"./SyntheticMouseEvent":100,"./keyOf":141}],16:[function(_dereq_,module,exports){ +},{"./EventConstants":17,"./EventPropagators":22,"./ReactMount":70,"./SyntheticMouseEvent":103,"./keyOf":147}],17:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * 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 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * 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. + * 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. * * @providesModule EventConstants */ @@ -18504,8 +18503,22 @@ var EventConstants = { module.exports = EventConstants; -},{"./keyMirror":140}],17:[function(_dereq_,module,exports){ +},{"./keyMirror":146}],18:[function(_dereq_,module,exports){ /** + * Copyright 2013-2014 Facebook, Inc. + * + * 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. + * * @providesModule EventListener * @typechecks */ @@ -18578,21 +18591,14 @@ var EventListener = { module.exports = EventListener; -},{"./emptyFunction":116}],18:[function(_dereq_,module,exports){ +},{"./emptyFunction":121}],19:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * 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 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * 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. + * 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. * * @providesModule EventPluginHub */ @@ -18602,11 +18608,9 @@ module.exports = EventListener; var EventPluginRegistry = _dereq_("./EventPluginRegistry"); var EventPluginUtils = _dereq_("./EventPluginUtils"); -var accumulate = _dereq_("./accumulate"); +var accumulateInto = _dereq_("./accumulateInto"); var forEachAccumulated = _dereq_("./forEachAccumulated"); var invariant = _dereq_("./invariant"); -var isEventSupported = _dereq_("./isEventSupported"); -var monitorCodeUse = _dereq_("./monitorCodeUse"); /** * Internal store for event listeners @@ -18740,15 +18744,6 @@ var EventPluginHub = { registrationName, typeof listener ) : invariant(!listener || typeof listener === 'function')); - if ("production" !== "development") { - // IE8 has no API for event capturing and the `onScroll` event doesn't - // bubble. - if (registrationName === 'onScroll' && - !isEventSupported('scroll', true)) { - monitorCodeUse('react_no_scroll_event'); - console.warn('This browser doesn\'t support the `onScroll` event'); - } - } var bankForRegistrationName = listenerBank[registrationName] || (listenerBank[registrationName] = {}); bankForRegistrationName[id] = listener; @@ -18817,7 +18812,7 @@ var EventPluginHub = { nativeEvent ); if (extractedEvents) { - events = accumulate(events, extractedEvents); + events = accumulateInto(events, extractedEvents); } } } @@ -18833,7 +18828,7 @@ var EventPluginHub = { */ enqueueEvents: function(events) { if (events) { - eventQueue = accumulate(eventQueue, events); + eventQueue = accumulateInto(eventQueue, events); } }, @@ -18870,21 +18865,14 @@ var EventPluginHub = { module.exports = EventPluginHub; -},{"./EventPluginRegistry":19,"./EventPluginUtils":20,"./accumulate":106,"./forEachAccumulated":121,"./invariant":134,"./isEventSupported":135,"./monitorCodeUse":148}],19:[function(_dereq_,module,exports){ +},{"./EventPluginRegistry":20,"./EventPluginUtils":21,"./accumulateInto":109,"./forEachAccumulated":126,"./invariant":140}],20:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * 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 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * 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. + * 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. * * @providesModule EventPluginRegistry * @typechecks static-only @@ -19155,21 +19143,14 @@ var EventPluginRegistry = { module.exports = EventPluginRegistry; -},{"./invariant":134}],20:[function(_dereq_,module,exports){ +},{"./invariant":140}],21:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * 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 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * 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. + * 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. * * @providesModule EventPluginUtils */ @@ -19381,21 +19362,14 @@ var EventPluginUtils = { module.exports = EventPluginUtils; -},{"./EventConstants":16,"./invariant":134}],21:[function(_dereq_,module,exports){ +},{"./EventConstants":17,"./invariant":140}],22:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * 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 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * 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. + * 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. * * @providesModule EventPropagators */ @@ -19405,7 +19379,7 @@ module.exports = EventPluginUtils; var EventConstants = _dereq_("./EventConstants"); var EventPluginHub = _dereq_("./EventPluginHub"); -var accumulate = _dereq_("./accumulate"); +var accumulateInto = _dereq_("./accumulateInto"); var forEachAccumulated = _dereq_("./forEachAccumulated"); var PropagationPhases = EventConstants.PropagationPhases; @@ -19436,8 +19410,9 @@ function accumulateDirectionalDispatches(domID, upwards, event) { var phase = upwards ? PropagationPhases.bubbled : PropagationPhases.captured; var listener = listenerAtPhase(domID, event, phase); if (listener) { - event._dispatchListeners = accumulate(event._dispatchListeners, listener); - event._dispatchIDs = accumulate(event._dispatchIDs, domID); + event._dispatchListeners = + accumulateInto(event._dispatchListeners, listener); + event._dispatchIDs = accumulateInto(event._dispatchIDs, domID); } } @@ -19469,8 +19444,9 @@ function accumulateDispatches(id, ignoredDirection, event) { var registrationName = event.dispatchConfig.registrationName; var listener = getListener(id, registrationName); if (listener) { - event._dispatchListeners = accumulate(event._dispatchListeners, listener); - event._dispatchIDs = accumulate(event._dispatchIDs, id); + event._dispatchListeners = + accumulateInto(event._dispatchListeners, listener); + event._dispatchIDs = accumulateInto(event._dispatchIDs, id); } } } @@ -19526,21 +19502,14 @@ var EventPropagators = { module.exports = EventPropagators; -},{"./EventConstants":16,"./EventPluginHub":18,"./accumulate":106,"./forEachAccumulated":121}],22:[function(_dereq_,module,exports){ +},{"./EventConstants":17,"./EventPluginHub":19,"./accumulateInto":109,"./forEachAccumulated":126}],23:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * 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 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * 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. + * 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. * * @providesModule ExecutionEnvironment */ @@ -19578,21 +19547,14 @@ var ExecutionEnvironment = { module.exports = ExecutionEnvironment; -},{}],23:[function(_dereq_,module,exports){ +},{}],24:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * 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 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * 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. + * 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. * * @providesModule HTMLDOMPropertyConfig */ @@ -19637,6 +19599,7 @@ var HTMLDOMPropertyConfig = { * Standard Properties */ accept: null, + acceptCharset: null, accessKey: null, action: null, allowFullScreen: MUST_USE_ATTRIBUTE | HAS_BOOLEAN_VALUE, @@ -19651,6 +19614,7 @@ var HTMLDOMPropertyConfig = { cellSpacing: null, charSet: MUST_USE_ATTRIBUTE, checked: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE, + classID: MUST_USE_ATTRIBUTE, // To set className on SVG elements, it's necessary to use .setAttribute; // this works on HTML elements too in all browsers except IE8. Conveniently, // IE8 doesn't support SVG and so we can simply use the attribute in @@ -19686,10 +19650,12 @@ var HTMLDOMPropertyConfig = { id: MUST_USE_PROPERTY, label: null, lang: null, - list: null, + list: MUST_USE_ATTRIBUTE, loop: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE, + manifest: MUST_USE_ATTRIBUTE, max: null, maxLength: MUST_USE_ATTRIBUTE, + media: MUST_USE_ATTRIBUTE, mediaGroup: null, method: null, min: null, @@ -19697,6 +19663,7 @@ var HTMLDOMPropertyConfig = { muted: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE, name: null, noValidate: HAS_BOOLEAN_VALUE, + open: null, pattern: null, placeholder: null, poster: null, @@ -19710,18 +19677,17 @@ var HTMLDOMPropertyConfig = { rowSpan: null, sandbox: null, scope: null, - scrollLeft: MUST_USE_PROPERTY, scrolling: null, - scrollTop: MUST_USE_PROPERTY, seamless: MUST_USE_ATTRIBUTE | HAS_BOOLEAN_VALUE, selected: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE, shape: null, size: MUST_USE_ATTRIBUTE | HAS_POSITIVE_NUMERIC_VALUE, + sizes: MUST_USE_ATTRIBUTE, span: HAS_POSITIVE_NUMERIC_VALUE, spellCheck: null, src: null, srcDoc: MUST_USE_PROPERTY, - srcSet: null, + srcSet: MUST_USE_ATTRIBUTE, start: HAS_NUMERIC_VALUE, step: null, style: null, @@ -19745,6 +19711,7 @@ var HTMLDOMPropertyConfig = { property: null // Supports OG in meta tags }, DOMAttributeNames: { + acceptCharset: 'accept-charset', className: 'class', htmlFor: 'for', httpEquiv: 'http-equiv' @@ -19766,21 +19733,14 @@ var HTMLDOMPropertyConfig = { module.exports = HTMLDOMPropertyConfig; -},{"./DOMProperty":11,"./ExecutionEnvironment":22}],24:[function(_dereq_,module,exports){ +},{"./DOMProperty":12,"./ExecutionEnvironment":23}],25:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * 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 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * 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. + * 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. * * @providesModule LinkedStateMixin * @typechecks static-only @@ -19814,21 +19774,14 @@ var LinkedStateMixin = { module.exports = LinkedStateMixin; -},{"./ReactLink":65,"./ReactStateSetters":81}],25:[function(_dereq_,module,exports){ +},{"./ReactLink":68,"./ReactStateSetters":85}],26:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * 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 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * 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. + * 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. * * @providesModule LinkedValueUtils * @typechecks static-only @@ -19975,21 +19928,14 @@ var LinkedValueUtils = { module.exports = LinkedValueUtils; -},{"./ReactPropTypes":75,"./invariant":134}],26:[function(_dereq_,module,exports){ +},{"./ReactPropTypes":79,"./invariant":140}],27:[function(_dereq_,module,exports){ /** - * Copyright 2014 Facebook, Inc. - * - * 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 + * Copyright 2014, Facebook, Inc. + * All rights reserved. * - * 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. + * 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. * * @providesModule LocalEventTrapMixin */ @@ -19998,7 +19944,7 @@ module.exports = LinkedValueUtils; var ReactBrowserEventEmitter = _dereq_("./ReactBrowserEventEmitter"); -var accumulate = _dereq_("./accumulate"); +var accumulateInto = _dereq_("./accumulateInto"); var forEachAccumulated = _dereq_("./forEachAccumulated"); var invariant = _dereq_("./invariant"); @@ -20014,7 +19960,8 @@ var LocalEventTrapMixin = { handlerBaseName, this.getDOMNode() ); - this._localEventListeners = accumulate(this._localEventListeners, listener); + this._localEventListeners = + accumulateInto(this._localEventListeners, listener); }, // trapCapturedEvent would look nearly identical. We don't implement that @@ -20029,21 +19976,14 @@ var LocalEventTrapMixin = { module.exports = LocalEventTrapMixin; -},{"./ReactBrowserEventEmitter":31,"./accumulate":106,"./forEachAccumulated":121,"./invariant":134}],27:[function(_dereq_,module,exports){ +},{"./ReactBrowserEventEmitter":33,"./accumulateInto":109,"./forEachAccumulated":126,"./invariant":140}],28:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * 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 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * 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. + * 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. * * @providesModule MobileSafariClickEventPlugin * @typechecks static-only @@ -20094,21 +20034,61 @@ var MobileSafariClickEventPlugin = { module.exports = MobileSafariClickEventPlugin; -},{"./EventConstants":16,"./emptyFunction":116}],28:[function(_dereq_,module,exports){ +},{"./EventConstants":17,"./emptyFunction":121}],29:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. + * Copyright 2014, Facebook, Inc. + * All rights reserved. * - * 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 + * 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. * - * http://www.apache.org/licenses/LICENSE-2.0 + * @providesModule Object.assign + */ + +// https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.assign + +function assign(target, sources) { + if (target == null) { + throw new TypeError('Object.assign target cannot be null or undefined'); + } + + var to = Object(target); + var hasOwnProperty = Object.prototype.hasOwnProperty; + + for (var nextIndex = 1; nextIndex < arguments.length; nextIndex++) { + var nextSource = arguments[nextIndex]; + if (nextSource == null) { + continue; + } + + var from = Object(nextSource); + + // We don't currently support accessors nor proxies. Therefore this + // copy cannot throw. If we ever supported this then we must handle + // exceptions and side-effects. We don't support symbols so they won't + // be transferred. + + for (var key in from) { + if (hasOwnProperty.call(from, key)) { + to[key] = from[key]; + } + } + } + + return to; +}; + +module.exports = assign; + +},{}],30:[function(_dereq_,module,exports){ +/** + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * 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. + * 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. * * @providesModule PooledClass */ @@ -20215,21 +20195,14 @@ var PooledClass = { module.exports = PooledClass; -},{"./invariant":134}],29:[function(_dereq_,module,exports){ +},{"./invariant":140}],31:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * 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 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * 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. + * 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. * * @providesModule React */ @@ -20243,11 +20216,13 @@ var ReactComponent = _dereq_("./ReactComponent"); var ReactCompositeComponent = _dereq_("./ReactCompositeComponent"); var ReactContext = _dereq_("./ReactContext"); var ReactCurrentOwner = _dereq_("./ReactCurrentOwner"); -var ReactDescriptor = _dereq_("./ReactDescriptor"); +var ReactElement = _dereq_("./ReactElement"); +var ReactElementValidator = _dereq_("./ReactElementValidator"); var ReactDOM = _dereq_("./ReactDOM"); var ReactDOMComponent = _dereq_("./ReactDOMComponent"); var ReactDefaultInjection = _dereq_("./ReactDefaultInjection"); var ReactInstanceHandles = _dereq_("./ReactInstanceHandles"); +var ReactLegacyElement = _dereq_("./ReactLegacyElement"); var ReactMount = _dereq_("./ReactMount"); var ReactMultiChild = _dereq_("./ReactMultiChild"); var ReactPerf = _dereq_("./ReactPerf"); @@ -20255,10 +20230,30 @@ var ReactPropTypes = _dereq_("./ReactPropTypes"); var ReactServerRendering = _dereq_("./ReactServerRendering"); var ReactTextComponent = _dereq_("./ReactTextComponent"); +var assign = _dereq_("./Object.assign"); +var deprecated = _dereq_("./deprecated"); var onlyChild = _dereq_("./onlyChild"); ReactDefaultInjection.inject(); +var createElement = ReactElement.createElement; +var createFactory = ReactElement.createFactory; + +if ("production" !== "development") { + createElement = ReactElementValidator.createElement; + createFactory = ReactElementValidator.createFactory; +} + +// TODO: Drop legacy elements once classes no longer export these factories +createElement = ReactLegacyElement.wrapCreateElement( + createElement +); +createFactory = ReactLegacyElement.wrapCreateFactory( + createFactory +); + +var render = ReactPerf.measure('React', 'render', ReactMount.render); + var React = { Children: { map: ReactChildren.map, @@ -20272,25 +20267,58 @@ var React = { EventPluginUtils.useTouchEvents = shouldUseTouch; }, createClass: ReactCompositeComponent.createClass, - createDescriptor: function(type, props, children) { - var args = Array.prototype.slice.call(arguments, 1); - return type.apply(null, args); - }, + createElement: createElement, + createFactory: createFactory, constructAndRenderComponent: ReactMount.constructAndRenderComponent, constructAndRenderComponentByID: ReactMount.constructAndRenderComponentByID, - renderComponent: ReactPerf.measure( + render: render, + renderToString: ReactServerRendering.renderToString, + renderToStaticMarkup: ReactServerRendering.renderToStaticMarkup, + unmountComponentAtNode: ReactMount.unmountComponentAtNode, + isValidClass: ReactLegacyElement.isValidClass, + isValidElement: ReactElement.isValidElement, + withContext: ReactContext.withContext, + + // Hook for JSX spread, don't use this for anything else. + __spread: assign, + + // Deprecations (remove for 0.13) + renderComponent: deprecated( 'React', 'renderComponent', - ReactMount.renderComponent + 'render', + this, + render ), - renderComponentToString: ReactServerRendering.renderComponentToString, - renderComponentToStaticMarkup: - ReactServerRendering.renderComponentToStaticMarkup, - unmountComponentAtNode: ReactMount.unmountComponentAtNode, - isValidClass: ReactDescriptor.isValidFactory, - isValidComponent: ReactDescriptor.isValidDescriptor, - withContext: ReactContext.withContext, - __internals: { + renderComponentToString: deprecated( + 'React', + 'renderComponentToString', + 'renderToString', + this, + ReactServerRendering.renderToString + ), + renderComponentToStaticMarkup: deprecated( + 'React', + 'renderComponentToStaticMarkup', + 'renderToStaticMarkup', + this, + ReactServerRendering.renderToStaticMarkup + ), + isValidComponent: deprecated( + 'React', + 'isValidComponent', + 'isValidElement', + this, + ReactElement.isValidElement + ) +}; + +// Inject the runtime into a devtools global hook regardless of browser. +// Allows for debugging when the hook is injected on the page. +if ( + typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' && + typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.inject === 'function') { + __REACT_DEVTOOLS_GLOBAL_HOOK__.inject({ Component: ReactComponent, CurrentOwner: ReactCurrentOwner, DOMComponent: ReactDOMComponent, @@ -20299,18 +20327,23 @@ var React = { Mount: ReactMount, MultiChild: ReactMultiChild, TextComponent: ReactTextComponent - } -}; + }); +} if ("production" !== "development") { var ExecutionEnvironment = _dereq_("./ExecutionEnvironment"); - if (ExecutionEnvironment.canUseDOM && - window.top === window.self && - navigator.userAgent.indexOf('Chrome') > -1) { - console.debug( - 'Download the React DevTools for a better development experience: ' + - 'http://fb.me/react-devtools' - ); + if (ExecutionEnvironment.canUseDOM && window.top === window.self) { + + // If we're in Chrome, look for the devtools marker and provide a download + // link if not installed. + if (navigator.userAgent.indexOf('Chrome') > -1) { + if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ === 'undefined') { + console.debug( + 'Download the React DevTools for a better development experience: ' + + 'http://fb.me/react-devtools' + ); + } + } var expectedFeatures = [ // shims @@ -20330,7 +20363,7 @@ if ("production" !== "development") { Object.freeze ]; - for (var i in expectedFeatures) { + for (var i = 0; i < expectedFeatures.length; i++) { if (!expectedFeatures[i]) { console.error( 'One or more ES5 shim/shams expected by React are not available: ' + @@ -20344,25 +20377,18 @@ if ("production" !== "development") { // Version exists only in the open-source version of React, not in Facebook's // internal version. -React.version = '0.11.1'; +React.version = '0.12.1'; module.exports = React; -},{"./DOMPropertyOperations":12,"./EventPluginUtils":20,"./ExecutionEnvironment":22,"./ReactChildren":34,"./ReactComponent":35,"./ReactCompositeComponent":38,"./ReactContext":39,"./ReactCurrentOwner":40,"./ReactDOM":41,"./ReactDOMComponent":43,"./ReactDefaultInjection":53,"./ReactDescriptor":56,"./ReactInstanceHandles":64,"./ReactMount":67,"./ReactMultiChild":68,"./ReactPerf":71,"./ReactPropTypes":75,"./ReactServerRendering":79,"./ReactTextComponent":83,"./onlyChild":149}],30:[function(_dereq_,module,exports){ +},{"./DOMPropertyOperations":13,"./EventPluginUtils":21,"./ExecutionEnvironment":23,"./Object.assign":29,"./ReactChildren":36,"./ReactComponent":37,"./ReactCompositeComponent":40,"./ReactContext":41,"./ReactCurrentOwner":42,"./ReactDOM":43,"./ReactDOMComponent":45,"./ReactDefaultInjection":55,"./ReactElement":58,"./ReactElementValidator":59,"./ReactInstanceHandles":66,"./ReactLegacyElement":67,"./ReactMount":70,"./ReactMultiChild":71,"./ReactPerf":75,"./ReactPropTypes":79,"./ReactServerRendering":83,"./ReactTextComponent":87,"./deprecated":120,"./onlyChild":151}],32:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * 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 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * 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. + * 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. * * @providesModule ReactBrowserComponentMixin */ @@ -20396,21 +20422,14 @@ var ReactBrowserComponentMixin = { module.exports = ReactBrowserComponentMixin; -},{"./ReactEmptyComponent":58,"./ReactMount":67,"./invariant":134}],31:[function(_dereq_,module,exports){ +},{"./ReactEmptyComponent":60,"./ReactMount":70,"./invariant":140}],33:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * 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 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * 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. + * 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. * * @providesModule ReactBrowserEventEmitter * @typechecks static-only @@ -20424,8 +20443,8 @@ var EventPluginRegistry = _dereq_("./EventPluginRegistry"); var ReactEventEmitterMixin = _dereq_("./ReactEventEmitterMixin"); var ViewportMetrics = _dereq_("./ViewportMetrics"); +var assign = _dereq_("./Object.assign"); var isEventSupported = _dereq_("./isEventSupported"); -var merge = _dereq_("./merge"); /** * Summary of `ReactBrowserEventEmitter` event handling: @@ -20554,7 +20573,7 @@ function getListeningForDocument(mountAt) { * * @internal */ -var ReactBrowserEventEmitter = merge(ReactEventEmitterMixin, { +var ReactBrowserEventEmitter = assign({}, ReactEventEmitterMixin, { /** * Injectable event backend @@ -20758,21 +20777,14 @@ var ReactBrowserEventEmitter = merge(ReactEventEmitterMixin, { module.exports = ReactBrowserEventEmitter; -},{"./EventConstants":16,"./EventPluginHub":18,"./EventPluginRegistry":19,"./ReactEventEmitterMixin":60,"./ViewportMetrics":105,"./isEventSupported":135,"./merge":144}],32:[function(_dereq_,module,exports){ +},{"./EventConstants":17,"./EventPluginHub":19,"./EventPluginRegistry":20,"./Object.assign":29,"./ReactEventEmitterMixin":62,"./ViewportMetrics":108,"./isEventSupported":141}],34:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * 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 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * 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. + * 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 * @providesModule ReactCSSTransitionGroup @@ -20782,8 +20794,14 @@ module.exports = ReactBrowserEventEmitter; var React = _dereq_("./React"); -var ReactTransitionGroup = _dereq_("./ReactTransitionGroup"); -var ReactCSSTransitionGroupChild = _dereq_("./ReactCSSTransitionGroupChild"); +var assign = _dereq_("./Object.assign"); + +var ReactTransitionGroup = React.createFactory( + _dereq_("./ReactTransitionGroup") +); +var ReactCSSTransitionGroupChild = React.createFactory( + _dereq_("./ReactCSSTransitionGroupChild") +); var ReactCSSTransitionGroup = React.createClass({ displayName: 'ReactCSSTransitionGroup', @@ -20816,10 +20834,9 @@ var ReactCSSTransitionGroup = React.createClass({ }, render: function() { - return this.transferPropsTo( + return ( ReactTransitionGroup( - {childFactory: this._wrapChild}, - this.props.children + assign({}, this.props, {childFactory: this._wrapChild}) ) ); } @@ -20827,21 +20844,14 @@ var ReactCSSTransitionGroup = React.createClass({ module.exports = ReactCSSTransitionGroup; -},{"./React":29,"./ReactCSSTransitionGroupChild":33,"./ReactTransitionGroup":86}],33:[function(_dereq_,module,exports){ +},{"./Object.assign":29,"./React":31,"./ReactCSSTransitionGroupChild":35,"./ReactTransitionGroup":90}],35:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * 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 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * 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. + * 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 * @providesModule ReactCSSTransitionGroupChild @@ -20886,7 +20896,10 @@ var ReactCSSTransitionGroupChild = React.createClass({ var activeClassName = className + '-active'; var noEventTimeout = null; - var endListener = function() { + var endListener = function(e) { + if (e && e.target !== node) { + return; + } if ("production" !== "development") { clearTimeout(noEventTimeout); } @@ -20964,21 +20977,14 @@ var ReactCSSTransitionGroupChild = React.createClass({ module.exports = ReactCSSTransitionGroupChild; -},{"./CSSCore":3,"./React":29,"./ReactTransitionEvents":85,"./onlyChild":149}],34:[function(_dereq_,module,exports){ +},{"./CSSCore":4,"./React":31,"./ReactTransitionEvents":89,"./onlyChild":151}],36:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * 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 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * 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. + * 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. * * @providesModule ReactChildren */ @@ -21119,34 +21125,27 @@ var ReactChildren = { module.exports = ReactChildren; -},{"./PooledClass":28,"./traverseAllChildren":156,"./warning":158}],35:[function(_dereq_,module,exports){ +},{"./PooledClass":30,"./traverseAllChildren":158,"./warning":160}],37:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * 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 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * 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. + * 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. * * @providesModule ReactComponent */ "use strict"; -var ReactDescriptor = _dereq_("./ReactDescriptor"); +var ReactElement = _dereq_("./ReactElement"); var ReactOwner = _dereq_("./ReactOwner"); var ReactUpdates = _dereq_("./ReactUpdates"); +var assign = _dereq_("./Object.assign"); var invariant = _dereq_("./invariant"); var keyMirror = _dereq_("./keyMirror"); -var merge = _dereq_("./merge"); /** * Every React component is in one of these life cycles. @@ -21269,11 +21268,11 @@ var ReactComponent = { * @public */ setProps: function(partialProps, callback) { - // Merge with the pending descriptor if it exists, otherwise with existing - // descriptor props. - var descriptor = this._pendingDescriptor || this._descriptor; + // Merge with the pending element if it exists, otherwise with existing + // element props. + var element = this._pendingElement || this._currentElement; this.replaceProps( - merge(descriptor.props, partialProps), + assign({}, element.props, partialProps), callback ); }, @@ -21299,10 +21298,10 @@ var ReactComponent = { '`render` method to pass the correct value as props to the component ' + 'where it is created.' ) : invariant(this._mountDepth === 0)); - // This is a deoptimized path. We optimize for always having a descriptor. - // This creates an extra internal descriptor. - this._pendingDescriptor = ReactDescriptor.cloneAndReplaceProps( - this._pendingDescriptor || this._descriptor, + // This is a deoptimized path. We optimize for always having a element. + // This creates an extra internal element. + this._pendingElement = ReactElement.cloneAndReplaceProps( + this._pendingElement || this._currentElement, props ); ReactUpdates.enqueueUpdate(this, callback); @@ -21317,12 +21316,12 @@ var ReactComponent = { * @internal */ _setPropsInternal: function(partialProps, callback) { - // This is a deoptimized path. We optimize for always having a descriptor. - // This creates an extra internal descriptor. - var descriptor = this._pendingDescriptor || this._descriptor; - this._pendingDescriptor = ReactDescriptor.cloneAndReplaceProps( - descriptor, - merge(descriptor.props, partialProps) + // This is a deoptimized path. We optimize for always having a element. + // This creates an extra internal element. + var element = this._pendingElement || this._currentElement; + this._pendingElement = ReactElement.cloneAndReplaceProps( + element, + assign({}, element.props, partialProps) ); ReactUpdates.enqueueUpdate(this, callback); }, @@ -21333,19 +21332,19 @@ var ReactComponent = { * Subclasses that override this method should make sure to invoke * `ReactComponent.Mixin.construct.call(this, ...)`. * - * @param {ReactDescriptor} descriptor + * @param {ReactElement} element * @internal */ - construct: function(descriptor) { + construct: function(element) { // This is the public exposed props object after it has been processed - // with default props. The descriptor's props represents the true internal + // with default props. The element's props represents the true internal // state of the props. - this.props = descriptor.props; + this.props = element.props; // Record the component responsible for creating this component. - // This is accessible through the descriptor but we maintain an extra + // This is accessible through the element but we maintain an extra // field for compatibility with devtools and as a way to make an // incremental update. TODO: Consider deprecating this field. - this._owner = descriptor._owner; + this._owner = element._owner; // All components start unmounted. this._lifeCycleState = ComponentLifeCycle.UNMOUNTED; @@ -21353,10 +21352,10 @@ var ReactComponent = { // See ReactUpdates. this._pendingCallbacks = null; - // We keep the old descriptor and a reference to the pending descriptor + // We keep the old element and a reference to the pending element // to track updates. - this._descriptor = descriptor; - this._pendingDescriptor = null; + this._currentElement = element; + this._pendingElement = null; }, /** @@ -21381,10 +21380,10 @@ var ReactComponent = { 'single component instance in multiple places.', rootID ) : invariant(!this.isMounted())); - var props = this._descriptor.props; - if (props.ref != null) { - var owner = this._descriptor._owner; - ReactOwner.addComponentAsRefTo(this, props.ref, owner); + var ref = this._currentElement.ref; + if (ref != null) { + var owner = this._currentElement._owner; + ReactOwner.addComponentAsRefTo(this, ref, owner); } this._rootNodeID = rootID; this._lifeCycleState = ComponentLifeCycle.MOUNTED; @@ -21407,9 +21406,9 @@ var ReactComponent = { this.isMounted(), 'unmountComponent(): Can only unmount a mounted component.' ) : invariant(this.isMounted())); - var props = this.props; - if (props.ref != null) { - ReactOwner.removeComponentAsRefFrom(this, props.ref, this._owner); + var ref = this._currentElement.ref; + if (ref != null) { + ReactOwner.removeComponentAsRefFrom(this, ref, this._owner); } unmountIDFromEnvironment(this._rootNodeID); this._rootNodeID = null; @@ -21427,49 +21426,49 @@ var ReactComponent = { * @param {ReactReconcileTransaction} transaction * @internal */ - receiveComponent: function(nextDescriptor, transaction) { + receiveComponent: function(nextElement, transaction) { ("production" !== "development" ? invariant( this.isMounted(), 'receiveComponent(...): Can only update a mounted component.' ) : invariant(this.isMounted())); - this._pendingDescriptor = nextDescriptor; + this._pendingElement = nextElement; this.performUpdateIfNecessary(transaction); }, /** - * If `_pendingDescriptor` is set, update the component. + * If `_pendingElement` is set, update the component. * * @param {ReactReconcileTransaction} transaction * @internal */ performUpdateIfNecessary: function(transaction) { - if (this._pendingDescriptor == null) { + if (this._pendingElement == null) { return; } - var prevDescriptor = this._descriptor; - var nextDescriptor = this._pendingDescriptor; - this._descriptor = nextDescriptor; - this.props = nextDescriptor.props; - this._owner = nextDescriptor._owner; - this._pendingDescriptor = null; - this.updateComponent(transaction, prevDescriptor); + var prevElement = this._currentElement; + var nextElement = this._pendingElement; + this._currentElement = nextElement; + this.props = nextElement.props; + this._owner = nextElement._owner; + this._pendingElement = null; + this.updateComponent(transaction, prevElement); }, /** * Updates the component's currently mounted representation. * * @param {ReactReconcileTransaction} transaction - * @param {object} prevDescriptor + * @param {object} prevElement * @internal */ - updateComponent: function(transaction, prevDescriptor) { - var nextDescriptor = this._descriptor; + updateComponent: function(transaction, prevElement) { + var nextElement = this._currentElement; // If either the owner or a `ref` has changed, make sure the newest owner // has stored a reference to `this`, and the previous owner (if different) - // has forgotten the reference to `this`. We use the descriptor instead + // has forgotten the reference to `this`. We use the element instead // of the public this.props because the post processing cannot determine - // a ref. The ref conceptually lives on the descriptor. + // a ref. The ref conceptually lives on the element. // TODO: Should this even be possible? The owner cannot change because // it's forbidden by shouldUpdateReactComponent. The ref can change @@ -21477,19 +21476,19 @@ var ReactComponent = { // is made. It probably belongs where the key checking and // instantiateReactComponent is done. - if (nextDescriptor._owner !== prevDescriptor._owner || - nextDescriptor.props.ref !== prevDescriptor.props.ref) { - if (prevDescriptor.props.ref != null) { + if (nextElement._owner !== prevElement._owner || + nextElement.ref !== prevElement.ref) { + if (prevElement.ref != null) { ReactOwner.removeComponentAsRefFrom( - this, prevDescriptor.props.ref, prevDescriptor._owner + this, prevElement.ref, prevElement._owner ); } // Correct, even if the owner is the same, and only the ref has changed. - if (nextDescriptor.props.ref != null) { + if (nextElement.ref != null) { ReactOwner.addComponentAsRefTo( this, - nextDescriptor.props.ref, - nextDescriptor._owner + nextElement.ref, + nextElement._owner ); } } @@ -21503,7 +21502,7 @@ var ReactComponent = { * @param {boolean} shouldReuseMarkup If true, do not insert markup * @final * @internal - * @see {ReactMount.renderComponent} + * @see {ReactMount.render} */ mountComponentIntoNode: function(rootID, container, shouldReuseMarkup) { var transaction = ReactUpdates.ReactReconcileTransaction.getPooled(); @@ -21567,21 +21566,14 @@ var ReactComponent = { module.exports = ReactComponent; -},{"./ReactDescriptor":56,"./ReactOwner":70,"./ReactUpdates":87,"./invariant":134,"./keyMirror":140,"./merge":144}],36:[function(_dereq_,module,exports){ +},{"./Object.assign":29,"./ReactElement":58,"./ReactOwner":74,"./ReactUpdates":91,"./invariant":140,"./keyMirror":146}],38:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * 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 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * 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. + * 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. * * @providesModule ReactComponentBrowserEnvironment */ @@ -21694,21 +21686,14 @@ var ReactComponentBrowserEnvironment = { module.exports = ReactComponentBrowserEnvironment; -},{"./ReactDOMIDOperations":45,"./ReactMarkupChecksum":66,"./ReactMount":67,"./ReactPerf":71,"./ReactReconcileTransaction":77,"./getReactRootElementInContainer":128,"./invariant":134,"./setInnerHTML":152}],37:[function(_dereq_,module,exports){ +},{"./ReactDOMIDOperations":47,"./ReactMarkupChecksum":69,"./ReactMount":70,"./ReactPerf":75,"./ReactReconcileTransaction":81,"./getReactRootElementInContainer":134,"./invariant":140,"./setInnerHTML":154}],39:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * 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 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * 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. + * 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. * * @providesModule ReactComponentWithPureRenderMixin */ @@ -21750,21 +21735,14 @@ var ReactComponentWithPureRenderMixin = { module.exports = ReactComponentWithPureRenderMixin; -},{"./shallowEqual":153}],38:[function(_dereq_,module,exports){ +},{"./shallowEqual":155}],40:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * 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 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * 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. + * 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. * * @providesModule ReactCompositeComponent */ @@ -21774,10 +21752,11 @@ module.exports = ReactComponentWithPureRenderMixin; var ReactComponent = _dereq_("./ReactComponent"); var ReactContext = _dereq_("./ReactContext"); var ReactCurrentOwner = _dereq_("./ReactCurrentOwner"); -var ReactDescriptor = _dereq_("./ReactDescriptor"); -var ReactDescriptorValidator = _dereq_("./ReactDescriptorValidator"); +var ReactElement = _dereq_("./ReactElement"); +var ReactElementValidator = _dereq_("./ReactElementValidator"); var ReactEmptyComponent = _dereq_("./ReactEmptyComponent"); var ReactErrorUtils = _dereq_("./ReactErrorUtils"); +var ReactLegacyElement = _dereq_("./ReactLegacyElement"); var ReactOwner = _dereq_("./ReactOwner"); var ReactPerf = _dereq_("./ReactPerf"); var ReactPropTransferer = _dereq_("./ReactPropTransferer"); @@ -21785,16 +21764,18 @@ var ReactPropTypeLocations = _dereq_("./ReactPropTypeLocations"); var ReactPropTypeLocationNames = _dereq_("./ReactPropTypeLocationNames"); var ReactUpdates = _dereq_("./ReactUpdates"); +var assign = _dereq_("./Object.assign"); var instantiateReactComponent = _dereq_("./instantiateReactComponent"); var invariant = _dereq_("./invariant"); var keyMirror = _dereq_("./keyMirror"); -var merge = _dereq_("./merge"); -var mixInto = _dereq_("./mixInto"); +var keyOf = _dereq_("./keyOf"); var monitorCodeUse = _dereq_("./monitorCodeUse"); var mapObject = _dereq_("./mapObject"); var shouldUpdateReactComponent = _dereq_("./shouldUpdateReactComponent"); var warning = _dereq_("./warning"); +var MIXINS_KEY = keyOf({mixins: null}); + /** * Policies that describe methods in `ReactCompositeComponentInterface`. */ @@ -22098,7 +22079,8 @@ var RESERVED_SPEC_KEYS = { childContextTypes, ReactPropTypeLocations.childContext ); - Constructor.childContextTypes = merge( + Constructor.childContextTypes = assign( + {}, Constructor.childContextTypes, childContextTypes ); @@ -22109,7 +22091,11 @@ var RESERVED_SPEC_KEYS = { contextTypes, ReactPropTypeLocations.context ); - Constructor.contextTypes = merge(Constructor.contextTypes, contextTypes); + Constructor.contextTypes = assign( + {}, + Constructor.contextTypes, + contextTypes + ); }, /** * Special case getDefaultProps which should move into statics but requires @@ -22131,7 +22117,11 @@ var RESERVED_SPEC_KEYS = { propTypes, ReactPropTypeLocations.prop ); - Constructor.propTypes = merge(Constructor.propTypes, propTypes); + Constructor.propTypes = assign( + {}, + Constructor.propTypes, + propTypes + ); }, statics: function(Constructor, statics) { mixStaticSpecIntoComponent(Constructor, statics); @@ -22200,11 +22190,12 @@ function validateLifeCycleOnReplaceState(instance) { 'replaceState(...): Can only update a mounted or mounting component.' ) : invariant(instance.isMounted() || compositeLifeCycleState === CompositeLifeCycle.MOUNTING)); - ("production" !== "development" ? invariant(compositeLifeCycleState !== CompositeLifeCycle.RECEIVING_STATE, + ("production" !== "development" ? invariant( + ReactCurrentOwner.current == null, 'replaceState(...): Cannot update during an existing state transition ' + - '(such as within `render`). This could potentially cause an infinite ' + - 'loop so it is forbidden.' - ) : invariant(compositeLifeCycleState !== CompositeLifeCycle.RECEIVING_STATE)); + '(such as within `render`). Render methods should be a pure function ' + + 'of props and state.' + ) : invariant(ReactCurrentOwner.current == null)); ("production" !== "development" ? invariant(compositeLifeCycleState !== CompositeLifeCycle.UNMOUNTING, 'replaceState(...): Cannot update while unmounting component. This ' + 'usually means you called setState() on an unmounted component.' @@ -22212,28 +22203,45 @@ function validateLifeCycleOnReplaceState(instance) { } /** - * Custom version of `mixInto` which handles policy validation and reserved + * Mixin helper which handles policy validation and reserved * specification keys when building `ReactCompositeComponent` classses. */ function mixSpecIntoComponent(Constructor, spec) { + if (!spec) { + return; + } + ("production" !== "development" ? invariant( - !ReactDescriptor.isValidFactory(spec), + !ReactLegacyElement.isValidFactory(spec), 'ReactCompositeComponent: You\'re attempting to ' + 'use a component class as a mixin. Instead, just use a regular object.' - ) : invariant(!ReactDescriptor.isValidFactory(spec))); + ) : invariant(!ReactLegacyElement.isValidFactory(spec))); ("production" !== "development" ? invariant( - !ReactDescriptor.isValidDescriptor(spec), + !ReactElement.isValidElement(spec), 'ReactCompositeComponent: You\'re attempting to ' + 'use a component as a mixin. Instead, just use a regular object.' - ) : invariant(!ReactDescriptor.isValidDescriptor(spec))); + ) : invariant(!ReactElement.isValidElement(spec))); var proto = Constructor.prototype; + + // 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) { - var property = spec[name]; if (!spec.hasOwnProperty(name)) { continue; } + if (name === MIXINS_KEY) { + // We have already handled mixins in a special case above + continue; + } + + var property = spec[name]; validateMethodOverride(proto, name); if (RESERVED_SPEC_KEYS.hasOwnProperty(name)) { @@ -22311,23 +22319,25 @@ function mixStaticSpecIntoComponent(Constructor, statics) { continue; } + var isReserved = name in RESERVED_SPEC_KEYS; + ("production" !== "development" ? invariant( + !isReserved, + 'ReactCompositeComponent: 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 + ) : invariant(!isReserved)); + var isInherited = name in Constructor; - var result = property; - if (isInherited) { - var existingProperty = Constructor[name]; - var existingType = typeof existingProperty; - var propertyType = typeof property; - ("production" !== "development" ? invariant( - existingType === 'function' && propertyType === 'function', - 'ReactCompositeComponent: You are attempting to define ' + - '`%s` on your component more than once, but that is only supported ' + - 'for functions, which are chained together. This conflict may be ' + - 'due to a mixin.', - name - ) : invariant(existingType === 'function' && propertyType === 'function')); - result = createChainedFunction(existingProperty, property); - } - Constructor[name] = result; + ("production" !== "development" ? invariant( + !isInherited, + 'ReactCompositeComponent: You are attempting to define ' + + '`%s` on your component more than once. This conflict may be ' + + 'due to a mixin.', + name + ) : invariant(!isInherited)); + Constructor[name] = property; } } @@ -22348,7 +22358,10 @@ function mergeObjectsWithNoDuplicateKeys(one, two) { ("production" !== "development" ? invariant( one[key] === undefined, 'mergeObjectsWithNoDuplicateKeys(): ' + - 'Tried to merge two objects with the same key: %s', + '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 ) : invariant(one[key] === undefined)); one[key] = value; @@ -22404,19 +22417,19 @@ function createChainedFunction(one, two) { * Top Row: ReactComponent.ComponentLifeCycle * Low Row: ReactComponent.CompositeLifeCycle * - * +-------+------------------------------------------------------+--------+ - * | UN | MOUNTED | UN | - * |MOUNTED| | MOUNTED| - * +-------+------------------------------------------------------+--------+ - * | ^--------+ +------+ +------+ +------+ +--------^ | - * | | | | | | | | | | | | - * | 0--|MOUNTING|-0-|RECEIV|-0-|RECEIV|-0-|RECEIV|-0-| UN |--->0 | - * | | | |PROPS | | PROPS| | STATE| |MOUNTING| | - * | | | | | | | | | | | | - * | | | | | | | | | | | | - * | +--------+ +------+ +------+ +------+ +--------+ | - * | | | | - * +-------+------------------------------------------------------+--------+ + * +-------+---------------------------------+--------+ + * | UN | MOUNTED | UN | + * |MOUNTED| | MOUNTED| + * +-------+---------------------------------+--------+ + * | ^--------+ +-------+ +--------^ | + * | | | | | | | | + * | 0--|MOUNTING|-0-|RECEIVE|-0-| UN |--->0 | + * | | | |PROPS | |MOUNTING| | + * | | | | | | | | + * | | | | | | | | + * | +--------+ +-------+ +--------+ | + * | | | | + * +-------+---------------------------------+--------+ */ var CompositeLifeCycle = keyMirror({ /** @@ -22433,12 +22446,7 @@ var CompositeLifeCycle = keyMirror({ * Components that are mounted and receiving new props respond to state * changes differently. */ - RECEIVING_PROPS: null, - /** - * Components that are mounted and receiving new state are guarded against - * additional state changes. - */ - RECEIVING_STATE: null + RECEIVING_PROPS: null }); /** @@ -22449,11 +22457,11 @@ var ReactCompositeComponentMixin = { /** * Base constructor for all composite component. * - * @param {ReactDescriptor} descriptor + * @param {ReactElement} element * @final * @internal */ - construct: function(descriptor) { + construct: function(element) { // Children can be either an array or more than one argument ReactComponent.Mixin.construct.apply(this, arguments); ReactOwner.Mixin.construct.apply(this, arguments); @@ -22462,7 +22470,7 @@ var ReactCompositeComponentMixin = { this._pendingState = null; // This is the public post-processed context. The real context and pending - // context lives on the descriptor. + // context lives on the element. this.context = null; this._compositeLifeCycleState = null; @@ -22505,7 +22513,7 @@ var ReactCompositeComponentMixin = { this._bindAutoBindMethods(); } - this.context = this._processContext(this._descriptor._context); + this.context = this._processContext(this._currentElement._context); this.props = this._processProps(this.props); this.state = this.getInitialState ? this.getInitialState() : null; @@ -22529,7 +22537,8 @@ var ReactCompositeComponentMixin = { } this._renderedComponent = instantiateReactComponent( - this._renderValidatedComponent() + this._renderValidatedComponent(), + this._currentElement.type // The wrapping type ); // Done with mounting, `setState` will now trigger UI changes. @@ -22601,7 +22610,7 @@ var ReactCompositeComponentMixin = { } // Merge with `_pendingState` if it exists, otherwise with existing state. this.replaceState( - merge(this._pendingState || this.state, partialState), + assign({}, this._pendingState || this.state, partialState), callback ); }, @@ -22689,7 +22698,7 @@ var ReactCompositeComponentMixin = { name ) : invariant(name in this.constructor.childContextTypes)); } - return merge(currentContext, childContext); + return assign({}, currentContext, childContext); } return currentContext; }, @@ -22704,25 +22713,13 @@ var ReactCompositeComponentMixin = { * @private */ _processProps: function(newProps) { - var defaultProps = this.constructor.defaultProps; - var props; - if (defaultProps) { - props = merge(newProps); - for (var propName in defaultProps) { - if (typeof props[propName] === 'undefined') { - props[propName] = defaultProps[propName]; - } - } - } else { - props = newProps; - } if ("production" !== "development") { var propTypes = this.constructor.propTypes; if (propTypes) { - this._checkPropTypes(propTypes, props, ReactPropTypeLocations.prop); + this._checkPropTypes(propTypes, newProps, ReactPropTypeLocations.prop); } } - return props; + return newProps; }, /** @@ -22734,7 +22731,7 @@ var ReactCompositeComponentMixin = { * @private */ _checkPropTypes: function(propTypes, props, location) { - // TODO: Stop validating prop types here and only use the descriptor + // TODO: Stop validating prop types here and only use the element // validation. var componentName = this.constructor.displayName; for (var propName in propTypes) { @@ -22753,7 +22750,7 @@ var ReactCompositeComponentMixin = { }, /** - * If any of `_pendingDescriptor`, `_pendingState`, or `_pendingForceUpdate` + * If any of `_pendingElement`, `_pendingState`, or `_pendingForceUpdate` * is set, update the component. * * @param {ReactReconcileTransaction} transaction @@ -22768,7 +22765,7 @@ var ReactCompositeComponentMixin = { return; } - if (this._pendingDescriptor == null && + if (this._pendingElement == null && this._pendingState == null && !this._pendingForceUpdate) { return; @@ -22776,12 +22773,12 @@ var ReactCompositeComponentMixin = { var nextContext = this.context; var nextProps = this.props; - var nextDescriptor = this._descriptor; - if (this._pendingDescriptor != null) { - nextDescriptor = this._pendingDescriptor; - nextContext = this._processContext(nextDescriptor._context); - nextProps = this._processProps(nextDescriptor.props); - this._pendingDescriptor = null; + var nextElement = this._currentElement; + if (this._pendingElement != null) { + nextElement = this._pendingElement; + nextContext = this._processContext(nextElement._context); + nextProps = this._processProps(nextElement.props); + this._pendingElement = null; this._compositeLifeCycleState = CompositeLifeCycle.RECEIVING_PROPS; if (this.componentWillReceiveProps) { @@ -22789,51 +22786,47 @@ var ReactCompositeComponentMixin = { } } - this._compositeLifeCycleState = CompositeLifeCycle.RECEIVING_STATE; + this._compositeLifeCycleState = null; var nextState = this._pendingState || this.state; this._pendingState = null; - try { - var shouldUpdate = - this._pendingForceUpdate || - !this.shouldComponentUpdate || - this.shouldComponentUpdate(nextProps, nextState, nextContext); + var shouldUpdate = + this._pendingForceUpdate || + !this.shouldComponentUpdate || + this.shouldComponentUpdate(nextProps, nextState, nextContext); - if ("production" !== "development") { - if (typeof shouldUpdate === "undefined") { - console.warn( - (this.constructor.displayName || 'ReactCompositeComponent') + - '.shouldComponentUpdate(): Returned undefined instead of a ' + - 'boolean value. Make sure to return true or false.' - ); - } + if ("production" !== "development") { + if (typeof shouldUpdate === "undefined") { + console.warn( + (this.constructor.displayName || 'ReactCompositeComponent') + + '.shouldComponentUpdate(): Returned undefined instead of a ' + + 'boolean value. Make sure to return true or false.' + ); } + } - if (shouldUpdate) { - this._pendingForceUpdate = false; - // Will set `this.props`, `this.state` and `this.context`. - this._performComponentUpdate( - nextDescriptor, - nextProps, - nextState, - nextContext, - transaction - ); - } else { - // If it's determined that a component should not update, we still want - // to set props and state. - this._descriptor = nextDescriptor; - this.props = nextProps; - this.state = nextState; - this.context = nextContext; + if (shouldUpdate) { + this._pendingForceUpdate = false; + // Will set `this.props`, `this.state` and `this.context`. + this._performComponentUpdate( + nextElement, + nextProps, + nextState, + nextContext, + transaction + ); + } else { + // If it's determined that a component should not update, we still want + // to set props and state. + this._currentElement = nextElement; + this.props = nextProps; + this.state = nextState; + this.context = nextContext; - // Owner cannot change because shouldUpdateReactComponent doesn't allow - // it. TODO: Remove this._owner completely. - this._owner = nextDescriptor._owner; - } - } finally { - this._compositeLifeCycleState = null; + // Owner cannot change because shouldUpdateReactComponent doesn't allow + // it. TODO: Remove this._owner completely. + this._owner = nextElement._owner; } }, @@ -22841,7 +22834,7 @@ var ReactCompositeComponentMixin = { * Merges new props and state, notifies delegate methods of update and * performs update. * - * @param {ReactDescriptor} nextDescriptor Next descriptor + * @param {ReactElement} nextElement Next element * @param {object} nextProps Next public object to set as properties. * @param {?object} nextState Next object to set as state. * @param {?object} nextContext Next public object to set as context. @@ -22849,13 +22842,13 @@ var ReactCompositeComponentMixin = { * @private */ _performComponentUpdate: function( - nextDescriptor, + nextElement, nextProps, nextState, nextContext, transaction ) { - var prevDescriptor = this._descriptor; + var prevElement = this._currentElement; var prevProps = this.props; var prevState = this.state; var prevContext = this.context; @@ -22864,18 +22857,18 @@ var ReactCompositeComponentMixin = { this.componentWillUpdate(nextProps, nextState, nextContext); } - this._descriptor = nextDescriptor; + this._currentElement = nextElement; this.props = nextProps; this.state = nextState; this.context = nextContext; // Owner cannot change because shouldUpdateReactComponent doesn't allow // it. TODO: Remove this._owner completely. - this._owner = nextDescriptor._owner; + this._owner = nextElement._owner; this.updateComponent( transaction, - prevDescriptor + prevElement ); if (this.componentDidUpdate) { @@ -22886,22 +22879,22 @@ var ReactCompositeComponentMixin = { } }, - receiveComponent: function(nextDescriptor, transaction) { - if (nextDescriptor === this._descriptor && - nextDescriptor._owner != null) { - // Since descriptors are immutable after the owner is rendered, + receiveComponent: function(nextElement, transaction) { + if (nextElement === this._currentElement && + nextElement._owner != null) { + // Since elements are immutable after the owner is rendered, // we can do a cheap identity compare here to determine if this is a // superfluous reconcile. It's possible for state to be mutable but such // change should trigger an update of the owner which would recreate - // the descriptor. We explicitly check for the existence of an owner since - // it's possible for a descriptor created outside a composite to be + // the element. We explicitly check for the existence of an owner since + // it's possible for a element created outside a composite to be // deeply mutated and reused. return; } ReactComponent.Mixin.receiveComponent.call( this, - nextDescriptor, + nextElement, transaction ); }, @@ -22913,31 +22906,34 @@ var ReactCompositeComponentMixin = { * Sophisticated clients may wish to override this. * * @param {ReactReconcileTransaction} transaction - * @param {ReactDescriptor} prevDescriptor + * @param {ReactElement} prevElement * @internal * @overridable */ updateComponent: ReactPerf.measure( 'ReactCompositeComponent', 'updateComponent', - function(transaction, prevParentDescriptor) { + function(transaction, prevParentElement) { ReactComponent.Mixin.updateComponent.call( this, transaction, - prevParentDescriptor + prevParentElement ); var prevComponentInstance = this._renderedComponent; - var prevDescriptor = prevComponentInstance._descriptor; - var nextDescriptor = this._renderValidatedComponent(); - if (shouldUpdateReactComponent(prevDescriptor, nextDescriptor)) { - prevComponentInstance.receiveComponent(nextDescriptor, transaction); + var prevElement = prevComponentInstance._currentElement; + var nextElement = this._renderValidatedComponent(); + if (shouldUpdateReactComponent(prevElement, nextElement)) { + prevComponentInstance.receiveComponent(nextElement, transaction); } else { // These two IDs are actually the same! But nothing should rely on that. var thisID = this._rootNodeID; var prevComponentID = prevComponentInstance._rootNodeID; prevComponentInstance.unmountComponent(); - this._renderedComponent = instantiateReactComponent(nextDescriptor); + this._renderedComponent = instantiateReactComponent( + nextElement, + this._currentElement.type + ); var nextMarkup = this._renderedComponent.mountComponent( thisID, transaction, @@ -22975,12 +22971,12 @@ var ReactCompositeComponentMixin = { ) : invariant(this.isMounted() || compositeLifeCycleState === CompositeLifeCycle.MOUNTING)); ("production" !== "development" ? invariant( - compositeLifeCycleState !== CompositeLifeCycle.RECEIVING_STATE && - compositeLifeCycleState !== CompositeLifeCycle.UNMOUNTING, + compositeLifeCycleState !== CompositeLifeCycle.UNMOUNTING && + ReactCurrentOwner.current == null, 'forceUpdate(...): Cannot force an update while unmounting component ' + - 'or during an existing state transition (such as within `render`).' - ) : invariant(compositeLifeCycleState !== CompositeLifeCycle.RECEIVING_STATE && - compositeLifeCycleState !== CompositeLifeCycle.UNMOUNTING)); + 'or within a `render` function.' + ) : invariant(compositeLifeCycleState !== CompositeLifeCycle.UNMOUNTING && + ReactCurrentOwner.current == null)); this._pendingForceUpdate = true; ReactUpdates.enqueueUpdate(this, callback); }, @@ -22995,7 +22991,7 @@ var ReactCompositeComponentMixin = { var renderedComponent; var previousContext = ReactContext.current; ReactContext.current = this._processChildContext( - this._descriptor._context + this._currentElement._context ); ReactCurrentOwner.current = this; try { @@ -23011,11 +23007,11 @@ var ReactCompositeComponentMixin = { ReactCurrentOwner.current = null; } ("production" !== "development" ? invariant( - ReactDescriptor.isValidDescriptor(renderedComponent), + ReactElement.isValidElement(renderedComponent), '%s.render(): A valid ReactComponent must be returned. You may have ' + 'returned undefined, an array or some other invalid object.', this.constructor.displayName || 'ReactCompositeComponent' - ) : invariant(ReactDescriptor.isValidDescriptor(renderedComponent))); + ) : invariant(ReactElement.isValidElement(renderedComponent))); return renderedComponent; } ), @@ -23044,16 +23040,14 @@ var ReactCompositeComponentMixin = { */ _bindAutoBindMethod: function(method) { var component = this; - var boundMethod = function() { - return method.apply(component, arguments); - }; + var boundMethod = method.bind(component); if ("production" !== "development") { boundMethod.__reactBoundContext = component; boundMethod.__reactBoundMethod = method; boundMethod.__reactBoundArguments = null; var componentName = component.constructor.displayName; var _bind = boundMethod.bind; - boundMethod.bind = function(newThis ) {var args=Array.prototype.slice.call(arguments,1); + boundMethod.bind = function(newThis ) {for (var args=[],$__0=1,$__1=arguments.length;$__0<$__1;$__0++) args.push(arguments[$__0]); // 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. @@ -23084,10 +23078,13 @@ var ReactCompositeComponentMixin = { }; var ReactCompositeComponentBase = function() {}; -mixInto(ReactCompositeComponentBase, ReactComponent.Mixin); -mixInto(ReactCompositeComponentBase, ReactOwner.Mixin); -mixInto(ReactCompositeComponentBase, ReactPropTransferer.Mixin); -mixInto(ReactCompositeComponentBase, ReactCompositeComponentMixin); +assign( + ReactCompositeComponentBase.prototype, + ReactComponent.Mixin, + ReactOwner.Mixin, + ReactPropTransferer.Mixin, + ReactCompositeComponentMixin +); /** * Module for creating composite components. @@ -23111,8 +23108,10 @@ var ReactCompositeComponent = { * @public */ createClass: function(spec) { - var Constructor = function(props, owner) { - this.construct(props, owner); + var Constructor = function(props) { + // This constructor is overridden by mocks. The argument is used + // by mocks to assert on what gets mounted. This will later be used + // by the stand-alone class implementation. }; Constructor.prototype = new ReactCompositeComponentBase(); Constructor.prototype.constructor = Constructor; @@ -23155,17 +23154,14 @@ var ReactCompositeComponent = { } } - var descriptorFactory = ReactDescriptor.createFactory(Constructor); - if ("production" !== "development") { - return ReactDescriptorValidator.createFactory( - descriptorFactory, - Constructor.propTypes, - Constructor.contextTypes + return ReactLegacyElement.wrapFactory( + ReactElementValidator.createFactory(Constructor) ); } - - return descriptorFactory; + return ReactLegacyElement.wrapFactory( + ReactElement.createFactory(Constructor) + ); }, injection: { @@ -23177,28 +23173,21 @@ var ReactCompositeComponent = { module.exports = ReactCompositeComponent; -},{"./ReactComponent":35,"./ReactContext":39,"./ReactCurrentOwner":40,"./ReactDescriptor":56,"./ReactDescriptorValidator":57,"./ReactEmptyComponent":58,"./ReactErrorUtils":59,"./ReactOwner":70,"./ReactPerf":71,"./ReactPropTransferer":72,"./ReactPropTypeLocationNames":73,"./ReactPropTypeLocations":74,"./ReactUpdates":87,"./instantiateReactComponent":133,"./invariant":134,"./keyMirror":140,"./mapObject":142,"./merge":144,"./mixInto":147,"./monitorCodeUse":148,"./shouldUpdateReactComponent":154,"./warning":158}],39:[function(_dereq_,module,exports){ +},{"./Object.assign":29,"./ReactComponent":37,"./ReactContext":41,"./ReactCurrentOwner":42,"./ReactElement":58,"./ReactElementValidator":59,"./ReactEmptyComponent":60,"./ReactErrorUtils":61,"./ReactLegacyElement":67,"./ReactOwner":74,"./ReactPerf":75,"./ReactPropTransferer":76,"./ReactPropTypeLocationNames":77,"./ReactPropTypeLocations":78,"./ReactUpdates":91,"./instantiateReactComponent":139,"./invariant":140,"./keyMirror":146,"./keyOf":147,"./mapObject":148,"./monitorCodeUse":150,"./shouldUpdateReactComponent":156,"./warning":160}],41:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * 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 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * 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. + * 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. * * @providesModule ReactContext */ "use strict"; -var merge = _dereq_("./merge"); +var assign = _dereq_("./Object.assign"); /** * Keeps track of the current context. @@ -23220,7 +23209,7 @@ var ReactContext = { * A typical use case might look like * * render: function() { - * var children = ReactContext.withContext({foo: 'foo'} () => ( + * var children = ReactContext.withContext({foo: 'foo'}, () => ( * * )); * return <div>{children}</div>; @@ -23233,7 +23222,7 @@ var ReactContext = { withContext: function(newContext, scopedCallback) { var result; var previousContext = ReactContext.current; - ReactContext.current = merge(previousContext, newContext); + ReactContext.current = assign({}, previousContext, newContext); try { result = scopedCallback(); } finally { @@ -23246,21 +23235,14 @@ var ReactContext = { module.exports = ReactContext; -},{"./merge":144}],40:[function(_dereq_,module,exports){ +},{"./Object.assign":29}],42:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * 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 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * 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. + * 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. * * @providesModule ReactCurrentOwner */ @@ -23287,21 +23269,14 @@ var ReactCurrentOwner = { module.exports = ReactCurrentOwner; -},{}],41:[function(_dereq_,module,exports){ +},{}],43:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * 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 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * 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. + * 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. * * @providesModule ReactDOM * @typechecks static-only @@ -23309,45 +23284,27 @@ module.exports = ReactCurrentOwner; "use strict"; -var ReactDescriptor = _dereq_("./ReactDescriptor"); -var ReactDescriptorValidator = _dereq_("./ReactDescriptorValidator"); -var ReactDOMComponent = _dereq_("./ReactDOMComponent"); +var ReactElement = _dereq_("./ReactElement"); +var ReactElementValidator = _dereq_("./ReactElementValidator"); +var ReactLegacyElement = _dereq_("./ReactLegacyElement"); -var mergeInto = _dereq_("./mergeInto"); var mapObject = _dereq_("./mapObject"); /** - * Creates a new React class that is idempotent and capable of containing other - * React components. It accepts event listeners and DOM properties that are - * valid according to `DOMProperty`. + * Create a factory that creates HTML tag elements. * - * - Event listeners: `onClick`, `onMouseDown`, etc. - * - DOM properties: `className`, `name`, `title`, etc. - * - * The `style` property functions differently from the DOM API. It accepts an - * object mapping of style properties to values. - * - * @param {boolean} omitClose True if the close tag should be omitted. * @param {string} tag Tag name (e.g. `div`). * @private */ -function createDOMComponentClass(omitClose, tag) { - var Constructor = function(descriptor) { - this.construct(descriptor); - }; - Constructor.prototype = new ReactDOMComponent(tag, omitClose); - Constructor.prototype.constructor = Constructor; - Constructor.displayName = tag; - - var ConvenienceConstructor = ReactDescriptor.createFactory(Constructor); - +function createDOMFactory(tag) { if ("production" !== "development") { - return ReactDescriptorValidator.createFactory( - ConvenienceConstructor + return ReactLegacyElement.markNonLegacyFactory( + ReactElementValidator.createFactory(tag) ); } - - return ConvenienceConstructor; + return ReactLegacyElement.markNonLegacyFactory( + ReactElement.createFactory(tag) + ); } /** @@ -23357,162 +23314,150 @@ function createDOMComponentClass(omitClose, tag) { * @public */ var ReactDOM = mapObject({ - a: false, - abbr: false, - address: false, - area: true, - article: false, - aside: false, - audio: false, - b: false, - base: true, - bdi: false, - bdo: false, - big: false, - blockquote: false, - body: false, - br: true, - button: false, - canvas: false, - caption: false, - cite: false, - code: false, - col: true, - colgroup: false, - data: false, - datalist: false, - dd: false, - del: false, - details: false, - dfn: false, - div: false, - dl: false, - dt: false, - em: false, - embed: true, - fieldset: false, - figcaption: false, - figure: false, - footer: false, - form: false, // NOTE: Injected, see `ReactDOMForm`. - h1: false, - h2: false, - h3: false, - h4: false, - h5: false, - h6: false, - head: false, - header: false, - hr: true, - html: false, - i: false, - iframe: false, - img: true, - input: true, - ins: false, - kbd: false, - keygen: true, - label: false, - legend: false, - li: false, - link: true, - main: false, - map: false, - mark: false, - menu: false, - menuitem: false, // NOTE: Close tag should be omitted, but causes problems. - meta: true, - meter: false, - nav: false, - noscript: false, - object: false, - ol: false, - optgroup: false, - option: false, - output: false, - p: false, - param: true, - pre: false, - progress: false, - q: false, - rp: false, - rt: false, - ruby: false, - s: false, - samp: false, - script: false, - section: false, - select: false, - small: false, - source: true, - span: false, - strong: false, - style: false, - sub: false, - summary: false, - sup: false, - table: false, - tbody: false, - td: false, - textarea: false, // NOTE: Injected, see `ReactDOMTextarea`. - tfoot: false, - th: false, - thead: false, - time: false, - title: false, - tr: false, - track: true, - u: false, - ul: false, - 'var': false, - video: false, - wbr: true, + a: 'a', + abbr: 'abbr', + address: 'address', + area: 'area', + article: 'article', + aside: 'aside', + audio: 'audio', + b: 'b', + base: 'base', + bdi: 'bdi', + bdo: 'bdo', + big: 'big', + blockquote: 'blockquote', + body: 'body', + br: 'br', + button: 'button', + canvas: 'canvas', + caption: 'caption', + cite: 'cite', + code: 'code', + col: 'col', + colgroup: 'colgroup', + data: 'data', + datalist: 'datalist', + dd: 'dd', + del: 'del', + details: 'details', + dfn: 'dfn', + dialog: 'dialog', + div: 'div', + dl: 'dl', + dt: 'dt', + em: 'em', + embed: 'embed', + fieldset: 'fieldset', + figcaption: 'figcaption', + figure: 'figure', + footer: 'footer', + form: 'form', + h1: 'h1', + h2: 'h2', + h3: 'h3', + h4: 'h4', + h5: 'h5', + h6: 'h6', + head: 'head', + header: 'header', + hr: 'hr', + html: 'html', + i: 'i', + iframe: 'iframe', + img: 'img', + input: 'input', + ins: 'ins', + kbd: 'kbd', + keygen: 'keygen', + label: 'label', + legend: 'legend', + li: 'li', + link: 'link', + main: 'main', + map: 'map', + mark: 'mark', + menu: 'menu', + menuitem: 'menuitem', + meta: 'meta', + meter: 'meter', + nav: 'nav', + noscript: 'noscript', + object: 'object', + ol: 'ol', + optgroup: 'optgroup', + option: 'option', + output: 'output', + p: 'p', + param: 'param', + picture: 'picture', + pre: 'pre', + progress: 'progress', + q: 'q', + rp: 'rp', + rt: 'rt', + ruby: 'ruby', + s: 's', + samp: 'samp', + script: 'script', + section: 'section', + select: 'select', + small: 'small', + source: 'source', + span: 'span', + strong: 'strong', + style: 'style', + sub: 'sub', + summary: 'summary', + sup: 'sup', + table: 'table', + tbody: 'tbody', + td: 'td', + textarea: 'textarea', + tfoot: 'tfoot', + th: 'th', + thead: 'thead', + time: 'time', + title: 'title', + tr: 'tr', + track: 'track', + u: 'u', + ul: 'ul', + 'var': 'var', + video: 'video', + wbr: 'wbr', // SVG - circle: false, - defs: false, - ellipse: false, - g: false, - line: false, - linearGradient: false, - mask: false, - path: false, - pattern: false, - polygon: false, - polyline: false, - radialGradient: false, - rect: false, - stop: false, - svg: false, - text: false, - tspan: false -}, createDOMComponentClass); - -var injection = { - injectComponentClasses: function(componentClasses) { - mergeInto(ReactDOM, componentClasses); - } -}; - -ReactDOM.injection = injection; + circle: 'circle', + defs: 'defs', + ellipse: 'ellipse', + g: 'g', + line: 'line', + linearGradient: 'linearGradient', + mask: 'mask', + path: 'path', + pattern: 'pattern', + polygon: 'polygon', + polyline: 'polyline', + radialGradient: 'radialGradient', + rect: 'rect', + stop: 'stop', + svg: 'svg', + text: 'text', + tspan: 'tspan' + +}, createDOMFactory); module.exports = ReactDOM; -},{"./ReactDOMComponent":43,"./ReactDescriptor":56,"./ReactDescriptorValidator":57,"./mapObject":142,"./mergeInto":146}],42:[function(_dereq_,module,exports){ +},{"./ReactElement":58,"./ReactElementValidator":59,"./ReactLegacyElement":67,"./mapObject":148}],44:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * 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 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * 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. + * 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. * * @providesModule ReactDOMButton */ @@ -23522,12 +23467,13 @@ module.exports = ReactDOM; var AutoFocusMixin = _dereq_("./AutoFocusMixin"); var ReactBrowserComponentMixin = _dereq_("./ReactBrowserComponentMixin"); var ReactCompositeComponent = _dereq_("./ReactCompositeComponent"); +var ReactElement = _dereq_("./ReactElement"); var ReactDOM = _dereq_("./ReactDOM"); var keyMirror = _dereq_("./keyMirror"); -// Store a reference to the <button> `ReactDOMComponent`. -var button = ReactDOM.button; +// Store a reference to the <button> `ReactDOMComponent`. TODO: use string +var button = ReactElement.createFactory(ReactDOM.button.type); var mouseListenerNames = keyMirror({ onClick: true, @@ -23569,21 +23515,14 @@ var ReactDOMButton = ReactCompositeComponent.createClass({ module.exports = ReactDOMButton; -},{"./AutoFocusMixin":1,"./ReactBrowserComponentMixin":30,"./ReactCompositeComponent":38,"./ReactDOM":41,"./keyMirror":140}],43:[function(_dereq_,module,exports){ +},{"./AutoFocusMixin":2,"./ReactBrowserComponentMixin":32,"./ReactCompositeComponent":40,"./ReactDOM":43,"./ReactElement":58,"./keyMirror":146}],45:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * 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 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * 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. + * 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. * * @providesModule ReactDOMComponent * @typechecks static-only @@ -23601,11 +23540,12 @@ var ReactMount = _dereq_("./ReactMount"); var ReactMultiChild = _dereq_("./ReactMultiChild"); var ReactPerf = _dereq_("./ReactPerf"); +var assign = _dereq_("./Object.assign"); var escapeTextForBrowser = _dereq_("./escapeTextForBrowser"); var invariant = _dereq_("./invariant"); +var isEventSupported = _dereq_("./isEventSupported"); var keyOf = _dereq_("./keyOf"); -var merge = _dereq_("./merge"); -var mixInto = _dereq_("./mixInto"); +var monitorCodeUse = _dereq_("./monitorCodeUse"); var deleteListener = ReactBrowserEventEmitter.deleteListener; var listenTo = ReactBrowserEventEmitter.listenTo; @@ -23630,6 +23570,16 @@ function assertValidProps(props) { props.children == null || props.dangerouslySetInnerHTML == null, 'Can only set one of `children` or `props.dangerouslySetInnerHTML`.' ) : invariant(props.children == null || props.dangerouslySetInnerHTML == null)); + if ("production" !== "development") { + if (props.contentEditable && props.children != null) { + console.warn( + 'A component is `contentEditable` and contains `children` managed by ' + + 'React. It is now your responsibility to guarantee that none of those '+ + 'nodes are unexpectedly modified or duplicated. This is probably not ' + + 'intentional.' + ); + } + } ("production" !== "development" ? invariant( props.style == null || typeof props.style === 'object', 'The `style` prop expects a mapping from style properties to values, ' + @@ -23638,6 +23588,15 @@ function assertValidProps(props) { } function putListener(id, registrationName, listener, transaction) { + if ("production" !== "development") { + // IE8 has no API for event capturing and the `onScroll` event doesn't + // bubble. + if (registrationName === 'onScroll' && + !isEventSupported('scroll', true)) { + monitorCodeUse('react_no_scroll_event'); + console.warn('This browser doesn\'t support the `onScroll` event'); + } + } var container = ReactMount.findReactContainerForID(id); if (container) { var doc = container.nodeType === ELEMENT_NODE_TYPE ? @@ -23652,18 +23611,66 @@ function putListener(id, registrationName, listener, transaction) { ); } +// For HTML, certain tags should omit their close tag. We keep a whitelist for +// those special cased tags. + +var omittedCloseTags = { + 'area': true, + 'base': true, + 'br': true, + 'col': true, + 'embed': true, + 'hr': true, + 'img': true, + 'input': true, + 'keygen': true, + 'link': true, + 'meta': true, + 'param': true, + 'source': true, + 'track': true, + 'wbr': true + // NOTE: menuitem's close tag should be omitted, but that causes problems. +}; + +// We accept any tag to be rendered but since this gets injected into abitrary +// HTML, we want to make sure that it's a safe tag. +// http://www.w3.org/TR/REC-xml/#NT-Name + +var VALID_TAG_REGEX = /^[a-zA-Z][a-zA-Z:_\.\-\d]*$/; // Simplified subset +var validatedTagCache = {}; +var hasOwnProperty = {}.hasOwnProperty; + +function validateDangerousTag(tag) { + if (!hasOwnProperty.call(validatedTagCache, tag)) { + ("production" !== "development" ? invariant(VALID_TAG_REGEX.test(tag), 'Invalid tag: %s', tag) : invariant(VALID_TAG_REGEX.test(tag))); + validatedTagCache[tag] = true; + } +} /** + * Creates a new React class that is idempotent and capable of containing other + * React components. It accepts event listeners and DOM properties that are + * valid according to `DOMProperty`. + * + * - Event listeners: `onClick`, `onMouseDown`, etc. + * - DOM properties: `className`, `name`, `title`, etc. + * + * The `style` property functions differently from the DOM API. It accepts an + * object mapping of style properties to values. + * * @constructor ReactDOMComponent * @extends ReactComponent * @extends ReactMultiChild */ -function ReactDOMComponent(tag, omitClose) { - this._tagOpen = '<' + tag; - this._tagClose = omitClose ? '' : '</' + tag + '>'; +function ReactDOMComponent(tag) { + validateDangerousTag(tag); + this._tag = tag; this.tagName = tag.toUpperCase(); } +ReactDOMComponent.displayName = 'ReactDOMComponent'; + ReactDOMComponent.Mixin = { /** @@ -23687,10 +23694,11 @@ ReactDOMComponent.Mixin = { mountDepth ); assertValidProps(this.props); + var closeTag = omittedCloseTags[this._tag] ? '' : '</' + this._tag + '>'; return ( this._createOpenTagMarkupAndPutListeners(transaction) + this._createContentMarkup(transaction) + - this._tagClose + closeTag ); } ), @@ -23709,7 +23717,7 @@ ReactDOMComponent.Mixin = { */ _createOpenTagMarkupAndPutListeners: function(transaction) { var props = this.props; - var ret = this._tagOpen; + var ret = '<' + this._tag; for (var propKey in props) { if (!props.hasOwnProperty(propKey)) { @@ -23724,7 +23732,7 @@ ReactDOMComponent.Mixin = { } else { if (propKey === STYLE) { if (propValue) { - propValue = props.style = merge(props.style); + propValue = props.style = assign({}, props.style); } propValue = CSSPropertyOperations.createMarkupForStyles(propValue); } @@ -23777,22 +23785,22 @@ ReactDOMComponent.Mixin = { return ''; }, - receiveComponent: function(nextDescriptor, transaction) { - if (nextDescriptor === this._descriptor && - nextDescriptor._owner != null) { - // Since descriptors are immutable after the owner is rendered, + receiveComponent: function(nextElement, transaction) { + if (nextElement === this._currentElement && + nextElement._owner != null) { + // Since elements are immutable after the owner is rendered, // we can do a cheap identity compare here to determine if this is a // superfluous reconcile. It's possible for state to be mutable but such // change should trigger an update of the owner which would recreate - // the descriptor. We explicitly check for the existence of an owner since - // it's possible for a descriptor created outside a composite to be + // the element. We explicitly check for the existence of an owner since + // it's possible for a element created outside a composite to be // deeply mutated and reused. return; } ReactComponent.Mixin.receiveComponent.call( this, - nextDescriptor, + nextElement, transaction ); }, @@ -23802,22 +23810,22 @@ ReactDOMComponent.Mixin = { * attached to the DOM. Reconciles the root DOM node, then recurses. * * @param {ReactReconcileTransaction} transaction - * @param {ReactDescriptor} prevDescriptor + * @param {ReactElement} prevElement * @internal * @overridable */ updateComponent: ReactPerf.measure( 'ReactDOMComponent', 'updateComponent', - function(transaction, prevDescriptor) { - assertValidProps(this._descriptor.props); + function(transaction, prevElement) { + assertValidProps(this._currentElement.props); ReactComponent.Mixin.updateComponent.call( this, transaction, - prevDescriptor + prevElement ); - this._updateDOMProperties(prevDescriptor.props, transaction); - this._updateDOMChildren(prevDescriptor.props, transaction); + this._updateDOMProperties(prevElement.props, transaction); + this._updateDOMChildren(prevElement.props, transaction); } ), @@ -23873,7 +23881,7 @@ ReactDOMComponent.Mixin = { } if (propKey === STYLE) { if (nextProp) { - nextProp = nextProps.style = merge(nextProp); + nextProp = nextProps.style = assign({}, nextProp); } if (lastProp) { // Unset styles on `lastProp` but not on `nextProp`. @@ -23982,28 +23990,24 @@ ReactDOMComponent.Mixin = { }; -mixInto(ReactDOMComponent, ReactComponent.Mixin); -mixInto(ReactDOMComponent, ReactDOMComponent.Mixin); -mixInto(ReactDOMComponent, ReactMultiChild.Mixin); -mixInto(ReactDOMComponent, ReactBrowserComponentMixin); +assign( + ReactDOMComponent.prototype, + ReactComponent.Mixin, + ReactDOMComponent.Mixin, + ReactMultiChild.Mixin, + ReactBrowserComponentMixin +); module.exports = ReactDOMComponent; -},{"./CSSPropertyOperations":5,"./DOMProperty":11,"./DOMPropertyOperations":12,"./ReactBrowserComponentMixin":30,"./ReactBrowserEventEmitter":31,"./ReactComponent":35,"./ReactMount":67,"./ReactMultiChild":68,"./ReactPerf":71,"./escapeTextForBrowser":118,"./invariant":134,"./keyOf":141,"./merge":144,"./mixInto":147}],44:[function(_dereq_,module,exports){ +},{"./CSSPropertyOperations":6,"./DOMProperty":12,"./DOMPropertyOperations":13,"./Object.assign":29,"./ReactBrowserComponentMixin":32,"./ReactBrowserEventEmitter":33,"./ReactComponent":37,"./ReactMount":70,"./ReactMultiChild":71,"./ReactPerf":75,"./escapeTextForBrowser":123,"./invariant":140,"./isEventSupported":141,"./keyOf":147,"./monitorCodeUse":150}],46:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * 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 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * 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. + * 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. * * @providesModule ReactDOMForm */ @@ -24014,10 +24018,11 @@ var EventConstants = _dereq_("./EventConstants"); var LocalEventTrapMixin = _dereq_("./LocalEventTrapMixin"); var ReactBrowserComponentMixin = _dereq_("./ReactBrowserComponentMixin"); var ReactCompositeComponent = _dereq_("./ReactCompositeComponent"); +var ReactElement = _dereq_("./ReactElement"); var ReactDOM = _dereq_("./ReactDOM"); -// Store a reference to the <form> `ReactDOMComponent`. -var form = ReactDOM.form; +// Store a reference to the <form> `ReactDOMComponent`. TODO: use string +var form = ReactElement.createFactory(ReactDOM.form.type); /** * Since onSubmit doesn't bubble OR capture on the top level in IE8, we need @@ -24034,7 +24039,7 @@ var ReactDOMForm = ReactCompositeComponent.createClass({ // TODO: Instead of using `ReactDOM` directly, we should use JSX. However, // `jshint` fails to parse JSX so in order for linting to work in the open // source repo, we need to just use `ReactDOM.form`. - return this.transferPropsTo(form(null, this.props.children)); + return form(this.props); }, componentDidMount: function() { @@ -24045,21 +24050,14 @@ var ReactDOMForm = ReactCompositeComponent.createClass({ module.exports = ReactDOMForm; -},{"./EventConstants":16,"./LocalEventTrapMixin":26,"./ReactBrowserComponentMixin":30,"./ReactCompositeComponent":38,"./ReactDOM":41}],45:[function(_dereq_,module,exports){ +},{"./EventConstants":17,"./LocalEventTrapMixin":27,"./ReactBrowserComponentMixin":32,"./ReactCompositeComponent":40,"./ReactDOM":43,"./ReactElement":58}],47:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * 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 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * 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. + * 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. * * @providesModule ReactDOMIDOperations * @typechecks static-only @@ -24236,21 +24234,14 @@ var ReactDOMIDOperations = { module.exports = ReactDOMIDOperations; -},{"./CSSPropertyOperations":5,"./DOMChildrenOperations":10,"./DOMPropertyOperations":12,"./ReactMount":67,"./ReactPerf":71,"./invariant":134,"./setInnerHTML":152}],46:[function(_dereq_,module,exports){ +},{"./CSSPropertyOperations":6,"./DOMChildrenOperations":11,"./DOMPropertyOperations":13,"./ReactMount":70,"./ReactPerf":75,"./invariant":140,"./setInnerHTML":154}],48:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * 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 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * 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. + * 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. * * @providesModule ReactDOMImg */ @@ -24261,10 +24252,11 @@ var EventConstants = _dereq_("./EventConstants"); var LocalEventTrapMixin = _dereq_("./LocalEventTrapMixin"); var ReactBrowserComponentMixin = _dereq_("./ReactBrowserComponentMixin"); var ReactCompositeComponent = _dereq_("./ReactCompositeComponent"); +var ReactElement = _dereq_("./ReactElement"); var ReactDOM = _dereq_("./ReactDOM"); -// Store a reference to the <img> `ReactDOMComponent`. -var img = ReactDOM.img; +// Store a reference to the <img> `ReactDOMComponent`. TODO: use string +var img = ReactElement.createFactory(ReactDOM.img.type); /** * Since onLoad doesn't bubble OR capture on the top level in IE8, we need to @@ -24290,21 +24282,14 @@ var ReactDOMImg = ReactCompositeComponent.createClass({ module.exports = ReactDOMImg; -},{"./EventConstants":16,"./LocalEventTrapMixin":26,"./ReactBrowserComponentMixin":30,"./ReactCompositeComponent":38,"./ReactDOM":41}],47:[function(_dereq_,module,exports){ +},{"./EventConstants":17,"./LocalEventTrapMixin":27,"./ReactBrowserComponentMixin":32,"./ReactCompositeComponent":40,"./ReactDOM":43,"./ReactElement":58}],49:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * 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 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * 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. + * 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. * * @providesModule ReactDOMInput */ @@ -24316,17 +24301,26 @@ var DOMPropertyOperations = _dereq_("./DOMPropertyOperations"); var LinkedValueUtils = _dereq_("./LinkedValueUtils"); var ReactBrowserComponentMixin = _dereq_("./ReactBrowserComponentMixin"); var ReactCompositeComponent = _dereq_("./ReactCompositeComponent"); +var ReactElement = _dereq_("./ReactElement"); var ReactDOM = _dereq_("./ReactDOM"); var ReactMount = _dereq_("./ReactMount"); +var ReactUpdates = _dereq_("./ReactUpdates"); +var assign = _dereq_("./Object.assign"); var invariant = _dereq_("./invariant"); -var merge = _dereq_("./merge"); -// Store a reference to the <input> `ReactDOMComponent`. -var input = ReactDOM.input; +// Store a reference to the <input> `ReactDOMComponent`. TODO: use string +var input = ReactElement.createFactory(ReactDOM.input.type); var instancesByReactID = {}; +function forceUpdateIfMounted() { + /*jshint validthis:true */ + if (this.isMounted()) { + this.forceUpdate(); + } +} + /** * Implements an <input> native component that allows setting these optional * props: `checked`, `value`, `defaultChecked`, and `defaultValue`. @@ -24351,28 +24345,23 @@ var ReactDOMInput = ReactCompositeComponent.createClass({ getInitialState: function() { var defaultValue = this.props.defaultValue; return { - checked: this.props.defaultChecked || false, - value: defaultValue != null ? defaultValue : null + initialChecked: this.props.defaultChecked || false, + initialValue: defaultValue != null ? defaultValue : null }; }, - shouldComponentUpdate: function() { - // Defer any updates to this component during the `onChange` handler. - return !this._isChanging; - }, - render: function() { // Clone `this.props` so we don't mutate the input. - var props = merge(this.props); + var props = assign({}, this.props); props.defaultChecked = null; props.defaultValue = null; var value = LinkedValueUtils.getValue(this); - props.value = value != null ? value : this.state.value; + props.value = value != null ? value : this.state.initialValue; var checked = LinkedValueUtils.getChecked(this); - props.checked = checked != null ? checked : this.state.checked; + props.checked = checked != null ? checked : this.state.initialChecked; props.onChange = this._handleChange; @@ -24412,14 +24401,12 @@ var ReactDOMInput = ReactCompositeComponent.createClass({ var returnValue; var onChange = LinkedValueUtils.getOnChange(this); if (onChange) { - this._isChanging = true; returnValue = onChange.call(this, event); - this._isChanging = false; } - this.setState({ - checked: event.target.checked, - value: event.target.value - }); + // Here we use asap to wait until all updates have propagated, which + // is important when using controlled components within layers: + // https://github.com/facebook/react/issues/1698 + ReactUpdates.asap(forceUpdateIfMounted, this); var name = this.props.name; if (this.props.type === 'radio' && name != null) { @@ -24457,13 +24444,10 @@ var ReactDOMInput = ReactCompositeComponent.createClass({ 'ReactDOMInput: Unknown radio button ID %s.', otherID ) : invariant(otherInstance)); - // In some cases, this will actually change the `checked` state value. - // In other cases, there's no change but this forces a reconcile upon - // which componentDidUpdate will reset the DOM property to whatever it - // should be. - otherInstance.setState({ - checked: false - }); + // If this is a controlled radio button group, forcing the input that + // was previously checked to update will cause it to be come re-checked + // as appropriate. + ReactUpdates.asap(forceUpdateIfMounted, otherInstance); } } @@ -24474,21 +24458,14 @@ var ReactDOMInput = ReactCompositeComponent.createClass({ module.exports = ReactDOMInput; -},{"./AutoFocusMixin":1,"./DOMPropertyOperations":12,"./LinkedValueUtils":25,"./ReactBrowserComponentMixin":30,"./ReactCompositeComponent":38,"./ReactDOM":41,"./ReactMount":67,"./invariant":134,"./merge":144}],48:[function(_dereq_,module,exports){ +},{"./AutoFocusMixin":2,"./DOMPropertyOperations":13,"./LinkedValueUtils":26,"./Object.assign":29,"./ReactBrowserComponentMixin":32,"./ReactCompositeComponent":40,"./ReactDOM":43,"./ReactElement":58,"./ReactMount":70,"./ReactUpdates":91,"./invariant":140}],50:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * 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 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * 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. + * 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. * * @providesModule ReactDOMOption */ @@ -24497,12 +24474,13 @@ module.exports = ReactDOMInput; var ReactBrowserComponentMixin = _dereq_("./ReactBrowserComponentMixin"); var ReactCompositeComponent = _dereq_("./ReactCompositeComponent"); +var ReactElement = _dereq_("./ReactElement"); var ReactDOM = _dereq_("./ReactDOM"); var warning = _dereq_("./warning"); -// Store a reference to the <option> `ReactDOMComponent`. -var option = ReactDOM.option; +// Store a reference to the <option> `ReactDOMComponent`. TODO: use string +var option = ReactElement.createFactory(ReactDOM.option.type); /** * Implements an <option> native component that warns when `selected` is set. @@ -24531,21 +24509,14 @@ var ReactDOMOption = ReactCompositeComponent.createClass({ module.exports = ReactDOMOption; -},{"./ReactBrowserComponentMixin":30,"./ReactCompositeComponent":38,"./ReactDOM":41,"./warning":158}],49:[function(_dereq_,module,exports){ +},{"./ReactBrowserComponentMixin":32,"./ReactCompositeComponent":40,"./ReactDOM":43,"./ReactElement":58,"./warning":160}],51:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * 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 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * 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. + * 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. * * @providesModule ReactDOMSelect */ @@ -24556,12 +24527,22 @@ var AutoFocusMixin = _dereq_("./AutoFocusMixin"); var LinkedValueUtils = _dereq_("./LinkedValueUtils"); var ReactBrowserComponentMixin = _dereq_("./ReactBrowserComponentMixin"); var ReactCompositeComponent = _dereq_("./ReactCompositeComponent"); +var ReactElement = _dereq_("./ReactElement"); var ReactDOM = _dereq_("./ReactDOM"); +var ReactUpdates = _dereq_("./ReactUpdates"); -var merge = _dereq_("./merge"); +var assign = _dereq_("./Object.assign"); -// Store a reference to the <select> `ReactDOMComponent`. -var select = ReactDOM.select; +// Store a reference to the <select> `ReactDOMComponent`. TODO: use string +var select = ReactElement.createFactory(ReactDOM.select.type); + +function updateWithPendingValueIfMounted() { + /*jshint validthis:true */ + if (this.isMounted()) { + this.setState({value: this._pendingValue}); + this._pendingValue = 0; + } +} /** * Validation function for `value` and `defaultValue`. @@ -24648,6 +24629,10 @@ var ReactDOMSelect = ReactCompositeComponent.createClass({ return {value: this.props.defaultValue || (this.props.multiple ? [] : '')}; }, + componentWillMount: function() { + this._pendingValue = null; + }, + componentWillReceiveProps: function(nextProps) { if (!this.props.multiple && nextProps.multiple) { this.setState({value: [this.state.value]}); @@ -24656,14 +24641,9 @@ var ReactDOMSelect = ReactCompositeComponent.createClass({ } }, - shouldComponentUpdate: function() { - // Defer any updates to this component during the `onChange` handler. - return !this._isChanging; - }, - render: function() { // Clone `this.props` so we don't mutate the input. - var props = merge(this.props); + var props = assign({}, this.props); props.onChange = this._handleChange; props.value = null; @@ -24688,9 +24668,7 @@ var ReactDOMSelect = ReactCompositeComponent.createClass({ var returnValue; var onChange = LinkedValueUtils.getOnChange(this); if (onChange) { - this._isChanging = true; returnValue = onChange.call(this, event); - this._isChanging = false; } var selectedValue; @@ -24706,7 +24684,8 @@ var ReactDOMSelect = ReactCompositeComponent.createClass({ selectedValue = event.target.value; } - this.setState({value: selectedValue}); + this._pendingValue = selectedValue; + ReactUpdates.asap(updateWithPendingValueIfMounted, this); return returnValue; } @@ -24714,21 +24693,14 @@ var ReactDOMSelect = ReactCompositeComponent.createClass({ module.exports = ReactDOMSelect; -},{"./AutoFocusMixin":1,"./LinkedValueUtils":25,"./ReactBrowserComponentMixin":30,"./ReactCompositeComponent":38,"./ReactDOM":41,"./merge":144}],50:[function(_dereq_,module,exports){ +},{"./AutoFocusMixin":2,"./LinkedValueUtils":26,"./Object.assign":29,"./ReactBrowserComponentMixin":32,"./ReactCompositeComponent":40,"./ReactDOM":43,"./ReactElement":58,"./ReactUpdates":91}],52:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * 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 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * 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. + * 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. * * @providesModule ReactDOMSelection */ @@ -24787,9 +24759,9 @@ function getIEOffsets(node) { * @return {?object} */ function getModernOffsets(node) { - var selection = window.getSelection(); + var selection = window.getSelection && window.getSelection(); - if (selection.rangeCount === 0) { + if (!selection || selection.rangeCount === 0) { return null; } @@ -24831,7 +24803,6 @@ function getModernOffsets(node) { detectionRange.setStart(anchorNode, anchorOffset); detectionRange.setEnd(focusNode, focusOffset); var isBackward = detectionRange.collapsed; - detectionRange.detach(); return { start: isBackward ? end : start, @@ -24878,8 +24849,11 @@ function setIEOffsets(node, offsets) { * @param {object} offsets */ function setModernOffsets(node, offsets) { - var selection = window.getSelection(); + if (!window.getSelection) { + return; + } + var selection = window.getSelection(); var length = node[getTextContentAccessor()].length; var start = Math.min(offsets.start, length); var end = typeof offsets.end === 'undefined' ? @@ -24908,8 +24882,6 @@ function setModernOffsets(node, offsets) { range.setEnd(endMarker.node, endMarker.offset); selection.addRange(range); } - - range.detach(); } } @@ -24930,21 +24902,14 @@ var ReactDOMSelection = { module.exports = ReactDOMSelection; -},{"./ExecutionEnvironment":22,"./getNodeForCharacterOffset":127,"./getTextContentAccessor":129}],51:[function(_dereq_,module,exports){ +},{"./ExecutionEnvironment":23,"./getNodeForCharacterOffset":133,"./getTextContentAccessor":135}],53:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * 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 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * 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. + * 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. * * @providesModule ReactDOMTextarea */ @@ -24956,15 +24921,24 @@ var DOMPropertyOperations = _dereq_("./DOMPropertyOperations"); var LinkedValueUtils = _dereq_("./LinkedValueUtils"); var ReactBrowserComponentMixin = _dereq_("./ReactBrowserComponentMixin"); var ReactCompositeComponent = _dereq_("./ReactCompositeComponent"); +var ReactElement = _dereq_("./ReactElement"); var ReactDOM = _dereq_("./ReactDOM"); +var ReactUpdates = _dereq_("./ReactUpdates"); +var assign = _dereq_("./Object.assign"); var invariant = _dereq_("./invariant"); -var merge = _dereq_("./merge"); var warning = _dereq_("./warning"); -// Store a reference to the <textarea> `ReactDOMComponent`. -var textarea = ReactDOM.textarea; +// Store a reference to the <textarea> `ReactDOMComponent`. TODO: use string +var textarea = ReactElement.createFactory(ReactDOM.textarea.type); + +function forceUpdateIfMounted() { + /*jshint validthis:true */ + if (this.isMounted()) { + this.forceUpdate(); + } +} /** * Implements a <textarea> native component that allows setting `value`, and @@ -25025,14 +24999,9 @@ var ReactDOMTextarea = ReactCompositeComponent.createClass({ }; }, - shouldComponentUpdate: function() { - // Defer any updates to this component during the `onChange` handler. - return !this._isChanging; - }, - render: function() { // Clone `this.props` so we don't mutate the input. - var props = merge(this.props); + var props = assign({}, this.props); ("production" !== "development" ? invariant( props.dangerouslySetInnerHTML == null, @@ -25062,11 +25031,9 @@ var ReactDOMTextarea = ReactCompositeComponent.createClass({ var returnValue; var onChange = LinkedValueUtils.getOnChange(this); if (onChange) { - this._isChanging = true; returnValue = onChange.call(this, event); - this._isChanging = false; } - this.setState({value: event.target.value}); + ReactUpdates.asap(forceUpdateIfMounted, this); return returnValue; } @@ -25074,21 +25041,14 @@ var ReactDOMTextarea = ReactCompositeComponent.createClass({ module.exports = ReactDOMTextarea; -},{"./AutoFocusMixin":1,"./DOMPropertyOperations":12,"./LinkedValueUtils":25,"./ReactBrowserComponentMixin":30,"./ReactCompositeComponent":38,"./ReactDOM":41,"./invariant":134,"./merge":144,"./warning":158}],52:[function(_dereq_,module,exports){ +},{"./AutoFocusMixin":2,"./DOMPropertyOperations":13,"./LinkedValueUtils":26,"./Object.assign":29,"./ReactBrowserComponentMixin":32,"./ReactCompositeComponent":40,"./ReactDOM":43,"./ReactElement":58,"./ReactUpdates":91,"./invariant":140,"./warning":160}],54:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * 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 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * 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. + * 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. * * @providesModule ReactDefaultBatchingStrategy */ @@ -25098,8 +25058,8 @@ module.exports = ReactDOMTextarea; var ReactUpdates = _dereq_("./ReactUpdates"); var Transaction = _dereq_("./Transaction"); +var assign = _dereq_("./Object.assign"); var emptyFunction = _dereq_("./emptyFunction"); -var mixInto = _dereq_("./mixInto"); var RESET_BATCHED_UPDATES = { initialize: emptyFunction, @@ -25119,12 +25079,15 @@ function ReactDefaultBatchingStrategyTransaction() { this.reinitializeTransaction(); } -mixInto(ReactDefaultBatchingStrategyTransaction, Transaction.Mixin); -mixInto(ReactDefaultBatchingStrategyTransaction, { - getTransactionWrappers: function() { - return TRANSACTION_WRAPPERS; +assign( + ReactDefaultBatchingStrategyTransaction.prototype, + Transaction.Mixin, + { + getTransactionWrappers: function() { + return TRANSACTION_WRAPPERS; + } } -}); +); var transaction = new ReactDefaultBatchingStrategyTransaction(); @@ -25151,21 +25114,14 @@ var ReactDefaultBatchingStrategy = { module.exports = ReactDefaultBatchingStrategy; -},{"./ReactUpdates":87,"./Transaction":104,"./emptyFunction":116,"./mixInto":147}],53:[function(_dereq_,module,exports){ +},{"./Object.assign":29,"./ReactUpdates":91,"./Transaction":107,"./emptyFunction":121}],55:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * 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 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * 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. + * 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. * * @providesModule ReactDefaultInjection */ @@ -25185,7 +25141,7 @@ var ReactBrowserComponentMixin = _dereq_("./ReactBrowserComponentMixin"); var ReactComponentBrowserEnvironment = _dereq_("./ReactComponentBrowserEnvironment"); var ReactDefaultBatchingStrategy = _dereq_("./ReactDefaultBatchingStrategy"); -var ReactDOM = _dereq_("./ReactDOM"); +var ReactDOMComponent = _dereq_("./ReactDOMComponent"); var ReactDOMButton = _dereq_("./ReactDOMButton"); var ReactDOMForm = _dereq_("./ReactDOMForm"); var ReactDOMImg = _dereq_("./ReactDOMImg"); @@ -25230,18 +25186,22 @@ function inject() { BeforeInputEventPlugin: BeforeInputEventPlugin }); - ReactInjection.DOM.injectComponentClasses({ - button: ReactDOMButton, - form: ReactDOMForm, - img: ReactDOMImg, - input: ReactDOMInput, - option: ReactDOMOption, - select: ReactDOMSelect, - textarea: ReactDOMTextarea, - - html: createFullPageComponent(ReactDOM.html), - head: createFullPageComponent(ReactDOM.head), - body: createFullPageComponent(ReactDOM.body) + ReactInjection.NativeComponent.injectGenericComponentClass( + ReactDOMComponent + ); + + ReactInjection.NativeComponent.injectComponentClasses({ + 'button': ReactDOMButton, + 'form': ReactDOMForm, + 'img': ReactDOMImg, + 'input': ReactDOMInput, + 'option': ReactDOMOption, + 'select': ReactDOMSelect, + 'textarea': ReactDOMTextarea, + + 'html': createFullPageComponent('html'), + 'head': createFullPageComponent('head'), + 'body': createFullPageComponent('body') }); // This needs to happen after createFullPageComponent() otherwise the mixin @@ -25251,7 +25211,7 @@ function inject() { ReactInjection.DOMProperty.injectDOMPropertyConfig(HTMLDOMPropertyConfig); ReactInjection.DOMProperty.injectDOMPropertyConfig(SVGDOMPropertyConfig); - ReactInjection.EmptyComponent.injectEmptyComponent(ReactDOM.noscript); + ReactInjection.EmptyComponent.injectEmptyComponent('noscript'); ReactInjection.Updates.injectReconcileTransaction( ReactComponentBrowserEnvironment.ReactReconcileTransaction @@ -25281,21 +25241,14 @@ module.exports = { inject: inject }; -},{"./BeforeInputEventPlugin":2,"./ChangeEventPlugin":7,"./ClientReactRootIndex":8,"./CompositionEventPlugin":9,"./DefaultEventPluginOrder":14,"./EnterLeaveEventPlugin":15,"./ExecutionEnvironment":22,"./HTMLDOMPropertyConfig":23,"./MobileSafariClickEventPlugin":27,"./ReactBrowserComponentMixin":30,"./ReactComponentBrowserEnvironment":36,"./ReactDOM":41,"./ReactDOMButton":42,"./ReactDOMForm":44,"./ReactDOMImg":46,"./ReactDOMInput":47,"./ReactDOMOption":48,"./ReactDOMSelect":49,"./ReactDOMTextarea":51,"./ReactDefaultBatchingStrategy":52,"./ReactDefaultPerf":54,"./ReactEventListener":61,"./ReactInjection":62,"./ReactInstanceHandles":64,"./ReactMount":67,"./SVGDOMPropertyConfig":89,"./SelectEventPlugin":90,"./ServerReactRootIndex":91,"./SimpleEventPlugin":92,"./createFullPageComponent":112}],54:[function(_dereq_,module,exports){ +},{"./BeforeInputEventPlugin":3,"./ChangeEventPlugin":8,"./ClientReactRootIndex":9,"./CompositionEventPlugin":10,"./DefaultEventPluginOrder":15,"./EnterLeaveEventPlugin":16,"./ExecutionEnvironment":23,"./HTMLDOMPropertyConfig":24,"./MobileSafariClickEventPlugin":28,"./ReactBrowserComponentMixin":32,"./ReactComponentBrowserEnvironment":38,"./ReactDOMButton":44,"./ReactDOMComponent":45,"./ReactDOMForm":46,"./ReactDOMImg":48,"./ReactDOMInput":49,"./ReactDOMOption":50,"./ReactDOMSelect":51,"./ReactDOMTextarea":53,"./ReactDefaultBatchingStrategy":54,"./ReactDefaultPerf":56,"./ReactEventListener":63,"./ReactInjection":64,"./ReactInstanceHandles":66,"./ReactMount":70,"./SVGDOMPropertyConfig":92,"./SelectEventPlugin":93,"./ServerReactRootIndex":94,"./SimpleEventPlugin":95,"./createFullPageComponent":116}],56:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * 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 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * 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. + * 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. * * @providesModule ReactDefaultPerf * @typechecks static-only @@ -25374,19 +25327,23 @@ var ReactDefaultPerf = { ); }, - printWasted: function(measurements) { - measurements = measurements || ReactDefaultPerf._allMeasurements; + getMeasurementsSummaryMap: function(measurements) { var summary = ReactDefaultPerfAnalysis.getInclusiveSummary( measurements, true ); - console.table(summary.map(function(item) { + return summary.map(function(item) { return { 'Owner > component': item.componentName, 'Wasted time (ms)': item.time, 'Instances': item.count }; - })); + }); + }, + + printWasted: function(measurements) { + measurements = measurements || ReactDefaultPerf._allMeasurements; + console.table(ReactDefaultPerf.getMeasurementsSummaryMap(measurements)); console.log( 'Total time:', ReactDefaultPerfAnalysis.getTotalTime(measurements).toFixed(2) + ' ms' @@ -25424,7 +25381,7 @@ var ReactDefaultPerf = { }, measure: function(moduleName, fnName, func) { - return function() {var args=Array.prototype.slice.call(arguments,0); + return function() {for (var args=[],$__0=0,$__1=arguments.length;$__0<$__1;$__0++) args.push(arguments[$__0]); var totalTime; var rv; var start; @@ -25544,26 +25501,19 @@ var ReactDefaultPerf = { module.exports = ReactDefaultPerf; -},{"./DOMProperty":11,"./ReactDefaultPerfAnalysis":55,"./ReactMount":67,"./ReactPerf":71,"./performanceNow":151}],55:[function(_dereq_,module,exports){ +},{"./DOMProperty":12,"./ReactDefaultPerfAnalysis":57,"./ReactMount":70,"./ReactPerf":75,"./performanceNow":153}],57:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * 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 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * 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. + * 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. * * @providesModule ReactDefaultPerfAnalysis */ -var merge = _dereq_("./merge"); +var assign = _dereq_("./Object.assign"); // Don't try to save users less than 1.2ms (a number I made up) var DONT_CARE_THRESHOLD = 1.2; @@ -25618,7 +25568,11 @@ function getExclusiveSummary(measurements) { for (var i = 0; i < measurements.length; i++) { var measurement = measurements[i]; - var allIDs = merge(measurement.exclusive, measurement.inclusive); + var allIDs = assign( + {}, + measurement.exclusive, + measurement.inclusive + ); for (var id in allIDs) { displayName = measurement.displayNames[id].current; @@ -25666,7 +25620,11 @@ function getInclusiveSummary(measurements, onlyClean) { for (var i = 0; i < measurements.length; i++) { var measurement = measurements[i]; - var allIDs = merge(measurement.exclusive, measurement.inclusive); + var allIDs = assign( + {}, + measurement.exclusive, + measurement.inclusive + ); var cleanComponents; if (onlyClean) { @@ -25721,11 +25679,11 @@ function getUnchangedComponents(measurement) { // the amount of time it took to render the entire subtree. var cleanComponents = {}; var dirtyLeafIDs = Object.keys(measurement.writes); - var allIDs = merge(measurement.exclusive, measurement.inclusive); + var allIDs = assign({}, measurement.exclusive, measurement.inclusive); for (var id in allIDs) { var isDirty = false; - // For each component that rendered, see if a component that triggerd + // For each component that rendered, see if a component that triggered // a DOM op is in its subtree. for (var i = 0; i < dirtyLeafIDs.length; i++) { if (dirtyLeafIDs[i].indexOf(id) === 0) { @@ -25749,23 +25707,16 @@ var ReactDefaultPerfAnalysis = { module.exports = ReactDefaultPerfAnalysis; -},{"./merge":144}],56:[function(_dereq_,module,exports){ +},{"./Object.assign":29}],58:[function(_dereq_,module,exports){ /** - * Copyright 2014 Facebook, Inc. - * - * 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 + * Copyright 2014, Facebook, Inc. + * All rights reserved. * - * 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. + * 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. * - * @providesModule ReactDescriptor + * @providesModule ReactElement */ "use strict"; @@ -25773,9 +25724,13 @@ module.exports = ReactDefaultPerfAnalysis; var ReactContext = _dereq_("./ReactContext"); var ReactCurrentOwner = _dereq_("./ReactCurrentOwner"); -var merge = _dereq_("./merge"); var warning = _dereq_("./warning"); +var RESERVED_PROPS = { + key: true, + ref: true +}; + /** * Warn for mutations. * @@ -25817,7 +25772,7 @@ var useMutationMembrane = false; * Warn for mutations. * * @internal - * @param {object} descriptor + * @param {object} element */ function defineMutationMembrane(prototype) { try { @@ -25834,161 +25789,145 @@ function defineMutationMembrane(prototype) { } /** - * Transfer static properties from the source to the target. Functions are - * rebound to have this reflect the original source. - */ -function proxyStaticMethods(target, source) { - if (typeof source !== 'function') { - return; - } - for (var key in source) { - if (source.hasOwnProperty(key)) { - var value = source[key]; - if (typeof value === 'function') { - var bound = value.bind(source); - // Copy any properties defined on the function, such as `isRequired` on - // a PropTypes validator. (mergeInto refuses to work on functions.) - for (var k in value) { - if (value.hasOwnProperty(k)) { - bound[k] = value[k]; - } - } - target[key] = bound; - } else { - target[key] = value; - } - } - } -} - -/** - * Base constructor for all React descriptors. This is only used to make this + * Base constructor for all React elements. This is only used to make this * work with a dynamic instanceof check. Nothing should live on this prototype. * * @param {*} type + * @param {string|object} ref + * @param {*} key + * @param {*} props * @internal */ -var ReactDescriptor = function() {}; - -if ("production" !== "development") { - defineMutationMembrane(ReactDescriptor.prototype); -} +var ReactElement = function(type, key, ref, owner, context, props) { + // Built-in properties that belong on the element + this.type = type; + this.key = key; + this.ref = ref; -ReactDescriptor.createFactory = function(type) { + // Record the component responsible for creating this element. + this._owner = owner; - var descriptorPrototype = Object.create(ReactDescriptor.prototype); + // TODO: Deprecate withContext, and then the context becomes accessible + // through the owner. + this._context = context; - var factory = function(props, children) { - // For consistency we currently allocate a new object for every descriptor. - // This protects the descriptor from being mutated by the original props - // object being mutated. It also protects the original props object from - // being mutated by children arguments and default props. This behavior - // comes with a performance cost and could be deprecated in the future. - // It could also be optimized with a smarter JSX transform. - if (props == null) { - props = {}; - } else if (typeof props === 'object') { - props = merge(props); + if ("production" !== "development") { + // The validation flag and props are currently mutative. We put them 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. + this._store = { validated: false, props: props }; + + // We're not allowed to set props directly on the object so we early + // return and rely on the prototype membrane to forward to the backing + // store. + if (useMutationMembrane) { + Object.freeze(this); + return; } + } - // Children can be more than one argument, and those are transferred onto - // the newly allocated props object. - var childrenLength = arguments.length - 1; - 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 + 1]; - } - props.children = childArray; - } + this.props = props; +}; - // Initialize the descriptor object - var descriptor = Object.create(descriptorPrototype); +// We intentionally don't expose the function on the constructor property. +// ReactElement should be indistinguishable from a plain object. +ReactElement.prototype = { + _isReactElement: true +}; - // Record the component responsible for creating this descriptor. - descriptor._owner = ReactCurrentOwner.current; +if ("production" !== "development") { + defineMutationMembrane(ReactElement.prototype); +} - // TODO: Deprecate withContext, and then the context becomes accessible - // through the owner. - descriptor._context = ReactContext.current; +ReactElement.createElement = function(type, config, children) { + var propName; - if ("production" !== "development") { - // The validation flag and props are currently mutative. We put them 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. - descriptor._store = { validated: false, props: props }; + // Reserved names are extracted + var props = {}; - // We're not allowed to set props directly on the object so we early - // return and rely on the prototype membrane to forward to the backing - // store. - if (useMutationMembrane) { - Object.freeze(descriptor); - return descriptor; + var key = null; + var ref = null; + + if (config != null) { + ref = config.ref === undefined ? null : config.ref; + if ("production" !== "development") { + ("production" !== "development" ? warning( + config.key !== null, + 'createElement(...): Encountered component with a `key` of null. In ' + + 'a future version, this will be treated as equivalent to the string ' + + '\'null\'; instead, provide an explicit key or use undefined.' + ) : null); + } + // TODO: Change this back to `config.key === undefined` + key = config.key == null ? null : '' + config.key; + // Remaining properties are added to a new props object + for (propName in config) { + if (config.hasOwnProperty(propName) && + !RESERVED_PROPS.hasOwnProperty(propName)) { + props[propName] = config[propName]; } } + } - descriptor.props = props; - return descriptor; - }; + // 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; + } - // Currently we expose the prototype of the descriptor so that - // <Foo /> instanceof Foo works. This is controversial pattern. - factory.prototype = descriptorPrototype; + // Resolve default props + if (type.defaultProps) { + var defaultProps = type.defaultProps; + for (propName in defaultProps) { + if (typeof props[propName] === 'undefined') { + props[propName] = defaultProps[propName]; + } + } + } + + return new ReactElement( + type, + key, + ref, + ReactCurrentOwner.current, + ReactContext.current, + props + ); +}; +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 descriptors. E.g. <Foo />.type === Foo.type and for - // static methods like <Foo />.type.staticMethod(); - // This should not be named constructor since this may not be the function - // that created the descriptor, and it may not even be a constructor. + // easily accessed on elements. E.g. <Foo />.type === Foo.type. + // This should not be named `constructor` since this may not be the function + // that created the element, and it may not even be a constructor. factory.type = type; - descriptorPrototype.type = type; - - proxyStaticMethods(factory, type); - - // Expose a unique constructor on the prototype is that this works with type - // systems that compare constructor properties: <Foo />.constructor === Foo - // This may be controversial since it requires a known factory function. - descriptorPrototype.constructor = factory; - return factory; - }; -ReactDescriptor.cloneAndReplaceProps = function(oldDescriptor, newProps) { - var newDescriptor = Object.create(oldDescriptor.constructor.prototype); - // It's important that this property order matches the hidden class of the - // original descriptor to maintain perf. - newDescriptor._owner = oldDescriptor._owner; - newDescriptor._context = oldDescriptor._context; +ReactElement.cloneAndReplaceProps = function(oldElement, newProps) { + var newElement = new ReactElement( + oldElement.type, + oldElement.key, + oldElement.ref, + oldElement._owner, + oldElement._context, + newProps + ); if ("production" !== "development") { - newDescriptor._store = { - validated: oldDescriptor._store.validated, - props: newProps - }; - if (useMutationMembrane) { - Object.freeze(newDescriptor); - return newDescriptor; - } + // If the key on the original is valid, then the clone is valid + newElement._store.validated = oldElement._store.validated; } - - newDescriptor.props = newProps; - return newDescriptor; -}; - -/** - * Checks if a value is a valid descriptor constructor. - * - * @param {*} - * @return {boolean} - * @public - */ -ReactDescriptor.isValidFactory = function(factory) { - return typeof factory === 'function' && - factory.prototype instanceof ReactDescriptor; + return newElement; }; /** @@ -25996,41 +25935,44 @@ ReactDescriptor.isValidFactory = function(factory) { * @return {boolean} True if `object` is a valid component. * @final */ -ReactDescriptor.isValidDescriptor = function(object) { - return object instanceof ReactDescriptor; +ReactElement.isValidElement = function(object) { + // ReactTestUtils is often used outside of beforeEach where as React is + // within it. This leads to two different instances of React on the same + // page. To identify a element from a different React instance we use + // a flag instead of an instanceof check. + var isElement = !!(object && object._isReactElement); + // if (isElement && !(object instanceof ReactElement)) { + // This is an indicator that you're using multiple versions of React at the + // same time. This will screw with ownership and stuff. Fix it, please. + // TODO: We could possibly warn here. + // } + return isElement; }; -module.exports = ReactDescriptor; +module.exports = ReactElement; -},{"./ReactContext":39,"./ReactCurrentOwner":40,"./merge":144,"./warning":158}],57:[function(_dereq_,module,exports){ +},{"./ReactContext":41,"./ReactCurrentOwner":42,"./warning":160}],59:[function(_dereq_,module,exports){ /** - * Copyright 2014 Facebook, Inc. - * - * 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 + * Copyright 2014, Facebook, Inc. + * All rights reserved. * - * 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. + * 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. * - * @providesModule ReactDescriptorValidator + * @providesModule ReactElementValidator */ /** - * ReactDescriptorValidator provides a wrapper around a descriptor factory - * which validates the props passed to the descriptor. This is intended to be + * 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 ReactDescriptor = _dereq_("./ReactDescriptor"); +var ReactElement = _dereq_("./ReactElement"); var ReactPropTypeLocations = _dereq_("./ReactPropTypeLocations"); var ReactCurrentOwner = _dereq_("./ReactCurrentOwner"); @@ -26073,7 +26015,7 @@ function getCurrentOwnerDisplayName() { * @param {*} parentType component's parent's type. */ function validateExplicitKey(component, parentType) { - if (component._store.validated || component.props.key != null) { + if (component._store.validated || component.key != null) { return; } component._store.validated = true; @@ -26179,11 +26121,11 @@ function validateChildKeys(component, parentType) { if (Array.isArray(component)) { for (var i = 0; i < component.length; i++) { var child = component[i]; - if (ReactDescriptor.isValidDescriptor(child)) { + if (ReactElement.isValidElement(child)) { validateExplicitKey(child, parentType); } } - } else if (ReactDescriptor.isValidDescriptor(component)) { + } else if (ReactElement.isValidElement(component)) { // This component was passed in a valid location. component._store.validated = true; } else if (component && typeof component === 'object') { @@ -26229,85 +26171,70 @@ function checkPropTypes(componentName, propTypes, props, location) { } } -var ReactDescriptorValidator = { +var ReactElementValidator = { - /** - * Wraps a descriptor factory function in another function which validates - * the props and context of the descriptor and warns about any failed type - * checks. - * - * @param {function} factory The original descriptor factory - * @param {object?} propTypes A prop type definition set - * @param {object?} contextTypes A context type definition set - * @return {object} The component descriptor, which may be invalid. - * @private - */ - createFactory: function(factory, propTypes, contextTypes) { - var validatedFactory = function(props, children) { - var descriptor = factory.apply(this, arguments); + createElement: function(type, props, children) { + var element = ReactElement.createElement.apply(this, arguments); - for (var i = 1; i < arguments.length; i++) { - validateChildKeys(arguments[i], descriptor.type); - } - - var name = descriptor.type.displayName; - if (propTypes) { - checkPropTypes( - name, - propTypes, - descriptor.props, - ReactPropTypeLocations.prop - ); - } - if (contextTypes) { - checkPropTypes( - name, - contextTypes, - descriptor._context, - ReactPropTypeLocations.context - ); - } - return descriptor; - }; + // 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; + } - validatedFactory.prototype = factory.prototype; - validatedFactory.type = factory.type; + for (var i = 2; i < arguments.length; i++) { + validateChildKeys(arguments[i], type); + } - // Copy static properties - for (var key in factory) { - if (factory.hasOwnProperty(key)) { - validatedFactory[key] = factory[key]; - } + var name = type.displayName; + if (type.propTypes) { + checkPropTypes( + name, + type.propTypes, + element.props, + ReactPropTypeLocations.prop + ); } + if (type.contextTypes) { + checkPropTypes( + name, + type.contextTypes, + element._context, + ReactPropTypeLocations.context + ); + } + return element; + }, + createFactory: function(type) { + var validatedFactory = ReactElementValidator.createElement.bind( + null, + type + ); + validatedFactory.type = type; return validatedFactory; } }; -module.exports = ReactDescriptorValidator; +module.exports = ReactElementValidator; -},{"./ReactCurrentOwner":40,"./ReactDescriptor":56,"./ReactPropTypeLocations":74,"./monitorCodeUse":148}],58:[function(_dereq_,module,exports){ +},{"./ReactCurrentOwner":42,"./ReactElement":58,"./ReactPropTypeLocations":78,"./monitorCodeUse":150}],60:[function(_dereq_,module,exports){ /** - * Copyright 2014 Facebook, Inc. - * - * 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 + * Copyright 2014, Facebook, Inc. + * All rights reserved. * - * 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. + * 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. * * @providesModule ReactEmptyComponent */ "use strict"; +var ReactElement = _dereq_("./ReactElement"); + var invariant = _dereq_("./invariant"); var component; @@ -26317,7 +26244,7 @@ var nullComponentIdsRegistry = {}; var ReactEmptyComponentInjection = { injectEmptyComponent: function(emptyComponent) { - component = emptyComponent; + component = ReactElement.createFactory(emptyComponent); } }; @@ -26367,21 +26294,14 @@ var ReactEmptyComponent = { module.exports = ReactEmptyComponent; -},{"./invariant":134}],59:[function(_dereq_,module,exports){ +},{"./ReactElement":58,"./invariant":140}],61:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * 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 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * 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. + * 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. * * @providesModule ReactErrorUtils * @typechecks @@ -26406,21 +26326,14 @@ var ReactErrorUtils = { module.exports = ReactErrorUtils; -},{}],60:[function(_dereq_,module,exports){ +},{}],62:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * 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 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * 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. + * 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. * * @providesModule ReactEventEmitterMixin */ @@ -26463,21 +26376,14 @@ var ReactEventEmitterMixin = { module.exports = ReactEventEmitterMixin; -},{"./EventPluginHub":18}],61:[function(_dereq_,module,exports){ +},{"./EventPluginHub":19}],63:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * 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 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * 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. + * 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. * * @providesModule ReactEventListener * @typechecks static-only @@ -26492,9 +26398,9 @@ var ReactInstanceHandles = _dereq_("./ReactInstanceHandles"); var ReactMount = _dereq_("./ReactMount"); var ReactUpdates = _dereq_("./ReactUpdates"); +var assign = _dereq_("./Object.assign"); var getEventTarget = _dereq_("./getEventTarget"); var getUnboundedScrollPosition = _dereq_("./getUnboundedScrollPosition"); -var mixInto = _dereq_("./mixInto"); /** * Finds the parent React component of `node`. @@ -26520,7 +26426,7 @@ function TopLevelCallbackBookKeeping(topLevelType, nativeEvent) { this.nativeEvent = nativeEvent; this.ancestors = []; } -mixInto(TopLevelCallbackBookKeeping, { +assign(TopLevelCallbackBookKeeping.prototype, { destructor: function() { this.topLevelType = null; this.nativeEvent = null; @@ -26654,21 +26560,14 @@ var ReactEventListener = { module.exports = ReactEventListener; -},{"./EventListener":17,"./ExecutionEnvironment":22,"./PooledClass":28,"./ReactInstanceHandles":64,"./ReactMount":67,"./ReactUpdates":87,"./getEventTarget":125,"./getUnboundedScrollPosition":130,"./mixInto":147}],62:[function(_dereq_,module,exports){ +},{"./EventListener":18,"./ExecutionEnvironment":23,"./Object.assign":29,"./PooledClass":30,"./ReactInstanceHandles":66,"./ReactMount":70,"./ReactUpdates":91,"./getEventTarget":131,"./getUnboundedScrollPosition":136}],64:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * 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 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * 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. + * 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. * * @providesModule ReactInjection */ @@ -26679,9 +26578,9 @@ var DOMProperty = _dereq_("./DOMProperty"); var EventPluginHub = _dereq_("./EventPluginHub"); var ReactComponent = _dereq_("./ReactComponent"); var ReactCompositeComponent = _dereq_("./ReactCompositeComponent"); -var ReactDOM = _dereq_("./ReactDOM"); var ReactEmptyComponent = _dereq_("./ReactEmptyComponent"); var ReactBrowserEventEmitter = _dereq_("./ReactBrowserEventEmitter"); +var ReactNativeComponent = _dereq_("./ReactNativeComponent"); var ReactPerf = _dereq_("./ReactPerf"); var ReactRootIndex = _dereq_("./ReactRootIndex"); var ReactUpdates = _dereq_("./ReactUpdates"); @@ -26692,8 +26591,8 @@ var ReactInjection = { DOMProperty: DOMProperty.injection, EmptyComponent: ReactEmptyComponent.injection, EventPluginHub: EventPluginHub.injection, - DOM: ReactDOM.injection, EventEmitter: ReactBrowserEventEmitter.injection, + NativeComponent: ReactNativeComponent.injection, Perf: ReactPerf.injection, RootIndex: ReactRootIndex.injection, Updates: ReactUpdates.injection @@ -26701,21 +26600,14 @@ var ReactInjection = { module.exports = ReactInjection; -},{"./DOMProperty":11,"./EventPluginHub":18,"./ReactBrowserEventEmitter":31,"./ReactComponent":35,"./ReactCompositeComponent":38,"./ReactDOM":41,"./ReactEmptyComponent":58,"./ReactPerf":71,"./ReactRootIndex":78,"./ReactUpdates":87}],63:[function(_dereq_,module,exports){ +},{"./DOMProperty":12,"./EventPluginHub":19,"./ReactBrowserEventEmitter":33,"./ReactComponent":37,"./ReactCompositeComponent":40,"./ReactEmptyComponent":60,"./ReactNativeComponent":73,"./ReactPerf":75,"./ReactRootIndex":82,"./ReactUpdates":91}],65:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * 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 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * 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. + * 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. * * @providesModule ReactInputSelection */ @@ -26844,21 +26736,14 @@ var ReactInputSelection = { module.exports = ReactInputSelection; -},{"./ReactDOMSelection":50,"./containsNode":109,"./focusNode":120,"./getActiveElement":122}],64:[function(_dereq_,module,exports){ +},{"./ReactDOMSelection":52,"./containsNode":114,"./focusNode":125,"./getActiveElement":127}],66:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * 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 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * 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. + * 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. * * @providesModule ReactInstanceHandles * @typechecks static-only @@ -27184,21 +27069,259 @@ var ReactInstanceHandles = { module.exports = ReactInstanceHandles; -},{"./ReactRootIndex":78,"./invariant":134}],65:[function(_dereq_,module,exports){ +},{"./ReactRootIndex":82,"./invariant":140}],67:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. + * Copyright 2014, Facebook, Inc. + * All rights reserved. * - * 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 + * 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. * - * http://www.apache.org/licenses/LICENSE-2.0 + * @providesModule ReactLegacyElement + */ + +"use strict"; + +var ReactCurrentOwner = _dereq_("./ReactCurrentOwner"); + +var invariant = _dereq_("./invariant"); +var monitorCodeUse = _dereq_("./monitorCodeUse"); +var warning = _dereq_("./warning"); + +var legacyFactoryLogs = {}; +function warnForLegacyFactoryCall() { + if (!ReactLegacyElementFactory._isLegacyCallWarningEnabled) { + return; + } + var owner = ReactCurrentOwner.current; + var name = owner && owner.constructor ? owner.constructor.displayName : ''; + if (!name) { + name = 'Something'; + } + if (legacyFactoryLogs.hasOwnProperty(name)) { + return; + } + legacyFactoryLogs[name] = true; + ("production" !== "development" ? warning( + false, + name + ' is calling a React component directly. ' + + 'Use a factory or JSX instead. See: http://fb.me/react-legacyfactory' + ) : null); + monitorCodeUse('react_legacy_factory_call', { version: 3, name: name }); +} + +function warnForPlainFunctionType(type) { + var isReactClass = + type.prototype && + typeof type.prototype.mountComponent === 'function' && + typeof type.prototype.receiveComponent === 'function'; + if (isReactClass) { + ("production" !== "development" ? warning( + false, + 'Did not expect to get a React class here. Use `Component` instead ' + + 'of `Component.type` or `this.constructor`.' + ) : null); + } else { + if (!type._reactWarnedForThisType) { + try { + type._reactWarnedForThisType = true; + } catch (x) { + // just incase this is a frozen object or some special object + } + monitorCodeUse( + 'react_non_component_in_jsx', + { version: 3, name: type.name } + ); + } + ("production" !== "development" ? warning( + false, + 'This JSX uses a plain function. Only React components are ' + + 'valid in React\'s JSX transform.' + ) : null); + } +} + +function warnForNonLegacyFactory(type) { + ("production" !== "development" ? warning( + false, + 'Do not pass React.DOM.' + type.type + ' to JSX or createFactory. ' + + 'Use the string "' + type.type + '" instead.' + ) : null); +} + +/** + * Transfer static properties from the source to the target. Functions are + * rebound to have this reflect the original source. + */ +function proxyStaticMethods(target, source) { + if (typeof source !== 'function') { + return; + } + for (var key in source) { + if (source.hasOwnProperty(key)) { + var value = source[key]; + if (typeof value === 'function') { + var bound = value.bind(source); + // Copy any properties defined on the function, such as `isRequired` on + // a PropTypes validator. + for (var k in value) { + if (value.hasOwnProperty(k)) { + bound[k] = value[k]; + } + } + target[key] = bound; + } else { + target[key] = value; + } + } + } +} + +// We use an object instead of a boolean because booleans are ignored by our +// mocking libraries when these factories gets mocked. +var LEGACY_MARKER = {}; +var NON_LEGACY_MARKER = {}; + +var ReactLegacyElementFactory = {}; + +ReactLegacyElementFactory.wrapCreateFactory = function(createFactory) { + var legacyCreateFactory = function(type) { + if (typeof type !== 'function') { + // Non-function types cannot be legacy factories + return createFactory(type); + } + + if (type.isReactNonLegacyFactory) { + // This is probably a factory created by ReactDOM we unwrap it to get to + // the underlying string type. It shouldn't have been passed here so we + // warn. + if ("production" !== "development") { + warnForNonLegacyFactory(type); + } + return createFactory(type.type); + } + + if (type.isReactLegacyFactory) { + // This is probably a legacy factory created by ReactCompositeComponent. + // We unwrap it to get to the underlying class. + return createFactory(type.type); + } + + if ("production" !== "development") { + warnForPlainFunctionType(type); + } + + // Unless it's a legacy factory, then this is probably a plain function, + // that is expecting to be invoked by JSX. We can just return it as is. + return type; + }; + return legacyCreateFactory; +}; + +ReactLegacyElementFactory.wrapCreateElement = function(createElement) { + var legacyCreateElement = function(type, props, children) { + if (typeof type !== 'function') { + // Non-function types cannot be legacy factories + return createElement.apply(this, arguments); + } + + var args; + + if (type.isReactNonLegacyFactory) { + // This is probably a factory created by ReactDOM we unwrap it to get to + // the underlying string type. It shouldn't have been passed here so we + // warn. + if ("production" !== "development") { + warnForNonLegacyFactory(type); + } + args = Array.prototype.slice.call(arguments, 0); + args[0] = type.type; + return createElement.apply(this, args); + } + + if (type.isReactLegacyFactory) { + // This is probably a legacy factory created by ReactCompositeComponent. + // We unwrap it to get to the underlying class. + if (type._isMockFunction) { + // If this is a mock function, people will expect it to be called. We + // will actually call the original mock factory function instead. This + // future proofs unit testing that assume that these are classes. + type.type._mockedReactClassConstructor = type; + } + args = Array.prototype.slice.call(arguments, 0); + args[0] = type.type; + return createElement.apply(this, args); + } + + if ("production" !== "development") { + warnForPlainFunctionType(type); + } + + // This is being called with a plain function we should invoke it + // immediately as if this was used with legacy JSX. + return type.apply(null, Array.prototype.slice.call(arguments, 1)); + }; + return legacyCreateElement; +}; + +ReactLegacyElementFactory.wrapFactory = function(factory) { + ("production" !== "development" ? invariant( + typeof factory === 'function', + 'This is suppose to accept a element factory' + ) : invariant(typeof factory === 'function')); + var legacyElementFactory = function(config, children) { + // This factory should not be called when JSX is used. Use JSX instead. + if ("production" !== "development") { + warnForLegacyFactoryCall(); + } + return factory.apply(this, arguments); + }; + proxyStaticMethods(legacyElementFactory, factory.type); + legacyElementFactory.isReactLegacyFactory = LEGACY_MARKER; + legacyElementFactory.type = factory.type; + return legacyElementFactory; +}; + +// This is used to mark a factory that will remain. E.g. we're allowed to call +// it as a function. However, you're not suppose to pass it to createElement +// or createFactory, so it will warn you if you do. +ReactLegacyElementFactory.markNonLegacyFactory = function(factory) { + factory.isReactNonLegacyFactory = NON_LEGACY_MARKER; + return factory; +}; + +// Checks if a factory function is actually a legacy factory pretending to +// be a class. +ReactLegacyElementFactory.isValidFactory = function(factory) { + // TODO: This will be removed and moved into a class validator or something. + return typeof factory === 'function' && + factory.isReactLegacyFactory === LEGACY_MARKER; +}; + +ReactLegacyElementFactory.isValidClass = function(factory) { + if ("production" !== "development") { + ("production" !== "development" ? warning( + false, + 'isValidClass is deprecated and will be removed in a future release. ' + + 'Use a more specific validator instead.' + ) : null); + } + return ReactLegacyElementFactory.isValidFactory(factory); +}; + +ReactLegacyElementFactory._isLegacyCallWarningEnabled = true; + +module.exports = ReactLegacyElementFactory; + +},{"./ReactCurrentOwner":42,"./invariant":140,"./monitorCodeUse":150,"./warning":160}],68:[function(_dereq_,module,exports){ +/** + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * 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. + * 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. * * @providesModule ReactLink * @typechecks static-only @@ -27264,21 +27387,14 @@ ReactLink.PropTypes = { module.exports = ReactLink; -},{"./React":29}],66:[function(_dereq_,module,exports){ +},{"./React":31}],69:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * 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 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * 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. + * 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. * * @providesModule ReactMarkupChecksum */ @@ -27319,21 +27435,14 @@ var ReactMarkupChecksum = { module.exports = ReactMarkupChecksum; -},{"./adler32":107}],67:[function(_dereq_,module,exports){ +},{"./adler32":110}],70:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * 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 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * 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. + * 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. * * @providesModule ReactMount */ @@ -27343,17 +27452,23 @@ module.exports = ReactMarkupChecksum; var DOMProperty = _dereq_("./DOMProperty"); var ReactBrowserEventEmitter = _dereq_("./ReactBrowserEventEmitter"); var ReactCurrentOwner = _dereq_("./ReactCurrentOwner"); -var ReactDescriptor = _dereq_("./ReactDescriptor"); +var ReactElement = _dereq_("./ReactElement"); +var ReactLegacyElement = _dereq_("./ReactLegacyElement"); var ReactInstanceHandles = _dereq_("./ReactInstanceHandles"); var ReactPerf = _dereq_("./ReactPerf"); var containsNode = _dereq_("./containsNode"); +var deprecated = _dereq_("./deprecated"); var getReactRootElementInContainer = _dereq_("./getReactRootElementInContainer"); var instantiateReactComponent = _dereq_("./instantiateReactComponent"); var invariant = _dereq_("./invariant"); var shouldUpdateReactComponent = _dereq_("./shouldUpdateReactComponent"); var warning = _dereq_("./warning"); +var createElement = ReactLegacyElement.wrapCreateElement( + ReactElement.createElement +); + var SEPARATOR = ReactInstanceHandles.SEPARATOR; var ATTR_NAME = DOMProperty.ID_ATTRIBUTE_NAME; @@ -27521,7 +27636,7 @@ function findDeepestCachedAncestor(targetID) { * representative DOM elements and inserting them into a supplied `container`. * Any prior content inside `container` is destroyed in the process. * - * ReactMount.renderComponent( + * ReactMount.render( * component, * document.getElementById('container') * ); @@ -27627,7 +27742,7 @@ var ReactMount = { 'componentDidUpdate.' ) : null); - var componentInstance = instantiateReactComponent(nextComponent); + var componentInstance = instantiateReactComponent(nextComponent, null); var reactRootID = ReactMount._registerComponent( componentInstance, container @@ -27655,35 +27770,38 @@ var ReactMount = { * perform an update on it and only mutate the DOM as necessary to reflect the * latest React component. * - * @param {ReactDescriptor} nextDescriptor Component descriptor to render. + * @param {ReactElement} nextElement Component element to render. * @param {DOMElement} container DOM element to render into. * @param {?function} callback function triggered on completion * @return {ReactComponent} Component instance rendered in `container`. */ - renderComponent: function(nextDescriptor, container, callback) { + render: function(nextElement, container, callback) { ("production" !== "development" ? invariant( - ReactDescriptor.isValidDescriptor(nextDescriptor), - 'renderComponent(): Invalid component descriptor.%s', + ReactElement.isValidElement(nextElement), + 'renderComponent(): Invalid component element.%s', ( - ReactDescriptor.isValidFactory(nextDescriptor) ? + typeof nextElement === 'string' ? + ' Instead of passing an element string, make sure to instantiate ' + + 'it by passing it to React.createElement.' : + ReactLegacyElement.isValidFactory(nextElement) ? ' Instead of passing a component class, make sure to instantiate ' + - 'it first by calling it with props.' : - // Check if it quacks like a descriptor - typeof nextDescriptor.props !== "undefined" ? + 'it by passing it to React.createElement.' : + // Check if it quacks like a element + typeof nextElement.props !== "undefined" ? ' This may be caused by unintentionally loading two independent ' + 'copies of React.' : '' ) - ) : invariant(ReactDescriptor.isValidDescriptor(nextDescriptor))); + ) : invariant(ReactElement.isValidElement(nextElement))); var prevComponent = instancesByReactRootID[getReactRootID(container)]; if (prevComponent) { - var prevDescriptor = prevComponent._descriptor; - if (shouldUpdateReactComponent(prevDescriptor, nextDescriptor)) { + var prevElement = prevComponent._currentElement; + if (shouldUpdateReactComponent(prevElement, nextElement)) { return ReactMount._updateRootComponent( prevComponent, - nextDescriptor, + nextElement, container, callback ); @@ -27699,7 +27817,7 @@ var ReactMount = { var shouldReuseMarkup = containerHasReactMarkup && !prevComponent; var component = ReactMount._renderNewRootComponent( - nextDescriptor, + nextElement, container, shouldReuseMarkup ); @@ -27717,7 +27835,8 @@ var ReactMount = { * @return {ReactComponent} Component instance rendered in `container`. */ constructAndRenderComponent: function(constructor, props, container) { - return ReactMount.renderComponent(constructor(props), container); + var element = createElement(constructor, props); + return ReactMount.render(element, container); }, /** @@ -27976,9 +28095,10 @@ var ReactMount = { false, 'findComponentRoot(..., %s): Unable to find element. This probably ' + 'means the DOM was unexpectedly mutated (e.g., by the browser), ' + - 'usually due to forgetting a <tbody> when using tables, nesting <p> ' + - 'or <a> tags, or using non-SVG elements in an <svg> parent. Try ' + - 'inspecting the child nodes of the element with React ID `%s`.', + 'usually due to forgetting a <tbody> when using tables, nesting tags ' + + 'like <form>, <p>, or <a>, or using non-SVG elements in an <svg> ' + + 'parent. ' + + 'Try inspecting the child nodes of the element with React ID `%s`.', targetID, ReactMount.getID(ancestorNode) ) : invariant(false)); @@ -28000,23 +28120,25 @@ var ReactMount = { purgeID: purgeID }; +// Deprecations (remove for 0.13) +ReactMount.renderComponent = deprecated( + 'ReactMount', + 'renderComponent', + 'render', + this, + ReactMount.render +); + module.exports = ReactMount; -},{"./DOMProperty":11,"./ReactBrowserEventEmitter":31,"./ReactCurrentOwner":40,"./ReactDescriptor":56,"./ReactInstanceHandles":64,"./ReactPerf":71,"./containsNode":109,"./getReactRootElementInContainer":128,"./instantiateReactComponent":133,"./invariant":134,"./shouldUpdateReactComponent":154,"./warning":158}],68:[function(_dereq_,module,exports){ +},{"./DOMProperty":12,"./ReactBrowserEventEmitter":33,"./ReactCurrentOwner":42,"./ReactElement":58,"./ReactInstanceHandles":66,"./ReactLegacyElement":67,"./ReactPerf":75,"./containsNode":114,"./deprecated":120,"./getReactRootElementInContainer":134,"./instantiateReactComponent":139,"./invariant":140,"./shouldUpdateReactComponent":156,"./warning":160}],71:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * 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 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * 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. + * 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. * * @providesModule ReactMultiChild * @typechecks static-only @@ -28200,7 +28322,7 @@ var ReactMultiChild = { if (children.hasOwnProperty(name)) { // The rendered children must be turned into instances as they're // mounted. - var childInstance = instantiateReactComponent(child); + var childInstance = instantiateReactComponent(child, null); children[name] = childInstance; // Inlined for performance, see `ReactInstanceHandles.createReactID`. var rootID = this._rootNodeID + name; @@ -28291,12 +28413,12 @@ var ReactMultiChild = { continue; } var prevChild = prevChildren && prevChildren[name]; - var prevDescriptor = prevChild && prevChild._descriptor; - var nextDescriptor = nextChildren[name]; - if (shouldUpdateReactComponent(prevDescriptor, nextDescriptor)) { + var prevElement = prevChild && prevChild._currentElement; + var nextElement = nextChildren[name]; + if (shouldUpdateReactComponent(prevElement, nextElement)) { this.moveChild(prevChild, nextIndex, lastIndex); lastIndex = Math.max(prevChild._mountIndex, lastIndex); - prevChild.receiveComponent(nextDescriptor, transaction); + prevChild.receiveComponent(nextElement, transaction); prevChild._mountIndex = nextIndex; } else { if (prevChild) { @@ -28305,7 +28427,10 @@ var ReactMultiChild = { this._unmountChildByName(prevChild, name); } // The child must be instantiated before it's mounted. - var nextChildInstance = instantiateReactComponent(nextDescriptor); + var nextChildInstance = instantiateReactComponent( + nextElement, + null + ); this._mountChildByNameAtIndex( nextChildInstance, name, nextIndex, transaction ); @@ -28434,21 +28559,14 @@ var ReactMultiChild = { module.exports = ReactMultiChild; -},{"./ReactComponent":35,"./ReactMultiChildUpdateTypes":69,"./flattenChildren":119,"./instantiateReactComponent":133,"./shouldUpdateReactComponent":154}],69:[function(_dereq_,module,exports){ +},{"./ReactComponent":37,"./ReactMultiChildUpdateTypes":72,"./flattenChildren":124,"./instantiateReactComponent":139,"./shouldUpdateReactComponent":156}],72:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * 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 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * 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. + * 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. * * @providesModule ReactMultiChildUpdateTypes */ @@ -28474,21 +28592,85 @@ var ReactMultiChildUpdateTypes = keyMirror({ module.exports = ReactMultiChildUpdateTypes; -},{"./keyMirror":140}],70:[function(_dereq_,module,exports){ +},{"./keyMirror":146}],73:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. + * Copyright 2014, Facebook, Inc. + * All rights reserved. * - * 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 + * 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. * - * http://www.apache.org/licenses/LICENSE-2.0 + * @providesModule ReactNativeComponent + */ + +"use strict"; + +var assign = _dereq_("./Object.assign"); +var invariant = _dereq_("./invariant"); + +var genericComponentClass = null; +// This registry keeps track of wrapper classes around native tags +var tagToComponentClass = {}; + +var ReactNativeComponentInjection = { + // This accepts a class that receives the tag string. This is a catch all + // that can render any kind of tag. + injectGenericComponentClass: function(componentClass) { + genericComponentClass = componentClass; + }, + // This accepts a keyed object with classes as values. Each key represents a + // tag. That particular tag will use this class instead of the generic one. + injectComponentClasses: function(componentClasses) { + assign(tagToComponentClass, componentClasses); + } +}; + +/** + * Create an internal class for a specific tag. * - * 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. + * @param {string} tag The tag for which to create an internal instance. + * @param {any} props The props passed to the instance constructor. + * @return {ReactComponent} component The injected empty component. + */ +function createInstanceForTag(tag, props, parentType) { + var componentClass = tagToComponentClass[tag]; + if (componentClass == null) { + ("production" !== "development" ? invariant( + genericComponentClass, + 'There is no registered component for the tag %s', + tag + ) : invariant(genericComponentClass)); + return new genericComponentClass(tag, props); + } + if (parentType === tag) { + // Avoid recursion + ("production" !== "development" ? invariant( + genericComponentClass, + 'There is no registered component for the tag %s', + tag + ) : invariant(genericComponentClass)); + return new genericComponentClass(tag, props); + } + // Unwrap legacy factories + return new componentClass.type(props); +} + +var ReactNativeComponent = { + createInstanceForTag: createInstanceForTag, + injection: ReactNativeComponentInjection +}; + +module.exports = ReactNativeComponent; + +},{"./Object.assign":29,"./invariant":140}],74:[function(_dereq_,module,exports){ +/** + * Copyright 2013-2014, 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. * * @providesModule ReactOwner */ @@ -28635,21 +28817,14 @@ var ReactOwner = { module.exports = ReactOwner; -},{"./emptyObject":117,"./invariant":134}],71:[function(_dereq_,module,exports){ +},{"./emptyObject":122,"./invariant":140}],75:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * 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 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * 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. + * 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. * * @providesModule ReactPerf * @typechecks static-only @@ -28685,7 +28860,7 @@ var ReactPerf = { measure: function(objName, fnName, func) { if ("production" !== "development") { var measuredFunc = null; - return function() { + var wrapper = function() { if (ReactPerf.enableMeasure) { if (!measuredFunc) { measuredFunc = ReactPerf.storedMeasure(objName, fnName, func); @@ -28694,6 +28869,8 @@ var ReactPerf = { } return func.apply(this, arguments); }; + wrapper.displayName = objName + '_' + fnName; + return wrapper; } return func; }, @@ -28722,31 +28899,27 @@ function _noMeasure(objName, fnName, func) { module.exports = ReactPerf; -},{}],72:[function(_dereq_,module,exports){ +},{}],76:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * 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 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * 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. + * 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. * * @providesModule ReactPropTransferer */ "use strict"; +var assign = _dereq_("./Object.assign"); var emptyFunction = _dereq_("./emptyFunction"); var invariant = _dereq_("./invariant"); var joinClasses = _dereq_("./joinClasses"); -var merge = _dereq_("./merge"); +var warning = _dereq_("./warning"); + +var didWarn = false; /** * Creates a transfer strategy that will merge prop values using the supplied @@ -28769,7 +28942,7 @@ var transferStrategyMerge = createTransferStrategy(function(a, b) { // `merge` overrides the first object's (`props[key]` above) keys using the // second object's (`value`) keys. An object's style's existing `propA` would // get overridden. Flip the order here. - return merge(b, a); + return assign({}, b, a); }); /** @@ -28787,14 +28960,6 @@ var TransferStrategies = { */ className: createTransferStrategy(joinClasses), /** - * Never transfer the `key` prop. - */ - key: emptyFunction, - /** - * Never transfer the `ref` prop. - */ - ref: emptyFunction, - /** * Transfer the `style` prop (which is an object) by merging them. */ style: transferStrategyMerge @@ -28843,7 +29008,7 @@ var ReactPropTransferer = { * @return {object} a new object containing both sets of props merged. */ mergeProps: function(oldProps, newProps) { - return transferInto(merge(oldProps), newProps); + return transferInto(assign({}, oldProps), newProps); }, /** @@ -28859,26 +29024,39 @@ var ReactPropTransferer = { * * This is usually used to pass down props to a returned root component. * - * @param {ReactDescriptor} descriptor Component receiving the properties. - * @return {ReactDescriptor} The supplied `component`. + * @param {ReactElement} element Component receiving the properties. + * @return {ReactElement} The supplied `component`. * @final * @protected */ - transferPropsTo: function(descriptor) { + transferPropsTo: function(element) { ("production" !== "development" ? invariant( - descriptor._owner === this, + element._owner === this, '%s: You can\'t call transferPropsTo() on a component that you ' + 'don\'t own, %s. This usually means you are calling ' + 'transferPropsTo() on a component passed in as props or children.', this.constructor.displayName, - descriptor.type.displayName - ) : invariant(descriptor._owner === this)); + typeof element.type === 'string' ? + element.type : + element.type.displayName + ) : invariant(element._owner === this)); + + if ("production" !== "development") { + if (!didWarn) { + didWarn = true; + ("production" !== "development" ? warning( + false, + 'transferPropsTo is deprecated. ' + + 'See http://fb.me/react-transferpropsto for more information.' + ) : null); + } + } - // Because descriptors are immutable we have to merge into the existing + // Because elements are immutable we have to merge into the existing // props object rather than clone it. - transferInto(descriptor.props, this.props); + transferInto(element.props, this.props); - return descriptor; + return element; } } @@ -28886,21 +29064,14 @@ var ReactPropTransferer = { module.exports = ReactPropTransferer; -},{"./emptyFunction":116,"./invariant":134,"./joinClasses":139,"./merge":144}],73:[function(_dereq_,module,exports){ +},{"./Object.assign":29,"./emptyFunction":121,"./invariant":140,"./joinClasses":145,"./warning":160}],77:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * 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 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * 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. + * 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. * * @providesModule ReactPropTypeLocationNames */ @@ -28919,21 +29090,14 @@ if ("production" !== "development") { module.exports = ReactPropTypeLocationNames; -},{}],74:[function(_dereq_,module,exports){ +},{}],78:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * 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 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * 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. + * 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. * * @providesModule ReactPropTypeLocations */ @@ -28950,30 +29114,24 @@ var ReactPropTypeLocations = keyMirror({ module.exports = ReactPropTypeLocations; -},{"./keyMirror":140}],75:[function(_dereq_,module,exports){ +},{"./keyMirror":146}],79:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * 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 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * 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. + * 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. * * @providesModule ReactPropTypes */ "use strict"; -var ReactDescriptor = _dereq_("./ReactDescriptor"); +var ReactElement = _dereq_("./ReactElement"); var ReactPropTypeLocationNames = _dereq_("./ReactPropTypeLocationNames"); +var deprecated = _dereq_("./deprecated"); var emptyFunction = _dereq_("./emptyFunction"); /** @@ -29025,6 +29183,9 @@ var emptyFunction = _dereq_("./emptyFunction"); var ANONYMOUS = '<<anonymous>>'; +var elementTypeChecker = createElementTypeChecker(); +var nodeTypeChecker = createNodeChecker(); + var ReactPropTypes = { array: createPrimitiveTypeChecker('array'), bool: createPrimitiveTypeChecker('boolean'), @@ -29035,13 +29196,28 @@ var ReactPropTypes = { any: createAnyTypeChecker(), arrayOf: createArrayOfTypeChecker, - component: createComponentTypeChecker(), + element: elementTypeChecker, instanceOf: createInstanceTypeChecker, + node: nodeTypeChecker, objectOf: createObjectOfTypeChecker, oneOf: createEnumTypeChecker, oneOfType: createUnionTypeChecker, - renderable: createRenderableTypeChecker(), - shape: createShapeTypeChecker + shape: createShapeTypeChecker, + + component: deprecated( + 'React.PropTypes', + 'component', + 'element', + this, + elementTypeChecker + ), + renderable: deprecated( + 'React.PropTypes', + 'renderable', + 'node', + this, + nodeTypeChecker + ) }; function createChainableTypeChecker(validate) { @@ -29111,13 +29287,13 @@ function createArrayOfTypeChecker(typeChecker) { return createChainableTypeChecker(validate); } -function createComponentTypeChecker() { +function createElementTypeChecker() { function validate(props, propName, componentName, location) { - if (!ReactDescriptor.isValidDescriptor(props[propName])) { + if (!ReactElement.isValidElement(props[propName])) { var locationName = ReactPropTypeLocationNames[location]; return new Error( ("Invalid " + locationName + " `" + propName + "` supplied to ") + - ("`" + componentName + "`, expected a React component.") + ("`" + componentName + "`, expected a ReactElement.") ); } } @@ -29198,13 +29374,13 @@ function createUnionTypeChecker(arrayOfTypeCheckers) { return createChainableTypeChecker(validate); } -function createRenderableTypeChecker() { +function createNodeChecker() { function validate(props, propName, componentName, location) { - if (!isRenderable(props[propName])) { + if (!isNode(props[propName])) { var locationName = ReactPropTypeLocationNames[location]; return new Error( ("Invalid " + locationName + " `" + propName + "` supplied to ") + - ("`" + componentName + "`, expected a renderable prop.") + ("`" + componentName + "`, expected a ReactNode.") ); } } @@ -29236,11 +29412,8 @@ function createShapeTypeChecker(shapeTypes) { return createChainableTypeChecker(validate, 'expected `object`'); } -function isRenderable(propValue) { +function isNode(propValue) { switch(typeof propValue) { - // TODO: this was probably written with the assumption that we're not - // returning `this.props.component` directly from `render`. This is - // currently not supported but we should, to make it consistent. case 'number': case 'string': return true; @@ -29248,13 +29421,13 @@ function isRenderable(propValue) { return !propValue; case 'object': if (Array.isArray(propValue)) { - return propValue.every(isRenderable); + return propValue.every(isNode); } - if (ReactDescriptor.isValidDescriptor(propValue)) { + if (ReactElement.isValidElement(propValue)) { return true; } for (var k in propValue) { - if (!isRenderable(propValue[k])) { + if (!isNode(propValue[k])) { return false; } } @@ -29295,21 +29468,14 @@ function getPreciseType(propValue) { module.exports = ReactPropTypes; -},{"./ReactDescriptor":56,"./ReactPropTypeLocationNames":73,"./emptyFunction":116}],76:[function(_dereq_,module,exports){ +},{"./ReactElement":58,"./ReactPropTypeLocationNames":77,"./deprecated":120,"./emptyFunction":121}],80:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * 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 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * 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. + * 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. * * @providesModule ReactPutListenerQueue */ @@ -29319,13 +29485,13 @@ module.exports = ReactPropTypes; var PooledClass = _dereq_("./PooledClass"); var ReactBrowserEventEmitter = _dereq_("./ReactBrowserEventEmitter"); -var mixInto = _dereq_("./mixInto"); +var assign = _dereq_("./Object.assign"); function ReactPutListenerQueue() { this.listenersToPut = []; } -mixInto(ReactPutListenerQueue, { +assign(ReactPutListenerQueue.prototype, { enqueuePutListener: function(rootNodeID, propKey, propValue) { this.listenersToPut.push({ rootNodeID: rootNodeID, @@ -29358,21 +29524,14 @@ PooledClass.addPoolingTo(ReactPutListenerQueue); module.exports = ReactPutListenerQueue; -},{"./PooledClass":28,"./ReactBrowserEventEmitter":31,"./mixInto":147}],77:[function(_dereq_,module,exports){ +},{"./Object.assign":29,"./PooledClass":30,"./ReactBrowserEventEmitter":33}],81:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * 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 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * 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. + * 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. * * @providesModule ReactReconcileTransaction * @typechecks static-only @@ -29387,7 +29546,7 @@ var ReactInputSelection = _dereq_("./ReactInputSelection"); var ReactPutListenerQueue = _dereq_("./ReactPutListenerQueue"); var Transaction = _dereq_("./Transaction"); -var mixInto = _dereq_("./mixInto"); +var assign = _dereq_("./Object.assign"); /** * Ensures that, when possible, the selection range (currently selected text @@ -29535,28 +29694,20 @@ var Mixin = { }; -mixInto(ReactReconcileTransaction, Transaction.Mixin); -mixInto(ReactReconcileTransaction, Mixin); +assign(ReactReconcileTransaction.prototype, Transaction.Mixin, Mixin); PooledClass.addPoolingTo(ReactReconcileTransaction); module.exports = ReactReconcileTransaction; -},{"./CallbackQueue":6,"./PooledClass":28,"./ReactBrowserEventEmitter":31,"./ReactInputSelection":63,"./ReactPutListenerQueue":76,"./Transaction":104,"./mixInto":147}],78:[function(_dereq_,module,exports){ +},{"./CallbackQueue":7,"./Object.assign":29,"./PooledClass":30,"./ReactBrowserEventEmitter":33,"./ReactInputSelection":65,"./ReactPutListenerQueue":80,"./Transaction":107}],82:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * 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 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * 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. + * 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. * * @providesModule ReactRootIndex * @typechecks @@ -29580,28 +29731,21 @@ var ReactRootIndex = { module.exports = ReactRootIndex; -},{}],79:[function(_dereq_,module,exports){ +},{}],83:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * 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 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * 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. + * 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 static-only * @providesModule ReactServerRendering */ "use strict"; -var ReactDescriptor = _dereq_("./ReactDescriptor"); +var ReactElement = _dereq_("./ReactElement"); var ReactInstanceHandles = _dereq_("./ReactInstanceHandles"); var ReactMarkupChecksum = _dereq_("./ReactMarkupChecksum"); var ReactServerRenderingTransaction = @@ -29611,20 +29755,14 @@ var instantiateReactComponent = _dereq_("./instantiateReactComponent"); var invariant = _dereq_("./invariant"); /** - * @param {ReactComponent} component + * @param {ReactElement} element * @return {string} the HTML markup */ -function renderComponentToString(component) { +function renderToString(element) { ("production" !== "development" ? invariant( - ReactDescriptor.isValidDescriptor(component), - 'renderComponentToString(): You must pass a valid ReactComponent.' - ) : invariant(ReactDescriptor.isValidDescriptor(component))); - - ("production" !== "development" ? invariant( - !(arguments.length === 2 && typeof arguments[1] === 'function'), - 'renderComponentToString(): This function became synchronous and now ' + - 'returns the generated markup. Please remove the second parameter.' - ) : invariant(!(arguments.length === 2 && typeof arguments[1] === 'function'))); + ReactElement.isValidElement(element), + 'renderToString(): You must pass a valid ReactElement.' + ) : invariant(ReactElement.isValidElement(element))); var transaction; try { @@ -29632,7 +29770,7 @@ function renderComponentToString(component) { transaction = ReactServerRenderingTransaction.getPooled(false); return transaction.perform(function() { - var componentInstance = instantiateReactComponent(component); + var componentInstance = instantiateReactComponent(element, null); var markup = componentInstance.mountComponent(id, transaction, 0); return ReactMarkupChecksum.addChecksumToMarkup(markup); }, null); @@ -29642,15 +29780,15 @@ function renderComponentToString(component) { } /** - * @param {ReactComponent} component + * @param {ReactElement} element * @return {string} the HTML markup, without the extra React ID and checksum -* (for generating static pages) + * (for generating static pages) */ -function renderComponentToStaticMarkup(component) { +function renderToStaticMarkup(element) { ("production" !== "development" ? invariant( - ReactDescriptor.isValidDescriptor(component), - 'renderComponentToStaticMarkup(): You must pass a valid ReactComponent.' - ) : invariant(ReactDescriptor.isValidDescriptor(component))); + ReactElement.isValidElement(element), + 'renderToStaticMarkup(): You must pass a valid ReactElement.' + ) : invariant(ReactElement.isValidElement(element))); var transaction; try { @@ -29658,7 +29796,7 @@ function renderComponentToStaticMarkup(component) { transaction = ReactServerRenderingTransaction.getPooled(true); return transaction.perform(function() { - var componentInstance = instantiateReactComponent(component); + var componentInstance = instantiateReactComponent(element, null); return componentInstance.mountComponent(id, transaction, 0); }, null); } finally { @@ -29667,25 +29805,18 @@ function renderComponentToStaticMarkup(component) { } module.exports = { - renderComponentToString: renderComponentToString, - renderComponentToStaticMarkup: renderComponentToStaticMarkup + renderToString: renderToString, + renderToStaticMarkup: renderToStaticMarkup }; -},{"./ReactDescriptor":56,"./ReactInstanceHandles":64,"./ReactMarkupChecksum":66,"./ReactServerRenderingTransaction":80,"./instantiateReactComponent":133,"./invariant":134}],80:[function(_dereq_,module,exports){ +},{"./ReactElement":58,"./ReactInstanceHandles":66,"./ReactMarkupChecksum":69,"./ReactServerRenderingTransaction":84,"./instantiateReactComponent":139,"./invariant":140}],84:[function(_dereq_,module,exports){ /** - * Copyright 2014 Facebook, Inc. - * - * 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 + * Copyright 2014, Facebook, Inc. + * All rights reserved. * - * 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. + * 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. * * @providesModule ReactServerRenderingTransaction * @typechecks @@ -29698,8 +29829,8 @@ var CallbackQueue = _dereq_("./CallbackQueue"); var ReactPutListenerQueue = _dereq_("./ReactPutListenerQueue"); var Transaction = _dereq_("./Transaction"); +var assign = _dereq_("./Object.assign"); var emptyFunction = _dereq_("./emptyFunction"); -var mixInto = _dereq_("./mixInto"); /** * Provides a `CallbackQueue` queue for collecting `onDOMReady` callbacks @@ -29781,28 +29912,24 @@ var Mixin = { }; -mixInto(ReactServerRenderingTransaction, Transaction.Mixin); -mixInto(ReactServerRenderingTransaction, Mixin); +assign( + ReactServerRenderingTransaction.prototype, + Transaction.Mixin, + Mixin +); PooledClass.addPoolingTo(ReactServerRenderingTransaction); module.exports = ReactServerRenderingTransaction; -},{"./CallbackQueue":6,"./PooledClass":28,"./ReactPutListenerQueue":76,"./Transaction":104,"./emptyFunction":116,"./mixInto":147}],81:[function(_dereq_,module,exports){ +},{"./CallbackQueue":7,"./Object.assign":29,"./PooledClass":30,"./ReactPutListenerQueue":80,"./Transaction":107,"./emptyFunction":121}],85:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * 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 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * 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. + * 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. * * @providesModule ReactStateSetters */ @@ -29901,21 +30028,14 @@ ReactStateSetters.Mixin = { module.exports = ReactStateSetters; -},{}],82:[function(_dereq_,module,exports){ +},{}],86:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * 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 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * 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. + * 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. * * @providesModule ReactTestUtils */ @@ -29926,16 +30046,14 @@ var EventConstants = _dereq_("./EventConstants"); var EventPluginHub = _dereq_("./EventPluginHub"); var EventPropagators = _dereq_("./EventPropagators"); var React = _dereq_("./React"); -var ReactDescriptor = _dereq_("./ReactDescriptor"); -var ReactDOM = _dereq_("./ReactDOM"); +var ReactElement = _dereq_("./ReactElement"); var ReactBrowserEventEmitter = _dereq_("./ReactBrowserEventEmitter"); var ReactMount = _dereq_("./ReactMount"); var ReactTextComponent = _dereq_("./ReactTextComponent"); var ReactUpdates = _dereq_("./ReactUpdates"); var SyntheticEvent = _dereq_("./SyntheticEvent"); -var mergeInto = _dereq_("./mergeInto"); -var copyProperties = _dereq_("./copyProperties"); +var assign = _dereq_("./Object.assign"); var topLevelTypes = EventConstants.topLevelTypes; @@ -29958,16 +30076,16 @@ var ReactTestUtils = { // clean up, so we're going to stop honoring the name of this method // (and probably rename it eventually) if no problems arise. // document.documentElement.appendChild(div); - return React.renderComponent(instance, div); + return React.render(instance, div); }, - isDescriptor: function(descriptor) { - return ReactDescriptor.isValidDescriptor(descriptor); + isElement: function(element) { + return ReactElement.isValidElement(element); }, - isDescriptorOfType: function(inst, convenienceConstructor) { + isElementOfType: function(inst, convenienceConstructor) { return ( - ReactDescriptor.isValidDescriptor(inst) && + ReactElement.isValidElement(inst) && inst.type === convenienceConstructor.type ); }, @@ -29976,9 +30094,9 @@ var ReactTestUtils = { return !!(inst && inst.mountComponent && inst.tagName); }, - isDOMComponentDescriptor: function(inst) { + isDOMComponentElement: function(inst) { return !!(inst && - ReactDescriptor.isValidDescriptor(inst) && + ReactElement.isValidElement(inst) && !!inst.tagName); }, @@ -29992,8 +30110,8 @@ var ReactTestUtils = { (inst.constructor === type.type)); }, - isCompositeComponentDescriptor: function(inst) { - if (!ReactDescriptor.isValidDescriptor(inst)) { + isCompositeComponentElement: function(inst) { + if (!ReactElement.isValidElement(inst)) { return false; } // We check the prototype of the type that will get mounted, not the @@ -30005,8 +30123,8 @@ var ReactTestUtils = { ); }, - isCompositeComponentDescriptorWithType: function(inst, type) { - return !!(ReactTestUtils.isCompositeComponentDescriptor(inst) && + isCompositeComponentElementWithType: function(inst, type) { + return !!(ReactTestUtils.isCompositeComponentElement(inst) && (inst.constructor === type)); }, @@ -30142,16 +30260,23 @@ var ReactTestUtils = { * @return {object} the ReactTestUtils object (for chaining) */ mockComponent: function(module, mockTagName) { - var ConvenienceConstructor = React.createClass({ + mockTagName = mockTagName || module.mockTagName || "div"; + + var ConvenienceConstructor = React.createClass({displayName: 'ConvenienceConstructor', render: function() { - var mockTagName = mockTagName || module.mockTagName || "div"; - return ReactDOM[mockTagName](null, this.props.children); + return React.createElement( + mockTagName, + null, + this.props.children + ); } }); - copyProperties(module, ConvenienceConstructor); module.mockImplementation(ConvenienceConstructor); + module.type = ConvenienceConstructor.type; + module.isReactLegacyFactory = true; + return this; }, @@ -30226,7 +30351,7 @@ function makeSimulator(eventType) { ReactMount.getID(node), fakeNativeEvent ); - mergeInto(event, eventData); + assign(event, eventData); EventPropagators.accumulateTwoPhaseDispatches(event); ReactUpdates.batchedUpdates(function() { @@ -30282,7 +30407,7 @@ buildSimulators(); function makeNativeSimulator(eventType) { return function(domComponentOrNode, nativeEventData) { var fakeNativeEvent = new Event(eventType); - mergeInto(fakeNativeEvent, nativeEventData); + assign(fakeNativeEvent, nativeEventData); if (ReactTestUtils.isDOMComponent(domComponentOrNode)) { ReactTestUtils.simulateNativeEventOnDOMComponent( eventType, @@ -30315,21 +30440,14 @@ for (eventType in topLevelTypes) { module.exports = ReactTestUtils; -},{"./EventConstants":16,"./EventPluginHub":18,"./EventPropagators":21,"./React":29,"./ReactBrowserEventEmitter":31,"./ReactDOM":41,"./ReactDescriptor":56,"./ReactMount":67,"./ReactTextComponent":83,"./ReactUpdates":87,"./SyntheticEvent":96,"./copyProperties":110,"./mergeInto":146}],83:[function(_dereq_,module,exports){ +},{"./EventConstants":17,"./EventPluginHub":19,"./EventPropagators":22,"./Object.assign":29,"./React":31,"./ReactBrowserEventEmitter":33,"./ReactElement":58,"./ReactMount":70,"./ReactTextComponent":87,"./ReactUpdates":91,"./SyntheticEvent":99}],87:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * 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 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * 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. + * 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. * * @providesModule ReactTextComponent * @typechecks static-only @@ -30338,12 +30456,11 @@ module.exports = ReactTestUtils; "use strict"; var DOMPropertyOperations = _dereq_("./DOMPropertyOperations"); -var ReactBrowserComponentMixin = _dereq_("./ReactBrowserComponentMixin"); var ReactComponent = _dereq_("./ReactComponent"); -var ReactDescriptor = _dereq_("./ReactDescriptor"); +var ReactElement = _dereq_("./ReactElement"); +var assign = _dereq_("./Object.assign"); var escapeTextForBrowser = _dereq_("./escapeTextForBrowser"); -var mixInto = _dereq_("./mixInto"); /** * Text nodes violate a couple assumptions that React makes about components: @@ -30360,13 +30477,11 @@ var mixInto = _dereq_("./mixInto"); * @extends ReactComponent * @internal */ -var ReactTextComponent = function(descriptor) { - this.construct(descriptor); +var ReactTextComponent = function(props) { + // This constructor and it's argument is currently used by mocks. }; -mixInto(ReactTextComponent, ReactComponent.Mixin); -mixInto(ReactTextComponent, ReactBrowserComponentMixin); -mixInto(ReactTextComponent, { +assign(ReactTextComponent.prototype, ReactComponent.Mixin, { /** * Creates the markup for this text node. This node is not intended to have @@ -30422,23 +30537,23 @@ mixInto(ReactTextComponent, { }); -module.exports = ReactDescriptor.createFactory(ReactTextComponent); +var ReactTextComponentFactory = function(text) { + // Bypass validation and configuration + return new ReactElement(ReactTextComponent, null, null, null, null, text); +}; -},{"./DOMPropertyOperations":12,"./ReactBrowserComponentMixin":30,"./ReactComponent":35,"./ReactDescriptor":56,"./escapeTextForBrowser":118,"./mixInto":147}],84:[function(_dereq_,module,exports){ +ReactTextComponentFactory.type = ReactTextComponent; + +module.exports = ReactTextComponentFactory; + +},{"./DOMPropertyOperations":13,"./Object.assign":29,"./ReactComponent":37,"./ReactElement":58,"./escapeTextForBrowser":123}],88:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * 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 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * 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. + * 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 static-only * @providesModule ReactTransitionChildMapping @@ -30464,7 +30579,7 @@ var ReactTransitionChildMapping = { /** * When you're adding or removing children some may be added or removed in the - * same render pass. We want ot show *both* since we want to simultaneously + * 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 @@ -30532,21 +30647,14 @@ var ReactTransitionChildMapping = { module.exports = ReactTransitionChildMapping; -},{"./ReactChildren":34}],85:[function(_dereq_,module,exports){ +},{"./ReactChildren":36}],89:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * 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 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * 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. + * 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. * * @providesModule ReactTransitionEvents */ @@ -30650,21 +30758,14 @@ var ReactTransitionEvents = { module.exports = ReactTransitionEvents; -},{"./ExecutionEnvironment":22}],86:[function(_dereq_,module,exports){ +},{"./ExecutionEnvironment":23}],90:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * 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 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * 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. + * 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. * * @providesModule ReactTransitionGroup */ @@ -30674,21 +30775,21 @@ module.exports = ReactTransitionEvents; var React = _dereq_("./React"); var ReactTransitionChildMapping = _dereq_("./ReactTransitionChildMapping"); +var assign = _dereq_("./Object.assign"); var cloneWithProps = _dereq_("./cloneWithProps"); var emptyFunction = _dereq_("./emptyFunction"); -var merge = _dereq_("./merge"); var ReactTransitionGroup = React.createClass({ displayName: 'ReactTransitionGroup', propTypes: { - component: React.PropTypes.func, + component: React.PropTypes.any, childFactory: React.PropTypes.func }, getDefaultProps: function() { return { - component: React.DOM.span, + component: 'span', childFactory: emptyFunction.thatReturnsArgument }; }, @@ -30812,7 +30913,7 @@ var ReactTransitionGroup = React.createClass({ // This entered again before it fully left. Add it again. this.performEnter(key); } else { - var newChildren = merge(this.state.children); + var newChildren = assign({}, this.state.children); delete newChildren[key]; this.setState({children: newChildren}); } @@ -30836,27 +30937,24 @@ var ReactTransitionGroup = React.createClass({ ); } } - return this.transferPropsTo(this.props.component(null, childrenToRender)); + return React.createElement( + this.props.component, + this.props, + childrenToRender + ); } }); module.exports = ReactTransitionGroup; -},{"./React":29,"./ReactTransitionChildMapping":84,"./cloneWithProps":108,"./emptyFunction":116,"./merge":144}],87:[function(_dereq_,module,exports){ +},{"./Object.assign":29,"./React":31,"./ReactTransitionChildMapping":88,"./cloneWithProps":113,"./emptyFunction":121}],91:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * 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 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * 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. + * 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. * * @providesModule ReactUpdates */ @@ -30869,11 +30967,13 @@ var ReactCurrentOwner = _dereq_("./ReactCurrentOwner"); var ReactPerf = _dereq_("./ReactPerf"); var Transaction = _dereq_("./Transaction"); +var assign = _dereq_("./Object.assign"); var invariant = _dereq_("./invariant"); -var mixInto = _dereq_("./mixInto"); var warning = _dereq_("./warning"); var dirtyComponents = []; +var asapCallbackQueue = CallbackQueue.getPooled(); +var asapEnqueued = false; var batchingStrategy = null; @@ -30918,13 +31018,14 @@ var TRANSACTION_WRAPPERS = [NESTED_UPDATES, UPDATE_QUEUEING]; function ReactUpdatesFlushTransaction() { this.reinitializeTransaction(); this.dirtyComponentsLength = null; - this.callbackQueue = CallbackQueue.getPooled(null); + this.callbackQueue = CallbackQueue.getPooled(); this.reconcileTransaction = ReactUpdates.ReactReconcileTransaction.getPooled(); } -mixInto(ReactUpdatesFlushTransaction, Transaction.Mixin); -mixInto(ReactUpdatesFlushTransaction, { +assign( + ReactUpdatesFlushTransaction.prototype, + Transaction.Mixin, { getTransactionWrappers: function() { return TRANSACTION_WRAPPERS; }, @@ -31015,11 +31116,21 @@ var flushBatchedUpdates = ReactPerf.measure( // ReactUpdatesFlushTransaction's wrappers will clear the dirtyComponents // array and perform any updates enqueued by mount-ready handlers (i.e., // componentDidUpdate) but we need to check here too in order to catch - // updates enqueued by setState callbacks. - while (dirtyComponents.length) { - var transaction = ReactUpdatesFlushTransaction.getPooled(); - transaction.perform(runBatchedUpdates, null, transaction); - ReactUpdatesFlushTransaction.release(transaction); + // updates enqueued by setState callbacks and asap calls. + while (dirtyComponents.length || asapEnqueued) { + if (dirtyComponents.length) { + var transaction = ReactUpdatesFlushTransaction.getPooled(); + transaction.perform(runBatchedUpdates, null, transaction); + ReactUpdatesFlushTransaction.release(transaction); + } + + if (asapEnqueued) { + asapEnqueued = false; + var queue = asapCallbackQueue; + asapCallbackQueue = CallbackQueue.getPooled(); + queue.notifyAll(); + CallbackQueue.release(queue); + } } } ); @@ -31066,6 +31177,20 @@ function enqueueUpdate(component, callback) { } } +/** + * Enqueue a callback to be run at the end of the current batching cycle. Throws + * if no updates are currently being performed. + */ +function asap(callback, context) { + ("production" !== "development" ? invariant( + batchingStrategy.isBatchingUpdates, + 'ReactUpdates.asap: Can\'t enqueue an asap callback in a context where' + + 'updates are not being batched.' + ) : invariant(batchingStrategy.isBatchingUpdates)); + asapCallbackQueue.enqueue(callback, context); + asapEnqueued = true; +} + var ReactUpdatesInjection = { injectReconcileTransaction: function(ReconcileTransaction) { ("production" !== "development" ? invariant( @@ -31104,84 +31229,20 @@ var ReactUpdates = { batchedUpdates: batchedUpdates, enqueueUpdate: enqueueUpdate, flushBatchedUpdates: flushBatchedUpdates, - injection: ReactUpdatesInjection + injection: ReactUpdatesInjection, + asap: asap }; module.exports = ReactUpdates; -},{"./CallbackQueue":6,"./PooledClass":28,"./ReactCurrentOwner":40,"./ReactPerf":71,"./Transaction":104,"./invariant":134,"./mixInto":147,"./warning":158}],88:[function(_dereq_,module,exports){ -/** - * Copyright 2013-2014 Facebook, Inc. - * - * 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. - * - * @providesModule ReactWithAddons - */ - -/** - * This module exists purely in the open source project, and is meant as a way - * to create a separate standalone build of React. This build has "addons", or - * functionality we've built and think might be useful but doesn't have a good - * place to live inside React core. - */ - -"use strict"; - -var LinkedStateMixin = _dereq_("./LinkedStateMixin"); -var React = _dereq_("./React"); -var ReactComponentWithPureRenderMixin = - _dereq_("./ReactComponentWithPureRenderMixin"); -var ReactCSSTransitionGroup = _dereq_("./ReactCSSTransitionGroup"); -var ReactTransitionGroup = _dereq_("./ReactTransitionGroup"); - -var cx = _dereq_("./cx"); -var cloneWithProps = _dereq_("./cloneWithProps"); -var update = _dereq_("./update"); - -React.addons = { - CSSTransitionGroup: ReactCSSTransitionGroup, - LinkedStateMixin: LinkedStateMixin, - PureRenderMixin: ReactComponentWithPureRenderMixin, - TransitionGroup: ReactTransitionGroup, - - classSet: cx, - cloneWithProps: cloneWithProps, - update: update -}; - -if ("production" !== "development") { - React.addons.Perf = _dereq_("./ReactDefaultPerf"); - React.addons.TestUtils = _dereq_("./ReactTestUtils"); -} - -module.exports = React; - - -},{"./LinkedStateMixin":24,"./React":29,"./ReactCSSTransitionGroup":32,"./ReactComponentWithPureRenderMixin":37,"./ReactDefaultPerf":54,"./ReactTestUtils":82,"./ReactTransitionGroup":86,"./cloneWithProps":108,"./cx":114,"./update":157}],89:[function(_dereq_,module,exports){ +},{"./CallbackQueue":7,"./Object.assign":29,"./PooledClass":30,"./ReactCurrentOwner":42,"./ReactPerf":75,"./Transaction":107,"./invariant":140,"./warning":160}],92:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * 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 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * 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. + * 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. * * @providesModule SVGDOMPropertyConfig */ @@ -31266,21 +31327,14 @@ var SVGDOMPropertyConfig = { module.exports = SVGDOMPropertyConfig; -},{"./DOMProperty":11}],90:[function(_dereq_,module,exports){ +},{"./DOMProperty":12}],93:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * 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 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * 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. + * 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. * * @providesModule SelectEventPlugin */ @@ -31338,6 +31392,14 @@ function getSelection(node) { start: node.selectionStart, end: node.selectionEnd }; + } else if (window.getSelection) { + var selection = window.getSelection(); + return { + anchorNode: selection.anchorNode, + anchorOffset: selection.anchorOffset, + focusNode: selection.focusNode, + focusOffset: selection.focusOffset + }; } else if (document.selection) { var range = document.selection.createRange(); return { @@ -31346,14 +31408,6 @@ function getSelection(node) { top: range.boundingTop, left: range.boundingLeft }; - } else { - var selection = window.getSelection(); - return { - anchorNode: selection.anchorNode, - anchorOffset: selection.anchorOffset, - focusNode: selection.focusNode, - focusOffset: selection.focusOffset - }; } } @@ -31468,21 +31522,14 @@ var SelectEventPlugin = { module.exports = SelectEventPlugin; -},{"./EventConstants":16,"./EventPropagators":21,"./ReactInputSelection":63,"./SyntheticEvent":96,"./getActiveElement":122,"./isTextInputElement":137,"./keyOf":141,"./shallowEqual":153}],91:[function(_dereq_,module,exports){ +},{"./EventConstants":17,"./EventPropagators":22,"./ReactInputSelection":65,"./SyntheticEvent":99,"./getActiveElement":127,"./isTextInputElement":143,"./keyOf":147,"./shallowEqual":155}],94:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * 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 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * 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. + * 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. * * @providesModule ServerReactRootIndex * @typechecks @@ -31506,21 +31553,14 @@ var ServerReactRootIndex = { module.exports = ServerReactRootIndex; -},{}],92:[function(_dereq_,module,exports){ +},{}],95:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * 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 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * 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. + * 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. * * @providesModule SimpleEventPlugin */ @@ -31540,8 +31580,11 @@ var SyntheticTouchEvent = _dereq_("./SyntheticTouchEvent"); var SyntheticUIEvent = _dereq_("./SyntheticUIEvent"); var SyntheticWheelEvent = _dereq_("./SyntheticWheelEvent"); +var getEventCharCode = _dereq_("./getEventCharCode"); + var invariant = _dereq_("./invariant"); var keyOf = _dereq_("./keyOf"); +var warning = _dereq_("./warning"); var topLevelTypes = EventConstants.topLevelTypes; @@ -31808,7 +31851,7 @@ var SimpleEventPlugin = { /** * Same as the default implementation, except cancels the event when return - * value is false. + * value is false. This behavior will be disabled in a future release. * * @param {object} Event to be dispatched. * @param {function} Application-level callback. @@ -31816,6 +31859,14 @@ var SimpleEventPlugin = { */ executeDispatch: function(event, listener, domID) { var returnValue = EventPluginUtils.executeDispatch(event, listener, domID); + + ("production" !== "development" ? warning( + typeof returnValue !== 'boolean', + 'Returning `false` from an event handler is deprecated and will be ' + + 'ignored in a future release. Instead, manually call ' + + 'e.stopPropagation() or e.preventDefault(), as appropriate.' + ) : null); + if (returnValue === false) { event.stopPropagation(); event.preventDefault(); @@ -31852,8 +31903,9 @@ var SimpleEventPlugin = { break; case topLevelTypes.topKeyPress: // FireFox creates a keypress event for function keys too. This removes - // the unwanted keypress events. - if (nativeEvent.charCode === 0) { + // the unwanted keypress events. Enter is however both printable and + // non-printable. One would expect Tab to be as well (but it isn't). + if (getEventCharCode(nativeEvent) === 0) { return null; } /* falls through */ @@ -31927,21 +31979,14 @@ var SimpleEventPlugin = { module.exports = SimpleEventPlugin; -},{"./EventConstants":16,"./EventPluginUtils":20,"./EventPropagators":21,"./SyntheticClipboardEvent":93,"./SyntheticDragEvent":95,"./SyntheticEvent":96,"./SyntheticFocusEvent":97,"./SyntheticKeyboardEvent":99,"./SyntheticMouseEvent":100,"./SyntheticTouchEvent":101,"./SyntheticUIEvent":102,"./SyntheticWheelEvent":103,"./invariant":134,"./keyOf":141}],93:[function(_dereq_,module,exports){ +},{"./EventConstants":17,"./EventPluginUtils":21,"./EventPropagators":22,"./SyntheticClipboardEvent":96,"./SyntheticDragEvent":98,"./SyntheticEvent":99,"./SyntheticFocusEvent":100,"./SyntheticKeyboardEvent":102,"./SyntheticMouseEvent":103,"./SyntheticTouchEvent":104,"./SyntheticUIEvent":105,"./SyntheticWheelEvent":106,"./getEventCharCode":128,"./invariant":140,"./keyOf":147,"./warning":160}],96:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * 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 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * 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. + * 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. * * @providesModule SyntheticClipboardEvent * @typechecks static-only @@ -31980,21 +32025,14 @@ SyntheticEvent.augmentClass(SyntheticClipboardEvent, ClipboardEventInterface); module.exports = SyntheticClipboardEvent; -},{"./SyntheticEvent":96}],94:[function(_dereq_,module,exports){ +},{"./SyntheticEvent":99}],97:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * 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 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * 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. + * 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. * * @providesModule SyntheticCompositionEvent * @typechecks static-only @@ -32033,21 +32071,14 @@ SyntheticEvent.augmentClass( module.exports = SyntheticCompositionEvent; -},{"./SyntheticEvent":96}],95:[function(_dereq_,module,exports){ +},{"./SyntheticEvent":99}],98:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * 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 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * 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. + * 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. * * @providesModule SyntheticDragEvent * @typechecks static-only @@ -32079,21 +32110,14 @@ SyntheticMouseEvent.augmentClass(SyntheticDragEvent, DragEventInterface); module.exports = SyntheticDragEvent; -},{"./SyntheticMouseEvent":100}],96:[function(_dereq_,module,exports){ +},{"./SyntheticMouseEvent":103}],99:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * 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 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * 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. + * 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. * * @providesModule SyntheticEvent * @typechecks static-only @@ -32103,10 +32127,9 @@ module.exports = SyntheticDragEvent; var PooledClass = _dereq_("./PooledClass"); +var assign = _dereq_("./Object.assign"); var emptyFunction = _dereq_("./emptyFunction"); var getEventTarget = _dereq_("./getEventTarget"); -var merge = _dereq_("./merge"); -var mergeInto = _dereq_("./mergeInto"); /** * @interface Event @@ -32173,7 +32196,7 @@ function SyntheticEvent(dispatchConfig, dispatchMarker, nativeEvent) { this.isPropagationStopped = emptyFunction.thatReturnsFalse; } -mergeInto(SyntheticEvent.prototype, { +assign(SyntheticEvent.prototype, { preventDefault: function() { this.defaultPrevented = true; @@ -32231,11 +32254,11 @@ SyntheticEvent.augmentClass = function(Class, Interface) { var Super = this; var prototype = Object.create(Super.prototype); - mergeInto(prototype, Class.prototype); + assign(prototype, Class.prototype); Class.prototype = prototype; Class.prototype.constructor = Class; - Class.Interface = merge(Super.Interface, Interface); + Class.Interface = assign({}, Super.Interface, Interface); Class.augmentClass = Super.augmentClass; PooledClass.addPoolingTo(Class, PooledClass.threeArgumentPooler); @@ -32245,21 +32268,14 @@ PooledClass.addPoolingTo(SyntheticEvent, PooledClass.threeArgumentPooler); module.exports = SyntheticEvent; -},{"./PooledClass":28,"./emptyFunction":116,"./getEventTarget":125,"./merge":144,"./mergeInto":146}],97:[function(_dereq_,module,exports){ +},{"./Object.assign":29,"./PooledClass":30,"./emptyFunction":121,"./getEventTarget":131}],100:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * 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 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * 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. + * 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. * * @providesModule SyntheticFocusEvent * @typechecks static-only @@ -32291,21 +32307,14 @@ SyntheticUIEvent.augmentClass(SyntheticFocusEvent, FocusEventInterface); module.exports = SyntheticFocusEvent; -},{"./SyntheticUIEvent":102}],98:[function(_dereq_,module,exports){ +},{"./SyntheticUIEvent":105}],101:[function(_dereq_,module,exports){ /** * Copyright 2013 Facebook, Inc. + * All rights reserved. * - * 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. + * 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. * * @providesModule SyntheticInputEvent * @typechecks static-only @@ -32345,21 +32354,14 @@ SyntheticEvent.augmentClass( module.exports = SyntheticInputEvent; -},{"./SyntheticEvent":96}],99:[function(_dereq_,module,exports){ +},{"./SyntheticEvent":99}],102:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * 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 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * 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. + * 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. * * @providesModule SyntheticKeyboardEvent * @typechecks static-only @@ -32369,6 +32371,7 @@ module.exports = SyntheticInputEvent; var SyntheticUIEvent = _dereq_("./SyntheticUIEvent"); +var getEventCharCode = _dereq_("./getEventCharCode"); var getEventKey = _dereq_("./getEventKey"); var getEventModifierState = _dereq_("./getEventModifierState"); @@ -32391,11 +32394,10 @@ var KeyboardEventInterface = { // `charCode` is the result of a KeyPress event and represents the value of // the actual printable character. - // KeyPress is deprecated but its replacement is not yet final and not - // implemented in any major browser. + // KeyPress is deprecated, but its replacement is not yet final and not + // implemented in any major browser. Only KeyPress has charCode. if (event.type === 'keypress') { - // IE8 does not implement "charCode", but "keyCode" has the correct value. - return 'charCode' in event ? event.charCode : event.keyCode; + return getEventCharCode(event); } return 0; }, @@ -32414,9 +32416,14 @@ var KeyboardEventInterface = { }, which: function(event) { // `which` is an alias for either `keyCode` or `charCode` depending on the - // type of the event. There is no need to determine the type of the event - // as `keyCode` and `charCode` are either aliased or default to zero. - return event.keyCode || event.charCode; + // type of the event. + if (event.type === 'keypress') { + return getEventCharCode(event); + } + if (event.type === 'keydown' || event.type === 'keyup') { + return event.keyCode; + } + return 0; } }; @@ -32434,21 +32441,14 @@ SyntheticUIEvent.augmentClass(SyntheticKeyboardEvent, KeyboardEventInterface); module.exports = SyntheticKeyboardEvent; -},{"./SyntheticUIEvent":102,"./getEventKey":123,"./getEventModifierState":124}],100:[function(_dereq_,module,exports){ +},{"./SyntheticUIEvent":105,"./getEventCharCode":128,"./getEventKey":129,"./getEventModifierState":130}],103:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * 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 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * 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. + * 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. * * @providesModule SyntheticMouseEvent * @typechecks static-only @@ -32524,21 +32524,14 @@ SyntheticUIEvent.augmentClass(SyntheticMouseEvent, MouseEventInterface); module.exports = SyntheticMouseEvent; -},{"./SyntheticUIEvent":102,"./ViewportMetrics":105,"./getEventModifierState":124}],101:[function(_dereq_,module,exports){ +},{"./SyntheticUIEvent":105,"./ViewportMetrics":108,"./getEventModifierState":130}],104:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * 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 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * 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. + * 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. * * @providesModule SyntheticTouchEvent * @typechecks static-only @@ -32579,21 +32572,14 @@ SyntheticUIEvent.augmentClass(SyntheticTouchEvent, TouchEventInterface); module.exports = SyntheticTouchEvent; -},{"./SyntheticUIEvent":102,"./getEventModifierState":124}],102:[function(_dereq_,module,exports){ +},{"./SyntheticUIEvent":105,"./getEventModifierState":130}],105:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * 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 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * 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. + * 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. * * @providesModule SyntheticUIEvent * @typechecks static-only @@ -32648,21 +32634,14 @@ SyntheticEvent.augmentClass(SyntheticUIEvent, UIEventInterface); module.exports = SyntheticUIEvent; -},{"./SyntheticEvent":96,"./getEventTarget":125}],103:[function(_dereq_,module,exports){ +},{"./SyntheticEvent":99,"./getEventTarget":131}],106:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * 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 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * 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. + * 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. * * @providesModule SyntheticWheelEvent * @typechecks static-only @@ -32716,21 +32695,14 @@ SyntheticMouseEvent.augmentClass(SyntheticWheelEvent, WheelEventInterface); module.exports = SyntheticWheelEvent; -},{"./SyntheticMouseEvent":100}],104:[function(_dereq_,module,exports){ +},{"./SyntheticMouseEvent":103}],107:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * 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 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * 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. + * 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. * * @providesModule Transaction */ @@ -32962,21 +32934,14 @@ var Transaction = { module.exports = Transaction; -},{"./invariant":134}],105:[function(_dereq_,module,exports){ +},{"./invariant":140}],108:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * 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 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * 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. + * 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. * * @providesModule ViewportMetrics */ @@ -33001,23 +32966,16 @@ var ViewportMetrics = { module.exports = ViewportMetrics; -},{"./getUnboundedScrollPosition":130}],106:[function(_dereq_,module,exports){ +},{"./getUnboundedScrollPosition":136}],109:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * 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 + * Copyright 2014, Facebook, Inc. + * All rights reserved. * - * 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. + * 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. * - * @providesModule accumulate + * @providesModule accumulateInto */ "use strict"; @@ -33025,53 +32983,61 @@ module.exports = ViewportMetrics; var invariant = _dereq_("./invariant"); /** - * Accumulates items that must not be null or undefined. * - * This is used to conserve memory by avoiding array allocations. + * Accumulates items that must not be null or undefined into the first one. This + * is used to conserve memory by avoiding array allocations, and thus sacrifices + * API cleanness. Since `current` can be null before being passed in and not + * null after this function, make sure to assign it back to `current`: + * + * `a = accumulateInto(a, b);` + * + * This API should be sparingly used. Try `accumulate` for something cleaner. * * @return {*|array<*>} An accumulation of items. */ -function accumulate(current, next) { + +function accumulateInto(current, next) { ("production" !== "development" ? invariant( next != null, - 'accumulate(...): Accumulated items must be not be null or undefined.' + 'accumulateInto(...): Accumulated items must not be null or undefined.' ) : invariant(next != null)); if (current == null) { return next; - } else { - // Both are not empty. Warning: Never call x.concat(y) when you are not - // certain that x is an Array (x could be a string with concat method). - var currentIsArray = Array.isArray(current); - var nextIsArray = Array.isArray(next); - if (currentIsArray) { - return current.concat(next); - } else { - if (nextIsArray) { - return [current].concat(next); - } else { - return [current, next]; - } - } } + + // Both are not empty. Warning: Never call x.concat(y) when you are not + // certain that x is an Array (x could be a string with concat method). + var currentIsArray = Array.isArray(current); + var nextIsArray = Array.isArray(next); + + if (currentIsArray && nextIsArray) { + current.push.apply(current, next); + return current; + } + + if (currentIsArray) { + current.push(next); + return current; + } + + if (nextIsArray) { + // A bit too dangerous to mutate `next`. + return [current].concat(next); + } + + return [current, next]; } -module.exports = accumulate; +module.exports = accumulateInto; -},{"./invariant":134}],107:[function(_dereq_,module,exports){ +},{"./invariant":140}],110:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * 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 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * 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. + * 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. * * @providesModule adler32 */ @@ -33084,7 +33050,7 @@ var MOD = 65521; // This is a clean-room implementation of adler32 designed for detecting // if markup is not what we expect it to be. It does not need to be -// cryptographically strong, only reasonable good at detecting if markup +// cryptographically strong, only reasonably good at detecting if markup // generated on the server is different than that on the client. function adler32(data) { var a = 1; @@ -33098,21 +33064,88 @@ function adler32(data) { module.exports = adler32; -},{}],108:[function(_dereq_,module,exports){ +},{}],111:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * 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 + * 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. * - * http://www.apache.org/licenses/LICENSE-2.0 + * @providesModule camelize + * @typechecks + */ + +var _hyphenPattern = /-(.)/g; + +/** + * Camelcases a hyphenated string, for example: * - * 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. + * > camelize('background-color') + * < "backgroundColor" + * + * @param {string} string + * @return {string} + */ +function camelize(string) { + return string.replace(_hyphenPattern, function(_, character) { + return character.toUpperCase(); + }); +} + +module.exports = camelize; + +},{}],112:[function(_dereq_,module,exports){ +/** + * Copyright 2014, 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. + * + * @providesModule camelizeStyleName + * @typechecks + */ + +"use strict"; + +var camelize = _dereq_("./camelize"); + +var msPattern = /^-ms-/; + +/** + * Camelcases a hyphenated CSS property name, for example: + * + * > camelizeStyleName('background-color') + * < "backgroundColor" + * > camelizeStyleName('-moz-transition') + * < "MozTransition" + * > camelizeStyleName('-ms-transition') + * < "msTransition" + * + * As Andi Smith suggests + * (http://www.andismith.com/blog/2012/02/modernizr-prefixed/), an `-ms` prefix + * is converted to lowercase `ms`. + * + * @param {string} string + * @return {string} + */ +function camelizeStyleName(string) { + return camelize(string.replace(msPattern, 'ms-')); +} + +module.exports = camelizeStyleName; + +},{"./camelize":111}],113:[function(_dereq_,module,exports){ +/** + * Copyright 2013-2014, 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 * @providesModule cloneWithProps @@ -33120,6 +33153,7 @@ module.exports = adler32; "use strict"; +var ReactElement = _dereq_("./ReactElement"); var ReactPropTransferer = _dereq_("./ReactPropTransferer"); var keyOf = _dereq_("./keyOf"); @@ -33139,7 +33173,7 @@ var CHILDREN_PROP = keyOf({children: null}); function cloneWithProps(child, props) { if ("production" !== "development") { ("production" !== "development" ? warning( - !child.props.ref, + !child.ref, 'You are calling cloneWithProps() on a child with a ref. This is ' + 'dangerous because you\'re creating a new child which will not be ' + 'added as a ref to its parent.' @@ -33155,27 +33189,20 @@ function cloneWithProps(child, props) { } // The current API doesn't retain _owner and _context, which is why this - // doesn't use ReactDescriptor.cloneAndReplaceProps. - return child.constructor(newProps); + // doesn't use ReactElement.cloneAndReplaceProps. + return ReactElement.createElement(child.type, newProps); } module.exports = cloneWithProps; -},{"./ReactPropTransferer":72,"./keyOf":141,"./warning":158}],109:[function(_dereq_,module,exports){ +},{"./ReactElement":58,"./ReactPropTransferer":76,"./keyOf":147,"./warning":160}],114:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * 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 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * 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. + * 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. * * @providesModule containsNode * @typechecks @@ -33212,77 +33239,14 @@ function containsNode(outerNode, innerNode) { module.exports = containsNode; -},{"./isTextNode":138}],110:[function(_dereq_,module,exports){ -/** - * Copyright 2013-2014 Facebook, Inc. - * - * 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. - * - * @providesModule copyProperties - */ - -/** - * Copy properties from one or more objects (up to 5) into the first object. - * This is a shallow copy. It mutates the first object and also returns it. - * - * NOTE: `arguments` has a very significant performance penalty, which is why - * we don't support unlimited arguments. - */ -function copyProperties(obj, a, b, c, d, e, f) { - obj = obj || {}; - - if ("production" !== "development") { - if (f) { - throw new Error('Too many arguments passed to copyProperties'); - } - } - - var args = [a, b, c, d, e]; - var ii = 0, v; - while (args[ii]) { - v = args[ii++]; - for (var k in v) { - obj[k] = v[k]; - } - - // IE ignores toString in object iteration.. See: - // webreflection.blogspot.com/2007/07/quick-fix-internet-explorer-and.html - if (v.hasOwnProperty && v.hasOwnProperty('toString') && - (typeof v.toString != 'undefined') && (obj.toString !== v.toString)) { - obj.toString = v.toString; - } - } - - return obj; -} - -module.exports = copyProperties; - -},{}],111:[function(_dereq_,module,exports){ +},{"./isTextNode":144}],115:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * 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 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * 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. + * 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. * * @providesModule createArrayFrom * @typechecks @@ -33361,21 +33325,14 @@ function createArrayFrom(obj) { module.exports = createArrayFrom; -},{"./toArray":155}],112:[function(_dereq_,module,exports){ +},{"./toArray":157}],116:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * 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 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * 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. + * 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. * * @providesModule createFullPageComponent * @typechecks @@ -33385,6 +33342,7 @@ module.exports = createArrayFrom; // Defeat circular references by requiring this directly. var ReactCompositeComponent = _dereq_("./ReactCompositeComponent"); +var ReactElement = _dereq_("./ReactElement"); var invariant = _dereq_("./invariant"); @@ -33396,14 +33354,14 @@ var invariant = _dereq_("./invariant"); * take advantage of React's reconciliation for styling and <title> * management. So we just document it and throw in dangerous cases. * - * @param {function} componentClass convenience constructor to wrap + * @param {string} tag The tag to wrap * @return {function} convenience constructor of new component */ -function createFullPageComponent(componentClass) { +function createFullPageComponent(tag) { + var elementFactory = ReactElement.createFactory(tag); + var FullPageComponent = ReactCompositeComponent.createClass({ - displayName: 'ReactFullPageComponent' + ( - componentClass.type.displayName || '' - ), + displayName: 'ReactFullPageComponent' + tag, componentWillUnmount: function() { ("production" !== "development" ? invariant( @@ -33417,7 +33375,7 @@ function createFullPageComponent(componentClass) { }, render: function() { - return this.transferPropsTo(componentClass(null, this.props.children)); + return elementFactory(this.props); } }); @@ -33426,21 +33384,14 @@ function createFullPageComponent(componentClass) { module.exports = createFullPageComponent; -},{"./ReactCompositeComponent":38,"./invariant":134}],113:[function(_dereq_,module,exports){ +},{"./ReactCompositeComponent":40,"./ReactElement":58,"./invariant":140}],117:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * 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 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * 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. + * 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. * * @providesModule createNodesFromMarkup * @typechecks @@ -33521,21 +33472,14 @@ function createNodesFromMarkup(markup, handleScript) { module.exports = createNodesFromMarkup; -},{"./ExecutionEnvironment":22,"./createArrayFrom":111,"./getMarkupWrap":126,"./invariant":134}],114:[function(_dereq_,module,exports){ +},{"./ExecutionEnvironment":23,"./createArrayFrom":115,"./getMarkupWrap":132,"./invariant":140}],118:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * 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 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * 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. + * 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. * * @providesModule cx */ @@ -33567,21 +33511,14 @@ function cx(classNames) { module.exports = cx; -},{}],115:[function(_dereq_,module,exports){ +},{}],119:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * 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 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * 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. + * 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. * * @providesModule dangerousStyleValue * @typechecks static-only @@ -33632,27 +33569,67 @@ function dangerousStyleValue(name, value) { module.exports = dangerousStyleValue; -},{"./CSSProperty":4}],116:[function(_dereq_,module,exports){ +},{"./CSSProperty":5}],120:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * 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 + * 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. * - * http://www.apache.org/licenses/LICENSE-2.0 + * @providesModule deprecated + */ + +var assign = _dereq_("./Object.assign"); +var warning = _dereq_("./warning"); + +/** + * This will log a single deprecation notice per function and forward the call + * on to the new API. * - * 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. + * @param {string} namespace The namespace of the call, eg 'React' + * @param {string} oldName The old function name, eg 'renderComponent' + * @param {string} newName The new function name, eg 'render' + * @param {*} ctx The context this forwarded call should run in + * @param {function} fn The function to forward on to + * @return {*} Will be the value as returned from `fn` + */ +function deprecated(namespace, oldName, newName, ctx, fn) { + var warned = false; + if ("production" !== "development") { + var newFn = function() { + ("production" !== "development" ? warning( + warned, + (namespace + "." + oldName + " will be deprecated in a future version. ") + + ("Use " + namespace + "." + newName + " instead.") + ) : null); + warned = true; + return fn.apply(ctx, arguments); + }; + newFn.displayName = (namespace + "_" + oldName); + // We need to make sure all properties of the original fn are copied over. + // In particular, this is needed to support PropTypes + return assign(newFn, fn); + } + + return fn; +} + +module.exports = deprecated; + +},{"./Object.assign":29,"./warning":160}],121:[function(_dereq_,module,exports){ +/** + * Copyright 2013-2014, 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. * * @providesModule emptyFunction */ -var copyProperties = _dereq_("./copyProperties"); - function makeEmptyFunction(arg) { return function() { return arg; @@ -33666,32 +33643,23 @@ function makeEmptyFunction(arg) { */ function emptyFunction() {} -copyProperties(emptyFunction, { - thatReturns: makeEmptyFunction, - thatReturnsFalse: makeEmptyFunction(false), - thatReturnsTrue: makeEmptyFunction(true), - thatReturnsNull: makeEmptyFunction(null), - thatReturnsThis: function() { return this; }, - thatReturnsArgument: function(arg) { return arg; } -}); +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; -},{"./copyProperties":110}],117:[function(_dereq_,module,exports){ +},{}],122:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * 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 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * 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. + * 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. * * @providesModule emptyObject */ @@ -33706,21 +33674,14 @@ if ("production" !== "development") { module.exports = emptyObject; -},{}],118:[function(_dereq_,module,exports){ +},{}],123:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * 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 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * 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. + * 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. * * @providesModule escapeTextForBrowser * @typechecks static-only @@ -33754,27 +33715,22 @@ function escapeTextForBrowser(text) { module.exports = escapeTextForBrowser; -},{}],119:[function(_dereq_,module,exports){ +},{}],124:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * 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 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * 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. + * 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. * * @providesModule flattenChildren */ "use strict"; +var ReactTextComponent = _dereq_("./ReactTextComponent"); + var traverseAllChildren = _dereq_("./traverseAllChildren"); var warning = _dereq_("./warning"); @@ -33795,7 +33751,18 @@ function flattenSingleChildIntoContext(traverseContext, child, name) { name ) : null); if (keyUnique && child != null) { - result[name] = child; + var type = typeof child; + var normalizedValue; + + if (type === 'string') { + normalizedValue = ReactTextComponent(child); + } else if (type === 'number') { + normalizedValue = ReactTextComponent('' + child); + } else { + normalizedValue = child; + } + + result[name] = normalizedValue; } } @@ -33815,21 +33782,14 @@ function flattenChildren(children) { module.exports = flattenChildren; -},{"./traverseAllChildren":156,"./warning":158}],120:[function(_dereq_,module,exports){ +},{"./ReactTextComponent":87,"./traverseAllChildren":158,"./warning":160}],125:[function(_dereq_,module,exports){ /** - * Copyright 2014 Facebook, Inc. - * - * 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 + * Copyright 2014, Facebook, Inc. + * All rights reserved. * - * 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. + * 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. * * @providesModule focusNode */ @@ -33837,34 +33797,28 @@ module.exports = flattenChildren; "use strict"; /** - * IE8 throws if an input/textarea is disabled and we try to focus it. - * Focus only when necessary. - * * @param {DOMElement} node input/textarea to focus */ function focusNode(node) { - if (!node.disabled) { + // IE8 can throw "Can't move focus to the control because it is invisible, + // not enabled, or of a type that does not accept the focus." for all kinds of + // reasons that are too expensive and fragile to test. + try { node.focus(); + } catch(e) { } } module.exports = focusNode; -},{}],121:[function(_dereq_,module,exports){ +},{}],126:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * 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 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * 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. + * 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. * * @providesModule forEachAccumulated */ @@ -33888,21 +33842,14 @@ var forEachAccumulated = function(arr, cb, scope) { module.exports = forEachAccumulated; -},{}],122:[function(_dereq_,module,exports){ +},{}],127:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * 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 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * 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. + * 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. * * @providesModule getActiveElement * @typechecks @@ -33924,21 +33871,66 @@ function getActiveElement() /*?DOMElement*/ { module.exports = getActiveElement; -},{}],123:[function(_dereq_,module,exports){ +},{}],128:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * 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 + * 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. * - * http://www.apache.org/licenses/LICENSE-2.0 + * @providesModule getEventCharCode + * @typechecks static-only + */ + +"use strict"; + +/** + * `charCode` represents the actual "character code" and is safe to use with + * `String.fromCharCode`. As such, only keys that correspond to printable + * characters produce a valid `charCode`, the only exception to this is Enter. + * The Tab-key is considered non-printable and does not have a `charCode`, + * presumably because it does not produce a tab-character in browsers. * - * 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. + * @param {object} nativeEvent Native browser event. + * @return {string} Normalized `charCode` property. + */ +function getEventCharCode(nativeEvent) { + var charCode; + var keyCode = nativeEvent.keyCode; + + if ('charCode' in nativeEvent) { + charCode = nativeEvent.charCode; + + // FF does not set `charCode` for the Enter-key, check against `keyCode`. + if (charCode === 0 && keyCode === 13) { + charCode = 13; + } + } else { + // IE8 does not implement `charCode`, but `keyCode` has the correct value. + charCode = keyCode; + } + + // Some non-printable keys are reported in `charCode`/`keyCode`, discard them. + // Must not discard the (non-)printable Enter-key. + if (charCode >= 32 || charCode === 13) { + return charCode; + } + + return 0; +} + +module.exports = getEventCharCode; + +},{}],129:[function(_dereq_,module,exports){ +/** + * Copyright 2013-2014, 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. * * @providesModule getEventKey * @typechecks static-only @@ -33946,7 +33938,7 @@ module.exports = getActiveElement; "use strict"; -var invariant = _dereq_("./invariant"); +var getEventCharCode = _dereq_("./getEventCharCode"); /** * Normalization of deprecated HTML5 `key` values @@ -33968,7 +33960,7 @@ var normalizeKey = { }; /** - * Translation from legacy `which`/`keyCode` to HTML5 `key` + * Translation from legacy `keyCode` to HTML5 `key` * Only special keys supported, all others depend on keyboard layout or browser * @see https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent#Key_names */ @@ -34020,11 +34012,7 @@ function getEventKey(nativeEvent) { // Browser does not implement `key`, polyfill as much of it as we can. if (nativeEvent.type === 'keypress') { - // Create the character from the `charCode` ourselves and use as an almost - // perfect replacement. - var charCode = 'charCode' in nativeEvent ? - nativeEvent.charCode : - nativeEvent.keyCode; + var charCode = getEventCharCode(nativeEvent); // The enter-key is technically both printable and non-printable and can // thus be captured by `keypress`, no other non-printable key should. @@ -34035,27 +34023,19 @@ function getEventKey(nativeEvent) { // `keyCode` value, almost all function keys have a universal value. return translateToKey[nativeEvent.keyCode] || 'Unidentified'; } - - ("production" !== "development" ? invariant(false, "Unexpected keyboard event type: %s", nativeEvent.type) : invariant(false)); + return ''; } module.exports = getEventKey; -},{"./invariant":134}],124:[function(_dereq_,module,exports){ +},{"./getEventCharCode":128}],130:[function(_dereq_,module,exports){ /** * Copyright 2013 Facebook, Inc. + * All rights reserved. * - * 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. + * 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. * * @providesModule getEventModifierState * @typechecks static-only @@ -34095,21 +34075,14 @@ function getEventModifierState(nativeEvent) { module.exports = getEventModifierState; -},{}],125:[function(_dereq_,module,exports){ +},{}],131:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * 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 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * 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. + * 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. * * @providesModule getEventTarget * @typechecks static-only @@ -34133,21 +34106,14 @@ function getEventTarget(nativeEvent) { module.exports = getEventTarget; -},{}],126:[function(_dereq_,module,exports){ +},{}],132:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * 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 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * 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. + * 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. * * @providesModule getMarkupWrap */ @@ -34255,21 +34221,14 @@ function getMarkupWrap(nodeName) { module.exports = getMarkupWrap; -},{"./ExecutionEnvironment":22,"./invariant":134}],127:[function(_dereq_,module,exports){ +},{"./ExecutionEnvironment":23,"./invariant":140}],133:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * 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 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * 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. + * 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. * * @providesModule getNodeForCharacterOffset */ @@ -34337,21 +34296,14 @@ function getNodeForCharacterOffset(root, offset) { module.exports = getNodeForCharacterOffset; -},{}],128:[function(_dereq_,module,exports){ +},{}],134:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * 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 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * 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. + * 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. * * @providesModule getReactRootElementInContainer */ @@ -34379,21 +34331,14 @@ function getReactRootElementInContainer(container) { module.exports = getReactRootElementInContainer; -},{}],129:[function(_dereq_,module,exports){ +},{}],135:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * 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 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * 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. + * 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. * * @providesModule getTextContentAccessor */ @@ -34423,21 +34368,14 @@ function getTextContentAccessor() { module.exports = getTextContentAccessor; -},{"./ExecutionEnvironment":22}],130:[function(_dereq_,module,exports){ +},{"./ExecutionEnvironment":23}],136:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * 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 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * 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. + * 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. * * @providesModule getUnboundedScrollPosition * @typechecks @@ -34470,21 +34408,14 @@ function getUnboundedScrollPosition(scrollable) { module.exports = getUnboundedScrollPosition; -},{}],131:[function(_dereq_,module,exports){ +},{}],137:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * 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 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * 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. + * 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. * * @providesModule hyphenate * @typechecks @@ -34510,21 +34441,14 @@ function hyphenate(string) { module.exports = hyphenate; -},{}],132:[function(_dereq_,module,exports){ +},{}],138:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * 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 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * 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. + * 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. * * @providesModule hyphenateStyleName * @typechecks @@ -34539,11 +34463,11 @@ var msPattern = /^ms-/; /** * Hyphenates a camelcased CSS property name, for example: * - * > hyphenate('backgroundColor') + * > hyphenateStyleName('backgroundColor') * < "background-color" - * > hyphenate('MozTransition') + * > hyphenateStyleName('MozTransition') * < "-moz-transition" - * > hyphenate('msTransition') + * > hyphenateStyleName('msTransition') * < "-ms-transition" * * As Modernizr suggests (http://modernizr.com/docs/#prefixed), an `ms` prefix @@ -34558,21 +34482,14 @@ function hyphenateStyleName(string) { module.exports = hyphenateStyleName; -},{"./hyphenate":131}],133:[function(_dereq_,module,exports){ +},{"./hyphenate":137}],139:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * 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 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * 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. + * 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. * * @providesModule instantiateReactComponent * @typechecks static-only @@ -34580,63 +34497,111 @@ module.exports = hyphenateStyleName; "use strict"; -var invariant = _dereq_("./invariant"); +var warning = _dereq_("./warning"); -/** - * Validate a `componentDescriptor`. This should be exposed publicly in a follow - * up diff. - * - * @param {object} descriptor - * @return {boolean} Returns true if this is a valid descriptor of a Component. - */ -function isValidComponentDescriptor(descriptor) { - return ( - descriptor && - typeof descriptor.type === 'function' && - typeof descriptor.type.prototype.mountComponent === 'function' && - typeof descriptor.type.prototype.receiveComponent === 'function' - ); -} +var ReactElement = _dereq_("./ReactElement"); +var ReactLegacyElement = _dereq_("./ReactLegacyElement"); +var ReactNativeComponent = _dereq_("./ReactNativeComponent"); +var ReactEmptyComponent = _dereq_("./ReactEmptyComponent"); /** - * Given a `componentDescriptor` create an instance that will actually be - * mounted. Currently it just extracts an existing clone from composite - * components but this is an implementation detail which will change. + * Given an `element` create an instance that will actually be mounted. * - * @param {object} descriptor - * @return {object} A new instance of componentDescriptor's constructor. + * @param {object} element + * @param {*} parentCompositeType The composite type that resolved this. + * @return {object} A new instance of the element's constructor. * @protected */ -function instantiateReactComponent(descriptor) { +function instantiateReactComponent(element, parentCompositeType) { + var instance; - // TODO: Make warning - // if (__DEV__) { - ("production" !== "development" ? invariant( - isValidComponentDescriptor(descriptor), - 'Only React Components are valid for mounting.' - ) : invariant(isValidComponentDescriptor(descriptor))); - // } + if ("production" !== "development") { + ("production" !== "development" ? warning( + element && (typeof element.type === 'function' || + typeof element.type === 'string'), + 'Only functions or strings can be mounted as React components.' + ) : null); + + // Resolve mock instances + if (element.type._mockedReactClassConstructor) { + // If this is a mocked class, we treat the legacy factory as if it was the + // class constructor for future proofing unit tests. Because this might + // be mocked as a legacy factory, we ignore any warnings triggerd by + // this temporary hack. + ReactLegacyElement._isLegacyCallWarningEnabled = false; + try { + instance = new element.type._mockedReactClassConstructor( + element.props + ); + } finally { + ReactLegacyElement._isLegacyCallWarningEnabled = true; + } + + // If the mock implementation was a legacy factory, then it returns a + // element. We need to turn this into a real component instance. + if (ReactElement.isValidElement(instance)) { + instance = new instance.type(instance.props); + } + + var render = instance.render; + if (!render) { + // For auto-mocked factories, the prototype isn't shimmed and therefore + // there is no render function on the instance. We replace the whole + // component with an empty component instance instead. + element = ReactEmptyComponent.getEmptyComponent(); + } else { + if (render._isMockFunction && !render._getMockImplementation()) { + // Auto-mocked components may have a prototype with a mocked render + // function. For those, we'll need to mock the result of the render + // since we consider undefined to be invalid results from render. + render.mockImplementation( + ReactEmptyComponent.getEmptyComponent + ); + } + instance.construct(element); + return instance; + } + } + } + + // Special case string values + if (typeof element.type === 'string') { + instance = ReactNativeComponent.createInstanceForTag( + element.type, + element.props, + parentCompositeType + ); + } else { + // Normal case for non-mocks and non-strings + instance = new element.type(element.props); + } + + if ("production" !== "development") { + ("production" !== "development" ? warning( + typeof instance.construct === 'function' && + typeof instance.mountComponent === 'function' && + typeof instance.receiveComponent === 'function', + 'Only React Components can be mounted.' + ) : null); + } - return new descriptor.type(descriptor); + // This actually sets up the internal instance. This will become decoupled + // from the public instance in a future diff. + instance.construct(element); + + return instance; } module.exports = instantiateReactComponent; -},{"./invariant":134}],134:[function(_dereq_,module,exports){ +},{"./ReactElement":58,"./ReactEmptyComponent":60,"./ReactLegacyElement":67,"./ReactNativeComponent":73,"./warning":160}],140:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * 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 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * 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. + * 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. * * @providesModule invariant */ @@ -34684,21 +34649,14 @@ var invariant = function(condition, format, a, b, c, d, e, f) { module.exports = invariant; -},{}],135:[function(_dereq_,module,exports){ +},{}],141:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * 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 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * 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. + * 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. * * @providesModule isEventSupported */ @@ -34756,21 +34714,14 @@ function isEventSupported(eventNameSuffix, capture) { module.exports = isEventSupported; -},{"./ExecutionEnvironment":22}],136:[function(_dereq_,module,exports){ +},{"./ExecutionEnvironment":23}],142:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * 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 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * 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. + * 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. * * @providesModule isNode * @typechecks @@ -34791,21 +34742,14 @@ function isNode(object) { module.exports = isNode; -},{}],137:[function(_dereq_,module,exports){ +},{}],143:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * 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 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * 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. + * 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. * * @providesModule isTextInputElement */ @@ -34842,21 +34786,14 @@ function isTextInputElement(elem) { module.exports = isTextInputElement; -},{}],138:[function(_dereq_,module,exports){ +},{}],144:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * 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 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * 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. + * 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. * * @providesModule isTextNode * @typechecks @@ -34874,21 +34811,14 @@ function isTextNode(object) { module.exports = isTextNode; -},{"./isNode":136}],139:[function(_dereq_,module,exports){ +},{"./isNode":142}],145:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * 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 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * 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. + * 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. * * @providesModule joinClasses * @typechecks static-only @@ -34912,7 +34842,9 @@ function joinClasses(className/*, ... */) { if (argLength > 1) { for (var ii = 1; ii < argLength; ii++) { nextClass = arguments[ii]; - nextClass && (className += ' ' + nextClass); + if (nextClass) { + className = (className ? className + ' ' : '') + nextClass; + } } } return className; @@ -34920,21 +34852,14 @@ function joinClasses(className/*, ... */) { module.exports = joinClasses; -},{}],140:[function(_dereq_,module,exports){ +},{}],146:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * 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 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * 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. + * 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. * * @providesModule keyMirror * @typechecks static-only @@ -34980,21 +34905,14 @@ var keyMirror = function(obj) { module.exports = keyMirror; -},{"./invariant":134}],141:[function(_dereq_,module,exports){ +},{"./invariant":140}],147:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * 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 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * 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. + * 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. * * @providesModule keyOf */ @@ -35023,75 +34941,67 @@ var keyOf = function(oneKeyObj) { module.exports = keyOf; -},{}],142:[function(_dereq_,module,exports){ +},{}],148:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * 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 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * 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. + * 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. * * @providesModule mapObject */ -"use strict"; +'use strict'; + +var hasOwnProperty = Object.prototype.hasOwnProperty; /** - * For each key/value pair, invokes callback func and constructs a resulting - * object which contains, for every key in obj, values that are the result of - * of invoking the function: + * Executes the provided `callback` once for each enumerable own property in the + * object and constructs a new object from the results. The `callback` is + * invoked with three arguments: * - * func(value, key, iteration) + * - the property value + * - the property name + * - the object being traversed * - * Grepable names: + * Properties that are added after the call to `mapObject` will not be visited + * by `callback`. If the values of existing properties are changed, the value + * passed to `callback` will be the value at the time `mapObject` visits them. + * Properties that are deleted before being visited are not visited. * - * function objectMap() - * function objMap() + * @grep function objectMap() + * @grep function objMap() * - * @param {?object} obj Object to map keys over - * @param {function} func Invoked for each key/val pair. - * @param {?*} context - * @return {?object} Result of mapping or null if obj is falsey + * @param {?object} object + * @param {function} callback + * @param {*} context + * @return {?object} */ -function mapObject(obj, func, context) { - if (!obj) { +function mapObject(object, callback, context) { + if (!object) { return null; } - var i = 0; - var ret = {}; - for (var key in obj) { - if (obj.hasOwnProperty(key)) { - ret[key] = func.call(context, obj[key], key, i++); + var result = {}; + for (var name in object) { + if (hasOwnProperty.call(object, name)) { + result[name] = callback.call(context, object[name], name, object); } } - return ret; + return result; } module.exports = mapObject; -},{}],143:[function(_dereq_,module,exports){ +},{}],149:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * 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 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * 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. + * 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. * * @providesModule memoizeStringOnly * @typechecks static-only @@ -35118,293 +35028,14 @@ function memoizeStringOnly(callback) { module.exports = memoizeStringOnly; -},{}],144:[function(_dereq_,module,exports){ -/** - * Copyright 2013-2014 Facebook, Inc. - * - * 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. - * - * @providesModule merge - */ - -"use strict"; - -var mergeInto = _dereq_("./mergeInto"); - -/** - * Shallow merges two structures into a return value, without mutating either. - * - * @param {?object} one Optional object with properties to merge from. - * @param {?object} two Optional object with properties to merge from. - * @return {object} The shallow extension of one by two. - */ -var merge = function(one, two) { - var result = {}; - mergeInto(result, one); - mergeInto(result, two); - return result; -}; - -module.exports = merge; - -},{"./mergeInto":146}],145:[function(_dereq_,module,exports){ -/** - * Copyright 2013-2014 Facebook, Inc. - * - * 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. - * - * @providesModule mergeHelpers - * - * requiresPolyfills: Array.isArray - */ - -"use strict"; - -var invariant = _dereq_("./invariant"); -var keyMirror = _dereq_("./keyMirror"); - -/** - * Maximum number of levels to traverse. Will catch circular structures. - * @const - */ -var MAX_MERGE_DEPTH = 36; - -/** - * We won't worry about edge cases like new String('x') or new Boolean(true). - * Functions are considered terminals, and arrays are not. - * @param {*} o The item/object/value to test. - * @return {boolean} true iff the argument is a terminal. - */ -var isTerminal = function(o) { - return typeof o !== 'object' || o === null; -}; - -var mergeHelpers = { - - MAX_MERGE_DEPTH: MAX_MERGE_DEPTH, - - isTerminal: isTerminal, - - /** - * Converts null/undefined values into empty object. - * - * @param {?Object=} arg Argument to be normalized (nullable optional) - * @return {!Object} - */ - normalizeMergeArg: function(arg) { - return arg === undefined || arg === null ? {} : arg; - }, - - /** - * If merging Arrays, a merge strategy *must* be supplied. If not, it is - * likely the caller's fault. If this function is ever called with anything - * but `one` and `two` being `Array`s, it is the fault of the merge utilities. - * - * @param {*} one Array to merge into. - * @param {*} two Array to merge from. - */ - checkMergeArrayArgs: function(one, two) { - ("production" !== "development" ? invariant( - Array.isArray(one) && Array.isArray(two), - 'Tried to merge arrays, instead got %s and %s.', - one, - two - ) : invariant(Array.isArray(one) && Array.isArray(two))); - }, - - /** - * @param {*} one Object to merge into. - * @param {*} two Object to merge from. - */ - checkMergeObjectArgs: function(one, two) { - mergeHelpers.checkMergeObjectArg(one); - mergeHelpers.checkMergeObjectArg(two); - }, - - /** - * @param {*} arg - */ - checkMergeObjectArg: function(arg) { - ("production" !== "development" ? invariant( - !isTerminal(arg) && !Array.isArray(arg), - 'Tried to merge an object, instead got %s.', - arg - ) : invariant(!isTerminal(arg) && !Array.isArray(arg))); - }, - - /** - * @param {*} arg - */ - checkMergeIntoObjectArg: function(arg) { - ("production" !== "development" ? invariant( - (!isTerminal(arg) || typeof arg === 'function') && !Array.isArray(arg), - 'Tried to merge into an object, instead got %s.', - arg - ) : invariant((!isTerminal(arg) || typeof arg === 'function') && !Array.isArray(arg))); - }, - - /** - * Checks that a merge was not given a circular object or an object that had - * too great of depth. - * - * @param {number} Level of recursion to validate against maximum. - */ - checkMergeLevel: function(level) { - ("production" !== "development" ? invariant( - level < MAX_MERGE_DEPTH, - 'Maximum deep merge depth exceeded. You may be attempting to merge ' + - 'circular structures in an unsupported way.' - ) : invariant(level < MAX_MERGE_DEPTH)); - }, - - /** - * Checks that the supplied merge strategy is valid. - * - * @param {string} Array merge strategy. - */ - checkArrayStrategy: function(strategy) { - ("production" !== "development" ? invariant( - strategy === undefined || strategy in mergeHelpers.ArrayStrategies, - 'You must provide an array strategy to deep merge functions to ' + - 'instruct the deep merge how to resolve merging two arrays.' - ) : invariant(strategy === undefined || strategy in mergeHelpers.ArrayStrategies)); - }, - - /** - * Set of possible behaviors of merge algorithms when encountering two Arrays - * that must be merged together. - * - `clobber`: The left `Array` is ignored. - * - `indexByIndex`: The result is achieved by recursively deep merging at - * each index. (not yet supported.) - */ - ArrayStrategies: keyMirror({ - Clobber: true, - IndexByIndex: true - }) - -}; - -module.exports = mergeHelpers; - -},{"./invariant":134,"./keyMirror":140}],146:[function(_dereq_,module,exports){ -/** - * Copyright 2013-2014 Facebook, Inc. - * - * 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. - * - * @providesModule mergeInto - * @typechecks static-only - */ - -"use strict"; - -var mergeHelpers = _dereq_("./mergeHelpers"); - -var checkMergeObjectArg = mergeHelpers.checkMergeObjectArg; -var checkMergeIntoObjectArg = mergeHelpers.checkMergeIntoObjectArg; - +},{}],150:[function(_dereq_,module,exports){ /** - * Shallow merges two structures by mutating the first parameter. - * - * @param {object|function} one Object to be merged into. - * @param {?object} two Optional object with properties to merge from. - */ -function mergeInto(one, two) { - checkMergeIntoObjectArg(one); - if (two != null) { - checkMergeObjectArg(two); - for (var key in two) { - if (!two.hasOwnProperty(key)) { - continue; - } - one[key] = two[key]; - } - } -} - -module.exports = mergeInto; - -},{"./mergeHelpers":145}],147:[function(_dereq_,module,exports){ -/** - * Copyright 2013-2014 Facebook, Inc. - * - * 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. - * - * @providesModule mixInto - */ - -"use strict"; - -/** - * Simply copies properties to the prototype. - */ -var mixInto = function(constructor, methodBag) { - var methodName; - for (methodName in methodBag) { - if (!methodBag.hasOwnProperty(methodName)) { - continue; - } - constructor.prototype[methodName] = methodBag[methodName]; - } -}; - -module.exports = mixInto; - -},{}],148:[function(_dereq_,module,exports){ -/** - * Copyright 2014 Facebook, Inc. - * - * 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 + * Copyright 2014, Facebook, Inc. + * All rights reserved. * - * 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. + * 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. * * @providesModule monitorCodeUse */ @@ -35429,27 +35060,20 @@ function monitorCodeUse(eventName, data) { module.exports = monitorCodeUse; -},{"./invariant":134}],149:[function(_dereq_,module,exports){ +},{"./invariant":140}],151:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * 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 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * 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. + * 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. * * @providesModule onlyChild */ "use strict"; -var ReactDescriptor = _dereq_("./ReactDescriptor"); +var ReactElement = _dereq_("./ReactElement"); var invariant = _dereq_("./invariant"); @@ -35466,29 +35090,22 @@ var invariant = _dereq_("./invariant"); */ function onlyChild(children) { ("production" !== "development" ? invariant( - ReactDescriptor.isValidDescriptor(children), + ReactElement.isValidElement(children), 'onlyChild must be passed a children with exactly one child.' - ) : invariant(ReactDescriptor.isValidDescriptor(children))); + ) : invariant(ReactElement.isValidElement(children))); return children; } module.exports = onlyChild; -},{"./ReactDescriptor":56,"./invariant":134}],150:[function(_dereq_,module,exports){ +},{"./ReactElement":58,"./invariant":140}],152:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * 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 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * 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. + * 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. * * @providesModule performance * @typechecks @@ -35509,21 +35126,14 @@ if (ExecutionEnvironment.canUseDOM) { module.exports = performance || {}; -},{"./ExecutionEnvironment":22}],151:[function(_dereq_,module,exports){ +},{"./ExecutionEnvironment":23}],153:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * 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 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * 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. + * 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. * * @providesModule performanceNow * @typechecks @@ -35544,21 +35154,14 @@ var performanceNow = performance.now.bind(performance); module.exports = performanceNow; -},{"./performance":150}],152:[function(_dereq_,module,exports){ +},{"./performance":152}],154:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * 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 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * 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. + * 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. * * @providesModule setInnerHTML */ @@ -35567,6 +35170,9 @@ module.exports = performanceNow; var ExecutionEnvironment = _dereq_("./ExecutionEnvironment"); +var WHITESPACE_TEST = /^[ \r\n\t\f]/; +var NONVISIBLE_TEST = /<(!--|link|noscript|meta|script|style)[ \r\n\t\f\/>]/; + /** * Set the innerHTML property of a node, ensuring that whitespace is preserved * even in IE8. @@ -35603,13 +35209,8 @@ if (ExecutionEnvironment.canUseDOM) { // thin air on IE8, this only happens if there is no visible text // in-front of the non-visible tags. Piggyback on the whitespace fix // and simply check if any non-visible tags appear in the source. - if (html.match(/^[ \r\n\t\f]/) || - html[0] === '<' && ( - html.indexOf('<noscript') !== -1 || - html.indexOf('<script') !== -1 || - html.indexOf('<style') !== -1 || - html.indexOf('<meta') !== -1 || - html.indexOf('<link') !== -1)) { + if (WHITESPACE_TEST.test(html) || + html[0] === '<' && NONVISIBLE_TEST.test(html)) { // Recover leading whitespace by temporarily prepending any character. // \uFEFF has the potential advantage of being zero-width/invisible. node.innerHTML = '\uFEFF' + html; @@ -35631,21 +35232,14 @@ if (ExecutionEnvironment.canUseDOM) { module.exports = setInnerHTML; -},{"./ExecutionEnvironment":22}],153:[function(_dereq_,module,exports){ +},{"./ExecutionEnvironment":23}],155:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * 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 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * 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. + * 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. * * @providesModule shallowEqual */ @@ -35671,7 +35265,7 @@ function shallowEqual(objA, objB) { return false; } } - // Test for B'a keys missing from A. + // Test for B's keys missing from A. for (key in objB) { if (objB.hasOwnProperty(key) && !objA.hasOwnProperty(key)) { return false; @@ -35682,21 +35276,14 @@ function shallowEqual(objA, objB) { module.exports = shallowEqual; -},{}],154:[function(_dereq_,module,exports){ +},{}],156:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * 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 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * 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. + * 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. * * @providesModule shouldUpdateReactComponent * @typechecks static-only @@ -35705,22 +35292,21 @@ module.exports = shallowEqual; "use strict"; /** - * Given a `prevDescriptor` and `nextDescriptor`, determines if the existing + * Given a `prevElement` and `nextElement`, determines if the existing * instance should be updated as opposed to being destroyed or replaced by a new - * instance. Both arguments are descriptors. This ensures that this logic can + * instance. Both arguments are elements. This ensures that this logic can * operate on stateless trees without any backing instance. * - * @param {?object} prevDescriptor - * @param {?object} nextDescriptor + * @param {?object} prevElement + * @param {?object} nextElement * @return {boolean} True if the existing instance should be updated. * @protected */ -function shouldUpdateReactComponent(prevDescriptor, nextDescriptor) { - if (prevDescriptor && nextDescriptor && - prevDescriptor.type === nextDescriptor.type && ( - (prevDescriptor.props && prevDescriptor.props.key) === - (nextDescriptor.props && nextDescriptor.props.key) - ) && prevDescriptor._owner === nextDescriptor._owner) { +function shouldUpdateReactComponent(prevElement, nextElement) { + if (prevElement && nextElement && + prevElement.type === nextElement.type && + prevElement.key === nextElement.key && + prevElement._owner === nextElement._owner) { return true; } return false; @@ -35728,21 +35314,14 @@ function shouldUpdateReactComponent(prevDescriptor, nextDescriptor) { module.exports = shouldUpdateReactComponent; -},{}],155:[function(_dereq_,module,exports){ +},{}],157:[function(_dereq_,module,exports){ /** - * Copyright 2014 Facebook, Inc. - * - * 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 + * Copyright 2014, Facebook, Inc. + * All rights reserved. * - * 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. + * 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. * * @providesModule toArray * @typechecks @@ -35805,29 +35384,22 @@ function toArray(obj) { module.exports = toArray; -},{"./invariant":134}],156:[function(_dereq_,module,exports){ +},{"./invariant":140}],158:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * 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 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * 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. + * 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. * * @providesModule traverseAllChildren */ "use strict"; +var ReactElement = _dereq_("./ReactElement"); var ReactInstanceHandles = _dereq_("./ReactInstanceHandles"); -var ReactTextComponent = _dereq_("./ReactTextComponent"); var invariant = _dereq_("./invariant"); @@ -35862,9 +35434,9 @@ function userProvidedKeyEscaper(match) { * @return {string} */ function getComponentKey(component, index) { - if (component && component.props && component.props.key != null) { + if (component && component.key != null) { // Explicit key - return wrapUserProvidedKey(component.props.key); + return wrapUserProvidedKey(component.key); } // Implicit key determined by the index in the set return index.toString(36); @@ -35905,16 +35477,17 @@ function wrapUserProvidedKey(key) { */ var traverseAllChildrenImpl = function(children, nameSoFar, indexSoFar, callback, traverseContext) { + var nextName, nextIndex; var subtreeCount = 0; // Count of children found in the current subtree. if (Array.isArray(children)) { for (var i = 0; i < children.length; i++) { var child = children[i]; - var nextName = ( + nextName = ( nameSoFar + (nameSoFar ? SUBSEPARATOR : SEPARATOR) + getComponentKey(child, i) ); - var nextIndex = indexSoFar + subtreeCount; + nextIndex = indexSoFar + subtreeCount; subtreeCount += traverseAllChildrenImpl( child, nextName, @@ -35934,40 +35507,32 @@ var traverseAllChildrenImpl = // All of the above are perceived as null. callback(traverseContext, null, storageName, indexSoFar); subtreeCount = 1; - } else if (children.type && children.type.prototype && - children.type.prototype.mountComponentIntoNode) { + } else if (type === 'string' || type === 'number' || + ReactElement.isValidElement(children)) { callback(traverseContext, children, storageName, indexSoFar); subtreeCount = 1; - } else { - if (type === 'object') { - ("production" !== "development" ? invariant( - !children || children.nodeType !== 1, - 'traverseAllChildren(...): Encountered an invalid child; DOM ' + - 'elements are not valid children of React components.' - ) : invariant(!children || children.nodeType !== 1)); - for (var key in children) { - if (children.hasOwnProperty(key)) { - subtreeCount += traverseAllChildrenImpl( - children[key], - ( - nameSoFar + (nameSoFar ? SUBSEPARATOR : SEPARATOR) + - wrapUserProvidedKey(key) + SUBSEPARATOR + - getComponentKey(children[key], 0) - ), - indexSoFar + subtreeCount, - callback, - traverseContext - ); - } + } else if (type === 'object') { + ("production" !== "development" ? invariant( + !children || children.nodeType !== 1, + 'traverseAllChildren(...): Encountered an invalid child; DOM ' + + 'elements are not valid children of React components.' + ) : invariant(!children || children.nodeType !== 1)); + for (var key in children) { + if (children.hasOwnProperty(key)) { + nextName = ( + nameSoFar + (nameSoFar ? SUBSEPARATOR : SEPARATOR) + + wrapUserProvidedKey(key) + SUBSEPARATOR + + getComponentKey(children[key], 0) + ); + nextIndex = indexSoFar + subtreeCount; + subtreeCount += traverseAllChildrenImpl( + children[key], + nextName, + nextIndex, + callback, + traverseContext + ); } - } else if (type === 'string') { - var normalizedText = ReactTextComponent(children); - callback(traverseContext, normalizedText, storageName, indexSoFar); - subtreeCount += 1; - } else if (type === 'number') { - var normalizedNumber = ReactTextComponent('' + children); - callback(traverseContext, normalizedNumber, storageName, indexSoFar); - subtreeCount += 1; } } } @@ -36000,28 +35565,21 @@ function traverseAllChildren(children, callback, traverseContext) { module.exports = traverseAllChildren; -},{"./ReactInstanceHandles":64,"./ReactTextComponent":83,"./invariant":134}],157:[function(_dereq_,module,exports){ +},{"./ReactElement":58,"./ReactInstanceHandles":66,"./invariant":140}],159:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * 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 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * 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. + * 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. * * @providesModule update */ "use strict"; -var copyProperties = _dereq_("./copyProperties"); +var assign = _dereq_("./Object.assign"); var keyOf = _dereq_("./keyOf"); var invariant = _dereq_("./invariant"); @@ -36029,7 +35587,7 @@ function shallowCopy(x) { if (Array.isArray(x)) { return x.concat(); } else if (x && typeof x === 'object') { - return copyProperties(new x.constructor(), x); + return assign(new x.constructor(), x); } else { return x; } @@ -36109,7 +35667,7 @@ function update(value, spec) { COMMAND_MERGE, nextValue ) : invariant(nextValue && typeof nextValue === 'object')); - copyProperties(nextValue, spec[COMMAND_MERGE]); + assign(nextValue, spec[COMMAND_MERGE]); } if (spec.hasOwnProperty(COMMAND_PUSH)) { @@ -36173,21 +35731,14 @@ function update(value, spec) { module.exports = update; -},{"./copyProperties":110,"./invariant":134,"./keyOf":141}],158:[function(_dereq_,module,exports){ +},{"./Object.assign":29,"./invariant":140,"./keyOf":147}],160:[function(_dereq_,module,exports){ /** - * Copyright 2014 Facebook, Inc. - * - * 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 + * Copyright 2014, Facebook, Inc. + * All rights reserved. * - * 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. + * 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. * * @providesModule warning */ @@ -36206,7 +35757,7 @@ var emptyFunction = _dereq_("./emptyFunction"); var warning = emptyFunction; if ("production" !== "development") { - warning = function(condition, format ) {var args=Array.prototype.slice.call(arguments,2); + warning = function(condition, format ) {for (var args=[],$__0=2,$__1=arguments.length;$__0<$__1;$__0++) args.push(arguments[$__0]); if (format === undefined) { throw new Error( '`warning(condition, format, ...args)` requires a warning ' + @@ -36223,71 +35774,81 @@ if ("production" !== "development") { module.exports = warning; -},{"./emptyFunction":116}]},{},[88]) -(88) +},{"./emptyFunction":121}]},{},[1])(1) }); !function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var f;"undefined"!=typeof window?f=window:"undefined"!=typeof global?f=global:"undefined"!=typeof self&&(f=self),f.ReactRouter=e()}}(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);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(_dereq_,module,exports){ -var LocationDispatcher = _dereq_('../dispatchers/LocationDispatcher'); -var makePath = _dereq_('../utils/makePath'); - /** * Actions that modify the URL. */ var LocationActions = { - PUSH: 'push', - REPLACE: 'replace', - POP: 'pop', - UPDATE_SCROLL: 'update-scroll', - /** - * Transitions to the URL specified in the arguments by pushing - * a new URL onto the history stack. + * Indicates a new location is being pushed to the history stack. */ - transitionTo: function (to, params, query) { - LocationDispatcher.handleViewAction({ - type: LocationActions.PUSH, - path: makePath(to, params, query) - }); - }, + PUSH: 'push', /** - * Transitions to the URL specified in the arguments by replacing - * the current URL in the history stack. + * Indicates the current location should be replaced. */ - replaceWith: function (to, params, query) { - LocationDispatcher.handleViewAction({ - type: LocationActions.REPLACE, - path: makePath(to, params, query) - }); - }, + REPLACE: 'replace', /** - * Transitions to the previous URL. + * Indicates the most recent entry should be removed from the history stack. */ - goBack: function () { - LocationDispatcher.handleViewAction({ - type: LocationActions.POP - }); - }, + POP: 'pop' - /** - * Updates the window's scroll position to the last known position - * for the current URL path. - */ - updateScroll: function () { - LocationDispatcher.handleViewAction({ - type: LocationActions.UPDATE_SCROLL - }); +}; + +module.exports = LocationActions; + +},{}],2:[function(_dereq_,module,exports){ +var LocationActions = _dereq_('../actions/LocationActions'); + +/** + * A scroll behavior that attempts to imitate the default behavior + * of modern browsers. + */ +var ImitateBrowserBehavior = { + + updateScrollPosition: function (position, actionType) { + switch (actionType) { + case LocationActions.PUSH: + case LocationActions.REPLACE: + window.scrollTo(0, 0); + break; + case LocationActions.POP: + if (position) { + window.scrollTo(position.x, position.y); + } else { + window.scrollTo(0, 0); + } + break; + } } }; -module.exports = LocationActions; +module.exports = ImitateBrowserBehavior; + +},{"../actions/LocationActions":1}],3:[function(_dereq_,module,exports){ +/** + * A scroll behavior that always scrolls to the top of the page + * after a transition. + */ +var ScrollToTopBehavior = { + + updateScrollPosition: function () { + window.scrollTo(0, 0); + } -},{"../dispatchers/LocationDispatcher":8,"../utils/makePath":26}],2:[function(_dereq_,module,exports){ -var merge = _dereq_('react/lib/merge'); -var Route = _dereq_('./Route'); +}; + +module.exports = ScrollToTopBehavior; + +},{}],4:[function(_dereq_,module,exports){ +var React = (typeof window !== "undefined" ? window.React : typeof global !== "undefined" ? global.React : null); +var FakeNode = _dereq_('../mixins/FakeNode'); +var PropTypes = _dereq_('../utils/PropTypes'); /** * A <DefaultRoute> component is a special kind of <Route> that @@ -36295,25 +35856,28 @@ var Route = _dereq_('./Route'); * Only one such route may be used at any given level in the * route hierarchy. */ -function DefaultRoute(props) { - return Route( - merge(props, { - path: null, - isDefault: true - }) - ); -} +var DefaultRoute = React.createClass({ + + displayName: 'DefaultRoute', + + mixins: [ FakeNode ], + + propTypes: { + name: React.PropTypes.string, + path: PropTypes.falsy, + handler: React.PropTypes.func.isRequired + } + +}); module.exports = DefaultRoute; -},{"./Route":6,"react/lib/merge":44}],3:[function(_dereq_,module,exports){ +},{"../mixins/FakeNode":14,"../utils/PropTypes":23}],5:[function(_dereq_,module,exports){ var React = (typeof window !== "undefined" ? window.React : typeof global !== "undefined" ? global.React : null); -var ActiveState = _dereq_('../mixins/ActiveState'); -var transitionTo = _dereq_('../actions/LocationActions').transitionTo; -var withoutProperties = _dereq_('../utils/withoutProperties'); -var hasOwnProperty = _dereq_('../utils/hasOwnProperty'); -var makeHref = _dereq_('../utils/makeHref'); -var warning = _dereq_('react/lib/warning'); +var classSet = _dereq_('react/lib/cx'); +var assign = _dereq_('react/lib/Object.assign'); +var Navigation = _dereq_('../mixins/Navigation'); +var State = _dereq_('../mixins/State'); function isLeftClickEvent(event) { return event.button === 0; @@ -36324,69 +35888,32 @@ function isModifiedEvent(event) { } /** - * DEPRECATED: A map of <Link> component props that are reserved for use by the - * router and/or React. All other props are used as params that are - * interpolated into the link's path. - */ -var RESERVED_PROPS = { - to: true, - key: true, - className: true, - activeClassName: true, - query: true, - onClick:true, - children: true // ReactChildren -}; - -/** * <Link> components are used to create an <a> element that links to a route. * When that route is active, the link gets an "active" class name (or the * value of its `activeClassName` prop). * * For example, assuming you have the following route: * - * <Route name="showPost" path="/posts/:postId" handler={Post}/> + * <Route name="showPost" path="/posts/:postID" handler={Post}/> * * You could use the following component to link to that route: * - * <Link to="showPost" params={{postId: "123"}} /> + * <Link to="showPost" params={{ postID: "123" }} /> * * In addition to params, links may pass along query string parameters * using the `query` prop. * - * <Link to="showPost" params={{postId: "123"}} query={{show:true}}/> + * <Link to="showPost" params={{ postID: "123" }} query={{ show:true }}/> */ var Link = React.createClass({ displayName: 'Link', - mixins: [ ActiveState ], - - statics: { - - // TODO: Deprecate passing props as params in v1.0 - getUnreservedProps: function (props) { - var props = withoutProperties(props, RESERVED_PROPS); - warning( - Object.keys(props).length === 0, - 'Passing props for params on <Link>s is deprecated, '+ - 'please use the `params` property.' - ); - return props; - }, - - /** - * Returns a hash of URL parameters to use in this <Link>'s path. - */ - getParams: function (props) { - return props.params || Link.getUnreservedProps(props); - } - - }, + mixins: [ Navigation, State ], propTypes: { - to: React.PropTypes.string.isRequired, activeClassName: React.PropTypes.string.isRequired, + to: React.PropTypes.string.isRequired, params: React.PropTypes.object, query: React.PropTypes.object, onClick: React.PropTypes.func @@ -36398,17 +35925,30 @@ var Link = React.createClass({ }; }, - getInitialState: function () { - return { - isActive: false - }; + handleClick: function (event) { + var allowTransition = true; + var clickResult; + + if (this.props.onClick) + clickResult = this.props.onClick(event); + + if (isModifiedEvent(event) || !isLeftClickEvent(event)) + return; + + if (clickResult === false || event.defaultPrevented === true) + allowTransition = false; + + event.preventDefault(); + + if (allowTransition) + this.transitionTo(this.props.to, this.props.params, this.props.query); }, /** * Returns the value of the "href" attribute to use on the DOM element. */ getHref: function () { - return makeHref(this.props.to, Link.getParams(this.props), this.props.query); + return this.makeHref(this.props.to, this.props.params, this.props.query); }, /** @@ -36416,59 +35956,23 @@ var Link = React.createClass({ * the value of the activeClassName property when this <Link> is active. */ getClassName: function () { - var className = this.props.className || ''; - - if (this.state.isActive) - return className + ' ' + this.props.activeClassName; - - return className; - }, - - componentWillReceiveProps: function (nextProps) { - var params = Link.getParams(nextProps); - - this.setState({ - isActive: Link.isActive(nextProps.to, params, nextProps.query) - }); - }, - - updateActiveState: function () { - this.setState({ - isActive: Link.isActive(this.props.to, Link.getParams(this.props), this.props.query) - }); - }, - - handleClick: function (event) { - var allowTransition = true; - var ret; - - if (this.props.onClick) - ret = this.props.onClick(event); - - if (isModifiedEvent(event) || !isLeftClickEvent(event)) - return; + var classNames = {}; - if (ret === false || event.defaultPrevented === true) - allowTransition = false; + if (this.props.className) + classNames[this.props.className] = true; - event.preventDefault(); + if (this.isActive(this.props.to, this.props.params, this.props.query)) + classNames[this.props.activeClassName] = true; - if (allowTransition) - transitionTo(this.props.to, Link.getParams(this.props), this.props.query); + return classSet(classNames); }, render: function () { - var props = { + var props = assign({}, this.props, { href: this.getHref(), className: this.getClassName(), onClick: this.handleClick - }; - - // pull in props without overriding - for (var propName in this.props) { - if (hasOwnProperty(this.props, propName) && hasOwnProperty(props, propName) === false) - props[propName] = this.props[propName]; - } + }); return React.DOM.a(props, this.props.children); } @@ -36477,9 +35981,10 @@ var Link = React.createClass({ module.exports = Link; -},{"../actions/LocationActions":1,"../mixins/ActiveState":15,"../utils/hasOwnProperty":24,"../utils/makeHref":25,"../utils/withoutProperties":29,"react/lib/warning":48}],4:[function(_dereq_,module,exports){ -var merge = _dereq_('react/lib/merge'); -var Route = _dereq_('./Route'); +},{"../mixins/Navigation":15,"../mixins/State":18,"react/lib/Object.assign":38,"react/lib/cx":39}],6:[function(_dereq_,module,exports){ +var React = (typeof window !== "undefined" ? window.React : typeof global !== "undefined" ? global.React : null); +var FakeNode = _dereq_('../mixins/FakeNode'); +var PropTypes = _dereq_('../utils/PropTypes'); /** * A <NotFoundRoute> is a special kind of <Route> that @@ -36488,65 +35993,51 @@ var Route = _dereq_('./Route'); * Only one such route may be used at any given level in the * route hierarchy. */ -function NotFoundRoute(props) { - return Route( - merge(props, { - path: null, - catchAll: true - }) - ); -} +var NotFoundRoute = React.createClass({ -module.exports = NotFoundRoute; + displayName: 'NotFoundRoute', -},{"./Route":6,"react/lib/merge":44}],5:[function(_dereq_,module,exports){ -var React = (typeof window !== "undefined" ? window.React : typeof global !== "undefined" ? global.React : null); -var Route = _dereq_('./Route'); + mixins: [ FakeNode ], -function createRedirectHandler(to) { - return React.createClass({ - statics: { - willTransitionTo: function (transition, params, query) { - transition.redirect(to, params, query); - } - }, + propTypes: { + name: React.PropTypes.string, + path: PropTypes.falsy, + handler: React.PropTypes.func.isRequired + } - render: function () { - return null; - } - }); -} +}); + +module.exports = NotFoundRoute; + +},{"../mixins/FakeNode":14,"../utils/PropTypes":23}],7:[function(_dereq_,module,exports){ +var React = (typeof window !== "undefined" ? window.React : typeof global !== "undefined" ? global.React : null); +var FakeNode = _dereq_('../mixins/FakeNode'); +var PropTypes = _dereq_('../utils/PropTypes'); /** * A <Redirect> component is a special kind of <Route> that always * redirects to another route when it matches. */ -function Redirect(props) { - return Route({ - name: props.name, - path: props.from || props.path || '*', - handler: createRedirectHandler(props.to) - }); -} +var Redirect = React.createClass({ + + displayName: 'Redirect', + + mixins: [ FakeNode ], + + propTypes: { + path: React.PropTypes.string, + from: React.PropTypes.string, // Alias for path. + to: React.PropTypes.string, + handler: PropTypes.falsy + } + +}); module.exports = Redirect; -},{"./Route":6}],6:[function(_dereq_,module,exports){ +},{"../mixins/FakeNode":14,"../utils/PropTypes":23}],8:[function(_dereq_,module,exports){ var React = (typeof window !== "undefined" ? window.React : typeof global !== "undefined" ? global.React : null); -var withoutProperties = _dereq_('../utils/withoutProperties'); - -/** - * A map of <Route> component props that are reserved for use by the - * router and/or React. All other props are considered "static" and - * are passed through to the route handler. - */ -var RESERVED_PROPS = { - handler: true, - path: true, - defaultRoute: true, - paramNames: true, - children: true // ReactChildren -}; +var FakeNode = _dereq_('../mixins/FakeNode'); /** * <Route> components specify components that are rendered to the page when the @@ -36558,40 +36049,29 @@ var RESERVED_PROPS = { * "active" and their components are rendered into the DOM, nested in the same * order as they are in the tree. * - * Unlike Ember, a nested route's path does not build upon that of its parents. - * This may seem like it creates more work up front in specifying URLs, but it - * has the nice benefit of decoupling nested UI from "nested" URLs. - * * The preferred way to configure a router is using JSX. The XML-like syntax is * a great way to visualize how routes are laid out in an application. * - * React.renderComponent(( - * <Routes handler={App}> + * var routes = [ + * <Route handler={App}> * <Route name="login" handler={Login}/> * <Route name="logout" handler={Logout}/> * <Route name="about" handler={About}/> - * </Routes> - * ), document.body); - * - * If you don't use JSX, you can also assemble a Router programmatically using - * the standard React component JavaScript API. - * - * React.renderComponent(( - * Routes({ handler: App }, - * Route({ name: 'login', handler: Login }), - * Route({ name: 'logout', handler: Logout }), - * Route({ name: 'about', handler: About }) - * ) - * ), document.body); + * </Route> + * ]; + * + * Router.run(routes, function (Handler) { + * React.render(<Handler/>, document.body); + * }); * * Handlers for Route components that contain children can render their active - * child route using the activeRouteHandler prop. + * child route using a <RouteHandler> element. * * var App = React.createClass({ * render: function () { * return ( * <div class="application"> - * {this.props.activeRouteHandler()} + * <RouteHandler/> * </div> * ); * } @@ -36601,542 +36081,122 @@ var Route = React.createClass({ displayName: 'Route', - statics: { - - getUnreservedProps: function (props) { - return withoutProperties(props, RESERVED_PROPS); - }, - - }, + mixins: [ FakeNode ], propTypes: { - preserveScrollPosition: React.PropTypes.bool.isRequired, - handler: React.PropTypes.any.isRequired, + name: React.PropTypes.string, path: React.PropTypes.string, - name: React.PropTypes.string - }, - - getDefaultProps: function () { - return { - preserveScrollPosition: false - }; - }, - - render: function () { - throw new Error( - 'The <Route> component should not be rendered directly. You may be ' + - 'missing a <Routes> wrapper around your list of routes.' - ); + handler: React.PropTypes.func.isRequired, + ignoreScrollBehavior: React.PropTypes.bool } }); module.exports = Route; -},{"../utils/withoutProperties":29}],7:[function(_dereq_,module,exports){ +},{"../mixins/FakeNode":14}],9:[function(_dereq_,module,exports){ var React = (typeof window !== "undefined" ? window.React : typeof global !== "undefined" ? global.React : null); -var warning = _dereq_('react/lib/warning'); -var copyProperties = _dereq_('react/lib/copyProperties'); -var Promise = _dereq_('when/lib/Promise'); -var LocationActions = _dereq_('../actions/LocationActions'); -var Route = _dereq_('../components/Route'); -var Path = _dereq_('../utils/Path'); -var Redirect = _dereq_('../utils/Redirect'); -var Transition = _dereq_('../utils/Transition'); -var DefaultLocation = _dereq_('../locations/DefaultLocation'); -var HashLocation = _dereq_('../locations/HashLocation'); -var HistoryLocation = _dereq_('../locations/HistoryLocation'); -var RefreshLocation = _dereq_('../locations/RefreshLocation'); -var ActiveStore = _dereq_('../stores/ActiveStore'); -var PathStore = _dereq_('../stores/PathStore'); -var RouteStore = _dereq_('../stores/RouteStore'); /** - * The ref name that can be used to reference the active route component. + * A <RouteHandler> component renders the active child route handler + * when routes are nested. */ -var REF_NAME = '__activeRoute__'; +var RouteHandler = React.createClass({ -/** - * A hash of { name, location } pairs of all locations. - */ -var NAMED_LOCATIONS = { - hash: HashLocation, - history: HistoryLocation, - refresh: RefreshLocation -}; - -/** - * The default handler for aborted transitions. Redirects replace - * the current URL and all others roll it back. - */ -function defaultAbortedTransitionHandler(transition) { - var reason = transition.abortReason; - - if (reason instanceof Redirect) { - LocationActions.replaceWith(reason.to, reason.params, reason.query); - } else { - LocationActions.goBack(); - } -} - -/** - * The default handler for active state updates. - */ -function defaultActiveStateChangeHandler(state) { - ActiveStore.updateState(state); -} - -/** - * The default handler for errors that were thrown asynchronously - * while transitioning. The default behavior is to re-throw the - * error so that it isn't silently swallowed. - */ -function defaultTransitionErrorHandler(error) { - throw error; // This error probably originated in a transition hook. -} - -function maybeUpdateScroll(routes, rootRoute) { - if (!routes.props.preserveScrollPosition && !rootRoute.props.preserveScrollPosition) - LocationActions.updateScroll(); -} - -/** - * The <Routes> component configures the route hierarchy and renders the - * route matching the current location when rendered into a document. - * - * See the <Route> component for more details. - */ -var Routes = React.createClass({ - - displayName: 'Routes', - - propTypes: { - onAbortedTransition: React.PropTypes.func.isRequired, - onActiveStateChange: React.PropTypes.func.isRequired, - onTransitionError: React.PropTypes.func.isRequired, - preserveScrollPosition: React.PropTypes.bool, - location: function (props, propName, componentName) { - var location = props[propName]; - - if (typeof location === 'string' && !(location in NAMED_LOCATIONS)) - return new Error('Unknown location "' + location + '", see ' + componentName); - } - }, + displayName: 'RouteHandler', getDefaultProps: function () { return { - onAbortedTransition: defaultAbortedTransitionHandler, - onActiveStateChange: defaultActiveStateChangeHandler, - onTransitionError: defaultTransitionErrorHandler, - preserveScrollPosition: false, - location: DefaultLocation - }; - }, - - getInitialState: function () { - return { - routes: RouteStore.registerChildren(this.props.children, this) + ref: '__routeHandler__' }; }, - getLocation: function () { - var location = this.props.location; - - if (typeof location === 'string') - return NAMED_LOCATIONS[location]; - - return location; + contextTypes: { + getRouteAtDepth: React.PropTypes.func.isRequired, + getRouteComponents: React.PropTypes.func.isRequired, + routeHandlers: React.PropTypes.array.isRequired }, - componentWillMount: function () { - PathStore.setup(this.getLocation()); - PathStore.addChangeListener(this.handlePathChange); + childContextTypes: { + routeHandlers: React.PropTypes.array.isRequired }, - componentDidMount: function () { - this.handlePathChange(); + getChildContext: function () { + return { + routeHandlers: this.context.routeHandlers.concat([ this ]) + }; }, - componentWillUnmount: function () { - PathStore.removeChangeListener(this.handlePathChange); + getRouteDepth: function () { + return this.context.routeHandlers.length - 1; }, - handlePathChange: function () { - this.dispatch(PathStore.getCurrentPath()); + componentDidMount: function () { + this._updateRouteComponent(); }, - /** - * Performs a depth-first search for the first route in the tree that matches - * on the given path. Returns an array of all routes in the tree leading to - * the one that matched in the format { route, params } where params is an - * object that contains the URL parameters relevant to that route. Returns - * null if no route in the tree matches the path. - * - * React.renderComponent( - * <Routes> - * <Route handler={App}> - * <Route name="posts" handler={Posts}/> - * <Route name="post" path="/posts/:id" handler={Post}/> - * </Route> - * </Routes> - * ).match('/posts/123'); => [ { route: <AppRoute>, params: {} }, - * { route: <PostRoute>, params: { id: '123' } } ] - */ - match: function (path) { - return findMatches(Path.withoutQuery(path), this.state.routes, this.props.defaultRoute, this.props.notFoundRoute); + componentDidUpdate: function () { + this._updateRouteComponent(); }, - /** - * Performs a transition to the given path and returns a promise for the - * Transition object that was used. - * - * In order to do this, the router first determines which routes are involved - * in the transition beginning with the current route, up the route tree to - * the first parent route that is shared with the destination route, and back - * down the tree to the destination route. The willTransitionFrom static - * method is invoked on all route handlers we're transitioning away from, in - * reverse nesting order. Likewise, the willTransitionTo static method - * is invoked on all route handlers we're transitioning to. - * - * Both willTransitionFrom and willTransitionTo hooks may either abort or - * redirect the transition. If they need to resolve asynchronously, they may - * return a promise. - * - * Any error that occurs asynchronously during the transition is re-thrown in - * the top-level scope unless returnRejectedPromise is true, in which case a - * rejected promise is returned so the caller may handle the error. - * - * Note: This function does not update the URL in a browser's location bar. - * If you want to keep the URL in sync with transitions, use Router.transitionTo, - * Router.replaceWith, or Router.goBack instead. - */ - dispatch: function (path, returnRejectedPromise) { - var transition = new Transition(path); - var routes = this; - - var promise = runTransitionHooks(routes, transition).then(function (nextState) { - if (transition.isAborted) { - routes.props.onAbortedTransition(transition); - } else if (nextState) { - routes.setState(nextState); - routes.props.onActiveStateChange(nextState); - - // TODO: add functional test - var rootMatch = getRootMatch(nextState.matches); - - if (rootMatch) - maybeUpdateScroll(routes, rootMatch.route); - } - - return transition; - }); - - if (!returnRejectedPromise) { - promise = promise.then(undefined, function (error) { - // Use setTimeout to break the promise chain. - setTimeout(function () { - routes.props.onTransitionError(error); - }); - }); - } - - return promise; + _updateRouteComponent: function () { + var depth = this.getRouteDepth(); + var components = this.context.getRouteComponents(); + components[depth] = this.refs[this.props.ref]; }, render: function () { - if (!this.state.path) - return null; - - var matches = this.state.matches; - if (matches.length) { - // matches[0] corresponds to the top-most match - return matches[0].route.props.handler(computeHandlerProps(matches, this.state.activeQuery)); - } else { - return null; - } - } - -}); - -function findMatches(path, routes, defaultRoute, notFoundRoute) { - var matches = null, route, params; - - for (var i = 0, len = routes.length; i < len; ++i) { - route = routes[i]; - - // Check the subtree first to find the most deeply-nested match. - matches = findMatches(path, route.props.children, route.props.defaultRoute, route.props.notFoundRoute); - - if (matches != null) { - var rootParams = getRootMatch(matches).params; - - params = route.props.paramNames.reduce(function (params, paramName) { - params[paramName] = rootParams[paramName]; - return params; - }, {}); - - matches.unshift(makeMatch(route, params)); - - return matches; - } - - // No routes in the subtree matched, so check this route. - params = Path.extractParams(route.props.path, path); - - if (params) - return [ makeMatch(route, params) ]; - } - - // No routes matched, so try the default route if there is one. - if (defaultRoute && (params = Path.extractParams(defaultRoute.props.path, path))) - return [ makeMatch(defaultRoute, params) ]; - - // Last attempt: does the "not found" route match? - if (notFoundRoute && (params = Path.extractParams(notFoundRoute.props.path, path))) - return [ makeMatch(notFoundRoute, params) ]; - - return matches; -} - -function makeMatch(route, params) { - return { route: route, params: params }; -} - -function hasMatch(matches, match) { - return matches.some(function (m) { - if (m.route !== match.route) - return false; - - for (var property in m.params) { - if (m.params[property] !== match.params[property]) - return false; - } - - return true; - }); -} - -function getRootMatch(matches) { - return matches[matches.length - 1]; -} - -function updateMatchComponents(matches, refs) { - var i = 0, component; - while (component = refs[REF_NAME]) { - matches[i++].component = component; - refs = component.refs; - } -} - -/** - * Runs all transition hooks that are required to get from the current state - * to the state specified by the given transition and updates the current state - * if they all pass successfully. Returns a promise that resolves to the new - * state if it needs to be updated, or undefined if not. - */ -function runTransitionHooks(routes, transition) { - if (routes.state.path === transition.path) - return Promise.resolve(); // Nothing to do! - - var currentMatches = routes.state.matches; - var nextMatches = routes.match(transition.path); - - warning( - nextMatches, - 'No route matches path "' + transition.path + '". Make sure you have ' + - '<Route path="' + transition.path + '"> somewhere in your routes' - ); - - if (!nextMatches) - nextMatches = []; - - var fromMatches, toMatches; - if (currentMatches) { - updateMatchComponents(currentMatches, routes.refs); - - fromMatches = currentMatches.filter(function (match) { - return !hasMatch(nextMatches, match); - }); - - toMatches = nextMatches.filter(function (match) { - return !hasMatch(currentMatches, match); - }); - } else { - fromMatches = []; - toMatches = nextMatches; - } - - var query = Path.extractQuery(transition.path) || {}; - - return runTransitionFromHooks(fromMatches, transition).then(function () { - if (transition.isAborted) - return; // No need to continue. - - return runTransitionToHooks(toMatches, transition, query).then(function () { - if (transition.isAborted) - return; // No need to continue. - - var rootMatch = getRootMatch(nextMatches); - var params = (rootMatch && rootMatch.params) || {}; - - return { - path: transition.path, - matches: nextMatches, - activeParams: params, - activeQuery: query, - activeRoutes: nextMatches.map(function (match) { - return match.route; - }) - }; - }); - }); -} - -/** - * Calls the willTransitionFrom hook of all handlers in the given matches - * serially in reverse with the transition object and the current instance of - * the route's handler, so that the deepest nested handlers are called first. - * Returns a promise that resolves after the last handler. - */ -function runTransitionFromHooks(matches, transition) { - var promise = Promise.resolve(); - - reversedArray(matches).forEach(function (match) { - promise = promise.then(function () { - var handler = match.route.props.handler; - - if (!transition.isAborted && handler.willTransitionFrom) - return handler.willTransitionFrom(transition, match.component); - }); - }); - - return promise; -} - -/** - * Calls the willTransitionTo hook of all handlers in the given matches serially - * with the transition object and any params that apply to that handler. Returns - * a promise that resolves after the last handler. - */ -function runTransitionToHooks(matches, transition, query) { - var promise = Promise.resolve(); - - matches.forEach(function (match) { - promise = promise.then(function () { - var handler = match.route.props.handler; - - if (!transition.isAborted && handler.willTransitionTo) - return handler.willTransitionTo(transition, match.params, query); - }); - }); - - return promise; -} - -/** - * Given an array of matches as returned by findMatches, return a descriptor for - * the handler hierarchy specified by the route. - */ -function computeHandlerProps(matches, query) { - var props = { - ref: null, - key: null, - params: null, - query: null, - activeRouteHandler: returnNull - }; - - var childHandler; - reversedArray(matches).forEach(function (match) { - var route = match.route; - - props = Route.getUnreservedProps(route.props); - - props.ref = REF_NAME; - props.params = match.params; - props.query = query; - - if (route.props.addHandlerKey) - props.key = Path.injectParams(route.props.path, match.params); - - if (childHandler) { - props.activeRouteHandler = childHandler; - } else { - props.activeRouteHandler = returnNull; - } - - childHandler = function (props, addedProps) { - if (arguments.length > 2 && typeof arguments[2] !== 'undefined') - throw new Error('Passing children to a route handler is not supported'); - - return route.props.handler(copyProperties(props, addedProps)); - }.bind(this, props); - }); - - return props; -} - -function returnNull() { - return null; -} - -function reversedArray(array) { - return array.slice(0).reverse(); -} - -module.exports = Routes; - -},{"../actions/LocationActions":1,"../components/Route":6,"../locations/DefaultLocation":10,"../locations/HashLocation":11,"../locations/HistoryLocation":12,"../locations/RefreshLocation":14,"../stores/ActiveStore":17,"../stores/PathStore":18,"../stores/RouteStore":19,"../utils/Path":20,"../utils/Redirect":21,"../utils/Transition":22,"react/lib/copyProperties":40,"react/lib/warning":48,"when/lib/Promise":49}],8:[function(_dereq_,module,exports){ -var copyProperties = _dereq_('react/lib/copyProperties'); -var Dispatcher = _dereq_('flux').Dispatcher; - -/** - * Dispatches actions that modify the URL. - */ -var LocationDispatcher = copyProperties(new Dispatcher, { - - handleViewAction: function (action) { - this.dispatch({ - source: 'VIEW_ACTION', - action: action - }); + var route = this.context.getRouteAtDepth(this.getRouteDepth()); + return route ? React.createElement(route.handler, this.props) : null; } }); -module.exports = LocationDispatcher; - -},{"flux":31,"react/lib/copyProperties":40}],9:[function(_dereq_,module,exports){ -exports.goBack = _dereq_('./actions/LocationActions').goBack; -exports.replaceWith = _dereq_('./actions/LocationActions').replaceWith; -exports.transitionTo = _dereq_('./actions/LocationActions').transitionTo; +module.exports = RouteHandler; +},{}],10:[function(_dereq_,module,exports){ exports.DefaultRoute = _dereq_('./components/DefaultRoute'); exports.Link = _dereq_('./components/Link'); exports.NotFoundRoute = _dereq_('./components/NotFoundRoute'); exports.Redirect = _dereq_('./components/Redirect'); exports.Route = _dereq_('./components/Route'); -exports.Routes = _dereq_('./components/Routes'); +exports.RouteHandler = _dereq_('./components/RouteHandler'); + +exports.HashLocation = _dereq_('./locations/HashLocation'); +exports.HistoryLocation = _dereq_('./locations/HistoryLocation'); +exports.RefreshLocation = _dereq_('./locations/RefreshLocation'); -exports.ActiveState = _dereq_('./mixins/ActiveState'); -exports.AsyncState = _dereq_('./mixins/AsyncState'); +exports.ImitateBrowserBehavior = _dereq_('./behaviors/ImitateBrowserBehavior'); +exports.ScrollToTopBehavior = _dereq_('./behaviors/ScrollToTopBehavior'); -exports.makeHref = _dereq_('./utils/makeHref'); +exports.Navigation = _dereq_('./mixins/Navigation'); +exports.State = _dereq_('./mixins/State'); -},{"./actions/LocationActions":1,"./components/DefaultRoute":2,"./components/Link":3,"./components/NotFoundRoute":4,"./components/Redirect":5,"./components/Route":6,"./components/Routes":7,"./mixins/ActiveState":15,"./mixins/AsyncState":16,"./utils/makeHref":25}],10:[function(_dereq_,module,exports){ -module.exports = "production" === 'test' - ? _dereq_('./MemoryLocation') - : _dereq_('./HashLocation'); +exports.create = _dereq_('./utils/createRouter'); +exports.run = _dereq_('./utils/runRouter'); -},{"./HashLocation":11,"./MemoryLocation":13}],11:[function(_dereq_,module,exports){ +},{"./behaviors/ImitateBrowserBehavior":2,"./behaviors/ScrollToTopBehavior":3,"./components/DefaultRoute":4,"./components/Link":5,"./components/NotFoundRoute":6,"./components/Redirect":7,"./components/Route":8,"./components/RouteHandler":9,"./locations/HashLocation":11,"./locations/HistoryLocation":12,"./locations/RefreshLocation":13,"./mixins/Navigation":15,"./mixins/State":18,"./utils/createRouter":26,"./utils/runRouter":30}],11:[function(_dereq_,module,exports){ var invariant = _dereq_('react/lib/invariant'); -var ExecutionEnvironment = _dereq_('react/lib/ExecutionEnvironment'); -var getWindowPath = _dereq_('../utils/getWindowPath'); +var canUseDOM = _dereq_('react/lib/ExecutionEnvironment').canUseDOM; +var LocationActions = _dereq_('../actions/LocationActions'); +var Path = _dereq_('../utils/Path'); +/** + * Returns the current URL path from `window.location.hash`, including query string + */ function getHashPath() { - return window.location.hash.substr(1); + invariant( + canUseDOM, + 'getHashPath needs a DOM' + ); + + return Path.decode( + window.location.hash.substr(1) + ); } +var _actionType; + function ensureSlash() { var path = getHashPath(); @@ -37148,11 +36208,30 @@ function ensureSlash() { return false; } -var _onChange; +var _changeListeners = []; -function handleHashChange() { - if (ensureSlash()) - _onChange(); +function notifyChange(type) { + var change = { + path: getHashPath(), + type: type + }; + + _changeListeners.forEach(function (listener) { + listener(change); + }); +} + +var _isListening = false; + +function onHashChange() { + if (ensureSlash()) { + // If we don't have an _actionType then all we know is the hash + // changed. It was probably caused by the user clicking the Back + // button, but may have also been the Forward button or manual + // manipulation. So just guess 'pop'. + notifyChange(_actionType || LocationActions.POP); + _actionType = null; + } } /** @@ -37160,40 +36239,36 @@ function handleHashChange() { */ var HashLocation = { - setup: function (onChange) { - invariant( - ExecutionEnvironment.canUseDOM, - 'You cannot use HashLocation in an environment with no DOM' - ); - - _onChange = onChange; + addChangeListener: function (listener) { + _changeListeners.push(listener); + // Do this BEFORE listening for hashchange. ensureSlash(); + if (_isListening) + return; + if (window.addEventListener) { - window.addEventListener('hashchange', handleHashChange, false); + window.addEventListener('hashchange', onHashChange, false); } else { - window.attachEvent('onhashchange', handleHashChange); + window.attachEvent('onhashchange', onHashChange); } - }, - teardown: function () { - if (window.removeEventListener) { - window.removeEventListener('hashchange', handleHashChange, false); - } else { - window.detachEvent('onhashchange', handleHashChange); - } + _isListening = true; }, push: function (path) { - window.location.hash = path; + _actionType = LocationActions.PUSH; + window.location.hash = Path.encode(path); }, replace: function (path) { - window.location.replace(getWindowPath() + '#' + path); + _actionType = LocationActions.REPLACE; + window.location.replace(window.location.pathname + '#' + Path.encode(path)); }, pop: function () { + _actionType = LocationActions.POP; window.history.back(); }, @@ -37207,49 +36282,73 @@ var HashLocation = { module.exports = HashLocation; -},{"../utils/getWindowPath":23,"react/lib/ExecutionEnvironment":39,"react/lib/invariant":42}],12:[function(_dereq_,module,exports){ +},{"../actions/LocationActions":1,"../utils/Path":21,"react/lib/ExecutionEnvironment":37,"react/lib/invariant":41}],12:[function(_dereq_,module,exports){ var invariant = _dereq_('react/lib/invariant'); -var ExecutionEnvironment = _dereq_('react/lib/ExecutionEnvironment'); -var getWindowPath = _dereq_('../utils/getWindowPath'); +var canUseDOM = _dereq_('react/lib/ExecutionEnvironment').canUseDOM; +var LocationActions = _dereq_('../actions/LocationActions'); +var Path = _dereq_('../utils/Path'); + +/** + * Returns the current URL path from `window.location`, including query string + */ +function getWindowPath() { + invariant( + canUseDOM, + 'getWindowPath needs a DOM' + ); + + return Path.decode( + window.location.pathname + window.location.search + ); +} + +var _changeListeners = []; -var _onChange; +function notifyChange(type) { + var change = { + path: getWindowPath(), + type: type + }; + + _changeListeners.forEach(function (listener) { + listener(change); + }); +} + +var _isListening = false; + +function onPopState() { + notifyChange(LocationActions.POP); +} /** * A Location that uses HTML5 history. */ var HistoryLocation = { - setup: function (onChange) { - invariant( - ExecutionEnvironment.canUseDOM, - 'You cannot use HistoryLocation in an environment with no DOM' - ); + addChangeListener: function (listener) { + _changeListeners.push(listener); - _onChange = onChange; + if (_isListening) + return; if (window.addEventListener) { - window.addEventListener('popstate', _onChange, false); + window.addEventListener('popstate', onPopState, false); } else { - window.attachEvent('popstate', _onChange); + window.attachEvent('popstate', onPopState); } - }, - teardown: function () { - if (window.removeEventListener) { - window.removeEventListener('popstate', _onChange, false); - } else { - window.detachEvent('popstate', _onChange); - } + _isListening = true; }, push: function (path) { - window.history.pushState({ path: path }, '', path); - _onChange(); + window.history.pushState({ path: path }, '', Path.encode(path)); + notifyChange(LocationActions.PUSH); }, replace: function (path) { - window.history.replaceState({ path: path }, '', path); - _onChange(); + window.history.replaceState({ path: path }, '', Path.encode(path)); + notifyChange(LocationActions.REPLACE); }, pop: function () { @@ -37266,670 +36365,444 @@ var HistoryLocation = { module.exports = HistoryLocation; -},{"../utils/getWindowPath":23,"react/lib/ExecutionEnvironment":39,"react/lib/invariant":42}],13:[function(_dereq_,module,exports){ -var warning = _dereq_('react/lib/warning'); - -var _lastPath = null; -var _currentPath = null; -var _onChange; +},{"../actions/LocationActions":1,"../utils/Path":21,"react/lib/ExecutionEnvironment":37,"react/lib/invariant":41}],13:[function(_dereq_,module,exports){ +var HistoryLocation = _dereq_('./HistoryLocation'); +var Path = _dereq_('../utils/Path'); /** - * A Location that does not require a DOM. + * A Location that uses full page refreshes. This is used as + * the fallback for HistoryLocation in browsers that do not + * support the HTML5 history API. */ -var MemoryLocation = { - - setup: function (onChange) { - _onChange = onChange; - }, +var RefreshLocation = { push: function (path) { - _lastPath = _currentPath; - _currentPath = path; - _onChange(); + window.location = Path.encode(path); }, replace: function (path) { - _currentPath = path; - _onChange(); + window.location.replace(Path.encode(path)); }, pop: function () { - warning( - _lastPath != null, - 'You cannot use MemoryLocation to go back more than once' - ); - - _currentPath = _lastPath; - _lastPath = null; - _onChange(); + window.history.back(); }, - getCurrentPath: function () { - return _currentPath || '/'; - }, + getCurrentPath: HistoryLocation.getCurrentPath, toString: function () { - return '<MemoryLocation>'; + return '<RefreshLocation>'; } }; -module.exports = MemoryLocation; +module.exports = RefreshLocation; -},{"react/lib/warning":48}],14:[function(_dereq_,module,exports){ +},{"../utils/Path":21,"./HistoryLocation":12}],14:[function(_dereq_,module,exports){ var invariant = _dereq_('react/lib/invariant'); -var ExecutionEnvironment = _dereq_('react/lib/ExecutionEnvironment'); -var getWindowPath = _dereq_('../utils/getWindowPath'); -/** - * A Location that uses full page refreshes. This is used as - * the fallback for HistoryLocation in browsers that do not - * support the HTML5 history API. - */ -var RefreshLocation = { +var FakeNode = { - setup: function () { + render: function () { invariant( - ExecutionEnvironment.canUseDOM, - 'You cannot use RefreshLocation in an environment with no DOM' + false, + '%s elements should not be rendered', + this.constructor.displayName ); - }, - - push: function (path) { - window.location = path; - }, - - replace: function (path) { - window.location.replace(path); - }, - - pop: function () { - window.history.back(); - }, - - getCurrentPath: getWindowPath, - - toString: function () { - return '<RefreshLocation>'; } }; -module.exports = RefreshLocation; +module.exports = FakeNode; -},{"../utils/getWindowPath":23,"react/lib/ExecutionEnvironment":39,"react/lib/invariant":42}],15:[function(_dereq_,module,exports){ -var ActiveStore = _dereq_('../stores/ActiveStore'); +},{"react/lib/invariant":41}],15:[function(_dereq_,module,exports){ +var React = (typeof window !== "undefined" ? window.React : typeof global !== "undefined" ? global.React : null); /** - * A mixin for components that need to know about the routes, params, - * and query that are currently active. Components that use it get two - * things: - * - * 1. An `isActive` static method they can use to check if a route, - * params, and query are active. - * 2. An `updateActiveState` instance method that is called when the - * active state changes. + * A mixin for components that modify the URL. * * Example: * - * var Tab = React.createClass({ - * - * mixins: [ Router.ActiveState ], - * - * getInitialState: function () { - * return { - * isActive: false - * }; + * var MyLink = React.createClass({ + * mixins: [ Router.Navigation ], + * handleClick: function (event) { + * event.preventDefault(); + * this.transitionTo('aRoute', { the: 'params' }, { the: 'query' }); * }, - * - * updateActiveState: function () { - * this.setState({ - * isActive: Tab.isActive(routeName, params, query) - * }) + * render: function () { + * return ( + * <a onClick={this.handleClick}>Click me!</a> + * ); * } - * * }); */ -var ActiveState = { - - statics: { +var Navigation = { - /** - * Returns true if the route with the given name, URL parameters, and query - * are all currently active. - */ - isActive: ActiveStore.isActive + contextTypes: { + makePath: React.PropTypes.func.isRequired, + makeHref: React.PropTypes.func.isRequired, + transitionTo: React.PropTypes.func.isRequired, + replaceWith: React.PropTypes.func.isRequired, + goBack: React.PropTypes.func.isRequired + }, + /** + * Returns an absolute URL path created from the given route + * name, URL parameters, and query values. + */ + makePath: function (to, params, query) { + return this.context.makePath(to, params, query); }, - componentWillMount: function () { - ActiveStore.addChangeListener(this.handleActiveStateChange); + /** + * Returns a string that may safely be used as the href of a + * link to the route with the given name. + */ + makeHref: function (to, params, query) { + return this.context.makeHref(to, params, query); }, - componentDidMount: function () { - if (this.updateActiveState) - this.updateActiveState(); + /** + * Transitions to the URL specified in the arguments by pushing + * a new URL onto the history stack. + */ + transitionTo: function (to, params, query) { + this.context.transitionTo(to, params, query); }, - componentWillUnmount: function () { - ActiveStore.removeChangeListener(this.handleActiveStateChange); + /** + * Transitions to the URL specified in the arguments by replacing + * the current URL in the history stack. + */ + replaceWith: function (to, params, query) { + this.context.replaceWith(to, params, query); }, - handleActiveStateChange: function () { - if (this.isMounted() && typeof this.updateActiveState === 'function') - this.updateActiveState(); + /** + * Transitions to the previous URL. + */ + goBack: function () { + this.context.goBack(); } }; -module.exports = ActiveState; +module.exports = Navigation; -},{"../stores/ActiveStore":17}],16:[function(_dereq_,module,exports){ +},{}],16:[function(_dereq_,module,exports){ var React = (typeof window !== "undefined" ? window.React : typeof global !== "undefined" ? global.React : null); -var resolveAsyncState = _dereq_('../utils/resolveAsyncState'); /** - * A mixin for route handler component classes that fetch at least - * part of their state asynchronously. Classes that use it should - * declare a static `getInitialAsyncState` method that fetches state - * for a component after it mounts. This function is given three - * arguments: 1) the current route params, 2) the current query and - * 3) a function that can be used to set state as it is received. - * - * Much like the familiar `getInitialState` method, `getInitialAsyncState` - * should return a hash of key/value pairs to use in the component's - * state. The difference is that the values may be promises. As these - * values resolve, the component's state is updated. You should only - * ever need to use the setState function for doing things like - * streaming data and/or updating progress. - * - * Example: - * - * var User = React.createClass({ - * - * statics: { - * - * getInitialAsyncState: function (params, query, setState) { - * // Return a hash with keys named after the state variables - * // you want to set, as you normally do in getInitialState, - * // except the values may be immediate values or promises. - * // The state is automatically updated as promises resolve. - * return { - * user: getUserByID(params.userID) // may be a promise - * }; - * - * // Or, use the setState function to stream data! - * var buffer = ''; - * - * return { - * - * // Same as above, the stream state variable is set to the - * // value returned by this promise when it resolves. - * stream: getStreamingData(params.userID, function (chunk) { - * buffer += chunk; - * - * // Notify of progress. - * setState({ - * streamBuffer: buffer - * }); - * }) - * - * }; - * } - * - * }, - * - * getInitialState: function () { - * return { - * user: null, // Receives a value when getUserByID resolves. - * stream: null, // Receives a value when getStreamingData resolves. - * streamBuffer: '' // Used to track data as it loads. - * }; - * }, - * - * render: function () { - * if (!this.state.user) - * return <LoadingUser/>; - * - * return ( - * <div> - * <p>Welcome {this.state.user.name}!</p> - * <p>So far, you've received {this.state.streamBuffer.length} data!</p> - * </div> - * ); - * } - * - * }); - * - * When testing, use the `initialAsyncState` prop to simulate asynchronous - * data fetching. When this prop is present, no attempt is made to retrieve - * additional state via `getInitialAsyncState`. + * Provides the router with context for Router.Navigation. */ -var AsyncState = { - - propTypes: { - initialAsyncState: React.PropTypes.object - }, +var NavigationContext = { - getInitialState: function () { - return this.props.initialAsyncState || null; + childContextTypes: { + makePath: React.PropTypes.func.isRequired, + makeHref: React.PropTypes.func.isRequired, + transitionTo: React.PropTypes.func.isRequired, + replaceWith: React.PropTypes.func.isRequired, + goBack: React.PropTypes.func.isRequired }, - updateAsyncState: function (state) { - if (this.isMounted()) - this.setState(state); - }, - - componentDidMount: function () { - if (this.props.initialAsyncState || typeof this.constructor.getInitialAsyncState !== 'function') - return; - - resolveAsyncState( - this.constructor.getInitialAsyncState(this.props.params, this.props.query, this.updateAsyncState), - this.updateAsyncState - ); + getChildContext: function () { + return { + makePath: this.constructor.makePath, + makeHref: this.constructor.makeHref, + transitionTo: this.constructor.transitionTo, + replaceWith: this.constructor.replaceWith, + goBack: this.constructor.goBack + }; } }; -module.exports = AsyncState; +module.exports = NavigationContext; -},{"../utils/resolveAsyncState":27}],17:[function(_dereq_,module,exports){ -var EventEmitter = _dereq_('events').EventEmitter; +},{}],17:[function(_dereq_,module,exports){ +var invariant = _dereq_('react/lib/invariant'); +var canUseDOM = _dereq_('react/lib/ExecutionEnvironment').canUseDOM; +var getWindowScrollPosition = _dereq_('../utils/getWindowScrollPosition'); -var CHANGE_EVENT = 'change'; -var _events = new EventEmitter; +function shouldUpdateScroll(state, prevState) { + if (!prevState) + return true; -_events.setMaxListeners(0); + // Don't update scroll position when only the query has changed. + if (state.pathname === prevState.pathname) + return false; -function notifyChange() { - _events.emit(CHANGE_EVENT); -} + var routes = state.routes; + var prevRoutes = prevState.routes; -var _activeRoutes = []; -var _activeParams = {}; -var _activeQuery = {}; + var sharedAncestorRoutes = routes.filter(function (route) { + return prevRoutes.indexOf(route) !== -1; + }); -function routeIsActive(routeName) { - return _activeRoutes.some(function (route) { - return route.props.name === routeName; + return !sharedAncestorRoutes.some(function (route) { + return route.ignoreScrollBehavior; }); } -function paramsAreActive(params) { - for (var property in params) { - if (_activeParams[property] !== String(params[property])) - return false; - } - - return true; -} +/** + * Provides the router with the ability to manage window scroll position + * according to its scroll behavior. + */ +var Scrolling = { -function queryIsActive(query) { - for (var property in query) { - if (_activeQuery[property] !== String(query[property])) - return false; - } + statics: { + /** + * Records curent scroll position as the last known position for the given URL path. + */ + recordScrollPosition: function (path) { + if (!this.scrollHistory) + this.scrollHistory = {}; - return true; -} + this.scrollHistory[path] = getWindowScrollPosition(); + }, -/** - * The ActiveStore keeps track of which routes, URL and query parameters are - * currently active on a page. <Link>s subscribe to the ActiveStore to know - * whether or not they are active. - */ -var ActiveStore = { + /** + * Returns the last known scroll position for the given URL path. + */ + getScrollPosition: function (path) { + if (!this.scrollHistory) + this.scrollHistory = {}; - addChangeListener: function (listener) { - _events.on(CHANGE_EVENT, listener); + return this.scrollHistory[path] || null; + } }, - removeChangeListener: function (listener) { - _events.removeListener(CHANGE_EVENT, listener); + componentWillMount: function () { + invariant( + this.getScrollBehavior() == null || canUseDOM, + 'Cannot use scroll behavior without a DOM' + ); }, - /** - * Updates the currently active state and notifies all listeners. - * This is automatically called by routes as they become active. - */ - updateState: function (state) { - state = state || {}; - - _activeRoutes = state.activeRoutes || []; - _activeParams = state.activeParams || {}; - _activeQuery = state.activeQuery || {}; + componentDidMount: function () { + this._updateScroll(); + }, - notifyChange(); + componentDidUpdate: function (prevProps, prevState) { + this._updateScroll(prevState); }, - /** - * Returns true if the route with the given name, URL parameters, and query - * are all currently active. - */ - isActive: function (routeName, params, query) { - var isActive = routeIsActive(routeName) && paramsAreActive(params); + _updateScroll: function (prevState) { + if (!shouldUpdateScroll(this.state, prevState)) + return; - if (query) - return isActive && queryIsActive(query); + var scrollBehavior = this.getScrollBehavior(); - return isActive; + if (scrollBehavior) + scrollBehavior.updateScrollPosition( + this.constructor.getScrollPosition(this.state.path), + this.state.action + ); } }; -module.exports = ActiveStore; - -},{"events":30}],18:[function(_dereq_,module,exports){ -var warning = _dereq_('react/lib/warning'); -var EventEmitter = _dereq_('events').EventEmitter; -var LocationActions = _dereq_('../actions/LocationActions'); -var LocationDispatcher = _dereq_('../dispatchers/LocationDispatcher'); -var supportsHistory = _dereq_('../utils/supportsHistory'); -var HistoryLocation = _dereq_('../locations/HistoryLocation'); -var RefreshLocation = _dereq_('../locations/RefreshLocation'); - -var CHANGE_EVENT = 'change'; -var _events = new EventEmitter; - -function notifyChange() { - _events.emit(CHANGE_EVENT); -} - -var _scrollPositions = {}; +module.exports = Scrolling; -function recordScrollPosition(path) { - _scrollPositions[path] = { - x: window.scrollX, - y: window.scrollY - }; -} - -function updateScrollPosition(path) { - var p = PathStore.getScrollPosition(path); - window.scrollTo(p.x, p.y); -} - -var _location; +},{"../utils/getWindowScrollPosition":28,"react/lib/ExecutionEnvironment":37,"react/lib/invariant":41}],18:[function(_dereq_,module,exports){ +var React = (typeof window !== "undefined" ? window.React : typeof global !== "undefined" ? global.React : null); /** - * The PathStore keeps track of the current URL path and manages - * the location strategy that is used to update the URL. + * A mixin for components that need to know the path, routes, URL + * params and query that are currently active. + * + * Example: + * + * var AboutLink = React.createClass({ + * mixins: [ Router.State ], + * render: function () { + * var className = this.props.className; + * + * if (this.isActive('about')) + * className += ' is-active'; + * + * return React.DOM.a({ className: className }, this.props.children); + * } + * }); */ -var PathStore = { +var State = { - addChangeListener: function (listener) { - _events.on(CHANGE_EVENT, listener); + contextTypes: { + getCurrentPath: React.PropTypes.func.isRequired, + getCurrentRoutes: React.PropTypes.func.isRequired, + getCurrentPathname: React.PropTypes.func.isRequired, + getCurrentParams: React.PropTypes.func.isRequired, + getCurrentQuery: React.PropTypes.func.isRequired, + isActive: React.PropTypes.func.isRequired }, - removeChangeListener: function (listener) { - _events.removeListener(CHANGE_EVENT, listener); - - // Automatically teardown when the last listener is removed. - if (EventEmitter.listenerCount(_events, CHANGE_EVENT) === 0) - PathStore.teardown(); - }, - - setup: function (location) { - // When using HistoryLocation, automatically fallback - // to RefreshLocation in browsers that do not support - // the HTML5 history API. - if (location === HistoryLocation && !supportsHistory()) - location = RefreshLocation; - - if (_location == null) { - _location = location; - - if (_location && typeof _location.setup === 'function') - _location.setup(notifyChange); - } else { - warning( - _location === location, - 'Cannot use location %s, already using %s', location, _location - ); - } + /** + * Returns the current URL path. + */ + getPath: function () { + return this.context.getCurrentPath(); }, - teardown: function () { - _events.removeAllListeners(CHANGE_EVENT); - - if (_location && typeof _location.teardown === 'function') - _location.teardown(); - - _location = null; + /** + * Returns an array of the routes that are currently active. + */ + getRoutes: function () { + return this.context.getCurrentRoutes(); }, /** - * Returns the location object currently in use. + * Returns the current URL path without the query string. */ - getLocation: function () { - return _location; + getPathname: function () { + return this.context.getCurrentPathname(); }, /** - * Returns the current URL path. + * Returns an object of the URL params that are currently active. */ - getCurrentPath: function () { - return _location.getCurrentPath(); + getParams: function () { + return this.context.getCurrentParams(); }, /** - * Returns the last known scroll position for the given path. + * Returns an object of the query params that are currently active. */ - getScrollPosition: function (path) { - return _scrollPositions[path] || { x: 0, y: 0 }; + getQuery: function () { + return this.context.getCurrentQuery(); }, - dispatchToken: LocationDispatcher.register(function (payload) { - var action = payload.action; - var currentPath = _location.getCurrentPath(); + /** + * A helper method to determine if a given route, params, and query + * are active. + */ + isActive: function (to, params, query) { + return this.context.isActive(to, params, query); + } - switch (action.type) { - case LocationActions.PUSH: - if (currentPath !== action.path) { - recordScrollPosition(currentPath); - _location.push(action.path); - } - break; +}; - case LocationActions.REPLACE: - if (currentPath !== action.path) { - recordScrollPosition(currentPath); - _location.replace(action.path); - } - break; +module.exports = State; - case LocationActions.POP: - recordScrollPosition(currentPath); - _location.pop(); - break; +},{}],19:[function(_dereq_,module,exports){ +var React = (typeof window !== "undefined" ? window.React : typeof global !== "undefined" ? global.React : null); +var assign = _dereq_('react/lib/Object.assign'); +var Path = _dereq_('../utils/Path'); - case LocationActions.UPDATE_SCROLL: - updateScrollPosition(currentPath); - break; - } - }) +function routeIsActive(activeRoutes, routeName) { + return activeRoutes.some(function (route) { + return route.name === routeName; + }); +} -}; +function paramsAreActive(activeParams, params) { + for (var property in params) + if (String(activeParams[property]) !== String(params[property])) + return false; -module.exports = PathStore; + return true; +} -},{"../actions/LocationActions":1,"../dispatchers/LocationDispatcher":8,"../locations/HistoryLocation":12,"../locations/RefreshLocation":14,"../utils/supportsHistory":28,"events":30,"react/lib/warning":48}],19:[function(_dereq_,module,exports){ -var React = (typeof window !== "undefined" ? window.React : typeof global !== "undefined" ? global.React : null); -var invariant = _dereq_('react/lib/invariant'); -var warning = _dereq_('react/lib/warning'); -var Path = _dereq_('../utils/Path'); +function queryIsActive(activeQuery, query) { + for (var property in query) + if (String(activeQuery[property]) !== String(query[property])) + return false; -var _namedRoutes = {}; + return true; +} /** - * The RouteStore contains a directory of all <Route>s in the system. It is - * used primarily for looking up routes by name so that <Link>s can use a - * route name in the "to" prop and users can use route names in `Router.transitionTo` - * and other high-level utility methods. + * Provides the router with context for Router.State. */ -var RouteStore = { +var StateContext = { /** - * Removes all references to <Route>s from the store. Should only ever - * really be used in tests to clear the store between test runs. + * Returns the current URL path + query string. */ - unregisterAllRoutes: function () { - _namedRoutes = {}; + getCurrentPath: function () { + return this.state.path; }, /** - * Removes the reference to the given <Route> and all of its children - * from the store. + * Returns a read-only array of the currently active routes. */ - unregisterRoute: function (route) { - var props = route.props; - - if (props.name) - delete _namedRoutes[props.name]; - - React.Children.forEach(props.children, RouteStore.unregisterRoute); + getCurrentRoutes: function () { + return this.state.routes.slice(0); }, /** - * Registers a <Route> and all of its children with the store. Also, - * does some normalization and validation on route props. + * Returns the current URL path without the query string. */ - registerRoute: function (route, parentRoute) { - // Note: parentRoute may be a <Route> _or_ a <Routes>. - var props = route.props; - - invariant( - React.isValidClass(props.handler), - 'The handler for the "%s" route must be a valid React class', - props.name || props.path - ); - - var parentPath = (parentRoute && parentRoute.props.path) || '/'; - - if ((props.path || props.name) && !props.isDefault && !props.catchAll) { - var path = props.path || props.name; - - // Relative paths extend their parent. - if (!Path.isAbsolute(path)) - path = Path.join(parentPath, path); - - props.path = Path.normalize(path); - } else { - props.path = parentPath; - - if (props.catchAll) - props.path += '*'; - } - - props.paramNames = Path.extractParamNames(props.path); - - // Make sure the route's path has all params its parent needs. - if (parentRoute && Array.isArray(parentRoute.props.paramNames)) { - parentRoute.props.paramNames.forEach(function (paramName) { - invariant( - props.paramNames.indexOf(paramName) !== -1, - 'The nested route path "%s" is missing the "%s" parameter of its parent path "%s"', - props.path, paramName, parentRoute.props.path - ); - }); - } - - // Make sure the route can be looked up by <Link>s. - if (props.name) { - var existingRoute = _namedRoutes[props.name]; - - invariant( - !existingRoute || route === existingRoute, - 'You cannot use the name "%s" for more than one route', - props.name - ); - - _namedRoutes[props.name] = route; - } - - if (props.catchAll) { - invariant( - parentRoute, - '<NotFoundRoute> must have a parent <Route>' - ); - - invariant( - parentRoute.props.notFoundRoute == null, - 'You may not have more than one <NotFoundRoute> per <Route>' - ); - - parentRoute.props.notFoundRoute = route; - - return null; - } - - if (props.isDefault) { - invariant( - parentRoute, - '<DefaultRoute> must have a parent <Route>' - ); - - invariant( - parentRoute.props.defaultRoute == null, - 'You may not have more than one <DefaultRoute> per <Route>' - ); - - parentRoute.props.defaultRoute = route; - - return null; - } + getCurrentPathname: function () { + return this.state.pathname; + }, - // Make sure children is an array. - props.children = RouteStore.registerChildren(props.children, route); + /** + * Returns a read-only object of the currently active URL parameters. + */ + getCurrentParams: function () { + return assign({}, this.state.params); + }, - return route; + /** + * Returns a read-only object of the currently active query parameters. + */ + getCurrentQuery: function () { + return assign({}, this.state.query); }, /** - * Registers many children routes at once, always returning an array. + * Returns true if the given route, params, and query are active. */ - registerChildren: function (children, parentRoute) { - var routes = []; + isActive: function (to, params, query) { + if (Path.isAbsolute(to)) + return to === this.state.path; - React.Children.forEach(children, function (child) { - // Exclude <DefaultRoute>s. - if (child = RouteStore.registerRoute(child, parentRoute)) - routes.push(child); - }); + return routeIsActive(this.state.routes, to) && + paramsAreActive(this.state.params, params) && + (query == null || queryIsActive(this.state.query, query)); + }, - return routes; + childContextTypes: { + getCurrentPath: React.PropTypes.func.isRequired, + getCurrentRoutes: React.PropTypes.func.isRequired, + getCurrentPathname: React.PropTypes.func.isRequired, + getCurrentParams: React.PropTypes.func.isRequired, + getCurrentQuery: React.PropTypes.func.isRequired, + isActive: React.PropTypes.func.isRequired }, - /** - * Returns the Route object with the given name, if one exists. - */ - getRouteByName: function (routeName) { - return _namedRoutes[routeName] || null; + getChildContext: function () { + return { + getCurrentPath: this.getCurrentPath, + getCurrentRoutes: this.getCurrentRoutes, + getCurrentPathname: this.getCurrentPathname, + getCurrentParams: this.getCurrentParams, + getCurrentQuery: this.getCurrentQuery, + isActive: this.isActive + }; } }; -module.exports = RouteStore; +module.exports = StateContext; -},{"../utils/Path":20,"react/lib/invariant":42,"react/lib/warning":48}],20:[function(_dereq_,module,exports){ +},{"../utils/Path":21,"react/lib/Object.assign":38}],20:[function(_dereq_,module,exports){ +/** + * Represents a cancellation caused by navigating away + * before the previous transition has fully resolved. + */ +function Cancellation() { } + +module.exports = Cancellation; + +},{}],21:[function(_dereq_,module,exports){ var invariant = _dereq_('react/lib/invariant'); var merge = _dereq_('qs/lib/utils').merge; var qs = _dereq_('qs'); -function encodeURL(url) { - return encodeURIComponent(url).replace(/%20/g, '+'); -} - -function decodeURL(url) { - return decodeURIComponent(url.replace(/\+/g, ' ')); -} - -function encodeURLPath(path) { - return String(path).split('/').map(encodeURL).join('/'); -} - -var paramMatcher = /:([a-zA-Z_$][a-zA-Z0-9_$]*)|[*.()\[\]\\+|{}^$]/g; +var paramCompileMatcher = /:([a-zA-Z_$][a-zA-Z0-9_$]*)|[*.()\[\]\\+|{}^$]/g; +var paramInjectMatcher = /:([a-zA-Z_$][a-zA-Z0-9_$?]*[?]?)|[*]/g; +var paramInjectTrailingSlashMatcher = /\/\/\?|\/\?/g; var queryMatcher = /\?(.+)/; var _compiledPatterns = {}; @@ -37937,10 +36810,10 @@ var _compiledPatterns = {}; function compilePattern(pattern) { if (!(pattern in _compiledPatterns)) { var paramNames = []; - var source = pattern.replace(paramMatcher, function (match, paramName) { + var source = pattern.replace(paramCompileMatcher, function (match, paramName) { if (paramName) { paramNames.push(paramName); - return '([^./?#]+)'; + return '([^/?#]+)'; } else if (match === '*') { paramNames.push('splat'); return '(.*?)'; @@ -37961,6 +36834,20 @@ function compilePattern(pattern) { var Path = { /** + * Safely decodes special characters in the given URL path. + */ + decode: function (path) { + return decodeURI(path.replace(/\+/g, ' ')); + }, + + /** + * Safely encodes special characters in the given URL path. + */ + encode: function (path) { + return encodeURI(path).replace(/%20/g, '+'); + }, + + /** * Returns an array of the names of all parameters in the given pattern. */ extractParamNames: function (pattern) { @@ -37974,7 +36861,7 @@ var Path = { */ extractParams: function (pattern, path) { var object = compilePattern(pattern); - var match = decodeURL(path).match(object.matcher); + var match = path.match(object.matcher); if (!match) return null; @@ -37997,13 +36884,21 @@ var Path = { var splatIndex = 0; - return pattern.replace(paramMatcher, function (match, paramName) { + return pattern.replace(paramInjectMatcher, function (match, paramName) { paramName = paramName || 'splat'; - invariant( - params[paramName] != null, - 'Missing "' + paramName + '" parameter for path "' + pattern + '"' - ); + // If param is optional don't check for existence + if (paramName.slice(-1) !== '?') { + invariant( + params[paramName] != null, + 'Missing "' + paramName + '" parameter for path "' + pattern + '"' + ); + } else { + paramName = paramName.slice(0, -1); + + if (params[paramName] == null) + return ''; + } var segment; if (paramName === 'splat' && Array.isArray(params[paramName])) { @@ -38017,8 +36912,8 @@ var Path = { segment = params[paramName]; } - return encodeURLPath(segment); - }); + return segment; + }).replace(paramInjectTrailingSlashMatcher, '/'); }, /** @@ -38026,7 +36921,7 @@ var Path = { * in the given path, null if the path contains no query string. */ extractQuery: function (path) { - var match = decodeURL(path).match(queryMatcher); + var match = path.match(queryMatcher); return match && qs.parse(match[1]); }, @@ -38080,7 +36975,30 @@ var Path = { module.exports = Path; -},{"qs":34,"qs/lib/utils":38,"react/lib/invariant":42}],21:[function(_dereq_,module,exports){ +},{"qs":32,"qs/lib/utils":36,"react/lib/invariant":41}],22:[function(_dereq_,module,exports){ +var Promise = _dereq_('when/lib/Promise'); + +// TODO: Use process.env.NODE_ENV check + envify to enable +// when's promise monitor here when in dev. + +module.exports = Promise; + +},{"when/lib/Promise":43}],23:[function(_dereq_,module,exports){ +var PropTypes = { + + /** + * Requires that the value of a prop be falsy. + */ + falsy: function (props, propName, elementName) { + if (props[propName]) + return new Error('<' + elementName + '> may not have a "' + propName + '" prop'); + } + +}; + +module.exports = PropTypes; + +},{}],24:[function(_dereq_,module,exports){ /** * Encapsulates a redirect to the given route. */ @@ -38092,10 +37010,89 @@ function Redirect(to, params, query) { module.exports = Redirect; -},{}],22:[function(_dereq_,module,exports){ -var mixInto = _dereq_('react/lib/mixInto'); -var transitionTo = _dereq_('../actions/LocationActions').transitionTo; +},{}],25:[function(_dereq_,module,exports){ +var assign = _dereq_('react/lib/Object.assign'); +var reversedArray = _dereq_('./reversedArray'); var Redirect = _dereq_('./Redirect'); +var Promise = _dereq_('./Promise'); + +/** + * Runs all hook functions serially and calls callback(error) when finished. + * A hook may return a promise if it needs to execute asynchronously. + */ +function runHooks(hooks, callback) { + try { + var promise = hooks.reduce(function (promise, hook) { + // The first hook to use transition.wait makes the rest + // of the transition async from that point forward. + return promise ? promise.then(hook) : hook(); + }, null); + } catch (error) { + return callback(error); // Sync error. + } + + if (promise) { + // Use setTimeout to break the promise chain. + promise.then(function () { + setTimeout(callback); + }, function (error) { + setTimeout(function () { + callback(error); + }); + }); + } else { + callback(); + } +} + +/** + * Calls the willTransitionFrom hook of all handlers in the given matches + * serially in reverse with the transition object and the current instance of + * the route's handler, so that the deepest nested handlers are called first. + * Calls callback(error) when finished. + */ +function runTransitionFromHooks(transition, routes, components, callback) { + components = reversedArray(components); + + var hooks = reversedArray(routes).map(function (route, index) { + return function () { + var handler = route.handler; + + if (!transition.isAborted && handler.willTransitionFrom) + return handler.willTransitionFrom(transition, components[index]); + + var promise = transition._promise; + transition._promise = null; + + return promise; + }; + }); + + runHooks(hooks, callback); +} + +/** + * Calls the willTransitionTo hook of all handlers in the given matches + * serially with the transition object and any params that apply to that + * handler. Calls callback(error) when finished. + */ +function runTransitionToHooks(transition, routes, params, query, callback) { + var hooks = routes.map(function (route) { + return function () { + var handler = route.handler; + + if (!transition.isAborted && handler.willTransitionTo) + handler.willTransitionTo(transition, params, query); + + var promise = transition._promise; + transition._promise = null; + + return promise; + }; + }); + + runHooks(hooks, callback); +} /** * Encapsulates a transition to a given path. @@ -38103,15 +37100,22 @@ var Redirect = _dereq_('./Redirect'); * The willTransitionTo and willTransitionFrom handlers receive * an instance of this class as their first argument. */ -function Transition(path) { +function Transition(path, retry) { this.path = path; this.abortReason = null; this.isAborted = false; + this.retry = retry.bind(this); + this._promise = null; } -mixInto(Transition, { +assign(Transition.prototype, { abort: function (reason) { + if (this.isAborted) { + // First abort wins. + return; + } + this.abortReason = reason; this.isAborted = true; }, @@ -38120,763 +37124,747 @@ mixInto(Transition, { this.abort(new Redirect(to, params, query)); }, - retry: function () { - transitionTo(this.path); + wait: function (value) { + this._promise = Promise.resolve(value); + }, + + from: function (routes, components, callback) { + return runTransitionFromHooks(this, routes, components, callback); + }, + + to: function (routes, params, query, callback) { + return runTransitionToHooks(this, routes, params, query, callback); } }); module.exports = Transition; -},{"../actions/LocationActions":1,"./Redirect":21,"react/lib/mixInto":47}],23:[function(_dereq_,module,exports){ +},{"./Promise":22,"./Redirect":24,"./reversedArray":29,"react/lib/Object.assign":38}],26:[function(_dereq_,module,exports){ +var React = (typeof window !== "undefined" ? window.React : typeof global !== "undefined" ? global.React : null); +var warning = _dereq_('react/lib/warning'); +var invariant = _dereq_('react/lib/invariant'); +var canUseDOM = _dereq_('react/lib/ExecutionEnvironment').canUseDOM; +var ImitateBrowserBehavior = _dereq_('../behaviors/ImitateBrowserBehavior'); +var RouteHandler = _dereq_('../components/RouteHandler'); +var LocationActions = _dereq_('../actions/LocationActions'); +var HashLocation = _dereq_('../locations/HashLocation'); +var HistoryLocation = _dereq_('../locations/HistoryLocation'); +var RefreshLocation = _dereq_('../locations/RefreshLocation'); +var NavigationContext = _dereq_('../mixins/NavigationContext'); +var StateContext = _dereq_('../mixins/StateContext'); +var Scrolling = _dereq_('../mixins/Scrolling'); +var createRoutesFromChildren = _dereq_('./createRoutesFromChildren'); +var supportsHistory = _dereq_('./supportsHistory'); +var Transition = _dereq_('./Transition'); +var PropTypes = _dereq_('./PropTypes'); +var Redirect = _dereq_('./Redirect'); +var Cancellation = _dereq_('./Cancellation'); +var Path = _dereq_('./Path'); + /** - * Returns the current URL path from `window.location`, including query string + * The default location for new routers. */ -function getWindowPath() { - return window.location.pathname + window.location.search; -} - -module.exports = getWindowPath; - +var DEFAULT_LOCATION = canUseDOM ? HashLocation : '/'; -},{}],24:[function(_dereq_,module,exports){ -module.exports = Function.prototype.call.bind(Object.prototype.hasOwnProperty); - -},{}],25:[function(_dereq_,module,exports){ -var HashLocation = _dereq_('../locations/HashLocation'); -var PathStore = _dereq_('../stores/PathStore'); -var makePath = _dereq_('./makePath'); +/** + * The default scroll behavior for new routers. + */ +var DEFAULT_SCROLL_BEHAVIOR = canUseDOM ? ImitateBrowserBehavior : null; /** - * Returns a string that may safely be used as the href of a - * link to the route with the given name. + * The default error handler for new routers. */ -function makeHref(to, params, query) { - var path = makePath(to, params, query); +function defaultErrorHandler(error) { + // Throw so we don't silently swallow async errors. + throw error; // This error probably originated in a transition hook. +} - if (PathStore.getLocation() === HashLocation) - return '#' + path; +/** + * The default aborted transition handler for new routers. + */ +function defaultAbortHandler(abortReason, location) { + if (typeof location === 'string') + throw new Error('Unhandled aborted transition! Reason: ' + abortReason); - return path; + if (abortReason instanceof Cancellation) { + return; + } else if (abortReason instanceof Redirect) { + location.replace(this.makePath(abortReason.to, abortReason.params, abortReason.query)); + } else { + location.pop(); + } } -module.exports = makeHref; +function findMatch(pathname, routes, defaultRoute, notFoundRoute) { + var match, route, params; -},{"../locations/HashLocation":11,"../stores/PathStore":18,"./makePath":26}],26:[function(_dereq_,module,exports){ -var invariant = _dereq_('react/lib/invariant'); -var RouteStore = _dereq_('../stores/RouteStore'); -var Path = _dereq_('./Path'); + for (var i = 0, len = routes.length; i < len; ++i) { + route = routes[i]; -/** - * Returns an absolute URL path created from the given route name, URL - * parameters, and query values. - */ -function makePath(to, params, query) { - var path; - if (Path.isAbsolute(to)) { - path = Path.normalize(to); - } else { - var route = RouteStore.getRouteByName(to); + // Check the subtree first to find the most deeply-nested match. + match = findMatch(pathname, route.childRoutes, route.defaultRoute, route.notFoundRoute); - invariant( - route, - 'Unable to find a route named "' + to + '". Make sure you have ' + - 'a <Route name="' + to + '"> defined somewhere in your routes' - ); + if (match != null) { + match.routes.unshift(route); + return match; + } + + // No routes in the subtree matched, so check this route. + params = Path.extractParams(route.path, pathname); - path = route.props.path; + if (params) + return createMatch(route, params); } - return Path.withQuery(Path.injectParams(path, params), query); + // No routes matched, so try the default route if there is one. + if (defaultRoute && (params = Path.extractParams(defaultRoute.path, pathname))) + return createMatch(defaultRoute, params); + + // Last attempt: does the "not found" route match? + if (notFoundRoute && (params = Path.extractParams(notFoundRoute.path, pathname))) + return createMatch(notFoundRoute, params); + + return match; } -module.exports = makePath; +function createMatch(route, params) { + return { routes: [ route ], params: params }; +} -},{"../stores/RouteStore":19,"./Path":20,"react/lib/invariant":42}],27:[function(_dereq_,module,exports){ -var Promise = _dereq_('when/lib/Promise'); +function hasMatch(routes, route, prevParams, nextParams) { + return routes.some(function (r) { + if (r !== route) + return false; + + var paramNames = route.paramNames; + var paramName; + + for (var i = 0, len = paramNames.length; i < len; ++i) { + paramName = paramNames[i]; + + if (nextParams[paramName] !== prevParams[paramName]) + return false; + } + + return true; + }); +} /** - * Resolves all values in asyncState and calls the setState - * function with new state as they resolve. Returns a promise - * that resolves after all values are resolved. + * Creates and returns a new router using the given options. A router + * is a ReactComponent class that knows how to react to changes in the + * URL and keep the contents of the page in sync. + * + * Options may be any of the following: + * + * - routes (required) The route config + * - location The location to use. Defaults to HashLocation when + * the DOM is available, "/" otherwise + * - scrollBehavior The scroll behavior to use. Defaults to ImitateBrowserBehavior + * when the DOM is available, null otherwise + * - onError A function that is used to handle errors + * - onAbort A function that is used to handle aborted transitions + * + * When rendering in a server-side environment, the location should simply + * be the URL path that was used in the request, including the query string. */ -function resolveAsyncState(asyncState, setState) { - if (asyncState == null) - return Promise.resolve(); +function createRouter(options) { + options = options || {}; - var keys = Object.keys(asyncState); - - return Promise.all( - keys.map(function (key) { - return Promise.resolve(asyncState[key]).then(function (value) { - var newState = {}; - newState[key] = value; - setState(newState); - }); - }) - ); -} + if (typeof options === 'function') { + options = { routes: options }; // Router.create(<Route>) + } else if (Array.isArray(options)) { + options = { routes: options }; // Router.create([ <Route>, <Route> ]) + } -module.exports = resolveAsyncState; + var routes = []; + var namedRoutes = {}; + var components = []; + var location = options.location || DEFAULT_LOCATION; + var scrollBehavior = options.scrollBehavior || DEFAULT_SCROLL_BEHAVIOR; + var onError = options.onError || defaultErrorHandler; + var onAbort = options.onAbort || defaultAbortHandler; + var state = {}; + var nextState = {}; + var pendingTransition = null; -},{"when/lib/Promise":49}],28:[function(_dereq_,module,exports){ -function supportsHistory() { - /*! taken from modernizr - * https://github.com/Modernizr/Modernizr/blob/master/LICENSE - * https://github.com/Modernizr/Modernizr/blob/master/feature-detects/history.js - */ - var ua = navigator.userAgent; - if ((ua.indexOf('Android 2.') !== -1 || - (ua.indexOf('Android 4.0') !== -1)) && - ua.indexOf('Mobile Safari') !== -1 && - ua.indexOf('Chrome') === -1) { - return false; + function updateState() { + state = nextState; + nextState = {}; } - return (window.history && 'pushState' in window.history); -} -module.exports = supportsHistory; + // Automatically fall back to full page refreshes in + // browsers that don't support the HTML history API. + if (location === HistoryLocation && !supportsHistory()) + location = RefreshLocation; -},{}],29:[function(_dereq_,module,exports){ -function withoutProperties(object, properties) { - var result = {}; + var router = React.createClass({ - for (var property in object) { - if (object.hasOwnProperty(property) && !properties[property]) - result[property] = object[property]; - } + displayName: 'Router', - return result; -} + mixins: [ NavigationContext, StateContext, Scrolling ], + + statics: { -module.exports = withoutProperties; + defaultRoute: null, + notFoundRoute: null, -},{}],30:[function(_dereq_,module,exports){ -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - -function EventEmitter() { - this._events = this._events || {}; - this._maxListeners = this._maxListeners || undefined; -} -module.exports = EventEmitter; - -// Backwards-compat with node 0.10.x -EventEmitter.EventEmitter = EventEmitter; - -EventEmitter.prototype._events = undefined; -EventEmitter.prototype._maxListeners = undefined; - -// By default EventEmitters will print a warning if more than 10 listeners are -// added to it. This is a useful default which helps finding memory leaks. -EventEmitter.defaultMaxListeners = 10; - -// Obviously not all Emitters should be limited to 10. This function allows -// that to be increased. Set to zero for unlimited. -EventEmitter.prototype.setMaxListeners = function(n) { - if (!isNumber(n) || n < 0 || isNaN(n)) - throw TypeError('n must be a positive number'); - this._maxListeners = n; - return this; -}; + /** + * Adds routes to this router from the given children object (see ReactChildren). + */ + addRoutes: function (children) { + routes.push.apply(routes, createRoutesFromChildren(children, this, namedRoutes)); + }, -EventEmitter.prototype.emit = function(type) { - var er, handler, len, args, i, listeners; + /** + * Returns an absolute URL path created from the given route + * name, URL parameters, and query. + */ + makePath: function (to, params, query) { + var path; + if (Path.isAbsolute(to)) { + path = Path.normalize(to); + } else { + var route = namedRoutes[to]; - if (!this._events) - this._events = {}; + invariant( + route, + 'Unable to find <Route name="%s">', + to + ); - // If there is no 'error' event listener then throw. - if (type === 'error') { - if (!this._events.error || - (isObject(this._events.error) && !this._events.error.length)) { - er = arguments[1]; - if (er instanceof Error) { - throw er; // Unhandled 'error' event - } else { - throw TypeError('Uncaught, unspecified "error" event.'); - } - return false; - } - } + path = route.path; + } - handler = this._events[type]; + return Path.withQuery(Path.injectParams(path, params), query); + }, - if (isUndefined(handler)) - return false; + /** + * Returns a string that may safely be used as the href of a link + * to the route with the given name, URL parameters, and query. + */ + makeHref: function (to, params, query) { + var path = this.makePath(to, params, query); + return (location === HashLocation) ? '#' + path : path; + }, - if (isFunction(handler)) { - switch (arguments.length) { - // fast cases - case 1: - handler.call(this); - break; - case 2: - handler.call(this, arguments[1]); - break; - case 3: - handler.call(this, arguments[1], arguments[2]); - break; - // slower - default: - len = arguments.length; - args = new Array(len - 1); - for (i = 1; i < len; i++) - args[i - 1] = arguments[i]; - handler.apply(this, args); - } - } else if (isObject(handler)) { - len = arguments.length; - args = new Array(len - 1); - for (i = 1; i < len; i++) - args[i - 1] = arguments[i]; - - listeners = handler.slice(); - len = listeners.length; - for (i = 0; i < len; i++) - listeners[i].apply(this, args); - } + /** + * Transitions to the URL specified in the arguments by pushing + * a new URL onto the history stack. + */ + transitionTo: function (to, params, query) { + invariant( + typeof location !== 'string', + 'You cannot use transitionTo with a static location' + ); - return true; -}; + var path = this.makePath(to, params, query); -EventEmitter.prototype.addListener = function(type, listener) { - var m; - - if (!isFunction(listener)) - throw TypeError('listener must be a function'); - - if (!this._events) - this._events = {}; - - // To avoid recursion in the case that type === "newListener"! Before - // adding it to the listeners, first emit "newListener". - if (this._events.newListener) - this.emit('newListener', type, - isFunction(listener.listener) ? - listener.listener : listener); - - if (!this._events[type]) - // Optimize the case of one listener. Don't need the extra array object. - this._events[type] = listener; - else if (isObject(this._events[type])) - // If we've already got an array, just append. - this._events[type].push(listener); - else - // Adding the second element, need to change to array. - this._events[type] = [this._events[type], listener]; - - // Check for listener leak - if (isObject(this._events[type]) && !this._events[type].warned) { - var m; - if (!isUndefined(this._maxListeners)) { - m = this._maxListeners; - } else { - m = EventEmitter.defaultMaxListeners; - } + if (pendingTransition) { + // Replace so pending location does not stay in history. + location.replace(path); + } else { + location.push(path); + } + }, - if (m && m > 0 && this._events[type].length > m) { - this._events[type].warned = true; - console.error('(node) warning: possible EventEmitter memory ' + - 'leak detected. %d listeners added. ' + - 'Use emitter.setMaxListeners() to increase limit.', - this._events[type].length); - if (typeof console.trace === 'function') { - // not supported in IE 10 - console.trace(); - } - } - } + /** + * Transitions to the URL specified in the arguments by replacing + * the current URL in the history stack. + */ + replaceWith: function (to, params, query) { + invariant( + typeof location !== 'string', + 'You cannot use replaceWith with a static location' + ); - return this; -}; + location.replace(this.makePath(to, params, query)); + }, + + /** + * Transitions to the previous URL. + */ + goBack: function () { + invariant( + typeof location !== 'string', + 'You cannot use goBack with a static location' + ); + + location.pop(); + }, + + /** + * Performs a match of the given pathname against this router and returns an object + * with the { routes, params } that match. Returns null if no match can be made. + */ + match: function (pathname) { + return findMatch(pathname, routes, this.defaultRoute, this.notFoundRoute) || null; + }, -EventEmitter.prototype.on = EventEmitter.prototype.addListener; + /** + * Performs a transition to the given path and calls callback(error, abortReason) + * when the transition is finished. If both arguments are null the router's state + * was updated. Otherwise the transition did not complete. + * + * In a transition, a router first determines which routes are involved by beginning + * with the current route, up the route tree to the first parent route that is shared + * with the destination route, and back down the tree to the destination route. The + * willTransitionFrom hook is invoked on all route handlers we're transitioning away + * from, in reverse nesting order. Likewise, the willTransitionTo hook is invoked on + * all route handlers we're transitioning to. + * + * Both willTransitionFrom and willTransitionTo hooks may either abort or redirect the + * transition. To resolve asynchronously, they may use transition.wait(promise). If no + * hooks wait, the transition is fully synchronous. + */ + dispatch: function (path, action, callback) { + if (pendingTransition) { + pendingTransition.abort(new Cancellation); + pendingTransition = null; + } -EventEmitter.prototype.once = function(type, listener) { - if (!isFunction(listener)) - throw TypeError('listener must be a function'); + var prevPath = state.path; + if (prevPath === path) + return; // Nothing to do! - var fired = false; + // Record the scroll position as early as possible to + // get it before browsers try update it automatically. + if (prevPath && action !== LocationActions.REPLACE) + this.recordScrollPosition(prevPath); - function g() { - this.removeListener(type, g); + var pathname = Path.withoutQuery(path); + var match = this.match(pathname); - if (!fired) { - fired = true; - listener.apply(this, arguments); - } - } + warning( + match != null, + 'No route matches path "%s". Make sure you have <Route path="%s"> somewhere in your routes', + path, path + ); - g.listener = listener; - this.on(type, g); + if (match == null) + match = {}; - return this; -}; + var prevRoutes = state.routes || []; + var prevParams = state.params || {}; -// emits a 'removeListener' event iff the listener was removed -EventEmitter.prototype.removeListener = function(type, listener) { - var list, position, length, i; + var nextRoutes = match.routes || []; + var nextParams = match.params || {}; + var nextQuery = Path.extractQuery(path) || {}; - if (!isFunction(listener)) - throw TypeError('listener must be a function'); + var fromRoutes, toRoutes; + if (prevRoutes.length) { + fromRoutes = prevRoutes.filter(function (route) { + return !hasMatch(nextRoutes, route, prevParams, nextParams); + }); - if (!this._events || !this._events[type]) - return this; + toRoutes = nextRoutes.filter(function (route) { + return !hasMatch(prevRoutes, route, prevParams, nextParams); + }); + } else { + fromRoutes = []; + toRoutes = nextRoutes; + } - list = this._events[type]; - length = list.length; - position = -1; - - if (list === listener || - (isFunction(list.listener) && list.listener === listener)) { - delete this._events[type]; - if (this._events.removeListener) - this.emit('removeListener', type, listener); - - } else if (isObject(list)) { - for (i = length; i-- > 0;) { - if (list[i] === listener || - (list[i].listener && list[i].listener === listener)) { - position = i; - break; + var transition = new Transition(path, this.replaceWith.bind(this, path)); + pendingTransition = transition; + + transition.from(fromRoutes, components, function (error) { + if (error || transition.isAborted) + return callback.call(router, error, transition); + + transition.to(toRoutes, nextParams, nextQuery, function (error) { + if (error || transition.isAborted) + return callback.call(router, error, transition); + + nextState.path = path; + nextState.action = action; + nextState.pathname = pathname; + nextState.routes = nextRoutes; + nextState.params = nextParams; + nextState.query = nextQuery; + + callback.call(router, null, transition); + }); + }); + }, + + /** + * Starts this router and calls callback(router, state) when the route changes. + * + * If the router's location is static (i.e. a URL path in a server environment) + * the callback is called only once. Otherwise, the location should be one of the + * Router.*Location objects (e.g. Router.HashLocation or Router.HistoryLocation). + */ + run: function (callback) { + function dispatchHandler(error, transition) { + pendingTransition = null; + + if (error) { + onError.call(router, error); + } else if (transition.isAborted) { + onAbort.call(router, transition.abortReason, location); + } else { + callback.call(router, router, nextState); + } + } + + if (typeof location === 'string') { + warning( + !canUseDOM || "production" === 'test', + 'You should not use a static location in a DOM environment because ' + + 'the router will not be kept in sync with the current URL' + ); + + // Dispatch the location. + router.dispatch(location, null, dispatchHandler); + } else { + invariant( + canUseDOM, + 'You cannot use %s in a non-DOM environment', + location + ); + + // Listen for changes to the location. + function changeListener(change) { + router.dispatch(change.path, change.type, dispatchHandler); + } + + if (location.addChangeListener) + location.addChangeListener(changeListener); + + // Bootstrap using the current path. + router.dispatch(location.getCurrentPath(), null, dispatchHandler); + } } - } - if (position < 0) - return this; + }, - if (list.length === 1) { - list.length = 0; - delete this._events[type]; - } else { - list.splice(position, 1); - } + propTypes: { + children: PropTypes.falsy + }, - if (this._events.removeListener) - this.emit('removeListener', type, listener); - } + getLocation: function () { + return location; + }, - return this; -}; + getScrollBehavior: function () { + return scrollBehavior; + }, -EventEmitter.prototype.removeAllListeners = function(type) { - var key, listeners; + getRouteAtDepth: function (depth) { + var routes = this.state.routes; + return routes && routes[depth]; + }, - if (!this._events) - return this; + getRouteComponents: function () { + return components; + }, - // not listening for removeListener, no need to emit - if (!this._events.removeListener) { - if (arguments.length === 0) - this._events = {}; - else if (this._events[type]) - delete this._events[type]; - return this; - } + getInitialState: function () { + updateState(); + return state; + }, - // emit removeListener for all listeners on all events - if (arguments.length === 0) { - for (key in this._events) { - if (key === 'removeListener') continue; - this.removeAllListeners(key); - } - this.removeAllListeners('removeListener'); - this._events = {}; - return this; - } + componentWillReceiveProps: function () { + updateState(); + this.setState(state); + }, - listeners = this._events[type]; + render: function () { + return this.getRouteAtDepth(0) ? React.createElement(RouteHandler, this.props) : null; + }, - if (isFunction(listeners)) { - this.removeListener(type, listeners); - } else { - // LIFO order - while (listeners.length) - this.removeListener(type, listeners[listeners.length - 1]); - } - delete this._events[type]; + childContextTypes: { + getRouteAtDepth: React.PropTypes.func.isRequired, + getRouteComponents: React.PropTypes.func.isRequired, + routeHandlers: React.PropTypes.array.isRequired + }, - return this; -}; + getChildContext: function () { + return { + getRouteComponents: this.getRouteComponents, + getRouteAtDepth: this.getRouteAtDepth, + routeHandlers: [ this ] + }; + } -EventEmitter.prototype.listeners = function(type) { - var ret; - if (!this._events || !this._events[type]) - ret = []; - else if (isFunction(this._events[type])) - ret = [this._events[type]]; - else - ret = this._events[type].slice(); - return ret; -}; + }); -EventEmitter.listenerCount = function(emitter, type) { - var ret; - if (!emitter._events || !emitter._events[type]) - ret = 0; - else if (isFunction(emitter._events[type])) - ret = 1; - else - ret = emitter._events[type].length; - return ret; -}; + if (options.routes) + router.addRoutes(options.routes); -function isFunction(arg) { - return typeof arg === 'function'; + return router; } -function isNumber(arg) { - return typeof arg === 'number'; -} +module.exports = createRouter; + +},{"../actions/LocationActions":1,"../behaviors/ImitateBrowserBehavior":2,"../components/RouteHandler":9,"../locations/HashLocation":11,"../locations/HistoryLocation":12,"../locations/RefreshLocation":13,"../mixins/NavigationContext":16,"../mixins/Scrolling":17,"../mixins/StateContext":19,"./Cancellation":20,"./Path":21,"./PropTypes":23,"./Redirect":24,"./Transition":25,"./createRoutesFromChildren":27,"./supportsHistory":31,"react/lib/ExecutionEnvironment":37,"react/lib/invariant":41,"react/lib/warning":42}],27:[function(_dereq_,module,exports){ +var React = (typeof window !== "undefined" ? window.React : typeof global !== "undefined" ? global.React : null); +var warning = _dereq_('react/lib/warning'); +var invariant = _dereq_('react/lib/invariant'); +var DefaultRoute = _dereq_('../components/DefaultRoute'); +var NotFoundRoute = _dereq_('../components/NotFoundRoute'); +var Redirect = _dereq_('../components/Redirect'); +var Route = _dereq_('../components/Route'); +var Path = _dereq_('./Path'); -function isObject(arg) { - return typeof arg === 'object' && arg !== null; +var CONFIG_ELEMENT_TYPES = [ + DefaultRoute.type, + NotFoundRoute.type, + Redirect.type, + Route.type +]; + +function createRedirectHandler(to, _params, _query) { + return React.createClass({ + statics: { + willTransitionTo: function (transition, params, query) { + transition.redirect(to, _params || params, _query || query); + } + }, + + render: function () { + return null; + } + }); } -function isUndefined(arg) { - return arg === void 0; +function checkPropTypes(componentName, propTypes, props) { + for (var propName in propTypes) { + if (propTypes.hasOwnProperty(propName)) { + var error = propTypes[propName](props, propName, componentName); + + if (error instanceof Error) + warning(false, error.message); + } + } } -},{}],31:[function(_dereq_,module,exports){ -/** - * Copyright (c) 2014, 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 createRoute(element, parentRoute, namedRoutes) { + var type = element.type; + var props = element.props; + var componentName = (type && type.displayName) || 'UnknownComponent'; -module.exports.Dispatcher = _dereq_('./lib/Dispatcher') + invariant( + CONFIG_ELEMENT_TYPES.indexOf(type) !== -1, + 'Unrecognized route configuration element "<%s>"', + componentName + ); -},{"./lib/Dispatcher":32}],32:[function(_dereq_,module,exports){ -/* - * Copyright (c) 2014, 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. - * - * @providesModule Dispatcher - * @typechecks - */ + if (type.propTypes) + checkPropTypes(componentName, type.propTypes, props); -var invariant = _dereq_('./invariant'); + var route = { name: props.name }; -var _lastID = 1; -var _prefix = 'ID_'; + if (props.ignoreScrollBehavior) { + route.ignoreScrollBehavior = true; + } -/** - * Dispatcher is used to broadcast payloads to registered callbacks. This is - * different from generic pub-sub systems in two ways: - * - * 1) Callbacks are not subscribed to particular events. Every payload is - * dispatched to every registered callback. - * 2) Callbacks can be deferred in whole or part until other callbacks have - * been executed. - * - * For example, consider this hypothetical flight destination form, which - * selects a default city when a country is selected: - * - * var flightDispatcher = new Dispatcher(); - * - * // Keeps track of which country is selected - * var CountryStore = {country: null}; - * - * // Keeps track of which city is selected - * var CityStore = {city: null}; - * - * // Keeps track of the base flight price of the selected city - * var FlightPriceStore = {price: null} - * - * When a user changes the selected city, we dispatch the payload: - * - * flightDispatcher.dispatch({ - * actionType: 'city-update', - * selectedCity: 'paris' - * }); - * - * This payload is digested by `CityStore`: - * - * flightDispatcher.register(function(payload) { - * if (payload.actionType === 'city-update') { - * CityStore.city = payload.selectedCity; - * } - * }); - * - * When the user selects a country, we dispatch the payload: - * - * flightDispatcher.dispatch({ - * actionType: 'country-update', - * selectedCountry: 'australia' - * }); - * - * This payload is digested by both stores: - * - * CountryStore.dispatchToken = flightDispatcher.register(function(payload) { - * if (payload.actionType === 'country-update') { - * CountryStore.country = payload.selectedCountry; - * } - * }); - * - * When the callback to update `CountryStore` is registered, we save a reference - * to the returned token. Using this token with `waitFor()`, we can guarantee - * that `CountryStore` is updated before the callback that updates `CityStore` - * needs to query its data. - * - * CityStore.dispatchToken = flightDispatcher.register(function(payload) { - * if (payload.actionType === 'country-update') { - * // `CountryStore.country` may not be updated. - * flightDispatcher.waitFor([CountryStore.dispatchToken]); - * // `CountryStore.country` is now guaranteed to be updated. - * - * // Select the default city for the new country - * CityStore.city = getDefaultCityForCountry(CountryStore.country); - * } - * }); - * - * The usage of `waitFor()` can be chained, for example: - * - * FlightPriceStore.dispatchToken = - * flightDispatcher.register(function(payload) { - * switch (payload.actionType) { - * case 'country-update': - * flightDispatcher.waitFor([CityStore.dispatchToken]); - * FlightPriceStore.price = - * getFlightPriceStore(CountryStore.country, CityStore.city); - * break; - * - * case 'city-update': - * FlightPriceStore.price = - * FlightPriceStore(CountryStore.country, CityStore.city); - * break; - * } - * }); - * - * The `country-update` payload will be guaranteed to invoke the stores' - * registered callbacks in order: `CountryStore`, `CityStore`, then - * `FlightPriceStore`. - */ + if (type === Redirect.type) { + route.handler = createRedirectHandler(props.to, props.params, props.query); + props.path = props.path || props.from || '*'; + } else { + route.handler = props.handler; + } + + var parentPath = (parentRoute && parentRoute.path) || '/'; + + if ((props.path || props.name) && type !== DefaultRoute.type && type !== NotFoundRoute.type) { + var path = props.path || props.name; - function Dispatcher() {"use strict"; - this.$Dispatcher_callbacks = {}; - this.$Dispatcher_isPending = {}; - this.$Dispatcher_isHandled = {}; - this.$Dispatcher_isDispatching = false; - this.$Dispatcher_pendingPayload = null; + // Relative paths extend their parent. + if (!Path.isAbsolute(path)) + path = Path.join(parentPath, path); + + route.path = Path.normalize(path); + } else { + route.path = parentPath; + + if (type === NotFoundRoute.type) + route.path += '*'; } - /** - * Registers a callback to be invoked with every dispatched payload. Returns - * a token that can be used with `waitFor()`. - * - * @param {function} callback - * @return {string} - */ - Dispatcher.prototype.register=function(callback) {"use strict"; - var id = _prefix + _lastID++; - this.$Dispatcher_callbacks[id] = callback; - return id; - }; + route.paramNames = Path.extractParamNames(route.path); - /** - * Removes a callback based on its token. - * - * @param {string} id - */ - Dispatcher.prototype.unregister=function(id) {"use strict"; + // Make sure the route's path has all params its parent needs. + if (parentRoute && Array.isArray(parentRoute.paramNames)) { + parentRoute.paramNames.forEach(function (paramName) { + invariant( + route.paramNames.indexOf(paramName) !== -1, + 'The nested route path "%s" is missing the "%s" parameter of its parent path "%s"', + route.path, paramName, parentRoute.path + ); + }); + } + + // Make sure the route can be looked up by <Link>s. + if (props.name) { invariant( - this.$Dispatcher_callbacks[id], - 'Dispatcher.unregister(...): `%s` does not map to a registered callback.', - id + namedRoutes[props.name] == null, + 'You cannot use the name "%s" for more than one route', + props.name ); - delete this.$Dispatcher_callbacks[id]; - }; - /** - * Waits for the callbacks specified to be invoked before continuing execution - * of the current callback. This method should only be used by a callback in - * response to a dispatched payload. - * - * @param {array<string>} ids - */ - Dispatcher.prototype.waitFor=function(ids) {"use strict"; + namedRoutes[props.name] = route; + } + + // Handle <NotFoundRoute>. + if (type === NotFoundRoute.type) { invariant( - this.$Dispatcher_isDispatching, - 'Dispatcher.waitFor(...): Must be invoked while dispatching.' + parentRoute, + '<NotFoundRoute> must have a parent <Route>' ); - for (var ii = 0; ii < ids.length; ii++) { - var id = ids[ii]; - if (this.$Dispatcher_isPending[id]) { - invariant( - this.$Dispatcher_isHandled[id], - 'Dispatcher.waitFor(...): Circular dependency detected while ' + - 'waiting for `%s`.', - id - ); - continue; - } - invariant( - this.$Dispatcher_callbacks[id], - 'Dispatcher.waitFor(...): `%s` does not map to a registered callback.', - id - ); - this.$Dispatcher_invokeCallback(id); - } - }; - /** - * Dispatches a payload to all registered callbacks. - * - * @param {object} payload - */ - Dispatcher.prototype.dispatch=function(payload) {"use strict"; invariant( - !this.$Dispatcher_isDispatching, - 'Dispatch.dispatch(...): Cannot dispatch in the middle of a dispatch.' + parentRoute.notFoundRoute == null, + 'You may not have more than one <NotFoundRoute> per <Route>' ); - this.$Dispatcher_startDispatching(payload); - try { - for (var id in this.$Dispatcher_callbacks) { - if (this.$Dispatcher_isPending[id]) { - continue; - } - this.$Dispatcher_invokeCallback(id); - } - } finally { - this.$Dispatcher_stopDispatching(); - } - }; - /** - * Is this Dispatcher currently dispatching. - * - * @return {boolean} - */ - Dispatcher.prototype.isDispatching=function() {"use strict"; - return this.$Dispatcher_isDispatching; - }; + parentRoute.notFoundRoute = route; - /** - * Call the callback stored with the given id. Also do some internal - * bookkeeping. - * - * @param {string} id - * @internal - */ - Dispatcher.prototype.$Dispatcher_invokeCallback=function(id) {"use strict"; - this.$Dispatcher_isPending[id] = true; - this.$Dispatcher_callbacks[id](this.$Dispatcher_pendingPayload); - this.$Dispatcher_isHandled[id] = true; - }; + return null; + } - /** - * Set up bookkeeping needed when dispatching. - * - * @param {object} payload - * @internal - */ - Dispatcher.prototype.$Dispatcher_startDispatching=function(payload) {"use strict"; - for (var id in this.$Dispatcher_callbacks) { - this.$Dispatcher_isPending[id] = false; - this.$Dispatcher_isHandled[id] = false; - } - this.$Dispatcher_pendingPayload = payload; - this.$Dispatcher_isDispatching = true; - }; + // Handle <DefaultRoute>. + if (type === DefaultRoute.type) { + invariant( + parentRoute, + '<DefaultRoute> must have a parent <Route>' + ); - /** - * Clear bookkeeping used for dispatching. - * - * @internal - */ - Dispatcher.prototype.$Dispatcher_stopDispatching=function() {"use strict"; - this.$Dispatcher_pendingPayload = null; - this.$Dispatcher_isDispatching = false; - }; + invariant( + parentRoute.defaultRoute == null, + 'You may not have more than one <DefaultRoute> per <Route>' + ); + parentRoute.defaultRoute = route; -module.exports = Dispatcher; + return null; + } + + route.childRoutes = createRoutesFromChildren(props.children, route, namedRoutes); + + return route; +} -},{"./invariant":33}],33:[function(_dereq_,module,exports){ /** - * Copyright (c) 2014, 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. - * - * @providesModule invariant + * Creates and returns an array of route objects from the given ReactChildren. */ +function createRoutesFromChildren(children, parentRoute, namedRoutes) { + var routes = []; -"use strict"; + React.Children.forEach(children, function (child) { + // Exclude <DefaultRoute>s and <NotFoundRoute>s. + if (child = createRoute(child, parentRoute, namedRoutes)) + routes.push(child); + }); + + return routes; +} + +module.exports = createRoutesFromChildren; + +},{"../components/DefaultRoute":4,"../components/NotFoundRoute":6,"../components/Redirect":7,"../components/Route":8,"./Path":21,"react/lib/invariant":41,"react/lib/warning":42}],28:[function(_dereq_,module,exports){ +var invariant = _dereq_('react/lib/invariant'); +var canUseDOM = _dereq_('react/lib/ExecutionEnvironment').canUseDOM; /** - * Use invariant() to assert state which your program assumes to be true. + * Returns the current scroll position of the window as { x, y }. + */ +function getWindowScrollPosition() { + invariant( + canUseDOM, + 'Cannot get current scroll position without a DOM' + ); + + return { + x: window.scrollX, + y: window.scrollY + }; +} + +module.exports = getWindowScrollPosition; + +},{"react/lib/ExecutionEnvironment":37,"react/lib/invariant":41}],29:[function(_dereq_,module,exports){ +function reversedArray(array) { + return array.slice(0).reverse(); +} + +module.exports = reversedArray; + +},{}],30:[function(_dereq_,module,exports){ +var createRouter = _dereq_('./createRouter'); + +/** + * A high-level convenience method that creates, configures, and + * runs a router in one shot. The method signature is: * - * Provide sprintf-style format (only %s is supported) and arguments - * to provide information about what broke and what you were - * expecting. + * Router.run(routes[, location ], callback); * - * The invariant message will be stripped in production, but the invariant - * will remain to ensure logic does not differ in production. + * Using `window.location.hash` to manage the URL, you could do: + * + * Router.run(routes, function (Handler) { + * React.render(<Handler/>, document.body); + * }); + * + * Using HTML5 history and a custom "cursor" prop: + * + * Router.run(routes, Router.HistoryLocation, function (Handler) { + * React.render(<Handler cursor={cursor}/>, document.body); + * }); + * + * Returns the newly created router. + * + * Note: If you need to specify further options for your router such + * as error/abort handling or custom scroll behavior, use Router.create + * instead. + * + * var router = Router.create(options); + * router.run(function (Handler) { + * // ... + * }); */ - -var invariant = function(condition, format, a, b, c, d, e, f) { - if (false) { - if (format === undefined) { - throw new Error('invariant requires an error message argument'); - } +function runRouter(routes, location, callback) { + if (typeof location === 'function') { + callback = location; + location = null; } - 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( - 'Invariant Violation: ' + - format.replace(/%s/g, function() { return args[argIndex++]; }) - ); - } + var router = createRouter({ + routes: routes, + location: location + }); - error.framesToPop = 1; // we don't care about invariant's own frame - throw error; + router.run(callback); + + return router; +} + +module.exports = runRouter; + +},{"./createRouter":26}],31:[function(_dereq_,module,exports){ +function supportsHistory() { + /*! taken from modernizr + * https://github.com/Modernizr/Modernizr/blob/master/LICENSE + * https://github.com/Modernizr/Modernizr/blob/master/feature-detects/history.js + */ + var ua = navigator.userAgent; + if ((ua.indexOf('Android 2.') !== -1 || + (ua.indexOf('Android 4.0') !== -1)) && + ua.indexOf('Mobile Safari') !== -1 && + ua.indexOf('Chrome') === -1) { + return false; } -}; + return (window.history && 'pushState' in window.history); +} -module.exports = invariant; +module.exports = supportsHistory; -},{}],34:[function(_dereq_,module,exports){ +},{}],32:[function(_dereq_,module,exports){ module.exports = _dereq_('./lib'); -},{"./lib":35}],35:[function(_dereq_,module,exports){ +},{"./lib":33}],33:[function(_dereq_,module,exports){ // Load modules var Stringify = _dereq_('./stringify'); @@ -38893,7 +37881,7 @@ module.exports = { parse: Parse }; -},{"./parse":36,"./stringify":37}],36:[function(_dereq_,module,exports){ +},{"./parse":34,"./stringify":35}],34:[function(_dereq_,module,exports){ // Load modules var Utils = _dereq_('./utils'); @@ -39049,7 +38037,7 @@ module.exports = function (str, options) { return Utils.compact(obj); }; -},{"./utils":38}],37:[function(_dereq_,module,exports){ +},{"./utils":36}],35:[function(_dereq_,module,exports){ // Load modules var Utils = _dereq_('./utils'); @@ -39109,7 +38097,7 @@ module.exports = function (obj, options) { return keys.join(delimiter); }; -},{"./utils":38}],38:[function(_dereq_,module,exports){ +},{"./utils":36}],36:[function(_dereq_,module,exports){ // Load modules @@ -39250,21 +38238,14 @@ exports.isBuffer = function (obj) { } }; -},{}],39:[function(_dereq_,module,exports){ +},{}],37:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * 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 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * 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. + * 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. * * @providesModule ExecutionEnvironment */ @@ -39302,82 +38283,103 @@ var ExecutionEnvironment = { module.exports = ExecutionEnvironment; -},{}],40:[function(_dereq_,module,exports){ +},{}],38:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * 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 + * Copyright 2014, Facebook, Inc. + * All rights reserved. * - * 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. + * 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. * - * @providesModule copyProperties + * @providesModule Object.assign */ -/** - * Copy properties from one or more objects (up to 5) into the first object. - * This is a shallow copy. It mutates the first object and also returns it. - * - * NOTE: `arguments` has a very significant performance penalty, which is why - * we don't support unlimited arguments. - */ -function copyProperties(obj, a, b, c, d, e, f) { - obj = obj || {}; +// https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.assign - if ("production" !== "production") { - if (f) { - throw new Error('Too many arguments passed to copyProperties'); - } +function assign(target, sources) { + if (target == null) { + throw new TypeError('Object.assign target cannot be null or undefined'); } - var args = [a, b, c, d, e]; - var ii = 0, v; - while (args[ii]) { - v = args[ii++]; - for (var k in v) { - obj[k] = v[k]; + var to = Object(target); + var hasOwnProperty = Object.prototype.hasOwnProperty; + + for (var nextIndex = 1; nextIndex < arguments.length; nextIndex++) { + var nextSource = arguments[nextIndex]; + if (nextSource == null) { + continue; } - // IE ignores toString in object iteration.. See: - // webreflection.blogspot.com/2007/07/quick-fix-internet-explorer-and.html - if (v.hasOwnProperty && v.hasOwnProperty('toString') && - (typeof v.toString != 'undefined') && (obj.toString !== v.toString)) { - obj.toString = v.toString; + var from = Object(nextSource); + + // We don't currently support accessors nor proxies. Therefore this + // copy cannot throw. If we ever supported this then we must handle + // exceptions and side-effects. We don't support symbols so they won't + // be transferred. + + for (var key in from) { + if (hasOwnProperty.call(from, key)) { + to[key] = from[key]; + } } } - return obj; -} + return to; +}; -module.exports = copyProperties; +module.exports = assign; -},{}],41:[function(_dereq_,module,exports){ +},{}],39:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * 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 + * 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. * - * http://www.apache.org/licenses/LICENSE-2.0 + * @providesModule cx + */ + +/** + * This function is used to mark string literals representing CSS class names + * so that they can be transformed statically. This allows for modularization + * and minification of CSS class names. * - * 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. + * In static_upstream, this function is actually implemented, but it should + * eventually be replaced with something more descriptive, and the transform + * that is used in the main stack should be ported for use elsewhere. * - * @providesModule emptyFunction + * @param string|object className to modularize, or an object of key/values. + * In the object case, the values are conditions that + * determine if the className keys should be included. + * @param [string ...] Variable list of classNames in the string case. + * @return string Renderable space-separated CSS className. */ +function cx(classNames) { + if (typeof classNames == 'object') { + return Object.keys(classNames).filter(function(className) { + return classNames[className]; + }).join(' '); + } else { + return Array.prototype.join.call(arguments, ' '); + } +} -var copyProperties = _dereq_("./copyProperties"); +module.exports = cx; + +},{}],40:[function(_dereq_,module,exports){ +/** + * Copyright 2013-2014, 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. + * + * @providesModule emptyFunction + */ function makeEmptyFunction(arg) { return function() { @@ -39392,32 +38394,23 @@ function makeEmptyFunction(arg) { */ function emptyFunction() {} -copyProperties(emptyFunction, { - thatReturns: makeEmptyFunction, - thatReturnsFalse: makeEmptyFunction(false), - thatReturnsTrue: makeEmptyFunction(true), - thatReturnsNull: makeEmptyFunction(null), - thatReturnsThis: function() { return this; }, - thatReturnsArgument: function(arg) { return arg; } -}); +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; -},{"./copyProperties":40}],42:[function(_dereq_,module,exports){ +},{}],41:[function(_dereq_,module,exports){ /** - * Copyright 2013-2014 Facebook, Inc. - * - * 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 + * Copyright 2013-2014, Facebook, Inc. + * All rights reserved. * - * 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. + * 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. * * @providesModule invariant */ @@ -39465,353 +38458,14 @@ var invariant = function(condition, format, a, b, c, d, e, f) { module.exports = invariant; -},{}],43:[function(_dereq_,module,exports){ -/** - * Copyright 2013-2014 Facebook, Inc. - * - * 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. - * - * @providesModule keyMirror - * @typechecks static-only - */ - -"use strict"; - -var invariant = _dereq_("./invariant"); - -/** - * Constructs an enumeration with keys equal to their value. - * - * For example: - * - * var COLORS = keyMirror({blue: null, red: null}); - * var myColor = COLORS.blue; - * var isColorValid = !!COLORS[myColor]; - * - * The last line could not be performed if the values of the generated enum were - * not equal to their keys. - * - * Input: {key1: val1, key2: val2} - * Output: {key1: key1, key2: key2} - * - * @param {object} obj - * @return {object} - */ -var keyMirror = function(obj) { - var ret = {}; - var key; - ("production" !== "production" ? invariant( - obj instanceof Object && !Array.isArray(obj), - 'keyMirror(...): Argument must be an object.' - ) : invariant(obj instanceof Object && !Array.isArray(obj))); - for (key in obj) { - if (!obj.hasOwnProperty(key)) { - continue; - } - ret[key] = key; - } - return ret; -}; - -module.exports = keyMirror; - -},{"./invariant":42}],44:[function(_dereq_,module,exports){ -/** - * Copyright 2013-2014 Facebook, Inc. - * - * 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. - * - * @providesModule merge - */ - -"use strict"; - -var mergeInto = _dereq_("./mergeInto"); - -/** - * Shallow merges two structures into a return value, without mutating either. - * - * @param {?object} one Optional object with properties to merge from. - * @param {?object} two Optional object with properties to merge from. - * @return {object} The shallow extension of one by two. - */ -var merge = function(one, two) { - var result = {}; - mergeInto(result, one); - mergeInto(result, two); - return result; -}; - -module.exports = merge; - -},{"./mergeInto":46}],45:[function(_dereq_,module,exports){ -/** - * Copyright 2013-2014 Facebook, Inc. - * - * 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. - * - * @providesModule mergeHelpers - * - * requiresPolyfills: Array.isArray - */ - -"use strict"; - -var invariant = _dereq_("./invariant"); -var keyMirror = _dereq_("./keyMirror"); - -/** - * Maximum number of levels to traverse. Will catch circular structures. - * @const - */ -var MAX_MERGE_DEPTH = 36; - -/** - * We won't worry about edge cases like new String('x') or new Boolean(true). - * Functions are considered terminals, and arrays are not. - * @param {*} o The item/object/value to test. - * @return {boolean} true iff the argument is a terminal. - */ -var isTerminal = function(o) { - return typeof o !== 'object' || o === null; -}; - -var mergeHelpers = { - - MAX_MERGE_DEPTH: MAX_MERGE_DEPTH, - - isTerminal: isTerminal, - - /** - * Converts null/undefined values into empty object. - * - * @param {?Object=} arg Argument to be normalized (nullable optional) - * @return {!Object} - */ - normalizeMergeArg: function(arg) { - return arg === undefined || arg === null ? {} : arg; - }, - - /** - * If merging Arrays, a merge strategy *must* be supplied. If not, it is - * likely the caller's fault. If this function is ever called with anything - * but `one` and `two` being `Array`s, it is the fault of the merge utilities. - * - * @param {*} one Array to merge into. - * @param {*} two Array to merge from. - */ - checkMergeArrayArgs: function(one, two) { - ("production" !== "production" ? invariant( - Array.isArray(one) && Array.isArray(two), - 'Tried to merge arrays, instead got %s and %s.', - one, - two - ) : invariant(Array.isArray(one) && Array.isArray(two))); - }, - - /** - * @param {*} one Object to merge into. - * @param {*} two Object to merge from. - */ - checkMergeObjectArgs: function(one, two) { - mergeHelpers.checkMergeObjectArg(one); - mergeHelpers.checkMergeObjectArg(two); - }, - - /** - * @param {*} arg - */ - checkMergeObjectArg: function(arg) { - ("production" !== "production" ? invariant( - !isTerminal(arg) && !Array.isArray(arg), - 'Tried to merge an object, instead got %s.', - arg - ) : invariant(!isTerminal(arg) && !Array.isArray(arg))); - }, - - /** - * @param {*} arg - */ - checkMergeIntoObjectArg: function(arg) { - ("production" !== "production" ? invariant( - (!isTerminal(arg) || typeof arg === 'function') && !Array.isArray(arg), - 'Tried to merge into an object, instead got %s.', - arg - ) : invariant((!isTerminal(arg) || typeof arg === 'function') && !Array.isArray(arg))); - }, - - /** - * Checks that a merge was not given a circular object or an object that had - * too great of depth. - * - * @param {number} Level of recursion to validate against maximum. - */ - checkMergeLevel: function(level) { - ("production" !== "production" ? invariant( - level < MAX_MERGE_DEPTH, - 'Maximum deep merge depth exceeded. You may be attempting to merge ' + - 'circular structures in an unsupported way.' - ) : invariant(level < MAX_MERGE_DEPTH)); - }, - - /** - * Checks that the supplied merge strategy is valid. - * - * @param {string} Array merge strategy. - */ - checkArrayStrategy: function(strategy) { - ("production" !== "production" ? invariant( - strategy === undefined || strategy in mergeHelpers.ArrayStrategies, - 'You must provide an array strategy to deep merge functions to ' + - 'instruct the deep merge how to resolve merging two arrays.' - ) : invariant(strategy === undefined || strategy in mergeHelpers.ArrayStrategies)); - }, - - /** - * Set of possible behaviors of merge algorithms when encountering two Arrays - * that must be merged together. - * - `clobber`: The left `Array` is ignored. - * - `indexByIndex`: The result is achieved by recursively deep merging at - * each index. (not yet supported.) - */ - ArrayStrategies: keyMirror({ - Clobber: true, - IndexByIndex: true - }) - -}; - -module.exports = mergeHelpers; - -},{"./invariant":42,"./keyMirror":43}],46:[function(_dereq_,module,exports){ -/** - * Copyright 2013-2014 Facebook, Inc. - * - * 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. - * - * @providesModule mergeInto - * @typechecks static-only - */ - -"use strict"; - -var mergeHelpers = _dereq_("./mergeHelpers"); - -var checkMergeObjectArg = mergeHelpers.checkMergeObjectArg; -var checkMergeIntoObjectArg = mergeHelpers.checkMergeIntoObjectArg; - +},{}],42:[function(_dereq_,module,exports){ /** - * Shallow merges two structures by mutating the first parameter. - * - * @param {object|function} one Object to be merged into. - * @param {?object} two Optional object with properties to merge from. - */ -function mergeInto(one, two) { - checkMergeIntoObjectArg(one); - if (two != null) { - checkMergeObjectArg(two); - for (var key in two) { - if (!two.hasOwnProperty(key)) { - continue; - } - one[key] = two[key]; - } - } -} - -module.exports = mergeInto; - -},{"./mergeHelpers":45}],47:[function(_dereq_,module,exports){ -/** - * Copyright 2013-2014 Facebook, Inc. - * - * 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. - * - * @providesModule mixInto - */ - -"use strict"; - -/** - * Simply copies properties to the prototype. - */ -var mixInto = function(constructor, methodBag) { - var methodName; - for (methodName in methodBag) { - if (!methodBag.hasOwnProperty(methodName)) { - continue; - } - constructor.prototype[methodName] = methodBag[methodName]; - } -}; - -module.exports = mixInto; - -},{}],48:[function(_dereq_,module,exports){ -/** - * Copyright 2014 Facebook, Inc. - * - * 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 + * Copyright 2014, Facebook, Inc. + * All rights reserved. * - * 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. + * 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. * * @providesModule warning */ @@ -39847,7 +38501,7 @@ if ("production" !== "production") { module.exports = warning; -},{"./emptyFunction":41}],49:[function(_dereq_,module,exports){ +},{"./emptyFunction":40}],43:[function(_dereq_,module,exports){ /** @license MIT License (c) copyright 2010-2014 original author or authors */ /** @author Brian Cavalier */ /** @author John Hann */ @@ -39866,7 +38520,7 @@ define(function (_dereq_) { }); })(typeof define === 'function' && define.amd ? define : function (factory) { module.exports = factory(_dereq_); }); -},{"./Scheduler":51,"./async":52,"./makePromise":53}],50:[function(_dereq_,module,exports){ +},{"./Scheduler":45,"./async":46,"./makePromise":47}],44:[function(_dereq_,module,exports){ /** @license MIT License (c) copyright 2010-2014 original author or authors */ /** @author Brian Cavalier */ /** @author John Hann */ @@ -39938,7 +38592,7 @@ define(function() { }); }(typeof define === 'function' && define.amd ? define : function(factory) { module.exports = factory(); })); -},{}],51:[function(_dereq_,module,exports){ +},{}],45:[function(_dereq_,module,exports){ /** @license MIT License (c) copyright 2010-2014 original author or authors */ /** @author Brian Cavalier */ /** @author John Hann */ @@ -40022,7 +38676,7 @@ define(function(_dereq_) { }); }(typeof define === 'function' && define.amd ? define : function(factory) { module.exports = factory(_dereq_); })); -},{"./Queue":50}],52:[function(_dereq_,module,exports){ +},{"./Queue":44}],46:[function(_dereq_,module,exports){ /** @license MIT License (c) copyright 2010-2014 original author or authors */ /** @author Brian Cavalier */ /** @author John Hann */ @@ -40067,11 +38721,21 @@ define(function(_dereq_) { } else { nextTick = (function(cjsRequire) { + var vertx; try { // vert.x 1.x || 2.x - return cjsRequire('vertx').runOnLoop || cjsRequire('vertx').runOnContext; + vertx = cjsRequire('vertx'); } catch (ignore) {} + if (vertx) { + if (typeof vertx.runOnLoop === 'function') { + return vertx.runOnLoop; + } + if (typeof vertx.runOnContext === 'function') { + return vertx.runOnContext; + } + } + // capture setTimeout to avoid being caught by fake timers // used in time based tests var capturedSetTimeout = setTimeout; @@ -40085,7 +38749,7 @@ define(function(_dereq_) { }); }(typeof define === 'function' && define.amd ? define : function(factory) { module.exports = factory(_dereq_); })); -},{}],53:[function(_dereq_,module,exports){ +},{}],47:[function(_dereq_,module,exports){ /** @license MIT License (c) copyright 2010-2014 original author or authors */ /** @author Brian Cavalier */ /** @author John Hann */ @@ -40216,10 +38880,12 @@ define(function() { */ Promise.prototype.then = function(onFulfilled, onRejected) { var parent = this._handler; + var state = parent.join().state(); - if (typeof onFulfilled !== 'function' && parent.join().state() > 0) { + if ((typeof onFulfilled !== 'function' && state > 0) || + (typeof onRejected !== 'function' && state < 0)) { // Short circuit: value will not change, simply share handler - return new Promise(Handler, parent); + return new this.constructor(Handler, parent); } var p = this._beget(); @@ -40280,9 +38946,7 @@ define(function() { } if (maybeThenable(x)) { - h = isPromise(x) - ? x._handler.join() - : getHandlerUntrusted(x); + h = getHandlerMaybeThenable(x); s = h.state(); if (s === 0) { @@ -40291,6 +38955,7 @@ define(function() { results[i] = h.value; --pending; } else { + unreportRemaining(promises, i+1, h); resolver.become(h); break; } @@ -40316,6 +38981,20 @@ define(function() { } } + function unreportRemaining(promises, start, rejectedHandler) { + var i, h, x; + for(i=start; i<promises.length; ++i) { + x = promises[i]; + if(maybeThenable(x)) { + h = getHandlerMaybeThenable(x); + + if(h !== rejectedHandler) { + h.visit(h, void 0, h._unreport); + } + } + } + } + /** * Fulfill-reject competitive race. Return a promise that will settle * to the same state as the earliest input promise to settle. @@ -40364,6 +39043,16 @@ define(function() { } /** + * Get a handler for thenable x. + * NOTE: You must only call this if maybeThenable(x) == true + * @param {object|function|Promise} x + * @returns {object} handler + */ + function getHandlerMaybeThenable(x) { + return isPromise(x) ? x._handler.join() : getHandlerUntrusted(x); + } + + /** * Get a handler for potentially untrusted thenable x * @param {*} x * @returns {object} handler @@ -40858,5354 +39547,7 @@ define(function() { }); }(typeof define === 'function' && define.amd ? define : function(factory) { module.exports = factory(); })); -},{}]},{},[9]) -(9) -}); -(function (root, factory) { - if (typeof define === 'function' && define.amd) { - // AMD. - define(['react'], factory); - } else { - // Browser globals - root.ReactBootstrap = factory(root.React); - } -}(this, function (React) { - -/** - * almond 0.1.2 Copyright (c) 2011, The Dojo Foundation All Rights Reserved. - * Available via the MIT or new BSD license. - * see: http://github.com/jrburke/almond for details - */ -//Going sloppy to avoid 'use strict' string cost, but strict practices should -//be followed. -/*jslint sloppy: true */ -/*global setTimeout: false */ - -var requirejs, require, define; -(function (undef) { - var defined = {}, - waiting = {}, - config = {}, - defining = {}, - aps = [].slice, - main, req; - - /** - * Given a relative module name, like ./something, normalize it to - * a real name that can be mapped to a path. - * @param {String} name the relative name - * @param {String} baseName a real name that the name arg is relative - * to. - * @returns {String} normalized name - */ - function normalize(name, baseName) { - var baseParts = baseName && baseName.split("/"), - map = config.map, - starMap = (map && map['*']) || {}, - nameParts, nameSegment, mapValue, foundMap, - foundI, foundStarMap, starI, i, j, part; - - //Adjust any relative paths. - if (name && name.charAt(0) === ".") { - //If have a base name, try to normalize against it, - //otherwise, assume it is a top-level require that will - //be relative to baseUrl in the end. - if (baseName) { - //Convert baseName to array, and lop off the last part, - //so that . matches that "directory" and not name of the baseName's - //module. For instance, baseName of "one/two/three", maps to - //"one/two/three.js", but we want the directory, "one/two" for - //this normalization. - baseParts = baseParts.slice(0, baseParts.length - 1); - - name = baseParts.concat(name.split("/")); - - //start trimDots - for (i = 0; (part = name[i]); i++) { - if (part === ".") { - name.splice(i, 1); - i -= 1; - } else if (part === "..") { - if (i === 1 && (name[2] === '..' || name[0] === '..')) { - //End of the line. Keep at least one non-dot - //path segment at the front so it can be mapped - //correctly to disk. Otherwise, there is likely - //no path mapping for a path starting with '..'. - //This can still fail, but catches the most reasonable - //uses of .. - return true; - } else if (i > 0) { - name.splice(i - 1, 2); - i -= 2; - } - } - } - //end trimDots - - name = name.join("/"); - } - } - - //Apply map config if available. - if ((baseParts || starMap) && map) { - nameParts = name.split('/'); - - for (i = nameParts.length; i > 0; i -= 1) { - nameSegment = nameParts.slice(0, i).join("/"); - - if (baseParts) { - //Find the longest baseName segment match in the config. - //So, do joins on the biggest to smallest lengths of baseParts. - for (j = baseParts.length; j > 0; j -= 1) { - mapValue = map[baseParts.slice(0, j).join('/')]; - - //baseName segment has config, find if it has one for - //this name. - if (mapValue) { - mapValue = mapValue[nameSegment]; - if (mapValue) { - //Match, update name to the new value. - foundMap = mapValue; - foundI = i; - break; - } - } - } - } - - if (foundMap) { - break; - } - - //Check for a star map match, but just hold on to it, - //if there is a shorter segment match later in a matching - //config, then favor over this star map. - if (!foundStarMap && starMap && starMap[nameSegment]) { - foundStarMap = starMap[nameSegment]; - starI = i; - } - } - - if (!foundMap && foundStarMap) { - foundMap = foundStarMap; - foundI = starI; - } - - if (foundMap) { - nameParts.splice(0, foundI, foundMap); - name = nameParts.join('/'); - } - } - - return name; - } - - function makeRequire(relName, forceSync) { - return function () { - //A version of a require function that passes a moduleName - //value for items that may need to - //look up paths relative to the moduleName - return req.apply(undef, aps.call(arguments, 0).concat([relName, forceSync])); - }; - } - - function makeNormalize(relName) { - return function (name) { - return normalize(name, relName); - }; - } - - function makeLoad(depName) { - return function (value) { - defined[depName] = value; - }; - } - - function callDep(name) { - if (waiting.hasOwnProperty(name)) { - var args = waiting[name]; - delete waiting[name]; - defining[name] = true; - main.apply(undef, args); - } - - if (!defined.hasOwnProperty(name)) { - throw new Error('No ' + name); - } - return defined[name]; - } - - /** - * Makes a name map, normalizing the name, and using a plugin - * for normalization if necessary. Grabs a ref to plugin - * too, as an optimization. - */ - function makeMap(name, relName) { - var prefix, plugin, - index = name.indexOf('!'); - - if (index !== -1) { - prefix = normalize(name.slice(0, index), relName); - name = name.slice(index + 1); - plugin = callDep(prefix); - - //Normalize according - if (plugin && plugin.normalize) { - name = plugin.normalize(name, makeNormalize(relName)); - } else { - name = normalize(name, relName); - } - } else { - name = normalize(name, relName); - } - - //Using ridiculous property names for space reasons - return { - f: prefix ? prefix + '!' + name : name, //fullName - n: name, - p: plugin - }; - } - - function makeConfig(name) { - return function () { - return (config && config.config && config.config[name]) || {}; - }; - } - - main = function (name, deps, callback, relName) { - var args = [], - usingExports, - cjsModule, depName, ret, map, i; - - //Use name if no relName - relName = relName || name; - - //Call the callback to define the module, if necessary. - if (typeof callback === 'function') { - - //Pull out the defined dependencies and pass the ordered - //values to the callback. - //Default to [require, exports, module] if no deps - deps = !deps.length && callback.length ? ['require', 'exports', 'module'] : deps; - for (i = 0; i < deps.length; i++) { - map = makeMap(deps[i], relName); - depName = map.f; - - //Fast path CommonJS standard dependencies. - if (depName === "require") { - args[i] = makeRequire(name); - } else if (depName === "exports") { - //CommonJS module spec 1.1 - args[i] = defined[name] = {}; - usingExports = true; - } else if (depName === "module") { - //CommonJS module spec 1.1 - cjsModule = args[i] = { - id: name, - uri: '', - exports: defined[name], - config: makeConfig(name) - }; - } else if (defined.hasOwnProperty(depName) || waiting.hasOwnProperty(depName)) { - args[i] = callDep(depName); - } else if (map.p) { - map.p.load(map.n, makeRequire(relName, true), makeLoad(depName), {}); - args[i] = defined[depName]; - } else if (!defining[depName]) { - throw new Error(name + ' missing ' + depName); - } - } - - ret = callback.apply(defined[name], args); - - if (name) { - //If setting exports via "module" is in play, - //favor that over return value and exports. After that, - //favor a non-undefined return value over exports use. - if (cjsModule && cjsModule.exports !== undef && - cjsModule.exports !== defined[name]) { - defined[name] = cjsModule.exports; - } else if (ret !== undef || !usingExports) { - //Use the return value from the function. - defined[name] = ret; - } - } - } else if (name) { - //May just be an object definition for the module. Only - //worry about defining if have a module name. - defined[name] = callback; - } - }; - - requirejs = require = req = function (deps, callback, relName, forceSync) { - if (typeof deps === "string") { - //Just return the module wanted. In this scenario, the - //deps arg is the module name, and second arg (if passed) - //is just the relName. - //Normalize module name, if it contains . or .. - return callDep(makeMap(deps, callback).f); - } else if (!deps.splice) { - //deps is a config object, not an array. - config = deps; - if (callback.splice) { - //callback is an array, which means it is a dependency list. - //Adjust args if there are dependencies - deps = callback; - callback = relName; - relName = null; - } else { - deps = undef; - } - } - - //Support require(['a']) - callback = callback || function () {}; - - //Simulate async callback; - if (forceSync) { - main(undef, deps, callback, relName); - } else { - setTimeout(function () { - main(undef, deps, callback, relName); - }, 15); - } - - return req; - }; - - /** - * Just drops the config on the floor, but returns req in case - * the config return value is used. - */ - req.config = function (cfg) { - config = cfg; - return req; - }; - - define = function (name, deps, callback) { - - //This module may not have dependencies - if (!deps.splice) { - //deps is not an array, so probably means - //an object literal or factory function for - //the value. Adjust args. - callback = deps; - deps = []; - } - - waiting[name] = [name, deps, callback]; - }; - - define.amd = { - jQuery: true - }; -}()); - -define("almond", function(){}); - -define('utils/classSet',['require','exports','module'],function (require, exports, module) {/** - * React classSet - * - * Copyright 2013-2014 Facebook, Inc. - * @licence https://github.com/facebook/react/blob/0.11-stable/LICENSE - * - * This file is unmodified from: - * https://github.com/facebook/react/blob/0.11-stable/src/vendor/stubs/cx.js - * - */ - -/** - * This function is used to mark string literals representing CSS class names - * so that they can be transformed statically. This allows for modularization - * and minification of CSS class names. - * - * In static_upstream, this function is actually implemented, but it should - * eventually be replaced with something more descriptive, and the transform - * that is used in the main stack should be ported for use elsewhere. - * - * @param string|object className to modularize, or an object of key/values. - * In the object case, the values are conditions that - * determine if the className keys should be included. - * @param [string ...] Variable list of classNames in the string case. - * @return string Renderable space-separated CSS className. - */ -function cx(classNames) { - if (typeof classNames == 'object') { - return Object.keys(classNames).filter(function(className) { - return classNames[className]; - }).join(' '); - } else { - return Array.prototype.join.call(arguments, ' '); - } -} - -module.exports = cx; -}); - -define('utils/merge',['require','exports','module'],function (require, exports, module) {/** - * Merge helper - * - * TODO: to be replaced with ES6's `Object.assign()` for React 0.12 - */ - -/** - * Shallow merges two structures by mutating the first parameter. - * - * @param {object} one Object to be merged into. - * @param {?object} two Optional object with properties to merge from. - */ -function mergeInto(one, two) { - if (two != null) { - for (var key in two) { - if (!two.hasOwnProperty(key)) { - continue; - } - one[key] = two[key]; - } - } -} - -/** - * Shallow merges two structures into a return value, without mutating either. - * - * @param {?object} one Optional object with properties to merge from. - * @param {?object} two Optional object with properties to merge from. - * @return {object} The shallow extension of one by two. - */ -function merge(one, two) { - var result = {}; - mergeInto(result, one); - mergeInto(result, two); - return result; -} - -module.exports = merge; -}); - -define('utils/cloneWithProps',['require','exports','module','react','./merge'],function (require, exports, module) {/** - * React cloneWithProps - * - * Copyright 2013-2014 Facebook, Inc. - * @licence https://github.com/facebook/react/blob/0.11-stable/LICENSE - * - * This file contains modified versions of: - * https://github.com/facebook/react/blob/0.11-stable/src/utils/cloneWithProps.js - * https://github.com/facebook/react/blob/0.11-stable/src/core/ReactPropTransferer.js - * https://github.com/facebook/react/blob/0.11-stable/src/utils/joinClasses.js - * - * TODO: This should be replaced as soon as cloneWithProps is available via - * the core React package or a separate package. - * @see https://github.com/facebook/react/issues/1906 - * - */ - -var React = require('react'); -var merge = require('./merge'); - -/** - * Combines multiple className strings into one. - * http://jsperf.com/joinclasses-args-vs-array - * - * @param {...?string} classes - * @return {string} - */ -function joinClasses(className/*, ... */) { - if (!className) { - className = ''; - } - var nextClass; - var argLength = arguments.length; - if (argLength > 1) { - for (var ii = 1; ii < argLength; ii++) { - nextClass = arguments[ii]; - nextClass && (className += ' ' + nextClass); - } - } - return className; -} - -/** - * Creates a transfer strategy that will merge prop values using the supplied - * `mergeStrategy`. If a prop was previously unset, this just sets it. - * - * @param {function} mergeStrategy - * @return {function} - */ -function createTransferStrategy(mergeStrategy) { - return function(props, key, value) { - if (!props.hasOwnProperty(key)) { - props[key] = value; - } else { - props[key] = mergeStrategy(props[key], value); - } - }; -} - -var transferStrategyMerge = createTransferStrategy(function(a, b) { - // `merge` overrides the first object's (`props[key]` above) keys using the - // second object's (`value`) keys. An object's style's existing `propA` would - // get overridden. Flip the order here. - return merge(b, a); -}); - -function emptyFunction() {} - -/** - * Transfer strategies dictate how props are transferred by `transferPropsTo`. - * NOTE: if you add any more exceptions to this list you should be sure to - * update `cloneWithProps()` accordingly. - */ -var TransferStrategies = { - /** - * Never transfer `children`. - */ - children: emptyFunction, - /** - * Transfer the `className` prop by merging them. - */ - className: createTransferStrategy(joinClasses), - /** - * Never transfer the `key` prop. - */ - key: emptyFunction, - /** - * Never transfer the `ref` prop. - */ - ref: emptyFunction, - /** - * Transfer the `style` prop (which is an object) by merging them. - */ - style: transferStrategyMerge -}; - -/** - * Mutates the first argument by transferring the properties from the second - * argument. - * - * @param {object} props - * @param {object} newProps - * @return {object} - */ -function transferInto(props, newProps) { - for (var thisKey in newProps) { - if (!newProps.hasOwnProperty(thisKey)) { - continue; - } - - var transferStrategy = TransferStrategies[thisKey]; - - if (transferStrategy && TransferStrategies.hasOwnProperty(thisKey)) { - transferStrategy(props, thisKey, newProps[thisKey]); - } else if (!props.hasOwnProperty(thisKey)) { - props[thisKey] = newProps[thisKey]; - } - } - return props; -} - -/** - * Merge two props objects using TransferStrategies. - * - * @param {object} oldProps original props (they take precedence) - * @param {object} newProps new props to merge in - * @return {object} a new object containing both sets of props merged. - */ -function mergeProps(oldProps, newProps) { - return transferInto(merge(oldProps), newProps); -} - -var ReactPropTransferer = { - mergeProps: mergeProps -}; - -var CHILDREN_PROP = 'children'; - -/** - * Sometimes you want to change the props of a child passed to you. Usually - * this is to add a CSS class. - * - * @param {object} child child component you'd like to clone - * @param {object} props props you'd like to modify. They will be merged - * as if you used `transferPropsTo()`. - * @return {object} a clone of child with props merged in. - */ -function cloneWithProps(child, props) { - var newProps = ReactPropTransferer.mergeProps(props, child.props); - - // Use `child.props.children` if it is provided. - if (!newProps.hasOwnProperty(CHILDREN_PROP) && - child.props.hasOwnProperty(CHILDREN_PROP)) { - newProps.children = child.props.children; - } - - // Huge hack to support both the 0.10 API and the new way of doing things - // TODO: remove when support for 0.10 is no longer needed - if (React.version.indexOf('0.10.') === 0) { - return child.constructor.ConvenienceConstructor(newProps); - } - - - // The current API doesn't retain _owner and _context, which is why this - // doesn't use ReactDescriptor.cloneAndReplaceProps. - return child.constructor(newProps); -} - -module.exports = cloneWithProps; -}); - -define('constants',['require','exports','module'],function (require, exports, module) {module.exports = { - CLASSES: { - 'alert': 'alert', - 'button': 'btn', - 'button-group': 'btn-group', - 'button-toolbar': 'btn-toolbar', - 'column': 'col', - 'input-group': 'input-group', - 'form': 'form', - 'glyphicon': 'glyphicon', - 'label': 'label', - 'list-group-item': 'list-group-item', - 'panel': 'panel', - 'panel-group': 'panel-group', - 'progress-bar': 'progress-bar', - 'nav': 'nav', - 'navbar': 'navbar', - 'modal': 'modal', - 'row': 'row', - 'well': 'well' - }, - STYLES: { - 'default': 'default', - 'primary': 'primary', - 'success': 'success', - 'info': 'info', - 'warning': 'warning', - 'danger': 'danger', - 'link': 'link', - 'inline': 'inline', - 'tabs': 'tabs', - 'pills': 'pills' - }, - SIZES: { - 'large': 'lg', - 'medium': 'md', - 'small': 'sm', - 'xsmall': 'xs' - }, - GLYPHS: [ - 'asterisk', - 'plus', - 'euro', - 'minus', - 'cloud', - 'envelope', - 'pencil', - 'glass', - 'music', - 'search', - 'heart', - 'star', - 'star-empty', - 'user', - 'film', - 'th-large', - 'th', - 'th-list', - 'ok', - 'remove', - 'zoom-in', - 'zoom-out', - 'off', - 'signal', - 'cog', - 'trash', - 'home', - 'file', - 'time', - 'road', - 'download-alt', - 'download', - 'upload', - 'inbox', - 'play-circle', - 'repeat', - 'refresh', - 'list-alt', - 'lock', - 'flag', - 'headphones', - 'volume-off', - 'volume-down', - 'volume-up', - 'qrcode', - 'barcode', - 'tag', - 'tags', - 'book', - 'bookmark', - 'print', - 'camera', - 'font', - 'bold', - 'italic', - 'text-height', - 'text-width', - 'align-left', - 'align-center', - 'align-right', - 'align-justify', - 'list', - 'indent-left', - 'indent-right', - 'facetime-video', - 'picture', - 'map-marker', - 'adjust', - 'tint', - 'edit', - 'share', - 'check', - 'move', - 'step-backward', - 'fast-backward', - 'backward', - 'play', - 'pause', - 'stop', - 'forward', - 'fast-forward', - 'step-forward', - 'eject', - 'chevron-left', - 'chevron-right', - 'plus-sign', - 'minus-sign', - 'remove-sign', - 'ok-sign', - 'question-sign', - 'info-sign', - 'screenshot', - 'remove-circle', - 'ok-circle', - 'ban-circle', - 'arrow-left', - 'arrow-right', - 'arrow-up', - 'arrow-down', - 'share-alt', - 'resize-full', - 'resize-small', - 'exclamation-sign', - 'gift', - 'leaf', - 'fire', - 'eye-open', - 'eye-close', - 'warning-sign', - 'plane', - 'calendar', - 'random', - 'comment', - 'magnet', - 'chevron-up', - 'chevron-down', - 'retweet', - 'shopping-cart', - 'folder-close', - 'folder-open', - 'resize-vertical', - 'resize-horizontal', - 'hdd', - 'bullhorn', - 'bell', - 'certificate', - 'thumbs-up', - 'thumbs-down', - 'hand-right', - 'hand-left', - 'hand-up', - 'hand-down', - 'circle-arrow-right', - 'circle-arrow-left', - 'circle-arrow-up', - 'circle-arrow-down', - 'globe', - 'wrench', - 'tasks', - 'filter', - 'briefcase', - 'fullscreen', - 'dashboard', - 'paperclip', - 'heart-empty', - 'link', - 'phone', - 'pushpin', - 'usd', - 'gbp', - 'sort', - 'sort-by-alphabet', - 'sort-by-alphabet-alt', - 'sort-by-order', - 'sort-by-order-alt', - 'sort-by-attributes', - 'sort-by-attributes-alt', - 'unchecked', - 'expand', - 'collapse-down', - 'collapse-up', - 'log-in', - 'flash', - 'log-out', - 'new-window', - 'record', - 'save', - 'open', - 'saved', - 'import', - 'export', - 'send', - 'floppy-disk', - 'floppy-saved', - 'floppy-remove', - 'floppy-save', - 'floppy-open', - 'credit-card', - 'transfer', - 'cutlery', - 'header', - 'compressed', - 'earphone', - 'phone-alt', - 'tower', - 'stats', - 'sd-video', - 'hd-video', - 'subtitles', - 'sound-stereo', - 'sound-dolby', - 'sound-5-1', - 'sound-6-1', - 'sound-7-1', - 'copyright-mark', - 'registration-mark', - 'cloud-download', - 'cloud-upload', - 'tree-conifer', - 'tree-deciduous' - ] -}; - -}); - -define('BootstrapMixin',['require','exports','module','react','./constants'],function (require, exports, module) {var React = require('react'); -var constants = require('./constants'); - -var BootstrapMixin = { - propTypes: { - bsClass: React.PropTypes.oneOf(Object.keys(constants.CLASSES)), - bsStyle: React.PropTypes.oneOf(Object.keys(constants.STYLES)), - bsSize: React.PropTypes.oneOf(Object.keys(constants.SIZES)) - }, - - getBsClassSet: function () { - var classes = {}; - - var bsClass = this.props.bsClass && constants.CLASSES[this.props.bsClass]; - if (bsClass) { - classes[bsClass] = true; - - var prefix = bsClass + '-'; - - var bsSize = this.props.bsSize && constants.SIZES[this.props.bsSize]; - if (bsSize) { - classes[prefix + bsSize] = true; - } - - var bsStyle = this.props.bsStyle && constants.STYLES[this.props.bsStyle]; - if (this.props.bsStyle) { - classes[prefix + bsStyle] = true; - } - } - - return classes; - } -}; - -module.exports = BootstrapMixin; -}); - -define('utils/ValidComponentChildren',['require','exports','module','react'],function (require, exports, module) {var React = require('react'); - -/** - * Maps children that are typically specified as `props.children`, - * but only iterates over children that are "valid components". - * - * The mapFunction provided index will be normalised to the components mapped, - * so an invalid component would not increase the index. - * - * @param {?*} children Children tree container. - * @param {function(*, int)} mapFunction. - * @param {*} mapContext Context for mapFunction. - * @return {object} Object containing the ordered map of results. - */ -function mapValidComponents(children, func, context) { - var index = 0; - - return React.Children.map(children, function (child) { - if (React.isValidComponent(child)) { - var lastIndex = index; - index++; - return func.call(context, child, lastIndex); - } - - return child; - }); -} - -/** - * Iterates through children that are typically specified as `props.children`, - * but only iterates over children that are "valid components". - * - * The provided forEachFunc(child, index) will be called for each - * leaf child with the index reflecting the position relative to "valid components". - * - * @param {?*} children Children tree container. - * @param {function(*, int)} forEachFunc. - * @param {*} forEachContext Context for forEachContext. - */ -function forEachValidComponents(children, func, context) { - var index = 0; - - return React.Children.forEach(children, function (child) { - if (React.isValidComponent(child)) { - func.call(context, child, index); - index++; - } - }); -} - -/** - * Count the number of "valid components" in the Children container. - * - * @param {?*} children Children tree container. - * @returns {number} - */ -function numberOfValidComponents(children) { - var count = 0; - - React.Children.forEach(children, function (child) { - if (React.isValidComponent(child)) { count++; } - }); - - return count; -} - -/** - * Determine if the Child container has one or more "valid components". - * - * @param {?*} children Children tree container. - * @returns {boolean} - */ -function hasValidComponent(children) { - var hasValid = false; - - React.Children.forEach(children, function (child) { - if (!hasValid && React.isValidComponent(child)) { - hasValid = true; - } - }); - - return hasValid; -} - -module.exports = { - map: mapValidComponents, - forEach: forEachValidComponents, - numberOf: numberOfValidComponents, - hasValidComponent: hasValidComponent -}; -}); - -define('PanelGroup',['require','exports','module','react','./utils/classSet','./utils/cloneWithProps','./BootstrapMixin','./utils/ValidComponentChildren'],function (require, exports, module) {/** @jsx React.DOM */ - -var React = require('react'); -var classSet = require('./utils/classSet'); -var cloneWithProps = require('./utils/cloneWithProps'); -var BootstrapMixin = require('./BootstrapMixin'); -var ValidComponentChildren = require('./utils/ValidComponentChildren'); - -var PanelGroup = React.createClass({displayName: 'PanelGroup', - mixins: [BootstrapMixin], - - propTypes: { - collapsable: React.PropTypes.bool, - activeKey: React.PropTypes.any, - defaultActiveKey: React.PropTypes.any, - onSelect: React.PropTypes.func - }, - - getDefaultProps: function () { - return { - bsClass: 'panel-group' - }; - }, - - getInitialState: function () { - var defaultActiveKey = this.props.defaultActiveKey; - - return { - activeKey: defaultActiveKey - }; - }, - - render: function () { - return this.transferPropsTo( - React.DOM.div( {className:classSet(this.getBsClassSet()), onSelect:null}, - ValidComponentChildren.map(this.props.children, this.renderPanel) - ) - ); - }, - - renderPanel: function (child) { - var activeKey = - this.props.activeKey != null ? this.props.activeKey : this.state.activeKey; - - var props = { - bsStyle: child.props.bsStyle || this.props.bsStyle, - key: child.props.key, - ref: child.props.ref - }; - - if (this.props.accordion) { - props.collapsable = true; - props.expanded = (child.props.key === activeKey); - props.onSelect = this.handleSelect; - } - - return cloneWithProps( - child, - props - ); - }, - - shouldComponentUpdate: function() { - // Defer any updates to this component during the `onSelect` handler. - return !this._isChanging; - }, - - handleSelect: function (key) { - if (this.props.onSelect) { - this._isChanging = true; - this.props.onSelect(key); - this._isChanging = false; - } - - if (this.state.activeKey === key) { - key = null; - } - - this.setState({ - activeKey: key - }); - } -}); - -module.exports = PanelGroup; -}); - -define('Accordion',['require','exports','module','react','./PanelGroup'],function (require, exports, module) {/** @jsx React.DOM */ - -var React = require('react'); -var PanelGroup = require('./PanelGroup'); - -var Accordion = React.createClass({displayName: 'Accordion', - render: function () { - return this.transferPropsTo( - PanelGroup( {accordion:true}, - this.props.children - ) - ); - } -}); - -module.exports = Accordion; -}); - -define('utils/domUtils',['require','exports','module'],function (require, exports, module) { -/** - * Shortcut to compute element style - * - * @param {HTMLElement} elem - * @returns {CssStyle} - */ -function getComputedStyles(elem) { - return elem.ownerDocument.defaultView.getComputedStyle(elem, null); -} - -/** - * Get elements offset - * - * TODO: REMOVE JQUERY! - * - * @param {HTMLElement} DOMNode - * @returns {{top: number, left: number}} - */ -function getOffset(DOMNode) { - if (window.jQuery) { - return window.jQuery(DOMNode).offset(); - } - - var docElem = document.documentElement; - var box = { top: 0, left: 0 }; - - // If we don't have gBCR, just use 0,0 rather than error - // BlackBerry 5, iOS 3 (original iPhone) - if ( typeof DOMNode.getBoundingClientRect !== 'undefined' ) { - box = DOMNode.getBoundingClientRect(); - } - - return { - top: box.top + window.pageYOffset - docElem.clientTop, - left: box.left + window.pageXOffset - docElem.clientLeft - }; -} - -/** - * Get elements position - * - * TODO: REMOVE JQUERY! - * - * @param {HTMLElement} elem - * @param {HTMLElement?} offsetParent - * @returns {{top: number, left: number}} - */ -function getPosition(elem, offsetParent) { - if (window.jQuery) { - return window.jQuery(elem).position(); - } - - var offset, - parentOffset = {top: 0, left: 0}; - - // Fixed elements are offset from window (parentOffset = {top:0, left: 0}, because it is its only offset parent - if (getComputedStyles(elem).position === 'fixed' ) { - // We assume that getBoundingClientRect is available when computed position is fixed - offset = elem.getBoundingClientRect(); - - } else { - if (!offsetParent) { - // Get *real* offsetParent - offsetParent = offsetParent(elem); - } - - // Get correct offsets - offset = getOffset(elem); - if ( offsetParent.nodeName !== 'HTML') { - parentOffset = getOffset(offsetParent); - } - - // Add offsetParent borders - parentOffset.top += parseInt(getComputedStyles(offsetParent).borderTopWidth, 10); - parentOffset.left += parseInt(getComputedStyles(offsetParent).borderLeftWidth, 10); - } - - // Subtract parent offsets and element margins - return { - top: offset.top - parentOffset.top - parseInt(getComputedStyles(elem).marginTop, 10), - left: offset.left - parentOffset.left - parseInt(getComputedStyles(elem).marginLeft, 10) - }; -} - -/** - * Get parent element - * - * @param {HTMLElement?} elem - * @returns {HTMLElement} - */ -function offsetParent(elem) { - var docElem = document.documentElement; - var offsetParent = elem.offsetParent || docElem; - - while ( offsetParent && ( offsetParent.nodeName !== 'HTML' && - getComputedStyles(offsetParent).position === 'static' ) ) { - offsetParent = offsetParent.offsetParent; - } - - return offsetParent || docElem; -} - -module.exports = { - getComputedStyles: getComputedStyles, - getOffset: getOffset, - getPosition: getPosition, - offsetParent: offsetParent -}; -}); - -define('utils/EventListener',['require','exports','module'],function (require, exports, module) {/** - * React EventListener.listen - * - * Copyright 2013-2014 Facebook, Inc. - * @licence https://github.com/facebook/react/blob/0.11-stable/LICENSE - * - * This file contains a modified version of: - * https://github.com/facebook/react/blob/0.11-stable/src/vendor/stubs/EventListener.js - * - * TODO: remove in favour of solution provided by: - * https://github.com/facebook/react/issues/285 - */ - -/** - * Does not take into account specific nature of platform. - */ -var EventListener = { - /** - * Listen to DOM events during the bubble phase. - * - * @param {DOMEventTarget} target DOM element to register listener on. - * @param {string} eventType Event type, e.g. 'click' or 'mouseover'. - * @param {function} callback Callback function. - * @return {object} Object with a `remove` method. - */ - listen: function(target, eventType, callback) { - if (target.addEventListener) { - target.addEventListener(eventType, callback, false); - return { - remove: function() { - target.removeEventListener(eventType, callback, false); - } - }; - } else if (target.attachEvent) { - target.attachEvent('on' + eventType, callback); - return { - remove: function() { - target.detachEvent('on' + eventType, callback); - } - }; - } - } -}; - -module.exports = EventListener; - -}); - -define('AffixMixin',['require','exports','module','react','./utils/domUtils','./utils/EventListener'],function (require, exports, module) {/* global window, document */ - -var React = require('react'); -var domUtils = require('./utils/domUtils'); -var EventListener = require('./utils/EventListener'); - -var AffixMixin = { - propTypes: { - offset: React.PropTypes.number, - offsetTop: React.PropTypes.number, - offsetBottom: React.PropTypes.number - }, - - getInitialState: function () { - return { - affixClass: 'affix-top' - }; - }, - - getPinnedOffset: function (DOMNode) { - if (this.pinnedOffset) { - return this.pinnedOffset; - } - - DOMNode.className = DOMNode.className.replace(/affix-top|affix-bottom|affix/, ''); - DOMNode.className += DOMNode.className.length ? ' affix' : 'affix'; - - this.pinnedOffset = domUtils.getOffset(DOMNode).top - window.pageYOffset; - - return this.pinnedOffset; - }, - - checkPosition: function () { - var DOMNode, scrollHeight, scrollTop, position, offsetTop, offsetBottom, - affix, affixType, affixPositionTop; - - // TODO: or not visible - if (!this.isMounted()) { - return; - } - - DOMNode = this.getDOMNode(); - scrollHeight = document.documentElement.offsetHeight; - scrollTop = window.pageYOffset; - position = domUtils.getOffset(DOMNode); - offsetTop; - offsetBottom; - - if (this.affixed === 'top') { - position.top += scrollTop; - } - - offsetTop = this.props.offsetTop != null ? - this.props.offsetTop : this.props.offset; - offsetBottom = this.props.offsetBottom != null ? - this.props.offsetBottom : this.props.offset; - - if (offsetTop == null && offsetBottom == null) { - return; - } - if (offsetTop == null) { - offsetTop = 0; - } - if (offsetBottom == null) { - offsetBottom = 0; - } - - if (this.unpin != null && (scrollTop + this.unpin <= position.top)) { - affix = false; - } else if (offsetBottom != null && (position.top + DOMNode.offsetHeight >= scrollHeight - offsetBottom)) { - affix = 'bottom'; - } else if (offsetTop != null && (scrollTop <= offsetTop)) { - affix = 'top'; - } else { - affix = false; - } - - if (this.affixed === affix) { - return; - } - - if (this.unpin != null) { - DOMNode.style.top = ''; - } - - affixType = 'affix' + (affix ? '-' + affix : ''); - - this.affixed = affix; - this.unpin = affix === 'bottom' ? - this.getPinnedOffset(DOMNode) : null; - - if (affix === 'bottom') { - DOMNode.className = DOMNode.className.replace(/affix-top|affix-bottom|affix/, 'affix-bottom'); - affixPositionTop = scrollHeight - offsetBottom - DOMNode.offsetHeight - domUtils.getOffset(DOMNode).top; - } - - this.setState({ - affixClass: affixType, - affixPositionTop: affixPositionTop - }); - }, - - checkPositionWithEventLoop: function () { - setTimeout(this.checkPosition, 0); - }, - - componentDidMount: function () { - this._onWindowScrollListener = - EventListener.listen(window, 'scroll', this.checkPosition); - this._onDocumentClickListener = - EventListener.listen(document, 'click', this.checkPositionWithEventLoop); - }, - - componentWillUnmount: function () { - if (this._onWindowScrollListener) { - this._onWindowScrollListener.remove(); - } - - if (this._onDocumentClickListener) { - this._onDocumentClickListener.remove(); - } - }, - - componentDidUpdate: function (prevProps, prevState) { - if (prevState.affixClass === this.state.affixClass) { - this.checkPositionWithEventLoop(); - } - } -}; - -module.exports = AffixMixin; -}); - -define('Affix',['require','exports','module','react','./AffixMixin','./utils/domUtils'],function (require, exports, module) {/** @jsx React.DOM */ - -var React = require('react'); -var AffixMixin = require('./AffixMixin'); -var domUtils = require('./utils/domUtils'); - -var Affix = React.createClass({displayName: 'Affix', - statics: { - domUtils: domUtils - }, - - mixins: [AffixMixin], - - render: function () { - var holderStyle = {top: this.state.affixPositionTop}; - return this.transferPropsTo( - React.DOM.div( {className:this.state.affixClass, style:holderStyle}, - this.props.children - ) - ); - } -}); - -module.exports = Affix; -}); - -define('Alert',['require','exports','module','react','./utils/classSet','./BootstrapMixin'],function (require, exports, module) {/** @jsx React.DOM */ - -var React = require('react'); -var classSet = require('./utils/classSet'); -var BootstrapMixin = require('./BootstrapMixin'); - - -var Alert = React.createClass({displayName: 'Alert', - mixins: [BootstrapMixin], - - propTypes: { - onDismiss: React.PropTypes.func, - dismissAfter: React.PropTypes.number - }, - - getDefaultProps: function () { - return { - bsClass: 'alert', - bsStyle: 'info' - }; - }, - - renderDismissButton: function () { - return ( - React.DOM.button( - {type:"button", - className:"close", - onClick:this.props.onDismiss, - 'aria-hidden':"true"}, - " × " - ) - ); - }, - - render: function () { - var classes = this.getBsClassSet(); - var isDismissable = !!this.props.onDismiss; - - classes['alert-dismissable'] = isDismissable; - - return this.transferPropsTo( - React.DOM.div( {className:classSet(classes)}, - isDismissable ? this.renderDismissButton() : null, - this.props.children - ) - ); - }, - - componentDidMount: function() { - if (this.props.dismissAfter && this.props.onDismiss) { - this.dismissTimer = setTimeout(this.props.onDismiss, this.props.dismissAfter); - } - }, - - componentWillUnmount: function() { - clearTimeout(this.dismissTimer); - } -}); - -module.exports = Alert; -}); - -define('Badge',['require','exports','module','react','./utils/ValidComponentChildren','./utils/classSet'],function (require, exports, module) {/** @jsx React.DOM */ - -var React = require('react'); -var ValidComponentChildren = require('./utils/ValidComponentChildren'); -var classSet = require('./utils/classSet'); - -var Badge = React.createClass({displayName: 'Badge', - propTypes: { - pullRight: React.PropTypes.bool, - }, - - render: function () { - var classes = { - 'pull-right': this.props.pullRight, - 'badge': ValidComponentChildren.hasValidComponent(this.props.children) - }; - return this.transferPropsTo( - React.DOM.span( {className:classSet(classes)}, - this.props.children - ) - ); - } -}); - -module.exports = Badge; - -}); - -define('utils/CustomPropTypes',['require','exports','module','react'],function (require, exports, module) {var React = require('react'); - -var ANONYMOUS = '<<anonymous>>'; - -var CustomPropTypes = { - /** - * Checks whether a prop is a valid React class - * - * @param props - * @param propName - * @param componentName - * @returns {Error|undefined} - */ - componentClass: createComponentClassChecker(), - - /** - * Checks whether a prop provides a DOM element - * - * The element can be provided in two forms: - * - Directly passed - * - Or passed an object which has a `getDOMNode` method which will return the required DOM element - * - * @param props - * @param propName - * @param componentName - * @returns {Error|undefined} - */ - mountable: createMountableChecker() -}; - -/** - * Create chain-able isRequired validator - * - * Largely copied directly from: - * https://github.com/facebook/react/blob/0.11-stable/src/core/ReactPropTypes.js#L94 - */ -function createChainableTypeChecker(validate) { - function checkType(isRequired, props, propName, componentName) { - componentName = componentName || ANONYMOUS; - if (props[propName] == null) { - if (isRequired) { - return new Error( - 'Required prop `' + propName + '` was not specified in ' + - '`' + componentName + '`.' - ); - } - } else { - return validate(props, propName, componentName); - } - } - - var chainedCheckType = checkType.bind(null, false); - chainedCheckType.isRequired = checkType.bind(null, true); - - return chainedCheckType; -} - -function createComponentClassChecker() { - function validate(props, propName, componentName) { - if (!React.isValidClass(props[propName])) { - return new Error( - 'Invalid prop `' + propName + '` supplied to ' + - '`' + componentName + '`, expected a valid React class.' - ); - } - } - - return createChainableTypeChecker(validate); -} - -function createMountableChecker() { - function validate(props, propName, componentName) { - if (typeof props[propName] !== 'object' || - typeof props[propName].getDOMNode !== 'function' && props[propName].nodeType !== 1) { - return new Error( - 'Invalid prop `' + propName + '` supplied to ' + - '`' + componentName + '`, expected a DOM element or an object that has a `getDOMNode` method' - ); - } - } - - return createChainableTypeChecker(validate); -} - -module.exports = CustomPropTypes; -}); - -define('Button',['require','exports','module','react','./utils/classSet','./BootstrapMixin','./utils/CustomPropTypes'],function (require, exports, module) {/** @jsx React.DOM */ - -var React = require('react'); -var classSet = require('./utils/classSet'); -var BootstrapMixin = require('./BootstrapMixin'); -var CustomPropTypes = require('./utils/CustomPropTypes'); - -var Button = React.createClass({displayName: 'Button', - mixins: [BootstrapMixin], - - propTypes: { - active: React.PropTypes.bool, - disabled: React.PropTypes.bool, - block: React.PropTypes.bool, - navItem: React.PropTypes.bool, - navDropdown: React.PropTypes.bool, - componentClass: CustomPropTypes.componentClass - }, - - getDefaultProps: function () { - return { - bsClass: 'button', - bsStyle: 'default', - type: 'button' - }; - }, - - render: function () { - var classes = this.props.navDropdown ? {} : this.getBsClassSet(); - var renderFuncName; - - classes['active'] = this.props.active; - classes['btn-block'] = this.props.block; - - if (this.props.navItem) { - return this.renderNavItem(classes); - } - - renderFuncName = this.props.href || this.props.navDropdown ? - 'renderAnchor' : 'renderButton'; - - return this[renderFuncName](classes); - }, - - renderAnchor: function (classes) { - var component = this.props.componentClass || React.DOM.a; - var href = this.props.href || '#'; - classes['disabled'] = this.props.disabled; - - return this.transferPropsTo( - component( - {href:href, - className:classSet(classes), - role:"button"}, - this.props.children - ) - ); - }, - - renderButton: function (classes) { - var component = this.props.componentClass || React.DOM.button; - - return this.transferPropsTo( - component( - {className:classSet(classes)}, - this.props.children - ) - ); - }, - - renderNavItem: function (classes) { - var liClasses = { - active: this.props.active - }; - - return ( - React.DOM.li( {className:classSet(liClasses)}, - this.renderAnchor(classes) - ) - ); - } -}); - -module.exports = Button; - -}); - -define('ButtonGroup',['require','exports','module','react','./utils/classSet','./BootstrapMixin','./Button'],function (require, exports, module) {/** @jsx React.DOM */ - -var React = require('react'); -var classSet = require('./utils/classSet'); -var BootstrapMixin = require('./BootstrapMixin'); -var Button = require('./Button'); - -var ButtonGroup = React.createClass({displayName: 'ButtonGroup', - mixins: [BootstrapMixin], - - propTypes: { - vertical: React.PropTypes.bool, - justified: React.PropTypes.bool - }, - - getDefaultProps: function () { - return { - bsClass: 'button-group' - }; - }, - - render: function () { - var classes = this.getBsClassSet(); - classes['btn-group'] = !this.props.vertical; - classes['btn-group-vertical'] = this.props.vertical; - classes['btn-group-justified'] = this.props.justified; - - return this.transferPropsTo( - React.DOM.div( - {className:classSet(classes)}, - this.props.children - ) - ); - } -}); - -module.exports = ButtonGroup; -}); - -define('ButtonToolbar',['require','exports','module','react','./utils/classSet','./BootstrapMixin','./Button'],function (require, exports, module) {/** @jsx React.DOM */ - -var React = require('react'); -var classSet = require('./utils/classSet'); -var BootstrapMixin = require('./BootstrapMixin'); -var Button = require('./Button'); - -var ButtonToolbar = React.createClass({displayName: 'ButtonToolbar', - mixins: [BootstrapMixin], - - getDefaultProps: function () { - return { - bsClass: 'button-toolbar' - }; - }, - - render: function () { - var classes = this.getBsClassSet(); - - return this.transferPropsTo( - React.DOM.div( - {role:"toolbar", - className:classSet(classes)}, - this.props.children - ) - ); - } -}); - -module.exports = ButtonToolbar; -}); - -define('Carousel',['require','exports','module','react','./utils/classSet','./utils/cloneWithProps','./BootstrapMixin','./utils/ValidComponentChildren'],function (require, exports, module) {/** @jsx React.DOM */ - -var React = require('react'); -var classSet = require('./utils/classSet'); -var cloneWithProps = require('./utils/cloneWithProps'); -var BootstrapMixin = require('./BootstrapMixin'); -var ValidComponentChildren = require('./utils/ValidComponentChildren'); - -var Carousel = React.createClass({displayName: 'Carousel', - mixins: [BootstrapMixin], - - propTypes: { - slide: React.PropTypes.bool, - indicators: React.PropTypes.bool, - controls: React.PropTypes.bool, - pauseOnHover: React.PropTypes.bool, - wrap: React.PropTypes.bool, - onSelect: React.PropTypes.func, - onSlideEnd: React.PropTypes.func, - activeIndex: React.PropTypes.number, - defaultActiveIndex: React.PropTypes.number, - direction: React.PropTypes.oneOf(['prev', 'next']) - }, - - getDefaultProps: function () { - return { - slide: true, - interval: 5000, - pauseOnHover: true, - wrap: true, - indicators: true, - controls: true - }; - }, - - getInitialState: function () { - return { - activeIndex: this.props.defaultActiveIndex == null ? - 0 : this.props.defaultActiveIndex, - previousActiveIndex: null, - direction: null - }; - }, - - getDirection: function (prevIndex, index) { - if (prevIndex === index) { - return null; - } - - return prevIndex > index ? - 'prev' : 'next'; - }, - - componentWillReceiveProps: function (nextProps) { - var activeIndex = this.getActiveIndex(); - - if (nextProps.activeIndex != null && nextProps.activeIndex !== activeIndex) { - clearTimeout(this.timeout); - this.setState({ - previousActiveIndex: activeIndex, - direction: nextProps.direction != null ? - nextProps.direction : this.getDirection(activeIndex, nextProps.activeIndex) - }); - } - }, - - componentDidMount: function () { - this.waitForNext(); - }, - - componentWillUnmount: function() { - clearTimeout(this.timeout); - }, - - next: function (e) { - if (e) { - e.preventDefault(); - } - - var index = this.getActiveIndex() + 1; - var count = ValidComponentChildren.numberOf(this.props.children); - - if (index > count - 1) { - if (!this.props.wrap) { - return; - } - index = 0; - } - - this.handleSelect(index, 'next'); - }, - - prev: function (e) { - if (e) { - e.preventDefault(); - } - - var index = this.getActiveIndex() - 1; - - if (index < 0) { - if (!this.props.wrap) { - return; - } - index = ValidComponentChildren.numberOf(this.props.children) - 1; - } - - this.handleSelect(index, 'prev'); - }, - - pause: function () { - this.isPaused = true; - clearTimeout(this.timeout); - }, - - play: function () { - this.isPaused = false; - this.waitForNext(); - }, - - waitForNext: function () { - if (!this.isPaused && this.props.slide && this.props.interval && - this.props.activeIndex == null) { - this.timeout = setTimeout(this.next, this.props.interval); - } - }, - - handleMouseOver: function () { - if (this.props.pauseOnHover) { - this.pause(); - } - }, - - handleMouseOut: function () { - if (this.isPaused) { - this.play(); - } - }, - - render: function () { - var classes = { - carousel: true, - slide: this.props.slide - }; - - return this.transferPropsTo( - React.DOM.div( - {className:classSet(classes), - onMouseOver:this.handleMouseOver, - onMouseOut:this.handleMouseOut}, - this.props.indicators ? this.renderIndicators() : null, - React.DOM.div( {className:"carousel-inner", ref:"inner"}, - ValidComponentChildren.map(this.props.children, this.renderItem) - ), - this.props.controls ? this.renderControls() : null - ) - ); - }, - - renderPrev: function () { - return ( - React.DOM.a( {className:"left carousel-control", href:"#prev", key:0, onClick:this.prev}, - React.DOM.span( {className:"glyphicon glyphicon-chevron-left"} ) - ) - ); - }, - - renderNext: function () { - return ( - React.DOM.a( {className:"right carousel-control", href:"#next", key:1, onClick:this.next}, - React.DOM.span( {className:"glyphicon glyphicon-chevron-right"}) - ) - ); - }, - - renderControls: function () { - if (this.props.wrap) { - var activeIndex = this.getActiveIndex(); - var count = ValidComponentChildren.numberOf(this.props.children); - - return [ - (activeIndex !== 0) ? this.renderPrev() : null, - (activeIndex !== count - 1) ? this.renderNext() : null - ]; - } - - return [ - this.renderPrev(), - this.renderNext() - ]; - }, - - renderIndicator: function (child, index) { - var className = (index === this.getActiveIndex()) ? - 'active' : null; - - return ( - React.DOM.li( - {key:index, - className:className, - onClick:this.handleSelect.bind(this, index, null)} ) - ); - }, - - renderIndicators: function () { - var indicators = []; - ValidComponentChildren - .forEach(this.props.children, function(child, index) { - indicators.push( - this.renderIndicator(child, index), - - // Force whitespace between indicator elements, bootstrap - // requires this for correct spacing of elements. - ' ' - ); - }, this); - - return ( - React.DOM.ol( {className:"carousel-indicators"}, - indicators - ) - ); - }, - - getActiveIndex: function () { - return this.props.activeIndex != null ? this.props.activeIndex : this.state.activeIndex; - }, - - handleItemAnimateOutEnd: function () { - this.setState({ - previousActiveIndex: null, - direction: null - }, function() { - this.waitForNext(); - - if (this.props.onSlideEnd) { - this.props.onSlideEnd(); - } - }); - }, - - renderItem: function (child, index) { - var activeIndex = this.getActiveIndex(); - var isActive = (index === activeIndex); - var isPreviousActive = this.state.previousActiveIndex != null && - this.state.previousActiveIndex === index && this.props.slide; - - return cloneWithProps( - child, - { - active: isActive, - ref: child.props.ref, - key: child.props.key != null ? - child.props.key : index, - index: index, - animateOut: isPreviousActive, - animateIn: isActive && this.state.previousActiveIndex != null && this.props.slide, - direction: this.state.direction, - onAnimateOutEnd: isPreviousActive ? this.handleItemAnimateOutEnd: null - } - ); - }, - - handleSelect: function (index, direction) { - clearTimeout(this.timeout); - - var previousActiveIndex = this.getActiveIndex(); - direction = direction || this.getDirection(previousActiveIndex, index); - - if (this.props.onSelect) { - this.props.onSelect(index, direction); - } - - if (this.props.activeIndex == null && index !== previousActiveIndex) { - if (this.state.previousActiveIndex != null) { - // If currently animating don't activate the new index. - // TODO: look into queuing this canceled call and - // animating after the current animation has ended. - return; - } - - this.setState({ - activeIndex: index, - previousActiveIndex: previousActiveIndex, - direction: direction - }); - } - } -}); - -module.exports = Carousel; -}); - -define('utils/TransitionEvents',['require','exports','module'],function (require, exports, module) {/** - * React TransitionEvents - * - * Copyright 2013-2014 Facebook, Inc. - * @licence https://github.com/facebook/react/blob/0.11-stable/LICENSE - * - * This file contains a modified version of: - * https://github.com/facebook/react/blob/0.11-stable/src/addons/transitions/ReactTransitionEvents.js - * - */ - -var canUseDOM = !!( - typeof window !== 'undefined' && - window.document && - window.document.createElement - ); - -/** - * EVENT_NAME_MAP is used to determine which event fired when a - * transition/animation ends, based on the style property used to - * define that event. - */ -var EVENT_NAME_MAP = { - transitionend: { - 'transition': 'transitionend', - 'WebkitTransition': 'webkitTransitionEnd', - 'MozTransition': 'mozTransitionEnd', - 'OTransition': 'oTransitionEnd', - 'msTransition': 'MSTransitionEnd' - }, - - animationend: { - 'animation': 'animationend', - 'WebkitAnimation': 'webkitAnimationEnd', - 'MozAnimation': 'mozAnimationEnd', - 'OAnimation': 'oAnimationEnd', - 'msAnimation': 'MSAnimationEnd' - } -}; - -var endEvents = []; - -function detectEvents() { - var testEl = document.createElement('div'); - var style = testEl.style; - - // On some platforms, in particular some releases of Android 4.x, - // the un-prefixed "animation" and "transition" properties are defined on the - // style object but the events that fire will still be prefixed, so we need - // to check if the un-prefixed events are useable, and if not remove them - // from the map - if (!('AnimationEvent' in window)) { - delete EVENT_NAME_MAP.animationend.animation; - } - - if (!('TransitionEvent' in window)) { - delete EVENT_NAME_MAP.transitionend.transition; - } - - for (var baseEventName in EVENT_NAME_MAP) { - var baseEvents = EVENT_NAME_MAP[baseEventName]; - for (var styleName in baseEvents) { - if (styleName in style) { - endEvents.push(baseEvents[styleName]); - break; - } - } - } -} - -if (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; - -}); - -define('CarouselItem',['require','exports','module','react','./utils/classSet','./utils/TransitionEvents'],function (require, exports, module) {/** @jsx React.DOM */ - -var React = require('react'); -var classSet = require('./utils/classSet'); -var TransitionEvents = require('./utils/TransitionEvents'); - -var CarouselItem = React.createClass({displayName: 'CarouselItem', - propTypes: { - direction: React.PropTypes.oneOf(['prev', 'next']), - onAnimateOutEnd: React.PropTypes.func, - active: React.PropTypes.bool, - caption: React.PropTypes.renderable - }, - - getInitialState: function () { - return { - direction: null - }; - }, - - getDefaultProps: function () { - return { - animation: true - }; - }, - - handleAnimateOutEnd: function () { - if (this.props.onAnimateOutEnd && this.isMounted()) { - this.props.onAnimateOutEnd(this.props.index); - } - }, - - componentWillReceiveProps: function (nextProps) { - if (this.props.active !== nextProps.active) { - this.setState({ - direction: null - }); - } - }, - - componentDidUpdate: function (prevProps) { - if (!this.props.active && prevProps.active) { - TransitionEvents.addEndEventListener( - this.getDOMNode(), - this.handleAnimateOutEnd - ); - } - - if (this.props.active !== prevProps.active) { - setTimeout(this.startAnimation, 20); - } - }, - - startAnimation: function () { - if (!this.isMounted()) { - return; - } - - this.setState({ - direction: this.props.direction === 'prev' ? - 'right' : 'left' - }); - }, - - render: function () { - var classes = { - item: true, - active: (this.props.active && !this.props.animateIn) || this.props.animateOut, - next: this.props.active && this.props.animateIn && this.props.direction === 'next', - prev: this.props.active && this.props.animateIn && this.props.direction === 'prev' - }; - - if (this.state.direction && (this.props.animateIn || this.props.animateOut)) { - classes[this.state.direction] = true; - } - - return this.transferPropsTo( - React.DOM.div( {className:classSet(classes)}, - this.props.children, - this.props.caption ? this.renderCaption() : null - ) - ); - }, - - renderCaption: function () { - return ( - React.DOM.div( {className:"carousel-caption"}, - this.props.caption - ) - ); - } -}); - -module.exports = CarouselItem; -}); - -define('Col',['require','exports','module','react','./utils/classSet','./utils/CustomPropTypes','./constants'],function (require, exports, module) {/** @jsx React.DOM */ - -var React = require('react'); -var classSet = require('./utils/classSet'); -var CustomPropTypes = require('./utils/CustomPropTypes'); -var constants = require('./constants'); - - -var Col = React.createClass({displayName: 'Col', - propTypes: { - xs: React.PropTypes.number, - sm: React.PropTypes.number, - md: React.PropTypes.number, - lg: React.PropTypes.number, - xsOffset: React.PropTypes.number, - smOffset: React.PropTypes.number, - mdOffset: React.PropTypes.number, - lgOffset: React.PropTypes.number, - xsPush: React.PropTypes.number, - smPush: React.PropTypes.number, - mdPush: React.PropTypes.number, - lgPush: React.PropTypes.number, - xsPull: React.PropTypes.number, - smPull: React.PropTypes.number, - mdPull: React.PropTypes.number, - lgPull: React.PropTypes.number, - componentClass: CustomPropTypes.componentClass.isRequired - }, - - getDefaultProps: function () { - return { - componentClass: React.DOM.div - }; - }, - - render: function () { - var componentClass = this.props.componentClass; - var classes = {}; - - Object.keys(constants.SIZES).forEach(function (key) { - var size = constants.SIZES[key]; - var prop = size; - var classPart = size + '-'; - - if (this.props[prop]) { - classes['col-' + classPart + this.props[prop]] = true; - } - - prop = size + 'Offset'; - classPart = size + '-offset-'; - if (this.props[prop]) { - classes['col-' + classPart + this.props[prop]] = true; - } - - prop = size + 'Push'; - classPart = size + '-push-'; - if (this.props[prop]) { - classes['col-' + classPart + this.props[prop]] = true; - } - - prop = size + 'Pull'; - classPart = size + '-pull-'; - if (this.props[prop]) { - classes['col-' + classPart + this.props[prop]] = true; - } - }, this); - - return this.transferPropsTo( - componentClass( {className:classSet(classes)}, - this.props.children - ) - ); - } -}); - -module.exports = Col; -}); - -define('CollapsableMixin',['require','exports','module','react','./utils/TransitionEvents'],function (require, exports, module) {var React = require('react'); -var TransitionEvents = require('./utils/TransitionEvents'); - -var CollapsableMixin = { - - propTypes: { - collapsable: React.PropTypes.bool, - defaultExpanded: React.PropTypes.bool, - expanded: React.PropTypes.bool - }, - - getInitialState: function () { - return { - expanded: this.props.defaultExpanded != null ? this.props.defaultExpanded : null, - collapsing: false - }; - }, - - handleTransitionEnd: function () { - this._collapseEnd = true; - this.setState({ - collapsing: false - }); - }, - - componentWillReceiveProps: function (newProps) { - if (this.props.collapsable && newProps.expanded !== this.props.expanded) { - this._collapseEnd = false; - this.setState({ - collapsing: true - }); - } - }, - - _addEndTransitionListener: function () { - var node = this.getCollapsableDOMNode(); - - if (node) { - TransitionEvents.addEndEventListener( - node, - this.handleTransitionEnd - ); - } - }, - - _removeEndTransitionListener: function () { - var node = this.getCollapsableDOMNode(); - - if (node) { - TransitionEvents.addEndEventListener( - node, - this.handleTransitionEnd - ); - } - }, - - componentDidMount: function () { - this._afterRender(); - }, - - componentWillUnmount: function () { - this._removeEndTransitionListener(); - }, - - componentWillUpdate: function (nextProps) { - var dimension = (typeof this.getCollapsableDimension === 'function') ? - this.getCollapsableDimension() : 'height'; - var node = this.getCollapsableDOMNode(); - - this._removeEndTransitionListener(); - if (node && nextProps.expanded !== this.props.expanded && this.props.expanded) { - node.style[dimension] = this.getCollapsableDimensionValue() + 'px'; - } - }, - - componentDidUpdate: function (prevProps, prevState) { - if (this.state.collapsing !== prevState.collapsing) { - this._afterRender(); - } - }, - - _afterRender: function () { - if (!this.props.collapsable) { - return; - } - - this._addEndTransitionListener(); - setTimeout(this._updateDimensionAfterRender, 0); - }, - - _updateDimensionAfterRender: function () { - var dimension = (typeof this.getCollapsableDimension === 'function') ? - this.getCollapsableDimension() : 'height'; - var node = this.getCollapsableDOMNode(); - - if (node) { - if(this.isExpanded() && !this.state.collapsing) { - node.style[dimension] = 'auto'; - } else { - node.style[dimension] = this.isExpanded() ? - this.getCollapsableDimensionValue() + 'px' : '0px'; - } - } - }, - - isExpanded: function () { - return (this.props.expanded != null) ? - this.props.expanded : this.state.expanded; - }, - - getCollapsableClassSet: function (className) { - var classes = {}; - - if (typeof className === 'string') { - className.split(' ').forEach(function (className) { - if (className) { - classes[className] = true; - } - }); - } - - classes.collapsing = this.state.collapsing; - classes.collapse = !this.state.collapsing; - classes['in'] = this.isExpanded() && !this.state.collapsing; - - return classes; - } -}; - -module.exports = CollapsableMixin; -}); - -define('utils/createChainedFunction',['require','exports','module'],function (require, exports, module) {/** - * Safe chained function - * - * Will only create a new function if needed, - * otherwise will pass back existing functions or null. - * - * @param {function} one - * @param {function} two - * @returns {function|null} - */ -function createChainedFunction(one, two) { - var hasOne = typeof one === 'function'; - var hasTwo = typeof two === 'function'; - - if (!hasOne && !hasTwo) { return null; } - if (!hasOne) { return two; } - if (!hasTwo) { return one; } - - return function chainedFunction() { - one.apply(this, arguments); - two.apply(this, arguments); - }; -} - -module.exports = createChainedFunction; -}); - -define('DropdownStateMixin',['require','exports','module','react','./utils/EventListener'],function (require, exports, module) {var React = require('react'); -var EventListener = require('./utils/EventListener'); - -/** - * Checks whether a node is within - * a root nodes tree - * - * @param {DOMElement} node - * @param {DOMElement} root - * @returns {boolean} - */ -function isNodeInRoot(node, root) { - while (node) { - if (node === root) { - return true; - } - node = node.parentNode; - } - - return false; -} - -var DropdownStateMixin = { - getInitialState: function () { - return { - open: false - }; - }, - - setDropdownState: function (newState, onStateChangeComplete) { - if (newState) { - this.bindRootCloseHandlers(); - } else { - this.unbindRootCloseHandlers(); - } - - this.setState({ - open: newState - }, onStateChangeComplete); - }, - - handleDocumentKeyUp: function (e) { - if (e.keyCode === 27) { - this.setDropdownState(false); - } - }, - - handleDocumentClick: function (e) { - // If the click originated from within this component - // don't do anything. - if (isNodeInRoot(e.target, this.getDOMNode())) { - return; - } - - this.setDropdownState(false); - }, - - bindRootCloseHandlers: function () { - this._onDocumentClickListener = - EventListener.listen(document, 'click', this.handleDocumentClick); - this._onDocumentKeyupListener = - EventListener.listen(document, 'keyup', this.handleDocumentKeyUp); - }, - - unbindRootCloseHandlers: function () { - if (this._onDocumentClickListener) { - this._onDocumentClickListener.remove(); - } - - if (this._onDocumentKeyupListener) { - this._onDocumentKeyupListener.remove(); - } - }, - - componentWillUnmount: function () { - this.unbindRootCloseHandlers(); - } -}; - -module.exports = DropdownStateMixin; -}); - -define('DropdownMenu',['require','exports','module','react','./utils/classSet','./utils/cloneWithProps','./utils/createChainedFunction','./utils/ValidComponentChildren'],function (require, exports, module) {/** @jsx React.DOM */ - -var React = require('react'); -var classSet = require('./utils/classSet'); -var cloneWithProps = require('./utils/cloneWithProps'); -var createChainedFunction = require('./utils/createChainedFunction'); -var ValidComponentChildren = require('./utils/ValidComponentChildren'); - -var DropdownMenu = React.createClass({displayName: 'DropdownMenu', - propTypes: { - pullRight: React.PropTypes.bool, - onSelect: React.PropTypes.func - }, - - render: function () { - var classes = { - 'dropdown-menu': true, - 'dropdown-menu-right': this.props.pullRight - }; - - return this.transferPropsTo( - React.DOM.ul( - {className:classSet(classes), - role:"menu"}, - ValidComponentChildren.map(this.props.children, this.renderMenuItem) - ) - ); - }, - - renderMenuItem: function (child) { - return cloneWithProps( - child, - { - // Capture onSelect events - onSelect: createChainedFunction(child.props.onSelect, this.props.onSelect), - - // Force special props to be transferred - key: child.props.key, - ref: child.props.ref - } - ); - } -}); - -module.exports = DropdownMenu; -}); - -define('DropdownButton',['require','exports','module','react','./utils/classSet','./utils/cloneWithProps','./utils/createChainedFunction','./BootstrapMixin','./DropdownStateMixin','./Button','./ButtonGroup','./DropdownMenu','./utils/ValidComponentChildren'],function (require, exports, module) {/** @jsx React.DOM */ - -var React = require('react'); -var classSet = require('./utils/classSet'); -var cloneWithProps = require('./utils/cloneWithProps'); -var createChainedFunction = require('./utils/createChainedFunction'); -var BootstrapMixin = require('./BootstrapMixin'); -var DropdownStateMixin = require('./DropdownStateMixin'); -var Button = require('./Button'); -var ButtonGroup = require('./ButtonGroup'); -var DropdownMenu = require('./DropdownMenu'); -var ValidComponentChildren = require('./utils/ValidComponentChildren'); - - -var DropdownButton = React.createClass({displayName: 'DropdownButton', - mixins: [BootstrapMixin, DropdownStateMixin], - - propTypes: { - pullRight: React.PropTypes.bool, - dropup: React.PropTypes.bool, - title: React.PropTypes.renderable, - href: React.PropTypes.string, - onClick: React.PropTypes.func, - onSelect: React.PropTypes.func, - navItem: React.PropTypes.bool - }, - - render: function () { - var className = 'dropdown-toggle'; - - var renderMethod = this.props.navItem ? - 'renderNavItem' : 'renderButtonGroup'; - - return this[renderMethod]([ - this.transferPropsTo(Button( - {ref:"dropdownButton", - className:className, - onClick:this.handleDropdownClick, - key:0, - navDropdown:this.props.navItem, - navItem:null, - title:null, - pullRight:null, - dropup:null}, - this.props.title,' ', - React.DOM.span( {className:"caret"} ) - )), - DropdownMenu( - {ref:"menu", - 'aria-labelledby':this.props.id, - pullRight:this.props.pullRight, - key:1}, - ValidComponentChildren.map(this.props.children, this.renderMenuItem) - ) - ]); - }, - - renderButtonGroup: function (children) { - var groupClasses = { - 'open': this.state.open, - 'dropup': this.props.dropup - }; - - return ( - ButtonGroup( - {bsSize:this.props.bsSize, - className:classSet(groupClasses)}, - children - ) - ); - }, - - renderNavItem: function (children) { - var classes = { - 'dropdown': true, - 'open': this.state.open, - 'dropup': this.props.dropup - }; - - return ( - React.DOM.li( {className:classSet(classes)}, - children - ) - ); - }, - - renderMenuItem: function (child) { - // Only handle the option selection if an onSelect prop has been set on the - // component or it's child, this allows a user not to pass an onSelect - // handler and have the browser preform the default action. - var handleOptionSelect = this.props.onSelect || child.props.onSelect ? - this.handleOptionSelect : null; - - return cloneWithProps( - child, - { - // Capture onSelect events - onSelect: createChainedFunction(child.props.onSelect, handleOptionSelect), - - // Force special props to be transferred - key: child.props.key, - ref: child.props.ref - } - ); - }, - - handleDropdownClick: function (e) { - e.preventDefault(); - - this.setDropdownState(!this.state.open); - }, - - handleOptionSelect: function (key) { - if (this.props.onSelect) { - this.props.onSelect(key); - } - - this.setDropdownState(false); - } -}); - -module.exports = DropdownButton; -}); - -define('FadeMixin',['require','exports','module','react'],function (require, exports, module) {var React = require('react'); - -// TODO: listen for onTransitionEnd to remove el -module.exports = { - _fadeIn: function () { - var els; - - if (this.isMounted()) { - els = this.getDOMNode().querySelectorAll('.fade'); - if (els.length) { - Array.prototype.forEach.call(els, function (el) { - el.className += ' in'; - }); - } - } - }, - - _fadeOut: function () { - var els = this._fadeOutEl.querySelectorAll('.fade.in'); - - if (els.length) { - Array.prototype.forEach.call(els, function (el) { - el.className = el.className.replace(/\bin\b/, ''); - }); - } - - setTimeout(this._handleFadeOutEnd, 300); - }, - - _handleFadeOutEnd: function () { - if (this._fadeOutEl && this._fadeOutEl.parentNode) { - this._fadeOutEl.parentNode.removeChild(this._fadeOutEl); - } - }, - - componentDidMount: function () { - if (document.querySelectorAll) { - // Firefox needs delay for transition to be triggered - setTimeout(this._fadeIn, 20); - } - }, - - componentWillUnmount: function () { - var els = this.getDOMNode().querySelectorAll('.fade'); - if (els.length) { - this._fadeOutEl = document.createElement('div'); - document.body.appendChild(this._fadeOutEl); - this._fadeOutEl.appendChild(this.getDOMNode().cloneNode(true)); - // Firefox needs delay for transition to be triggered - setTimeout(this._fadeOut, 20); - } - } -}; - -}); - -define('Glyphicon',['require','exports','module','react','./utils/classSet','./BootstrapMixin','./constants'],function (require, exports, module) {/** @jsx React.DOM */ - -var React = require('react'); -var classSet = require('./utils/classSet'); -var BootstrapMixin = require('./BootstrapMixin'); -var constants = require('./constants'); - -var Glyphicon = React.createClass({displayName: 'Glyphicon', - mixins: [BootstrapMixin], - - propTypes: { - glyph: React.PropTypes.oneOf(constants.GLYPHS).isRequired - }, - - getDefaultProps: function () { - return { - bsClass: 'glyphicon' - }; - }, - - render: function () { - var classes = this.getBsClassSet(); - - classes['glyphicon-' + this.props.glyph] = true; - - return this.transferPropsTo( - React.DOM.span( {className:classSet(classes)}, - this.props.children - ) - ); - } -}); - -module.exports = Glyphicon; -}); - -define('Grid',['require','exports','module','react','./utils/CustomPropTypes'],function (require, exports, module) {/** @jsx React.DOM */ - -var React = require('react'); -var CustomPropTypes = require('./utils/CustomPropTypes'); - - -var Grid = React.createClass({displayName: 'Grid', - propTypes: { - fluid: React.PropTypes.bool, - componentClass: CustomPropTypes.componentClass.isRequired - }, - - getDefaultProps: function () { - return { - componentClass: React.DOM.div - }; - }, - - render: function () { - var componentClass = this.props.componentClass; - - return this.transferPropsTo( - componentClass( {className:this.props.fluid ? 'container-fluid' : 'container'}, - this.props.children - ) - ); - } -}); - -module.exports = Grid; -}); - -define('Input',['require','exports','module','react','./utils/classSet','./Button'],function (require, exports, module) {/** @jsx React.DOM */ - -var React = require('react'); -var classSet = require('./utils/classSet'); -var Button = require('./Button'); - -var Input = React.createClass({displayName: 'Input', - propTypes: { - type: React.PropTypes.string, - label: React.PropTypes.renderable, - help: React.PropTypes.renderable, - addonBefore: React.PropTypes.renderable, - addonAfter: React.PropTypes.renderable, - bsStyle: function(props) { - if (props.type === 'submit') { - // Return early if `type=submit` as the `Button` component - // it transfers these props to has its own propType checks. - return; - } - - return React.PropTypes.oneOf(['success', 'warning', 'error']).apply(null, arguments); - }, - hasFeedback: React.PropTypes.bool, - groupClassName: React.PropTypes.string, - wrapperClassName: React.PropTypes.string, - labelClassName: React.PropTypes.string - }, - - getInputDOMNode: function () { - return this.refs.input.getDOMNode(); - }, - - getValue: function () { - if (this.props.type === 'static') { - return this.props.value; - } - else if (this.props.type) { - return this.getInputDOMNode().value; - } - else { - throw Error('Cannot use getValue without specifying input type.'); - } - }, - - getChecked: function () { - return this.getInputDOMNode().checked; - }, - - isCheckboxOrRadio: function () { - return this.props.type === 'radio' || this.props.type === 'checkbox'; - }, - - renderInput: function () { - var input = null; - - if (!this.props.type) { - return this.props.children - } - - switch (this.props.type) { - case 'select': - input = ( - React.DOM.select( {className:"form-control", ref:"input", key:"input"}, - this.props.children - ) - ); - break; - case 'textarea': - input = React.DOM.textarea( {className:"form-control", ref:"input", key:"input"} ); - break; - case 'static': - input = ( - React.DOM.p( {className:"form-control-static", ref:"input", key:"input"}, - this.props.value - ) - ); - break; - case 'submit': - input = this.transferPropsTo( - Button( {componentClass:React.DOM.input} ) - ); - break; - default: - var className = this.isCheckboxOrRadio() ? '' : 'form-control'; - input = React.DOM.input( {className:className, ref:"input", key:"input"} ); - } - - return this.transferPropsTo(input); - }, - - renderInputGroup: function (children) { - var addonBefore = this.props.addonBefore ? ( - React.DOM.span( {className:"input-group-addon", key:"addonBefore"}, - this.props.addonBefore - ) - ) : null; - - var addonAfter = this.props.addonAfter ? ( - React.DOM.span( {className:"input-group-addon", key:"addonAfter"}, - this.props.addonAfter - ) - ) : null; - - return addonBefore || addonAfter ? ( - React.DOM.div( {className:"input-group", key:"input-group"}, - addonBefore, - children, - addonAfter - ) - ) : children; - }, - - renderIcon: function () { - var classes = { - 'glyphicon': true, - 'form-control-feedback': true, - 'glyphicon-ok': this.props.bsStyle === 'success', - 'glyphicon-warning-sign': this.props.bsStyle === 'warning', - 'glyphicon-remove': this.props.bsStyle === 'error' - }; - - return this.props.hasFeedback ? ( - React.DOM.span( {className:classSet(classes), key:"icon"} ) - ) : null; - }, - - renderHelp: function () { - return this.props.help ? ( - React.DOM.span( {className:"help-block", key:"help"}, - this.props.help - ) - ) : null; - }, - - renderCheckboxandRadioWrapper: function (children) { - var classes = { - 'checkbox': this.props.type === 'checkbox', - 'radio': this.props.type === 'radio' - }; - - return ( - React.DOM.div( {className:classSet(classes), key:"checkboxRadioWrapper"}, - children - ) - ); - }, - - renderWrapper: function (children) { - return this.props.wrapperClassName ? ( - React.DOM.div( {className:this.props.wrapperClassName, key:"wrapper"}, - children - ) - ) : children; - }, - - renderLabel: function (children) { - var classes = { - 'control-label': !this.isCheckboxOrRadio() - }; - classes[this.props.labelClassName] = this.props.labelClassName; - - return this.props.label ? ( - React.DOM.label( {htmlFor:this.props.id, className:classSet(classes), key:"label"}, - children, - this.props.label - ) - ) : children; - }, - - renderFormGroup: function (children) { - var classes = { - 'form-group': true, - 'has-feedback': this.props.hasFeedback, - 'has-success': this.props.bsStyle === 'success', - 'has-warning': this.props.bsStyle === 'warning', - 'has-error': this.props.bsStyle === 'error' - }; - classes[this.props.groupClassName] = this.props.groupClassName; - - return ( - React.DOM.div( {className:classSet(classes)}, - children - ) - ); - }, - - render: function () { - if (this.isCheckboxOrRadio()) { - return this.renderFormGroup( - this.renderWrapper([ - this.renderCheckboxandRadioWrapper( - this.renderLabel( - this.renderInput() - ) - ), - this.renderHelp() - ]) - ); - } - else { - return this.renderFormGroup([ - this.renderLabel(), - this.renderWrapper([ - this.renderInputGroup( - this.renderInput() - ), - this.renderIcon(), - this.renderHelp() - ]) - ]); - } - } +},{}]},{},[10]) +(10) }); - -module.exports = Input; - -}); - -define('Interpolate',['require','exports','module','react','./utils/merge','./utils/ValidComponentChildren'],function (require, exports, module) {// https://www.npmjs.org/package/react-interpolate-component - - -var React = require('react'); -var merge = require('./utils/merge'); -var ValidComponentChildren = require('./utils/ValidComponentChildren'); - -var REGEXP = /\%\((.+?)\)s/; - -var Interpolate = React.createClass({ - displayName: 'Interpolate', - - propTypes: { - format: React.PropTypes.string - }, - - getDefaultProps: function() { - return { component: React.DOM.span }; - }, - - render: function() { - var format = ValidComponentChildren.hasValidComponent(this.props.children) ? this.props.children : this.props.format; - var parent = this.props.component; - var unsafe = this.props.unsafe === true; - var props = merge(this.props); - - delete props.children; - delete props.format; - delete props.component; - delete props.unsafe; - - if (unsafe) { - var content = format.split(REGEXP).reduce(function(memo, match, index) { - var html; - - if (index % 2 === 0) { - html = match; - } else { - html = props[match]; - delete props[match]; - } - - if (React.isValidComponent(html)) { - throw new Error('cannot interpolate a React component into unsafe text'); - } - - memo += html; - - return memo; - }, ''); - - props.dangerouslySetInnerHTML = { __html: content }; - - return parent(props); - } else { - var args = format.split(REGEXP).reduce(function(memo, match, index) { - var child; - - if (index % 2 === 0) { - if (match.length === 0) { - return memo; - } - - child = match; - } else { - child = props[match]; - delete props[match]; - } - - memo.push(child); - - return memo; - }, [props]); - - return parent.apply(null, args); - } - } -}); - -module.exports = Interpolate; - -}); - -define('Jumbotron',['require','exports','module','react'],function (require, exports, module) {/** @jsx React.DOM */ - -var React = require('react'); - -var Jumbotron = React.createClass({displayName: 'Jumbotron', - - render: function () { - return this.transferPropsTo( - React.DOM.div( {className:"jumbotron"}, - this.props.children - ) - ); - } -}); - -module.exports = Jumbotron; -}); - -define('Label',['require','exports','module','react','./utils/classSet','./BootstrapMixin'],function (require, exports, module) {/** @jsx React.DOM */ - -var React = require('react'); -var classSet = require('./utils/classSet'); -var BootstrapMixin = require('./BootstrapMixin'); - -var Label = React.createClass({displayName: 'Label', - mixins: [BootstrapMixin], - - getDefaultProps: function () { - return { - bsClass: 'label', - bsStyle: 'default' - }; - }, - - render: function () { - var classes = this.getBsClassSet(); - - return this.transferPropsTo( - React.DOM.span( {className:classSet(classes)}, - this.props.children - ) - ); - } -}); - -module.exports = Label; -}); - -define('ListGroup',['require','exports','module','react','./utils/classSet','./utils/cloneWithProps','./utils/ValidComponentChildren','./utils/createChainedFunction'],function (require, exports, module) {/** @jsx React.DOM */ - -var React = require('react'); -var classSet = require('./utils/classSet'); -var cloneWithProps = require('./utils/cloneWithProps'); -var ValidComponentChildren = require('./utils/ValidComponentChildren'); -var createChainedFunction = require('./utils/createChainedFunction'); - -var ListGroup = React.createClass({displayName: 'ListGroup', - propTypes: { - onClick: React.PropTypes.func - }, - - render: function () { - return ( - React.DOM.div( {className:"list-group"}, - ValidComponentChildren.map(this.props.children, this.renderListItem) - ) - ); - }, - - renderListItem: function (child) { - return cloneWithProps(child, { - onClick: createChainedFunction(child.props.onClick, this.props.onClick), - ref: child.props.ref, - key: child.props.key - }); - } -}); - -module.exports = ListGroup; - -}); - -define('ListGroupItem',['require','exports','module','react','./BootstrapMixin','./utils/classSet','./utils/cloneWithProps','./utils/ValidComponentChildren'],function (require, exports, module) {/** @jsx React.DOM */ - -var React = require('react'); -var BootstrapMixin = require('./BootstrapMixin'); -var classSet = require('./utils/classSet'); -var cloneWithProps = require('./utils/cloneWithProps'); -var ValidComponentChildren = require('./utils/ValidComponentChildren'); - -var ListGroupItem = React.createClass({displayName: 'ListGroupItem', - mixins: [BootstrapMixin], - - propTypes: { - bsStyle: React.PropTypes.oneOf(['danger','info','success','warning']), - active: React.PropTypes.any, - disabled: React.PropTypes.any, - header: React.PropTypes.renderable, - onClick: React.PropTypes.func - }, - - getDefaultProps: function () { - return { - bsClass: 'list-group-item' - }; - }, - - render: function () { - var classes = this.getBsClassSet(); - - classes['active'] = this.props.active; - classes['disabled'] = this.props.disabled; - - if (this.props.href || this.props.onClick) { - return this.renderAnchor(classes); - } else { - return this.renderSpan(classes); - } - }, - - renderSpan: function (classes) { - return this.transferPropsTo( - React.DOM.span( {className:classSet(classes)}, - this.props.header ? this.renderStructuredContent() : this.props.children - ) - ); - }, - - renderAnchor: function (classes) { - return this.transferPropsTo( - React.DOM.a( - {className:classSet(classes), - onClick:this.handleClick}, - this.props.header ? this.renderStructuredContent() : this.props.children - ) - ); - }, - - renderStructuredContent: function () { - var header; - if (React.isValidComponent(this.props.header)) { - header = cloneWithProps(this.props.header, { - className: 'list-group-item-heading' - }); - } else { - header = ( - React.DOM.h4( {className:"list-group-item-heading"}, - this.props.header - ) - ); - } - - var content = ( - React.DOM.p( {className:"list-group-item-text"}, - this.props.children - ) - ); - - return { - header: header, - content: content - }; - }, - - handleClick: function (e) { - if (this.props.onClick) { - e.preventDefault(); - this.props.onClick(this.props.key, this.props.href); - } - } -}); - -module.exports = ListGroupItem; - -}); - -define('MenuItem',['require','exports','module','react','./utils/classSet'],function (require, exports, module) {/** @jsx React.DOM */ - -var React = require('react'); -var classSet = require('./utils/classSet'); - -var MenuItem = React.createClass({displayName: 'MenuItem', - propTypes: { - header: React.PropTypes.bool, - divider: React.PropTypes.bool, - href: React.PropTypes.string, - title: React.PropTypes.string, - onSelect: React.PropTypes.func - }, - - getDefaultProps: function () { - return { - href: '#' - }; - }, - - handleClick: function (e) { - if (this.props.onSelect) { - e.preventDefault(); - this.props.onSelect(this.props.key); - } - }, - - renderAnchor: function () { - return ( - React.DOM.a( {onClick:this.handleClick, href:this.props.href, title:this.props.title, tabIndex:"-1"}, - this.props.children - ) - ); - }, - - render: function () { - var classes = { - 'dropdown-header': this.props.header, - 'divider': this.props.divider - }; - - var children = null; - if (this.props.header) { - children = this.props.children; - } else if (!this.props.divider) { - children = this.renderAnchor(); - } - - return this.transferPropsTo( - React.DOM.li( {role:"presentation", title:null, href:null, className:classSet(classes)}, - children - ) - ); - } -}); - -module.exports = MenuItem; -}); - -define('Modal',['require','exports','module','react','./utils/classSet','./BootstrapMixin','./FadeMixin','./utils/EventListener'],function (require, exports, module) {/** @jsx React.DOM */ -/* global document:false */ - -var React = require('react'); -var classSet = require('./utils/classSet'); -var BootstrapMixin = require('./BootstrapMixin'); -var FadeMixin = require('./FadeMixin'); -var EventListener = require('./utils/EventListener'); - - -// TODO: -// - aria-labelledby -// - Add `modal-body` div if only one child passed in that doesn't already have it -// - Tests - -var Modal = React.createClass({displayName: 'Modal', - mixins: [BootstrapMixin, FadeMixin], - - propTypes: { - title: React.PropTypes.renderable, - backdrop: React.PropTypes.oneOf(['static', true, false]), - keyboard: React.PropTypes.bool, - closeButton: React.PropTypes.bool, - animation: React.PropTypes.bool, - onRequestHide: React.PropTypes.func.isRequired - }, - - getDefaultProps: function () { - return { - bsClass: 'modal', - backdrop: true, - keyboard: true, - animation: true, - closeButton: true - }; - }, - - render: function () { - var modalStyle = {display: 'block'}; - var dialogClasses = this.getBsClassSet(); - delete dialogClasses.modal; - dialogClasses['modal-dialog'] = true; - - var classes = { - modal: true, - fade: this.props.animation, - 'in': !this.props.animation || !document.querySelectorAll - }; - - var modal = this.transferPropsTo( - React.DOM.div( - {title:null, - tabIndex:"-1", - role:"dialog", - style:modalStyle, - className:classSet(classes), - onClick:this.props.backdrop === true ? this.handleBackdropClick : null, - ref:"modal"}, - React.DOM.div( {className:classSet(dialogClasses)}, - React.DOM.div( {className:"modal-content"}, - this.props.title ? this.renderHeader() : null, - this.props.children - ) - ) - ) - ); - - return this.props.backdrop ? - this.renderBackdrop(modal) : modal; - }, - - renderBackdrop: function (modal) { - var classes = { - 'modal-backdrop': true, - 'fade': this.props.animation - }; - - classes['in'] = !this.props.animation || !document.querySelectorAll; - - var onClick = this.props.backdrop === true ? - this.handleBackdropClick : null; - - return ( - React.DOM.div(null, - React.DOM.div( {className:classSet(classes), ref:"backdrop", onClick:onClick} ), - modal - ) - ); - }, - - renderHeader: function () { - var closeButton; - if (this.props.closeButton) { - closeButton = ( - React.DOM.button( {type:"button", className:"close", 'aria-hidden':"true", onClick:this.props.onRequestHide}, "×") - ); - } - - return ( - React.DOM.div( {className:"modal-header"}, - closeButton, - this.renderTitle() - ) - ); - }, - - renderTitle: function () { - return ( - React.isValidComponent(this.props.title) ? - this.props.title : React.DOM.h4( {className:"modal-title"}, this.props.title) - ); - }, - - iosClickHack: function () { - // IOS only allows click events to be delegated to the document on elements - // it considers 'clickable' - anchors, buttons, etc. We fake a click handler on the - // DOM nodes themselves. Remove if handled by React: https://github.com/facebook/react/issues/1169 - this.refs.modal.getDOMNode().onclick = function () {}; - this.refs.backdrop.getDOMNode().onclick = function () {}; - }, - - componentDidMount: function () { - this._onDocumentKeyupListener = - EventListener.listen(document, 'keyup', this.handleDocumentKeyUp); - - if (this.props.backdrop) { - this.iosClickHack(); - } - }, - - componentDidUpdate: function (prevProps) { - if (this.props.backdrop && this.props.backdrop !== prevProps.backdrop) { - this.iosClickHack(); - } - }, - - componentWillUnmount: function () { - this._onDocumentKeyupListener.remove(); - }, - - handleBackdropClick: function (e) { - if (e.target !== e.currentTarget) { - return; - } - - this.props.onRequestHide(); - }, - - handleDocumentKeyUp: function (e) { - if (this.props.keyboard && e.keyCode === 27) { - this.props.onRequestHide(); - } - } -}); - -module.exports = Modal; - -}); - -define('Nav',['require','exports','module','react','./BootstrapMixin','./CollapsableMixin','./utils/classSet','./utils/domUtils','./utils/cloneWithProps','./utils/ValidComponentChildren','./utils/createChainedFunction'],function (require, exports, module) {/** @jsx React.DOM */ - -var React = require('react'); -var BootstrapMixin = require('./BootstrapMixin'); -var CollapsableMixin = require('./CollapsableMixin'); -var classSet = require('./utils/classSet'); -var domUtils = require('./utils/domUtils'); -var cloneWithProps = require('./utils/cloneWithProps'); -var ValidComponentChildren = require('./utils/ValidComponentChildren'); -var createChainedFunction = require('./utils/createChainedFunction'); - - -var Nav = React.createClass({displayName: 'Nav', - mixins: [BootstrapMixin, CollapsableMixin], - - propTypes: { - bsStyle: React.PropTypes.oneOf(['tabs','pills']), - stacked: React.PropTypes.bool, - justified: React.PropTypes.bool, - onSelect: React.PropTypes.func, - collapsable: React.PropTypes.bool, - expanded: React.PropTypes.bool, - navbar: React.PropTypes.bool - }, - - getDefaultProps: function () { - return { - bsClass: 'nav' - }; - }, - - getCollapsableDOMNode: function () { - return this.getDOMNode(); - }, - - getCollapsableDimensionValue: function () { - var node = this.refs.ul.getDOMNode(), - height = node.offsetHeight, - computedStyles = domUtils.getComputedStyles(node); - - return height + parseInt(computedStyles.marginTop, 10) + parseInt(computedStyles.marginBottom, 10); - }, - - render: function () { - var classes = this.props.collapsable ? this.getCollapsableClassSet() : {}; - - classes['navbar-collapse'] = this.props.collapsable; - - if (this.props.navbar && !this.props.collapsable) { - return this.transferPropsTo(this.renderUl()); - } - - return this.transferPropsTo( - React.DOM.nav( {className:classSet(classes)}, - this.renderUl() - ) - ); - }, - - renderUl: function () { - var classes = this.getBsClassSet(); - - classes['nav-stacked'] = this.props.stacked; - classes['nav-justified'] = this.props.justified; - classes['navbar-nav'] = this.props.navbar; - classes['pull-right'] = this.props.pullRight; - - return ( - React.DOM.ul( {className:classSet(classes), ref:"ul"}, - ValidComponentChildren.map(this.props.children, this.renderNavItem) - ) - ); - }, - - getChildActiveProp: function (child) { - if (child.props.active) { - return true; - } - if (this.props.activeKey != null) { - if (child.props.key === this.props.activeKey) { - return true; - } - } - if (this.props.activeHref != null) { - if (child.props.href === this.props.activeHref) { - return true; - } - } - - return child.props.active; - }, - - renderNavItem: function (child) { - return cloneWithProps( - child, - { - active: this.getChildActiveProp(child), - activeKey: this.props.activeKey, - activeHref: this.props.activeHref, - onSelect: createChainedFunction(child.props.onSelect, this.props.onSelect), - ref: child.props.ref, - key: child.props.key, - navItem: true - } - ); - } -}); - -module.exports = Nav; - -}); - -define('Navbar',['require','exports','module','react','./BootstrapMixin','./utils/CustomPropTypes','./utils/classSet','./utils/cloneWithProps','./utils/ValidComponentChildren','./utils/createChainedFunction','./Nav'],function (require, exports, module) {/** @jsx React.DOM */ - -var React = require('react'); -var BootstrapMixin = require('./BootstrapMixin'); -var CustomPropTypes = require('./utils/CustomPropTypes'); -var classSet = require('./utils/classSet'); -var cloneWithProps = require('./utils/cloneWithProps'); -var ValidComponentChildren = require('./utils/ValidComponentChildren'); -var createChainedFunction = require('./utils/createChainedFunction'); -var Nav = require('./Nav'); - - -var Navbar = React.createClass({displayName: 'Navbar', - mixins: [BootstrapMixin], - - propTypes: { - fixedTop: React.PropTypes.bool, - fixedBottom: React.PropTypes.bool, - staticTop: React.PropTypes.bool, - inverse: React.PropTypes.bool, - fluid: React.PropTypes.bool, - role: React.PropTypes.string, - componentClass: CustomPropTypes.componentClass.isRequired, - brand: React.PropTypes.renderable, - toggleButton: React.PropTypes.renderable, - onToggle: React.PropTypes.func, - navExpanded: React.PropTypes.bool, - defaultNavExpanded: React.PropTypes.bool - }, - - getDefaultProps: function () { - return { - bsClass: 'navbar', - bsStyle: 'default', - role: 'navigation', - componentClass: React.DOM.nav - }; - }, - - getInitialState: function () { - return { - navExpanded: this.props.defaultNavExpanded - }; - }, - - shouldComponentUpdate: function() { - // Defer any updates to this component during the `onSelect` handler. - return !this._isChanging; - }, - - handleToggle: function () { - if (this.props.onToggle) { - this._isChanging = true; - this.props.onToggle(); - this._isChanging = false; - } - - this.setState({ - navOpen: !this.state.navOpen - }); - }, - - isNavOpen: function () { - return this.props.navOpen != null ? this.props.navOpen : this.state.navOpen; - }, - - render: function () { - var classes = this.getBsClassSet(); - var componentClass = this.props.componentClass; - - classes['navbar-fixed-top'] = this.props.fixedTop; - classes['navbar-fixed-bottom'] = this.props.fixedBottom; - classes['navbar-static-top'] = this.props.staticTop; - classes['navbar-inverse'] = this.props.inverse; - - return this.transferPropsTo( - componentClass( {className:classSet(classes)}, - React.DOM.div( {className:this.props.fluid ? 'container-fluid' : 'container'}, - (this.props.brand || this.props.toggleButton || this.props.toggleNavKey) ? this.renderHeader() : null, - ValidComponentChildren.map(this.props.children, this.renderChild) - ) - ) - ); - }, - - renderChild: function (child) { - return cloneWithProps(child, { - navbar: true, - collapsable: this.props.toggleNavKey != null && this.props.toggleNavKey === child.props.key, - expanded: this.props.toggleNavKey != null && this.props.toggleNavKey === child.props.key && this.isNavOpen(), - key: child.props.key, - ref: child.props.ref - }); - }, - - renderHeader: function () { - var brand; - - if (this.props.brand) { - brand = React.isValidComponent(this.props.brand) ? - cloneWithProps(this.props.brand, { - className: 'navbar-brand' - }) : React.DOM.span( {className:"navbar-brand"}, this.props.brand); - } - - return ( - React.DOM.div( {className:"navbar-header"}, - brand, - (this.props.toggleButton || this.props.toggleNavKey != null) ? this.renderToggleButton() : null - ) - ); - }, - - renderToggleButton: function () { - var children; - - if (React.isValidComponent(this.props.toggleButton)) { - return cloneWithProps(this.props.toggleButton, { - className: 'navbar-toggle', - onClick: createChainedFunction(this.handleToggle, this.props.toggleButton.props.onClick) - }); - } - - children = (this.props.toggleButton != null) ? - this.props.toggleButton : [ - React.DOM.span( {className:"sr-only", key:0}, "Toggle navigation"), - React.DOM.span( {className:"icon-bar", key:1}), - React.DOM.span( {className:"icon-bar", key:2}), - React.DOM.span( {className:"icon-bar", key:3}) - ]; - - return ( - React.DOM.button( {className:"navbar-toggle", type:"button", onClick:this.handleToggle}, - children - ) - ); - } -}); - -module.exports = Navbar; - -}); - -define('NavItem',['require','exports','module','react','./utils/classSet','./BootstrapMixin'],function (require, exports, module) {/** @jsx React.DOM */ - -var React = require('react'); -var classSet = require('./utils/classSet'); -var BootstrapMixin = require('./BootstrapMixin'); - -var NavItem = React.createClass({displayName: 'NavItem', - mixins: [BootstrapMixin], - - propTypes: { - onSelect: React.PropTypes.func, - active: React.PropTypes.bool, - disabled: React.PropTypes.bool, - href: React.PropTypes.string, - title: React.PropTypes.string - }, - - getDefaultProps: function () { - return { - href: '#' - }; - }, - - render: function () { - var classes = { - 'active': this.props.active, - 'disabled': this.props.disabled - }; - - return this.transferPropsTo( - React.DOM.li( {className:classSet(classes)}, - React.DOM.a( - {href:this.props.href, - title:this.props.title, - onClick:this.handleClick, - ref:"anchor"}, - this.props.children - ) - ) - ); - }, - - handleClick: function (e) { - if (this.props.onSelect) { - e.preventDefault(); - - if (!this.props.disabled) { - this.props.onSelect(this.props.key,this.props.href); - } - } - } -}); - -module.exports = NavItem; -}); - -define('OverlayMixin',['require','exports','module','react','./utils/CustomPropTypes'],function (require, exports, module) {var React = require('react'); -var CustomPropTypes = require('./utils/CustomPropTypes'); - -module.exports = { - propTypes: { - container: CustomPropTypes.mountable - }, - - getDefaultProps: function () { - return { - container: { - // Provide `getDOMNode` fn mocking a React component API. The `document.body` - // reference needs to be contained within this function so that it is not accessed - // in environments where it would not be defined, e.g. nodejs. Equally this is needed - // before the body is defined where `document.body === null`, this ensures - // `document.body` is only accessed after componentDidMount. - getDOMNode: function getDOMNode() { - return document.body; - } - } - }; - }, - - componentWillUnmount: function () { - this._unrenderOverlay(); - if (this._overlayTarget) { - this.getContainerDOMNode() - .removeChild(this._overlayTarget); - this._overlayTarget = null; - } - }, - - componentDidUpdate: function () { - this._renderOverlay(); - }, - - componentDidMount: function () { - this._renderOverlay(); - }, - - _mountOverlayTarget: function () { - this._overlayTarget = document.createElement('div'); - this.getContainerDOMNode() - .appendChild(this._overlayTarget); - }, - - _renderOverlay: function () { - if (!this._overlayTarget) { - this._mountOverlayTarget(); - } - - // Save reference to help testing - this._overlayInstance = React.renderComponent(this.renderOverlay(), this._overlayTarget); - }, - - _unrenderOverlay: function () { - React.unmountComponentAtNode(this._overlayTarget); - this._overlayInstance = null; - }, - - getOverlayDOMNode: function () { - if (!this.isMounted()) { - throw new Error('getOverlayDOMNode(): A component must be mounted to have a DOM node.'); - } - - return this._overlayInstance.getDOMNode(); - }, - - getContainerDOMNode: function () { - return this.props.container.getDOMNode ? - this.props.container.getDOMNode() : this.props.container; - } -}; - -}); - -define('ModalTrigger',['require','exports','module','react','./OverlayMixin','./utils/cloneWithProps','./utils/createChainedFunction'],function (require, exports, module) {/** @jsx React.DOM */ - -var React = require('react'); -var OverlayMixin = require('./OverlayMixin'); -var cloneWithProps = require('./utils/cloneWithProps'); -var createChainedFunction = require('./utils/createChainedFunction'); - -var ModalTrigger = React.createClass({displayName: 'ModalTrigger', - mixins: [OverlayMixin], - - propTypes: { - modal: React.PropTypes.renderable.isRequired - }, - - getInitialState: function () { - return { - isOverlayShown: false - }; - }, - - show: function () { - this.setState({ - isOverlayShown: true - }); - }, - - hide: function () { - this.setState({ - isOverlayShown: false - }); - }, - - toggle: function () { - this.setState({ - isOverlayShown: !this.state.isOverlayShown - }); - }, - - renderOverlay: function () { - if (!this.state.isOverlayShown) { - return React.DOM.span(null ); - } - - return cloneWithProps( - this.props.modal, - { - onRequestHide: this.hide - } - ); - }, - - render: function () { - var child = React.Children.only(this.props.children); - return cloneWithProps( - child, - { - onClick: createChainedFunction(child.props.onClick, this.toggle) - } - ); - } -}); - -module.exports = ModalTrigger; -}); - -define('OverlayTrigger',['require','exports','module','react','./OverlayMixin','./utils/domUtils','./utils/cloneWithProps','./utils/createChainedFunction','./utils/merge'],function (require, exports, module) {/** @jsx React.DOM */ - -var React = require('react'); -var OverlayMixin = require('./OverlayMixin'); -var domUtils = require('./utils/domUtils'); -var cloneWithProps = require('./utils/cloneWithProps'); -var createChainedFunction = require('./utils/createChainedFunction'); -var merge = require('./utils/merge'); - -/** - * Check if value one is inside or equal to the of value - * - * @param {string} one - * @param {string|array} of - * @returns {boolean} - */ -function isOneOf(one, of) { - if (Array.isArray(of)) { - return of.indexOf(one) >= 0; - } - return one === of; -} - -var OverlayTrigger = React.createClass({displayName: 'OverlayTrigger', - mixins: [OverlayMixin], - - propTypes: { - trigger: React.PropTypes.oneOfType([ - React.PropTypes.oneOf(['manual', 'click', 'hover', 'focus']), - React.PropTypes.arrayOf(React.PropTypes.oneOf(['click', 'hover', 'focus'])) - ]), - placement: React.PropTypes.oneOf(['top','right', 'bottom', 'left']), - delay: React.PropTypes.number, - delayShow: React.PropTypes.number, - delayHide: React.PropTypes.number, - defaultOverlayShown: React.PropTypes.bool, - overlay: React.PropTypes.renderable.isRequired - }, - - getDefaultProps: function () { - return { - placement: 'right', - trigger: ['hover', 'focus'] - }; - }, - - getInitialState: function () { - return { - isOverlayShown: this.props.defaultOverlayShown == null ? - false : this.props.defaultOverlayShown, - overlayLeft: null, - overlayTop: null - }; - }, - - show: function () { - this.setState({ - isOverlayShown: true - }, function() { - this.updateOverlayPosition(); - }); - }, - - hide: function () { - this.setState({ - isOverlayShown: false - }); - }, - - toggle: function () { - this.state.isOverlayShown ? - this.hide() : this.show(); - }, - - renderOverlay: function () { - if (!this.state.isOverlayShown) { - return React.DOM.span(null ); - } - - return cloneWithProps( - this.props.overlay, - { - onRequestHide: this.hide, - placement: this.props.placement, - positionLeft: this.state.overlayLeft, - positionTop: this.state.overlayTop - } - ); - }, - - render: function () { - if (this.props.trigger === 'manual') { - return React.Children.only(this.props.children); - } - - var props = {}; - - if (isOneOf('click', this.props.trigger)) { - props.onClick = createChainedFunction(this.toggle, this.props.onClick); - } - - if (isOneOf('hover', this.props.trigger)) { - props.onMouseOver = createChainedFunction(this.handleDelayedShow, this.props.onMouseOver); - props.onMouseOut = createChainedFunction(this.handleDelayedHide, this.props.onMouseOut); - } - - if (isOneOf('focus', this.props.trigger)) { - props.onFocus = createChainedFunction(this.handleDelayedShow, this.props.onFocus); - props.onBlur = createChainedFunction(this.handleDelayedHide, this.props.onBlur); - } - - return cloneWithProps( - React.Children.only(this.props.children), - props - ); - }, - - componentWillUnmount: function() { - clearTimeout(this._hoverDelay); - }, - - handleDelayedShow: function () { - if (this._hoverDelay != null) { - clearTimeout(this._hoverDelay); - this._hoverDelay = null; - return; - } - - var delay = this.props.delayShow != null ? - this.props.delayShow : this.props.delay; - - if (!delay) { - this.show(); - return; - } - - this._hoverDelay = setTimeout(function() { - this._hoverDelay = null; - this.show(); - }.bind(this), delay); - }, - - handleDelayedHide: function () { - if (this._hoverDelay != null) { - clearTimeout(this._hoverDelay); - this._hoverDelay = null; - return; - } - - var delay = this.props.delayHide != null ? - this.props.delayHide : this.props.delay; - - if (!delay) { - this.hide(); - return; - } - - this._hoverDelay = setTimeout(function() { - this._hoverDelay = null; - this.hide(); - }.bind(this), delay); - }, - - updateOverlayPosition: function () { - if (!this.isMounted()) { - return; - } - - var pos = this.calcOverlayPosition(); - - this.setState({ - overlayLeft: pos.left, - overlayTop: pos.top - }); - }, - - calcOverlayPosition: function () { - var childOffset = this.getPosition(); - - var overlayNode = this.getOverlayDOMNode(); - var overlayHeight = overlayNode.offsetHeight; - var overlayWidth = overlayNode.offsetWidth; - - switch (this.props.placement) { - case 'right': - return { - top: childOffset.top + childOffset.height / 2 - overlayHeight / 2, - left: childOffset.left + childOffset.width - }; - case 'left': - return { - top: childOffset.top + childOffset.height / 2 - overlayHeight / 2, - left: childOffset.left - overlayWidth - }; - case 'top': - return { - top: childOffset.top - overlayHeight, - left: childOffset.left + childOffset.width / 2 - overlayWidth / 2 - }; - case 'bottom': - return { - top: childOffset.top + childOffset.height, - left: childOffset.left + childOffset.width / 2 - overlayWidth / 2 - }; - default: - throw new Error('calcOverlayPosition(): No such placement of "' + this.props.placement + '" found.'); - } - }, - - getPosition: function () { - var node = this.getDOMNode(); - var container = this.getContainerDOMNode(); - - var offset = container.tagName == 'BODY' ? - domUtils.getOffset(node) : domUtils.getPosition(node, container); - - return merge(offset, { - height: node.offsetHeight, - width: node.offsetWidth - }); - } -}); - -module.exports = OverlayTrigger; -}); - -define('PageHeader',['require','exports','module','react'],function (require, exports, module) {/** @jsx React.DOM */ - -var React = require('react'); - -var PageHeader = React.createClass({displayName: 'PageHeader', - - render: function () { - return this.transferPropsTo( - React.DOM.div( {className:"page-header"}, - React.DOM.h1(null, this.props.children) - ) - ); - } -}); - -module.exports = PageHeader; -}); - -define('Panel',['require','exports','module','react','./utils/classSet','./utils/cloneWithProps','./BootstrapMixin','./CollapsableMixin'],function (require, exports, module) {/** @jsx React.DOM */ - -var React = require('react'); -var classSet = require('./utils/classSet'); -var cloneWithProps = require('./utils/cloneWithProps'); -var BootstrapMixin = require('./BootstrapMixin'); -var CollapsableMixin = require('./CollapsableMixin'); - -var Panel = React.createClass({displayName: 'Panel', - mixins: [BootstrapMixin, CollapsableMixin], - - propTypes: { - onSelect: React.PropTypes.func, - header: React.PropTypes.renderable, - footer: React.PropTypes.renderable - }, - - getDefaultProps: function () { - return { - bsClass: 'panel', - bsStyle: 'default' - }; - }, - - handleSelect: function (e) { - if (this.props.onSelect) { - this._isChanging = true; - this.props.onSelect(this.props.key); - this._isChanging = false; - } - - e.preventDefault(); - - this.setState({ - expanded: !this.state.expanded - }); - }, - - shouldComponentUpdate: function () { - return !this._isChanging; - }, - - getCollapsableDimensionValue: function () { - return this.refs.body.getDOMNode().offsetHeight; - }, - - getCollapsableDOMNode: function () { - if (!this.isMounted() || !this.refs || !this.refs.panel) { - return null; - } - - return this.refs.panel.getDOMNode(); - }, - - render: function () { - var classes = this.getBsClassSet(); - classes['panel'] = true; - - return this.transferPropsTo( - React.DOM.div( {className:classSet(classes), id:this.props.collapsable ? null : this.props.id, onSelect:null}, - this.renderHeading(), - this.props.collapsable ? this.renderCollapsableBody() : this.renderBody(), - this.renderFooter() - ) - ); - }, - - renderCollapsableBody: function () { - return ( - React.DOM.div( {className:classSet(this.getCollapsableClassSet('panel-collapse')), id:this.props.id, ref:"panel"}, - this.renderBody() - ) - ); - }, - - renderBody: function () { - return ( - React.DOM.div( {className:"panel-body", ref:"body"}, - this.props.children - ) - ); - }, - - renderHeading: function () { - var header = this.props.header; - - if (!header) { - return null; - } - - if (!React.isValidComponent(header) || Array.isArray(header)) { - header = this.props.collapsable ? - this.renderCollapsableTitle(header) : header; - } else if (this.props.collapsable) { - header = cloneWithProps(header, { - className: 'panel-title', - children: this.renderAnchor(header.props.children) - }); - } else { - header = cloneWithProps(header, { - className: 'panel-title' - }); - } - - return ( - React.DOM.div( {className:"panel-heading"}, - header - ) - ); - }, - - renderAnchor: function (header) { - return ( - React.DOM.a( - {href:'#' + (this.props.id || ''), - className:this.isExpanded() ? null : 'collapsed', - onClick:this.handleSelect}, - header - ) - ); - }, - - renderCollapsableTitle: function (header) { - return ( - React.DOM.h4( {className:"panel-title"}, - this.renderAnchor(header) - ) - ); - }, - - renderFooter: function () { - if (!this.props.footer) { - return null; - } - - return ( - React.DOM.div( {className:"panel-footer"}, - this.props.footer - ) - ); - } -}); - -module.exports = Panel; -}); - -define('PageItem',['require','exports','module','react','./utils/classSet'],function (require, exports, module) {/** @jsx React.DOM */ - -var React = require('react'); -var classSet = require('./utils/classSet'); - -var PageItem = React.createClass({displayName: 'PageItem', - - propTypes: { - disabled: React.PropTypes.bool, - previous: React.PropTypes.bool, - next: React.PropTypes.bool, - onSelect: React.PropTypes.func - }, - - getDefaultProps: function () { - return { - href: '#' - }; - }, - - render: function () { - var classes = { - 'disabled': this.props.disabled, - 'previous': this.props.previous, - 'next': this.props.next - }; - - return this.transferPropsTo( - React.DOM.li( - {className:classSet(classes)}, - React.DOM.a( - {href:this.props.href, - title:this.props.title, - onClick:this.handleSelect, - ref:"anchor"}, - this.props.children - ) - ) - ); - }, - - handleSelect: function (e) { - if (this.props.onSelect) { - e.preventDefault(); - - if (!this.props.disabled) { - this.props.onSelect(this.props.key, this.props.href); - } - } - } -}); - -module.exports = PageItem; -}); - -define('Pager',['require','exports','module','react','./utils/cloneWithProps','./utils/ValidComponentChildren','./utils/createChainedFunction'],function (require, exports, module) {/** @jsx React.DOM */ - -var React = require('react'); -var cloneWithProps = require('./utils/cloneWithProps'); -var ValidComponentChildren = require('./utils/ValidComponentChildren'); -var createChainedFunction = require('./utils/createChainedFunction'); - -var Pager = React.createClass({displayName: 'Pager', - - propTypes: { - onSelect: React.PropTypes.func - }, - - render: function () { - return this.transferPropsTo( - React.DOM.ul( - {className:"pager"}, - ValidComponentChildren.map(this.props.children, this.renderPageItem) - ) - ); - }, - - renderPageItem: function (child) { - return cloneWithProps( - child, - { - onSelect: createChainedFunction(child.props.onSelect, this.props.onSelect), - ref: child.props.ref, - key: child.props.key - } - ); - } -}); - -module.exports = Pager; -}); - -define('Popover',['require','exports','module','react','./utils/classSet','./BootstrapMixin'],function (require, exports, module) {/** @jsx React.DOM */ - -var React = require('react'); -var classSet = require('./utils/classSet'); -var BootstrapMixin = require('./BootstrapMixin'); - - -var Popover = React.createClass({displayName: 'Popover', - mixins: [BootstrapMixin], - - propTypes: { - placement: React.PropTypes.oneOf(['top','right', 'bottom', 'left']), - positionLeft: React.PropTypes.number, - positionTop: React.PropTypes.number, - arrowOffsetLeft: React.PropTypes.number, - arrowOffsetTop: React.PropTypes.number, - title: React.PropTypes.renderable - }, - - getDefaultProps: function () { - return { - placement: 'right' - }; - }, - - render: function () { - var classes = {}; - classes['popover'] = true; - classes[this.props.placement] = true; - classes['in'] = this.props.positionLeft != null || this.props.positionTop != null; - - var style = {}; - style['left'] = this.props.positionLeft; - style['top'] = this.props.positionTop; - style['display'] = 'block'; - - var arrowStyle = {}; - arrowStyle['left'] = this.props.arrowOffsetLeft; - arrowStyle['top'] = this.props.arrowOffsetTop; - - return this.transferPropsTo( - React.DOM.div( {className:classSet(classes), style:style, title:null}, - React.DOM.div( {className:"arrow", style:arrowStyle} ), - this.props.title ? this.renderTitle() : null, - React.DOM.div( {className:"popover-content"}, - this.props.children - ) - ) - ); - }, - - renderTitle: function() { - return ( - React.DOM.h3( {className:"popover-title"}, this.props.title) - ); - } -}); - -module.exports = Popover; -}); - -define('ProgressBar',['require','exports','module','react','./Interpolate','./BootstrapMixin','./utils/classSet','./utils/cloneWithProps','./utils/ValidComponentChildren'],function (require, exports, module) {/** @jsx React.DOM */ - -var React = require('react'); -var Interpolate = require('./Interpolate'); -var BootstrapMixin = require('./BootstrapMixin'); -var classSet = require('./utils/classSet'); -var cloneWithProps = require('./utils/cloneWithProps'); -var ValidComponentChildren = require('./utils/ValidComponentChildren'); - - -var ProgressBar = React.createClass({displayName: 'ProgressBar', - propTypes: { - min: React.PropTypes.number, - now: React.PropTypes.number, - max: React.PropTypes.number, - label: React.PropTypes.renderable, - srOnly: React.PropTypes.bool, - striped: React.PropTypes.bool, - active: React.PropTypes.bool - }, - - mixins: [BootstrapMixin], - - getDefaultProps: function () { - return { - bsClass: 'progress-bar', - min: 0, - max: 100 - }; - }, - - getPercentage: function (now, min, max) { - return Math.ceil((now - min) / (max - min) * 100); - }, - - render: function () { - var classes = { - progress: true - }; - - if (this.props.active) { - classes['progress-striped'] = true; - classes['active'] = true; - } else if (this.props.striped) { - classes['progress-striped'] = true; - } - - if (!ValidComponentChildren.hasValidComponent(this.props.children)) { - if (!this.props.isChild) { - return this.transferPropsTo( - React.DOM.div( {className:classSet(classes)}, - this.renderProgressBar() - ) - ); - } else { - return this.transferPropsTo( - this.renderProgressBar() - ); - } - } else { - return this.transferPropsTo( - React.DOM.div( {className:classSet(classes)}, - ValidComponentChildren.map(this.props.children, this.renderChildBar) - ) - ); - } - }, - - renderChildBar: function (child) { - return cloneWithProps(child, { - isChild: true, - key: child.props.key, - ref: child.props.ref - }); - }, - - renderProgressBar: function () { - var percentage = this.getPercentage( - this.props.now, - this.props.min, - this.props.max - ); - - var label; - - if (typeof this.props.label === "string") { - label = this.renderLabel(percentage); - } else if (this.props.label) { - label = this.props.label; - } - - if (this.props.srOnly) { - label = this.renderScreenReaderOnlyLabel(label); - } - - return ( - React.DOM.div( {className:classSet(this.getBsClassSet()), role:"progressbar", - style:{width: percentage + '%'}, - 'aria-valuenow':this.props.now, - 'aria-valuemin':this.props.min, - 'aria-valuemax':this.props.max}, - label - ) - ); - }, - - renderLabel: function (percentage) { - var InterpolateClass = this.props.interpolateClass || Interpolate; - - return ( - InterpolateClass( - {now:this.props.now, - min:this.props.min, - max:this.props.max, - percent:percentage, - bsStyle:this.props.bsStyle}, - this.props.label - ) - ); - }, - - renderScreenReaderOnlyLabel: function (label) { - return ( - React.DOM.span( {className:"sr-only"}, - label - ) - ); - } -}); - -module.exports = ProgressBar; - -}); - -define('Row',['require','exports','module','react','./utils/CustomPropTypes'],function (require, exports, module) {/** @jsx React.DOM */ - -var React = require('react'); -var CustomPropTypes = require('./utils/CustomPropTypes'); - - -var Row = React.createClass({displayName: 'Row', - propTypes: { - componentClass: CustomPropTypes.componentClass.isRequired - }, - - getDefaultProps: function () { - return { - componentClass: React.DOM.div - }; - }, - - render: function () { - var componentClass = this.props.componentClass; - - return this.transferPropsTo( - componentClass( {className:"row"}, - this.props.children - ) - ); - } -}); - -module.exports = Row; -}); - -define('SplitButton',['require','exports','module','react','./utils/classSet','./BootstrapMixin','./DropdownStateMixin','./Button','./ButtonGroup','./DropdownMenu'],function (require, exports, module) {/** @jsx React.DOM */ - -var React = require('react'); -var classSet = require('./utils/classSet'); -var BootstrapMixin = require('./BootstrapMixin'); -var DropdownStateMixin = require('./DropdownStateMixin'); -var Button = require('./Button'); -var ButtonGroup = require('./ButtonGroup'); -var DropdownMenu = require('./DropdownMenu'); - -var SplitButton = React.createClass({displayName: 'SplitButton', - mixins: [BootstrapMixin, DropdownStateMixin], - - propTypes: { - pullRight: React.PropTypes.bool, - title: React.PropTypes.renderable, - href: React.PropTypes.string, - dropdownTitle: React.PropTypes.renderable, - onClick: React.PropTypes.func, - onSelect: React.PropTypes.func, - disabled: React.PropTypes.bool - }, - - getDefaultProps: function () { - return { - dropdownTitle: 'Toggle dropdown' - }; - }, - - render: function () { - var groupClasses = { - 'open': this.state.open, - 'dropup': this.props.dropup - }; - - var button = this.transferPropsTo( - Button( - {ref:"button", - onClick:this.handleButtonClick, - title:null, - id:null}, - this.props.title - ) - ); - - var dropdownButton = this.transferPropsTo( - Button( - {ref:"dropdownButton", - className:"dropdown-toggle", - onClick:this.handleDropdownClick, - title:null, - id:null}, - React.DOM.span( {className:"sr-only"}, this.props.dropdownTitle), - React.DOM.span( {className:"caret"} ) - ) - ); - - return ( - ButtonGroup( - {bsSize:this.props.bsSize, - className:classSet(groupClasses), - id:this.props.id}, - button, - dropdownButton, - DropdownMenu( - {ref:"menu", - onSelect:this.handleOptionSelect, - 'aria-labelledby':this.props.id, - pullRight:this.props.pullRight}, - this.props.children - ) - ) - ); - }, - - handleButtonClick: function (e) { - if (this.state.open) { - this.setDropdownState(false); - } - - if (this.props.onClick) { - this.props.onClick(e); - } - }, - - handleDropdownClick: function (e) { - e.preventDefault(); - - this.setDropdownState(!this.state.open); - }, - - handleOptionSelect: function (key) { - if (this.props.onSelect) { - this.props.onSelect(key); - } - - this.setDropdownState(false); - } -}); - -module.exports = SplitButton; - -}); - -define('SubNav',['require','exports','module','react','./utils/classSet','./utils/cloneWithProps','./utils/ValidComponentChildren','./utils/createChainedFunction','./BootstrapMixin'],function (require, exports, module) {/** @jsx React.DOM */ - -var React = require('react'); -var classSet = require('./utils/classSet'); -var cloneWithProps = require('./utils/cloneWithProps'); -var ValidComponentChildren = require('./utils/ValidComponentChildren'); -var createChainedFunction = require('./utils/createChainedFunction'); -var BootstrapMixin = require('./BootstrapMixin'); - - -var SubNav = React.createClass({displayName: 'SubNav', - mixins: [BootstrapMixin], - - propTypes: { - onSelect: React.PropTypes.func, - active: React.PropTypes.bool, - disabled: React.PropTypes.bool, - href: React.PropTypes.string, - title: React.PropTypes.string, - text: React.PropTypes.renderable - }, - - getDefaultProps: function () { - return { - bsClass: 'nav' - }; - }, - - handleClick: function (e) { - if (this.props.onSelect) { - e.preventDefault(); - - if (!this.props.disabled) { - this.props.onSelect(this.props.key, this.props.href); - } - } - }, - - isActive: function () { - return this.isChildActive(this); - }, - - isChildActive: function (child) { - if (child.props.active) { - return true; - } - - if (this.props.activeKey != null && this.props.activeKey === child.props.key) { - return true; - } - - if (this.props.activeHref != null && this.props.activeHref === child.props.href) { - return true; - } - - if (child.props.children) { - var isActive = false; - - ValidComponentChildren.forEach( - child.props.children, - function (child) { - if (this.isChildActive(child)) { - isActive = true; - } - }, - this - ); - - return isActive; - } - - return false; - }, - - getChildActiveProp: function (child) { - if (child.props.active) { - return true; - } - if (this.props.activeKey != null) { - if (child.props.key === this.props.activeKey) { - return true; - } - } - if (this.props.activeHref != null) { - if (child.props.href === this.props.activeHref) { - return true; - } - } - - return child.props.active; - }, - - render: function () { - var classes = { - 'active': this.isActive(), - 'disabled': this.props.disabled - }; - - return this.transferPropsTo( - React.DOM.li( {className:classSet(classes)}, - React.DOM.a( - {href:this.props.href, - title:this.props.title, - onClick:this.handleClick, - ref:"anchor"}, - this.props.text - ), - React.DOM.ul( {className:"nav"}, - ValidComponentChildren.map(this.props.children, this.renderNavItem) - ) - ) - ); - }, - - renderNavItem: function (child) { - return cloneWithProps( - child, - { - active: this.getChildActiveProp(child), - onSelect: createChainedFunction(child.props.onSelect, this.props.onSelect), - ref: child.props.ref, - key: child.props.key - } - ); - } -}); - -module.exports = SubNav; - -}); - -define('TabbedArea',['require','exports','module','react','./BootstrapMixin','./utils/cloneWithProps','./utils/ValidComponentChildren','./Nav','./NavItem'],function (require, exports, module) {/** @jsx React.DOM */ - -var React = require('react'); -var BootstrapMixin = require('./BootstrapMixin'); -var cloneWithProps = require('./utils/cloneWithProps'); -var ValidComponentChildren = require('./utils/ValidComponentChildren'); -var Nav = require('./Nav'); -var NavItem = require('./NavItem'); - -function getDefaultActiveKeyFromChildren(children) { - var defaultActiveKey; - - ValidComponentChildren.forEach(children, function(child) { - if (defaultActiveKey == null) { - defaultActiveKey = child.props.key; - } - }); - - return defaultActiveKey; -} - -var TabbedArea = React.createClass({displayName: 'TabbedArea', - mixins: [BootstrapMixin], - - propTypes: { - bsStyle: React.PropTypes.oneOf(['tabs','pills']), - animation: React.PropTypes.bool, - onSelect: React.PropTypes.func - }, - - getDefaultProps: function () { - return { - bsStyle: "tabs", - animation: true - }; - }, - - getInitialState: function () { - var defaultActiveKey = this.props.defaultActiveKey != null ? - this.props.defaultActiveKey : getDefaultActiveKeyFromChildren(this.props.children); - - // TODO: In __DEV__ mode warn via `console.warn` if no `defaultActiveKey` has - // been set by this point, invalid children or missing key properties are likely the cause. - - return { - activeKey: defaultActiveKey, - previousActiveKey: null - }; - }, - - componentWillReceiveProps: function (nextProps) { - if (nextProps.activeKey != null && nextProps.activeKey !== this.props.activeKey) { - this.setState({ - previousActiveKey: this.props.activeKey - }); - } - }, - - handlePaneAnimateOutEnd: function () { - this.setState({ - previousActiveKey: null - }); - }, - - render: function () { - var activeKey = - this.props.activeKey != null ? this.props.activeKey : this.state.activeKey; - - function renderTabIfSet(child) { - return child.props.tab != null ? this.renderTab(child) : null; - } - - var nav = this.transferPropsTo( - Nav( {activeKey:activeKey, onSelect:this.handleSelect, ref:"tabs"}, - ValidComponentChildren.map(this.props.children, renderTabIfSet, this) - ) - ); - - return ( - React.DOM.div(null, - nav, - React.DOM.div( {id:this.props.id, className:"tab-content", ref:"panes"}, - ValidComponentChildren.map(this.props.children, this.renderPane) - ) - ) - ); - }, - - getActiveKey: function () { - return this.props.activeKey != null ? this.props.activeKey : this.state.activeKey; - }, - - renderPane: function (child) { - var activeKey = this.getActiveKey(); - - return cloneWithProps( - child, - { - active: (child.props.key === activeKey && - (this.state.previousActiveKey == null || !this.props.animation)), - ref: child.props.ref, - key: child.props.key, - animation: this.props.animation, - onAnimateOutEnd: (this.state.previousActiveKey != null && - child.props.key === this.state.previousActiveKey) ? this.handlePaneAnimateOutEnd: null - } - ); - }, - - renderTab: function (child) { - var key = child.props.key; - return ( - NavItem( - {ref:'tab' + key, - key:key}, - child.props.tab - ) - ); - }, - - shouldComponentUpdate: function() { - // Defer any updates to this component during the `onSelect` handler. - return !this._isChanging; - }, - - handleSelect: function (key) { - if (this.props.onSelect) { - this._isChanging = true; - this.props.onSelect(key); - this._isChanging = false; - } else if (key !== this.getActiveKey()) { - this.setState({ - activeKey: key, - previousActiveKey: this.getActiveKey() - }); - } - } -}); - -module.exports = TabbedArea; -}); - -define('Table',['require','exports','module','react','./utils/classSet'],function (require, exports, module) {/** @jsx React.DOM */ - -var React = require('react'); -var classSet = require('./utils/classSet'); - -var Table = React.createClass({displayName: 'Table', - propTypes: { - striped: React.PropTypes.bool, - bordered: React.PropTypes.bool, - condensed: React.PropTypes.bool, - hover: React.PropTypes.bool, - responsive: React.PropTypes.bool - }, - - render: function () { - var classes = { - 'table': true, - 'table-striped': this.props.striped, - 'table-bordered': this.props.bordered, - 'table-condensed': this.props.condensed, - 'table-hover': this.props.hover - }; - var table = this.transferPropsTo( - React.DOM.table( {className:classSet(classes)}, - this.props.children - ) - ); - - return this.props.responsive ? ( - React.DOM.div( {className:"table-responsive"}, - table - ) - ) : table; - } -}); - -module.exports = Table; -}); - -define('TabPane',['require','exports','module','react','./utils/classSet','./utils/TransitionEvents'],function (require, exports, module) {/** @jsx React.DOM */ - -var React = require('react'); -var classSet = require('./utils/classSet'); -var TransitionEvents = require('./utils/TransitionEvents'); - -var TabPane = React.createClass({displayName: 'TabPane', - getDefaultProps: function () { - return { - animation: true - }; - }, - - getInitialState: function () { - return { - animateIn: false, - animateOut: false - }; - }, - - componentWillReceiveProps: function (nextProps) { - if (this.props.animation) { - if (!this.state.animateIn && nextProps.active && !this.props.active) { - this.setState({ - animateIn: true - }); - } else if (!this.state.animateOut && !nextProps.active && this.props.active) { - this.setState({ - animateOut: true - }); - } - } - }, - - componentDidUpdate: function () { - if (this.state.animateIn) { - setTimeout(this.startAnimateIn, 0); - } - if (this.state.animateOut) { - TransitionEvents.addEndEventListener( - this.getDOMNode(), - this.stopAnimateOut - ); - } - }, - - startAnimateIn: function () { - if (this.isMounted()) { - this.setState({ - animateIn: false - }); - } - }, - - stopAnimateOut: function () { - if (this.isMounted()) { - this.setState({ - animateOut: false - }); - - if (typeof this.props.onAnimateOutEnd === 'function') { - this.props.onAnimateOutEnd(); - } - } - }, - - render: function () { - var classes = { - 'tab-pane': true, - 'fade': true, - 'active': this.props.active || this.state.animateOut, - 'in': this.props.active && !this.state.animateIn - }; - - return this.transferPropsTo( - React.DOM.div( {className:classSet(classes)}, - this.props.children - ) - ); - } -}); - -module.exports = TabPane; -}); - -define('Tooltip',['require','exports','module','react','./utils/classSet','./BootstrapMixin'],function (require, exports, module) {/** @jsx React.DOM */ - -var React = require('react'); -var classSet = require('./utils/classSet'); -var BootstrapMixin = require('./BootstrapMixin'); - - -var Tooltip = React.createClass({displayName: 'Tooltip', - mixins: [BootstrapMixin], - - propTypes: { - placement: React.PropTypes.oneOf(['top','right', 'bottom', 'left']), - positionLeft: React.PropTypes.number, - positionTop: React.PropTypes.number, - arrowOffsetLeft: React.PropTypes.number, - arrowOffsetTop: React.PropTypes.number - }, - - getDefaultProps: function () { - return { - placement: 'right' - }; - }, - - render: function () { - var classes = {}; - classes['tooltip'] = true; - classes[this.props.placement] = true; - classes['in'] = this.props.positionLeft != null || this.props.positionTop != null; - - var style = {}; - style['left'] = this.props.positionLeft; - style['top'] = this.props.positionTop; - - var arrowStyle = {}; - arrowStyle['left'] = this.props.arrowOffsetLeft; - arrowStyle['top'] = this.props.arrowOffsetTop; - - return this.transferPropsTo( - React.DOM.div( {className:classSet(classes), style:style}, - React.DOM.div( {className:"tooltip-arrow", style:arrowStyle} ), - React.DOM.div( {className:"tooltip-inner"}, - this.props.children - ) - ) - ); - } -}); - -module.exports = Tooltip; -}); - -define('Well',['require','exports','module','react','./utils/classSet','./BootstrapMixin'],function (require, exports, module) {/** @jsx React.DOM */ - -var React = require('react'); -var classSet = require('./utils/classSet'); -var BootstrapMixin = require('./BootstrapMixin'); - -var Well = React.createClass({displayName: 'Well', - mixins: [BootstrapMixin], - - getDefaultProps: function () { - return { - bsClass: 'well' - }; - }, - - render: function () { - var classes = this.getBsClassSet(); - - return this.transferPropsTo( - React.DOM.div( {className:classSet(classes)}, - this.props.children - ) - ); - } -}); - -module.exports = Well; -}); - -/*global define */ - -define('react-bootstrap',['require','./Accordion','./Affix','./AffixMixin','./Alert','./BootstrapMixin','./Badge','./Button','./ButtonGroup','./ButtonToolbar','./Carousel','./CarouselItem','./Col','./CollapsableMixin','./DropdownButton','./DropdownMenu','./DropdownStateMixin','./FadeMixin','./Glyphicon','./Grid','./Input','./Interpolate','./Jumbotron','./Label','./ListGroup','./ListGroupItem','./MenuItem','./Modal','./Nav','./Navbar','./NavItem','./ModalTrigger','./OverlayTrigger','./OverlayMixin','./PageHeader','./Panel','./PanelGroup','./PageItem','./Pager','./Popover','./ProgressBar','./Row','./SplitButton','./SubNav','./TabbedArea','./Table','./TabPane','./Tooltip','./Well'],function (require) { - - - return { - Accordion: require('./Accordion'), - Affix: require('./Affix'), - AffixMixin: require('./AffixMixin'), - Alert: require('./Alert'), - BootstrapMixin: require('./BootstrapMixin'), - Badge: require('./Badge'), - Button: require('./Button'), - ButtonGroup: require('./ButtonGroup'), - ButtonToolbar: require('./ButtonToolbar'), - Carousel: require('./Carousel'), - CarouselItem: require('./CarouselItem'), - Col: require('./Col'), - CollapsableMixin: require('./CollapsableMixin'), - DropdownButton: require('./DropdownButton'), - DropdownMenu: require('./DropdownMenu'), - DropdownStateMixin: require('./DropdownStateMixin'), - FadeMixin: require('./FadeMixin'), - Glyphicon: require('./Glyphicon'), - Grid: require('./Grid'), - Input: require('./Input'), - Interpolate: require('./Interpolate'), - Jumbotron: require('./Jumbotron'), - Label: require('./Label'), - ListGroup: require('./ListGroup'), - ListGroupItem: require('./ListGroupItem'), - MenuItem: require('./MenuItem'), - Modal: require('./Modal'), - Nav: require('./Nav'), - Navbar: require('./Navbar'), - NavItem: require('./NavItem'), - ModalTrigger: require('./ModalTrigger'), - OverlayTrigger: require('./OverlayTrigger'), - OverlayMixin: require('./OverlayMixin'), - PageHeader: require('./PageHeader'), - Panel: require('./Panel'), - PanelGroup: require('./PanelGroup'), - PageItem: require('./PageItem'), - Pager: require('./Pager'), - Popover: require('./Popover'), - ProgressBar: require('./ProgressBar'), - Row: require('./Row'), - SplitButton: require('./SplitButton'), - SubNav: require('./SubNav'), - TabbedArea: require('./TabbedArea'), - Table: require('./Table'), - TabPane: require('./TabPane'), - Tooltip: require('./Tooltip'), - Well: require('./Well') - }; -}); - - //Register in the values from the outer closure for common dependencies - //as local almond modules - define('react', function () { - return React; - }); - - //Use almond's special top-level, synchronous require to trigger factory - //functions, get the final module value, and export it as the public - //value. - return require('react-bootstrap'); -})); - //# sourceMappingURL=vendor.js.map
\ No newline at end of file |