@cerebral/fluent
Advanced tools
Comparing version 2.0.0-1526409797341 to 2.0.0-1527015081471
@@ -63,6 +63,6 @@ import Hoc from './Hoc'; | ||
state: x.state, | ||
signals: x.signals, | ||
sequences: x.sequences, | ||
module: { | ||
state: lookups.stateLookup(x.state), | ||
signals: lookups.signalsLookup(x.signals), | ||
sequences: lookups.sequencesLookup(x.sequences), | ||
}, | ||
@@ -69,0 +69,0 @@ props: x.props, |
@@ -37,11 +37,11 @@ var __extends = (this && this.__extends) || (function () { | ||
_this.state = _this.model.state; | ||
_this.signals = extractModuleProp(_this.module, 'signals', function (signals, module) { | ||
return Object.keys(signals).reduce(function (runableSignals, key) { | ||
if ('run' in signals[key]) { | ||
runableSignals[key] = signals[key].run; | ||
_this.sequences = extractModuleProp(_this.module, 'sequences', function (sequences, module) { | ||
return Object.keys(sequences).reduce(function (runablesequences, key) { | ||
if ('run' in sequences[key]) { | ||
runablesequences[key] = sequences[key].run; | ||
} | ||
else { | ||
runableSignals[key] = signals[key]; | ||
runablesequences[key] = sequences[key]; | ||
} | ||
return runableSignals; | ||
return runablesequences; | ||
}, {}); | ||
@@ -70,6 +70,6 @@ }); | ||
}); | ||
updateIn(this.signals, pathArray.concat(moduleKey), function (parentState, key) { | ||
parentState[key] = Object.keys(newModule.signals).reduce(function (signals, key) { | ||
signals[key] = newModule.signals[key]; | ||
return signals; | ||
updateIn(this.sequences, pathArray.concat(moduleKey), function (parentState, key) { | ||
parentState[key] = Object.keys(newModule.sequences).reduce(function (sequences, key) { | ||
sequences[key] = newModule.sequences[key]; | ||
return sequences; | ||
}, {}); | ||
@@ -101,4 +101,4 @@ }); | ||
}); | ||
updateIn(this.signals, pathArray.concat(moduleKey), function (parentSignals) { | ||
delete parentSignals[moduleKey]; | ||
updateIn(this.sequences, pathArray.concat(moduleKey), function (parentsequences) { | ||
delete parentsequences[moduleKey]; | ||
}); | ||
@@ -105,0 +105,0 @@ this.emit('moduleRemoved', path, module); |
@@ -27,3 +27,3 @@ /* eslint-env mocha */ | ||
}, | ||
signals: { | ||
sequences: { | ||
test: [ | ||
@@ -50,3 +50,3 @@ function test(_a) { | ||
}); | ||
controller.signals.test(); | ||
controller.sequences.test(); | ||
assert.equal(controller.state.foo, 'bar2'); | ||
@@ -101,3 +101,3 @@ assert.equal(controller.state.bool, false); | ||
}, | ||
signals: { | ||
sequences: { | ||
test: sequence, | ||
@@ -107,3 +107,3 @@ }, | ||
var controller = Controller(rootModule); | ||
controller.signals.test({ | ||
controller.sequences.test({ | ||
foo: 'bar', | ||
@@ -130,3 +130,3 @@ }); | ||
}, | ||
signals: { | ||
sequences: { | ||
test: signal, | ||
@@ -141,3 +141,3 @@ }, | ||
assert.equal(controller.state.test.get(), 'BARbar'); | ||
controller.signals.test(); | ||
controller.sequences.test(); | ||
assert.equal(hasUpdated, 2); | ||
@@ -161,3 +161,3 @@ }); | ||
}, | ||
signals: { | ||
sequences: { | ||
test: signal, | ||
@@ -172,3 +172,3 @@ }, | ||
assert.equal(controller.state.test, 'BAR'); | ||
controller.signals.test(); | ||
controller.sequences.test(); | ||
assert.equal(hasUpdated, 2); | ||
@@ -188,3 +188,3 @@ }); | ||
}, | ||
signals: { | ||
sequences: { | ||
test: sequence, | ||
@@ -194,3 +194,3 @@ }, | ||
var controller = Controller(rootModule); | ||
controller.signals.test(); | ||
controller.sequences.test(); | ||
assert.equal(controller.state.foo, 'bar2'); | ||
@@ -242,3 +242,3 @@ }); | ||
}, | ||
signals: { | ||
sequences: { | ||
test: sequence, | ||
@@ -308,3 +308,3 @@ }, | ||
}); | ||
controller.signals.test(); | ||
controller.sequences.test(); | ||
assert.equal(controller.state._set, 'bar2'); | ||
@@ -332,3 +332,3 @@ assert.equal(controller.state._push[0], 'bar2'); | ||
}, | ||
signals: { | ||
sequences: { | ||
test: sequence, | ||
@@ -352,3 +352,3 @@ }, | ||
view.mount(); | ||
controller.signals.test({ | ||
controller.sequences.test({ | ||
foo: 'bar', | ||
@@ -378,3 +378,3 @@ }); | ||
}, | ||
signals: { | ||
sequences: { | ||
test: sequence, | ||
@@ -397,3 +397,3 @@ }, | ||
}); | ||
controller.signals.test(); | ||
controller.sequences.test(); | ||
var item = controller.state.observableMapSet.get('item'); | ||
@@ -420,3 +420,3 @@ if (item) { | ||
}, | ||
signals: { | ||
sequences: { | ||
test: sequence, | ||
@@ -439,3 +439,3 @@ }, | ||
}); | ||
controller.signals.test(); | ||
controller.sequences.test(); | ||
assert.equal(controller.state.observableMapSet.size, 0); | ||
@@ -465,3 +465,3 @@ }); | ||
}, | ||
signals: { | ||
sequences: { | ||
test: sequence, | ||
@@ -494,3 +494,3 @@ }, | ||
}); | ||
controller.signals.test(); | ||
controller.sequences.test(); | ||
assert.equal(controller.state.foo.bar.baz, 'mip2'); | ||
@@ -528,3 +528,3 @@ }); | ||
}, | ||
signals: { | ||
sequences: { | ||
test: sequence, | ||
@@ -590,3 +590,3 @@ }, | ||
}); | ||
controller.signals.test(); | ||
controller.sequences.test(); | ||
var item = controller.state.observableMapSet.get('item'); | ||
@@ -643,3 +643,3 @@ if (item) { | ||
}, | ||
signals: { | ||
sequences: { | ||
test: sequence, | ||
@@ -714,3 +714,3 @@ }, | ||
}); | ||
controller.signals.foo.test(); | ||
controller.sequences.foo.test(); | ||
assert.equal(controller.state.foo._set, 'bar2'); | ||
@@ -768,3 +768,3 @@ assert.equal(controller.state.foo._push[0], 'bar2'); | ||
}, | ||
signals: { | ||
sequences: { | ||
test: sequence, | ||
@@ -779,3 +779,3 @@ }, | ||
var controller = Controller(rootModule); | ||
controller.signals.foo.test(); | ||
controller.sequences.foo.test(); | ||
assert.equal(controller.state.foo._set, 'bar2'); | ||
@@ -782,0 +782,0 @@ assert.equal(controller.state.foo._push[0], 'bar2'); |
@@ -37,3 +37,3 @@ import { Reaction } from 'mobx'; | ||
state: _this.controller.state, | ||
signals: _this.controller.signals, | ||
sequences: _this.controller.sequences, | ||
props: _this.props, | ||
@@ -40,0 +40,0 @@ }); |
@@ -5,3 +5,3 @@ import { Component } from './Hoc'; | ||
state: State; | ||
signals: Signals; | ||
sequences: Signals; | ||
}) => EP, passedComponent: Component<Props & EP>): Component<Props>; | ||
@@ -11,3 +11,3 @@ export declare type ModuleConnector<TState, TSignals> = { | ||
state: TState; | ||
signals: TSignals; | ||
sequences: TSignals; | ||
}; | ||
@@ -18,3 +18,3 @@ }; | ||
props: TProps; | ||
signals: TSignals; | ||
sequences: TSignals; | ||
}; | ||
@@ -21,0 +21,0 @@ export declare function ConnectFactory<TState, TSignals>(): <TProps>() => { |
@@ -68,6 +68,6 @@ "use strict"; | ||
state: x.state, | ||
signals: x.signals, | ||
sequences: x.sequences, | ||
module: { | ||
state: lookups.stateLookup(x.state), | ||
signals: lookups.signalsLookup(x.signals), | ||
sequences: lookups.sequencesLookup(x.sequences), | ||
}, | ||
@@ -74,0 +74,0 @@ props: x.props, |
@@ -27,5 +27,5 @@ import { ObservableMap as MobxObservableMap } from 'mobx'; | ||
}; | ||
export declare class FluentController<State = {}, Signals = {}> extends BaseControllerClass { | ||
export declare class FluentController<State = {}, Sequences = {}> extends BaseControllerClass { | ||
state: State; | ||
signals: Signals; | ||
sequences: Sequences; | ||
devtools: any; | ||
@@ -32,0 +32,0 @@ contextProviders: any; |
@@ -50,11 +50,11 @@ "use strict"; | ||
_this.state = _this.model.state; | ||
_this.signals = internal_1.extractModuleProp(_this.module, 'signals', function (signals, module) { | ||
return Object.keys(signals).reduce(function (runableSignals, key) { | ||
if ('run' in signals[key]) { | ||
runableSignals[key] = signals[key].run; | ||
_this.sequences = internal_1.extractModuleProp(_this.module, 'sequences', function (sequences, module) { | ||
return Object.keys(sequences).reduce(function (runablesequences, key) { | ||
if ('run' in sequences[key]) { | ||
runablesequences[key] = sequences[key].run; | ||
} | ||
else { | ||
runableSignals[key] = signals[key]; | ||
runablesequences[key] = sequences[key]; | ||
} | ||
return runableSignals; | ||
return runablesequences; | ||
}, {}); | ||
@@ -83,6 +83,6 @@ }); | ||
}); | ||
utils_1.updateIn(this.signals, pathArray.concat(moduleKey), function (parentState, key) { | ||
parentState[key] = Object.keys(newModule.signals).reduce(function (signals, key) { | ||
signals[key] = newModule.signals[key]; | ||
return signals; | ||
utils_1.updateIn(this.sequences, pathArray.concat(moduleKey), function (parentState, key) { | ||
parentState[key] = Object.keys(newModule.sequences).reduce(function (sequences, key) { | ||
sequences[key] = newModule.sequences[key]; | ||
return sequences; | ||
}, {}); | ||
@@ -114,4 +114,4 @@ }); | ||
}); | ||
utils_1.updateIn(this.signals, pathArray.concat(moduleKey), function (parentSignals) { | ||
delete parentSignals[moduleKey]; | ||
utils_1.updateIn(this.sequences, pathArray.concat(moduleKey), function (parentsequences) { | ||
delete parentsequences[moduleKey]; | ||
}); | ||
@@ -118,0 +118,0 @@ this.emit('moduleRemoved', path, module); |
@@ -29,3 +29,3 @@ "use strict"; | ||
}, | ||
signals: { | ||
sequences: { | ||
test: [ | ||
@@ -52,3 +52,3 @@ function test(_a) { | ||
}); | ||
controller.signals.test(); | ||
controller.sequences.test(); | ||
assert.equal(controller.state.foo, 'bar2'); | ||
@@ -103,3 +103,3 @@ assert.equal(controller.state.bool, false); | ||
}, | ||
signals: { | ||
sequences: { | ||
test: sequence, | ||
@@ -109,3 +109,3 @@ }, | ||
var controller = _1.Controller(rootModule); | ||
controller.signals.test({ | ||
controller.sequences.test({ | ||
foo: 'bar', | ||
@@ -132,3 +132,3 @@ }); | ||
}, | ||
signals: { | ||
sequences: { | ||
test: signal, | ||
@@ -143,3 +143,3 @@ }, | ||
assert.equal(controller.state.test.get(), 'BARbar'); | ||
controller.signals.test(); | ||
controller.sequences.test(); | ||
assert.equal(hasUpdated, 2); | ||
@@ -163,3 +163,3 @@ }); | ||
}, | ||
signals: { | ||
sequences: { | ||
test: signal, | ||
@@ -174,3 +174,3 @@ }, | ||
assert.equal(controller.state.test, 'BAR'); | ||
controller.signals.test(); | ||
controller.sequences.test(); | ||
assert.equal(hasUpdated, 2); | ||
@@ -190,3 +190,3 @@ }); | ||
}, | ||
signals: { | ||
sequences: { | ||
test: sequence, | ||
@@ -196,3 +196,3 @@ }, | ||
var controller = _1.Controller(rootModule); | ||
controller.signals.test(); | ||
controller.sequences.test(); | ||
assert.equal(controller.state.foo, 'bar2'); | ||
@@ -244,3 +244,3 @@ }); | ||
}, | ||
signals: { | ||
sequences: { | ||
test: sequence, | ||
@@ -310,3 +310,3 @@ }, | ||
}); | ||
controller.signals.test(); | ||
controller.sequences.test(); | ||
assert.equal(controller.state._set, 'bar2'); | ||
@@ -334,3 +334,3 @@ assert.equal(controller.state._push[0], 'bar2'); | ||
}, | ||
signals: { | ||
sequences: { | ||
test: sequence, | ||
@@ -354,3 +354,3 @@ }, | ||
view.mount(); | ||
controller.signals.test({ | ||
controller.sequences.test({ | ||
foo: 'bar', | ||
@@ -380,3 +380,3 @@ }); | ||
}, | ||
signals: { | ||
sequences: { | ||
test: sequence, | ||
@@ -399,3 +399,3 @@ }, | ||
}); | ||
controller.signals.test(); | ||
controller.sequences.test(); | ||
var item = controller.state.observableMapSet.get('item'); | ||
@@ -422,3 +422,3 @@ if (item) { | ||
}, | ||
signals: { | ||
sequences: { | ||
test: sequence, | ||
@@ -441,3 +441,3 @@ }, | ||
}); | ||
controller.signals.test(); | ||
controller.sequences.test(); | ||
assert.equal(controller.state.observableMapSet.size, 0); | ||
@@ -467,3 +467,3 @@ }); | ||
}, | ||
signals: { | ||
sequences: { | ||
test: sequence, | ||
@@ -496,3 +496,3 @@ }, | ||
}); | ||
controller.signals.test(); | ||
controller.sequences.test(); | ||
assert.equal(controller.state.foo.bar.baz, 'mip2'); | ||
@@ -530,3 +530,3 @@ }); | ||
}, | ||
signals: { | ||
sequences: { | ||
test: sequence, | ||
@@ -592,3 +592,3 @@ }, | ||
}); | ||
controller.signals.test(); | ||
controller.sequences.test(); | ||
var item = controller.state.observableMapSet.get('item'); | ||
@@ -645,3 +645,3 @@ if (item) { | ||
}, | ||
signals: { | ||
sequences: { | ||
test: sequence, | ||
@@ -716,3 +716,3 @@ }, | ||
}); | ||
controller.signals.foo.test(); | ||
controller.sequences.foo.test(); | ||
assert.equal(controller.state.foo._set, 'bar2'); | ||
@@ -770,3 +770,3 @@ assert.equal(controller.state.foo._push[0], 'bar2'); | ||
}, | ||
signals: { | ||
sequences: { | ||
test: sequence, | ||
@@ -781,3 +781,3 @@ }, | ||
var controller = _1.Controller(rootModule); | ||
controller.signals.foo.test(); | ||
controller.sequences.foo.test(); | ||
assert.equal(controller.state.foo._set, 'bar2'); | ||
@@ -784,0 +784,0 @@ assert.equal(controller.state.foo._push[0], 'bar2'); |
@@ -39,3 +39,3 @@ "use strict"; | ||
state: _this.controller.state, | ||
signals: _this.controller.signals, | ||
sequences: _this.controller.sequences, | ||
props: _this.props, | ||
@@ -42,0 +42,0 @@ }); |
{ | ||
"name": "@cerebral/fluent", | ||
"version": "2.0.0-1526409797341", | ||
"version": "2.0.0-1527015081471", | ||
"description": "Makes Cerebral typescript friendly", | ||
@@ -23,3 +23,3 @@ "main": "index.js", | ||
"dependencies": { | ||
"cerebral": "^5.0.0-1526409797341", | ||
"cerebral": "^5.0.0-1527015081471", | ||
"mobx": "^3.4.1" | ||
@@ -26,0 +26,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
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
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
274399