react-router
Advanced tools
Comparing version 0.5.0 to 0.5.1
@@ -1,2 +0,2 @@ | ||
!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(){return function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a="function"==typeof require&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);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}for(var i="function"==typeof require&&require,o=0;o<r.length;o++)s(r[o]);return s}({1:[function(_dereq_,module){function Router(route){return warning(!1,"The Router(<Route>).renderComponent(container) interface is deprecated and will be removed soon. Use React.renderComponent(<Route>, container) instead"),{renderComponent:function(container,callback){return React.renderComponent(route,container,callback)}}}var React="undefined"!=typeof window?window.React:"undefined"!=typeof global?global.React:null,warning=_dereq_("react/lib/warning");module.exports=Router},{"react/lib/warning":51}],2:[function(_dereq_,module){function isModifiedEvent(event){return!!(event.metaKey||event.ctrlKey||event.shiftKey)}var React="undefined"!=typeof window?window.React:"undefined"!=typeof global?global.React:null,ActiveState=_dereq_("../mixins/ActiveState"),withoutProperties=_dereq_("../helpers/withoutProperties"),transitionTo=_dereq_("../helpers/transitionTo"),makeHref=_dereq_("../helpers/makeHref"),RESERVED_PROPS={to:!0,className:!0,activeClassName:!0,query:!0,children:!0},Link=React.createClass({displayName:"Link",mixins:[ActiveState],statics:{getUnreservedProps:function(props){return withoutProperties(props,RESERVED_PROPS)}},propTypes:{to:React.PropTypes.string.isRequired,activeClassName:React.PropTypes.string.isRequired,query:React.PropTypes.object},getDefaultProps:function(){return{activeClassName:"active"}},getInitialState:function(){return{isActive:!1}},getParams:function(){return Link.getUnreservedProps(this.props)},getHref:function(){return makeHref(this.props.to,this.getParams(),this.props.query)},getClassName:function(){var className=this.props.className||"";return this.state.isActive?className+" "+this.props.activeClassName:className},componentWillReceiveProps:function(nextProps){var params=Link.getUnreservedProps(nextProps);this.setState({isActive:Link.isActive(nextProps.to,params,nextProps.query)})},updateActiveState:function(){this.setState({isActive:Link.isActive(this.props.to,this.getParams(),this.props.query)})},handleClick:function(event){isModifiedEvent(event)||(event.preventDefault(),transitionTo(this.props.to,this.getParams(),this.props.query))},render:function(){var props={href:this.getHref(),className:this.getClassName(),onClick:this.handleClick};return React.DOM.a(props,this.props.children)}});module.exports=Link},{"../helpers/makeHref":8,"../helpers/transitionTo":12,"../helpers/withoutProperties":13,"../mixins/ActiveState":15}],3:[function(_dereq_,module){var React="undefined"!=typeof window?window.React:"undefined"!=typeof global?global.React:null,withoutProperties=_dereq_("../helpers/withoutProperties"),RESERVED_PROPS={handler:!0,name:!0,path:!0,children:!0},Route=React.createClass({displayName:"Route",statics:{getUnreservedProps:function(props){return withoutProperties(props,RESERVED_PROPS)}},propTypes:{handler:React.PropTypes.any.isRequired,path:React.PropTypes.string,name:React.PropTypes.string},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.")}});module.exports=Route},{"../helpers/withoutProperties":13}],4:[function(_dereq_,module){function Transition(path){this.path=path,this.cancelReason=null,this.isCancelled=!1}function Abort(){}function Redirect(to,params,query){this.to=to,this.params=params,this.query=query}function findMatches(path,route){var matches,params,children=route.props.children;if(Array.isArray(children))for(var i=0,len=children.length;null==matches&&len>i;++i)matches=findMatches(path,children[i]);else children&&(matches=findMatches(path,children));if(matches){var rootParams=getRootMatch(matches).params;return params={},Path.extractParamNames(route.props.path).forEach(function(paramName){params[paramName]=rootParams[paramName]}),matches.unshift(makeMatch(route,params)),matches}return params=Path.extractParams(route.props.path,path),params?[makeMatch(route,params)]:null}function makeMatch(route,params){return{route:route,params:params}}function hasMatch(matches,match){return matches.some(function(m){if(m.route!==match.route)return!1;for(var property in m.params)if(m.params[property]!==match.params[property])return!1;return!0})}function getRootMatch(matches){return matches[matches.length-1]}function updateMatchComponents(matches,refs){for(var component,i=0;component=refs[REF_NAME];)matches[i++].component=component,refs=component.refs}function syncWithTransition(routes,transition){if(routes.state.path===transition.path)return Promise.resolve();var currentMatches=routes.state.matches,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'),nextMatches||(nextMatches=[]);var fromMatches,toMatches;return currentMatches?(updateMatchComponents(currentMatches,routes.refs),fromMatches=currentMatches.filter(function(match){return!hasMatch(nextMatches,match)}),toMatches=nextMatches.filter(function(match){return!hasMatch(currentMatches,match)})):(fromMatches=[],toMatches=nextMatches),checkTransitionFromHooks(fromMatches,transition).then(function(){return transition.isCancelled?void 0:checkTransitionToHooks(toMatches,transition).then(function(){if(!transition.isCancelled){var rootMatch=getRootMatch(nextMatches),params=rootMatch&&rootMatch.params||{},query=Path.extractQuery(transition.path)||{},state={path:transition.path,matches:nextMatches,activeParams:params,activeQuery:query,activeRoutes:nextMatches.map(function(match){return match.route})};return routes.setState(state),state}})})}function checkTransitionFromHooks(matches,transition){var promise=Promise.resolve();return reversedArray(matches).forEach(function(match){promise=promise.then(function(){var handler=match.route.props.handler;return!transition.isCancelled&&handler.willTransitionFrom?handler.willTransitionFrom(transition,match.component):void 0})}),promise}function checkTransitionToHooks(matches,transition){var promise=Promise.resolve();return matches.forEach(function(match){promise=promise.then(function(){var handler=match.route.props.handler;return!transition.isCancelled&&handler.willTransitionTo?handler.willTransitionTo(transition,match.params):void 0})}),promise}function computeHandlerProps(matches,query){var childHandler,props={ref:null,key:null,params:null,query:null,activeRouteHandler:returnNull};return reversedArray(matches).forEach(function(match){var route=match.route;props=Route.getUnreservedProps(route.props),props.ref=REF_NAME,props.key=Path.injectParams(route.props.path,match.params),props.params=match.params,props.query=query,props.activeRouteHandler=childHandler?childHandler:returnNull,childHandler=function(props,addedProps){if(arguments.length>2&&"undefined"!=typeof arguments[2])throw new Error("Passing children to a route handler is not supported");return route.props.handler(mergeProperties(props,addedProps))}.bind(this,props)}),props}function returnNull(){return null}function reversedArray(array){return array.slice(0).reverse()}var React="undefined"!=typeof window?window.React:"undefined"!=typeof global?global.React:null,warning=_dereq_("react/lib/warning"),ExecutionEnvironment=_dereq_("react/lib/ExecutionEnvironment"),mergeProperties=_dereq_("../helpers/mergeProperties"),goBack=_dereq_("../helpers/goBack"),replaceWith=_dereq_("../helpers/replaceWith"),transitionTo=_dereq_("../helpers/transitionTo"),withoutProperties=_dereq_("../helpers/withoutProperties"),Route=_dereq_("../components/Route"),Path=_dereq_("../helpers/Path"),ActiveStore=_dereq_("../stores/ActiveStore"),RouteStore=_dereq_("../stores/RouteStore"),URLStore=_dereq_("../stores/URLStore"),Promise=_dereq_("es6-promise").Promise,REF_NAME="__activeRoute__",Routes=React.createClass({displayName:"Routes",statics:{getUnreservedProps:function(props){return withoutProperties(props,RESERVED_PROPS)},handleAsyncError:function(error){throw error},handleCancelledTransition:function(transition){var reason=transition.cancelReason;reason instanceof Redirect?replaceWith(reason.to,reason.params,reason.query):reason instanceof Abort&&goBack()}},propTypes:{location:React.PropTypes.oneOf(["hash","history"]).isRequired},getDefaultProps:function(){return{location:"hash"}},getInitialState:function(){return{}},componentWillMount:function(){React.Children.forEach(this.props.children,function(child){RouteStore.registerRoute(child)}),!URLStore.isSetup()&&ExecutionEnvironment.canUseDOM&&URLStore.setup(this.props.location),URLStore.addChangeListener(this.handleRouteChange)},componentDidMount:function(){this.dispatch(URLStore.getCurrentPath())},componentWillUnmount:function(){URLStore.removeChangeListener(this.handleRouteChange)},handleRouteChange:function(){this.dispatch(URLStore.getCurrentPath())},match:function(path){var rootRoutes=this.props.children;Array.isArray(rootRoutes)||(rootRoutes=[rootRoutes]);for(var matches=null,i=0;null==matches&&i<rootRoutes.length;i++)matches=findMatches(Path.withoutQuery(path),rootRoutes[i]);return matches},dispatch:function(path,returnRejectedPromise){var transition=new Transition(path),routes=this,promise=syncWithTransition(routes,transition).then(function(newState){return transition.isCancelled?Routes.handleCancelledTransition(transition,routes):newState&&ActiveStore.updateState(newState),transition});return returnRejectedPromise||(promise=promise.then(void 0,function(error){setTimeout(function(){Routes.handleAsyncError(error,routes)})})),promise},render:function(){if(!this.state.path)return null;var matches=this.state.matches;return matches.length?matches[0].route.props.handler(computeHandlerProps(matches,this.state.activeQuery)):null}});mergeProperties(Transition.prototype,{abort:function(){this.cancelReason=new Abort,this.isCancelled=!0},redirect:function(to,params,query){this.cancelReason=new Redirect(to,params,query),this.isCancelled=!0},retry:function(){transitionTo(this.path)}}),module.exports=Routes},{"../components/Route":3,"../helpers/Path":5,"../helpers/goBack":7,"../helpers/mergeProperties":10,"../helpers/replaceWith":11,"../helpers/transitionTo":12,"../helpers/withoutProperties":13,"../stores/ActiveStore":16,"../stores/RouteStore":17,"../stores/URLStore":18,"es6-promise":22,"react/lib/ExecutionEnvironment":47,"react/lib/warning":51}],5:[function(_dereq_,module){function getParamName(pathSegment){return"*"===pathSegment?"splat":pathSegment.substr(1)}function compilePattern(pattern){if(_compiledPatterns[pattern])return _compiledPatterns[pattern];var compiled=_compiledPatterns[pattern]={},paramNames=compiled.paramNames=[],source=pattern.replace(paramMatcher,function(match,pathSegment){return paramNames.push(getParamName(pathSegment)),"*"===pathSegment?"(.*?)":"([^/?#]+)"});return compiled.matcher=new RegExp("^"+source+"$","i"),compiled}function isDynamicPattern(pattern){return-1!==pattern.indexOf(":")||-1!==pattern.indexOf("*")}var invariant=_dereq_("react/lib/invariant"),qs=_dereq_("querystring"),mergeProperties=_dereq_("./mergeProperties"),URL=_dereq_("./URL"),paramMatcher=/((?::[a-z_$][a-z0-9_$]*)|\*)/gi,queryMatcher=/\?(.+)/,_compiledPatterns={},Path={extractParams:function(pattern,path){if(!pattern)return null;if(!isDynamicPattern(pattern))return pattern===URL.decode(path)?{}:null;var compiled=compilePattern(pattern),match=URL.decode(path).match(compiled.matcher);if(!match)return null;var params={};return compiled.paramNames.forEach(function(paramName,index){params[paramName]=match[index+1]}),params},extractParamNames:function(pattern){return pattern?compilePattern(pattern).paramNames:[]},injectParams:function(pattern,params){return pattern?isDynamicPattern(pattern)?(params=params||{},pattern.replace(paramMatcher,function(match,pathSegment){var paramName=getParamName(pathSegment);return invariant(null!=params[paramName],'Missing "'+paramName+'" parameter for path "'+pattern+'"'),String(params[paramName]).split("/").map(URL.encode).join("/")})):pattern:null},extractQuery:function(path){var match=path.match(queryMatcher);return match&&qs.parse(match[1])},withoutQuery:function(path){return path.replace(queryMatcher,"")},withQuery:function(path,query){var existingQuery=Path.extractQuery(path);existingQuery&&(query=query?mergeProperties(existingQuery,query):existingQuery);var queryString=query&&qs.stringify(query);return queryString?Path.withoutQuery(path)+"?"+queryString:path},normalize:function(path){return path.replace(/^\/*/,"/")}};module.exports=Path},{"./URL":6,"./mergeProperties":10,querystring:21,"react/lib/invariant":50}],6:[function(_dereq_,module){var urlEncodedSpaceRE=/\+/g,encodedSpaceRE=/%20/g,URL={decode:function(str){return str=str.replace(urlEncodedSpaceRE," "),decodeURIComponent(str)},encode:function(str){return str=encodeURIComponent(str),str.replace(encodedSpaceRE,"+")}};module.exports=URL},{}],7:[function(_dereq_,module){function goBack(){URLStore.back()}var URLStore=_dereq_("../stores/URLStore");module.exports=goBack},{"../stores/URLStore":18}],8:[function(_dereq_,module){function makeHref(routeName,params,query){var path=makePath(routeName,params,query);return"hash"===URLStore.getLocation()?"#"+path:path}var URLStore=_dereq_("../stores/URLStore"),makePath=_dereq_("./makePath");module.exports=makeHref},{"../stores/URLStore":18,"./makePath":9}],9:[function(_dereq_,module){function makePath(to,params,query){var path;if("/"===to.charAt(0))path=Path.normalize(to);else{var route=RouteStore.getRouteByName(to);invariant(route,'Unable to find a route named "'+to+'". Make sure you have a <Route name="'+to+'"> defined somewhere in your routes'),path=route.props.path}return Path.withQuery(Path.injectParams(path,params),query)}var invariant=_dereq_("react/lib/invariant"),RouteStore=_dereq_("../stores/RouteStore"),Path=_dereq_("./Path");module.exports=makePath},{"../stores/RouteStore":17,"./Path":5,"react/lib/invariant":50}],10:[function(_dereq_,module){function mergeProperties(object,properties){for(var property in properties)properties.hasOwnProperty(property)&&(object[property]=properties[property]);return object}module.exports=mergeProperties},{}],11:[function(_dereq_,module){function replaceWith(to,params,query){URLStore.replace(makePath(to,params,query))}var URLStore=_dereq_("../stores/URLStore"),makePath=_dereq_("./makePath");module.exports=replaceWith},{"../stores/URLStore":18,"./makePath":9}],12:[function(_dereq_,module){function transitionTo(to,params,query){URLStore.push(makePath(to,params,query))}var URLStore=_dereq_("../stores/URLStore"),makePath=_dereq_("./makePath");module.exports=transitionTo},{"../stores/URLStore":18,"./makePath":9}],13:[function(_dereq_,module){function withoutProperties(object,properties){var result={};for(var property in object)object.hasOwnProperty(property)&&!properties[property]&&(result[property]=object[property]);return result}module.exports=withoutProperties},{}],14:[function(_dereq_,module,exports){exports.Link=_dereq_("./components/Link"),exports.Route=_dereq_("./components/Route"),exports.Routes=_dereq_("./components/Routes"),exports.goBack=_dereq_("./helpers/goBack"),exports.replaceWith=_dereq_("./helpers/replaceWith"),exports.transitionTo=_dereq_("./helpers/transitionTo"),exports.ActiveState=_dereq_("./mixins/ActiveState"),exports.Router=_dereq_("./Router")},{"./Router":1,"./components/Link":2,"./components/Route":3,"./components/Routes":4,"./helpers/goBack":7,"./helpers/replaceWith":11,"./helpers/transitionTo":12,"./mixins/ActiveState":15}],15:[function(_dereq_,module){var ActiveStore=_dereq_("../stores/ActiveStore"),ActiveState={statics:{isActive:ActiveStore.isActive},componentWillMount:function(){ActiveStore.addChangeListener(this.handleActiveStateChange)},componentDidMount:function(){this.updateActiveState&&this.updateActiveState()},componentWillUnmount:function(){ActiveStore.removeChangeListener(this.handleActiveStateChange)},handleActiveStateChange:function(){this.isMounted()&&this.updateActiveState&&this.updateActiveState()}};module.exports=ActiveState},{"../stores/ActiveStore":16}],16:[function(_dereq_,module){function routeIsActive(routeName){return _activeRoutes.some(function(route){return route.props.name===routeName})}function paramsAreActive(params){for(var property in params)if(_activeParams[property]!==String(params[property]))return!1;return!0}function queryIsActive(query){for(var property in query)if(_activeQuery[property]!==String(query[property]))return!1;return!0}function notifyChange(){_events.emit("change")}var _activeRoutes=[],_activeParams={},_activeQuery={},EventEmitter=_dereq_("event-emitter"),_events=EventEmitter(),ActiveStore={addChangeListener:function(listener){_events.on("change",listener)},removeChangeListener:function(listener){_events.off("change",listener)},updateState:function(state){state=state||{},_activeRoutes=state.activeRoutes||[],_activeParams=state.activeParams||{},_activeQuery=state.activeQuery||{},notifyChange()},isActive:function(routeName,params,query){var isActive=routeIsActive(routeName)&¶msAreActive(params);return query?isActive&&queryIsActive(query):isActive}};module.exports=ActiveStore},{"event-emitter":32}],17:[function(_dereq_,module){var React="undefined"!=typeof window?window.React:"undefined"!=typeof global?global.React:null,invariant=_dereq_("react/lib/invariant"),Path=(_dereq_("react/lib/warning"),_dereq_("../helpers/Path")),_namedRoutes={},RouteStore={registerRoute:function(route,_parentRoute){if(route.props.path=route.props.path||route.props.name?Path.normalize(route.props.path||route.props.name):"/",invariant(React.isValidClass(route.props.handler),'The handler for Route "'+(route.props.name||route.props.path)+'" must be a valid React component'),_parentRoute){var paramNames=Path.extractParamNames(route.props.path);Path.extractParamNames(_parentRoute.props.path).forEach(function(paramName){invariant(-1!==paramNames.indexOf(paramName),'The nested route path "'+route.props.path+'" is missing the "'+paramName+'" parameter of its parent path "'+_parentRoute.props.path+'"')})}if(route.props.name){var existingRoute=_namedRoutes[route.props.name];invariant(!existingRoute||route===existingRoute,'You cannot use the name "'+route.props.name+'" for more than one route'),_namedRoutes[route.props.name]=route}React.Children.forEach(route.props.children,function(child){RouteStore.registerRoute(child,route)})},unregisterRoute:function(route){route.props.name&&delete _namedRoutes[route.props.name],React.Children.forEach(route.props.children,function(){RouteStore.unregisterRoute(route)})},getRouteByName:function(routeName){return _namedRoutes[routeName]||null}};module.exports=RouteStore},{"../helpers/Path":5,"react/lib/invariant":50,"react/lib/warning":51}],18:[function(_dereq_,module){function getWindowPath(){return window.location.pathname+window.location.search}function notifyChange(){_events.emit("change")}var _location,ExecutionEnvironment=_dereq_("react/lib/ExecutionEnvironment"),invariant=_dereq_("react/lib/invariant"),warning=_dereq_("react/lib/warning"),CHANGE_EVENTS={hash:window.addEventListener?"hashchange":"onhashchange",history:"popstate"},_currentPath="/",_lastPath=null,EventEmitter=_dereq_("event-emitter"),_events=EventEmitter(),URLStore={addChangeListener:function(listener){_events.on("change",listener)},removeChangeListener:function(listener){_events.off("change",listener)},getLocation:function(){return _location||"hash"},getCurrentPath:function(){return"history"===_location?getWindowPath():"hash"===_location?window.location.hash.substr(1):_currentPath},push:function(path){"history"===_location?(window.history.pushState({path:path},"",path),notifyChange()):"hash"===_location?window.location.hash=path:(_lastPath=_currentPath,_currentPath=path,notifyChange())},replace:function(path){"history"===_location?(window.history.replaceState({path:path},"",path),notifyChange()):"hash"===_location?window.location.replace(getWindowPath()+"#"+path):(_currentPath=path,notifyChange())},back:function(){null!=_location?window.history.back():(invariant(_lastPath,"You cannot make the URL store go back more than once when it does not use the DOM"),_currentPath=_lastPath,_lastPath=null,notifyChange())},isSetup:function(){return null!=_location},setup:function(location){if(invariant(ExecutionEnvironment.canUseDOM,"You cannot setup the URL store in an environment with no DOM"),null!=_location)return void warning(_location===location,"The URL store was already setup using "+_location+" location. You cannot use "+location+" location on the same page");var changeEvent=CHANGE_EVENTS[location];invariant(changeEvent,'The URL store location "'+location+'" is not valid. It must be either "hash" or "history"'),_location=location,"hash"===location&&""===window.location.hash&&URLStore.replace("/"),window.addEventListener?window.addEventListener(changeEvent,notifyChange,!1):window.attachEvent(changeEvent,notifyChange),notifyChange()},teardown:function(){if(null!=_location){var changeEvent=CHANGE_EVENTS[_location];window.removeEventListener?window.removeEventListener(changeEvent,notifyChange,!1):window.detachEvent(changeEvent,notifyChange),_location=null}}};module.exports=URLStore},{"event-emitter":32,"react/lib/ExecutionEnvironment":47,"react/lib/invariant":50,"react/lib/warning":51}],19:[function(_dereq_,module){"use strict";function hasOwnProperty(obj,prop){return Object.prototype.hasOwnProperty.call(obj,prop)}module.exports=function(qs,sep,eq,options){sep=sep||"&",eq=eq||"=";var obj={};if("string"!=typeof qs||0===qs.length)return obj;var regexp=/\+/g;qs=qs.split(sep);var maxKeys=1e3;options&&"number"==typeof options.maxKeys&&(maxKeys=options.maxKeys);var len=qs.length;maxKeys>0&&len>maxKeys&&(len=maxKeys);for(var i=0;len>i;++i){var kstr,vstr,k,v,x=qs[i].replace(regexp,"%20"),idx=x.indexOf(eq);idx>=0?(kstr=x.substr(0,idx),vstr=x.substr(idx+1)):(kstr=x,vstr=""),k=decodeURIComponent(kstr),v=decodeURIComponent(vstr),hasOwnProperty(obj,k)?isArray(obj[k])?obj[k].push(v):obj[k]=[obj[k],v]:obj[k]=v}return obj};var isArray=Array.isArray||function(xs){return"[object Array]"===Object.prototype.toString.call(xs)}},{}],20:[function(_dereq_,module){"use strict";function map(xs,f){if(xs.map)return xs.map(f);for(var res=[],i=0;i<xs.length;i++)res.push(f(xs[i],i));return res}var stringifyPrimitive=function(v){switch(typeof v){case"string":return v;case"boolean":return v?"true":"false";case"number":return isFinite(v)?v:"";default:return""}};module.exports=function(obj,sep,eq,name){return sep=sep||"&",eq=eq||"=",null===obj&&(obj=void 0),"object"==typeof obj?map(objectKeys(obj),function(k){var ks=encodeURIComponent(stringifyPrimitive(k))+eq;return isArray(obj[k])?map(obj[k],function(v){return ks+encodeURIComponent(stringifyPrimitive(v))}).join(sep):ks+encodeURIComponent(stringifyPrimitive(obj[k]))}).join(sep):name?encodeURIComponent(stringifyPrimitive(name))+eq+encodeURIComponent(stringifyPrimitive(obj)):""};var isArray=Array.isArray||function(xs){return"[object Array]"===Object.prototype.toString.call(xs)},objectKeys=Object.keys||function(obj){var res=[];for(var key in obj)Object.prototype.hasOwnProperty.call(obj,key)&&res.push(key);return res}},{}],21:[function(_dereq_,module,exports){"use strict";exports.decode=exports.parse=_dereq_("./decode"),exports.encode=exports.stringify=_dereq_("./encode")},{"./decode":19,"./encode":20}],22:[function(_dereq_,module,exports){"use strict";var Promise=_dereq_("./promise/promise").Promise,polyfill=_dereq_("./promise/polyfill").polyfill;exports.Promise=Promise,exports.polyfill=polyfill},{"./promise/polyfill":26,"./promise/promise":27}],23:[function(_dereq_,module,exports){"use strict";function all(promises){var Promise=this;if(!isArray(promises))throw new TypeError("You must pass an array to all.");return new Promise(function(resolve,reject){function resolver(index){return function(value){resolveAll(index,value)}}function resolveAll(index,value){results[index]=value,0===--remaining&&resolve(results)}var promise,results=[],remaining=promises.length;0===remaining&&resolve([]);for(var i=0;i<promises.length;i++)promise=promises[i],promise&&isFunction(promise.then)?promise.then(resolver(i),reject):resolveAll(i,promise)})}var isArray=_dereq_("./utils").isArray,isFunction=_dereq_("./utils").isFunction;exports.all=all},{"./utils":31}],24:[function(_dereq_,module,exports){"use strict";function useNextTick(){return function(){process.nextTick(flush)}}function useMutationObserver(){var iterations=0,observer=new BrowserMutationObserver(flush),node=document.createTextNode("");return observer.observe(node,{characterData:!0}),function(){node.data=iterations=++iterations%2}}function useSetTimeout(){return function(){local.setTimeout(flush,1)}}function flush(){for(var i=0;i<queue.length;i++){var tuple=queue[i],callback=tuple[0],arg=tuple[1];callback(arg)}queue=[]}function asap(callback,arg){var length=queue.push([callback,arg]);1===length&&scheduleFlush()}var scheduleFlush,browserGlobal="undefined"!=typeof window?window:{},BrowserMutationObserver=browserGlobal.MutationObserver||browserGlobal.WebKitMutationObserver,local="undefined"!=typeof global?global:void 0===this?window:this,queue=[];scheduleFlush="undefined"!=typeof process&&"[object process]"==={}.toString.call(process)?useNextTick():BrowserMutationObserver?useMutationObserver():useSetTimeout(),exports.asap=asap},{}],25:[function(_dereq_,module,exports){"use strict";function configure(name,value){return 2!==arguments.length?config[name]:void(config[name]=value)}var config={instrument:!1};exports.config=config,exports.configure=configure},{}],26:[function(_dereq_,module,exports){"use strict";function polyfill(){var local;local="undefined"!=typeof global?global:"undefined"!=typeof window&&window.document?window:self;var es6PromiseSupport="Promise"in local&&"resolve"in local.Promise&&"reject"in local.Promise&&"all"in local.Promise&&"race"in local.Promise&&function(){var resolve;return new local.Promise(function(r){resolve=r}),isFunction(resolve)}();es6PromiseSupport||(local.Promise=RSVPPromise)}var RSVPPromise=_dereq_("./promise").Promise,isFunction=_dereq_("./utils").isFunction;exports.polyfill=polyfill},{"./promise":27,"./utils":31}],27:[function(_dereq_,module,exports){"use strict";function Promise(resolver){if(!isFunction(resolver))throw new TypeError("You must pass a resolver function as the first argument to the promise constructor");if(!(this instanceof Promise))throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.");this._subscribers=[],invokeResolver(resolver,this)}function invokeResolver(resolver,promise){function resolvePromise(value){resolve(promise,value)}function rejectPromise(reason){reject(promise,reason)}try{resolver(resolvePromise,rejectPromise)}catch(e){rejectPromise(e)}}function invokeCallback(settled,promise,callback,detail){var value,error,succeeded,failed,hasCallback=isFunction(callback);if(hasCallback)try{value=callback(detail),succeeded=!0}catch(e){failed=!0,error=e}else value=detail,succeeded=!0;handleThenable(promise,value)||(hasCallback&&succeeded?resolve(promise,value):failed?reject(promise,error):settled===FULFILLED?resolve(promise,value):settled===REJECTED&&reject(promise,value))}function subscribe(parent,child,onFulfillment,onRejection){var subscribers=parent._subscribers,length=subscribers.length;subscribers[length]=child,subscribers[length+FULFILLED]=onFulfillment,subscribers[length+REJECTED]=onRejection}function publish(promise,settled){for(var child,callback,subscribers=promise._subscribers,detail=promise._detail,i=0;i<subscribers.length;i+=3)child=subscribers[i],callback=subscribers[i+settled],invokeCallback(settled,child,callback,detail);promise._subscribers=null}function handleThenable(promise,value){var resolved,then=null;try{if(promise===value)throw new TypeError("A promises callback cannot return that same promise.");if(objectOrFunction(value)&&(then=value.then,isFunction(then)))return then.call(value,function(val){return resolved?!0:(resolved=!0,void(value!==val?resolve(promise,val):fulfill(promise,val)))},function(val){return resolved?!0:(resolved=!0,void reject(promise,val))}),!0}catch(error){return resolved?!0:(reject(promise,error),!0)}return!1}function resolve(promise,value){promise===value?fulfill(promise,value):handleThenable(promise,value)||fulfill(promise,value)}function fulfill(promise,value){promise._state===PENDING&&(promise._state=SEALED,promise._detail=value,config.async(publishFulfillment,promise))}function reject(promise,reason){promise._state===PENDING&&(promise._state=SEALED,promise._detail=reason,config.async(publishRejection,promise))}function publishFulfillment(promise){publish(promise,promise._state=FULFILLED)}function publishRejection(promise){publish(promise,promise._state=REJECTED)}var config=_dereq_("./config").config,objectOrFunction=(_dereq_("./config").configure,_dereq_("./utils").objectOrFunction),isFunction=_dereq_("./utils").isFunction,all=(_dereq_("./utils").now,_dereq_("./all").all),race=_dereq_("./race").race,staticResolve=_dereq_("./resolve").resolve,staticReject=_dereq_("./reject").reject,asap=_dereq_("./asap").asap;config.async=asap;var PENDING=void 0,SEALED=0,FULFILLED=1,REJECTED=2;Promise.prototype={constructor:Promise,_state:void 0,_detail:void 0,_subscribers:void 0,then:function(onFulfillment,onRejection){var promise=this,thenPromise=new this.constructor(function(){});if(this._state){var callbacks=arguments;config.async(function(){invokeCallback(promise._state,thenPromise,callbacks[promise._state-1],promise._detail)})}else subscribe(this,thenPromise,onFulfillment,onRejection);return thenPromise},"catch":function(onRejection){return this.then(null,onRejection)}},Promise.all=all,Promise.race=race,Promise.resolve=staticResolve,Promise.reject=staticReject,exports.Promise=Promise},{"./all":23,"./asap":24,"./config":25,"./race":28,"./reject":29,"./resolve":30,"./utils":31}],28:[function(_dereq_,module,exports){"use strict";function race(promises){var Promise=this;if(!isArray(promises))throw new TypeError("You must pass an array to race.");return new Promise(function(resolve,reject){for(var promise,i=0;i<promises.length;i++)promise=promises[i],promise&&"function"==typeof promise.then?promise.then(resolve,reject):resolve(promise)})}var isArray=_dereq_("./utils").isArray;exports.race=race},{"./utils":31}],29:[function(_dereq_,module,exports){"use strict";function reject(reason){var Promise=this;return new Promise(function(resolve,reject){reject(reason)})}exports.reject=reject},{}],30:[function(_dereq_,module,exports){"use strict";function resolve(value){if(value&&"object"==typeof value&&value.constructor===this)return value;var Promise=this;return new Promise(function(resolve){resolve(value)})}exports.resolve=resolve},{}],31:[function(_dereq_,module,exports){"use strict";function objectOrFunction(x){return isFunction(x)||"object"==typeof x&&null!==x}function isFunction(x){return"function"==typeof x}function isArray(x){return"[object Array]"===Object.prototype.toString.call(x)}var now=Date.now||function(){return(new Date).getTime()};exports.objectOrFunction=objectOrFunction,exports.isFunction=isFunction,exports.isArray=isArray,exports.now=now},{}],32:[function(_dereq_,module,exports){"use strict";var on,once,off,emit,methods,descriptors,base,d=_dereq_("d"),callable=_dereq_("es5-ext/object/valid-callable"),apply=Function.prototype.apply,call=Function.prototype.call,create=Object.create,defineProperty=Object.defineProperty,defineProperties=Object.defineProperties,hasOwnProperty=Object.prototype.hasOwnProperty,descriptor={configurable:!0,enumerable:!1,writable:!0}; | ||
on=function(type,listener){var data;return callable(listener),hasOwnProperty.call(this,"__ee__")?data=this.__ee__:(data=descriptor.value=create(null),defineProperty(this,"__ee__",descriptor),descriptor.value=null),data[type]?"object"==typeof data[type]?data[type].push(listener):data[type]=[data[type],listener]:data[type]=listener,this},once=function(type,listener){var once,self;return callable(listener),self=this,on.call(this,type,once=function(){off.call(self,type,once),apply.call(listener,this,arguments)}),once.__eeOnceListener__=listener,this},off=function(type,listener){var data,listeners,candidate,i;if(callable(listener),!hasOwnProperty.call(this,"__ee__"))return this;if(data=this.__ee__,!data[type])return this;if(listeners=data[type],"object"==typeof listeners)for(i=0;candidate=listeners[i];++i)(candidate===listener||candidate.__eeOnceListener__===listener)&&(2===listeners.length?data[type]=listeners[i?0:1]:listeners.splice(i,1));else(listeners===listener||listeners.__eeOnceListener__===listener)&&delete data[type];return this},emit=function(type){var i,l,listener,listeners,args;if(hasOwnProperty.call(this,"__ee__")&&(listeners=this.__ee__[type]))if("object"==typeof listeners){for(l=arguments.length,args=new Array(l-1),i=1;l>i;++i)args[i-1]=arguments[i];for(listeners=listeners.slice(),i=0;listener=listeners[i];++i)apply.call(listener,this,args)}else switch(arguments.length){case 1:call.call(listeners,this);break;case 2:call.call(listeners,this,arguments[1]);break;case 3:call.call(listeners,this,arguments[1],arguments[2]);break;default:for(l=arguments.length,args=new Array(l-1),i=1;l>i;++i)args[i-1]=arguments[i];apply.call(listeners,this,args)}},methods={on:on,once:once,off:off,emit:emit},descriptors={on:d(on),once:d(once),off:d(off),emit:d(emit)},base=defineProperties({},descriptors),module.exports=exports=function(o){return null==o?create(base):defineProperties(Object(o),descriptors)},exports.methods=methods},{d:33,"es5-ext/object/valid-callable":42}],33:[function(_dereq_,module){"use strict";var d,assign=_dereq_("es5-ext/object/assign"),normalizeOpts=_dereq_("es5-ext/object/normalize-options"),isCallable=_dereq_("es5-ext/object/is-callable"),contains=_dereq_("es5-ext/string/#/contains");d=module.exports=function(dscr,value){var c,e,w,options,desc;return arguments.length<2||"string"!=typeof dscr?(options=value,value=dscr,dscr=null):options=arguments[2],null==dscr?(c=w=!0,e=!1):(c=contains.call(dscr,"c"),e=contains.call(dscr,"e"),w=contains.call(dscr,"w")),desc={value:value,configurable:c,enumerable:e,writable:w},options?assign(normalizeOpts(options),desc):desc},d.gs=function(dscr,get,set){var c,e,options,desc;return"string"!=typeof dscr?(options=set,set=get,get=dscr,dscr=null):options=arguments[3],null==get?get=void 0:isCallable(get)?null==set?set=void 0:isCallable(set)||(options=set,set=void 0):(options=get,get=set=void 0),null==dscr?(c=!0,e=!1):(c=contains.call(dscr,"c"),e=contains.call(dscr,"e")),desc={get:get,set:set,configurable:c,enumerable:e},options?assign(normalizeOpts(options),desc):desc}},{"es5-ext/object/assign":34,"es5-ext/object/is-callable":37,"es5-ext/object/normalize-options":41,"es5-ext/string/#/contains":44}],34:[function(_dereq_,module){"use strict";module.exports=_dereq_("./is-implemented")()?Object.assign:_dereq_("./shim")},{"./is-implemented":35,"./shim":36}],35:[function(_dereq_,module){"use strict";module.exports=function(){var obj,assign=Object.assign;return"function"!=typeof assign?!1:(obj={foo:"raz"},assign(obj,{bar:"dwa"},{trzy:"trzy"}),obj.foo+obj.bar+obj.trzy==="razdwatrzy")}},{}],36:[function(_dereq_,module){"use strict";var keys=_dereq_("../keys"),value=_dereq_("../valid-value"),max=Math.max;module.exports=function(dest,src){var error,i,assign,l=max(arguments.length,2);for(dest=Object(value(dest)),assign=function(key){try{dest[key]=src[key]}catch(e){error||(error=e)}},i=1;l>i;++i)src=arguments[i],keys(src).forEach(assign);if(void 0!==error)throw error;return dest}},{"../keys":38,"../valid-value":43}],37:[function(_dereq_,module){"use strict";module.exports=function(obj){return"function"==typeof obj}},{}],38:[function(_dereq_,module){"use strict";module.exports=_dereq_("./is-implemented")()?Object.keys:_dereq_("./shim")},{"./is-implemented":39,"./shim":40}],39:[function(_dereq_,module){"use strict";module.exports=function(){try{return Object.keys("primitive"),!0}catch(e){return!1}}},{}],40:[function(_dereq_,module){"use strict";var keys=Object.keys;module.exports=function(object){return keys(null==object?object:Object(object))}},{}],41:[function(_dereq_,module){"use strict";var process,assign=_dereq_("./assign"),forEach=Array.prototype.forEach,create=Object.create,getPrototypeOf=Object.getPrototypeOf;process=function(src,obj){var proto=getPrototypeOf(src);return assign(proto?process(proto,obj):obj,src)},module.exports=function(){var result=create(null);return forEach.call(arguments,function(options){null!=options&&process(Object(options),result)}),result}},{"./assign":34}],42:[function(_dereq_,module){"use strict";module.exports=function(fn){if("function"!=typeof fn)throw new TypeError(fn+" is not a function");return fn}},{}],43:[function(_dereq_,module){"use strict";module.exports=function(value){if(null==value)throw new TypeError("Cannot use null or undefined");return value}},{}],44:[function(_dereq_,module){"use strict";module.exports=_dereq_("./is-implemented")()?String.prototype.contains:_dereq_("./shim")},{"./is-implemented":45,"./shim":46}],45:[function(_dereq_,module){"use strict";var str="razdwatrzy";module.exports=function(){return"function"!=typeof str.contains?!1:str.contains("dwa")===!0&&str.contains("foo")===!1}},{}],46:[function(_dereq_,module){"use strict";var indexOf=String.prototype.indexOf;module.exports=function(searchString){return indexOf.call(this,searchString,arguments[1])>-1}},{}],47:[function(_dereq_,module){"use strict";var canUseDOM=!("undefined"==typeof window||!window.document||!window.document.createElement),ExecutionEnvironment={canUseDOM:canUseDOM,canUseWorkers:"undefined"!=typeof Worker,canUseEventListeners:canUseDOM&&!(!window.addEventListener&&!window.attachEvent),canUseViewport:canUseDOM&&!!window.screen,isInWorker:!canUseDOM};module.exports=ExecutionEnvironment},{}],48:[function(_dereq_,module){function copyProperties(obj,a,b,c,d,e,f){obj=obj||{};for(var v,args=[a,b,c,d,e],ii=0;args[ii];){v=args[ii++];for(var k in v)obj[k]=v[k];v.hasOwnProperty&&v.hasOwnProperty("toString")&&"undefined"!=typeof v.toString&&obj.toString!==v.toString&&(obj.toString=v.toString)}return obj}module.exports=copyProperties},{}],49:[function(_dereq_,module){function makeEmptyFunction(arg){return function(){return arg}}function emptyFunction(){}var copyProperties=_dereq_("./copyProperties");copyProperties(emptyFunction,{thatReturns:makeEmptyFunction,thatReturnsFalse:makeEmptyFunction(!1),thatReturnsTrue:makeEmptyFunction(!0),thatReturnsNull:makeEmptyFunction(null),thatReturnsThis:function(){return this},thatReturnsArgument:function(arg){return arg}}),module.exports=emptyFunction},{"./copyProperties":48}],50:[function(_dereq_,module){"use strict";var invariant=function(condition,format,a,b,c,d,e,f){if(!condition){var error;if(void 0===format)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],argIndex=0;error=new Error("Invariant Violation: "+format.replace(/%s/g,function(){return args[argIndex++]}))}throw error.framesToPop=1,error}};module.exports=invariant},{}],51:[function(_dereq_,module){"use strict";var emptyFunction=_dereq_("./emptyFunction"),warning=emptyFunction;module.exports=warning},{"./emptyFunction":49}]},{},[14])(14)}); | ||
!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(){return function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a="function"==typeof require&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);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}for(var i="function"==typeof require&&require,o=0;o<r.length;o++)s(r[o]);return s}({1:[function(_dereq_,module){function Router(route){return warning(!1,"The Router(<Route>).renderComponent(container) interface is deprecated and will be removed soon. Use React.renderComponent(<Route>, container) instead"),{renderComponent:function(container,callback){return React.renderComponent(route,container,callback)}}}var React="undefined"!=typeof window?window.React:"undefined"!=typeof global?global.React:null,warning=_dereq_("react/lib/warning");module.exports=Router},{"react/lib/warning":53}],2:[function(_dereq_,module){function isLeftClick(event){return 0===event.button}function isModifiedEvent(event){return!!(event.metaKey||event.altKey||event.ctrlKey||event.shiftKey)}var React="undefined"!=typeof window?window.React:"undefined"!=typeof global?global.React:null,ActiveState=_dereq_("../mixins/ActiveState"),withoutProperties=_dereq_("../helpers/withoutProperties"),transitionTo=_dereq_("../helpers/transitionTo"),makeHref=_dereq_("../helpers/makeHref"),RESERVED_PROPS={to:!0,className:!0,activeClassName:!0,query:!0,children:!0},Link=React.createClass({displayName:"Link",mixins:[ActiveState],statics:{getUnreservedProps:function(props){return withoutProperties(props,RESERVED_PROPS)}},propTypes:{to:React.PropTypes.string.isRequired,activeClassName:React.PropTypes.string.isRequired,query:React.PropTypes.object},getDefaultProps:function(){return{activeClassName:"active"}},getInitialState:function(){return{isActive:!1}},getParams:function(){return Link.getUnreservedProps(this.props)},getHref:function(){return makeHref(this.props.to,this.getParams(),this.props.query)},getClassName:function(){var className=this.props.className||"";return this.state.isActive?className+" "+this.props.activeClassName:className},componentWillReceiveProps:function(nextProps){var params=Link.getUnreservedProps(nextProps);this.setState({isActive:Link.isActive(nextProps.to,params,nextProps.query)})},updateActiveState:function(){this.setState({isActive:Link.isActive(this.props.to,this.getParams(),this.props.query)})},handleClick:function(event){!isModifiedEvent(event)&&isLeftClick(event)&&(event.preventDefault(),transitionTo(this.props.to,this.getParams(),this.props.query))},render:function(){var props={href:this.getHref(),className:this.getClassName(),onClick:this.handleClick};return React.DOM.a(props,this.props.children)}});module.exports=Link},{"../helpers/makeHref":8,"../helpers/transitionTo":13,"../helpers/withoutProperties":14,"../mixins/ActiveState":16}],3:[function(_dereq_,module){var React="undefined"!=typeof window?window.React:"undefined"!=typeof global?global.React:null,withoutProperties=_dereq_("../helpers/withoutProperties"),RESERVED_PROPS={handler:!0,name:!0,path:!0,children:!0},Route=React.createClass({displayName:"Route",statics:{getUnreservedProps:function(props){return withoutProperties(props,RESERVED_PROPS)}},propTypes:{handler:React.PropTypes.any.isRequired,path:React.PropTypes.string,name:React.PropTypes.string},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.")}});module.exports=Route},{"../helpers/withoutProperties":14}],4:[function(_dereq_,module){function Transition(path){this.path=path,this.cancelReason=null,this.isCancelled=!1}function Abort(){}function Redirect(to,params,query){this.to=to,this.params=params,this.query=query}function findMatches(path,route){var matches,params,children=route.props.children;if(Array.isArray(children))for(var i=0,len=children.length;null==matches&&len>i;++i)matches=findMatches(path,children[i]);else children&&(matches=findMatches(path,children));if(matches){var rootParams=getRootMatch(matches).params;return params={},Path.extractParamNames(route.props.path).forEach(function(paramName){params[paramName]=rootParams[paramName]}),matches.unshift(makeMatch(route,params)),matches}return params=Path.extractParams(route.props.path,path),params?[makeMatch(route,params)]:null}function makeMatch(route,params){return{route:route,params:params}}function hasMatch(matches,match){return matches.some(function(m){if(m.route!==match.route)return!1;for(var property in m.params)if(m.params[property]!==match.params[property])return!1;return!0})}function getRootMatch(matches){return matches[matches.length-1]}function updateMatchComponents(matches,refs){for(var component,i=0;component=refs[REF_NAME];)matches[i++].component=component,refs=component.refs}function syncWithTransition(routes,transition){if(routes.state.path===transition.path)return Promise.resolve();var currentMatches=routes.state.matches,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'),nextMatches||(nextMatches=[]);var fromMatches,toMatches;return currentMatches?(updateMatchComponents(currentMatches,routes.refs),fromMatches=currentMatches.filter(function(match){return!hasMatch(nextMatches,match)}),toMatches=nextMatches.filter(function(match){return!hasMatch(currentMatches,match)})):(fromMatches=[],toMatches=nextMatches),checkTransitionFromHooks(fromMatches,transition).then(function(){return transition.isCancelled?void 0:checkTransitionToHooks(toMatches,transition).then(function(){if(!transition.isCancelled){var rootMatch=getRootMatch(nextMatches),params=rootMatch&&rootMatch.params||{},query=Path.extractQuery(transition.path)||{},state={path:transition.path,matches:nextMatches,activeParams:params,activeQuery:query,activeRoutes:nextMatches.map(function(match){return match.route})};return routes.setState(state),state}})})}function checkTransitionFromHooks(matches,transition){var promise=Promise.resolve();return reversedArray(matches).forEach(function(match){promise=promise.then(function(){var handler=match.route.props.handler;return!transition.isCancelled&&handler.willTransitionFrom?handler.willTransitionFrom(transition,match.component):void 0})}),promise}function checkTransitionToHooks(matches,transition){var promise=Promise.resolve();return matches.forEach(function(match){promise=promise.then(function(){var handler=match.route.props.handler;return!transition.isCancelled&&handler.willTransitionTo?handler.willTransitionTo(transition,match.params):void 0})}),promise}function computeHandlerProps(matches,query){var childHandler,props={ref:null,key:null,params:null,query:null,activeRouteHandler:returnNull};return reversedArray(matches).forEach(function(match){var route=match.route;props=Route.getUnreservedProps(route.props),props.ref=REF_NAME,props.key=Path.injectParams(route.props.path,match.params),props.params=match.params,props.query=query,props.activeRouteHandler=childHandler?childHandler:returnNull,childHandler=function(props,addedProps){if(arguments.length>2&&"undefined"!=typeof arguments[2])throw new Error("Passing children to a route handler is not supported");return route.props.handler(mergeProperties(props,addedProps))}.bind(this,props)}),props}function returnNull(){return null}function reversedArray(array){return array.slice(0).reverse()}var React="undefined"!=typeof window?window.React:"undefined"!=typeof global?global.React:null,warning=_dereq_("react/lib/warning"),ExecutionEnvironment=_dereq_("react/lib/ExecutionEnvironment"),mergeProperties=_dereq_("../helpers/mergeProperties"),goBack=_dereq_("../helpers/goBack"),replaceWith=_dereq_("../helpers/replaceWith"),transitionTo=_dereq_("../helpers/transitionTo"),Route=_dereq_("../components/Route"),Path=_dereq_("../helpers/Path"),ActiveStore=_dereq_("../stores/ActiveStore"),RouteStore=_dereq_("../stores/RouteStore"),URLStore=_dereq_("../stores/URLStore"),Promise=_dereq_("es6-promise").Promise,REF_NAME="__activeRoute__",Routes=React.createClass({displayName:"Routes",statics:{handleAsyncError:function(error){throw error},handleCancelledTransition:function(transition){var reason=transition.cancelReason;reason instanceof Redirect?replaceWith(reason.to,reason.params,reason.query):reason instanceof Abort&&goBack()}},propTypes:{location:React.PropTypes.oneOf(["hash","history"]).isRequired},getDefaultProps:function(){return{location:"hash"}},getInitialState:function(){return{}},componentWillMount:function(){React.Children.forEach(this.props.children,function(child){RouteStore.registerRoute(child)}),!URLStore.isSetup()&&ExecutionEnvironment.canUseDOM&&URLStore.setup(this.props.location),URLStore.addChangeListener(this.handleRouteChange)},componentDidMount:function(){this.dispatch(URLStore.getCurrentPath())},componentWillUnmount:function(){URLStore.removeChangeListener(this.handleRouteChange)},handleRouteChange:function(){this.dispatch(URLStore.getCurrentPath())},match:function(path){var rootRoutes=this.props.children;Array.isArray(rootRoutes)||(rootRoutes=[rootRoutes]);for(var matches=null,i=0;null==matches&&i<rootRoutes.length;i++)matches=findMatches(Path.withoutQuery(path),rootRoutes[i]);return matches},dispatch:function(path,returnRejectedPromise){var transition=new Transition(path),routes=this,promise=syncWithTransition(routes,transition).then(function(newState){return transition.isCancelled?Routes.handleCancelledTransition(transition,routes):newState&&ActiveStore.updateState(newState),transition});return returnRejectedPromise||(promise=promise.then(void 0,function(error){setTimeout(function(){Routes.handleAsyncError(error,routes)})})),promise},render:function(){if(!this.state.path)return null;var matches=this.state.matches;return matches.length?matches[0].route.props.handler(computeHandlerProps(matches,this.state.activeQuery)):null}});mergeProperties(Transition.prototype,{abort:function(){this.cancelReason=new Abort,this.isCancelled=!0},redirect:function(to,params,query){this.cancelReason=new Redirect(to,params,query),this.isCancelled=!0},retry:function(){transitionTo(this.path)}}),module.exports=Routes},{"../components/Route":3,"../helpers/Path":5,"../helpers/goBack":7,"../helpers/mergeProperties":10,"../helpers/replaceWith":11,"../helpers/transitionTo":13,"../stores/ActiveStore":18,"../stores/RouteStore":19,"../stores/URLStore":20,"es6-promise":24,"react/lib/ExecutionEnvironment":49,"react/lib/warning":53}],5:[function(_dereq_,module){function getParamName(pathSegment){return"*"===pathSegment?"splat":pathSegment.substr(1)}function compilePattern(pattern){if(_compiledPatterns[pattern])return _compiledPatterns[pattern];var compiled=_compiledPatterns[pattern]={},paramNames=compiled.paramNames=[],source=pattern.replace(paramMatcher,function(match,pathSegment){return paramNames.push(getParamName(pathSegment)),"*"===pathSegment?"(.*?)":"([^/?#]+)"});return compiled.matcher=new RegExp("^"+source+"$","i"),compiled}function isDynamicPattern(pattern){return-1!==pattern.indexOf(":")||-1!==pattern.indexOf("*")}var invariant=_dereq_("react/lib/invariant"),qs=_dereq_("querystring"),mergeProperties=_dereq_("./mergeProperties"),URL=_dereq_("./URL"),paramMatcher=/((?::[a-z_$][a-z0-9_$]*)|\*)/gi,queryMatcher=/\?(.+)/,_compiledPatterns={},Path={extractParams:function(pattern,path){if(!pattern)return null;if(!isDynamicPattern(pattern))return pattern===URL.decode(path)?{}:null;var compiled=compilePattern(pattern),match=URL.decode(path).match(compiled.matcher);if(!match)return null;var params={};return compiled.paramNames.forEach(function(paramName,index){params[paramName]=match[index+1]}),params},extractParamNames:function(pattern){return pattern?compilePattern(pattern).paramNames:[]},injectParams:function(pattern,params){return pattern?isDynamicPattern(pattern)?(params=params||{},pattern.replace(paramMatcher,function(match,pathSegment){var paramName=getParamName(pathSegment);return invariant(null!=params[paramName],'Missing "'+paramName+'" parameter for path "'+pattern+'"'),String(params[paramName]).split("/").map(URL.encode).join("/")})):pattern:null},extractQuery:function(path){var match=path.match(queryMatcher);return match&&qs.parse(match[1])},withoutQuery:function(path){return path.replace(queryMatcher,"")},withQuery:function(path,query){var existingQuery=Path.extractQuery(path);existingQuery&&(query=query?mergeProperties(existingQuery,query):existingQuery);var queryString=query&&qs.stringify(query);return queryString?Path.withoutQuery(path)+"?"+queryString:path},normalize:function(path){return path.replace(/^\/*/,"/")}};module.exports=Path},{"./URL":6,"./mergeProperties":10,querystring:23,"react/lib/invariant":52}],6:[function(_dereq_,module){var urlEncodedSpaceRE=/\+/g,encodedSpaceRE=/%20/g,URL={decode:function(str){return str=str.replace(urlEncodedSpaceRE," "),decodeURIComponent(str)},encode:function(str){return str=encodeURIComponent(str),str.replace(encodedSpaceRE,"+")}};module.exports=URL},{}],7:[function(_dereq_,module){function goBack(){URLStore.back()}var URLStore=_dereq_("../stores/URLStore");module.exports=goBack},{"../stores/URLStore":20}],8:[function(_dereq_,module){function makeHref(routeName,params,query){var path=makePath(routeName,params,query);return"hash"===URLStore.getLocation()?"#"+path:path}var URLStore=_dereq_("../stores/URLStore"),makePath=_dereq_("./makePath");module.exports=makeHref},{"../stores/URLStore":20,"./makePath":9}],9:[function(_dereq_,module){function makePath(to,params,query){var path;if("/"===to.charAt(0))path=Path.normalize(to);else{var route=RouteStore.getRouteByName(to);invariant(route,'Unable to find a route named "'+to+'". Make sure you have a <Route name="'+to+'"> defined somewhere in your routes'),path=route.props.path}return Path.withQuery(Path.injectParams(path,params),query)}var invariant=_dereq_("react/lib/invariant"),RouteStore=_dereq_("../stores/RouteStore"),Path=_dereq_("./Path");module.exports=makePath},{"../stores/RouteStore":19,"./Path":5,"react/lib/invariant":52}],10:[function(_dereq_,module){function mergeProperties(object,properties){for(var property in properties)properties.hasOwnProperty(property)&&(object[property]=properties[property]);return object}module.exports=mergeProperties},{}],11:[function(_dereq_,module){function replaceWith(to,params,query){URLStore.replace(makePath(to,params,query))}var URLStore=_dereq_("../stores/URLStore"),makePath=_dereq_("./makePath");module.exports=replaceWith},{"../stores/URLStore":20,"./makePath":9}],12:[function(_dereq_,module){function resolveAsyncState(asyncState,setState){if(null==asyncState)return Promise.resolve();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)})}))}var Promise=_dereq_("es6-promise").Promise;module.exports=resolveAsyncState},{"es6-promise":24}],13:[function(_dereq_,module){function transitionTo(to,params,query){URLStore.push(makePath(to,params,query))}var URLStore=_dereq_("../stores/URLStore"),makePath=_dereq_("./makePath");module.exports=transitionTo},{"../stores/URLStore":20,"./makePath":9}],14:[function(_dereq_,module){function withoutProperties(object,properties){var result={};for(var property in object)object.hasOwnProperty(property)&&!properties[property]&&(result[property]=object[property]);return result}module.exports=withoutProperties},{}],15:[function(_dereq_,module,exports){exports.Link=_dereq_("./components/Link"),exports.Route=_dereq_("./components/Route"),exports.Routes=_dereq_("./components/Routes"),exports.goBack=_dereq_("./helpers/goBack"),exports.replaceWith=_dereq_("./helpers/replaceWith"),exports.transitionTo=_dereq_("./helpers/transitionTo"),exports.ActiveState=_dereq_("./mixins/ActiveState"),exports.AsyncState=_dereq_("./mixins/AsyncState"),exports.Router=_dereq_("./Router")},{"./Router":1,"./components/Link":2,"./components/Route":3,"./components/Routes":4,"./helpers/goBack":7,"./helpers/replaceWith":11,"./helpers/transitionTo":13,"./mixins/ActiveState":16,"./mixins/AsyncState":17}],16:[function(_dereq_,module){var ActiveStore=_dereq_("../stores/ActiveStore"),ActiveState={statics:{isActive:ActiveStore.isActive},componentWillMount:function(){ActiveStore.addChangeListener(this.handleActiveStateChange)},componentDidMount:function(){this.updateActiveState&&this.updateActiveState()},componentWillUnmount:function(){ActiveStore.removeChangeListener(this.handleActiveStateChange)},handleActiveStateChange:function(){this.isMounted()&&this.updateActiveState&&this.updateActiveState()}};module.exports=ActiveState},{"../stores/ActiveStore":18}],17:[function(_dereq_,module){var React="undefined"!=typeof window?window.React:"undefined"!=typeof global?global.React:null,resolveAsyncState=_dereq_("../helpers/resolveAsyncState"),AsyncState={propTypes:{initialAsyncState:React.PropTypes.object},getInitialState:function(){return this.props.initialAsyncState||null},updateAsyncState:function(state){this.isMounted()&&this.setState(state)},componentDidMount:function(){!this.props.initialAsyncState&&this.constructor.getInitialAsyncState&&resolveAsyncState(this.constructor.getInitialAsyncState(this.props.params,this.props.query,this.updateAsyncState),this.updateAsyncState)}};module.exports=AsyncState},{"../helpers/resolveAsyncState":12}],18:[function(_dereq_,module){function routeIsActive(routeName){return _activeRoutes.some(function(route){return route.props.name===routeName})}function paramsAreActive(params){for(var property in params)if(_activeParams[property]!==String(params[property]))return!1;return!0}function queryIsActive(query){for(var property in query)if(_activeQuery[property]!==String(query[property]))return!1;return!0}function notifyChange(){_events.emit("change")}var _activeRoutes=[],_activeParams={},_activeQuery={},EventEmitter=_dereq_("event-emitter"),_events=EventEmitter(),ActiveStore={addChangeListener:function(listener){_events.on("change",listener)},removeChangeListener:function(listener){_events.off("change",listener)},updateState:function(state){state=state||{},_activeRoutes=state.activeRoutes||[],_activeParams=state.activeParams||{},_activeQuery=state.activeQuery||{},notifyChange()},isActive:function(routeName,params,query){var isActive=routeIsActive(routeName)&¶msAreActive(params);return query?isActive&&queryIsActive(query):isActive}};module.exports=ActiveStore},{"event-emitter":34}],19:[function(_dereq_,module){var React="undefined"!=typeof window?window.React:"undefined"!=typeof global?global.React:null,invariant=_dereq_("react/lib/invariant"),Path=(_dereq_("react/lib/warning"),_dereq_("../helpers/Path")),_namedRoutes={},RouteStore={unregisterAllRoutes:function(){_namedRoutes={}},unregisterRoute:function(route){route.props.name&&delete _namedRoutes[route.props.name],React.Children.forEach(route.props.children,function(child){RouteStore.unregisterRoute(child)})},registerRoute:function(route,_parentRoute){if(route.props.path=route.props.path||route.props.name?Path.normalize(route.props.path||route.props.name):"/",invariant(React.isValidClass(route.props.handler),'The handler for Route "'+(route.props.name||route.props.path)+'" must be a valid React component'),_parentRoute){var paramNames=Path.extractParamNames(route.props.path);Path.extractParamNames(_parentRoute.props.path).forEach(function(paramName){invariant(-1!==paramNames.indexOf(paramName),'The nested route path "'+route.props.path+'" is missing the "'+paramName+'" parameter of its parent path "'+_parentRoute.props.path+'"')})}if(route.props.name){var existingRoute=_namedRoutes[route.props.name];invariant(!existingRoute||route===existingRoute,'You cannot use the name "'+route.props.name+'" for more than one route'),_namedRoutes[route.props.name]=route}React.Children.forEach(route.props.children,function(child){RouteStore.registerRoute(child,route)})},getRouteByName:function(routeName){return _namedRoutes[routeName]||null}};module.exports=RouteStore},{"../helpers/Path":5,"react/lib/invariant":52,"react/lib/warning":53}],20:[function(_dereq_,module){function getWindowChangeEvent(location){return"history"===location?"popstate":window.addEventListener?"hashchange":"onhashchange"}function getWindowPath(){return window.location.pathname+window.location.search}function notifyChange(){_events.emit("change")}function supportsHistory(){var ua=navigator.userAgent;return-1===ua.indexOf("Android 2.")&&-1===ua.indexOf("Android 4.0")||-1===ua.indexOf("Mobile Safari")||-1!==ua.indexOf("Chrome")?window.history&&"pushState"in window.history:!1}var _location,ExecutionEnvironment=_dereq_("react/lib/ExecutionEnvironment"),invariant=_dereq_("react/lib/invariant"),warning=_dereq_("react/lib/warning"),_currentPath="/",_lastPath=null,EventEmitter=_dereq_("event-emitter"),_events=EventEmitter(),URLStore={addChangeListener:function(listener){_events.on("change",listener)},removeChangeListener:function(listener){_events.off("change",listener)},getLocation:function(){return _location||"hash"},getCurrentPath:function(){return"history"===_location||"disabledHistory"===_location?getWindowPath():"hash"===_location?window.location.hash.substr(1):_currentPath},push:function(path){return path!==this.getCurrentPath()?"disabledHistory"===_location?window.location=path:void("history"===_location?(window.history.pushState({path:path},"",path),notifyChange()):"hash"===_location?window.location.hash=path:(_lastPath=_currentPath,_currentPath=path,notifyChange())):void 0},replace:function(path){"disabledHistory"===_location?window.location.replace(path):"history"===_location?(window.history.replaceState({path:path},"",path),notifyChange()):"hash"===_location?window.location.replace(getWindowPath()+"#"+path):(_currentPath=path,notifyChange())},back:function(){null!=_location?window.history.back():(invariant(_lastPath,"You cannot make the URL store go back more than once when it does not use the DOM"),_currentPath=_lastPath,_lastPath=null,notifyChange())},isSetup:function(){return null!=_location},setup:function(location){if(invariant(ExecutionEnvironment.canUseDOM,"You cannot setup the URL store in an environment with no DOM"),null!=_location)return void warning(_location===location,"The URL store was already setup using "+_location+" location. You cannot use "+location+" location on the same page");if("history"===location&&!supportsHistory())return void(_location="disabledHistory");var changeEvent=getWindowChangeEvent(location);invariant(changeEvent||"disabledHistory"===location,'The URL store location "'+location+'" is not valid. It must be either "hash" or "history"'),_location=location,"hash"===location&&""===window.location.hash&&URLStore.replace("/"),window.addEventListener?window.addEventListener(changeEvent,notifyChange,!1):window.attachEvent(changeEvent,notifyChange),notifyChange()},teardown:function(){if(null!=_location){var changeEvent=getWindowChangeEvent(_location);window.removeEventListener?window.removeEventListener(changeEvent,notifyChange,!1):window.detachEvent(changeEvent,notifyChange),_location=null,_currentPath="/"}}};module.exports=URLStore},{"event-emitter":34,"react/lib/ExecutionEnvironment":49,"react/lib/invariant":52,"react/lib/warning":53}],21:[function(_dereq_,module){"use strict";function hasOwnProperty(obj,prop){return Object.prototype.hasOwnProperty.call(obj,prop)}module.exports=function(qs,sep,eq,options){sep=sep||"&",eq=eq||"=";var obj={};if("string"!=typeof qs||0===qs.length)return obj;var regexp=/\+/g;qs=qs.split(sep);var maxKeys=1e3;options&&"number"==typeof options.maxKeys&&(maxKeys=options.maxKeys);var len=qs.length;maxKeys>0&&len>maxKeys&&(len=maxKeys);for(var i=0;len>i;++i){var kstr,vstr,k,v,x=qs[i].replace(regexp,"%20"),idx=x.indexOf(eq);idx>=0?(kstr=x.substr(0,idx),vstr=x.substr(idx+1)):(kstr=x,vstr=""),k=decodeURIComponent(kstr),v=decodeURIComponent(vstr),hasOwnProperty(obj,k)?isArray(obj[k])?obj[k].push(v):obj[k]=[obj[k],v]:obj[k]=v}return obj};var isArray=Array.isArray||function(xs){return"[object Array]"===Object.prototype.toString.call(xs)}},{}],22:[function(_dereq_,module){"use strict";function map(xs,f){if(xs.map)return xs.map(f);for(var res=[],i=0;i<xs.length;i++)res.push(f(xs[i],i));return res}var stringifyPrimitive=function(v){switch(typeof v){case"string":return v;case"boolean":return v?"true":"false";case"number":return isFinite(v)?v:"";default:return""}};module.exports=function(obj,sep,eq,name){return sep=sep||"&",eq=eq||"=",null===obj&&(obj=void 0),"object"==typeof obj?map(objectKeys(obj),function(k){var ks=encodeURIComponent(stringifyPrimitive(k))+eq;return isArray(obj[k])?map(obj[k],function(v){return ks+encodeURIComponent(stringifyPrimitive(v))}).join(sep):ks+encodeURIComponent(stringifyPrimitive(obj[k]))}).join(sep):name?encodeURIComponent(stringifyPrimitive(name))+eq+encodeURIComponent(stringifyPrimitive(obj)):""};var isArray=Array.isArray||function(xs){return"[object Array]"===Object.prototype.toString.call(xs)},objectKeys=Object.keys||function(obj){var res=[];for(var key in obj)Object.prototype.hasOwnProperty.call(obj,key)&&res.push(key);return res}},{}],23:[function(_dereq_,module,exports){"use strict";exports.decode=exports.parse=_dereq_("./decode"),exports.encode=exports.stringify=_dereq_("./encode")},{"./decode":21,"./encode":22}],24:[function(_dereq_,module,exports){"use strict";var Promise=_dereq_("./promise/promise").Promise,polyfill=_dereq_("./promise/polyfill").polyfill;exports.Promise=Promise,exports.polyfill=polyfill},{"./promise/polyfill":28,"./promise/promise":29}],25:[function(_dereq_,module,exports){"use strict";function all(promises){var Promise=this;if(!isArray(promises))throw new TypeError("You must pass an array to all.");return new Promise(function(resolve,reject){function resolver(index){return function(value){resolveAll(index,value)}}function resolveAll(index,value){results[index]=value,0===--remaining&&resolve(results)}var promise,results=[],remaining=promises.length;0===remaining&&resolve([]);for(var i=0;i<promises.length;i++)promise=promises[i],promise&&isFunction(promise.then)?promise.then(resolver(i),reject):resolveAll(i,promise)})}var isArray=_dereq_("./utils").isArray,isFunction=_dereq_("./utils").isFunction;exports.all=all},{"./utils":33}],26:[function(_dereq_,module,exports){"use strict";function useNextTick(){return function(){process.nextTick(flush)}}function useMutationObserver(){var iterations=0,observer=new BrowserMutationObserver(flush),node=document.createTextNode("");return observer.observe(node,{characterData:!0}),function(){node.data=iterations=++iterations%2}}function useSetTimeout(){return function(){local.setTimeout(flush,1)}}function flush(){for(var i=0;i<queue.length;i++){var tuple=queue[i],callback=tuple[0],arg=tuple[1];callback(arg)}queue=[]}function asap(callback,arg){var length=queue.push([callback,arg]);1===length&&scheduleFlush()}var scheduleFlush,browserGlobal="undefined"!=typeof window?window:{},BrowserMutationObserver=browserGlobal.MutationObserver||browserGlobal.WebKitMutationObserver,local="undefined"!=typeof global?global:void 0===this?window:this,queue=[];scheduleFlush="undefined"!=typeof process&&"[object process]"==={}.toString.call(process)?useNextTick():BrowserMutationObserver?useMutationObserver():useSetTimeout(),exports.asap=asap},{}],27:[function(_dereq_,module,exports){"use strict";function configure(name,value){return 2!==arguments.length?config[name]:void(config[name]=value)}var config={instrument:!1};exports.config=config,exports.configure=configure},{}],28:[function(_dereq_,module,exports){"use strict";function polyfill(){var local;local="undefined"!=typeof global?global:"undefined"!=typeof window&&window.document?window:self;var es6PromiseSupport="Promise"in local&&"resolve"in local.Promise&&"reject"in local.Promise&&"all"in local.Promise&&"race"in local.Promise&&function(){var resolve;return new local.Promise(function(r){resolve=r}),isFunction(resolve)}();es6PromiseSupport||(local.Promise=RSVPPromise)}var RSVPPromise=_dereq_("./promise").Promise,isFunction=_dereq_("./utils").isFunction;exports.polyfill=polyfill},{"./promise":29,"./utils":33}],29:[function(_dereq_,module,exports){"use strict";function Promise(resolver){if(!isFunction(resolver))throw new TypeError("You must pass a resolver function as the first argument to the promise constructor");if(!(this instanceof Promise))throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.");this._subscribers=[],invokeResolver(resolver,this)}function invokeResolver(resolver,promise){function resolvePromise(value){resolve(promise,value)}function rejectPromise(reason){reject(promise,reason)}try{resolver(resolvePromise,rejectPromise)}catch(e){rejectPromise(e)}}function invokeCallback(settled,promise,callback,detail){var value,error,succeeded,failed,hasCallback=isFunction(callback);if(hasCallback)try{value=callback(detail),succeeded=!0}catch(e){failed=!0,error=e}else value=detail,succeeded=!0;handleThenable(promise,value)||(hasCallback&&succeeded?resolve(promise,value):failed?reject(promise,error):settled===FULFILLED?resolve(promise,value):settled===REJECTED&&reject(promise,value))}function subscribe(parent,child,onFulfillment,onRejection){var subscribers=parent._subscribers,length=subscribers.length;subscribers[length]=child,subscribers[length+FULFILLED]=onFulfillment,subscribers[length+REJECTED]=onRejection}function publish(promise,settled){for(var child,callback,subscribers=promise._subscribers,detail=promise._detail,i=0;i<subscribers.length;i+=3)child=subscribers[i],callback=subscribers[i+settled],invokeCallback(settled,child,callback,detail);promise._subscribers=null}function handleThenable(promise,value){var resolved,then=null;try{if(promise===value)throw new TypeError("A promises callback cannot return that same promise.");if(objectOrFunction(value)&&(then=value.then,isFunction(then)))return then.call(value,function(val){return resolved?!0:(resolved=!0,void(value!==val?resolve(promise,val):fulfill(promise,val)))},function(val){return resolved?!0:(resolved=!0,void reject(promise,val))}),!0}catch(error){return resolved?!0:(reject(promise,error),!0)}return!1}function resolve(promise,value){promise===value?fulfill(promise,value):handleThenable(promise,value)||fulfill(promise,value)}function fulfill(promise,value){promise._state===PENDING&&(promise._state=SEALED,promise._detail=value,config.async(publishFulfillment,promise))}function reject(promise,reason){promise._state===PENDING&&(promise._state=SEALED,promise._detail=reason,config.async(publishRejection,promise))}function publishFulfillment(promise){publish(promise,promise._state=FULFILLED)}function publishRejection(promise){publish(promise,promise._state=REJECTED)}var config=_dereq_("./config").config,objectOrFunction=(_dereq_("./config").configure,_dereq_("./utils").objectOrFunction),isFunction=_dereq_("./utils").isFunction,all=(_dereq_("./utils").now,_dereq_("./all").all),race=_dereq_("./race").race,staticResolve=_dereq_("./resolve").resolve,staticReject=_dereq_("./reject").reject,asap=_dereq_("./asap").asap;config.async=asap;var PENDING=void 0,SEALED=0,FULFILLED=1,REJECTED=2;Promise.prototype={constructor:Promise,_state:void 0,_detail:void 0,_subscribers:void 0,then:function(onFulfillment,onRejection){var promise=this,thenPromise=new this.constructor(function(){});if(this._state){var callbacks=arguments;config.async(function(){invokeCallback(promise._state,thenPromise,callbacks[promise._state-1],promise._detail)})}else subscribe(this,thenPromise,onFulfillment,onRejection); | ||
return thenPromise},"catch":function(onRejection){return this.then(null,onRejection)}},Promise.all=all,Promise.race=race,Promise.resolve=staticResolve,Promise.reject=staticReject,exports.Promise=Promise},{"./all":25,"./asap":26,"./config":27,"./race":30,"./reject":31,"./resolve":32,"./utils":33}],30:[function(_dereq_,module,exports){"use strict";function race(promises){var Promise=this;if(!isArray(promises))throw new TypeError("You must pass an array to race.");return new Promise(function(resolve,reject){for(var promise,i=0;i<promises.length;i++)promise=promises[i],promise&&"function"==typeof promise.then?promise.then(resolve,reject):resolve(promise)})}var isArray=_dereq_("./utils").isArray;exports.race=race},{"./utils":33}],31:[function(_dereq_,module,exports){"use strict";function reject(reason){var Promise=this;return new Promise(function(resolve,reject){reject(reason)})}exports.reject=reject},{}],32:[function(_dereq_,module,exports){"use strict";function resolve(value){if(value&&"object"==typeof value&&value.constructor===this)return value;var Promise=this;return new Promise(function(resolve){resolve(value)})}exports.resolve=resolve},{}],33:[function(_dereq_,module,exports){"use strict";function objectOrFunction(x){return isFunction(x)||"object"==typeof x&&null!==x}function isFunction(x){return"function"==typeof x}function isArray(x){return"[object Array]"===Object.prototype.toString.call(x)}var now=Date.now||function(){return(new Date).getTime()};exports.objectOrFunction=objectOrFunction,exports.isFunction=isFunction,exports.isArray=isArray,exports.now=now},{}],34:[function(_dereq_,module,exports){"use strict";var on,once,off,emit,methods,descriptors,base,d=_dereq_("d"),callable=_dereq_("es5-ext/object/valid-callable"),apply=Function.prototype.apply,call=Function.prototype.call,create=Object.create,defineProperty=Object.defineProperty,defineProperties=Object.defineProperties,hasOwnProperty=Object.prototype.hasOwnProperty,descriptor={configurable:!0,enumerable:!1,writable:!0};on=function(type,listener){var data;return callable(listener),hasOwnProperty.call(this,"__ee__")?data=this.__ee__:(data=descriptor.value=create(null),defineProperty(this,"__ee__",descriptor),descriptor.value=null),data[type]?"object"==typeof data[type]?data[type].push(listener):data[type]=[data[type],listener]:data[type]=listener,this},once=function(type,listener){var once,self;return callable(listener),self=this,on.call(this,type,once=function(){off.call(self,type,once),apply.call(listener,this,arguments)}),once.__eeOnceListener__=listener,this},off=function(type,listener){var data,listeners,candidate,i;if(callable(listener),!hasOwnProperty.call(this,"__ee__"))return this;if(data=this.__ee__,!data[type])return this;if(listeners=data[type],"object"==typeof listeners)for(i=0;candidate=listeners[i];++i)(candidate===listener||candidate.__eeOnceListener__===listener)&&(2===listeners.length?data[type]=listeners[i?0:1]:listeners.splice(i,1));else(listeners===listener||listeners.__eeOnceListener__===listener)&&delete data[type];return this},emit=function(type){var i,l,listener,listeners,args;if(hasOwnProperty.call(this,"__ee__")&&(listeners=this.__ee__[type]))if("object"==typeof listeners){for(l=arguments.length,args=new Array(l-1),i=1;l>i;++i)args[i-1]=arguments[i];for(listeners=listeners.slice(),i=0;listener=listeners[i];++i)apply.call(listener,this,args)}else switch(arguments.length){case 1:call.call(listeners,this);break;case 2:call.call(listeners,this,arguments[1]);break;case 3:call.call(listeners,this,arguments[1],arguments[2]);break;default:for(l=arguments.length,args=new Array(l-1),i=1;l>i;++i)args[i-1]=arguments[i];apply.call(listeners,this,args)}},methods={on:on,once:once,off:off,emit:emit},descriptors={on:d(on),once:d(once),off:d(off),emit:d(emit)},base=defineProperties({},descriptors),module.exports=exports=function(o){return null==o?create(base):defineProperties(Object(o),descriptors)},exports.methods=methods},{d:35,"es5-ext/object/valid-callable":44}],35:[function(_dereq_,module){"use strict";var d,assign=_dereq_("es5-ext/object/assign"),normalizeOpts=_dereq_("es5-ext/object/normalize-options"),isCallable=_dereq_("es5-ext/object/is-callable"),contains=_dereq_("es5-ext/string/#/contains");d=module.exports=function(dscr,value){var c,e,w,options,desc;return arguments.length<2||"string"!=typeof dscr?(options=value,value=dscr,dscr=null):options=arguments[2],null==dscr?(c=w=!0,e=!1):(c=contains.call(dscr,"c"),e=contains.call(dscr,"e"),w=contains.call(dscr,"w")),desc={value:value,configurable:c,enumerable:e,writable:w},options?assign(normalizeOpts(options),desc):desc},d.gs=function(dscr,get,set){var c,e,options,desc;return"string"!=typeof dscr?(options=set,set=get,get=dscr,dscr=null):options=arguments[3],null==get?get=void 0:isCallable(get)?null==set?set=void 0:isCallable(set)||(options=set,set=void 0):(options=get,get=set=void 0),null==dscr?(c=!0,e=!1):(c=contains.call(dscr,"c"),e=contains.call(dscr,"e")),desc={get:get,set:set,configurable:c,enumerable:e},options?assign(normalizeOpts(options),desc):desc}},{"es5-ext/object/assign":36,"es5-ext/object/is-callable":39,"es5-ext/object/normalize-options":43,"es5-ext/string/#/contains":46}],36:[function(_dereq_,module){"use strict";module.exports=_dereq_("./is-implemented")()?Object.assign:_dereq_("./shim")},{"./is-implemented":37,"./shim":38}],37:[function(_dereq_,module){"use strict";module.exports=function(){var obj,assign=Object.assign;return"function"!=typeof assign?!1:(obj={foo:"raz"},assign(obj,{bar:"dwa"},{trzy:"trzy"}),obj.foo+obj.bar+obj.trzy==="razdwatrzy")}},{}],38:[function(_dereq_,module){"use strict";var keys=_dereq_("../keys"),value=_dereq_("../valid-value"),max=Math.max;module.exports=function(dest,src){var error,i,assign,l=max(arguments.length,2);for(dest=Object(value(dest)),assign=function(key){try{dest[key]=src[key]}catch(e){error||(error=e)}},i=1;l>i;++i)src=arguments[i],keys(src).forEach(assign);if(void 0!==error)throw error;return dest}},{"../keys":40,"../valid-value":45}],39:[function(_dereq_,module){"use strict";module.exports=function(obj){return"function"==typeof obj}},{}],40:[function(_dereq_,module){"use strict";module.exports=_dereq_("./is-implemented")()?Object.keys:_dereq_("./shim")},{"./is-implemented":41,"./shim":42}],41:[function(_dereq_,module){"use strict";module.exports=function(){try{return Object.keys("primitive"),!0}catch(e){return!1}}},{}],42:[function(_dereq_,module){"use strict";var keys=Object.keys;module.exports=function(object){return keys(null==object?object:Object(object))}},{}],43:[function(_dereq_,module){"use strict";var process,assign=_dereq_("./assign"),forEach=Array.prototype.forEach,create=Object.create,getPrototypeOf=Object.getPrototypeOf;process=function(src,obj){var proto=getPrototypeOf(src);return assign(proto?process(proto,obj):obj,src)},module.exports=function(){var result=create(null);return forEach.call(arguments,function(options){null!=options&&process(Object(options),result)}),result}},{"./assign":36}],44:[function(_dereq_,module){"use strict";module.exports=function(fn){if("function"!=typeof fn)throw new TypeError(fn+" is not a function");return fn}},{}],45:[function(_dereq_,module){"use strict";module.exports=function(value){if(null==value)throw new TypeError("Cannot use null or undefined");return value}},{}],46:[function(_dereq_,module){"use strict";module.exports=_dereq_("./is-implemented")()?String.prototype.contains:_dereq_("./shim")},{"./is-implemented":47,"./shim":48}],47:[function(_dereq_,module){"use strict";var str="razdwatrzy";module.exports=function(){return"function"!=typeof str.contains?!1:str.contains("dwa")===!0&&str.contains("foo")===!1}},{}],48:[function(_dereq_,module){"use strict";var indexOf=String.prototype.indexOf;module.exports=function(searchString){return indexOf.call(this,searchString,arguments[1])>-1}},{}],49:[function(_dereq_,module){"use strict";var canUseDOM=!("undefined"==typeof window||!window.document||!window.document.createElement),ExecutionEnvironment={canUseDOM:canUseDOM,canUseWorkers:"undefined"!=typeof Worker,canUseEventListeners:canUseDOM&&!(!window.addEventListener&&!window.attachEvent),canUseViewport:canUseDOM&&!!window.screen,isInWorker:!canUseDOM};module.exports=ExecutionEnvironment},{}],50:[function(_dereq_,module){function copyProperties(obj,a,b,c,d,e,f){obj=obj||{};for(var v,args=[a,b,c,d,e],ii=0;args[ii];){v=args[ii++];for(var k in v)obj[k]=v[k];v.hasOwnProperty&&v.hasOwnProperty("toString")&&"undefined"!=typeof v.toString&&obj.toString!==v.toString&&(obj.toString=v.toString)}return obj}module.exports=copyProperties},{}],51:[function(_dereq_,module){function makeEmptyFunction(arg){return function(){return arg}}function emptyFunction(){}var copyProperties=_dereq_("./copyProperties");copyProperties(emptyFunction,{thatReturns:makeEmptyFunction,thatReturnsFalse:makeEmptyFunction(!1),thatReturnsTrue:makeEmptyFunction(!0),thatReturnsNull:makeEmptyFunction(null),thatReturnsThis:function(){return this},thatReturnsArgument:function(arg){return arg}}),module.exports=emptyFunction},{"./copyProperties":50}],52:[function(_dereq_,module){"use strict";var invariant=function(condition,format,a,b,c,d,e,f){if(!condition){var error;if(void 0===format)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],argIndex=0;error=new Error("Invariant Violation: "+format.replace(/%s/g,function(){return args[argIndex++]}))}throw error.framesToPop=1,error}};module.exports=invariant},{}],53:[function(_dereq_,module){"use strict";var emptyFunction=_dereq_("./emptyFunction"),warning=emptyFunction;module.exports=warning},{"./emptyFunction":51}]},{},[15])(15)}); |
@@ -30,3 +30,3 @@ var React = require('react'); | ||
* You could use the following component to link to that route: | ||
* | ||
* | ||
* <Link to="showPost" postId="123"/> | ||
@@ -113,3 +113,3 @@ * | ||
handleClick: function (event) { | ||
if (isModifiedEvent(event)) | ||
if (isModifiedEvent(event) || !isLeftClick(event)) | ||
return; | ||
@@ -134,6 +134,10 @@ | ||
function isLeftClick(event) { | ||
return event.button === 0; | ||
} | ||
function isModifiedEvent(event) { | ||
return !!(event.metaKey || event.ctrlKey || event.shiftKey); | ||
return !!(event.metaKey || event.altKey || event.ctrlKey || event.shiftKey); | ||
} | ||
module.exports = Link; |
@@ -8,3 +8,2 @@ var React = require('react'); | ||
var transitionTo = require('../helpers/transitionTo'); | ||
var withoutProperties = require('../helpers/withoutProperties'); | ||
var Route = require('../components/Route'); | ||
@@ -33,6 +32,2 @@ var Path = require('../helpers/Path'); | ||
getUnreservedProps: function (props) { | ||
return withoutProperties(props, RESERVED_PROPS); | ||
}, | ||
/** | ||
@@ -106,10 +101,10 @@ * Handles errors that were thrown asynchronously. By default, the | ||
* | ||
* ( <Routes handler={App}> | ||
* <Route name="posts" handler={Posts}> | ||
* <Route name="newPost" path="/posts/new" handler={NewPost}/> | ||
* <Route name="showPost" path="/posts/:id" handler={Post}/> | ||
* 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: <PostsRoute>, params: {} }, | ||
* { route: <PostRoute>, params: { id: '123' } } ] | ||
@@ -116,0 +111,0 @@ */ |
@@ -10,2 +10,3 @@ exports.Link = require('./components/Link'); | ||
exports.ActiveState = require('./mixins/ActiveState'); | ||
exports.AsyncState = require('./mixins/AsyncState'); | ||
@@ -12,0 +13,0 @@ // Backwards compat with 0.1. We should |
@@ -17,3 +17,24 @@ var React = require('react'); | ||
/** | ||
* Registers a <Route> and all of its children with the RouteStore. Also, | ||
* Removes all references to <Route>s from the store. Should only ever | ||
* really be used in tests to clear the store between test runs. | ||
*/ | ||
unregisterAllRoutes: function () { | ||
_namedRoutes = {}; | ||
}, | ||
/** | ||
* Removes the reference to the given <Route> and all of its children | ||
* from the store. | ||
*/ | ||
unregisterRoute: function (route) { | ||
if (route.props.name) | ||
delete _namedRoutes[route.props.name]; | ||
React.Children.forEach(route.props.children, function (child) { | ||
RouteStore.unregisterRoute(child); | ||
}); | ||
}, | ||
/** | ||
* Registers a <Route> and all of its children with the store. Also, | ||
* does some normalization and validation on route props. | ||
@@ -69,15 +90,2 @@ */ | ||
/** | ||
* Removes the reference to the given <Route> and all of its children from | ||
* the RouteStore. | ||
*/ | ||
unregisterRoute: function (route) { | ||
if (route.props.name) | ||
delete _namedRoutes[route.props.name]; | ||
React.Children.forEach(route.props.children, function (child) { | ||
RouteStore.unregisterRoute(route); | ||
}); | ||
}, | ||
/** | ||
* Returns the Route object with the given name, if one exists. | ||
@@ -84,0 +92,0 @@ */ |
@@ -5,7 +5,2 @@ var ExecutionEnvironment = require('react/lib/ExecutionEnvironment'); | ||
var CHANGE_EVENTS = { | ||
hash: (window.addEventListener) ? 'hashchange' : 'onhashchange', | ||
history: 'popstate' | ||
}; | ||
var _location; | ||
@@ -15,2 +10,9 @@ var _currentPath = '/'; | ||
function getWindowChangeEvent(location) { | ||
if (location === 'history') | ||
return 'popstate'; | ||
return window.addEventListener ? 'hashchange' : 'onhashchange'; | ||
} | ||
function getWindowPath() { | ||
@@ -59,8 +61,8 @@ return window.location.pathname + window.location.search; | ||
getCurrentPath: function () { | ||
if (_location === 'history') | ||
if (_location === 'history' || _location === 'disabledHistory') | ||
return getWindowPath(); | ||
if (_location === 'hash') | ||
return window.location.hash.substr(1); | ||
return _currentPath; | ||
@@ -73,2 +75,8 @@ }, | ||
push: function (path) { | ||
if (path === this.getCurrentPath()) | ||
return; | ||
if (_location === 'disabledHistory') | ||
return window.location = path; | ||
if (_location === 'history') { | ||
@@ -91,3 +99,5 @@ window.history.pushState({ path: path }, '', path); | ||
replace: function (path) { | ||
if (_location === 'history') { | ||
if (_location === 'disabledHistory') { | ||
window.location.replace(path); | ||
} else if (_location === 'history') { | ||
window.history.replaceState({ path: path }, '', path); | ||
@@ -148,6 +158,11 @@ notifyChange(); | ||
var changeEvent = CHANGE_EVENTS[location]; | ||
if (location === 'history' && !supportsHistory()) { | ||
_location = 'disabledHistory'; | ||
return; | ||
} | ||
var changeEvent = getWindowChangeEvent(location); | ||
invariant( | ||
changeEvent, | ||
changeEvent || location === 'disabledHistory', | ||
'The URL store location "' + location + '" is not valid. ' + | ||
@@ -178,3 +193,3 @@ 'It must be either "hash" or "history"' | ||
var changeEvent = CHANGE_EVENTS[_location]; | ||
var changeEvent = getWindowChangeEvent(_location); | ||
@@ -188,2 +203,3 @@ if (window.removeEventListener) { | ||
_location = null; | ||
_currentPath = '/'; | ||
} | ||
@@ -193,2 +209,17 @@ | ||
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 = URLStore; |
{ | ||
"name": "react-router", | ||
"version": "0.5.0", | ||
"version": "0.5.1", | ||
"description": "A complete routing library for React.js", | ||
@@ -27,20 +27,20 @@ "tags": [ | ||
"devDependencies": { | ||
"browserify": "^4.2.3", | ||
"browserify-shim": "^3.6.0", | ||
"bundle-loader": "^0.5.0", | ||
"envify": "~1.2.0", | ||
"expect": "^0.1.1", | ||
"jsx-loader": "^0.10.2", | ||
"karma": "^0.12.16", | ||
"karma-chrome-launcher": "^0.1.4", | ||
"browserify": "4.2.3", | ||
"browserify-shim": "3.6.0", | ||
"bundle-loader": "0.5.0", | ||
"envify": "1.2.0", | ||
"expect": "0.1.1", | ||
"jsx-loader": "0.10.2", | ||
"karma": "0.12.16", | ||
"karma-chrome-launcher": "0.1.4", | ||
"karma-cli": "0.0.4", | ||
"karma-firefox-launcher": "^0.1.3", | ||
"karma-mocha": "^0.1.3", | ||
"karma-webpack": "^1.2.1", | ||
"mocha": "^1.20.1", | ||
"karma-firefox-launcher": "0.1.3", | ||
"karma-mocha": "0.1.3", | ||
"karma-webpack": "1.2.1", | ||
"mocha": "1.20.1", | ||
"react": ">=0.11.0", | ||
"rf-release": "^0.1.2", | ||
"uglify-js": "^2.4.15", | ||
"webpack": "^1.2.0-beta5", | ||
"webpack-dev-server": "^1.4.2" | ||
"rf-release": "0.1.2", | ||
"uglify-js": "2.4.15", | ||
"webpack": "1.2.0-beta5", | ||
"webpack-dev-server": "1.4.2" | ||
}, | ||
@@ -47,0 +47,0 @@ "peerDependencies": { |
348
README.md
@@ -8,10 +8,13 @@ React Router | ||
You are viewing docs for the latest code on master. Check out | ||
[other releases](https://github.com/rackt/react-router/releases) | ||
for the version you have installed. | ||
Docs | ||
---- | ||
Also, please refer to the [CHANGELOG](/CHANGELOG) when upgrading. | ||
- [Guide: Overview](/docs/guides/overview.md) | ||
- [API](/docs/api/) | ||
## **** NPM USERS THIS PACKAGE MOVED **** | ||
Important Notes | ||
--------------- | ||
### **** NPM USERS THIS PACKAGE MOVED **** | ||
This package has moved from `react-nested-router` to `react-router`. | ||
@@ -24,4 +27,3 @@ | ||
SemVer | ||
------ | ||
### SemVer | ||
@@ -32,18 +34,5 @@ Before our `1.0` release, breaking API changes will cause a bump to | ||
Features | ||
-------- | ||
Please refer to the [upgrade guide](/UPGRADE_GUIDE.md) and | ||
[changelog](/CHANGELOG) when upgrading. | ||
- Nested views mapped to nested routes | ||
- Modular construction of route hierarchy | ||
- Fully asynchronous transition hooks | ||
- Transition abort / redirect / retry | ||
- Dynamic segments | ||
- Query parameters | ||
- Links with automatic `.active` class when their route is active | ||
- Multiple root routes | ||
- Hash or HTML5 history URLs | ||
Check out the `examples` directory to see how simple previously complex UI | ||
and workflows are to create. | ||
Installation | ||
@@ -65,8 +54,22 @@ ------------ | ||
Usage | ||
----- | ||
Features | ||
-------- | ||
``` | ||
var Route = require('react-router').Route; | ||
- Nested views mapped to nested routes | ||
- Modular construction of route hierarchy | ||
- Fully asynchronous transition hooks | ||
- Transition abort / redirect / retry | ||
- Dynamic segments | ||
- Query parameters | ||
- Links with automatic `.active` class when their route is active | ||
- Multiple root routes | ||
- Hash or HTML5 history URLs | ||
Check out the `examples` directory to see how simple previously complex UI | ||
and workflows are to create. | ||
What's it look like? | ||
-------------------- | ||
```js | ||
React.renderComponent(( | ||
@@ -84,91 +87,4 @@ <Routes> | ||
Or if JSX isn't your jam: | ||
See more in the [overview guide](/docs/guides/overview.md). | ||
```js | ||
React.renderComponent(( | ||
Routes({}, | ||
Route({handler: App}, | ||
Route({name: "about", handler: About}), | ||
Route({name: "users", handler: Users}, | ||
Route({name: "user", path: "/user/:userId", handler: User}) | ||
) | ||
) | ||
) | ||
), document.body); | ||
``` | ||
- URLs will be matched to the deepest route, and then all the routes up | ||
the hierarchy are activated and their "handlers" (normal React | ||
components) will be rendered. | ||
- Paths are assumed from names unless specified. | ||
- Each handler will receive a `params` property containing the matched | ||
parameters form the url, like `:userId`. | ||
- Handlers also receive a `query` prop equal to a dictionary of the | ||
current query params. | ||
- Parent routes will receive a `activeRouteHandler` property. Its a function that | ||
will render the active child route handler. | ||
Here's the rest of the application: | ||
```js | ||
var Link = require('react-router').Link; | ||
var App = React.createClass({ | ||
render: function() { | ||
return ( | ||
<div> | ||
<ul> | ||
<li><Link to="about">About</Link></li> | ||
<li><Link to="users">Users</Link></li> | ||
<li><Link to="user" userId="123">User 123</Link></li> | ||
</ul> | ||
<this.props.activeRouteHandler/> | ||
</div> | ||
); | ||
} | ||
}); | ||
var About = React.createClass({ | ||
render: function() { | ||
return <h2>About</h2>; | ||
} | ||
}); | ||
var Users = React.createClass({ | ||
render: function() { | ||
return ( | ||
<div> | ||
<h2>Users</h2> | ||
<this.props.activeRouteHandler/> | ||
</div> | ||
); | ||
} | ||
}); | ||
var User = React.createClass({ | ||
render: function() { | ||
return <div>{this.props.params.userId}</div> | ||
} | ||
}); | ||
``` | ||
To better understand what is happening with `activeRouteHandler` perhaps an | ||
example without the router will help. Lets take the scenario where | ||
`/users/2` has been matched. Your render method, without this router, | ||
might look something like this: | ||
```js | ||
render: function() { | ||
var user = <User params={{userId: 2}}/>; | ||
var users = <Users activeRouteHandler={user}/>; | ||
return <App activeRouteHandler={users}/>; | ||
} | ||
``` | ||
Instead, the router manages this view hierarchy for you. | ||
Benefits of This Approach | ||
@@ -205,206 +121,6 @@ ------------------------- | ||
API | ||
--- | ||
### Routes (component) | ||
Contributing | ||
------------ | ||
Configuration component for your router, all `<Route/>`s must be | ||
children of a `<Routes/>`. It is the component you provide to | ||
`React.renderComponent(routes, el)`. | ||
#### Props | ||
**location** - `"hash"` or `"history"`, defaults to `"hash"`. Configures | ||
what type of url you want, hash includes `#/` in the url and works | ||
without a server, if you use `history` your server will need to support | ||
it. | ||
### Route (component) | ||
Configuration component to declare your application's routes and view hierarchy. | ||
#### Props | ||
**name** - The name of the route, used in the `Link` component and the | ||
router's transition methods. | ||
**path** - The path used in the URL, supporting dynamic segments. If | ||
left undefined, the path will be defined by the `name`, and if there is | ||
no name, will default to `/`. This path is always absolute from the URL | ||
"root", even if the leading slash is left off. Nested routes do not | ||
inherit the path of their parent. | ||
**handler** - The component to be rendered when the route matches. | ||
#### Children | ||
Routes can be nested. When a child route matches, the parent route's | ||
handler will have an instance of the child route's handler available as | ||
`this.props.activeRouteHandler()`. You can then render it in the parent | ||
passing in any additional props as needed. | ||
#### Examples | ||
```xml | ||
<Routes> | ||
<!-- path defaults to '/' since no name or path provided --> | ||
<Route handler={App}> | ||
<!-- path is automatically assigned to the name since it is omitted --> | ||
<Route name="about" handler={About}/> | ||
<Route name="users" handler={Users}> | ||
<!-- note the dynamic segment in the path --> | ||
<Route name="user" handler={User} path="/user/:id"/> | ||
</Route> | ||
</Route> | ||
</Routes> | ||
``` | ||
Or w/o JSX: | ||
```js | ||
Route({handler: App}, | ||
Route({name: 'about', handler: About}), | ||
Route({name: 'users', handler: Users}, | ||
Route({name: 'user', handler: User, path: '/user/:id'}) | ||
) | ||
); | ||
``` | ||
### Route Handler (user-defined component) | ||
The value you pass to a route's `handler` prop is another component that | ||
is rendered to the page when that route is active. There are some special | ||
props and static methods available to these components. | ||
#### Props | ||
**this.props.activeRouteHandler(extraProps)** - The active child route handler. | ||
Use it in your render method to render the child route, passing in | ||
additional properties as needed. | ||
**this.props.params** - When a route has dynamic segments like `<Route | ||
path="users/:userId"/>` the dynamic values are available at | ||
`this.props.params.userId`, etc. | ||
**this.props.query** - The query parameters from the url. | ||
#### Static Methods (Transition Hooks) | ||
You can define static methods on your route handlers that will be called | ||
during route transitions. | ||
**willTransitionTo(transition, params)** - Called when a route is about | ||
to render, giving you the opportunity to abort the transition. You can | ||
return a promise and the whole route hierarchy will wait for the | ||
promises to resolve before proceeding. This is especially useful for | ||
server-side rendering when you need to populate some data before the | ||
handler is rendered. | ||
**willTransitionFrom(transition, component)** - Called when an active | ||
route is being transitioned out giving you an opportunity to abort the | ||
transition. The `component` is the current component, you'll probably | ||
need it to check its state to decide if you want to allow the | ||
transition. | ||
### Transition (object) | ||
**transition.abort()** - aborts a transition | ||
**transition.redirect(to, params, query)** - redirect to another route | ||
**transition.retry()** - retrys a transition | ||
#### Example | ||
```js | ||
var Settings = React.createClass({ | ||
statics: { | ||
willTransitionTo: function(transition, params) { | ||
return auth.isLoggedIn().then(function(loggedIn) { | ||
if (!loggedIn) | ||
return; | ||
transition.abort(); | ||
return auth.logIn({transition: transition}); | ||
// in auth module call `transition.retry()` after being logged in | ||
}); | ||
}, | ||
willTransitionFrom: function(transition, component) { | ||
if (component.formHasUnsavedData())) { | ||
if (!confirm('You have unsaved information, are you sure you want to leave this page?')) { | ||
transition.abort(); | ||
} | ||
} | ||
} | ||
} | ||
//... | ||
}); | ||
``` | ||
### Link (Component) | ||
Creates an anchor tag that links to a route in the application. Also | ||
gets the `active` class automatically when the route matches. If you | ||
change the path of your route, you don't have to change your links. | ||
#### Properties | ||
**to** - The name of the route to link to, or a full URL. | ||
**query** - Object, Query parameters to add to the link. Access query | ||
parameters in your route handler with `this.props.query`. | ||
**[param]** - Any parameters the route defines are passed by name | ||
through the link's properties. | ||
#### Example | ||
Given a route like `<Route name="user" path="/users/:userId"/>`: | ||
```xml | ||
<Link to="user" userId={user.id} query={{foo: bar}}>{user.name}</Link> | ||
<!-- becomes one of these depending on your router and if the route is | ||
active --> | ||
<a href="/users/123?foo=bar" class="active">Michael</a> | ||
<a href="#/users/123?foo=bar">Michael</a> | ||
<!-- or if you have the full url already, you can just pass that in --> | ||
<Link to="/users/123?foo=bar"/> | ||
``` | ||
### Top-Level Static Methods | ||
The router has several top-level methods that may be used to navigate around the application. | ||
```js | ||
var Router = require('react-router') | ||
``` | ||
**transitionTo(routeNameOrPath, [params[, query]])** - Programatically transition to a new route. | ||
```js | ||
Router.transitionTo('user', {id: 10}, {showAge: true}); | ||
Router.transitionTo('about'); | ||
Router.transitionTo('/users/10?showAge=true'); | ||
``` | ||
**replaceWith(routeName, [params[, query]])** - Programatically replace current route with a new route. Does not add an entry into the browser history. | ||
```js | ||
Router.replaceWith('user', {id: 10}, {showAge: true}); | ||
Router.replaceWith('about'); | ||
Router.replaceWith('/users/10?showAge=true'); | ||
``` | ||
**goBack()** - Programatically go back to the last route and remove the most recent entry from the browser history. | ||
```js | ||
Router.goBack(); | ||
``` | ||
Development | ||
----------- | ||
Please see [CONTRIBUTING](CONTRIBUTING.md) | ||
@@ -411,0 +127,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
193098
40
3893
129