@smartface/contx
Advanced tools
Comparing version 3.0.2 to 3.0.4
@@ -69,4 +69,4 @@ "use strict"; | ||
}; | ||
Context.prototype.find = function (instance, notValue) { | ||
return this.actors.collection.get(instance) || notValue; | ||
Context.prototype.find = function (instanceId, notValue) { | ||
return this.actors.collection.get(instanceId) || notValue; | ||
}; | ||
@@ -80,4 +80,4 @@ Context.prototype.addTree = function (tree) { | ||
!actor.getID() && actor.setID(Context.getID()); | ||
var instance = actor.getInstanceID(); //TODO: map by component type | ||
this.actors.collection.set(instance, actor); | ||
var instanceId = actor.getInstanceID(); //TODO: map by component type | ||
this.actors.collection.set(instanceId, actor); | ||
actor.hook = this._hookFactory; | ||
@@ -88,5 +88,5 @@ actor.componentDidEnter(function (action, target) { return _this.dispatch(action, target); }); | ||
}; | ||
Context.prototype.removeChildren = function (instance) { | ||
Context.prototype.removeChildren = function (instanceId) { | ||
var _this = this; | ||
var removeActor = this.actors.collection.get(instance); | ||
var removeActor = this.actors.collection.get(instanceId); | ||
this.actors.collection.forEach(function (actor, nm) { | ||
@@ -100,10 +100,10 @@ if (nm.indexOf(removeActor.getName() + "_") === 0) { | ||
}; | ||
Context.prototype.remove = function (instance) { | ||
if (!instance) { | ||
Context.prototype.remove = function (instanceId) { | ||
if (!instanceId) { | ||
throw new Error("name cannot be empty"); | ||
} | ||
this.removeChildren(instance); | ||
var actor = this.actors.collection.get(instance); | ||
this.removeChildren(instanceId); | ||
var actor = this.actors.collection.get(instanceId); | ||
if (actor) { | ||
this.actors.collection.delete(instance); | ||
this.actors.collection.delete(instanceId); | ||
actor.componentDidLeave(); | ||
@@ -110,0 +110,0 @@ actor.dispose(); |
{ | ||
"name": "@smartface/contx", | ||
"version": "3.0.2", | ||
"version": "3.0.4", | ||
"description": "Context Manager", | ||
@@ -9,3 +9,3 @@ "scripts": { | ||
"build:dev": "BABEL_ENV=development babel ./src/ --out-dir -d ../scripts/node_modules/@smartface/contx", | ||
"build": "rm -R -f ./lib && tsc", | ||
"build": "rm -R -f ./lib && tsc && cp -r ./src/**/*.d.ts ./lib", | ||
"dev:sync": "mkdir -p ../scripts/node_modules/@smartface/contx && cp -r -t ../scripts/node_modules/@smartface/contx lib package.json ", | ||
@@ -59,2 +59,3 @@ "dev:remove": "rm -R -f ../scripts/node_modules/@smartface/contx & rm -R -f ./lib", | ||
"@smartface/styler": "^2.0.0", | ||
"@smartface/html-to-text": "^1.0.0", | ||
"filtrex": "^0.5.4" | ||
@@ -61,0 +62,0 @@ }, |
@@ -28,3 +28,3 @@ import Actor from "./Actor"; | ||
find(instance: Actor, notValue: any): Actor; | ||
find(instanceId: Actor, notValue?: any): Actor; | ||
@@ -38,5 +38,5 @@ /** | ||
removeChildren(instance: Actor): void; | ||
removeChildren(instanceId: Actor): void; | ||
remove(instance: Actor): void; | ||
remove(instanceId: Actor): void; | ||
@@ -43,0 +43,0 @@ setState(state: { [key: string]: any }): void; |
@@ -77,4 +77,4 @@ import { INIT_CONTEXT_ACTION_TYPE } from "./constants"; | ||
find(instance, notValue) { | ||
return this.actors.collection.get(instance) || notValue; | ||
find(instanceId, notValue) { | ||
return this.actors.collection.get(instanceId) || notValue; | ||
} | ||
@@ -88,4 +88,4 @@ | ||
!actor.getID() && actor.setID(Context.getID()); | ||
const instance = actor.getInstanceID(); //TODO: map by component type | ||
this.actors.collection.set(instance, actor); | ||
const instanceId = actor.getInstanceID(); //TODO: map by component type | ||
this.actors.collection.set(instanceId, actor); | ||
actor.hook = this._hookFactory; | ||
@@ -98,4 +98,4 @@ actor.componentDidEnter((action, target) => this.dispatch(action, target)); | ||
removeChildren(instance) { | ||
const removeActor = this.actors.collection.get(instance); | ||
removeChildren(instanceId) { | ||
const removeActor = this.actors.collection.get(instanceId); | ||
@@ -111,12 +111,12 @@ this.actors.collection.forEach((actor, nm) => { | ||
remove(instance) { | ||
if(!instance){ | ||
remove(instanceId) { | ||
if(!instanceId){ | ||
throw new Error("name cannot be empty"); | ||
} | ||
this.removeChildren(instance); | ||
const actor = this.actors.collection.get(instance); | ||
this.removeChildren(instanceId); | ||
const actor = this.actors.collection.get(instanceId); | ||
if (actor) { | ||
this.actors.collection.delete(instance); | ||
this.actors.collection.delete(instanceId); | ||
actor.componentDidLeave(); | ||
@@ -123,0 +123,0 @@ actor.dispose(); |
import View = require("sf-core/ui/view"); | ||
type styling = { [key: string]: any }; | ||
/** | ||
* Creates new page context boundry | ||
* | ||
* | ||
* @param {object} component - Root component of the context | ||
@@ -10,4 +11,13 @@ * @param {string} name - Root component ID | ||
*/ | ||
export default function createPageContext(component: View, name: string, reducers: () => any): void; | ||
export default function createPageContext( | ||
component: View, | ||
name: string, | ||
reducers: () => any | ||
): (styles: styling | null) => void; | ||
declare function contextReducer(context: any[], action: string, target: any, state: any): any; | ||
declare function contextReducer( | ||
context: any[], | ||
action: string, | ||
target: any, | ||
state: any | ||
): (styling: styling) => void; |
@@ -1,3 +0,1 @@ | ||
import * as StyleContext from "../styling/StyleContext"; | ||
import styler from "@smartface/styler/lib/styler"; | ||
import commands from "@smartface/styler/lib/commandsManager"; | ||
@@ -9,5 +7,2 @@ import merge from "@smartface/styler/lib/utils/merge"; | ||
import isTablet from '../core/isTablet'; | ||
import makeStylable from '../styling/Stylable'; | ||
import hooks from '../core/hooks'; | ||
import Contants from "../core/constants"; | ||
import fromSFComponent, { createActorTreeFromSFComponent } from "./fromSFComponent"; | ||
@@ -14,0 +9,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
212546
3
128
4000
3
+ Added@smartface/html-to-text@1.2.0(transitive)
+ Addedhtml-parse-stringify@1.0.2(transitive)
+ Addedvoid-elements@1.0.0(transitive)