@smartface/contx
Advanced tools
Comparing version
@@ -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(); |
@@ -26,3 +26,3 @@ "use strict"; | ||
var orientation = __importStar(require("sf-extension-utils/lib/orientation")); | ||
var system_1 = __importDefault(require("sf-core/device/system")); | ||
var system_1 = __importDefault(require("@smartface/native/device/system")); | ||
function load(src) { | ||
@@ -37,3 +37,3 @@ return require(src); | ||
else if (system_1.default.OS === "Android") { | ||
AndroidConfig = load('sf-core/util/Android/androidconfig'); | ||
AndroidConfig = load('@smartface/native/util/Android/androidconfig'); | ||
var Activity = AndroidConfig.activity; | ||
@@ -40,0 +40,0 @@ var context = Activity; |
@@ -8,3 +8,3 @@ "use strict"; | ||
var patchMethod_1 = __importDefault(require("../util/patchMethod")); | ||
var Application = require("sf-core/application"); | ||
var Application = require("@smartface/native/application"); | ||
function componentContextPatch(component, name) { | ||
@@ -11,0 +11,0 @@ component.themeContext = Application.theme(pageContext_1.default(component, name, null, null), name); |
@@ -33,3 +33,3 @@ "use strict"; | ||
var raiseErrorMaybe_1 = __importDefault(require("../core/util/raiseErrorMaybe")); | ||
var application_1 = __importDefault(require("sf-core/application")); | ||
var application_1 = __importDefault(require("@smartface/native/application")); | ||
function addChild(superAddChild, child, name, classNames, userProps, defaultClassNames) { | ||
@@ -167,3 +167,3 @@ if (classNames === void 0) { classNames = ""; } | ||
* | ||
* @param {Object} component - A sf-core component | ||
* @param {Object} component - A @smartface/native component | ||
* @param {string} name - component name | ||
@@ -170,0 +170,0 @@ * @param {function} initialClassNameMap - classNames mapping with specified component and children |
@@ -28,4 +28,4 @@ "use strict"; | ||
var sfCorePropFactory_1 = __importDefault(require("./sfCorePropFactory")); | ||
var screen_1 = __importDefault(require("sf-core/device/screen")); | ||
var system_1 = __importDefault(require("sf-core/device/system")); | ||
var screen_1 = __importDefault(require("@smartface/native/device/screen")); | ||
var system_1 = __importDefault(require("@smartface/native/device/system")); | ||
var isTablet_1 = __importDefault(require("../core/isTablet")); | ||
@@ -32,0 +32,0 @@ var fromSFComponent_1 = __importStar(require("./fromSFComponent")); |
@@ -9,3 +9,3 @@ "use strict"; | ||
var buildStyles = require("@smartface/styler/lib/buildStyles"); | ||
var Application = require("sf-core/application"); | ||
var Application = require("@smartface/native/application"); | ||
function onSafeAreaPaddingChange(onSafeAreaPaddingChange, paddings) { | ||
@@ -12,0 +12,0 @@ var style = {}; |
"use strict"; | ||
var PageBase = require('sf-core/ui/page'); | ||
var PageBase = require('@smartface/native/ui/page'); | ||
var extend = require("js-base/core/extend"); | ||
@@ -4,0 +4,0 @@ var Page = extend(PageBase); |
@@ -7,32 +7,32 @@ "use strict"; | ||
exports.createSFCoreProp = void 0; | ||
var color_1 = __importDefault(require("sf-core/ui/color")); | ||
var font_1 = __importDefault(require("sf-core/ui/font")); | ||
var image_1 = __importDefault(require("sf-core/ui/image")); | ||
var color_1 = __importDefault(require("@smartface/native/ui/color")); | ||
var font_1 = __importDefault(require("@smartface/native/ui/font")); | ||
var image_1 = __importDefault(require("@smartface/native/ui/image")); | ||
var HexColorValidationRegexp = /^#[0-9A-Fa-f]{6}$/gi; | ||
var ENUMS = { | ||
imageFillType: "sf-core/ui/imagefilltype", | ||
textAlignment: "sf-core/ui/textalignment", | ||
keyboardType: "sf-core/ui/keyboardtype", | ||
orientation: "sf-core/ui/page", | ||
type: "sf-core/ui/mapview", | ||
gradientOrientation: "sf-core/ui/color", | ||
searchViewStyle: "sf-core/ui/searchview", | ||
activityIndicatorViewStyle: "sf-core/ui/activityindicator/ios/activityindicatorviewstyle", | ||
alignSelf: "sf-core/ui/flexlayout", | ||
alignContent: "sf-core/ui/flexlayout", | ||
alignItems: "sf-core/ui/flexlayout", | ||
direction: "sf-core/ui/flexlayout", | ||
ellipsizeMode: "sf-core/ui/ellipsizemode", | ||
flexDirection: "sf-core/ui/flexlayout", | ||
flexWrap: "sf-core/ui/flexlayout", | ||
justifyContent: "sf-core/ui/flexlayout", | ||
positionType: "sf-core/ui/flexlayout", | ||
overflow: "sf-core/ui/flexlayout", | ||
style: "sf-core/ui/statusbarstyle", | ||
shimmeringDirection: "sf-core/ui/shimmerflexlayout", | ||
imageFillType: "@smartface/native/ui/imagefilltype", | ||
textAlignment: "@smartface/native/ui/textalignment", | ||
keyboardType: "@smartface/native/ui/keyboardtype", | ||
orientation: "@smartface/native/ui/page", | ||
type: "@smartface/native/ui/mapview", | ||
gradientOrientation: "@smartface/native/ui/color", | ||
searchViewStyle: "@smartface/native/ui/searchview", | ||
activityIndicatorViewStyle: "@smartface/native/ui/activityindicator/ios/activityindicatorviewstyle", | ||
alignSelf: "@smartface/native/ui/flexlayout", | ||
alignContent: "@smartface/native/ui/flexlayout", | ||
alignItems: "@smartface/native/ui/flexlayout", | ||
direction: "@smartface/native/ui/flexlayout", | ||
ellipsizeMode: "@smartface/native/ui/ellipsizemode", | ||
flexDirection: "@smartface/native/ui/flexlayout", | ||
flexWrap: "@smartface/native/ui/flexlayout", | ||
justifyContent: "@smartface/native/ui/flexlayout", | ||
positionType: "@smartface/native/ui/flexlayout", | ||
overflow: "@smartface/native/ui/flexlayout", | ||
style: "@smartface/native/ui/statusbarstyle", | ||
shimmeringDirection: "@smartface/native/ui/shimmerflexlayout", | ||
ios: { | ||
style: "sf-core/ui/statusbarstyle" | ||
style: "@smartface/native/ui/statusbarstyle" | ||
}, | ||
align: "sf-core/ui/scrollview", | ||
scrollDirection: "sf-core/ui/layoutmanager" | ||
align: "@smartface/native/ui/scrollview", | ||
scrollDirection: "@smartface/native/ui/layoutmanager" | ||
}; | ||
@@ -160,3 +160,3 @@ var ENUMS_META_FIELD = { | ||
/** | ||
* Create a sf-core value | ||
* Create a @smartface/native value | ||
* | ||
@@ -222,3 +222,3 @@ * @function | ||
function createGifImageForDevice(gifImage) { | ||
return require("sf-core/ui/gifimage").createFromFile("assets://" + gifImage); | ||
return require("@smartface/native/ui/gifimage").createFromFile("assets://" + gifImage); | ||
} | ||
@@ -225,0 +225,0 @@ function createImageForDevice(image) { |
@@ -158,3 +158,3 @@ "use strict"; | ||
// -------------> | ||
var isScrollView = _component.layout && (_component instanceof require("sf-core/ui/scrollview")); | ||
var isScrollView = _component.layout && (_component instanceof require("@smartface/native/ui/scrollview")); | ||
_component.subscribeContext ? hasDiff && _component.subscribeContext({ | ||
@@ -161,0 +161,0 @@ type: "new-styles", |
{ | ||
"name": "@smartface/contx", | ||
"version": "3.0.2", | ||
"version": "4.0.0-rc.1", | ||
"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 ", | ||
@@ -45,3 +45,3 @@ "dev:remove": "rm -R -f ../scripts/node_modules/@smartface/contx & rm -R -f ./lib", | ||
"cz-customizable": "^5.0.0", | ||
"eslint": "^3.19.0", | ||
"eslint": "^4.18.2", | ||
"eslint-plugin-react": "^6.10.3", | ||
@@ -48,0 +48,0 @@ "gitbook-cli": "^2.3.2", |
@@ -219,4 +219,4 @@ [](https://twitter.com/smartface_io) | ||
let flWait = new FlWait(); // A library component | ||
componentContextPatch(dialog, `dialog${guid()}`); // Connect component to context | ||
dialog.layout.addChild(flWait, `flWait${guid()}`, ".flWait"); // Child components are connected autmatically | ||
componentContextPatch(dialog, `dialog`); // Connect component to context | ||
dialog.layout.addChild(flWait, `flWait`, ".flWait"); // Child components are connected autmatically | ||
dialog.layout.applyLayout(); | ||
@@ -223,0 +223,0 @@ dialog.show(); |
@@ -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 * as orientation from "sf-extension-utils/lib/orientation"; | ||
import System from 'sf-core/device/system'; | ||
import System from '@smartface/native/device/system'; | ||
function load(src){ | ||
@@ -12,3 +12,3 @@ return require(src); | ||
} else if (System.OS === "Android") { | ||
AndroidConfig = load('sf-core/util/Android/androidconfig'); | ||
AndroidConfig = load('@smartface/native/util/Android/androidconfig'); | ||
const Activity = AndroidConfig.activity; | ||
@@ -15,0 +15,0 @@ const context = Activity; |
@@ -1,2 +0,2 @@ | ||
import View = require("sf-core/ui/view"); | ||
import View = require("@smartface/native/ui/view"); | ||
/** | ||
@@ -3,0 +3,0 @@ * Add context child action |
import createPageContext from "./pageContext"; | ||
import patchMethod from '../util/patchMethod'; | ||
const Application = require("sf-core/application"); | ||
const Application = require("@smartface/native/application"); | ||
@@ -6,0 +6,0 @@ export default function componentContextPatch(component, name) { |
@@ -1,2 +0,2 @@ | ||
import View = require("sf-core/ui/view"); | ||
import View = require("@smartface/native/ui/view"); | ||
@@ -3,0 +3,0 @@ declare function addChild(superAddChild: () => any, child: View, name: string, classNames: string, userProps: { [key: string]: any } | null, defaultClassNames: string): void; |
@@ -9,3 +9,3 @@ import hooks from '../core/hooks'; | ||
import raiseErrorMaybe from '../core/util/raiseErrorMaybe'; | ||
import Application from "sf-core/application"; | ||
import Application from "@smartface/native/application"; | ||
@@ -156,3 +156,3 @@ function addChild(superAddChild, child, name, classNames = "", userProps = null, defaultClassNames= "") { | ||
* | ||
* @param {Object} component - A sf-core component | ||
* @param {Object} component - A @smartface/native component | ||
* @param {string} name - component name | ||
@@ -159,0 +159,0 @@ * @param {function} initialClassNameMap - classNames mapping with specified component and children |
@@ -1,6 +0,7 @@ | ||
import View = require("sf-core/ui/view"); | ||
import View = require("@smartface/native/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,12 +0,7 @@ | ||
import * as StyleContext from "../styling/StyleContext"; | ||
import styler from "@smartface/styler/lib/styler"; | ||
import commands from "@smartface/styler/lib/commandsManager"; | ||
import merge from "@smartface/styler/lib/utils/merge"; | ||
import buildProps from "./sfCorePropFactory"; | ||
import Screen from 'sf-core/device/screen'; | ||
import System from 'sf-core/device/system'; | ||
import Screen from '@smartface/native/device/screen'; | ||
import System from '@smartface/native/device/system'; | ||
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"; | ||
@@ -13,0 +8,0 @@ |
@@ -1,2 +0,2 @@ | ||
import Page = require("sf-core/ui/page"); | ||
import Page = require("@smartface/native/ui/page"); | ||
@@ -3,0 +3,0 @@ declare function onSafeAreaPaddingChange(onSafeAreaPaddingChange: () => any, paddings: { left: number, right: number, top: number, bottom: number}): void; |
@@ -6,3 +6,3 @@ import extend from 'js-base/core/extend'; | ||
const buildStyles = require("@smartface/styler/lib/buildStyles"); | ||
const Application = require("sf-core/application"); | ||
const Application = require("@smartface/native/application"); | ||
@@ -9,0 +9,0 @@ function onSafeAreaPaddingChange(onSafeAreaPaddingChange, paddings) { |
@@ -1,5 +0,5 @@ | ||
import PageBase = require('sf-core/ui/page'); | ||
import Application = require('sf-core/application'); | ||
import PageBase = require('@smartface/native/ui/page'); | ||
import Application = require('@smartface/native/application'); | ||
import StatusBar = Application.statusBar; | ||
import HeaderBar = require('sf-core/ui/headerbar'); | ||
import HeaderBar = require('@smartface/native/ui/headerbar'); | ||
@@ -6,0 +6,0 @@ export default class Page extends PageBase { |
@@ -1,2 +0,2 @@ | ||
const PageBase = require('sf-core/ui/page'); | ||
const PageBase = require('@smartface/native/ui/page'); | ||
const extend = require("js-base/core/extend"); | ||
@@ -3,0 +3,0 @@ const Page = extend(PageBase); |
/** | ||
* Create a sf-core value | ||
* Create a @smartface/native value | ||
* | ||
@@ -5,0 +5,0 @@ * @function |
@@ -1,33 +0,33 @@ | ||
import Color from "sf-core/ui/color"; | ||
import Font from "sf-core/ui/font"; | ||
import Image from "sf-core/ui/image"; | ||
import Color from "@smartface/native/ui/color"; | ||
import Font from "@smartface/native/ui/font"; | ||
import Image from "@smartface/native/ui/image"; | ||
const HexColorValidationRegexp = /^#[0-9A-Fa-f]{6}$/gi; | ||
const ENUMS = { | ||
imageFillType: "sf-core/ui/imagefilltype", | ||
textAlignment: "sf-core/ui/textalignment", | ||
keyboardType: "sf-core/ui/keyboardtype", | ||
orientation: "sf-core/ui/page", | ||
type: "sf-core/ui/mapview", | ||
gradientOrientation: "sf-core/ui/color", | ||
searchViewStyle: "sf-core/ui/searchview", | ||
imageFillType: "@smartface/native/ui/imagefilltype", | ||
textAlignment: "@smartface/native/ui/textalignment", | ||
keyboardType: "@smartface/native/ui/keyboardtype", | ||
orientation: "@smartface/native/ui/page", | ||
type: "@smartface/native/ui/mapview", | ||
gradientOrientation: "@smartface/native/ui/color", | ||
searchViewStyle: "@smartface/native/ui/searchview", | ||
activityIndicatorViewStyle: | ||
"sf-core/ui/activityindicator/ios/activityindicatorviewstyle", | ||
alignSelf: "sf-core/ui/flexlayout", | ||
alignContent: "sf-core/ui/flexlayout", | ||
alignItems: "sf-core/ui/flexlayout", | ||
direction: "sf-core/ui/flexlayout", | ||
ellipsizeMode: "sf-core/ui/ellipsizemode", | ||
flexDirection: "sf-core/ui/flexlayout", | ||
flexWrap: "sf-core/ui/flexlayout", | ||
justifyContent: "sf-core/ui/flexlayout", | ||
positionType: "sf-core/ui/flexlayout", | ||
overflow: "sf-core/ui/flexlayout", | ||
style: "sf-core/ui/statusbarstyle", | ||
shimmeringDirection: "sf-core/ui/shimmerflexlayout", | ||
"@smartface/native/ui/activityindicator/ios/activityindicatorviewstyle", | ||
alignSelf: "@smartface/native/ui/flexlayout", | ||
alignContent: "@smartface/native/ui/flexlayout", | ||
alignItems: "@smartface/native/ui/flexlayout", | ||
direction: "@smartface/native/ui/flexlayout", | ||
ellipsizeMode: "@smartface/native/ui/ellipsizemode", | ||
flexDirection: "@smartface/native/ui/flexlayout", | ||
flexWrap: "@smartface/native/ui/flexlayout", | ||
justifyContent: "@smartface/native/ui/flexlayout", | ||
positionType: "@smartface/native/ui/flexlayout", | ||
overflow: "@smartface/native/ui/flexlayout", | ||
style: "@smartface/native/ui/statusbarstyle", | ||
shimmeringDirection: "@smartface/native/ui/shimmerflexlayout", | ||
ios: { | ||
style: "sf-core/ui/statusbarstyle" | ||
style: "@smartface/native/ui/statusbarstyle" | ||
}, | ||
align: "sf-core/ui/scrollview", | ||
scrollDirection: "sf-core/ui/layoutmanager" | ||
align: "@smartface/native/ui/scrollview", | ||
scrollDirection: "@smartface/native/ui/layoutmanager" | ||
}; | ||
@@ -166,3 +166,3 @@ const ENUMS_META_FIELD = { | ||
/** | ||
* Create a sf-core value | ||
* Create a @smartface/native value | ||
* | ||
@@ -224,3 +224,3 @@ * @function | ||
function createGifImageForDevice(gifImage) { | ||
return require("sf-core/ui/gifimage").createFromFile( | ||
return require("@smartface/native/ui/gifimage").createFromFile( | ||
`assets://${gifImage}` | ||
@@ -227,0 +227,0 @@ ); |
import Actor from "../core/Actor"; | ||
import View = require("sf-core/ui/view"); | ||
import View = require("@smartface/native/ui/view"); | ||
@@ -4,0 +4,0 @@ declare function componentAssign(component: View, key: string, value: { [key: string]: any }): void; |
@@ -148,3 +148,3 @@ import Actor from "../core/Actor"; | ||
// -------------> | ||
var isScrollView = _component.layout && (_component instanceof require("sf-core/ui/scrollview")); | ||
var isScrollView = _component.layout && (_component instanceof require("@smartface/native/ui/scrollview")); | ||
_component.subscribeContext ? hasDiff && _component.subscribeContext({ | ||
@@ -151,0 +151,0 @@ type: "new-styles", |
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
Sorry, the diff of this file is not supported yet
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
223111
-0.8%146
-7.01%4212
-1.7%1
Infinity%