1
0
Fork 0
forked from OpenNeo/impress
impress/app/assets/javascripts/react.js

20 lines
92 KiB
JavaScript
Raw Normal View History

2014-01-20 12:35:28 -08:00
/**
* React v0.8.0
*
* Copyright 2013 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.
*/
!function(e){"object"==typeof exports?module.exports=e():"function"==typeof define&&define.amd?define(e):"undefined"!=typeof window?window.React=e():"undefined"!=typeof global?global.React=e():"undefined"!=typeof self&&(self.React=e())}(function(){return function e(t,n,o){function r(a,s){if(!n[a]){if(!t[a]){var u="function"==typeof require&&require;if(!s&&u)return u(a,!0);if(i)return i(a,!0);throw new Error("Cannot find module '"+a+"'")}var c=n[a]={exports:{}};t[a][0].call(c.exports,function(e){var n=t[a][1][e];return r(n?n:e)},c,c.exports,e,t,n,o)}return n[a].exports}for(var i="function"==typeof require&&require,a=0;a<o.length;a++)r(o[a]);return r}({1:[function(e,t){function n(e){var t=o(e);if(!t)throw new Error(r('Tried to get element with id of "%s" but it is not present on the page.',e));return t}var o=e("./ge"),r=e("./ex");t.exports=n},{"./ex":85,"./ge":89}],2:[function(e,t){"use strict";var n={fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,orphans:!0,zIndex:!0,zoom:!0},o={background:{backgroundImage:!0,backgroundPosition:!0,backgroundRepeat:!0,backgroundColor:!0},border:{borderWidth:!0,borderStyle:!0,borderColor:!0},borderBottom:{borderBottomWidth:!0,borderBottomStyle:!0,borderBottomColor:!0},borderLeft:{borderLeftWidth:!0,borderLeftStyle:!0,borderLeftColor:!0},borderRight:{borderRightWidth:!0,borderRightStyle:!0,borderRightColor:!0},borderTop:{borderTopWidth:!0,borderTopStyle:!0,borderTopColor:!0},font:{fontStyle:!0,fontVariant:!0,fontWeight:!0,fontSize:!0,lineHeight:!0,fontFamily:!0}},r={isUnitlessNumber:n,shorthandPropertyExpansions:o};t.exports=r},{}],3:[function(e,t){"use strict";var n=e("./CSSProperty"),o=e("./dangerousStyleValue"),r=e("./escapeTextForBrowser"),i=e("./hyphenate"),a=e("./memoizeStringOnly"),s=a(function(e){return r(i(e))}),u={createMarkupForStyles:function(e){var t="";for(var n in e)if(e.hasOwnProperty(n)){var r=e[n];null!=r&&(t+=s(n)+":",t+=o(n,r)+";")}return t||null},setValueForStyles:function(e,t){var r=e.style;for(var i in t)if(t.hasOwnProperty(i)){var a=o(i,t[i]);if(a)r[i]=a;else{var s=n.shorthandPropertyExpansions[i];if(s)for(var u in s)r[u]="";else r[i]=""}}}};t.exports=u},{"./CSSProperty":2,"./dangerousStyleValue":82,"./escapeTextForBrowser":84,"./hyphenate":97,"./memoizeStringOnly":106}],4:[function(e,t){"use strict";var n={},o={putListener:function(e,t,o){var r=n[t]||(n[t]={});r[e]=o},getListener:function(e,t){var o=n[t];return o&&o[e]},deleteListener:function(e,t){var o=n[t];o&&delete o[e]},deleteAllListeners:function(e){for(var t in n)delete n[t][e]},__purge:function(){n={}}};t.exports=o},{}],5:[function(e,t){"use strict";function n(e){return"SELECT"===e.nodeName||"INPUT"===e.nodeName&&"file"===e.type}function o(e){var t=E.getPooled(x.change,_,e);C.accumulateTwoPhaseDispatches(t),g.enqueueEvents(t),g.processEventQueue()}function r(e,t){N=e,_=t,N.attachEvent("onchange",o)}function i(){N&&(N.detachEvent("onchange",o),N=null,_=null)}function a(e,t,n){return e===b.topChange?n:void 0}function s(e,t,n){e===b.topFocus?(i(),r(t,n)):e===b.topBlur&&i()}function u(e,t){N=e,_=t,I=e.value,T=Object.getOwnPropertyDescriptor(e.constructor.prototype,"value"),Object.defineProperty(N,"value",S),N.attachEvent("onpropertychange",l)}function c(){N&&(delete N.value,N.detachEvent("onpropertychange",l),N=null,_=null,I=null,T=null)}function l(e){if("value"===e.propertyName){var t=e.srcElement.value;t!==I&&(I=t,o(e))}}function p(e,t,n){return e===b.topInput?n:void 0}function d(e,t,n){e===b.topFocus?(c(),u(t,n)):e===b.topBlur&&c()}function f(e){return e!==b.topSelectionChange&&e!==b.topKeyUp&&e!==b.topKeyDown||!N||N.value===I?void 0:(I=N.value,_)}function h(e){return"INPUT"===e.nodeName&&("checkbox"===e.type||"radio"===e.type)}function m(e,t,n){return e===b.topClick?n:void 0}var v=e("./EventConstants"),g=e("./EventPluginHub"),C=e("./EventPropagators"),y=e("./ExecutionEnvironment"),E=e("./SyntheticEvent"),M=e("./isEventSupported"),R=e("./isTextInputElement"),D=e("./keyOf"),b=v.topLevelTypes,x={change:{phasedRegistrationNames:{bubbled:D({onChange:null}),captured:D({onChangeCapture:null})}}},N=null,_=nul
},_performUpdateIfNecessary:function(e){if(null!=this._pendingProps||null!=this._pendingState||this._pendingForceUpdate){var t=this.props;null!=this._pendingProps&&(t=this._pendingProps,this._processProps(t),this._pendingProps=null,this._compositeLifeCycleState=D.RECEIVING_PROPS,this.componentWillReceiveProps&&this.componentWillReceiveProps(t,e)),this._compositeLifeCycleState=D.RECEIVING_STATE;var n=this._pendingState||this.state;this._pendingState=null,this._pendingForceUpdate||!this.shouldComponentUpdate||this.shouldComponentUpdate(t,n)?(this._pendingForceUpdate=!1,this._performComponentUpdate(t,n,e)):(this.props=t,this.state=n),this._compositeLifeCycleState=null}},_performComponentUpdate:function(e,t,n){var o=this.props,r=this.state;this.componentWillUpdate&&this.componentWillUpdate(e,t,n),this.props=e,this.state=t,this.updateComponent(n,o,r),this.componentDidUpdate&&n.getReactMountReady().enqueue(this,this.componentDidUpdate.bind(this,o,r))},updateComponent:d.measure("ReactCompositeComponent","updateComponent",function(e,t){u.Mixin.updateComponent.call(this,e,t);var n=this._renderedComponent,o=this._renderValidatedComponent();if(n.constructor===o.constructor)n.receiveComponent(o,e);else{var r=this._rootNodeID,i=n._rootNodeID;n.unmountComponent(),this._renderedComponent=o;var a=o.mountComponent(r,e,this._mountDepth+1);u.DOMIDOperations.dangerouslyReplaceNodeWithMarkupByID(i,a)}}),forceUpdate:function(e){var t=this._compositeLifeCycleState;m(this.isMounted()||t===D.MOUNTING),m(t!==D.RECEIVING_STATE&&t!==D.UNMOUNTING),this._pendingForceUpdate=!0,h.enqueueUpdate(this,e)},_renderValidatedComponent:function(){var e;c.current=this;try{e=this.render()}catch(t){throw t}finally{c.current=null}return m(u.isValidComponent(e)),e},_bindAutoBindMethods:function(){for(var e in this.__reactAutoBindMap)if(this.__reactAutoBindMap.hasOwnProperty(e)){var t=this.__reactAutoBindMap[e];this[e]=this._bindAutoBindMethod(l.guard(t,this.constructor.displayName+"."+e))}},_bindAutoBindMethod:function(e){var t=this,n=function(){return e.apply(t,arguments)};return n}},x=function(){};C(x,u.Mixin),C(x,p.Mixin),C(x,f.Mixin),C(x,b);var N={LifeCycle:D,Base:x,createClass:function(e){var t=function(){};t.prototype=new x,t.prototype.constructor=t,r(t,e),m(t.prototype.render);for(var n in M)t.prototype[n]||(t.prototype[n]=null);var o=function(){var e=new t;return e.construct.apply(e,arguments),e};return o.componentConstructor=t,o.originalSpec=e,o},isValidClass:function(e){return e instanceof Function&&"componentConstructor"in e&&e.componentConstructor instanceof Function}};t.exports=N},{"./ReactComponent":25,"./ReactCurrentOwner":29,"./ReactErrorUtils":43,"./ReactOwner":54,"./ReactPerf":55,"./ReactPropTransferer":56,"./ReactUpdates":61,"./invariant":98,"./keyMirror":104,"./merge":107,"./mixInto":110,"./objMap":112}],29:[function(e,t){"use strict";var n={current:null};t.exports=n},{}],30:[function(e,t){"use strict";function n(e,t){var n=function(){};n.prototype=new o(e,t),n.prototype.constructor=n,n.displayName=e;var r=function(){var e=new n;return e.construct.apply(e,arguments),e};return r.componentConstructor=n,r}var o=e("./ReactDOMComponent"),r=e("./mergeInto"),i=e("./objMapKeyVal"),a=i({a:!1,abbr:!1,address:!1,area:!1,article:!1,aside:!1,audio:!1,b:!1,base:!1,bdi:!1,bdo:!1,big:!1,blockquote:!1,body:!1,br:!0,button:!1,canvas:!1,caption:!1,cite:!1,code:!1,col:!0,colgroup:!1,data:!1,datalist:!1,dd:!1,del:!1,details:!1,dfn:!1,div:!1,dl:!1,dt:!1,em:!1,embed:!0,fieldset:!1,figcaption:!1,figure:!1,footer:!1,form:!1,h1:!1,h2:!1,h3:!1,h4:!1,h5:!1,h6:!1,head:!1,header:!1,hr:!0,html:!1,i:!1,iframe:!1,img:!0,input:!0,ins:!1,kbd:!1,keygen:!0,label:!1,legend:!1,li:!1,link:!1,main:!1,map:!1,mark:!1,menu:!1,menuitem:!1,meta:!0,meter:!1,nav:!1,noscript:!1,object:!1,ol:!1,optgroup:!1,option:!1,output:!1,p:!1,param:!0,pre:!1,progress:!1,q:!1,rp:!1,rt:!1,ruby:!1,s:!1,samp:!1,script:!1,section:!1,select:!1,small:!1,source:!1,span:!1,strong:!1,style:!1,sub:!1,summary:!1,sup:!1,table:!1,tbody:!1,td:!1,textarea:!1,tfoot:!1,th:!1,thead:!1,time:!1,title:!1,tr:!1,track:!0,u:!1,ul
t.exports=o},{"./keyMirror":104}],54:[function(e,t){"use strict";var n=e("./invariant"),o={isValidOwner:function(e){return!(!e||"function"!=typeof e.attachRef||"function"!=typeof e.detachRef)},addComponentAsRefTo:function(e,t,r){n(o.isValidOwner(r)),r.attachRef(t,e)},removeComponentAsRefFrom:function(e,t,r){n(o.isValidOwner(r)),r.refs[t]===e&&r.detachRef(t)},Mixin:{attachRef:function(e,t){n(t.isOwnedBy(this));var o=this.refs||(this.refs={});o[e]=t},detachRef:function(e){delete this.refs[e]}}};t.exports=o},{"./invariant":98}],55:[function(e,t){"use strict";function n(e,t,n){return n}var o={enableMeasure:!1,storedMeasure:n,measure:function(e,t,n){return n},injection:{injectMeasure:function(e){o.storedMeasure=e}}};t.exports=o},{"./ExecutionEnvironment":20}],56:[function(e,t){"use strict";function n(e){return function(t,n,o){t[n]=t.hasOwnProperty(n)?e(t[n],o):o}}var o=e("./emptyFunction"),r=e("./invariant"),i=e("./joinClasses"),a=e("./merge"),s={children:o,className:n(i),ref:o,style:n(a)},u={TransferStrategies:s,Mixin:{transferPropsTo:function(e){r(e.props.__owner__===this);var t={};for(var n in e.props)e.props.hasOwnProperty(n)&&(t[n]=e.props[n]);for(var o in this.props)if(this.props.hasOwnProperty(o)){var i=s[o];i?i(t,o,this.props[o]):t.hasOwnProperty(o)||(t[o]=this.props[o])}return e.props=t,e}}};t.exports=u},{"./emptyFunction":83,"./invariant":98,"./joinClasses":103,"./merge":107}],57:[function(e,t){"use strict";function n(e){function t(t,n,o){var r=typeof t;"object"===r&&Array.isArray(t)&&(r="array"),s(r===e)}return i(t)}function o(e){function t(e,t,o){s(n[e])}var n=a(e);return i(t)}function r(e){function t(t,n,o){s(t instanceof e)}return i(t)}function i(e){function t(n){function o(t,o,r){var i=t[o];null!=i?e(i,o,r||c):s(!n)}return n||(o.isRequired=t(!0)),o}return t(!1)}var a=e("./createObjectFrom"),s=e("./invariant"),u={array:n("array"),bool:n("boolean"),func:n("function"),number:n("number"),object:n("object"),string:n("string"),oneOf:o,instanceOf:r},c="<<anonymous>>";t.exports=u},{"./createObjectFrom":81,"./invariant":98}],58:[function(e,t){"use strict";function n(){this.reinitializeTransaction(),this.reactMountReady=s.getPooled(null)}var o=e("./ExecutionEnvironment"),r=e("./PooledClass"),i=e("./ReactEventEmitter"),a=e("./ReactInputSelection"),s=e("./ReactMountReady"),u=e("./Transaction"),c=e("./mixInto"),l={initialize:a.getSelectionInformation,close:a.restoreSelection},p={initialize:function(){var e=i.isEnabled();return i.setEnabled(!1),e},close:function(e){i.setEnabled(e)}},d={initialize:function(){this.reactMountReady.reset()},close:function(){this.reactMountReady.notifyAll()}},f=[l,p,d],h={getTransactionWrappers:function(){return o.canUseDOM?f:[]},getReactMountReady:function(){return this.reactMountReady},destructor:function(){s.release(this.reactMountReady),this.reactMountReady=null}};c(n,u.Mixin),c(n,h),r.addPoolingTo(n),t.exports=n},{"./ExecutionEnvironment":20,"./PooledClass":23,"./ReactEventEmitter":44,"./ReactInputSelection":47,"./ReactMountReady":51,"./Transaction":73,"./mixInto":110}],59:[function(e,t){"use strict";function n(e,t){s(o.isValidComponent(e)),s("function"==typeof t);var n=r.createReactRootID(),u=a.getPooled();u.reinitializeTransaction();try{u.perform(function(){var o=e.mountComponent(n,u,0);o=i.addChecksumToMarkup(o),t(o)},null)}finally{a.release(u)}}var o=e("./ReactComponent"),r=e("./ReactInstanceHandles"),i=e("./ReactMarkupChecksum"),a=e("./ReactReconcileTransaction"),s=e("./invariant");t.exports={renderComponentToString:n}},{"./ReactComponent":25,"./ReactInstanceHandles":48,"./ReactMarkupChecksum":49,"./ReactReconcileTransaction":58,"./invariant":98}],60:[function(e,t){"use strict";var n=e("./ReactComponent"),o=e("./ReactMount"),r=e("./escapeTextForBrowser"),i=e("./mixInto"),a=function(e){this.construct({text:e})};i(a,n.Mixin),i(a,{mountComponent:function(e,t,i){return n.Mixin.mountComponent.call(this,e,t,i),"<span "+o.ATTR_NAME+'="'+r(e)+'">'+r(this.props.text)+"</span>"},receiveComponent:function(e){var t=e.props;t.text!==this.props.text&&(this.props.text=t.text,n.DOMIDOperations.updateT