vasille 2.3.9 → 3.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +57 -155
- package/lib/binding/attribute.js +4 -5
- package/lib/binding/binding.js +4 -5
- package/lib/binding/class.js +2 -4
- package/lib/binding/style.js +12 -4
- package/lib/core/config.js +3 -0
- package/lib/core/core.js +39 -177
- package/lib/core/destroyable.js +1 -36
- package/lib/core/ivalue.js +6 -49
- package/lib/functional/safety.js +7 -0
- package/lib/index.js +7 -8
- package/lib/models/array-model.js +40 -107
- package/lib/models/listener.js +16 -80
- package/lib/models/map-model.js +6 -13
- package/lib/models/object-model.js +6 -6
- package/lib/models/set-model.js +5 -12
- package/lib/node/app.js +8 -27
- package/lib/node/node.js +294 -524
- package/lib/node/watch.js +10 -8
- package/lib/tsconfig-build.tsbuildinfo +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -0
- package/lib/value/expression.js +16 -41
- package/lib/value/mirror.js +9 -23
- package/lib/value/pointer.js +64 -16
- package/lib/value/reference.js +24 -29
- package/lib/views/array-view.js +5 -6
- package/lib/views/base-view.js +14 -26
- package/lib/views/map-view.js +4 -5
- package/lib/views/repeat-node.js +17 -34
- package/lib/views/set-view.js +7 -5
- package/lib-node/binding/attribute.js +4 -5
- package/lib-node/binding/binding.js +4 -5
- package/lib-node/binding/class.js +2 -4
- package/lib-node/binding/style.js +13 -4
- package/lib-node/core/config.js +6 -0
- package/lib-node/core/core.js +39 -180
- package/lib-node/core/destroyable.js +1 -36
- package/lib-node/core/ivalue.js +7 -51
- package/lib-node/functional/safety.js +12 -0
- package/lib-node/index.js +7 -12
- package/lib-node/models/array-model.js +41 -107
- package/lib-node/models/listener.js +16 -80
- package/lib-node/models/map-model.js +6 -13
- package/lib-node/models/object-model.js +6 -6
- package/lib-node/models/set-model.js +5 -12
- package/lib-node/node/app.js +8 -28
- package/lib-node/node/node.js +294 -529
- package/lib-node/node/watch.js +10 -8
- package/lib-node/tsconfig-build-node.tsbuildinfo +1 -1
- package/lib-node/value/expression.js +16 -41
- package/lib-node/value/mirror.js +9 -23
- package/lib-node/value/pointer.js +66 -17
- package/lib-node/value/reference.js +24 -29
- package/lib-node/views/array-view.js +5 -6
- package/lib-node/views/base-view.js +14 -27
- package/lib-node/views/map-view.js +4 -5
- package/lib-node/views/repeat-node.js +17 -35
- package/lib-node/views/set-view.js +7 -5
- package/package.json +9 -6
- package/types/binding/attribute.d.ts +2 -2
- package/types/binding/binding.d.ts +1 -1
- package/types/binding/style.d.ts +3 -2
- package/types/core/config.d.ts +3 -0
- package/types/core/core.d.ts +18 -93
- package/types/core/destroyable.d.ts +11 -6
- package/types/core/ivalue.d.ts +7 -24
- package/types/functional/options.d.ts +7 -22
- package/types/functional/safety.d.ts +2 -0
- package/types/index.d.ts +8 -10
- package/types/models/array-model.d.ts +6 -55
- package/types/models/listener.d.ts +0 -26
- package/types/models/map-model.d.ts +3 -4
- package/types/models/model.d.ts +2 -9
- package/types/models/set-model.d.ts +1 -2
- package/types/node/app.d.ts +7 -25
- package/types/node/node.d.ts +105 -222
- package/types/node/watch.d.ts +4 -5
- package/types/spec/html.d.ts +231 -231
- package/types/spec/svg.d.ts +166 -166
- package/types/tsconfig-types.tsbuildinfo +1 -1
- package/types/value/expression.d.ts +5 -7
- package/types/value/mirror.d.ts +4 -6
- package/types/value/pointer.d.ts +26 -9
- package/types/value/reference.d.ts +6 -7
- package/types/views/array-view.d.ts +3 -3
- package/types/views/base-view.d.ts +15 -23
- package/types/views/map-view.d.ts +2 -2
- package/types/views/repeat-node.d.ts +9 -23
- package/types/views/set-view.d.ts +3 -2
- package/cdn/es2015.js +0 -2480
- package/flow-typed/vasille.js +0 -2613
package/types/core/core.d.ts
CHANGED
|
@@ -1,100 +1,46 @@
|
|
|
1
1
|
import { Destroyable } from "./destroyable.js";
|
|
2
|
-
import { IValue
|
|
3
|
-
import {
|
|
2
|
+
import { IValue } from "./ivalue.js";
|
|
3
|
+
import { KindOfIValue } from "../value/expression";
|
|
4
4
|
import { Pointer } from "../value/pointer";
|
|
5
|
-
import { Mirror } from "../value/mirror";
|
|
6
|
-
import { IModel } from "../models/model";
|
|
7
|
-
import { FragmentOptions } from "../functional/options";
|
|
8
|
-
export declare let current: Reactive | null;
|
|
9
|
-
export declare function stack(node: Reactive): void;
|
|
10
|
-
export declare function unstack(): void;
|
|
11
5
|
/**
|
|
12
|
-
*
|
|
13
|
-
* @class
|
|
6
|
+
* A reactive object
|
|
7
|
+
* @class Reactive
|
|
14
8
|
* @extends Destroyable
|
|
15
9
|
*/
|
|
16
|
-
export declare class
|
|
10
|
+
export declare class Reactive<T extends object = object> extends Destroyable {
|
|
17
11
|
/**
|
|
18
12
|
* A list of user-defined values
|
|
19
13
|
* @type {Set}
|
|
20
14
|
*/
|
|
21
|
-
|
|
15
|
+
private _watch;
|
|
22
16
|
/**
|
|
23
17
|
* A list of user-defined bindings
|
|
24
18
|
* @type {Set}
|
|
25
19
|
*/
|
|
26
|
-
bindings
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
models: Set<IModel>;
|
|
31
|
-
/**
|
|
32
|
-
* Reactivity switch state
|
|
33
|
-
* @type {boolean}
|
|
34
|
-
*/
|
|
35
|
-
enabled: boolean;
|
|
36
|
-
/**
|
|
37
|
-
* The frozen state of object
|
|
38
|
-
* @type {boolean}
|
|
39
|
-
*/
|
|
40
|
-
frozen: boolean;
|
|
41
|
-
/**
|
|
42
|
-
* An expression which will freeze/unfreeze the object
|
|
43
|
-
* @type {IValue<void>}
|
|
44
|
-
*/
|
|
45
|
-
freezeExpr: Expression<void, [boolean]>;
|
|
46
|
-
/**
|
|
47
|
-
* Parent node
|
|
48
|
-
* @type {Reactive}
|
|
49
|
-
*/
|
|
50
|
-
parent: Reactive;
|
|
51
|
-
onDestroy?: () => void;
|
|
52
|
-
constructor();
|
|
53
|
-
$destroy(): void;
|
|
54
|
-
}
|
|
55
|
-
/**
|
|
56
|
-
* A reactive object
|
|
57
|
-
* @class Reactive
|
|
58
|
-
* @extends Destroyable
|
|
59
|
-
*/
|
|
60
|
-
export declare class Reactive<T extends FragmentOptions = FragmentOptions> extends Destroyable {
|
|
61
|
-
/**
|
|
62
|
-
* Private stuff
|
|
63
|
-
* @protected
|
|
64
|
-
*/
|
|
65
|
-
protected $: ReactivePrivate;
|
|
66
|
-
input: T;
|
|
67
|
-
constructor(input: T, $?: ReactivePrivate);
|
|
68
|
-
/**
|
|
69
|
-
* Get parent node
|
|
70
|
-
*/
|
|
71
|
-
get parent(): Reactive;
|
|
20
|
+
private bindings;
|
|
21
|
+
private onDestroy?;
|
|
22
|
+
readonly input: T;
|
|
23
|
+
constructor(input: T);
|
|
72
24
|
/**
|
|
73
25
|
* Create a reference
|
|
74
26
|
* @param value {*} value to reference
|
|
75
27
|
*/
|
|
76
28
|
ref<T>(value: T): IValue<T>;
|
|
77
29
|
/**
|
|
78
|
-
* Create a
|
|
79
|
-
* @param value {IValue} value to
|
|
30
|
+
* Create a forward-only pointer
|
|
31
|
+
* @param value {IValue} value to point
|
|
80
32
|
*/
|
|
81
|
-
|
|
82
|
-
/**
|
|
83
|
-
* Create a forward-only mirror
|
|
84
|
-
* @param value {IValue} value to mirror
|
|
85
|
-
*/
|
|
86
|
-
forward<T>(value: IValue<T>): Mirror<T>;
|
|
33
|
+
forward<T>(value: IValue<T>): IValue<T>;
|
|
87
34
|
/**
|
|
88
35
|
* Creates a pointer
|
|
89
36
|
* @param value {*} default value to point
|
|
90
|
-
* @param forwardOnly {boolean} forward only sync
|
|
91
37
|
*/
|
|
92
|
-
|
|
38
|
+
own<T>(value: IValue<T>): Pointer<T>;
|
|
93
39
|
/**
|
|
94
|
-
* Register a model
|
|
95
|
-
* @param model
|
|
40
|
+
* Register a model/dependency
|
|
96
41
|
*/
|
|
97
|
-
register<T extends
|
|
42
|
+
register<T extends Destroyable>(data: T): T;
|
|
43
|
+
release(data: Destroyable): void;
|
|
98
44
|
/**
|
|
99
45
|
* Creates a watcher
|
|
100
46
|
* @param func {function} function to run on any argument change
|
|
@@ -108,27 +54,6 @@ export declare class Reactive<T extends FragmentOptions = FragmentOptions> exten
|
|
|
108
54
|
* @return {IValue} the created ivalue
|
|
109
55
|
*/
|
|
110
56
|
expr<T, Args extends unknown[]>(func: (...args: Args) => T, ...values: KindOfIValue<Args>): IValue<T>;
|
|
111
|
-
/**
|
|
112
|
-
* Enable reactivity of fields
|
|
113
|
-
*/
|
|
114
|
-
enable(): void;
|
|
115
|
-
/**
|
|
116
|
-
* Disable reactivity of fields
|
|
117
|
-
*/
|
|
118
|
-
disable(): void;
|
|
119
|
-
/**
|
|
120
|
-
* Disable/Enable reactivity of object fields with feedback
|
|
121
|
-
* @param cond {IValue} show condition
|
|
122
|
-
* @param onOff {function} on show feedback
|
|
123
|
-
* @param onOn {function} on hide feedback
|
|
124
|
-
*/
|
|
125
|
-
bindAlive(cond: IValue<boolean>, onOff?: () => void, onOn?: () => void): this;
|
|
126
|
-
init(): T['return'];
|
|
127
|
-
protected applyOptions(input: T): void;
|
|
128
|
-
protected applyOptionsNow(): void;
|
|
129
|
-
protected compose(input: T): T['return'];
|
|
130
|
-
protected composeNow(): T['return'];
|
|
131
|
-
runFunctional<F extends (...args: any) => any>(f: F, ...args: Parameters<F>): ReturnType<F>;
|
|
132
57
|
runOnDestroy(func: () => void): void;
|
|
133
|
-
|
|
58
|
+
destroy(): void;
|
|
134
59
|
}
|
|
@@ -1,15 +1,20 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Mark an object which can be destroyed
|
|
3
|
-
* @
|
|
3
|
+
* @interface IDestroyable
|
|
4
4
|
*/
|
|
5
|
-
export
|
|
5
|
+
export interface IDestroyable {
|
|
6
6
|
/**
|
|
7
|
-
*
|
|
8
|
-
* @protected
|
|
7
|
+
* Garbage collector method
|
|
9
8
|
*/
|
|
10
|
-
|
|
9
|
+
destroy(): void;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Mark an object which can be destroyed
|
|
13
|
+
* @class Destroyable
|
|
14
|
+
*/
|
|
15
|
+
export declare class Destroyable implements IDestroyable {
|
|
11
16
|
/**
|
|
12
17
|
* Garbage collector method
|
|
13
18
|
*/
|
|
14
|
-
|
|
19
|
+
destroy(): void;
|
|
15
20
|
}
|
package/types/core/ivalue.d.ts
CHANGED
|
@@ -1,47 +1,30 @@
|
|
|
1
1
|
import { Destroyable } from "./destroyable.js";
|
|
2
|
-
export declare class Switchable extends Destroyable {
|
|
3
|
-
/**
|
|
4
|
-
* Enable update handlers triggering
|
|
5
|
-
*/
|
|
6
|
-
$enable(): void;
|
|
7
|
-
/**
|
|
8
|
-
* disable update handlers triggering
|
|
9
|
-
*/
|
|
10
|
-
$disable(): void;
|
|
11
|
-
}
|
|
12
2
|
/**
|
|
13
3
|
* Interface which describes a value
|
|
14
4
|
* @class IValue
|
|
15
5
|
* @extends Destroyable
|
|
16
6
|
*/
|
|
17
|
-
export declare class IValue<T> extends
|
|
18
|
-
/**
|
|
19
|
-
* Is enabled state flag
|
|
20
|
-
* @protected
|
|
21
|
-
*/
|
|
22
|
-
protected isEnabled: boolean;
|
|
23
|
-
/**
|
|
24
|
-
* @param isEnabled {boolean} initial is enabled state
|
|
25
|
-
*/
|
|
26
|
-
constructor(isEnabled: boolean);
|
|
7
|
+
export declare abstract class IValue<T> extends Destroyable {
|
|
27
8
|
/**
|
|
28
9
|
* Get the encapsulated value
|
|
29
10
|
* @return {*} the encapsulated value
|
|
30
11
|
*/
|
|
31
|
-
get $(): T;
|
|
12
|
+
abstract get $(): T;
|
|
32
13
|
/**
|
|
33
14
|
* Sets the encapsulated value
|
|
34
15
|
* @param value {*} value to encapsulate
|
|
35
16
|
*/
|
|
36
|
-
set $(value: T);
|
|
17
|
+
abstract set $(value: T);
|
|
37
18
|
/**
|
|
38
19
|
* Add a new handler to value change
|
|
39
20
|
* @param handler {function(value : *)} the handler to add
|
|
40
21
|
*/
|
|
41
|
-
|
|
22
|
+
abstract on(handler: (value: T) => void): void;
|
|
42
23
|
/**
|
|
43
24
|
* Removes a handler of value change
|
|
44
25
|
* @param handler {function(value : *)} the handler to remove
|
|
45
26
|
*/
|
|
46
|
-
|
|
27
|
+
abstract off(handler: (value: T) => void): void;
|
|
28
|
+
toJSON(): T;
|
|
29
|
+
toString(): string;
|
|
47
30
|
}
|
|
@@ -1,25 +1,10 @@
|
|
|
1
1
|
import type { IValue } from "../core/ivalue";
|
|
2
|
-
import { AcceptedTagsMap, AcceptedTagsSpec } from "../spec/react";
|
|
3
|
-
import type { Fragment } from "../node/node";
|
|
4
|
-
export interface FragmentOptions {
|
|
5
|
-
"v:is"?: Record<string, IValue<any>>;
|
|
6
|
-
return?: {
|
|
7
|
-
[key: string]: any;
|
|
8
|
-
};
|
|
9
|
-
slot?: (node: Fragment, ...args: any[]) => void;
|
|
10
|
-
}
|
|
11
2
|
export type AttrType<T> = IValue<T | string | null> | T | string | null | undefined;
|
|
12
|
-
export
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
style?: Record<string, string | IValue<string> | [number | string | IValue<number | string>, string]>;
|
|
20
|
-
"v:events"?: Partial<AcceptedTagsSpec[T]['events']>;
|
|
21
|
-
"v:set"?: Partial<AcceptedTagsMap[T]> & Record<string, any>;
|
|
22
|
-
"v:bind"?: {
|
|
23
|
-
[K in keyof AcceptedTagsMap[T]]?: IValue<AcceptedTagsMap[T][K]>;
|
|
24
|
-
} & Record<string, IValue<any>>;
|
|
3
|
+
export type StyleType<T> = T | number | number[] | IValue<string | number | number[]>;
|
|
4
|
+
export interface TagOptions {
|
|
5
|
+
attr?: Record<string, AttrType<number | boolean>>;
|
|
6
|
+
class?: (string | IValue<string> | Record<string, boolean | IValue<boolean>>)[];
|
|
7
|
+
style?: Record<string, StyleType<string>>;
|
|
8
|
+
events?: Record<string, (...args: unknown[]) => unknown>;
|
|
9
|
+
bind?: Record<string, any>;
|
|
25
10
|
}
|
package/types/index.d.ts
CHANGED
|
@@ -1,26 +1,24 @@
|
|
|
1
|
+
import { config } from "./core/config";
|
|
1
2
|
import { Destroyable } from "./core/destroyable";
|
|
2
|
-
import {
|
|
3
|
+
import { Reactive } from "./core/core";
|
|
3
4
|
import { IValue } from "./core/ivalue";
|
|
4
|
-
import {
|
|
5
|
+
import { reportError, setErrorHandler } from "./functional/safety";
|
|
6
|
+
import { ArrayModel, proxyArrayModel } from "./models/array-model";
|
|
5
7
|
import { Listener } from "./models/listener";
|
|
6
8
|
import { MapModel } from "./models/map-model";
|
|
7
|
-
import { ObjectModel } from "./models/object-model";
|
|
8
9
|
import { SetModel } from "./models/set-model";
|
|
9
|
-
import { App,
|
|
10
|
-
import {
|
|
10
|
+
import { App, Portal } from "./node/app";
|
|
11
|
+
import { Extension, Fragment, INode, Tag, TagOptionsWithSlot } from "./node/node";
|
|
11
12
|
import { Expression, KindOfIValue } from "./value/expression";
|
|
12
|
-
import { Mirror } from "./value/mirror";
|
|
13
13
|
import { Pointer } from "./value/pointer";
|
|
14
14
|
import { Reference } from "./value/reference";
|
|
15
15
|
import { ArrayView } from "./views/array-view";
|
|
16
16
|
import { BaseView } from "./views/base-view";
|
|
17
17
|
import { MapView } from "./views/map-view";
|
|
18
|
-
import { ObjectView } from "./views/object-view";
|
|
19
18
|
import { SetView } from "./views/set-view";
|
|
20
19
|
import { Binding } from "./binding/binding";
|
|
21
|
-
import {
|
|
22
|
-
import { AcceptedTagsMap, AcceptedTagsSpec } from "./spec/react";
|
|
20
|
+
import { TagOptions } from "./functional/options";
|
|
23
21
|
import { userError } from "./core/errors";
|
|
24
22
|
import { ListenableModel } from "./models/model";
|
|
25
23
|
import { Watch } from "./node/watch";
|
|
26
|
-
export { Destroyable, IValue, Reference,
|
|
24
|
+
export { Destroyable, IValue, Reference, Pointer, ArrayModel, proxyArrayModel, MapModel, SetModel, BaseView, Listener, ArrayView, MapView, SetView, Fragment, INode, Tag, Extension, App, Portal, Expression, Binding, Reactive, Watch, TagOptions, KindOfIValue, ListenableModel, TagOptionsWithSlot, userError, config, setErrorHandler, reportError, };
|
|
@@ -7,15 +7,11 @@ import { ListenableModel } from "./model";
|
|
|
7
7
|
*/
|
|
8
8
|
export declare class ArrayModel<T> extends Array<T> implements ListenableModel<T, T> {
|
|
9
9
|
listener: Listener<T, T>;
|
|
10
|
+
passive: boolean;
|
|
10
11
|
/**
|
|
11
12
|
* @param data {Array} input data
|
|
12
13
|
*/
|
|
13
|
-
constructor(data?: Array<T>);
|
|
14
|
-
/**
|
|
15
|
-
* Gets the last item of array
|
|
16
|
-
* @return {*} the last item of array
|
|
17
|
-
*/
|
|
18
|
-
get last(): T;
|
|
14
|
+
constructor(data?: Array<T> | number);
|
|
19
15
|
/**
|
|
20
16
|
* Calls Array.fill and notify about changes
|
|
21
17
|
* @param value {*} value to fill with
|
|
@@ -27,7 +23,7 @@ export declare class ArrayModel<T> extends Array<T> implements ListenableModel<T
|
|
|
27
23
|
* Calls Array.pop and notify about changes
|
|
28
24
|
* @return {*} removed value
|
|
29
25
|
*/
|
|
30
|
-
pop(): T;
|
|
26
|
+
pop(): T | undefined;
|
|
31
27
|
/**
|
|
32
28
|
* Calls Array.push and notify about changes
|
|
33
29
|
* @param items {...*} values to push
|
|
@@ -38,7 +34,7 @@ export declare class ArrayModel<T> extends Array<T> implements ListenableModel<T
|
|
|
38
34
|
* Calls Array.shift and notify about changed
|
|
39
35
|
* @return {*} the shifted value
|
|
40
36
|
*/
|
|
41
|
-
shift(): T;
|
|
37
|
+
shift(): T | undefined;
|
|
42
38
|
/**
|
|
43
39
|
* Calls Array.splice and notify about changed
|
|
44
40
|
* @param start {number} start index
|
|
@@ -53,52 +49,7 @@ export declare class ArrayModel<T> extends Array<T> implements ListenableModel<T
|
|
|
53
49
|
* @return {number} the length after prepend
|
|
54
50
|
*/
|
|
55
51
|
unshift(...items: Array<T>): number;
|
|
56
|
-
/**
|
|
57
|
-
* Inserts a value to the end of array
|
|
58
|
-
* @param v {*} value to insert
|
|
59
|
-
*/
|
|
60
|
-
append(v: T): this;
|
|
61
|
-
/**
|
|
62
|
-
* Clears array
|
|
63
|
-
* @return {this} a pointer to this
|
|
64
|
-
*/
|
|
65
|
-
clear(): this;
|
|
66
|
-
/**
|
|
67
|
-
* Inserts a value to position `index`
|
|
68
|
-
* @param index {number} index to insert value
|
|
69
|
-
* @param v {*} value to insert
|
|
70
|
-
* @return {this} a pointer to this
|
|
71
|
-
*/
|
|
72
|
-
insert(index: number, v: T): this;
|
|
73
|
-
/**
|
|
74
|
-
* Inserts a value to the beginning of array
|
|
75
|
-
* @param v {*} value to insert
|
|
76
|
-
* @return {this} a pointer to this
|
|
77
|
-
*/
|
|
78
|
-
prepend(v: T): this;
|
|
79
|
-
/**
|
|
80
|
-
* Removes a value from an index
|
|
81
|
-
* @param index {number} index of value to remove
|
|
82
|
-
* @return {this} a pointer to this
|
|
83
|
-
*/
|
|
84
|
-
removeAt(index: number): this;
|
|
85
|
-
/**
|
|
86
|
-
* Removes the first value of array
|
|
87
|
-
* @return {this} a pointer to this
|
|
88
|
-
*/
|
|
89
|
-
removeFirst(): this;
|
|
90
|
-
/**
|
|
91
|
-
* Removes the ast value of array
|
|
92
|
-
* @return {this} a pointer to this
|
|
93
|
-
*/
|
|
94
|
-
removeLast(): this;
|
|
95
|
-
/**
|
|
96
|
-
* Remove the first occurrence of value
|
|
97
|
-
* @param v {*} value to remove
|
|
98
|
-
* @return {this}
|
|
99
|
-
*/
|
|
100
|
-
removeOne(v: T): this;
|
|
101
52
|
replace(at: number, with_: T): this;
|
|
102
|
-
|
|
103
|
-
disableReactivity(): void;
|
|
53
|
+
destroy(): void;
|
|
104
54
|
}
|
|
55
|
+
export declare function proxyArrayModel<T>(arr: ArrayModel<T>): ArrayModel<T>;
|
|
@@ -13,24 +13,6 @@ export declare class Listener<ValueT, IndexT = string | number> {
|
|
|
13
13
|
* @type Set
|
|
14
14
|
*/
|
|
15
15
|
private readonly onRemoved;
|
|
16
|
-
/**
|
|
17
|
-
* Describe the frozen state of model
|
|
18
|
-
* @type boolean
|
|
19
|
-
* @private
|
|
20
|
-
*/
|
|
21
|
-
private frozen;
|
|
22
|
-
/**
|
|
23
|
-
* The queue of operations in frozen state
|
|
24
|
-
* @type Object[]
|
|
25
|
-
* @private
|
|
26
|
-
*/
|
|
27
|
-
private readonly queue;
|
|
28
|
-
constructor();
|
|
29
|
-
/**
|
|
30
|
-
* Exclude the repeated operation in queue
|
|
31
|
-
* @private
|
|
32
|
-
*/
|
|
33
|
-
private excludeRepeat;
|
|
34
16
|
/**
|
|
35
17
|
* Emits added event to listeners
|
|
36
18
|
* @param index {*} index of value
|
|
@@ -63,12 +45,4 @@ export declare class Listener<ValueT, IndexT = string | number> {
|
|
|
63
45
|
* @param handler {function} handler to remove
|
|
64
46
|
*/
|
|
65
47
|
offRemove(handler: (index: IndexT, value: ValueT) => void): void;
|
|
66
|
-
/**
|
|
67
|
-
* Run all queued operation and enable reactivity
|
|
68
|
-
*/
|
|
69
|
-
enableReactivity(): void;
|
|
70
|
-
/**
|
|
71
|
-
* Disable the reactivity and enable the queue
|
|
72
|
-
*/
|
|
73
|
-
disableReactivity(): void;
|
|
74
48
|
}
|
|
@@ -14,7 +14,7 @@ export declare class MapModel<K, T> extends Map<K, T> implements ListenableModel
|
|
|
14
14
|
*/
|
|
15
15
|
constructor(map?: [K, T][]);
|
|
16
16
|
/**
|
|
17
|
-
* Calls Map.clear and notify
|
|
17
|
+
* Calls Map.clear and notify about changes
|
|
18
18
|
*/
|
|
19
19
|
clear(): void;
|
|
20
20
|
/**
|
|
@@ -22,7 +22,7 @@ export declare class MapModel<K, T> extends Map<K, T> implements ListenableModel
|
|
|
22
22
|
* @param key {*} key
|
|
23
23
|
* @return {boolean} true if removed something, otherwise false
|
|
24
24
|
*/
|
|
25
|
-
delete(key:
|
|
25
|
+
delete(key: K): boolean;
|
|
26
26
|
/**
|
|
27
27
|
* Calls Map.set and notify abut changes
|
|
28
28
|
* @param key {*} key
|
|
@@ -30,6 +30,5 @@ export declare class MapModel<K, T> extends Map<K, T> implements ListenableModel
|
|
|
30
30
|
* @return {MapModel} a pointer to this
|
|
31
31
|
*/
|
|
32
32
|
set(key: K, value: T): this;
|
|
33
|
-
|
|
34
|
-
disableReactivity(): void;
|
|
33
|
+
destroy(): void;
|
|
35
34
|
}
|
package/types/models/model.d.ts
CHANGED
|
@@ -1,16 +1,9 @@
|
|
|
1
|
+
import { IDestroyable } from "../core/destroyable";
|
|
1
2
|
import { Listener } from "./listener";
|
|
2
3
|
/**
|
|
3
4
|
* @interface IModel
|
|
4
5
|
*/
|
|
5
|
-
export interface IModel {
|
|
6
|
-
/**
|
|
7
|
-
* Enable the reactivity of model
|
|
8
|
-
*/
|
|
9
|
-
enableReactivity(): void;
|
|
10
|
-
/**
|
|
11
|
-
* Disable the reactivity of model
|
|
12
|
-
*/
|
|
13
|
-
disableReactivity(): void;
|
|
6
|
+
export interface IModel extends IDestroyable {
|
|
14
7
|
}
|
|
15
8
|
export interface ListenableModel<K, T> extends IModel {
|
|
16
9
|
/**
|
|
@@ -29,6 +29,5 @@ export declare class SetModel<T> extends Set<T> implements ListenableModel<T, T>
|
|
|
29
29
|
* @return {boolean} true if a value was deleted, otherwise false
|
|
30
30
|
*/
|
|
31
31
|
delete(value: T): boolean;
|
|
32
|
-
|
|
33
|
-
disableReactivity(): void;
|
|
32
|
+
destroy(): void;
|
|
34
33
|
}
|
package/types/node/app.d.ts
CHANGED
|
@@ -1,30 +1,11 @@
|
|
|
1
|
-
import { Fragment,
|
|
2
|
-
import { TagOptions } from "../functional/options";
|
|
3
|
-
import { AcceptedTagsMap } from "../spec/react";
|
|
4
|
-
export interface AppOptions<K extends keyof AcceptedTagsMap> extends TagOptions<K> {
|
|
5
|
-
debugUi?: boolean;
|
|
6
|
-
}
|
|
7
|
-
/**
|
|
8
|
-
* Application Node
|
|
9
|
-
* @class AppNode
|
|
10
|
-
* @extends INode
|
|
11
|
-
*/
|
|
12
|
-
export declare class AppNode<T extends AppOptions<any> = AppOptions<any>> extends INode<T> {
|
|
13
|
-
/**
|
|
14
|
-
* Enables debug comments
|
|
15
|
-
*/
|
|
16
|
-
debugUi: boolean;
|
|
17
|
-
/**
|
|
18
|
-
* @param input
|
|
19
|
-
*/
|
|
20
|
-
constructor(input: T);
|
|
21
|
-
}
|
|
1
|
+
import { Fragment, Root } from "./node";
|
|
22
2
|
/**
|
|
23
3
|
* Represents a Vasille.js application
|
|
24
4
|
* @class App
|
|
25
5
|
* @extends AppNode
|
|
26
6
|
*/
|
|
27
|
-
export declare class App<T extends
|
|
7
|
+
export declare class App<T extends object = object> extends Root<T> {
|
|
8
|
+
private node;
|
|
28
9
|
/**
|
|
29
10
|
* Constructs an app node
|
|
30
11
|
* @param node {Element} The root of application
|
|
@@ -33,11 +14,12 @@ export declare class App<T extends AppOptions<any> = AppOptions<any>> extends Ap
|
|
|
33
14
|
constructor(node: Element, input: T);
|
|
34
15
|
appendNode(node: Node): void;
|
|
35
16
|
}
|
|
36
|
-
interface PortalOptions
|
|
17
|
+
interface PortalOptions {
|
|
37
18
|
node: Element;
|
|
38
|
-
slot?: (
|
|
19
|
+
slot?: (ctx: Fragment) => void;
|
|
39
20
|
}
|
|
40
|
-
export declare class Portal extends
|
|
21
|
+
export declare class Portal extends Fragment {
|
|
22
|
+
private node;
|
|
41
23
|
constructor(input: PortalOptions);
|
|
42
24
|
appendNode(node: Node): void;
|
|
43
25
|
}
|