@odoo/owl 3.0.0-alpha.4 → 3.0.0-alpha.41
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 +74 -117
- package/dist/owl.cjs +6902 -0
- package/dist/owl.es.js +6840 -6642
- package/dist/owl.iife.js +6864 -6693
- package/dist/owl.iife.min.js +27 -1
- package/dist/types/owl.d.ts +893 -668
- package/package.json +23 -80
- package/dist/compile_templates.mjs +0 -2553
- package/dist/owl-devtools.zip +0 -0
- package/dist/owl.cjs.js +0 -6729
- package/dist/types/common/owl_error.d.ts +0 -3
- package/dist/types/common/types.d.ts +0 -29
- package/dist/types/common/utils.d.ts +0 -8
- package/dist/types/compiler/code_generator.d.ts +0 -152
- package/dist/types/compiler/index.d.ts +0 -13
- package/dist/types/compiler/inline_expressions.d.ts +0 -59
- package/dist/types/compiler/parser.d.ts +0 -178
- package/dist/types/compiler/standalone/index.d.ts +0 -2
- package/dist/types/compiler/standalone/setup_jsdom.d.ts +0 -1
- package/dist/types/index.d.ts +0 -1
- package/dist/types/runtime/app.d.ts +0 -62
- package/dist/types/runtime/blockdom/attributes.d.ts +0 -6
- package/dist/types/runtime/blockdom/block_compiler.d.ts +0 -21
- package/dist/types/runtime/blockdom/config.d.ts +0 -8
- package/dist/types/runtime/blockdom/event_catcher.d.ts +0 -7
- package/dist/types/runtime/blockdom/events.d.ts +0 -8
- package/dist/types/runtime/blockdom/html.d.ts +0 -17
- package/dist/types/runtime/blockdom/index.d.ts +0 -26
- package/dist/types/runtime/blockdom/list.d.ts +0 -18
- package/dist/types/runtime/blockdom/multi.d.ts +0 -17
- package/dist/types/runtime/blockdom/text.d.ts +0 -26
- package/dist/types/runtime/blockdom/toggler.d.ts +0 -17
- package/dist/types/runtime/cancellableContext.d.ts +0 -15
- package/dist/types/runtime/cancellablePromise.d.ts +0 -15
- package/dist/types/runtime/component.d.ts +0 -28
- package/dist/types/runtime/component_node.d.ts +0 -83
- package/dist/types/runtime/error_handling.d.ts +0 -13
- package/dist/types/runtime/event_handling.d.ts +0 -1
- package/dist/types/runtime/executionContext.d.ts +0 -0
- package/dist/types/runtime/fibers.d.ts +0 -37
- package/dist/types/runtime/hooks.d.ts +0 -57
- package/dist/types/runtime/index.d.ts +0 -35
- package/dist/types/runtime/lifecycle_hooks.d.ts +0 -12
- package/dist/types/runtime/listOperation.d.ts +0 -1
- package/dist/types/runtime/plugins.d.ts +0 -39
- package/dist/types/runtime/portal.d.ts +0 -15
- package/dist/types/runtime/reactivity.d.ts +0 -46
- package/dist/types/runtime/registry.d.ts +0 -15
- package/dist/types/runtime/relationalModel/discussModel.d.ts +0 -19
- package/dist/types/runtime/relationalModel/discussModelTypes.d.ts +0 -22
- package/dist/types/runtime/relationalModel/field.d.ts +0 -20
- package/dist/types/runtime/relationalModel/model.d.ts +0 -59
- package/dist/types/runtime/relationalModel/modelData.d.ts +0 -18
- package/dist/types/runtime/relationalModel/modelRegistry.d.ts +0 -3
- package/dist/types/runtime/relationalModel/modelUtils.d.ts +0 -4
- package/dist/types/runtime/relationalModel/store.d.ts +0 -16
- package/dist/types/runtime/relationalModel/types.d.ts +0 -83
- package/dist/types/runtime/relationalModel/util.d.ts +0 -1
- package/dist/types/runtime/relationalModel/web/WebDataPoint.d.ts +0 -25
- package/dist/types/runtime/relationalModel/web/WebRecord.d.ts +0 -131
- package/dist/types/runtime/relationalModel/web/WebStaticList.d.ts +0 -63
- package/dist/types/runtime/relationalModel/web/webModel.d.ts +0 -5
- package/dist/types/runtime/relationalModel/web/webModelTypes.d.ts +0 -139
- package/dist/types/runtime/scheduler.d.ts +0 -21
- package/dist/types/runtime/signals.d.ts +0 -17
- package/dist/types/runtime/status.d.ts +0 -10
- package/dist/types/runtime/task.d.ts +0 -12
- package/dist/types/runtime/template_helpers.d.ts +0 -58
- package/dist/types/runtime/template_set.d.ts +0 -40
- package/dist/types/runtime/utils.d.ts +0 -25
- package/dist/types/runtime/validation.d.ts +0 -36
- package/dist/types/utils/registry.d.ts +0 -15
- package/dist/types/version.d.ts +0 -1
- package/tools/compile_owl_templates.mjs +0 -31
package/dist/types/owl.d.ts
CHANGED
|
@@ -1,687 +1,912 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
1
|
+
export type CustomDirectives = Record<string, (node: Element, value: string, modifier: string[]) => void>;
|
|
2
|
+
export type Template = (context: any, vnode: any, key?: string) => any;
|
|
3
|
+
export type TemplateFunction = (app: any, bdom: any, helpers: any) => Template;
|
|
4
|
+
declare class VToggler {
|
|
5
|
+
key: string;
|
|
6
|
+
child: VNode;
|
|
7
|
+
parentEl?: HTMLElement | undefined;
|
|
8
|
+
constructor(key: string, child: VNode);
|
|
9
|
+
mount(parent: HTMLElement, afterNode: Node | null): void;
|
|
10
|
+
moveBeforeDOMNode(node: Node | null, parent?: HTMLElement): void;
|
|
11
|
+
moveBeforeVNode(other: VToggler | null, afterNode: Node | null): void;
|
|
12
|
+
patch(other: VToggler, withBeforeRemove: boolean): void;
|
|
13
|
+
beforeRemove(): void;
|
|
14
|
+
remove(): void;
|
|
15
|
+
firstNode(): Node | undefined;
|
|
16
|
+
toString(): string;
|
|
17
|
+
}
|
|
15
18
|
declare function toggler(key: string, child: VNode): VNode<VToggler>;
|
|
16
|
-
|
|
17
|
-
declare 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
|
-
*/
|
|
19
|
+
export type BlockType = (data?: any[], children?: VNode[]) => VNode;
|
|
33
20
|
declare function createBlock(str: string): BlockType;
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
}
|
|
21
|
+
declare class VList {
|
|
22
|
+
children: VNode[];
|
|
23
|
+
anchor: Node | undefined;
|
|
24
|
+
parentEl?: HTMLElement | undefined;
|
|
25
|
+
isOnlyChild?: boolean | undefined;
|
|
26
|
+
constructor(children: VNode[]);
|
|
27
|
+
mount(parent: HTMLElement, afterNode: Node | null): void;
|
|
28
|
+
moveBeforeDOMNode(node: Node | null, parent?: HTMLElement | undefined): void;
|
|
29
|
+
moveBeforeVNode(other: VList | null, afterNode: Node | null): void;
|
|
30
|
+
patch(other: VList, withBeforeRemove: boolean): void;
|
|
31
|
+
beforeRemove(): void;
|
|
32
|
+
remove(): void;
|
|
33
|
+
firstNode(): Node | undefined;
|
|
34
|
+
toString(): string;
|
|
35
|
+
}
|
|
50
36
|
declare function list(children: VNode[]): VNode<VList>;
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
}
|
|
37
|
+
declare class VMulti {
|
|
38
|
+
children: (VNode | undefined)[];
|
|
39
|
+
anchors?: Node[] | undefined;
|
|
40
|
+
parentEl?: HTMLElement | undefined;
|
|
41
|
+
isOnlyChild?: boolean | undefined;
|
|
42
|
+
constructor(children: (VNode | undefined)[]);
|
|
43
|
+
mount(parent: HTMLElement, afterNode: Node | null): void;
|
|
44
|
+
moveBeforeDOMNode(node: Node | null, parent?: HTMLElement | undefined): void;
|
|
45
|
+
moveBeforeVNode(other: VMulti | null, afterNode: Node | null): void;
|
|
46
|
+
patch(other: VMulti, withBeforeRemove: boolean): void;
|
|
47
|
+
beforeRemove(): void;
|
|
48
|
+
remove(): void;
|
|
49
|
+
firstNode(): Node | undefined;
|
|
50
|
+
toString(): string;
|
|
51
|
+
}
|
|
67
52
|
declare function multi(children: (VNode | undefined)[]): VNode<VMulti>;
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
}
|
|
82
|
-
declare
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
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
|
-
}
|
|
53
|
+
declare class VText {
|
|
54
|
+
text: string | String;
|
|
55
|
+
parentEl?: HTMLElement | undefined;
|
|
56
|
+
el?: any;
|
|
57
|
+
constructor(text: string | String);
|
|
58
|
+
mount(parent: HTMLElement, afterNode: Node | null): void;
|
|
59
|
+
moveBeforeDOMNode(node: Node | null, parent?: HTMLElement | undefined): void;
|
|
60
|
+
moveBeforeVNode(other: VText | null, afterNode: Node | null): void;
|
|
61
|
+
beforeRemove(): void;
|
|
62
|
+
remove(): void;
|
|
63
|
+
firstNode(): Node;
|
|
64
|
+
patch(other: VText): void;
|
|
65
|
+
toString(): string | String;
|
|
66
|
+
}
|
|
67
|
+
declare function text(str: string | String): VNode<VText>;
|
|
68
|
+
declare class VHtml {
|
|
69
|
+
html: string;
|
|
70
|
+
parentEl?: HTMLElement | undefined;
|
|
71
|
+
content: ChildNode[];
|
|
72
|
+
constructor(html: string);
|
|
73
|
+
mount(parent: HTMLElement, afterNode: Node | null): void;
|
|
74
|
+
moveBeforeDOMNode(node: Node | null, parent?: HTMLElement | undefined): void;
|
|
75
|
+
moveBeforeVNode(other: VHtml | null, afterNode: Node | null): void;
|
|
76
|
+
patch(other: VHtml): void;
|
|
77
|
+
beforeRemove(): void;
|
|
78
|
+
remove(): void;
|
|
79
|
+
firstNode(): Node;
|
|
80
|
+
toString(): string;
|
|
81
|
+
}
|
|
107
82
|
declare function html(str: string): VNode<VHtml>;
|
|
108
|
-
|
|
109
|
-
interface VNode<T = any> {
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
declare function mount
|
|
124
|
-
declare function patch(vnode1: VNode, vnode2: VNode, withBeforeRemove?: boolean): void;
|
|
83
|
+
export type MountTarget = HTMLElement | ShadowRoot;
|
|
84
|
+
export interface VNode<T = any> {
|
|
85
|
+
mount(parent: MountTarget, afterNode: Node | null): void;
|
|
86
|
+
moveBeforeDOMNode(node: Node | null, parent?: MountTarget): void;
|
|
87
|
+
moveBeforeVNode(other: T | null, afterNode: Node | null): void;
|
|
88
|
+
patch(other: T, withBeforeRemove: boolean): void;
|
|
89
|
+
beforeRemove(): void;
|
|
90
|
+
remove(): void;
|
|
91
|
+
firstNode(): Node | undefined;
|
|
92
|
+
el?: undefined | HTMLElement | Text;
|
|
93
|
+
parentEl?: undefined | HTMLElement;
|
|
94
|
+
isOnlyChild?: boolean | undefined;
|
|
95
|
+
key?: any;
|
|
96
|
+
}
|
|
97
|
+
export type BDom = VNode<any>;
|
|
98
|
+
declare function mount(vnode: VNode, fixture: MountTarget, afterNode?: Node | null): void;
|
|
99
|
+
declare function patch(vnode1: VNode, vnode2: VNode, withBeforeRemove?: boolean): void;
|
|
125
100
|
declare function remove(vnode: VNode, withBeforeRemove?: boolean): void;
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
new (...args: any[]): any;
|
|
129
|
-
} | true | "*";
|
|
130
|
-
interface TypeInfo {
|
|
131
|
-
type?: TypeDescription;
|
|
132
|
-
optional?: boolean;
|
|
133
|
-
validate?: Function;
|
|
134
|
-
shape?: Schema;
|
|
135
|
-
element?: TypeDescription;
|
|
136
|
-
values?: TypeDescription;
|
|
137
|
-
}
|
|
138
|
-
declare type ValueType = {
|
|
139
|
-
value: any;
|
|
140
|
-
};
|
|
141
|
-
declare type TypeDescription = BaseType | TypeInfo | ValueType | TypeDescription[];
|
|
142
|
-
declare type SimplifiedSchema = string[];
|
|
143
|
-
declare type NormalizedSchema = {
|
|
144
|
-
[key: string]: TypeDescription;
|
|
145
|
-
};
|
|
146
|
-
declare type Schema = SimplifiedSchema | NormalizedSchema;
|
|
147
|
-
/**
|
|
148
|
-
* Main validate function
|
|
149
|
-
*/
|
|
150
|
-
declare function validate(obj: {
|
|
151
|
-
[key: string]: any;
|
|
152
|
-
}, spec: Schema): void;
|
|
153
|
-
declare function validateType(key: string, value: any, descr: TypeDescription): string | null;
|
|
154
|
-
|
|
155
|
-
declare type Fn<T> = () => T;
|
|
156
|
-
declare class Registry<T> {
|
|
157
|
-
_map: {
|
|
158
|
-
[key: string]: [number, T];
|
|
159
|
-
};
|
|
160
|
-
_name: string;
|
|
161
|
-
_type?: TypeDescription;
|
|
162
|
-
items: Fn<T[]>;
|
|
163
|
-
entries: Fn<[string, T][]>;
|
|
164
|
-
constructor(name?: string, type?: TypeDescription);
|
|
165
|
-
set(key: string, value: T, sequence?: number): void;
|
|
166
|
-
get(key: string, defaultValue?: T): T;
|
|
101
|
+
export declare class OwlError extends Error {
|
|
102
|
+
cause?: any;
|
|
167
103
|
}
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
104
|
+
declare const STATUS: {
|
|
105
|
+
readonly NEW: 0;
|
|
106
|
+
readonly MOUNTED: 1;
|
|
107
|
+
readonly CANCELLED: 2;
|
|
108
|
+
readonly DESTROYED: 3;
|
|
109
|
+
};
|
|
110
|
+
export type StatusValue = (typeof STATUS)[keyof typeof STATUS];
|
|
111
|
+
export type Callback = (...args: any[]) => void;
|
|
112
|
+
/**
|
|
113
|
+
* Creates a batched version of a callback so that all calls to it in the same
|
|
114
|
+
* microtick will only call the original callback once.
|
|
115
|
+
*
|
|
116
|
+
* @param callback the callback to batch
|
|
117
|
+
* @returns a batched version of the original callback
|
|
118
|
+
*/
|
|
119
|
+
export declare function batched(callback: Callback): Callback;
|
|
120
|
+
export interface ReactiveValue<TRead, TWrite = TRead> {
|
|
121
|
+
(): TRead;
|
|
122
|
+
/**
|
|
123
|
+
* Update the value of the reactive with a new value. If the new value is different
|
|
124
|
+
* from the previous values, all computations that depends on this reactive will
|
|
125
|
+
* be invalidated, and effects will rerun.
|
|
126
|
+
*/
|
|
127
|
+
set(nextValue: TWrite): void;
|
|
192
128
|
}
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
root: RootFiber | null;
|
|
198
|
-
parent: Fiber | null;
|
|
199
|
-
children: Fiber[];
|
|
200
|
-
appliedToDom: boolean;
|
|
201
|
-
deep: boolean;
|
|
202
|
-
childrenMap: ComponentNode["children"];
|
|
203
|
-
constructor(node: ComponentNode, parent: Fiber | null);
|
|
204
|
-
render(): void;
|
|
205
|
-
_render(): void;
|
|
206
|
-
}
|
|
207
|
-
declare class RootFiber extends Fiber {
|
|
208
|
-
counter: number;
|
|
209
|
-
willPatch: Fiber[];
|
|
210
|
-
patched: Fiber[];
|
|
211
|
-
mounted: Fiber[];
|
|
212
|
-
locked: boolean;
|
|
213
|
-
complete(): void;
|
|
214
|
-
setCounter(newValue: number): void;
|
|
215
|
-
}
|
|
216
|
-
declare type Position = "first-child" | "last-child";
|
|
217
|
-
interface MountOptions {
|
|
218
|
-
position?: Position;
|
|
219
|
-
}
|
|
220
|
-
declare class MountFiber extends RootFiber {
|
|
221
|
-
target: HTMLElement;
|
|
222
|
-
position: Position;
|
|
223
|
-
constructor(node: ComponentNode, target: HTMLElement, options?: MountOptions);
|
|
224
|
-
complete(): void;
|
|
129
|
+
declare enum ComputationState {
|
|
130
|
+
EXECUTED = 0,
|
|
131
|
+
STALE = 1,
|
|
132
|
+
PENDING = 2
|
|
225
133
|
}
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
id: string;
|
|
230
|
-
dependencies: string[];
|
|
231
|
-
}
|
|
232
|
-
interface PluginMetaData {
|
|
233
|
-
isDestroyed: boolean;
|
|
234
|
-
}
|
|
235
|
-
declare class Plugin<Deps = {
|
|
236
|
-
[name: string]: Plugin;
|
|
237
|
-
}> {
|
|
238
|
-
static id: string;
|
|
239
|
-
static dependencies: string[];
|
|
240
|
-
readonly plugins: Deps;
|
|
241
|
-
static resources: {};
|
|
242
|
-
resources: {
|
|
243
|
-
[name: string]: any;
|
|
244
|
-
};
|
|
245
|
-
__meta__: PluginMetaData;
|
|
246
|
-
setup(): void;
|
|
247
|
-
destroy(): void;
|
|
248
|
-
get isDestroyed(): boolean;
|
|
249
|
-
}
|
|
250
|
-
declare class PluginManager {
|
|
251
|
-
_parent: PluginManager | null;
|
|
252
|
-
_children: PluginManager[];
|
|
253
|
-
plugins: {
|
|
254
|
-
[id: string]: Plugin;
|
|
255
|
-
};
|
|
256
|
-
resources: {
|
|
257
|
-
[id: string]: any;
|
|
258
|
-
};
|
|
259
|
-
constructor(parent: PluginManager | null, Plugins: PluginCtor[] | (() => PluginCtor[]));
|
|
260
|
-
destroy(): void;
|
|
261
|
-
getPlugin(name: string): Plugin | null;
|
|
262
|
-
getResource(name: string): any[];
|
|
263
|
-
}
|
|
264
|
-
declare function usePlugins(Plugins: PluginCtor[]): void;
|
|
265
|
-
|
|
266
|
-
declare const enum STATUS {
|
|
267
|
-
NEW = 0,
|
|
268
|
-
MOUNTED = 1,
|
|
269
|
-
CANCELLED = 2,
|
|
270
|
-
DESTROYED = 3
|
|
271
|
-
}
|
|
272
|
-
declare type STATUS_DESCR = "new" | "mounted" | "cancelled" | "destroyed";
|
|
273
|
-
declare function status(component: Component): STATUS_DESCR;
|
|
274
|
-
|
|
275
|
-
declare function useComponent(): Component;
|
|
276
|
-
/**
|
|
277
|
-
* Creates a reactive object that will be observed by the current component.
|
|
278
|
-
* Reading data from the returned object (eg during rendering) will cause the
|
|
279
|
-
* component to subscribe to that data and be rerendered when it changes.
|
|
280
|
-
*
|
|
281
|
-
* @param state the state to observe
|
|
282
|
-
* @returns a reactive object that will cause the component to re-render on
|
|
283
|
-
* relevant changes
|
|
284
|
-
* @see reactive
|
|
285
|
-
*/
|
|
286
|
-
declare function useState<T extends object>(state: T): T;
|
|
287
|
-
declare type LifecycleHook = Function;
|
|
288
|
-
declare class ComponentNode<P extends Props = any, Plugins = any, E = any> implements VNode<ComponentNode<P, E>> {
|
|
289
|
-
el?: HTMLElement | Text | undefined;
|
|
290
|
-
app: App;
|
|
291
|
-
fiber: Fiber | null;
|
|
292
|
-
component: Component<P, Plugins, E>;
|
|
293
|
-
bdom: BDom | null;
|
|
294
|
-
status: STATUS;
|
|
295
|
-
forceNextRender: boolean;
|
|
296
|
-
parentKey: string | null;
|
|
297
|
-
props: P;
|
|
298
|
-
nextProps: P | null;
|
|
299
|
-
renderFn: Function;
|
|
300
|
-
parent: ComponentNode | null;
|
|
301
|
-
childEnv: Env;
|
|
302
|
-
children: {
|
|
303
|
-
[key: string]: ComponentNode;
|
|
304
|
-
};
|
|
305
|
-
refs: any;
|
|
306
|
-
willStart: LifecycleHook[];
|
|
307
|
-
willUpdateProps: LifecycleHook[];
|
|
308
|
-
willUnmount: LifecycleHook[];
|
|
309
|
-
mounted: LifecycleHook[];
|
|
310
|
-
willPatch: LifecycleHook[];
|
|
311
|
-
patched: LifecycleHook[];
|
|
312
|
-
willDestroy: LifecycleHook[];
|
|
313
|
-
signalComputation: Computation;
|
|
314
|
-
pluginManager: PluginManager;
|
|
315
|
-
constructor(C: ComponentConstructor<P, Plugins, E>, props: P, app: App, parent: ComponentNode | null, parentKey: string | null);
|
|
316
|
-
mountComponent(target: any, options?: MountOptions): void;
|
|
317
|
-
initiateRender(fiber: Fiber | MountFiber): Promise<void>;
|
|
318
|
-
render(deep: boolean): Promise<void>;
|
|
319
|
-
cancel(): void;
|
|
320
|
-
_cancel(): void;
|
|
321
|
-
destroy(): void;
|
|
322
|
-
_destroy(): void;
|
|
323
|
-
updateAndRender(props: P, parentFiber: Fiber): Promise<void>;
|
|
324
|
-
/**
|
|
325
|
-
* Finds a child that has dom that is not yet updated, and update it. This
|
|
326
|
-
* method is meant to be used only in the context of repatching the dom after
|
|
327
|
-
* a mounted hook failed and was handled.
|
|
328
|
-
*/
|
|
329
|
-
updateDom(): void;
|
|
330
|
-
/**
|
|
331
|
-
* Sets a ref to a given HTMLElement.
|
|
332
|
-
*
|
|
333
|
-
* @param name the name of the ref to set
|
|
334
|
-
* @param el the HTMLElement to set the ref to. The ref is not set if the el
|
|
335
|
-
* is null, but useRef will not return elements that are not in the DOM
|
|
336
|
-
*/
|
|
337
|
-
setRef(name: string, el: HTMLElement | null): void;
|
|
338
|
-
firstNode(): Node | undefined;
|
|
339
|
-
mount(parent: HTMLElement, anchor: ChildNode): void;
|
|
340
|
-
moveBeforeDOMNode(node: Node | null, parent?: HTMLElement): void;
|
|
341
|
-
moveBeforeVNode(other: ComponentNode<P, E> | null, afterNode: Node | null): void;
|
|
342
|
-
patch(): void;
|
|
343
|
-
_patch(): void;
|
|
344
|
-
beforeRemove(): void;
|
|
345
|
-
remove(): void;
|
|
346
|
-
get name(): string;
|
|
134
|
+
export interface Atom<T = any> {
|
|
135
|
+
observers: Set<ComputationAtom>;
|
|
136
|
+
value: T;
|
|
347
137
|
}
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
template: string;
|
|
354
|
-
defaultProps?: any;
|
|
355
|
-
props?: Schema;
|
|
356
|
-
components?: {
|
|
357
|
-
[componentName: string]: ComponentConstructor;
|
|
358
|
-
};
|
|
359
|
-
}
|
|
360
|
-
declare type ComponentConstructor<P extends Props = any, Plugins = any, E = any> = (new (props: P, env: E, plugins: Plugins, node: ComponentNode) => Component<P, Plugins, E>) & StaticComponentProperties;
|
|
361
|
-
declare class Component<Props = any, Plugins = PluginManager["plugins"], Env = any> {
|
|
362
|
-
static template: string;
|
|
363
|
-
static props?: Schema;
|
|
364
|
-
static defaultProps?: any;
|
|
365
|
-
props: Props;
|
|
366
|
-
env: Env;
|
|
367
|
-
plugins: Plugins;
|
|
368
|
-
__owl__: ComponentNode;
|
|
369
|
-
constructor(props: Props, env: Env, plugins: Plugins, node: ComponentNode);
|
|
370
|
-
setup(): void;
|
|
371
|
-
render(deep?: boolean): void;
|
|
138
|
+
export interface ComputationAtom<T = any> extends Atom<T> {
|
|
139
|
+
compute: () => T;
|
|
140
|
+
isDerived: boolean;
|
|
141
|
+
sources: Set<Atom>;
|
|
142
|
+
state: ComputationState;
|
|
372
143
|
}
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
}
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
}
|
|
381
|
-
declare
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
144
|
+
export declare function untrack<T>(fn: (...args: any[]) => T): T;
|
|
145
|
+
export type Constructor<T = any> = {
|
|
146
|
+
new (...args: any[]): T;
|
|
147
|
+
};
|
|
148
|
+
export declare const hasDefault: unique symbol;
|
|
149
|
+
export type WithDefault<T> = T & {
|
|
150
|
+
[hasDefault]: T;
|
|
151
|
+
};
|
|
152
|
+
export declare const isOptional: unique symbol;
|
|
153
|
+
export type Optional<T> = T & {
|
|
154
|
+
[isOptional]: T;
|
|
155
|
+
};
|
|
156
|
+
export declare const typeBrand: unique symbol;
|
|
157
|
+
export type Type<T> = T & {
|
|
158
|
+
[typeBrand]: T;
|
|
159
|
+
/**
|
|
160
|
+
* Marks the type as optional: `undefined` passes validation, and an object
|
|
161
|
+
* key with an optional type may be omitted.
|
|
162
|
+
*/
|
|
163
|
+
optional(): Optional<T>;
|
|
164
|
+
/**
|
|
165
|
+
* Marks the type as optional, with a default value to fill it: the reader
|
|
166
|
+
* of the value always gets one (the default replaces an omitted value). The
|
|
167
|
+
* default can be given as a factory (`() => value`), which is called once
|
|
168
|
+
* per consumer, so mutable defaults ([], {}) are not shared. A default for
|
|
169
|
+
* a function type must use the factory form.
|
|
170
|
+
*/
|
|
171
|
+
optional(value: T extends Function ? () => T : T | (() => T)): WithDefault<T>;
|
|
172
|
+
type: T;
|
|
173
|
+
};
|
|
174
|
+
export type IsAny<T> = 0 extends 1 & T ? true : false;
|
|
175
|
+
export type HasDefault<T> = IsAny<T> extends true ? false : T extends {
|
|
176
|
+
[hasDefault]: any;
|
|
177
|
+
} ? true : false;
|
|
178
|
+
export type IsOptional<T> = IsAny<T> extends true ? false : T extends {
|
|
179
|
+
[isOptional]: any;
|
|
180
|
+
} ? true : false;
|
|
181
|
+
export type StripDefault<T> = T extends {
|
|
182
|
+
[hasDefault]: infer U;
|
|
183
|
+
} ? U : T;
|
|
184
|
+
export type StripOptional<T> = T extends {
|
|
185
|
+
[isOptional]: infer U;
|
|
186
|
+
} ? U | undefined : T;
|
|
187
|
+
export type StripType<T> = T extends {
|
|
188
|
+
[typeBrand]: infer U;
|
|
189
|
+
} ? U : T;
|
|
190
|
+
export type StripBrands<T> = StripType<StripDefault<StripOptional<T>>>;
|
|
191
|
+
export type StripBrandsAll<T extends any[]> = {
|
|
192
|
+
[K in keyof T]: StripBrands<T[K]>;
|
|
193
|
+
};
|
|
194
|
+
export type GetDefaultedKeys<T> = keyof T extends infer K ? K extends keyof T ? HasDefault<T[K]> extends true ? K : never : never : never;
|
|
195
|
+
export type GetOptionalEntries<T> = {
|
|
196
|
+
[K in keyof T as IsOptional<T[K]> extends true ? K : HasDefault<T[K]> extends true ? K : never]?: StripBrands<T[K]>;
|
|
197
|
+
};
|
|
198
|
+
export type GetRequiredEntries<T> = {
|
|
199
|
+
[K in keyof T as IsOptional<T[K]> extends true ? never : HasDefault<T[K]> extends true ? never : K]: StripBrands<T[K]>;
|
|
200
|
+
};
|
|
201
|
+
export type PrettifyShape<T> = T extends Function ? T : {
|
|
202
|
+
[K in keyof T]: T[K];
|
|
203
|
+
};
|
|
204
|
+
export type ResolveOptionalEntries<T> = PrettifyShape<GetRequiredEntries<T> & GetOptionalEntries<T>>;
|
|
205
|
+
export type ResolveReaderObjectType<T> = PrettifyShape<{
|
|
206
|
+
[K in keyof T as IsOptional<T[K]> extends true ? never : K]: StripBrands<T[K]>;
|
|
207
|
+
} & {
|
|
208
|
+
[K in keyof T as IsOptional<T[K]> extends true ? K : never]?: StripBrands<T[K]>;
|
|
209
|
+
}>;
|
|
210
|
+
export type KeyedObject<K extends string[]> = {
|
|
211
|
+
[P in K[number]]: any;
|
|
212
|
+
};
|
|
213
|
+
export type ResolveShapedObject<T extends {}> = PrettifyShape<ResolveOptionalEntries<T>>;
|
|
214
|
+
export type ResolveObjectType<T extends {}> = ResolveShapedObject<T extends string[] ? KeyedObject<T> : T>;
|
|
215
|
+
export type UnionToIntersection<U> = (U extends any ? (_: U) => any : never) extends (_: infer I) => void ? I : never;
|
|
216
|
+
/**
|
|
217
|
+
* Returns the default value factory attached to a type by `.optional(value)`,
|
|
218
|
+
* if any. This is how consumers (props, config, ...) resolve defaults at
|
|
219
|
+
* runtime: validation only runs in dev mode, so defaults are metadata on the
|
|
220
|
+
* schema, not a validation side-effect.
|
|
221
|
+
*/
|
|
222
|
+
export declare function getDefault(type: any): (() => any) | undefined;
|
|
223
|
+
/**
|
|
224
|
+
* Returns `value` with defaults from the schema filled in, at any depth: a
|
|
225
|
+
* default fires when the value at its schema position is `undefined`. The
|
|
226
|
+
* input is never mutated; objects are copied along the changed paths only, so
|
|
227
|
+
* if nothing is filled in, `value` is returned as is.
|
|
228
|
+
*
|
|
229
|
+
* Note that this only recurses through object shapes, tuples and arrays
|
|
230
|
+
* (unions are ambiguous, records have no fixed keys).
|
|
231
|
+
*/
|
|
232
|
+
export declare function applyDefaults<T>(value: unknown, type: T): StripBrands<T>;
|
|
233
|
+
declare function anyType(): Type<any>;
|
|
234
|
+
declare function booleanType(): Type<boolean>;
|
|
235
|
+
declare function numberType<T extends number = number>(): Type<T>;
|
|
236
|
+
declare function stringType<T extends string = string>(): Type<T>;
|
|
237
|
+
declare function arrayType(): Type<any[]>;
|
|
238
|
+
declare function arrayType<T>(): Type<T[]>;
|
|
239
|
+
declare function arrayType<T>(elementType: T): Type<StripBrands<T>[]>;
|
|
240
|
+
declare function constructorType<T extends Constructor>(constructor: T): Type<T>;
|
|
241
|
+
declare function customValidator<T>(type: T, validator: (value: StripBrands<T>) => boolean, errorMessage?: string): Type<StripBrands<T>>;
|
|
242
|
+
declare function functionType(): Type<(...parameters: any[]) => any>;
|
|
243
|
+
declare function functionType<const P extends unknown[]>(parameters: P): Type<(...parameters: StripBrandsAll<P>) => void>;
|
|
244
|
+
declare function functionType<const P extends unknown[], R>(): Type<(...parameters: P) => R>;
|
|
245
|
+
declare function functionType<const P extends unknown[], R>(parameters: P, result: R): Type<(...parameters: StripBrandsAll<P>) => StripBrands<R>>;
|
|
246
|
+
declare function instanceType<T extends Constructor>(constructor: T): Type<InstanceType<T>>;
|
|
247
|
+
declare function intersection<T extends any[]>(types: T): Type<UnionToIntersection<StripBrands<T[number]>>>;
|
|
248
|
+
export type LiteralTypes = number | string | boolean | null | undefined;
|
|
249
|
+
declare function literalType<const T extends LiteralTypes>(literal: T): Type<T>;
|
|
250
|
+
declare function literalSelection<const T extends LiteralTypes>(literals: T[]): Type<T>;
|
|
251
|
+
declare function objectType(): Type<Record<string, any>>;
|
|
252
|
+
declare function objectType<const Keys extends string[]>(keys: Keys): Type<ResolveOptionalEntries<KeyedObject<Keys>>>;
|
|
253
|
+
declare function objectType<Shape extends {}>(): Type<ResolveOptionalEntries<Shape>>;
|
|
254
|
+
declare function objectType<Shape extends {}>(shape: Shape): Type<ResolveOptionalEntries<Shape>>;
|
|
255
|
+
declare function strictObjectType<const Keys extends string[]>(keys: Keys): Type<ResolveOptionalEntries<KeyedObject<Keys>>>;
|
|
256
|
+
declare function strictObjectType<Shape extends {}>(shape: Shape): Type<ResolveOptionalEntries<Shape>>;
|
|
257
|
+
declare function promiseType(): Type<Promise<void>>;
|
|
258
|
+
declare function promiseType<T>(type: T): Type<Promise<StripBrands<T>>>;
|
|
259
|
+
declare function recordType(): Type<Record<PropertyKey, any>>;
|
|
260
|
+
declare function recordType<V>(valueType: V): Type<Record<PropertyKey, StripBrands<V>>>;
|
|
261
|
+
declare function tuple<const T extends unknown[]>(types: T): Type<StripBrandsAll<T>>;
|
|
262
|
+
declare function union<T extends unknown[]>(types: T): Type<StripBrands<T[number]>>;
|
|
263
|
+
declare function reactiveValueType(): Type<ReactiveValue<any>>;
|
|
264
|
+
declare function reactiveValueType<T>(): Type<ReactiveValue<T>>;
|
|
265
|
+
declare function reactiveValueType<T>(type: T): Type<ReactiveValue<StripBrands<T>>>;
|
|
266
|
+
declare function ref(): Type<HTMLElement | null>;
|
|
267
|
+
declare function ref<T extends Constructor<HTMLElement>>(type: T): Type<InstanceType<T> | null>;
|
|
268
|
+
declare const types: {
|
|
269
|
+
and: typeof intersection;
|
|
270
|
+
any: typeof anyType;
|
|
271
|
+
array: typeof arrayType;
|
|
272
|
+
boolean: typeof booleanType;
|
|
273
|
+
constructor: typeof constructorType;
|
|
274
|
+
customValidator: typeof customValidator;
|
|
275
|
+
function: typeof functionType;
|
|
276
|
+
instanceOf: typeof instanceType;
|
|
277
|
+
literal: typeof literalType;
|
|
278
|
+
number: typeof numberType;
|
|
279
|
+
object: typeof objectType;
|
|
280
|
+
or: typeof union;
|
|
281
|
+
promise: typeof promiseType;
|
|
282
|
+
record: typeof recordType;
|
|
283
|
+
ref: typeof ref;
|
|
284
|
+
selection: typeof literalSelection;
|
|
285
|
+
signal: typeof reactiveValueType;
|
|
286
|
+
strictObject: typeof strictObjectType;
|
|
287
|
+
string: typeof stringType;
|
|
288
|
+
tuple: typeof tuple;
|
|
289
|
+
};
|
|
290
|
+
export interface ResourceOptions<T> {
|
|
291
|
+
name?: string;
|
|
292
|
+
validation?: T;
|
|
401
293
|
}
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
translateFn?: (s: string, translationCtx: string) => string;
|
|
405
|
-
translatableAttributes?: string[];
|
|
406
|
-
dev?: boolean;
|
|
294
|
+
export interface ResourceAddOptions {
|
|
295
|
+
sequence?: number;
|
|
407
296
|
}
|
|
408
|
-
|
|
409
|
-
declare
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
static template: string;
|
|
420
|
-
static props: {
|
|
421
|
-
readonly target: {
|
|
422
|
-
readonly type: StringConstructor;
|
|
423
|
-
};
|
|
424
|
-
readonly slots: true;
|
|
425
|
-
};
|
|
426
|
-
setup(): void;
|
|
297
|
+
export type Item<T> = StripBrands<T>;
|
|
298
|
+
export declare class Resource<T> {
|
|
299
|
+
private _items;
|
|
300
|
+
private _name?;
|
|
301
|
+
private _validation?;
|
|
302
|
+
constructor(options?: ResourceOptions<T>);
|
|
303
|
+
items: ReactiveValue<Item<T>[]>;
|
|
304
|
+
add(item: Item<T>, options?: ResourceAddOptions): Resource<T>;
|
|
305
|
+
delete(item: Item<T>): Resource<T>;
|
|
306
|
+
has(item: Item<T>): boolean;
|
|
307
|
+
use(item: Item<T>, options?: ResourceAddOptions): Resource<T>;
|
|
427
308
|
}
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
translateFn?: (s: string, translationCtx: string) => string;
|
|
433
|
-
templates?: string | Document | Record<string, string>;
|
|
434
|
-
getTemplate?: (s: string) => Element | Function | string | void;
|
|
435
|
-
customDirectives?: customDirectives;
|
|
436
|
-
globalValues?: object;
|
|
437
|
-
}
|
|
438
|
-
declare class TemplateSet {
|
|
439
|
-
static registerTemplate(name: string, fn: TemplateFunction): void;
|
|
440
|
-
dev: boolean;
|
|
441
|
-
rawTemplates: typeof globalTemplates;
|
|
442
|
-
templates: {
|
|
443
|
-
[name: string]: Template;
|
|
444
|
-
};
|
|
445
|
-
getRawTemplate?: (s: string) => Element | Function | string | void;
|
|
446
|
-
translateFn?: (s: string, translationCtx: string) => string;
|
|
447
|
-
translatableAttributes?: string[];
|
|
448
|
-
Portal: typeof Portal;
|
|
449
|
-
customDirectives: customDirectives;
|
|
450
|
-
runtimeUtils: object;
|
|
451
|
-
hasGlobalValues: boolean;
|
|
452
|
-
constructor(config?: TemplateSetConfig);
|
|
453
|
-
addTemplate(name: string, template: string | Element): void;
|
|
454
|
-
addTemplates(xml: string | Document): void;
|
|
455
|
-
getTemplate(name: string): Template;
|
|
456
|
-
_compileTemplate(name: string, template: string | Element): ReturnType<typeof compile>;
|
|
457
|
-
callTemplate(owner: any, subTemplate: string, ctx: any, parent: any, key: any): any;
|
|
458
|
-
}
|
|
459
|
-
declare const globalTemplates: {
|
|
460
|
-
[key: string]: string | Element | TemplateFunction;
|
|
461
|
-
};
|
|
462
|
-
declare function xml(...args: Parameters<typeof String.raw>): string;
|
|
463
|
-
declare namespace xml {
|
|
464
|
-
var nextId: number;
|
|
309
|
+
export interface PluginConstructor {
|
|
310
|
+
new (...args: any[]): Plugin$1;
|
|
311
|
+
id: string;
|
|
312
|
+
sequence: number;
|
|
465
313
|
}
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
*
|
|
493
|
-
*
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
declare
|
|
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
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
declare function
|
|
612
|
-
declare function
|
|
613
|
-
declare
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
314
|
+
declare class Plugin$1 {
|
|
315
|
+
private static _shadowId;
|
|
316
|
+
static get id(): string;
|
|
317
|
+
static set id(shadowId: string);
|
|
318
|
+
static sequence: number;
|
|
319
|
+
__owl__: PluginManager;
|
|
320
|
+
constructor(manager: PluginManager);
|
|
321
|
+
setup(): void;
|
|
322
|
+
}
|
|
323
|
+
export interface PluginManagerOptions {
|
|
324
|
+
parent?: PluginManager | null;
|
|
325
|
+
config?: Record<string, any>;
|
|
326
|
+
}
|
|
327
|
+
declare class PluginManager extends Scope {
|
|
328
|
+
config: Record<string, any>;
|
|
329
|
+
plugins: Record<string, Plugin$1>;
|
|
330
|
+
ready: Promise<void>;
|
|
331
|
+
private hasPendingReady;
|
|
332
|
+
constructor(app: any, options?: PluginManagerOptions);
|
|
333
|
+
destroy(): void;
|
|
334
|
+
getPluginById<T extends Plugin$1>(id: string): T | null;
|
|
335
|
+
getPlugin<T extends PluginConstructor>(pluginConstructor: T): InstanceType<T> | null;
|
|
336
|
+
startPlugin<T extends PluginConstructor>(pluginConstructor: T): InstanceType<T> | null;
|
|
337
|
+
startPlugins(pluginConstructors: PluginConstructor[]): void;
|
|
338
|
+
}
|
|
339
|
+
/**
|
|
340
|
+
* Returns the active scope. Throws if no scope is active — use this inside
|
|
341
|
+
* hooks and setup functions where the caller is expected to be in a scope.
|
|
342
|
+
*/
|
|
343
|
+
export declare function useScope(): Scope;
|
|
344
|
+
export declare abstract class Scope {
|
|
345
|
+
app: any;
|
|
346
|
+
pluginManager: PluginManager;
|
|
347
|
+
status: StatusValue;
|
|
348
|
+
computations: ComputationAtom[];
|
|
349
|
+
willStart: Array<() => any>;
|
|
350
|
+
private _controller;
|
|
351
|
+
private _destroyCbs;
|
|
352
|
+
constructor(app: any);
|
|
353
|
+
/**
|
|
354
|
+
* Pushes this scope on the stack for the duration of `callback`. Any code
|
|
355
|
+
* executed inside `callback` can reach this scope via `useScope()`.
|
|
356
|
+
*/
|
|
357
|
+
run<T>(callback: () => T): T;
|
|
358
|
+
/**
|
|
359
|
+
* An AbortSignal tied to this scope's lifetime. If the scope is already
|
|
360
|
+
* dead, returns a pre-aborted signal. Lazily allocates an AbortController
|
|
361
|
+
* on first access.
|
|
362
|
+
*/
|
|
363
|
+
get abortSignal(): AbortSignal;
|
|
364
|
+
/**
|
|
365
|
+
* Awaits `p`, throwing an AbortError if the scope is dead before or after
|
|
366
|
+
* the await. Unlike `until(signal, p)`, this does not allocate an
|
|
367
|
+
* AbortController — status checks are sufficient for guarding between
|
|
368
|
+
* awaits.
|
|
369
|
+
*/
|
|
370
|
+
until<T>(p: Promise<T>): Promise<T>;
|
|
371
|
+
/**
|
|
372
|
+
* Registers a callback to run when the scope is destroyed. If the scope is
|
|
373
|
+
* already destroyed, the callback is invoked immediately.
|
|
374
|
+
*/
|
|
375
|
+
onDestroy(cb: () => void): void;
|
|
376
|
+
/**
|
|
377
|
+
* Marks the scope as cancelled and aborts its signal. Used when an entity is
|
|
378
|
+
* abandoned before it reaches the MOUNTED state. Subclasses may override to
|
|
379
|
+
* extend the behavior (e.g. ComponentNode recurses to children).
|
|
380
|
+
*/
|
|
381
|
+
cancel(): void;
|
|
382
|
+
/**
|
|
383
|
+
* Aborts the scope's signal, runs all registered onDestroy callbacks in
|
|
384
|
+
* reverse registration order, disposes any computations attached to this
|
|
385
|
+
* scope, and transitions status to DESTROYED. Callbacks run *before* the
|
|
386
|
+
* status transition so they can still observe the pre-destroyed state
|
|
387
|
+
* (matching the prior onWillDestroy contract). Errors in callbacks are
|
|
388
|
+
* routed to `reportError`.
|
|
389
|
+
*/
|
|
390
|
+
finalize(reportError: (e: unknown) => void): void;
|
|
391
|
+
/**
|
|
392
|
+
* Wrapper applied to lifecycle callbacks before they are stored. The base
|
|
393
|
+
* implementation prepends the scope as the first argument, so every
|
|
394
|
+
* lifecycle callback receives the scope it was registered in.
|
|
395
|
+
* ComponentNode overrides to additionally bind `this` to the component and,
|
|
396
|
+
* in dev mode, to rename the bound function so the hook shows up as
|
|
397
|
+
* `ComponentName.hookName` in stack traces.
|
|
398
|
+
*/
|
|
399
|
+
decorate(fn: Function, _hookName: string): Function;
|
|
400
|
+
}
|
|
401
|
+
/**
|
|
402
|
+
* Returns the scope currently active on the stack, or null if none. Prefer
|
|
403
|
+
* `useScope()` in hook-like code that expects to be called inside a scope;
|
|
404
|
+
* reach for `getScope()` only when the absence of a scope is meaningful.
|
|
405
|
+
*/
|
|
406
|
+
export declare function getScope(): Scope | null;
|
|
407
|
+
export type Target = object;
|
|
408
|
+
export type Reactive<T extends Target> = T;
|
|
409
|
+
/**
|
|
410
|
+
* Mark an object or array so that it is ignored by the reactivity system
|
|
411
|
+
*
|
|
412
|
+
* @param value the value to mark
|
|
413
|
+
* @returns the object itself
|
|
414
|
+
*/
|
|
415
|
+
export declare function markRaw<T extends Target>(value: T): T;
|
|
416
|
+
/**
|
|
417
|
+
* Given a proxy objet, return the raw (non proxy) underlying object
|
|
418
|
+
*
|
|
419
|
+
* @param value a proxy value
|
|
420
|
+
* @returns the underlying value
|
|
421
|
+
*/
|
|
422
|
+
export declare function toRaw<T extends Target, U extends Reactive<T>>(value: U | T): T;
|
|
423
|
+
/**
|
|
424
|
+
* Wraps an object so it behaves like a signal, but with the familiar
|
|
425
|
+
* property-access API: instead of `count()` / `count.set(n)`, you write
|
|
426
|
+
* `state.count` and `state.count = n`. Reading and writing the proxy
|
|
427
|
+
* transparently looks and feels like reading and writing the original object.
|
|
428
|
+
*
|
|
429
|
+
* Reactivity is nested: reading a property that holds another object/array
|
|
430
|
+
* returns a proxy for that value too, recursively. Arrays, Maps, Sets, and
|
|
431
|
+
* WeakMaps are also wrapped, so `state.items.push(x)` or `state.map.set(k, v)`
|
|
432
|
+
* notify subscribers the same way property writes do.
|
|
433
|
+
*
|
|
434
|
+
* Subscriptions are only created when a read happens *while a computation is
|
|
435
|
+
* active* — i.e. inside a component's render, or inside an `effect`,
|
|
436
|
+
* `computed`, or `asyncComputed`. Reading the proxy from a plain function
|
|
437
|
+
* with no surrounding computation just returns the value without subscribing
|
|
438
|
+
* anything.
|
|
439
|
+
*
|
|
440
|
+
* @param target the object to make reactive
|
|
441
|
+
* @returns a proxy that tracks reads/writes against `target`
|
|
442
|
+
*/
|
|
443
|
+
export declare function proxy<T extends Target>(target: T): T;
|
|
444
|
+
export interface Signal<T> extends ReactiveValue<T> {
|
|
445
|
+
/**
|
|
446
|
+
* Update the value of the signal with a new value. If the new value is different
|
|
447
|
+
* from the previous values, all computations that depends on this signal will
|
|
448
|
+
* be invalidated, and effects will rerun.
|
|
449
|
+
*/
|
|
450
|
+
set(nextValue: T): void;
|
|
451
|
+
}
|
|
452
|
+
export interface SignalOptions<T> {
|
|
453
|
+
type?: T;
|
|
454
|
+
}
|
|
455
|
+
declare function triggerSignal(signal: Signal<any>): void;
|
|
456
|
+
declare function signalRef(): Signal<HTMLElement | null>;
|
|
457
|
+
declare function signalRef<T extends Constructor<HTMLElement>>(type: T): Signal<InstanceType<T> | null>;
|
|
458
|
+
declare function signalArray<T>(): Signal<T[]>;
|
|
459
|
+
declare function signalArray<T>(initialValue: T[]): Signal<T[]>;
|
|
460
|
+
declare function signalArray<T>(initialValue: NoInfer<T>[], options: SignalOptions<T>): Signal<T[]>;
|
|
461
|
+
declare function signalObject<T extends Record<PropertyKey, any>>(): Signal<T>;
|
|
462
|
+
declare function signalObject<T extends Record<PropertyKey, any>>(initialValue: T): Signal<T>;
|
|
463
|
+
declare function signalObject<T extends Record<PropertyKey, any>>(initialValue: NoInfer<T>, options: SignalOptions<T>): Signal<T>;
|
|
464
|
+
export interface MapSignalOptions<K, V> {
|
|
465
|
+
name?: string;
|
|
466
|
+
keyType?: K;
|
|
467
|
+
valueType?: V;
|
|
468
|
+
}
|
|
469
|
+
declare function signalMap<K, V>(): Signal<Map<K, V>>;
|
|
470
|
+
declare function signalMap<K, V>(initialValue: Map<K, V>): Signal<Map<K, V>>;
|
|
471
|
+
declare function signalMap<K, V>(initialValue: NoInfer<Map<K, V>>, options: MapSignalOptions<K, V>): Signal<Map<K, V>>;
|
|
472
|
+
declare function signalSet<T>(): Signal<Set<T>>;
|
|
473
|
+
declare function signalSet<T>(initialValue: Set<T>): Signal<Set<T>>;
|
|
474
|
+
declare function signalSet<T>(initialValue: Set<NoInfer<T>>, options: SignalOptions<T>): Signal<Set<T>>;
|
|
475
|
+
export declare function signal<T>(value: T): Signal<T>;
|
|
476
|
+
export declare function signal<T>(value: NoInfer<T>, options: SignalOptions<T>): Signal<T>;
|
|
477
|
+
export declare namespace signal {
|
|
478
|
+
var trigger: typeof triggerSignal;
|
|
479
|
+
var ref: typeof signalRef;
|
|
480
|
+
var Array: typeof signalArray;
|
|
481
|
+
var Map: typeof signalMap;
|
|
482
|
+
var Object: typeof signalObject;
|
|
483
|
+
var Set: typeof signalSet;
|
|
484
|
+
}
|
|
485
|
+
export interface ComputedOptions<TWrite> {
|
|
486
|
+
set?(value: TWrite): void;
|
|
487
|
+
}
|
|
488
|
+
export declare function computed<TRead, TWrite = TRead>(getter: () => TRead, options?: ComputedOptions<TWrite>): ReactiveValue<TRead, TWrite>;
|
|
489
|
+
export declare function effect<T>(fn: () => T): () => void;
|
|
490
|
+
export interface AsyncComputedContext {
|
|
491
|
+
readonly abortSignal: AbortSignal;
|
|
492
|
+
}
|
|
493
|
+
export interface AsyncComputedOptions<T> {
|
|
494
|
+
initial?: T;
|
|
495
|
+
}
|
|
496
|
+
export interface AsyncComputed<T> {
|
|
497
|
+
(): T | undefined;
|
|
498
|
+
loading(): boolean;
|
|
499
|
+
error(): Error | null;
|
|
500
|
+
refresh(): void;
|
|
501
|
+
dispose(): void;
|
|
502
|
+
/**
|
|
503
|
+
* Returns a promise that resolves as soon as no run is in flight: if a run
|
|
504
|
+
* is currently running it resolves once that run (or any run that supersedes
|
|
505
|
+
* it) settles, otherwise it resolves immediately. It never rejects — fetcher
|
|
506
|
+
* errors are surfaced through `error()`. Handy to await the value in
|
|
507
|
+
* `onWillStart`: `onWillStart(() => data.currentPromise())`.
|
|
508
|
+
*/
|
|
509
|
+
currentPromise(): Promise<void>;
|
|
510
|
+
}
|
|
511
|
+
/**
|
|
512
|
+
* @experimental The exact API is subject to change in future versions.
|
|
513
|
+
*/
|
|
514
|
+
export declare function asyncComputed<T>(fetcher: (ctx: AsyncComputedContext) => Promise<T>, options?: AsyncComputedOptions<T>): AsyncComputed<T>;
|
|
515
|
+
export interface ValidationIssue {
|
|
516
|
+
message: string;
|
|
517
|
+
path?: string;
|
|
518
|
+
received?: any;
|
|
519
|
+
[K: string]: any;
|
|
520
|
+
}
|
|
521
|
+
export declare function assertType(value: any, validation: any, errorMessage?: string): void;
|
|
522
|
+
export declare function validateType(value: any, validation: any): ValidationIssue[];
|
|
523
|
+
export interface RegistryOptions<T> {
|
|
524
|
+
name?: string;
|
|
525
|
+
validation?: T;
|
|
526
|
+
}
|
|
527
|
+
export interface RegistryAddOptions extends ResourceAddOptions {
|
|
528
|
+
force?: boolean;
|
|
529
|
+
}
|
|
530
|
+
type Item$1<T> = StripBrands<T>;
|
|
531
|
+
export declare class Registry<T> {
|
|
532
|
+
private _map;
|
|
533
|
+
private _name;
|
|
534
|
+
private _validation?;
|
|
535
|
+
constructor(options?: RegistryOptions<T>);
|
|
536
|
+
entries: ReactiveValue<[
|
|
537
|
+
string,
|
|
538
|
+
Item$1<T>
|
|
539
|
+
][]>;
|
|
540
|
+
items: ReactiveValue<Item$1<T>[]>;
|
|
541
|
+
addById<U extends {
|
|
542
|
+
id: string;
|
|
543
|
+
} & Item$1<T>>(item: U, options?: RegistryAddOptions): Registry<T>;
|
|
544
|
+
add(key: string, value: Item$1<T>, options?: RegistryAddOptions): Registry<T>;
|
|
545
|
+
get(key: string, defaultValue?: Item$1<T>): Item$1<T>;
|
|
546
|
+
delete(key: string): void;
|
|
547
|
+
has(key: string): boolean;
|
|
548
|
+
use(key: string, value: Item$1<T>, options?: RegistryAddOptions): Registry<T>;
|
|
549
|
+
useById<U extends {
|
|
550
|
+
id: string;
|
|
551
|
+
} & Item$1<T>>(item: U, options?: RegistryAddOptions): Registry<T>;
|
|
552
|
+
}
|
|
553
|
+
/**
|
|
554
|
+
* Creates a reactive effect bound to the surrounding component or plugin.
|
|
555
|
+
* Equivalent to `onWillDestroy(effect(fn))`: the effect runs once immediately,
|
|
556
|
+
* re-runs whenever any reactive value (signal, computed, proxy property) read
|
|
557
|
+
* during its execution changes, and is disposed when the owning scope is
|
|
558
|
+
* destroyed. If the callback returns a function, that function is called as
|
|
559
|
+
* cleanup before each re-run and on disposal.
|
|
560
|
+
*/
|
|
561
|
+
export declare function useEffect(fn: Parameters<typeof effect>[0]): void;
|
|
562
|
+
/**
|
|
563
|
+
* Adds an event listener to a target and automatically removes it when the
|
|
564
|
+
* surrounding component or plugin is destroyed.
|
|
565
|
+
*
|
|
566
|
+
* `target` can be either an `EventTarget` (the listener is attached
|
|
567
|
+
* immediately) or a `Signal<EventTarget | null>` such as a `t-ref` (the
|
|
568
|
+
* listener is attached through a `useEffect` and re-attaches when the signal's
|
|
569
|
+
* value changes; nothing is attached while the signal is null).
|
|
570
|
+
*
|
|
571
|
+
* The handler is not bound: it is passed as-is to `addEventListener`, so inside
|
|
572
|
+
* it `this` is the event target, not the calling component. Wrap a method in an
|
|
573
|
+
* arrow function (or bind it) if it relies on `this`.
|
|
574
|
+
*
|
|
575
|
+
* Example — close a menu when the user clicks anywhere on `window`:
|
|
576
|
+
* useListener(window, "click", () => this.close());
|
|
577
|
+
*/
|
|
578
|
+
export declare function useListener(target: EventTarget | Signal<EventTarget | null>, eventName: string, handler: EventListener, eventParams?: AddEventListenerOptions): void;
|
|
579
|
+
export declare function onWillStart(fn: (scope: Scope) => Promise<void> | void | any): void;
|
|
580
|
+
export declare function onWillDestroy(fn: (scope: Scope) => void | any): void;
|
|
581
|
+
export type PluginInstance<T extends PluginConstructor> = Omit<InstanceType<T>, "setup">;
|
|
582
|
+
export declare function plugin<T extends PluginConstructor>(pluginType: T): PluginInstance<T>;
|
|
583
|
+
export declare function config<T = any>(key: string): T;
|
|
584
|
+
export declare function config<T>(key: string, type: WithDefault<T>): T;
|
|
585
|
+
export declare function config<T>(key: string, type: Optional<T>): T | undefined;
|
|
586
|
+
export declare function config<T>(key: string, type: T): StripBrands<T>;
|
|
587
|
+
export declare class EventBus extends EventTarget {
|
|
588
|
+
trigger(name: string, payload?: any): void;
|
|
589
|
+
}
|
|
590
|
+
declare class Markup extends String {
|
|
591
|
+
}
|
|
592
|
+
export declare function htmlEscape(str: any): Markup;
|
|
593
|
+
export declare function markup(strings: TemplateStringsArray, ...placeholders: unknown[]): Markup;
|
|
594
|
+
export declare function markup(value: string): Markup;
|
|
595
|
+
declare class Fiber {
|
|
596
|
+
node: ComponentNode;
|
|
597
|
+
bdom: BDom | null;
|
|
598
|
+
root: RootFiber | null;
|
|
599
|
+
parent: Fiber | null;
|
|
600
|
+
children: Fiber[];
|
|
601
|
+
appliedToDom: boolean;
|
|
602
|
+
deep: boolean;
|
|
603
|
+
childrenMap: ComponentNode["children"];
|
|
604
|
+
constructor(node: ComponentNode, parent: Fiber | null);
|
|
605
|
+
render(): void;
|
|
606
|
+
}
|
|
607
|
+
declare class RootFiber extends Fiber {
|
|
608
|
+
counter: number;
|
|
609
|
+
renderCount: number;
|
|
610
|
+
willPatch: Fiber[];
|
|
611
|
+
patched: Fiber[];
|
|
612
|
+
mounted: Fiber[];
|
|
613
|
+
locked: boolean;
|
|
614
|
+
complete(): void;
|
|
615
|
+
setCounter(newValue: number): void;
|
|
616
|
+
}
|
|
617
|
+
export type Position = "first-child" | "last-child";
|
|
618
|
+
export interface MountOptions {
|
|
619
|
+
position?: Position;
|
|
620
|
+
afterNode?: Node | null;
|
|
621
|
+
}
|
|
622
|
+
declare class MountFiber extends RootFiber {
|
|
623
|
+
target: MountTarget | null;
|
|
624
|
+
position: Position;
|
|
625
|
+
afterNode: Node | null;
|
|
626
|
+
prepared: boolean;
|
|
627
|
+
onPrepared: (() => void) | null;
|
|
628
|
+
constructor(node: ComponentNode, target: MountTarget | null, options?: MountOptions);
|
|
629
|
+
complete(): void;
|
|
630
|
+
commit(target: MountTarget, options?: MountOptions): void;
|
|
631
|
+
private _mount;
|
|
664
632
|
}
|
|
633
|
+
export type LifecycleHook = Function;
|
|
634
|
+
declare class ComponentNode extends Scope implements VNode<ComponentNode> {
|
|
635
|
+
fiber: Fiber | null;
|
|
636
|
+
component: Component;
|
|
637
|
+
bdom: BDom | null;
|
|
638
|
+
componentName: string;
|
|
639
|
+
forceNextRender: boolean;
|
|
640
|
+
parentKey: string | null;
|
|
641
|
+
props: Record<string, any>;
|
|
642
|
+
defaultProps: Record<string, any> | null;
|
|
643
|
+
renderFn: Function;
|
|
644
|
+
parent: ComponentNode | null;
|
|
645
|
+
children: {
|
|
646
|
+
[key: string]: ComponentNode;
|
|
647
|
+
};
|
|
648
|
+
willUpdateProps: LifecycleHook[];
|
|
649
|
+
propsUpdated: LifecycleHook[];
|
|
650
|
+
willUnmount: LifecycleHook[];
|
|
651
|
+
mounted: LifecycleHook[];
|
|
652
|
+
willPatch: LifecycleHook[];
|
|
653
|
+
patched: LifecycleHook[];
|
|
654
|
+
signalComputation: ComputationAtom;
|
|
655
|
+
trackedRefs: Map<{
|
|
656
|
+
set(v: null): void;
|
|
657
|
+
}, {
|
|
658
|
+
value: HTMLElement | null;
|
|
659
|
+
}> | null;
|
|
660
|
+
constructor(C: ComponentConstructor, props: Record<string, any>, app: App, parent: ComponentNode | null, parentKey: string | null);
|
|
661
|
+
decorate(f: Function, hookName: string): Function;
|
|
662
|
+
initiateRender(fiber: Fiber | MountFiber): Promise<void>;
|
|
663
|
+
render(deep: boolean): Promise<void>;
|
|
664
|
+
cancel(): void;
|
|
665
|
+
_cancel(): void;
|
|
666
|
+
destroy(): void;
|
|
667
|
+
_destroy(): void;
|
|
668
|
+
/**
|
|
669
|
+
* Unset any tracked t-ref whose element is no longer in the document, and stop
|
|
670
|
+
* tracking it (createRef re-registers it on the next render if the element
|
|
671
|
+
* comes back). `isConnected` is the discriminator: a ref the block's own
|
|
672
|
+
* remove() failed to clear (bulk removal) points at a detached element and is
|
|
673
|
+
* cleared, while a ref a surviving sibling just took over (t-if/t-else with a
|
|
674
|
+
* shared signal) points at a still-connected element and is left alone.
|
|
675
|
+
*
|
|
676
|
+
* Called after this component's dom settles: at the tail of `_patch` (before
|
|
677
|
+
* user `onPatched`), so an element removed in place is caught, and — for the
|
|
678
|
+
* nodes collected during `_destroy` — after a removed subtree is detached.
|
|
679
|
+
*/
|
|
680
|
+
sweepRefs(): void;
|
|
681
|
+
/**
|
|
682
|
+
* Finds a child that has dom that is not yet updated, and update it. This
|
|
683
|
+
* method is meant to be used only in the context of repatching the dom after
|
|
684
|
+
* a mounted hook failed and was handled.
|
|
685
|
+
*/
|
|
686
|
+
updateDom(): void;
|
|
687
|
+
firstNode(): Node | undefined;
|
|
688
|
+
mount(parent: HTMLElement, anchor: ChildNode): void;
|
|
689
|
+
moveBeforeDOMNode(node: Node | null, parent?: HTMLElement): void;
|
|
690
|
+
moveBeforeVNode(other: ComponentNode | null, afterNode: Node | null): void;
|
|
691
|
+
/**
|
|
692
|
+
* Register a t-ref signal bound to an element this component hosts, so its
|
|
693
|
+
* lifecycle can clear it (see sweepRefs / _destroy). Idempotent — re-tracking
|
|
694
|
+
* the same signal on each render just refreshes its atom.
|
|
695
|
+
*/
|
|
696
|
+
trackRef(ref: {
|
|
697
|
+
set(v: null): void;
|
|
698
|
+
}, atom: {
|
|
699
|
+
value: HTMLElement | null;
|
|
700
|
+
}): void;
|
|
701
|
+
patch(): void;
|
|
702
|
+
_patch(): void;
|
|
703
|
+
beforeRemove(): void;
|
|
704
|
+
remove(): void;
|
|
705
|
+
}
|
|
706
|
+
export interface StaticComponentProperties {
|
|
707
|
+
template: string;
|
|
708
|
+
components?: {
|
|
709
|
+
[componentName: string]: ComponentConstructor;
|
|
710
|
+
};
|
|
711
|
+
}
|
|
712
|
+
export interface ComponentConstructor extends StaticComponentProperties {
|
|
713
|
+
new (node: ComponentNode): Component;
|
|
714
|
+
}
|
|
715
|
+
export declare class Component {
|
|
716
|
+
static template: string;
|
|
717
|
+
__owl__: ComponentNode;
|
|
718
|
+
constructor(node: ComponentNode);
|
|
719
|
+
setup(): void;
|
|
720
|
+
}
|
|
721
|
+
declare function staticProp<T = any>(key: string): T;
|
|
722
|
+
declare function staticProp<T>(key: string, type: WithDefault<T>): T;
|
|
723
|
+
declare function staticProp<T>(key: string, type: Optional<T>): T | undefined;
|
|
724
|
+
declare function staticProp<T>(key: string, type: T): StripBrands<T>;
|
|
725
|
+
export declare const isProps: unique symbol;
|
|
726
|
+
export type Props<T extends {}> = T & {
|
|
727
|
+
[isProps]: never;
|
|
728
|
+
};
|
|
729
|
+
export type PropsWithDefaults<T extends {}, DK extends PropertyKey> = T & {
|
|
730
|
+
[isProps]: DK;
|
|
731
|
+
};
|
|
732
|
+
export type GetPropsWithOptionals<T> = T extends {
|
|
733
|
+
[isProps]: infer DK extends PropertyKey;
|
|
734
|
+
} ? Omit<T, typeof isProps | (DK & keyof T)> & Partial<Pick<T, DK & keyof T>> : never;
|
|
735
|
+
export type GetProps<T> = {
|
|
736
|
+
[K in keyof T]: T[K] extends {
|
|
737
|
+
[isProps]: PropertyKey;
|
|
738
|
+
} ? (x: GetPropsWithOptionals<T[K]>) => void : never;
|
|
739
|
+
}[keyof T] extends (x: infer I) => void ? {
|
|
740
|
+
[K in keyof I]: I[K];
|
|
741
|
+
} : never;
|
|
742
|
+
export type ResolveProps<Shape> = [
|
|
743
|
+
GetDefaultedKeys<Shape>
|
|
744
|
+
] extends [
|
|
745
|
+
never
|
|
746
|
+
] ? Props<ResolveReaderObjectType<Shape>> : PropsWithDefaults<ResolveReaderObjectType<Shape>, GetDefaultedKeys<Shape> & PropertyKey>;
|
|
747
|
+
export interface PropsFunction {
|
|
748
|
+
(): Props<Record<string, any>>;
|
|
749
|
+
<const Keys extends string[]>(keys: Keys): Props<ResolveObjectType<Keys>>;
|
|
750
|
+
<Shape extends {}>(shape: Shape): ResolveProps<Shape>;
|
|
751
|
+
static: typeof staticProp;
|
|
752
|
+
}
|
|
753
|
+
export declare const props: PropsFunction;
|
|
754
|
+
declare class Scheduler {
|
|
755
|
+
static requestAnimationFrame: (callback: FrameRequestCallback) => number;
|
|
756
|
+
tasks: Set<RootFiber>;
|
|
757
|
+
requestAnimationFrame: Window["requestAnimationFrame"];
|
|
758
|
+
frame: number;
|
|
759
|
+
delayedRenders: Fiber[];
|
|
760
|
+
cancelledNodes: Set<ComponentNode>;
|
|
761
|
+
processing: boolean;
|
|
762
|
+
constructor();
|
|
763
|
+
addFiber(fiber: Fiber): void;
|
|
764
|
+
scheduleDestroy(node: ComponentNode): void;
|
|
765
|
+
/**
|
|
766
|
+
* Process all current tasks. This only applies to the fibers that are ready.
|
|
767
|
+
* Other tasks are left unchanged.
|
|
768
|
+
*/
|
|
769
|
+
flush(): void;
|
|
770
|
+
processTasks(): void;
|
|
771
|
+
processCancelledNodes(): void;
|
|
772
|
+
}
|
|
773
|
+
export interface TemplateSetConfig {
|
|
774
|
+
dev?: boolean;
|
|
775
|
+
translatableAttributes?: string[];
|
|
776
|
+
translateFn?: (s: string, translationCtx: string) => string;
|
|
777
|
+
templates?: string | Document | Record<string, string | TemplateFunction>;
|
|
778
|
+
getTemplate?: (s: string) => Element | Function | string | void;
|
|
779
|
+
customDirectives?: CustomDirectives;
|
|
780
|
+
globalValues?: object;
|
|
781
|
+
}
|
|
782
|
+
export declare class TemplateSet {
|
|
783
|
+
static registerTemplate(name: string, fn: TemplateFunction): void;
|
|
784
|
+
dev: boolean;
|
|
785
|
+
rawTemplates: typeof globalTemplates;
|
|
786
|
+
templates: {
|
|
787
|
+
[name: string]: Template;
|
|
788
|
+
};
|
|
789
|
+
getRawTemplate?: (s: string) => Element | Function | string | void;
|
|
790
|
+
translateFn?: (s: string, translationCtx: string) => string;
|
|
791
|
+
translatableAttributes?: string[];
|
|
792
|
+
customDirectives: CustomDirectives;
|
|
793
|
+
runtimeUtils: object;
|
|
794
|
+
hasGlobalValues: boolean;
|
|
795
|
+
constructor(config?: TemplateSetConfig);
|
|
796
|
+
addTemplate(name: string, template: string | Element | TemplateFunction): void;
|
|
797
|
+
addTemplates(xml: string | Document): void;
|
|
798
|
+
getTemplate(name: string): Template;
|
|
799
|
+
private _compileTemplate;
|
|
800
|
+
private _parseXML;
|
|
801
|
+
}
|
|
802
|
+
export declare const globalTemplates: {
|
|
803
|
+
[key: string]: string | Element | TemplateFunction;
|
|
804
|
+
};
|
|
805
|
+
export declare function xml(...args: Parameters<typeof String.raw>): string;
|
|
806
|
+
export declare namespace xml {
|
|
807
|
+
var nextId: number;
|
|
808
|
+
}
|
|
809
|
+
declare function validateTarget(target: HTMLElement | ShadowRoot): void;
|
|
810
|
+
export declare function whenReady(fn?: any): Promise<void>;
|
|
811
|
+
export type ComponentInstance<C extends ComponentConstructor> = C extends new (...args: any) => infer T ? T : never;
|
|
812
|
+
export interface RootConfig<P> {
|
|
813
|
+
props?: P;
|
|
814
|
+
}
|
|
815
|
+
export interface AppConfig extends TemplateSetConfig {
|
|
816
|
+
name?: string;
|
|
817
|
+
plugins?: PluginConstructor[] | Resource<PluginConstructor>;
|
|
818
|
+
config?: Record<string, any>;
|
|
819
|
+
test?: boolean;
|
|
820
|
+
}
|
|
821
|
+
export interface Root<T extends ComponentConstructor> {
|
|
822
|
+
node: ComponentNode;
|
|
823
|
+
promise: Promise<ComponentInstance<T>>;
|
|
824
|
+
prepare(): Promise<void>;
|
|
825
|
+
mount(target: MountTarget, options?: MountOptions): Promise<ComponentInstance<T>>;
|
|
826
|
+
destroy(): void;
|
|
827
|
+
}
|
|
828
|
+
export declare class App extends TemplateSet {
|
|
829
|
+
static validateTarget: typeof validateTarget;
|
|
830
|
+
static apps: Set<App>;
|
|
831
|
+
static version: string;
|
|
832
|
+
name: string;
|
|
833
|
+
scheduler: Scheduler;
|
|
834
|
+
roots: Set<Root<any>>;
|
|
835
|
+
pluginManager: PluginManager;
|
|
836
|
+
destroyed: boolean;
|
|
837
|
+
constructor(config?: AppConfig);
|
|
838
|
+
createRoot<T extends ComponentConstructor>(Root: T, config?: RootConfig<GetProps<ComponentInstance<T>>>): Root<T>;
|
|
839
|
+
destroy(): void;
|
|
840
|
+
_handleError(error: any): void;
|
|
841
|
+
}
|
|
842
|
+
declare function mount$1<T extends ComponentConstructor>(C: T, target: MountTarget, config?: AppConfig & RootConfig<GetProps<ComponentInstance<T>>> & MountOptions): Promise<ComponentInstance<T>>;
|
|
843
|
+
export declare class ErrorBoundary extends Component {
|
|
844
|
+
static template: string;
|
|
845
|
+
props: PropsWithDefaults<{
|
|
846
|
+
error: ReactiveValue<any, any>;
|
|
847
|
+
}, "error">;
|
|
848
|
+
setup(): void;
|
|
849
|
+
}
|
|
850
|
+
export declare class Portal extends Component {
|
|
851
|
+
static template: string;
|
|
852
|
+
props: Props<{
|
|
853
|
+
slots: {
|
|
854
|
+
default: any;
|
|
855
|
+
};
|
|
856
|
+
target: string | HTMLElement | ReactiveValue<HTMLElement, HTMLElement>;
|
|
857
|
+
}>;
|
|
858
|
+
setup(): void;
|
|
859
|
+
}
|
|
860
|
+
export declare class Suspense extends Component {
|
|
861
|
+
static template: string;
|
|
862
|
+
props: Props<{
|
|
863
|
+
slots: {
|
|
864
|
+
default: any;
|
|
865
|
+
fallback: any;
|
|
866
|
+
};
|
|
867
|
+
}>;
|
|
868
|
+
private prepared;
|
|
869
|
+
private mounted;
|
|
870
|
+
private subRootMounted;
|
|
871
|
+
setup(): void;
|
|
872
|
+
}
|
|
873
|
+
export type STATUS_DESCR = "new" | "started" | "mounted" | "cancelled" | "destroyed";
|
|
874
|
+
declare function status$1(entity: Component | Plugin$1): STATUS_DESCR;
|
|
875
|
+
export declare const useApp: () => App;
|
|
876
|
+
export declare function onWillUpdateProps(fn: (nextProps: any, scope: ComponentNode) => Promise<void> | void | any): void;
|
|
877
|
+
export declare function onMounted(fn: (scope: ComponentNode) => void | any): void;
|
|
878
|
+
export declare function onWillPatch(fn: (scope: ComponentNode) => any | void): void;
|
|
879
|
+
export declare function onPatched(fn: (scope: ComponentNode) => void | any): void;
|
|
880
|
+
export declare function onWillUnmount(fn: (scope: ComponentNode) => void | any): void;
|
|
881
|
+
export type OnErrorCallback = (error: any) => void | any;
|
|
882
|
+
export declare function onError(callback: OnErrorCallback): void;
|
|
883
|
+
declare const types$1: typeof types & {
|
|
884
|
+
component: () => Type<typeof Component>;
|
|
885
|
+
};
|
|
886
|
+
export declare function providePlugins(pluginConstructors: PluginConstructor[] | Resource<PluginConstructor>, config?: Record<string, any>): void;
|
|
887
|
+
export declare const blockDom: {
|
|
888
|
+
config: {
|
|
889
|
+
shouldNormalizeDom: boolean;
|
|
890
|
+
mainEventHandler: (data: any, ev: Event, currentTarget?: EventTarget | null) => boolean;
|
|
891
|
+
};
|
|
892
|
+
mount: typeof mount;
|
|
893
|
+
patch: typeof patch;
|
|
894
|
+
remove: typeof remove;
|
|
895
|
+
list: typeof list;
|
|
896
|
+
multi: typeof multi;
|
|
897
|
+
text: typeof text;
|
|
898
|
+
toggler: typeof toggler;
|
|
899
|
+
createBlock: typeof createBlock;
|
|
900
|
+
html: typeof html;
|
|
901
|
+
};
|
|
902
|
+
export declare const __info__: Record<string, string>;
|
|
665
903
|
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
patch: typeof patch;
|
|
673
|
-
remove: typeof remove;
|
|
674
|
-
list: typeof list;
|
|
675
|
-
multi: typeof multi;
|
|
676
|
-
text: typeof text;
|
|
677
|
-
toggler: typeof toggler;
|
|
678
|
-
createBlock: typeof createBlock;
|
|
679
|
-
html: typeof html;
|
|
680
|
-
comment: typeof comment;
|
|
681
|
-
};
|
|
682
|
-
|
|
683
|
-
declare const __info__: {
|
|
684
|
-
version: string;
|
|
904
|
+
export {
|
|
905
|
+
Plugin$1 as Plugin,
|
|
906
|
+
mount$1 as mount,
|
|
907
|
+
status$1 as status,
|
|
908
|
+
types$1 as t,
|
|
909
|
+
types$1 as types,
|
|
685
910
|
};
|
|
686
911
|
|
|
687
|
-
export {
|
|
912
|
+
export {};
|