From c3dd3bbfb128cb0f614623d51a79a7948eea234c Mon Sep 17 00:00:00 2001 From: John Haugeland Date: Sun, 29 Mar 2015 20:19:01 -0700 Subject: [PATCH] Whoops, render target was hardwired to document.body (fixes #52) --- bower.json | 2 +- dist/flocks.js | 4 ++-- dist/flocks.min.js | 18 +++++++++--------- lib/flocks.jsx | 4 ++-- package.json | 2 +- 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/bower.json b/bower.json index 13f172d..3447979 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "flocks.js", - "version": "1.0.1", + "version": "1.0.2", "dependencies": { "closure-compiler": "http://dl.google.com/closure-compiler/compiler-latest.zip" } diff --git a/dist/flocks.js b/dist/flocks.js index 04f0c9f..a7d18d9 100644 --- a/dist/flocks.js +++ b/dist/flocks.js @@ -173,7 +173,7 @@ if (typeof React === "undefined") { prevFCtx = nextFCtx; flocksLog(3, " - Flocks2 update passed"); - React.render( React.createFactory(tagtype)( { "flocks2context" : nextFCtx } ), document.body ); + React.render( React.createFactory(tagtype)( { "flocks2context" : nextFCtx } ), prevFCtx.flocks2Config.target ); dirty = false; flocksLog(3, " - Flocks2 update complete; finalizing"); @@ -540,7 +540,7 @@ if (typeof React === "undefined") { * @type {String} */ - "version" : "1.0.1", + "version" : "1.0.2", diff --git a/dist/flocks.min.js b/dist/flocks.min.js index 21a6e57..bd7b555 100644 --- a/dist/flocks.min.js +++ b/dist/flocks.min.js @@ -1,10 +1,10 @@ if("undefined"===typeof React)var React=require("react"); -(function(){function f(a){return"[object Array]"===Object.prototype.toString.call(a)}function k(a){return"undefined"===typeof a}function u(a){return"object"!==typeof a||"[object Array]"===Object.prototype.toString.call(a)?!1:!0}function c(a,b){if("string"===typeof a)if(~"warn debug error log info exception assert".split(" ").indexOf(a,0))console[a]("Flocks2 ["+a+"] "+b.toString());else console.log("Flocks2 [Unknown level] "+b.toString());else k(d.flocks2Config)?console.log("Flocks2 pre-config ["+ -a.toString()+"] "+b.toString()):d.flocks2Config.log_level>=a&&console.log("Flocks2 ["+a.toString()+"] "+b.toString())}function l(){c(3," - Flocks2 attempting update");if(!v)return c(1," x Flocks2 skipped update: root is not initialized"),null;if(m)return c(1," x Flocks2 skipped update: lock count updateBlocks is non-zero"),null;if(!w(d))return c(0," ! Flocks2 rolling back update: handler rejected propset"),d=x,null;x=d;c(3," - Flocks2 update passed");React.render(React.createFactory(p)({flocks2context:d}), -document.body);c(3," - Flocks2 update complete; finalizing");y();return!0}function z(a,b){if("string"!==typeof a)throw b||"Argument must be a string";}function A(a,b){if(!f(a))throw b||"Argument must be an array";}function B(a,b){if(!u(a))throw b||"Argument must be a non-array object";}function C(a,b,c){var d;if(!f(a))throw"Path must be an array!";if(0===a.length)return b;if(1===a.length)return d=b[a[0]],b[a[0]]=c,d;if(-1!==["string","number"].indexOf(typeof a[0]))return d=a.splice(1,Number.MAX_VALUE), -C(d,b[a[0]],c)}function D(a,b){A(a,"Flocks2 setByPathh/2 must take an array for its key");c(1,' - Flocks2 setByPath "'+a.join("|")+'"');C(a,d,b);l()}function q(a,b){c(3," - Flocks2 multi-set");if("string"===typeof a)z(a,"Flocks2 set/2 must take a string for its key"),d[a]=b,c(1,' - Flocks2 setByKey "'+a+'"'),l();else if(f(a))D(a,b);else throw"Flocks2 set/1,2 key must be a string or an array";}function r(a,b){var c;if(!f(a))throw"path must be an array!";if(0===a.length)return b;if(1===a.length)return b[a[0]]; -if(-1!==["string","number"].indexOf(typeof a[0]))return c=a.splice(1,Number.MAX_VALUE),r(c,b[a[0]])}function E(a){console.log("ERROR: stub called!");B(a,"Flocks2 update/1 must take a plain object")}function H(){++m}function F(){if(0>=m)throw"unlock()ed with no lock!";--m;l()}function t(a){var b=a.constructor(),c;if(null===a||"object"!==typeof a)return a;for(c in a)a.hasOwnProperty(c)&&(b[c]=a[c]);return b}function G(a){if(k(a))return[n];if(f(a)){if(~a.indexOf(n,0))return a;a=t(a);a.push(n);return a}throw"Original mixin list must be an array or undefined!"; -}var n,h,v=!1,m=0,p,w=function(a){return!0},y=function(){return!0},x={},d={};h={flocks2context:React.PropTypes.object};n={contextTypes:h,childContextTypes:h,componentWillMount:function(){c(1," - Flocks2 component will mount: "+this.constructor.displayName);c(3,k(this.props.flocks2context)?" - No F2 Context Prop":" - F2 Context Prop found");c(3,k(this.context.flocks2context)?" - No F2 Context":" - F2 Context found");this.props.flocks2context&&(this.context.flocks2context=this.props.flocks2context); -this.fupdate=function(a){return E(a)};this.fgetpath=function(a,b){return r(a,b)};this.fset=function(a,b){return q(a,b)};this.fsetpath=function(a,b){return q(a,b)};this.flock=function(){++m};this.funlock=function(){return F()};this.fctx=this.context.flocks2context},getChildContext:function(){return this.context}};h={version:"1.0.1",createClass:function(a){a.mixins=G(a.mixins);return React.createClass(a)},mount:function(a,b){var g=a||{},f=b||{},e=function(){console.log("ERROR: stub called!");l()},e= -{get:e,override:e,clear:e,get_path:r,set:q,set_path:D,update:E,lock:H,unlock:F};g.log_level=g.log_level||-1;p=g.control;f.flocks2Config=g;d=f;c(1,"Flocks2 root creation begins");if(!p)throw"Flocks2 fatal error: must provide a control in create/2 FlocksConfig";g.handler&&(w=g.handler,c(3," - Flocks2 handler assigned"));g.finalizer&&(y=g.finalizer,c(3," - Flocks2 finalizer assigned"));g.preventAutoContext?c(2," - Flocks2 skipping auto-context"):(c(2," - Flocks2 engaging auto-context"),this.fctx=t(d)); -c(3,"Flocks2 creation finished; initializing");v=!0;l();c(3,"Flocks2 expose updater");this.fupd=e;this.fset=e.set;this.fgetpath=e.get_path;this.flock=e.lock;this.funlock=e.unlock;this.fupdate=e.update;c(3,"Flocks2 initialization finished");return e},clone:t,isArray:f,isUndefined:k,isNonArrayObject:u,enforceString:z,enforceArray:A,enforceNonArrayObject:B,atLeastFlocks:G,plumbing:n};"undefined"!==typeof module?module.exports=h:window.flocks=h})(); +(function(){function f(a){return"[object Array]"===Object.prototype.toString.call(a)}function k(a){return"undefined"===typeof a}function v(a){return"object"!==typeof a||"[object Array]"===Object.prototype.toString.call(a)?!1:!0}function c(a,b){if("string"===typeof a)if(~"warn debug error log info exception assert".split(" ").indexOf(a,0))console[a]("Flocks2 ["+a+"] "+b.toString());else console.log("Flocks2 [Unknown level] "+b.toString());else k(d.flocks2Config)?console.log("Flocks2 pre-config ["+ +a.toString()+"] "+b.toString()):d.flocks2Config.log_level>=a&&console.log("Flocks2 ["+a.toString()+"] "+b.toString())}function l(){c(3," - Flocks2 attempting update");if(!w)return c(1," x Flocks2 skipped update: root is not initialized"),null;if(m)return c(1," x Flocks2 skipped update: lock count updateBlocks is non-zero"),null;if(!x(d))return c(0," ! Flocks2 rolling back update: handler rejected propset"),d=p,null;p=d;c(3," - Flocks2 update passed");React.render(React.createFactory(q)({flocks2context:d}), +p.flocks2Config.target);c(3," - Flocks2 update complete; finalizing");y();return!0}function z(a,b){if("string"!==typeof a)throw b||"Argument must be a string";}function A(a,b){if(!f(a))throw b||"Argument must be an array";}function B(a,b){if(!v(a))throw b||"Argument must be a non-array object";}function C(a,b,c){var d;if(!f(a))throw"Path must be an array!";if(0===a.length)return b;if(1===a.length)return d=b[a[0]],b[a[0]]=c,d;if(-1!==["string","number"].indexOf(typeof a[0]))return d=a.splice(1,Number.MAX_VALUE), +C(d,b[a[0]],c)}function D(a,b){A(a,"Flocks2 setByPathh/2 must take an array for its key");c(1,' - Flocks2 setByPath "'+a.join("|")+'"');C(a,d,b);l()}function r(a,b){c(3," - Flocks2 multi-set");if("string"===typeof a)z(a,"Flocks2 set/2 must take a string for its key"),d[a]=b,c(1,' - Flocks2 setByKey "'+a+'"'),l();else if(f(a))D(a,b);else throw"Flocks2 set/1,2 key must be a string or an array";}function t(a,b){var c;if(!f(a))throw"path must be an array!";if(0===a.length)return b;if(1===a.length)return b[a[0]]; +if(-1!==["string","number"].indexOf(typeof a[0]))return c=a.splice(1,Number.MAX_VALUE),t(c,b[a[0]])}function E(a){console.log("ERROR: stub called!");B(a,"Flocks2 update/1 must take a plain object")}function H(){++m}function F(){if(0>=m)throw"unlock()ed with no lock!";--m;l()}function u(a){var b=a.constructor(),c;if(null===a||"object"!==typeof a)return a;for(c in a)a.hasOwnProperty(c)&&(b[c]=a[c]);return b}function G(a){if(k(a))return[n];if(f(a)){if(~a.indexOf(n,0))return a;a=u(a);a.push(n);return a}throw"Original mixin list must be an array or undefined!"; +}var n,h,w=!1,m=0,q,x=function(a){return!0},y=function(){return!0},p={},d={};h={flocks2context:React.PropTypes.object};n={contextTypes:h,childContextTypes:h,componentWillMount:function(){c(1," - Flocks2 component will mount: "+this.constructor.displayName);c(3,k(this.props.flocks2context)?" - No F2 Context Prop":" - F2 Context Prop found");c(3,k(this.context.flocks2context)?" - No F2 Context":" - F2 Context found");this.props.flocks2context&&(this.context.flocks2context=this.props.flocks2context); +this.fupdate=function(a){return E(a)};this.fgetpath=function(a,b){return t(a,b)};this.fset=function(a,b){return r(a,b)};this.fsetpath=function(a,b){return r(a,b)};this.flock=function(){++m};this.funlock=function(){return F()};this.fctx=this.context.flocks2context},getChildContext:function(){return this.context}};h={version:"1.0.2",createClass:function(a){a.mixins=G(a.mixins);return React.createClass(a)},mount:function(a,b){var g=a||{},f=b||{},e=function(){console.log("ERROR: stub called!");l()},e= +{get:e,override:e,clear:e,get_path:t,set:r,set_path:D,update:E,lock:H,unlock:F};g.log_level=g.log_level||-1;q=g.control;f.flocks2Config=g;d=f;c(1,"Flocks2 root creation begins");if(!q)throw"Flocks2 fatal error: must provide a control in create/2 FlocksConfig";g.handler&&(x=g.handler,c(3," - Flocks2 handler assigned"));g.finalizer&&(y=g.finalizer,c(3," - Flocks2 finalizer assigned"));g.preventAutoContext?c(2," - Flocks2 skipping auto-context"):(c(2," - Flocks2 engaging auto-context"),this.fctx=u(d)); +c(3,"Flocks2 creation finished; initializing");w=!0;l();c(3,"Flocks2 expose updater");this.fupd=e;this.fset=e.set;this.fgetpath=e.get_path;this.flock=e.lock;this.funlock=e.unlock;this.fupdate=e.update;c(3,"Flocks2 initialization finished");return e},clone:u,isArray:f,isUndefined:k,isNonArrayObject:v,enforceString:z,enforceArray:A,enforceNonArrayObject:B,atLeastFlocks:G,plumbing:n};"undefined"!==typeof module?module.exports=h:window.flocks=h})(); diff --git a/lib/flocks.jsx b/lib/flocks.jsx index 04f0c9f..a7d18d9 100644 --- a/lib/flocks.jsx +++ b/lib/flocks.jsx @@ -173,7 +173,7 @@ if (typeof React === "undefined") { prevFCtx = nextFCtx; flocksLog(3, " - Flocks2 update passed"); - React.render( React.createFactory(tagtype)( { "flocks2context" : nextFCtx } ), document.body ); + React.render( React.createFactory(tagtype)( { "flocks2context" : nextFCtx } ), prevFCtx.flocks2Config.target ); dirty = false; flocksLog(3, " - Flocks2 update complete; finalizing"); @@ -540,7 +540,7 @@ if (typeof React === "undefined") { * @type {String} */ - "version" : "1.0.1", + "version" : "1.0.2", diff --git a/package.json b/package.json index fadbf9d..fd132b8 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ "name": "flocks.js", "filename": "flocks.js", "description": "Simpler state management for React.js", - "version": "1.0.1", + "version": "1.0.2", "homepage": "http://flocks.rocks/", "repository": { "url": "https://github.com/StoneCypher/flocks.js.git"