@odoo/owl 3.0.0-alpha.2 → 3.0.0-alpha.20
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/dist/compile_templates.mjs +2430 -2532
- package/dist/compiler.js +2371 -0
- package/dist/owl.cjs.js +6571 -6615
- package/dist/owl.cjs.runtime.js +4070 -0
- package/dist/owl.es.js +6559 -6599
- package/dist/owl.es.runtime.js +4026 -0
- package/dist/owl.iife.js +6572 -6616
- package/dist/owl.iife.min.js +1 -1
- package/dist/owl.iife.runtime.js +4074 -0
- package/dist/owl.iife.runtime.min.js +1 -0
- package/dist/types/common/owl_error.d.ts +3 -3
- package/dist/types/common/types.d.ts +0 -28
- package/dist/types/common/utils.d.ts +8 -8
- package/dist/types/compiler/code_generator.d.ts +134 -152
- package/dist/types/compiler/index.d.ts +13 -13
- package/dist/types/compiler/inline_expressions.d.ts +58 -59
- package/dist/types/compiler/parser.d.ts +175 -178
- package/dist/types/compiler/standalone/index.d.ts +2 -2
- package/dist/types/compiler/standalone/setup_jsdom.d.ts +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/owl.d.ts +703 -665
- package/dist/types/runtime/app.d.ts +55 -62
- package/dist/types/runtime/blockdom/attributes.d.ts +6 -6
- package/dist/types/runtime/blockdom/block_compiler.d.ts +21 -21
- package/dist/types/runtime/blockdom/config.d.ts +8 -8
- package/dist/types/runtime/blockdom/event_catcher.d.ts +7 -7
- package/dist/types/runtime/blockdom/events.d.ts +8 -8
- package/dist/types/runtime/blockdom/html.d.ts +17 -17
- package/dist/types/runtime/blockdom/index.d.ts +25 -26
- package/dist/types/runtime/blockdom/list.d.ts +18 -18
- package/dist/types/runtime/blockdom/multi.d.ts +17 -17
- package/dist/types/runtime/blockdom/text.d.ts +26 -26
- package/dist/types/runtime/blockdom/toggler.d.ts +17 -17
- package/dist/types/runtime/component.d.ts +17 -28
- package/dist/types/runtime/component_node.d.ts +57 -83
- package/dist/types/runtime/context.d.ts +36 -0
- package/dist/types/runtime/event_handling.d.ts +1 -1
- package/dist/types/runtime/hooks.d.ts +32 -57
- package/dist/types/runtime/index.d.ts +46 -35
- package/dist/types/runtime/lifecycle_hooks.d.ts +10 -12
- package/dist/types/runtime/model.d.ts +48 -0
- package/dist/types/runtime/plugin_hooks.d.ts +6 -0
- package/dist/types/runtime/plugin_manager.d.ts +34 -0
- package/dist/types/runtime/plugins.d.ts +36 -39
- package/dist/types/runtime/portal.d.ts +12 -15
- package/dist/types/runtime/props.d.ts +21 -0
- package/dist/types/runtime/reactivity/async_computed.d.ts +1 -0
- package/dist/types/runtime/reactivity/computations.d.ts +33 -0
- package/dist/types/runtime/reactivity/computed.d.ts +6 -0
- package/dist/types/runtime/reactivity/derived.d.ts +7 -0
- package/dist/types/runtime/reactivity/effect.d.ts +1 -0
- package/dist/types/runtime/reactivity/proxy.d.ts +47 -0
- package/dist/types/runtime/reactivity/reactivity.d.ts +46 -0
- package/dist/types/runtime/reactivity/signal.d.ts +31 -0
- package/dist/types/runtime/reactivity/signals.d.ts +30 -0
- package/dist/types/runtime/reactivity/state.d.ts +48 -0
- package/dist/types/runtime/reactivity.d.ts +12 -1
- package/dist/types/runtime/registry.d.ts +24 -15
- package/dist/types/runtime/rendering/error_handling.d.ts +13 -0
- package/dist/types/runtime/rendering/fibers.d.ts +37 -0
- package/dist/types/runtime/rendering/scheduler.d.ts +21 -0
- package/dist/types/runtime/rendering/template_helpers.d.ts +51 -0
- package/dist/types/runtime/resource.d.ts +18 -0
- package/dist/types/runtime/signals.d.ts +6 -4
- package/dist/types/runtime/status.d.ts +11 -10
- package/dist/types/runtime/suspense.d.ts +5 -0
- package/dist/types/runtime/template_set.d.ts +36 -40
- package/dist/types/runtime/types.d.ts +67 -0
- package/dist/types/runtime/utils.d.ts +24 -25
- package/dist/types/runtime/validation.d.ts +19 -36
- package/dist/types/version.d.ts +1 -1
- package/package.json +22 -19
package/dist/types/owl.d.ts
CHANGED
|
@@ -1,687 +1,725 @@
|
|
|
1
|
-
declare class VToggler {
|
|
2
|
-
key: string;
|
|
3
|
-
child: VNode;
|
|
4
|
-
parentEl?: HTMLElement | undefined;
|
|
5
|
-
constructor(key: string, child: VNode);
|
|
6
|
-
mount(parent: HTMLElement, afterNode: Node | null): void;
|
|
7
|
-
moveBeforeDOMNode(node: Node | null, parent?: HTMLElement): void;
|
|
8
|
-
moveBeforeVNode(other: VToggler | null, afterNode: Node | null): void;
|
|
9
|
-
patch(other: VToggler, withBeforeRemove: boolean): void;
|
|
10
|
-
beforeRemove(): void;
|
|
11
|
-
remove(): void;
|
|
12
|
-
firstNode(): Node | undefined;
|
|
13
|
-
toString(): string;
|
|
14
|
-
}
|
|
1
|
+
declare class VToggler {
|
|
2
|
+
key: string;
|
|
3
|
+
child: VNode;
|
|
4
|
+
parentEl?: HTMLElement | undefined;
|
|
5
|
+
constructor(key: string, child: VNode);
|
|
6
|
+
mount(parent: HTMLElement, afterNode: Node | null): void;
|
|
7
|
+
moveBeforeDOMNode(node: Node | null, parent?: HTMLElement): void;
|
|
8
|
+
moveBeforeVNode(other: VToggler | null, afterNode: Node | null): void;
|
|
9
|
+
patch(other: VToggler, withBeforeRemove: boolean): void;
|
|
10
|
+
beforeRemove(): void;
|
|
11
|
+
remove(): void;
|
|
12
|
+
firstNode(): Node | undefined;
|
|
13
|
+
toString(): string;
|
|
14
|
+
}
|
|
15
15
|
declare function toggler(key: string, child: VNode): VNode<VToggler>;
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Compiling blocks is a multi-step process:
|
|
20
|
-
*
|
|
21
|
-
* 1. build an IntermediateTree from the HTML element. This intermediate tree
|
|
22
|
-
* is a binary tree structure that encode dynamic info sub nodes, and the
|
|
23
|
-
* path required to reach them
|
|
24
|
-
* 2. process the tree to build a block context, which is an object that aggregate
|
|
25
|
-
* all dynamic info in a list, and also, all ref indexes.
|
|
26
|
-
* 3. process the context to build appropriate builder/setter functions
|
|
27
|
-
* 4. make a dynamic block class, which will efficiently collect references and
|
|
28
|
-
* create/update dynamic locations/children
|
|
29
|
-
*
|
|
30
|
-
* @param str
|
|
31
|
-
* @returns a new block type, that can build concrete blocks
|
|
32
|
-
*/
|
|
17
|
+
type BlockType = (data?: any[], children?: VNode[]) => VNode;
|
|
18
|
+
/**
|
|
19
|
+
* Compiling blocks is a multi-step process:
|
|
20
|
+
*
|
|
21
|
+
* 1. build an IntermediateTree from the HTML element. This intermediate tree
|
|
22
|
+
* is a binary tree structure that encode dynamic info sub nodes, and the
|
|
23
|
+
* path required to reach them
|
|
24
|
+
* 2. process the tree to build a block context, which is an object that aggregate
|
|
25
|
+
* all dynamic info in a list, and also, all ref indexes.
|
|
26
|
+
* 3. process the context to build appropriate builder/setter functions
|
|
27
|
+
* 4. make a dynamic block class, which will efficiently collect references and
|
|
28
|
+
* create/update dynamic locations/children
|
|
29
|
+
*
|
|
30
|
+
* @param str
|
|
31
|
+
* @returns a new block type, that can build concrete blocks
|
|
32
|
+
*/
|
|
33
33
|
declare function createBlock(str: string): BlockType;
|
|
34
34
|
|
|
35
|
-
declare class VList {
|
|
36
|
-
children: VNode[];
|
|
37
|
-
anchor: Node | undefined;
|
|
38
|
-
parentEl?: HTMLElement | undefined;
|
|
39
|
-
isOnlyChild?: boolean | undefined;
|
|
40
|
-
constructor(children: VNode[]);
|
|
41
|
-
mount(parent: HTMLElement, afterNode: Node | null): void;
|
|
42
|
-
moveBeforeDOMNode(node: Node | null, parent?: HTMLElement | undefined): void;
|
|
43
|
-
moveBeforeVNode(other: VList | null, afterNode: Node | null): void;
|
|
44
|
-
patch(other: VList, withBeforeRemove: boolean): void;
|
|
45
|
-
beforeRemove(): void;
|
|
46
|
-
remove(): void;
|
|
47
|
-
firstNode(): Node | undefined;
|
|
48
|
-
toString(): string;
|
|
49
|
-
}
|
|
35
|
+
declare class VList {
|
|
36
|
+
children: VNode[];
|
|
37
|
+
anchor: Node | undefined;
|
|
38
|
+
parentEl?: HTMLElement | undefined;
|
|
39
|
+
isOnlyChild?: boolean | undefined;
|
|
40
|
+
constructor(children: VNode[]);
|
|
41
|
+
mount(parent: HTMLElement, afterNode: Node | null): void;
|
|
42
|
+
moveBeforeDOMNode(node: Node | null, parent?: HTMLElement | undefined): void;
|
|
43
|
+
moveBeforeVNode(other: VList | null, afterNode: Node | null): void;
|
|
44
|
+
patch(other: VList, withBeforeRemove: boolean): void;
|
|
45
|
+
beforeRemove(): void;
|
|
46
|
+
remove(): void;
|
|
47
|
+
firstNode(): Node | undefined;
|
|
48
|
+
toString(): string;
|
|
49
|
+
}
|
|
50
50
|
declare function list(children: VNode[]): VNode<VList>;
|
|
51
51
|
|
|
52
|
-
declare class VMulti {
|
|
53
|
-
children: (VNode | undefined)[];
|
|
54
|
-
anchors?: Node[] | undefined;
|
|
55
|
-
parentEl?: HTMLElement | undefined;
|
|
56
|
-
isOnlyChild?: boolean | undefined;
|
|
57
|
-
constructor(children: (VNode | undefined)[]);
|
|
58
|
-
mount(parent: HTMLElement, afterNode: Node | null): void;
|
|
59
|
-
moveBeforeDOMNode(node: Node | null, parent?: HTMLElement | undefined): void;
|
|
60
|
-
moveBeforeVNode(other: VMulti | null, afterNode: Node | null): void;
|
|
61
|
-
patch(other: VMulti, withBeforeRemove: boolean): void;
|
|
62
|
-
beforeRemove(): void;
|
|
63
|
-
remove(): void;
|
|
64
|
-
firstNode(): Node | undefined;
|
|
65
|
-
toString(): string;
|
|
66
|
-
}
|
|
52
|
+
declare class VMulti {
|
|
53
|
+
children: (VNode | undefined)[];
|
|
54
|
+
anchors?: Node[] | undefined;
|
|
55
|
+
parentEl?: HTMLElement | undefined;
|
|
56
|
+
isOnlyChild?: boolean | undefined;
|
|
57
|
+
constructor(children: (VNode | undefined)[]);
|
|
58
|
+
mount(parent: HTMLElement, afterNode: Node | null): void;
|
|
59
|
+
moveBeforeDOMNode(node: Node | null, parent?: HTMLElement | undefined): void;
|
|
60
|
+
moveBeforeVNode(other: VMulti | null, afterNode: Node | null): void;
|
|
61
|
+
patch(other: VMulti, withBeforeRemove: boolean): void;
|
|
62
|
+
beforeRemove(): void;
|
|
63
|
+
remove(): void;
|
|
64
|
+
firstNode(): Node | undefined;
|
|
65
|
+
toString(): string;
|
|
66
|
+
}
|
|
67
67
|
declare function multi(children: (VNode | undefined)[]): VNode<VMulti>;
|
|
68
68
|
|
|
69
|
-
declare abstract class VSimpleNode {
|
|
70
|
-
text: string | String;
|
|
71
|
-
parentEl?: HTMLElement | undefined;
|
|
72
|
-
el?: any;
|
|
73
|
-
constructor(text: string | String);
|
|
74
|
-
mountNode(node: Node, parent: HTMLElement, afterNode: Node | null): void;
|
|
75
|
-
moveBeforeDOMNode(node: Node | null, parent?: HTMLElement | undefined): void;
|
|
76
|
-
moveBeforeVNode(other: VText | null, afterNode: Node | null): void;
|
|
77
|
-
beforeRemove(): void;
|
|
78
|
-
remove(): void;
|
|
79
|
-
firstNode(): Node;
|
|
80
|
-
toString(): string | String;
|
|
81
|
-
}
|
|
82
|
-
declare class VText extends VSimpleNode {
|
|
83
|
-
mount(parent: HTMLElement, afterNode: Node | null): void;
|
|
84
|
-
patch(other: VText): void;
|
|
85
|
-
}
|
|
86
|
-
declare class VComment extends VSimpleNode {
|
|
87
|
-
mount(parent: HTMLElement, afterNode: Node | null): void;
|
|
88
|
-
patch(): void;
|
|
89
|
-
}
|
|
90
|
-
declare function text(str: string | String): VNode<VText>;
|
|
69
|
+
declare abstract class VSimpleNode {
|
|
70
|
+
text: string | String;
|
|
71
|
+
parentEl?: HTMLElement | undefined;
|
|
72
|
+
el?: any;
|
|
73
|
+
constructor(text: string | String);
|
|
74
|
+
mountNode(node: Node, parent: HTMLElement, afterNode: Node | null): void;
|
|
75
|
+
moveBeforeDOMNode(node: Node | null, parent?: HTMLElement | undefined): void;
|
|
76
|
+
moveBeforeVNode(other: VText | null, afterNode: Node | null): void;
|
|
77
|
+
beforeRemove(): void;
|
|
78
|
+
remove(): void;
|
|
79
|
+
firstNode(): Node;
|
|
80
|
+
toString(): string | String;
|
|
81
|
+
}
|
|
82
|
+
declare class VText extends VSimpleNode {
|
|
83
|
+
mount(parent: HTMLElement, afterNode: Node | null): void;
|
|
84
|
+
patch(other: VText): void;
|
|
85
|
+
}
|
|
86
|
+
declare class VComment extends VSimpleNode {
|
|
87
|
+
mount(parent: HTMLElement, afterNode: Node | null): void;
|
|
88
|
+
patch(): void;
|
|
89
|
+
}
|
|
90
|
+
declare function text(str: string | String): VNode<VText>;
|
|
91
91
|
declare function comment(str: string): VNode<VComment>;
|
|
92
92
|
|
|
93
|
-
declare class VHtml {
|
|
94
|
-
html: string;
|
|
95
|
-
parentEl?: HTMLElement | undefined;
|
|
96
|
-
content: ChildNode[];
|
|
97
|
-
constructor(html: string);
|
|
98
|
-
mount(parent: HTMLElement, afterNode: Node | null): void;
|
|
99
|
-
moveBeforeDOMNode(node: Node | null, parent?: HTMLElement | undefined): void;
|
|
100
|
-
moveBeforeVNode(other: VHtml | null, afterNode: Node | null): void;
|
|
101
|
-
patch(other: VHtml): void;
|
|
102
|
-
beforeRemove(): void;
|
|
103
|
-
remove(): void;
|
|
104
|
-
firstNode(): Node;
|
|
105
|
-
toString(): string;
|
|
106
|
-
}
|
|
93
|
+
declare class VHtml {
|
|
94
|
+
html: string;
|
|
95
|
+
parentEl?: HTMLElement | undefined;
|
|
96
|
+
content: ChildNode[];
|
|
97
|
+
constructor(html: string);
|
|
98
|
+
mount(parent: HTMLElement, afterNode: Node | null): void;
|
|
99
|
+
moveBeforeDOMNode(node: Node | null, parent?: HTMLElement | undefined): void;
|
|
100
|
+
moveBeforeVNode(other: VHtml | null, afterNode: Node | null): void;
|
|
101
|
+
patch(other: VHtml): void;
|
|
102
|
+
beforeRemove(): void;
|
|
103
|
+
remove(): void;
|
|
104
|
+
firstNode(): Node;
|
|
105
|
+
toString(): string;
|
|
106
|
+
}
|
|
107
107
|
declare function html(str: string): VNode<VHtml>;
|
|
108
108
|
|
|
109
|
-
interface VNode<T = any> {
|
|
110
|
-
mount(parent: HTMLElement, afterNode: Node | null): void;
|
|
111
|
-
moveBeforeDOMNode(node: Node | null, parent?: HTMLElement): void;
|
|
112
|
-
moveBeforeVNode(other: T | null, afterNode: Node | null): void;
|
|
113
|
-
patch(other: T, withBeforeRemove: boolean): void;
|
|
114
|
-
beforeRemove(): void;
|
|
115
|
-
remove(): void;
|
|
116
|
-
firstNode(): Node | undefined;
|
|
117
|
-
el?: undefined | HTMLElement | Text;
|
|
118
|
-
parentEl?: undefined | HTMLElement;
|
|
119
|
-
isOnlyChild?: boolean | undefined;
|
|
120
|
-
key?: any;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
declare function mount$1(vnode: VNode, fixture: HTMLElement, afterNode?: Node | null): void;
|
|
124
|
-
declare function patch(vnode1: VNode, vnode2: VNode, withBeforeRemove?: boolean): void;
|
|
109
|
+
interface VNode<T = any> {
|
|
110
|
+
mount(parent: HTMLElement, afterNode: Node | null): void;
|
|
111
|
+
moveBeforeDOMNode(node: Node | null, parent?: HTMLElement): void;
|
|
112
|
+
moveBeforeVNode(other: T | null, afterNode: Node | null): void;
|
|
113
|
+
patch(other: T, withBeforeRemove: boolean): void;
|
|
114
|
+
beforeRemove(): void;
|
|
115
|
+
remove(): void;
|
|
116
|
+
firstNode(): Node | undefined;
|
|
117
|
+
el?: undefined | HTMLElement | Text;
|
|
118
|
+
parentEl?: undefined | HTMLElement;
|
|
119
|
+
isOnlyChild?: boolean | undefined;
|
|
120
|
+
key?: any;
|
|
121
|
+
}
|
|
122
|
+
type BDom = VNode<any>;
|
|
123
|
+
declare function mount$1(vnode: VNode, fixture: HTMLElement, afterNode?: Node | null): void;
|
|
124
|
+
declare function patch(vnode1: VNode, vnode2: VNode, withBeforeRemove?: boolean): void;
|
|
125
125
|
declare function remove(vnode: VNode, withBeforeRemove?: boolean): void;
|
|
126
126
|
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
declare
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
declare
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
declare class
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
declare
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
declare type
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
127
|
+
interface ResourceOptions<T> {
|
|
128
|
+
name?: string;
|
|
129
|
+
validation?: T;
|
|
130
|
+
}
|
|
131
|
+
declare class Resource<T> {
|
|
132
|
+
private _items;
|
|
133
|
+
private _name?;
|
|
134
|
+
private _validation?;
|
|
135
|
+
constructor(options?: ResourceOptions<T>);
|
|
136
|
+
items: ReactiveValue<T[], T[]>;
|
|
137
|
+
add(item: T, options?: {
|
|
138
|
+
sequence?: number;
|
|
139
|
+
}): Resource<T>;
|
|
140
|
+
delete(item: T): Resource<T>;
|
|
141
|
+
has(item: T): boolean;
|
|
142
|
+
}
|
|
143
|
+
declare function useResource<T>(r: Resource<T>, elements: T[]): void;
|
|
144
|
+
|
|
145
|
+
interface RegistryOptions<T> {
|
|
146
|
+
name?: string;
|
|
147
|
+
validation?: T;
|
|
148
|
+
}
|
|
149
|
+
declare class Registry<T> {
|
|
150
|
+
private _map;
|
|
151
|
+
private _name;
|
|
152
|
+
private _validation?;
|
|
153
|
+
constructor(options?: RegistryOptions<T>);
|
|
154
|
+
entries: ReactiveValue<[string, T][], [string, T][]>;
|
|
155
|
+
items: ReactiveValue<T[], T[]>;
|
|
156
|
+
addById<U extends {
|
|
157
|
+
id: string;
|
|
158
|
+
} & T>(item: U, options?: {
|
|
159
|
+
sequence?: number;
|
|
160
|
+
}): Registry<T>;
|
|
161
|
+
add(key: string, value: T, options?: {
|
|
162
|
+
sequence?: number;
|
|
163
|
+
}): Registry<T>;
|
|
164
|
+
get(key: string, defaultValue?: T): T;
|
|
165
|
+
delete(key: string): void;
|
|
166
|
+
has(key: string): boolean;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
declare const enum STATUS {
|
|
170
|
+
NEW = 0,
|
|
171
|
+
MOUNTED = 1,// is ready, and in DOM. It has a valid el
|
|
172
|
+
CANCELLED = 2,
|
|
173
|
+
DESTROYED = 3
|
|
174
|
+
}
|
|
175
|
+
type STATUS_DESCR = "new" | "started" | "mounted" | "cancelled" | "destroyed";
|
|
176
|
+
declare function status(entity: Component | Plugin): STATUS_DESCR;
|
|
177
|
+
|
|
178
|
+
interface PluginConstructor {
|
|
179
|
+
new (...args: any[]): Plugin;
|
|
180
|
+
id: string;
|
|
181
|
+
}
|
|
182
|
+
declare class Plugin {
|
|
183
|
+
private static _shadowId;
|
|
184
|
+
static get id(): string;
|
|
185
|
+
static set id(shadowId: string);
|
|
186
|
+
__owl__: PluginManager;
|
|
187
|
+
constructor(manager: PluginManager);
|
|
188
|
+
setup(): void;
|
|
189
|
+
}
|
|
190
|
+
interface PluginManagerOptions {
|
|
191
|
+
parent?: PluginManager | null;
|
|
192
|
+
config?: Record<string, any>;
|
|
193
|
+
}
|
|
194
|
+
declare class PluginManager {
|
|
195
|
+
app: App;
|
|
196
|
+
config: Record<string, any>;
|
|
197
|
+
onDestroyCb: Function[];
|
|
198
|
+
plugins: Record<string, Plugin>;
|
|
199
|
+
status: STATUS;
|
|
200
|
+
constructor(app: App, options?: PluginManagerOptions);
|
|
201
|
+
destroy(): void;
|
|
202
|
+
getPluginById<T extends Plugin>(id: string): T | null;
|
|
203
|
+
getPlugin<T extends PluginConstructor>(pluginConstructor: T): InstanceType<T> | null;
|
|
204
|
+
startPlugin<T extends PluginConstructor>(pluginConstructor: T): InstanceType<T> | null;
|
|
205
|
+
startPlugins(pluginConstructors: PluginConstructor[]): void;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
interface ReactiveValue<TRead, TWrite = TRead> {
|
|
209
|
+
(): TRead;
|
|
210
|
+
/**
|
|
211
|
+
* Update the value of the reactive with a new value. If the new value is different
|
|
212
|
+
* from the previous values, all computations that depends on this reactive will
|
|
213
|
+
* be invalidated, and effects will rerun.
|
|
214
|
+
*/
|
|
215
|
+
set(nextValue: TWrite): void;
|
|
216
|
+
}
|
|
217
|
+
declare enum ComputationState {
|
|
218
|
+
EXECUTED = 0,
|
|
219
|
+
STALE = 1,
|
|
220
|
+
PENDING = 2
|
|
221
|
+
}
|
|
222
|
+
interface Atom<T = any> {
|
|
223
|
+
observers: Set<ComputationAtom>;
|
|
224
|
+
value: T;
|
|
225
|
+
}
|
|
226
|
+
interface ComputationAtom<T = any> extends Atom<T> {
|
|
227
|
+
compute: () => T;
|
|
228
|
+
isDerived: boolean;
|
|
229
|
+
sources: Set<Atom>;
|
|
230
|
+
state: ComputationState;
|
|
231
|
+
}
|
|
232
|
+
declare function untrack<T>(fn: (...args: any[]) => T): T;
|
|
233
|
+
|
|
234
|
+
declare class Fiber {
|
|
235
|
+
node: ComponentNode;
|
|
236
|
+
bdom: BDom | null;
|
|
237
|
+
root: RootFiber | null;
|
|
238
|
+
parent: Fiber | null;
|
|
239
|
+
children: Fiber[];
|
|
240
|
+
appliedToDom: boolean;
|
|
241
|
+
deep: boolean;
|
|
242
|
+
childrenMap: ComponentNode["children"];
|
|
243
|
+
constructor(node: ComponentNode, parent: Fiber | null);
|
|
244
|
+
render(): void;
|
|
245
|
+
_render(): void;
|
|
246
|
+
}
|
|
247
|
+
declare class RootFiber extends Fiber {
|
|
248
|
+
counter: number;
|
|
249
|
+
willPatch: Fiber[];
|
|
250
|
+
patched: Fiber[];
|
|
251
|
+
mounted: Fiber[];
|
|
252
|
+
locked: boolean;
|
|
253
|
+
complete(): void;
|
|
254
|
+
setCounter(newValue: number): void;
|
|
255
|
+
}
|
|
256
|
+
type Position = "first-child" | "last-child";
|
|
257
|
+
interface MountOptions {
|
|
258
|
+
position?: Position;
|
|
259
|
+
}
|
|
260
|
+
declare class MountFiber extends RootFiber {
|
|
261
|
+
target: HTMLElement;
|
|
262
|
+
position: Position;
|
|
263
|
+
constructor(node: ComponentNode, target: HTMLElement, options?: MountOptions);
|
|
264
|
+
complete(): void;
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
type LifecycleHook = Function;
|
|
268
|
+
declare class ComponentNode implements VNode<ComponentNode> {
|
|
269
|
+
el?: HTMLElement | Text | undefined;
|
|
270
|
+
app: App;
|
|
271
|
+
fiber: Fiber | null;
|
|
272
|
+
component: Component;
|
|
273
|
+
bdom: BDom | null;
|
|
274
|
+
status: STATUS;
|
|
275
|
+
forceNextRender: boolean;
|
|
276
|
+
parentKey: string | null;
|
|
277
|
+
props: Record<string, any>;
|
|
278
|
+
renderFn: Function;
|
|
279
|
+
parent: ComponentNode | null;
|
|
280
|
+
children: {
|
|
281
|
+
[key: string]: ComponentNode;
|
|
282
|
+
};
|
|
283
|
+
willStart: LifecycleHook[];
|
|
284
|
+
willUpdateProps: LifecycleHook[];
|
|
285
|
+
willUnmount: LifecycleHook[];
|
|
286
|
+
mounted: LifecycleHook[];
|
|
287
|
+
willPatch: LifecycleHook[];
|
|
288
|
+
patched: LifecycleHook[];
|
|
289
|
+
willDestroy: LifecycleHook[];
|
|
290
|
+
signalComputation: ComputationAtom;
|
|
291
|
+
pluginManager: PluginManager;
|
|
292
|
+
constructor(C: ComponentConstructor, props: Record<string, any>, app: App, parent: ComponentNode | null, parentKey: string | null);
|
|
293
|
+
mountComponent(target: any, options?: MountOptions): void;
|
|
294
|
+
initiateRender(fiber: Fiber | MountFiber): Promise<void>;
|
|
295
|
+
render(deep: boolean): Promise<void>;
|
|
296
|
+
cancel(): void;
|
|
297
|
+
_cancel(): void;
|
|
298
|
+
destroy(): void;
|
|
299
|
+
_destroy(): void;
|
|
300
|
+
updateAndRender(props: Record<string, any>, parentFiber: Fiber): Promise<void>;
|
|
301
|
+
/**
|
|
302
|
+
* Finds a child that has dom that is not yet updated, and update it. This
|
|
303
|
+
* method is meant to be used only in the context of repatching the dom after
|
|
304
|
+
* a mounted hook failed and was handled.
|
|
305
|
+
*/
|
|
306
|
+
updateDom(): void;
|
|
307
|
+
firstNode(): Node | undefined;
|
|
308
|
+
mount(parent: HTMLElement, anchor: ChildNode): void;
|
|
309
|
+
moveBeforeDOMNode(node: Node | null, parent?: HTMLElement): void;
|
|
310
|
+
moveBeforeVNode(other: ComponentNode | null, afterNode: Node | null): void;
|
|
311
|
+
patch(): void;
|
|
312
|
+
_patch(): void;
|
|
313
|
+
beforeRemove(): void;
|
|
314
|
+
remove(): void;
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
interface StaticComponentProperties {
|
|
318
|
+
template: string;
|
|
319
|
+
components?: {
|
|
320
|
+
[componentName: string]: ComponentConstructor;
|
|
321
|
+
};
|
|
322
|
+
}
|
|
323
|
+
interface ComponentConstructor extends StaticComponentProperties {
|
|
324
|
+
new (node: ComponentNode): Component;
|
|
325
|
+
}
|
|
326
|
+
declare class Component {
|
|
327
|
+
static template: string;
|
|
328
|
+
__owl__: ComponentNode;
|
|
329
|
+
constructor(node: ComponentNode);
|
|
330
|
+
setup(): void;
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
type Constructor<T = any> = {
|
|
334
|
+
new (...args: any[]): T;
|
|
335
|
+
};
|
|
336
|
+
type GetOptionalEntries<T> = {
|
|
337
|
+
[K in keyof T as K extends `${infer P}?` ? P : never]?: T[K];
|
|
338
|
+
};
|
|
339
|
+
type GetRequiredEntries<T> = {
|
|
340
|
+
[K in keyof T as K extends `${string}?` ? never : K]: T[K];
|
|
341
|
+
};
|
|
342
|
+
type PrettifyShape<T> = T extends Function ? T : {
|
|
343
|
+
[K in keyof T]: T[K];
|
|
344
|
+
};
|
|
345
|
+
type ResolveOptionalEntries<T> = PrettifyShape<GetRequiredEntries<T> & GetOptionalEntries<T>>;
|
|
346
|
+
type KeyedObject<K extends string[]> = {
|
|
347
|
+
[P in K[number]]: any;
|
|
348
|
+
};
|
|
349
|
+
type ResolveShapedObject<T extends {}> = PrettifyShape<ResolveOptionalEntries<T>>;
|
|
350
|
+
type ResolveObjectType<T extends {}> = ResolveShapedObject<T extends string[] ? KeyedObject<T> : T>;
|
|
351
|
+
type UnionToIntersection<U> = (U extends any ? (_: U) => any : never) extends (_: infer I) => void ? I : never;
|
|
352
|
+
declare function arrayType(): any[];
|
|
353
|
+
declare function arrayType<T>(elementType: T): T[];
|
|
354
|
+
declare function constructorType<T extends Constructor>(constructor: T): T;
|
|
355
|
+
declare function customValidator<T>(type: T, validator: (value: T) => boolean, errorMessage?: string): T;
|
|
356
|
+
declare function functionType(): (...parameters: any[]) => any;
|
|
357
|
+
declare function functionType<const P extends any[]>(parameters: P): (...parameters: P) => void;
|
|
358
|
+
declare function functionType<const P extends any[], R>(parameters: P, result: R): (...parameters: P) => R;
|
|
359
|
+
declare function instanceType<T extends Constructor>(constructor: T): InstanceType<T>;
|
|
360
|
+
declare function intersection<T extends any[]>(types: T): UnionToIntersection<T[number]>;
|
|
361
|
+
type LiteralTypes = number | string | boolean | null | undefined;
|
|
362
|
+
declare function literalType<const T extends LiteralTypes>(literal: T): T;
|
|
363
|
+
declare function literalSelection<const T extends LiteralTypes>(literals: T[]): T;
|
|
364
|
+
declare function objectType(): Record<string, any>;
|
|
365
|
+
declare function objectType<const Keys extends string[]>(keys: Keys): ResolveOptionalEntries<KeyedObject<Keys>>;
|
|
366
|
+
declare function objectType<Shape extends {}>(shape: Shape): ResolveOptionalEntries<Shape>;
|
|
367
|
+
declare function promiseType(): Promise<void>;
|
|
368
|
+
declare function promiseType<T>(type: T): Promise<T>;
|
|
369
|
+
declare function recordType(): Record<PropertyKey, any>;
|
|
370
|
+
declare function recordType<V>(valueType: V): Record<PropertyKey, V>;
|
|
371
|
+
declare function tuple<const T extends any[]>(types: T): T;
|
|
372
|
+
declare function union<T extends any[]>(types: T): T[number];
|
|
373
|
+
declare function reactiveValueType(): ReactiveValue<any>;
|
|
374
|
+
declare function reactiveValueType<T>(type: T): ReactiveValue<T>;
|
|
375
|
+
declare function ref(): HTMLElement | null;
|
|
376
|
+
declare function ref<T extends Constructor<HTMLElement>>(type: T): InstanceType<T> | null;
|
|
377
|
+
declare const types: {
|
|
378
|
+
and: typeof intersection;
|
|
379
|
+
any: any;
|
|
380
|
+
array: typeof arrayType;
|
|
381
|
+
boolean: boolean;
|
|
382
|
+
constructor: typeof constructorType;
|
|
383
|
+
customValidator: typeof customValidator;
|
|
384
|
+
function: typeof functionType;
|
|
385
|
+
instanceOf: typeof instanceType;
|
|
386
|
+
literal: typeof literalType;
|
|
387
|
+
number: number;
|
|
388
|
+
object: typeof objectType;
|
|
389
|
+
or: typeof union;
|
|
390
|
+
promise: typeof promiseType;
|
|
391
|
+
record: typeof recordType;
|
|
392
|
+
ref: typeof ref;
|
|
393
|
+
selection: typeof literalSelection;
|
|
394
|
+
signal: typeof reactiveValueType;
|
|
395
|
+
string: string;
|
|
396
|
+
tuple: typeof tuple;
|
|
397
|
+
};
|
|
398
|
+
|
|
399
|
+
declare const isProps: unique symbol;
|
|
400
|
+
type WithDefaults<T, D> = T & Required<D>;
|
|
401
|
+
type Props<T extends {}> = T & {
|
|
402
|
+
[isProps]: true;
|
|
403
|
+
};
|
|
404
|
+
type GetPropsDefaults<T extends object> = PrettifyShape<GetOptionalEntries<T>>;
|
|
405
|
+
type GetPropsWithOptionals<T> = T extends Props<infer P> ? (P extends WithDefaults<infer R, any> ? R : P) : never;
|
|
406
|
+
type GetProps<T> = {
|
|
407
|
+
[K in keyof T]: T[K] extends {
|
|
408
|
+
[isProps]: true;
|
|
409
|
+
} ? (x: GetPropsWithOptionals<T[K]>) => void : never;
|
|
410
|
+
}[keyof T] extends (x: infer I) => void ? {
|
|
411
|
+
[K in keyof I]: I[K];
|
|
412
|
+
} : never;
|
|
413
|
+
declare function props(): Props<Record<string, any>>;
|
|
414
|
+
declare function props<const Keys extends string[]>(keys: Keys): Props<ResolveObjectType<Keys>>;
|
|
415
|
+
declare function props<const Keys extends string[], Defaults>(keys: Keys, defaults: Defaults & GetPropsDefaults<KeyedObject<Keys>>): Props<WithDefaults<ResolveObjectType<Keys>, Defaults>>;
|
|
416
|
+
declare function props<Shape extends {}>(shape: Shape): Props<ResolveObjectType<Shape>>;
|
|
417
|
+
declare function props<Shape extends {}, Defaults>(shape: Shape, defaults: Defaults & GetPropsDefaults<Shape>): Props<WithDefaults<ResolveObjectType<Shape>, Defaults>>;
|
|
418
|
+
|
|
419
|
+
type Target = object;
|
|
420
|
+
type Reactive<T extends Target> = T;
|
|
421
|
+
/**
|
|
422
|
+
* Mark an object or array so that it is ignored by the reactivity system
|
|
423
|
+
*
|
|
424
|
+
* @param value the value to mark
|
|
425
|
+
* @returns the object itself
|
|
426
|
+
*/
|
|
427
|
+
declare function markRaw<T extends Target>(value: T): T;
|
|
428
|
+
/**
|
|
429
|
+
* Given a proxy objet, return the raw (non proxy) underlying object
|
|
430
|
+
*
|
|
431
|
+
* @param value a proxy value
|
|
432
|
+
* @returns the underlying value
|
|
433
|
+
*/
|
|
434
|
+
declare function toRaw<T extends Target, U extends Reactive<T>>(value: U | T): T;
|
|
435
|
+
/**
|
|
436
|
+
* Creates a reactive proxy for an object. Reading data on the proxy object
|
|
437
|
+
* subscribes to changes to the data. Writing data on the object will cause the
|
|
438
|
+
* notify callback to be called if there are suscriptions to that data. Nested
|
|
439
|
+
* objects and arrays are automatically made reactive as well.
|
|
440
|
+
*
|
|
441
|
+
* Whenever you are notified of a change, all subscriptions are cleared, and if
|
|
442
|
+
* you would like to be notified of any further changes, you should go read
|
|
443
|
+
* the underlying data again. We assume that if you don't go read it again after
|
|
444
|
+
* being notified, it means that you are no longer interested in that data.
|
|
445
|
+
*
|
|
446
|
+
* Subscriptions:
|
|
447
|
+
* + Reading a property on an object will subscribe you to changes in the value
|
|
448
|
+
* of that property.
|
|
449
|
+
* + Accessing an object's keys (eg with Object.keys or with `for..in`) will
|
|
450
|
+
* subscribe you to the creation/deletion of keys. Checking the presence of a
|
|
451
|
+
* key on the object with 'in' has the same effect.
|
|
452
|
+
* - getOwnPropertyDescriptor does not currently subscribe you to the property.
|
|
453
|
+
* This is a choice that was made because changing a key's value will trigger
|
|
454
|
+
* this trap and we do not want to subscribe by writes. This also means that
|
|
455
|
+
* Object.hasOwnProperty doesn't subscribe as it goes through this trap.
|
|
456
|
+
*
|
|
457
|
+
* @param target the object for which to create a proxy proxy
|
|
458
|
+
* @param callback the function to call when an observed property of the
|
|
459
|
+
* proxy has changed
|
|
460
|
+
* @returns a proxy that tracks changes to it
|
|
461
|
+
*/
|
|
462
|
+
declare function proxy<T extends Target>(target: T): T;
|
|
463
|
+
|
|
464
|
+
type ErrorParams = {
|
|
465
|
+
error: any;
|
|
466
|
+
} & ({
|
|
467
|
+
node: ComponentNode;
|
|
468
|
+
} | {
|
|
469
|
+
fiber: Fiber;
|
|
470
|
+
});
|
|
381
471
|
declare function handleError(params: ErrorParams): void;
|
|
382
472
|
|
|
383
|
-
declare class Scheduler {
|
|
384
|
-
static requestAnimationFrame: ((callback: FrameRequestCallback) => number) & typeof requestAnimationFrame;
|
|
385
|
-
tasks: Set<RootFiber>;
|
|
386
|
-
requestAnimationFrame: Window["requestAnimationFrame"];
|
|
387
|
-
frame: number;
|
|
388
|
-
delayedRenders: Fiber[];
|
|
389
|
-
cancelledNodes: Set<ComponentNode>;
|
|
390
|
-
processing: boolean;
|
|
391
|
-
constructor();
|
|
392
|
-
addFiber(fiber: Fiber): void;
|
|
393
|
-
scheduleDestroy(node: ComponentNode): void;
|
|
394
|
-
/**
|
|
395
|
-
* Process all current tasks. This only applies to the fibers that are ready.
|
|
396
|
-
* Other tasks are left unchanged.
|
|
397
|
-
*/
|
|
398
|
-
flush(): void;
|
|
399
|
-
processTasks(): void;
|
|
400
|
-
processFiber(fiber: RootFiber): void;
|
|
401
|
-
}
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
customDirectives?:
|
|
414
|
-
|
|
415
|
-
}
|
|
416
|
-
declare
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
}
|
|
438
|
-
declare
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
}
|
|
459
|
-
declare
|
|
460
|
-
|
|
461
|
-
};
|
|
462
|
-
declare function xml(...args: Parameters<typeof String.raw>): string;
|
|
463
|
-
declare namespace xml {
|
|
464
|
-
var nextId: number;
|
|
465
|
-
}
|
|
466
|
-
|
|
467
|
-
declare type Callback = () => void;
|
|
468
|
-
/**
|
|
469
|
-
* Creates a batched version of a callback so that all calls to it in the same
|
|
470
|
-
* microtick will only call the original callback once.
|
|
471
|
-
*
|
|
472
|
-
* @param callback the callback to batch
|
|
473
|
-
* @returns a batched version of the original callback
|
|
474
|
-
*/
|
|
475
|
-
declare function batched(callback: Callback): Callback;
|
|
476
|
-
declare function validateTarget(target: HTMLElement | ShadowRoot): void;
|
|
477
|
-
declare class EventBus extends EventTarget {
|
|
478
|
-
trigger(name: string, payload?: any): void;
|
|
479
|
-
}
|
|
480
|
-
declare function whenReady(fn?: any): Promise<void>;
|
|
481
|
-
declare function loadFile(url: string): Promise<string>;
|
|
482
|
-
declare class Markup extends String {
|
|
483
|
-
}
|
|
484
|
-
declare function htmlEscape(str: any): Markup;
|
|
485
|
-
declare function markup(strings: TemplateStringsArray, ...placeholders: unknown[]): Markup;
|
|
473
|
+
declare class Scheduler {
|
|
474
|
+
static requestAnimationFrame: ((callback: FrameRequestCallback) => number) & typeof requestAnimationFrame;
|
|
475
|
+
tasks: Set<RootFiber>;
|
|
476
|
+
requestAnimationFrame: Window["requestAnimationFrame"];
|
|
477
|
+
frame: number;
|
|
478
|
+
delayedRenders: Fiber[];
|
|
479
|
+
cancelledNodes: Set<ComponentNode>;
|
|
480
|
+
processing: boolean;
|
|
481
|
+
constructor();
|
|
482
|
+
addFiber(fiber: Fiber): void;
|
|
483
|
+
scheduleDestroy(node: ComponentNode): void;
|
|
484
|
+
/**
|
|
485
|
+
* Process all current tasks. This only applies to the fibers that are ready.
|
|
486
|
+
* Other tasks are left unchanged.
|
|
487
|
+
*/
|
|
488
|
+
flush(): void;
|
|
489
|
+
processTasks(): void;
|
|
490
|
+
processFiber(fiber: RootFiber): void;
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
type CustomDirectives = Record<string, (node: Element, value: string, modifier: string[]) => void>;
|
|
494
|
+
type Template = (context: any, vnode: any, key?: string) => BDom;
|
|
495
|
+
type TemplateFunction = (app: TemplateSet, bdom: any, helpers: any) => Template;
|
|
496
|
+
|
|
497
|
+
interface TemplateSetConfig {
|
|
498
|
+
dev?: boolean;
|
|
499
|
+
translatableAttributes?: string[];
|
|
500
|
+
translateFn?: (s: string, translationCtx: string) => string;
|
|
501
|
+
templates?: string | Document | Record<string, string>;
|
|
502
|
+
getTemplate?: (s: string) => Element | Function | string | void;
|
|
503
|
+
customDirectives?: CustomDirectives;
|
|
504
|
+
globalValues?: object;
|
|
505
|
+
}
|
|
506
|
+
declare class TemplateSet {
|
|
507
|
+
static registerTemplate(name: string, fn: TemplateFunction): void;
|
|
508
|
+
dev: boolean;
|
|
509
|
+
rawTemplates: typeof globalTemplates;
|
|
510
|
+
templates: {
|
|
511
|
+
[name: string]: Template;
|
|
512
|
+
};
|
|
513
|
+
getRawTemplate?: (s: string) => Element | Function | string | void;
|
|
514
|
+
translateFn?: (s: string, translationCtx: string) => string;
|
|
515
|
+
translatableAttributes?: string[];
|
|
516
|
+
customDirectives: CustomDirectives;
|
|
517
|
+
runtimeUtils: object;
|
|
518
|
+
hasGlobalValues: boolean;
|
|
519
|
+
constructor(config?: TemplateSetConfig);
|
|
520
|
+
addTemplate(name: string, template: string | Element): void;
|
|
521
|
+
addTemplates(xml: string | Document): void;
|
|
522
|
+
getTemplate(name: string): Template;
|
|
523
|
+
private _compileTemplate;
|
|
524
|
+
}
|
|
525
|
+
declare const globalTemplates: {
|
|
526
|
+
[key: string]: string | Element | TemplateFunction;
|
|
527
|
+
};
|
|
528
|
+
declare function xml(...args: Parameters<typeof String.raw>): string;
|
|
529
|
+
declare namespace xml {
|
|
530
|
+
var nextId: number;
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
type Callback = (...args: any[]) => void;
|
|
534
|
+
/**
|
|
535
|
+
* Creates a batched version of a callback so that all calls to it in the same
|
|
536
|
+
* microtick will only call the original callback once.
|
|
537
|
+
*
|
|
538
|
+
* @param callback the callback to batch
|
|
539
|
+
* @returns a batched version of the original callback
|
|
540
|
+
*/
|
|
541
|
+
declare function batched(callback: Callback): Callback;
|
|
542
|
+
declare function validateTarget(target: HTMLElement | ShadowRoot): void;
|
|
543
|
+
declare class EventBus extends EventTarget {
|
|
544
|
+
trigger(name: string, payload?: any): void;
|
|
545
|
+
}
|
|
546
|
+
declare function whenReady(fn?: any): Promise<void>;
|
|
547
|
+
declare class Markup extends String {
|
|
548
|
+
}
|
|
549
|
+
declare function htmlEscape(str: any): Markup;
|
|
550
|
+
declare function markup(strings: TemplateStringsArray, ...placeholders: unknown[]): Markup;
|
|
486
551
|
declare function markup(value: string): Markup;
|
|
487
552
|
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
*
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
declare function
|
|
606
|
-
|
|
607
|
-
* This hook is a simple way to let components use a sub environment. Note that
|
|
608
|
-
* like for all hooks, it is important that this is only called in the
|
|
609
|
-
* constructor method.
|
|
610
|
-
*/
|
|
611
|
-
declare function useSubEnv(envExtension: Env): void;
|
|
612
|
-
declare function useChildSubEnv(envExtension: Env): void;
|
|
613
|
-
declare type EffectDeps<T extends unknown[]> = T | (T extends [...infer H, never] ? EffectDeps<H> : never);
|
|
614
|
-
/**
|
|
615
|
-
* @template T
|
|
616
|
-
* @param {...T} dependencies the dependencies computed by computeDependencies
|
|
617
|
-
* @returns {void|(()=>void)} a cleanup function that reverses the side
|
|
618
|
-
* effects of the effect callback.
|
|
619
|
-
*/
|
|
620
|
-
declare type Effect<T extends unknown[]> = (...dependencies: EffectDeps<T>) => void | (() => void);
|
|
621
|
-
/**
|
|
622
|
-
* This hook will run a callback when a component is mounted and patched, and
|
|
623
|
-
* will run a cleanup function before patching and before unmounting the
|
|
624
|
-
* the component.
|
|
625
|
-
*
|
|
626
|
-
* @template T
|
|
627
|
-
* @param {Effect<T>} effect the effect to run on component mount and/or patch
|
|
628
|
-
* @param {()=>[...T]} [computeDependencies=()=>[NaN]] a callback to compute
|
|
629
|
-
* dependencies that will decide if the effect needs to be cleaned up and
|
|
630
|
-
* run again. If the dependencies did not change, the effect will not run
|
|
631
|
-
* again. The default value returns an array containing only NaN because
|
|
632
|
-
* NaN !== NaN, which will cause the effect to rerun on every patch.
|
|
633
|
-
*/
|
|
634
|
-
declare function useEffect<T extends unknown[]>(effect: Effect<T>, computeDependencies?: () => [...T]): void;
|
|
635
|
-
/**
|
|
636
|
-
* When a component needs to listen to DOM Events on element(s) that are not
|
|
637
|
-
* part of his hierarchy, we can use the `useExternalListener` hook.
|
|
638
|
-
* It will correctly add and remove the event listener, whenever the
|
|
639
|
-
* component is mounted and unmounted.
|
|
640
|
-
*
|
|
641
|
-
* Example:
|
|
642
|
-
* a menu needs to listen to the click on window to be closed automatically
|
|
643
|
-
*
|
|
644
|
-
* Usage:
|
|
645
|
-
* in the constructor of the OWL component that needs to be notified,
|
|
646
|
-
* `useExternalListener(window, 'click', this._doSomething);`
|
|
647
|
-
* */
|
|
648
|
-
declare function useExternalListener(target: EventTarget, eventName: string, handler: EventListener, eventParams?: AddEventListenerOptions): void;
|
|
649
|
-
|
|
650
|
-
declare function onWillStart(fn: () => Promise<void> | void | any): void;
|
|
651
|
-
declare function onWillUpdateProps(fn: (nextProps: any) => Promise<void> | void | any): void;
|
|
652
|
-
declare function onMounted(fn: () => void | any): void;
|
|
653
|
-
declare function onWillPatch(fn: () => any | void): void;
|
|
654
|
-
declare function onPatched(fn: () => void | any): void;
|
|
655
|
-
declare function onWillUnmount(fn: () => void | any): void;
|
|
656
|
-
declare function onWillDestroy(fn: () => void | any): void;
|
|
657
|
-
declare function onWillRender(fn: () => void | any): void;
|
|
658
|
-
declare function onRendered(fn: () => void | any): void;
|
|
659
|
-
declare type OnErrorCallback = (error: any) => void | any;
|
|
553
|
+
type ComponentInstance<C extends ComponentConstructor> = C extends new (...args: any) => infer T ? T : never;
|
|
554
|
+
interface RootConfig<P> {
|
|
555
|
+
props?: P;
|
|
556
|
+
}
|
|
557
|
+
interface AppConfig extends TemplateSetConfig {
|
|
558
|
+
name?: string;
|
|
559
|
+
plugins?: PluginConstructor[] | Resource<PluginConstructor>;
|
|
560
|
+
config?: Record<string, any>;
|
|
561
|
+
test?: boolean;
|
|
562
|
+
}
|
|
563
|
+
declare global {
|
|
564
|
+
interface Window {
|
|
565
|
+
__OWL_DEVTOOLS__: {
|
|
566
|
+
apps: Set<App>;
|
|
567
|
+
Fiber: typeof Fiber;
|
|
568
|
+
RootFiber: typeof RootFiber;
|
|
569
|
+
toRaw: typeof toRaw;
|
|
570
|
+
proxy: typeof proxy;
|
|
571
|
+
};
|
|
572
|
+
}
|
|
573
|
+
}
|
|
574
|
+
type MountTarget = HTMLElement | ShadowRoot;
|
|
575
|
+
interface Root<T extends ComponentConstructor> {
|
|
576
|
+
node: ComponentNode;
|
|
577
|
+
promise: Promise<ComponentInstance<T>>;
|
|
578
|
+
mount(target: MountTarget, options?: MountOptions): Promise<ComponentInstance<T>>;
|
|
579
|
+
destroy(): void;
|
|
580
|
+
}
|
|
581
|
+
declare class App extends TemplateSet {
|
|
582
|
+
static validateTarget: typeof validateTarget;
|
|
583
|
+
static apps: Set<App>;
|
|
584
|
+
static version: string;
|
|
585
|
+
name: string;
|
|
586
|
+
scheduler: Scheduler;
|
|
587
|
+
roots: Set<Root<any>>;
|
|
588
|
+
pluginManager: PluginManager;
|
|
589
|
+
constructor(config?: AppConfig);
|
|
590
|
+
createRoot<T extends ComponentConstructor>(Root: T, config?: RootConfig<GetProps<ComponentInstance<T>>>): Root<T>;
|
|
591
|
+
private mountNode;
|
|
592
|
+
destroy(): void;
|
|
593
|
+
handleError(...args: Parameters<typeof handleError>): void;
|
|
594
|
+
}
|
|
595
|
+
declare function mount<T extends ComponentConstructor>(C: T, target: MountTarget, config?: AppConfig & RootConfig<GetProps<ComponentInstance<T>>> & MountOptions): Promise<ComponentInstance<T>>;
|
|
596
|
+
|
|
597
|
+
interface Signal<T> extends ReactiveValue<T> {
|
|
598
|
+
/**
|
|
599
|
+
* Update the value of the signal with a new value. If the new value is different
|
|
600
|
+
* from the previous values, all computations that depends on this signal will
|
|
601
|
+
* be invalidated, and effects will rerun.
|
|
602
|
+
*/
|
|
603
|
+
set(nextValue: T): void;
|
|
604
|
+
}
|
|
605
|
+
interface SignalOptions<T> {
|
|
606
|
+
type?: T;
|
|
607
|
+
}
|
|
608
|
+
declare function invalidateSignal(signal: Signal<any>): void;
|
|
609
|
+
declare function signalArray<T>(initialValue: T[], options?: SignalOptions<T>): Signal<T[]>;
|
|
610
|
+
declare function signalObject<T extends Record<PropertyKey, any>>(initialValue: T, options?: SignalOptions<T>): Signal<T>;
|
|
611
|
+
interface MapSignalOptions<K, V> {
|
|
612
|
+
name?: string;
|
|
613
|
+
keyType?: K;
|
|
614
|
+
valueType?: V;
|
|
615
|
+
}
|
|
616
|
+
declare function signalMap<K, V>(initialValue: Map<K, V>, options?: MapSignalOptions<K, V>): Signal<Map<K, V>>;
|
|
617
|
+
declare function signalSet<T>(initialValue: Set<T>, options?: SignalOptions<T>): Signal<Set<T>>;
|
|
618
|
+
declare function signal<T>(value: T, options?: SignalOptions<T>): Signal<T>;
|
|
619
|
+
declare namespace signal {
|
|
620
|
+
var invalidate: typeof invalidateSignal;
|
|
621
|
+
var Array: typeof signalArray;
|
|
622
|
+
var Map: typeof signalMap;
|
|
623
|
+
var Object: typeof signalObject;
|
|
624
|
+
var Set: typeof signalSet;
|
|
625
|
+
}
|
|
626
|
+
|
|
627
|
+
interface ComputedOptions<TWrite> {
|
|
628
|
+
set?(value: TWrite): void;
|
|
629
|
+
}
|
|
630
|
+
declare function computed<TRead, TWrite = TRead>(getter: () => TRead, options?: ComputedOptions<TWrite>): ReactiveValue<TRead, TWrite>;
|
|
631
|
+
|
|
632
|
+
declare function effect<T>(fn: () => T): () => void;
|
|
633
|
+
|
|
634
|
+
/**
|
|
635
|
+
* This hook will run a callback when a component is mounted and patched, and
|
|
636
|
+
* will run a cleanup function before patching and before unmounting the
|
|
637
|
+
* the component.
|
|
638
|
+
*
|
|
639
|
+
* @template T
|
|
640
|
+
* @param {Effect<T>} effect the effect to run on component mount and/or patch
|
|
641
|
+
* @param {()=>[...T]} [computeDependencies=()=>[NaN]] a callback to compute
|
|
642
|
+
* dependencies that will decide if the effect needs to be cleaned up and
|
|
643
|
+
* run again. If the dependencies did not change, the effect will not run
|
|
644
|
+
* again. The default value returns an array containing only NaN because
|
|
645
|
+
* NaN !== NaN, which will cause the effect to rerun on every patch.
|
|
646
|
+
*/
|
|
647
|
+
declare function useEffect(fn: Parameters<typeof effect>[0]): void;
|
|
648
|
+
/**
|
|
649
|
+
* When a component needs to listen to DOM Events on element(s) that are not
|
|
650
|
+
* part of his hierarchy, we can use the `useListener` hook.
|
|
651
|
+
* It will immediately add the listener, and remove it whenever the plugin or
|
|
652
|
+
* component is destroyed.
|
|
653
|
+
*
|
|
654
|
+
* Example:
|
|
655
|
+
* a menu needs to listen to the click on window to be closed automatically
|
|
656
|
+
*
|
|
657
|
+
* Usage:
|
|
658
|
+
* in the constructor of the OWL component that needs to be notified,
|
|
659
|
+
* `useListener(window, 'click', () => this._doSomething());`
|
|
660
|
+
* */
|
|
661
|
+
declare function useListener(target: EventTarget | Signal<EventTarget | null>, eventName: string, handler: EventListener, eventParams?: AddEventListenerOptions): void;
|
|
662
|
+
declare function useApp(): App;
|
|
663
|
+
|
|
664
|
+
declare function onWillStart(fn: () => Promise<void> | void | any): void;
|
|
665
|
+
declare function onWillUpdateProps(fn: (nextProps: any) => Promise<void> | void | any): void;
|
|
666
|
+
declare function onMounted(fn: () => void | any): void;
|
|
667
|
+
declare function onWillPatch(fn: () => any | void): void;
|
|
668
|
+
declare function onPatched(fn: () => void | any): void;
|
|
669
|
+
declare function onWillUnmount(fn: () => void | any): void;
|
|
670
|
+
declare function onWillDestroy(fn: () => void | any): void;
|
|
671
|
+
type OnErrorCallback = (error: any) => void | any;
|
|
660
672
|
declare function onError(callback: OnErrorCallback): void;
|
|
661
673
|
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
674
|
+
interface ValidationIssue {
|
|
675
|
+
message: string;
|
|
676
|
+
path?: PropertyKey[];
|
|
677
|
+
received?: any;
|
|
678
|
+
[K: string]: any;
|
|
679
|
+
}
|
|
680
|
+
declare function assertType(value: any, validation: any, errorMessage?: string): void;
|
|
681
|
+
declare function validateType(value: any, validation: any): ValidationIssue[];
|
|
682
|
+
|
|
683
|
+
declare class OwlError extends Error {
|
|
684
|
+
cause?: any;
|
|
685
|
+
}
|
|
686
|
+
|
|
687
|
+
type PluginInstance<T extends PluginConstructor> = Omit<InstanceType<T>, "setup">;
|
|
688
|
+
declare function plugin<T extends PluginConstructor>(pluginType: T): PluginInstance<T>;
|
|
689
|
+
declare function config<T = any>(name: string, type?: T): T;
|
|
690
|
+
declare function providePlugins(pluginConstructors: PluginConstructor[] | Resource<PluginConstructor>, config?: Record<string, any>): void;
|
|
691
|
+
|
|
692
|
+
interface CapturedContext {
|
|
693
|
+
run<T = void>(callback: () => T): T;
|
|
694
|
+
protectAsync<P extends any[], R>(callback: (...args: P) => Promise<R>): (...args: P) => Promise<R>;
|
|
695
|
+
runWithAsyncProtection<T>(callback: () => Promise<T>): Promise<T>;
|
|
696
|
+
}
|
|
697
|
+
/**
|
|
698
|
+
* Captures the current context and gives methods to run
|
|
699
|
+
* functions within the captured context.
|
|
700
|
+
*/
|
|
701
|
+
declare function useContext(): CapturedContext;
|
|
702
|
+
|
|
703
|
+
declare const blockDom: {
|
|
704
|
+
config: {
|
|
705
|
+
shouldNormalizeDom: boolean;
|
|
706
|
+
mainEventHandler: (data: any, ev: Event, currentTarget?: EventTarget | null) => boolean;
|
|
707
|
+
};
|
|
708
|
+
mount: typeof mount$1;
|
|
709
|
+
patch: typeof patch;
|
|
710
|
+
remove: typeof remove;
|
|
711
|
+
list: typeof list;
|
|
712
|
+
multi: typeof multi;
|
|
713
|
+
text: typeof text;
|
|
714
|
+
toggler: typeof toggler;
|
|
715
|
+
createBlock: typeof createBlock;
|
|
716
|
+
html: typeof html;
|
|
717
|
+
comment: typeof comment;
|
|
718
|
+
};
|
|
719
|
+
|
|
720
|
+
declare const __info__: {
|
|
721
|
+
version: string;
|
|
685
722
|
};
|
|
686
723
|
|
|
687
|
-
export { App, Component,
|
|
724
|
+
export { App, Component, EventBus, OwlError, Plugin, Registry, Resource, __info__, assertType, batched, blockDom, computed, config, effect, htmlEscape, markRaw, markup, mount, onError, onMounted, onPatched, onWillDestroy, onWillPatch, onWillStart, onWillUnmount, onWillUpdateProps, plugin, props, providePlugins, proxy, signal, status, toRaw, types, untrack, useApp, useContext, useEffect, useListener, useResource, validateType, whenReady, xml };
|
|
725
|
+
export type { CapturedContext, ComponentConstructor, GetProps, PluginConstructor, PluginInstance, ReactiveValue, Signal };
|