🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

nerv-shared

Package Overview
Dependencies
Maintainers
2
Versions
39
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nerv-shared - npm Package Compare versions

Comparing version
1.4.0-beta.0
to
1.4.0-beta.1
+117
dist/index.d.ts
// Generated by dts-bundle v0.7.3
declare module 'nerv-shared' {
export interface Widget {
vtype: VType;
name: string;
_owner: any;
props: any;
_rendered: any;
context: any;
init(parentContext: any, parentComponent: any): Element | null;
update(previous: ComponentInstance, current: ComponentInstance, context: any, dom?: Element): Element | null;
destroy(dom?: Element): any;
}
export interface Portal {
type: Element;
vtype: VType;
children: VirtualNode;
dom: null | Element;
}
export type ComponentInstance = CompositeComponent | StatelessComponent;
export interface CompositeComponent extends Widget {
type: any;
component: Component<any, any>;
ref?: Ref;
dom: Element | null;
}
export interface StatelessComponent extends Widget {
type: Function;
dom: Element | null;
}
export const EMPTY_CHILDREN: any[];
export const EMPTY_OBJ: {};
export interface VText {
vtype: VType;
text: string | number;
dom: Text | null;
}
export interface VVoid {
dom: Text | null;
vtype: VType;
}
export interface VNode {
vtype: VType;
type: string;
props: Props;
children: VirtualChildren;
key: string | number | undefined;
namespace: string | null;
_owner: Component<any, any>;
isSvg?: boolean;
parentContext?: any;
dom: Element | null;
ref: Function | string | null;
}
export type VirtualNode = VNode | VText | CompositeComponent | StatelessComponent | VVoid | Portal;
export type VirtualChildren = Array<string | number | VirtualNode> | VirtualNode;
export type Ref = (node?: Element | null) => void | null | string;
export interface Props {
children?: VirtualChildren;
ref?: Ref;
key?: any;
className?: string | object;
[k: string]: any;
}
export interface ComponentLifecycle<P, S> {
componentWillMount?(): void;
componentDidMount?(): void;
componentWillReceiveProps?(nextProps: Readonly<P>, nextContext: any): void;
shouldComponentUpdate?(nextProps: Readonly<P>, nextState: Readonly<S>, nextContext: any): boolean;
componentWillUpdate?(nextProps: Readonly<P>, nextState: Readonly<S>, nextContext: any): void;
componentDidUpdate?(prevProps: Readonly<P>, prevState: Readonly<S>, prevContext: any): void;
componentWillUnmount?(): void;
componentDidCatch?(error?: any): void;
}
export interface Refs {
[k: string]: any;
}
export interface Component<P, S> extends ComponentLifecycle<P, S> {
state: Readonly<S>;
props: Readonly<P> & Readonly<any>;
context: any;
_dirty: boolean;
_disable: boolean;
_rendered: any;
_parentComponent: Component<any, any>;
prevProps: P;
prevState: S;
prevContext: object;
isReactComponent: object;
dom: any;
vnode: CompositeComponent;
clearCallBacks: () => void;
getState(): S;
refs: Refs;
render(props?: any, context?: any): VirtualNode;
}
export function isNullOrUndef(o: any): o is undefined | null;
export function isInvalid(o: any): o is undefined | null | true | false;
export function isVNode(node: any): node is VNode;
export function isVText(node: any): node is VText;
export function isComponent(instance: any): instance is Component<any, any>;
export function isWidget(node: any): node is CompositeComponent | StatelessComponent;
export function isPortal(vtype: VType, node: any): node is Portal;
export function isComposite(node: any): node is CompositeComponent;
export function isValidElement(node: any): node is VirtualNode;
export function isHook(arg: any): boolean;
export function noop(): void;
export const enum VType {
Text = 1,
Node = 2,
Composite = 4,
Void = 16,
Portal = 32
}
}
const EMPTY_CHILDREN = [];
const EMPTY_OBJ = {};
function isNullOrUndef(o) {
return o === undefined || o === null;
}
function isInvalid(o) {
return isNullOrUndef(o) || o === true || o === false;
}
function isVNode(node) {
return !isNullOrUndef(node) && node.vtype === 2 /* Node */;
}
function isVText(node) {
return !isNullOrUndef(node) && node.vtype === 1 /* Text */;
}
function isComponent(instance) {
return !isInvalid(instance) && instance.isReactComponent === EMPTY_OBJ;
}
function isWidget(node) {
return (!isNullOrUndef(node) &&
(node.vtype & (4 /* Composite */)) > 0);
}
function isPortal(vtype, node) {
return (vtype & 32 /* Portal */) > 0;
}
function isComposite(node) {
return !isNullOrUndef(node) && node.vtype === 4 /* Composite */;
}
function isValidElement(node) {
return !isNullOrUndef(node) && node.vtype;
}
function isHook(arg) {
return !isNullOrUndef(arg) && typeof arg.vhook === 'number';
}
// tslint:disable-next-line:no-empty
function noop() { }
// typescript will compile the enum's value for us.
// eg.
// Composite = 1 << 2 => Composite = 4
var VType;
(function (VType) {
VType[VType["Text"] = 1] = "Text";
VType[VType["Node"] = 2] = "Node";
VType[VType["Composite"] = 4] = "Composite";
VType[VType["Void"] = 16] = "Void";
VType[VType["Portal"] = 32] = "Portal";
})(VType || (VType = {}));
export { EMPTY_CHILDREN, EMPTY_OBJ, isNullOrUndef, isInvalid, isVNode, isVText, isComponent, isWidget, isPortal, isComposite, isValidElement, isHook, noop, VType };
//# sourceMappingURL=index.js.map
{"version":3,"file":"index.js","sources":["../src/index.ts"],"sourcesContent":["export interface Widget {\n vtype: VType\n name: string\n _owner: any\n props: any\n _rendered: any\n context: any\n init (parentContext, parentComponent): Element | null\n update (\n previous: ComponentInstance,\n current: ComponentInstance,\n context: any,\n dom?: Element\n ): Element | null\n destroy (dom?: Element)\n}\n\nexport interface Portal {\n type: Element\n vtype: VType\n children: VirtualNode\n dom: null | Element\n}\n\nexport type ComponentInstance = CompositeComponent | StatelessComponent\n\nexport interface CompositeComponent extends Widget {\n type: any\n component: Component<any, any>\n ref?: Ref\n dom: Element | null\n}\n\nexport interface StatelessComponent extends Widget {\n type: Function\n dom: Element | null\n}\n\nexport const EMPTY_CHILDREN: any[] = []\n\nexport const EMPTY_OBJ = {}\n\nexport interface VText {\n vtype: VType\n text: string | number\n dom: Text | null\n}\n\nexport interface VVoid {\n dom: Text | null\n vtype: VType\n}\n\nexport interface VNode {\n vtype: VType\n type: string\n props: Props\n children: VirtualChildren\n key: string | number | undefined\n namespace: string | null\n _owner: Component<any, any> // TODO: this is a component\n isSvg?: boolean\n parentContext?: any\n dom: Element | null\n ref: Function | string | null\n}\n\nexport type VirtualNode =\n | VNode\n | VText\n | CompositeComponent\n | StatelessComponent\n | VVoid\n | Portal\n\nexport type VirtualChildren = Array<string | number | VirtualNode> | VirtualNode\n\nexport type Ref = (node?: Element | null) => void | null | string\n\nexport interface Props {\n children?: VirtualChildren\n ref?: Ref\n key?: any\n className?: string | object\n [k: string]: any\n}\n\nexport interface ComponentLifecycle<P, S> {\n componentWillMount? (): void\n componentDidMount? (): void\n componentWillReceiveProps? (nextProps: Readonly<P>, nextContext: any): void\n shouldComponentUpdate? (\n nextProps: Readonly<P>,\n nextState: Readonly<S>,\n nextContext: any\n ): boolean\n componentWillUpdate? (\n nextProps: Readonly<P>,\n nextState: Readonly<S>,\n nextContext: any\n ): void\n componentDidUpdate? (\n prevProps: Readonly<P>,\n prevState: Readonly<S>,\n prevContext: any\n ): void\n componentWillUnmount? (): void\n componentDidCatch? (error?): void\n}\n\nexport interface Refs {\n [k: string]: any\n}\n\nexport interface Component<P, S> extends ComponentLifecycle<P, S> {\n state: Readonly<S>\n props: Readonly<P> & Readonly<any>\n context: any\n _dirty: boolean\n _disable: boolean\n _rendered: any\n _parentComponent: Component<any, any>\n prevProps: P\n prevState: S\n prevContext: object\n isReactComponent: object\n dom: any\n vnode: CompositeComponent\n clearCallBacks: () => void\n getState (): S\n // tslint:disable-next-line:member-ordering\n refs: Refs\n render (props?, context?): VirtualNode\n}\n\nexport function isNullOrUndef (o: any): o is undefined | null {\n return o === undefined || o === null\n}\n\nexport function isInvalid (o: any): o is undefined | null | true | false {\n return isNullOrUndef(o) || o === true || o === false\n}\n\nexport function isVNode (node): node is VNode {\n return !isNullOrUndef(node) && node.vtype === VType.Node\n}\n\nexport function isVText (node): node is VText {\n return !isNullOrUndef(node) && node.vtype === VType.Text\n}\n\nexport function isComponent (instance): instance is Component<any, any> {\n return !isInvalid(instance) && instance.isReactComponent === EMPTY_OBJ\n}\n\nexport function isWidget (\n node\n): node is CompositeComponent | StatelessComponent {\n return (\n !isNullOrUndef(node) &&\n (node.vtype & (VType.Composite)) > 0\n )\n}\n\nexport function isPortal (vtype: VType, node): node is Portal {\n return (vtype & VType.Portal) > 0\n}\n\nexport function isComposite (node): node is CompositeComponent {\n return !isNullOrUndef(node) && node.vtype === VType.Composite\n}\n\nexport function isValidElement (node): node is VirtualNode {\n return !isNullOrUndef(node) && node.vtype\n}\n\nexport function isHook (arg) {\n return !isNullOrUndef(arg) && typeof arg.vhook === 'number'\n}\n\n// tslint:disable-next-line:no-empty\nexport function noop () {}\n\n// typescript will compile the enum's value for us.\n// eg.\n// Composite = 1 << 2 => Composite = 4\nexport const enum VType {\n Text = 1,\n Node = 1 << 1,\n Composite = 1 << 2,\n Void = 1 << 4,\n Portal = 1 << 5\n}\n"],"names":[],"mappings":"AAsCO,MAAM,cAAc,GAAU,EAAE,CAAA;AAEvC,AAAO,MAAM,SAAS,GAAG,EAAE,CAAA;AA+F3B,SAAgB,aAAa,CAAE,CAAM;IACnC,OAAO,CAAC,KAAK,SAAS,IAAI,CAAC,KAAK,IAAI,CAAA;CACrC;AAED,SAAgB,SAAS,CAAE,CAAM;IAC/B,OAAO,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,KAAK,CAAA;CACrD;AAED,SAAgB,OAAO,CAAE,IAAI;IAC3B,OAAO,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,KAAK,kBAAe;CACzD;AAED,SAAgB,OAAO,CAAE,IAAI;IAC3B,OAAO,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,KAAK,kBAAe;CACzD;AAED,SAAgB,WAAW,CAAE,QAAQ;IACnC,OAAO,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,QAAQ,CAAC,gBAAgB,KAAK,SAAS,CAAA;CACvE;AAED,SAAgB,QAAQ,CACtB,IAAI;IAEJ,QACE,CAAC,aAAa,CAAC,IAAI,CAAC;QACpB,CAAC,IAAI,CAAC,KAAK,sBAAoB,IAAI,CAAC,EACrC;CACF;AAED,SAAgB,QAAQ,CAAE,KAAY,EAAE,IAAI;IAC1C,OAAO,CAAC,KAAK,sBAAmB,CAAC,CAAA;CAClC;AAED,SAAgB,WAAW,CAAE,IAAI;IAC/B,OAAO,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,KAAK,uBAAoB;CAC9D;AAED,SAAgB,cAAc,CAAE,IAAI;IAClC,OAAO,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,KAAK,CAAA;CAC1C;AAED,SAAgB,MAAM,CAAE,GAAG;IACzB,OAAO,CAAC,aAAa,CAAC,GAAG,CAAC,IAAI,OAAO,GAAG,CAAC,KAAK,KAAK,QAAQ,CAAA;CAC5D;;AAGD,SAAgB,IAAI,MAAM;;;;AAK1B,AAAA,IAAkB,KAMjB;AAND,WAAkB,KAAK;IACrB,iCAAQ,CAAA;IACR,iCAAa,CAAA;IACb,2CAAkB,CAAA;IAClB,kCAAa,CAAA;IACb,sCAAe,CAAA;CAChB,EANiB,KAAK,KAAL,KAAK,QAMtB;;;;"}
+0
-11

@@ -6,13 +6,2 @@ # Change Log

<a name="1.4.0-beta.0"></a>
# [1.4.0-beta.0](https://github.com/NervJS/nerv/compare/v1.3.12...v1.4.0-beta.0) (2019-04-10)
### Features
* implementing useLayoutEffect ([f56920d](https://github.com/NervJS/nerv/commit/f56920d))
<a name="1.3.7"></a>

@@ -19,0 +8,0 @@ ## [1.3.7](https://github.com/NervJS/nerv/compare/v1.3.6...v1.3.7) (2018-10-26)

+1
-1
{
"name": "nerv-shared",
"version": "v1.4.0-beta.0",
"version": "1.4.0-beta.1",
"description": "Internal utilities for Nerv.js",

@@ -5,0 +5,0 @@ "main": "index.js",