noodl-types
Advanced tools
Comparing version 1.0.20 to 1.0.21
@@ -9,6 +9,6 @@ "use strict"; | ||
var Identify_1 = require("../Identify"); | ||
describe(chalk_1.default.keyword('orange')('identify'), function () { | ||
describe(chalk_1.default.keyword('orange')('Identify'), function () { | ||
describe.only("actionChain", function () { | ||
it.only("should accept emit objects", function () { | ||
chai_1.expect(Identify_1.identify.actionChain([ | ||
chai_1.expect(Identify_1.Identify.actionChain([ | ||
{ emit: { dataKey: { var1: 'itemObject' } }, actions: [] }, | ||
@@ -18,3 +18,3 @@ ])).to.be.true; | ||
xit("should accept goto objects", function () { | ||
chai_1.expect(Identify_1.identify.actionChain([ | ||
chai_1.expect(Identify_1.Identify.actionChain([ | ||
{ emit: { dataKey: { var1: 'itemObject' } }, actions: [] }, | ||
@@ -26,3 +26,3 @@ { goto: 'PatientDashboard' }, | ||
xit("should accept emit, goto, and toast objects", function () { | ||
chai_1.expect(Identify_1.identify.actionChain([ | ||
chai_1.expect(Identify_1.Identify.actionChain([ | ||
{ emit: { dataKey: { var1: 'itemObject' } }, actions: [] }, | ||
@@ -36,12 +36,12 @@ { goto: 'PatientDashboard' }, | ||
it("should be a toast", function () { | ||
chai_1.expect(Identify_1.identify.toast({ toast: { message: 'hello', style: {} } })).to.be | ||
chai_1.expect(Identify_1.Identify.toast({ toast: { message: 'hello', style: {} } })).to.be | ||
.true; | ||
}); | ||
it("should not be a toast", function () { | ||
chai_1.expect(Identify_1.identify.toast({ toasft: { message: 'hello', style: {} } })).to.be | ||
chai_1.expect(Identify_1.Identify.toast({ toasft: { message: 'hello', style: {} } })).to.be | ||
.false; | ||
chai_1.expect(Identify_1.identify.toast({})).to.be.false; | ||
chai_1.expect(Identify_1.identify.toast('fasfas')).to.be.false; | ||
chai_1.expect(Identify_1.identify.toast(5)).to.be.false; | ||
chai_1.expect(Identify_1.identify.toast(null)).to.be.false; | ||
chai_1.expect(Identify_1.Identify.toast({})).to.be.false; | ||
chai_1.expect(Identify_1.Identify.toast('fasfas')).to.be.false; | ||
chai_1.expect(Identify_1.Identify.toast(5)).to.be.false; | ||
chai_1.expect(Identify_1.Identify.toast(null)).to.be.false; | ||
}); | ||
@@ -48,0 +48,0 @@ }); |
@@ -0,2 +1,3 @@ | ||
export declare const componentTypes: readonly ["button", "divider", "footer", "header", "image", "label", "list", "listItem", "page", "plugin", "pluginHead", "pluginBodyTail", "popUp", "register", "select", "scrollView", "textField", "textView", "video", "view"]; | ||
export declare const minimalStyleKeys: string[]; | ||
export declare const minimalBorderStyleKeys: string[]; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.minimalBorderStyleKeys = exports.minimalStyleKeys = void 0; | ||
exports.minimalBorderStyleKeys = exports.minimalStyleKeys = exports.componentTypes = void 0; | ||
exports.componentTypes = [ | ||
'button', | ||
'divider', | ||
'footer', | ||
'header', | ||
'image', | ||
'label', | ||
'list', | ||
'listItem', | ||
'page', | ||
'plugin', | ||
'pluginHead', | ||
'pluginBodyTail', | ||
'popUp', | ||
'register', | ||
'select', | ||
'scrollView', | ||
'textField', | ||
'textView', | ||
'video', | ||
'view', | ||
]; | ||
exports.minimalStyleKeys = [ | ||
@@ -5,0 +27,0 @@ 'backgroundColor', |
@@ -11,5 +11,6 @@ import { PlainObject } from '../internalTypes'; | ||
export declare function hasInAnyKeys(keys: string | string[], value: PlainObject): boolean; | ||
export declare function isArr(v: unknown): v is any[]; | ||
export declare function isBool(value: unknown): value is Boolean; | ||
export declare function isNil(v: unknown): boolean; | ||
export declare function isPlainObject(value: unknown): value is PlainObject; | ||
export declare function isObj(value: unknown): value is PlainObject; | ||
export declare function isImg(s: string): boolean; | ||
@@ -16,0 +17,0 @@ export declare function isPdf(s: string): boolean; |
@@ -6,3 +6,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.isHtml = exports.isJs = exports.isJson = exports.isYml = exports.isVid = exports.isPdf = exports.isImg = exports.isPlainObject = exports.isNil = exports.isBool = exports.hasInAnyKeys = exports.hasAnyKeys = exports.hasMinimumKeys = exports.hasInAllKeys = exports.hasAllKeys = exports.hasKeyEqualTo = exports.hasKey = exports.exists = exports.excludeKeys = void 0; | ||
exports.isHtml = exports.isJs = exports.isJson = exports.isYml = exports.isVid = exports.isPdf = exports.isImg = exports.isObj = exports.isNil = exports.isBool = exports.isArr = exports.hasInAnyKeys = exports.hasAnyKeys = exports.hasMinimumKeys = exports.hasInAllKeys = exports.hasAllKeys = exports.hasKeyEqualTo = exports.hasKey = exports.exists = exports.excludeKeys = void 0; | ||
var get_1 = __importDefault(require("lodash/get")); | ||
@@ -64,2 +64,6 @@ var has_1 = __importDefault(require("lodash/has")); | ||
exports.hasInAnyKeys = hasInAnyKeys; | ||
function isArr(v) { | ||
return Array.isArray(v); | ||
} | ||
exports.isArr = isArr; | ||
function isBool(value) { | ||
@@ -73,6 +77,6 @@ return typeof value === 'boolean'; | ||
exports.isNil = isNil; | ||
function isPlainObject(value) { | ||
function isObj(value) { | ||
return exists(value) && !Array.isArray(value) && typeof value === 'object'; | ||
} | ||
exports.isPlainObject = isPlainObject; | ||
exports.isObj = isObj; | ||
function isImg(s) { | ||
@@ -79,0 +83,0 @@ return /([a-z\-_0-9\/\:\.]*\.(jpg|jpeg|png|gif))/i.test(s); |
@@ -1,26 +0,28 @@ | ||
import { IfObject } from './uncategorizedTypes'; | ||
export interface ActionObject<T extends string = any> { | ||
actionType: T; | ||
export interface UncommonActionObjectProps { | ||
contentType?: string; | ||
dataKey?: any; | ||
dataObject?: any; | ||
destination?: string; | ||
funcName: string; | ||
object?: any; | ||
popUpView?: string; | ||
reload?: boolean; | ||
viewTag?: string; | ||
wait?: boolean | number; | ||
} | ||
export declare type AnyActionObject = BuiltInActionObject | EvalActionObject | PageJumpActionObject | PopupActionObject | PopupDismissActionObject | RefreshActionObject | SaveActionObject; | ||
export interface ActionObject<T extends string = any> { | ||
actionType: T; | ||
[key: string]: any; | ||
} | ||
export interface BuiltInActionObject<FuncName extends string = any> extends ActionObject { | ||
export interface BuiltInActionObject extends ActionObject, Pick<UncommonActionObjectProps, 'contentType' | 'funcName' | 'reload' | 'viewTag'> { | ||
actionType: 'builtIn'; | ||
funcName: FuncName; | ||
contentType?: string; | ||
viewTag?: string; | ||
[key: string]: any; | ||
} | ||
export interface EvalActionObject extends ActionObject { | ||
export interface EvalActionObject extends ActionObject, Pick<UncommonActionObjectProps, 'object'> { | ||
actionType: 'evalObject'; | ||
object?: Function | IfObject; | ||
[key: string]: any; | ||
} | ||
export interface PageJumpActionObject<D extends string = any> extends ActionObject { | ||
export interface PageJumpActionObject extends ActionObject, Pick<UncommonActionObjectProps, 'destination'> { | ||
actionType: 'pageJump'; | ||
destination: D; | ||
[key: string]: any; | ||
@@ -33,5 +35,4 @@ } | ||
} | ||
export interface PopupDismissActionObject<V extends string = any> extends ActionObject { | ||
export interface PopupDismissActionObject extends ActionObject, Pick<UncommonActionObjectProps, 'popUpView'> { | ||
actionType: 'popUpDismiss'; | ||
popUpView: V; | ||
[key: string]: any; | ||
@@ -43,16 +44,12 @@ } | ||
} | ||
export interface SaveActionObject extends ActionObject { | ||
export interface SaveActionObject extends ActionObject, Pick<UncommonActionObjectProps, 'object'> { | ||
actionType: 'saveObject'; | ||
object?: [string | ((...args: any[]) => any)] | ((...args: any[]) => any); | ||
[key: string]: any; | ||
} | ||
export declare type UpdateActionObject<T = any> = { | ||
export declare type UpdateActionObject = ({ | ||
actionType: 'updateObject'; | ||
dataObject?: string; | ||
dataKey?: string; | ||
[key: string]: any; | ||
} | { | ||
} & Pick<UncommonActionObjectProps, 'dataObject' | 'dataKey'>) | ({ | ||
actionType: 'updateObject'; | ||
object?: T; | ||
[key: string]: any; | ||
}; | ||
} & Pick<UncommonActionObjectProps, 'object'>); |
import { ActionObject } from './actionTypes'; | ||
import { StyleObject } from './styleTypes'; | ||
import { EventType } from './constantTypes'; | ||
import { StyleObject, StyleTextAlign, StyleTextAlignObject } from './styleTypes'; | ||
import { ActionChain, EmitObject, GotoObject, IfObject, TextBoardObject } from './uncategorizedTypes'; | ||
export declare type AnyComponentObject = ButtonComponentObject | DividerComponentObject | FooterComponentObject | HeaderComponentObject | ImageComponentObject | LabelComponentObject | ListComponentObject | ListItemComponentObject | PageComponentObject | PluginComponentObject | PluginHeadComponentObject | PluginBodyTailComponentObject | PopUpComponentObject | RegisterComponentObject | SelectComponentObject | ScrollViewComponentObject | TextFieldComponentObject | TextViewComponentObject | VideoComponentObject | ViewComponentObject; | ||
export declare type UncommonComponentObjectProps = { | ||
[key in EventType]: ActionChain; | ||
} & { | ||
actions?: (ActionObject | EmitObject | GotoObject)[]; | ||
contentType?: string; | ||
dataKey?: string; | ||
isEditable?: boolean; | ||
iteratorVar?: string; | ||
listObject?: '' | any[]; | ||
onEvent?: string; | ||
optionKey?: string; | ||
options?: any[]; | ||
path?: string | IfObject | EmitObject; | ||
pathSelected?: string; | ||
placeholder?: string | EmitObject; | ||
popUpView?: string; | ||
poster?: string; | ||
refresh?: boolean; | ||
required?: boolean; | ||
text?: string; | ||
textBoard?: TextBoardObject; | ||
textAlign?: StyleTextAlign | StyleTextAlignObject; | ||
'text=func'?: string; | ||
viewTag?: string; | ||
videoFormat?: string; | ||
}; | ||
export interface ComponentObject<T extends string = any> { | ||
@@ -9,3 +38,3 @@ type: T; | ||
} | ||
export interface ButtonComponentObject extends ComponentObject { | ||
export interface ButtonComponentObject extends ComponentObject, Pick<UncommonComponentObjectProps, 'contentType' | 'text'> { | ||
type: 'button'; | ||
@@ -26,15 +55,12 @@ [key: string]: any; | ||
} | ||
export interface ImageComponentObject extends ComponentObject { | ||
export interface ImageComponentObject extends ComponentObject, Pick<UncommonComponentObjectProps, 'path'> { | ||
type: 'image'; | ||
path: string; | ||
[key: string]: any; | ||
} | ||
export interface LabelComponentObject extends ComponentObject { | ||
export interface LabelComponentObject extends ComponentObject, Pick<UncommonComponentObjectProps, 'contentType' | 'dataKey' | 'text' | 'textBoard' | 'text=func'> { | ||
type: 'label'; | ||
[key: string]: any; | ||
} | ||
export interface ListComponentObject extends ComponentObject { | ||
export interface ListComponentObject extends ComponentObject, Pick<UncommonComponentObjectProps, 'contentType' | 'iteratorVar' | 'listObject'> { | ||
type: 'list'; | ||
iteratorVar: String; | ||
listObject: any[]; | ||
[key: string]: any; | ||
@@ -46,29 +72,27 @@ } | ||
} | ||
export interface PageComponentObject extends ComponentObject { | ||
export interface PageComponentObject extends ComponentObject, Pick<UncommonComponentObjectProps, 'path'> { | ||
type: 'page'; | ||
[key: string]: any; | ||
} | ||
export interface PluginComponentObject extends ComponentObject { | ||
export interface PluginComponentObject extends ComponentObject, Pick<UncommonComponentObjectProps, 'path'> { | ||
type: 'plugin'; | ||
[key: string]: any; | ||
} | ||
export interface PluginHeadComponentObject extends ComponentObject { | ||
export interface PluginHeadComponentObject extends ComponentObject, Pick<UncommonComponentObjectProps, 'path'> { | ||
type: 'pluginHead'; | ||
[key: string]: any; | ||
} | ||
export interface PluginBodyTailComponentObject extends ComponentObject { | ||
export interface PluginBodyTailComponentObject extends ComponentObject, Pick<UncommonComponentObjectProps, 'path'> { | ||
type: 'pluginBodyTail'; | ||
[key: string]: any; | ||
} | ||
export interface PopUpComponentObject extends ComponentObject { | ||
export interface PopUpComponentObject extends ComponentObject, Pick<UncommonComponentObjectProps, 'popUpView'> { | ||
type: 'popUp'; | ||
[key: string]: any; | ||
} | ||
export interface RegisterComponentObject extends ComponentObject { | ||
export interface RegisterComponentObject extends ComponentObject, Pick<UncommonComponentObjectProps, 'actions' | 'onEvent'> { | ||
type: 'register'; | ||
onEvent?: string; | ||
actions?: ActionObject[]; | ||
[key: string]: any; | ||
} | ||
export interface SelectComponentObject extends ComponentObject { | ||
export interface SelectComponentObject extends ComponentObject, Pick<UncommonComponentObjectProps, 'optionKey' | 'options'> { | ||
type: 'select'; | ||
@@ -81,3 +105,3 @@ [key: string]: any; | ||
} | ||
export interface TextFieldComponentObject extends ComponentObject { | ||
export interface TextFieldComponentObject extends ComponentObject, Pick<UncommonComponentObjectProps, 'dataKey' | 'placeholder'> { | ||
type: 'textField'; | ||
@@ -90,3 +114,3 @@ [key: string]: any; | ||
} | ||
export interface VideoComponentObject extends ComponentObject { | ||
export interface VideoComponentObject extends ComponentObject, Pick<UncommonComponentObjectProps, 'path' | 'poster' | 'videoFormat'> { | ||
type: 'video'; | ||
@@ -93,0 +117,0 @@ [key: string]: any; |
@@ -0,8 +1,69 @@ | ||
import { StyleObject } from './styleTypes'; | ||
import * as T from '.'; | ||
export declare const identify: { | ||
paths: { | ||
actionChain(): void; | ||
export declare const Identify: { | ||
folds: { | ||
actionChain(v: unknown): v is (T.ActionObject<any> | T.EmitObject | T.GotoObject)[]; | ||
component: { | ||
any(): void; | ||
button(): void; | ||
any(v: unknown): v is T.AnyComponentObject; | ||
} & { | ||
button: <K extends "button" | "divider" | "footer" | "header" | "image" | "label" | "list" | "listItem" | "page" | "plugin" | "pluginHead" | "pluginBodyTail" | "popUp" | "register" | "select" | "scrollView" | "textField" | "textView" | "video" | "view">(v: unknown) => v is Pick<T.AnyComponentObject, string | number> & { | ||
type: K; | ||
}; | ||
divider: <K extends "button" | "divider" | "footer" | "header" | "image" | "label" | "list" | "listItem" | "page" | "plugin" | "pluginHead" | "pluginBodyTail" | "popUp" | "register" | "select" | "scrollView" | "textField" | "textView" | "video" | "view">(v: unknown) => v is Pick<T.AnyComponentObject, string | number> & { | ||
type: K; | ||
}; | ||
footer: <K extends "button" | "divider" | "footer" | "header" | "image" | "label" | "list" | "listItem" | "page" | "plugin" | "pluginHead" | "pluginBodyTail" | "popUp" | "register" | "select" | "scrollView" | "textField" | "textView" | "video" | "view">(v: unknown) => v is Pick<T.AnyComponentObject, string | number> & { | ||
type: K; | ||
}; | ||
header: <K extends "button" | "divider" | "footer" | "header" | "image" | "label" | "list" | "listItem" | "page" | "plugin" | "pluginHead" | "pluginBodyTail" | "popUp" | "register" | "select" | "scrollView" | "textField" | "textView" | "video" | "view">(v: unknown) => v is Pick<T.AnyComponentObject, string | number> & { | ||
type: K; | ||
}; | ||
image: <K extends "button" | "divider" | "footer" | "header" | "image" | "label" | "list" | "listItem" | "page" | "plugin" | "pluginHead" | "pluginBodyTail" | "popUp" | "register" | "select" | "scrollView" | "textField" | "textView" | "video" | "view">(v: unknown) => v is Pick<T.AnyComponentObject, string | number> & { | ||
type: K; | ||
}; | ||
label: <K extends "button" | "divider" | "footer" | "header" | "image" | "label" | "list" | "listItem" | "page" | "plugin" | "pluginHead" | "pluginBodyTail" | "popUp" | "register" | "select" | "scrollView" | "textField" | "textView" | "video" | "view">(v: unknown) => v is Pick<T.AnyComponentObject, string | number> & { | ||
type: K; | ||
}; | ||
list: <K extends "button" | "divider" | "footer" | "header" | "image" | "label" | "list" | "listItem" | "page" | "plugin" | "pluginHead" | "pluginBodyTail" | "popUp" | "register" | "select" | "scrollView" | "textField" | "textView" | "video" | "view">(v: unknown) => v is Pick<T.AnyComponentObject, string | number> & { | ||
type: K; | ||
}; | ||
listItem: <K extends "button" | "divider" | "footer" | "header" | "image" | "label" | "list" | "listItem" | "page" | "plugin" | "pluginHead" | "pluginBodyTail" | "popUp" | "register" | "select" | "scrollView" | "textField" | "textView" | "video" | "view">(v: unknown) => v is Pick<T.AnyComponentObject, string | number> & { | ||
type: K; | ||
}; | ||
page: <K extends "button" | "divider" | "footer" | "header" | "image" | "label" | "list" | "listItem" | "page" | "plugin" | "pluginHead" | "pluginBodyTail" | "popUp" | "register" | "select" | "scrollView" | "textField" | "textView" | "video" | "view">(v: unknown) => v is Pick<T.AnyComponentObject, string | number> & { | ||
type: K; | ||
}; | ||
plugin: <K extends "button" | "divider" | "footer" | "header" | "image" | "label" | "list" | "listItem" | "page" | "plugin" | "pluginHead" | "pluginBodyTail" | "popUp" | "register" | "select" | "scrollView" | "textField" | "textView" | "video" | "view">(v: unknown) => v is Pick<T.AnyComponentObject, string | number> & { | ||
type: K; | ||
}; | ||
pluginHead: <K extends "button" | "divider" | "footer" | "header" | "image" | "label" | "list" | "listItem" | "page" | "plugin" | "pluginHead" | "pluginBodyTail" | "popUp" | "register" | "select" | "scrollView" | "textField" | "textView" | "video" | "view">(v: unknown) => v is Pick<T.AnyComponentObject, string | number> & { | ||
type: K; | ||
}; | ||
pluginBodyTail: <K extends "button" | "divider" | "footer" | "header" | "image" | "label" | "list" | "listItem" | "page" | "plugin" | "pluginHead" | "pluginBodyTail" | "popUp" | "register" | "select" | "scrollView" | "textField" | "textView" | "video" | "view">(v: unknown) => v is Pick<T.AnyComponentObject, string | number> & { | ||
type: K; | ||
}; | ||
popUp: <K extends "button" | "divider" | "footer" | "header" | "image" | "label" | "list" | "listItem" | "page" | "plugin" | "pluginHead" | "pluginBodyTail" | "popUp" | "register" | "select" | "scrollView" | "textField" | "textView" | "video" | "view">(v: unknown) => v is Pick<T.AnyComponentObject, string | number> & { | ||
type: K; | ||
}; | ||
register: <K extends "button" | "divider" | "footer" | "header" | "image" | "label" | "list" | "listItem" | "page" | "plugin" | "pluginHead" | "pluginBodyTail" | "popUp" | "register" | "select" | "scrollView" | "textField" | "textView" | "video" | "view">(v: unknown) => v is Pick<T.AnyComponentObject, string | number> & { | ||
type: K; | ||
}; | ||
select: <K extends "button" | "divider" | "footer" | "header" | "image" | "label" | "list" | "listItem" | "page" | "plugin" | "pluginHead" | "pluginBodyTail" | "popUp" | "register" | "select" | "scrollView" | "textField" | "textView" | "video" | "view">(v: unknown) => v is Pick<T.AnyComponentObject, string | number> & { | ||
type: K; | ||
}; | ||
scrollView: <K extends "button" | "divider" | "footer" | "header" | "image" | "label" | "list" | "listItem" | "page" | "plugin" | "pluginHead" | "pluginBodyTail" | "popUp" | "register" | "select" | "scrollView" | "textField" | "textView" | "video" | "view">(v: unknown) => v is Pick<T.AnyComponentObject, string | number> & { | ||
type: K; | ||
}; | ||
textField: <K extends "button" | "divider" | "footer" | "header" | "image" | "label" | "list" | "listItem" | "page" | "plugin" | "pluginHead" | "pluginBodyTail" | "popUp" | "register" | "select" | "scrollView" | "textField" | "textView" | "video" | "view">(v: unknown) => v is Pick<T.AnyComponentObject, string | number> & { | ||
type: K; | ||
}; | ||
textView: <K extends "button" | "divider" | "footer" | "header" | "image" | "label" | "list" | "listItem" | "page" | "plugin" | "pluginHead" | "pluginBodyTail" | "popUp" | "register" | "select" | "scrollView" | "textField" | "textView" | "video" | "view">(v: unknown) => v is Pick<T.AnyComponentObject, string | number> & { | ||
type: K; | ||
}; | ||
video: <K extends "button" | "divider" | "footer" | "header" | "image" | "label" | "list" | "listItem" | "page" | "plugin" | "pluginHead" | "pluginBodyTail" | "popUp" | "register" | "select" | "scrollView" | "textField" | "textView" | "video" | "view">(v: unknown) => v is Pick<T.AnyComponentObject, string | number> & { | ||
type: K; | ||
}; | ||
view: <K extends "button" | "divider" | "footer" | "header" | "image" | "label" | "list" | "listItem" | "page" | "plugin" | "pluginHead" | "pluginBodyTail" | "popUp" | "register" | "select" | "scrollView" | "textField" | "textView" | "video" | "view">(v: unknown) => v is Pick<T.AnyComponentObject, string | number> & { | ||
type: K; | ||
}; | ||
}; | ||
@@ -31,10 +92,10 @@ emit(value: unknown): value is { | ||
any(v: unknown): v is T.ActionObject<any>; | ||
builtIn(v: unknown): v is T.BuiltInActionObject<any>; | ||
builtIn(v: unknown): v is T.BuiltInActionObject; | ||
evalObject(v: unknown): v is T.EvalActionObject; | ||
pageJump(v: unknown): v is T.PageJumpActionObject<any>; | ||
pageJump(v: unknown): v is T.PageJumpActionObject; | ||
popUp(v: unknown): v is T.PopupActionObject<any>; | ||
popUpDismiss(v: unknown): v is T.PopupDismissActionObject<any>; | ||
popUpDismiss(v: unknown): v is T.PopupDismissActionObject; | ||
refresh(v: unknown): v is T.RefreshActionObject; | ||
saveObject(v: unknown): v is T.SaveActionObject; | ||
updateObject(v: unknown): v is T.UpdateActionObject<any>; | ||
updateObject(v: unknown): v is T.UpdateActionObject; | ||
}; | ||
@@ -77,3 +138,3 @@ actionChain(v: unknown): boolean; | ||
style: { | ||
any(v: unknown): v is T.StyleObject; | ||
any(v: unknown): v is StyleObject; | ||
border(v: unknown): boolean; | ||
@@ -80,0 +141,0 @@ }; |
@@ -33,34 +33,44 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.identify = void 0; | ||
exports.Identify = void 0; | ||
var constants_1 = require("./_internal/constants"); | ||
var u = __importStar(require("./_internal")); | ||
exports.identify = (function () { | ||
exports.Identify = (function () { | ||
var identity = function (x) { return x; }; | ||
var composeSomes = function () { | ||
var fns = []; | ||
for (var _i = 0; _i < arguments.length; _i++) { | ||
fns[_i] = arguments[_i]; | ||
} | ||
return function (arg) { | ||
return fns.some(function (fn) { return fn(arg); }); | ||
}; | ||
}; | ||
var o = { | ||
action: { | ||
any: function (v) { | ||
return u.isPlainObject(v) && 'actionType' in v; | ||
return u.isObj(v) && 'actionType' in v; | ||
}, | ||
builtIn: function (v) { | ||
return (u.isPlainObject(v) && ('funcName' in v || v.actionType === 'builtIn')); | ||
return u.isObj(v) && ('funcName' in v || v.actionType === 'builtIn'); | ||
}, | ||
evalObject: function (v) { | ||
return u.isPlainObject(v) && v.actionType === 'evalObject'; | ||
return u.isObj(v) && v.actionType === 'evalObject'; | ||
}, | ||
pageJump: function (v) { | ||
return u.isPlainObject(v) && v.actionType === 'pageJump'; | ||
return u.isObj(v) && v.actionType === 'pageJump'; | ||
}, | ||
popUp: function (v) { | ||
return u.isPlainObject(v) && v.actionType === 'popUp'; | ||
return u.isObj(v) && v.actionType === 'popUp'; | ||
}, | ||
popUpDismiss: function (v) { | ||
return u.isPlainObject(v) && v.actionType === 'popUpDismiss'; | ||
return u.isObj(v) && v.actionType === 'popUpDismiss'; | ||
}, | ||
refresh: function (v) { | ||
return u.isPlainObject(v) && v.actionType === 'refresh'; | ||
return u.isObj(v) && v.actionType === 'refresh'; | ||
}, | ||
saveObject: function (v) { | ||
return u.isPlainObject(v) && v.actionType === 'saveObject'; | ||
return u.isObj(v) && v.actionType === 'saveObject'; | ||
}, | ||
updateObject: function (v) { | ||
return u.isPlainObject(v) && v.actionType === 'updateObject'; | ||
return u.isObj(v) && v.actionType === 'updateObject'; | ||
}, | ||
@@ -88,67 +98,67 @@ }, | ||
button: function (value) { | ||
return u.isPlainObject(value) && value.type === 'button'; | ||
return u.isObj(value) && value.type === 'button'; | ||
}, | ||
divider: function (value) { | ||
return u.isPlainObject(value) && value.type === 'divider'; | ||
return u.isObj(value) && value.type === 'divider'; | ||
}, | ||
footer: function (value) { | ||
return u.isPlainObject(value) && value.type === 'footer'; | ||
return u.isObj(value) && value.type === 'footer'; | ||
}, | ||
header: function (value) { | ||
return u.isPlainObject(value) && value.type === 'header'; | ||
return u.isObj(value) && value.type === 'header'; | ||
}, | ||
image: function (value) { | ||
return u.isPlainObject(value) && value.type === 'image'; | ||
return u.isObj(value) && value.type === 'image'; | ||
}, | ||
label: function (value) { | ||
return u.isPlainObject(value) && value.type === 'label'; | ||
return u.isObj(value) && value.type === 'label'; | ||
}, | ||
list: function (value) { | ||
return u.isPlainObject(value) && value.type === 'list'; | ||
return u.isObj(value) && value.type === 'list'; | ||
}, | ||
listItem: function (value) { | ||
return u.isPlainObject(value) && value.type === 'listItem'; | ||
return u.isObj(value) && value.type === 'listItem'; | ||
}, | ||
plugin: function (value) { | ||
return u.isPlainObject(value) && value.type === 'plugin'; | ||
return u.isObj(value) && value.type === 'plugin'; | ||
}, | ||
pluginHead: function (value) { | ||
return u.isPlainObject(value) && value.type === 'pluginHead'; | ||
return u.isObj(value) && value.type === 'pluginHead'; | ||
}, | ||
pluginBodyTail: function (value) { | ||
return u.isPlainObject(value) && value.type === 'pluginBodyTail'; | ||
return u.isObj(value) && value.type === 'pluginBodyTail'; | ||
}, | ||
popUp: function (value) { | ||
return u.isPlainObject(value) && value.type === 'popUp'; | ||
return u.isObj(value) && value.type === 'popUp'; | ||
}, | ||
register: function (value) { | ||
return u.isPlainObject(value) && value.type === 'register'; | ||
return u.isObj(value) && value.type === 'register'; | ||
}, | ||
select: function (value) { | ||
return u.isPlainObject(value) && value.type === 'select'; | ||
return u.isObj(value) && value.type === 'select'; | ||
}, | ||
scrollView: function (value) { | ||
return u.isPlainObject(value) && value.type === 'scrollView'; | ||
return u.isObj(value) && value.type === 'scrollView'; | ||
}, | ||
textField: function (value) { | ||
return u.isPlainObject(value) && value.type === 'textField'; | ||
return u.isObj(value) && value.type === 'textField'; | ||
}, | ||
textView: function (value) { | ||
return u.isPlainObject(value) && value.type === 'textView'; | ||
return u.isObj(value) && value.type === 'textView'; | ||
}, | ||
video: function (value) { | ||
return u.isPlainObject(value) && value.type === 'video'; | ||
return u.isObj(value) && value.type === 'video'; | ||
}, | ||
view: function (value) { | ||
return u.isPlainObject(value) && value.type === 'view'; | ||
return u.isObj(value) && value.type === 'view'; | ||
}, | ||
}, | ||
emit: function (v) { | ||
return u.isPlainObject(v) && 'emit' in v; | ||
return u.isObj(v) && 'emit' in v; | ||
}, | ||
goto: function (v) { | ||
return u.isPlainObject(v) && 'goto' in v; | ||
return u.isObj(v) && 'goto' in v; | ||
}, | ||
if: function (v) { | ||
return u.isPlainObject(v) && 'if' in v; | ||
return u.isObj(v) && 'if' in v; | ||
}, | ||
@@ -175,6 +185,6 @@ reference: function (value) { | ||
any: function (v) { | ||
return u.isPlainObject(v) && u.hasAnyKeys(constants_1.minimalStyleKeys, v); | ||
return u.isObj(v) && u.hasAnyKeys(constants_1.minimalStyleKeys, v); | ||
}, | ||
border: function (v) { | ||
return (u.isPlainObject(v) && | ||
return (u.isObj(v) && | ||
u.hasAnyKeys(['color', 'style', 'width'], v) && | ||
@@ -185,19 +195,31 @@ !u.hasAnyKeys(u.excludeKeys(constants_1.minimalStyleKeys, constants_1.minimalBorderStyleKeys), v)); | ||
toast: function (value) { | ||
return u.isPlainObject(value) && 'message' in value; | ||
return u.isObj(value) && 'message' in value; | ||
}, | ||
}; | ||
var paths = { | ||
actionChain: function () { }, | ||
component: { | ||
any: function () { }, | ||
button: function () { }, | ||
var folds = { | ||
actionChain: function (v) { | ||
return u.isArr(v) && v.some(composeSomes(o.action.any, o.emit, o.goto)); | ||
}, | ||
component: Object.assign({ | ||
any: function (v) { | ||
return (u.isObj(v) && | ||
'type' in v && | ||
constants_1.componentTypes.some(function (t) { return v.type === t; })); | ||
}, | ||
}, Object.assign({}, constants_1.componentTypes.reduce(function (acc, type) { | ||
var _a; | ||
return Object.assign(acc, (_a = {}, | ||
_a[type] = function (v) { | ||
return u.isObj(v) && v['type'] === type; | ||
}, | ||
_a)); | ||
}, {}))), | ||
emit: function (value) { | ||
return u.isPlainObject(value) && 'emit' in value; | ||
return u.isObj(value) && 'emit' in value; | ||
}, | ||
goto: function (value) { | ||
return u.isPlainObject(value) && 'goto' in value; | ||
return u.isObj(value) && 'goto' in value; | ||
}, | ||
path: function (value) { | ||
return u.isPlainObject(value) && 'path' in value; | ||
return u.isObj(value) && 'path' in value; | ||
}, | ||
@@ -209,10 +231,14 @@ style: { | ||
textFunc: function (value) { | ||
return u.isPlainObject(value) && 'path' in value; | ||
return u.isObj(value) && 'path' in value; | ||
}, | ||
toast: function (value) { | ||
return u.isPlainObject(value) && 'toast' in value; | ||
return u.isObj(value) && 'toast' in value; | ||
}, | ||
}; | ||
return __assign(__assign({}, o), { paths: paths }); | ||
var a = {}; | ||
if (folds.component.button(a)) { | ||
// a.type = 'divider' | ||
} | ||
return __assign(__assign({}, o), { folds: folds }); | ||
})(); | ||
//# sourceMappingURL=Identify.js.map |
@@ -7,2 +7,3 @@ export * from './actionTypes'; | ||
export * from './uncategorizedTypes'; | ||
export { identify } from './Identify'; | ||
export { Identify } from './Identify'; | ||
export { actionTypes, componentTypes } from './data.json'; |
@@ -13,3 +13,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.identify = void 0; | ||
exports.componentTypes = exports.actionTypes = exports.Identify = void 0; | ||
__exportStar(require("./actionTypes"), exports); | ||
@@ -22,3 +22,6 @@ __exportStar(require("./componentTypes"), exports); | ||
var Identify_1 = require("./Identify"); | ||
Object.defineProperty(exports, "identify", { enumerable: true, get: function () { return Identify_1.identify; } }); | ||
Object.defineProperty(exports, "Identify", { enumerable: true, get: function () { return Identify_1.Identify; } }); | ||
var data_json_1 = require("./data.json"); | ||
Object.defineProperty(exports, "actionTypes", { enumerable: true, get: function () { return data_json_1.actionTypes; } }); | ||
Object.defineProperty(exports, "componentTypes", { enumerable: true, get: function () { return data_json_1.componentTypes; } }); | ||
//# sourceMappingURL=index.js.map |
@@ -0,3 +1,6 @@ | ||
export interface AnyFn { | ||
(...args: any[]): any; | ||
} | ||
export interface PlainObject { | ||
[key: string]: any; | ||
} |
@@ -19,2 +19,4 @@ export interface StyleObject { | ||
display?: string; | ||
flex?: string; | ||
flexFlow?: any; | ||
fontColor?: string; | ||
@@ -27,4 +29,8 @@ fontSize?: string; | ||
isHidden?: boolean; | ||
justifyContent?: string; | ||
left?: string; | ||
letterSpacing?: string; | ||
lineHeight?: string; | ||
marginLeft?: string; | ||
marginTop?: string; | ||
outline?: string; | ||
@@ -39,2 +45,3 @@ padding?: string; | ||
textColor?: string; | ||
textDecoration?: string; | ||
textIndent?: string; | ||
@@ -41,0 +48,0 @@ top?: string; |
@@ -0,6 +1,8 @@ | ||
import { ActionObject } from './actionTypes'; | ||
import { StyleObject } from './styleTypes'; | ||
export declare type ActionChain = (ActionObject | EmitObject | GotoObject)[]; | ||
export interface EmitObject { | ||
emit: { | ||
actions: any[]; | ||
dataKey: string | { | ||
dataKey?: string | { | ||
[key: string]: string; | ||
@@ -22,2 +24,8 @@ }; | ||
export declare type Path = string | EmitObject | IfObject; | ||
export declare type TextBoardObject = ({ | ||
color?: string; | ||
text?: string; | ||
} | { | ||
br?: null | ''; | ||
})[]; | ||
export interface ToastObject { | ||
@@ -24,0 +32,0 @@ message?: string; |
{ | ||
"name": "noodl-types", | ||
"version": "1.0.20", | ||
"version": "1.0.21", | ||
"description": "NOODL TypeScript Definitions", | ||
@@ -25,3 +25,3 @@ "author": "Christopher Tran <christopher@aitmed.com>", | ||
}, | ||
"gitHead": "fc0bcbd6e05eabd2c789311e01bbd8519b7a4b9d" | ||
"gitHead": "9a138c1e20522aa8d9160100eee962ac27caf74b" | ||
} |
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
59862
41
1103