Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

reactive-di

Package Overview
Dependencies
Maintainers
1
Versions
134
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

reactive-di - npm Package Compare versions

Comparing version 4.0.8 to 4.0.9

5

CHANGELOG.md

@@ -5,2 +5,7 @@ # Change Log

<a name="4.0.9"></a>
## [4.0.9](https://github.com/zerkalica/reactive-di/compare/v4.0.8...v4.0.9) (2017-08-27)
<a name="4.0.8"></a>

@@ -7,0 +12,0 @@ ## [4.0.8](https://github.com/zerkalica/reactive-di/compare/v4.0.7...v4.0.8) (2017-08-27)

106

dist/reactive-di.es.js

@@ -1,2 +0,2 @@

import { defaultContext, detached, mem, memkey } from 'lom_atom';
import { defaultContext, detached, memkey } from 'lom_atom';

@@ -129,2 +129,4 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) {

function Injector(items, sheetProcessor, parent, displayName) {
this._resolved = false;
this._listeners = undefined;
this.parent = parent;

@@ -184,2 +186,3 @@ this.displayName = displayName || 'Injector';

this.parent = undefined;
this._listeners = undefined;
this._sheetManager = undefined;

@@ -248,3 +251,3 @@ };

Injector.prototype.invokeWithProps = function invokeWithProps(key, props) {
Injector.prototype.invokeWithProps = function invokeWithProps(key, props, propsChanged) {
if (key.deps === undefined) {

@@ -256,2 +259,15 @@ return key(props);

if (propsChanged === true) {
var listeners = this._listeners;
if (listeners !== undefined) {
for (var i = 0; i < listeners.length; i++) {
var listener = listeners[i];
listener[listener.constructor.__lom_prop] = props;
}
}
}
this._resolved = true;
switch (args.length) {

@@ -296,2 +312,4 @@ case 0:

if (argDeps !== undefined) {
var resolved = this._resolved;
for (var i = 0, l = argDeps.length; i < l; i++) {

@@ -306,3 +324,13 @@ var argDep = argDeps[i];

var key = argDep[prop];
obj[prop] = key.theme === undefined ? this.value(key) : this._sheetManager.sheet(key).classes;
var dep = key.theme === undefined ? this.value(key) : this._sheetManager.sheet(key).classes;
if (resolved === false && key.__lom_prop !== undefined) {
if (this._listeners === undefined) {
this._listeners = [];
}
this._listeners.push(dep);
}
obj[prop] = dep;
}

@@ -312,3 +340,13 @@

} else {
result.push(argDep.theme === undefined ? this.value(argDep) : this._sheetManager.sheet(argDep).classes);
var _dep = argDep.theme === undefined ? this.value(argDep) : this._sheetManager.sheet(argDep).classes;
if (resolved === false && argDep.__lom_prop !== undefined) {
if (this._listeners === undefined) {
this._listeners = [];
}
this._listeners.push(_dep);
}
result.push(_dep);
}

@@ -324,15 +362,2 @@ }

var _class;
var _descriptor;
function _initDefineProp(target, property, descriptor, context) {
if (!descriptor) return;
Object.defineProperty(target, property, {
enumerable: descriptor.enumerable,
configurable: descriptor.configurable,
writable: descriptor.writable,
value: descriptor.initializer ? descriptor.initializer.call(context) : void 0
});
}
function _applyDecoratedDescriptor(target, property, decorators, descriptor, context) {

@@ -434,25 +459,8 @@ var desc = {};

}
var wrapperProxyDescr = {
get: function get$$1(t, name) {
return t.writableProps[name];
},
ownKeys: function ownKeys(t) {
return Object.keys(t.writableProps.valueOf());
}
};
var PropsWrapper = (_class = function PropsWrapper(props) {
_initDefineProp(this, "writableProps", _descriptor, this);
this.writableProps = props;
this.props = new Proxy(this, wrapperProxyDescr);
}, (_descriptor = _applyDecoratedDescriptor(_class.prototype, "writableProps", [mem], {
enumerable: true,
initializer: null
})), _class);
function createReactWrapper(BaseComponent, defaultFromError) {
var _class3;
var _class;
var rootInjector = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : new Injector();
var useContext = arguments[3];
var AtomizedComponent = (_class3 = function (_BaseComponent) {
var AtomizedComponent = (_class = function (_BaseComponent) {
inheritsLoose(AtomizedComponent, _BaseComponent);

@@ -469,14 +477,3 @@

_this._keys = Object.keys(props);
var propsKey = render.props;
if (props && propsKey !== undefined) {
injector._map.set(propsKey, props);
_this._propsWrapper = new PropsWrapper(props);
_this._injector = (props.__lom_ctx || rootInjector).copy([[propsKey, _this._propsWrapper.props]], _this.constructor.displayName);
} else {
_this._propsWrapper = undefined;
_this._injector = (props.__lom_ctx || rootInjector).copy(undefined, _this.constructor.displayName);
}
_this._injector = (props.__lom_ctx || rootInjector).copy(undefined, _this.constructor.displayName);
return _this;

@@ -495,7 +492,2 @@ }

this._propsChanged = true;
if (this._propsWrapper !== undefined) {
this._propsWrapper.writableProps = props;
}
return true;

@@ -506,5 +498,2 @@ }

return false; // this._propsChanged = shouldUpdate(this.props, props)
// if (this._propsChanged && this._propsWrapper !== undefined) {
// this._propsWrapper.writableProps = props
// }
// return this._propsChanged

@@ -521,3 +510,2 @@ };

this._injector = undefined;
this._propsWrapper = undefined;
};

@@ -532,3 +520,3 @@

try {
data = parentContext.invokeWithProps(render, this.props);
data = parentContext.invokeWithProps(render, this.props, force);
} catch (error) {

@@ -557,3 +545,3 @@ data = parentContext.invokeWithProps(render.onError || defaultFromError, {

return AtomizedComponent;
}(BaseComponent), (_applyDecoratedDescriptor(_class3.prototype, "r", [detached], Object.getOwnPropertyDescriptor(_class3.prototype, "r"), _class3.prototype)), _class3);
}(BaseComponent), (_applyDecoratedDescriptor(_class.prototype, "r", [detached], Object.getOwnPropertyDescriptor(_class.prototype, "r"), _class.prototype)), _class);
return function reactWrapper(render) {

@@ -560,0 +548,0 @@ if (render.__lom !== undefined) {

@@ -133,2 +133,4 @@ 'use strict';

function Injector(items, sheetProcessor, parent, displayName) {
this._resolved = false;
this._listeners = undefined;
this.parent = parent;

@@ -188,2 +190,3 @@ this.displayName = displayName || 'Injector';

this.parent = undefined;
this._listeners = undefined;
this._sheetManager = undefined;

@@ -252,3 +255,3 @@ };

Injector.prototype.invokeWithProps = function invokeWithProps(key, props) {
Injector.prototype.invokeWithProps = function invokeWithProps(key, props, propsChanged) {
if (key.deps === undefined) {

@@ -260,2 +263,15 @@ return key(props);

if (propsChanged === true) {
var listeners = this._listeners;
if (listeners !== undefined) {
for (var i = 0; i < listeners.length; i++) {
var listener = listeners[i];
listener[listener.constructor.__lom_prop] = props;
}
}
}
this._resolved = true;
switch (args.length) {

@@ -300,2 +316,4 @@ case 0:

if (argDeps !== undefined) {
var resolved = this._resolved;
for (var i = 0, l = argDeps.length; i < l; i++) {

@@ -310,3 +328,13 @@ var argDep = argDeps[i];

var key = argDep[prop];
obj[prop] = key.theme === undefined ? this.value(key) : this._sheetManager.sheet(key).classes;
var dep = key.theme === undefined ? this.value(key) : this._sheetManager.sheet(key).classes;
if (resolved === false && key.__lom_prop !== undefined) {
if (this._listeners === undefined) {
this._listeners = [];
}
this._listeners.push(dep);
}
obj[prop] = dep;
}

@@ -316,3 +344,13 @@

} else {
result.push(argDep.theme === undefined ? this.value(argDep) : this._sheetManager.sheet(argDep).classes);
var _dep = argDep.theme === undefined ? this.value(argDep) : this._sheetManager.sheet(argDep).classes;
if (resolved === false && argDep.__lom_prop !== undefined) {
if (this._listeners === undefined) {
this._listeners = [];
}
this._listeners.push(_dep);
}
result.push(_dep);
}

@@ -328,15 +366,2 @@ }

var _class;
var _descriptor;
function _initDefineProp(target, property, descriptor, context) {
if (!descriptor) return;
Object.defineProperty(target, property, {
enumerable: descriptor.enumerable,
configurable: descriptor.configurable,
writable: descriptor.writable,
value: descriptor.initializer ? descriptor.initializer.call(context) : void 0
});
}
function _applyDecoratedDescriptor(target, property, decorators, descriptor, context) {

@@ -438,25 +463,8 @@ var desc = {};

}
var wrapperProxyDescr = {
get: function get$$1(t, name) {
return t.writableProps[name];
},
ownKeys: function ownKeys(t) {
return Object.keys(t.writableProps.valueOf());
}
};
var PropsWrapper = (_class = function PropsWrapper(props) {
_initDefineProp(this, "writableProps", _descriptor, this);
this.writableProps = props;
this.props = new Proxy(this, wrapperProxyDescr);
}, (_descriptor = _applyDecoratedDescriptor(_class.prototype, "writableProps", [lom_atom.mem], {
enumerable: true,
initializer: null
})), _class);
function createReactWrapper(BaseComponent, defaultFromError) {
var _class3;
var _class;
var rootInjector = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : new Injector();
var useContext = arguments[3];
var AtomizedComponent = (_class3 = function (_BaseComponent) {
var AtomizedComponent = (_class = function (_BaseComponent) {
inheritsLoose(AtomizedComponent, _BaseComponent);

@@ -473,14 +481,3 @@

_this._keys = Object.keys(props);
var propsKey = render.props;
if (props && propsKey !== undefined) {
injector._map.set(propsKey, props);
_this._propsWrapper = new PropsWrapper(props);
_this._injector = (props.__lom_ctx || rootInjector).copy([[propsKey, _this._propsWrapper.props]], _this.constructor.displayName);
} else {
_this._propsWrapper = undefined;
_this._injector = (props.__lom_ctx || rootInjector).copy(undefined, _this.constructor.displayName);
}
_this._injector = (props.__lom_ctx || rootInjector).copy(undefined, _this.constructor.displayName);
return _this;

@@ -499,7 +496,2 @@ }

this._propsChanged = true;
if (this._propsWrapper !== undefined) {
this._propsWrapper.writableProps = props;
}
return true;

@@ -510,5 +502,2 @@ }

return false; // this._propsChanged = shouldUpdate(this.props, props)
// if (this._propsChanged && this._propsWrapper !== undefined) {
// this._propsWrapper.writableProps = props
// }
// return this._propsChanged

@@ -525,3 +514,2 @@ };

this._injector = undefined;
this._propsWrapper = undefined;
};

@@ -536,3 +524,3 @@

try {
data = parentContext.invokeWithProps(render, this.props);
data = parentContext.invokeWithProps(render, this.props, force);
} catch (error) {

@@ -561,3 +549,3 @@ data = parentContext.invokeWithProps(render.onError || defaultFromError, {

return AtomizedComponent;
}(BaseComponent), (_applyDecoratedDescriptor(_class3.prototype, "r", [lom_atom.detached], Object.getOwnPropertyDescriptor(_class3.prototype, "r"), _class3.prototype)), _class3);
}(BaseComponent), (_applyDecoratedDescriptor(_class.prototype, "r", [lom_atom.detached], Object.getOwnPropertyDescriptor(_class.prototype, "r"), _class.prototype)), _class);
return function reactWrapper(render) {

@@ -564,0 +552,0 @@ if (render.__lom !== undefined) {

@@ -133,2 +133,4 @@ (function (global, factory) {

function Injector(items, sheetProcessor, parent, displayName) {
this._resolved = false;
this._listeners = undefined;
this.parent = parent;

@@ -188,2 +190,3 @@ this.displayName = displayName || 'Injector';

this.parent = undefined;
this._listeners = undefined;
this._sheetManager = undefined;

@@ -252,3 +255,3 @@ };

Injector.prototype.invokeWithProps = function invokeWithProps(key, props) {
Injector.prototype.invokeWithProps = function invokeWithProps(key, props, propsChanged) {
if (key.deps === undefined) {

@@ -260,2 +263,15 @@ return key(props);

if (propsChanged === true) {
var listeners = this._listeners;
if (listeners !== undefined) {
for (var i = 0; i < listeners.length; i++) {
var listener = listeners[i];
listener[listener.constructor.__lom_prop] = props;
}
}
}
this._resolved = true;
switch (args.length) {

@@ -300,2 +316,4 @@ case 0:

if (argDeps !== undefined) {
var resolved = this._resolved;
for (var i = 0, l = argDeps.length; i < l; i++) {

@@ -310,3 +328,13 @@ var argDep = argDeps[i];

var key = argDep[prop];
obj[prop] = key.theme === undefined ? this.value(key) : this._sheetManager.sheet(key).classes;
var dep = key.theme === undefined ? this.value(key) : this._sheetManager.sheet(key).classes;
if (resolved === false && key.__lom_prop !== undefined) {
if (this._listeners === undefined) {
this._listeners = [];
}
this._listeners.push(dep);
}
obj[prop] = dep;
}

@@ -316,3 +344,13 @@

} else {
result.push(argDep.theme === undefined ? this.value(argDep) : this._sheetManager.sheet(argDep).classes);
var _dep = argDep.theme === undefined ? this.value(argDep) : this._sheetManager.sheet(argDep).classes;
if (resolved === false && argDep.__lom_prop !== undefined) {
if (this._listeners === undefined) {
this._listeners = [];
}
this._listeners.push(_dep);
}
result.push(_dep);
}

@@ -328,15 +366,2 @@ }

var _class;
var _descriptor;
function _initDefineProp(target, property, descriptor, context) {
if (!descriptor) return;
Object.defineProperty(target, property, {
enumerable: descriptor.enumerable,
configurable: descriptor.configurable,
writable: descriptor.writable,
value: descriptor.initializer ? descriptor.initializer.call(context) : void 0
});
}
function _applyDecoratedDescriptor(target, property, decorators, descriptor, context) {

@@ -438,25 +463,8 @@ var desc = {};

}
var wrapperProxyDescr = {
get: function get$$1(t, name) {
return t.writableProps[name];
},
ownKeys: function ownKeys(t) {
return Object.keys(t.writableProps.valueOf());
}
};
var PropsWrapper = (_class = function PropsWrapper(props) {
_initDefineProp(this, "writableProps", _descriptor, this);
this.writableProps = props;
this.props = new Proxy(this, wrapperProxyDescr);
}, (_descriptor = _applyDecoratedDescriptor(_class.prototype, "writableProps", [lom_atom.mem], {
enumerable: true,
initializer: null
})), _class);
function createReactWrapper(BaseComponent, defaultFromError) {
var _class3;
var _class;
var rootInjector = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : new Injector();
var useContext = arguments[3];
var AtomizedComponent = (_class3 = function (_BaseComponent) {
var AtomizedComponent = (_class = function (_BaseComponent) {
inheritsLoose(AtomizedComponent, _BaseComponent);

@@ -473,14 +481,3 @@

_this._keys = Object.keys(props);
var propsKey = render.props;
if (props && propsKey !== undefined) {
injector._map.set(propsKey, props);
_this._propsWrapper = new PropsWrapper(props);
_this._injector = (props.__lom_ctx || rootInjector).copy([[propsKey, _this._propsWrapper.props]], _this.constructor.displayName);
} else {
_this._propsWrapper = undefined;
_this._injector = (props.__lom_ctx || rootInjector).copy(undefined, _this.constructor.displayName);
}
_this._injector = (props.__lom_ctx || rootInjector).copy(undefined, _this.constructor.displayName);
return _this;

@@ -499,7 +496,2 @@ }

this._propsChanged = true;
if (this._propsWrapper !== undefined) {
this._propsWrapper.writableProps = props;
}
return true;

@@ -510,5 +502,2 @@ }

return false; // this._propsChanged = shouldUpdate(this.props, props)
// if (this._propsChanged && this._propsWrapper !== undefined) {
// this._propsWrapper.writableProps = props
// }
// return this._propsChanged

@@ -525,3 +514,2 @@ };

this._injector = undefined;
this._propsWrapper = undefined;
};

@@ -536,3 +524,3 @@

try {
data = parentContext.invokeWithProps(render, this.props);
data = parentContext.invokeWithProps(render, this.props, force);
} catch (error) {

@@ -561,3 +549,3 @@ data = parentContext.invokeWithProps(render.onError || defaultFromError, {

return AtomizedComponent;
}(BaseComponent), (_applyDecoratedDescriptor(_class3.prototype, "r", [lom_atom.detached], Object.getOwnPropertyDescriptor(_class3.prototype, "r"), _class3.prototype)), _class3);
}(BaseComponent), (_applyDecoratedDescriptor(_class.prototype, "r", [lom_atom.detached], Object.getOwnPropertyDescriptor(_class.prototype, "r"), _class.prototype)), _class);
return function reactWrapper(render) {

@@ -564,0 +552,0 @@ if (render.__lom !== undefined) {

{
"name": "reactive-di",
"version": "4.0.8",
"version": "4.0.9",
"description": "Reactive dependency injection",

@@ -76,4 +76,4 @@ "publishConfig": {

"dependencies": {
"lom_atom": "^1.0.13"
"lom_atom": "^1.0.14"
}
}

@@ -111,23 +111,2 @@ // @flow

const wrapperProxyDescr = {
get(t: PropsWrapper<*>, name: string) {
return t.writableProps[name]
},
ownKeys(t: PropsWrapper<*>) {
return Object.keys(t.writableProps.valueOf())
}
}
class PropsWrapper<Props: Object> {
@mem writableProps: Props
props: Props
constructor(props: Props) {
this.writableProps = props
this.props = new Proxy((this: any), wrapperProxyDescr)
}
}
const emptyArgs = []
export default function createReactWrapper<IElement>(

@@ -144,3 +123,2 @@ BaseComponent: Class<*>,

_injector: Injector
_propsWrapper: PropsWrapper<IPropsWithContext> | void

@@ -159,17 +137,6 @@ static render: IRenderFn<IElement, State>

this._keys = Object.keys(props)
const propsKey = render.props
if (props && propsKey !== undefined) {
injector._map.set(propsKey, props)
this._propsWrapper = new PropsWrapper(props)
this._injector = (props.__lom_ctx || rootInjector).copy(
[[propsKey, this._propsWrapper.props]],
this.constructor.displayName
)
} else {
this._propsWrapper = undefined
this._injector = (props.__lom_ctx || rootInjector).copy(
undefined,
this.constructor.displayName
)
}
this._injector = (props.__lom_ctx || rootInjector).copy(
undefined,
this.constructor.displayName
)
}

@@ -184,5 +151,2 @@

this._propsChanged = true
if (this._propsWrapper !== undefined) {
this._propsWrapper.writableProps = props
}
return true

@@ -194,5 +158,2 @@ }

// this._propsChanged = shouldUpdate(this.props, props)
// if (this._propsChanged && this._propsWrapper !== undefined) {
// this._propsWrapper.writableProps = props
// }
// return this._propsChanged

@@ -209,3 +170,2 @@ }

this._injector = (undefined: any)
this._propsWrapper = undefined
}

@@ -223,5 +183,4 @@

parentContext = this._injector
try {
data = parentContext.invokeWithProps(render, this.props)
data = parentContext.invokeWithProps(render, this.props, force)
} catch (error) {

@@ -228,0 +187,0 @@ data = parentContext.invokeWithProps(render.onError || defaultFromError, {error})

@@ -24,4 +24,2 @@ // @flow

let chainCount = 0
class FakeSheet<V: Object> implements ISheet<V> {

@@ -82,2 +80,4 @@ classes: {+[id: $Keys<V>]: string} = {}

type IListener = Object
export default class Injector {

@@ -137,2 +137,3 @@ parent: Injector | void

this.parent = undefined
this._listeners = undefined
this._sheetManager = (undefined: any)

@@ -169,8 +170,20 @@ }

invokeWithProps<V>(key: Function, props?: Object): V {
_resolved: boolean = false
_listeners: IListener[] | void = undefined
invokeWithProps<V>(key: Function, props?: Object, propsChanged?: boolean): V {
if (key.deps === undefined) {
return key(props)
}
const args = this.resolve(key.deps)
if (propsChanged === true) {
const listeners = this._listeners
if (listeners !== undefined) {
for (let i = 0; i < listeners.length; i++) {
const listener = listeners[i]
listener[listener.constructor.__lom_prop] = props
}
}
}
this._resolved = true
switch (args.length) {

@@ -193,2 +206,3 @@ case 0: return key(props)

resolve(argDeps?: IArg[]): any[] {

@@ -198,2 +212,3 @@ const result = []

if (argDeps !== undefined) {
const resolved = this._resolved
for (let i = 0, l = argDeps.length; i < l; i++) {

@@ -205,5 +220,14 @@ let argDep = argDeps[i]

const key = argDep[prop]
obj[prop] = key.theme === undefined
const dep = key.theme === undefined
? this.value(key)
: this._sheetManager.sheet(key).classes
if (resolved === false && key.__lom_prop !== undefined) {
if (this._listeners === undefined) {
this._listeners = []
}
this._listeners.push(dep)
}
obj[prop] = dep
}

@@ -213,6 +237,14 @@

} else {
result.push(argDep.theme === undefined
const dep = argDep.theme === undefined
? this.value(argDep)
: this._sheetManager.sheet(argDep).classes
)
if (resolved === false && argDep.__lom_prop !== undefined) {
if (this._listeners === undefined) {
this._listeners = []
}
this._listeners.push(dep)
}
result.push(dep)
}

@@ -219,0 +251,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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc