@odoo/owl 3.0.0-alpha.20 → 3.0.0-alpha.22

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 (62) hide show
  1. package/README.md +100 -110
  2. package/dist/compile_templates.mjs +84 -80
  3. package/dist/owl-devtools.zip +0 -0
  4. package/dist/owl.cjs.js +1612 -1473
  5. package/dist/owl.es.js +1612 -1473
  6. package/dist/owl.iife.js +1612 -1473
  7. package/dist/owl.iife.min.js +1 -1
  8. package/dist/types/compiler/code_generator.d.ts +1 -2
  9. package/dist/types/compiler/inline_expressions.d.ts +7 -24
  10. package/dist/types/compiler/parser.d.ts +3 -8
  11. package/dist/types/owl.d.ts +33 -27
  12. package/dist/types/runtime/blockdom/attributes.d.ts +2 -0
  13. package/dist/types/runtime/component_node.d.ts +2 -0
  14. package/dist/types/runtime/plugin_manager.d.ts +2 -0
  15. package/dist/types/runtime/reactivity/computations.d.ts +1 -0
  16. package/dist/types/runtime/rendering/scheduler.d.ts +1 -1
  17. package/dist/types/runtime/rendering/template_helpers.d.ts +2 -2
  18. package/dist/types/runtime/types.d.ts +3 -0
  19. package/dist/types/version.d.ts +1 -1
  20. package/package.json +25 -2
  21. package/dist/compiler.js +0 -2371
  22. package/dist/owl.cjs.runtime.js +0 -4070
  23. package/dist/owl.es.runtime.js +0 -4026
  24. package/dist/owl.iife.runtime.js +0 -4074
  25. package/dist/owl.iife.runtime.min.js +0 -1
  26. package/dist/types/common/types.d.ts +0 -1
  27. package/dist/types/runtime/cancellableContext.d.ts +0 -15
  28. package/dist/types/runtime/cancellablePromise.d.ts +0 -15
  29. package/dist/types/runtime/error_handling.d.ts +0 -13
  30. package/dist/types/runtime/executionContext.d.ts +0 -0
  31. package/dist/types/runtime/fibers.d.ts +0 -37
  32. package/dist/types/runtime/listOperation.d.ts +0 -1
  33. package/dist/types/runtime/model.d.ts +0 -48
  34. package/dist/types/runtime/plugins.d.ts +0 -36
  35. package/dist/types/runtime/portal.d.ts +0 -12
  36. package/dist/types/runtime/reactivity/async_computed.d.ts +0 -1
  37. package/dist/types/runtime/reactivity/derived.d.ts +0 -7
  38. package/dist/types/runtime/reactivity/reactivity.d.ts +0 -46
  39. package/dist/types/runtime/reactivity/signals.d.ts +0 -30
  40. package/dist/types/runtime/reactivity/state.d.ts +0 -48
  41. package/dist/types/runtime/reactivity.d.ts +0 -57
  42. package/dist/types/runtime/relationalModel/discussModel.d.ts +0 -19
  43. package/dist/types/runtime/relationalModel/discussModelTypes.d.ts +0 -22
  44. package/dist/types/runtime/relationalModel/field.d.ts +0 -20
  45. package/dist/types/runtime/relationalModel/model.d.ts +0 -59
  46. package/dist/types/runtime/relationalModel/modelData.d.ts +0 -18
  47. package/dist/types/runtime/relationalModel/modelRegistry.d.ts +0 -3
  48. package/dist/types/runtime/relationalModel/modelUtils.d.ts +0 -4
  49. package/dist/types/runtime/relationalModel/store.d.ts +0 -16
  50. package/dist/types/runtime/relationalModel/types.d.ts +0 -83
  51. package/dist/types/runtime/relationalModel/util.d.ts +0 -1
  52. package/dist/types/runtime/relationalModel/web/WebDataPoint.d.ts +0 -25
  53. package/dist/types/runtime/relationalModel/web/WebRecord.d.ts +0 -131
  54. package/dist/types/runtime/relationalModel/web/WebStaticList.d.ts +0 -63
  55. package/dist/types/runtime/relationalModel/web/webModel.d.ts +0 -5
  56. package/dist/types/runtime/relationalModel/web/webModelTypes.d.ts +0 -139
  57. package/dist/types/runtime/scheduler.d.ts +0 -21
  58. package/dist/types/runtime/signals.d.ts +0 -19
  59. package/dist/types/runtime/suspense.d.ts +0 -5
  60. package/dist/types/runtime/task.d.ts +0 -12
  61. package/dist/types/runtime/template_helpers.d.ts +0 -58
  62. package/dist/types/utils/registry.d.ts +0 -15
@@ -166,6 +166,32 @@ declare class Registry<T> {
166
166
  has(key: string): boolean;
167
167
  }
168
168
 
169
+ interface ReactiveValue<TRead, TWrite = TRead> {
170
+ (): TRead;
171
+ /**
172
+ * Update the value of the reactive with a new value. If the new value is different
173
+ * from the previous values, all computations that depends on this reactive will
174
+ * be invalidated, and effects will rerun.
175
+ */
176
+ set(nextValue: TWrite): void;
177
+ }
178
+ declare enum ComputationState {
179
+ EXECUTED = 0,
180
+ STALE = 1,
181
+ PENDING = 2
182
+ }
183
+ interface Atom<T = any> {
184
+ observers: Set<ComputationAtom>;
185
+ value: T;
186
+ }
187
+ interface ComputationAtom<T = any> extends Atom<T> {
188
+ compute: () => T;
189
+ isDerived: boolean;
190
+ sources: Set<Atom>;
191
+ state: ComputationState;
192
+ }
193
+ declare function untrack<T>(fn: (...args: any[]) => T): T;
194
+
169
195
  declare const enum STATUS {
170
196
  NEW = 0,
171
197
  MOUNTED = 1,// is ready, and in DOM. It has a valid el
@@ -195,6 +221,7 @@ declare class PluginManager {
195
221
  app: App;
196
222
  config: Record<string, any>;
197
223
  onDestroyCb: Function[];
224
+ computations: ComputationAtom[];
198
225
  plugins: Record<string, Plugin>;
199
226
  status: STATUS;
200
227
  constructor(app: App, options?: PluginManagerOptions);
@@ -205,32 +232,6 @@ declare class PluginManager {
205
232
  startPlugins(pluginConstructors: PluginConstructor[]): void;
206
233
  }
207
234
 
208
- interface ReactiveValue<TRead, TWrite = TRead> {
209
- (): TRead;
210
- /**
211
- * Update the value of the reactive with a new value. If the new value is different
212
- * from the previous values, all computations that depends on this reactive will
213
- * be invalidated, and effects will rerun.
214
- */
215
- set(nextValue: TWrite): void;
216
- }
217
- declare enum ComputationState {
218
- EXECUTED = 0,
219
- STALE = 1,
220
- PENDING = 2
221
- }
222
- interface Atom<T = any> {
223
- observers: Set<ComputationAtom>;
224
- value: T;
225
- }
226
- interface ComputationAtom<T = any> extends Atom<T> {
227
- compute: () => T;
228
- isDerived: boolean;
229
- sources: Set<Atom>;
230
- state: ComputationState;
231
- }
232
- declare function untrack<T>(fn: (...args: any[]) => T): T;
233
-
234
235
  declare class Fiber {
235
236
  node: ComponentNode;
236
237
  bdom: BDom | null;
@@ -275,6 +276,7 @@ declare class ComponentNode implements VNode<ComponentNode> {
275
276
  forceNextRender: boolean;
276
277
  parentKey: string | null;
277
278
  props: Record<string, any>;
279
+ defaultProps: Record<string, any>;
278
280
  renderFn: Function;
279
281
  parent: ComponentNode | null;
280
282
  children: {
@@ -288,6 +290,7 @@ declare class ComponentNode implements VNode<ComponentNode> {
288
290
  patched: LifecycleHook[];
289
291
  willDestroy: LifecycleHook[];
290
292
  signalComputation: ComputationAtom;
293
+ computations: ComputationAtom[];
291
294
  pluginManager: PluginManager;
292
295
  constructor(C: ComponentConstructor, props: Record<string, any>, app: App, parent: ComponentNode | null, parentKey: string | null);
293
296
  mountComponent(target: any, options?: MountOptions): void;
@@ -364,6 +367,8 @@ declare function literalSelection<const T extends LiteralTypes>(literals: T[]):
364
367
  declare function objectType(): Record<string, any>;
365
368
  declare function objectType<const Keys extends string[]>(keys: Keys): ResolveOptionalEntries<KeyedObject<Keys>>;
366
369
  declare function objectType<Shape extends {}>(shape: Shape): ResolveOptionalEntries<Shape>;
370
+ declare function strictObjectType<const Keys extends string[]>(keys: Keys): ResolveOptionalEntries<KeyedObject<Keys>>;
371
+ declare function strictObjectType<Shape extends {}>(shape: Shape): ResolveOptionalEntries<Shape>;
367
372
  declare function promiseType(): Promise<void>;
368
373
  declare function promiseType<T>(type: T): Promise<T>;
369
374
  declare function recordType(): Record<PropertyKey, any>;
@@ -392,6 +397,7 @@ declare const types: {
392
397
  ref: typeof ref;
393
398
  selection: typeof literalSelection;
394
399
  signal: typeof reactiveValueType;
400
+ strictObject: typeof strictObjectType;
395
401
  string: string;
396
402
  tuple: typeof tuple;
397
403
  };
@@ -471,7 +477,7 @@ type ErrorParams = {
471
477
  declare function handleError(params: ErrorParams): void;
472
478
 
473
479
  declare class Scheduler {
474
- static requestAnimationFrame: ((callback: FrameRequestCallback) => number) & typeof requestAnimationFrame;
480
+ static requestAnimationFrame: (callback: FrameRequestCallback) => number;
475
481
  tasks: Set<RootFiber>;
476
482
  requestAnimationFrame: Window["requestAnimationFrame"];
477
483
  frame: number;
@@ -4,3 +4,5 @@ export declare function attrsSetter(this: HTMLElement, attrs: any): void;
4
4
  export declare function attrsUpdater(this: HTMLElement, attrs: any, oldAttrs: any): void;
5
5
  export declare function setClass(this: HTMLElement, val: any): void;
6
6
  export declare function updateClass(this: HTMLElement, val: any, oldVal: any): void;
7
+ export declare function setStyle(this: HTMLElement, val: any): void;
8
+ export declare function updateStyle(this: HTMLElement, val: any, oldVal: any): void;
@@ -16,6 +16,7 @@ export declare class ComponentNode implements VNode<ComponentNode> {
16
16
  forceNextRender: boolean;
17
17
  parentKey: string | null;
18
18
  props: Record<string, any>;
19
+ defaultProps: Record<string, any>;
19
20
  renderFn: Function;
20
21
  parent: ComponentNode | null;
21
22
  children: {
@@ -29,6 +30,7 @@ export declare class ComponentNode implements VNode<ComponentNode> {
29
30
  patched: LifecycleHook[];
30
31
  willDestroy: LifecycleHook[];
31
32
  signalComputation: ComputationAtom;
33
+ computations: ComputationAtom[];
32
34
  pluginManager: PluginManager;
33
35
  constructor(C: ComponentConstructor, props: Record<string, any>, app: App, parent: ComponentNode | null, parentKey: string | null);
34
36
  mountComponent(target: any, options?: MountOptions): void;
@@ -1,4 +1,5 @@
1
1
  import { App } from "./app";
2
+ import { ComputationAtom } from "./reactivity/computations";
2
3
  import { Resource } from "./resource";
3
4
  import { STATUS } from "./status";
4
5
  export interface PluginConstructor {
@@ -21,6 +22,7 @@ export declare class PluginManager {
21
22
  app: App;
22
23
  config: Record<string, any>;
23
24
  onDestroyCb: Function[];
25
+ computations: ComputationAtom[];
24
26
  plugins: Record<string, Plugin>;
25
27
  status: STATUS;
26
28
  constructor(app: App, options?: PluginManagerOptions);
@@ -30,4 +30,5 @@ export declare function getCurrentComputation(): ComputationAtom<any> | undefine
30
30
  export declare function setComputation(computation: ComputationAtom | undefined): void;
31
31
  export declare function updateComputation(computation: ComputationAtom): void;
32
32
  export declare function removeSources(computation: ComputationAtom): void;
33
+ export declare function disposeComputation(computation: ComputationAtom): void;
33
34
  export declare function untrack<T>(fn: (...args: any[]) => T): T;
@@ -1,7 +1,7 @@
1
1
  import type { ComponentNode } from "../component_node";
2
2
  import { Fiber, RootFiber } from "./fibers";
3
3
  export declare class Scheduler {
4
- static requestAnimationFrame: ((callback: FrameRequestCallback) => number) & typeof requestAnimationFrame;
4
+ static requestAnimationFrame: (callback: FrameRequestCallback) => number;
5
5
  tasks: Set<RootFiber>;
6
6
  requestAnimationFrame: Window["requestAnimationFrame"];
7
7
  frame: number;
@@ -2,7 +2,6 @@ import { OwlError } from "../../common/owl_error";
2
2
  import { App } from "../app";
3
3
  import { BDom, createCatcher, toggler } from "../blockdom";
4
4
  import { ComponentNode } from "../component_node";
5
- import { Portal } from "../portal";
6
5
  import { markRaw } from "../reactivity/proxy";
7
6
  /**
8
7
  * This file contains utility functions that will be injected in each template,
@@ -26,6 +25,7 @@ declare class LazyValue {
26
25
  }
27
26
  export declare function safeOutput(value: any, defaultValue?: any): ReturnType<typeof toggler>;
28
27
  declare function createRef(ref: any): (el: HTMLElement | null, previousEl: HTMLElement | null) => void;
28
+ declare function callHandler(fn: any, ctx: any, ev: Event): void;
29
29
  declare function modelExpr(value: any): any;
30
30
  declare function createComponent<P extends Record<string, any>>(app: App, name: string | null, isStatic: boolean, hasSlotsProp: boolean, hasDynamicPropList: boolean, propList: string[]): (props: P, key: string, ctx: ComponentNode, parent: any, C: any) => any;
31
31
  declare function callTemplate(subTemplate: string, owner: any, app: App, ctx: any, parent: any, key: any): any;
@@ -45,7 +45,7 @@ export declare const helpers: {
45
45
  createRef: typeof createRef;
46
46
  modelExpr: typeof modelExpr;
47
47
  createComponent: typeof createComponent;
48
- Portal: typeof Portal;
49
48
  callTemplate: typeof callTemplate;
49
+ callHandler: typeof callHandler;
50
50
  };
51
51
  export {};
@@ -33,6 +33,8 @@ declare function literalSelection<const T extends LiteralTypes>(literals: T[]):
33
33
  declare function objectType(): Record<string, any>;
34
34
  declare function objectType<const Keys extends string[]>(keys: Keys): ResolveOptionalEntries<KeyedObject<Keys>>;
35
35
  declare function objectType<Shape extends {}>(shape: Shape): ResolveOptionalEntries<Shape>;
36
+ declare function strictObjectType<const Keys extends string[]>(keys: Keys): ResolveOptionalEntries<KeyedObject<Keys>>;
37
+ declare function strictObjectType<Shape extends {}>(shape: Shape): ResolveOptionalEntries<Shape>;
36
38
  declare function promiseType(): Promise<void>;
37
39
  declare function promiseType<T>(type: T): Promise<T>;
38
40
  declare function recordType(): Record<PropertyKey, any>;
@@ -61,6 +63,7 @@ export declare const types: {
61
63
  ref: typeof ref;
62
64
  selection: typeof literalSelection;
63
65
  signal: typeof reactiveValueType;
66
+ strictObject: typeof strictObjectType;
64
67
  string: string;
65
68
  tuple: typeof tuple;
66
69
  };
@@ -1 +1 @@
1
- export declare const version = "3.0.0-alpha";
1
+ export declare const version = "3.0.0-alpha.22";
package/package.json CHANGED
@@ -1,10 +1,20 @@
1
1
  {
2
2
  "name": "@odoo/owl",
3
- "version": "3.0.0-alpha.20",
3
+ "version": "3.0.0-alpha.22",
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
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/types/owl.d.ts",
11
+ "import": "./dist/owl.es.js",
12
+ "require": "./dist/owl.cjs.js",
13
+ "default": "./dist/owl.es.js"
14
+ },
15
+ "./dist/*": "./dist/*",
16
+ "./package.json": "./package.json"
17
+ },
8
18
  "type": "module",
9
19
  "files": [
10
20
  "dist"
@@ -32,7 +42,7 @@
32
42
  "prettier": "prettier {src/*.ts,src/**/*.ts,tests/*.ts,tests/**/*.ts,doc/*.md,doc/**/*.md,tools/devtools/**/*.js} --write",
33
43
  "check-formatting": "prettier {src/*.ts,src/**/*.ts,tests/*.ts,tests/**/*.ts,doc/*.md,doc/**/*.md,tools/devtools/**/*.js} --check",
34
44
  "lint": "eslint src/**/*.ts tests/**/*.ts",
35
- "release": "node tools/release.js",
45
+ "release": "node tools/release.cjs",
36
46
  "compile_templates": "node tools/compile_owl_templates.mjs"
37
47
  },
38
48
  "bin": {
@@ -49,6 +59,18 @@
49
59
  },
50
60
  "homepage": "https://github.com/odoo/owl#readme",
51
61
  "devDependencies": {
62
+ "@codemirror/autocomplete": "^6.20.1",
63
+ "@codemirror/commands": "^6.10.3",
64
+ "@codemirror/lang-css": "^6.3.1",
65
+ "@codemirror/lang-javascript": "^6.2.5",
66
+ "@codemirror/lang-markdown": "^6.5.0",
67
+ "@codemirror/lang-xml": "^6.1.0",
68
+ "@codemirror/language": "^6.12.2",
69
+ "@codemirror/state": "^6.6.0",
70
+ "@codemirror/theme-one-dark": "^6.1.3",
71
+ "@codemirror/view": "^6.40.0",
72
+ "@emmetio/codemirror6-plugin": "^0.4.0",
73
+ "@rollup/plugin-node-resolve": "^16.0.3",
52
74
  "@rollup/plugin-terser": "^0.4.4",
53
75
  "@types/jest": "^30.0.0",
54
76
  "@types/jsdom": "^21.1.7",
@@ -56,6 +78,7 @@
56
78
  "@typescript-eslint/eslint-plugin": "^8.54.0",
57
79
  "@typescript-eslint/parser": "^8.54.0",
58
80
  "chalk": "^3.0.0",
81
+ "codemirror": "^6.0.2",
59
82
  "current-git-branch": "^1.1.0",
60
83
  "eslint": "^9.39.2",
61
84
  "git-rev-sync": "^3.0.2",