@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.
Files changed (72) hide show
  1. package/dist/compile_templates.mjs +2430 -2532
  2. package/dist/compiler.js +2371 -0
  3. package/dist/owl.cjs.js +6571 -6615
  4. package/dist/owl.cjs.runtime.js +4070 -0
  5. package/dist/owl.es.js +6559 -6599
  6. package/dist/owl.es.runtime.js +4026 -0
  7. package/dist/owl.iife.js +6572 -6616
  8. package/dist/owl.iife.min.js +1 -1
  9. package/dist/owl.iife.runtime.js +4074 -0
  10. package/dist/owl.iife.runtime.min.js +1 -0
  11. package/dist/types/common/owl_error.d.ts +3 -3
  12. package/dist/types/common/types.d.ts +0 -28
  13. package/dist/types/common/utils.d.ts +8 -8
  14. package/dist/types/compiler/code_generator.d.ts +134 -152
  15. package/dist/types/compiler/index.d.ts +13 -13
  16. package/dist/types/compiler/inline_expressions.d.ts +58 -59
  17. package/dist/types/compiler/parser.d.ts +175 -178
  18. package/dist/types/compiler/standalone/index.d.ts +2 -2
  19. package/dist/types/compiler/standalone/setup_jsdom.d.ts +1 -1
  20. package/dist/types/index.d.ts +1 -1
  21. package/dist/types/owl.d.ts +703 -665
  22. package/dist/types/runtime/app.d.ts +55 -62
  23. package/dist/types/runtime/blockdom/attributes.d.ts +6 -6
  24. package/dist/types/runtime/blockdom/block_compiler.d.ts +21 -21
  25. package/dist/types/runtime/blockdom/config.d.ts +8 -8
  26. package/dist/types/runtime/blockdom/event_catcher.d.ts +7 -7
  27. package/dist/types/runtime/blockdom/events.d.ts +8 -8
  28. package/dist/types/runtime/blockdom/html.d.ts +17 -17
  29. package/dist/types/runtime/blockdom/index.d.ts +25 -26
  30. package/dist/types/runtime/blockdom/list.d.ts +18 -18
  31. package/dist/types/runtime/blockdom/multi.d.ts +17 -17
  32. package/dist/types/runtime/blockdom/text.d.ts +26 -26
  33. package/dist/types/runtime/blockdom/toggler.d.ts +17 -17
  34. package/dist/types/runtime/component.d.ts +17 -28
  35. package/dist/types/runtime/component_node.d.ts +57 -83
  36. package/dist/types/runtime/context.d.ts +36 -0
  37. package/dist/types/runtime/event_handling.d.ts +1 -1
  38. package/dist/types/runtime/hooks.d.ts +32 -57
  39. package/dist/types/runtime/index.d.ts +46 -35
  40. package/dist/types/runtime/lifecycle_hooks.d.ts +10 -12
  41. package/dist/types/runtime/model.d.ts +48 -0
  42. package/dist/types/runtime/plugin_hooks.d.ts +6 -0
  43. package/dist/types/runtime/plugin_manager.d.ts +34 -0
  44. package/dist/types/runtime/plugins.d.ts +36 -39
  45. package/dist/types/runtime/portal.d.ts +12 -15
  46. package/dist/types/runtime/props.d.ts +21 -0
  47. package/dist/types/runtime/reactivity/async_computed.d.ts +1 -0
  48. package/dist/types/runtime/reactivity/computations.d.ts +33 -0
  49. package/dist/types/runtime/reactivity/computed.d.ts +6 -0
  50. package/dist/types/runtime/reactivity/derived.d.ts +7 -0
  51. package/dist/types/runtime/reactivity/effect.d.ts +1 -0
  52. package/dist/types/runtime/reactivity/proxy.d.ts +47 -0
  53. package/dist/types/runtime/reactivity/reactivity.d.ts +46 -0
  54. package/dist/types/runtime/reactivity/signal.d.ts +31 -0
  55. package/dist/types/runtime/reactivity/signals.d.ts +30 -0
  56. package/dist/types/runtime/reactivity/state.d.ts +48 -0
  57. package/dist/types/runtime/reactivity.d.ts +12 -1
  58. package/dist/types/runtime/registry.d.ts +24 -15
  59. package/dist/types/runtime/rendering/error_handling.d.ts +13 -0
  60. package/dist/types/runtime/rendering/fibers.d.ts +37 -0
  61. package/dist/types/runtime/rendering/scheduler.d.ts +21 -0
  62. package/dist/types/runtime/rendering/template_helpers.d.ts +51 -0
  63. package/dist/types/runtime/resource.d.ts +18 -0
  64. package/dist/types/runtime/signals.d.ts +6 -4
  65. package/dist/types/runtime/status.d.ts +11 -10
  66. package/dist/types/runtime/suspense.d.ts +5 -0
  67. package/dist/types/runtime/template_set.d.ts +36 -40
  68. package/dist/types/runtime/types.d.ts +67 -0
  69. package/dist/types/runtime/utils.d.ts +24 -25
  70. package/dist/types/runtime/validation.d.ts +19 -36
  71. package/dist/types/version.d.ts +1 -1
  72. package/package.json +22 -19
@@ -0,0 +1,67 @@
1
+ import { ReactiveValue } from "./reactivity/computations";
2
+ type Constructor<T = any> = {
3
+ new (...args: any[]): T;
4
+ };
5
+ export type GetOptionalEntries<T> = {
6
+ [K in keyof T as K extends `${infer P}?` ? P : never]?: T[K];
7
+ };
8
+ export type GetRequiredEntries<T> = {
9
+ [K in keyof T as K extends `${string}?` ? never : K]: T[K];
10
+ };
11
+ export type PrettifyShape<T> = T extends Function ? T : {
12
+ [K in keyof T]: T[K];
13
+ };
14
+ type ResolveOptionalEntries<T> = PrettifyShape<GetRequiredEntries<T> & GetOptionalEntries<T>>;
15
+ export type KeyedObject<K extends string[]> = {
16
+ [P in K[number]]: any;
17
+ };
18
+ type ResolveShapedObject<T extends {}> = PrettifyShape<ResolveOptionalEntries<T>>;
19
+ export type ResolveObjectType<T extends {}> = ResolveShapedObject<T extends string[] ? KeyedObject<T> : T>;
20
+ type UnionToIntersection<U> = (U extends any ? (_: U) => any : never) extends (_: infer I) => void ? I : never;
21
+ declare function arrayType(): any[];
22
+ declare function arrayType<T>(elementType: T): T[];
23
+ declare function constructorType<T extends Constructor>(constructor: T): T;
24
+ declare function customValidator<T>(type: T, validator: (value: T) => boolean, errorMessage?: string): T;
25
+ declare function functionType(): (...parameters: any[]) => any;
26
+ declare function functionType<const P extends any[]>(parameters: P): (...parameters: P) => void;
27
+ declare function functionType<const P extends any[], R>(parameters: P, result: R): (...parameters: P) => R;
28
+ declare function instanceType<T extends Constructor>(constructor: T): InstanceType<T>;
29
+ declare function intersection<T extends any[]>(types: T): UnionToIntersection<T[number]>;
30
+ type LiteralTypes = number | string | boolean | null | undefined;
31
+ declare function literalType<const T extends LiteralTypes>(literal: T): T;
32
+ declare function literalSelection<const T extends LiteralTypes>(literals: T[]): T;
33
+ declare function objectType(): Record<string, any>;
34
+ declare function objectType<const Keys extends string[]>(keys: Keys): ResolveOptionalEntries<KeyedObject<Keys>>;
35
+ declare function objectType<Shape extends {}>(shape: Shape): ResolveOptionalEntries<Shape>;
36
+ declare function promiseType(): Promise<void>;
37
+ declare function promiseType<T>(type: T): Promise<T>;
38
+ declare function recordType(): Record<PropertyKey, any>;
39
+ declare function recordType<V>(valueType: V): Record<PropertyKey, V>;
40
+ declare function tuple<const T extends any[]>(types: T): T;
41
+ declare function union<T extends any[]>(types: T): T[number];
42
+ declare function reactiveValueType(): ReactiveValue<any>;
43
+ declare function reactiveValueType<T>(type: T): ReactiveValue<T>;
44
+ declare function ref(): HTMLElement | null;
45
+ declare function ref<T extends Constructor<HTMLElement>>(type: T): InstanceType<T> | null;
46
+ export declare const types: {
47
+ and: typeof intersection;
48
+ any: any;
49
+ array: typeof arrayType;
50
+ boolean: boolean;
51
+ constructor: typeof constructorType;
52
+ customValidator: typeof customValidator;
53
+ function: typeof functionType;
54
+ instanceOf: typeof instanceType;
55
+ literal: typeof literalType;
56
+ number: number;
57
+ object: typeof objectType;
58
+ or: typeof union;
59
+ promise: typeof promiseType;
60
+ record: typeof recordType;
61
+ ref: typeof ref;
62
+ selection: typeof literalSelection;
63
+ signal: typeof reactiveValueType;
64
+ string: string;
65
+ tuple: typeof tuple;
66
+ };
67
+ export {};
@@ -1,25 +1,24 @@
1
- export declare type Callback = () => void;
2
- /**
3
- * Creates a batched version of a callback so that all calls to it in the same
4
- * microtick will only call the original callback once.
5
- *
6
- * @param callback the callback to batch
7
- * @returns a batched version of the original callback
8
- */
9
- export declare function batched(callback: Callback): Callback;
10
- /**
11
- * Determine whether the given element is contained in its ownerDocument:
12
- * either directly or with a shadow root in between.
13
- */
14
- export declare function inOwnerDocument(el?: HTMLElement): boolean;
15
- export declare function validateTarget(target: HTMLElement | ShadowRoot): void;
16
- export declare class EventBus extends EventTarget {
17
- trigger(name: string, payload?: any): void;
18
- }
19
- export declare function whenReady(fn?: any): Promise<void>;
20
- export declare function loadFile(url: string): Promise<string>;
21
- export declare class Markup extends String {
22
- }
23
- export declare function htmlEscape(str: any): Markup;
24
- export declare function markup(strings: TemplateStringsArray, ...placeholders: unknown[]): Markup;
25
- export declare function markup(value: string): Markup;
1
+ export type Callback = (...args: any[]) => void;
2
+ /**
3
+ * Creates a batched version of a callback so that all calls to it in the same
4
+ * microtick will only call the original callback once.
5
+ *
6
+ * @param callback the callback to batch
7
+ * @returns a batched version of the original callback
8
+ */
9
+ export declare function batched(callback: Callback): Callback;
10
+ /**
11
+ * Determine whether the given element is contained in its ownerDocument:
12
+ * either directly or with a shadow root in between.
13
+ */
14
+ export declare function inOwnerDocument(el?: HTMLElement): boolean;
15
+ export declare function validateTarget(target: HTMLElement | ShadowRoot): void;
16
+ export declare class EventBus extends EventTarget {
17
+ trigger(name: string, payload?: any): void;
18
+ }
19
+ export declare function whenReady(fn?: any): Promise<void>;
20
+ export declare class Markup extends String {
21
+ }
22
+ export declare function htmlEscape(str: any): Markup;
23
+ export declare function markup(strings: TemplateStringsArray, ...placeholders: unknown[]): Markup;
24
+ export declare function markup(value: string): Markup;
@@ -1,36 +1,19 @@
1
- declare type BaseType = {
2
- new (...args: any[]): any;
3
- } | true | "*";
4
- interface TypeInfo {
5
- type?: TypeDescription;
6
- optional?: boolean;
7
- validate?: Function;
8
- shape?: Schema;
9
- element?: TypeDescription;
10
- values?: TypeDescription;
11
- }
12
- declare type ValueType = {
13
- value: any;
14
- };
15
- declare type TypeDescription = BaseType | TypeInfo | ValueType | TypeDescription[];
16
- declare type SimplifiedSchema = string[];
17
- declare type NormalizedSchema = {
18
- [key: string]: TypeDescription;
19
- };
20
- export declare type Schema = SimplifiedSchema | NormalizedSchema;
21
- export declare function isOptional(t: TypeDescription): Boolean;
22
- /**
23
- * Main validate function
24
- */
25
- export declare function validate(obj: {
26
- [key: string]: any;
27
- }, spec: Schema): void;
28
- /**
29
- * Helper validate function, to get the list of errors. useful if one want to
30
- * manipulate the errors without parsing an error object
31
- */
32
- export declare function validateSchema(obj: {
33
- [key: string]: any;
34
- }, schema: Schema): string[];
35
- export declare function validateType(key: string, value: any, descr: TypeDescription): string | null;
36
- export {};
1
+ export interface ValidationIssue {
2
+ message: string;
3
+ path?: PropertyKey[];
4
+ received?: any;
5
+ [K: string]: any;
6
+ }
7
+ export interface ValidationContext {
8
+ addIssue(issue: ValidationIssue): void;
9
+ isValid: boolean;
10
+ issueDepth: number;
11
+ mergeIssues(issues: ValidationIssue[]): void;
12
+ path: PropertyKey[];
13
+ validate(type: any): void;
14
+ value: any;
15
+ withIssues(issues: ValidationIssue[]): ValidationContext;
16
+ withKey(key: PropertyKey): ValidationContext;
17
+ }
18
+ export declare function assertType(value: any, validation: any, errorMessage?: string): void;
19
+ export declare function validateType(value: any, validation: any): ValidationIssue[];
@@ -1 +1 @@
1
- export declare const version = "2.8.1";
1
+ export declare const version = "3.0.0-alpha";
package/package.json CHANGED
@@ -1,10 +1,11 @@
1
1
  {
2
2
  "name": "@odoo/owl",
3
- "version": "3.0.0-alpha.2",
3
+ "version": "3.0.0-alpha.20",
4
4
  "description": "Odoo Web Library (OWL)",
5
5
  "main": "dist/owl.cjs.js",
6
6
  "module": "dist/owl.es.js",
7
7
  "types": "dist/types/owl.d.ts",
8
+ "type": "module",
8
9
  "files": [
9
10
  "dist"
10
11
  ],
@@ -48,32 +49,33 @@
48
49
  },
49
50
  "homepage": "https://github.com/odoo/owl#readme",
50
51
  "devDependencies": {
51
- "@types/jest": "^27.0.1",
52
+ "@rollup/plugin-terser": "^0.4.4",
53
+ "@types/jest": "^30.0.0",
52
54
  "@types/jsdom": "^21.1.7",
53
- "@types/node": "^14.11.8",
54
- "@typescript-eslint/eslint-plugin": "5.48.1",
55
- "@typescript-eslint/parser": "5.48.1",
55
+ "@types/node": "^25.2.0",
56
+ "@typescript-eslint/eslint-plugin": "^8.54.0",
57
+ "@typescript-eslint/parser": "^8.54.0",
56
58
  "chalk": "^3.0.0",
57
59
  "current-git-branch": "^1.1.0",
58
- "eslint": "8.31.0",
60
+ "eslint": "^9.39.2",
59
61
  "git-rev-sync": "^3.0.2",
60
- "github-api": "^3.3.0",
61
- "jest": "^27.1.0",
62
+ "github-api": "^3.4.0",
63
+ "globals": "^17.3.0",
64
+ "jest": "^30.2.0",
62
65
  "jest-diff": "^27.3.1",
63
- "jest-environment-jsdom": "^27.1.0",
66
+ "jest-environment-jsdom": "^30.2.0",
64
67
  "npm-run-all": "^4.1.5",
65
- "prettier": "2.4.1",
66
- "rollup": "^2.56.3",
67
- "rollup-plugin-copy": "^3.3.0",
68
- "rollup-plugin-delete": "^2.0.0",
69
- "rollup-plugin-dts": "^4.2.2",
68
+ "prettier": "^3.8.1",
69
+ "rollup": "^4.57.1",
70
+ "rollup-plugin-copy": "^3.5.0",
71
+ "rollup-plugin-delete": "^3.0.2",
72
+ "rollup-plugin-dts": "^6.3.0",
70
73
  "rollup-plugin-execute": "^1.1.1",
71
74
  "rollup-plugin-string": "^3.0.0",
72
- "rollup-plugin-terser": "^7.0.2",
73
- "rollup-plugin-typescript2": "^0.31.1",
75
+ "rollup-plugin-typescript2": "^0.36.0",
74
76
  "source-map-support": "^0.5.10",
75
- "ts-jest": "^27.0.5",
76
- "typescript": "4.5.2"
77
+ "ts-jest": "^29.4.6",
78
+ "typescript": "^5.9.3"
77
79
  },
78
80
  "jest": {
79
81
  "testEnvironment": "jsdom",
@@ -100,7 +102,8 @@
100
102
  },
101
103
  "prettier": {
102
104
  "printWidth": 100,
103
- "endOfLine": "auto"
105
+ "endOfLine": "auto",
106
+ "trailingComma": "es5"
104
107
  },
105
108
  "dependencies": {
106
109
  "jsdom": "^25.0.1"