@odoo/owl 3.0.0-alpha.3 → 3.0.0-alpha.30
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 +74 -117
- package/dist/owl.cjs.js +6522 -6686
- package/dist/owl.es.js +6501 -6640
- package/dist/owl.iife.js +6525 -6691
- package/dist/owl.iife.min.js +27 -1
- package/dist/types/owl.d.ts +763 -668
- package/package.json +22 -79
- package/dist/compile_templates.mjs +0 -2553
- package/dist/owl-devtools.zip +0 -0
- package/dist/types/common/owl_error.d.ts +0 -3
- package/dist/types/common/types.d.ts +0 -29
- package/dist/types/common/utils.d.ts +0 -8
- package/dist/types/compiler/code_generator.d.ts +0 -152
- package/dist/types/compiler/index.d.ts +0 -13
- package/dist/types/compiler/inline_expressions.d.ts +0 -59
- package/dist/types/compiler/parser.d.ts +0 -178
- package/dist/types/compiler/standalone/index.d.ts +0 -2
- package/dist/types/compiler/standalone/setup_jsdom.d.ts +0 -1
- package/dist/types/index.d.ts +0 -1
- package/dist/types/runtime/app.d.ts +0 -62
- package/dist/types/runtime/blockdom/attributes.d.ts +0 -6
- package/dist/types/runtime/blockdom/block_compiler.d.ts +0 -21
- package/dist/types/runtime/blockdom/config.d.ts +0 -8
- package/dist/types/runtime/blockdom/event_catcher.d.ts +0 -7
- package/dist/types/runtime/blockdom/events.d.ts +0 -8
- package/dist/types/runtime/blockdom/html.d.ts +0 -17
- package/dist/types/runtime/blockdom/index.d.ts +0 -26
- package/dist/types/runtime/blockdom/list.d.ts +0 -18
- package/dist/types/runtime/blockdom/multi.d.ts +0 -17
- package/dist/types/runtime/blockdom/text.d.ts +0 -26
- package/dist/types/runtime/blockdom/toggler.d.ts +0 -17
- package/dist/types/runtime/cancellableContext.d.ts +0 -15
- package/dist/types/runtime/cancellablePromise.d.ts +0 -15
- package/dist/types/runtime/component.d.ts +0 -28
- package/dist/types/runtime/component_node.d.ts +0 -83
- package/dist/types/runtime/error_handling.d.ts +0 -13
- package/dist/types/runtime/event_handling.d.ts +0 -1
- package/dist/types/runtime/executionContext.d.ts +0 -0
- package/dist/types/runtime/fibers.d.ts +0 -37
- package/dist/types/runtime/hooks.d.ts +0 -57
- package/dist/types/runtime/index.d.ts +0 -35
- package/dist/types/runtime/lifecycle_hooks.d.ts +0 -12
- package/dist/types/runtime/listOperation.d.ts +0 -1
- package/dist/types/runtime/plugins.d.ts +0 -39
- package/dist/types/runtime/portal.d.ts +0 -15
- package/dist/types/runtime/reactivity.d.ts +0 -46
- package/dist/types/runtime/registry.d.ts +0 -15
- package/dist/types/runtime/relationalModel/discussModel.d.ts +0 -19
- package/dist/types/runtime/relationalModel/discussModelTypes.d.ts +0 -22
- package/dist/types/runtime/relationalModel/field.d.ts +0 -20
- package/dist/types/runtime/relationalModel/model.d.ts +0 -59
- package/dist/types/runtime/relationalModel/modelData.d.ts +0 -18
- package/dist/types/runtime/relationalModel/modelRegistry.d.ts +0 -3
- package/dist/types/runtime/relationalModel/modelUtils.d.ts +0 -4
- package/dist/types/runtime/relationalModel/store.d.ts +0 -16
- package/dist/types/runtime/relationalModel/types.d.ts +0 -83
- package/dist/types/runtime/relationalModel/util.d.ts +0 -1
- package/dist/types/runtime/relationalModel/web/WebDataPoint.d.ts +0 -25
- package/dist/types/runtime/relationalModel/web/WebRecord.d.ts +0 -131
- package/dist/types/runtime/relationalModel/web/WebStaticList.d.ts +0 -63
- package/dist/types/runtime/relationalModel/web/webModel.d.ts +0 -5
- package/dist/types/runtime/relationalModel/web/webModelTypes.d.ts +0 -139
- package/dist/types/runtime/scheduler.d.ts +0 -21
- package/dist/types/runtime/signals.d.ts +0 -17
- package/dist/types/runtime/status.d.ts +0 -10
- package/dist/types/runtime/task.d.ts +0 -12
- package/dist/types/runtime/template_helpers.d.ts +0 -58
- package/dist/types/runtime/template_set.d.ts +0 -40
- package/dist/types/runtime/utils.d.ts +0 -25
- package/dist/types/runtime/validation.d.ts +0 -36
- package/dist/types/utils/registry.d.ts +0 -15
- package/dist/types/version.d.ts +0 -1
- package/tools/compile_owl_templates.mjs +0 -31
package/README.md
CHANGED
|
@@ -1,149 +1,106 @@
|
|
|
1
|
-
<h1 align="center">🦉 <a href="https://odoo.github.io/owl/">Owl
|
|
1
|
+
<h1 align="center">🦉 <a href="https://odoo.github.io/owl/">Owl</a> 🦉</h1>
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
<p align="center">
|
|
4
|
+
<strong>A modern, lightweight UI framework for applications that scale</strong>
|
|
5
|
+
</p>
|
|
6
|
+
|
|
7
|
+
[](https://www.gnu.org/licenses/lgpl-3.0)
|
|
4
8
|
[](https://badge.fury.io/js/@odoo%2Fowl)
|
|
5
9
|
[](https://www.npmjs.com/package/@odoo/owl)
|
|
6
10
|
|
|
7
|
-
|
|
11
|
+
---
|
|
8
12
|
|
|
9
|
-
**
|
|
13
|
+
> **Owl 3.0.0 Alpha:** This is an alpha release. The API and features are subject to change without notice.
|
|
10
14
|
|
|
11
|
-
|
|
15
|
+
---
|
|
12
16
|
|
|
13
|
-
|
|
14
|
-
[Odoo](https://www.odoo.com/) for its products. Owl is a modern
|
|
15
|
-
framework, written in Typescript, taking the best ideas from React and Vue in a
|
|
16
|
-
simple and consistent way. Owl's main features are:
|
|
17
|
+
## Try it now
|
|
17
18
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
- asynchronous rendering
|
|
19
|
+
The fastest way to discover Owl is the **[online playground](https://odoo.github.io/owl/playground)**.
|
|
20
|
+
It features interactive examples, a live editor, and showcases all major features:
|
|
21
|
+
reactivity, components, plugins, and more. It also includes **guided tutorials**
|
|
22
|
+
and is the recommended way to learn about Owl.
|
|
23
23
|
|
|
24
|
-
|
|
25
|
-
underlying virtual DOM, integrates beautifully with hooks, and the rendering is
|
|
26
|
-
asynchronous.
|
|
24
|
+
## What is Owl?
|
|
27
25
|
|
|
28
|
-
|
|
26
|
+
Owl is a modern UI framework (~30kb gzipped, zero dependencies) written in TypeScript,
|
|
27
|
+
built by [Odoo](https://www.odoo.com/). It powers Odoo's web client, one of the largest
|
|
28
|
+
open-source business applications, but is equally suited for small projects and prototypes.
|
|
29
29
|
|
|
30
|
-
|
|
31
|
-
- [changelog](CHANGELOG.md) (from Owl 1.x to 2.x),
|
|
32
|
-
- [playground](https://odoo.github.io/owl/playground)
|
|
30
|
+
Key features:
|
|
33
31
|
|
|
34
|
-
|
|
32
|
+
- **Signal-based reactivity** — Explicit, composable, and debuggable state management
|
|
33
|
+
- **Plugin system** — Type-safe, composable sharing of state and services
|
|
34
|
+
- **Class-based components** — Familiar OOP patterns with ES6 classes
|
|
35
|
+
- **Declarative templates** — XML templates with a clean syntax
|
|
36
|
+
- **Async rendering** — Concurrent mode for smooth user experiences
|
|
35
37
|
|
|
36
|
-
|
|
38
|
+
## Quick Example
|
|
37
39
|
|
|
38
40
|
```javascript
|
|
39
|
-
|
|
41
|
+
import { Component, signal, computed, mount, xml } from "@odoo/owl";
|
|
40
42
|
|
|
41
|
-
class
|
|
43
|
+
class TodoList extends Component {
|
|
42
44
|
static template = xml`
|
|
43
|
-
<
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
45
|
+
<input placeholder="Add todo..." t-on-keydown="this.onKeydown"/>
|
|
46
|
+
<ul>
|
|
47
|
+
<t t-foreach="this.todos()" t-as="todo" t-key="todo.id">
|
|
48
|
+
<li t-att-class="{ done: todo.done }">
|
|
49
|
+
<input type="checkbox" t-model="todo.done"/>
|
|
50
|
+
<t t-out="todo.text"/>
|
|
51
|
+
</li>
|
|
52
|
+
</t>
|
|
53
|
+
</ul>
|
|
54
|
+
<p t-if="this.remaining() > 0">
|
|
55
|
+
<t t-out="this.remaining()"/> item(s) remaining
|
|
56
|
+
</p>`;
|
|
57
|
+
|
|
58
|
+
todos = signal.Array([
|
|
59
|
+
{ id: 1, text: "Learn Owl", done: false },
|
|
60
|
+
{ id: 2, text: "Build something", done: false },
|
|
61
|
+
]);
|
|
62
|
+
|
|
63
|
+
remaining = computed(() => this.todos().filter((t) => !t.done).length);
|
|
64
|
+
|
|
65
|
+
onKeydown(ev) {
|
|
66
|
+
if (ev.key === "Enter" && ev.target.value) {
|
|
67
|
+
this.todos.push({
|
|
68
|
+
id: Date.now(),
|
|
69
|
+
text: ev.target.value,
|
|
70
|
+
done: false,
|
|
71
|
+
});
|
|
72
|
+
ev.target.value = "";
|
|
73
|
+
}
|
|
74
|
+
}
|
|
48
75
|
}
|
|
49
76
|
|
|
50
|
-
|
|
51
|
-
static template = xml`
|
|
52
|
-
<span>Hello Owl</span>
|
|
53
|
-
<Counter increment="2"/>`;
|
|
54
|
-
|
|
55
|
-
static components = { Counter };
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
mount(Root, document.body);
|
|
77
|
+
mount(TodoList, document.body);
|
|
59
78
|
```
|
|
60
79
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
More interesting examples can be found on the
|
|
66
|
-
[playground](https://odoo.github.io/owl/playground) application.
|
|
80
|
+
This example demonstrates Owl's reactivity: `todos` is a signal, `remaining`
|
|
81
|
+
is a computed value that updates automatically, and the UI reacts to changes
|
|
82
|
+
without manual subscription management.
|
|
67
83
|
|
|
68
84
|
## Documentation
|
|
69
85
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
Are you new to Owl? This is the place to start!
|
|
73
|
-
|
|
74
|
-
- [Tutorial: create a TodoList application](doc/learning/tutorial_todoapp.md)
|
|
75
|
-
- [How to start an Owl project](doc/learning/quick_start.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)
|
|
82
|
-
- [Component](doc/reference/component.md)
|
|
83
|
-
- [Component Lifecycle](doc/reference/component.md#lifecycle)
|
|
84
|
-
- [Concurrency Model](doc/reference/concurrency_model.md)
|
|
85
|
-
- [Dev mode](doc/reference/app.md#dev-mode)
|
|
86
|
-
- [Dynamic sub components](doc/reference/component.md#dynamic-sub-components)
|
|
87
|
-
- [Environment](doc/reference/environment.md)
|
|
88
|
-
- [Error Handling](doc/reference/error_handling.md)
|
|
89
|
-
- [Event Handling](doc/reference/event_handling.md)
|
|
90
|
-
- [Form Input Bindings](doc/reference/input_bindings.md)
|
|
91
|
-
- [Fragments](doc/reference/templates.md#fragments)
|
|
92
|
-
- [Hooks](doc/reference/hooks.md)
|
|
93
|
-
- [Loading Templates](doc/reference/app.md#loading-templates)
|
|
94
|
-
- [Mounting a component](doc/reference/app.md#mount-helper)
|
|
95
|
-
- [Portal](doc/reference/portal.md)
|
|
96
|
-
- [Precompiling templates](doc/reference/precompiling_templates.md)
|
|
97
|
-
- [Props](doc/reference/props.md)
|
|
98
|
-
- [Props Validation](doc/reference/props.md#props-validation)
|
|
99
|
-
- [Reactivity](doc/reference/reactivity.md)
|
|
100
|
-
- [Rendering SVG](doc/reference/templates.md#rendering-svg)
|
|
101
|
-
- [Refs](doc/reference/refs.md)
|
|
102
|
-
- [Slots](doc/reference/slots.md)
|
|
103
|
-
- [Sub components](doc/reference/component.md#sub-components)
|
|
104
|
-
- [Sub templates](doc/reference/templates.md#sub-templates)
|
|
105
|
-
- [Templates (Qweb)](doc/reference/templates.md)
|
|
106
|
-
- [Translations](doc/reference/translations.md)
|
|
107
|
-
- [Utils](doc/reference/utils.md)
|
|
108
|
-
|
|
109
|
-
### Other Topics
|
|
110
|
-
|
|
111
|
-
- [Notes On Owl Architecture](doc/miscellaneous/architecture.md)
|
|
112
|
-
- [Comparison with React/Vue](doc/miscellaneous/comparison.md)
|
|
113
|
-
- [Why did Odoo build Owl?](doc/miscellaneous/why_owl.md)
|
|
114
|
-
- [Changelog (from owl 1.x to 2.x)](CHANGELOG.md)
|
|
115
|
-
- [Notes on compiled templates](doc/miscellaneous/compiled_template.md)
|
|
116
|
-
- [Owl devtools extension](doc/tools/devtools.md)
|
|
117
|
-
|
|
118
|
-
## Installing Owl
|
|
119
|
-
|
|
120
|
-
Owl is available on `npm` and can be installed with the following command:
|
|
86
|
+
The full documentation is available at **[odoo.github.io/owl/documentation](https://odoo.github.io/owl/documentation/)**.
|
|
121
87
|
|
|
122
|
-
|
|
123
|
-
npm install @odoo/owl
|
|
124
|
-
```
|
|
125
|
-
If you want to use a simple `<script>` tag, the last release can be downloaded here:
|
|
126
|
-
|
|
127
|
-
- [owl](https://github.com/odoo/owl/releases/latest)
|
|
88
|
+
For the Owl 2 documentation, see the [owl-2.x branch](https://github.com/odoo/owl/tree/owl-2.x).
|
|
128
89
|
|
|
129
|
-
##
|
|
90
|
+
## Installation
|
|
130
91
|
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
### Chrome
|
|
92
|
+
```bash
|
|
93
|
+
npm install @odoo/owl
|
|
94
|
+
```
|
|
135
95
|
|
|
136
|
-
|
|
137
|
-
Select the devtools-chrome folder and that's it, your extension is active!
|
|
138
|
-
There is a convenient refresh button on the extension card (still on the same admin page) to update your code.
|
|
139
|
-
Do note that if you got some problems, you may need to completly remove and reload the extension to completly refresh the extension.
|
|
96
|
+
Or download directly: [latest release](https://github.com/odoo/owl/releases/latest)
|
|
140
97
|
|
|
141
|
-
|
|
142
|
-
Go to the address about:debugging#/runtime/this-firefox and click on `Load temporary Add-on...`.
|
|
143
|
-
Select any file in the devtools-firefox folder and that's it, your extension is active!
|
|
144
|
-
Here, you can use the reload button to refresh the extension.
|
|
98
|
+
## Devtools
|
|
145
99
|
|
|
146
|
-
|
|
147
|
-
|
|
100
|
+
The Owl devtools extension helps debug your applications with component tree
|
|
101
|
+
inspection, state visualization, and performance profiling. Download it from
|
|
102
|
+
the [releases page](https://github.com/odoo/owl/releases/latest).
|
|
148
103
|
|
|
104
|
+
## License
|
|
149
105
|
|
|
106
|
+
Owl is released under the [LGPL v3](https://www.gnu.org/licenses/lgpl-3.0) license.
|