@odoo/owl 1.4.10 → 2.0.0-alpha.1
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 +60 -66
- package/dist/owl.cjs.js +4626 -5075
- package/dist/owl.cjs.min.js +1 -15
- package/dist/owl.es.js +4598 -5065
- package/dist/owl.es.min.js +1 -15
- package/dist/owl.iife.js +4626 -5075
- package/dist/owl.iife.min.js +1 -15
- package/dist/types/app/app.d.ts +29 -0
- package/dist/types/app/template_helpers.d.ts +49 -0
- package/dist/types/app/template_set.d.ts +34 -0
- package/dist/types/blockdom/attributes.d.ts +8 -0
- package/dist/types/blockdom/block_compiler.d.ts +21 -0
- package/dist/types/blockdom/config.d.ts +8 -0
- package/dist/types/blockdom/events.d.ts +7 -0
- package/dist/types/blockdom/html.d.ts +16 -0
- package/dist/types/blockdom/index.d.ts +24 -0
- package/dist/types/blockdom/list.d.ts +17 -0
- package/dist/types/blockdom/multi.d.ts +16 -0
- package/dist/types/blockdom/text.d.ts +25 -0
- package/dist/types/blockdom/toggler.d.ts +16 -0
- package/dist/types/compiler/code_generator.d.ts +144 -0
- package/dist/types/compiler/index.d.ts +9 -0
- package/dist/types/{qweb/expression_parser.d.ts → compiler/inline_expressions.d.ts} +4 -6
- package/dist/types/compiler/parser.d.ts +157 -0
- package/dist/types/component/component.d.ts +15 -294
- package/dist/types/component/component_node.d.ts +54 -0
- package/dist/types/component/error_handling.d.ts +13 -0
- package/dist/types/component/fibers.d.ts +32 -0
- package/dist/types/component/handler.d.ts +1 -0
- package/dist/types/component/lifecycle_hooks.d.ts +12 -0
- package/dist/types/component/props_validation.d.ts +14 -1
- package/dist/types/component/scheduler.d.ts +5 -21
- package/dist/types/component/status.d.ts +9 -0
- package/dist/types/hooks.d.ts +26 -35
- package/dist/types/index.d.ts +27 -47
- package/dist/types/memo.d.ts +6 -0
- package/dist/types/portal.d.ts +11 -0
- package/dist/types/reactivity.d.ts +64 -0
- package/dist/types/utils.d.ts +14 -21
- package/package.json +14 -9
- package/dist/types/browser.d.ts +0 -12
- package/dist/types/component/directive.d.ts +0 -1
- package/dist/types/component/fiber.d.ts +0 -75
- package/dist/types/component/styles.d.ts +0 -12
- package/dist/types/config.d.ts +0 -12
- package/dist/types/context.d.ts +0 -36
- package/dist/types/core/event_bus.d.ts +0 -42
- package/dist/types/core/observer.d.ts +0 -30
- package/dist/types/core/owl_event.d.ts +0 -10
- package/dist/types/misc/async_root.d.ts +0 -13
- package/dist/types/misc/portal.d.ts +0 -70
- package/dist/types/qweb/base_directives.d.ts +0 -1
- package/dist/types/qweb/compilation_context.d.ts +0 -69
- package/dist/types/qweb/extensions.d.ts +0 -28
- package/dist/types/qweb/index.d.ts +0 -3
- package/dist/types/qweb/qweb.d.ts +0 -141
- package/dist/types/router/link.d.ts +0 -11
- package/dist/types/router/route_component.d.ts +0 -6
- package/dist/types/router/router.d.ts +0 -57
- package/dist/types/store.d.ts +0 -63
- package/dist/types/tags.d.ts +0 -29
- package/dist/types/vdom/html_to_vdom.d.ts +0 -2
- package/dist/types/vdom/index.d.ts +0 -2
- package/dist/types/vdom/modules.d.ts +0 -5
- package/dist/types/vdom/vdom.d.ts +0 -101
package/dist/types/context.d.ts
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { Component } from "./component/component";
|
|
2
|
-
import { EventBus } from "./core/event_bus";
|
|
3
|
-
import { Observer } from "./core/observer";
|
|
4
|
-
export declare class Context extends EventBus {
|
|
5
|
-
state: any;
|
|
6
|
-
observer: Observer;
|
|
7
|
-
rev: number;
|
|
8
|
-
mapping: {
|
|
9
|
-
[componentId: number]: number;
|
|
10
|
-
};
|
|
11
|
-
constructor(state?: Object);
|
|
12
|
-
/**
|
|
13
|
-
* Instead of using trigger to emit an update event, we actually implement
|
|
14
|
-
* our own function to do that. The reason is that we need to be smarter than
|
|
15
|
-
* a simple trigger function: we need to wait for parent components to be
|
|
16
|
-
* done before doing children components. More precisely, if an update
|
|
17
|
-
* as an effect of destroying a children, we do not want to call any code
|
|
18
|
-
* from the child, and certainly not render it.
|
|
19
|
-
*
|
|
20
|
-
* This method implements a simple grouping algorithm by depth. If we have
|
|
21
|
-
* connected components of depths [2, 4,4,4,4, 3,8,8], the Context will notify
|
|
22
|
-
* them in the following groups: [2], [4,4,4,4], [3], [8,8]. Each group will
|
|
23
|
-
* be updated sequentially, but each components in a given group will be done in
|
|
24
|
-
* parallel.
|
|
25
|
-
*
|
|
26
|
-
* This is a very simple algorithm, but it avoids checking if a given
|
|
27
|
-
* component is a child of another.
|
|
28
|
-
*/
|
|
29
|
-
__notifyComponents(): Promise<void>;
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* The`useContext` hook is the normal way for a component to register themselve
|
|
33
|
-
* to context state changes. The `useContext` method returns the context state
|
|
34
|
-
*/
|
|
35
|
-
export declare function useContext(ctx: Context): any;
|
|
36
|
-
export declare function useContextWithCB(ctx: Context, component: Component, method: any): any;
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* We define here a simple event bus: it can
|
|
3
|
-
* - emit events
|
|
4
|
-
* - add/remove listeners.
|
|
5
|
-
*
|
|
6
|
-
* This is a useful pattern of communication in many cases. For OWL, each
|
|
7
|
-
* components and stores are event buses.
|
|
8
|
-
*/
|
|
9
|
-
export declare type Callback = (...args: any[]) => void;
|
|
10
|
-
export interface Subscription {
|
|
11
|
-
owner: any;
|
|
12
|
-
callback: Callback;
|
|
13
|
-
}
|
|
14
|
-
export declare class EventBus {
|
|
15
|
-
subscriptions: {
|
|
16
|
-
[eventType: string]: Subscription[];
|
|
17
|
-
};
|
|
18
|
-
/**
|
|
19
|
-
* Add a listener for the 'eventType' events.
|
|
20
|
-
*
|
|
21
|
-
* Note that the 'owner' of this event can be anything, but will more likely
|
|
22
|
-
* be a component or a class. The idea is that the callback will be called with
|
|
23
|
-
* the proper owner bound.
|
|
24
|
-
*
|
|
25
|
-
* Also, the owner should be kind of unique. This will be used to remove the
|
|
26
|
-
* listener.
|
|
27
|
-
*/
|
|
28
|
-
on(eventType: string, owner: any, callback: Callback): void;
|
|
29
|
-
/**
|
|
30
|
-
* Remove a listener
|
|
31
|
-
*/
|
|
32
|
-
off(eventType: string, owner: any): void;
|
|
33
|
-
/**
|
|
34
|
-
* Emit an event of type 'eventType'. Any extra arguments will be passed to
|
|
35
|
-
* the listeners callback.
|
|
36
|
-
*/
|
|
37
|
-
trigger(eventType: string, ...args: any[]): void;
|
|
38
|
-
/**
|
|
39
|
-
* Remove all subscriptions.
|
|
40
|
-
*/
|
|
41
|
-
clear(): void;
|
|
42
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Owl Observer
|
|
3
|
-
*
|
|
4
|
-
* This code contains the logic that allows Owl to observe and react to state
|
|
5
|
-
* changes.
|
|
6
|
-
*
|
|
7
|
-
* This is a Observer class that can observe any JS values. The way it works
|
|
8
|
-
* can be summarized thusly:
|
|
9
|
-
* - primitive values are not observed at all
|
|
10
|
-
* - Objects and arrays are observed by replacing them with a Proxy
|
|
11
|
-
* - each object/array metadata are tracked in a weakmap, and keep a revision
|
|
12
|
-
* number
|
|
13
|
-
*
|
|
14
|
-
* Note that this code is loosely inspired by Vue.
|
|
15
|
-
*/
|
|
16
|
-
export declare class Observer {
|
|
17
|
-
rev: number;
|
|
18
|
-
allowMutations: boolean;
|
|
19
|
-
weakMap: WeakMap<any, any>;
|
|
20
|
-
notifyCB(): void;
|
|
21
|
-
observe<T>(value: T, parent?: any): T;
|
|
22
|
-
revNumber(value: any): number;
|
|
23
|
-
_observe(value: any, parent: any): {
|
|
24
|
-
value: any;
|
|
25
|
-
proxy: any;
|
|
26
|
-
rev: number;
|
|
27
|
-
parent: any;
|
|
28
|
-
};
|
|
29
|
-
_updateRevNumber(target: any): void;
|
|
30
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { Component } from "../component/component";
|
|
2
|
-
/**
|
|
3
|
-
* We define here OwlEvent, a subclass of CustomEvent, with an additional
|
|
4
|
-
* attribute:
|
|
5
|
-
* - originalComponent: the component that triggered the event
|
|
6
|
-
*/
|
|
7
|
-
export declare class OwlEvent<T> extends CustomEvent<T> {
|
|
8
|
-
originalComponent: Component;
|
|
9
|
-
constructor(component: any, eventType: any, options: any);
|
|
10
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { Component } from "../component/component";
|
|
2
|
-
/**
|
|
3
|
-
* AsyncRoot
|
|
4
|
-
*
|
|
5
|
-
* Owl is by default asynchronous, and the user interface will wait for all its
|
|
6
|
-
* subcomponents to be rendered before updating the DOM. This is most of the
|
|
7
|
-
* time what we want, but in some cases, it makes sense to "detach" a component
|
|
8
|
-
* from this coordination. This is the goal of the AsyncRoot component.
|
|
9
|
-
*/
|
|
10
|
-
export declare class AsyncRoot extends Component {
|
|
11
|
-
static template: string;
|
|
12
|
-
__updateProps(nextProps: any, parentFiber: any): Promise<void>;
|
|
13
|
-
}
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import { Component } from "../component/component";
|
|
2
|
-
import { VNode } from "../vdom/index";
|
|
3
|
-
import { OwlEvent } from "../core/owl_event";
|
|
4
|
-
/**
|
|
5
|
-
* Portal
|
|
6
|
-
*
|
|
7
|
-
* The Portal component allows to render a part of a component outside it's DOM.
|
|
8
|
-
* It is for example useful for dialogs: for css reasons, dialogs are in general
|
|
9
|
-
* placed in a specific spot of the DOM (e.g. directly in the body). With the
|
|
10
|
-
* Portal, a component can conditionally specify in its tempate that it contains
|
|
11
|
-
* a dialog, and where this dialog should be inserted in the DOM.
|
|
12
|
-
*
|
|
13
|
-
* The Portal component ensures that the communication between the content of
|
|
14
|
-
* the Portal and its parent properly works: business events reaching the Portal
|
|
15
|
-
* are re-triggered on an empty <portal> node located in the parent's DOM.
|
|
16
|
-
*/
|
|
17
|
-
interface Props {
|
|
18
|
-
target: string;
|
|
19
|
-
}
|
|
20
|
-
export declare class Portal extends Component<Props> {
|
|
21
|
-
static template: string;
|
|
22
|
-
static props: {
|
|
23
|
-
target: {
|
|
24
|
-
type: StringConstructor;
|
|
25
|
-
};
|
|
26
|
-
};
|
|
27
|
-
doTargetLookUp: boolean;
|
|
28
|
-
_handledEvents: Set<string>;
|
|
29
|
-
_handlerTunnel: (f: OwlEvent<any>) => void;
|
|
30
|
-
parentEnv: any;
|
|
31
|
-
portal: VNode | null;
|
|
32
|
-
target: Element | null;
|
|
33
|
-
constructor(parent: any, props: any);
|
|
34
|
-
/**
|
|
35
|
-
* Override to revert back to a classic Component's structure
|
|
36
|
-
*
|
|
37
|
-
* @override
|
|
38
|
-
*/
|
|
39
|
-
__callWillUnmount(): void;
|
|
40
|
-
/**
|
|
41
|
-
* At each DOM change, we must ensure that the portal contains exactly one
|
|
42
|
-
* child
|
|
43
|
-
*/
|
|
44
|
-
__checkVNodeStructure(vnode: VNode): void;
|
|
45
|
-
/**
|
|
46
|
-
* Ensure the target is still there at whichever time we render
|
|
47
|
-
*/
|
|
48
|
-
__checkTargetPresence(): void;
|
|
49
|
-
/**
|
|
50
|
-
* Move the portal's element to the target
|
|
51
|
-
*/
|
|
52
|
-
__deployPortal(): void;
|
|
53
|
-
/**
|
|
54
|
-
* Override to remove from the DOM the element we have teleported
|
|
55
|
-
*
|
|
56
|
-
* @override
|
|
57
|
-
*/
|
|
58
|
-
__destroy(parent: any): void;
|
|
59
|
-
/**
|
|
60
|
-
* Override to patch the element that has been teleported
|
|
61
|
-
*
|
|
62
|
-
* @override
|
|
63
|
-
*/
|
|
64
|
-
__patch(target: any, vnode: any): void;
|
|
65
|
-
/**
|
|
66
|
-
* Override to set the env
|
|
67
|
-
*/
|
|
68
|
-
__trigger(component: Component, eventType: string, payload?: any): void;
|
|
69
|
-
}
|
|
70
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import { QWebVar } from "./expression_parser";
|
|
2
|
-
export declare const INTERP_REGEXP: RegExp;
|
|
3
|
-
export declare class CompilationContext {
|
|
4
|
-
static nextID: number;
|
|
5
|
-
code: string[];
|
|
6
|
-
variables: {
|
|
7
|
-
[key: string]: QWebVar;
|
|
8
|
-
};
|
|
9
|
-
escaping: boolean;
|
|
10
|
-
parentNode: number | null | string;
|
|
11
|
-
parentTextNode: number | null;
|
|
12
|
-
rootNode: number | null;
|
|
13
|
-
indentLevel: number;
|
|
14
|
-
rootContext: CompilationContext;
|
|
15
|
-
shouldDefineParent: boolean;
|
|
16
|
-
shouldDefineScope: boolean;
|
|
17
|
-
protectedScopeNumber: number;
|
|
18
|
-
shouldDefineQWeb: boolean;
|
|
19
|
-
shouldDefineUtils: boolean;
|
|
20
|
-
shouldDefineRefs: boolean;
|
|
21
|
-
shouldDefineResult: boolean;
|
|
22
|
-
loopNumber: number;
|
|
23
|
-
inPreTag: boolean;
|
|
24
|
-
templateName: string;
|
|
25
|
-
allowMultipleRoots: boolean;
|
|
26
|
-
hasParentWidget: boolean;
|
|
27
|
-
hasKey0: boolean;
|
|
28
|
-
keyStack: boolean[];
|
|
29
|
-
constructor(name?: string);
|
|
30
|
-
generateID(): number;
|
|
31
|
-
/**
|
|
32
|
-
* This method generates a "template key", which is basically a unique key
|
|
33
|
-
* which depends on the currently set keys, and on the iteration numbers (if
|
|
34
|
-
* we are in a loop).
|
|
35
|
-
*
|
|
36
|
-
* Such a key is necessary when we need to associate an id to some element
|
|
37
|
-
* generated by a template (for example, a component)
|
|
38
|
-
*/
|
|
39
|
-
generateTemplateKey(prefix?: string): string;
|
|
40
|
-
generateCode(): string[];
|
|
41
|
-
withParent(node: number): CompilationContext;
|
|
42
|
-
subContext(key: keyof CompilationContext, value: any): CompilationContext;
|
|
43
|
-
indent(): void;
|
|
44
|
-
dedent(): void;
|
|
45
|
-
addLine(line: string): number;
|
|
46
|
-
addIf(condition: string): void;
|
|
47
|
-
addElse(): void;
|
|
48
|
-
closeIf(): void;
|
|
49
|
-
getValue(val: any): QWebVar | string;
|
|
50
|
-
/**
|
|
51
|
-
* Prepare an expression for being consumed at render time. Its main job
|
|
52
|
-
* is to
|
|
53
|
-
* - replace unknown variables by a lookup in the context
|
|
54
|
-
* - replace already defined variables by their internal name
|
|
55
|
-
*/
|
|
56
|
-
formatExpression(expr: string): string;
|
|
57
|
-
captureExpression(expr: string): string;
|
|
58
|
-
/**
|
|
59
|
-
* Perform string interpolation on the given string. Note that if the whole
|
|
60
|
-
* string is an expression, it simply returns it (formatted and enclosed in
|
|
61
|
-
* parentheses).
|
|
62
|
-
* For instance:
|
|
63
|
-
* 'Hello {{x}}!' -> `Hello ${x}`
|
|
64
|
-
* '{{x ? 'a': 'b'}}' -> (x ? 'a' : 'b')
|
|
65
|
-
*/
|
|
66
|
-
interpolate(s: string): string;
|
|
67
|
-
startProtectScope(codeBlock?: boolean): number;
|
|
68
|
-
stopProtectScope(protectID: number): void;
|
|
69
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Owl QWeb Extensions
|
|
3
|
-
*
|
|
4
|
-
* This file contains the implementation of non standard QWeb directives, added
|
|
5
|
-
* by Owl and that will only work on Owl projects:
|
|
6
|
-
*
|
|
7
|
-
* - t-on
|
|
8
|
-
* - t-ref
|
|
9
|
-
* - t-transition
|
|
10
|
-
* - t-mounted
|
|
11
|
-
* - t-slot
|
|
12
|
-
* - t-model
|
|
13
|
-
*/
|
|
14
|
-
export declare const MODS_CODE: {
|
|
15
|
-
prevent: string;
|
|
16
|
-
self: string;
|
|
17
|
-
stop: string;
|
|
18
|
-
};
|
|
19
|
-
interface HandlerInfo {
|
|
20
|
-
event: string;
|
|
21
|
-
handler: string;
|
|
22
|
-
}
|
|
23
|
-
export declare function makeHandlerCode(ctx: any, fullName: any, value: any, putInCache: boolean, modcodes?: {
|
|
24
|
-
prevent: string;
|
|
25
|
-
self: string;
|
|
26
|
-
stop: string;
|
|
27
|
-
}): HandlerInfo;
|
|
28
|
-
export {};
|
|
@@ -1,141 +0,0 @@
|
|
|
1
|
-
import { EventBus } from "../core/event_bus";
|
|
2
|
-
import { h, VNode } from "../vdom/index";
|
|
3
|
-
import { CompilationContext } from "./compilation_context";
|
|
4
|
-
/**
|
|
5
|
-
* Owl QWeb Engine
|
|
6
|
-
*
|
|
7
|
-
* In this file, you will find a QWeb engine/template compiler. It is the core
|
|
8
|
-
* of how Owl component works.
|
|
9
|
-
*
|
|
10
|
-
* Briefly, Owl QWeb compiles XML templates into functions that output a virtual
|
|
11
|
-
* DOM representation.
|
|
12
|
-
*
|
|
13
|
-
* We have here:
|
|
14
|
-
* - a CompilationContext class, which is an internal object that contains all
|
|
15
|
-
* compilation specific information, while a template is being compiled.
|
|
16
|
-
* - a QWeb class: this is the code of the QWeb compiler.
|
|
17
|
-
*
|
|
18
|
-
* Note that this file does not contain the implementation of the QWeb
|
|
19
|
-
* directives (see qweb_directives.ts and qweb_extensions.ts).
|
|
20
|
-
*/
|
|
21
|
-
export declare type EvalContext = {
|
|
22
|
-
[key: string]: any;
|
|
23
|
-
};
|
|
24
|
-
export declare type CompiledTemplate = (context: EvalContext, extra: any) => VNode;
|
|
25
|
-
interface Template {
|
|
26
|
-
elem: Element;
|
|
27
|
-
fn: CompiledTemplate;
|
|
28
|
-
}
|
|
29
|
-
interface CompilationInfo {
|
|
30
|
-
node: Element;
|
|
31
|
-
qweb: QWeb;
|
|
32
|
-
ctx: CompilationContext;
|
|
33
|
-
fullName: string;
|
|
34
|
-
value: string;
|
|
35
|
-
}
|
|
36
|
-
interface NodeCreationCompilationInfo extends CompilationInfo {
|
|
37
|
-
nodeID: number;
|
|
38
|
-
addNodeHook: Function;
|
|
39
|
-
}
|
|
40
|
-
export interface Directive {
|
|
41
|
-
name: string;
|
|
42
|
-
extraNames?: string[];
|
|
43
|
-
priority: number;
|
|
44
|
-
atNodeEncounter?(info: CompilationInfo): boolean | void;
|
|
45
|
-
atNodeCreation?(info: NodeCreationCompilationInfo): void;
|
|
46
|
-
finalize?(info: CompilationInfo): void;
|
|
47
|
-
}
|
|
48
|
-
interface QWebConfig {
|
|
49
|
-
templates?: string;
|
|
50
|
-
translateFn?(text: string): string;
|
|
51
|
-
}
|
|
52
|
-
export declare const TRANSLATABLE_ATTRS: string[];
|
|
53
|
-
interface Utils {
|
|
54
|
-
toClassObj(expr: any): Object;
|
|
55
|
-
shallowEqual(p1: Object, p2: Object): boolean;
|
|
56
|
-
[key: string]: any;
|
|
57
|
-
}
|
|
58
|
-
export declare class QWeb extends EventBus {
|
|
59
|
-
templates: {
|
|
60
|
-
[name: string]: Template;
|
|
61
|
-
};
|
|
62
|
-
static utils: Utils;
|
|
63
|
-
static components: any;
|
|
64
|
-
static DIRECTIVE_NAMES: {
|
|
65
|
-
[key: string]: 1;
|
|
66
|
-
};
|
|
67
|
-
static DIRECTIVES: Directive[];
|
|
68
|
-
static TEMPLATES: {
|
|
69
|
-
[name: string]: Template;
|
|
70
|
-
};
|
|
71
|
-
static nextId: number;
|
|
72
|
-
h: typeof h;
|
|
73
|
-
static dev: boolean;
|
|
74
|
-
static enableTransitions: boolean;
|
|
75
|
-
static slots: {};
|
|
76
|
-
static nextSlotId: number;
|
|
77
|
-
subTemplates: {
|
|
78
|
-
[key: string]: number;
|
|
79
|
-
};
|
|
80
|
-
static subTemplates: {
|
|
81
|
-
[id: number]: Function;
|
|
82
|
-
};
|
|
83
|
-
isUpdating: boolean;
|
|
84
|
-
translateFn?: QWebConfig["translateFn"];
|
|
85
|
-
constructor(config?: QWebConfig);
|
|
86
|
-
static addDirective(directive: Directive): void;
|
|
87
|
-
static registerComponent(name: string, Component: any): void;
|
|
88
|
-
/**
|
|
89
|
-
* Register globally a template. All QWeb instances will obtain their
|
|
90
|
-
* templates from their own template map, and then, from the global static
|
|
91
|
-
* TEMPLATES property.
|
|
92
|
-
*/
|
|
93
|
-
static registerTemplate(name: string, template: string): void;
|
|
94
|
-
/**
|
|
95
|
-
* Add a template to the internal template map. Note that it is not
|
|
96
|
-
* immediately compiled.
|
|
97
|
-
*/
|
|
98
|
-
addTemplate(name: string, xmlString: string, allowDuplicate?: boolean): void;
|
|
99
|
-
/**
|
|
100
|
-
* Load templates from a xml (as a string or xml document). This will look up
|
|
101
|
-
* for the first <templates> tag, and will consider each child of this as a
|
|
102
|
-
* template, with the name given by the t-name attribute.
|
|
103
|
-
*/
|
|
104
|
-
addTemplates(xmlstr: string | Document): void;
|
|
105
|
-
_addTemplate(name: string, elem: Element): void;
|
|
106
|
-
_processTemplate(elem: Element): void;
|
|
107
|
-
/**
|
|
108
|
-
* Render a template
|
|
109
|
-
*
|
|
110
|
-
* @param {string} name the template should already have been added
|
|
111
|
-
*/
|
|
112
|
-
render(name: string, context?: EvalContext, extra?: any): VNode;
|
|
113
|
-
/**
|
|
114
|
-
* Render a template to a html string.
|
|
115
|
-
*
|
|
116
|
-
* Note that this is more limited than the `render` method: it is not suitable
|
|
117
|
-
* to render a full component tree, since this is an asynchronous operation.
|
|
118
|
-
* This method can only render templates without components.
|
|
119
|
-
*/
|
|
120
|
-
renderToString(name: string, context?: EvalContext, extra?: any): string;
|
|
121
|
-
/**
|
|
122
|
-
* Force all widgets connected to this QWeb instance to rerender themselves.
|
|
123
|
-
*
|
|
124
|
-
* This method is mostly useful for external code that want to modify the
|
|
125
|
-
* application in some cases. For example, a router plugin.
|
|
126
|
-
*/
|
|
127
|
-
forceUpdate(): void;
|
|
128
|
-
_compile(name: string, options?: {
|
|
129
|
-
elem?: Element;
|
|
130
|
-
hasParent?: boolean;
|
|
131
|
-
defineKey?: boolean;
|
|
132
|
-
}): CompiledTemplate;
|
|
133
|
-
/**
|
|
134
|
-
* Generate code from an xml node
|
|
135
|
-
*
|
|
136
|
-
*/
|
|
137
|
-
_compileNode(node: ChildNode, ctx: CompilationContext): void;
|
|
138
|
-
_compileGenericNode(node: ChildNode, ctx: CompilationContext, withHandlers?: boolean): number;
|
|
139
|
-
_compileChildren(node: ChildNode, ctx: CompilationContext): void;
|
|
140
|
-
}
|
|
141
|
-
export {};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { Component } from "../component/component";
|
|
2
|
-
import { Destination, RouterEnv } from "./router";
|
|
3
|
-
declare type Props = Destination;
|
|
4
|
-
export declare class Link<Env extends RouterEnv> extends Component<Props, Env> {
|
|
5
|
-
static template: string;
|
|
6
|
-
href: string;
|
|
7
|
-
willUpdateProps(nextProps: any): Promise<void>;
|
|
8
|
-
get isActive(): boolean;
|
|
9
|
-
navigate(ev: any): void;
|
|
10
|
-
}
|
|
11
|
-
export {};
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import { Env } from "../component/component";
|
|
2
|
-
declare type NavigationGuard = (info: {
|
|
3
|
-
env: Env;
|
|
4
|
-
to: Route | null;
|
|
5
|
-
from: Route | null;
|
|
6
|
-
}) => boolean | Destination;
|
|
7
|
-
export interface Route {
|
|
8
|
-
name: string;
|
|
9
|
-
path: string;
|
|
10
|
-
extractionRegExp: RegExp;
|
|
11
|
-
component?: any;
|
|
12
|
-
redirect?: Destination;
|
|
13
|
-
params: string[];
|
|
14
|
-
beforeRouteEnter?: NavigationGuard;
|
|
15
|
-
}
|
|
16
|
-
export declare type RouteParams = {
|
|
17
|
-
[key: string]: string | number;
|
|
18
|
-
};
|
|
19
|
-
export interface RouterEnv extends Env {
|
|
20
|
-
router: Router;
|
|
21
|
-
}
|
|
22
|
-
export interface Destination {
|
|
23
|
-
path?: string;
|
|
24
|
-
to?: string;
|
|
25
|
-
params?: RouteParams;
|
|
26
|
-
}
|
|
27
|
-
interface Options {
|
|
28
|
-
mode: Router["mode"];
|
|
29
|
-
}
|
|
30
|
-
export interface EnvWithRouter extends Env {
|
|
31
|
-
router: Router;
|
|
32
|
-
}
|
|
33
|
-
export declare class Router {
|
|
34
|
-
currentRoute: Route | null;
|
|
35
|
-
currentParams: RouteParams | null;
|
|
36
|
-
mode: "history" | "hash";
|
|
37
|
-
routes: {
|
|
38
|
-
[id: string]: Route;
|
|
39
|
-
};
|
|
40
|
-
routeIds: string[];
|
|
41
|
-
env: RouterEnv;
|
|
42
|
-
constructor(env: Partial<EnvWithRouter>, routes: Partial<Route>[], options?: Options);
|
|
43
|
-
start(): Promise<void>;
|
|
44
|
-
navigate(to: Destination): Promise<boolean>;
|
|
45
|
-
_navigate(path: string, ev?: any): Promise<boolean>;
|
|
46
|
-
destToPath(dest: Destination): string;
|
|
47
|
-
get currentRouteName(): string | null;
|
|
48
|
-
private setUrlFromPath;
|
|
49
|
-
private validateDestination;
|
|
50
|
-
private routeToPath;
|
|
51
|
-
private currentPath;
|
|
52
|
-
private match;
|
|
53
|
-
private matchAndApplyRules;
|
|
54
|
-
private applyRules;
|
|
55
|
-
private getRouteParams;
|
|
56
|
-
}
|
|
57
|
-
export {};
|
package/dist/types/store.d.ts
DELETED
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import { Env } from "./component/component";
|
|
2
|
-
import { Context } from "./context";
|
|
3
|
-
/**
|
|
4
|
-
* Owl Store
|
|
5
|
-
*
|
|
6
|
-
* We have here:
|
|
7
|
-
* - a Store class
|
|
8
|
-
* - useStore hook
|
|
9
|
-
* - useDispatch hook
|
|
10
|
-
* - useGetters hook
|
|
11
|
-
*
|
|
12
|
-
* The Owl store is our answer to the problem of managing complex state across
|
|
13
|
-
* components. The main idea is that the store owns some state, allow external
|
|
14
|
-
* code to modify it through actions, and for each state changes,
|
|
15
|
-
* connected component will be notified, and updated if necessary.
|
|
16
|
-
*
|
|
17
|
-
* Note that this code is partly inspired by VueX and React/Redux
|
|
18
|
-
*/
|
|
19
|
-
export interface EnvWithStore extends Env {
|
|
20
|
-
store: Store;
|
|
21
|
-
}
|
|
22
|
-
export declare type Action = ({ state, dispatch, env, getters }: {
|
|
23
|
-
state: any;
|
|
24
|
-
dispatch: any;
|
|
25
|
-
env: any;
|
|
26
|
-
getters: any;
|
|
27
|
-
}, ...payload: any) => any;
|
|
28
|
-
export declare type Getter = ({ state: any, getters }: {
|
|
29
|
-
state: any;
|
|
30
|
-
getters: any;
|
|
31
|
-
}, payload?: any) => any;
|
|
32
|
-
interface StoreConfig {
|
|
33
|
-
env?: Env;
|
|
34
|
-
state?: any;
|
|
35
|
-
actions?: {
|
|
36
|
-
[name: string]: Action;
|
|
37
|
-
};
|
|
38
|
-
getters?: {
|
|
39
|
-
[name: string]: Getter;
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
|
-
export declare class Store extends Context {
|
|
43
|
-
actions: any;
|
|
44
|
-
env: any;
|
|
45
|
-
getters: {
|
|
46
|
-
[name: string]: (payload?: any) => any;
|
|
47
|
-
};
|
|
48
|
-
updateFunctions: {
|
|
49
|
-
[key: number]: (() => boolean)[];
|
|
50
|
-
};
|
|
51
|
-
constructor(config: StoreConfig);
|
|
52
|
-
dispatch(action: string, ...payload: any): Promise<void> | void;
|
|
53
|
-
__notifyComponents(): Promise<void>;
|
|
54
|
-
}
|
|
55
|
-
interface SelectorOptions {
|
|
56
|
-
store?: Store;
|
|
57
|
-
isEqual?: (a: any, b: any) => boolean;
|
|
58
|
-
onUpdate?: (result: any) => any;
|
|
59
|
-
}
|
|
60
|
-
export declare function useStore(selector: any, options?: SelectorOptions): any;
|
|
61
|
-
export declare function useDispatch(store?: Store): Store["dispatch"];
|
|
62
|
-
export declare function useGetters(store?: Store): Store["getters"];
|
|
63
|
-
export {};
|
package/dist/types/tags.d.ts
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Owl Tags
|
|
3
|
-
*
|
|
4
|
-
* We have here a (very) small collection of tag functions:
|
|
5
|
-
*
|
|
6
|
-
* - xml
|
|
7
|
-
*
|
|
8
|
-
* The plan is to add a few other tags such as css, globalcss.
|
|
9
|
-
*/
|
|
10
|
-
/**
|
|
11
|
-
* XML tag helper for defining templates. With this, one can simply define
|
|
12
|
-
* an inline template with just the template xml:
|
|
13
|
-
* ```js
|
|
14
|
-
* class A extends Component {
|
|
15
|
-
* static template = xml`<div>some template</div>`;
|
|
16
|
-
* }
|
|
17
|
-
* ```
|
|
18
|
-
*/
|
|
19
|
-
export declare function xml(strings: any, ...args: any[]): string;
|
|
20
|
-
/**
|
|
21
|
-
* CSS tag helper for defining inline stylesheets. With this, one can simply define
|
|
22
|
-
* an inline stylesheet with just the following code:
|
|
23
|
-
* ```js
|
|
24
|
-
* class A extends Component {
|
|
25
|
-
* static style = css`.component-a { color: red; }`;
|
|
26
|
-
* }
|
|
27
|
-
* ```
|
|
28
|
-
*/
|
|
29
|
-
export declare function css(strings: any, ...args: any[]): string;
|