@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/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<h1 align="center">🦉 <a href="https://odoo.github.io/owl/">
|
|
1
|
+
<h1 align="center">🦉 <a href="https://odoo.github.io/owl/">Owl Framework</a> 🦉</h1>
|
|
2
2
|
|
|
3
3
|
[](https://www.gnu.org/licenses/lgpl-3.0)
|
|
4
4
|
[](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 (
|
|
12
|
-
|
|
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
|
|
18
|
-
-
|
|
19
|
-
-
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
41
|
-
|
|
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
|
|
50
|
+
class Root extends Component {
|
|
61
51
|
static template = xml`
|
|
62
|
-
<
|
|
63
|
-
|
|
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(
|
|
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/
|
|
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
|
-
|
|
70
|
+
### Learning Owl
|
|
105
71
|
|
|
106
|
-
|
|
72
|
+
Are you new to Owl? This is the place to start!
|
|
107
73
|
|
|
108
|
-
|
|
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
|
-
- [
|
|
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
|
|
|
@@ -124,8 +121,5 @@ npm install @odoo/owl
|
|
|
124
121
|
|
|
125
122
|
If you want to use a simple `<script>` tag, the last release can be downloaded here:
|
|
126
123
|
|
|
127
|
-
- [owl-1.4.
|
|
128
|
-
|
|
129
|
-
## License
|
|
124
|
+
- [owl-1.4.7](https://github.com/odoo/owl/releases/tag/v1.4.7)
|
|
130
125
|
|
|
131
|
-
OWL is [LGPL licensed](./LICENSE).
|