Comparing version 2.0.4 to 2.0.5
@@ -5,10 +5,6 @@ // @flow | ||
interface IModel { | ||
enableReactivity () : void; | ||
disableReactivity () : void; | ||
} | ||
declare module "vasille" { | ||
declare type AppOptions = ?{ | ||
debugUi?: boolean, | ||
debugUi ?: boolean, | ||
freezeUi ?: boolean, | ||
@@ -19,9 +15,9 @@ executor ?: Executor | ||
declare export class Destroyable { | ||
$seal () : void; | ||
$destroy () : void; | ||
seal () : void; | ||
destroy () : void; | ||
} | ||
declare export class ReactivePrivate extends Destroyable { | ||
watch : Set<IValue<any>>; | ||
watch : Set<Switchable>; | ||
bindings : Set<Destroyable>; | ||
models: Set<IModel<any, any>>; | ||
models: Set<IModel>; | ||
enabled : boolean; | ||
@@ -33,3 +29,3 @@ frozen : boolean; | ||
$destroy () : void; | ||
destroy () : void; | ||
} | ||
@@ -41,21 +37,21 @@ declare export class Reactive extends Destroyable { | ||
$ref<T> (value : T) : IValue<T>; | ||
$mirror<T> (value : IValue<T>) : Mirror<T>; | ||
$forward<T> (value : IValue<T>) : Mirror<T>; | ||
$point<T>(value: T | IValue<T>, forwardOnly?: boolean): Pointer<T>; | ||
$register<T>(model: T): T; | ||
ref<T> (value : T) : IValue<T>; | ||
mirror<T> (value : IValue<T>) : Mirror<T>; | ||
forward<T> (value : IValue<T>) : Mirror<T>; | ||
point<T>(value: IValue<T>, forwardOnly?: boolean): Pointer<T>; | ||
register<T>(model: T): T; | ||
$watch<T1> ( | ||
watch<T1> ( | ||
func : (a1 : T1) => void, | ||
v1: IValue<T1>, | ||
) : void; | ||
$watch<T1, T2> ( | ||
watch<T1, T2> ( | ||
func : (a1 : T1, a2 : T2) => void, | ||
v1: IValue<T1>, v2: IValue<T2>, | ||
) : void; | ||
$watch<T1, T2, T3> ( | ||
watch<T1, T2, T3> ( | ||
func : (a1 : T1, a2 : T2, a3 : T3) => void, | ||
v1: IValue<T1>, v2: IValue<T2>, v3: IValue<T3>, | ||
) : void; | ||
$watch<T1, T2, T3, T4> ( | ||
watch<T1, T2, T3, T4> ( | ||
func : (a1 : T1, a2 : T2, a3 : T3, a4 : T4) => void, | ||
@@ -65,3 +61,3 @@ v1: IValue<T1>, v2: IValue<T2>, v3: IValue<T3>, | ||
) : void; | ||
$watch<T1, T2, T3, T4, T5> ( | ||
watch<T1, T2, T3, T4, T5> ( | ||
func : (a1 : T1, a2 : T2, a3 : T3, a4 : T4, a5 : T5) => void, | ||
@@ -71,3 +67,3 @@ v1: IValue<T1>, v2: IValue<T2>, v3: IValue<T3>, | ||
) : void; | ||
$watch<T1, T2, T3, T4, T5, T6> ( | ||
watch<T1, T2, T3, T4, T5, T6> ( | ||
func : (a1 : T1, a2 : T2, a3 : T3, a4 : T4, a5 : T5, a6 : T6) => void, | ||
@@ -77,3 +73,3 @@ v1: IValue<T1>, v2: IValue<T2>, v3: IValue<T3>, | ||
) : void; | ||
$watch<T1, T2, T3, T4, T5, T6, T7> ( | ||
watch<T1, T2, T3, T4, T5, T6, T7> ( | ||
func : (a1 : T1, a2 : T2, a3 : T3, a4 : T4, a5 : T5, a6 : T6, a7 : T7) => void, | ||
@@ -84,3 +80,3 @@ v1: IValue<T1>, v2: IValue<T2>, v3: IValue<T3>, | ||
) : void; | ||
$watch<T1, T2, T3, T4, T5, T6, T7, T8> ( | ||
watch<T1, T2, T3, T4, T5, T6, T7, T8> ( | ||
func : (a1 : T1, a2 : T2, a3 : T3, a4 : T4, a5 : T5, a6 : T6, a7 : T7, a8 : T8) => void, | ||
@@ -91,3 +87,3 @@ v1: IValue<T1>, v2: IValue<T2>, v3: IValue<T3>, | ||
) : void; | ||
$watch<T1, T2, T3, T4, T5, T6, T7, T8, T9> ( | ||
watch<T1, T2, T3, T4, T5, T6, T7, T8, T9> ( | ||
func : (a1 : T1, a2 : T2, a3 : T3, a4 : T4, a5 : T5, a6 : T6, a7 : T7, a8 : T8, a9 : T9) => void, | ||
@@ -99,15 +95,15 @@ v1: IValue<T1>, v2: IValue<T2>, v3: IValue<T3>, | ||
$bind<T, T1> ( | ||
bind<T, T1> ( | ||
func : (a1 : T1) => T, | ||
v1: IValue<T1>, | ||
) : IValue<T>; | ||
$bind<T, T1, T2> ( | ||
bind<T, T1, T2> ( | ||
func : (a1 : T1, a2 : T2) => T, | ||
v1: IValue<T1>, v2: IValue<T2>, | ||
) : IValue<T>; | ||
$bind<T, T1, T2, T3> ( | ||
bind<T, T1, T2, T3> ( | ||
func : (a1 : T1, a2 : T2, a3 : T3) => T, | ||
v1: IValue<T1>, v2: IValue<T2>, v3: IValue<T3>, | ||
) : IValue<T>; | ||
$bind<T, T1, T2, T3, T4> ( | ||
bind<T, T1, T2, T3, T4> ( | ||
func : (a1 : T1, a2 : T2, a3 : T3, a4 : T4) => T, | ||
@@ -117,3 +113,3 @@ v1: IValue<T1>, v2: IValue<T2>, v3: IValue<T3>, | ||
) : IValue<T>; | ||
$bind<T, T1, T2, T3, T4, T5> ( | ||
bind<T, T1, T2, T3, T4, T5> ( | ||
func : (a1 : T1, a2 : T2, a3 : T3, a4 : T4, a5 : T5) => T, | ||
@@ -123,3 +119,3 @@ v1: IValue<T1>, v2: IValue<T2>, v3: IValue<T3>, | ||
) : IValue<T>; | ||
$bind<T, T1, T2, T3, T4, T5, T6> ( | ||
bind<T, T1, T2, T3, T4, T5, T6> ( | ||
func : (a1 : T1, a2 : T2, a3 : T3, a4 : T4, a5 : T5, a6 : T6) => T, | ||
@@ -129,3 +125,3 @@ v1: IValue<T1>, v2: IValue<T2>, v3: IValue<T3>, | ||
) : IValue<T>; | ||
$bind<T, T1, T2, T3, T4, T5, T6, T7> ( | ||
bind<T, T1, T2, T3, T4, T5, T6, T7> ( | ||
func : (a1 : T1, a2 : T2, a3 : T3, a4 : T4, a5 : T5, a6 : T6, a7 : T7) => T, | ||
@@ -136,3 +132,3 @@ v1: IValue<T1>, v2: IValue<T2>, v3: IValue<T3>, | ||
) : IValue<T>; | ||
$bind<T, T1, T2, T3, T4, T5, T6, T7, T8> ( | ||
bind<T, T1, T2, T3, T4, T5, T6, T7, T8> ( | ||
func : (a1 : T1, a2 : T2, a3 : T3, a4 : T4, a5 : T5, a6 : T6, a7 : T7, a8 : T8) => T, | ||
@@ -143,3 +139,3 @@ v1: IValue<T1>, v2: IValue<T2>, v3: IValue<T3>, | ||
) : IValue<T>; | ||
$bind<T, T1, T2, T3, T4, T5, T6, T7, T8, T9> ( | ||
bind<T, T1, T2, T3, T4, T5, T6, T7, T8, T9> ( | ||
func : (a1 : T1, a2 : T2, a3 : T3, a4 : T4, a5 : T5, a6 : T6, a7 : T7, a8 : T8, a9 : T9) => T, | ||
@@ -151,6 +147,6 @@ v1: IValue<T1>, v2: IValue<T2>, v3: IValue<T3>, | ||
$enable () : void; | ||
$disable () : void; | ||
$bindAlive(cond: IValue<boolean>, onOff?: () => void, onOn?: () => void): this; | ||
$destroy () : void; | ||
enable () : void; | ||
disable () : void; | ||
bindAlive(cond: IValue<boolean>, onOff?: () => void, onOn?: () => void): this; | ||
destroy () : void; | ||
} | ||
@@ -171,2 +167,6 @@ declare export class Executor { | ||
} | ||
declare export class Switchable extends Destroyable { | ||
enable(): void; | ||
disable(): void; | ||
} | ||
declare export class IValue<T> extends Destroyable { | ||
@@ -180,4 +180,2 @@ isEnabled : boolean; | ||
off (handler : (value : T) => void) : this; | ||
enable () : this; | ||
disable () : this; | ||
} | ||
@@ -232,2 +230,6 @@ declare export class Signal< | ||
} | ||
declare interface IModel { | ||
enableReactivity () : void; | ||
disableReactivity () : void; | ||
} | ||
declare export class ArrayModel<T> extends Array<T> implements IModel { | ||
@@ -289,6 +291,6 @@ listener : Listener<T, ?T>; | ||
declare export class AppNode extends INode { | ||
$run : Executor; | ||
run : Executor; | ||
constructor (options : AppOptions) : void; | ||
$$appendNode(node: Node): void; | ||
$appendNode(node: Node): void; | ||
} | ||
@@ -330,28 +332,28 @@ declare export class App extends AppNode { | ||
declare export class Fragment extends Reactive { | ||
$children : Array<Fragment>; | ||
children : Array<Fragment>; | ||
constructor ($ : ?FragmentPrivate) : void; | ||
$preinit (app: AppNode, parent : Fragment, data ?: any) : void; | ||
$init () : this; | ||
$created () : void; | ||
$mounted () : void; | ||
$ready () : void; | ||
$createSignals () : void; | ||
$createWatchers () : void; | ||
$compose () : void; | ||
$$pushNode (node : Fragment) : void; | ||
$$findFirstChild () : ?Node; | ||
$$appendNode (node : Node) : void ; | ||
$$insertAdjacent (node : Node) : void; | ||
$text ( | ||
preinit (app: AppNode, parent : Fragment, data ?: any) : void; | ||
init () : this; | ||
created () : void; | ||
mounted () : void; | ||
ready () : void; | ||
createSignals () : void; | ||
createWatchers () : void; | ||
compose () : void; | ||
$pushNode (node : Fragment) : void; | ||
$findFirstChild () : ?Node; | ||
$appendNode (node : Node) : void ; | ||
$insertAdjacent (node : Node) : void; | ||
text ( | ||
text : string | IValue<string>, | ||
cb : ?(text : TextNode) => void | ||
) : this; | ||
$debug(text : IValue<string>) : this; | ||
$tag<T = Element> ( | ||
debug(text : IValue<string>) : this; | ||
tag<T = Element> ( | ||
tagName : string, | ||
cb ?: (node : Tag, element : T) => void | ||
) : this; | ||
$create<T> ( | ||
create<T> ( | ||
node : T, | ||
@@ -361,7 +363,7 @@ callback ?: ($ : T) => void, | ||
) : this; | ||
$if ( | ||
if ( | ||
cond : IValue<boolean>, | ||
cb : (node : Fragment) => void | ||
) : this ; | ||
$if_else ( | ||
if_else ( | ||
ifCond : IValue<boolean>, | ||
@@ -371,8 +373,11 @@ ifCb : (node : Fragment) => void, | ||
) : this; | ||
$switch ( | ||
switch ( | ||
...cases : Array<{ cond : IValue<boolean>, cb : (node : Fragment) => void }> | ||
) : this; | ||
$case (cond : IValue<boolean>, cb : (node : Fragment) => void) | ||
case (cond : IValue<boolean>, cb : (node : Fragment) => void) | ||
: {cond : IValue<boolean>, cb : (node : Fragment) => void}; | ||
$default (cb: (node : Fragment) => void) | ||
insertBefore(node: Fragment): void; | ||
insertAfter(node: Fragment): void; | ||
remove(): void; | ||
default (cb: (node : Fragment) => void) | ||
: {cond : IValue<boolean>, cb : (node : Fragment) => void}; | ||
@@ -389,3 +394,3 @@ } | ||
$preinit (app : AppNode, parent : Fragment, text : ?IValue<string>) : void; | ||
preinit (app : AppNode, parent : Fragment, text : ?IValue<string>) : void; | ||
} | ||
@@ -402,7 +407,7 @@ declare export class INodePrivate extends FragmentPrivate { | ||
constructor ($ : ?INodePrivate) : void; | ||
$init () : this; | ||
$createAttrs () : void; | ||
$createStyle () : void; | ||
$attr (name : string, value : IValue<?string>) : this; | ||
$bindAttr<T1> ( | ||
init () : this; | ||
createAttrs () : void; | ||
createStyle () : void; | ||
attr (name : string, value : IValue<?string>) : this; | ||
bindAttr<T1> ( | ||
name : string, | ||
@@ -412,3 +417,3 @@ calculator : (a1 : T1) => string, | ||
) : this; | ||
$bindAttr<T1, T2> ( | ||
bindAttr<T1, T2> ( | ||
name : string, | ||
@@ -418,3 +423,3 @@ calculator : (a1 : T1, a2 : T2) => string, | ||
) : this; | ||
$bindAttr<T1, T2, T3> ( | ||
bindAttr<T1, T2, T3> ( | ||
name : string, | ||
@@ -424,3 +429,3 @@ calculator : (a1 : T1, a2 : T2, a3 : T3) => string, | ||
) : this; | ||
$bindAttr<T1, T2, T3, T4> ( | ||
bindAttr<T1, T2, T3, T4> ( | ||
name : string, | ||
@@ -431,3 +436,3 @@ calculator : (a1 : T1, a2 : T2, a3 : T3, a4 : T4) => string, | ||
) : this; | ||
$bindAttr<T1, T2, T3, T4, T5> ( | ||
bindAttr<T1, T2, T3, T4, T5> ( | ||
name : string, | ||
@@ -438,3 +443,3 @@ calculator : (a1 : T1, a2 : T2, a3 : T3, a4 : T4, a5 : T5) => string, | ||
) : this; | ||
$bindAttr<T1, T2, T3, T4, T5, T6> ( | ||
bindAttr<T1, T2, T3, T4, T5, T6> ( | ||
name : string, | ||
@@ -445,3 +450,3 @@ calculator : (a1 : T1, a2 : T2, a3 : T3, a4 : T4, a5 : T5, a6 : T6) => string, | ||
) : this; | ||
$bindAttr<T1, T2, T3, T4, T5, T6, T7> ( | ||
bindAttr<T1, T2, T3, T4, T5, T6, T7> ( | ||
name : string, | ||
@@ -453,3 +458,3 @@ calculator : (a1 : T1, a2 : T2, a3 : T3, a4 : T4, a5 : T5, a6 : T6, a7 : T7) => string, | ||
) : this; | ||
$bindAttr<T1, T2, T3, T4, T5, T6, T7, T8> ( | ||
bindAttr<T1, T2, T3, T4, T5, T6, T7, T8> ( | ||
name : string, | ||
@@ -461,3 +466,3 @@ calculator : (a1 : T1, a2 : T2, a3 : T3, a4 : T4, a5 : T5, a6 : T6, a7 : T7, a8 : T8) => string, | ||
) : this; | ||
$bindAttr<T1, T2, T3, T4, T5, T6, T7, T8, T9> ( | ||
bindAttr<T1, T2, T3, T4, T5, T6, T7, T8, T9> ( | ||
name : string, | ||
@@ -469,14 +474,14 @@ calculator : (a1 : T1, a2 : T2, a3 : T3, a4 : T4, a5 : T5, a6 : T6, a7 : T7, a8 : T8, a9 : T9) => string, | ||
) : this; | ||
$setAttr ( | ||
setAttr ( | ||
name : string, | ||
value : string | ||
) : this; | ||
$addClass (cl : string) : this; | ||
$addClasses (...cl : Array<string>) : this; | ||
$bindClass ( | ||
addClass (cl : string) : this; | ||
addClasses (...cl : Array<string>) : this; | ||
bindClass ( | ||
className : IValue<string> | ||
) : this; | ||
$floatingClass (cond : IValue<boolean>, className : string) : this; | ||
$style (name : string, value : IValue<string>) : this; | ||
$bindStyle<T1> ( | ||
floatingClass (cond : IValue<boolean>, className : string) : this; | ||
style (name : string, value : IValue<string>) : this; | ||
bindStyle<T1> ( | ||
name : string, | ||
@@ -486,3 +491,3 @@ calculator : (a1 : T1) => string, | ||
) : this; | ||
$bindStyle<T1, T2> ( | ||
bindStyle<T1, T2> ( | ||
name : string, | ||
@@ -492,3 +497,3 @@ calculator : (a1 : T1, a2 : T2) => string, | ||
) : this; | ||
$bindStyle<T1, T2, T3> ( | ||
bindStyle<T1, T2, T3> ( | ||
name : string, | ||
@@ -498,3 +503,3 @@ calculator : (a1 : T1, a2 : T2, a3 : T3) => string, | ||
) : this; | ||
$bindStyle<T1, T2, T3, T4> ( | ||
bindStyle<T1, T2, T3, T4> ( | ||
name : string, | ||
@@ -505,3 +510,3 @@ calculator : (a1 : T1, a2 : T2, a3 : T3, a4 : T4) => string, | ||
) : this; | ||
$bindStyle<T1, T2, T3, T4, T5> ( | ||
bindStyle<T1, T2, T3, T4, T5> ( | ||
name : string, | ||
@@ -512,3 +517,3 @@ calculator : (a1 : T1, a2 : T2, a3 : T3, a4 : T4, a5 : T5) => string, | ||
) : this; | ||
$bindStyle<T1, T2, T3, T4, T5, T6> ( | ||
bindStyle<T1, T2, T3, T4, T5, T6> ( | ||
name : string, | ||
@@ -519,3 +524,3 @@ calculator : (a1 : T1, a2 : T2, a3 : T3, a4 : T4, a5 : T5, a6 : T6) => string, | ||
) : this; | ||
$bindStyle<T1, T2, T3, T4, T5, T6, T7> ( | ||
bindStyle<T1, T2, T3, T4, T5, T6, T7> ( | ||
name : string, | ||
@@ -527,3 +532,3 @@ calculator : (a1 : T1, a2 : T2, a3 : T3, a4 : T4, a5 : T5, a6 : T6, a7 : T7) => string, | ||
) : this; | ||
$bindStyle<T1, T2, T3, T4, T5, T6, T7, T8> ( | ||
bindStyle<T1, T2, T3, T4, T5, T6, T7, T8> ( | ||
name : string, | ||
@@ -535,3 +540,3 @@ calculator : (a1 : T1, a2 : T2, a3 : T3, a4 : T4, a5 : T5, a6 : T6, a7 : T7, a8 : T8) => string, | ||
) : this; | ||
$bindStyle<T1, T2, T3, T4, T5, T6, T7, T8, T9> ( | ||
bindStyle<T1, T2, T3, T4, T5, T6, T7, T8, T9> ( | ||
name : string, | ||
@@ -543,64 +548,64 @@ calculator : (a1 : T1, a2 : T2, a3 : T3, a4 : T4, a5 : T5, a6 : T6, a7 : T7, a8 : T8, a9 : T9) => string, | ||
) : this; | ||
$setStyle ( | ||
setStyle ( | ||
prop : string, | ||
value : string | ||
) : this; | ||
$listen (name : string, handler : (ev : any) => void, options : ?EventListenerOptionsOrUseCapture) : this; | ||
$oncontextmenu (handler : (ev : MouseEvent) => void, options : ?EventListenerOptionsOrUseCapture) : this; | ||
$onmousedown (handler : (ev : MouseEvent) => void, options : ?EventListenerOptionsOrUseCapture) : this; | ||
$onmouseenter (handler : (ev : MouseEvent) => void, options : ?EventListenerOptionsOrUseCapture) : this; | ||
$onmouseleave (handler : (ev : MouseEvent) => void, options : ?EventListenerOptionsOrUseCapture) : this; | ||
$onmousemove (handler : (ev : MouseEvent) => void, options : ?EventListenerOptionsOrUseCapture) : this; | ||
$onmouseout (handler : (ev : MouseEvent) => void, options : ?EventListenerOptionsOrUseCapture) : this; | ||
$onmouseover (handler : (ev : MouseEvent) => void, options : ?EventListenerOptionsOrUseCapture) : this; | ||
$onmouseup (handler : (ev : MouseEvent) => void, options : ?EventListenerOptionsOrUseCapture) : this; | ||
$onclick (handler : (ev : MouseEvent) => void, options : ?EventListenerOptionsOrUseCapture) : this; | ||
$ondblclick (handler : (ev : MouseEvent) => void, options : ?EventListenerOptionsOrUseCapture) : this; | ||
$onblur (handler : (ev : FocusEvent) => void, options : ?EventListenerOptionsOrUseCapture) : this; | ||
$onfocus (handler : (ev : FocusEvent) => void, options : ?EventListenerOptionsOrUseCapture) : this; | ||
$onfocusin (handler : (ev : FocusEvent) => void, options : ?EventListenerOptionsOrUseCapture) : this; | ||
$onfocusout (handler : (ev : FocusEvent) => void, options : ?EventListenerOptionsOrUseCapture) : this; | ||
$onkeydown (handler : (ev : KeyboardEvent) => void, options : ?EventListenerOptionsOrUseCapture) : this; | ||
$onkeyup (handler : (ev : KeyboardEvent) => void, options : ?EventListenerOptionsOrUseCapture) : this; | ||
$onkeypress (handler : (ev : KeyboardEvent) => void, options : ?EventListenerOptionsOrUseCapture) : this; | ||
$ontouchstart (handler : (ev : TouchEvent) => void, options : ?EventListenerOptionsOrUseCapture) : this; | ||
$ontouchmove (handler : (ev : TouchEvent) => void, options : ?EventListenerOptionsOrUseCapture) : this; | ||
$ontouchend (handler : (ev : TouchEvent) => void, options : ?EventListenerOptionsOrUseCapture) : this; | ||
$ontouchcancel (handler : (ev : TouchEvent) => void, options : ?EventListenerOptionsOrUseCapture) : this; | ||
$onwheel (handler : (ev : WheelEvent) => void, options : ?EventListenerOptionsOrUseCapture) : this; | ||
$onabort (handler : (ev : ProgressEvent) => void, options : ?EventListenerOptionsOrUseCapture) : this; | ||
$onerror (handler : (ev : ProgressEvent) => void, options : ?EventListenerOptionsOrUseCapture) : this; | ||
$onload (handler : (ev : ProgressEvent) => void, options : ?EventListenerOptionsOrUseCapture) : this; | ||
$onloadend (handler : (ev : ProgressEvent) => void, options : ?EventListenerOptionsOrUseCapture) : this; | ||
$onloadstart (handler : (ev : ProgressEvent) => void, options : ?EventListenerOptionsOrUseCapture) : this; | ||
$onprogress (handler : (ev : ProgressEvent) => void, options : ?EventListenerOptionsOrUseCapture) : this; | ||
$ontimeout (handler : (ev : ProgressEvent) => void, options : ?EventListenerOptionsOrUseCapture) : this; | ||
$ondrag (handler : (ev : DragEvent) => void, options : ?EventListenerOptionsOrUseCapture) : this; | ||
$ondragend (handler : (ev : DragEvent) => void, options : ?EventListenerOptionsOrUseCapture) : this; | ||
$ondragenter (handler : (ev : DragEvent) => void, options : ?EventListenerOptionsOrUseCapture) : this; | ||
$ondragexit (handler : (ev : DragEvent) => void, options : ?EventListenerOptionsOrUseCapture) : this; | ||
$ondragleave (handler : (ev : DragEvent) => void, options : ?EventListenerOptionsOrUseCapture) : this; | ||
$ondragover (handler : (ev : DragEvent) => void, options : ?EventListenerOptionsOrUseCapture) : this; | ||
$ondragstart (handler : (ev : DragEvent) => void, options : ?EventListenerOptionsOrUseCapture) : this; | ||
$ondrop (handler : (ev : DragEvent) => void, options : ?EventListenerOptionsOrUseCapture) : this; | ||
$onpointerover (handler : (ev : PointerEvent) => void, options : ?EventListenerOptionsOrUseCapture) : this; | ||
$onpointerenter (handler : (ev : PointerEvent) => void, options : ?EventListenerOptionsOrUseCapture) : this; | ||
$onpointerdown (handler : (ev : PointerEvent) => void, options : ?EventListenerOptionsOrUseCapture) : this; | ||
$onpointermove (handler : (ev : PointerEvent) => void, options : ?EventListenerOptionsOrUseCapture) : this; | ||
$onpointerup (handler : (ev : PointerEvent) => void, options : ?EventListenerOptionsOrUseCapture) : this; | ||
$onpointercancel (handler : (ev : PointerEvent) => void, options : ?EventListenerOptionsOrUseCapture) : this; | ||
$onpointerout (handler : (ev : PointerEvent) => void, options : ?EventListenerOptionsOrUseCapture) : this; | ||
$onpointerleave (handler : (ev : PointerEvent) => void, options : ?EventListenerOptionsOrUseCapture) : this; | ||
$ongotpointercapture (handler : (ev : PointerEvent) => void, options : ?EventListenerOptionsOrUseCapture) : this; | ||
$onlostpointercapture (handler : (ev : PointerEvent) => void, options : ?EventListenerOptionsOrUseCapture) : this; | ||
$onanimationstart (handler : (ev : AnimationEvent) => void, options : ?EventListenerOptionsOrUseCapture) : this; | ||
$onanimationend (handler : (ev : AnimationEvent) => void, options : ?EventListenerOptionsOrUseCapture) : this; | ||
$onanimationiteraton (handler : (ev : AnimationEvent) => void, options : ?EventListenerOptionsOrUseCapture) : this; | ||
$onclipboardchange (handler : (ev : ClipboardEvent) => void, options : ?EventListenerOptionsOrUseCapture) : this; | ||
$oncut (handler : (ev : ClipboardEvent) => void, options : ?EventListenerOptionsOrUseCapture) : this; | ||
$oncopy (handler : (ev : ClipboardEvent) => void, options : ?EventListenerOptionsOrUseCapture) : this; | ||
$onpaste (handler : (ev : ClipboardEvent) => void, options : ?EventListenerOptionsOrUseCapture) : this; | ||
$$insertAdjacent (node : Node) : void; | ||
$bindShow (cond : IValue<boolean>) : this; | ||
$html (value : IValue<string>) : void; | ||
listen (name : string, handler : (ev : any) => void, options : ?EventListenerOptionsOrUseCapture) : this; | ||
oncontextmenu (handler : (ev : MouseEvent) => void, options : ?EventListenerOptionsOrUseCapture) : this; | ||
onmousedown (handler : (ev : MouseEvent) => void, options : ?EventListenerOptionsOrUseCapture) : this; | ||
onmouseenter (handler : (ev : MouseEvent) => void, options : ?EventListenerOptionsOrUseCapture) : this; | ||
onmouseleave (handler : (ev : MouseEvent) => void, options : ?EventListenerOptionsOrUseCapture) : this; | ||
onmousemove (handler : (ev : MouseEvent) => void, options : ?EventListenerOptionsOrUseCapture) : this; | ||
onmouseout (handler : (ev : MouseEvent) => void, options : ?EventListenerOptionsOrUseCapture) : this; | ||
onmouseover (handler : (ev : MouseEvent) => void, options : ?EventListenerOptionsOrUseCapture) : this; | ||
onmouseup (handler : (ev : MouseEvent) => void, options : ?EventListenerOptionsOrUseCapture) : this; | ||
onclick (handler : (ev : MouseEvent) => void, options : ?EventListenerOptionsOrUseCapture) : this; | ||
ondblclick (handler : (ev : MouseEvent) => void, options : ?EventListenerOptionsOrUseCapture) : this; | ||
onblur (handler : (ev : FocusEvent) => void, options : ?EventListenerOptionsOrUseCapture) : this; | ||
onfocus (handler : (ev : FocusEvent) => void, options : ?EventListenerOptionsOrUseCapture) : this; | ||
onfocusin (handler : (ev : FocusEvent) => void, options : ?EventListenerOptionsOrUseCapture) : this; | ||
onfocusout (handler : (ev : FocusEvent) => void, options : ?EventListenerOptionsOrUseCapture) : this; | ||
onkeydown (handler : (ev : KeyboardEvent) => void, options : ?EventListenerOptionsOrUseCapture) : this; | ||
onkeyup (handler : (ev : KeyboardEvent) => void, options : ?EventListenerOptionsOrUseCapture) : this; | ||
onkeypress (handler : (ev : KeyboardEvent) => void, options : ?EventListenerOptionsOrUseCapture) : this; | ||
ontouchstart (handler : (ev : TouchEvent) => void, options : ?EventListenerOptionsOrUseCapture) : this; | ||
ontouchmove (handler : (ev : TouchEvent) => void, options : ?EventListenerOptionsOrUseCapture) : this; | ||
ontouchend (handler : (ev : TouchEvent) => void, options : ?EventListenerOptionsOrUseCapture) : this; | ||
ontouchcancel (handler : (ev : TouchEvent) => void, options : ?EventListenerOptionsOrUseCapture) : this; | ||
onwheel (handler : (ev : WheelEvent) => void, options : ?EventListenerOptionsOrUseCapture) : this; | ||
onabort (handler : (ev : ProgressEvent) => void, options : ?EventListenerOptionsOrUseCapture) : this; | ||
onerror (handler : (ev : ProgressEvent) => void, options : ?EventListenerOptionsOrUseCapture) : this; | ||
onload (handler : (ev : ProgressEvent) => void, options : ?EventListenerOptionsOrUseCapture) : this; | ||
onloadend (handler : (ev : ProgressEvent) => void, options : ?EventListenerOptionsOrUseCapture) : this; | ||
onloadstart (handler : (ev : ProgressEvent) => void, options : ?EventListenerOptionsOrUseCapture) : this; | ||
onprogress (handler : (ev : ProgressEvent) => void, options : ?EventListenerOptionsOrUseCapture) : this; | ||
ontimeout (handler : (ev : ProgressEvent) => void, options : ?EventListenerOptionsOrUseCapture) : this; | ||
ondrag (handler : (ev : DragEvent) => void, options : ?EventListenerOptionsOrUseCapture) : this; | ||
ondragend (handler : (ev : DragEvent) => void, options : ?EventListenerOptionsOrUseCapture) : this; | ||
ondragenter (handler : (ev : DragEvent) => void, options : ?EventListenerOptionsOrUseCapture) : this; | ||
ondragexit (handler : (ev : DragEvent) => void, options : ?EventListenerOptionsOrUseCapture) : this; | ||
ondragleave (handler : (ev : DragEvent) => void, options : ?EventListenerOptionsOrUseCapture) : this; | ||
ondragover (handler : (ev : DragEvent) => void, options : ?EventListenerOptionsOrUseCapture) : this; | ||
ondragstart (handler : (ev : DragEvent) => void, options : ?EventListenerOptionsOrUseCapture) : this; | ||
ondrop (handler : (ev : DragEvent) => void, options : ?EventListenerOptionsOrUseCapture) : this; | ||
onpointerover (handler : (ev : PointerEvent) => void, options : ?EventListenerOptionsOrUseCapture) : this; | ||
onpointerenter (handler : (ev : PointerEvent) => void, options : ?EventListenerOptionsOrUseCapture) : this; | ||
onpointerdown (handler : (ev : PointerEvent) => void, options : ?EventListenerOptionsOrUseCapture) : this; | ||
onpointermove (handler : (ev : PointerEvent) => void, options : ?EventListenerOptionsOrUseCapture) : this; | ||
onpointerup (handler : (ev : PointerEvent) => void, options : ?EventListenerOptionsOrUseCapture) : this; | ||
onpointercancel (handler : (ev : PointerEvent) => void, options : ?EventListenerOptionsOrUseCapture) : this; | ||
onpointerout (handler : (ev : PointerEvent) => void, options : ?EventListenerOptionsOrUseCapture) : this; | ||
onpointerleave (handler : (ev : PointerEvent) => void, options : ?EventListenerOptionsOrUseCapture) : this; | ||
ongotpointercapture (handler : (ev : PointerEvent) => void, options : ?EventListenerOptionsOrUseCapture) : this; | ||
onlostpointercapture (handler : (ev : PointerEvent) => void, options : ?EventListenerOptionsOrUseCapture) : this; | ||
onanimationstart (handler : (ev : AnimationEvent) => void, options : ?EventListenerOptionsOrUseCapture) : this; | ||
onanimationend (handler : (ev : AnimationEvent) => void, options : ?EventListenerOptionsOrUseCapture) : this; | ||
onanimationiteraton (handler : (ev : AnimationEvent) => void, options : ?EventListenerOptionsOrUseCapture) : this; | ||
onclipboardchange (handler : (ev : ClipboardEvent) => void, options : ?EventListenerOptionsOrUseCapture) : this; | ||
oncut (handler : (ev : ClipboardEvent) => void, options : ?EventListenerOptionsOrUseCapture) : this; | ||
oncopy (handler : (ev : ClipboardEvent) => void, options : ?EventListenerOptionsOrUseCapture) : this; | ||
onpaste (handler : (ev : ClipboardEvent) => void, options : ?EventListenerOptionsOrUseCapture) : this; | ||
$insertAdjacent (node : Node) : void; | ||
bindShow (cond : IValue<boolean>) : this; | ||
html (value : IValue<string>) : void; | ||
} | ||
@@ -611,8 +616,8 @@ declare export class Tag extends INode { | ||
$preinit (app : AppNode, parent : Fragment, tagName : ?string) : void; | ||
$$appendNode(node: Node): void; | ||
$bindMount(cond: IValue<boolean>): this; | ||
preinit (app : AppNode, parent : Fragment, tagName : ?string) : void; | ||
$appendNode(node: Node): void; | ||
bindMount(cond: IValue<boolean>): this; | ||
} | ||
declare export class Extension extends INode { | ||
$preinit (app : AppNode, parent : Fragment) : void; | ||
preinit (app : AppNode, parent : Fragment) : void; | ||
@@ -624,3 +629,3 @@ constructor ($ : ?INodePrivate) : void; | ||
$mounted () : void; | ||
mounted () : void; | ||
} | ||
@@ -639,3 +644,3 @@ declare export class SwitchedNodePrivate extends INodePrivate { | ||
createChild (cb : (node : Fragment) => void) : void; | ||
$ready () : void; | ||
ready () : void; | ||
} | ||
@@ -653,3 +658,3 @@ declare export class DebugPrivate extends FragmentPrivate { | ||
$preinit (app : AppNode, parent : Fragment, text : ?IValue<string>) : void; | ||
preinit (app : AppNode, parent : Fragment, text : ?IValue<string>) : void; | ||
} | ||
@@ -662,3 +667,3 @@ declare export class Watch<T> extends Fragment { | ||
$createWatchers () : void; | ||
createWatchers () : void; | ||
} | ||
@@ -782,6 +787,6 @@ declare export class Expression< | ||
enable () : this; | ||
disable () : this; | ||
on (handler : (value : T) => void) : this; | ||
off (handler : (value : T) => void) : this; | ||
enable () : void; | ||
disable () : void; | ||
on (handler : (value : T) => void) : void; | ||
off (handler : (value : T) => void) : void; | ||
} | ||
@@ -810,3 +815,3 @@ declare export class Mirror<T> extends Reference<T> { | ||
constructor ($1 : ?BaseViewPrivate<K, T>) : void; | ||
constructor ($ : ?BaseViewPrivate<K, T>) : void; | ||
} | ||
@@ -859,8 +864,6 @@ declare export class ArrayView<T> extends BaseView<?T, T, ArrayModel<T>> { | ||
) : void; | ||
bound (name : string) : (rt : INode, ts : INode, value : ?string) => void; | ||
} | ||
declare export class Binding<T> extends Destroyable { | ||
binding : IValue<T>; | ||
updateFunc : (value: T) => void; | ||
func : (value: T) => void; | ||
@@ -873,15 +876,10 @@ constructor ( | ||
bound (name : string) : (rt : INode, ts : INode, value : T) => void; | ||
$destroy () : void; | ||
destroy () : void; | ||
} | ||
declare export class ClassBinding extends Binding<string | boolean> { | ||
constructor ( | ||
node : INode, | ||
name : string, | ||
value : IValue<string | boolean> | ||
) : void; | ||
bound (name : string) : (rt : INode, ts : INode, value : string | boolean) => void; | ||
declare export class StaticClassBinding extends Binding<boolean> { | ||
constructor(node: INode, name: string, value: IValue<boolean>) : void; | ||
} | ||
declare export class DynamicalClassBinding extends Binding<string> { | ||
constructor (node : INode, value : IValue<string>) : void; | ||
} | ||
declare export class StyleBinding extends Binding<string> { | ||
@@ -893,5 +891,3 @@ constructor ( | ||
) : void; | ||
bound (name : string) : (rt : INode, ts : INode, value : string) => void; | ||
} | ||
} |
@@ -15,19 +15,13 @@ import { Binding } from "./binding"; | ||
constructor(node, name, value) { | ||
super(node, name, value); | ||
} | ||
/** | ||
* Generates a function which updates the attribute value | ||
* @param name {String} The name of attribute | ||
* @returns {Function} a function which will update attribute value | ||
*/ | ||
bound(name) { | ||
return function (node, value) { | ||
super(value); | ||
this.init((value) => { | ||
if (value) { | ||
node.app.$run.setAttribute(node.node, name, value); | ||
node.app.run.setAttribute(node.node, name, value); | ||
} | ||
else { | ||
node.app.$run.removeAttribute(node.node, name); | ||
node.app.run.removeAttribute(node.node, name); | ||
} | ||
}; | ||
}); | ||
this.seal(); | ||
} | ||
} |
import { Destroyable } from "../core/destroyable"; | ||
import { notOverwritten } from "../core/errors"; | ||
/** | ||
@@ -11,22 +10,13 @@ * Describe a common binding logic | ||
* Constructs a common binding logic | ||
* @param node {INode} the vasille node | ||
* @param name {String} the name of property/attribute/class | ||
* @param value {IValue} the value to bind | ||
*/ | ||
constructor(node, name, value) { | ||
constructor(value) { | ||
super(); | ||
this.updateFunc = this.bound(name).bind(null, node); | ||
this.binding = value; | ||
this.binding.on(this.updateFunc); | ||
this.updateFunc(this.binding.$); | ||
this.$seal(); | ||
this.seal(); | ||
} | ||
/** | ||
* Is a virtual function to get the specific bind function | ||
* @param name {String} the name of attribute/property | ||
* @returns {Function} a function to update attribute/property value | ||
* @throws Always throws and must be overloaded in child class | ||
*/ | ||
bound(name) { | ||
throw notOverwritten(); | ||
init(bounded) { | ||
this.func = bounded; | ||
this.binding.on(this.func); | ||
this.func(this.binding.$); | ||
} | ||
@@ -36,6 +26,6 @@ /** | ||
*/ | ||
$destroy() { | ||
this.binding.off(this.updateFunc); | ||
super.$destroy(); | ||
destroy() { | ||
this.binding.off(this.func); | ||
super.destroy(); | ||
} | ||
} |
import { Binding } from "./binding"; | ||
/** | ||
* Represents a HTML class binding description | ||
* @class ClassBinding | ||
* @extends Binding | ||
*/ | ||
export class ClassBinding extends Binding { | ||
/** | ||
* Constructs an HTML class binding description | ||
* @param node {INode} the vasille node | ||
* @param name {String} the name of class | ||
* @param value {IValue} the value to bind | ||
*/ | ||
function addClass(node, cl) { | ||
node.app.run.addClass(node.node, cl); | ||
} | ||
function removeClass(node, cl) { | ||
node.app.run.removeClass(node.node, cl); | ||
} | ||
export class StaticClassBinding extends Binding { | ||
constructor(node, name, value) { | ||
super(node, name, value); | ||
this.$seal(); | ||
super(value); | ||
this.current = false; | ||
this.init((value) => { | ||
if (value !== this.current) { | ||
if (value) { | ||
addClass(node, name); | ||
} | ||
else { | ||
removeClass(node, name); | ||
} | ||
this.current = value; | ||
} | ||
}); | ||
this.seal(); | ||
} | ||
/** | ||
* Generates a function which updates the html class value | ||
* @param name {String} The name of attribute | ||
* @returns {Function} a function which will update attribute value | ||
*/ | ||
bound(name) { | ||
let current = null; | ||
function addClass(node, cl) { | ||
node.app.$run.addClass(node.node, cl); | ||
} | ||
function removeClass(node, cl) { | ||
node.app.$run.removeClass(node.node, cl); | ||
} | ||
return (node, value) => { | ||
if (value !== current) { | ||
if (typeof current === "string" && current !== "") { | ||
removeClass(node, current); | ||
} | ||
export class DynamicalClassBinding extends Binding { | ||
constructor(node, value) { | ||
super(value); | ||
this.current = ""; | ||
this.init((value) => { | ||
if (this.current != value) { | ||
if (this.current.length) { | ||
removeClass(node, this.current); | ||
} | ||
if (typeof value === "boolean") { | ||
if (value) { | ||
addClass(node, name); | ||
} | ||
else { | ||
removeClass(node, name); | ||
} | ||
} | ||
else if (typeof value === "string" && value !== "") { | ||
if (value.length) { | ||
addClass(node, value); | ||
} | ||
current = value; | ||
this.current = value; | ||
} | ||
}; | ||
}); | ||
this.seal(); | ||
} | ||
} |
@@ -15,16 +15,10 @@ import { Binding } from "./binding"; | ||
constructor(node, name, value) { | ||
super(node, name, value); | ||
} | ||
/** | ||
* Generates a function to update style property value | ||
* @param name {string} | ||
* @returns {Function} a function to update style property | ||
*/ | ||
bound(name) { | ||
return function (node, value) { | ||
super(value); | ||
this.init((value) => { | ||
if (node.node instanceof HTMLElement) { | ||
node.app.$run.setStyle(node.node, name, value); | ||
node.app.run.setStyle(node.node, name, value); | ||
} | ||
}; | ||
}); | ||
this.seal(); | ||
} | ||
} |
import { Destroyable } from "./destroyable.js"; | ||
import { wrongBinding } from "./errors"; | ||
import { IValue } from "./ivalue.js"; | ||
import { Expression } from "../value/expression"; | ||
@@ -40,12 +39,14 @@ import { Reference } from "../value/reference"; | ||
this.frozen = false; | ||
this.$seal(); | ||
this.seal(); | ||
} | ||
$destroy() { | ||
destroy() { | ||
var _a; | ||
this.watch.forEach(value => value.$destroy()); | ||
this.watch.forEach(value => value.destroy()); | ||
this.watch.clear(); | ||
this.bindings.forEach(binding => binding.$destroy()); | ||
this.bindings.forEach(binding => binding.destroy()); | ||
this.bindings.clear(); | ||
(_a = this.freezeExpr) === null || _a === void 0 ? void 0 : _a.$destroy(); | ||
super.$destroy(); | ||
this.models.forEach(model => model.disableReactivity()); | ||
this.models.clear(); | ||
(_a = this.freezeExpr) === null || _a === void 0 ? void 0 : _a.destroy(); | ||
super.destroy(); | ||
} | ||
@@ -67,3 +68,3 @@ } | ||
*/ | ||
$ref(value) { | ||
ref(value) { | ||
const $ = this.$; | ||
@@ -78,3 +79,3 @@ const ref = new Reference(value); | ||
*/ | ||
$mirror(value) { | ||
mirror(value) { | ||
const mirror = new Mirror(value, false); | ||
@@ -88,3 +89,3 @@ this.$.watch.add(mirror); | ||
*/ | ||
$forward(value) { | ||
forward(value) { | ||
const mirror = new Mirror(value, true); | ||
@@ -99,10 +100,5 @@ this.$.watch.add(mirror); | ||
*/ | ||
$point(value, forwardOnly = false) { | ||
point(value, forwardOnly = false) { | ||
const $ = this.$; | ||
const ref = value instanceof IValue ? value : new Reference(value); | ||
const pointer = new Pointer(ref, forwardOnly); | ||
// when value is an ivalue will be equal to ref | ||
if (value !== ref) { | ||
$.watch.add(ref); | ||
} | ||
const pointer = new Pointer(value, forwardOnly); | ||
$.watch.add(pointer); | ||
@@ -115,11 +111,11 @@ return pointer; | ||
*/ | ||
$register(model) { | ||
register(model) { | ||
this.$.models.add(model); | ||
return model; | ||
} | ||
$watch(func, v1, v2, v3, v4, v5, v6, v7, v8, v9) { | ||
watch(func, v1, v2, v3, v4, v5, v6, v7, v8, v9) { | ||
const $ = this.$; | ||
$.watch.add(new Expression(func, !this.$.frozen, v1, v2, v3, v4, v5, v6, v7, v8, v9)); | ||
} | ||
$bind(func, v1, v2, v3, v4, v5, v6, v7, v8, v9) { | ||
bind(func, v1, v2, v3, v4, v5, v6, v7, v8, v9) { | ||
const res = new Expression(func, !this.$.frozen, v1, v2, v3, v4, v5, v6, v7, v8, v9); | ||
@@ -133,3 +129,3 @@ const $ = this.$; | ||
*/ | ||
$enable() { | ||
enable() { | ||
const $ = this.$; | ||
@@ -149,3 +145,3 @@ if (!$.enabled) { | ||
*/ | ||
$disable() { | ||
disable() { | ||
const $ = this.$; | ||
@@ -168,3 +164,3 @@ if ($.enabled) { | ||
*/ | ||
$bindAlive(cond, onOff, onOn) { | ||
bindAlive(cond, onOff, onOn) { | ||
const $ = this.$; | ||
@@ -181,7 +177,7 @@ if ($.freezeExpr) { | ||
onOn === null || onOn === void 0 ? void 0 : onOn(); | ||
this.$enable(); | ||
this.enable(); | ||
} | ||
else { | ||
onOff === null || onOff === void 0 ? void 0 : onOff(); | ||
this.$disable(); | ||
this.disable(); | ||
} | ||
@@ -191,7 +187,7 @@ }, true, cond); | ||
} | ||
$destroy() { | ||
super.$destroy(); | ||
this.$.$destroy(); | ||
destroy() { | ||
super.destroy(); | ||
this.$.destroy(); | ||
this.$ = null; | ||
} | ||
} |
@@ -10,3 +10,3 @@ /** | ||
*/ | ||
$seal() { | ||
seal() { | ||
const $ = this; | ||
@@ -43,5 +43,5 @@ Object.keys($).forEach(i => { | ||
*/ | ||
$destroy() { | ||
destroy() { | ||
// nothing here | ||
} | ||
} |
import { Destroyable } from "./destroyable.js"; | ||
import { notOverwritten } from "./errors"; | ||
export class Switchable extends Destroyable { | ||
/** | ||
* Enable update handlers triggering | ||
*/ | ||
enable() { | ||
throw notOverwritten(); | ||
} | ||
/** | ||
* disable update handlers triggering | ||
*/ | ||
disable() { | ||
throw notOverwritten(); | ||
} | ||
} | ||
/** | ||
@@ -8,3 +22,3 @@ * Interface which describes a value | ||
*/ | ||
export class IValue extends Destroyable { | ||
export class IValue extends Switchable { | ||
/** | ||
@@ -45,14 +59,2 @@ * @param isEnabled {boolean} initial is enabled state | ||
} | ||
/** | ||
* Enable update handlers triggering | ||
*/ | ||
enable() { | ||
throw notOverwritten(); | ||
} | ||
/** | ||
* disable update handlers triggering | ||
*/ | ||
disable() { | ||
throw notOverwritten(); | ||
} | ||
} |
@@ -14,4 +14,4 @@ import { instantExecutor, timeoutExecutor } from "../core/executor"; | ||
super(); | ||
this.$run = (options === null || options === void 0 ? void 0 : options.executor) || ((options === null || options === void 0 ? void 0 : options.freezeUi) === false ? timeoutExecutor : instantExecutor); | ||
this.$debugUi = (options === null || options === void 0 ? void 0 : options.debugUi) || false; | ||
this.run = (options === null || options === void 0 ? void 0 : options.executor) || ((options === null || options === void 0 ? void 0 : options.freezeUi) === false ? timeoutExecutor : instantExecutor); | ||
this.debugUi = (options === null || options === void 0 ? void 0 : options.debugUi) || false; | ||
} | ||
@@ -33,9 +33,9 @@ } | ||
this.$.node = node; | ||
this.$preinit(this, this); | ||
this.$seal(); | ||
this.preinit(this, this); | ||
this.seal(); | ||
} | ||
$$appendNode(node) { | ||
appendNode(node) { | ||
const $ = this.$; | ||
$.app.$run.appendChild($.node, node); | ||
this.run.appendChild($.node, node); | ||
} | ||
} |
@@ -52,4 +52,4 @@ import { Fragment } from "./node"; | ||
} | ||
$destroy() { | ||
super.$destroy(); | ||
destroy() { | ||
super.destroy(); | ||
this.signals.forEach(signal => { | ||
@@ -81,5 +81,5 @@ this.handlers.forEach(handler => { | ||
} | ||
$compose() { | ||
compose() { | ||
this.slot.release(this, this.interceptor); | ||
} | ||
} |
@@ -6,3 +6,3 @@ import { Reactive, ReactivePrivate } from "../core/core"; | ||
import { AttributeBinding } from "../binding/attribute"; | ||
import { ClassBinding } from "../binding/class"; | ||
import { StaticClassBinding, DynamicalClassBinding } from "../binding/class"; | ||
import { StyleBinding } from "../binding/style"; | ||
@@ -18,3 +18,3 @@ import { internalError, userError } from "../core/errors"; | ||
super(); | ||
this.$seal(); | ||
this.seal(); | ||
} | ||
@@ -33,6 +33,6 @@ /** | ||
*/ | ||
$destroy() { | ||
destroy() { | ||
this.next = null; | ||
this.prev = null; | ||
super.$destroy(); | ||
super.destroy(); | ||
} | ||
@@ -50,3 +50,3 @@ } | ||
constructor($) { | ||
super(); | ||
super($ || new FragmentPrivate); | ||
/** | ||
@@ -56,4 +56,4 @@ * The children list | ||
*/ | ||
this.$children = []; | ||
this.$ = $ || new FragmentPrivate; | ||
this.children = new Set; | ||
this.lastChild = null; | ||
} | ||
@@ -72,3 +72,3 @@ /** | ||
*/ | ||
$preinit(app, parent, data) { | ||
preinit(app, parent, data) { | ||
const $ = this.$; | ||
@@ -80,32 +80,27 @@ $.preinit(app, parent); | ||
*/ | ||
$init() { | ||
this.$createSignals(); | ||
this.$createWatchers(); | ||
this.$created(); | ||
this.$compose(); | ||
this.$mounted(); | ||
init() { | ||
this.createWatchers(); | ||
this.created(); | ||
this.compose(); | ||
this.mounted(); | ||
return this; | ||
} | ||
/** To be overloaded: created event handler */ | ||
$created() { | ||
created() { | ||
// empty | ||
} | ||
/** To be overloaded: mounted event handler */ | ||
$mounted() { | ||
mounted() { | ||
// empty | ||
} | ||
/** To be overloaded: ready event handler */ | ||
$ready() { | ||
ready() { | ||
// empty | ||
} | ||
/** To be overloaded: signals creation milestone */ | ||
$createSignals() { | ||
// empty | ||
} | ||
/** To be overloaded: watchers creation milestone */ | ||
$createWatchers() { | ||
createWatchers() { | ||
// empty | ||
} | ||
/** To be overloaded: DOM creation milestone */ | ||
$compose() { | ||
compose() { | ||
// empty | ||
@@ -118,13 +113,9 @@ } | ||
*/ | ||
$$pushNode(node) { | ||
let lastChild = null; | ||
if (this.$children.length) { | ||
lastChild = this.$children[this.$children.length - 1]; | ||
pushNode(node) { | ||
if (this.lastChild) { | ||
this.lastChild.$.next = node; | ||
} | ||
if (lastChild) { | ||
lastChild.$.next = node; | ||
} | ||
node.$.prev = lastChild; | ||
node.$.parent = this; | ||
this.$children.push(node); | ||
node.$.prev = this.lastChild; | ||
this.lastChild = node; | ||
this.children.add(node); | ||
} | ||
@@ -136,6 +127,6 @@ /** | ||
*/ | ||
$$findFirstChild() { | ||
findFirstChild() { | ||
let first; | ||
this.$children.forEach(child => { | ||
first = first || child.$$findFirstChild(); | ||
this.children.forEach(child => { | ||
first = first || child.findFirstChild(); | ||
}); | ||
@@ -148,9 +139,9 @@ return first; | ||
*/ | ||
$$appendNode(node) { | ||
appendNode(node) { | ||
const $ = this.$; | ||
if ($.next) { | ||
$.next.$$insertAdjacent(node); | ||
$.next.insertAdjacent(node); | ||
} | ||
else { | ||
$.parent.$$appendNode(node); | ||
$.parent.appendNode(node); | ||
} | ||
@@ -162,13 +153,13 @@ } | ||
*/ | ||
$$insertAdjacent(node) { | ||
const child = this.$$findFirstChild(); | ||
insertAdjacent(node) { | ||
const child = this.findFirstChild(); | ||
const $ = this.$; | ||
if (child) { | ||
$.app.$run.insertBefore(child, node); | ||
$.app.run.insertBefore(child, node); | ||
} | ||
else if ($.next) { | ||
$.next.$$insertAdjacent(node); | ||
$.next.insertAdjacent(node); | ||
} | ||
else { | ||
$.parent.$$appendNode(node); | ||
$.parent.appendNode(node); | ||
} | ||
@@ -181,36 +172,34 @@ } | ||
*/ | ||
$text(text, cb) { | ||
text(text, cb) { | ||
const $ = this.$; | ||
const node = new TextNode(); | ||
const textValue = text instanceof IValue ? text : this.$ref(text); | ||
node.$preinit($.app, this, textValue); | ||
this.$$pushNode(node); | ||
const textValue = text instanceof IValue ? text : this.ref(text); | ||
node.preinit($.app, this, textValue); | ||
this.pushNode(node); | ||
if (cb) { | ||
$.app.$run.callCallback(() => { | ||
$.app.run.callCallback(() => { | ||
cb(node); | ||
}); | ||
} | ||
return this; | ||
} | ||
$debug(text) { | ||
if (this.$.app.$debugUi) { | ||
debug(text) { | ||
if (this.$.app.debugUi) { | ||
const node = new DebugNode(); | ||
node.$preinit(this.$.app, this, text); | ||
this.$$pushNode(node); | ||
node.preinit(this.$.app, this, text); | ||
this.pushNode(node); | ||
} | ||
return this; | ||
} | ||
$tag(tagName, cb) { | ||
tag(tagName, cb) { | ||
const $ = this.$; | ||
const node = new Tag(); | ||
node.$preinit($.app, this, tagName); | ||
node.$init(); | ||
this.$$pushNode(node); | ||
$.app.$run.callCallback(() => { | ||
node.preinit($.app, this, tagName); | ||
node.init(); | ||
this.pushNode(node); | ||
$.app.run.callCallback(() => { | ||
if (cb) { | ||
cb(node, node.node); | ||
} | ||
node.$ready(); | ||
node.ready(); | ||
}); | ||
return this; | ||
} | ||
@@ -223,6 +212,6 @@ /** | ||
*/ | ||
$create(node, callback, callback1) { | ||
create(node, callback, callback1) { | ||
const $ = this.$; | ||
node.$.parent = this; | ||
node.$preinit($.app, this); | ||
node.preinit($.app, this); | ||
if (callback) { | ||
@@ -234,5 +223,4 @@ callback(node); | ||
} | ||
this.$$pushNode(node); | ||
node.$init().$ready(); | ||
return this; | ||
this.pushNode(node); | ||
node.init().ready(); | ||
} | ||
@@ -245,4 +233,4 @@ /** | ||
*/ | ||
$if(cond, cb) { | ||
return this.$switch({ cond, cb }); | ||
if(cond, cb) { | ||
return this.switch({ cond, cb }); | ||
} | ||
@@ -255,4 +243,4 @@ /** | ||
*/ | ||
$if_else(ifCond, ifCb, elseCb) { | ||
return this.$switch({ cond: ifCond, cb: ifCb }, { cond: trueIValue, cb: elseCb }); | ||
if_else(ifCond, ifCb, elseCb) { | ||
return this.switch({ cond: ifCond, cb: ifCb }, { cond: trueIValue, cb: elseCb }); | ||
} | ||
@@ -264,10 +252,10 @@ /** | ||
*/ | ||
$switch(...cases) { | ||
switch(...cases) { | ||
const $ = this.$; | ||
const node = new SwitchedNode(); | ||
node.$preinit($.app, this); | ||
node.$init(); | ||
this.$$pushNode(node); | ||
node.preinit($.app, this); | ||
node.init(); | ||
this.pushNode(node); | ||
node.setCases(cases); | ||
node.$ready(); | ||
node.ready(); | ||
return this; | ||
@@ -281,3 +269,3 @@ } | ||
*/ | ||
$case(cond, cb) { | ||
case(cond, cb) { | ||
return { cond, cb }; | ||
@@ -289,12 +277,38 @@ } | ||
*/ | ||
$default(cb) { | ||
default(cb) { | ||
return { cond: trueIValue, cb }; | ||
} | ||
$destroy() { | ||
for (const child of this.$children) { | ||
child.$destroy(); | ||
insertBefore(node) { | ||
const $ = this.$; | ||
node.$.prev = $.prev; | ||
node.$.next = this; | ||
if ($.prev) { | ||
$.prev.$.next = node; | ||
} | ||
this.$children.splice(0); | ||
super.$destroy(); | ||
$.prev = node; | ||
} | ||
insertAfter(node) { | ||
const $ = this.$; | ||
node.$.prev = this; | ||
node.$.next = $.next; | ||
$.next = node; | ||
} | ||
remove() { | ||
const $ = this.$; | ||
if ($.next) { | ||
$.next.$.prev = $.prev; | ||
} | ||
if ($.prev) { | ||
$.prev.$.next = $.next; | ||
} | ||
} | ||
destroy() { | ||
this.children.forEach(child => child.destroy()); | ||
this.children.clear(); | ||
this.lastChild = null; | ||
if (this.$.parent.lastChild === this) { | ||
this.$.parent.lastChild = this.$.prev; | ||
} | ||
super.destroy(); | ||
} | ||
} | ||
@@ -310,3 +324,3 @@ const trueIValue = new Reference(true); | ||
super(); | ||
this.$seal(); | ||
this.seal(); | ||
} | ||
@@ -324,3 +338,2 @@ /** | ||
}, true, text)); | ||
this.parent.$$appendNode(this.node); | ||
} | ||
@@ -330,4 +343,4 @@ /** | ||
*/ | ||
$destroy() { | ||
super.$destroy(); | ||
destroy() { | ||
super.destroy(); | ||
} | ||
@@ -341,8 +354,7 @@ } | ||
export class TextNode extends Fragment { | ||
constructor() { | ||
super(); | ||
this.$ = new TextNodePrivate(); | ||
this.$seal(); | ||
constructor($ = new TextNodePrivate()) { | ||
super($); | ||
this.seal(); | ||
} | ||
$preinit(app, parent, text) { | ||
preinit(app, parent, text) { | ||
const $ = this.$; | ||
@@ -353,10 +365,11 @@ if (!text) { | ||
$.preinitText(app, parent, text); | ||
$.parent.appendNode($.node); | ||
} | ||
$$findFirstChild() { | ||
findFirstChild() { | ||
return this.$.node; | ||
} | ||
$destroy() { | ||
destroy() { | ||
this.$.node.remove(); | ||
this.$.$destroy(); | ||
super.$destroy(); | ||
this.$.destroy(); | ||
super.destroy(); | ||
} | ||
@@ -377,6 +390,6 @@ } | ||
this.unmounted = false; | ||
this.$seal(); | ||
this.seal(); | ||
} | ||
$destroy() { | ||
super.$destroy(); | ||
destroy() { | ||
super.destroy(); | ||
} | ||
@@ -396,3 +409,3 @@ } | ||
super($ || new INodePrivate); | ||
this.$seal(); | ||
this.seal(); | ||
} | ||
@@ -408,18 +421,17 @@ /** | ||
*/ | ||
$init() { | ||
this.$createSignals(); | ||
this.$createWatchers(); | ||
this.$createAttrs(); | ||
this.$createStyle(); | ||
this.$created(); | ||
this.$compose(); | ||
this.$mounted(); | ||
init() { | ||
this.createWatchers(); | ||
this.createAttrs(); | ||
this.createStyle(); | ||
this.created(); | ||
this.compose(); | ||
this.mounted(); | ||
return this; | ||
} | ||
/** To be overloaded: attributes creation milestone */ | ||
$createAttrs() { | ||
createAttrs() { | ||
// empty | ||
} | ||
/** To be overloaded: $style attributes creation milestone */ | ||
$createStyle() { | ||
createStyle() { | ||
// empty | ||
@@ -432,13 +444,11 @@ } | ||
*/ | ||
$attr(name, value) { | ||
attr(name, value) { | ||
const $ = this.$; | ||
const attr = new AttributeBinding(this, name, value); | ||
$.bindings.add(attr); | ||
return this; | ||
} | ||
$bindAttr(name, calculator, v1, v2, v3, v4, v5, v6, v7, v8, v9) { | ||
bindAttr(name, calculator, v1, v2, v3, v4, v5, v6, v7, v8, v9) { | ||
const $ = this.$; | ||
const expr = this.$bind(calculator, v1, v2, v3, v4, v5, v6, v7, v8, v9); | ||
const expr = this.bind(calculator, v1, v2, v3, v4, v5, v6, v7, v8, v9); | ||
$.bindings.add(new AttributeBinding(this, name, expr)); | ||
return this; | ||
} | ||
@@ -450,4 +460,4 @@ /** | ||
*/ | ||
$setAttr(name, value) { | ||
this.$.app.$run.setAttribute(this.$.node, name, value); | ||
setAttr(name, value) { | ||
this.$.app.run.setAttribute(this.$.node, name, value); | ||
return this; | ||
@@ -459,4 +469,4 @@ } | ||
*/ | ||
$addClass(cl) { | ||
this.$.app.$run.addClass(this.$.node, cl); | ||
addClass(cl) { | ||
this.$.app.run.addClass(this.$.node, cl); | ||
return this; | ||
@@ -468,5 +478,5 @@ } | ||
*/ | ||
$addClasses(...cls) { | ||
addClasses(...cls) { | ||
cls.forEach(cl => { | ||
this.$.app.$run.addClass(this.$.node, cl); | ||
this.$.app.run.addClass(this.$.node, cl); | ||
}); | ||
@@ -479,5 +489,5 @@ return this; | ||
*/ | ||
$bindClass(className) { | ||
bindClass(className) { | ||
const $ = this.$; | ||
$.bindings.add(new ClassBinding(this, "", className)); | ||
$.bindings.add(new DynamicalClassBinding(this, className)); | ||
return this; | ||
@@ -490,4 +500,4 @@ } | ||
*/ | ||
$floatingClass(cond, className) { | ||
this.$.bindings.add(new ClassBinding(this, className, cond)); | ||
floatingClass(cond, className) { | ||
this.$.bindings.add(new StaticClassBinding(this, className, cond)); | ||
return this; | ||
@@ -500,3 +510,3 @@ } | ||
*/ | ||
$style(name, value) { | ||
style(name, value) { | ||
const $ = this.$; | ||
@@ -511,5 +521,5 @@ if ($.node instanceof HTMLElement) { | ||
} | ||
$bindStyle(name, calculator, v1, v2, v3, v4, v5, v6, v7, v8, v9) { | ||
bindStyle(name, calculator, v1, v2, v3, v4, v5, v6, v7, v8, v9) { | ||
const $ = this.$; | ||
const expr = this.$bind(calculator, v1, v2, v3, v4, v5, v6, v7, v8, v9); | ||
const expr = this.bind(calculator, v1, v2, v3, v4, v5, v6, v7, v8, v9); | ||
if ($.node instanceof HTMLElement) { | ||
@@ -528,5 +538,5 @@ $.bindings.add(new StyleBinding(this, name, expr)); | ||
*/ | ||
$setStyle(prop, value) { | ||
setStyle(prop, value) { | ||
if (this.$.node instanceof HTMLElement) { | ||
this.$.app.$run.setStyle(this.$.node, prop, value); | ||
this.$.app.run.setStyle(this.$.node, prop, value); | ||
} | ||
@@ -544,3 +554,3 @@ else { | ||
*/ | ||
$listen(name, handler, options) { | ||
listen(name, handler, options) { | ||
this.$.node.addEventListener(name, handler, options); | ||
@@ -553,4 +563,4 @@ return this; | ||
*/ | ||
$oncontextmenu(handler, options) { | ||
return this.$listen("contextmenu", handler, options); | ||
oncontextmenu(handler, options) { | ||
return this.listen("contextmenu", handler, options); | ||
} | ||
@@ -561,4 +571,4 @@ /** | ||
*/ | ||
$onmousedown(handler, options) { | ||
return this.$listen("mousedown", handler, options); | ||
onmousedown(handler, options) { | ||
return this.listen("mousedown", handler, options); | ||
} | ||
@@ -569,4 +579,4 @@ /** | ||
*/ | ||
$onmouseenter(handler, options) { | ||
return this.$listen("mouseenter", handler, options); | ||
onmouseenter(handler, options) { | ||
return this.listen("mouseenter", handler, options); | ||
} | ||
@@ -577,4 +587,4 @@ /** | ||
*/ | ||
$onmouseleave(handler, options) { | ||
return this.$listen("mouseleave", handler, options); | ||
onmouseleave(handler, options) { | ||
return this.listen("mouseleave", handler, options); | ||
} | ||
@@ -585,4 +595,4 @@ /** | ||
*/ | ||
$onmousemove(handler, options) { | ||
return this.$listen("mousemove", handler, options); | ||
onmousemove(handler, options) { | ||
return this.listen("mousemove", handler, options); | ||
} | ||
@@ -593,4 +603,4 @@ /** | ||
*/ | ||
$onmouseout(handler, options) { | ||
return this.$listen("mouseout", handler, options); | ||
onmouseout(handler, options) { | ||
return this.listen("mouseout", handler, options); | ||
} | ||
@@ -601,4 +611,4 @@ /** | ||
*/ | ||
$onmouseover(handler, options) { | ||
return this.$listen("mouseover", handler, options); | ||
onmouseover(handler, options) { | ||
return this.listen("mouseover", handler, options); | ||
} | ||
@@ -609,4 +619,4 @@ /** | ||
*/ | ||
$onmouseup(handler, options) { | ||
return this.$listen("mouseup", handler, options); | ||
onmouseup(handler, options) { | ||
return this.listen("mouseup", handler, options); | ||
} | ||
@@ -617,4 +627,4 @@ /** | ||
*/ | ||
$onclick(handler, options) { | ||
return this.$listen("click", handler, options); | ||
onclick(handler, options) { | ||
return this.listen("click", handler, options); | ||
} | ||
@@ -625,4 +635,4 @@ /** | ||
*/ | ||
$ondblclick(handler, options) { | ||
return this.$listen("dblclick", handler, options); | ||
ondblclick(handler, options) { | ||
return this.listen("dblclick", handler, options); | ||
} | ||
@@ -633,4 +643,4 @@ /** | ||
*/ | ||
$onblur(handler, options) { | ||
return this.$listen("blur", handler, options); | ||
onblur(handler, options) { | ||
return this.listen("blur", handler, options); | ||
} | ||
@@ -641,4 +651,4 @@ /** | ||
*/ | ||
$onfocus(handler, options) { | ||
return this.$listen("focus", handler, options); | ||
onfocus(handler, options) { | ||
return this.listen("focus", handler, options); | ||
} | ||
@@ -649,4 +659,4 @@ /** | ||
*/ | ||
$onfocusin(handler, options) { | ||
return this.$listen("focusin", handler, options); | ||
onfocusin(handler, options) { | ||
return this.listen("focusin", handler, options); | ||
} | ||
@@ -657,4 +667,4 @@ /** | ||
*/ | ||
$onfocusout(handler, options) { | ||
return this.$listen("focusout", handler, options); | ||
onfocusout(handler, options) { | ||
return this.listen("focusout", handler, options); | ||
} | ||
@@ -665,4 +675,4 @@ /** | ||
*/ | ||
$onkeydown(handler, options) { | ||
return this.$listen("keydown", handler, options); | ||
onkeydown(handler, options) { | ||
return this.listen("keydown", handler, options); | ||
} | ||
@@ -673,4 +683,4 @@ /** | ||
*/ | ||
$onkeyup(handler, options) { | ||
return this.$listen("keyup", handler, options); | ||
onkeyup(handler, options) { | ||
return this.listen("keyup", handler, options); | ||
} | ||
@@ -681,4 +691,4 @@ /** | ||
*/ | ||
$onkeypress(handler, options) { | ||
return this.$listen("keypress", handler, options); | ||
onkeypress(handler, options) { | ||
return this.listen("keypress", handler, options); | ||
} | ||
@@ -689,4 +699,4 @@ /** | ||
*/ | ||
$ontouchstart(handler, options) { | ||
return this.$listen("touchstart", handler, options); | ||
ontouchstart(handler, options) { | ||
return this.listen("touchstart", handler, options); | ||
} | ||
@@ -697,4 +707,4 @@ /** | ||
*/ | ||
$ontouchmove(handler, options) { | ||
return this.$listen("touchmove", handler, options); | ||
ontouchmove(handler, options) { | ||
return this.listen("touchmove", handler, options); | ||
} | ||
@@ -705,4 +715,4 @@ /** | ||
*/ | ||
$ontouchend(handler, options) { | ||
return this.$listen("touchend", handler, options); | ||
ontouchend(handler, options) { | ||
return this.listen("touchend", handler, options); | ||
} | ||
@@ -713,4 +723,4 @@ /** | ||
*/ | ||
$ontouchcancel(handler, options) { | ||
return this.$listen("touchcancel", handler, options); | ||
ontouchcancel(handler, options) { | ||
return this.listen("touchcancel", handler, options); | ||
} | ||
@@ -721,4 +731,4 @@ /** | ||
*/ | ||
$onwheel(handler, options) { | ||
return this.$listen("wheel", handler, options); | ||
onwheel(handler, options) { | ||
return this.listen("wheel", handler, options); | ||
} | ||
@@ -729,4 +739,4 @@ /** | ||
*/ | ||
$onabort(handler, options) { | ||
return this.$listen("abort", handler, options); | ||
onabort(handler, options) { | ||
return this.listen("abort", handler, options); | ||
} | ||
@@ -737,4 +747,4 @@ /** | ||
*/ | ||
$onerror(handler, options) { | ||
return this.$listen("error", handler, options); | ||
onerror(handler, options) { | ||
return this.listen("error", handler, options); | ||
} | ||
@@ -745,4 +755,4 @@ /** | ||
*/ | ||
$onload(handler, options) { | ||
return this.$listen("load", handler, options); | ||
onload(handler, options) { | ||
return this.listen("load", handler, options); | ||
} | ||
@@ -753,4 +763,4 @@ /** | ||
*/ | ||
$onloadend(handler, options) { | ||
return this.$listen("loadend", handler, options); | ||
onloadend(handler, options) { | ||
return this.listen("loadend", handler, options); | ||
} | ||
@@ -761,4 +771,4 @@ /** | ||
*/ | ||
$onloadstart(handler, options) { | ||
return this.$listen("loadstart", handler, options); | ||
onloadstart(handler, options) { | ||
return this.listen("loadstart", handler, options); | ||
} | ||
@@ -769,4 +779,4 @@ /** | ||
*/ | ||
$onprogress(handler, options) { | ||
return this.$listen("progress", handler, options); | ||
onprogress(handler, options) { | ||
return this.listen("progress", handler, options); | ||
} | ||
@@ -777,4 +787,4 @@ /** | ||
*/ | ||
$ontimeout(handler, options) { | ||
return this.$listen("timeout", handler, options); | ||
ontimeout(handler, options) { | ||
return this.listen("timeout", handler, options); | ||
} | ||
@@ -785,4 +795,4 @@ /** | ||
*/ | ||
$ondrag(handler, options) { | ||
return this.$listen("drag", handler, options); | ||
ondrag(handler, options) { | ||
return this.listen("drag", handler, options); | ||
} | ||
@@ -793,4 +803,4 @@ /** | ||
*/ | ||
$ondragend(handler, options) { | ||
return this.$listen("dragend", handler, options); | ||
ondragend(handler, options) { | ||
return this.listen("dragend", handler, options); | ||
} | ||
@@ -801,4 +811,4 @@ /** | ||
*/ | ||
$ondragenter(handler, options) { | ||
return this.$listen("dragenter", handler, options); | ||
ondragenter(handler, options) { | ||
return this.listen("dragenter", handler, options); | ||
} | ||
@@ -809,4 +819,4 @@ /** | ||
*/ | ||
$ondragexit(handler, options) { | ||
return this.$listen("dragexit", handler, options); | ||
ondragexit(handler, options) { | ||
return this.listen("dragexit", handler, options); | ||
} | ||
@@ -817,4 +827,4 @@ /** | ||
*/ | ||
$ondragleave(handler, options) { | ||
return this.$listen("dragleave", handler, options); | ||
ondragleave(handler, options) { | ||
return this.listen("dragleave", handler, options); | ||
} | ||
@@ -825,4 +835,4 @@ /** | ||
*/ | ||
$ondragover(handler, options) { | ||
return this.$listen("dragover", handler, options); | ||
ondragover(handler, options) { | ||
return this.listen("dragover", handler, options); | ||
} | ||
@@ -833,4 +843,4 @@ /** | ||
*/ | ||
$ondragstart(handler, options) { | ||
return this.$listen("dragstart", handler, options); | ||
ondragstart(handler, options) { | ||
return this.listen("dragstart", handler, options); | ||
} | ||
@@ -841,4 +851,4 @@ /** | ||
*/ | ||
$ondrop(handler, options) { | ||
return this.$listen("drop", handler, options); | ||
ondrop(handler, options) { | ||
return this.listen("drop", handler, options); | ||
} | ||
@@ -849,4 +859,4 @@ /** | ||
*/ | ||
$onpointerover(handler, options) { | ||
return this.$listen("pointerover", handler, options); | ||
onpointerover(handler, options) { | ||
return this.listen("pointerover", handler, options); | ||
} | ||
@@ -857,4 +867,4 @@ /** | ||
*/ | ||
$onpointerenter(handler, options) { | ||
return this.$listen("pointerenter", handler, options); | ||
onpointerenter(handler, options) { | ||
return this.listen("pointerenter", handler, options); | ||
} | ||
@@ -865,4 +875,4 @@ /** | ||
*/ | ||
$onpointerdown(handler, options) { | ||
return this.$listen("pointerdown", handler, options); | ||
onpointerdown(handler, options) { | ||
return this.listen("pointerdown", handler, options); | ||
} | ||
@@ -873,4 +883,4 @@ /** | ||
*/ | ||
$onpointermove(handler, options) { | ||
return this.$listen("pointermove", handler, options); | ||
onpointermove(handler, options) { | ||
return this.listen("pointermove", handler, options); | ||
} | ||
@@ -881,4 +891,4 @@ /** | ||
*/ | ||
$onpointerup(handler, options) { | ||
return this.$listen("pointerup", handler, options); | ||
onpointerup(handler, options) { | ||
return this.listen("pointerup", handler, options); | ||
} | ||
@@ -889,4 +899,4 @@ /** | ||
*/ | ||
$onpointercancel(handler, options) { | ||
return this.$listen("pointercancel", handler, options); | ||
onpointercancel(handler, options) { | ||
return this.listen("pointercancel", handler, options); | ||
} | ||
@@ -897,4 +907,4 @@ /** | ||
*/ | ||
$onpointerout(handler, options) { | ||
return this.$listen("pointerout", handler, options); | ||
onpointerout(handler, options) { | ||
return this.listen("pointerout", handler, options); | ||
} | ||
@@ -905,4 +915,4 @@ /** | ||
*/ | ||
$onpointerleave(handler, options) { | ||
return this.$listen("pointerleave", handler, options); | ||
onpointerleave(handler, options) { | ||
return this.listen("pointerleave", handler, options); | ||
} | ||
@@ -913,4 +923,4 @@ /** | ||
*/ | ||
$ongotpointercapture(handler, options) { | ||
return this.$listen("gotpointercapture", handler, options); | ||
ongotpointercapture(handler, options) { | ||
return this.listen("gotpointercapture", handler, options); | ||
} | ||
@@ -921,4 +931,4 @@ /** | ||
*/ | ||
$onlostpointercapture(handler, options) { | ||
return this.$listen("lostpointercapture", handler, options); | ||
onlostpointercapture(handler, options) { | ||
return this.listen("lostpointercapture", handler, options); | ||
} | ||
@@ -929,4 +939,4 @@ /** | ||
*/ | ||
$onanimationstart(handler, options) { | ||
return this.$listen("animationstart", handler, options); | ||
onanimationstart(handler, options) { | ||
return this.listen("animationstart", handler, options); | ||
} | ||
@@ -937,4 +947,4 @@ /** | ||
*/ | ||
$onanimationend(handler, options) { | ||
return this.$listen("animationend", handler, options); | ||
onanimationend(handler, options) { | ||
return this.listen("animationend", handler, options); | ||
} | ||
@@ -945,4 +955,4 @@ /** | ||
*/ | ||
$onanimationiteraton(handler, options) { | ||
return this.$listen("animationiteration", handler, options); | ||
onanimationiteraton(handler, options) { | ||
return this.listen("animationiteration", handler, options); | ||
} | ||
@@ -953,4 +963,4 @@ /** | ||
*/ | ||
$onclipboardchange(handler, options) { | ||
return this.$listen("clipboardchange", handler, options); | ||
onclipboardchange(handler, options) { | ||
return this.listen("clipboardchange", handler, options); | ||
} | ||
@@ -961,4 +971,4 @@ /** | ||
*/ | ||
$oncut(handler, options) { | ||
return this.$listen("cut", handler, options); | ||
oncut(handler, options) { | ||
return this.listen("cut", handler, options); | ||
} | ||
@@ -969,4 +979,4 @@ /** | ||
*/ | ||
$oncopy(handler, options) { | ||
return this.$listen("copy", handler, options); | ||
oncopy(handler, options) { | ||
return this.listen("copy", handler, options); | ||
} | ||
@@ -977,8 +987,8 @@ /** | ||
*/ | ||
$onpaste(handler, options) { | ||
return this.$listen("paste", handler, options); | ||
onpaste(handler, options) { | ||
return this.listen("paste", handler, options); | ||
} | ||
$$insertAdjacent(node) { | ||
insertAdjacent(node) { | ||
const $ = this.$; | ||
$.app.$run.insertBefore($.node, node); | ||
$.app.run.insertBefore($.node, node); | ||
} | ||
@@ -989,3 +999,3 @@ /** | ||
*/ | ||
$bindShow(cond) { | ||
bindShow(cond) { | ||
const $ = this.$; | ||
@@ -996,3 +1006,3 @@ const node = $.node; | ||
const htmlNode = node; | ||
return this.$bindAlive(cond, () => { | ||
return this.bindAlive(cond, () => { | ||
lastDisplay = htmlNode.style.display; | ||
@@ -1012,3 +1022,3 @@ htmlNode.style.display = 'none'; | ||
*/ | ||
$html(value) { | ||
html(value) { | ||
const $ = this.$; | ||
@@ -1018,3 +1028,3 @@ const node = $.node; | ||
node.innerHTML = value.$; | ||
this.$watch((v) => { | ||
this.watch((v) => { | ||
node.innerHTML = v; | ||
@@ -1036,5 +1046,5 @@ }, value); | ||
super(); | ||
this.$seal(); | ||
this.seal(); | ||
} | ||
$preinit(app, parent, tagName) { | ||
preinit(app, parent, tagName) { | ||
if (!tagName || typeof tagName !== "string") { | ||
@@ -1047,23 +1057,23 @@ throw internalError('wrong Tag::$preinit call'); | ||
$.node = node; | ||
$.parent.$$appendNode(node); | ||
$.parent.appendNode(node); | ||
} | ||
$$findFirstChild() { | ||
findFirstChild() { | ||
return this.$.unmounted ? null : this.$.node; | ||
} | ||
$$insertAdjacent(node) { | ||
insertAdjacent(node) { | ||
if (this.$.unmounted) { | ||
if (this.$.next) { | ||
this.$.next.$$insertAdjacent(node); | ||
this.$.next.insertAdjacent(node); | ||
} | ||
else { | ||
this.$.parent.$$appendNode(node); | ||
this.$.parent.appendNode(node); | ||
} | ||
} | ||
else { | ||
super.$$insertAdjacent(node); | ||
super.insertAdjacent(node); | ||
} | ||
} | ||
$$appendNode(node) { | ||
appendNode(node) { | ||
const $ = this.$; | ||
$.app.$run.appendChild($.node, node); | ||
$.app.run.appendChild($.node, node); | ||
} | ||
@@ -1074,17 +1084,12 @@ /** | ||
*/ | ||
$bindMount(cond) { | ||
bindMount(cond) { | ||
const $ = this.$; | ||
return this.$bindAlive(cond, () => { | ||
this.bindAlive(cond, () => { | ||
$.node.remove(); | ||
$.unmounted = true; | ||
}, () => { | ||
if (!$.unmounted) | ||
return; | ||
if ($.next) { | ||
$.next.$$insertAdjacent($.node); | ||
if ($.unmounted) { | ||
this.insertAdjacent($.node); | ||
$.unmounted = false; | ||
} | ||
else { | ||
$.parent.$$appendNode($.node); | ||
} | ||
$.unmounted = false; | ||
}); | ||
@@ -1095,5 +1100,5 @@ } | ||
*/ | ||
$destroy() { | ||
destroy() { | ||
this.node.remove(); | ||
super.$destroy(); | ||
super.destroy(); | ||
} | ||
@@ -1107,3 +1112,3 @@ } | ||
export class Extension extends INode { | ||
$preinit(app, parent) { | ||
preinit(app, parent) { | ||
if (parent instanceof INode) { | ||
@@ -1120,6 +1125,6 @@ const $ = this.$; | ||
super($); | ||
this.$seal(); | ||
this.seal(); | ||
} | ||
$destroy() { | ||
super.$destroy(); | ||
destroy() { | ||
super.destroy(); | ||
} | ||
@@ -1135,10 +1140,10 @@ } | ||
super(); | ||
this.$seal(); | ||
this.seal(); | ||
} | ||
$mounted() { | ||
super.$mounted(); | ||
if (this.$children.length !== 1) { | ||
mounted() { | ||
super.mounted(); | ||
if (this.children.size !== 1) { | ||
throw userError("Component must have a child only", "dom-error"); | ||
} | ||
const child = this.$children[0]; | ||
const child = this.lastChild; | ||
if (child instanceof Tag || child instanceof Component) { | ||
@@ -1152,3 +1157,3 @@ const $ = this.$; | ||
} | ||
$preinit(app, parent) { | ||
preinit(app, parent) { | ||
this.$.preinit(app, parent); | ||
@@ -1162,6 +1167,6 @@ } | ||
*/ | ||
export class SwitchedNodePrivate extends INodePrivate { | ||
export class SwitchedNodePrivate extends FragmentPrivate { | ||
constructor() { | ||
super(); | ||
this.$seal(); | ||
this.seal(); | ||
} | ||
@@ -1171,3 +1176,3 @@ /** | ||
*/ | ||
$destroy() { | ||
destroy() { | ||
this.cases.forEach(c => { | ||
@@ -1178,3 +1183,3 @@ delete c.cond; | ||
this.cases.splice(0); | ||
super.$destroy(); | ||
super.destroy(); | ||
} | ||
@@ -1202,6 +1207,6 @@ } | ||
} | ||
if ($.fragment) { | ||
$.fragment.$destroy(); | ||
this.$children.splice(0); | ||
$.fragment = null; | ||
if (this.lastChild) { | ||
this.lastChild.destroy(); | ||
this.children.clear(); | ||
this.lastChild = null; | ||
} | ||
@@ -1216,3 +1221,3 @@ if (i !== $.cases.length) { | ||
}; | ||
this.$seal(); | ||
this.seal(); | ||
} | ||
@@ -1233,12 +1238,10 @@ /** | ||
const node = new Fragment(); | ||
node.$preinit(this.$.app, this); | ||
node.$init(); | ||
node.$ready(); | ||
this.$.fragment = node; | ||
this.$children.push(node); | ||
node.preinit(this.$.app, this); | ||
node.init(); | ||
this.lastChild = node; | ||
this.children.add(node); | ||
cb(node); | ||
} | ||
$ready() { | ||
ready() { | ||
const $ = this.$; | ||
super.$ready(); | ||
$.cases.forEach(c => { | ||
@@ -1249,3 +1252,3 @@ c.cond.on($.sync); | ||
} | ||
$destroy() { | ||
destroy() { | ||
const $ = this.$; | ||
@@ -1255,3 +1258,3 @@ $.cases.forEach(c => { | ||
}); | ||
super.$destroy(); | ||
super.destroy(); | ||
} | ||
@@ -1265,3 +1268,3 @@ } | ||
super(); | ||
this.$seal(); | ||
this.seal(); | ||
} | ||
@@ -1280,3 +1283,3 @@ /** | ||
}, true, text)); | ||
this.parent.$$appendNode(this.node); | ||
this.parent.appendNode(this.node); | ||
} | ||
@@ -1286,5 +1289,5 @@ /** | ||
*/ | ||
$destroy() { | ||
destroy() { | ||
this.node.remove(); | ||
super.$destroy(); | ||
super.destroy(); | ||
} | ||
@@ -1305,5 +1308,5 @@ } | ||
this.$ = new DebugPrivate(); | ||
this.$seal(); | ||
this.seal(); | ||
} | ||
$preinit(app, parent, text) { | ||
preinit(app, parent, text) { | ||
const $ = this.$; | ||
@@ -1318,6 +1321,6 @@ if (!text) { | ||
*/ | ||
$destroy() { | ||
this.$.$destroy(); | ||
super.$destroy(); | ||
destroy() { | ||
this.$.destroy(); | ||
super.destroy(); | ||
} | ||
} |
@@ -12,17 +12,17 @@ import { Fragment } from "./node"; | ||
this.slot = new Slot; | ||
this.model = this.$ref(null); | ||
this.$seal(); | ||
this.model = this.ref(null); | ||
this.seal(); | ||
} | ||
$createWatchers() { | ||
this.$watch((value) => { | ||
this.$children.forEach(child => { | ||
child.$destroy(); | ||
createWatchers() { | ||
this.watch((value) => { | ||
this.children.forEach(child => { | ||
child.destroy(); | ||
}); | ||
this.$children.splice(0); | ||
this.children.clear(); | ||
this.slot.release(this, value); | ||
}, this.model); | ||
} | ||
$compose() { | ||
compose() { | ||
this.slot.release(this, this.model.$); | ||
} | ||
} |
@@ -40,3 +40,3 @@ import { Reference } from "./reference.js"; | ||
} | ||
this.$seal(); | ||
this.seal(); | ||
} | ||
@@ -77,3 +77,3 @@ get $() { | ||
} | ||
$destroy() { | ||
destroy() { | ||
this.disable(); | ||
@@ -83,4 +83,4 @@ this.values.splice(0); | ||
this.linkedFunc.splice(0); | ||
super.$destroy(); | ||
super.destroy(); | ||
} | ||
} |
@@ -22,3 +22,3 @@ import { Reference } from "./reference"; | ||
value.on(this.handler); | ||
this.$seal(); | ||
this.seal(); | ||
} | ||
@@ -32,2 +32,5 @@ get $() { | ||
set $(v) { | ||
if (!this.forwardOnly) { | ||
this.pointedValue.$ = v; | ||
} | ||
// this is a ts bug | ||
@@ -37,5 +40,2 @@ // eslint-disable-next-line | ||
super.$ = v; | ||
if (!this.forwardOnly) { | ||
this.pointedValue.$ = v; | ||
} | ||
} | ||
@@ -48,3 +48,2 @@ enable() { | ||
} | ||
return this; | ||
} | ||
@@ -56,8 +55,7 @@ disable() { | ||
} | ||
return this; | ||
} | ||
$destroy() { | ||
destroy() { | ||
this.disable(); | ||
super.$destroy(); | ||
super.destroy(); | ||
} | ||
} |
@@ -15,3 +15,3 @@ import { IValue } from "../core/ivalue"; | ||
this.onchange = new Set; | ||
this.$seal(); | ||
this.seal(); | ||
} | ||
@@ -38,20 +38,16 @@ get $() { | ||
} | ||
return this; | ||
} | ||
disable() { | ||
this.isEnabled = false; | ||
return this; | ||
} | ||
on(handler) { | ||
this.onchange.add(handler); | ||
return this; | ||
} | ||
off(handler) { | ||
this.onchange.delete(handler); | ||
return this; | ||
} | ||
$destroy() { | ||
super.$destroy(); | ||
destroy() { | ||
super.destroy(); | ||
this.onchange.clear(); | ||
} | ||
} |
@@ -15,8 +15,8 @@ import { BaseView } from "./base-view"; | ||
} | ||
$ready() { | ||
ready() { | ||
this.model.forEach(item => { | ||
this.createChild(item, item); | ||
}); | ||
super.$ready(); | ||
super.ready(); | ||
} | ||
} |
@@ -10,3 +10,3 @@ import { RepeatNode, RepeatNodePrivate } from "./repeat-node"; | ||
super(); | ||
this.$seal(); | ||
this.seal(); | ||
} | ||
@@ -30,3 +30,3 @@ } | ||
}; | ||
this.$seal(); | ||
this.seal(); | ||
} | ||
@@ -36,7 +36,7 @@ /** | ||
*/ | ||
$ready() { | ||
ready() { | ||
const $ = this.$; | ||
this.model.listener.onAdd($.addHandler); | ||
this.model.listener.onRemove($.removeHandler); | ||
super.$ready(); | ||
super.ready(); | ||
} | ||
@@ -46,8 +46,8 @@ /** | ||
*/ | ||
$destroy() { | ||
destroy() { | ||
const $ = this.$; | ||
this.model.listener.offAdd($.addHandler); | ||
this.model.listener.offRemove($.removeHandler); | ||
super.$destroy(); | ||
super.destroy(); | ||
} | ||
} |
@@ -12,3 +12,3 @@ import { BaseView } from "./base-view"; | ||
} | ||
$ready() { | ||
ready() { | ||
const map = this.model; | ||
@@ -18,4 +18,4 @@ map.forEach((value, key) => { | ||
}); | ||
super.$ready(); | ||
super.ready(); | ||
} | ||
} |
@@ -12,3 +12,3 @@ import { BaseView } from "./base-view"; | ||
} | ||
$ready() { | ||
ready() { | ||
const obj = this.model; | ||
@@ -18,4 +18,4 @@ for (const key in obj) { | ||
} | ||
super.$ready(); | ||
super.ready(); | ||
} | ||
} |
@@ -17,7 +17,7 @@ import { Fragment, INodePrivate } from "../node/node"; | ||
this.nodes = new Map(); | ||
this.$seal(); | ||
this.seal(); | ||
} | ||
$destroy() { | ||
destroy() { | ||
this.nodes.clear(); | ||
super.$destroy(); | ||
super.destroy(); | ||
} | ||
@@ -42,39 +42,23 @@ } | ||
const node = new Fragment(); | ||
// eslint-disable-next-line | ||
// @ts-ignore | ||
const $ = node.$; | ||
this.destroyChild(id, item); | ||
if (before) { | ||
$.next = before; | ||
// eslint-disable-next-line | ||
// @ts-ignore | ||
$.prev = before.$.prev; | ||
// eslint-disable-next-line | ||
// @ts-ignore | ||
before.$.prev = node; | ||
if ($.prev) { | ||
// eslint-disable-next-line | ||
// @ts-ignore | ||
$.prev.$.next = node; | ||
} | ||
this.$children.splice(this.$children.indexOf(before), 0, node); | ||
this.children.add(node); | ||
before.insertBefore(node); | ||
} | ||
else { | ||
const lastChild = this.$children[this.$children.length - 1]; | ||
const lastChild = this.lastChild; | ||
if (lastChild) { | ||
// eslint-disable-next-line | ||
// @ts-ignore | ||
lastChild.$.next = node; | ||
lastChild.insertAfter(node); | ||
} | ||
$.prev = lastChild; | ||
this.$children.push(node); | ||
this.children.add(node); | ||
} | ||
node.$preinit(this.$.app, this); | ||
node.$init(); | ||
this.lastChild = node; | ||
node.preinit(this.$.app, this); | ||
node.init(); | ||
const callback = () => { | ||
this.slot.release(node, item, id); | ||
node.$ready(); | ||
node.ready(); | ||
}; | ||
if (this.freezeUi) { | ||
this.$.app.$run.callCallback(callback); | ||
this.$.app.run.callCallback(callback); | ||
} | ||
@@ -90,20 +74,8 @@ else { | ||
if (child) { | ||
// eslint-disable-next-line | ||
// @ts-ignore | ||
const $ = child.$; | ||
if ($.prev) { | ||
// eslint-disable-next-line | ||
// @ts-ignore | ||
$.prev.$.next = $.next; | ||
} | ||
if ($.next) { | ||
// eslint-disable-next-line | ||
// @ts-ignore | ||
$.next.$.prev = $.prev; | ||
} | ||
child.$destroy(); | ||
child.remove(); | ||
child.destroy(); | ||
this.$.nodes.delete(id); | ||
this.$children.splice(this.$children.indexOf(child), 1); | ||
this.children.delete(child); | ||
} | ||
} | ||
} |
@@ -15,3 +15,3 @@ import { RepeatNode, RepeatNodePrivate } from "./repeat-node"; | ||
this.currentCount = 0; | ||
this.$seal(); | ||
this.seal(); | ||
} | ||
@@ -31,3 +31,3 @@ } | ||
this.count = new Reference(0); | ||
this.$seal(); | ||
this.seal(); | ||
} | ||
@@ -51,16 +51,16 @@ /** | ||
} | ||
$created() { | ||
created() { | ||
const $ = this.$; | ||
super.$created(); | ||
super.created(); | ||
$.updateHandler = this.changeCount.bind(this); | ||
this.count.on($.updateHandler); | ||
} | ||
$ready() { | ||
ready() { | ||
this.changeCount(this.count.$); | ||
} | ||
$destroy() { | ||
destroy() { | ||
const $ = this.$; | ||
super.$destroy(); | ||
super.destroy(); | ||
this.count.off($.updateHandler); | ||
} | ||
} |
@@ -12,12 +12,12 @@ import { BaseView } from "./base-view"; | ||
} | ||
$ready() { | ||
ready() { | ||
const $ = this.$; | ||
const set = this.model; | ||
set.forEach(item => { | ||
$.app.$run.callCallback(() => { | ||
$.app.run.callCallback(() => { | ||
this.createChild(item, item); | ||
}); | ||
}); | ||
super.$ready(); | ||
super.ready(); | ||
} | ||
} |
@@ -6,3 +6,3 @@ { | ||
"types": "types/index.d.ts", | ||
"version": "2.0.4", | ||
"version": "2.0.5", | ||
"exports": { | ||
@@ -9,0 +9,0 @@ "import": "./lib/index.js", |
@@ -38,5 +38,5 @@ # Vasille | ||
### Getting ready be example | ||
* JavaScript Example | ||
* TypeScript Example | ||
* Flow.js Example | ||
* [JavaScript Example](https://gitlab.com/vasille-js/learning/vasille-js-example) | ||
* [TypeScript Example](https://gitlab.com/vasille-js/learning/vasille-ts-example) | ||
* [Flow.js Example](https://gitlab.com/vasille-js/learning/vasille-flow-js-example) | ||
@@ -43,0 +43,0 @@ ### Flow.js typedef |
@@ -17,8 +17,2 @@ import { Binding } from "./binding"; | ||
constructor(node: INode, name: string, value: IValue<string>); | ||
/** | ||
* Generates a function which updates the attribute value | ||
* @param name {String} The name of attribute | ||
* @returns {Function} a function which will update attribute value | ||
*/ | ||
protected bound(name: string): (node: INode, value: string) => void; | ||
} |
import { Destroyable } from "../core/destroyable"; | ||
import type { IValue } from "../core/ivalue"; | ||
import type { INode } from "../node/node"; | ||
/** | ||
@@ -11,21 +10,13 @@ * Describe a common binding logic | ||
private binding; | ||
private readonly updateFunc; | ||
private func; | ||
/** | ||
* Constructs a common binding logic | ||
* @param node {INode} the vasille node | ||
* @param name {String} the name of property/attribute/class | ||
* @param value {IValue} the value to bind | ||
*/ | ||
constructor(node: INode, name: string, value: IValue<T>); | ||
constructor(value: IValue<T>); | ||
protected init(bounded: (v: T) => void): void; | ||
/** | ||
* Is a virtual function to get the specific bind function | ||
* @param name {String} the name of attribute/property | ||
* @returns {Function} a function to update attribute/property value | ||
* @throws Always throws and must be overloaded in child class | ||
*/ | ||
protected bound(name: string): (node: INode, value: T) => void; | ||
/** | ||
* Just clear bindings | ||
*/ | ||
$destroy(): void; | ||
destroy(): void; | ||
} |
import { Binding } from "./binding"; | ||
import type { INode } from "../node/node"; | ||
import type { IValue } from "../core/ivalue"; | ||
/** | ||
* Represents a HTML class binding description | ||
* @class ClassBinding | ||
* @extends Binding | ||
*/ | ||
export declare class ClassBinding extends Binding<string | boolean> { | ||
/** | ||
* Constructs an HTML class binding description | ||
* @param node {INode} the vasille node | ||
* @param name {String} the name of class | ||
* @param value {IValue} the value to bind | ||
*/ | ||
constructor(node: INode, name: string, value: IValue<string | boolean>); | ||
/** | ||
* Generates a function which updates the html class value | ||
* @param name {String} The name of attribute | ||
* @returns {Function} a function which will update attribute value | ||
*/ | ||
protected bound(name: string): (node: INode, value: string | boolean) => void; | ||
export declare class StaticClassBinding extends Binding<boolean> { | ||
private current; | ||
constructor(node: INode, name: string, value: IValue<boolean>); | ||
} | ||
export declare class DynamicalClassBinding extends Binding<string> { | ||
private current; | ||
constructor(node: INode, value: IValue<string>); | ||
} |
@@ -17,8 +17,2 @@ import { Binding } from "./binding"; | ||
constructor(node: INode, name: string, value: IValue<string>); | ||
/** | ||
* Generates a function to update style property value | ||
* @param name {string} | ||
* @returns {Function} a function to update style property | ||
*/ | ||
protected bound(name: string): (node: INode, value: string) => void; | ||
} |
import { Destroyable } from "./destroyable.js"; | ||
import { IValue } from "./ivalue.js"; | ||
import { IValue, Switchable } from "./ivalue.js"; | ||
import { Expression } from "../value/expression"; | ||
@@ -17,3 +17,3 @@ import { Pointer } from "../value/pointer"; | ||
*/ | ||
watch: Set<IValue<unknown>>; | ||
watch: Set<Switchable>; | ||
/** | ||
@@ -27,3 +27,3 @@ * A list of user-defined bindings | ||
*/ | ||
models: Set<IModel<any, any>>; | ||
models: Set<IModel>; | ||
/** | ||
@@ -45,3 +45,3 @@ * Reactivity switch state | ||
constructor(); | ||
$destroy(): void; | ||
destroy(): void; | ||
} | ||
@@ -64,3 +64,3 @@ /** | ||
*/ | ||
$ref<T>(value: T): IValue<T>; | ||
ref<T>(value: T): IValue<T>; | ||
/** | ||
@@ -70,3 +70,3 @@ * Create a mirror | ||
*/ | ||
$mirror<T>(value: IValue<T>): Mirror<T>; | ||
mirror<T>(value: IValue<T>): Mirror<T>; | ||
/** | ||
@@ -76,3 +76,3 @@ * Create a forward-only mirror | ||
*/ | ||
$forward<T>(value: IValue<T>): Mirror<T>; | ||
forward<T>(value: IValue<T>): Mirror<T>; | ||
/** | ||
@@ -83,3 +83,3 @@ * Creates a pointer | ||
*/ | ||
$point<T>(value: T | IValue<T>, forwardOnly?: boolean): Pointer<T>; | ||
point<T>(value: IValue<T>, forwardOnly?: boolean): Pointer<T>; | ||
/** | ||
@@ -89,3 +89,3 @@ * Register a model | ||
*/ | ||
$register<T extends IModel<any, any>>(model: T): T; | ||
register<T extends IModel>(model: T): T; | ||
/** | ||
@@ -104,11 +104,11 @@ * Creates a watcher | ||
*/ | ||
$watch<T1>(func: (a1: T1) => void, v1: IValue<T1>): any; | ||
$watch<T1, T2>(func: (a1: T1, a2: T2) => void, v1: IValue<T1>, v2: IValue<T2>): any; | ||
$watch<T1, T2, T3>(func: (a1: T1, a2: T2, a3: T3) => void, v1: IValue<T1>, v2: IValue<T2>, v3: IValue<T3>): any; | ||
$watch<T1, T2, T3, T4>(func: (a1: T1, a2: T2, a3: T3, a4: T4) => void, v1: IValue<T1>, v2: IValue<T2>, v3: IValue<T3>, v4: IValue<T4>): any; | ||
$watch<T1, T2, T3, T4, T5>(func: (a1: T1, a2: T2, a3: T3, a4: T4, a5: T5) => void, v1: IValue<T1>, v2: IValue<T2>, v3: IValue<T3>, v4: IValue<T4>, v5: IValue<T5>): any; | ||
$watch<T1, T2, T3, T4, T5, T6>(func: (a1: T1, a2: T2, a3: T3, a4: T4, a5: T5, a6: T6) => void, v1: IValue<T1>, v2: IValue<T2>, v3: IValue<T3>, v4: IValue<T4>, v5: IValue<T5>, v6: IValue<T6>): any; | ||
$watch<T1, T2, T3, T4, T5, T6, T7>(func: (a1: T1, a2: T2, a3: T3, a4: T4, a5: T5, a6: T6, a7: T7) => void, v1: IValue<T1>, v2: IValue<T2>, v3: IValue<T3>, v4: IValue<T4>, v5: IValue<T5>, v6: IValue<T6>, v7: IValue<T7>): any; | ||
$watch<T1, T2, T3, T4, T5, T6, T7, T8>(func: (a1: T1, a2: T2, a3: T3, a4: T4, a5: T5, a6: T6, a7: T7, a8: T8) => void, v1: IValue<T1>, v2: IValue<T2>, v3: IValue<T3>, v4: IValue<T4>, v5: IValue<T5>, v6: IValue<T6>, v7: IValue<T7>, v8: IValue<T8>): any; | ||
$watch<T1, T2, T3, T4, T5, T6, T7, T8, T9>(func: (a1: T1, a2: T2, a3: T3, a4: T4, a5: T5, a6: T6, a7: T7, a8: T8, a9: T9) => void, v1: IValue<T1>, v2: IValue<T2>, v3: IValue<T3>, v4: IValue<T4>, v5: IValue<T5>, v6: IValue<T6>, v7: IValue<T7>, v8: IValue<T8>, v9: IValue<T9>): any; | ||
watch<T1>(func: (a1: T1) => void, v1: IValue<T1>): any; | ||
watch<T1, T2>(func: (a1: T1, a2: T2) => void, v1: IValue<T1>, v2: IValue<T2>): any; | ||
watch<T1, T2, T3>(func: (a1: T1, a2: T2, a3: T3) => void, v1: IValue<T1>, v2: IValue<T2>, v3: IValue<T3>): any; | ||
watch<T1, T2, T3, T4>(func: (a1: T1, a2: T2, a3: T3, a4: T4) => void, v1: IValue<T1>, v2: IValue<T2>, v3: IValue<T3>, v4: IValue<T4>): any; | ||
watch<T1, T2, T3, T4, T5>(func: (a1: T1, a2: T2, a3: T3, a4: T4, a5: T5) => void, v1: IValue<T1>, v2: IValue<T2>, v3: IValue<T3>, v4: IValue<T4>, v5: IValue<T5>): any; | ||
watch<T1, T2, T3, T4, T5, T6>(func: (a1: T1, a2: T2, a3: T3, a4: T4, a5: T5, a6: T6) => void, v1: IValue<T1>, v2: IValue<T2>, v3: IValue<T3>, v4: IValue<T4>, v5: IValue<T5>, v6: IValue<T6>): any; | ||
watch<T1, T2, T3, T4, T5, T6, T7>(func: (a1: T1, a2: T2, a3: T3, a4: T4, a5: T5, a6: T6, a7: T7) => void, v1: IValue<T1>, v2: IValue<T2>, v3: IValue<T3>, v4: IValue<T4>, v5: IValue<T5>, v6: IValue<T6>, v7: IValue<T7>): any; | ||
watch<T1, T2, T3, T4, T5, T6, T7, T8>(func: (a1: T1, a2: T2, a3: T3, a4: T4, a5: T5, a6: T6, a7: T7, a8: T8) => void, v1: IValue<T1>, v2: IValue<T2>, v3: IValue<T3>, v4: IValue<T4>, v5: IValue<T5>, v6: IValue<T6>, v7: IValue<T7>, v8: IValue<T8>): any; | ||
watch<T1, T2, T3, T4, T5, T6, T7, T8, T9>(func: (a1: T1, a2: T2, a3: T3, a4: T4, a5: T5, a6: T6, a7: T7, a8: T8, a9: T9) => void, v1: IValue<T1>, v2: IValue<T2>, v3: IValue<T3>, v4: IValue<T4>, v5: IValue<T5>, v6: IValue<T6>, v7: IValue<T7>, v8: IValue<T8>, v9: IValue<T9>): any; | ||
/** | ||
@@ -128,19 +128,19 @@ * Creates a computed value | ||
*/ | ||
$bind<T, T1>(func: (a1: T1) => T, v1: IValue<T1>): IValue<T>; | ||
$bind<T, T1, T2>(func: (a1: T1, a2: T2) => T, v1: IValue<T1>, v2: IValue<T2>): IValue<T>; | ||
$bind<T, T1, T2, T3>(func: (a1: T1, a2: T2, a3: T3) => T, v1: IValue<T1>, v2: IValue<T2>, v3: IValue<T3>): IValue<T>; | ||
$bind<T, T1, T2, T3, T4>(func: (a1: T1, a2: T2, a3: T3, a4: T4) => T, v1: IValue<T1>, v2: IValue<T2>, v3: IValue<T3>, v4: IValue<T4>): IValue<T>; | ||
$bind<T, T1, T2, T3, T4, T5>(func: (a1: T1, a2: T2, a3: T3, a4: T4, a5: T5) => T, v1: IValue<T1>, v2: IValue<T2>, v3: IValue<T3>, v4: IValue<T4>, v5: IValue<T5>): IValue<T>; | ||
$bind<T, T1, T2, T3, T4, T5, T6>(func: (a1: T1, a2: T2, a3: T3, a4: T4, a5: T5, a6: T6) => T, v1: IValue<T1>, v2: IValue<T2>, v3: IValue<T3>, v4: IValue<T4>, v5: IValue<T5>, v6: IValue<T6>): IValue<T>; | ||
$bind<T, T1, T2, T3, T4, T5, T6, T7>(func: (a1: T1, a2: T2, a3: T3, a4: T4, a5: T5, a6: T6, a7: T7) => T, v1: IValue<T1>, v2: IValue<T2>, v3: IValue<T3>, v4: IValue<T4>, v5: IValue<T5>, v6: IValue<T6>, v7: IValue<T7>): IValue<T>; | ||
$bind<T, T1, T2, T3, T4, T5, T6, T7, T8>(func: (a1: T1, a2: T2, a3: T3, a4: T4, a5: T5, a6: T6, a7: T7, a8: T8) => T, v1: IValue<T1>, v2: IValue<T2>, v3: IValue<T3>, v4: IValue<T4>, v5: IValue<T5>, v6: IValue<T6>, v7: IValue<T7>, v8: IValue<T8>): IValue<T>; | ||
$bind<T, T1, T2, T3, T4, T5, T6, T7, T8, T9>(func: (a1: T1, a2: T2, a3: T3, a4: T4, a5: T5, a6: T6, a7: T7, a8: T8, a9: T9) => T, v1: IValue<T1>, v2: IValue<T2>, v3: IValue<T3>, v4: IValue<T4>, v5: IValue<T5>, v6: IValue<T6>, v7: IValue<T7>, v8: IValue<T8>, v9: IValue<T9>): IValue<T>; | ||
bind<T, T1>(func: (a1: T1) => T, v1: IValue<T1>): IValue<T>; | ||
bind<T, T1, T2>(func: (a1: T1, a2: T2) => T, v1: IValue<T1>, v2: IValue<T2>): IValue<T>; | ||
bind<T, T1, T2, T3>(func: (a1: T1, a2: T2, a3: T3) => T, v1: IValue<T1>, v2: IValue<T2>, v3: IValue<T3>): IValue<T>; | ||
bind<T, T1, T2, T3, T4>(func: (a1: T1, a2: T2, a3: T3, a4: T4) => T, v1: IValue<T1>, v2: IValue<T2>, v3: IValue<T3>, v4: IValue<T4>): IValue<T>; | ||
bind<T, T1, T2, T3, T4, T5>(func: (a1: T1, a2: T2, a3: T3, a4: T4, a5: T5) => T, v1: IValue<T1>, v2: IValue<T2>, v3: IValue<T3>, v4: IValue<T4>, v5: IValue<T5>): IValue<T>; | ||
bind<T, T1, T2, T3, T4, T5, T6>(func: (a1: T1, a2: T2, a3: T3, a4: T4, a5: T5, a6: T6) => T, v1: IValue<T1>, v2: IValue<T2>, v3: IValue<T3>, v4: IValue<T4>, v5: IValue<T5>, v6: IValue<T6>): IValue<T>; | ||
bind<T, T1, T2, T3, T4, T5, T6, T7>(func: (a1: T1, a2: T2, a3: T3, a4: T4, a5: T5, a6: T6, a7: T7) => T, v1: IValue<T1>, v2: IValue<T2>, v3: IValue<T3>, v4: IValue<T4>, v5: IValue<T5>, v6: IValue<T6>, v7: IValue<T7>): IValue<T>; | ||
bind<T, T1, T2, T3, T4, T5, T6, T7, T8>(func: (a1: T1, a2: T2, a3: T3, a4: T4, a5: T5, a6: T6, a7: T7, a8: T8) => T, v1: IValue<T1>, v2: IValue<T2>, v3: IValue<T3>, v4: IValue<T4>, v5: IValue<T5>, v6: IValue<T6>, v7: IValue<T7>, v8: IValue<T8>): IValue<T>; | ||
bind<T, T1, T2, T3, T4, T5, T6, T7, T8, T9>(func: (a1: T1, a2: T2, a3: T3, a4: T4, a5: T5, a6: T6, a7: T7, a8: T8, a9: T9) => T, v1: IValue<T1>, v2: IValue<T2>, v3: IValue<T3>, v4: IValue<T4>, v5: IValue<T5>, v6: IValue<T6>, v7: IValue<T7>, v8: IValue<T8>, v9: IValue<T9>): IValue<T>; | ||
/** | ||
* Enable reactivity of fields | ||
*/ | ||
$enable(): void; | ||
enable(): void; | ||
/** | ||
* Disable reactivity of fields | ||
*/ | ||
$disable(): void; | ||
disable(): void; | ||
/** | ||
@@ -152,4 +152,4 @@ * Disable/Enable reactivity of object fields with feedback | ||
*/ | ||
$bindAlive(cond: IValue<boolean>, onOff?: () => void, onOn?: () => void): this; | ||
$destroy(): void; | ||
bindAlive(cond: IValue<boolean>, onOff?: () => void, onOn?: () => void): this; | ||
destroy(): void; | ||
} |
@@ -10,7 +10,7 @@ /** | ||
*/ | ||
protected $seal(): void; | ||
protected seal(): void; | ||
/** | ||
* Garbage collector method | ||
*/ | ||
$destroy(): void; | ||
destroy(): void; | ||
} |
import { Destroyable } from "./destroyable.js"; | ||
export declare class Switchable extends Destroyable { | ||
/** | ||
* Enable update handlers triggering | ||
*/ | ||
enable(): void; | ||
/** | ||
* disable update handlers triggering | ||
*/ | ||
disable(): void; | ||
} | ||
/** | ||
@@ -7,3 +17,3 @@ * Interface which describes a value | ||
*/ | ||
export declare class IValue<T> extends Destroyable { | ||
export declare class IValue<T> extends Switchable { | ||
/** | ||
@@ -32,3 +42,3 @@ * Is enabled state flag | ||
*/ | ||
on(handler: (value: T) => void): this; | ||
on(handler: (value: T) => void): void; | ||
/** | ||
@@ -38,11 +48,3 @@ * Removes a handler of value change | ||
*/ | ||
off(handler: (value: T) => void): this; | ||
/** | ||
* Enable update handlers triggering | ||
*/ | ||
enable(): this; | ||
/** | ||
* disable update handlers triggering | ||
*/ | ||
disable(): this; | ||
off(handler: (value: T) => void): void; | ||
} |
import { Listener } from "./listener"; | ||
import type { IModel } from "./model"; | ||
import { ListenableModel } from "./model"; | ||
/** | ||
@@ -8,3 +8,3 @@ * Model based on Array class | ||
*/ | ||
export declare class ArrayModel<T> extends Array<T> implements IModel<T, T> { | ||
export declare class ArrayModel<T> extends Array<T> implements ListenableModel<T, T> { | ||
listener: Listener<T, T>; | ||
@@ -11,0 +11,0 @@ /** |
import { Listener } from "./listener"; | ||
import type { IModel } from "./model"; | ||
import { ListenableModel } from "./model"; | ||
/** | ||
@@ -9,3 +9,3 @@ * A Map based memory | ||
*/ | ||
export declare class MapModel<K, T> extends Map<K, T> implements IModel<K, T> { | ||
export declare class MapModel<K, T> extends Map<K, T> implements ListenableModel<K, T> { | ||
listener: Listener<T, K>; | ||
@@ -12,0 +12,0 @@ /** |
@@ -5,3 +5,3 @@ import { Listener } from "./listener"; | ||
*/ | ||
export interface IModel<K, T> { | ||
export interface IModel { | ||
/** | ||
@@ -15,2 +15,4 @@ * Enable the reactivity of model | ||
disableReactivity(): void; | ||
} | ||
export interface ListenableModel<K, T> extends IModel { | ||
/** | ||
@@ -17,0 +19,0 @@ * The listener of model |
import { Listener } from "./listener"; | ||
import type { IModel } from "./model"; | ||
import { ListenableModel } from "./model"; | ||
/** | ||
@@ -7,3 +7,3 @@ * Object based model | ||
*/ | ||
export declare class ObjectModel<T> extends Object implements IModel<string, T> { | ||
export declare class ObjectModel<T> extends Object implements ListenableModel<string, T> { | ||
listener: Listener<T, string>; | ||
@@ -10,0 +10,0 @@ /** |
import { Listener } from "./listener"; | ||
import type { IModel } from "./model"; | ||
import { ListenableModel } from "./model"; | ||
/** | ||
@@ -9,3 +9,3 @@ * A Set based model | ||
*/ | ||
export declare class SetModel<T> extends Set<T> implements IModel<T, T> { | ||
export declare class SetModel<T> extends Set<T> implements ListenableModel<T, T> { | ||
listener: Listener<T, T>; | ||
@@ -12,0 +12,0 @@ /** |
@@ -18,7 +18,7 @@ import { Executor } from "../core/executor"; | ||
*/ | ||
$run: Executor; | ||
run: Executor; | ||
/** | ||
* Enables debug comments | ||
*/ | ||
$debugUi: boolean; | ||
debugUi: boolean; | ||
/** | ||
@@ -41,4 +41,4 @@ * @param options {Object} Application options | ||
constructor(node: Element, options?: AppOptions); | ||
$$appendNode(node: Node): void; | ||
appendNode(node: Node): void; | ||
} | ||
export {}; |
@@ -31,3 +31,3 @@ import { Fragment } from "./node"; | ||
disconnect(handler: (a1: t1, a2: t2, a3: t3, a4: t4, a5: t5, a6: t6, a7: t7, a8: t8, a9: t9) => void): void; | ||
$destroy(): void; | ||
destroy(): void; | ||
} | ||
@@ -50,3 +50,3 @@ /** | ||
slot: Slot<Fragment, Interceptor<t1, t2, t3, t4, t5, t6, t7, t8, t9>>; | ||
$compose(): void; | ||
compose(): void; | ||
} |
@@ -40,3 +40,3 @@ import { Reactive, ReactivePrivate } from "../core/core"; | ||
*/ | ||
$destroy(): void; | ||
destroy(): void; | ||
} | ||
@@ -57,3 +57,4 @@ /** | ||
*/ | ||
$children: Array<Fragment>; | ||
children: Set<Fragment>; | ||
lastChild: any; | ||
/** | ||
@@ -74,19 +75,17 @@ * Constructs a Vasille Node | ||
*/ | ||
$preinit(app: AppNode, parent: Fragment, data?: unknown): void; | ||
preinit(app: AppNode, parent: Fragment, data?: unknown): void; | ||
/** | ||
* Initialize node | ||
*/ | ||
$init(): this; | ||
init(): this; | ||
/** To be overloaded: created event handler */ | ||
$created(): void; | ||
created(): void; | ||
/** To be overloaded: mounted event handler */ | ||
$mounted(): void; | ||
mounted(): void; | ||
/** To be overloaded: ready event handler */ | ||
$ready(): void; | ||
/** To be overloaded: signals creation milestone */ | ||
$createSignals(): void; | ||
ready(): void; | ||
/** To be overloaded: watchers creation milestone */ | ||
$createWatchers(): void; | ||
createWatchers(): void; | ||
/** To be overloaded: DOM creation milestone */ | ||
$compose(): void; | ||
compose(): void; | ||
/** | ||
@@ -97,3 +96,3 @@ * Pushes a node to children immediately | ||
*/ | ||
protected $$pushNode(node: Fragment): void; | ||
protected pushNode(node: Fragment): void; | ||
/** | ||
@@ -104,3 +103,3 @@ * Find first node in element if so exists | ||
*/ | ||
protected $$findFirstChild(): Node; | ||
protected findFirstChild(): Node; | ||
/** | ||
@@ -110,3 +109,3 @@ * Append a node to end of element | ||
*/ | ||
$$appendNode(node: Node): void; | ||
appendNode(node: Node): void; | ||
/** | ||
@@ -116,3 +115,3 @@ * Insert a node as a sibling of this | ||
*/ | ||
$$insertAdjacent(node: Node): void; | ||
insertAdjacent(node: Node): void; | ||
/** | ||
@@ -123,4 +122,4 @@ * Defines a text fragment | ||
*/ | ||
$text(text: string | IValue<string>, cb?: (text: TextNode) => void): this; | ||
$debug(text: IValue<string>): this; | ||
text(text: string | IValue<string>, cb?: (text: TextNode) => void): void; | ||
debug(text: IValue<string>): this; | ||
/** | ||
@@ -131,5 +130,5 @@ * Defines a tag element | ||
*/ | ||
$tag<K extends keyof HTMLElementTagNameMap>(tagName: K, cb?: (node: Tag, element: HTMLElementTagNameMap[K]) => void): this; | ||
$tag<K extends keyof SVGElementTagNameMap>(tagName: K, cb?: (node: Tag, element: SVGElementTagNameMap[K]) => void): this; | ||
$tag(tagName: string, cb?: (node: Tag, element: Element) => void): this; | ||
tag<K extends keyof HTMLElementTagNameMap>(tagName: K, cb?: (node: Tag, element: HTMLElementTagNameMap[K]) => void): void; | ||
tag<K extends keyof SVGElementTagNameMap>(tagName: K, cb?: (node: Tag, element: SVGElementTagNameMap[K]) => void): void; | ||
tag(tagName: string, cb?: (node: Tag, element: Element) => void): void; | ||
/** | ||
@@ -141,3 +140,3 @@ * Defines a custom element | ||
*/ | ||
$create<T extends Fragment>(node: T, callback?: ($: T) => void, callback1?: ($: T) => void): this; | ||
create<T extends Fragment>(node: T, callback?: ($: T) => void, callback1?: ($: T) => void): void; | ||
/** | ||
@@ -149,3 +148,3 @@ * Defines an if node | ||
*/ | ||
$if(cond: IValue<boolean>, cb: (node: Fragment) => void): this; | ||
if(cond: IValue<boolean>, cb: (node: Fragment) => void): this; | ||
/** | ||
@@ -157,3 +156,3 @@ * Defines a if-else node | ||
*/ | ||
$if_else(ifCond: IValue<boolean>, ifCb: (node: Fragment) => void, elseCb: (node: Fragment) => void): this; | ||
if_else(ifCond: IValue<boolean>, ifCb: (node: Fragment) => void, elseCb: (node: Fragment) => void): this; | ||
/** | ||
@@ -164,3 +163,3 @@ * Defines a switch nodes: Will break after first true condition | ||
*/ | ||
$switch(...cases: Array<{ | ||
switch(...cases: Array<{ | ||
cond: IValue<boolean>; | ||
@@ -175,3 +174,3 @@ cb: (node: Fragment) => void; | ||
*/ | ||
$case(cond: IValue<boolean>, cb: (node: Fragment) => void): { | ||
case(cond: IValue<boolean>, cb: (node: Fragment) => void): { | ||
cond: IValue<boolean>; | ||
@@ -184,7 +183,10 @@ cb: (node: Fragment) => void; | ||
*/ | ||
$default(cb: (node: Fragment) => void): { | ||
default(cb: (node: Fragment) => void): { | ||
cond: IValue<boolean>; | ||
cb: (node: Fragment) => void; | ||
}; | ||
$destroy(): void; | ||
insertBefore(node: Fragment): void; | ||
insertAfter(node: Fragment): void; | ||
remove(): void; | ||
destroy(): void; | ||
} | ||
@@ -208,3 +210,3 @@ /** | ||
*/ | ||
$destroy(): void; | ||
destroy(): void; | ||
} | ||
@@ -218,6 +220,6 @@ /** | ||
protected $: TextNodePrivate; | ||
constructor(); | ||
$preinit(app: AppNode, parent: Fragment, text?: IValue<string>): void; | ||
protected $$findFirstChild(): Node; | ||
$destroy(): void; | ||
constructor($?: TextNodePrivate); | ||
preinit(app: AppNode, parent: Fragment, text?: IValue<string>): void; | ||
protected findFirstChild(): Node; | ||
destroy(): void; | ||
} | ||
@@ -241,3 +243,3 @@ /** | ||
constructor(); | ||
$destroy(): void; | ||
destroy(): void; | ||
} | ||
@@ -263,7 +265,7 @@ /** | ||
*/ | ||
$init(): this; | ||
init(): this; | ||
/** To be overloaded: attributes creation milestone */ | ||
$createAttrs(): void; | ||
createAttrs(): void; | ||
/** To be overloaded: $style attributes creation milestone */ | ||
$createStyle(): void; | ||
createStyle(): void; | ||
/** | ||
@@ -274,3 +276,3 @@ * Bind attribute value | ||
*/ | ||
$attr(name: string, value: IValue<string>): this; | ||
attr(name: string, value: IValue<string>): void; | ||
/** | ||
@@ -291,11 +293,11 @@ * Creates and binds a multivalued binding to attribute | ||
*/ | ||
$bindAttr<T1>(name: string, calculator: (a1: T1) => string, v1: IValue<T1>, v2?: IValue<void>, v3?: IValue<void>, v4?: IValue<void>, v5?: IValue<void>, v6?: IValue<void>, v7?: IValue<void>, v8?: IValue<void>, v9?: IValue<void>): this; | ||
$bindAttr<T1, T2>(name: string, calculator: (a1: T1, a2: T2) => string, v1: IValue<T1>, v2: IValue<T2>, v3?: IValue<void>, v4?: IValue<void>, v5?: IValue<void>, v6?: IValue<void>, v7?: IValue<void>, v8?: IValue<void>, v9?: IValue<void>): this; | ||
$bindAttr<T1, T2, T3>(name: string, calculator: (a1: T1, a2: T2, a3: T3) => string, v1: IValue<T1>, v2: IValue<T2>, v3: IValue<T3>, v4?: IValue<void>, v5?: IValue<void>, v6?: IValue<void>, v7?: IValue<void>, v8?: IValue<void>, v9?: IValue<void>): this; | ||
$bindAttr<T1, T2, T3, T4>(name: string, calculator: (a1: T1, a2: T2, a3: T3, a4: T4) => string, v1: IValue<T1>, v2: IValue<T2>, v3: IValue<T3>, v4: IValue<T4>, v5?: IValue<void>, v6?: IValue<void>, v7?: IValue<void>, v8?: IValue<void>, v9?: IValue<void>): this; | ||
$bindAttr<T1, T2, T3, T4, T5>(name: string, calculator: (a1: T1, a2: T2, a3: T3, a4: T4, a5: T5) => string, v1: IValue<T1>, v2: IValue<T2>, v3: IValue<T3>, v4: IValue<T4>, v5: IValue<T5>, v6?: IValue<void>, v7?: IValue<void>, v8?: IValue<void>, v9?: IValue<void>): this; | ||
$bindAttr<T1, T2, T3, T4, T5, T6>(name: string, calculator: (a1: T1, a2: T2, a3: T3, a4: T4, a5: T5, a6: T6) => string, v1: IValue<T1>, v2: IValue<T2>, v3: IValue<T3>, v4: IValue<T4>, v5: IValue<T5>, v6: IValue<T6>, v7?: IValue<void>, v8?: IValue<void>, v9?: IValue<void>): this; | ||
$bindAttr<T1, T2, T3, T4, T5, T6, T7>(name: string, calculator: (a1: T1, a2: T2, a3: T3, a4: T4, a5: T5, a6: T6, a7: T7) => string, v1: IValue<T1>, v2: IValue<T2>, v3: IValue<T3>, v4: IValue<T4>, v5: IValue<T5>, v6: IValue<T6>, v7: IValue<T7>, v8?: IValue<void>, v9?: IValue<void>): this; | ||
$bindAttr<T1, T2, T3, T4, T5, T6, T7, T8>(name: string, calculator: (a1: T1, a2: T2, a3: T3, a4: T4, a5: T5, a6: T6, a7: T7, a8: T8) => string, v1: IValue<T1>, v2: IValue<T2>, v3: IValue<T3>, v4: IValue<T4>, v5: IValue<T5>, v6: IValue<T6>, v7: IValue<T7>, v8: IValue<T8>, v9?: IValue<void>): this; | ||
$bindAttr<T1, T2, T3, T4, T5, T6, T7, T8, T9>(name: string, calculator: (a1: T1, a2: T2, a3: T3, a4: T4, a5: T5, a6: T6, a7: T7, a8: T8, a9: T9) => string, v1: IValue<T1>, v2: IValue<T2>, v3: IValue<T3>, v4: IValue<T4>, v5: IValue<T5>, v6: IValue<T6>, v7: IValue<T7>, v8: IValue<T8>, v9: IValue<T9>): this; | ||
bindAttr<T1>(name: string, calculator: (a1: T1) => string, v1: IValue<T1>, v2?: IValue<void>, v3?: IValue<void>, v4?: IValue<void>, v5?: IValue<void>, v6?: IValue<void>, v7?: IValue<void>, v8?: IValue<void>, v9?: IValue<void>): this; | ||
bindAttr<T1, T2>(name: string, calculator: (a1: T1, a2: T2) => string, v1: IValue<T1>, v2: IValue<T2>, v3?: IValue<void>, v4?: IValue<void>, v5?: IValue<void>, v6?: IValue<void>, v7?: IValue<void>, v8?: IValue<void>, v9?: IValue<void>): this; | ||
bindAttr<T1, T2, T3>(name: string, calculator: (a1: T1, a2: T2, a3: T3) => string, v1: IValue<T1>, v2: IValue<T2>, v3: IValue<T3>, v4?: IValue<void>, v5?: IValue<void>, v6?: IValue<void>, v7?: IValue<void>, v8?: IValue<void>, v9?: IValue<void>): this; | ||
bindAttr<T1, T2, T3, T4>(name: string, calculator: (a1: T1, a2: T2, a3: T3, a4: T4) => string, v1: IValue<T1>, v2: IValue<T2>, v3: IValue<T3>, v4: IValue<T4>, v5?: IValue<void>, v6?: IValue<void>, v7?: IValue<void>, v8?: IValue<void>, v9?: IValue<void>): this; | ||
bindAttr<T1, T2, T3, T4, T5>(name: string, calculator: (a1: T1, a2: T2, a3: T3, a4: T4, a5: T5) => string, v1: IValue<T1>, v2: IValue<T2>, v3: IValue<T3>, v4: IValue<T4>, v5: IValue<T5>, v6?: IValue<void>, v7?: IValue<void>, v8?: IValue<void>, v9?: IValue<void>): this; | ||
bindAttr<T1, T2, T3, T4, T5, T6>(name: string, calculator: (a1: T1, a2: T2, a3: T3, a4: T4, a5: T5, a6: T6) => string, v1: IValue<T1>, v2: IValue<T2>, v3: IValue<T3>, v4: IValue<T4>, v5: IValue<T5>, v6: IValue<T6>, v7?: IValue<void>, v8?: IValue<void>, v9?: IValue<void>): this; | ||
bindAttr<T1, T2, T3, T4, T5, T6, T7>(name: string, calculator: (a1: T1, a2: T2, a3: T3, a4: T4, a5: T5, a6: T6, a7: T7) => string, v1: IValue<T1>, v2: IValue<T2>, v3: IValue<T3>, v4: IValue<T4>, v5: IValue<T5>, v6: IValue<T6>, v7: IValue<T7>, v8?: IValue<void>, v9?: IValue<void>): this; | ||
bindAttr<T1, T2, T3, T4, T5, T6, T7, T8>(name: string, calculator: (a1: T1, a2: T2, a3: T3, a4: T4, a5: T5, a6: T6, a7: T7, a8: T8) => string, v1: IValue<T1>, v2: IValue<T2>, v3: IValue<T3>, v4: IValue<T4>, v5: IValue<T5>, v6: IValue<T6>, v7: IValue<T7>, v8: IValue<T8>, v9?: IValue<void>): this; | ||
bindAttr<T1, T2, T3, T4, T5, T6, T7, T8, T9>(name: string, calculator: (a1: T1, a2: T2, a3: T3, a4: T4, a5: T5, a6: T6, a7: T7, a8: T8, a9: T9) => string, v1: IValue<T1>, v2: IValue<T2>, v3: IValue<T3>, v4: IValue<T4>, v5: IValue<T5>, v6: IValue<T6>, v7: IValue<T7>, v8: IValue<T8>, v9: IValue<T9>): this; | ||
/** | ||
@@ -306,3 +308,3 @@ * Set attribute value | ||
*/ | ||
$setAttr(name: string, value: string): this; | ||
setAttr(name: string, value: string): this; | ||
/** | ||
@@ -312,3 +314,3 @@ * Adds a CSS class | ||
*/ | ||
$addClass(cl: string): this; | ||
addClass(cl: string): this; | ||
/** | ||
@@ -318,3 +320,3 @@ * Adds some CSS classes | ||
*/ | ||
$addClasses(...cls: Array<string>): this; | ||
addClasses(...cls: Array<string>): this; | ||
/** | ||
@@ -324,3 +326,3 @@ * Bind a CSS class | ||
*/ | ||
$bindClass(className: IValue<string>): this; | ||
bindClass(className: IValue<string>): this; | ||
/** | ||
@@ -331,3 +333,3 @@ * Bind a floating class name | ||
*/ | ||
$floatingClass(cond: IValue<boolean>, className: string): this; | ||
floatingClass(cond: IValue<boolean>, className: string): this; | ||
/** | ||
@@ -338,3 +340,3 @@ * Defines a style attribute | ||
*/ | ||
$style(name: string, value: IValue<string>): this; | ||
style(name: string, value: IValue<string>): this; | ||
/** | ||
@@ -354,11 +356,11 @@ * Binds style property value | ||
*/ | ||
$bindStyle<T1>(name: string, calculator: (a1: T1) => string, v1: IValue<T1>): this; | ||
$bindStyle<T1, T2>(name: string, calculator: (a1: T1, a2: T2) => string, v1: IValue<T1>, v2: IValue<T2>): this; | ||
$bindStyle<T1, T2, T3>(name: string, calculator: (a1: T1, a2: T2, a3: T3) => string, v1: IValue<T1>, v2: IValue<T2>, v3: IValue<T3>): this; | ||
$bindStyle<T1, T2, T3, T4>(name: string, calculator: (a1: T1, a2: T2, a3: T3, a4: T4) => string, v1: IValue<T1>, v2: IValue<T2>, v3: IValue<T3>, v4: IValue<T4>): this; | ||
$bindStyle<T1, T2, T3, T4, T5>(name: string, calculator: (a1: T1, a2: T2, a3: T3, a4: T4, a5: T5) => string, v1: IValue<T1>, v2: IValue<T2>, v3: IValue<T3>, v4: IValue<T4>, v5: IValue<T5>): this; | ||
$bindStyle<T1, T2, T3, T4, T5, T6>(name: string, calculator: (a1: T1, a2: T2, a3: T3, a4: T4, a5: T5, a6: T6) => string, v1: IValue<T1>, v2: IValue<T2>, v3: IValue<T3>, v4: IValue<T4>, v5: IValue<T5>, v6: IValue<T6>): this; | ||
$bindStyle<T1, T2, T3, T4, T5, T6, T7>(name: string, calculator: (a1: T1, a2: T2, a3: T3, a4: T4, a5: T5, a6: T6, a7: T7) => string, v1: IValue<T1>, v2: IValue<T2>, v3: IValue<T3>, v4: IValue<T4>, v5: IValue<T5>, v6: IValue<T6>, v7: IValue<T7>): this; | ||
$bindStyle<T1, T2, T3, T4, T5, T6, T7, T8>(name: string, calculator: (a1: T1, a2: T2, a3: T3, a4: T4, a5: T5, a6: T6, a7: T7, a8: T8) => string, v1: IValue<T1>, v2: IValue<T2>, v3: IValue<T3>, v4: IValue<T4>, v5: IValue<T5>, v6: IValue<T6>, v7: IValue<T7>, v8: IValue<T8>): this; | ||
$bindStyle<T1, T2, T3, T4, T5, T6, T7, T8, T9>(name: string, calculator: (a1: T1, a2: T2, a3: T3, a4: T4, a5: T5, a6: T6, a7: T7, a8: T8, a9: T9) => string, v1: IValue<T1>, v2: IValue<T2>, v3: IValue<T3>, v4: IValue<T4>, v5: IValue<T5>, v6: IValue<T6>, v7: IValue<T7>, v8: IValue<T8>, v9: IValue<T9>): this; | ||
bindStyle<T1>(name: string, calculator: (a1: T1) => string, v1: IValue<T1>): this; | ||
bindStyle<T1, T2>(name: string, calculator: (a1: T1, a2: T2) => string, v1: IValue<T1>, v2: IValue<T2>): this; | ||
bindStyle<T1, T2, T3>(name: string, calculator: (a1: T1, a2: T2, a3: T3) => string, v1: IValue<T1>, v2: IValue<T2>, v3: IValue<T3>): this; | ||
bindStyle<T1, T2, T3, T4>(name: string, calculator: (a1: T1, a2: T2, a3: T3, a4: T4) => string, v1: IValue<T1>, v2: IValue<T2>, v3: IValue<T3>, v4: IValue<T4>): this; | ||
bindStyle<T1, T2, T3, T4, T5>(name: string, calculator: (a1: T1, a2: T2, a3: T3, a4: T4, a5: T5) => string, v1: IValue<T1>, v2: IValue<T2>, v3: IValue<T3>, v4: IValue<T4>, v5: IValue<T5>): this; | ||
bindStyle<T1, T2, T3, T4, T5, T6>(name: string, calculator: (a1: T1, a2: T2, a3: T3, a4: T4, a5: T5, a6: T6) => string, v1: IValue<T1>, v2: IValue<T2>, v3: IValue<T3>, v4: IValue<T4>, v5: IValue<T5>, v6: IValue<T6>): this; | ||
bindStyle<T1, T2, T3, T4, T5, T6, T7>(name: string, calculator: (a1: T1, a2: T2, a3: T3, a4: T4, a5: T5, a6: T6, a7: T7) => string, v1: IValue<T1>, v2: IValue<T2>, v3: IValue<T3>, v4: IValue<T4>, v5: IValue<T5>, v6: IValue<T6>, v7: IValue<T7>): this; | ||
bindStyle<T1, T2, T3, T4, T5, T6, T7, T8>(name: string, calculator: (a1: T1, a2: T2, a3: T3, a4: T4, a5: T5, a6: T6, a7: T7, a8: T8) => string, v1: IValue<T1>, v2: IValue<T2>, v3: IValue<T3>, v4: IValue<T4>, v5: IValue<T5>, v6: IValue<T6>, v7: IValue<T7>, v8: IValue<T8>): this; | ||
bindStyle<T1, T2, T3, T4, T5, T6, T7, T8, T9>(name: string, calculator: (a1: T1, a2: T2, a3: T3, a4: T4, a5: T5, a6: T6, a7: T7, a8: T8, a9: T9) => string, v1: IValue<T1>, v2: IValue<T2>, v3: IValue<T3>, v4: IValue<T4>, v5: IValue<T5>, v6: IValue<T6>, v7: IValue<T7>, v8: IValue<T8>, v9: IValue<T9>): this; | ||
/** | ||
@@ -369,3 +371,3 @@ * Sets a style property value | ||
*/ | ||
$setStyle(prop: string, value: string): this; | ||
setStyle(prop: string, value: string): this; | ||
/** | ||
@@ -377,3 +379,3 @@ * Add a listener for an event | ||
*/ | ||
$listen(name: string, handler: (ev: Event) => void, options?: boolean | AddEventListenerOptions): this; | ||
listen(name: string, handler: (ev: Event) => void, options?: boolean | AddEventListenerOptions): this; | ||
/** | ||
@@ -383,3 +385,3 @@ * @param handler {function (MouseEvent)} | ||
*/ | ||
$oncontextmenu(handler: (ev: MouseEvent) => void, options?: boolean | AddEventListenerOptions): this; | ||
oncontextmenu(handler: (ev: MouseEvent) => void, options?: boolean | AddEventListenerOptions): this; | ||
/** | ||
@@ -389,3 +391,3 @@ * @param handler {function (MouseEvent)} | ||
*/ | ||
$onmousedown(handler: (ev: MouseEvent) => void, options?: boolean | AddEventListenerOptions): this; | ||
onmousedown(handler: (ev: MouseEvent) => void, options?: boolean | AddEventListenerOptions): this; | ||
/** | ||
@@ -395,3 +397,3 @@ * @param handler {function (MouseEvent)} | ||
*/ | ||
$onmouseenter(handler: (ev: MouseEvent) => void, options?: boolean | AddEventListenerOptions): this; | ||
onmouseenter(handler: (ev: MouseEvent) => void, options?: boolean | AddEventListenerOptions): this; | ||
/** | ||
@@ -401,3 +403,3 @@ * @param handler {function (MouseEvent)} | ||
*/ | ||
$onmouseleave(handler: (ev: MouseEvent) => void, options?: boolean | AddEventListenerOptions): this; | ||
onmouseleave(handler: (ev: MouseEvent) => void, options?: boolean | AddEventListenerOptions): this; | ||
/** | ||
@@ -407,3 +409,3 @@ * @param handler {function (MouseEvent)} | ||
*/ | ||
$onmousemove(handler: (ev: MouseEvent) => void, options?: boolean | AddEventListenerOptions): this; | ||
onmousemove(handler: (ev: MouseEvent) => void, options?: boolean | AddEventListenerOptions): this; | ||
/** | ||
@@ -413,3 +415,3 @@ * @param handler {function (MouseEvent)} | ||
*/ | ||
$onmouseout(handler: (ev: MouseEvent) => void, options?: boolean | AddEventListenerOptions): this; | ||
onmouseout(handler: (ev: MouseEvent) => void, options?: boolean | AddEventListenerOptions): this; | ||
/** | ||
@@ -419,3 +421,3 @@ * @param handler {function (MouseEvent)} | ||
*/ | ||
$onmouseover(handler: (ev: MouseEvent) => void, options?: boolean | AddEventListenerOptions): this; | ||
onmouseover(handler: (ev: MouseEvent) => void, options?: boolean | AddEventListenerOptions): this; | ||
/** | ||
@@ -425,3 +427,3 @@ * @param handler {function (MouseEvent)} | ||
*/ | ||
$onmouseup(handler: (ev: MouseEvent) => void, options?: boolean | AddEventListenerOptions): this; | ||
onmouseup(handler: (ev: MouseEvent) => void, options?: boolean | AddEventListenerOptions): this; | ||
/** | ||
@@ -431,3 +433,3 @@ * @param handler {function (MouseEvent)} | ||
*/ | ||
$onclick(handler: (ev: MouseEvent) => void, options?: boolean | AddEventListenerOptions): this; | ||
onclick(handler: (ev: MouseEvent) => void, options?: boolean | AddEventListenerOptions): this; | ||
/** | ||
@@ -437,3 +439,3 @@ * @param handler {function (MouseEvent)} | ||
*/ | ||
$ondblclick(handler: (ev: MouseEvent) => void, options?: boolean | AddEventListenerOptions): this; | ||
ondblclick(handler: (ev: MouseEvent) => void, options?: boolean | AddEventListenerOptions): this; | ||
/** | ||
@@ -443,3 +445,3 @@ * @param handler {function (FocusEvent)} | ||
*/ | ||
$onblur(handler: (ev: FocusEvent) => void, options?: boolean | AddEventListenerOptions): this; | ||
onblur(handler: (ev: FocusEvent) => void, options?: boolean | AddEventListenerOptions): this; | ||
/** | ||
@@ -449,3 +451,3 @@ * @param handler {function (FocusEvent)} | ||
*/ | ||
$onfocus(handler: (ev: FocusEvent) => void, options?: boolean | AddEventListenerOptions): this; | ||
onfocus(handler: (ev: FocusEvent) => void, options?: boolean | AddEventListenerOptions): this; | ||
/** | ||
@@ -455,3 +457,3 @@ * @param handler {function (FocusEvent)} | ||
*/ | ||
$onfocusin(handler: (ev: FocusEvent) => void, options?: boolean | AddEventListenerOptions): this; | ||
onfocusin(handler: (ev: FocusEvent) => void, options?: boolean | AddEventListenerOptions): this; | ||
/** | ||
@@ -461,3 +463,3 @@ * @param handler {function (FocusEvent)} | ||
*/ | ||
$onfocusout(handler: (ev: FocusEvent) => void, options?: boolean | AddEventListenerOptions): this; | ||
onfocusout(handler: (ev: FocusEvent) => void, options?: boolean | AddEventListenerOptions): this; | ||
/** | ||
@@ -467,3 +469,3 @@ * @param handler {function (KeyboardEvent)} | ||
*/ | ||
$onkeydown(handler: (ev: KeyboardEvent) => void, options?: boolean | AddEventListenerOptions): this; | ||
onkeydown(handler: (ev: KeyboardEvent) => void, options?: boolean | AddEventListenerOptions): this; | ||
/** | ||
@@ -473,3 +475,3 @@ * @param handler {function (KeyboardEvent)} | ||
*/ | ||
$onkeyup(handler: (ev: KeyboardEvent) => void, options?: boolean | AddEventListenerOptions): this; | ||
onkeyup(handler: (ev: KeyboardEvent) => void, options?: boolean | AddEventListenerOptions): this; | ||
/** | ||
@@ -479,3 +481,3 @@ * @param handler {function (KeyboardEvent)} | ||
*/ | ||
$onkeypress(handler: (ev: KeyboardEvent) => void, options?: boolean | AddEventListenerOptions): this; | ||
onkeypress(handler: (ev: KeyboardEvent) => void, options?: boolean | AddEventListenerOptions): this; | ||
/** | ||
@@ -485,3 +487,3 @@ * @param handler {function (TouchEvent)} | ||
*/ | ||
$ontouchstart(handler: (ev: TouchEvent) => void, options?: boolean | AddEventListenerOptions): this; | ||
ontouchstart(handler: (ev: TouchEvent) => void, options?: boolean | AddEventListenerOptions): this; | ||
/** | ||
@@ -491,3 +493,3 @@ * @param handler {function (TouchEvent)} | ||
*/ | ||
$ontouchmove(handler: (ev: TouchEvent) => void, options?: boolean | AddEventListenerOptions): this; | ||
ontouchmove(handler: (ev: TouchEvent) => void, options?: boolean | AddEventListenerOptions): this; | ||
/** | ||
@@ -497,3 +499,3 @@ * @param handler {function (TouchEvent)} | ||
*/ | ||
$ontouchend(handler: (ev: TouchEvent) => void, options?: boolean | AddEventListenerOptions): this; | ||
ontouchend(handler: (ev: TouchEvent) => void, options?: boolean | AddEventListenerOptions): this; | ||
/** | ||
@@ -503,3 +505,3 @@ * @param handler {function (TouchEvent)} | ||
*/ | ||
$ontouchcancel(handler: (ev: TouchEvent) => void, options?: boolean | AddEventListenerOptions): this; | ||
ontouchcancel(handler: (ev: TouchEvent) => void, options?: boolean | AddEventListenerOptions): this; | ||
/** | ||
@@ -509,3 +511,3 @@ * @param handler {function (WheelEvent)} | ||
*/ | ||
$onwheel(handler: (ev: WheelEvent) => void, options?: boolean | AddEventListenerOptions): this; | ||
onwheel(handler: (ev: WheelEvent) => void, options?: boolean | AddEventListenerOptions): this; | ||
/** | ||
@@ -515,3 +517,3 @@ * @param handler {function (ProgressEvent)} | ||
*/ | ||
$onabort(handler: (ev: ProgressEvent) => void, options?: boolean | AddEventListenerOptions): this; | ||
onabort(handler: (ev: ProgressEvent) => void, options?: boolean | AddEventListenerOptions): this; | ||
/** | ||
@@ -521,3 +523,3 @@ * @param handler {function (ProgressEvent)} | ||
*/ | ||
$onerror(handler: (ev: ProgressEvent) => void, options?: boolean | AddEventListenerOptions): this; | ||
onerror(handler: (ev: ProgressEvent) => void, options?: boolean | AddEventListenerOptions): this; | ||
/** | ||
@@ -527,3 +529,3 @@ * @param handler {function (ProgressEvent)} | ||
*/ | ||
$onload(handler: (ev: ProgressEvent) => void, options?: boolean | AddEventListenerOptions): this; | ||
onload(handler: (ev: ProgressEvent) => void, options?: boolean | AddEventListenerOptions): this; | ||
/** | ||
@@ -533,3 +535,3 @@ * @param handler {function (ProgressEvent)} | ||
*/ | ||
$onloadend(handler: (ev: ProgressEvent) => void, options?: boolean | AddEventListenerOptions): this; | ||
onloadend(handler: (ev: ProgressEvent) => void, options?: boolean | AddEventListenerOptions): this; | ||
/** | ||
@@ -539,3 +541,3 @@ * @param handler {function (ProgressEvent)} | ||
*/ | ||
$onloadstart(handler: (ev: ProgressEvent) => void, options?: boolean | AddEventListenerOptions): this; | ||
onloadstart(handler: (ev: ProgressEvent) => void, options?: boolean | AddEventListenerOptions): this; | ||
/** | ||
@@ -545,3 +547,3 @@ * @param handler {function (ProgressEvent)} | ||
*/ | ||
$onprogress(handler: (ev: ProgressEvent) => void, options?: boolean | AddEventListenerOptions): this; | ||
onprogress(handler: (ev: ProgressEvent) => void, options?: boolean | AddEventListenerOptions): this; | ||
/** | ||
@@ -551,3 +553,3 @@ * @param handler {function (ProgressEvent)} | ||
*/ | ||
$ontimeout(handler: (ev: ProgressEvent) => void, options?: boolean | AddEventListenerOptions): this; | ||
ontimeout(handler: (ev: ProgressEvent) => void, options?: boolean | AddEventListenerOptions): this; | ||
/** | ||
@@ -557,3 +559,3 @@ * @param handler {function (DragEvent)} | ||
*/ | ||
$ondrag(handler: (ev: DragEvent) => void, options?: boolean | AddEventListenerOptions): this; | ||
ondrag(handler: (ev: DragEvent) => void, options?: boolean | AddEventListenerOptions): this; | ||
/** | ||
@@ -563,3 +565,3 @@ * @param handler {function (DragEvent)} | ||
*/ | ||
$ondragend(handler: (ev: DragEvent) => void, options?: boolean | AddEventListenerOptions): this; | ||
ondragend(handler: (ev: DragEvent) => void, options?: boolean | AddEventListenerOptions): this; | ||
/** | ||
@@ -569,3 +571,3 @@ * @param handler {function (DragEvent)} | ||
*/ | ||
$ondragenter(handler: (ev: DragEvent) => void, options?: boolean | AddEventListenerOptions): this; | ||
ondragenter(handler: (ev: DragEvent) => void, options?: boolean | AddEventListenerOptions): this; | ||
/** | ||
@@ -575,3 +577,3 @@ * @param handler {function (DragEvent)} | ||
*/ | ||
$ondragexit(handler: (ev: DragEvent) => void, options?: boolean | AddEventListenerOptions): this; | ||
ondragexit(handler: (ev: DragEvent) => void, options?: boolean | AddEventListenerOptions): this; | ||
/** | ||
@@ -581,3 +583,3 @@ * @param handler {function (DragEvent)} | ||
*/ | ||
$ondragleave(handler: (ev: DragEvent) => void, options?: boolean | AddEventListenerOptions): this; | ||
ondragleave(handler: (ev: DragEvent) => void, options?: boolean | AddEventListenerOptions): this; | ||
/** | ||
@@ -587,3 +589,3 @@ * @param handler {function (DragEvent)} | ||
*/ | ||
$ondragover(handler: (ev: DragEvent) => void, options?: boolean | AddEventListenerOptions): this; | ||
ondragover(handler: (ev: DragEvent) => void, options?: boolean | AddEventListenerOptions): this; | ||
/** | ||
@@ -593,3 +595,3 @@ * @param handler {function (DragEvent)} | ||
*/ | ||
$ondragstart(handler: (ev: DragEvent) => void, options?: boolean | AddEventListenerOptions): this; | ||
ondragstart(handler: (ev: DragEvent) => void, options?: boolean | AddEventListenerOptions): this; | ||
/** | ||
@@ -599,3 +601,3 @@ * @param handler {function (DragEvent)} | ||
*/ | ||
$ondrop(handler: (ev: DragEvent) => void, options?: boolean | AddEventListenerOptions): this; | ||
ondrop(handler: (ev: DragEvent) => void, options?: boolean | AddEventListenerOptions): this; | ||
/** | ||
@@ -605,3 +607,3 @@ * @param handler {function (PointerEvent)} | ||
*/ | ||
$onpointerover(handler: (ev: PointerEvent) => void, options?: boolean | AddEventListenerOptions): this; | ||
onpointerover(handler: (ev: PointerEvent) => void, options?: boolean | AddEventListenerOptions): this; | ||
/** | ||
@@ -611,3 +613,3 @@ * @param handler {function (PointerEvent)} | ||
*/ | ||
$onpointerenter(handler: (ev: PointerEvent) => void, options?: boolean | AddEventListenerOptions): this; | ||
onpointerenter(handler: (ev: PointerEvent) => void, options?: boolean | AddEventListenerOptions): this; | ||
/** | ||
@@ -617,3 +619,3 @@ * @param handler {function (PointerEvent)} | ||
*/ | ||
$onpointerdown(handler: (ev: PointerEvent) => void, options?: boolean | AddEventListenerOptions): this; | ||
onpointerdown(handler: (ev: PointerEvent) => void, options?: boolean | AddEventListenerOptions): this; | ||
/** | ||
@@ -623,3 +625,3 @@ * @param handler {function (PointerEvent)} | ||
*/ | ||
$onpointermove(handler: (ev: PointerEvent) => void, options?: boolean | AddEventListenerOptions): this; | ||
onpointermove(handler: (ev: PointerEvent) => void, options?: boolean | AddEventListenerOptions): this; | ||
/** | ||
@@ -629,3 +631,3 @@ * @param handler {function (PointerEvent)} | ||
*/ | ||
$onpointerup(handler: (ev: PointerEvent) => void, options?: boolean | AddEventListenerOptions): this; | ||
onpointerup(handler: (ev: PointerEvent) => void, options?: boolean | AddEventListenerOptions): this; | ||
/** | ||
@@ -635,3 +637,3 @@ * @param handler {function (PointerEvent)} | ||
*/ | ||
$onpointercancel(handler: (ev: PointerEvent) => void, options?: boolean | AddEventListenerOptions): this; | ||
onpointercancel(handler: (ev: PointerEvent) => void, options?: boolean | AddEventListenerOptions): this; | ||
/** | ||
@@ -641,3 +643,3 @@ * @param handler {function (PointerEvent)} | ||
*/ | ||
$onpointerout(handler: (ev: PointerEvent) => void, options?: boolean | AddEventListenerOptions): this; | ||
onpointerout(handler: (ev: PointerEvent) => void, options?: boolean | AddEventListenerOptions): this; | ||
/** | ||
@@ -647,3 +649,3 @@ * @param handler {function (PointerEvent)} | ||
*/ | ||
$onpointerleave(handler: (ev: PointerEvent) => void, options?: boolean | AddEventListenerOptions): this; | ||
onpointerleave(handler: (ev: PointerEvent) => void, options?: boolean | AddEventListenerOptions): this; | ||
/** | ||
@@ -653,3 +655,3 @@ * @param handler {function (PointerEvent)} | ||
*/ | ||
$ongotpointercapture(handler: (ev: PointerEvent) => void, options?: boolean | AddEventListenerOptions): this; | ||
ongotpointercapture(handler: (ev: PointerEvent) => void, options?: boolean | AddEventListenerOptions): this; | ||
/** | ||
@@ -659,3 +661,3 @@ * @param handler {function (PointerEvent)} | ||
*/ | ||
$onlostpointercapture(handler: (ev: PointerEvent) => void, options?: boolean | AddEventListenerOptions): this; | ||
onlostpointercapture(handler: (ev: PointerEvent) => void, options?: boolean | AddEventListenerOptions): this; | ||
/** | ||
@@ -665,3 +667,3 @@ * @param handler {function (AnimationEvent)} | ||
*/ | ||
$onanimationstart(handler: (ev: AnimationEvent) => void, options?: boolean | AddEventListenerOptions): this; | ||
onanimationstart(handler: (ev: AnimationEvent) => void, options?: boolean | AddEventListenerOptions): this; | ||
/** | ||
@@ -671,3 +673,3 @@ * @param handler {function (AnimationEvent)} | ||
*/ | ||
$onanimationend(handler: (ev: AnimationEvent) => void, options?: boolean | AddEventListenerOptions): this; | ||
onanimationend(handler: (ev: AnimationEvent) => void, options?: boolean | AddEventListenerOptions): this; | ||
/** | ||
@@ -677,3 +679,3 @@ * @param handler {function (AnimationEvent)} | ||
*/ | ||
$onanimationiteraton(handler: (ev: AnimationEvent) => void, options?: boolean | AddEventListenerOptions): this; | ||
onanimationiteraton(handler: (ev: AnimationEvent) => void, options?: boolean | AddEventListenerOptions): this; | ||
/** | ||
@@ -683,3 +685,3 @@ * @param handler {function (ClipboardEvent)} | ||
*/ | ||
$onclipboardchange(handler: (ev: ClipboardEvent) => void, options?: boolean | AddEventListenerOptions): this; | ||
onclipboardchange(handler: (ev: ClipboardEvent) => void, options?: boolean | AddEventListenerOptions): this; | ||
/** | ||
@@ -689,3 +691,3 @@ * @param handler {function (ClipboardEvent)} | ||
*/ | ||
$oncut(handler: (ev: ClipboardEvent) => void, options?: boolean | AddEventListenerOptions): this; | ||
oncut(handler: (ev: ClipboardEvent) => void, options?: boolean | AddEventListenerOptions): this; | ||
/** | ||
@@ -695,3 +697,3 @@ * @param handler {function (ClipboardEvent)} | ||
*/ | ||
$oncopy(handler: (ev: ClipboardEvent) => void, options?: boolean | AddEventListenerOptions): this; | ||
oncopy(handler: (ev: ClipboardEvent) => void, options?: boolean | AddEventListenerOptions): this; | ||
/** | ||
@@ -701,4 +703,4 @@ * @param handler {function (ClipboardEvent)} | ||
*/ | ||
$onpaste(handler: (ev: ClipboardEvent) => void, options?: boolean | AddEventListenerOptions): this; | ||
$$insertAdjacent(node: Node): void; | ||
onpaste(handler: (ev: ClipboardEvent) => void, options?: boolean | AddEventListenerOptions): this; | ||
insertAdjacent(node: Node): void; | ||
/** | ||
@@ -708,3 +710,3 @@ * A v-show & ngShow alternative | ||
*/ | ||
$bindShow(cond: IValue<boolean>): this; | ||
bindShow(cond: IValue<boolean>): this; | ||
/** | ||
@@ -714,3 +716,3 @@ * bind HTML | ||
*/ | ||
$html(value: IValue<string>): void; | ||
html(value: IValue<string>): void; | ||
} | ||
@@ -724,6 +726,6 @@ /** | ||
constructor(); | ||
$preinit(app: AppNode, parent: Fragment, tagName?: string): void; | ||
protected $$findFirstChild(): Node; | ||
$$insertAdjacent(node: Node): void; | ||
$$appendNode(node: Node): void; | ||
preinit(app: AppNode, parent: Fragment, tagName?: string): void; | ||
protected findFirstChild(): Node; | ||
insertAdjacent(node: Node): void; | ||
appendNode(node: Node): void; | ||
/** | ||
@@ -733,7 +735,7 @@ * Mount/Unmount a node | ||
*/ | ||
$bindMount(cond: IValue<boolean>): this; | ||
bindMount(cond: IValue<boolean>): void; | ||
/** | ||
* Runs GC | ||
*/ | ||
$destroy(): void; | ||
destroy(): void; | ||
} | ||
@@ -746,5 +748,5 @@ /** | ||
export declare class Extension extends INode { | ||
$preinit(app: AppNode, parent: Fragment): void; | ||
preinit(app: AppNode, parent: Fragment): void; | ||
constructor($?: INodePrivate); | ||
$destroy(): void; | ||
destroy(): void; | ||
} | ||
@@ -758,4 +760,4 @@ /** | ||
constructor(); | ||
$mounted(): void; | ||
$preinit(app: AppNode, parent: Fragment): void; | ||
mounted(): void; | ||
preinit(app: AppNode, parent: Fragment): void; | ||
} | ||
@@ -767,3 +769,3 @@ /** | ||
*/ | ||
export declare class SwitchedNodePrivate extends INodePrivate { | ||
export declare class SwitchedNodePrivate extends FragmentPrivate { | ||
/** | ||
@@ -775,7 +777,2 @@ * Index of current true condition | ||
/** | ||
* The unique child which can be absent | ||
* @type Extension | ||
*/ | ||
fragment?: Fragment; | ||
/** | ||
* Array of possible cases | ||
@@ -797,3 +794,3 @@ * @type {Array<{cond : IValue<boolean>, cb : function(Fragment)}>} | ||
*/ | ||
$destroy(): void; | ||
destroy(): void; | ||
} | ||
@@ -816,3 +813,3 @@ /** | ||
*/ | ||
$destroy(): void; | ||
destroy(): void; | ||
} | ||
@@ -831,7 +828,7 @@ /** | ||
constructor(); | ||
$preinit(app: AppNode, parent: Fragment, text?: IValue<string>): void; | ||
preinit(app: AppNode, parent: Fragment, text?: IValue<string>): void; | ||
/** | ||
* Runs garbage collector | ||
*/ | ||
$destroy(): void; | ||
destroy(): void; | ||
} |
@@ -21,4 +21,4 @@ import { Fragment } from "./node"; | ||
constructor(); | ||
$createWatchers(): void; | ||
$compose(): void; | ||
createWatchers(): void; | ||
compose(): void; | ||
} |
@@ -59,3 +59,3 @@ import { IValue } from "../core/ivalue"; | ||
disable(): this; | ||
$destroy(): void; | ||
destroy(): void; | ||
} |
@@ -32,5 +32,5 @@ import { IValue } from "../core/ivalue"; | ||
set $(v: T); | ||
enable(): this; | ||
disable(): this; | ||
$destroy(): void; | ||
enable(): void; | ||
disable(): void; | ||
destroy(): void; | ||
} |
@@ -25,7 +25,7 @@ import { IValue } from "../core/ivalue"; | ||
set $(value: T); | ||
enable(): this; | ||
disable(): this; | ||
on(handler: (value: T) => void): this; | ||
off(handler: (value: T) => void): this; | ||
$destroy(): void; | ||
enable(): void; | ||
disable(): void; | ||
on(handler: (value: T) => void): void; | ||
off(handler: (value: T) => void): void; | ||
destroy(): void; | ||
} |
@@ -12,3 +12,3 @@ import { BaseView } from "./base-view"; | ||
createChild(id: T, item: T, before?: Fragment): any; | ||
$ready(): void; | ||
ready(): void; | ||
} |
import { RepeatNode, RepeatNodePrivate } from "./repeat-node"; | ||
import { IModel } from "../models/model"; | ||
import { ListenableModel } from "../models/model"; | ||
/** | ||
@@ -27,3 +27,3 @@ * Private part of BaseView | ||
*/ | ||
export declare class BaseView<K, T, Model extends IModel<K, T>> extends RepeatNode<K, T> { | ||
export declare class BaseView<K, T, Model extends ListenableModel<K, T>> extends RepeatNode<K, T> { | ||
protected $: BaseViewPrivate<K, T>; | ||
@@ -39,7 +39,7 @@ /** | ||
*/ | ||
$ready(): void; | ||
ready(): void; | ||
/** | ||
* Handles destroy event | ||
*/ | ||
$destroy(): void; | ||
destroy(): void; | ||
} |
@@ -10,3 +10,3 @@ import { BaseView } from "./base-view"; | ||
constructor(model: MapModel<K, T>); | ||
$ready(): void; | ||
ready(): void; | ||
} |
@@ -10,3 +10,3 @@ import { BaseView } from "./base-view"; | ||
constructor(model: ObjectModel<T>); | ||
$ready(): void; | ||
ready(): void; | ||
} |
@@ -15,3 +15,3 @@ import { Fragment, INodePrivate } from "../node/node"; | ||
constructor(); | ||
$destroy(): void; | ||
destroy(): void; | ||
} | ||
@@ -18,0 +18,0 @@ /** |
@@ -35,5 +35,5 @@ import { RepeatNode, RepeatNodePrivate } from "./repeat-node"; | ||
changeCount(number: number): void; | ||
$created(): void; | ||
$ready(): void; | ||
$destroy(): void; | ||
created(): void; | ||
ready(): void; | ||
destroy(): void; | ||
} |
@@ -10,3 +10,3 @@ import { BaseView } from "./base-view"; | ||
constructor(model: SetModel<T>); | ||
$ready(): void; | ||
ready(): void; | ||
} |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
380062
12412