vasille 2.0.5 → 2.2.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 +4 -0
- package/cdn/es2015.js +827 -827
- package/cdn/es5.js +909 -829
- package/flow-typed/vasille.js +2647 -835
- package/lib/binding/attribute.js +8 -3
- package/lib/binding/binding.js +5 -5
- package/lib/binding/class.js +4 -4
- package/lib/binding/style.js +2 -2
- package/lib/core/core.js +73 -17
- package/lib/core/destroyable.js +2 -2
- package/lib/core/ivalue.js +4 -4
- package/lib/functional/components.js +17 -0
- package/lib/functional/merge.js +41 -0
- package/lib/functional/models.js +26 -0
- package/lib/functional/options.js +1 -0
- package/lib/functional/reactivity.js +33 -0
- package/lib/functional/stack.js +127 -0
- package/lib/index.js +2 -7
- package/lib/models/array-model.js +9 -0
- package/lib/models/object-model.js +28 -14
- package/lib/node/app.js +21 -12
- package/lib/node/node.js +229 -573
- package/lib/node/watch.js +6 -14
- package/lib/spec/html.js +1 -0
- package/lib/spec/react.js +1 -0
- package/lib/spec/svg.js +1 -0
- package/lib/v/index.js +23 -0
- package/lib/value/expression.js +21 -18
- package/lib/value/mirror.js +15 -15
- package/lib/value/pointer.js +5 -5
- package/lib/value/reference.js +18 -18
- package/lib/views/array-view.js +6 -10
- package/lib/views/base-view.js +12 -23
- package/lib/views/map-view.js +4 -9
- package/lib/views/object-view.js +4 -7
- package/lib/views/repeat-node.js +10 -22
- package/lib/views/set-view.js +4 -11
- package/package.json +3 -1
- package/types/binding/attribute.d.ts +2 -2
- package/types/binding/binding.d.ts +1 -1
- package/types/core/core.d.ts +31 -43
- package/types/core/destroyable.d.ts +2 -2
- package/types/core/ivalue.d.ts +4 -4
- package/types/functional/components.d.ts +4 -0
- package/types/functional/merge.d.ts +1 -0
- package/types/functional/models.d.ts +10 -0
- package/types/functional/options.d.ts +23 -0
- package/types/functional/reactivity.d.ts +11 -0
- package/types/functional/stack.d.ts +24 -0
- package/types/index.d.ts +3 -7
- package/types/models/array-model.d.ts +1 -0
- package/types/models/object-model.d.ts +2 -0
- package/types/node/app.d.ts +19 -17
- package/types/node/node.d.ts +67 -388
- package/types/node/watch.d.ts +9 -15
- package/types/spec/html.d.ts +975 -0
- package/types/spec/react.d.ts +4 -0
- package/types/spec/svg.d.ts +314 -0
- package/types/v/index.d.ts +36 -0
- package/types/value/expression.d.ts +11 -24
- package/types/value/mirror.d.ts +6 -6
- package/types/value/pointer.d.ts +1 -1
- package/types/value/reference.d.ts +7 -7
- package/types/views/array-view.d.ts +3 -4
- package/types/views/base-view.d.ts +8 -16
- package/types/views/map-view.d.ts +2 -3
- package/types/views/object-view.d.ts +2 -3
- package/types/views/repeat-node.d.ts +8 -9
- package/types/views/set-view.d.ts +2 -3
- package/types/core/executor.d.ts +0 -87
- package/types/core/signal.d.ts +0 -35
- package/types/core/slot.d.ts +0 -45
- package/types/node/interceptor.d.ts +0 -50
- package/types/views/repeater.d.ts +0 -38
package/types/node/node.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { Reactive, ReactivePrivate } from "../core/core";
|
|
2
2
|
import { IValue } from "../core/ivalue";
|
|
3
3
|
import type { AppNode } from "./app";
|
|
4
|
+
import { Options, TagOptions } from "../functional/options";
|
|
5
|
+
import { AcceptedTagsMap } from "../spec/react";
|
|
4
6
|
/**
|
|
5
7
|
* Represents a Vasille.js node
|
|
6
8
|
* @class FragmentPrivate
|
|
@@ -37,13 +39,13 @@ export declare class FragmentPrivate extends ReactivePrivate {
|
|
|
37
39
|
/**
|
|
38
40
|
* Unlinks all bindings
|
|
39
41
|
*/
|
|
40
|
-
destroy(): void;
|
|
42
|
+
$destroy(): void;
|
|
41
43
|
}
|
|
42
44
|
/**
|
|
43
45
|
* This class is symbolic
|
|
44
46
|
* @extends Reactive
|
|
45
47
|
*/
|
|
46
|
-
export declare class Fragment extends Reactive {
|
|
48
|
+
export declare class Fragment<T extends Options = Options> extends Reactive {
|
|
47
49
|
/**
|
|
48
50
|
* Private part
|
|
49
51
|
* @protected
|
|
@@ -54,12 +56,13 @@ export declare class Fragment extends Reactive {
|
|
|
54
56
|
* @type Array
|
|
55
57
|
*/
|
|
56
58
|
children: Set<Fragment>;
|
|
57
|
-
lastChild:
|
|
59
|
+
lastChild: Fragment | null;
|
|
58
60
|
/**
|
|
59
61
|
* Constructs a Vasille Node
|
|
62
|
+
* @param input
|
|
60
63
|
* @param $ {FragmentPrivate}
|
|
61
64
|
*/
|
|
62
|
-
constructor($?: FragmentPrivate);
|
|
65
|
+
constructor(input: T, $?: FragmentPrivate);
|
|
63
66
|
/**
|
|
64
67
|
* Gets the app of node
|
|
65
68
|
*/
|
|
@@ -71,20 +74,10 @@ export declare class Fragment extends Reactive {
|
|
|
71
74
|
* @param data {*} additional data
|
|
72
75
|
*/
|
|
73
76
|
preinit(app: AppNode, parent: Fragment, data?: unknown): void;
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
*/
|
|
77
|
-
init(): this;
|
|
78
|
-
/** To be overloaded: created event handler */
|
|
79
|
-
created(): void;
|
|
80
|
-
/** To be overloaded: mounted event handler */
|
|
81
|
-
mounted(): void;
|
|
77
|
+
init(): void;
|
|
78
|
+
protected compose(input: T): void;
|
|
82
79
|
/** To be overloaded: ready event handler */
|
|
83
80
|
ready(): void;
|
|
84
|
-
/** To be overloaded: watchers creation milestone */
|
|
85
|
-
createWatchers(): void;
|
|
86
|
-
/** To be overloaded: DOM creation milestone */
|
|
87
|
-
compose(): void;
|
|
88
81
|
/**
|
|
89
82
|
* Pushes a node to children immediately
|
|
90
83
|
* @param node {Fragment} A node to push
|
|
@@ -113,45 +106,29 @@ export declare class Fragment extends Reactive {
|
|
|
113
106
|
* @param cb {function (TextNode)} Callback if previous is slot name
|
|
114
107
|
*/
|
|
115
108
|
text(text: string | IValue<string>, cb?: (text: TextNode) => void): void;
|
|
116
|
-
debug(text: IValue<string>):
|
|
109
|
+
debug(text: IValue<string>): void;
|
|
117
110
|
/**
|
|
118
111
|
* Defines a tag element
|
|
119
112
|
* @param tagName {String} the tag name
|
|
113
|
+
* @param input
|
|
120
114
|
* @param cb {function(Tag, *)} callback
|
|
121
115
|
*/
|
|
122
|
-
tag<K extends keyof
|
|
123
|
-
tag<K extends keyof SVGElementTagNameMap>(tagName: K, cb?: (node: Tag, element: SVGElementTagNameMap[K]) => void): void;
|
|
124
|
-
tag(tagName: string, cb?: (node: Tag, element: Element) => void): void;
|
|
116
|
+
tag<K extends keyof AcceptedTagsMap>(tagName: K, input: TagOptionsWithSlot<K>, cb?: (node: Tag<K>) => void): (HTMLElementTagNameMap & SVGElementTagNameMap)[K];
|
|
125
117
|
/**
|
|
126
118
|
* Defines a custom element
|
|
127
119
|
* @param node {Fragment} vasille element to insert
|
|
128
120
|
* @param callback {function($ : *)}
|
|
129
|
-
* @param callback1 {function($ : *)}
|
|
130
121
|
*/
|
|
131
|
-
create<T extends Fragment>(node: T, callback?:
|
|
122
|
+
create<T extends Fragment>(node: T, callback?: T['input']['slot']): void;
|
|
132
123
|
/**
|
|
133
124
|
* Defines an if node
|
|
134
125
|
* @param cond {IValue} condition
|
|
135
126
|
* @param cb {function(Fragment)} callback to run on true
|
|
136
127
|
* @return {this}
|
|
137
128
|
*/
|
|
138
|
-
if(cond: IValue<boolean>, cb: (node: Fragment) => void):
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
* @param ifCond {IValue} `if` condition
|
|
142
|
-
* @param ifCb {function(Fragment)} Call-back to create `if` child nodes
|
|
143
|
-
* @param elseCb {function(Fragment)} Call-back to create `else` child nodes
|
|
144
|
-
*/
|
|
145
|
-
if_else(ifCond: IValue<boolean>, ifCb: (node: Fragment) => void, elseCb: (node: Fragment) => void): this;
|
|
146
|
-
/**
|
|
147
|
-
* Defines a switch nodes: Will break after first true condition
|
|
148
|
-
* @param cases {...{ cond : IValue, cb : function(Fragment) }} cases
|
|
149
|
-
* @return {INode}
|
|
150
|
-
*/
|
|
151
|
-
switch(...cases: Array<{
|
|
152
|
-
cond: IValue<boolean>;
|
|
153
|
-
cb: (node: Fragment) => void;
|
|
154
|
-
}>): this;
|
|
129
|
+
if(cond: IValue<boolean>, cb: (node: Fragment) => void): void;
|
|
130
|
+
else(cb: (node: Fragment) => void): void;
|
|
131
|
+
elif(cond: IValue<boolean>, cb: (node: Fragment) => void): void;
|
|
155
132
|
/**
|
|
156
133
|
* Create a case for switch
|
|
157
134
|
* @param cond {IValue<boolean>}
|
|
@@ -173,7 +150,7 @@ export declare class Fragment extends Reactive {
|
|
|
173
150
|
insertBefore(node: Fragment): void;
|
|
174
151
|
insertAfter(node: Fragment): void;
|
|
175
152
|
remove(): void;
|
|
176
|
-
destroy(): void;
|
|
153
|
+
$destroy(): void;
|
|
177
154
|
}
|
|
178
155
|
/**
|
|
179
156
|
* The private part of a text node
|
|
@@ -186,13 +163,14 @@ export declare class TextNodePrivate extends FragmentPrivate {
|
|
|
186
163
|
/**
|
|
187
164
|
* Pre-initializes a text node
|
|
188
165
|
* @param app {AppNode} the app node
|
|
166
|
+
* @param parent
|
|
189
167
|
* @param text {IValue}
|
|
190
168
|
*/
|
|
191
|
-
preinitText(app: AppNode, parent: Fragment, text: IValue<string>): void;
|
|
169
|
+
preinitText(app: AppNode, parent: Fragment, text: IValue<string> | string): void;
|
|
192
170
|
/**
|
|
193
171
|
* Clear node data
|
|
194
172
|
*/
|
|
195
|
-
destroy(): void;
|
|
173
|
+
$destroy(): void;
|
|
196
174
|
}
|
|
197
175
|
/**
|
|
198
176
|
* Represents a text node
|
|
@@ -202,9 +180,9 @@ export declare class TextNodePrivate extends FragmentPrivate {
|
|
|
202
180
|
export declare class TextNode extends Fragment {
|
|
203
181
|
protected $: TextNodePrivate;
|
|
204
182
|
constructor($?: TextNodePrivate);
|
|
205
|
-
preinit(app: AppNode, parent: Fragment, text?: IValue<string>): void;
|
|
183
|
+
preinit(app: AppNode, parent: Fragment, text?: IValue<string> | string): void;
|
|
206
184
|
protected findFirstChild(): Node;
|
|
207
|
-
destroy(): void;
|
|
185
|
+
$destroy(): void;
|
|
208
186
|
}
|
|
209
187
|
/**
|
|
210
188
|
* The private part of a base node
|
|
@@ -223,68 +201,37 @@ export declare class INodePrivate extends FragmentPrivate {
|
|
|
223
201
|
*/
|
|
224
202
|
node: Element;
|
|
225
203
|
constructor();
|
|
226
|
-
destroy(): void;
|
|
204
|
+
$destroy(): void;
|
|
227
205
|
}
|
|
228
206
|
/**
|
|
229
207
|
* Vasille node which can manipulate an element node
|
|
230
208
|
* @class INode
|
|
231
209
|
* @extends Fragment
|
|
232
210
|
*/
|
|
233
|
-
export declare class INode extends Fragment {
|
|
211
|
+
export declare class INode<T extends TagOptions<any> = TagOptions<any>> extends Fragment<T> {
|
|
234
212
|
protected $: INodePrivate;
|
|
235
213
|
/**
|
|
236
214
|
* Constructs a base node
|
|
215
|
+
* @param input
|
|
237
216
|
* @param $ {?INodePrivate}
|
|
238
217
|
*/
|
|
239
|
-
constructor($?: INodePrivate);
|
|
218
|
+
constructor(input: T, $?: INodePrivate);
|
|
240
219
|
/**
|
|
241
220
|
* Get the bound node
|
|
242
221
|
*/
|
|
243
222
|
get node(): Element;
|
|
244
|
-
/**
|
|
245
|
-
* Initialize node
|
|
246
|
-
*/
|
|
247
|
-
init(): this;
|
|
248
|
-
/** To be overloaded: attributes creation milestone */
|
|
249
|
-
createAttrs(): void;
|
|
250
|
-
/** To be overloaded: $style attributes creation milestone */
|
|
251
|
-
createStyle(): void;
|
|
252
223
|
/**
|
|
253
224
|
* Bind attribute value
|
|
254
225
|
* @param name {String} name of attribute
|
|
255
226
|
* @param value {IValue} value
|
|
256
227
|
*/
|
|
257
|
-
attr(name: string, value: IValue<string>): void;
|
|
258
|
-
/**
|
|
259
|
-
* Creates and binds a multivalued binding to attribute
|
|
260
|
-
* @param name {String} The name of attribute
|
|
261
|
-
* @param calculator {Function} Binding calculator (must return a value)
|
|
262
|
-
* @param v1 {*} argument
|
|
263
|
-
* @param v2 {*} argument
|
|
264
|
-
* @param v3 {*} argument
|
|
265
|
-
* @param v4 {*} argument
|
|
266
|
-
* @param v5 {*} argument
|
|
267
|
-
* @param v6 {*} argument
|
|
268
|
-
* @param v7 {*} argument
|
|
269
|
-
* @param v8 {*} argument
|
|
270
|
-
* @param v9 {*} argument
|
|
271
|
-
* @return {INode} A pointer to this
|
|
272
|
-
*/
|
|
273
|
-
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;
|
|
274
|
-
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;
|
|
275
|
-
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;
|
|
276
|
-
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;
|
|
277
|
-
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;
|
|
278
|
-
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;
|
|
279
|
-
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;
|
|
280
|
-
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;
|
|
281
|
-
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;
|
|
228
|
+
attr(name: string, value: IValue<string | number | boolean>): void;
|
|
282
229
|
/**
|
|
283
230
|
* Set attribute value
|
|
284
231
|
* @param name {string} name of attribute
|
|
285
232
|
* @param value {string} value
|
|
286
233
|
*/
|
|
287
|
-
setAttr(name: string, value: string): this;
|
|
234
|
+
setAttr(name: string, value: string | number | boolean): this;
|
|
288
235
|
/**
|
|
289
236
|
* Adds a CSS class
|
|
290
237
|
* @param cl {string} Class name
|
|
@@ -294,7 +241,7 @@ export declare class INode extends Fragment {
|
|
|
294
241
|
* Adds some CSS classes
|
|
295
242
|
* @param cls {...string} classes names
|
|
296
243
|
*/
|
|
297
|
-
|
|
244
|
+
removeClasse(cl: string): this;
|
|
298
245
|
/**
|
|
299
246
|
* Bind a CSS class
|
|
300
247
|
* @param className {IValue}
|
|
@@ -312,29 +259,6 @@ export declare class INode extends Fragment {
|
|
|
312
259
|
* @param value {IValue} value
|
|
313
260
|
*/
|
|
314
261
|
style(name: string, value: IValue<string>): this;
|
|
315
|
-
/**
|
|
316
|
-
* Binds style property value
|
|
317
|
-
* @param name {string} name of style attribute
|
|
318
|
-
* @param calculator {function} calculator for style value
|
|
319
|
-
* @param v1 {*} argument
|
|
320
|
-
* @param v2 {*} argument
|
|
321
|
-
* @param v3 {*} argument
|
|
322
|
-
* @param v4 {*} argument
|
|
323
|
-
* @param v5 {*} argument
|
|
324
|
-
* @param v6 {*} argument
|
|
325
|
-
* @param v7 {*} argument
|
|
326
|
-
* @param v8 {*} argument
|
|
327
|
-
* @param v9 {*} argument
|
|
328
|
-
*/
|
|
329
|
-
bindStyle<T1>(name: string, calculator: (a1: T1) => string, v1: IValue<T1>): this;
|
|
330
|
-
bindStyle<T1, T2>(name: string, calculator: (a1: T1, a2: T2) => string, v1: IValue<T1>, v2: IValue<T2>): this;
|
|
331
|
-
bindStyle<T1, T2, T3>(name: string, calculator: (a1: T1, a2: T2, a3: T3) => string, v1: IValue<T1>, v2: IValue<T2>, v3: IValue<T3>): this;
|
|
332
|
-
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;
|
|
333
|
-
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;
|
|
334
|
-
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;
|
|
335
|
-
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;
|
|
336
|
-
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;
|
|
337
|
-
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;
|
|
338
262
|
/**
|
|
339
263
|
* Sets a style property value
|
|
340
264
|
* @param prop {string} Property name
|
|
@@ -348,276 +272,6 @@ export declare class INode extends Fragment {
|
|
|
348
272
|
* @param options {Object | boolean} addEventListener options
|
|
349
273
|
*/
|
|
350
274
|
listen(name: string, handler: (ev: Event) => void, options?: boolean | AddEventListenerOptions): this;
|
|
351
|
-
/**
|
|
352
|
-
* @param handler {function (MouseEvent)}
|
|
353
|
-
* @param options {Object | boolean}
|
|
354
|
-
*/
|
|
355
|
-
oncontextmenu(handler: (ev: MouseEvent) => void, options?: boolean | AddEventListenerOptions): this;
|
|
356
|
-
/**
|
|
357
|
-
* @param handler {function (MouseEvent)}
|
|
358
|
-
* @param options {Object | boolean}
|
|
359
|
-
*/
|
|
360
|
-
onmousedown(handler: (ev: MouseEvent) => void, options?: boolean | AddEventListenerOptions): this;
|
|
361
|
-
/**
|
|
362
|
-
* @param handler {function (MouseEvent)}
|
|
363
|
-
* @param options {Object | boolean}
|
|
364
|
-
*/
|
|
365
|
-
onmouseenter(handler: (ev: MouseEvent) => void, options?: boolean | AddEventListenerOptions): this;
|
|
366
|
-
/**
|
|
367
|
-
* @param handler {function (MouseEvent)}
|
|
368
|
-
* @param options {Object | boolean}
|
|
369
|
-
*/
|
|
370
|
-
onmouseleave(handler: (ev: MouseEvent) => void, options?: boolean | AddEventListenerOptions): this;
|
|
371
|
-
/**
|
|
372
|
-
* @param handler {function (MouseEvent)}
|
|
373
|
-
* @param options {Object | boolean}
|
|
374
|
-
*/
|
|
375
|
-
onmousemove(handler: (ev: MouseEvent) => void, options?: boolean | AddEventListenerOptions): this;
|
|
376
|
-
/**
|
|
377
|
-
* @param handler {function (MouseEvent)}
|
|
378
|
-
* @param options {Object | boolean}
|
|
379
|
-
*/
|
|
380
|
-
onmouseout(handler: (ev: MouseEvent) => void, options?: boolean | AddEventListenerOptions): this;
|
|
381
|
-
/**
|
|
382
|
-
* @param handler {function (MouseEvent)}
|
|
383
|
-
* @param options {Object | boolean}
|
|
384
|
-
*/
|
|
385
|
-
onmouseover(handler: (ev: MouseEvent) => void, options?: boolean | AddEventListenerOptions): this;
|
|
386
|
-
/**
|
|
387
|
-
* @param handler {function (MouseEvent)}
|
|
388
|
-
* @param options {Object | boolean}
|
|
389
|
-
*/
|
|
390
|
-
onmouseup(handler: (ev: MouseEvent) => void, options?: boolean | AddEventListenerOptions): this;
|
|
391
|
-
/**
|
|
392
|
-
* @param handler {function (MouseEvent)}
|
|
393
|
-
* @param options {Object | boolean}
|
|
394
|
-
*/
|
|
395
|
-
onclick(handler: (ev: MouseEvent) => void, options?: boolean | AddEventListenerOptions): this;
|
|
396
|
-
/**
|
|
397
|
-
* @param handler {function (MouseEvent)}
|
|
398
|
-
* @param options {Object | boolean}
|
|
399
|
-
*/
|
|
400
|
-
ondblclick(handler: (ev: MouseEvent) => void, options?: boolean | AddEventListenerOptions): this;
|
|
401
|
-
/**
|
|
402
|
-
* @param handler {function (FocusEvent)}
|
|
403
|
-
* @param options {Object | boolean}
|
|
404
|
-
*/
|
|
405
|
-
onblur(handler: (ev: FocusEvent) => void, options?: boolean | AddEventListenerOptions): this;
|
|
406
|
-
/**
|
|
407
|
-
* @param handler {function (FocusEvent)}
|
|
408
|
-
* @param options {Object | boolean}
|
|
409
|
-
*/
|
|
410
|
-
onfocus(handler: (ev: FocusEvent) => void, options?: boolean | AddEventListenerOptions): this;
|
|
411
|
-
/**
|
|
412
|
-
* @param handler {function (FocusEvent)}
|
|
413
|
-
* @param options {Object | boolean}
|
|
414
|
-
*/
|
|
415
|
-
onfocusin(handler: (ev: FocusEvent) => void, options?: boolean | AddEventListenerOptions): this;
|
|
416
|
-
/**
|
|
417
|
-
* @param handler {function (FocusEvent)}
|
|
418
|
-
* @param options {Object | boolean}
|
|
419
|
-
*/
|
|
420
|
-
onfocusout(handler: (ev: FocusEvent) => void, options?: boolean | AddEventListenerOptions): this;
|
|
421
|
-
/**
|
|
422
|
-
* @param handler {function (KeyboardEvent)}
|
|
423
|
-
* @param options {Object | boolean}
|
|
424
|
-
*/
|
|
425
|
-
onkeydown(handler: (ev: KeyboardEvent) => void, options?: boolean | AddEventListenerOptions): this;
|
|
426
|
-
/**
|
|
427
|
-
* @param handler {function (KeyboardEvent)}
|
|
428
|
-
* @param options {Object | boolean}
|
|
429
|
-
*/
|
|
430
|
-
onkeyup(handler: (ev: KeyboardEvent) => void, options?: boolean | AddEventListenerOptions): this;
|
|
431
|
-
/**
|
|
432
|
-
* @param handler {function (KeyboardEvent)}
|
|
433
|
-
* @param options {Object | boolean}
|
|
434
|
-
*/
|
|
435
|
-
onkeypress(handler: (ev: KeyboardEvent) => void, options?: boolean | AddEventListenerOptions): this;
|
|
436
|
-
/**
|
|
437
|
-
* @param handler {function (TouchEvent)}
|
|
438
|
-
* @param options {Object | boolean}
|
|
439
|
-
*/
|
|
440
|
-
ontouchstart(handler: (ev: TouchEvent) => void, options?: boolean | AddEventListenerOptions): this;
|
|
441
|
-
/**
|
|
442
|
-
* @param handler {function (TouchEvent)}
|
|
443
|
-
* @param options {Object | boolean}
|
|
444
|
-
*/
|
|
445
|
-
ontouchmove(handler: (ev: TouchEvent) => void, options?: boolean | AddEventListenerOptions): this;
|
|
446
|
-
/**
|
|
447
|
-
* @param handler {function (TouchEvent)}
|
|
448
|
-
* @param options {Object | boolean}
|
|
449
|
-
*/
|
|
450
|
-
ontouchend(handler: (ev: TouchEvent) => void, options?: boolean | AddEventListenerOptions): this;
|
|
451
|
-
/**
|
|
452
|
-
* @param handler {function (TouchEvent)}
|
|
453
|
-
* @param options {Object | boolean}
|
|
454
|
-
*/
|
|
455
|
-
ontouchcancel(handler: (ev: TouchEvent) => void, options?: boolean | AddEventListenerOptions): this;
|
|
456
|
-
/**
|
|
457
|
-
* @param handler {function (WheelEvent)}
|
|
458
|
-
* @param options {Object | boolean}
|
|
459
|
-
*/
|
|
460
|
-
onwheel(handler: (ev: WheelEvent) => void, options?: boolean | AddEventListenerOptions): this;
|
|
461
|
-
/**
|
|
462
|
-
* @param handler {function (ProgressEvent)}
|
|
463
|
-
* @param options {Object | boolean}
|
|
464
|
-
*/
|
|
465
|
-
onabort(handler: (ev: ProgressEvent) => void, options?: boolean | AddEventListenerOptions): this;
|
|
466
|
-
/**
|
|
467
|
-
* @param handler {function (ProgressEvent)}
|
|
468
|
-
* @param options {Object | boolean}
|
|
469
|
-
*/
|
|
470
|
-
onerror(handler: (ev: ProgressEvent) => void, options?: boolean | AddEventListenerOptions): this;
|
|
471
|
-
/**
|
|
472
|
-
* @param handler {function (ProgressEvent)}
|
|
473
|
-
* @param options {Object | boolean}
|
|
474
|
-
*/
|
|
475
|
-
onload(handler: (ev: ProgressEvent) => void, options?: boolean | AddEventListenerOptions): this;
|
|
476
|
-
/**
|
|
477
|
-
* @param handler {function (ProgressEvent)}
|
|
478
|
-
* @param options {Object | boolean}
|
|
479
|
-
*/
|
|
480
|
-
onloadend(handler: (ev: ProgressEvent) => void, options?: boolean | AddEventListenerOptions): this;
|
|
481
|
-
/**
|
|
482
|
-
* @param handler {function (ProgressEvent)}
|
|
483
|
-
* @param options {Object | boolean}
|
|
484
|
-
*/
|
|
485
|
-
onloadstart(handler: (ev: ProgressEvent) => void, options?: boolean | AddEventListenerOptions): this;
|
|
486
|
-
/**
|
|
487
|
-
* @param handler {function (ProgressEvent)}
|
|
488
|
-
* @param options {Object | boolean}
|
|
489
|
-
*/
|
|
490
|
-
onprogress(handler: (ev: ProgressEvent) => void, options?: boolean | AddEventListenerOptions): this;
|
|
491
|
-
/**
|
|
492
|
-
* @param handler {function (ProgressEvent)}
|
|
493
|
-
* @param options {Object | boolean}
|
|
494
|
-
*/
|
|
495
|
-
ontimeout(handler: (ev: ProgressEvent) => void, options?: boolean | AddEventListenerOptions): this;
|
|
496
|
-
/**
|
|
497
|
-
* @param handler {function (DragEvent)}
|
|
498
|
-
* @param options {Object | boolean}
|
|
499
|
-
*/
|
|
500
|
-
ondrag(handler: (ev: DragEvent) => void, options?: boolean | AddEventListenerOptions): this;
|
|
501
|
-
/**
|
|
502
|
-
* @param handler {function (DragEvent)}
|
|
503
|
-
* @param options {Object | boolean}
|
|
504
|
-
*/
|
|
505
|
-
ondragend(handler: (ev: DragEvent) => void, options?: boolean | AddEventListenerOptions): this;
|
|
506
|
-
/**
|
|
507
|
-
* @param handler {function (DragEvent)}
|
|
508
|
-
* @param options {Object | boolean}
|
|
509
|
-
*/
|
|
510
|
-
ondragenter(handler: (ev: DragEvent) => void, options?: boolean | AddEventListenerOptions): this;
|
|
511
|
-
/**
|
|
512
|
-
* @param handler {function (DragEvent)}
|
|
513
|
-
* @param options {Object | boolean}
|
|
514
|
-
*/
|
|
515
|
-
ondragexit(handler: (ev: DragEvent) => void, options?: boolean | AddEventListenerOptions): this;
|
|
516
|
-
/**
|
|
517
|
-
* @param handler {function (DragEvent)}
|
|
518
|
-
* @param options {Object | boolean}
|
|
519
|
-
*/
|
|
520
|
-
ondragleave(handler: (ev: DragEvent) => void, options?: boolean | AddEventListenerOptions): this;
|
|
521
|
-
/**
|
|
522
|
-
* @param handler {function (DragEvent)}
|
|
523
|
-
* @param options {Object | boolean}
|
|
524
|
-
*/
|
|
525
|
-
ondragover(handler: (ev: DragEvent) => void, options?: boolean | AddEventListenerOptions): this;
|
|
526
|
-
/**
|
|
527
|
-
* @param handler {function (DragEvent)}
|
|
528
|
-
* @param options {Object | boolean}
|
|
529
|
-
*/
|
|
530
|
-
ondragstart(handler: (ev: DragEvent) => void, options?: boolean | AddEventListenerOptions): this;
|
|
531
|
-
/**
|
|
532
|
-
* @param handler {function (DragEvent)}
|
|
533
|
-
* @param options {Object | boolean}
|
|
534
|
-
*/
|
|
535
|
-
ondrop(handler: (ev: DragEvent) => void, options?: boolean | AddEventListenerOptions): this;
|
|
536
|
-
/**
|
|
537
|
-
* @param handler {function (PointerEvent)}
|
|
538
|
-
* @param options {Object | boolean}
|
|
539
|
-
*/
|
|
540
|
-
onpointerover(handler: (ev: PointerEvent) => void, options?: boolean | AddEventListenerOptions): this;
|
|
541
|
-
/**
|
|
542
|
-
* @param handler {function (PointerEvent)}
|
|
543
|
-
* @param options {Object | boolean}
|
|
544
|
-
*/
|
|
545
|
-
onpointerenter(handler: (ev: PointerEvent) => void, options?: boolean | AddEventListenerOptions): this;
|
|
546
|
-
/**
|
|
547
|
-
* @param handler {function (PointerEvent)}
|
|
548
|
-
* @param options {Object | boolean}
|
|
549
|
-
*/
|
|
550
|
-
onpointerdown(handler: (ev: PointerEvent) => void, options?: boolean | AddEventListenerOptions): this;
|
|
551
|
-
/**
|
|
552
|
-
* @param handler {function (PointerEvent)}
|
|
553
|
-
* @param options {Object | boolean}
|
|
554
|
-
*/
|
|
555
|
-
onpointermove(handler: (ev: PointerEvent) => void, options?: boolean | AddEventListenerOptions): this;
|
|
556
|
-
/**
|
|
557
|
-
* @param handler {function (PointerEvent)}
|
|
558
|
-
* @param options {Object | boolean}
|
|
559
|
-
*/
|
|
560
|
-
onpointerup(handler: (ev: PointerEvent) => void, options?: boolean | AddEventListenerOptions): this;
|
|
561
|
-
/**
|
|
562
|
-
* @param handler {function (PointerEvent)}
|
|
563
|
-
* @param options {Object | boolean}
|
|
564
|
-
*/
|
|
565
|
-
onpointercancel(handler: (ev: PointerEvent) => void, options?: boolean | AddEventListenerOptions): this;
|
|
566
|
-
/**
|
|
567
|
-
* @param handler {function (PointerEvent)}
|
|
568
|
-
* @param options {Object | boolean}
|
|
569
|
-
*/
|
|
570
|
-
onpointerout(handler: (ev: PointerEvent) => void, options?: boolean | AddEventListenerOptions): this;
|
|
571
|
-
/**
|
|
572
|
-
* @param handler {function (PointerEvent)}
|
|
573
|
-
* @param options {Object | boolean}
|
|
574
|
-
*/
|
|
575
|
-
onpointerleave(handler: (ev: PointerEvent) => void, options?: boolean | AddEventListenerOptions): this;
|
|
576
|
-
/**
|
|
577
|
-
* @param handler {function (PointerEvent)}
|
|
578
|
-
* @param options {Object | boolean}
|
|
579
|
-
*/
|
|
580
|
-
ongotpointercapture(handler: (ev: PointerEvent) => void, options?: boolean | AddEventListenerOptions): this;
|
|
581
|
-
/**
|
|
582
|
-
* @param handler {function (PointerEvent)}
|
|
583
|
-
* @param options {Object | boolean}
|
|
584
|
-
*/
|
|
585
|
-
onlostpointercapture(handler: (ev: PointerEvent) => void, options?: boolean | AddEventListenerOptions): this;
|
|
586
|
-
/**
|
|
587
|
-
* @param handler {function (AnimationEvent)}
|
|
588
|
-
* @param options {Object | boolean}
|
|
589
|
-
*/
|
|
590
|
-
onanimationstart(handler: (ev: AnimationEvent) => void, options?: boolean | AddEventListenerOptions): this;
|
|
591
|
-
/**
|
|
592
|
-
* @param handler {function (AnimationEvent)}
|
|
593
|
-
* @param options {Object | boolean}
|
|
594
|
-
*/
|
|
595
|
-
onanimationend(handler: (ev: AnimationEvent) => void, options?: boolean | AddEventListenerOptions): this;
|
|
596
|
-
/**
|
|
597
|
-
* @param handler {function (AnimationEvent)}
|
|
598
|
-
* @param options {Object | boolean}
|
|
599
|
-
*/
|
|
600
|
-
onanimationiteraton(handler: (ev: AnimationEvent) => void, options?: boolean | AddEventListenerOptions): this;
|
|
601
|
-
/**
|
|
602
|
-
* @param handler {function (ClipboardEvent)}
|
|
603
|
-
* @param options {Object | boolean}
|
|
604
|
-
*/
|
|
605
|
-
onclipboardchange(handler: (ev: ClipboardEvent) => void, options?: boolean | AddEventListenerOptions): this;
|
|
606
|
-
/**
|
|
607
|
-
* @param handler {function (ClipboardEvent)}
|
|
608
|
-
* @param options {Object | boolean}
|
|
609
|
-
*/
|
|
610
|
-
oncut(handler: (ev: ClipboardEvent) => void, options?: boolean | AddEventListenerOptions): this;
|
|
611
|
-
/**
|
|
612
|
-
* @param handler {function (ClipboardEvent)}
|
|
613
|
-
* @param options {Object | boolean}
|
|
614
|
-
*/
|
|
615
|
-
oncopy(handler: (ev: ClipboardEvent) => void, options?: boolean | AddEventListenerOptions): this;
|
|
616
|
-
/**
|
|
617
|
-
* @param handler {function (ClipboardEvent)}
|
|
618
|
-
* @param options {Object | boolean}
|
|
619
|
-
*/
|
|
620
|
-
onpaste(handler: (ev: ClipboardEvent) => void, options?: boolean | AddEventListenerOptions): this;
|
|
621
275
|
insertAdjacent(node: Node): void;
|
|
622
276
|
/**
|
|
623
277
|
* A v-show & ngShow alternative
|
|
@@ -628,16 +282,21 @@ export declare class INode extends Fragment {
|
|
|
628
282
|
* bind HTML
|
|
629
283
|
* @param value {IValue}
|
|
630
284
|
*/
|
|
631
|
-
|
|
285
|
+
bindDomApi(name: string, value: IValue<string>): void;
|
|
286
|
+
protected applyOptions(options: T): void;
|
|
287
|
+
}
|
|
288
|
+
export interface TagOptionsWithSlot<K extends keyof AcceptedTagsMap> extends TagOptions<K> {
|
|
289
|
+
slot?: (tag: Tag<K>) => void;
|
|
632
290
|
}
|
|
633
291
|
/**
|
|
634
292
|
* Represents an Vasille.js HTML element node
|
|
635
293
|
* @class Tag
|
|
636
294
|
* @extends INode
|
|
637
295
|
*/
|
|
638
|
-
export declare class Tag extends INode {
|
|
639
|
-
constructor();
|
|
296
|
+
export declare class Tag<K extends keyof AcceptedTagsMap> extends INode<TagOptionsWithSlot<K>> {
|
|
297
|
+
constructor(input: TagOptionsWithSlot<K>);
|
|
640
298
|
preinit(app: AppNode, parent: Fragment, tagName?: string): void;
|
|
299
|
+
protected compose(input: TagOptionsWithSlot<K>): void;
|
|
641
300
|
protected findFirstChild(): Node;
|
|
642
301
|
insertAdjacent(node: Node): void;
|
|
643
302
|
appendNode(node: Node): void;
|
|
@@ -649,26 +308,25 @@ export declare class Tag extends INode {
|
|
|
649
308
|
/**
|
|
650
309
|
* Runs GC
|
|
651
310
|
*/
|
|
652
|
-
destroy(): void;
|
|
311
|
+
$destroy(): void;
|
|
653
312
|
}
|
|
654
313
|
/**
|
|
655
314
|
* Represents a vasille extension node
|
|
656
315
|
* @class Extension
|
|
657
316
|
* @extends INode
|
|
658
317
|
*/
|
|
659
|
-
export declare class Extension extends INode {
|
|
318
|
+
export declare class Extension<T extends TagOptions<any> = TagOptions<any>> extends INode<T> {
|
|
660
319
|
preinit(app: AppNode, parent: Fragment): void;
|
|
661
|
-
|
|
662
|
-
destroy(): void;
|
|
320
|
+
$destroy(): void;
|
|
663
321
|
}
|
|
664
322
|
/**
|
|
665
323
|
* Node which cas has just a child
|
|
666
324
|
* @class Component
|
|
667
325
|
* @extends Extension
|
|
668
326
|
*/
|
|
669
|
-
export declare class Component extends Extension {
|
|
670
|
-
|
|
671
|
-
|
|
327
|
+
export declare class Component<T extends TagOptions<any>> extends Extension<T> {
|
|
328
|
+
init(): void;
|
|
329
|
+
ready(): void;
|
|
672
330
|
preinit(app: AppNode, parent: Fragment): void;
|
|
673
331
|
}
|
|
674
332
|
/**
|
|
@@ -699,7 +357,28 @@ export declare class SwitchedNodePrivate extends FragmentPrivate {
|
|
|
699
357
|
/**
|
|
700
358
|
* Runs GC
|
|
701
359
|
*/
|
|
702
|
-
destroy(): void;
|
|
360
|
+
$destroy(): void;
|
|
361
|
+
}
|
|
362
|
+
/**
|
|
363
|
+
* Defines a node witch can switch its children conditionally
|
|
364
|
+
*/
|
|
365
|
+
export declare class SwitchedNode extends Fragment {
|
|
366
|
+
protected $: SwitchedNodePrivate;
|
|
367
|
+
/**
|
|
368
|
+
* Constructs a switch node and define a sync function
|
|
369
|
+
*/
|
|
370
|
+
constructor();
|
|
371
|
+
addCase(case_: {
|
|
372
|
+
cond: IValue<boolean>;
|
|
373
|
+
cb: (node: Fragment) => void;
|
|
374
|
+
}): void;
|
|
375
|
+
/**
|
|
376
|
+
* Creates a child node
|
|
377
|
+
* @param cb {function(Fragment)} Call-back
|
|
378
|
+
*/
|
|
379
|
+
createChild(cb: (node: Fragment) => void): void;
|
|
380
|
+
ready(): void;
|
|
381
|
+
$destroy(): void;
|
|
703
382
|
}
|
|
704
383
|
/**
|
|
705
384
|
* The private part of a text node
|
|
@@ -717,7 +396,7 @@ export declare class DebugPrivate extends FragmentPrivate {
|
|
|
717
396
|
/**
|
|
718
397
|
* Clear node data
|
|
719
398
|
*/
|
|
720
|
-
destroy(): void;
|
|
399
|
+
$destroy(): void;
|
|
721
400
|
}
|
|
722
401
|
/**
|
|
723
402
|
* Represents a debug node
|
|
@@ -735,5 +414,5 @@ export declare class DebugNode extends Fragment {
|
|
|
735
414
|
/**
|
|
736
415
|
* Runs garbage collector
|
|
737
416
|
*/
|
|
738
|
-
destroy(): void;
|
|
417
|
+
$destroy(): void;
|
|
739
418
|
}
|
package/types/node/watch.d.ts
CHANGED
|
@@ -1,23 +1,17 @@
|
|
|
1
1
|
import { Fragment } from "./node";
|
|
2
|
-
import { Slot } from "../core/slot";
|
|
3
2
|
import { IValue } from "../core/ivalue";
|
|
3
|
+
import { Options } from "../functional/options";
|
|
4
|
+
interface WatchOptions<T> extends Options {
|
|
5
|
+
model: IValue<T>;
|
|
6
|
+
slot?: (node: Fragment, value: T) => void;
|
|
7
|
+
}
|
|
4
8
|
/**
|
|
5
9
|
* Watch Node
|
|
6
10
|
* @class Watch
|
|
7
11
|
* @extends Fragment
|
|
8
12
|
*/
|
|
9
|
-
export declare class Watch<T> extends Fragment {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
* @type Slot
|
|
13
|
-
*/
|
|
14
|
-
slot: Slot<Fragment, T>;
|
|
15
|
-
/**
|
|
16
|
-
* iValue to watch
|
|
17
|
-
* @type IValue
|
|
18
|
-
*/
|
|
19
|
-
model: IValue<T>;
|
|
20
|
-
constructor();
|
|
21
|
-
createWatchers(): void;
|
|
22
|
-
compose(): void;
|
|
13
|
+
export declare class Watch<T> extends Fragment<WatchOptions<T>> {
|
|
14
|
+
input: WatchOptions<T>;
|
|
15
|
+
compose(input: WatchOptions<T>): void;
|
|
23
16
|
}
|
|
17
|
+
export {};
|