reactive-di
Advanced tools
Comparing version 4.0.3 to 4.0.4
@@ -5,2 +5,7 @@ # Change Log | ||
<a name="4.0.4"></a> | ||
## [4.0.4](https://github.com/zerkalica/reactive-di/compare/v4.0.3...v4.0.4) (2017-08-13) | ||
<a name="4.0.3"></a> | ||
@@ -7,0 +12,0 @@ ## [4.0.3](https://github.com/zerkalica/reactive-di/compare/v4.0.2...v4.0.3) (2017-08-04) |
@@ -283,12 +283,2 @@ import { defaultContext, detached, memkey } from 'lom_atom'; | ||
function createEventFix(origin) { | ||
function fixEvent(e) { | ||
origin(e); | ||
defaultContext.run(); | ||
} | ||
fixEvent.displayName = origin.displayName || origin.name; | ||
return fixEvent; | ||
} | ||
function shouldUpdate(oldProps, props) { | ||
@@ -348,24 +338,2 @@ if (oldProps === props) { | ||
if (attrs) { | ||
if (attrs.onKeyPress) { | ||
attrs.onKeyPress = createEventFix(attrs.onKeyPress); | ||
} | ||
if (attrs.onKeyDown) { | ||
attrs.onKeyDown = createEventFix(attrs.onKeyDown); | ||
} | ||
if (attrs.onKeyUp) { | ||
attrs.onKeyUp = createEventFix(attrs.onKeyUp); | ||
} | ||
if (attrs.onInput) { | ||
attrs.onChange = createEventFix(attrs.onInput); | ||
} | ||
if (attrs.onChange) { | ||
attrs.onChange = createEventFix(attrs.onChange); | ||
} | ||
} | ||
switch (arguments.length) { | ||
@@ -461,5 +429,4 @@ case 2: | ||
return this._injector; | ||
}; // @mem | ||
}; | ||
AtomizedComponent.prototype._state = function _state(next, force) { | ||
@@ -469,3 +436,3 @@ var injector = this._injector || this._getInjector(); | ||
if (this._render.props && force) { | ||
injector.value(this._render.props, this.props, true); | ||
injector.value(this._render.props, this.props); | ||
} | ||
@@ -472,0 +439,0 @@ |
@@ -1,2 +0,2 @@ | ||
"use strict";function _applyDecoratedDescriptor$1(t,e,r,o,n){var i={};return Object.keys(o).forEach(function(t){i[t]=o[t]}),i.enumerable=!!i.enumerable,i.configurable=!!i.configurable,("value"in i||i.initializer)&&(i.writable=!0),i=r.slice().reverse().reduce(function(r,o){return o(t,e,r)||r},i),n&&void 0!==i.initializer&&(i.value=i.initializer?i.initializer.call(n):void 0,i.initializer=void 0),void 0===i.initializer&&(Object.defineProperty(t,e,i),i=null),i}function _applyDecoratedDescriptor(t,e,r,o,n){var i={};return Object.keys(o).forEach(function(t){i[t]=o[t]}),i.enumerable=!!i.enumerable,i.configurable=!!i.configurable,("value"in i||i.initializer)&&(i.writable=!0),i=r.slice().reverse().reduce(function(r,o){return o(t,e,r)||r},i),n&&void 0!==i.initializer&&(i.value=i.initializer?i.initializer.call(n):void 0,i.initializer=void 0),void 0===i.initializer&&(Object.defineProperty(t,e,i),i=null),i}function createEventFix(t){function e(e){t(e),lom_atom.defaultContext.run()}return e.displayName=t.displayName||t.name,e}function shouldUpdate(t,e){if(t===e)return!1;if(!t&&e||!e&&t)return!0;var r=0;for(var o in t){if(t[o]!==e[o])return!0;r++}for(var n in e)r--;return 0!==r}function createCreateElement(t,e){return function(){var r=arguments[0],o=arguments[1],n=void 0,i="function"==typeof r&&void 0===r.prototype.render;switch(i?(void 0===r.__lom&&(r.__lom=t(r)),n=r.__lom,o?o.__lom_ctx=parentContext:o={__lom_ctx:parentContext}):n=r,o&&(o.onKeyPress&&(o.onKeyPress=createEventFix(o.onKeyPress)),o.onKeyDown&&(o.onKeyDown=createEventFix(o.onKeyDown)),o.onKeyUp&&(o.onKeyUp=createEventFix(o.onKeyUp)),o.onInput&&(o.onChange=createEventFix(o.onInput)),o.onChange&&(o.onChange=createEventFix(o.onChange))),arguments.length){case 2:return e(n,o);case 3:return e(n,o,arguments[2]);case 4:return e(n,o,arguments[2],arguments[3]);case 5:return e(n,o,arguments[2],arguments[3],arguments[4]);case 6:return e(n,o,arguments[2],arguments[3],arguments[4],arguments[5]);case 7:return e(n,o,arguments[2],arguments[3],arguments[4],arguments[5],arguments[6]);case 8:return e(n,o,arguments[2],arguments[3],arguments[4],arguments[5],arguments[6],arguments[7]);case 9:return e(n,o,arguments[2],arguments[3],arguments[4],arguments[5],arguments[6],arguments[7],arguments[8]);default:if(!1===i)return e.apply(null,arguments);for(var s=[n,o],a=2,c=arguments.length;a<c;a++)s.push(arguments[a]);return e.apply(null,s)}}}function createReactWrapper(t,e){var r,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new Injector,n=(r=function(t){function r(e,r,o){var n;return n=t.call(this,e,r)||this,n._propsChanged=!0,n._injector=void 0,n._el=void 0,n._render=o,void 0===o.deps&&void 0===o.props||n.constructor.instances++,n}return inheritsLoose(r,t),r.prototype.shouldComponentUpdate=function(t){return this._propsChanged=shouldUpdate(this.props,t),this._propsChanged},r.prototype.componentWillUnmount=function(){lom_atom.defaultContext.getAtom("r$",this).destroyed(!0)},r.prototype._destroy=function(){var t=this._render;void 0===t.deps&&void 0===t.props||this.constructor.instances--,this._el=void 0,this.props=void 0,this._injector=void 0,this._render=void 0},r.prototype._getInjector=function(){var t=this.props.__lom_ctx||o;return this._injector=this.constructor.instances>0?t.copy():t,this._injector},r.prototype._state=function(t,e){var r=this._injector||this._getInjector();return this._render.props&&e&&r.value(this._render.props,this.props,!0),r.resolve(this._render.deps)[0]},r.prototype.r=function(t,r){var o=void 0,n=this._render,i=parentContext;parentContext=this._injector||this._getInjector();var s=void 0!==n.deps?this._state(void 0,r):void 0;try{o=n(this.props,s)}catch(t){var a=n.onError||e;o=a({error:t},void 0===a.deps?void 0:parentContext.resolve(a.deps)[0])}return parentContext=i,r||(this._el=o,this.forceUpdate(),this._el=void 0),this._propsChanged=!1,o},r.prototype.render=function(){return void 0===this._el?this.r(void 0,this._propsChanged):this._el},r}(t),_applyDecoratedDescriptor(r.prototype,"r",[lom_atom.detached],Object.getOwnPropertyDescriptor(r.prototype,"r"),r.prototype),r);return function(t){function e(e,r){n.call(this,e,r,t)}return e.instances=0,e.displayName=t.displayName||t.name,e.prototype=Object.create(n.prototype),e.prototype.constructor=e,e}}Object.defineProperty(exports,"__esModule",{value:!0});var lom_atom=require("lom_atom"),_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},inheritsLoose=function(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e},_class2,chainCount=0,FakeSheet=function(){function t(){this.classes={}}return t.prototype.update=function(t){return this},t.prototype.attach=function(){return this},t.prototype.detach=function(){return this},t}(),defaultSheetProcessor={createStyleSheet:function(t){return new FakeSheet}},Injector=(_class2=function(){function t(t,e,r){if(this.parent=r,this.top=r?r.top:this,this._sheetProcessor=e||defaultSheetProcessor,this._sticky=void 0,void 0!==t)for(var o=0;o<t.length;o++){var n=t[o];n instanceof Array?this.value(n[0],n[1],!0):"function"==typeof n?(void 0===this._sticky&&(this._sticky=new Set),this._sticky.add(n)):this.value(n.constructor,n,!0)}}return t.prototype.value=function(t,e,r,o){if(void 0!==e)return e;if(!0===t.theme){if(this.top===this){var n=void 0===o?this._sheetProcessor.createStyleSheet(this._fastCall(t)):o.update(this._fastCall(t));return n.attach(),n}return this.top.value(t)}if(void 0!==this.parent&&(void 0===this._sticky||!this._sticky.has(t))){chainCount++;var i=this.parent.value(t);if(chainCount--,void 0!==i)return i}return 0===chainCount?this._fastNew(t):void 0},t.prototype._destroyProp=function(t,e){this!==this.top||"function"!=typeof t||void 0===t.theme||void 0===e||e.detach()},t.prototype._destroy=function(){this._sticky=void 0,this.parent=void 0,this.top=void 0,this._sheetProcessor=void 0},t.prototype._fastNew=function(t){var e=this.resolve(t.deps);switch(e.length){case 1:return new t(e[0]);case 2:return new t(e[0],e[1]);case 3:return new t(e[0],e[1],e[2]);case 4:return new t(e[0],e[1],e[2],e[3]);case 5:return new t(e[0],e[1],e[2],e[3],e[4]);case 6:return new t(e[0],e[1],e[2],e[3],e[4],e[5]);default:return new(Function.prototype.bind.apply(t,[null].concat(e)))}},t.prototype._fastCall=function(t){var e=this.resolve(t.deps);switch(e.length){case 1:return t(e[0]);case 2:return t(e[0],e[1]);case 3:return t(e[0],e[1],e[2]);case 4:return t(e[0],e[1],e[2],e[3]);case 5:return t(e[0],e[1],e[2],e[3],e[4]);case 6:return t(e[0],e[1],e[2],e[3],e[4],e[5]);default:return t.apply(void 0,e)}},t.prototype.copy=function(e){return new t(e,this._sheetProcessor,this)},t.prototype.resolve=function(t){var e=[];if(void 0!==t)for(var r=0,o=t.length;r<o;r++){var n=t[r];if("object"===_typeof(n)){var i={};for(var s in n){var a=n[s];i[s]=void 0===a.theme?this.value(a):this.value(a).classes}e.push(i)}else e.push(this.value(n))}return e},t}(),_applyDecoratedDescriptor$1(_class2.prototype,"value",[lom_atom.memkey],Object.getOwnPropertyDescriptor(_class2.prototype,"value"),_class2.prototype),_class2),parentContext=void 0;exports.createReactWrapper=createReactWrapper,exports.createCreateElement=createCreateElement,exports.Injector=Injector; | ||
"use strict";function _applyDecoratedDescriptor$1(t,e,r,o,i){var n={};return Object.keys(o).forEach(function(t){n[t]=o[t]}),n.enumerable=!!n.enumerable,n.configurable=!!n.configurable,("value"in n||n.initializer)&&(n.writable=!0),n=r.slice().reverse().reduce(function(r,o){return o(t,e,r)||r},n),i&&void 0!==n.initializer&&(n.value=n.initializer?n.initializer.call(i):void 0,n.initializer=void 0),void 0===n.initializer&&(Object.defineProperty(t,e,n),n=null),n}function _applyDecoratedDescriptor(t,e,r,o,i){var n={};return Object.keys(o).forEach(function(t){n[t]=o[t]}),n.enumerable=!!n.enumerable,n.configurable=!!n.configurable,("value"in n||n.initializer)&&(n.writable=!0),n=r.slice().reverse().reduce(function(r,o){return o(t,e,r)||r},n),i&&void 0!==n.initializer&&(n.value=n.initializer?n.initializer.call(i):void 0,n.initializer=void 0),void 0===n.initializer&&(Object.defineProperty(t,e,n),n=null),n}function shouldUpdate(t,e){if(t===e)return!1;if(!t&&e||!e&&t)return!0;var r=0;for(var o in t){if(t[o]!==e[o])return!0;r++}for(var i in e)r--;return 0!==r}function createCreateElement(t,e){return function(){var r=arguments[0],o=arguments[1],i=void 0,n="function"==typeof r&&void 0===r.prototype.render;switch(n?(void 0===r.__lom&&(r.__lom=t(r)),i=r.__lom,o?o.__lom_ctx=parentContext:o={__lom_ctx:parentContext}):i=r,arguments.length){case 2:return e(i,o);case 3:return e(i,o,arguments[2]);case 4:return e(i,o,arguments[2],arguments[3]);case 5:return e(i,o,arguments[2],arguments[3],arguments[4]);case 6:return e(i,o,arguments[2],arguments[3],arguments[4],arguments[5]);case 7:return e(i,o,arguments[2],arguments[3],arguments[4],arguments[5],arguments[6]);case 8:return e(i,o,arguments[2],arguments[3],arguments[4],arguments[5],arguments[6],arguments[7]);case 9:return e(i,o,arguments[2],arguments[3],arguments[4],arguments[5],arguments[6],arguments[7],arguments[8]);default:if(!1===n)return e.apply(null,arguments);for(var s=[i,o],a=2,c=arguments.length;a<c;a++)s.push(arguments[a]);return e.apply(null,s)}}}function createReactWrapper(t,e){var r,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new Injector,i=(r=function(t){function r(e,r,o){var i;return i=t.call(this,e,r)||this,i._propsChanged=!0,i._injector=void 0,i._el=void 0,i._render=o,void 0===o.deps&&void 0===o.props||i.constructor.instances++,i}return inheritsLoose(r,t),r.prototype.shouldComponentUpdate=function(t){return this._propsChanged=shouldUpdate(this.props,t),this._propsChanged},r.prototype.componentWillUnmount=function(){lom_atom.defaultContext.getAtom("r$",this).destroyed(!0)},r.prototype._destroy=function(){var t=this._render;void 0===t.deps&&void 0===t.props||this.constructor.instances--,this._el=void 0,this.props=void 0,this._injector=void 0,this._render=void 0},r.prototype._getInjector=function(){var t=this.props.__lom_ctx||o;return this._injector=this.constructor.instances>0?t.copy():t,this._injector},r.prototype._state=function(t,e){var r=this._injector||this._getInjector();return this._render.props&&e&&r.value(this._render.props,this.props),r.resolve(this._render.deps)[0]},r.prototype.r=function(t,r){var o=void 0,i=this._render,n=parentContext;parentContext=this._injector||this._getInjector();var s=void 0!==i.deps?this._state(void 0,r):void 0;try{o=i(this.props,s)}catch(t){var a=i.onError||e;o=a({error:t},void 0===a.deps?void 0:parentContext.resolve(a.deps)[0])}return parentContext=n,r||(this._el=o,this.forceUpdate(),this._el=void 0),this._propsChanged=!1,o},r.prototype.render=function(){return void 0===this._el?this.r(void 0,this._propsChanged):this._el},r}(t),_applyDecoratedDescriptor(r.prototype,"r",[lom_atom.detached],Object.getOwnPropertyDescriptor(r.prototype,"r"),r.prototype),r);return function(t){function e(e,r){i.call(this,e,r,t)}return e.instances=0,e.displayName=t.displayName||t.name,e.prototype=Object.create(i.prototype),e.prototype.constructor=e,e}}Object.defineProperty(exports,"__esModule",{value:!0});var lom_atom=require("lom_atom"),_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},inheritsLoose=function(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e},_class2,chainCount=0,FakeSheet=function(){function t(){this.classes={}}return t.prototype.update=function(t){return this},t.prototype.attach=function(){return this},t.prototype.detach=function(){return this},t}(),defaultSheetProcessor={createStyleSheet:function(t){return new FakeSheet}},Injector=(_class2=function(){function t(t,e,r){if(this.parent=r,this.top=r?r.top:this,this._sheetProcessor=e||defaultSheetProcessor,this._sticky=void 0,void 0!==t)for(var o=0;o<t.length;o++){var i=t[o];i instanceof Array?this.value(i[0],i[1],!0):"function"==typeof i?(void 0===this._sticky&&(this._sticky=new Set),this._sticky.add(i)):this.value(i.constructor,i,!0)}}return t.prototype.value=function(t,e,r,o){if(void 0!==e)return e;if(!0===t.theme){if(this.top===this){var i=void 0===o?this._sheetProcessor.createStyleSheet(this._fastCall(t)):o.update(this._fastCall(t));return i.attach(),i}return this.top.value(t)}if(void 0!==this.parent&&(void 0===this._sticky||!this._sticky.has(t))){chainCount++;var n=this.parent.value(t);if(chainCount--,void 0!==n)return n}return 0===chainCount?this._fastNew(t):void 0},t.prototype._destroyProp=function(t,e){this!==this.top||"function"!=typeof t||void 0===t.theme||void 0===e||e.detach()},t.prototype._destroy=function(){this._sticky=void 0,this.parent=void 0,this.top=void 0,this._sheetProcessor=void 0},t.prototype._fastNew=function(t){var e=this.resolve(t.deps);switch(e.length){case 1:return new t(e[0]);case 2:return new t(e[0],e[1]);case 3:return new t(e[0],e[1],e[2]);case 4:return new t(e[0],e[1],e[2],e[3]);case 5:return new t(e[0],e[1],e[2],e[3],e[4]);case 6:return new t(e[0],e[1],e[2],e[3],e[4],e[5]);default:return new(Function.prototype.bind.apply(t,[null].concat(e)))}},t.prototype._fastCall=function(t){var e=this.resolve(t.deps);switch(e.length){case 1:return t(e[0]);case 2:return t(e[0],e[1]);case 3:return t(e[0],e[1],e[2]);case 4:return t(e[0],e[1],e[2],e[3]);case 5:return t(e[0],e[1],e[2],e[3],e[4]);case 6:return t(e[0],e[1],e[2],e[3],e[4],e[5]);default:return t.apply(void 0,e)}},t.prototype.copy=function(e){return new t(e,this._sheetProcessor,this)},t.prototype.resolve=function(t){var e=[];if(void 0!==t)for(var r=0,o=t.length;r<o;r++){var i=t[r];if("object"===_typeof(i)){var n={};for(var s in i){var a=i[s];n[s]=void 0===a.theme?this.value(a):this.value(a).classes}e.push(n)}else e.push(this.value(i))}return e},t}(),_applyDecoratedDescriptor$1(_class2.prototype,"value",[lom_atom.memkey],Object.getOwnPropertyDescriptor(_class2.prototype,"value"),_class2.prototype),_class2),parentContext=void 0;exports.createReactWrapper=createReactWrapper,exports.createCreateElement=createCreateElement,exports.Injector=Injector; | ||
//# sourceMappingURL=reactive-di.js.map |
@@ -1,2 +0,2 @@ | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("lom_atom")):"function"==typeof define&&define.amd?define(["exports","lom_atom"],e):e(t["reactive-di"]={},t.lom_atom)}(this,function(t,e){"use strict";function r(t,e,r,o,n){var i={};return Object.keys(o).forEach(function(t){i[t]=o[t]}),i.enumerable=!!i.enumerable,i.configurable=!!i.configurable,("value"in i||i.initializer)&&(i.writable=!0),i=r.slice().reverse().reduce(function(r,o){return o(t,e,r)||r},i),n&&void 0!==i.initializer&&(i.value=i.initializer?i.initializer.call(n):void 0,i.initializer=void 0),void 0===i.initializer&&(Object.defineProperty(t,e,i),i=null),i}function o(t){function r(r){t(r),e.defaultContext.run()}return r.displayName=t.displayName||t.name,r}function n(t,e){if(t===e)return!1;if(!t&&e||!e&&t)return!0;var r=0;for(var o in t){if(t[o]!==e[o])return!0;r++}for(var n in e)r--;return 0!==r}var i,s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},a=function(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e},c=0,u=function(){function t(){this.classes={}}return t.prototype.update=function(t){return this},t.prototype.attach=function(){return this},t.prototype.detach=function(){return this},t}(),p={createStyleSheet:function(t){return new u}},l=(i=function(){function t(t,e,r){if(this.parent=r,this.top=r?r.top:this,this._sheetProcessor=e||p,this._sticky=void 0,void 0!==t)for(var o=0;o<t.length;o++){var n=t[o];n instanceof Array?this.value(n[0],n[1],!0):"function"==typeof n?(void 0===this._sticky&&(this._sticky=new Set),this._sticky.add(n)):this.value(n.constructor,n,!0)}}return t.prototype.value=function(t,e,r,o){if(void 0!==e)return e;if(!0===t.theme){if(this.top===this){var n=void 0===o?this._sheetProcessor.createStyleSheet(this._fastCall(t)):o.update(this._fastCall(t));return n.attach(),n}return this.top.value(t)}if(void 0!==this.parent&&(void 0===this._sticky||!this._sticky.has(t))){c++;var i=this.parent.value(t);if(c--,void 0!==i)return i}return 0===c?this._fastNew(t):void 0},t.prototype._destroyProp=function(t,e){this!==this.top||"function"!=typeof t||void 0===t.theme||void 0===e||e.detach()},t.prototype._destroy=function(){this._sticky=void 0,this.parent=void 0,this.top=void 0,this._sheetProcessor=void 0},t.prototype._fastNew=function(t){var e=this.resolve(t.deps);switch(e.length){case 1:return new t(e[0]);case 2:return new t(e[0],e[1]);case 3:return new t(e[0],e[1],e[2]);case 4:return new t(e[0],e[1],e[2],e[3]);case 5:return new t(e[0],e[1],e[2],e[3],e[4]);case 6:return new t(e[0],e[1],e[2],e[3],e[4],e[5]);default:return new(Function.prototype.bind.apply(t,[null].concat(e)))}},t.prototype._fastCall=function(t){var e=this.resolve(t.deps);switch(e.length){case 1:return t(e[0]);case 2:return t(e[0],e[1]);case 3:return t(e[0],e[1],e[2]);case 4:return t(e[0],e[1],e[2],e[3]);case 5:return t(e[0],e[1],e[2],e[3],e[4]);case 6:return t(e[0],e[1],e[2],e[3],e[4],e[5]);default:return t.apply(void 0,e)}},t.prototype.copy=function(e){return new t(e,this._sheetProcessor,this)},t.prototype.resolve=function(t){var e=[];if(void 0!==t)for(var r=0,o=t.length;r<o;r++){var n=t[r];if("object"===s(n)){var i={};for(var a in n){var c=n[a];i[a]=void 0===c.theme?this.value(c):this.value(c).classes}e.push(i)}else e.push(this.value(n))}return e},t}(),function(t,e,r,o,n){var i={};Object.keys(o).forEach(function(t){i[t]=o[t]}),i.enumerable=!!i.enumerable,i.configurable=!!i.configurable,("value"in i||i.initializer)&&(i.writable=!0),i=r.slice().reverse().reduce(function(r,o){return o(t,e,r)||r},i),n&&void 0!==i.initializer&&(i.value=i.initializer?i.initializer.call(n):void 0,i.initializer=void 0),void 0===i.initializer&&(Object.defineProperty(t,e,i),i=null)}(i.prototype,"value",[e.memkey],Object.getOwnPropertyDescriptor(i.prototype,"value"),i.prototype),i),h=void 0;t.createReactWrapper=function(t,o){var i,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new l,c=(i=function(t){function r(e,r,o){var n;return n=t.call(this,e,r)||this,n._propsChanged=!0,n._injector=void 0,n._el=void 0,n._render=o,void 0===o.deps&&void 0===o.props||n.constructor.instances++,n}return a(r,t),r.prototype.shouldComponentUpdate=function(t){return this._propsChanged=n(this.props,t),this._propsChanged},r.prototype.componentWillUnmount=function(){e.defaultContext.getAtom("r$",this).destroyed(!0)},r.prototype._destroy=function(){var t=this._render;void 0===t.deps&&void 0===t.props||this.constructor.instances--,this._el=void 0,this.props=void 0,this._injector=void 0,this._render=void 0},r.prototype._getInjector=function(){var t=this.props.__lom_ctx||s;return this._injector=this.constructor.instances>0?t.copy():t,this._injector},r.prototype._state=function(t,e){var r=this._injector||this._getInjector();return this._render.props&&e&&r.value(this._render.props,this.props,!0),r.resolve(this._render.deps)[0]},r.prototype.r=function(t,e){var r=void 0,n=this._render,i=h;h=this._injector||this._getInjector();var s=void 0!==n.deps?this._state(void 0,e):void 0;try{r=n(this.props,s)}catch(t){var a=n.onError||o;r=a({error:t},void 0===a.deps?void 0:h.resolve(a.deps)[0])}return h=i,e||(this._el=r,this.forceUpdate(),this._el=void 0),this._propsChanged=!1,r},r.prototype.render=function(){return void 0===this._el?this.r(void 0,this._propsChanged):this._el},r}(t),r(i.prototype,"r",[e.detached],Object.getOwnPropertyDescriptor(i.prototype,"r"),i.prototype),i);return function(t){function e(e,r){c.call(this,e,r,t)}return e.instances=0,e.displayName=t.displayName||t.name,e.prototype=Object.create(c.prototype),e.prototype.constructor=e,e}},t.createCreateElement=function(t,e){return function(){var r=arguments[0],n=arguments[1],i=void 0,s="function"==typeof r&&void 0===r.prototype.render;switch(s?(void 0===r.__lom&&(r.__lom=t(r)),i=r.__lom,n?n.__lom_ctx=h:n={__lom_ctx:h}):i=r,n&&(n.onKeyPress&&(n.onKeyPress=o(n.onKeyPress)),n.onKeyDown&&(n.onKeyDown=o(n.onKeyDown)),n.onKeyUp&&(n.onKeyUp=o(n.onKeyUp)),n.onInput&&(n.onChange=o(n.onInput)),n.onChange&&(n.onChange=o(n.onChange))),arguments.length){case 2:return e(i,n);case 3:return e(i,n,arguments[2]);case 4:return e(i,n,arguments[2],arguments[3]);case 5:return e(i,n,arguments[2],arguments[3],arguments[4]);case 6:return e(i,n,arguments[2],arguments[3],arguments[4],arguments[5]);case 7:return e(i,n,arguments[2],arguments[3],arguments[4],arguments[5],arguments[6]);case 8:return e(i,n,arguments[2],arguments[3],arguments[4],arguments[5],arguments[6],arguments[7]);case 9:return e(i,n,arguments[2],arguments[3],arguments[4],arguments[5],arguments[6],arguments[7],arguments[8]);default:if(!1===s)return e.apply(null,arguments);for(var a=[i,n],c=2,u=arguments.length;c<u;c++)a.push(arguments[c]);return e.apply(null,a)}}},t.Injector=l,Object.defineProperty(t,"__esModule",{value:!0})}); | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("lom_atom")):"function"==typeof define&&define.amd?define(["exports","lom_atom"],e):e(t["reactive-di"]={},t.lom_atom)}(this,function(t,e){"use strict";function r(t,e,r,o,i){var n={};return Object.keys(o).forEach(function(t){n[t]=o[t]}),n.enumerable=!!n.enumerable,n.configurable=!!n.configurable,("value"in n||n.initializer)&&(n.writable=!0),n=r.slice().reverse().reduce(function(r,o){return o(t,e,r)||r},n),i&&void 0!==n.initializer&&(n.value=n.initializer?n.initializer.call(i):void 0,n.initializer=void 0),void 0===n.initializer&&(Object.defineProperty(t,e,n),n=null),n}function o(t,e){if(t===e)return!1;if(!t&&e||!e&&t)return!0;var r=0;for(var o in t){if(t[o]!==e[o])return!0;r++}for(var i in e)r--;return 0!==r}var i,n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},s=function(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e},c=0,a=function(){function t(){this.classes={}}return t.prototype.update=function(t){return this},t.prototype.attach=function(){return this},t.prototype.detach=function(){return this},t}(),u={createStyleSheet:function(t){return new a}},p=(i=function(){function t(t,e,r){if(this.parent=r,this.top=r?r.top:this,this._sheetProcessor=e||u,this._sticky=void 0,void 0!==t)for(var o=0;o<t.length;o++){var i=t[o];i instanceof Array?this.value(i[0],i[1],!0):"function"==typeof i?(void 0===this._sticky&&(this._sticky=new Set),this._sticky.add(i)):this.value(i.constructor,i,!0)}}return t.prototype.value=function(t,e,r,o){if(void 0!==e)return e;if(!0===t.theme){if(this.top===this){var i=void 0===o?this._sheetProcessor.createStyleSheet(this._fastCall(t)):o.update(this._fastCall(t));return i.attach(),i}return this.top.value(t)}if(void 0!==this.parent&&(void 0===this._sticky||!this._sticky.has(t))){c++;var n=this.parent.value(t);if(c--,void 0!==n)return n}return 0===c?this._fastNew(t):void 0},t.prototype._destroyProp=function(t,e){this!==this.top||"function"!=typeof t||void 0===t.theme||void 0===e||e.detach()},t.prototype._destroy=function(){this._sticky=void 0,this.parent=void 0,this.top=void 0,this._sheetProcessor=void 0},t.prototype._fastNew=function(t){var e=this.resolve(t.deps);switch(e.length){case 1:return new t(e[0]);case 2:return new t(e[0],e[1]);case 3:return new t(e[0],e[1],e[2]);case 4:return new t(e[0],e[1],e[2],e[3]);case 5:return new t(e[0],e[1],e[2],e[3],e[4]);case 6:return new t(e[0],e[1],e[2],e[3],e[4],e[5]);default:return new(Function.prototype.bind.apply(t,[null].concat(e)))}},t.prototype._fastCall=function(t){var e=this.resolve(t.deps);switch(e.length){case 1:return t(e[0]);case 2:return t(e[0],e[1]);case 3:return t(e[0],e[1],e[2]);case 4:return t(e[0],e[1],e[2],e[3]);case 5:return t(e[0],e[1],e[2],e[3],e[4]);case 6:return t(e[0],e[1],e[2],e[3],e[4],e[5]);default:return t.apply(void 0,e)}},t.prototype.copy=function(e){return new t(e,this._sheetProcessor,this)},t.prototype.resolve=function(t){var e=[];if(void 0!==t)for(var r=0,o=t.length;r<o;r++){var i=t[r];if("object"===n(i)){var s={};for(var c in i){var a=i[c];s[c]=void 0===a.theme?this.value(a):this.value(a).classes}e.push(s)}else e.push(this.value(i))}return e},t}(),function(t,e,r,o,i){var n={};Object.keys(o).forEach(function(t){n[t]=o[t]}),n.enumerable=!!n.enumerable,n.configurable=!!n.configurable,("value"in n||n.initializer)&&(n.writable=!0),n=r.slice().reverse().reduce(function(r,o){return o(t,e,r)||r},n),i&&void 0!==n.initializer&&(n.value=n.initializer?n.initializer.call(i):void 0,n.initializer=void 0),void 0===n.initializer&&(Object.defineProperty(t,e,n),n=null)}(i.prototype,"value",[e.memkey],Object.getOwnPropertyDescriptor(i.prototype,"value"),i.prototype),i),l=void 0;t.createReactWrapper=function(t,i){var n,c=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new p,a=(n=function(t){function r(e,r,o){var i;return i=t.call(this,e,r)||this,i._propsChanged=!0,i._injector=void 0,i._el=void 0,i._render=o,void 0===o.deps&&void 0===o.props||i.constructor.instances++,i}return s(r,t),r.prototype.shouldComponentUpdate=function(t){return this._propsChanged=o(this.props,t),this._propsChanged},r.prototype.componentWillUnmount=function(){e.defaultContext.getAtom("r$",this).destroyed(!0)},r.prototype._destroy=function(){var t=this._render;void 0===t.deps&&void 0===t.props||this.constructor.instances--,this._el=void 0,this.props=void 0,this._injector=void 0,this._render=void 0},r.prototype._getInjector=function(){var t=this.props.__lom_ctx||c;return this._injector=this.constructor.instances>0?t.copy():t,this._injector},r.prototype._state=function(t,e){var r=this._injector||this._getInjector();return this._render.props&&e&&r.value(this._render.props,this.props),r.resolve(this._render.deps)[0]},r.prototype.r=function(t,e){var r=void 0,o=this._render,n=l;l=this._injector||this._getInjector();var s=void 0!==o.deps?this._state(void 0,e):void 0;try{r=o(this.props,s)}catch(t){var c=o.onError||i;r=c({error:t},void 0===c.deps?void 0:l.resolve(c.deps)[0])}return l=n,e||(this._el=r,this.forceUpdate(),this._el=void 0),this._propsChanged=!1,r},r.prototype.render=function(){return void 0===this._el?this.r(void 0,this._propsChanged):this._el},r}(t),r(n.prototype,"r",[e.detached],Object.getOwnPropertyDescriptor(n.prototype,"r"),n.prototype),n);return function(t){function e(e,r){a.call(this,e,r,t)}return e.instances=0,e.displayName=t.displayName||t.name,e.prototype=Object.create(a.prototype),e.prototype.constructor=e,e}},t.createCreateElement=function(t,e){return function(){var r=arguments[0],o=arguments[1],i=void 0,n="function"==typeof r&&void 0===r.prototype.render;switch(n?(void 0===r.__lom&&(r.__lom=t(r)),i=r.__lom,o?o.__lom_ctx=l:o={__lom_ctx:l}):i=r,arguments.length){case 2:return e(i,o);case 3:return e(i,o,arguments[2]);case 4:return e(i,o,arguments[2],arguments[3]);case 5:return e(i,o,arguments[2],arguments[3],arguments[4]);case 6:return e(i,o,arguments[2],arguments[3],arguments[4],arguments[5]);case 7:return e(i,o,arguments[2],arguments[3],arguments[4],arguments[5],arguments[6]);case 8:return e(i,o,arguments[2],arguments[3],arguments[4],arguments[5],arguments[6],arguments[7]);case 9:return e(i,o,arguments[2],arguments[3],arguments[4],arguments[5],arguments[6],arguments[7],arguments[8]);default:if(!1===n)return e.apply(null,arguments);for(var s=[i,o],c=2,a=arguments.length;c<a;c++)s.push(arguments[c]);return e.apply(null,s)}}},t.Injector=p,Object.defineProperty(t,"__esModule",{value:!0})}); | ||
//# sourceMappingURL=reactive-di.umd.js.map |
{ | ||
"name": "reactive-di", | ||
"version": "4.0.3", | ||
"version": "4.0.4", | ||
"description": "Reactive dependency injection", | ||
@@ -76,4 +76,4 @@ "publishConfig": { | ||
"dependencies": { | ||
"lom_atom": "^1.0.5" | ||
"lom_atom": "^1.0.6" | ||
} | ||
} |
// @flow | ||
import {defaultContext, detached} from 'lom_atom' | ||
import {defaultContext, mem, detached} from 'lom_atom' | ||
import type {NamesOf} from 'lom_atom' | ||
@@ -29,12 +29,2 @@ | ||
function createEventFix(origin: (e: Event) => void): (e: Event) => void { | ||
function fixEvent(e: Event) { | ||
origin(e) | ||
defaultContext.run() | ||
} | ||
fixEvent.displayName = origin.displayName || origin.name | ||
return fixEvent | ||
} | ||
function shouldUpdate<Props: Object>(oldProps: Props, props: Props): boolean { | ||
@@ -87,19 +77,2 @@ if (oldProps === props) { | ||
} | ||
if (attrs) { | ||
if (attrs.onKeyPress) { | ||
attrs.onKeyPress = createEventFix(attrs.onKeyPress) | ||
} | ||
if (attrs.onKeyDown) { | ||
attrs.onKeyDown = createEventFix(attrs.onKeyDown) | ||
} | ||
if (attrs.onKeyUp) { | ||
attrs.onKeyUp = createEventFix(attrs.onKeyUp) | ||
} | ||
if (attrs.onInput) { | ||
attrs.onChange = createEventFix(attrs.onInput) | ||
} | ||
if (attrs.onChange) { | ||
attrs.onChange = createEventFix(attrs.onChange) | ||
} | ||
} | ||
@@ -195,7 +168,6 @@ switch(arguments.length) { | ||
// @mem | ||
_state(next?: State, force?: boolean): State { | ||
const injector = this._injector || this._getInjector() | ||
if (this._render.props && force) { | ||
injector.value(this._render.props, this.props, true) | ||
injector.value(this._render.props, this.props) | ||
} | ||
@@ -202,0 +174,0 @@ const state = injector.resolve(this._render.deps)[0] |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
110217
830
Updatedlom_atom@^1.0.6