@cerebral/fluent
Advanced tools
Comparing version 1.0.0-1521141520687 to 1.0.0-1521491486243
@@ -5,8 +5,8 @@ export declare type ComputedValue<T> = { | ||
export declare class ComputedClass<T> { | ||
callback: (state: any, root: any) => T; | ||
callback: (state: any, global: any) => T; | ||
instance: ComputedValue<T>; | ||
getState: () => any; | ||
constructor(callback: (state: any, root: any) => T); | ||
constructor(callback: (state: any, global: any) => T); | ||
get(): T; | ||
} | ||
export declare function Computed<T>(callback: (state: any, root: any) => T): ComputedClass<T>; | ||
export declare function Computed<T>(callback: (state: any, global: any) => T): ComputedClass<T>; |
@@ -18,3 +18,3 @@ /// <reference types="react" /> | ||
onUpdate(): void; | ||
setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Props) => {} | Pick<{}, K>) | Pick<{}, K>, callback?: (() => void) | undefined): void; | ||
setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Props) => {} | Pick<{}, K> | null) | Pick<{}, K> | null, callback?: (() => void) | undefined): void; | ||
forceUpdate(callBack?: (() => void) | undefined): void; | ||
@@ -21,0 +21,0 @@ props: Readonly<{ |
@@ -8,3 +8,7 @@ import { computed as mobxComputed } from 'mobx'; | ||
var _this = this; | ||
this.instance = this.instance || mobxComputed(function () { return _this.callback(_this.getState().state, _this.getState().root); }); | ||
this.instance = | ||
this.instance || | ||
mobxComputed(function () { | ||
return _this.callback(_this.getState().state, _this.getState().root); | ||
}); | ||
return this.instance.get(); | ||
@@ -11,0 +15,0 @@ }; |
@@ -15,5 +15,5 @@ import Hoc from './Hoc'; | ||
return connect(connector, passedComponent({})); | ||
} | ||
}, | ||
}; | ||
} | ||
}, | ||
}; | ||
@@ -20,0 +20,0 @@ } |
@@ -37,2 +37,2 @@ "use strict"; | ||
}) | ||
})*/ | ||
}) */ |
@@ -66,3 +66,4 @@ var __extends = (this && this.__extends) || (function () { | ||
}(BaseComponent)), | ||
_a.displayName = "CerebralWrapping_" + (Component.displayName || Component.name), | ||
_a.displayName = "CerebralWrapping_" + (Component.displayName || | ||
Component.name), | ||
_a.contextTypes = { | ||
@@ -69,0 +70,0 @@ controller: PropTypes.object, |
@@ -11,3 +11,3 @@ var __extends = (this && this.__extends) || (function () { | ||
})(); | ||
import { observable, untracked, transaction, extras, ObservableMap as MobxObservableMap, useStrict } from 'mobx'; | ||
import { observable, untracked, transaction, extras, ObservableMap as MobxObservableMap, useStrict, } from 'mobx'; | ||
import { CreateModuleProvider } from './providers'; | ||
@@ -20,3 +20,3 @@ import { BaseControllerClass } from 'cerebral'; | ||
export { pathFor } from './paths'; | ||
export { SequenceFactory, SequenceWithPropsFactory } from 'function-tree/fluent'; | ||
export { SequenceFactory, SequenceWithPropsFactory, } from 'function-tree/fluent'; | ||
export { Computed } from './Computed'; | ||
@@ -35,3 +35,3 @@ export { default as Container } from './Container'; | ||
extras.allowStateChanges(true, function () { return untracked(function () { return transaction(cb); }); }); | ||
} | ||
}, | ||
}) || this; | ||
@@ -38,0 +38,0 @@ useStrict(typeof options.useStrict === 'undefined' ? true : options.useStrict); |
/* eslint-env mocha */ | ||
import { Controller, Module, Dictionary, SequenceFactory, SequenceWithPropsFactory, Computed } from './'; | ||
import { Controller, Module, Dictionary, SequenceFactory, SequenceWithPropsFactory, Computed, } from './'; | ||
import View from './View'; | ||
@@ -10,4 +10,4 @@ import { autorun } from 'mobx'; | ||
state: { | ||
foo: 'bar' | ||
} | ||
foo: 'bar', | ||
}, | ||
}); | ||
@@ -24,5 +24,5 @@ var controller = Controller(rootModule); | ||
object: Dictionary({ | ||
foo: 'bar' | ||
foo: 'bar', | ||
}), | ||
count: 1 | ||
count: 1, | ||
}, | ||
@@ -44,8 +44,8 @@ signals: { | ||
state.increment('count', 1); | ||
} | ||
] | ||
} | ||
}, | ||
], | ||
}, | ||
}); | ||
var controller = Controller(rootModule, { | ||
useLegacyStateApi: true | ||
useLegacyStateApi: true, | ||
}); | ||
@@ -55,3 +55,7 @@ controller.signals.test(); | ||
assert.equal(controller.state.bool, false); | ||
assert.deepEqual(controller.state.list.map(function (val) { return val; }), ['foo3', 'baz', 'apple']); | ||
assert.deepEqual(controller.state.list.map(function (val) { return val; }), [ | ||
'foo3', | ||
'baz', | ||
'apple', | ||
]); | ||
assert.deepEqual(controller.state.object.toJSON(), { bar: 'baz' }); | ||
@@ -64,5 +68,5 @@ assert.equal(controller.state.count, 2); | ||
map: Dictionary({ | ||
foo: 'bar' | ||
}) | ||
} | ||
foo: 'bar', | ||
}), | ||
}, | ||
}); | ||
@@ -75,7 +79,7 @@ var controller = Controller(rootModule); | ||
state: { | ||
foo: 'bar' | ||
} | ||
foo: 'bar', | ||
}, | ||
}); | ||
var controller = Controller(rootModule, { | ||
useStrict: false | ||
useStrict: false, | ||
}); | ||
@@ -99,11 +103,11 @@ autorun(function () { | ||
state: { | ||
foo: 'bar' | ||
foo: 'bar', | ||
}, | ||
signals: { | ||
test: sequence | ||
} | ||
test: sequence, | ||
}, | ||
}); | ||
var controller = Controller(rootModule); | ||
controller.signals.test({ | ||
foo: 'bar' | ||
foo: 'bar', | ||
}); | ||
@@ -127,7 +131,7 @@ assert.equal(controller.state.foo, 'bar2'); | ||
foo: 'bar', | ||
test: Computed(computed) | ||
test: Computed(computed), | ||
}, | ||
signals: { | ||
test: signal | ||
} | ||
test: signal, | ||
}, | ||
}); | ||
@@ -157,7 +161,7 @@ var controller = Controller(rootModule); | ||
return this.foo.toUpperCase(); | ||
} | ||
}, | ||
}, | ||
signals: { | ||
test: signal | ||
} | ||
test: signal, | ||
}, | ||
}); | ||
@@ -183,7 +187,7 @@ var controller = Controller(rootModule); | ||
state: { | ||
foo: 'bar' | ||
foo: 'bar', | ||
}, | ||
signals: { | ||
test: sequence | ||
} | ||
test: sequence, | ||
}, | ||
}); | ||
@@ -236,7 +240,7 @@ var controller = Controller(rootModule); | ||
_unshift: ['foo'], | ||
_observableMapSet: Dictionary({}) | ||
_observableMapSet: Dictionary({}), | ||
}, | ||
signals: { | ||
test: sequence | ||
} | ||
test: sequence, | ||
}, | ||
}); | ||
@@ -254,3 +258,3 @@ var controller = Controller(rootModule, { | ||
method: 'set', | ||
args: [['_set'], 'bar2'] | ||
args: [['_set'], 'bar2'], | ||
}); | ||
@@ -262,3 +266,3 @@ break; | ||
method: 'push', | ||
args: [['_push'], 'bar2'] | ||
args: [['_push'], 'bar2'], | ||
}); | ||
@@ -270,3 +274,3 @@ break; | ||
method: 'pop', | ||
args: [['_pop']] | ||
args: [['_pop']], | ||
}); | ||
@@ -278,3 +282,3 @@ break; | ||
method: 'shift', | ||
args: [['_shift']] | ||
args: [['_shift']], | ||
}); | ||
@@ -286,3 +290,3 @@ break; | ||
method: 'splice', | ||
args: [['_splice'], 1, 0, 'baz'] | ||
args: [['_splice'], 1, 0, 'baz'], | ||
}); | ||
@@ -294,3 +298,3 @@ break; | ||
method: 'unshift', | ||
args: [['_unshift'], 'bar'] | ||
args: [['_unshift'], 'bar'], | ||
}); | ||
@@ -302,3 +306,3 @@ break; | ||
method: 'set', | ||
args: [['_observableMapSet', 'foo'], 'bar'] | ||
args: [['_observableMapSet', 'foo'], 'bar'], | ||
}); | ||
@@ -308,4 +312,4 @@ break; | ||
actionCount++; | ||
} | ||
} | ||
}, | ||
}, | ||
}); | ||
@@ -333,7 +337,7 @@ controller.signals.test(); | ||
state: { | ||
foo: 'bar' | ||
foo: 'bar', | ||
}, | ||
signals: { | ||
test: sequence | ||
} | ||
test: sequence, | ||
}, | ||
}); | ||
@@ -349,10 +353,10 @@ var controller = Controller(rootModule); | ||
return { | ||
foo: controller.state.foo | ||
foo: controller.state.foo, | ||
}; | ||
}, | ||
displayName: 'woo' | ||
displayName: 'woo', | ||
}); | ||
view.mount(); | ||
controller.signals.test({ | ||
foo: 'bar' | ||
foo: 'bar', | ||
}); | ||
@@ -363,3 +367,2 @@ assert.equal(controller.state.foo, 'bar2'); | ||
it('should handle nested map property', function () { | ||
var actionCount = 0; | ||
var Sequence = SequenceFactory(); | ||
@@ -379,9 +382,9 @@ var sequence = Sequence(function (s) { | ||
item: { | ||
foo: 'string' | ||
} | ||
}) | ||
foo: 'string', | ||
}, | ||
}), | ||
}, | ||
signals: { | ||
test: sequence | ||
} | ||
test: sequence, | ||
}, | ||
}); | ||
@@ -397,7 +400,6 @@ var controller = Controller(rootModule, { | ||
method: 'set', | ||
args: [['observableMapSet', 'item', 'foo'], 'string2'] | ||
args: [['observableMapSet', 'item', 'foo'], 'string2'], | ||
}); | ||
actionCount++; | ||
} | ||
} | ||
}, | ||
}, | ||
}); | ||
@@ -411,3 +413,2 @@ controller.signals.test(); | ||
it('should handle removing map property', function () { | ||
var actionCount = 0; | ||
var Sequence = SequenceFactory(); | ||
@@ -417,3 +418,3 @@ var sequence = Sequence(function (s) { | ||
var state = _a.state; | ||
var item = state.observableMapSet.delete('item'); | ||
state.observableMapSet.delete('item'); | ||
}); | ||
@@ -425,9 +426,9 @@ }); | ||
item: { | ||
foo: 'string' | ||
} | ||
}) | ||
foo: 'string', | ||
}, | ||
}), | ||
}, | ||
signals: { | ||
test: sequence | ||
} | ||
test: sequence, | ||
}, | ||
}); | ||
@@ -443,7 +444,6 @@ var controller = Controller(rootModule, { | ||
method: 'unset', | ||
args: [['observableMapSet', 'item']] | ||
args: [['observableMapSet', 'item']], | ||
}); | ||
actionCount++; | ||
} | ||
} | ||
}, | ||
}, | ||
}); | ||
@@ -468,12 +468,12 @@ controller.signals.test(); | ||
bar: { | ||
baz: 'mip' | ||
baz: 'mip', | ||
}, | ||
bar2: { | ||
baz2: 'mip2' | ||
} | ||
} | ||
baz2: 'mip2', | ||
}, | ||
}, | ||
}, | ||
signals: { | ||
test: sequence | ||
} | ||
test: sequence, | ||
}, | ||
}); | ||
@@ -490,3 +490,3 @@ var controller = Controller(rootModule, { | ||
method: 'set', | ||
args: [['foo', 'bar', 'baz'], 'mip2'] | ||
args: [['foo', 'bar', 'baz'], 'mip2'], | ||
}); | ||
@@ -498,8 +498,8 @@ } | ||
method: 'set', | ||
args: [['foo', 'bar2', 'baz2'], 'mip3'] | ||
args: [['foo', 'bar2', 'baz2'], 'mip3'], | ||
}); | ||
} | ||
actionCount++; | ||
} | ||
} | ||
}, | ||
}, | ||
}); | ||
@@ -515,6 +515,6 @@ controller.signals.test(); | ||
var state = _a.state; | ||
var hasKey = state.observableMapSet.has('item'); | ||
var keys = state.observableMapSet.keys(); | ||
var values = state.observableMapSet.values(); | ||
var entries = state.observableMapSet.entries(); | ||
state.observableMapSet.has('item'); | ||
state.observableMapSet.keys(); | ||
state.observableMapSet.values(); | ||
state.observableMapSet.entries(); | ||
state.observableMapSet.forEach(function (item) { | ||
@@ -536,9 +536,9 @@ item.foo = 'miiip'; | ||
foo: 'string', | ||
bar: 'string2' | ||
} | ||
}) | ||
bar: 'string2', | ||
}, | ||
}), | ||
}, | ||
signals: { | ||
test: sequence | ||
} | ||
test: sequence, | ||
}, | ||
}); | ||
@@ -556,3 +556,3 @@ var controller = Controller(rootModule, { | ||
method: 'set', | ||
args: [['observableMapSet', 'item', 'foo'], 'miiip'] | ||
args: [['observableMapSet', 'item', 'foo'], 'miiip'], | ||
}); | ||
@@ -564,3 +564,3 @@ break; | ||
method: 'set', | ||
args: [['observableMapSet', 'item', 'bar'], 'mopmop'] | ||
args: [['observableMapSet', 'item', 'bar'], 'mopmop'], | ||
}); | ||
@@ -572,3 +572,6 @@ break; | ||
method: 'set', | ||
args: [['observableMapSet', 'item'], { foo: 'foo2', bar: 'bar2' }] | ||
args: [ | ||
['observableMapSet', 'item'], | ||
{ foo: 'foo2', bar: 'bar2' }, | ||
], | ||
}); | ||
@@ -580,3 +583,3 @@ break; | ||
method: 'set', | ||
args: [['observableMapSet'], {}] | ||
args: [['observableMapSet'], {}], | ||
}); | ||
@@ -588,3 +591,3 @@ break; | ||
method: 'merge', | ||
args: [['observableMapSet'], { bar: 'baz' }] | ||
args: [['observableMapSet'], { bar: 'baz' }], | ||
}); | ||
@@ -596,3 +599,3 @@ break; | ||
method: 'set', | ||
args: [['observableMapSet'], { baz: 'bop' }] | ||
args: [['observableMapSet'], { baz: 'bop' }], | ||
}); | ||
@@ -602,4 +605,4 @@ break; | ||
actionCount++; | ||
} | ||
} | ||
}, | ||
}, | ||
}); | ||
@@ -610,3 +613,3 @@ controller.signals.test(); | ||
assert.deepEqual(controller.state.observableMapSet.toJS(), { | ||
baz: 'bop' | ||
baz: 'bop', | ||
}); | ||
@@ -657,12 +660,12 @@ } | ||
_unshift: ['foo'], | ||
_observableMapSet: Dictionary({}) | ||
_observableMapSet: Dictionary({}), | ||
}, | ||
signals: { | ||
test: sequence | ||
} | ||
test: sequence, | ||
}, | ||
}); | ||
var rootModule = Module({ | ||
modules: { | ||
foo: fooModule | ||
} | ||
foo: fooModule, | ||
}, | ||
}); | ||
@@ -680,3 +683,3 @@ var controller = Controller(rootModule, { | ||
method: 'module.set', | ||
args: [['foo', '_set'], 'bar2'] | ||
args: [['foo', '_set'], 'bar2'], | ||
}); | ||
@@ -688,3 +691,3 @@ break; | ||
method: 'module.push', | ||
args: [['foo', '_push'], 'bar2'] | ||
args: [['foo', '_push'], 'bar2'], | ||
}); | ||
@@ -696,3 +699,3 @@ break; | ||
method: 'module.pop', | ||
args: [['foo', '_pop']] | ||
args: [['foo', '_pop']], | ||
}); | ||
@@ -704,3 +707,3 @@ break; | ||
method: 'module.shift', | ||
args: [['foo', '_shift']] | ||
args: [['foo', '_shift']], | ||
}); | ||
@@ -712,3 +715,3 @@ break; | ||
method: 'module.splice', | ||
args: [['foo', '_splice'], 1, 0, 'baz'] | ||
args: [['foo', '_splice'], 1, 0, 'baz'], | ||
}); | ||
@@ -720,3 +723,3 @@ break; | ||
method: 'module.unshift', | ||
args: [['foo', '_unshift'], 'bar'] | ||
args: [['foo', '_unshift'], 'bar'], | ||
}); | ||
@@ -728,3 +731,3 @@ break; | ||
method: 'module.set', | ||
args: [['foo', '_observableMapSet', 'foo'], 'bar'] | ||
args: [['foo', '_observableMapSet', 'foo'], 'bar'], | ||
}); | ||
@@ -734,4 +737,4 @@ break; | ||
actionCount++; | ||
} | ||
} | ||
}, | ||
}, | ||
}); | ||
@@ -789,12 +792,12 @@ controller.signals.foo.test(); | ||
_unshift: ['foo'], | ||
_observableMapSet: Dictionary({}) | ||
_observableMapSet: Dictionary({}), | ||
}, | ||
signals: { | ||
test: sequence | ||
} | ||
test: sequence, | ||
}, | ||
}); | ||
var rootModule = Module({ | ||
modules: { | ||
foo: fooModule | ||
} | ||
foo: fooModule, | ||
}, | ||
}); | ||
@@ -801,0 +804,0 @@ var controller = Controller(rootModule); |
@@ -12,3 +12,3 @@ var __extends = (this && this.__extends) || (function () { | ||
import { extractModuleProp, isObject, BaseModel } from 'cerebral/internal'; | ||
import { observable, isObservable, isObservableMap, extendObservable, ObservableMap } from 'mobx'; | ||
import { observable, isObservable, isObservableMap, extendObservable, ObservableMap, } from 'mobx'; | ||
import { ComputedClass } from './Computed'; | ||
@@ -139,3 +139,6 @@ import { updateIn, traverse } from './utils'; | ||
else if (extension[key] instanceof ComputedClass) { | ||
extension[key].getState = function () { return ({ state: extended, root: _this.state }); }; | ||
extension[key].getState = function () { return ({ | ||
state: extended, | ||
root: _this.state, | ||
}); }; | ||
root[key] = extension[key]; | ||
@@ -142,0 +145,0 @@ } |
@@ -1,2 +0,2 @@ | ||
var pathLambdaRegex = /function\s*\((\w)\)\s*{\s*return\s*\1[\.]?([\w\.\[\]]+);\s*}/g; | ||
var pathLambdaRegex = /function\s*\((\w)\)\s*{\s*return\s*\1[.]?([\w.[\]]+);\s*}/g; | ||
export function cerebralPathFromFunction(func, args) { | ||
@@ -14,5 +14,5 @@ pathLambdaRegex.lastIndex = 0; | ||
else { | ||
output = output.replace(/\[/g, ".").replace(/\]/g, ""); | ||
output = output.replace(/\[/g, '.').replace(/\]/g, ''); | ||
} | ||
if (output && output[0] == ".") { | ||
if (output && output[0] === '.') { | ||
output = output.substring(1); | ||
@@ -47,4 +47,4 @@ } | ||
} | ||
var currentPath = ""; | ||
if (typeof (input) == typeof (Function)) { | ||
var currentPath = ''; | ||
if (typeof input === typeof Function) { | ||
currentPath = cerebralPathFromFunction(input, args); | ||
@@ -62,3 +62,3 @@ } | ||
return currentPath + "." + cerebralPathFromFunction(innerInput, innerArgs); | ||
} | ||
}, | ||
}; | ||
@@ -65,0 +65,0 @@ return withProvider; |
import { Provider } from 'cerebral'; | ||
import { isObservableMap, isObservable } from 'mobx'; | ||
import { isObservable, isObservableMap } from 'mobx'; | ||
import { ComputedClass } from './Computed'; | ||
var mutationMethods = ['concat', 'pop', 'push', 'shift', 'splice', 'unshift']; | ||
var nonMutationObservableMapKeys = [ | ||
'has', | ||
'keys', | ||
'values', | ||
'entries', | ||
'isValidKey', | ||
'_hasMap', | ||
'forEach' | ||
var mutationMethods = [ | ||
'concat', | ||
'pop', | ||
'push', | ||
'shift', | ||
'splice', | ||
'unshift', | ||
]; | ||
@@ -28,3 +26,2 @@ function cleanPath(state, key, path) { | ||
} | ||
return; | ||
}, state); | ||
@@ -51,3 +48,2 @@ if (value === undefined) { | ||
case 'forEach': | ||
var originalFunc = target[key]; | ||
return function (cb) { | ||
@@ -93,3 +89,3 @@ return target.keys().forEach(function (forEachKey) { | ||
method: basePath.length ? 'module.unset' : 'unset', | ||
args: [basePath.concat(path).concat(args[0])] | ||
args: [basePath.concat(path).concat(args[0])], | ||
}, execution, functionDetails, props); | ||
@@ -110,3 +106,3 @@ path = cleanPath(state, args[0], path); | ||
method: basePath.length ? 'module.set' : 'set', | ||
args: [basePath.concat(path), {}] | ||
args: [basePath.concat(path), {}], | ||
}, execution, functionDetails, props); | ||
@@ -127,3 +123,3 @@ path = cleanPath(state, null, path); | ||
method: basePath.length ? 'module.merge' : 'merge', | ||
args: [basePath.concat(path), args[0]] | ||
args: [basePath.concat(path), args[0]], | ||
}, execution, functionDetails, props); | ||
@@ -144,3 +140,3 @@ path = cleanPath(state, null, path); | ||
method: basePath.length ? 'module.set' : 'set', | ||
args: [basePath.concat(path), args[0]] | ||
args: [basePath.concat(path), args[0]], | ||
}, execution, functionDetails, props); | ||
@@ -160,3 +156,3 @@ path = cleanPath(state, null, path); | ||
method: basePath.length ? 'module.set' : 'set', | ||
args: [basePath.concat(path).concat(args[0]), args[1]] | ||
args: [basePath.concat(path).concat(args[0]), args[1]], | ||
}, execution, functionDetails, props); | ||
@@ -179,3 +175,4 @@ path = cleanPath(state, null, path); | ||
else { | ||
if (typeof target[key] === 'function' && mutationMethods.indexOf(key) >= 0) { | ||
if (typeof target[key] === 'function' && | ||
mutationMethods.indexOf(key) >= 0) { | ||
var originalFunction_6 = target[key]; | ||
@@ -190,3 +187,3 @@ return function () { | ||
method: basePath.length ? 'module.' + String(key) : key, | ||
args: [basePath.concat(path)].concat(args) | ||
args: [basePath.concat(path)].concat(args), | ||
}, execution, functionDetails, props); | ||
@@ -205,7 +202,10 @@ path = cleanPath(state, key, path); | ||
method: basePath.length ? 'module.set' : 'set', | ||
args: [basePath.concat(path), isObservable(value) ? value.value : value] | ||
args: [ | ||
basePath.concat(path), | ||
isObservable(value) ? value.value : value, | ||
], | ||
}, execution, functionDetails, props); | ||
Reflect.set(target, key, value); | ||
return true; | ||
} | ||
}, | ||
}; | ||
@@ -226,3 +226,3 @@ return validator; | ||
'increment', | ||
'unset' | ||
'unset', | ||
]; | ||
@@ -239,3 +239,3 @@ export function CreateStateProvider(state, devtools, model, useLegacyStateApi) { | ||
return model[method].apply(model, [path.split('.')].concat(args)); | ||
} | ||
}, | ||
}); | ||
@@ -260,7 +260,7 @@ }); | ||
method: method, | ||
args: [path.split('.')].concat(args.map(function (value) { return (isObservable(value) ? value.value : value); })) | ||
args: [path.split('.')].concat(args.map(function (value) { return (isObservable(value) ? value.value : value); })), | ||
}, context.execution, context.functionDetails, context.props); | ||
} | ||
return model[method].apply(model, [path.split('.')].concat(args)); | ||
} | ||
}, | ||
}); | ||
@@ -272,7 +272,6 @@ }); | ||
: false, | ||
ignoreDefinition: true | ||
ignoreDefinition: true, | ||
}); | ||
} | ||
export function CreateModuleProvider(state, devtools, model, useLegacyStateApi) { | ||
var module = {}; | ||
return Provider(function (context) { | ||
@@ -297,7 +296,7 @@ var signalPath = context.execution.name.split('.'); | ||
method: 'module.' + method, | ||
args: [modulePath.concat(path.split('.'))].concat(args.map(function (value) { return (isObservable(value) ? value.value : value); })) | ||
args: [modulePath.concat(path.split('.'))].concat(args.map(function (value) { return (isObservable(value) ? value.value : value); })), | ||
}, context.execution, context.functionDetails, context.props); | ||
} | ||
return model[method].apply(model, [path.split('.')].concat(args)); | ||
} | ||
}, | ||
}); | ||
@@ -321,3 +320,3 @@ }); | ||
return model[method].apply(model, [modulePath.concat(path.split('.'))].concat(args)); | ||
} | ||
}, | ||
}); | ||
@@ -324,0 +323,0 @@ }); |
@@ -12,3 +12,5 @@ import { isObservable, isObservableMap } from 'mobx'; | ||
} | ||
return isObservableMap(currentValue) ? currentValue.get(key) : currentValue[key]; | ||
return isObservableMap(currentValue) | ||
? currentValue.get(key) | ||
: currentValue[key]; | ||
}, obj); | ||
@@ -15,0 +17,0 @@ } |
@@ -38,3 +38,3 @@ import { Reaction } from 'mobx'; | ||
signals: _this.controller.signals, | ||
props: _this.props | ||
props: _this.props, | ||
}); | ||
@@ -88,5 +88,5 @@ if (_this.isMounted) { | ||
!this._hasWarnedBigComponent && | ||
Object.keys(dependenciesProps).length >= this.controller.devtools.bigComponentsWarning) { | ||
console.warn("Component named " + this | ||
._displayName + " has a lot of dependencies, consider refactoring or adjust this option in devtools"); | ||
Object.keys(dependenciesProps).length >= | ||
this.controller.devtools.bigComponentsWarning) { | ||
console.warn("Component named " + this._displayName + " has a lot of dependencies, consider refactoring or adjust this option in devtools"); | ||
this._hasWarnedBigComponent = true; | ||
@@ -93,0 +93,0 @@ } |
{ | ||
"name": "@cerebral/fluent", | ||
"version": "1.0.0-1521141520687", | ||
"version": "1.0.0-1521491486243", | ||
"description": "Makes Cerebral typescript friendly", | ||
@@ -21,9 +21,9 @@ "main": "index.js", | ||
"devDependencies": { | ||
"@types/react": "^16.0.35", | ||
"@types/react-dom": "^16.0.3", | ||
"@types/react": "^16.0.40", | ||
"@types/react-dom": "^16.0.4", | ||
"jest": "^22.1.1", | ||
"prop-types": "^15.5.10" | ||
"prop-types": "^15.6.1" | ||
}, | ||
"dependencies": { | ||
"cerebral": "^4.2.0-1521141520687", | ||
"cerebral": "^4.2.0-1521491486243", | ||
"mobx": "^3.4.1" | ||
@@ -35,3 +35,3 @@ }, | ||
"prepublish": "npm run build", | ||
"test": "cross-env mocha --require ts-runtime.js \"src/**/*.test.ts\" \"__test__/**/*.test.ts\"", | ||
"test": "cross-env mocha --require ts-runtime.js \"src/**/*.test.ts\"", | ||
"test:watch": "npm run test -- --watch" | ||
@@ -38,0 +38,0 @@ }, |
@@ -7,2 +7,3 @@ { | ||
"strict": true, | ||
"strictPropertyInitialization": false, | ||
"moduleResolution": "node", | ||
@@ -9,0 +10,0 @@ "declaration": true, |
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
81879
1946