@odoo/owl 3.0.0-alpha.2 → 3.0.0-alpha.21
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 +100 -110
- package/dist/compile_templates.mjs +2434 -2532
- package/dist/compiler.js +2371 -0
- package/dist/owl-devtools.zip +0 -0
- package/dist/owl.cjs.js +6709 -6616
- package/dist/owl.cjs.runtime.js +4480 -0
- package/dist/owl.es.js +6697 -6600
- package/dist/owl.es.runtime.js +4436 -0
- package/dist/owl.iife.js +6710 -6617
- package/dist/owl.iife.min.js +1 -1
- package/dist/owl.iife.runtime.js +4484 -0
- package/dist/owl.iife.runtime.min.js +1 -0
- package/dist/types/common/owl_error.d.ts +3 -3
- package/dist/types/common/types.d.ts +1 -29
- package/dist/types/common/utils.d.ts +8 -8
- package/dist/types/compiler/code_generator.d.ts +133 -152
- package/dist/types/compiler/index.d.ts +13 -13
- package/dist/types/compiler/inline_expressions.d.ts +41 -59
- package/dist/types/compiler/parser.d.ts +170 -178
- package/dist/types/compiler/standalone/index.d.ts +2 -2
- package/dist/types/compiler/standalone/setup_jsdom.d.ts +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/owl.d.ts +709 -665
- package/dist/types/runtime/app.d.ts +55 -62
- package/dist/types/runtime/blockdom/attributes.d.ts +8 -6
- package/dist/types/runtime/blockdom/block_compiler.d.ts +21 -21
- package/dist/types/runtime/blockdom/config.d.ts +8 -8
- package/dist/types/runtime/blockdom/event_catcher.d.ts +7 -7
- package/dist/types/runtime/blockdom/events.d.ts +8 -8
- package/dist/types/runtime/blockdom/html.d.ts +17 -17
- package/dist/types/runtime/blockdom/index.d.ts +25 -26
- package/dist/types/runtime/blockdom/list.d.ts +18 -18
- package/dist/types/runtime/blockdom/multi.d.ts +17 -17
- package/dist/types/runtime/blockdom/text.d.ts +26 -26
- package/dist/types/runtime/blockdom/toggler.d.ts +17 -17
- package/dist/types/runtime/component.d.ts +17 -28
- package/dist/types/runtime/component_node.d.ts +59 -83
- package/dist/types/runtime/context.d.ts +36 -0
- package/dist/types/runtime/error_handling.d.ts +13 -13
- package/dist/types/runtime/event_handling.d.ts +1 -1
- package/dist/types/runtime/fibers.d.ts +37 -37
- package/dist/types/runtime/hooks.d.ts +32 -57
- package/dist/types/runtime/index.d.ts +46 -35
- package/dist/types/runtime/lifecycle_hooks.d.ts +10 -12
- package/dist/types/runtime/plugin_hooks.d.ts +6 -0
- package/dist/types/runtime/plugin_manager.d.ts +36 -0
- package/dist/types/runtime/props.d.ts +21 -0
- package/dist/types/runtime/reactivity/computations.d.ts +34 -0
- package/dist/types/runtime/reactivity/computed.d.ts +6 -0
- package/dist/types/runtime/reactivity/effect.d.ts +1 -0
- package/dist/types/runtime/reactivity/proxy.d.ts +47 -0
- package/dist/types/runtime/reactivity/signal.d.ts +31 -0
- package/dist/types/runtime/reactivity.d.ts +57 -46
- package/dist/types/runtime/registry.d.ts +24 -15
- package/dist/types/runtime/rendering/error_handling.d.ts +13 -0
- package/dist/types/runtime/rendering/fibers.d.ts +37 -0
- package/dist/types/runtime/rendering/scheduler.d.ts +21 -0
- package/dist/types/runtime/rendering/template_helpers.d.ts +51 -0
- package/dist/types/runtime/resource.d.ts +18 -0
- package/dist/types/runtime/scheduler.d.ts +21 -21
- package/dist/types/runtime/status.d.ts +11 -10
- package/dist/types/runtime/template_set.d.ts +36 -40
- package/dist/types/runtime/types.d.ts +70 -0
- package/dist/types/runtime/utils.d.ts +24 -25
- package/dist/types/runtime/validation.d.ts +19 -36
- package/dist/types/version.d.ts +1 -1
- package/package.json +45 -19
- package/dist/types/runtime/cancellableContext.d.ts +0 -15
- package/dist/types/runtime/cancellablePromise.d.ts +0 -15
- package/dist/types/runtime/executionContext.d.ts +0 -0
- package/dist/types/runtime/listOperation.d.ts +0 -1
- package/dist/types/runtime/plugins.d.ts +0 -39
- 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/signals.d.ts +0 -17
- package/dist/types/runtime/task.d.ts +0 -12
- package/dist/types/utils/registry.d.ts +0 -15
package/README.md
CHANGED
|
@@ -1,149 +1,139 @@
|
|
|
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 (~20kb 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
|
-
|
|
86
|
+
The documentation below is for **Owl 3**. For the Owl 2 documentation, see the
|
|
87
|
+
[owl-2.x branch](https://github.com/odoo/owl/tree/owl-2.x).
|
|
71
88
|
|
|
72
|
-
|
|
89
|
+
### Getting Started
|
|
73
90
|
|
|
74
|
-
- [
|
|
75
|
-
- [
|
|
76
|
-
- [
|
|
91
|
+
- **[Playground](https://odoo.github.io/owl/playground)** — Interactive examples and live coding
|
|
92
|
+
- [Tutorial: Getting Started](https://odoo.github.io/owl/playground#getting_started) — Learn Owl fundamentals step by step
|
|
93
|
+
- [Tutorial: Todo List](https://odoo.github.io/owl/playground#todo_list) — Build a full TodoMVC app
|
|
94
|
+
- [Tutorial: Hibou OS](https://odoo.github.io/owl/playground#hibou_os) — Build a desktop-like interface
|
|
77
95
|
|
|
78
96
|
### Reference
|
|
79
97
|
|
|
80
|
-
- [
|
|
81
|
-
- [App](doc/reference/app.md)
|
|
82
|
-
- [Component](doc/reference/component.md)
|
|
83
|
-
- [
|
|
84
|
-
- [
|
|
85
|
-
- [
|
|
86
|
-
- [
|
|
87
|
-
- [
|
|
88
|
-
- [
|
|
89
|
-
- [
|
|
90
|
-
- [
|
|
91
|
-
- [
|
|
92
|
-
- [
|
|
93
|
-
- [
|
|
94
|
-
- [
|
|
95
|
-
- [
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
- [
|
|
100
|
-
- [
|
|
101
|
-
- [
|
|
102
|
-
- [
|
|
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)
|
|
98
|
+
- [API Reference](doc/readme.md) — A complete list of everything exported by the Owl library
|
|
99
|
+
- [App](doc/reference/app.md) — Configure and mount an Owl application to the DOM
|
|
100
|
+
- [Component](doc/reference/component.md) — Define components with lifecycle methods and static properties
|
|
101
|
+
- [Error Handling](doc/reference/error_handling.md) — Catch and recover from errors in components
|
|
102
|
+
- [Event Handling](doc/reference/event_handling.md) — Handle DOM events with t-on directives
|
|
103
|
+
- [Form Bindings](doc/reference/form_bindings.md) — Bind form inputs to reactive state with t-model
|
|
104
|
+
- [Hooks](doc/reference/hooks.md) — Use lifecycle hooks and other built-in hooks in components
|
|
105
|
+
- [Plugins](doc/reference/plugins.md) — Share state and services across components with type-safe plugins
|
|
106
|
+
- [Props](doc/reference/props.md) — Pass data to child components with validation and defaults
|
|
107
|
+
- [Reactivity](doc/reference/reactivity.md) — Manage state with signals, computed values, and reactive objects
|
|
108
|
+
- [Refs](doc/reference/refs.md) — Access DOM elements from components with t-ref
|
|
109
|
+
- [Resources and Registries](doc/reference/resources_and_registries.md) — Ordered reactive collections for shared data
|
|
110
|
+
- [Slots](doc/reference/slots.md) — Compose components with named and dynamic slot content
|
|
111
|
+
- [Template Syntax](doc/reference/template_syntax.md) — Write XML templates with QWeb directives
|
|
112
|
+
- [Translations](doc/reference/translations.md) — Translate templates and dynamic strings
|
|
113
|
+
- [Types Validation](doc/reference/types_validation.md) — Validate data structures at runtime with a declarative schema
|
|
114
|
+
|
|
115
|
+
### Misc
|
|
116
|
+
|
|
117
|
+
- [Owl 3.x Release Notes](release_notes.md) — Complete guide to all changes in Owl 3
|
|
118
|
+
- [Design Principles](doc/miscellaneous/design_principles.md)
|
|
119
|
+
- [Why we built Owl](doc/miscellaneous/why_owl.md)
|
|
120
|
+
- [Architecture Notes](doc/miscellaneous/architecture.md)
|
|
112
121
|
- [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
122
|
|
|
118
|
-
##
|
|
123
|
+
## Installation
|
|
119
124
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
```
|
|
125
|
+
```bash
|
|
123
126
|
npm install @odoo/owl
|
|
124
127
|
```
|
|
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)
|
|
128
|
-
|
|
129
|
-
## Installing Owl devtools
|
|
130
|
-
|
|
131
|
-
The Owl devtools browser extension is also available in the [release](https://github.com/odoo/owl/releases/latest):
|
|
132
|
-
Unzip the owl-devtools.zip file and follow the instructions depending on your browser:
|
|
133
|
-
|
|
134
|
-
### Chrome
|
|
135
128
|
|
|
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.
|
|
129
|
+
Or download directly: [latest release](https://github.com/odoo/owl/releases/latest)
|
|
140
130
|
|
|
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.
|
|
131
|
+
## Devtools
|
|
145
132
|
|
|
146
|
-
|
|
147
|
-
|
|
133
|
+
The Owl devtools extension helps debug your applications with component tree
|
|
134
|
+
inspection, state visualization, and performance profiling. Download it from
|
|
135
|
+
the [releases page](https://github.com/odoo/owl/releases/latest).
|
|
148
136
|
|
|
137
|
+
## License
|
|
149
138
|
|
|
139
|
+
Owl is released under the [LGPL v3](https://www.gnu.org/licenses/lgpl-3.0) license.
|