@odoo/owl 2.0.0-beta.3 → 2.0.0
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 +3 -1
- package/dist/owl.cjs.js +2077 -1794
- package/dist/owl.es.js +2076 -1795
- package/dist/owl.iife.js +2077 -1794
- package/dist/owl.iife.min.js +1 -1
- package/dist/types/compiler/code_generator.d.ts +30 -30
- package/dist/types/compiler/index.d.ts +3 -2
- package/dist/types/compiler/inline_expressions.d.ts +1 -22
- package/dist/types/compiler/parser.d.ts +2 -1
- package/dist/types/index.d.ts +1 -27
- package/dist/types/owl.d.ts +532 -0
- package/dist/types/{app → runtime}/app.d.ts +10 -5
- package/dist/types/{blockdom → runtime/blockdom}/attributes.d.ts +0 -0
- package/dist/types/{blockdom → runtime/blockdom}/block_compiler.d.ts +0 -0
- package/dist/types/{blockdom → runtime/blockdom}/config.d.ts +0 -0
- package/dist/types/{blockdom → runtime/blockdom}/event_catcher.d.ts +0 -0
- package/dist/types/{blockdom → runtime/blockdom}/events.d.ts +0 -0
- package/dist/types/{blockdom → runtime/blockdom}/html.d.ts +0 -0
- package/dist/types/{blockdom → runtime/blockdom}/index.d.ts +0 -0
- package/dist/types/{blockdom → runtime/blockdom}/list.d.ts +0 -0
- package/dist/types/{blockdom → runtime/blockdom}/multi.d.ts +0 -0
- package/dist/types/{blockdom → runtime/blockdom}/text.d.ts +0 -0
- package/dist/types/{blockdom → runtime/blockdom}/toggler.d.ts +0 -0
- package/dist/types/{component → runtime}/component.d.ts +6 -2
- package/dist/types/{component → runtime}/component_node.d.ts +13 -13
- package/dist/types/{component → runtime}/error_handling.d.ts +3 -0
- package/dist/types/{component/handler.d.ts → runtime/event_handling.d.ts} +0 -0
- package/dist/types/{component → runtime}/fibers.d.ts +5 -1
- package/dist/types/{hooks.d.ts → runtime/hooks.d.ts} +1 -1
- package/dist/types/runtime/index.d.ts +31 -0
- package/dist/types/{component → runtime}/lifecycle_hooks.d.ts +0 -0
- package/dist/types/runtime/portal.d.ts +15 -0
- package/dist/types/{reactivity.d.ts → runtime/reactivity.d.ts} +0 -0
- package/dist/types/{component → runtime}/scheduler.d.ts +3 -4
- package/dist/types/{component → runtime}/status.d.ts +0 -0
- package/dist/types/{app → runtime}/template_helpers.d.ts +17 -4
- package/dist/types/runtime/template_set.d.ts +32 -0
- package/dist/types/{utils.d.ts → runtime/utils.d.ts} +0 -7
- package/dist/types/runtime/validation.d.ts +32 -0
- package/package.json +7 -4
- package/CHANGELOG.md +0 -766
- package/dist/owl.cjs.min.js +0 -1
- package/dist/owl.es.min.js +0 -1
- package/dist/types/app/template_set.d.ts +0 -27
- package/dist/types/component/props_validation.d.ts +0 -14
- package/dist/types/portal.d.ts +0 -11
|
File without changes
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BDom } from "
|
|
1
|
+
import { BDom } from "./blockdom";
|
|
2
2
|
import type { ComponentNode } from "./component_node";
|
|
3
3
|
export declare function makeChildFiber(node: ComponentNode, parent: Fiber): Fiber;
|
|
4
4
|
export declare function makeRootFiber(node: ComponentNode): Fiber;
|
|
@@ -10,7 +10,10 @@ export declare class Fiber {
|
|
|
10
10
|
children: Fiber[];
|
|
11
11
|
appliedToDom: boolean;
|
|
12
12
|
deep: boolean;
|
|
13
|
+
childrenMap: ComponentNode["children"];
|
|
13
14
|
constructor(node: ComponentNode, parent: Fiber | null);
|
|
15
|
+
render(): void;
|
|
16
|
+
_render(): void;
|
|
14
17
|
}
|
|
15
18
|
export declare class RootFiber extends Fiber {
|
|
16
19
|
counter: number;
|
|
@@ -19,6 +22,7 @@ export declare class RootFiber extends Fiber {
|
|
|
19
22
|
mounted: Fiber[];
|
|
20
23
|
locked: boolean;
|
|
21
24
|
complete(): void;
|
|
25
|
+
setCounter(newValue: number): void;
|
|
22
26
|
}
|
|
23
27
|
declare type Position = "first-child" | "last-child";
|
|
24
28
|
export interface MountOptions {
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { createBlock, html, list, mount as blockMount, multi, patch, remove, text, toggler, comment } from "./blockdom";
|
|
2
|
+
export type { Reactive } from "./reactivity";
|
|
3
|
+
export declare const blockDom: {
|
|
4
|
+
config: {
|
|
5
|
+
shouldNormalizeDom: boolean;
|
|
6
|
+
mainEventHandler: (data: any, ev: Event, currentTarget?: EventTarget | null | undefined) => boolean;
|
|
7
|
+
};
|
|
8
|
+
mount: typeof blockMount;
|
|
9
|
+
patch: typeof patch;
|
|
10
|
+
remove: typeof remove;
|
|
11
|
+
list: typeof list;
|
|
12
|
+
multi: typeof multi;
|
|
13
|
+
text: typeof text;
|
|
14
|
+
toggler: typeof toggler;
|
|
15
|
+
createBlock: typeof createBlock;
|
|
16
|
+
html: typeof html;
|
|
17
|
+
comment: typeof comment;
|
|
18
|
+
};
|
|
19
|
+
export { App, mount } from "./app";
|
|
20
|
+
export { xml } from "./template_set";
|
|
21
|
+
export { Component } from "./component";
|
|
22
|
+
export type { ComponentConstructor } from "./component";
|
|
23
|
+
export { useComponent, useState } from "./component_node";
|
|
24
|
+
export { status } from "./status";
|
|
25
|
+
export { reactive, markRaw, toRaw } from "./reactivity";
|
|
26
|
+
export { useEffect, useEnv, useExternalListener, useRef, useChildSubEnv, useSubEnv } from "./hooks";
|
|
27
|
+
export { EventBus, whenReady, loadFile, markup } from "./utils";
|
|
28
|
+
export { onWillStart, onMounted, onWillUnmount, onWillUpdateProps, onWillPatch, onPatched, onWillRender, onRendered, onWillDestroy, onError, } from "./lifecycle_hooks";
|
|
29
|
+
export { validate } from "./validation";
|
|
30
|
+
export { OwlError } from "./error_handling";
|
|
31
|
+
export declare const __info__: {};
|
|
File without changes
|
|
@@ -0,0 +1,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
|
+
static props: {
|
|
9
|
+
target: {
|
|
10
|
+
type: StringConstructor;
|
|
11
|
+
};
|
|
12
|
+
slots: boolean;
|
|
13
|
+
};
|
|
14
|
+
setup(): void;
|
|
15
|
+
}
|
|
File without changes
|
|
@@ -2,16 +2,15 @@ import { Fiber, RootFiber } from "./fibers";
|
|
|
2
2
|
export declare class Scheduler {
|
|
3
3
|
static requestAnimationFrame: ((callback: FrameRequestCallback) => number) & typeof requestAnimationFrame;
|
|
4
4
|
tasks: Set<RootFiber>;
|
|
5
|
-
isRunning: boolean;
|
|
6
5
|
requestAnimationFrame: Window["requestAnimationFrame"];
|
|
6
|
+
frame: number;
|
|
7
|
+
delayedRenders: Fiber[];
|
|
7
8
|
constructor();
|
|
8
|
-
start(): void;
|
|
9
|
-
stop(): void;
|
|
10
9
|
addFiber(fiber: Fiber): void;
|
|
11
10
|
/**
|
|
12
11
|
* Process all current tasks. This only applies to the fibers that are ready.
|
|
13
12
|
* Other tasks are left unchanged.
|
|
14
13
|
*/
|
|
15
14
|
flush(): void;
|
|
16
|
-
|
|
15
|
+
processFiber(fiber: RootFiber): void;
|
|
17
16
|
}
|
|
File without changes
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import { BDom, toggler, createCatcher } from "
|
|
2
|
-
import {
|
|
1
|
+
import { BDom, toggler, createCatcher } from "./blockdom";
|
|
2
|
+
import type { ComponentConstructor } from "./component";
|
|
3
|
+
import { markRaw } from "./reactivity";
|
|
4
|
+
import { OwlError } from "./error_handling";
|
|
3
5
|
/**
|
|
4
6
|
* This file contains utility functions that will be injected in each template,
|
|
5
7
|
* to perform various useful tasks in the compiled code.
|
|
@@ -17,18 +19,27 @@ declare function shallowEqual(l1: any[], l2: any[]): boolean;
|
|
|
17
19
|
declare class LazyValue {
|
|
18
20
|
fn: any;
|
|
19
21
|
ctx: any;
|
|
22
|
+
component: any;
|
|
20
23
|
node: any;
|
|
21
|
-
|
|
24
|
+
key: any;
|
|
25
|
+
constructor(fn: any, ctx: any, component: any, node: any, key: any);
|
|
22
26
|
evaluate(): any;
|
|
23
27
|
toString(): any;
|
|
24
28
|
}
|
|
25
|
-
export declare function safeOutput(value: any): ReturnType<typeof toggler>;
|
|
29
|
+
export declare function safeOutput(value: any, defaultValue?: any): ReturnType<typeof toggler>;
|
|
26
30
|
declare function bind(ctx: any, fn: Function): Function;
|
|
27
31
|
declare type RefMap = {
|
|
28
32
|
[key: string]: HTMLElement | null;
|
|
29
33
|
};
|
|
30
34
|
declare type RefSetter = (el: HTMLElement | null) => void;
|
|
31
35
|
declare function multiRefSetter(refs: RefMap, name: string): RefSetter;
|
|
36
|
+
/**
|
|
37
|
+
* Validate the component props (or next props) against the (static) props
|
|
38
|
+
* description. This is potentially an expensive operation: it may needs to
|
|
39
|
+
* visit recursively the props and all the children to check if they are valid.
|
|
40
|
+
* This is why it is only done in 'dev' mode.
|
|
41
|
+
*/
|
|
42
|
+
export declare function validateProps<P>(name: string | ComponentConstructor<P>, props: P, comp?: any): void;
|
|
32
43
|
export declare const helpers: {
|
|
33
44
|
withDefault: typeof withDefault;
|
|
34
45
|
zero: symbol;
|
|
@@ -46,5 +57,7 @@ export declare const helpers: {
|
|
|
46
57
|
safeOutput: typeof safeOutput;
|
|
47
58
|
bind: typeof bind;
|
|
48
59
|
createCatcher: typeof createCatcher;
|
|
60
|
+
markRaw: typeof markRaw;
|
|
61
|
+
OwlError: typeof OwlError;
|
|
49
62
|
};
|
|
50
63
|
export {};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { compile, Template, TemplateFunction } from "../compiler";
|
|
2
|
+
import { Portal } from "./portal";
|
|
3
|
+
export interface TemplateSetConfig {
|
|
4
|
+
dev?: boolean;
|
|
5
|
+
translatableAttributes?: string[];
|
|
6
|
+
translateFn?: (s: string) => string;
|
|
7
|
+
templates?: string | Document;
|
|
8
|
+
}
|
|
9
|
+
export declare class TemplateSet {
|
|
10
|
+
static registerTemplate(name: string, fn: TemplateFunction): void;
|
|
11
|
+
dev: boolean;
|
|
12
|
+
rawTemplates: typeof globalTemplates;
|
|
13
|
+
templates: {
|
|
14
|
+
[name: string]: Template;
|
|
15
|
+
};
|
|
16
|
+
translateFn?: (s: string) => string;
|
|
17
|
+
translatableAttributes?: string[];
|
|
18
|
+
Portal: typeof Portal;
|
|
19
|
+
constructor(config?: TemplateSetConfig);
|
|
20
|
+
addTemplate(name: string, template: string | Element): void;
|
|
21
|
+
addTemplates(xml: string | Document): void;
|
|
22
|
+
getTemplate(name: string): Template;
|
|
23
|
+
_compileTemplate(name: string, template: string | Element): ReturnType<typeof compile>;
|
|
24
|
+
callTemplate(owner: any, subTemplate: string, ctx: any, parent: any, key: any): any;
|
|
25
|
+
}
|
|
26
|
+
export declare const globalTemplates: {
|
|
27
|
+
[key: string]: string | Element | TemplateFunction;
|
|
28
|
+
};
|
|
29
|
+
export declare function xml(...args: Parameters<typeof String.raw>): string;
|
|
30
|
+
export declare namespace xml {
|
|
31
|
+
var nextId: number;
|
|
32
|
+
}
|
|
@@ -16,10 +16,3 @@ export declare function loadFile(url: string): Promise<string>;
|
|
|
16
16
|
export declare class Markup extends String {
|
|
17
17
|
}
|
|
18
18
|
export declare function markup(value: any): Markup;
|
|
19
|
-
export declare const globalTemplates: {
|
|
20
|
-
[key: string]: string | Element;
|
|
21
|
-
};
|
|
22
|
-
export declare function xml(...args: Parameters<typeof String.raw>): string;
|
|
23
|
-
export declare namespace xml {
|
|
24
|
-
var nextId: number;
|
|
25
|
-
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
declare type BaseType = typeof String | typeof Boolean | typeof Number | typeof Date | typeof Object | typeof Array | true | "*";
|
|
2
|
+
interface TypeInfo {
|
|
3
|
+
type?: TypeDescription;
|
|
4
|
+
optional?: boolean;
|
|
5
|
+
validate?: Function;
|
|
6
|
+
shape?: Schema;
|
|
7
|
+
element?: TypeDescription;
|
|
8
|
+
}
|
|
9
|
+
declare type ValueType = {
|
|
10
|
+
value: any;
|
|
11
|
+
};
|
|
12
|
+
declare type TypeDescription = BaseType | TypeInfo | ValueType | TypeDescription[];
|
|
13
|
+
declare type SimplifiedSchema = string[];
|
|
14
|
+
declare type NormalizedSchema = {
|
|
15
|
+
[key: string]: TypeDescription;
|
|
16
|
+
};
|
|
17
|
+
export declare type Schema = SimplifiedSchema | NormalizedSchema;
|
|
18
|
+
export declare function isOptional(t: TypeDescription): Boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Main validate function
|
|
21
|
+
*/
|
|
22
|
+
export declare function validate(obj: {
|
|
23
|
+
[key: string]: any;
|
|
24
|
+
}, spec: Schema): void;
|
|
25
|
+
/**
|
|
26
|
+
* Helper validate function, to get the list of errors. useful if one want to
|
|
27
|
+
* manipulate the errors without parsing an error object
|
|
28
|
+
*/
|
|
29
|
+
export declare function validateSchema(obj: {
|
|
30
|
+
[key: string]: any;
|
|
31
|
+
}, schema: Schema): string[];
|
|
32
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@odoo/owl",
|
|
3
|
-
"version": "2.0.0
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "Odoo Web Library (OWL)",
|
|
5
5
|
"main": "dist/owl.cjs.js",
|
|
6
|
-
"browser": "dist/owl.iife.js",
|
|
7
6
|
"module": "dist/owl.es.js",
|
|
8
|
-
"types": "dist/types/
|
|
7
|
+
"types": "dist/types/owl.d.ts",
|
|
9
8
|
"files": [
|
|
10
9
|
"dist"
|
|
11
10
|
],
|
|
@@ -14,6 +13,8 @@
|
|
|
14
13
|
},
|
|
15
14
|
"scripts": {
|
|
16
15
|
"build:bundle": "rollup -c --failAfterWarnings",
|
|
16
|
+
"build:runtime": "rollup -c --failAfterWarnings runtime",
|
|
17
|
+
"build:compiler": "rollup -c --failAfterWarnings compiler",
|
|
17
18
|
"build": "npm run build:bundle",
|
|
18
19
|
"test": "jest",
|
|
19
20
|
"test:debug": "node --inspect-brk node_modules/.bin/jest --runInBand --watch --testTimeout=5000000",
|
|
@@ -25,7 +26,8 @@
|
|
|
25
26
|
"prettier": "prettier {src/*.ts,src/**/*.ts,tests/*.ts,tests/**/*.ts,doc/*.md,doc/**/*.md} --write",
|
|
26
27
|
"check-formatting": "prettier {src/*.ts,src/**/*.ts,tests/*.ts,tests/**/*.ts,doc/*.md,doc/**/*.md} --check",
|
|
27
28
|
"publish": "npm run build && npm publish",
|
|
28
|
-
"release": "node tools/release.js"
|
|
29
|
+
"release": "node tools/release.js",
|
|
30
|
+
"compile_templates": "node tools/compile_xml.js"
|
|
29
31
|
},
|
|
30
32
|
"repository": {
|
|
31
33
|
"type": "git",
|
|
@@ -52,6 +54,7 @@
|
|
|
52
54
|
"npm-run-all": "^4.1.5",
|
|
53
55
|
"prettier": "2.4.1",
|
|
54
56
|
"rollup": "^2.56.3",
|
|
57
|
+
"rollup-plugin-dts": "^4.2.2",
|
|
55
58
|
"rollup-plugin-terser": "^7.0.2",
|
|
56
59
|
"rollup-plugin-typescript2": "^0.31.1",
|
|
57
60
|
"sass": "^1.16.1",
|