diff --git a/backbone-reaction.js b/backbone-reaction.js index 145617c..6ba19ee 100644 --- a/backbone-reaction.js +++ b/backbone-reaction.js @@ -1,5 +1,5 @@ /*! - * backbone-reaction v0.8.1 + * backbone-reaction v0.9.0 * https://github.com/jhudson8/backbone-reaction * * Copyright (c) 2014 Joe Hudson diff --git a/backbone-reaction.min.js b/backbone-reaction.min.js index 32b9c76..be96908 100644 --- a/backbone-reaction.min.js +++ b/backbone-reaction.min.js @@ -1,4 +1,4 @@ /*! - * https://github.com/jhudson8/backbone-reaction v0.8.1; MIT license; Joe Hudson + * https://github.com/jhudson8/backbone-reaction v0.9.0; MIT license; Joe Hudson */ !function(e){"function"==typeof define&&define.amd?define(["react","backbone","underscore"],e):"undefined"!=typeof exports&&"undefined"!=typeof require?module.exports=function(t,n){e(t,n,require("underscore"))}:e(React,Backbone,_)}(function(React,Backbone,_){!function(){var e=Backbone.sync;Backbone.async=_.extend({},Backbone.Events),Backbone.sync=function(t,n,i){function a(e){var t=i[e];i[e]=function(){var a=arguments;t&&t.apply(this,a);var o=r.indexOf(s);o>=0&&r.splice(o,1);var c="success"===e?[e,n,i]:[e,n,a[1],a[2],i];s.trigger.apply(s,c),c.splice(0,0,"complete"),s.trigger.apply(s,c),0===r.length&&n.trigger("async:load-complete")}}i=i||{},i.url||(i.url=_.result(n,"url"));var r=n._pendingAsyncEvents=n._pendingAsyncEvents||[],o=i&&i.event||t,s=_.extend({},Backbone.Events);r.push(s),s.method=t,s.options=i,s.model=n,n.trigger("async",o,s,i),n.trigger("async:"+o,s,i),_.each([Backbone.async,Backbone.asyncHandler],function(e){e&&(e.trigger("async",o,n,s,i),e.trigger("async:"+o,n,s,i))}),a("success"),a("error");var c=i.intercept;if(c){if("function"==typeof c)return c(i);throw"intercept must be function(options)"}e.call(this,t,n,i)},_.each([Backbone.Model,Backbone.Collection],function(e){e.prototype.isLoading=function(){return this._pendingAsyncEvents&&this._pendingAsyncEvents.length>0?this._pendingAsyncEvents:!1}}),Backbone.async.on("async:read",function(e,t){t.on("success",function(){e.hasBeenFetched=!0,e.hadFetchError=!1}),t.on("error",function(){e.hadFetchError=!0})})}(),function(){function get(values,index,initiatedOnce,rtn){function addTo(name){var indexName=name,match=name.match(/^([^\(]*)\s*\(([^\)]*)\)\s*/),params=match&&match[2];if(name=match&&match[1]||name,!index[indexName]){params&&(params=eval("["+params+"]"));var mixin=React.mixins._mixins[name],checkAgain=!1,skip=!1;if(!mixin)throw new Error('invalid mixin "'+name+'"');if("function"==typeof mixin)React.mixins._initiatedOnce[name]?(initiatedOnce[name]=initiatedOnce[name]||[],initiatedOnce[name].push(params),skip=!0):(mixin=mixin.apply(this,params||[]),checkAgain=!0);else if(params)throw new Error('the mixin "'+name+'" does not support parameters');get(React.mixins._dependsOn[name],index,initiatedOnce,rtn),get(React.mixins._dependsInjected[name],index,initiatedOnce,rtn),index[indexName]=!0,checkAgain?get([mixin],index,initiatedOnce,rtn):skip||rtn.push(mixin)}}function handleMixin(e){e&&(Array.isArray(e)?get(e,index,initiatedOnce,rtn):"string"==typeof e?addTo(e):rtn.push(e))}if(Array.isArray(values))for(var i=0;i=0,u=c[s]),!u)throw'no callback function exists for "'+s+'"';s=function(){return u.apply(c,l?[]:arguments)}}var f=o.match(a);if(f){var h=f[1],m=f[2].split(/\s*,\s*/),p=f[3],v=React.events.specials[h];if(v)return 1===m.length&&""===m[0]&&(m=[]),s=v.call(c,s,m),e(p,s,c,!0);throw new Error('invalid special event handler "'+h+"'")}var g=o.match(i),x=g[1];path=g[2],handler=t[x];for(var y=0;!handler&&y0?Array.prototype.slice.call(arguments,0):void 0;return{getInitialState:function(){e=n(e||"loadOn",this,"async:{key}",function(e){this.setState({loading:!0}),e.on("complete",function(){this.isMounted()&&this.setState({loading:!1})},this)});var t=this.getModel();if(t){var i,a=t.isLoading();if(a)for(var r=function(){this.isMounted()&&this.setState({loading:!1})},o=0;o=0)return i=e[s],a[o].on("complete",r,this),{loading:!0}}}return{}},loadWhile:function(e){function t(t){var i=e[t];e[t]=function(){n.setState({loading:!1}),i&&i.apply(this,arguments)}}e=e||{};var n=this;return t("error"),t("success"),this.setState({loading:!0}),e}}},"modelEventAware"),React.mixins.add("modelUpdateOn",function(){var e=arguments.length>0?Array.prototype.slice.call(arguments,0):void 0;return{getInitialState:function(){n(e||"updateOn",this,"{key}",function(){this.deferUpdate()})}}},"modelEventAware","deferUpdate"),React.events){React.events.mixin=React.events.mixin||Backbone.Events;var r=/^model(\[.+\])?$/;React.events.handle(r,function(e,t){var n=e.key.match(r),i=n[1]&&n[1].substring(1,n[1].length-1),a=i&&(this.props[i]||this.refs[i]);if(!a&&i)throw new Error('no model found with "'+i+'"');var o={model:a,event:e.path,callback:t};return{on:function(){this.modelOn(o)},off:function(){}}});var o=React.events.specials;if(o){var s=["memoize","delay","defer","throttle","debounce","once"];_.each(s,function(e){o[e]=o[e]||function(t,n){return n=a(n),n.splice(0,0,t),_[e].apply(_,n)}})}}var c=function(e,t,n,i){return React.createClass(_.extend({mixins:["modelValueAware"],render:function(){var i={},a=this.getModelValue();return n?i.defaultChecked=a:i.defaultValue=a,React.DOM[e](_.extend(i,t,this.props),this.props.children)},getUIModelValue:function(){if(this.isMounted()){if(!n)return $(this.getDOMNode()).val();var e=this.getDOMNode();if(e.checked)return e.value||!0}}},i))};Backbone.input=Backbone.input||{},_.defaults(Backbone.input,{Text:c("input",{type:"text"}),TextArea:c("textarea"),Select:c("select",void 0,void 0),CheckBox:c("input",{type:"checkbox"},!0),RadioGroup:React.createClass({mixins:["modelValueAware"],render:function(){var e=this.props;return React.DOM[e.tag||"span"](e,e.children)},componentDidMount:function(){var e=this.getModelValue();if(e){var t='input[value="'+e.replace('"','\\"')+'"]',n=$(this.getDOMNode()).find(t);n.attr("checked","checked")}},getUIModelValue:function(){if(this.isMounted())for(var e='input[type="radio"]',t=$(this.getDOMNode()).find(e),n=0;n" diff --git a/package.json b/package.json index 3d36f67..5d2aa8e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "backbone-reaction", - "version": "0.8.1", + "version": "0.9.0", "author": "Joe Hudson ", "description": "react, backbone and then some", "repository": { diff --git a/release-notes.md b/release-notes.md index 8fb0161..00f6e5c 100644 --- a/release-notes.md +++ b/release-notes.md @@ -2,7 +2,17 @@ ## Development -[Commits](https://github.com/jhudson8/backbone-reaction/compare/v0.8.1...master) +[Commits](https://github.com/jhudson8/backbone-reaction/compare/v0.9.0...master) + +## v0.9.0 - September 7th, 2014 + - https://github.com/jhudson8/react-mixin-manager v0.7.0 + + https://github.com/jhudson8/react-mixin-manager v0.7.1 + - https://github.com/jhudson8/react-events v0.4.4 + + https://github.com/jhudson8/react-events v0.5.0 + - https://github.com/jhudson8/react-backbone v0.9.1 + + https://github.com/jhudson8/react-backbone v0.10.1 - 5bfabe9 + +[Commits](https://github.com/jhudson8/backbone-reaction/compare/v0.8.1...v0.9.0) ## v0.8.1 - July 25th, 2014 - upgrade to react-events 0.4.3 - 3e98044