UNPKG

soot

Version:
157 lines (149 loc) 6.91 kB
// Generated by dts-bundle v0.7.3 // Dependencies for this module: // ../../../../packages/soot/soot-shared // ../../../../packages/soot/soot-vnode-flags declare module 'soot' { import { NO_OP } from "soot-shared"; import { Props, V, VNode } from "soot/core/vnode"; import { linkEvent } from "soot/DOM/events/linkEvent"; import { Component, render } from "soot/DOM/rendering"; import { EMPTY_OBJ } from "soot/DOM/utils"; const version: string | undefined; export { EMPTY_OBJ, VNode, Component, NO_OP, Props, V, linkEvent, render, version }; } declare module 'soot/core/vnode' { import { VNodeFlags } from "soot-vnode-flags"; import { Component } from "soot/DOM/rendering"; export type Type = string | null | Function | Component<any, any>; export interface Props { children?: any; [k: string]: any; } export interface VNode { c: any; cN: string; f: number; k: string | number | null; p: Props | null; r: any; t: Type; } /** * Creates virtual node * @param {number} flags * @param {*} type * @param {string|null?} className * @param {Object?} children * @param {Object?} props * @param {*?} key * @param {Object|Function?} ref * @returns {Object} returns new virtual node */ export function V(flags: VNodeFlags, type: any, className?: string | null, children?: any, props?: Props | null, key?: any, ref?: any): { c: any; cN: string | null; f: VNodeFlags; k: any; p: Props | null; r: any; t: any; }; export function isVNode(o: any): o is VNode; } declare module 'soot/DOM/events/linkEvent' { /** * Links given data to event as first parameter * @param {*} data data to be linked, it will be available in function as first parameter * @param {Function} event Function to be called when event occurs * @returns {Object} Return null when event is not valid, to avoid creating unnecessary event handlers */ export function linkEvent(data: any, event: any): { data: any; event: any; } | null; } declare module 'soot/DOM/rendering' { import { IV } from "soot/core/iv"; import { Props, VNode } from "soot/core/vnode"; export function triggerLifecycle(listeners: any): void; export function handleEvent(name: string, nextEvent: any, dom: any): void; /** * Renders virtual node tree into parent node. * @param {VNode | null | string | number} input v to be rendered * @param {*} parentDom DOM node which content will be replaced by virtual node * @param {Function?} callback Callback to be called after rendering has finished * @returns {void} */ export function render(input: VNode | null | string | undefined, parentDom: Element | SVGAElement | DocumentFragment | null | HTMLElement | Node, callback?: Function): void; export function patch(iv: IV, nextInput: VNode | string | number, parentDom: Element, lifecycle: any, isSVG: boolean): void; export function patchChildren(parentIV: IV, nextInput: any, parentDOM: Element, lifecycle: any, childrenIsSVG: boolean): void; export function patchElement(iv: IV, lastVNode: VNode, nextVNode: VNode, parentDom: Element | null, lifecycle: any, isSVG: boolean): void; export function patchNonKeyedChildren(childIVs: IV[], nextChildren: Array<VNode | null | string | false | undefined | true | number>, parentDOM: Element, lifecycle: any, isSVG: boolean, lastIVsLength: number, nextChildrenLength: number): void; export function patchKeyedChildren(parentIV: IV, a: IV[], b: VNode[], parentDOM: any, lifecycle: any, isSVG: boolean, aLength: number, bLength: number): void; export function isAttrAnEvent(attr: string): boolean; export function patchProp(prop: any, lastValue: any, nextValue: any, dom: Element, isSVG: boolean): void; export function patchEvent(name: string, lastValue: any, nextValue: any, dom: any): void; export interface ComponentLifecycle<P, S> { componentDidMount?(): void; componentWillMount?(): void; componentWillReceiveProps?(nextProps: P): void; shouldComponentUpdate?(nextProps: P, nextState: S): boolean; componentWillUpdate?(nextProps: P, nextState: S): void; componentDidUpdate?(prevProps: P, prevState: S): void; componentWillUnmount?(): void; } export function handleUpdate(component: Component<any, any>, nextState: any, nextProps: any, fromSetState: boolean, isSVG: boolean, lifecycle: any, parentDom: any): void; export function flushSetStates(): void; export class Component<P, S> implements ComponentLifecycle<P, S> { state: S | null; props: P & Props; __BR: boolean; __BS: boolean; __PSS: boolean; __PS: S | null; __IV: IV; __UN: boolean; __LC: Function[]; __SVG: boolean; __PN: Element; __FP: boolean; __FCB: Function[] | null; constructor(props?: P); componentDidMount?(): void; componentWillMount?(): void; componentWillReceiveProps?(nextProps: P): void; shouldComponentUpdate?(nextProps: P, nextState: S): boolean; componentWillUpdate?(nextProps: P, nextState: S): void; componentDidUpdate?(prevProps: P, prevState: S): void; componentWillUnmount?(): void; setState(newState: S | Function, callback?: Function): void; render(nextProps?: P, nextState?: any): any; } } declare module 'soot/DOM/utils' { import { IV } from "soot/core/iv"; import { VNode } from "soot/core/vnode"; export const EMPTY_OBJ: {}; export function replaceDOM(iv: IV, parentDom: any, newDOM: any): void; export function setTextContent(dom: any, text: string | number): void; export function appendChild(parentDom: any, dom: any): void; export function insertOrAppend(iv: IV, parentDom: Element, newNode: Element, nextNode: Element | null): void; export function replaceWithNewNode(iv: IV, nextInput: VNode | string | number, parentDom: any, lifecycle: any, isSVG: boolean): void; export function replaceChild(parentDom: any, nextDom: any, lastDom: any): void; export function removeChild(parentDom: Element, dom: Element): void; export function removeAllChildren(parentIV: IV, dom: Element, children: IV[]): void; } declare module 'soot/core/iv' { import { VNode } from "soot/core/vnode"; export interface IV { b: IV | null; c: IV | IV[] | null; d: Element | null; f: number; i: any; k: string | number | null; p: number; v: VNode | string | number; } export function createIV(input: VNode | string | number, pos: number, key: string | number | null): IV; }