vasille 2.3.8 → 3.0.0
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 +122 -0
- 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 +4 -4
- 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/node/node.d.ts
CHANGED
|
@@ -1,83 +1,17 @@
|
|
|
1
|
-
import { Reactive
|
|
1
|
+
import { Reactive } from "../core/core";
|
|
2
2
|
import { IValue } from "../core/ivalue";
|
|
3
|
-
import
|
|
4
|
-
import { FragmentOptions, TagOptions } from "../functional/options";
|
|
5
|
-
import { AcceptedTagsMap } from "../spec/react";
|
|
6
|
-
/**
|
|
7
|
-
* Represents a Vasille.js node
|
|
8
|
-
* @class FragmentPrivate
|
|
9
|
-
* @extends ReactivePrivate
|
|
10
|
-
*/
|
|
11
|
-
export declare class FragmentPrivate extends ReactivePrivate {
|
|
12
|
-
/**
|
|
13
|
-
* The app node
|
|
14
|
-
* @type {AppNode}
|
|
15
|
-
*/
|
|
16
|
-
app: AppNode;
|
|
17
|
-
/**
|
|
18
|
-
* Parent node
|
|
19
|
-
* @type {Fragment}
|
|
20
|
-
*/
|
|
21
|
-
parent: Fragment;
|
|
22
|
-
/**
|
|
23
|
-
* Next node
|
|
24
|
-
* @type {?Fragment}
|
|
25
|
-
*/
|
|
26
|
-
next?: Fragment;
|
|
27
|
-
/**
|
|
28
|
-
* Previous node
|
|
29
|
-
* @type {?Fragment}
|
|
30
|
-
*/
|
|
31
|
-
prev?: Fragment;
|
|
32
|
-
constructor();
|
|
33
|
-
/**
|
|
34
|
-
* Pre-initializes the base of a fragment
|
|
35
|
-
* @param app {App} the app node
|
|
36
|
-
* @param parent {Fragment} the parent node
|
|
37
|
-
*/
|
|
38
|
-
preinit(app: AppNode, parent: Fragment): void;
|
|
39
|
-
/**
|
|
40
|
-
* Unlinks all bindings
|
|
41
|
-
*/
|
|
42
|
-
$destroy(): void;
|
|
43
|
-
}
|
|
3
|
+
import { AttrType, TagOptions } from "../functional/options";
|
|
44
4
|
/**
|
|
45
5
|
* This class is symbolic
|
|
46
6
|
* @extends Reactive
|
|
47
7
|
*/
|
|
48
|
-
export declare class
|
|
49
|
-
/**
|
|
50
|
-
* Private part
|
|
51
|
-
* @protected
|
|
52
|
-
*/
|
|
53
|
-
protected $: FragmentPrivate;
|
|
8
|
+
export declare abstract class Root<T extends object = object> extends Reactive<T> {
|
|
54
9
|
/**
|
|
55
10
|
* The children list
|
|
56
11
|
* @type Array
|
|
57
12
|
*/
|
|
58
13
|
children: Set<Fragment>;
|
|
59
|
-
lastChild: Fragment |
|
|
60
|
-
/**
|
|
61
|
-
* Constructs a Vasille Node
|
|
62
|
-
* @param input
|
|
63
|
-
* @param $ {FragmentPrivate}
|
|
64
|
-
*/
|
|
65
|
-
constructor(input: T, $?: FragmentPrivate);
|
|
66
|
-
/**
|
|
67
|
-
* Gets the app of node
|
|
68
|
-
*/
|
|
69
|
-
get app(): AppNode;
|
|
70
|
-
/**
|
|
71
|
-
* Prepare to init fragment
|
|
72
|
-
* @param app {AppNode} app of node
|
|
73
|
-
* @param parent {Fragment} parent of node
|
|
74
|
-
* @param data {*} additional data
|
|
75
|
-
*/
|
|
76
|
-
preinit(app: AppNode, parent: Fragment, data?: unknown): void;
|
|
77
|
-
init(): T['return'];
|
|
78
|
-
protected compose(input: T): T['return'];
|
|
79
|
-
/** To be overloaded: ready event handler */
|
|
80
|
-
ready(): void;
|
|
14
|
+
lastChild: Fragment | undefined;
|
|
81
15
|
/**
|
|
82
16
|
* Pushes a node to children immediately
|
|
83
17
|
* @param node {Fragment} A node to push
|
|
@@ -85,58 +19,53 @@ export declare class Fragment<T extends FragmentOptions = FragmentOptions> exten
|
|
|
85
19
|
*/
|
|
86
20
|
protected pushNode(node: Fragment): void;
|
|
87
21
|
/**
|
|
88
|
-
* Find first node in element if so exists
|
|
22
|
+
* Find the first node in the element if so exists
|
|
89
23
|
* @return {?Element}
|
|
90
24
|
* @protected
|
|
91
25
|
*/
|
|
92
|
-
protected findFirstChild(): Node;
|
|
26
|
+
protected findFirstChild(): Node | undefined;
|
|
93
27
|
/**
|
|
94
28
|
* Append a node to end of element
|
|
95
29
|
* @param node {Node} node to insert
|
|
96
30
|
*/
|
|
97
|
-
appendNode(node: Node): void;
|
|
98
|
-
/**
|
|
99
|
-
* Insert a node as a sibling of this
|
|
100
|
-
* @param node {Node} node to insert
|
|
101
|
-
*/
|
|
102
|
-
insertAdjacent(node: Node): void;
|
|
31
|
+
abstract appendNode(node: Node): void;
|
|
103
32
|
/**
|
|
104
33
|
* Defines a text fragment
|
|
105
34
|
* @param text {String | IValue} A text fragment string
|
|
106
35
|
* @param cb {function (TextNode)} Callback if previous is slot name
|
|
107
36
|
*/
|
|
108
|
-
text(text:
|
|
109
|
-
debug(text: IValue<
|
|
37
|
+
text(text: unknown): void;
|
|
38
|
+
debug(text: IValue<unknown>): void;
|
|
110
39
|
/**
|
|
111
40
|
* Defines a tag element
|
|
112
41
|
* @param tagName {String} the tag name
|
|
113
42
|
* @param input
|
|
114
43
|
* @param cb {function(Tag, *)} callback
|
|
115
44
|
*/
|
|
116
|
-
tag
|
|
45
|
+
tag(tagName: string, input: TagOptionsWithSlot, cb?: (ctx: Tag) => void): void;
|
|
117
46
|
/**
|
|
118
47
|
* Defines a custom element
|
|
119
48
|
* @param node {Fragment} vasille element to insert
|
|
120
49
|
* @param callback {function($ : *)}
|
|
121
50
|
*/
|
|
122
|
-
create<T extends Fragment>(node: T, callback?: T
|
|
51
|
+
create<T extends Fragment>(node: T, callback?: (ctx: T) => void): void;
|
|
123
52
|
/**
|
|
124
53
|
* Defines an if node
|
|
125
54
|
* @param cond {IValue} condition
|
|
126
55
|
* @param cb {function(Fragment)} callback to run on true
|
|
127
56
|
* @return {this}
|
|
128
57
|
*/
|
|
129
|
-
if(cond: IValue<
|
|
58
|
+
if(cond: IValue<unknown>, cb: (node: Fragment) => void): void;
|
|
130
59
|
else(cb: (node: Fragment) => void): void;
|
|
131
|
-
elif(cond: IValue<
|
|
60
|
+
elif(cond: IValue<unknown>, cb: (node: Fragment) => void): void;
|
|
132
61
|
/**
|
|
133
62
|
* Create a case for switch
|
|
134
63
|
* @param cond {IValue<boolean>}
|
|
135
64
|
* @param cb {function(Fragment) : void}
|
|
136
65
|
* @return {{cond : IValue, cb : (function(Fragment) : void)}}
|
|
137
66
|
*/
|
|
138
|
-
case(cond: IValue<
|
|
139
|
-
cond: IValue<
|
|
67
|
+
case(cond: IValue<unknown>, cb: (node: Fragment) => void): {
|
|
68
|
+
cond: IValue<unknown>;
|
|
140
69
|
cb: (node: Fragment) => void;
|
|
141
70
|
};
|
|
142
71
|
/**
|
|
@@ -147,230 +76,203 @@ export declare class Fragment<T extends FragmentOptions = FragmentOptions> exten
|
|
|
147
76
|
cond: IValue<boolean>;
|
|
148
77
|
cb: (node: Fragment) => void;
|
|
149
78
|
};
|
|
150
|
-
|
|
151
|
-
insertAfter(node: Fragment): void;
|
|
152
|
-
remove(): void;
|
|
153
|
-
$destroy(): void;
|
|
79
|
+
destroy(): void;
|
|
154
80
|
}
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
*/
|
|
160
|
-
export declare class TextNodePrivate extends FragmentPrivate {
|
|
161
|
-
node: Text;
|
|
162
|
-
constructor();
|
|
81
|
+
export declare class Fragment<T extends object = object> extends Root<T> {
|
|
82
|
+
readonly name?: string;
|
|
83
|
+
parent: Root;
|
|
84
|
+
constructor(input: T, name?: string);
|
|
163
85
|
/**
|
|
164
|
-
*
|
|
165
|
-
* @
|
|
166
|
-
* @param parent
|
|
167
|
-
* @param text {IValue}
|
|
86
|
+
* Next node
|
|
87
|
+
* @type {?Fragment}
|
|
168
88
|
*/
|
|
169
|
-
|
|
89
|
+
protected next?: Fragment;
|
|
170
90
|
/**
|
|
171
|
-
*
|
|
91
|
+
* Previous node
|
|
92
|
+
* @type {?Fragment}
|
|
172
93
|
*/
|
|
173
|
-
|
|
94
|
+
protected prev?: Fragment;
|
|
95
|
+
/**
|
|
96
|
+
* Pushes a node to children immediately
|
|
97
|
+
* @param node {Fragment} A node to push
|
|
98
|
+
* @protected
|
|
99
|
+
*/
|
|
100
|
+
protected pushNode(node: Fragment): void;
|
|
101
|
+
/**
|
|
102
|
+
* Append a node to end of element
|
|
103
|
+
* @param node {Node} node to insert
|
|
104
|
+
*/
|
|
105
|
+
appendNode(node: Node): void;
|
|
106
|
+
/**
|
|
107
|
+
* Insert a node as a sibling of this
|
|
108
|
+
* @param node {Node} node to insert
|
|
109
|
+
*/
|
|
110
|
+
insertAdjacent(node: Node): void;
|
|
111
|
+
compose(): void;
|
|
112
|
+
insertBefore(node: Fragment): void;
|
|
113
|
+
insertAfter(node: Fragment): void;
|
|
114
|
+
remove(): void;
|
|
115
|
+
destroy(): void;
|
|
116
|
+
}
|
|
117
|
+
interface TextProps {
|
|
118
|
+
text: unknown;
|
|
174
119
|
}
|
|
175
120
|
/**
|
|
176
121
|
* Represents a text node
|
|
177
122
|
* @class TextNode
|
|
178
123
|
* @extends Fragment
|
|
179
124
|
*/
|
|
180
|
-
export declare class TextNode extends Fragment {
|
|
181
|
-
|
|
182
|
-
constructor(
|
|
183
|
-
|
|
125
|
+
export declare class TextNode extends Fragment<TextProps> {
|
|
126
|
+
private node;
|
|
127
|
+
constructor(input: TextProps);
|
|
128
|
+
compose(): void;
|
|
184
129
|
protected findFirstChild(): Node;
|
|
185
|
-
|
|
130
|
+
destroy(): void;
|
|
186
131
|
}
|
|
187
132
|
/**
|
|
188
|
-
*
|
|
189
|
-
* @class
|
|
190
|
-
* @extends
|
|
133
|
+
* Vasille node which can manipulate an element node
|
|
134
|
+
* @class INode
|
|
135
|
+
* @extends Fragment
|
|
191
136
|
*/
|
|
192
|
-
export declare class
|
|
137
|
+
export declare class INode<T extends TagOptions = TagOptions> extends Fragment<T> {
|
|
193
138
|
/**
|
|
194
139
|
* Defines if node is unmounted
|
|
195
140
|
* @type {boolean}
|
|
196
141
|
*/
|
|
197
|
-
unmounted: boolean;
|
|
142
|
+
protected unmounted: boolean;
|
|
198
143
|
/**
|
|
199
144
|
* The element of vasille node
|
|
200
145
|
* @type Element
|
|
201
146
|
*/
|
|
202
|
-
node: Element;
|
|
203
|
-
|
|
204
|
-
$destroy(): void;
|
|
205
|
-
}
|
|
206
|
-
/**
|
|
207
|
-
* Vasille node which can manipulate an element node
|
|
208
|
-
* @class INode
|
|
209
|
-
* @extends Fragment
|
|
210
|
-
*/
|
|
211
|
-
export declare class INode<T extends TagOptions<any> = TagOptions<any>> extends Fragment<T> {
|
|
212
|
-
protected $: INodePrivate;
|
|
213
|
-
/**
|
|
214
|
-
* Constructs a base node
|
|
215
|
-
* @param input
|
|
216
|
-
* @param $ {?INodePrivate}
|
|
217
|
-
*/
|
|
218
|
-
constructor(input: T, $?: INodePrivate);
|
|
219
|
-
/**
|
|
220
|
-
* Get the bound node
|
|
221
|
-
*/
|
|
222
|
-
get node(): Element;
|
|
147
|
+
protected node: Element;
|
|
148
|
+
get element(): Element;
|
|
223
149
|
/**
|
|
224
150
|
* Bind attribute value
|
|
225
151
|
* @param name {String} name of attribute
|
|
226
152
|
* @param value {IValue} value
|
|
227
153
|
*/
|
|
228
|
-
attr(name: string, value: IValue<string | number | boolean>): void;
|
|
154
|
+
attr(name: string, value: IValue<string | number | boolean | null | undefined>): void;
|
|
229
155
|
/**
|
|
230
156
|
* Set attribute value
|
|
231
157
|
* @param name {string} name of attribute
|
|
232
158
|
* @param value {string} value
|
|
233
159
|
*/
|
|
234
|
-
setAttr(name: string, value: string | number | boolean): this;
|
|
160
|
+
setAttr(name: string, value: string | number | boolean | null | undefined): this;
|
|
235
161
|
/**
|
|
236
162
|
* Adds a CSS class
|
|
237
163
|
* @param cl {string} Class name
|
|
238
164
|
*/
|
|
239
|
-
addClass(cl: string):
|
|
165
|
+
addClass(cl: string): void;
|
|
240
166
|
/**
|
|
241
167
|
* Adds some CSS classes
|
|
242
|
-
* @param
|
|
168
|
+
* @param cl {string} classes names
|
|
243
169
|
*/
|
|
244
|
-
|
|
170
|
+
removeClass(cl: string): void;
|
|
245
171
|
/**
|
|
246
172
|
* Bind a CSS class
|
|
247
173
|
* @param className {IValue}
|
|
248
174
|
*/
|
|
249
|
-
bindClass(className: IValue<string>):
|
|
175
|
+
bindClass(className: IValue<string>): void;
|
|
250
176
|
/**
|
|
251
177
|
* Bind a floating class name
|
|
252
178
|
* @param cond {IValue} condition
|
|
253
179
|
* @param className {string} class name
|
|
254
180
|
*/
|
|
255
|
-
floatingClass(cond: IValue<boolean>, className: string):
|
|
181
|
+
floatingClass(cond: IValue<boolean>, className: string): void;
|
|
256
182
|
/**
|
|
257
183
|
* Defines a style attribute
|
|
258
184
|
* @param name {String} name of style attribute
|
|
259
185
|
* @param value {IValue} value
|
|
260
186
|
*/
|
|
261
|
-
style(name: string, value: IValue<string>):
|
|
187
|
+
style(name: string, value: IValue<string | number | number[]>): void;
|
|
262
188
|
/**
|
|
263
189
|
* Sets a style property value
|
|
264
190
|
* @param prop {string} Property name
|
|
265
191
|
* @param value {string} Property value
|
|
266
192
|
*/
|
|
267
|
-
setStyle(prop: string, value: string): this;
|
|
193
|
+
setStyle(prop: string, value: string | number | number[]): this;
|
|
268
194
|
/**
|
|
269
195
|
* Add a listener for an event
|
|
270
196
|
* @param name {string} Event name
|
|
271
197
|
* @param handler {function (Event)} Event handler
|
|
272
198
|
* @param options {Object | boolean} addEventListener options
|
|
273
199
|
*/
|
|
274
|
-
listen(name: string, handler: (ev: Event) => void, options?: boolean | AddEventListenerOptions):
|
|
200
|
+
listen(name: string, handler: (ev: Event) => void, options?: boolean | AddEventListenerOptions): void;
|
|
275
201
|
insertAdjacent(node: Node): void;
|
|
276
202
|
/**
|
|
277
203
|
* A v-show & ngShow alternative
|
|
278
204
|
* @param cond {IValue} show condition
|
|
279
205
|
*/
|
|
280
|
-
bindShow(cond: IValue<
|
|
206
|
+
bindShow(cond: IValue<unknown>): void;
|
|
281
207
|
/**
|
|
282
208
|
* bind HTML
|
|
283
209
|
* @param value {IValue}
|
|
284
210
|
*/
|
|
285
211
|
bindDomApi(name: string, value: IValue<string>): void;
|
|
212
|
+
protected applyAttrs(attrs: Record<string, AttrType<number | boolean>>): void;
|
|
213
|
+
protected applyStyle(style: Record<string, string | number | number[] | IValue<string | number | number[]>>): void;
|
|
214
|
+
protected applyBind(bind: Record<string, any>): void;
|
|
286
215
|
protected applyOptions(options: T): void;
|
|
287
216
|
}
|
|
288
|
-
export interface TagOptionsWithSlot
|
|
289
|
-
slot?: (
|
|
217
|
+
export interface TagOptionsWithSlot extends TagOptions {
|
|
218
|
+
slot?: (ctx: Tag) => void;
|
|
219
|
+
callback?: (node: Element) => void;
|
|
290
220
|
}
|
|
291
221
|
/**
|
|
292
222
|
* Represents an Vasille.js HTML element node
|
|
293
223
|
* @class Tag
|
|
294
224
|
* @extends INode
|
|
295
225
|
*/
|
|
296
|
-
export declare class Tag
|
|
297
|
-
constructor(input: TagOptionsWithSlot
|
|
298
|
-
|
|
299
|
-
protected
|
|
300
|
-
protected findFirstChild(): Node;
|
|
226
|
+
export declare class Tag extends INode<TagOptionsWithSlot> {
|
|
227
|
+
constructor(input: TagOptionsWithSlot, tagName: string);
|
|
228
|
+
compose(): void;
|
|
229
|
+
protected findFirstChild(): Node | undefined;
|
|
301
230
|
insertAdjacent(node: Node): void;
|
|
302
231
|
appendNode(node: Node): void;
|
|
232
|
+
extent(options: TagOptions): void;
|
|
303
233
|
/**
|
|
304
234
|
* Mount/Unmount a node
|
|
305
235
|
* @param cond {IValue} show condition
|
|
306
236
|
*/
|
|
307
|
-
bindMount(cond: IValue<
|
|
237
|
+
bindMount(cond: IValue<unknown>): void;
|
|
308
238
|
/**
|
|
309
239
|
* Runs GC
|
|
310
240
|
*/
|
|
311
|
-
|
|
241
|
+
destroy(): void;
|
|
312
242
|
}
|
|
313
243
|
/**
|
|
314
244
|
* Represents a vasille extension node
|
|
315
245
|
* @class Extension
|
|
316
246
|
* @extends INode
|
|
317
247
|
*/
|
|
318
|
-
export declare class Extension
|
|
319
|
-
|
|
320
|
-
extend(options: T): void;
|
|
321
|
-
$destroy(): void;
|
|
248
|
+
export declare class Extension extends Fragment {
|
|
249
|
+
tag(tagName: string, input: TagOptionsWithSlot): void;
|
|
322
250
|
}
|
|
323
251
|
/**
|
|
324
|
-
*
|
|
325
|
-
* @class Component
|
|
326
|
-
* @extends Extension
|
|
252
|
+
* Defines a node which can switch its children conditionally
|
|
327
253
|
*/
|
|
328
|
-
export declare class
|
|
329
|
-
init(): T['return'];
|
|
330
|
-
ready(): void;
|
|
331
|
-
preinit(app: AppNode, parent: Fragment): void;
|
|
332
|
-
}
|
|
333
|
-
/**
|
|
334
|
-
* Private part of switch node
|
|
335
|
-
* @class SwitchedNodePrivate
|
|
336
|
-
* @extends INodePrivate
|
|
337
|
-
*/
|
|
338
|
-
export declare class SwitchedNodePrivate extends FragmentPrivate {
|
|
254
|
+
export declare class SwitchedNode extends Fragment {
|
|
339
255
|
/**
|
|
340
256
|
* Index of current true condition
|
|
341
257
|
* @type number
|
|
342
258
|
*/
|
|
343
|
-
index
|
|
259
|
+
private index;
|
|
344
260
|
/**
|
|
345
261
|
* Array of possible cases
|
|
346
|
-
* @type {Array<{cond : IValue<
|
|
262
|
+
* @type {Array<{cond : IValue<unknown>, cb : function(Fragment)}>}
|
|
347
263
|
*/
|
|
348
|
-
cases
|
|
349
|
-
cond: IValue<boolean>;
|
|
350
|
-
cb: (node: Fragment) => void;
|
|
351
|
-
}[];
|
|
264
|
+
private cases;
|
|
352
265
|
/**
|
|
353
|
-
* A function
|
|
266
|
+
* A function that syncs index and content will be bounded to each condition
|
|
354
267
|
* @type {Function}
|
|
355
268
|
*/
|
|
356
|
-
sync
|
|
357
|
-
constructor();
|
|
358
|
-
/**
|
|
359
|
-
* Runs GC
|
|
360
|
-
*/
|
|
361
|
-
$destroy(): void;
|
|
362
|
-
}
|
|
363
|
-
/**
|
|
364
|
-
* Defines a node witch can switch its children conditionally
|
|
365
|
-
*/
|
|
366
|
-
export declare class SwitchedNode extends Fragment {
|
|
367
|
-
protected $: SwitchedNodePrivate;
|
|
269
|
+
private sync;
|
|
368
270
|
/**
|
|
369
271
|
* Constructs a switch node and define a sync function
|
|
370
272
|
*/
|
|
371
273
|
constructor();
|
|
372
274
|
addCase(case_: {
|
|
373
|
-
cond: IValue<
|
|
275
|
+
cond: IValue<unknown>;
|
|
374
276
|
cb: (node: Fragment) => void;
|
|
375
277
|
}): void;
|
|
376
278
|
/**
|
|
@@ -378,42 +280,23 @@ export declare class SwitchedNode extends Fragment {
|
|
|
378
280
|
* @param cb {function(Fragment)} Call-back
|
|
379
281
|
*/
|
|
380
282
|
createChild(cb: (node: Fragment) => void): void;
|
|
381
|
-
|
|
382
|
-
$destroy(): void;
|
|
283
|
+
destroy(): void;
|
|
383
284
|
}
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
*/
|
|
387
|
-
export declare class DebugPrivate extends FragmentPrivate {
|
|
388
|
-
node: Comment;
|
|
389
|
-
constructor();
|
|
390
|
-
/**
|
|
391
|
-
* Pre-initializes a text node
|
|
392
|
-
* @param app {App} the app node
|
|
393
|
-
* @param parent {Fragment} parent node
|
|
394
|
-
* @param text {String | IValue}
|
|
395
|
-
*/
|
|
396
|
-
preinitComment(app: AppNode, parent: Fragment, text: IValue<string>): void;
|
|
397
|
-
/**
|
|
398
|
-
* Clear node data
|
|
399
|
-
*/
|
|
400
|
-
$destroy(): void;
|
|
285
|
+
interface DebugProps {
|
|
286
|
+
text: IValue<unknown>;
|
|
401
287
|
}
|
|
402
288
|
/**
|
|
403
289
|
* Represents a debug node
|
|
404
290
|
* @class DebugNode
|
|
405
291
|
* @extends Fragment
|
|
406
292
|
*/
|
|
407
|
-
export declare class DebugNode extends Fragment {
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
*/
|
|
412
|
-
protected $: DebugPrivate;
|
|
413
|
-
constructor();
|
|
414
|
-
preinit(app: AppNode, parent: Fragment, text?: IValue<string>): void;
|
|
293
|
+
export declare class DebugNode extends Fragment<DebugProps> {
|
|
294
|
+
private node;
|
|
295
|
+
constructor(input: DebugProps);
|
|
296
|
+
compose(): void;
|
|
415
297
|
/**
|
|
416
298
|
* Runs garbage collector
|
|
417
299
|
*/
|
|
418
|
-
|
|
300
|
+
destroy(): void;
|
|
419
301
|
}
|
|
302
|
+
export {};
|
package/types/node/watch.d.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { Fragment } from "./node";
|
|
2
2
|
import { IValue } from "../core/ivalue";
|
|
3
|
-
|
|
4
|
-
interface WatchOptions<T> extends FragmentOptions {
|
|
3
|
+
interface WatchOptions<T> {
|
|
5
4
|
model: IValue<T>;
|
|
6
|
-
slot?: (
|
|
5
|
+
slot?: (ctx: Fragment, value: T) => void;
|
|
7
6
|
}
|
|
8
7
|
/**
|
|
9
8
|
* Watch Node
|
|
@@ -11,7 +10,7 @@ interface WatchOptions<T> extends FragmentOptions {
|
|
|
11
10
|
* @extends Fragment
|
|
12
11
|
*/
|
|
13
12
|
export declare class Watch<T> extends Fragment<WatchOptions<T>> {
|
|
14
|
-
input: WatchOptions<T
|
|
15
|
-
compose(
|
|
13
|
+
constructor(input: WatchOptions<T>);
|
|
14
|
+
compose(): void;
|
|
16
15
|
}
|
|
17
16
|
export {};
|