@smartface/contx
Advanced tools
Comparing version 1.0.0-rc.9 to 1.0.0-rc.10
@@ -75,3 +75,3 @@ (function (global, factory) { | ||
} else { | ||
this.getParent() && this.getParent().removeChild(this); | ||
this.getParent && this.getParent() && this.getParent().removeChild(this); | ||
this.dispatch && this.dispatch((0, _removeChild2.default)()); | ||
@@ -78,0 +78,0 @@ } |
@@ -38,3 +38,3 @@ (function (global, factory) { | ||
page.onHide = (0, _patchMethod2.default)(page, "onHide", onHide); | ||
page.didComponentEnter = (0, _patchMethod2.default)(page, "onContextInit", didComponentEnter); | ||
page.didComponentEnter = (0, _patchMethod2.default)(page, "didComponentEnter", didComponentEnter); | ||
page.onOrientationChange = (0, _patchMethod2.default)(page, "onOrientationChange", onOrientationChange); | ||
@@ -41,0 +41,0 @@ page.themeContext = Application.theme(); |
@@ -127,3 +127,3 @@ (function (global, factory) { | ||
var diff = Object.keys(style).reduce(diffReducer, {}); | ||
var rawDiff = Object.keys(style).reduce(diffReducer, {}); | ||
@@ -133,3 +133,3 @@ // this.styles === userStyle && (diff = merge(diff, userStyle)); | ||
var beforeHook = _this.hook("beforeStyleDiffAssign"); | ||
beforeHook && (diff = beforeHook(diff)); | ||
var diff = beforeHook && beforeHook(rawDiff) || null; | ||
@@ -173,6 +173,5 @@ var comp = name.indexOf("_") === -1 && _this._actorInternal_.component.layout ? _this._actorInternal_.component.layout : _this._actorInternal_.component; | ||
typeof component.subscribeContext === "function" ? hasDiff && component.subscribeContext({ type: "new-styles", data: Object.assign({}, diff) }) : hasDiff && Object.keys(diff).forEach(function (key) { | ||
typeof component.subscribeContext === "function" ? hasDiff && component.subscribeContext({ type: "new-styles", style: Object.assign({}, diff), rawStyle: (0, _merge2.default)(rawDiff) }) : hasDiff && Object.keys(diff).forEach(function (key) { | ||
try { | ||
if (component.layout && SCW_LAYOUT_PROPS[key]) { | ||
// component.layout[SCW_LAYOUT_PROPS[key]] = diff[key]; | ||
componentAssign(component.layout, SCW_LAYOUT_PROPS[key], diff[key]); | ||
@@ -179,0 +178,0 @@ } else { |
{ | ||
"name": "@smartface/contx", | ||
"version": "1.0.0-rc.9", | ||
"version": "1.0.0-rc.10", | ||
"description": "Context Manager", | ||
@@ -5,0 +5,0 @@ "scripts": { |
@@ -126,2 +126,5 @@ # Contxjs | ||
TODO: Add example | ||
TODO: Describe Directive rule | ||
#### Creating Runtime Rules | ||
@@ -202,2 +205,8 @@ TODO: Creating Run-time Rules | ||
- **Action::type = changeUserStyle** : | ||
Sets component userStyle. | ||
- *Action::userStyle:object* | ||
- **Action::type = updateUserStyle** : | ||
- *Action::userStyle:object* | ||
Update component userStyle. | ||
- **Action::type = removeChild** : | ||
@@ -212,3 +221,3 @@ Removes target component and it's children from context. | ||
Removes className selector from the specified component's actor in the Context. | ||
- *Action::classNames:string* | ||
- *Action::className:string* | ||
- **Action::type = invalidate** : | ||
@@ -219,26 +228,26 @@ Forces to update Context's Actors and applies styles if they are changed. | ||
##### FlexLayout::addChild( childComponent:*, ?contextName: string, ?className: string, ?initialProps:StyleObject ) | ||
##### FlexLayout::addChild( childComponent:*, ?contextName: string, ?className: string, ?userStyle:StyleObject=null ) | ||
Adds specified component to the FlexLayout instance and if contextName is specified then dispatches **addPageContextChild** action to the Context. | ||
Adds specified component to the FlexLayout instance and if contextName is specified then dispatches addPageContextChild action to the Context. | ||
##### FlexLayout::removeChild(childComponent:object) | ||
Removes specified component from FlexLayout instance then dispatches **removeChild** action to the Context. | ||
Removes specified component from FlexLayout instance then dispatches removeChild action to the Context. | ||
##### FlexLayout::removeAll() | ||
Removes specified component's children then dispatches **removeChildren** action to the Context. | ||
Removes specified component's children then dispatches removeChildren action to the Context. | ||
#### Life-Cycle Events | ||
##### Component::onDispose | ||
##### Component::didComponentLeave | ||
When a component is removed from the Context and If the component has onDipose method then it's triggered. | ||
When a component is removed from the Context and If the component has didComponentLeave method then it's triggered. | ||
##### Component::onContextInit(dispatch:function) | ||
##### Component::didComponentEnter(dispatch:function) | ||
When a component initialized in the Context and If the component has onContextInit method and then it's triggered by passing its dispatch method. If not, dispatch method will be assigned to component directly. | ||
When a component initialized in the Context and If the component has didComponentEnter method and then it's triggered by passing its dispatch method. If not, dispatch method will be assigned to component directly. | ||
##### Component::onError(error:Error) | ||
If an error is occcured while an operation is running for a component, for example new properties assignment, and the component has onError method then the error is passed to onError method of the component. If not and then the content throws the error. | ||
If an error is occcured while an operation is running for a component, for example new properties assignment, and the component has onError method then the error is passed to onError method of the component. If not and then the context throws the error. | ||
79927
250
1812