@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
|
@@ -1,83 +1,57 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { STATUS } from "./status";
|
|
8
|
-
|
|
9
|
-
export declare
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
updateAndRender(props: P, parentFiber: Fiber): Promise<void>;
|
|
59
|
-
/**
|
|
60
|
-
* Finds a child that has dom that is not yet updated, and update it. This
|
|
61
|
-
* method is meant to be used only in the context of repatching the dom after
|
|
62
|
-
* a mounted hook failed and was handled.
|
|
63
|
-
*/
|
|
64
|
-
updateDom(): void;
|
|
65
|
-
/**
|
|
66
|
-
* Sets a ref to a given HTMLElement.
|
|
67
|
-
*
|
|
68
|
-
* @param name the name of the ref to set
|
|
69
|
-
* @param el the HTMLElement to set the ref to. The ref is not set if the el
|
|
70
|
-
* is null, but useRef will not return elements that are not in the DOM
|
|
71
|
-
*/
|
|
72
|
-
setRef(name: string, el: HTMLElement | null): void;
|
|
73
|
-
firstNode(): Node | undefined;
|
|
74
|
-
mount(parent: HTMLElement, anchor: ChildNode): void;
|
|
75
|
-
moveBeforeDOMNode(node: Node | null, parent?: HTMLElement): void;
|
|
76
|
-
moveBeforeVNode(other: ComponentNode<P, E> | null, afterNode: Node | null): void;
|
|
77
|
-
patch(): void;
|
|
78
|
-
_patch(): void;
|
|
79
|
-
beforeRemove(): void;
|
|
80
|
-
remove(): void;
|
|
81
|
-
get name(): string;
|
|
82
|
-
}
|
|
83
|
-
export {};
|
|
1
|
+
import type { App } from "./app";
|
|
2
|
+
import { BDom, VNode } from "./blockdom";
|
|
3
|
+
import { Component, ComponentConstructor } from "./component";
|
|
4
|
+
import { PluginManager } from "./plugin_manager";
|
|
5
|
+
import { ComputationAtom } from "./reactivity/computations";
|
|
6
|
+
import { Fiber, MountFiber, MountOptions } from "./rendering/fibers";
|
|
7
|
+
import { STATUS } from "./status";
|
|
8
|
+
type LifecycleHook = Function;
|
|
9
|
+
export declare class ComponentNode implements VNode<ComponentNode> {
|
|
10
|
+
el?: HTMLElement | Text | undefined;
|
|
11
|
+
app: App;
|
|
12
|
+
fiber: Fiber | null;
|
|
13
|
+
component: Component;
|
|
14
|
+
bdom: BDom | null;
|
|
15
|
+
status: STATUS;
|
|
16
|
+
forceNextRender: boolean;
|
|
17
|
+
parentKey: string | null;
|
|
18
|
+
props: Record<string, any>;
|
|
19
|
+
renderFn: Function;
|
|
20
|
+
parent: ComponentNode | null;
|
|
21
|
+
children: {
|
|
22
|
+
[key: string]: ComponentNode;
|
|
23
|
+
};
|
|
24
|
+
willStart: LifecycleHook[];
|
|
25
|
+
willUpdateProps: LifecycleHook[];
|
|
26
|
+
willUnmount: LifecycleHook[];
|
|
27
|
+
mounted: LifecycleHook[];
|
|
28
|
+
willPatch: LifecycleHook[];
|
|
29
|
+
patched: LifecycleHook[];
|
|
30
|
+
willDestroy: LifecycleHook[];
|
|
31
|
+
signalComputation: ComputationAtom;
|
|
32
|
+
pluginManager: PluginManager;
|
|
33
|
+
constructor(C: ComponentConstructor, props: Record<string, any>, app: App, parent: ComponentNode | null, parentKey: string | null);
|
|
34
|
+
mountComponent(target: any, options?: MountOptions): void;
|
|
35
|
+
initiateRender(fiber: Fiber | MountFiber): Promise<void>;
|
|
36
|
+
render(deep: boolean): Promise<void>;
|
|
37
|
+
cancel(): void;
|
|
38
|
+
_cancel(): void;
|
|
39
|
+
destroy(): void;
|
|
40
|
+
_destroy(): void;
|
|
41
|
+
updateAndRender(props: Record<string, any>, parentFiber: Fiber): Promise<void>;
|
|
42
|
+
/**
|
|
43
|
+
* Finds a child that has dom that is not yet updated, and update it. This
|
|
44
|
+
* method is meant to be used only in the context of repatching the dom after
|
|
45
|
+
* a mounted hook failed and was handled.
|
|
46
|
+
*/
|
|
47
|
+
updateDom(): void;
|
|
48
|
+
firstNode(): Node | undefined;
|
|
49
|
+
mount(parent: HTMLElement, anchor: ChildNode): void;
|
|
50
|
+
moveBeforeDOMNode(node: Node | null, parent?: HTMLElement): void;
|
|
51
|
+
moveBeforeVNode(other: ComponentNode | null, afterNode: Node | null): void;
|
|
52
|
+
patch(): void;
|
|
53
|
+
_patch(): void;
|
|
54
|
+
beforeRemove(): void;
|
|
55
|
+
remove(): void;
|
|
56
|
+
}
|
|
57
|
+
export {};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { App } from "./app";
|
|
2
|
+
import { type ComponentNode } from "./component_node";
|
|
3
|
+
import { PluginManager } from "./plugin_manager";
|
|
4
|
+
import { STATUS } from "./status";
|
|
5
|
+
interface ComponentContext {
|
|
6
|
+
type: "component";
|
|
7
|
+
app: App;
|
|
8
|
+
componentName: string;
|
|
9
|
+
node: ComponentNode;
|
|
10
|
+
status: STATUS;
|
|
11
|
+
}
|
|
12
|
+
interface PluginContext {
|
|
13
|
+
type: "plugin";
|
|
14
|
+
app: App;
|
|
15
|
+
manager: PluginManager;
|
|
16
|
+
status: STATUS;
|
|
17
|
+
}
|
|
18
|
+
type Contexts = {
|
|
19
|
+
plugin: PluginContext;
|
|
20
|
+
component: ComponentContext;
|
|
21
|
+
};
|
|
22
|
+
type Context = Contexts[keyof Contexts];
|
|
23
|
+
export declare let contextStack: Context[];
|
|
24
|
+
export declare function saveContext(): () => void;
|
|
25
|
+
export declare function getContext<K extends keyof Contexts>(type?: K): K extends string ? Contexts[K] : Context;
|
|
26
|
+
export interface CapturedContext {
|
|
27
|
+
run<T = void>(callback: () => T): T;
|
|
28
|
+
protectAsync<P extends any[], R>(callback: (...args: P) => Promise<R>): (...args: P) => Promise<R>;
|
|
29
|
+
runWithAsyncProtection<T>(callback: () => Promise<T>): Promise<T>;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Captures the current context and gives methods to run
|
|
33
|
+
* functions within the captured context.
|
|
34
|
+
*/
|
|
35
|
+
export declare function useContext(): CapturedContext;
|
|
36
|
+
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const mainEventHandler: (data: any, ev: Event, currentTarget?: EventTarget | null
|
|
1
|
+
export declare const mainEventHandler: (data: any, ev: Event, currentTarget?: EventTarget | null) => boolean;
|
|
@@ -1,57 +1,32 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
*
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
*
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
*
|
|
34
|
-
* @template T
|
|
35
|
-
* @param {Effect<T>} effect the effect to run on component mount and/or patch
|
|
36
|
-
* @param {()=>[...T]} [computeDependencies=()=>[NaN]] a callback to compute
|
|
37
|
-
* dependencies that will decide if the effect needs to be cleaned up and
|
|
38
|
-
* run again. If the dependencies did not change, the effect will not run
|
|
39
|
-
* again. The default value returns an array containing only NaN because
|
|
40
|
-
* NaN !== NaN, which will cause the effect to rerun on every patch.
|
|
41
|
-
*/
|
|
42
|
-
export declare function useEffect<T extends unknown[]>(effect: Effect<T>, computeDependencies?: () => [...T]): void;
|
|
43
|
-
/**
|
|
44
|
-
* When a component needs to listen to DOM Events on element(s) that are not
|
|
45
|
-
* part of his hierarchy, we can use the `useExternalListener` hook.
|
|
46
|
-
* It will correctly add and remove the event listener, whenever the
|
|
47
|
-
* component is mounted and unmounted.
|
|
48
|
-
*
|
|
49
|
-
* Example:
|
|
50
|
-
* a menu needs to listen to the click on window to be closed automatically
|
|
51
|
-
*
|
|
52
|
-
* Usage:
|
|
53
|
-
* in the constructor of the OWL component that needs to be notified,
|
|
54
|
-
* `useExternalListener(window, 'click', this._doSomething);`
|
|
55
|
-
* */
|
|
56
|
-
export declare function useExternalListener(target: EventTarget, eventName: string, handler: EventListener, eventParams?: AddEventListenerOptions): void;
|
|
57
|
-
export {};
|
|
1
|
+
import { App } from "./app";
|
|
2
|
+
import { effect } from "./reactivity/effect";
|
|
3
|
+
import { Signal } from "./reactivity/signal";
|
|
4
|
+
/**
|
|
5
|
+
* This hook will run a callback when a component is mounted and patched, and
|
|
6
|
+
* will run a cleanup function before patching and before unmounting the
|
|
7
|
+
* the component.
|
|
8
|
+
*
|
|
9
|
+
* @template T
|
|
10
|
+
* @param {Effect<T>} effect the effect to run on component mount and/or patch
|
|
11
|
+
* @param {()=>[...T]} [computeDependencies=()=>[NaN]] a callback to compute
|
|
12
|
+
* dependencies that will decide if the effect needs to be cleaned up and
|
|
13
|
+
* run again. If the dependencies did not change, the effect will not run
|
|
14
|
+
* again. The default value returns an array containing only NaN because
|
|
15
|
+
* NaN !== NaN, which will cause the effect to rerun on every patch.
|
|
16
|
+
*/
|
|
17
|
+
export declare function useEffect(fn: Parameters<typeof effect>[0]): void;
|
|
18
|
+
/**
|
|
19
|
+
* When a component needs to listen to DOM Events on element(s) that are not
|
|
20
|
+
* part of his hierarchy, we can use the `useListener` hook.
|
|
21
|
+
* It will immediately add the listener, and remove it whenever the plugin or
|
|
22
|
+
* component is destroyed.
|
|
23
|
+
*
|
|
24
|
+
* Example:
|
|
25
|
+
* a menu needs to listen to the click on window to be closed automatically
|
|
26
|
+
*
|
|
27
|
+
* Usage:
|
|
28
|
+
* in the constructor of the OWL component that needs to be notified,
|
|
29
|
+
* `useListener(window, 'click', () => this._doSomething());`
|
|
30
|
+
* */
|
|
31
|
+
export declare function useListener(target: EventTarget | Signal<EventTarget | null>, eventName: string, handler: EventListener, eventParams?: AddEventListenerOptions): void;
|
|
32
|
+
export declare function useApp(): App;
|
|
@@ -1,35 +1,46 @@
|
|
|
1
|
-
import { createBlock, html, list, mount as blockMount, multi, patch, remove, text, toggler, comment } from "./blockdom";
|
|
2
|
-
export {
|
|
3
|
-
export
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
export {
|
|
21
|
-
export {
|
|
22
|
-
export
|
|
23
|
-
export {
|
|
24
|
-
export {
|
|
25
|
-
export {
|
|
26
|
-
export {
|
|
27
|
-
export {
|
|
28
|
-
export {
|
|
29
|
-
export {
|
|
30
|
-
export {
|
|
31
|
-
export {
|
|
32
|
-
export
|
|
33
|
-
|
|
34
|
-
};
|
|
35
|
-
export {
|
|
1
|
+
import { createBlock, html, list, mount as blockMount, multi, patch, remove, text, toggler, comment } from "./blockdom";
|
|
2
|
+
export { Resource, useResource } from "./resource";
|
|
3
|
+
export { Registry } from "./registry";
|
|
4
|
+
export declare const blockDom: {
|
|
5
|
+
config: {
|
|
6
|
+
shouldNormalizeDom: boolean;
|
|
7
|
+
mainEventHandler: (data: any, ev: Event, currentTarget?: EventTarget | null) => boolean;
|
|
8
|
+
};
|
|
9
|
+
mount: typeof blockMount;
|
|
10
|
+
patch: typeof patch;
|
|
11
|
+
remove: typeof remove;
|
|
12
|
+
list: typeof list;
|
|
13
|
+
multi: typeof multi;
|
|
14
|
+
text: typeof text;
|
|
15
|
+
toggler: typeof toggler;
|
|
16
|
+
createBlock: typeof createBlock;
|
|
17
|
+
html: typeof html;
|
|
18
|
+
comment: typeof comment;
|
|
19
|
+
};
|
|
20
|
+
export { App, mount } from "./app";
|
|
21
|
+
export { xml } from "./template_set";
|
|
22
|
+
export { Component } from "./component";
|
|
23
|
+
export type { ComponentConstructor } from "./component";
|
|
24
|
+
export { props } from "./props";
|
|
25
|
+
export type { GetProps } from "./props";
|
|
26
|
+
export { status } from "./status";
|
|
27
|
+
export { proxy, markRaw, toRaw } from "./reactivity/proxy";
|
|
28
|
+
export { untrack, type ReactiveValue } from "./reactivity/computations";
|
|
29
|
+
export { signal, type Signal } from "./reactivity/signal";
|
|
30
|
+
export { computed } from "./reactivity/computed";
|
|
31
|
+
export { effect } from "./reactivity/effect";
|
|
32
|
+
export { useEffect, useListener, useApp } from "./hooks";
|
|
33
|
+
export { batched, EventBus, htmlEscape, whenReady, markup } from "./utils";
|
|
34
|
+
export { onWillStart, onMounted, onWillUnmount, onWillUpdateProps, onWillPatch, onPatched, onWillDestroy, onError, } from "./lifecycle_hooks";
|
|
35
|
+
export { assertType, validateType } from "./validation";
|
|
36
|
+
export { types } from "./types";
|
|
37
|
+
export { OwlError } from "../common/owl_error";
|
|
38
|
+
export { config, plugin, providePlugins } from "./plugin_hooks";
|
|
39
|
+
export type { PluginInstance } from "./plugin_hooks";
|
|
40
|
+
export { Plugin } from "./plugin_manager";
|
|
41
|
+
export type { PluginConstructor } from "./plugin_manager";
|
|
42
|
+
export { useContext } from "./context";
|
|
43
|
+
export type { CapturedContext } from "./context";
|
|
44
|
+
export declare const __info__: {
|
|
45
|
+
version: string;
|
|
46
|
+
};
|
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
export declare function onWillStart(fn: () => Promise<void> | void | any): void;
|
|
2
|
-
export declare function onWillUpdateProps(fn: (nextProps: any) => Promise<void> | void | any): void;
|
|
3
|
-
export declare function onMounted(fn: () => void | any): void;
|
|
4
|
-
export declare function onWillPatch(fn: () => any | void): void;
|
|
5
|
-
export declare function onPatched(fn: () => void | any): void;
|
|
6
|
-
export declare function onWillUnmount(fn: () => void | any): void;
|
|
7
|
-
export declare function onWillDestroy(fn: () => void | any): void;
|
|
8
|
-
|
|
9
|
-
export declare function
|
|
10
|
-
|
|
11
|
-
export declare function onError(callback: OnErrorCallback): void;
|
|
12
|
-
export {};
|
|
1
|
+
export declare function onWillStart(fn: () => Promise<void> | void | any): void;
|
|
2
|
+
export declare function onWillUpdateProps(fn: (nextProps: any) => Promise<void> | void | any): void;
|
|
3
|
+
export declare function onMounted(fn: () => void | any): void;
|
|
4
|
+
export declare function onWillPatch(fn: () => any | void): void;
|
|
5
|
+
export declare function onPatched(fn: () => void | any): void;
|
|
6
|
+
export declare function onWillUnmount(fn: () => void | any): void;
|
|
7
|
+
export declare function onWillDestroy(fn: () => void | any): void;
|
|
8
|
+
type OnErrorCallback = (error: any) => void | any;
|
|
9
|
+
export declare function onError(callback: OnErrorCallback): void;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { Signal } from "./reactivity/signal";
|
|
2
|
+
type MClass<TFields extends Record<string, FieldDef>> = (new (...args: any[]) => Model<TFields>) & StaticModel<TFields>;
|
|
3
|
+
type CharField = {
|
|
4
|
+
type: "char";
|
|
5
|
+
};
|
|
6
|
+
type NumberField = {
|
|
7
|
+
type: "number";
|
|
8
|
+
};
|
|
9
|
+
type Many2OneField<C extends MClass<any>> = {
|
|
10
|
+
type: "many2one";
|
|
11
|
+
comodel: () => C;
|
|
12
|
+
};
|
|
13
|
+
type FieldDef = CharField | NumberField | Many2OneField<MClass<any>>;
|
|
14
|
+
type FieldValue<F extends FieldDef> = F extends CharField ? Signal<string> : F extends NumberField ? Signal<number> : F extends Many2OneField<infer C> ? Signal<InstanceType<C>> : never;
|
|
15
|
+
type FieldsToData<F extends Record<string, FieldDef>> = {
|
|
16
|
+
[K in keyof F]: FieldValue<F[K]>;
|
|
17
|
+
};
|
|
18
|
+
type FieldDescription = {
|
|
19
|
+
type: "char";
|
|
20
|
+
} | {
|
|
21
|
+
type: "number";
|
|
22
|
+
} | {
|
|
23
|
+
type: "many2one";
|
|
24
|
+
comodel: () => MClass<any>;
|
|
25
|
+
};
|
|
26
|
+
export type Fields = Record<string, FieldDescription>;
|
|
27
|
+
interface StaticModel<F extends Record<string, FieldDef>> {
|
|
28
|
+
fields: F;
|
|
29
|
+
id: string;
|
|
30
|
+
}
|
|
31
|
+
type R<F extends Record<string, FieldDef>, C extends MClass<F>> = InstanceType<C>;
|
|
32
|
+
export declare class Model<F extends Record<string, FieldDef> = any> {
|
|
33
|
+
#private;
|
|
34
|
+
static fields: Fields;
|
|
35
|
+
readonly id: string;
|
|
36
|
+
data: FieldsToData<F>;
|
|
37
|
+
constructor(store: Store, id: string, data?: any);
|
|
38
|
+
toObject(): Object;
|
|
39
|
+
}
|
|
40
|
+
export declare class Store {
|
|
41
|
+
#private;
|
|
42
|
+
static fromObject(obj: any, models: MClass<any>[]): Store;
|
|
43
|
+
uuid(): string;
|
|
44
|
+
create<F extends Record<string, FieldDef>, C extends MClass<F>>(M: C, initialState?: any): R<F, C>;
|
|
45
|
+
toObject(): Object;
|
|
46
|
+
getAll<F extends Record<string, FieldDef>, C extends MClass<F>>(M: C): R<F, C>[];
|
|
47
|
+
}
|
|
48
|
+
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { PluginConstructor } from "./plugin_manager";
|
|
2
|
+
import { Resource } from "./resource";
|
|
3
|
+
export type PluginInstance<T extends PluginConstructor> = Omit<InstanceType<T>, "setup">;
|
|
4
|
+
export declare function plugin<T extends PluginConstructor>(pluginType: T): PluginInstance<T>;
|
|
5
|
+
export declare function config<T = any>(name: string, type?: T): T;
|
|
6
|
+
export declare function providePlugins(pluginConstructors: PluginConstructor[] | Resource<PluginConstructor>, config?: Record<string, any>): void;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { App } from "./app";
|
|
2
|
+
import { Resource } from "./resource";
|
|
3
|
+
import { STATUS } from "./status";
|
|
4
|
+
export interface PluginConstructor {
|
|
5
|
+
new (...args: any[]): Plugin;
|
|
6
|
+
id: string;
|
|
7
|
+
}
|
|
8
|
+
export declare class Plugin {
|
|
9
|
+
private static _shadowId;
|
|
10
|
+
static get id(): string;
|
|
11
|
+
static set id(shadowId: string);
|
|
12
|
+
__owl__: PluginManager;
|
|
13
|
+
constructor(manager: PluginManager);
|
|
14
|
+
setup(): void;
|
|
15
|
+
}
|
|
16
|
+
interface PluginManagerOptions {
|
|
17
|
+
parent?: PluginManager | null;
|
|
18
|
+
config?: Record<string, any>;
|
|
19
|
+
}
|
|
20
|
+
export declare class PluginManager {
|
|
21
|
+
app: App;
|
|
22
|
+
config: Record<string, any>;
|
|
23
|
+
onDestroyCb: Function[];
|
|
24
|
+
plugins: Record<string, Plugin>;
|
|
25
|
+
status: STATUS;
|
|
26
|
+
constructor(app: App, options?: PluginManagerOptions);
|
|
27
|
+
destroy(): void;
|
|
28
|
+
getPluginById<T extends Plugin>(id: string): T | null;
|
|
29
|
+
getPlugin<T extends PluginConstructor>(pluginConstructor: T): InstanceType<T> | null;
|
|
30
|
+
startPlugin<T extends PluginConstructor>(pluginConstructor: T): InstanceType<T> | null;
|
|
31
|
+
startPlugins(pluginConstructors: PluginConstructor[]): void;
|
|
32
|
+
}
|
|
33
|
+
export declare function startPlugins(manager: PluginManager, plugins: PluginConstructor[] | Resource<PluginConstructor>): void;
|
|
34
|
+
export {};
|
|
@@ -1,39 +1,36 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
}
|
|
38
|
-
export declare function usePlugins(Plugins: PluginCtor[]): void;
|
|
39
|
-
export {};
|
|
1
|
+
import { Props, WithDefaults } from "./props";
|
|
2
|
+
import { STATUS } from "./status";
|
|
3
|
+
import { GetOptionalEntries } from "./types";
|
|
4
|
+
export interface PluginConstructor {
|
|
5
|
+
new (): Plugin;
|
|
6
|
+
id: string;
|
|
7
|
+
}
|
|
8
|
+
export declare class Plugin {
|
|
9
|
+
private static _shadowId;
|
|
10
|
+
static get id(): string;
|
|
11
|
+
static set id(shadowId: string);
|
|
12
|
+
setup(): void;
|
|
13
|
+
}
|
|
14
|
+
interface PluginManagerOptions {
|
|
15
|
+
parent?: PluginManager | null;
|
|
16
|
+
plugins?: PluginConstructor[];
|
|
17
|
+
pluginProps?: any;
|
|
18
|
+
}
|
|
19
|
+
export declare class PluginManager {
|
|
20
|
+
static current: PluginManager | null;
|
|
21
|
+
private children;
|
|
22
|
+
private parent;
|
|
23
|
+
private plugins;
|
|
24
|
+
private onDestroyCb;
|
|
25
|
+
status: STATUS;
|
|
26
|
+
constructor(options?: PluginManagerOptions);
|
|
27
|
+
destroy(): void;
|
|
28
|
+
getPluginById<T extends Plugin>(id: string): T | null;
|
|
29
|
+
getPlugin<T extends PluginConstructor>(pluginType: T): InstanceType<T> | null;
|
|
30
|
+
startPlugins(pluginTypes: PluginConstructor[], pluginProps?: any): Plugin[];
|
|
31
|
+
}
|
|
32
|
+
export declare function plugin<T extends PluginConstructor>(pluginType: T): InstanceType<T>;
|
|
33
|
+
export declare namespace plugin {
|
|
34
|
+
var props: <P extends Record<string, any> = any, D extends GetOptionalEntries<P> = any>(type?: P, defaults?: D) => Props<WithDefaults<P, D>>;
|
|
35
|
+
}
|
|
36
|
+
export {};
|
|
@@ -1,15 +1,12 @@
|
|
|
1
|
-
import { Component } from "./component";
|
|
2
|
-
/**
|
|
3
|
-
* kind of similar to <t t-slot="default"/>, but it wraps it around a VPortal
|
|
4
|
-
*/
|
|
5
|
-
export declare function portalTemplate(app: any, bdom: any, helpers: any): (ctx: any, node: any, key?: string) => any;
|
|
6
|
-
export declare class Portal extends Component {
|
|
7
|
-
static template: string;
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
};
|
|
14
|
-
setup(): void;
|
|
15
|
-
}
|
|
1
|
+
import { Component } from "./component";
|
|
2
|
+
/**
|
|
3
|
+
* kind of similar to <t t-slot="default"/>, but it wraps it around a VPortal
|
|
4
|
+
*/
|
|
5
|
+
export declare function portalTemplate(app: any, bdom: any, helpers: any): (ctx: any, node: any, key?: string) => any;
|
|
6
|
+
export declare class Portal extends Component {
|
|
7
|
+
static template: string;
|
|
8
|
+
props: import("./props").Props<{
|
|
9
|
+
target: string;
|
|
10
|
+
}>;
|
|
11
|
+
setup(): void;
|
|
12
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { GetOptionalEntries, KeyedObject, PrettifyShape, ResolveObjectType } from "./types";
|
|
2
|
+
declare const isProps: unique symbol;
|
|
3
|
+
export type WithDefaults<T, D> = T & Required<D>;
|
|
4
|
+
export type Props<T extends {}> = T & {
|
|
5
|
+
[isProps]: true;
|
|
6
|
+
};
|
|
7
|
+
type GetPropsDefaults<T extends object> = PrettifyShape<GetOptionalEntries<T>>;
|
|
8
|
+
type GetPropsWithOptionals<T> = T extends Props<infer P> ? (P extends WithDefaults<infer R, any> ? R : P) : never;
|
|
9
|
+
export type GetProps<T> = {
|
|
10
|
+
[K in keyof T]: T[K] extends {
|
|
11
|
+
[isProps]: true;
|
|
12
|
+
} ? (x: GetPropsWithOptionals<T[K]>) => void : never;
|
|
13
|
+
}[keyof T] extends (x: infer I) => void ? {
|
|
14
|
+
[K in keyof I]: I[K];
|
|
15
|
+
} : never;
|
|
16
|
+
export declare function props(): Props<Record<string, any>>;
|
|
17
|
+
export declare function props<const Keys extends string[]>(keys: Keys): Props<ResolveObjectType<Keys>>;
|
|
18
|
+
export declare function props<const Keys extends string[], Defaults>(keys: Keys, defaults: Defaults & GetPropsDefaults<KeyedObject<Keys>>): Props<WithDefaults<ResolveObjectType<Keys>, Defaults>>;
|
|
19
|
+
export declare function props<Shape extends {}>(shape: Shape): Props<ResolveObjectType<Shape>>;
|
|
20
|
+
export declare function props<Shape extends {}, Defaults>(shape: Shape, defaults: Defaults & GetPropsDefaults<Shape>): Props<WithDefaults<ResolveObjectType<Shape>, Defaults>>;
|
|
21
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function asyncComputed<T>(fn: () => Promise<T>): () => Promise<T>;
|