@odoo/owl 1.4.7 → 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.
Files changed (65) hide show
  1. package/README.md +59 -65
  2. package/dist/owl.cjs.js +4628 -5045
  3. package/dist/owl.cjs.min.js +1 -15
  4. package/dist/owl.es.js +4600 -5035
  5. package/dist/owl.es.min.js +1 -15
  6. package/dist/owl.iife.js +4628 -5045
  7. package/dist/owl.iife.min.js +1 -15
  8. package/dist/types/app/app.d.ts +29 -0
  9. package/dist/types/app/template_helpers.d.ts +49 -0
  10. package/dist/types/app/template_set.d.ts +34 -0
  11. package/dist/types/blockdom/attributes.d.ts +8 -0
  12. package/dist/types/blockdom/block_compiler.d.ts +21 -0
  13. package/dist/types/blockdom/config.d.ts +8 -0
  14. package/dist/types/blockdom/events.d.ts +7 -0
  15. package/dist/types/blockdom/html.d.ts +16 -0
  16. package/dist/types/blockdom/index.d.ts +24 -0
  17. package/dist/types/blockdom/list.d.ts +17 -0
  18. package/dist/types/blockdom/multi.d.ts +16 -0
  19. package/dist/types/blockdom/text.d.ts +25 -0
  20. package/dist/types/blockdom/toggler.d.ts +16 -0
  21. package/dist/types/compiler/code_generator.d.ts +144 -0
  22. package/dist/types/compiler/index.d.ts +9 -0
  23. package/dist/types/{qweb/expression_parser.d.ts → compiler/inline_expressions.d.ts} +5 -6
  24. package/dist/types/compiler/parser.d.ts +157 -0
  25. package/dist/types/component/component.d.ts +15 -294
  26. package/dist/types/component/component_node.d.ts +54 -0
  27. package/dist/types/component/error_handling.d.ts +13 -0
  28. package/dist/types/component/fibers.d.ts +32 -0
  29. package/dist/types/component/handler.d.ts +1 -0
  30. package/dist/types/component/lifecycle_hooks.d.ts +12 -0
  31. package/dist/types/component/props_validation.d.ts +14 -1
  32. package/dist/types/component/scheduler.d.ts +5 -21
  33. package/dist/types/component/status.d.ts +9 -0
  34. package/dist/types/hooks.d.ts +26 -35
  35. package/dist/types/index.d.ts +27 -47
  36. package/dist/types/memo.d.ts +6 -0
  37. package/dist/types/portal.d.ts +11 -0
  38. package/dist/types/reactivity.d.ts +64 -0
  39. package/dist/types/utils.d.ts +14 -21
  40. package/package.json +14 -9
  41. package/dist/types/browser.d.ts +0 -12
  42. package/dist/types/component/directive.d.ts +0 -1
  43. package/dist/types/component/fiber.d.ts +0 -75
  44. package/dist/types/component/styles.d.ts +0 -12
  45. package/dist/types/config.d.ts +0 -12
  46. package/dist/types/context.d.ts +0 -36
  47. package/dist/types/core/event_bus.d.ts +0 -42
  48. package/dist/types/core/observer.d.ts +0 -30
  49. package/dist/types/core/owl_event.d.ts +0 -10
  50. package/dist/types/misc/async_root.d.ts +0 -13
  51. package/dist/types/misc/portal.d.ts +0 -70
  52. package/dist/types/qweb/base_directives.d.ts +0 -1
  53. package/dist/types/qweb/compilation_context.d.ts +0 -69
  54. package/dist/types/qweb/extensions.d.ts +0 -28
  55. package/dist/types/qweb/index.d.ts +0 -3
  56. package/dist/types/qweb/qweb.d.ts +0 -141
  57. package/dist/types/router/link.d.ts +0 -11
  58. package/dist/types/router/route_component.d.ts +0 -6
  59. package/dist/types/router/router.d.ts +0 -57
  60. package/dist/types/store.d.ts +0 -63
  61. package/dist/types/tags.d.ts +0 -29
  62. package/dist/types/vdom/html_to_vdom.d.ts +0 -2
  63. package/dist/types/vdom/index.d.ts +0 -2
  64. package/dist/types/vdom/modules.d.ts +0 -5
  65. package/dist/types/vdom/vdom.d.ts +0 -101
package/README.md CHANGED
@@ -1,4 +1,4 @@
1
- <h1 align="center">🦉 <a href="https://odoo.github.io/owl/">OWL Framework</a> 🦉</h1>
1
+ <h1 align="center">🦉 <a href="https://odoo.github.io/owl/">Owl Framework</a> 🦉</h1>
2
2
 
3
3
  [![License: LGPL v3](https://img.shields.io/badge/License-LGPL%20v3-blue.svg)](https://www.gnu.org/licenses/lgpl-3.0)
4
4
  [![npm version](https://badge.fury.io/js/@odoo%2Fowl.svg)](https://badge.fury.io/js/@odoo%2Fowl)
@@ -6,113 +6,110 @@
6
6
 
7
7
  _Class based components with hooks, reactive state and concurrent mode_
8
8
 
9
+ **Try it online!** you can experiment with the Owl framework in an online [playground](https://odoo.github.io/owl/playground).
10
+
9
11
  ## Project Overview
10
12
 
11
- The Odoo Web Library (OWL) is a smallish (~<20kb gzipped) UI framework intended to
12
- be the basis for the [Odoo](https://www.odoo.com/) Web Client. Owl is a modern
13
+ The Odoo Web Library (Owl) is a smallish (~<20kb gzipped) UI framework built by
14
+ [Odoo](https://www.odoo.com/) for its products. Owl is a modern
13
15
  framework, written in Typescript, taking the best ideas from React and Vue in a
14
16
  simple and consistent way. Owl's main features are:
15
17
 
16
18
  - a declarative component system,
17
- - a reactivity system based on hooks,
18
- - concurrent mode by default,
19
- - a store and a frontend router
19
+ - a fine grained reactivity system similar to Vue,
20
+ - hooks
21
+ - fragments
22
+ - asynchronous rendering
20
23
 
21
- Owl components are defined with ES6 classes, they use QWeb templates, an
24
+ Owl components are defined with ES6 classes and xml templates, uses an
22
25
  underlying virtual DOM, integrates beautifully with hooks, and the rendering is
23
26
  asynchronous.
24
27
 
25
- **Try it online!** An online playground is available at
26
- [https://odoo.github.io/owl/playground](https://odoo.github.io/owl/playground)
27
- to let you experiment with the Owl framework. There are some code examples to
28
- showcase some interesting features.
29
-
30
- Owl is currently stable. Possible future changes are explained in the
31
- [roadmap](roadmap.md).
32
-
33
- ## Why Owl?
34
-
35
- Why did Odoo decide to make Yet Another Framework? This is really a question
36
- that deserves [a long answer](doc/miscellaneous/why_owl.md). But in short, we believe that
37
- while the current state of the art frameworks are excellent, they are not
38
- optimized for our use case, and there is still room for something else.
28
+ Quick links:
39
29
 
40
- If you are interested in a comparison with React or Vue, you will
41
- find some more additional information [here](doc/miscellaneous/comparison.md).
30
+ - [documentation](#documentation),
31
+ - [changelog](CHANGELOG.md) (from Owl 1.x to 2.x),
32
+ - [playground](https://odoo.github.io/owl/playground)
42
33
 
43
34
  ## Example
44
35
 
45
36
  Here is a short example to illustrate interactive components:
46
37
 
47
38
  ```javascript
48
- const { Component, useState, mount } = owl;
49
- const { xml } = owl.tags;
39
+ const { Component, useState, mount, xml } = owl;
50
40
 
51
41
  class Counter extends Component {
52
42
  static template = xml`
53
- <button t-on-click="state.value++">
43
+ <button t-on-click="() => state.value = state.value + props.increment">
54
44
  Click Me! [<t t-esc="state.value"/>]
55
45
  </button>`;
56
46
 
57
47
  state = useState({ value: 0 });
58
48
  }
59
49
 
60
- class App extends Component {
50
+ class Root extends Component {
61
51
  static template = xml`
62
- <div>
63
- <span>Hello Owl</span>
64
- <Counter />
65
- </div>`;
52
+ <span>Hello Owl</span>
53
+ <Counter increment="2"/>`;
66
54
 
67
55
  static components = { Counter };
68
56
  }
69
57
 
70
- mount(App, { target: document.body });
58
+ mount(Root, document.body);
71
59
  ```
72
60
 
73
61
  Note that the counter component is made reactive with the [`useState` hook](doc/reference/hooks.md#usestate).
74
- Also, all examples here uses the [`xml` helper](doc/reference/tags.md#xml-tag) to define inline templates.
62
+ Also, all examples here uses the [`xml` helper](doc/reference/templates.md#inline-templates) to define inline templates.
75
63
  But this is not mandatory, many applications will load templates separately.
76
64
 
77
65
  More interesting examples can be found on the
78
66
  [playground](https://odoo.github.io/owl/playground) application.
79
67
 
80
- ## Design Principles
81
-
82
- OWL is designed to be used in highly dynamic applications where changing
83
- requirements are common and code needs to be maintained by large teams.
84
-
85
- - **XML based**: templates are based on the XML format, which allows interesting
86
- applications. For example, they could be stored in a database and modified
87
- dynamically with `xpaths`.
88
- - **templates compilation in the browser**: this may not be a good fit for all
89
- applications, but if you need to generate dynamically user interfaces in the
90
- browser, this is very powerful. For example, a generic form view component
91
- could generate a specific form user interface for each various models, from a XML view.
92
- - **no toolchain required**: this is extremely useful for some applications, if,
93
- for various reasons (security/deployment/dynamic modules/specific assets tools),
94
- it is not ok to use standard web tools based on `npm`.
95
-
96
- Owl is not designed to be fast nor small (even though it is quite good on those
97
- two topics). It is a no nonsense framework to build applications. There is only
98
- one way to define components (with classes). There is no black magic. It just
99
- works.
100
-
101
-
102
68
  ## Documentation
103
69
 
104
- A complete documentation for Owl can be found here:
70
+ ### Learning Owl
105
71
 
106
- - [Main documentation page](doc/readme.md).
72
+ Are you new to Owl? This is the place to start!
107
73
 
108
- Some of the most important pages are:
109
-
110
- - [Tutorial: TodoList application](doc/learning/tutorial_todoapp.md)
74
+ - [Tutorial: create a TodoList application](doc/learning/tutorial_todoapp.md)
111
75
  - [How to start an Owl project](doc/learning/quick_start.md)
112
- - [QWeb templating language](doc/reference/qweb_templating_language.md)
76
+ - [How to test Components](doc/learning/how_to_test.md)
77
+
78
+ ### Reference
79
+
80
+ - [Overview](doc/readme.md)
81
+ - [App](doc/reference/app.md)
113
82
  - [Component](doc/reference/component.md)
83
+ - [Component Lifecycle](doc/reference/component.md#lifecycle)
84
+ - [Concurrency Model](doc/reference/concurrency_model.md)
85
+ - [Dynamic sub components](doc/reference/component.md#dynamic-sub-components)
86
+ - [Environment](doc/reference/environment.md)
87
+ - [Error Handling](doc/reference/error_handling.md)
88
+ - [Event Handling](doc/reference/event_handling.md)
89
+ - [Form Input Bindings](doc/reference/input_bindings.md)
90
+ - [Fragments](doc/reference/templates.md#fragments)
114
91
  - [Hooks](doc/reference/hooks.md)
115
-
92
+ - [Loading Templates](doc/reference/app.md#loading-templates)
93
+ - [Mounting a component](doc/reference/app.md#mount-helper)
94
+ - [Portal](doc/reference/portal.md)
95
+ - [Props](doc/reference/props.md)
96
+ - [Props Validation](doc/reference/props.md#props-validation)
97
+ - [Reactivity](doc/reference/reactivity.md)
98
+ - [Rendering SVG](doc/reference/templates.md#rendering-svg)
99
+ - [Refs](doc/reference/refs.md)
100
+ - [Slots](doc/reference/slots.md)
101
+ - [Sub components](doc/reference/component.md#sub-components)
102
+ - [Sub templates](doc/reference/templates.md#sub-templates)
103
+ - [Templates (Qweb)](doc/reference/templates.md)
104
+ - [Translations](doc/reference/translations.md)
105
+ - [Utils](doc/reference/utils.md)
106
+
107
+ ### Other Topics
108
+
109
+ - [Notes On Owl Architecture](doc/miscellaneous/architecture.md)
110
+ - [Comparison with React/Vue](doc/miscellaneous/comparison.md)
111
+ - [Why did Odoo build Owl?](doc/miscellaneous/why_owl.md)
112
+ - [Changelog (from owl 1.x to 2.x)](CHANGELOG.md)
116
113
 
117
114
  ## Installing Owl
118
115
 
@@ -126,6 +123,3 @@ If you want to use a simple `<script>` tag, the last release can be downloaded h
126
123
 
127
124
  - [owl-1.4.7](https://github.com/odoo/owl/releases/tag/v1.4.7)
128
125
 
129
- ## License
130
-
131
- OWL is [LGPL licensed](./LICENSE).