Compare commits
63 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 409431c4ad | |||
| 66a801393f | |||
| e7f405cc97 | |||
| 55c48b2b12 | |||
| 2eb151c92d | |||
| 7952f31e63 | |||
| 11e4e67599 | |||
| 7b7a6de373 | |||
| b63d1e28b2 | |||
| c0667a11c6 | |||
| fddb1ec924 | |||
| e6c3b62ef0 | |||
| 97b69f164f | |||
| 33dfeb1b41 | |||
| dd292472b9 | |||
| 9b18b57fdf | |||
| 68f491cd32 | |||
| 7b3e39ba27 | |||
| 61fc3f4fdc | |||
| 7b454dae66 | |||
| 70101e4c66 | |||
| 5ef405293a | |||
| 9dcbbe54eb | |||
| e94428a186 | |||
| 941190dfa8 | |||
| a53e42518f | |||
| b7c37ca69a | |||
| 34489a2494 | |||
| 398df543fe | |||
| aa6a4a5d46 | |||
| db3499f5e5 | |||
| 166cada8ff | |||
| acbe316689 | |||
| fb013ccc72 | |||
| fee3eecd7f | |||
| 6037018dd2 | |||
| eec7cc4ea7 | |||
| 035895b043 | |||
| ff5ef82ea2 | |||
| 0048205636 | |||
| 0d341d9e7b | |||
| 4c7f572dbe | |||
| 610c272104 | |||
| 32e4565131 | |||
| 9b9c15e4a9 | |||
| b1690f19cc | |||
| 5dcee2564c | |||
| 752160fd85 | |||
| 3937966b74 | |||
| e7ebb92104 | |||
| c78e070636 | |||
| 610ed02373 | |||
| 4b23f51974 | |||
| b25e988628 | |||
| e0758c0e9e | |||
| ba34811f71 | |||
| 28672096a2 | |||
| 9823a4e7dd | |||
| 105ec7ced8 | |||
| 8f9ad987b9 | |||
| 6050827689 | |||
| 9b1ec5dc0e | |||
| 9b1c270501 |
@@ -15,7 +15,7 @@ yarn-debug.log*
|
|||||||
yarn-error.log*
|
yarn-error.log*
|
||||||
|
|
||||||
#ide's
|
#ide's
|
||||||
.vscode
|
**/.vscode/*
|
||||||
.idea
|
.idea
|
||||||
|
|
||||||
node_modules
|
node_modules
|
||||||
@@ -26,3 +26,10 @@ release-notes.md
|
|||||||
|
|
||||||
# useful in some cases
|
# useful in some cases
|
||||||
/temp
|
/temp
|
||||||
|
|
||||||
|
# owl-vision
|
||||||
|
*/owl-vision/out/
|
||||||
|
*/owl-vision/.vs/
|
||||||
|
**/*.vsix
|
||||||
|
!*/owl-vision/.vscode/launch.json
|
||||||
|
!*/owl-vision/.vscode/tasks.json
|
||||||
|
|||||||
@@ -47,3 +47,4 @@ Utility/helpers:
|
|||||||
- [`status`](reference/component.md#status-helper): utility function to get the status of a component (new, mounted or destroyed)
|
- [`status`](reference/component.md#status-helper): utility function to get the status of a component (new, mounted or destroyed)
|
||||||
- [`validate`](reference/utils.md#validate): validates if an object satisfies a specified schema
|
- [`validate`](reference/utils.md#validate): validates if an object satisfies a specified schema
|
||||||
- [`whenReady`](reference/utils.md#whenready): utility function to execute code when DOM is ready
|
- [`whenReady`](reference/utils.md#whenready): utility function to execute code when DOM is ready
|
||||||
|
- [`batched`](reference/utils.md#batched): utility function to batch function calls
|
||||||
|
|||||||
@@ -61,6 +61,8 @@ The `config` object is an object with some of the following keys:
|
|||||||
templates (see [translations](translations.md))
|
templates (see [translations](translations.md))
|
||||||
- **`templates (string | xml document)`**: all the templates that will be used by
|
- **`templates (string | xml document)`**: all the templates that will be used by
|
||||||
the components created by the application.
|
the components created by the application.
|
||||||
|
- **`getTemplate ((s: string) => Element | Function | string | void)`**: a function that will be called by owl when it
|
||||||
|
needs a template. If undefined is returned, owl looks into the app templates.
|
||||||
- **`warnIfNoStaticProps (boolean, default=false)`**: if true, Owl will log a warning
|
- **`warnIfNoStaticProps (boolean, default=false)`**: if true, Owl will log a warning
|
||||||
whenever it encounters a component that does not provide a [static props description](props.md#props-validation).
|
whenever it encounters a component that does not provide a [static props description](props.md#props-validation).
|
||||||
|
|
||||||
|
|||||||
@@ -357,7 +357,7 @@ cleaning operation, since the component may be destroyed before it has even been
|
|||||||
mounted. The `willDestroy` hook is useful in that situation, since it is always
|
mounted. The `willDestroy` hook is useful in that situation, since it is always
|
||||||
called.
|
called.
|
||||||
|
|
||||||
The `onWillUnmount` hook is used to register a function that will be executed at
|
The `onWillDestroy` hook is used to register a function that will be executed at
|
||||||
this moment:
|
this moment:
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
|
|||||||
@@ -51,8 +51,8 @@ that render its content, and a fallback if an error happened.
|
|||||||
```js
|
```js
|
||||||
class ErrorBoundary extends Component {
|
class ErrorBoundary extends Component {
|
||||||
static template = xml`
|
static template = xml`
|
||||||
<t t-if="error" t-slot="fallback">An error occurred</t>
|
<t t-if="state.error" t-slot="fallback">An error occurred</t>
|
||||||
<t t-else="" t-slot="content"`;
|
<t t-else="" t-slot="default"/>`;
|
||||||
|
|
||||||
setup() {
|
setup() {
|
||||||
this.state = useState({ error: false });
|
this.state = useState({ error: false });
|
||||||
|
|||||||
@@ -190,12 +190,13 @@ will then be updated accordingly.
|
|||||||
### `useExternalListener`
|
### `useExternalListener`
|
||||||
|
|
||||||
The `useExternalListener` hook helps solve a very common problem: adding and removing
|
The `useExternalListener` hook helps solve a very common problem: adding and removing
|
||||||
a listener on some target whenever a component is mounted/unmounted. For example,
|
a listener on some target whenever a component is mounted/unmounted. It takes a target
|
||||||
|
as its first argument, forwards the other arguments to `addEventListener`. For example,
|
||||||
a dropdown menu (or its parent) may need to listen to a `click` event on `window`
|
a dropdown menu (or its parent) may need to listen to a `click` event on `window`
|
||||||
to be closed:
|
to be closed:
|
||||||
|
|
||||||
```js
|
```js
|
||||||
useExternalListener(window, "click", this.closeMenu);
|
useExternalListener(window, "click", this.closeMenu, { capture: true });
|
||||||
```
|
```
|
||||||
|
|
||||||
### `useComponent`
|
### `useComponent`
|
||||||
|
|||||||
@@ -238,7 +238,7 @@ class ComponentB extends owl.Component {
|
|||||||
count: {type: Number},
|
count: {type: Number},
|
||||||
messages: {
|
messages: {
|
||||||
type: Array,
|
type: Array,
|
||||||
element: {type: Object, shape: {id: Boolean, text: String }
|
element: {type: Object, shape: {id: Boolean, text: String }}
|
||||||
},
|
},
|
||||||
date: Date,
|
date: Date,
|
||||||
combinedVal: [Number, Boolean],
|
combinedVal: [Number, Boolean],
|
||||||
@@ -276,7 +276,8 @@ class ComponentB extends owl.Component {
|
|||||||
id: Number,
|
id: Number,
|
||||||
name: {type: String, optional: true},
|
name: {type: String, optional: true},
|
||||||
url: String
|
url: String
|
||||||
]}, // object, with keys id (number), name (string, optional) and url (string)
|
}
|
||||||
|
}, // object, with keys id (number), name (string, optional) and url (string)
|
||||||
someObj3: {
|
someObj3: {
|
||||||
type: Object,
|
type: Object,
|
||||||
values: { type: Array, element: String },
|
values: { type: Array, element: String },
|
||||||
|
|||||||
@@ -152,7 +152,7 @@ This may seem counter-intuitive, but it makes perfect sense in the context of co
|
|||||||
```js
|
```js
|
||||||
class DoubleCounter extends Component {
|
class DoubleCounter extends Component {
|
||||||
static template = xml`
|
static template = xml`
|
||||||
<t t-esc="state.selected + ': ' + state[state.selected].value"/>
|
<t t-esc="'selected: ' + state.selected + ', value: ' + state[state.selected]"/>
|
||||||
<button t-on-click="() => this.state.count1++">increment count 1</button>
|
<button t-on-click="() => this.state.count1++">increment count 1</button>
|
||||||
<button t-on-click="() => this.state.count2++">increment count 2</button>
|
<button t-on-click="() => this.state.count2++">increment count 2</button>
|
||||||
<button t-on-click="changeCounter">Switch counter</button>
|
<button t-on-click="changeCounter">Switch counter</button>
|
||||||
@@ -193,7 +193,7 @@ to be able to opt out of creating them in the first place. This is the purpose o
|
|||||||
### `markRaw`
|
### `markRaw`
|
||||||
|
|
||||||
Marks an object so that it is ignored by the reactivity system, meaning that if this object is ever
|
Marks an object so that it is ignored by the reactivity system, meaning that if this object is ever
|
||||||
part of a of a reactive object, it will be returned as is, and no keys in that object will be
|
part of a reactive object, it will be returned as is, and no keys in that object will be
|
||||||
observed.
|
observed.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
|
|||||||
@@ -133,7 +133,7 @@ Slots can define a default content, in case the parent did not define them:
|
|||||||
## Dynamic Slots
|
## Dynamic Slots
|
||||||
|
|
||||||
The `t-slot` directive is actually able to use any expressions, using string
|
The `t-slot` directive is actually able to use any expressions, using string
|
||||||
interplolation:
|
interpolation:
|
||||||
|
|
||||||
```xml
|
```xml
|
||||||
<t t-slot="{{current}}" />
|
<t t-slot="{{current}}" />
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ functions are all available in the `owl.utils` namespace.
|
|||||||
- [`loadFile`](#loadfile): loading a file (useful for templates)
|
- [`loadFile`](#loadfile): loading a file (useful for templates)
|
||||||
- [`EventBus`](#eventbus): a simple EventBus
|
- [`EventBus`](#eventbus): a simple EventBus
|
||||||
- [`validate`](#validate): a validation function
|
- [`validate`](#validate): a validation function
|
||||||
|
- [`batched`](#batched): batch function calls
|
||||||
|
|
||||||
## `whenReady`
|
## `whenReady`
|
||||||
|
|
||||||
@@ -78,3 +79,22 @@ validate(
|
|||||||
// - 'id' is missing (should be a number),
|
// - 'id' is missing (should be a number),
|
||||||
// - 'url' is missing (should be a boolean or list of numbers),
|
// - 'url' is missing (should be a boolean or list of numbers),
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## `batched`
|
||||||
|
|
||||||
|
The `batched` function creates a batched version of a callback so that multiple calls to it within the same microtick will only result in a single invocation of the original callback.
|
||||||
|
|
||||||
|
```js
|
||||||
|
function hello() {
|
||||||
|
console.log("hello");
|
||||||
|
}
|
||||||
|
|
||||||
|
const batchedHello = batched(hello);
|
||||||
|
batchedHello();
|
||||||
|
// Nothing is logged
|
||||||
|
batchedHello();
|
||||||
|
// Still not logged
|
||||||
|
|
||||||
|
await Promise.resolve(); // Await the next microtick
|
||||||
|
// "hello" is logged only once
|
||||||
|
```
|
||||||
|
|||||||
@@ -35,13 +35,13 @@ The components tab is separated into two sub windows: the components tree in the
|
|||||||
the component details in the right. The components tree will display all the different
|
the component details in the right. The components tree will display all the different
|
||||||
components that are present in the tab in the form of a tree. The root of this tree is
|
components that are present in the tab in the form of a tree. The root of this tree is
|
||||||
actually the app which is not a component but can still be inspected by the devtools like
|
actually the app which is not a component but can still be inspected by the devtools like
|
||||||
one. There can also be multiple apps loaded in the page like in the following:
|
one. There can also be multiple apps loaded in the page like in website:
|
||||||
|
|
||||||
<img src="screenshots/multi_apps.png"/>
|
<img src="screenshots/multi_apps.png"/>
|
||||||
|
|
||||||
There is a convenient search bar at the top of the components tree which will help finding
|
There is a convenient search bar at the top of the components tree which will help finding
|
||||||
the components tou want in the tree and also, an element picker can be used to directly select
|
the components tou want in the tree and also, an element picker can be used to directly select
|
||||||
the component you want to focus on in the page which is especially useful when trying to find
|
the component you want to focus on in the page which is especially useful when 1trying to find
|
||||||
what you want. Just click on the elements picker icon and click on the element you want to focus
|
what you want. Just click on the elements picker icon and click on the element you want to focus
|
||||||
on in the page and it will be selected in the devtools accordingly. Hovering any element in the
|
on in the page and it will be selected in the devtools accordingly. Hovering any element in the
|
||||||
page in this mode will highlight it and the same happens anytime in the components tree.
|
page in this mode will highlight it and the same happens anytime in the components tree.
|
||||||
@@ -64,25 +64,18 @@ as its env, props, observed states and all the other variables that are present
|
|||||||
While the props and the env are already present on the actual instance of the component and are
|
While the props and the env are already present on the actual instance of the component and are
|
||||||
pretty explicit by themselves, the observed state value is a bit more complicated to grasp.
|
pretty explicit by themselves, the observed state value is a bit more complicated to grasp.
|
||||||
|
|
||||||
The observed state is actually information about which variables are observed by the component
|
The observed state is actually information about which variables are being observed by the component:
|
||||||
which will trigger a rerender of the component when it is modified. The keys represent which part of the
|
when any property of a reactive object is being read by the component, the component will subscribe
|
||||||
variable is actually observed and the target is the actual variable. For simplicity, the properties
|
to this property which means it will listen to any change that can occur on the property and render
|
||||||
that are not observed by the component are greyed out while the others are in bold. This means that
|
when such a change occurs. This can be visualized easily within the devtools inside of the observed
|
||||||
editing bold ones will trigger a rerender while the greyed out ones will not.
|
state section: observed properties of the reactive object(s) are displayed in bold while the others
|
||||||
|
are greyed out. Do keep in mind that a greyed out property in the observed state of one component
|
||||||
|
may be observed by another and the other way around is also possible. Here is an example for some
|
||||||
|
user Field component:
|
||||||
|
|
||||||
<img src="screenshots/states.png"/>
|
<img src="screenshots/states.png"/>
|
||||||
|
|
||||||
In the given example, we have two keys/target pairs for two different variables. The first one indicates
|
Navigation inside the properties is also similar to the one in console variables: properties have
|
||||||
that adding or removing an element to the array will trigger a rerender since the length will have changed.
|
|
||||||
Replacing the element at index 0, 1 or 2 will also have the same effect as implied by the keys. It doesn't
|
|
||||||
mean that editing the properties of element at index 0, 1 or 2 will rerender the component though. It may
|
|
||||||
be the case for some but this will be described in another keys/target pair. The second keys/target pair
|
|
||||||
is actually the element at index 0 of the first pair. It only has id in the keys meaning that only the
|
|
||||||
id property will actually trigger a rerender the component when modified. Be aware however that the other
|
|
||||||
properties may be in the observed state of another component like a child one in this case. A greyed out
|
|
||||||
property only implies it is not reactive for the selected component and not for the others.
|
|
||||||
|
|
||||||
The navigation inside the properties is also similar to the one in console variables: properties have
|
|
||||||
their prototype displayed and getters will get their value when clicked on (...). It is also possible to
|
their prototype displayed and getters will get their value when clicked on (...). It is also possible to
|
||||||
send any property to the console using the right-click context menu on it and functions can be inspected
|
send any property to the console using the right-click context menu on it and functions can be inspected
|
||||||
in the sources tab as well.
|
in the sources tab as well.
|
||||||
@@ -96,8 +89,10 @@ component's name. Using the left click on the component's name will focus it in
|
|||||||
It is also possible to edit any of the leaf node properties. To do so, you must double click on the
|
It is also possible to edit any of the leaf node properties. To do so, you must double click on the
|
||||||
property's value and modify it using the freshly created input then press enter to apply the changes.
|
property's value and modify it using the freshly created input then press enter to apply the changes.
|
||||||
Do note that the modified values should be written in JSON format in order to be valid (examples:
|
Do note that the modified values should be written in JSON format in order to be valid (examples:
|
||||||
89, "yes", undefined, null, \["hello", 15\], {"a": 1}, true, ...). Whether it has an impact on the
|
89, "yes", undefined, null, \["hello", 15\], {"a": 1}, true, ...). Editing any value will produce a
|
||||||
component or not and whether it produces an error is the responsability of the user.
|
manual render of the component (or the root component of the application in the case of env values).
|
||||||
|
Whether the edition has an impact on the component or not and whether it produces an error is the
|
||||||
|
responsability of the user.
|
||||||
|
|
||||||
<img src="screenshots/edit.png"/>
|
<img src="screenshots/edit.png"/>
|
||||||
|
|
||||||
@@ -117,7 +112,8 @@ are intercepted by the devtools using the record button.
|
|||||||
The second button is used to clear all the events that have been recorded. The select can be used to
|
The second button is used to clear all the events that have been recorded. The select can be used to
|
||||||
switch between the tree view (which shows the causality between renders) and the events log view which
|
switch between the tree view (which shows the causality between renders) and the events log view which
|
||||||
simply displays the events in the exact order they were triggered. In this view, you can expand the create,
|
simply displays the events in the exact order they were triggered. In this view, you can expand the create,
|
||||||
update and destroy events which reveals the component that initiated the event.
|
update and destroy events which reveals the component that initiated the event. Also, a transition line will
|
||||||
|
appear each time a new animation frame has been loaded between events.
|
||||||
|
|
||||||
<img src="screenshots/events_log.png"/>
|
<img src="screenshots/events_log.png"/>
|
||||||
|
|
||||||
@@ -131,20 +127,29 @@ There is also the Trace Renderings and Trace Subscriptions features. These featu
|
|||||||
recording of events and have no effect on the profiler tab. The Trace Renderings option is used to log in
|
recording of events and have no effect on the profiler tab. The Trace Renderings option is used to log in
|
||||||
the console all the render events and allows to show their traceback information. Similarly, the Trace
|
the console all the render events and allows to show their traceback information. Similarly, the Trace
|
||||||
Subscriptions option logs all the properties that caused a render event and also allows to see the traceback
|
Subscriptions option logs all the properties that caused a render event and also allows to see the traceback
|
||||||
of the modification
|
of the modification.
|
||||||
|
|
||||||
<img src="screenshots/trace_rendering.png"/>
|
<img src="screenshots/trace_rendering.png"/>
|
||||||
<img src="screenshots/trace_subscriptions.png"/>
|
<img src="screenshots/trace_subscriptions.png"/>
|
||||||
|
|
||||||
|
The Owl Devtools also allow to inspect iframes coded in Owl: when an Owl iframe is detected in the page,
|
||||||
|
the iframe selector will appear next to the tabs. This allows to switch from an iframe to another easily.
|
||||||
|
Be aware that switching iframes will clear all record events from the profiler tab. Iframes detection is
|
||||||
|
currently not working in the firefox version, we are aware of this issue and will try to address it in the
|
||||||
|
future.
|
||||||
|
|
||||||
|
<img src="screenshots/iframes.png"/>
|
||||||
|
|
||||||
## Options
|
## Options
|
||||||
|
|
||||||
The owl devtools extension has a dark mode feature which defaults to your general devtools settings and can
|
The owl devtools extension has a dark mode feature which defaults to your general devtools settings and can
|
||||||
be toggled using the sun/moon icon at the top-right corner of the tab. All the examples above were created
|
be toggled using the sun/moon icon at the top-right corner of the tab. There is also a refresh button to
|
||||||
with the dark mode enabled. There is also a refresh button to completely reset the owl devtools.
|
completely reset the owl devtools.
|
||||||
|
|
||||||
<img src="screenshots/darkmode.png"/>
|
<img src="screenshots/darkmode.png"/>
|
||||||
|
|
||||||
## Troubleshooting
|
## Troubleshooting
|
||||||
|
|
||||||
If the feedback from the page to the devtools seems to be cut, just close the devtools and refresh the page.
|
If the feedback from the page to the devtools seems to be cut, you can first try to use the refresh
|
||||||
|
button mentioned above but if it still doesn't seem to work, just close the devtools and refresh the page.
|
||||||
This will eventually happen any time a tab stays opened for too long without being refreshed.
|
This will eventually happen any time a tab stays opened for too long without being refreshed.
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 333 KiB After Width: | Height: | Size: 545 KiB |
|
Before Width: | Height: | Size: 210 KiB After Width: | Height: | Size: 387 KiB |
|
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 72 KiB |
|
Before Width: | Height: | Size: 197 KiB After Width: | Height: | Size: 266 KiB |
|
Before Width: | Height: | Size: 185 KiB After Width: | Height: | Size: 320 KiB |
|
After Width: | Height: | Size: 206 KiB |
|
Before Width: | Height: | Size: 166 KiB After Width: | Height: | Size: 329 KiB |
|
Before Width: | Height: | Size: 86 KiB After Width: | Height: | Size: 166 KiB |
|
Before Width: | Height: | Size: 311 KiB After Width: | Height: | Size: 536 KiB |
|
Before Width: | Height: | Size: 336 KiB After Width: | Height: | Size: 488 KiB |
|
Before Width: | Height: | Size: 27 KiB After Width: | Height: | Size: 36 KiB |
|
Before Width: | Height: | Size: 44 KiB After Width: | Height: | Size: 177 KiB |
|
Before Width: | Height: | Size: 146 KiB After Width: | Height: | Size: 182 KiB |
@@ -82,67 +82,6 @@ function toggler(key, child) {
|
|||||||
|
|
||||||
// Custom error class that wraps error that happen in the owl lifecycle
|
// Custom error class that wraps error that happen in the owl lifecycle
|
||||||
class OwlError extends Error {
|
class OwlError extends Error {
|
||||||
}
|
|
||||||
// Maps fibers to thrown errors
|
|
||||||
const fibersInError = new WeakMap();
|
|
||||||
const nodeErrorHandlers = new WeakMap();
|
|
||||||
function _handleError(node, error) {
|
|
||||||
if (!node) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
const fiber = node.fiber;
|
|
||||||
if (fiber) {
|
|
||||||
fibersInError.set(fiber, error);
|
|
||||||
}
|
|
||||||
const errorHandlers = nodeErrorHandlers.get(node);
|
|
||||||
if (errorHandlers) {
|
|
||||||
let handled = false;
|
|
||||||
// execute in the opposite order
|
|
||||||
for (let i = errorHandlers.length - 1; i >= 0; i--) {
|
|
||||||
try {
|
|
||||||
errorHandlers[i](error);
|
|
||||||
handled = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
catch (e) {
|
|
||||||
error = e;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (handled) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return _handleError(node.parent, error);
|
|
||||||
}
|
|
||||||
function handleError(params) {
|
|
||||||
let { error } = params;
|
|
||||||
// Wrap error if it wasn't wrapped by wrapError (ie when not in dev mode)
|
|
||||||
if (!(error instanceof OwlError)) {
|
|
||||||
error = Object.assign(new OwlError(`An error occured in the owl lifecycle (see this Error's "cause" property)`), { cause: error });
|
|
||||||
}
|
|
||||||
const node = "node" in params ? params.node : params.fiber.node;
|
|
||||||
const fiber = "fiber" in params ? params.fiber : node.fiber;
|
|
||||||
if (fiber) {
|
|
||||||
// resets the fibers on components if possible. This is important so that
|
|
||||||
// new renderings can be properly included in the initial one, if any.
|
|
||||||
let current = fiber;
|
|
||||||
do {
|
|
||||||
current.node.fiber = current;
|
|
||||||
current = current.parent;
|
|
||||||
} while (current);
|
|
||||||
fibersInError.set(fiber.root, error);
|
|
||||||
}
|
|
||||||
const handled = _handleError(node, error);
|
|
||||||
if (!handled) {
|
|
||||||
console.warn(`[Owl] Unhandled error. Destroying the root component`);
|
|
||||||
try {
|
|
||||||
node.app.destroy();
|
|
||||||
}
|
|
||||||
catch (e) {
|
|
||||||
console.error(e);
|
|
||||||
}
|
|
||||||
throw error;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const { setAttribute: elemSetAttribute, removeAttribute } = Element.prototype;
|
const { setAttribute: elemSetAttribute, removeAttribute } = Element.prototype;
|
||||||
@@ -771,12 +710,7 @@ function buildTree(node, parent = null, domParentTree = null) {
|
|||||||
info.push({ type: "child", idx: index });
|
info.push({ type: "child", idx: index });
|
||||||
el = document.createTextNode("");
|
el = document.createTextNode("");
|
||||||
}
|
}
|
||||||
const attrs = node.attributes;
|
currentNS || (currentNS = node.namespaceURI);
|
||||||
const ns = attrs.getNamedItem("block-ns");
|
|
||||||
if (ns) {
|
|
||||||
attrs.removeNamedItem("block-ns");
|
|
||||||
currentNS = ns.value;
|
|
||||||
}
|
|
||||||
if (!el) {
|
if (!el) {
|
||||||
el = currentNS
|
el = currentNS
|
||||||
? document.createElementNS(currentNS, tagName)
|
? document.createElementNS(currentNS, tagName)
|
||||||
@@ -792,6 +726,7 @@ function buildTree(node, parent = null, domParentTree = null) {
|
|||||||
const fragment = document.createElement("template").content;
|
const fragment = document.createElement("template").content;
|
||||||
fragment.appendChild(el);
|
fragment.appendChild(el);
|
||||||
}
|
}
|
||||||
|
const attrs = node.attributes;
|
||||||
for (let i = 0; i < attrs.length; i++) {
|
for (let i = 0; i < attrs.length; i++) {
|
||||||
const attrName = attrs[i].name;
|
const attrName = attrs[i].name;
|
||||||
const attrValue = attrs[i].value;
|
const attrValue = attrs[i].value;
|
||||||
@@ -1603,6 +1538,68 @@ function remove(vnode, withBeforeRemove = false) {
|
|||||||
vnode.remove();
|
vnode.remove();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Maps fibers to thrown errors
|
||||||
|
const fibersInError = new WeakMap();
|
||||||
|
const nodeErrorHandlers = new WeakMap();
|
||||||
|
function _handleError(node, error) {
|
||||||
|
if (!node) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
const fiber = node.fiber;
|
||||||
|
if (fiber) {
|
||||||
|
fibersInError.set(fiber, error);
|
||||||
|
}
|
||||||
|
const errorHandlers = nodeErrorHandlers.get(node);
|
||||||
|
if (errorHandlers) {
|
||||||
|
let handled = false;
|
||||||
|
// execute in the opposite order
|
||||||
|
for (let i = errorHandlers.length - 1; i >= 0; i--) {
|
||||||
|
try {
|
||||||
|
errorHandlers[i](error);
|
||||||
|
handled = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
catch (e) {
|
||||||
|
error = e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (handled) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return _handleError(node.parent, error);
|
||||||
|
}
|
||||||
|
function handleError(params) {
|
||||||
|
let { error } = params;
|
||||||
|
// Wrap error if it wasn't wrapped by wrapError (ie when not in dev mode)
|
||||||
|
if (!(error instanceof OwlError)) {
|
||||||
|
error = Object.assign(new OwlError(`An error occured in the owl lifecycle (see this Error's "cause" property)`), { cause: error });
|
||||||
|
}
|
||||||
|
const node = "node" in params ? params.node : params.fiber.node;
|
||||||
|
const fiber = "fiber" in params ? params.fiber : node.fiber;
|
||||||
|
if (fiber) {
|
||||||
|
// resets the fibers on components if possible. This is important so that
|
||||||
|
// new renderings can be properly included in the initial one, if any.
|
||||||
|
let current = fiber;
|
||||||
|
do {
|
||||||
|
current.node.fiber = current;
|
||||||
|
current = current.parent;
|
||||||
|
} while (current);
|
||||||
|
fibersInError.set(fiber.root, error);
|
||||||
|
}
|
||||||
|
const handled = _handleError(node, error);
|
||||||
|
if (!handled) {
|
||||||
|
console.warn(`[Owl] Unhandled error. Destroying the root component`);
|
||||||
|
try {
|
||||||
|
node.app.destroy();
|
||||||
|
}
|
||||||
|
catch (e) {
|
||||||
|
console.error(e);
|
||||||
|
}
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function makeChildFiber(node, parent) {
|
function makeChildFiber(node, parent) {
|
||||||
let current = node.fiber;
|
let current = node.fiber;
|
||||||
if (current) {
|
if (current) {
|
||||||
@@ -1853,8 +1850,9 @@ const NO_CALLBACK = () => {
|
|||||||
};
|
};
|
||||||
const objectToString = Object.prototype.toString;
|
const objectToString = Object.prototype.toString;
|
||||||
const objectHasOwnProperty = Object.prototype.hasOwnProperty;
|
const objectHasOwnProperty = Object.prototype.hasOwnProperty;
|
||||||
const SUPPORTED_RAW_TYPES = new Set(["Object", "Array", "Set", "Map", "WeakMap"]);
|
// Use arrays because Array.includes is faster than Set.has for small arrays
|
||||||
const COLLECTION_RAWTYPES = new Set(["Set", "Map", "WeakMap"]);
|
const SUPPORTED_RAW_TYPES = ["Object", "Array", "Set", "Map", "WeakMap"];
|
||||||
|
const COLLECTION_RAW_TYPES = ["Set", "Map", "WeakMap"];
|
||||||
/**
|
/**
|
||||||
* extract "RawType" from strings like "[object RawType]" => this lets us ignore
|
* extract "RawType" from strings like "[object RawType]" => this lets us ignore
|
||||||
* many native objects such as Promise (whose toString is [object Promise])
|
* many native objects such as Promise (whose toString is [object Promise])
|
||||||
@@ -1877,7 +1875,7 @@ function canBeMadeReactive(value) {
|
|||||||
if (typeof value !== "object") {
|
if (typeof value !== "object") {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return SUPPORTED_RAW_TYPES.has(rawType(value));
|
return SUPPORTED_RAW_TYPES.includes(rawType(value));
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Creates a reactive from the given object/callback if possible and returns it,
|
* Creates a reactive from the given object/callback if possible and returns it,
|
||||||
@@ -2047,7 +2045,7 @@ function reactive(target, callback = NO_CALLBACK) {
|
|||||||
const reactivesForTarget = reactiveCache.get(target);
|
const reactivesForTarget = reactiveCache.get(target);
|
||||||
if (!reactivesForTarget.has(callback)) {
|
if (!reactivesForTarget.has(callback)) {
|
||||||
const targetRawType = rawType(target);
|
const targetRawType = rawType(target);
|
||||||
const handler = COLLECTION_RAWTYPES.has(targetRawType)
|
const handler = COLLECTION_RAW_TYPES.includes(targetRawType)
|
||||||
? collectionsProxyHandler(target, callback, targetRawType)
|
? collectionsProxyHandler(target, callback, targetRawType)
|
||||||
: basicProxyHandler(callback);
|
: basicProxyHandler(callback);
|
||||||
const proxy = new Proxy(target, handler);
|
const proxy = new Proxy(target, handler);
|
||||||
@@ -2076,7 +2074,7 @@ function basicProxyHandler(callback) {
|
|||||||
set(target, key, value, receiver) {
|
set(target, key, value, receiver) {
|
||||||
const hadKey = objectHasOwnProperty.call(target, key);
|
const hadKey = objectHasOwnProperty.call(target, key);
|
||||||
const originalValue = Reflect.get(target, key, receiver);
|
const originalValue = Reflect.get(target, key, receiver);
|
||||||
const ret = Reflect.set(target, key, value, receiver);
|
const ret = Reflect.set(target, key, toRaw(value), receiver);
|
||||||
if (!hadKey && objectHasOwnProperty.call(target, key)) {
|
if (!hadKey && objectHasOwnProperty.call(target, key)) {
|
||||||
notifyReactives(target, KEYCHANGES);
|
notifyReactives(target, KEYCHANGES);
|
||||||
}
|
}
|
||||||
@@ -2180,7 +2178,7 @@ function delegateAndNotify(setterName, getterName, target) {
|
|||||||
if (hadKey !== hasKey) {
|
if (hadKey !== hasKey) {
|
||||||
notifyReactives(target, KEYCHANGES);
|
notifyReactives(target, KEYCHANGES);
|
||||||
}
|
}
|
||||||
if (originalValue !== value) {
|
if (originalValue !== target[getterName](key)) {
|
||||||
notifyReactives(target, key);
|
notifyReactives(target, key);
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
@@ -2624,7 +2622,7 @@ function wrapError(fn, hookName) {
|
|||||||
result.catch(() => { }),
|
result.catch(() => { }),
|
||||||
new Promise((resolve) => setTimeout(() => resolve(TIMEOUT), 3000)),
|
new Promise((resolve) => setTimeout(() => resolve(TIMEOUT), 3000)),
|
||||||
]).then((res) => {
|
]).then((res) => {
|
||||||
if (res === TIMEOUT && node.fiber === fiber) {
|
if (res === TIMEOUT && node.fiber === fiber && node.status <= 2) {
|
||||||
console.warn(timeoutError);
|
console.warn(timeoutError);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -3001,15 +2999,13 @@ function prepareList(collection) {
|
|||||||
keys = [...collection.keys()];
|
keys = [...collection.keys()];
|
||||||
values = [...collection.values()];
|
values = [...collection.values()];
|
||||||
}
|
}
|
||||||
|
else if (Symbol.iterator in Object(collection)) {
|
||||||
|
keys = [...collection];
|
||||||
|
values = keys;
|
||||||
|
}
|
||||||
else if (collection && typeof collection === "object") {
|
else if (collection && typeof collection === "object") {
|
||||||
if (Symbol.iterator in collection) {
|
values = Object.values(collection);
|
||||||
keys = [...collection];
|
keys = Object.keys(collection);
|
||||||
values = keys;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
values = Object.keys(collection);
|
|
||||||
keys = Object.values(collection);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
throw new OwlError(`Invalid loop expression: "${collection}" is not iterable`);
|
throw new OwlError(`Invalid loop expression: "${collection}" is not iterable`);
|
||||||
@@ -3164,8 +3160,14 @@ const helpers = {
|
|||||||
makeRefWrapper,
|
makeRefWrapper,
|
||||||
};
|
};
|
||||||
|
|
||||||
const bdom = { text, createBlock, list, multi, html, toggler, comment };
|
/**
|
||||||
function parseXML$1(xml) {
|
* Parses an XML string into an XML document, throwing errors on parser errors
|
||||||
|
* instead of returning an XML document containing the parseerror.
|
||||||
|
*
|
||||||
|
* @param xml the string to parse
|
||||||
|
* @returns an XML document corresponding to the content of the string
|
||||||
|
*/
|
||||||
|
function parseXML(xml) {
|
||||||
const parser = new DOMParser();
|
const parser = new DOMParser();
|
||||||
const doc = parser.parseFromString(xml, "text/xml");
|
const doc = parser.parseFromString(xml, "text/xml");
|
||||||
if (doc.getElementsByTagName("parsererror").length) {
|
if (doc.getElementsByTagName("parsererror").length) {
|
||||||
@@ -3192,7 +3194,9 @@ function parseXML$1(xml) {
|
|||||||
throw new OwlError(msg);
|
throw new OwlError(msg);
|
||||||
}
|
}
|
||||||
return doc;
|
return doc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const bdom = { text, createBlock, list, multi, html, toggler, comment };
|
||||||
class TemplateSet {
|
class TemplateSet {
|
||||||
constructor(config = {}) {
|
constructor(config = {}) {
|
||||||
this.rawTemplates = Object.create(globalTemplates);
|
this.rawTemplates = Object.create(globalTemplates);
|
||||||
@@ -3202,14 +3206,26 @@ class TemplateSet {
|
|||||||
this.translateFn = config.translateFn;
|
this.translateFn = config.translateFn;
|
||||||
this.translatableAttributes = config.translatableAttributes;
|
this.translatableAttributes = config.translatableAttributes;
|
||||||
if (config.templates) {
|
if (config.templates) {
|
||||||
this.addTemplates(config.templates);
|
if (config.templates instanceof Document || typeof config.templates === "string") {
|
||||||
|
this.addTemplates(config.templates);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
for (const name in config.templates) {
|
||||||
|
this.addTemplate(name, config.templates[name]);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
this.getRawTemplate = config.getTemplate;
|
||||||
}
|
}
|
||||||
static registerTemplate(name, fn) {
|
static registerTemplate(name, fn) {
|
||||||
globalTemplates[name] = fn;
|
globalTemplates[name] = fn;
|
||||||
}
|
}
|
||||||
addTemplate(name, template) {
|
addTemplate(name, template) {
|
||||||
if (name in this.rawTemplates) {
|
if (name in this.rawTemplates) {
|
||||||
|
// this check can be expensive, just silently ignore double definitions outside dev mode
|
||||||
|
if (!this.dev) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
const rawTemplate = this.rawTemplates[name];
|
const rawTemplate = this.rawTemplates[name];
|
||||||
const currentAsString = typeof rawTemplate === "string"
|
const currentAsString = typeof rawTemplate === "string"
|
||||||
? rawTemplate
|
? rawTemplate
|
||||||
@@ -3229,15 +3245,16 @@ class TemplateSet {
|
|||||||
// empty string
|
// empty string
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
xml = xml instanceof Document ? xml : parseXML$1(xml);
|
xml = xml instanceof Document ? xml : parseXML(xml);
|
||||||
for (const template of xml.querySelectorAll("[t-name]")) {
|
for (const template of xml.querySelectorAll("[t-name]")) {
|
||||||
const name = template.getAttribute("t-name");
|
const name = template.getAttribute("t-name");
|
||||||
this.addTemplate(name, template);
|
this.addTemplate(name, template);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
getTemplate(name) {
|
getTemplate(name) {
|
||||||
|
var _a;
|
||||||
if (!(name in this.templates)) {
|
if (!(name in this.templates)) {
|
||||||
const rawTemplate = this.rawTemplates[name];
|
const rawTemplate = ((_a = this.getRawTemplate) === null || _a === void 0 ? void 0 : _a.call(this, name)) || this.rawTemplates[name];
|
||||||
if (rawTemplate === undefined) {
|
if (rawTemplate === undefined) {
|
||||||
let extraInfo = "";
|
let extraInfo = "";
|
||||||
try {
|
try {
|
||||||
@@ -3495,7 +3512,7 @@ function compileExprToArray(expr) {
|
|||||||
const localVars = new Set();
|
const localVars = new Set();
|
||||||
const tokens = tokenize(expr);
|
const tokens = tokenize(expr);
|
||||||
let i = 0;
|
let i = 0;
|
||||||
let stack = []; // to track last opening [ or {
|
let stack = []; // to track last opening (, [ or {
|
||||||
while (i < tokens.length) {
|
while (i < tokens.length) {
|
||||||
let token = tokens[i];
|
let token = tokens[i];
|
||||||
let prevToken = tokens[i - 1];
|
let prevToken = tokens[i - 1];
|
||||||
@@ -3504,10 +3521,12 @@ function compileExprToArray(expr) {
|
|||||||
switch (token.type) {
|
switch (token.type) {
|
||||||
case "LEFT_BRACE":
|
case "LEFT_BRACE":
|
||||||
case "LEFT_BRACKET":
|
case "LEFT_BRACKET":
|
||||||
|
case "LEFT_PAREN":
|
||||||
stack.push(token.type);
|
stack.push(token.type);
|
||||||
break;
|
break;
|
||||||
case "RIGHT_BRACE":
|
case "RIGHT_BRACE":
|
||||||
case "RIGHT_BRACKET":
|
case "RIGHT_BRACKET":
|
||||||
|
case "RIGHT_PAREN":
|
||||||
stack.pop();
|
stack.pop();
|
||||||
}
|
}
|
||||||
let isVar = token.type === "SYMBOL" && !RESERVED_WORDS.includes(token.value);
|
let isVar = token.type === "SYMBOL" && !RESERVED_WORDS.includes(token.value);
|
||||||
@@ -3619,6 +3638,13 @@ function isProp(tag, key) {
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Returns a template literal that evaluates to str. You can add interpolation
|
||||||
|
* sigils into the string if required
|
||||||
|
*/
|
||||||
|
function toStringExpression(str) {
|
||||||
|
return `\`${str.replace(/\\/g, "\\\\").replace(/`/g, "\\`").replace(/\$\{/, "\\${")}\``;
|
||||||
|
}
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
// BlockDescription
|
// BlockDescription
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
@@ -3799,15 +3825,14 @@ class CodeGenerator {
|
|||||||
mainCode.push(``);
|
mainCode.push(``);
|
||||||
for (let block of this.blocks) {
|
for (let block of this.blocks) {
|
||||||
if (block.dom) {
|
if (block.dom) {
|
||||||
let xmlString = block.asXmlString();
|
let xmlString = toStringExpression(block.asXmlString());
|
||||||
xmlString = xmlString.replace(/\\/g, "\\\\").replace(/`/g, "\\`");
|
|
||||||
if (block.dynamicTagName) {
|
if (block.dynamicTagName) {
|
||||||
xmlString = xmlString.replace(/^<\w+/, `<\${tag || '${block.dom.nodeName}'}`);
|
xmlString = xmlString.replace(/^`<\w+/, `\`<\${tag || '${block.dom.nodeName}'}`);
|
||||||
xmlString = xmlString.replace(/\w+>$/, `\${tag || '${block.dom.nodeName}'}>`);
|
xmlString = xmlString.replace(/\w+>`$/, `\${tag || '${block.dom.nodeName}'}>\``);
|
||||||
mainCode.push(`let ${block.blockName} = tag => createBlock(\`${xmlString}\`);`);
|
mainCode.push(`let ${block.blockName} = tag => createBlock(${xmlString});`);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
mainCode.push(`let ${block.blockName} = createBlock(\`${xmlString}\`);`);
|
mainCode.push(`let ${block.blockName} = createBlock(${xmlString});`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3853,7 +3878,7 @@ class CodeGenerator {
|
|||||||
createBlock(parentBlock, type, ctx) {
|
createBlock(parentBlock, type, ctx) {
|
||||||
const hasRoot = this.target.hasRoot;
|
const hasRoot = this.target.hasRoot;
|
||||||
const block = new BlockDescription(this.target, type);
|
const block = new BlockDescription(this.target, type);
|
||||||
if (!hasRoot && !ctx.preventRoot) {
|
if (!hasRoot) {
|
||||||
this.target.hasRoot = true;
|
this.target.hasRoot = true;
|
||||||
block.isRoot = true;
|
block.isRoot = true;
|
||||||
}
|
}
|
||||||
@@ -3876,7 +3901,7 @@ class CodeGenerator {
|
|||||||
if (ctx.tKeyExpr) {
|
if (ctx.tKeyExpr) {
|
||||||
blockExpr = `toggler(${ctx.tKeyExpr}, ${blockExpr})`;
|
blockExpr = `toggler(${ctx.tKeyExpr}, ${blockExpr})`;
|
||||||
}
|
}
|
||||||
if (block.isRoot && !ctx.preventRoot) {
|
if (block.isRoot) {
|
||||||
if (this.target.on) {
|
if (this.target.on) {
|
||||||
blockExpr = this.wrapWithEventCatcher(blockExpr, this.target.on);
|
blockExpr = this.wrapWithEventCatcher(blockExpr, this.target.on);
|
||||||
}
|
}
|
||||||
@@ -3985,7 +4010,7 @@ class CodeGenerator {
|
|||||||
const isNewBlock = !block || forceNewBlock;
|
const isNewBlock = !block || forceNewBlock;
|
||||||
if (isNewBlock) {
|
if (isNewBlock) {
|
||||||
block = this.createBlock(block, "comment", ctx);
|
block = this.createBlock(block, "comment", ctx);
|
||||||
this.insertBlock(`comment(\`${ast.value}\`)`, block, {
|
this.insertBlock(`comment(${toStringExpression(ast.value)})`, block, {
|
||||||
...ctx,
|
...ctx,
|
||||||
forceNewBlock: forceNewBlock && !block,
|
forceNewBlock: forceNewBlock && !block,
|
||||||
});
|
});
|
||||||
@@ -4007,7 +4032,7 @@ class CodeGenerator {
|
|||||||
}
|
}
|
||||||
if (!block || forceNewBlock) {
|
if (!block || forceNewBlock) {
|
||||||
block = this.createBlock(block, "text", ctx);
|
block = this.createBlock(block, "text", ctx);
|
||||||
this.insertBlock(`text(\`${value}\`)`, block, {
|
this.insertBlock(`text(${toStringExpression(value)})`, block, {
|
||||||
...ctx,
|
...ctx,
|
||||||
forceNewBlock: forceNewBlock && !block,
|
forceNewBlock: forceNewBlock && !block,
|
||||||
});
|
});
|
||||||
@@ -4052,11 +4077,6 @@ class CodeGenerator {
|
|||||||
}
|
}
|
||||||
// attributes
|
// attributes
|
||||||
const attrs = {};
|
const attrs = {};
|
||||||
const nameSpace = ast.ns || ctx.nameSpace;
|
|
||||||
if (nameSpace && isNewBlock) {
|
|
||||||
// specific namespace uri
|
|
||||||
attrs["block-ns"] = nameSpace;
|
|
||||||
}
|
|
||||||
for (let key in ast.attrs) {
|
for (let key in ast.attrs) {
|
||||||
let expr, attrName;
|
let expr, attrName;
|
||||||
if (key.startsWith("t-attf")) {
|
if (key.startsWith("t-attf")) {
|
||||||
@@ -4172,7 +4192,10 @@ class CodeGenerator {
|
|||||||
const idx = block.insertData(setRefStr, "ref");
|
const idx = block.insertData(setRefStr, "ref");
|
||||||
attrs["block-ref"] = String(idx);
|
attrs["block-ref"] = String(idx);
|
||||||
}
|
}
|
||||||
const dom = xmlDoc.createElement(ast.tag);
|
const nameSpace = ast.ns || ctx.nameSpace;
|
||||||
|
const dom = nameSpace
|
||||||
|
? xmlDoc.createElementNS(nameSpace, ast.tag)
|
||||||
|
: xmlDoc.createElement(ast.tag);
|
||||||
for (const [attr, val] of Object.entries(attrs)) {
|
for (const [attr, val] of Object.entries(attrs)) {
|
||||||
if (!(attr === "class" && val === "")) {
|
if (!(attr === "class" && val === "")) {
|
||||||
dom.setAttribute(attr, val);
|
dom.setAttribute(attr, val);
|
||||||
@@ -4214,7 +4237,7 @@ class CodeGenerator {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.addLine(`let ${block.children.map((c) => c.varName)};`, codeIdx);
|
this.addLine(`let ${block.children.map((c) => c.varName).join(", ")};`, codeIdx);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return block.varName;
|
return block.varName;
|
||||||
@@ -4230,7 +4253,8 @@ class CodeGenerator {
|
|||||||
expr = compileExpr(ast.expr);
|
expr = compileExpr(ast.expr);
|
||||||
if (ast.defaultValue) {
|
if (ast.defaultValue) {
|
||||||
this.helpers.add("withDefault");
|
this.helpers.add("withDefault");
|
||||||
expr = `withDefault(${expr}, \`${ast.defaultValue}\`)`;
|
// FIXME: defaultValue is not translated
|
||||||
|
expr = `withDefault(${expr}, ${toStringExpression(ast.defaultValue)})`;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!block || forceNewBlock) {
|
if (!block || forceNewBlock) {
|
||||||
@@ -4317,7 +4341,7 @@ class CodeGenerator {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.addLine(`let ${block.children.map((c) => c.varName)};`, codeIdx);
|
this.addLine(`let ${block.children.map((c) => c.varName).join(", ")};`, codeIdx);
|
||||||
}
|
}
|
||||||
// note: this part is duplicated from end of compilemulti:
|
// note: this part is duplicated from end of compilemulti:
|
||||||
const args = block.children.map((c) => c.varName).join(", ");
|
const args = block.children.map((c) => c.varName).join(", ");
|
||||||
@@ -4346,18 +4370,18 @@ class CodeGenerator {
|
|||||||
}
|
}
|
||||||
this.addLine(`for (let ${loopVar} = 0; ${loopVar} < ${l}; ${loopVar}++) {`);
|
this.addLine(`for (let ${loopVar} = 0; ${loopVar} < ${l}; ${loopVar}++) {`);
|
||||||
this.target.indentLevel++;
|
this.target.indentLevel++;
|
||||||
this.addLine(`ctx[\`${ast.elem}\`] = ${vals}[${loopVar}];`);
|
this.addLine(`ctx[\`${ast.elem}\`] = ${keys}[${loopVar}];`);
|
||||||
if (!ast.hasNoFirst) {
|
if (!ast.hasNoFirst) {
|
||||||
this.addLine(`ctx[\`${ast.elem}_first\`] = ${loopVar} === 0;`);
|
this.addLine(`ctx[\`${ast.elem}_first\`] = ${loopVar} === 0;`);
|
||||||
}
|
}
|
||||||
if (!ast.hasNoLast) {
|
if (!ast.hasNoLast) {
|
||||||
this.addLine(`ctx[\`${ast.elem}_last\`] = ${loopVar} === ${vals}.length - 1;`);
|
this.addLine(`ctx[\`${ast.elem}_last\`] = ${loopVar} === ${keys}.length - 1;`);
|
||||||
}
|
}
|
||||||
if (!ast.hasNoIndex) {
|
if (!ast.hasNoIndex) {
|
||||||
this.addLine(`ctx[\`${ast.elem}_index\`] = ${loopVar};`);
|
this.addLine(`ctx[\`${ast.elem}_index\`] = ${loopVar};`);
|
||||||
}
|
}
|
||||||
if (!ast.hasNoValue) {
|
if (!ast.hasNoValue) {
|
||||||
this.addLine(`ctx[\`${ast.elem}_value\`] = ${keys}[${loopVar}];`);
|
this.addLine(`ctx[\`${ast.elem}_value\`] = ${vals}[${loopVar}];`);
|
||||||
}
|
}
|
||||||
this.define(`key${this.target.loopLevel}`, ast.key ? compileExpr(ast.key) : loopVar);
|
this.define(`key${this.target.loopLevel}`, ast.key ? compileExpr(ast.key) : loopVar);
|
||||||
if (this.dev) {
|
if (this.dev) {
|
||||||
@@ -4432,7 +4456,6 @@ class CodeGenerator {
|
|||||||
block,
|
block,
|
||||||
index,
|
index,
|
||||||
forceNewBlock: !isTSet,
|
forceNewBlock: !isTSet,
|
||||||
preventRoot: ctx.preventRoot,
|
|
||||||
isLast: ctx.isLast && i === l - 1,
|
isLast: ctx.isLast && i === l - 1,
|
||||||
});
|
});
|
||||||
this.compileAST(child, subCtx);
|
this.compileAST(child, subCtx);
|
||||||
@@ -4441,21 +4464,19 @@ class CodeGenerator {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (isNewBlock) {
|
if (isNewBlock) {
|
||||||
if (block.hasDynamicChildren) {
|
if (block.hasDynamicChildren && block.children.length) {
|
||||||
if (block.children.length) {
|
const code = this.target.code;
|
||||||
const code = this.target.code;
|
const children = block.children.slice();
|
||||||
const children = block.children.slice();
|
let current = children.shift();
|
||||||
let current = children.shift();
|
for (let i = codeIdx; i < code.length; i++) {
|
||||||
for (let i = codeIdx; i < code.length; i++) {
|
if (code[i].trimStart().startsWith(`const ${current.varName} `)) {
|
||||||
if (code[i].trimStart().startsWith(`const ${current.varName} `)) {
|
code[i] = code[i].replace(`const ${current.varName}`, current.varName);
|
||||||
code[i] = code[i].replace(`const ${current.varName}`, current.varName);
|
current = children.shift();
|
||||||
current = children.shift();
|
if (!current)
|
||||||
if (!current)
|
break;
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
this.addLine(`let ${block.children.map((c) => c.varName)};`, codeIdx);
|
|
||||||
}
|
}
|
||||||
|
this.addLine(`let ${block.children.map((c) => c.varName).join(", ")};`, codeIdx);
|
||||||
}
|
}
|
||||||
const args = block.children.map((c) => c.varName).join(", ");
|
const args = block.children.map((c) => c.varName).join(", ");
|
||||||
this.insertBlock(`multi([${args}])`, block, ctx);
|
this.insertBlock(`multi([${args}])`, block, ctx);
|
||||||
@@ -4469,32 +4490,30 @@ class CodeGenerator {
|
|||||||
ctxVar = generateId("ctx");
|
ctxVar = generateId("ctx");
|
||||||
this.addLine(`let ${ctxVar} = ${compileExpr(ast.context)};`);
|
this.addLine(`let ${ctxVar} = ${compileExpr(ast.context)};`);
|
||||||
}
|
}
|
||||||
|
const isDynamic = INTERP_REGEXP.test(ast.name);
|
||||||
|
const subTemplate = isDynamic ? interpolate(ast.name) : "`" + ast.name + "`";
|
||||||
|
if (block && !forceNewBlock) {
|
||||||
|
this.insertAnchor(block);
|
||||||
|
}
|
||||||
|
block = this.createBlock(block, "multi", ctx);
|
||||||
if (ast.body) {
|
if (ast.body) {
|
||||||
this.addLine(`${ctxVar} = Object.create(${ctxVar});`);
|
this.addLine(`${ctxVar} = Object.create(${ctxVar});`);
|
||||||
this.addLine(`${ctxVar}[isBoundary] = 1;`);
|
this.addLine(`${ctxVar}[isBoundary] = 1;`);
|
||||||
this.helpers.add("isBoundary");
|
this.helpers.add("isBoundary");
|
||||||
const subCtx = createContext(ctx, { preventRoot: true, ctxVar });
|
const subCtx = createContext(ctx, { ctxVar });
|
||||||
const bl = this.compileMulti({ type: 3 /* Multi */, content: ast.body }, subCtx);
|
const bl = this.compileMulti({ type: 3 /* Multi */, content: ast.body }, subCtx);
|
||||||
if (bl) {
|
if (bl) {
|
||||||
this.helpers.add("zero");
|
this.helpers.add("zero");
|
||||||
this.addLine(`${ctxVar}[zero] = ${bl};`);
|
this.addLine(`${ctxVar}[zero] = ${bl};`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const isDynamic = INTERP_REGEXP.test(ast.name);
|
const key = this.generateComponentKey();
|
||||||
const subTemplate = isDynamic ? interpolate(ast.name) : "`" + ast.name + "`";
|
|
||||||
if (block) {
|
|
||||||
if (!forceNewBlock) {
|
|
||||||
this.insertAnchor(block);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
const key = `key + \`${this.generateComponentKey()}\``;
|
|
||||||
if (isDynamic) {
|
if (isDynamic) {
|
||||||
const templateVar = generateId("template");
|
const templateVar = generateId("template");
|
||||||
if (!this.staticDefs.find((d) => d.id === "call")) {
|
if (!this.staticDefs.find((d) => d.id === "call")) {
|
||||||
this.staticDefs.push({ id: "call", expr: `app.callTemplate.bind(app)` });
|
this.staticDefs.push({ id: "call", expr: `app.callTemplate.bind(app)` });
|
||||||
}
|
}
|
||||||
this.define(templateVar, subTemplate);
|
this.define(templateVar, subTemplate);
|
||||||
block = this.createBlock(block, "multi", ctx);
|
|
||||||
this.insertBlock(`call(this, ${templateVar}, ${ctxVar}, node, ${key})`, block, {
|
this.insertBlock(`call(this, ${templateVar}, ${ctxVar}, node, ${key})`, block, {
|
||||||
...ctx,
|
...ctx,
|
||||||
forceNewBlock: !block,
|
forceNewBlock: !block,
|
||||||
@@ -4503,7 +4522,6 @@ class CodeGenerator {
|
|||||||
else {
|
else {
|
||||||
const id = generateId(`callTemplate_`);
|
const id = generateId(`callTemplate_`);
|
||||||
this.staticDefs.push({ id, expr: `app.getTemplate(${subTemplate})` });
|
this.staticDefs.push({ id, expr: `app.getTemplate(${subTemplate})` });
|
||||||
block = this.createBlock(block, "multi", ctx);
|
|
||||||
this.insertBlock(`${id}.call(this, ${ctxVar}, node, ${key})`, block, {
|
this.insertBlock(`${id}.call(this, ${ctxVar}, node, ${key})`, block, {
|
||||||
...ctx,
|
...ctx,
|
||||||
forceNewBlock: !block,
|
forceNewBlock: !block,
|
||||||
@@ -4541,12 +4559,12 @@ class CodeGenerator {
|
|||||||
else {
|
else {
|
||||||
let value;
|
let value;
|
||||||
if (ast.defaultValue) {
|
if (ast.defaultValue) {
|
||||||
const defaultValue = ctx.translate ? this.translate(ast.defaultValue) : ast.defaultValue;
|
const defaultValue = toStringExpression(ctx.translate ? this.translate(ast.defaultValue) : ast.defaultValue);
|
||||||
if (ast.value) {
|
if (ast.value) {
|
||||||
value = `withDefault(${expr}, \`${defaultValue}\`)`;
|
value = `withDefault(${expr}, ${defaultValue})`;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
value = `\`${defaultValue}\``;
|
value = defaultValue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -4557,12 +4575,12 @@ class CodeGenerator {
|
|||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
generateComponentKey() {
|
generateComponentKey(currentKey = "key") {
|
||||||
const parts = [generateId("__")];
|
const parts = [generateId("__")];
|
||||||
for (let i = 0; i < this.target.loopLevel; i++) {
|
for (let i = 0; i < this.target.loopLevel; i++) {
|
||||||
parts.push(`\${key${i + 1}}`);
|
parts.push(`\${key${i + 1}}`);
|
||||||
}
|
}
|
||||||
return parts.join("__");
|
return `${currentKey} + \`${parts.join("__")}\``;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Formats a prop name and value into a string suitable to be inserted in the
|
* Formats a prop name and value into a string suitable to be inserted in the
|
||||||
@@ -4653,7 +4671,6 @@ class CodeGenerator {
|
|||||||
this.addLine(`${propVar}.slots = markRaw(Object.assign(${slotDef}, ${propVar}.slots))`);
|
this.addLine(`${propVar}.slots = markRaw(Object.assign(${slotDef}, ${propVar}.slots))`);
|
||||||
}
|
}
|
||||||
// cmap key
|
// cmap key
|
||||||
const key = this.generateComponentKey();
|
|
||||||
let expr;
|
let expr;
|
||||||
if (ast.isDynamic) {
|
if (ast.isDynamic) {
|
||||||
expr = generateId("Comp");
|
expr = generateId("Comp");
|
||||||
@@ -4669,7 +4686,7 @@ class CodeGenerator {
|
|||||||
// todo: check the forcenewblock condition
|
// todo: check the forcenewblock condition
|
||||||
this.insertAnchor(block);
|
this.insertAnchor(block);
|
||||||
}
|
}
|
||||||
let keyArg = `key + \`${key}\``;
|
let keyArg = this.generateComponentKey();
|
||||||
if (ctx.tKeyExpr) {
|
if (ctx.tKeyExpr) {
|
||||||
keyArg = `${ctx.tKeyExpr} + ${keyArg}`;
|
keyArg = `${ctx.tKeyExpr} + ${keyArg}`;
|
||||||
}
|
}
|
||||||
@@ -4742,7 +4759,7 @@ class CodeGenerator {
|
|||||||
}
|
}
|
||||||
let key = this.target.loopLevel ? `key${this.target.loopLevel}` : "key";
|
let key = this.target.loopLevel ? `key${this.target.loopLevel}` : "key";
|
||||||
if (isMultiple) {
|
if (isMultiple) {
|
||||||
key = `${key} + \`${this.generateComponentKey()}\``;
|
key = this.generateComponentKey(key);
|
||||||
}
|
}
|
||||||
const props = ast.attrs ? this.formatPropObject(ast.attrs) : [];
|
const props = ast.attrs ? this.formatPropObject(ast.attrs) : [];
|
||||||
const scope = this.getPropString(props, dynProps);
|
const scope = this.getPropString(props, dynProps);
|
||||||
@@ -4783,7 +4800,6 @@ class CodeGenerator {
|
|||||||
}
|
}
|
||||||
let { block } = ctx;
|
let { block } = ctx;
|
||||||
const name = this.compileInNewTarget("slot", ast.content, ctx);
|
const name = this.compileInNewTarget("slot", ast.content, ctx);
|
||||||
const key = this.generateComponentKey();
|
|
||||||
let ctxStr = "ctx";
|
let ctxStr = "ctx";
|
||||||
if (this.target.loopLevel || !this.hasSafeContext) {
|
if (this.target.loopLevel || !this.hasSafeContext) {
|
||||||
ctxStr = generateId("ctx");
|
ctxStr = generateId("ctx");
|
||||||
@@ -4796,7 +4812,8 @@ class CodeGenerator {
|
|||||||
expr: `app.createComponent(null, false, true, false, false)`,
|
expr: `app.createComponent(null, false, true, false, false)`,
|
||||||
});
|
});
|
||||||
const target = compileExpr(ast.target);
|
const target = compileExpr(ast.target);
|
||||||
const blockString = `${id}({target: ${target},slots: {'default': {__render: ${name}.bind(this), __ctx: ${ctxStr}}}}, key + \`${key}\`, node, ctx, Portal)`;
|
const key = this.generateComponentKey();
|
||||||
|
const blockString = `${id}({target: ${target},slots: {'default': {__render: ${name}.bind(this), __ctx: ${ctxStr}}}}, ${key}, node, ctx, Portal)`;
|
||||||
if (block) {
|
if (block) {
|
||||||
this.insertAnchor(block);
|
this.insertAnchor(block);
|
||||||
}
|
}
|
||||||
@@ -4825,7 +4842,7 @@ function parse(xml) {
|
|||||||
}
|
}
|
||||||
function _parse(xml) {
|
function _parse(xml) {
|
||||||
normalizeXML(xml);
|
normalizeXML(xml);
|
||||||
const ctx = { inPreTag: false, inSVG: false };
|
const ctx = { inPreTag: false };
|
||||||
return parseNode(xml, ctx) || { type: 0 /* Text */, value: "" };
|
return parseNode(xml, ctx) || { type: 0 /* Text */, value: "" };
|
||||||
}
|
}
|
||||||
function parseNode(node, ctx) {
|
function parseNode(node, ctx) {
|
||||||
@@ -4916,9 +4933,7 @@ function parseDOMNode(node, ctx) {
|
|||||||
if (tagName === "pre") {
|
if (tagName === "pre") {
|
||||||
ctx.inPreTag = true;
|
ctx.inPreTag = true;
|
||||||
}
|
}
|
||||||
const shouldAddSVGNS = ROOT_SVG_TAGS.has(tagName) && !ctx.inSVG;
|
let ns = !ctx.nameSpace && ROOT_SVG_TAGS.has(tagName) ? "http://www.w3.org/2000/svg" : null;
|
||||||
ctx.inSVG = ctx.inSVG || shouldAddSVGNS;
|
|
||||||
const ns = shouldAddSVGNS ? "http://www.w3.org/2000/svg" : null;
|
|
||||||
const ref = node.getAttribute("t-ref");
|
const ref = node.getAttribute("t-ref");
|
||||||
node.removeAttribute("t-ref");
|
node.removeAttribute("t-ref");
|
||||||
const nodeAttrsNames = node.getAttributeNames();
|
const nodeAttrsNames = node.getAttributeNames();
|
||||||
@@ -4957,9 +4972,9 @@ function parseDOMNode(node, ctx) {
|
|||||||
const isSelect = tagName === "select";
|
const isSelect = tagName === "select";
|
||||||
const isCheckboxInput = isInput && typeAttr === "checkbox";
|
const isCheckboxInput = isInput && typeAttr === "checkbox";
|
||||||
const isRadioInput = isInput && typeAttr === "radio";
|
const isRadioInput = isInput && typeAttr === "radio";
|
||||||
const hasLazyMod = attr.includes(".lazy");
|
|
||||||
const hasNumberMod = attr.includes(".number");
|
|
||||||
const hasTrimMod = attr.includes(".trim");
|
const hasTrimMod = attr.includes(".trim");
|
||||||
|
const hasLazyMod = hasTrimMod || attr.includes(".lazy");
|
||||||
|
const hasNumberMod = attr.includes(".number");
|
||||||
const eventType = isRadioInput ? "click" : isSelect || hasLazyMod ? "change" : "input";
|
const eventType = isRadioInput ? "click" : isSelect || hasLazyMod ? "change" : "input";
|
||||||
model = {
|
model = {
|
||||||
baseExpr,
|
baseExpr,
|
||||||
@@ -4980,6 +4995,9 @@ function parseDOMNode(node, ctx) {
|
|||||||
else if (attr.startsWith("block-")) {
|
else if (attr.startsWith("block-")) {
|
||||||
throw new OwlError(`Invalid attribute: '${attr}'`);
|
throw new OwlError(`Invalid attribute: '${attr}'`);
|
||||||
}
|
}
|
||||||
|
else if (attr === "xmlns") {
|
||||||
|
ns = value;
|
||||||
|
}
|
||||||
else if (attr !== "t-name") {
|
else if (attr !== "t-name") {
|
||||||
if (attr.startsWith("t-") && !attr.startsWith("t-att")) {
|
if (attr.startsWith("t-") && !attr.startsWith("t-att")) {
|
||||||
throw new OwlError(`Unknown QWeb directive: '${attr}'`);
|
throw new OwlError(`Unknown QWeb directive: '${attr}'`);
|
||||||
@@ -4992,6 +5010,9 @@ function parseDOMNode(node, ctx) {
|
|||||||
attrs[attr] = value;
|
attrs[attr] = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (ns) {
|
||||||
|
ctx.nameSpace = ns;
|
||||||
|
}
|
||||||
const children = parseChildren(node, ctx);
|
const children = parseChildren(node, ctx);
|
||||||
return {
|
return {
|
||||||
type: 2 /* DomNode */,
|
type: 2 /* DomNode */,
|
||||||
@@ -5284,14 +5305,14 @@ function parseComponent(node, ctx) {
|
|||||||
// be ignored)
|
// be ignored)
|
||||||
let el = slotNode.parentElement;
|
let el = slotNode.parentElement;
|
||||||
let isInSubComponent = false;
|
let isInSubComponent = false;
|
||||||
while (el !== clone) {
|
while (el && el !== clone) {
|
||||||
if (el.hasAttribute("t-component") || el.tagName[0] === el.tagName[0].toUpperCase()) {
|
if (el.hasAttribute("t-component") || el.tagName[0] === el.tagName[0].toUpperCase()) {
|
||||||
isInSubComponent = true;
|
isInSubComponent = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
el = el.parentElement;
|
el = el.parentElement;
|
||||||
}
|
}
|
||||||
if (isInSubComponent) {
|
if (isInSubComponent || !el) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
slotNode.removeAttribute("t-set-slot");
|
slotNode.removeAttribute("t-set-slot");
|
||||||
@@ -5499,41 +5520,6 @@ function normalizeTEscTOut(el) {
|
|||||||
function normalizeXML(el) {
|
function normalizeXML(el) {
|
||||||
normalizeTIf(el);
|
normalizeTIf(el);
|
||||||
normalizeTEscTOut(el);
|
normalizeTEscTOut(el);
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Parses an XML string into an XML document, throwing errors on parser errors
|
|
||||||
* instead of returning an XML document containing the parseerror.
|
|
||||||
*
|
|
||||||
* @param xml the string to parse
|
|
||||||
* @returns an XML document corresponding to the content of the string
|
|
||||||
*/
|
|
||||||
function parseXML(xml) {
|
|
||||||
const parser = new DOMParser();
|
|
||||||
const doc = parser.parseFromString(xml, "text/xml");
|
|
||||||
if (doc.getElementsByTagName("parsererror").length) {
|
|
||||||
let msg = "Invalid XML in template.";
|
|
||||||
const parsererrorText = doc.getElementsByTagName("parsererror")[0].textContent;
|
|
||||||
if (parsererrorText) {
|
|
||||||
msg += "\nThe parser has produced the following error message:\n" + parsererrorText;
|
|
||||||
const re = /\d+/g;
|
|
||||||
const firstMatch = re.exec(parsererrorText);
|
|
||||||
if (firstMatch) {
|
|
||||||
const lineNumber = Number(firstMatch[0]);
|
|
||||||
const line = xml.split("\n")[lineNumber - 1];
|
|
||||||
const secondMatch = re.exec(parsererrorText);
|
|
||||||
if (line && secondMatch) {
|
|
||||||
const columnIndex = Number(secondMatch[0]) - 1;
|
|
||||||
if (line[columnIndex]) {
|
|
||||||
msg +=
|
|
||||||
`\nThe error might be located at xml line ${lineNumber} column ${columnIndex}\n` +
|
|
||||||
`${line}\n${"-".repeat(columnIndex - 1)}^`;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
throw new OwlError(msg);
|
|
||||||
}
|
|
||||||
return doc;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function compile(template, options = {}) {
|
function compile(template, options = {}) {
|
||||||
@@ -5547,11 +5533,20 @@ function compile(template, options = {}) {
|
|||||||
const codeGenerator = new CodeGenerator(ast, { ...options, hasSafeContext });
|
const codeGenerator = new CodeGenerator(ast, { ...options, hasSafeContext });
|
||||||
const code = codeGenerator.generateCode();
|
const code = codeGenerator.generateCode();
|
||||||
// template function
|
// template function
|
||||||
return new Function("app, bdom, helpers", code);
|
try {
|
||||||
|
return new Function("app, bdom, helpers", code);
|
||||||
|
}
|
||||||
|
catch (originalError) {
|
||||||
|
const { name } = options;
|
||||||
|
const nameStr = name ? `template "${name}"` : "anonymous template";
|
||||||
|
const err = new OwlError(`Failed to compile ${nameStr}: ${originalError.message}\n\ngenerated code:\nfunction(app, bdom, helpers) {\n${code}\n}`);
|
||||||
|
err.cause = originalError;
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// do not modify manually. This file is generated by the release script.
|
// do not modify manually. This file is generated by the release script.
|
||||||
const version = "2.2.3";
|
const version = "2.2.11";
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
// Scheduler
|
// Scheduler
|
||||||
@@ -5640,13 +5635,8 @@ const DEV_MSG = () => {
|
|||||||
This is not suitable for production use.
|
This is not suitable for production use.
|
||||||
See https://github.com/odoo/owl/blob/${hash}/doc/reference/app.md#configuration for more information.`;
|
See https://github.com/odoo/owl/blob/${hash}/doc/reference/app.md#configuration for more information.`;
|
||||||
};
|
};
|
||||||
window.__OWL_DEVTOOLS__ || (window.__OWL_DEVTOOLS__ = {
|
const apps = new Set();
|
||||||
apps: new Set(),
|
window.__OWL_DEVTOOLS__ || (window.__OWL_DEVTOOLS__ = { apps, Fiber, RootFiber, toRaw, reactive });
|
||||||
Fiber: Fiber,
|
|
||||||
RootFiber: RootFiber,
|
|
||||||
toRaw: toRaw,
|
|
||||||
reactive: reactive,
|
|
||||||
});
|
|
||||||
class App extends TemplateSet {
|
class App extends TemplateSet {
|
||||||
constructor(Root, config = {}) {
|
constructor(Root, config = {}) {
|
||||||
super(config);
|
super(config);
|
||||||
@@ -5654,7 +5644,7 @@ class App extends TemplateSet {
|
|||||||
this.root = null;
|
this.root = null;
|
||||||
this.name = config.name || "";
|
this.name = config.name || "";
|
||||||
this.Root = Root;
|
this.Root = Root;
|
||||||
window.__OWL_DEVTOOLS__.apps.add(this);
|
apps.add(this);
|
||||||
if (config.test) {
|
if (config.test) {
|
||||||
this.dev = true;
|
this.dev = true;
|
||||||
}
|
}
|
||||||
@@ -5711,7 +5701,7 @@ class App extends TemplateSet {
|
|||||||
this.root.destroy();
|
this.root.destroy();
|
||||||
this.scheduler.processTasks();
|
this.scheduler.processTasks();
|
||||||
}
|
}
|
||||||
window.__OWL_DEVTOOLS__.apps.delete(this);
|
apps.delete(this);
|
||||||
}
|
}
|
||||||
createComponent(name, isStatic, hasSlotsProp, hasDynamicPropList, propList) {
|
createComponent(name, isStatic, hasSlotsProp, hasDynamicPropList, propList) {
|
||||||
const isDynamic = !isStatic;
|
const isDynamic = !isStatic;
|
||||||
@@ -5786,6 +5776,7 @@ class App extends TemplateSet {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
App.validateTarget = validateTarget;
|
App.validateTarget = validateTarget;
|
||||||
|
App.apps = apps;
|
||||||
App.version = version;
|
App.version = version;
|
||||||
async function mount(C, target, config = {}) {
|
async function mount(C, target, config = {}) {
|
||||||
return new App(C, config).mount(target, config);
|
return new App(C, config).mount(target, config);
|
||||||
@@ -5902,7 +5893,7 @@ function useChildSubEnv(envExtension) {
|
|||||||
*
|
*
|
||||||
* @template T
|
* @template T
|
||||||
* @param {Effect<T>} effect the effect to run on component mount and/or patch
|
* @param {Effect<T>} effect the effect to run on component mount and/or patch
|
||||||
* @param {()=>T} [computeDependencies=()=>[NaN]] a callback to compute
|
* @param {()=>[...T]} [computeDependencies=()=>[NaN]] a callback to compute
|
||||||
* dependencies that will decide if the effect needs to be cleaned up and
|
* dependencies that will decide if the effect needs to be cleaned up and
|
||||||
* run again. If the dependencies did not change, the effect will not run
|
* run again. If the dependencies did not change, the effect will not run
|
||||||
* again. The default value returns an array containing only NaN because
|
* again. The default value returns an array containing only NaN because
|
||||||
@@ -5981,9 +5972,9 @@ TemplateSet.prototype._compileTemplate = function _compileTemplate(name, templat
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
export { App, Component, EventBus, OwlError, __info__, blockDom, loadFile, markRaw, markup, mount, onError, onMounted, onPatched, onRendered, onWillDestroy, onWillPatch, onWillRender, onWillStart, onWillUnmount, onWillUpdateProps, reactive, status, toRaw, useChildSubEnv, useComponent, useEffect, useEnv, useExternalListener, useRef, useState, useSubEnv, validate, validateType, whenReady, xml };
|
export { App, Component, EventBus, OwlError, __info__, batched, blockDom, loadFile, markRaw, markup, mount, onError, onMounted, onPatched, onRendered, onWillDestroy, onWillPatch, onWillRender, onWillStart, onWillUnmount, onWillUpdateProps, reactive, status, toRaw, useChildSubEnv, useComponent, useEffect, useEnv, useExternalListener, useRef, useState, useSubEnv, validate, validateType, whenReady, xml };
|
||||||
|
|
||||||
|
|
||||||
__info__.date = '2023-07-20T06:05:29.796Z';
|
__info__.date = '2024-06-17T13:31:12.099Z';
|
||||||
__info__.hash = 'b1a3b32';
|
__info__.hash = 'e7f405c';
|
||||||
__info__.url = 'https://github.com/odoo/owl';
|
__info__.url = 'https://github.com/odoo/owl';
|
||||||
|
|||||||
@@ -41,9 +41,6 @@ const loadFile = (path) => {
|
|||||||
* Make an iframe, with all the js, css and xml properly injected.
|
* Make an iframe, with all the js, css and xml properly injected.
|
||||||
*/
|
*/
|
||||||
function makeCodeIframe(js, css, xml) {
|
function makeCodeIframe(js, css, xml) {
|
||||||
// escape backticks in the xml so they don't close the template string
|
|
||||||
const escapedXml = xml.replace(/`/g, '\\\`');
|
|
||||||
|
|
||||||
const iframe = document.createElement("iframe");
|
const iframe = document.createElement("iframe");
|
||||||
iframe.onload = () => {
|
iframe.onload = () => {
|
||||||
const doc = iframe.contentDocument;
|
const doc = iframe.contentDocument;
|
||||||
@@ -55,6 +52,8 @@ function makeCodeIframe(js, css, xml) {
|
|||||||
|
|
||||||
const script = doc.createElement("script");
|
const script = doc.createElement("script");
|
||||||
script.type = "module";
|
script.type = "module";
|
||||||
|
// escape characters with special meaning in template literals
|
||||||
|
const escapedXml = xml.replace(/\\/g, "\\\\").replace(/`/g, "\\`").replace(/\$\{/, "\\${");
|
||||||
script.textContent = `const TEMPLATES = \`${escapedXml}\`\n${js}`;
|
script.textContent = `const TEMPLATES = \`${escapedXml}\`\n${js}`;
|
||||||
doc.body.appendChild(script);
|
doc.body.appendChild(script);
|
||||||
|
|
||||||
|
|||||||
@@ -43,10 +43,6 @@ class TaskList {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
toggleTask(task) {
|
|
||||||
task.isCompleted = !task.isCompleted;
|
|
||||||
}
|
|
||||||
|
|
||||||
toggleTask(id) {
|
toggleTask(id) {
|
||||||
const task = this.tasks.find(t => t.id === id);
|
const task = this.tasks.find(t => t.id === id);
|
||||||
task.isCompleted = !task.isCompleted;
|
task.isCompleted = !task.isCompleted;
|
||||||
@@ -61,7 +57,7 @@ class TaskList {
|
|||||||
clearCompleted() {
|
clearCompleted() {
|
||||||
const tasks = this.tasks.filter(t => t.isCompleted);
|
const tasks = this.tasks.filter(t => t.isCompleted);
|
||||||
for (let task of tasks) {
|
for (let task of tasks) {
|
||||||
this.deleteTask(task);
|
this.deleteTask(task.id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@odoo/owl",
|
"name": "@odoo/owl",
|
||||||
"version": "2.2.3",
|
"version": "2.2.11",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
@@ -5925,9 +5925,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"ws": {
|
"ws": {
|
||||||
"version": "7.5.9",
|
"version": "7.5.10",
|
||||||
"resolved": "https://registry.npmjs.org/ws/-/ws-7.5.9.tgz",
|
"resolved": "https://registry.npmjs.org/ws/-/ws-7.5.10.tgz",
|
||||||
"integrity": "sha512-F+P9Jil7UiSKSkppIiD94dN07AwvFixvLIj1Og1Rl9GGMuNipJnV9JzjD6XuqmAeiswGvUmNLjr5cFuXwNS77Q==",
|
"integrity": "sha512-+dbF1tHwZpXcbOJdVOkzLDxZP1ailvSxM6ZweXTegylPny803bFhA+vqBYw4s31NSAk4S2Qz+AKXK9a4wkdjcQ==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"xml-name-validator": {
|
"xml-name-validator": {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@odoo/owl",
|
"name": "@odoo/owl",
|
||||||
"version": "2.2.3",
|
"version": "2.2.11",
|
||||||
"description": "Odoo Web Library (OWL)",
|
"description": "Odoo Web Library (OWL)",
|
||||||
"main": "dist/owl.cjs.js",
|
"main": "dist/owl.cjs.js",
|
||||||
"module": "dist/owl.es.js",
|
"module": "dist/owl.es.js",
|
||||||
|
|||||||
@@ -0,0 +1,4 @@
|
|||||||
|
// Custom error class that wraps error that happen in the owl lifecycle
|
||||||
|
export class OwlError extends Error {
|
||||||
|
cause?: any;
|
||||||
|
}
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
import { OwlError } from "./owl_error";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parses an XML string into an XML document, throwing errors on parser errors
|
||||||
|
* instead of returning an XML document containing the parseerror.
|
||||||
|
*
|
||||||
|
* @param xml the string to parse
|
||||||
|
* @returns an XML document corresponding to the content of the string
|
||||||
|
*/
|
||||||
|
export function parseXML(xml: string): XMLDocument {
|
||||||
|
const parser = new DOMParser();
|
||||||
|
const doc = parser.parseFromString(xml, "text/xml");
|
||||||
|
if (doc.getElementsByTagName("parsererror").length) {
|
||||||
|
let msg = "Invalid XML in template.";
|
||||||
|
const parsererrorText = doc.getElementsByTagName("parsererror")[0].textContent;
|
||||||
|
if (parsererrorText) {
|
||||||
|
msg += "\nThe parser has produced the following error message:\n" + parsererrorText;
|
||||||
|
const re = /\d+/g;
|
||||||
|
const firstMatch = re.exec(parsererrorText);
|
||||||
|
if (firstMatch) {
|
||||||
|
const lineNumber = Number(firstMatch[0]);
|
||||||
|
const line = xml.split("\n")[lineNumber - 1];
|
||||||
|
const secondMatch = re.exec(parsererrorText);
|
||||||
|
if (line && secondMatch) {
|
||||||
|
const columnIndex = Number(secondMatch[0]) - 1;
|
||||||
|
if (line[columnIndex]) {
|
||||||
|
msg +=
|
||||||
|
`\nThe error might be located at xml line ${lineNumber} column ${columnIndex}\n` +
|
||||||
|
`${line}\n${"-".repeat(columnIndex - 1)}^`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
throw new OwlError(msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
return doc;
|
||||||
|
}
|
||||||
@@ -29,7 +29,7 @@ import {
|
|||||||
Attrs,
|
Attrs,
|
||||||
EventHandlers,
|
EventHandlers,
|
||||||
} from "./parser";
|
} from "./parser";
|
||||||
import { OwlError } from "../runtime/error_handling";
|
import { OwlError } from "../common/owl_error";
|
||||||
|
|
||||||
type BlockType = "block" | "text" | "multi" | "list" | "html" | "comment";
|
type BlockType = "block" | "text" | "multi" | "list" | "html" | "comment";
|
||||||
const whitespaceRE = /\s+/g;
|
const whitespaceRE = /\s+/g;
|
||||||
@@ -43,7 +43,6 @@ export interface Config {
|
|||||||
export interface CodeGenOptions extends Config {
|
export interface CodeGenOptions extends Config {
|
||||||
hasSafeContext?: boolean;
|
hasSafeContext?: boolean;
|
||||||
name?: string;
|
name?: string;
|
||||||
alias?: string;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// using a non-html document so that <inner/outer>HTML serializes as XML instead
|
// using a non-html document so that <inner/outer>HTML serializes as XML instead
|
||||||
@@ -83,6 +82,14 @@ function isProp(tag: string, key: string): boolean {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a template literal that evaluates to str. You can add interpolation
|
||||||
|
* sigils into the string if required
|
||||||
|
*/
|
||||||
|
function toStringExpression(str: string) {
|
||||||
|
return `\`${str.replace(/\\/g, "\\\\").replace(/`/g, "\\`").replace(/\$\{/, "\\${")}\``;
|
||||||
|
}
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
// BlockDescription
|
// BlockDescription
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
@@ -161,7 +168,6 @@ interface Context {
|
|||||||
block: BlockDescription | null;
|
block: BlockDescription | null;
|
||||||
index: number | string;
|
index: number | string;
|
||||||
forceNewBlock: boolean;
|
forceNewBlock: boolean;
|
||||||
preventRoot?: boolean;
|
|
||||||
isLast?: boolean;
|
isLast?: boolean;
|
||||||
translate: boolean;
|
translate: boolean;
|
||||||
tKeyExpr: string | null;
|
tKeyExpr: string | null;
|
||||||
@@ -198,7 +204,6 @@ class CodeTarget {
|
|||||||
hasRefWrapper: boolean = false;
|
hasRefWrapper: boolean = false;
|
||||||
|
|
||||||
constructor(name: string, on?: EventHandlers | null) {
|
constructor(name: string, on?: EventHandlers | null) {
|
||||||
debugger
|
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.on = on || null;
|
this.on = on || null;
|
||||||
}
|
}
|
||||||
@@ -245,13 +250,6 @@ class CodeTarget {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function toFnName(name: string = "", alias?: string) {
|
|
||||||
if (alias) {
|
|
||||||
name += `_${alias}`;
|
|
||||||
}
|
|
||||||
return name.replace(/[^A-Za-z_$0-9]+/g, "_") || "template";
|
|
||||||
}
|
|
||||||
|
|
||||||
const TRANSLATABLE_ATTRS = ["label", "title", "placeholder", "alt"];
|
const TRANSLATABLE_ATTRS = ["label", "title", "placeholder", "alt"];
|
||||||
const translationRE = /^(\s*)([\s\S]+?)(\s*)$/;
|
const translationRE = /^(\s*)([\s\S]+?)(\s*)$/;
|
||||||
|
|
||||||
@@ -261,7 +259,7 @@ export class CodeGenerator {
|
|||||||
hasSafeContext: boolean;
|
hasSafeContext: boolean;
|
||||||
isDebug: boolean = false;
|
isDebug: boolean = false;
|
||||||
targets: CodeTarget[] = [];
|
targets: CodeTarget[] = [];
|
||||||
target: CodeTarget;
|
target = new CodeTarget("template");
|
||||||
templateName?: string;
|
templateName?: string;
|
||||||
dev: boolean;
|
dev: boolean;
|
||||||
translateFn: (s: string) => string;
|
translateFn: (s: string) => string;
|
||||||
@@ -272,7 +270,6 @@ export class CodeGenerator {
|
|||||||
helpers: Set<string> = new Set();
|
helpers: Set<string> = new Set();
|
||||||
|
|
||||||
constructor(ast: AST, options: CodeGenOptions) {
|
constructor(ast: AST, options: CodeGenOptions) {
|
||||||
this.target = new CodeTarget(toFnName(options.name, options.alias));
|
|
||||||
this.translateFn = options.translateFn || ((s: string) => s);
|
this.translateFn = options.translateFn || ((s: string) => s);
|
||||||
if (options.translatableAttributes) {
|
if (options.translatableAttributes) {
|
||||||
const attrs = new Set(TRANSLATABLE_ATTRS);
|
const attrs = new Set(TRANSLATABLE_ATTRS);
|
||||||
@@ -322,14 +319,13 @@ export class CodeGenerator {
|
|||||||
mainCode.push(``);
|
mainCode.push(``);
|
||||||
for (let block of this.blocks) {
|
for (let block of this.blocks) {
|
||||||
if (block.dom) {
|
if (block.dom) {
|
||||||
let xmlString = block.asXmlString();
|
let xmlString = toStringExpression(block.asXmlString());
|
||||||
xmlString = xmlString.replace(/\\/g, "\\\\").replace(/`/g, "\\`");
|
|
||||||
if (block.dynamicTagName) {
|
if (block.dynamicTagName) {
|
||||||
xmlString = xmlString.replace(/^<\w+/, `<\${tag || '${block.dom.nodeName}'}`);
|
xmlString = xmlString.replace(/^`<\w+/, `\`<\${tag || '${block.dom.nodeName}'}`);
|
||||||
xmlString = xmlString.replace(/\w+>$/, `\${tag || '${block.dom.nodeName}'}>`);
|
xmlString = xmlString.replace(/\w+>`$/, `\${tag || '${block.dom.nodeName}'}>\``);
|
||||||
mainCode.push(`let ${block.blockName} = tag => createBlock(\`${xmlString}\`);`);
|
mainCode.push(`let ${block.blockName} = tag => createBlock(${xmlString});`);
|
||||||
} else {
|
} else {
|
||||||
mainCode.push(`let ${block.blockName} = createBlock(\`${xmlString}\`);`);
|
mainCode.push(`let ${block.blockName} = createBlock(${xmlString});`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -387,7 +383,7 @@ export class CodeGenerator {
|
|||||||
): BlockDescription {
|
): BlockDescription {
|
||||||
const hasRoot = this.target.hasRoot;
|
const hasRoot = this.target.hasRoot;
|
||||||
const block = new BlockDescription(this.target, type);
|
const block = new BlockDescription(this.target, type);
|
||||||
if (!hasRoot && !ctx.preventRoot) {
|
if (!hasRoot) {
|
||||||
this.target.hasRoot = true;
|
this.target.hasRoot = true;
|
||||||
block.isRoot = true;
|
block.isRoot = true;
|
||||||
}
|
}
|
||||||
@@ -413,7 +409,7 @@ export class CodeGenerator {
|
|||||||
blockExpr = `toggler(${ctx.tKeyExpr}, ${blockExpr})`;
|
blockExpr = `toggler(${ctx.tKeyExpr}, ${blockExpr})`;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (block.isRoot && !ctx.preventRoot) {
|
if (block.isRoot) {
|
||||||
if (this.target.on) {
|
if (this.target.on) {
|
||||||
blockExpr = this.wrapWithEventCatcher(blockExpr, this.target.on);
|
blockExpr = this.wrapWithEventCatcher(blockExpr, this.target.on);
|
||||||
}
|
}
|
||||||
@@ -526,7 +522,7 @@ export class CodeGenerator {
|
|||||||
const isNewBlock = !block || forceNewBlock;
|
const isNewBlock = !block || forceNewBlock;
|
||||||
if (isNewBlock) {
|
if (isNewBlock) {
|
||||||
block = this.createBlock(block, "comment", ctx);
|
block = this.createBlock(block, "comment", ctx);
|
||||||
this.insertBlock(`comment(\`${ast.value}\`)`, block, {
|
this.insertBlock(`comment(${toStringExpression(ast.value)})`, block, {
|
||||||
...ctx,
|
...ctx,
|
||||||
forceNewBlock: forceNewBlock && !block,
|
forceNewBlock: forceNewBlock && !block,
|
||||||
});
|
});
|
||||||
@@ -550,7 +546,7 @@ export class CodeGenerator {
|
|||||||
|
|
||||||
if (!block || forceNewBlock) {
|
if (!block || forceNewBlock) {
|
||||||
block = this.createBlock(block, "text", ctx);
|
block = this.createBlock(block, "text", ctx);
|
||||||
this.insertBlock(`text(\`${value}\`)`, block, {
|
this.insertBlock(`text(${toStringExpression(value)})`, block, {
|
||||||
...ctx,
|
...ctx,
|
||||||
forceNewBlock: forceNewBlock && !block,
|
forceNewBlock: forceNewBlock && !block,
|
||||||
});
|
});
|
||||||
@@ -596,11 +592,6 @@ export class CodeGenerator {
|
|||||||
}
|
}
|
||||||
// attributes
|
// attributes
|
||||||
const attrs: Attrs = {};
|
const attrs: Attrs = {};
|
||||||
const nameSpace = ast.ns || ctx.nameSpace;
|
|
||||||
if (nameSpace && isNewBlock) {
|
|
||||||
// specific namespace uri
|
|
||||||
attrs["block-ns"] = nameSpace;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (let key in ast.attrs) {
|
for (let key in ast.attrs) {
|
||||||
let expr, attrName;
|
let expr, attrName;
|
||||||
@@ -729,7 +720,10 @@ export class CodeGenerator {
|
|||||||
attrs["block-ref"] = String(idx);
|
attrs["block-ref"] = String(idx);
|
||||||
}
|
}
|
||||||
|
|
||||||
const dom = xmlDoc.createElement(ast.tag);
|
const nameSpace = ast.ns || ctx.nameSpace;
|
||||||
|
const dom = nameSpace
|
||||||
|
? xmlDoc.createElementNS(nameSpace, ast.tag)
|
||||||
|
: xmlDoc.createElement(ast.tag);
|
||||||
for (const [attr, val] of Object.entries(attrs)) {
|
for (const [attr, val] of Object.entries(attrs)) {
|
||||||
if (!(attr === "class" && val === "")) {
|
if (!(attr === "class" && val === "")) {
|
||||||
dom.setAttribute(attr, val);
|
dom.setAttribute(attr, val);
|
||||||
@@ -771,7 +765,7 @@ export class CodeGenerator {
|
|||||||
if (!current) break;
|
if (!current) break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.addLine(`let ${block!.children.map((c) => c.varName)};`, codeIdx);
|
this.addLine(`let ${block!.children.map((c) => c.varName).join(", ")};`, codeIdx);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return block!.varName;
|
return block!.varName;
|
||||||
@@ -787,7 +781,8 @@ export class CodeGenerator {
|
|||||||
expr = compileExpr(ast.expr);
|
expr = compileExpr(ast.expr);
|
||||||
if (ast.defaultValue) {
|
if (ast.defaultValue) {
|
||||||
this.helpers.add("withDefault");
|
this.helpers.add("withDefault");
|
||||||
expr = `withDefault(${expr}, \`${ast.defaultValue}\`)`;
|
// FIXME: defaultValue is not translated
|
||||||
|
expr = `withDefault(${expr}, ${toStringExpression(ast.defaultValue)})`;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!block || forceNewBlock) {
|
if (!block || forceNewBlock) {
|
||||||
@@ -873,7 +868,7 @@ export class CodeGenerator {
|
|||||||
if (!current) break;
|
if (!current) break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.addLine(`let ${block!.children.map((c) => c.varName)};`, codeIdx);
|
this.addLine(`let ${block!.children.map((c) => c.varName).join(", ")};`, codeIdx);
|
||||||
}
|
}
|
||||||
|
|
||||||
// note: this part is duplicated from end of compilemulti:
|
// note: this part is duplicated from end of compilemulti:
|
||||||
@@ -904,18 +899,18 @@ export class CodeGenerator {
|
|||||||
}
|
}
|
||||||
this.addLine(`for (let ${loopVar} = 0; ${loopVar} < ${l}; ${loopVar}++) {`);
|
this.addLine(`for (let ${loopVar} = 0; ${loopVar} < ${l}; ${loopVar}++) {`);
|
||||||
this.target.indentLevel++;
|
this.target.indentLevel++;
|
||||||
this.addLine(`ctx[\`${ast.elem}\`] = ${vals}[${loopVar}];`);
|
this.addLine(`ctx[\`${ast.elem}\`] = ${keys}[${loopVar}];`);
|
||||||
if (!ast.hasNoFirst) {
|
if (!ast.hasNoFirst) {
|
||||||
this.addLine(`ctx[\`${ast.elem}_first\`] = ${loopVar} === 0;`);
|
this.addLine(`ctx[\`${ast.elem}_first\`] = ${loopVar} === 0;`);
|
||||||
}
|
}
|
||||||
if (!ast.hasNoLast) {
|
if (!ast.hasNoLast) {
|
||||||
this.addLine(`ctx[\`${ast.elem}_last\`] = ${loopVar} === ${vals}.length - 1;`);
|
this.addLine(`ctx[\`${ast.elem}_last\`] = ${loopVar} === ${keys}.length - 1;`);
|
||||||
}
|
}
|
||||||
if (!ast.hasNoIndex) {
|
if (!ast.hasNoIndex) {
|
||||||
this.addLine(`ctx[\`${ast.elem}_index\`] = ${loopVar};`);
|
this.addLine(`ctx[\`${ast.elem}_index\`] = ${loopVar};`);
|
||||||
}
|
}
|
||||||
if (!ast.hasNoValue) {
|
if (!ast.hasNoValue) {
|
||||||
this.addLine(`ctx[\`${ast.elem}_value\`] = ${keys}[${loopVar}];`);
|
this.addLine(`ctx[\`${ast.elem}_value\`] = ${vals}[${loopVar}];`);
|
||||||
}
|
}
|
||||||
this.define(`key${this.target.loopLevel}`, ast.key ? compileExpr(ast.key) : loopVar);
|
this.define(`key${this.target.loopLevel}`, ast.key ? compileExpr(ast.key) : loopVar);
|
||||||
if (this.dev) {
|
if (this.dev) {
|
||||||
@@ -999,7 +994,6 @@ export class CodeGenerator {
|
|||||||
block,
|
block,
|
||||||
index,
|
index,
|
||||||
forceNewBlock: !isTSet,
|
forceNewBlock: !isTSet,
|
||||||
preventRoot: ctx.preventRoot,
|
|
||||||
isLast: ctx.isLast && i === l - 1,
|
isLast: ctx.isLast && i === l - 1,
|
||||||
});
|
});
|
||||||
this.compileAST(child, subCtx);
|
this.compileAST(child, subCtx);
|
||||||
@@ -1008,20 +1002,18 @@ export class CodeGenerator {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (isNewBlock) {
|
if (isNewBlock) {
|
||||||
if (block!.hasDynamicChildren) {
|
if (block!.hasDynamicChildren && block!.children.length) {
|
||||||
if (block!.children.length) {
|
const code = this.target.code;
|
||||||
const code = this.target.code;
|
const children = block!.children.slice();
|
||||||
const children = block!.children.slice();
|
let current = children.shift();
|
||||||
let current = children.shift();
|
for (let i = codeIdx; i < code.length; i++) {
|
||||||
for (let i = codeIdx; i < code.length; i++) {
|
if (code[i].trimStart().startsWith(`const ${current!.varName} `)) {
|
||||||
if (code[i].trimStart().startsWith(`const ${current!.varName} `)) {
|
code[i] = code[i].replace(`const ${current!.varName}`, current!.varName);
|
||||||
code[i] = code[i].replace(`const ${current!.varName}`, current!.varName);
|
current = children.shift();
|
||||||
current = children.shift();
|
if (!current) break;
|
||||||
if (!current) break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
this.addLine(`let ${block!.children.map((c) => c.varName)};`, codeIdx);
|
|
||||||
}
|
}
|
||||||
|
this.addLine(`let ${block!.children.map((c) => c.varName).join(", ")};`, codeIdx);
|
||||||
}
|
}
|
||||||
|
|
||||||
const args = block!.children.map((c) => c.varName).join(", ");
|
const args = block!.children.map((c) => c.varName).join(", ");
|
||||||
@@ -1037,32 +1029,31 @@ export class CodeGenerator {
|
|||||||
ctxVar = generateId("ctx");
|
ctxVar = generateId("ctx");
|
||||||
this.addLine(`let ${ctxVar} = ${compileExpr(ast.context)};`);
|
this.addLine(`let ${ctxVar} = ${compileExpr(ast.context)};`);
|
||||||
}
|
}
|
||||||
|
const isDynamic = INTERP_REGEXP.test(ast.name);
|
||||||
|
const subTemplate = isDynamic ? interpolate(ast.name) : "`" + ast.name + "`";
|
||||||
|
if (block && !forceNewBlock) {
|
||||||
|
this.insertAnchor(block);
|
||||||
|
}
|
||||||
|
block = this.createBlock(block, "multi", ctx);
|
||||||
if (ast.body) {
|
if (ast.body) {
|
||||||
this.addLine(`${ctxVar} = Object.create(${ctxVar});`);
|
this.addLine(`${ctxVar} = Object.create(${ctxVar});`);
|
||||||
this.addLine(`${ctxVar}[isBoundary] = 1;`);
|
this.addLine(`${ctxVar}[isBoundary] = 1;`);
|
||||||
this.helpers.add("isBoundary");
|
this.helpers.add("isBoundary");
|
||||||
const subCtx = createContext(ctx, { preventRoot: true, ctxVar });
|
const subCtx = createContext(ctx, { ctxVar });
|
||||||
const bl = this.compileMulti({ type: ASTType.Multi, content: ast.body }, subCtx);
|
const bl = this.compileMulti({ type: ASTType.Multi, content: ast.body }, subCtx);
|
||||||
if (bl) {
|
if (bl) {
|
||||||
this.helpers.add("zero");
|
this.helpers.add("zero");
|
||||||
this.addLine(`${ctxVar}[zero] = ${bl};`);
|
this.addLine(`${ctxVar}[zero] = ${bl};`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const isDynamic = INTERP_REGEXP.test(ast.name);
|
|
||||||
const subTemplate = isDynamic ? interpolate(ast.name) : "`" + ast.name + "`";
|
const key = this.generateComponentKey();
|
||||||
if (block) {
|
|
||||||
if (!forceNewBlock) {
|
|
||||||
this.insertAnchor(block);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
const key = `key + \`${this.generateComponentKey()}\``;
|
|
||||||
if (isDynamic) {
|
if (isDynamic) {
|
||||||
const templateVar = generateId("template");
|
const templateVar = generateId("template");
|
||||||
if (!this.staticDefs.find((d) => d.id === "call")) {
|
if (!this.staticDefs.find((d) => d.id === "call")) {
|
||||||
this.staticDefs.push({ id: "call", expr: `app.callTemplate.bind(app)` });
|
this.staticDefs.push({ id: "call", expr: `app.callTemplate.bind(app)` });
|
||||||
}
|
}
|
||||||
this.define(templateVar, subTemplate);
|
this.define(templateVar, subTemplate);
|
||||||
block = this.createBlock(block, "multi", ctx);
|
|
||||||
this.insertBlock(`call(this, ${templateVar}, ${ctxVar}, node, ${key})`, block!, {
|
this.insertBlock(`call(this, ${templateVar}, ${ctxVar}, node, ${key})`, block!, {
|
||||||
...ctx,
|
...ctx,
|
||||||
forceNewBlock: !block,
|
forceNewBlock: !block,
|
||||||
@@ -1070,7 +1061,6 @@ export class CodeGenerator {
|
|||||||
} else {
|
} else {
|
||||||
const id = generateId(`callTemplate_`);
|
const id = generateId(`callTemplate_`);
|
||||||
this.staticDefs.push({ id, expr: `app.getTemplate(${subTemplate})` });
|
this.staticDefs.push({ id, expr: `app.getTemplate(${subTemplate})` });
|
||||||
block = this.createBlock(block, "multi", ctx);
|
|
||||||
this.insertBlock(`${id}.call(this, ${ctxVar}, node, ${key})`, block!, {
|
this.insertBlock(`${id}.call(this, ${ctxVar}, node, ${key})`, block!, {
|
||||||
...ctx,
|
...ctx,
|
||||||
forceNewBlock: !block,
|
forceNewBlock: !block,
|
||||||
@@ -1109,11 +1099,13 @@ export class CodeGenerator {
|
|||||||
} else {
|
} else {
|
||||||
let value: string;
|
let value: string;
|
||||||
if (ast.defaultValue) {
|
if (ast.defaultValue) {
|
||||||
const defaultValue = ctx.translate ? this.translate(ast.defaultValue) : ast.defaultValue;
|
const defaultValue = toStringExpression(
|
||||||
|
ctx.translate ? this.translate(ast.defaultValue) : ast.defaultValue
|
||||||
|
);
|
||||||
if (ast.value) {
|
if (ast.value) {
|
||||||
value = `withDefault(${expr}, \`${defaultValue}\`)`;
|
value = `withDefault(${expr}, ${defaultValue})`;
|
||||||
} else {
|
} else {
|
||||||
value = `\`${defaultValue}\``;
|
value = defaultValue;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
value = expr;
|
value = expr;
|
||||||
@@ -1124,12 +1116,12 @@ export class CodeGenerator {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
generateComponentKey() {
|
generateComponentKey(currentKey: string = "key") {
|
||||||
const parts = [generateId("__")];
|
const parts = [generateId("__")];
|
||||||
for (let i = 0; i < this.target.loopLevel; i++) {
|
for (let i = 0; i < this.target.loopLevel; i++) {
|
||||||
parts.push(`\${key${i + 1}}`);
|
parts.push(`\${key${i + 1}}`);
|
||||||
}
|
}
|
||||||
return parts.join("__");
|
return `${currentKey} + \`${parts.join("__")}\``;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1232,7 +1224,6 @@ export class CodeGenerator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// cmap key
|
// cmap key
|
||||||
const key = this.generateComponentKey();
|
|
||||||
let expr: string;
|
let expr: string;
|
||||||
if (ast.isDynamic) {
|
if (ast.isDynamic) {
|
||||||
expr = generateId("Comp");
|
expr = generateId("Comp");
|
||||||
@@ -1250,7 +1241,7 @@ export class CodeGenerator {
|
|||||||
this.insertAnchor(block);
|
this.insertAnchor(block);
|
||||||
}
|
}
|
||||||
|
|
||||||
let keyArg = `key + \`${key}\``;
|
let keyArg = this.generateComponentKey();
|
||||||
if (ctx.tKeyExpr) {
|
if (ctx.tKeyExpr) {
|
||||||
keyArg = `${ctx.tKeyExpr} + ${keyArg}`;
|
keyArg = `${ctx.tKeyExpr} + ${keyArg}`;
|
||||||
}
|
}
|
||||||
@@ -1329,7 +1320,7 @@ export class CodeGenerator {
|
|||||||
}
|
}
|
||||||
let key = this.target.loopLevel ? `key${this.target.loopLevel}` : "key";
|
let key = this.target.loopLevel ? `key${this.target.loopLevel}` : "key";
|
||||||
if (isMultiple) {
|
if (isMultiple) {
|
||||||
key = `${key} + \`${this.generateComponentKey()}\``;
|
key = this.generateComponentKey(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
const props = ast.attrs ? this.formatPropObject(ast.attrs) : [];
|
const props = ast.attrs ? this.formatPropObject(ast.attrs) : [];
|
||||||
@@ -1372,7 +1363,6 @@ export class CodeGenerator {
|
|||||||
|
|
||||||
let { block } = ctx;
|
let { block } = ctx;
|
||||||
const name = this.compileInNewTarget("slot", ast.content, ctx);
|
const name = this.compileInNewTarget("slot", ast.content, ctx);
|
||||||
const key = this.generateComponentKey();
|
|
||||||
let ctxStr = "ctx";
|
let ctxStr = "ctx";
|
||||||
if (this.target.loopLevel || !this.hasSafeContext) {
|
if (this.target.loopLevel || !this.hasSafeContext) {
|
||||||
ctxStr = generateId("ctx");
|
ctxStr = generateId("ctx");
|
||||||
@@ -1386,7 +1376,8 @@ export class CodeGenerator {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const target = compileExpr(ast.target);
|
const target = compileExpr(ast.target);
|
||||||
const blockString = `${id}({target: ${target},slots: {'default': {__render: ${name}.bind(this), __ctx: ${ctxStr}}}}, key + \`${key}\`, node, ctx, Portal)`;
|
const key = this.generateComponentKey();
|
||||||
|
const blockString = `${id}({target: ${target},slots: {'default': {__render: ${name}.bind(this), __ctx: ${ctxStr}}}}, ${key}, node, ctx, Portal)`;
|
||||||
if (block) {
|
if (block) {
|
||||||
this.insertAnchor(block);
|
this.insertAnchor(block);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import type { TemplateSet } from "../runtime/template_set";
|
|||||||
import type { BDom } from "../runtime/blockdom";
|
import type { BDom } from "../runtime/blockdom";
|
||||||
import { CodeGenerator, Config } from "./code_generator";
|
import { CodeGenerator, Config } from "./code_generator";
|
||||||
import { parse } from "./parser";
|
import { parse } from "./parser";
|
||||||
import { OwlError } from "../runtime";
|
import { OwlError } from "../common/owl_error";
|
||||||
|
|
||||||
export type Template = (context: any, vnode: any, key?: string) => BDom;
|
export type Template = (context: any, vnode: any, key?: string) => BDom;
|
||||||
|
|
||||||
@@ -10,7 +10,6 @@ export type TemplateFunction = (app: TemplateSet, bdom: any, helpers: any) => Te
|
|||||||
|
|
||||||
interface CompileOptions extends Config {
|
interface CompileOptions extends Config {
|
||||||
name?: string;
|
name?: string;
|
||||||
alias?: string;
|
|
||||||
}
|
}
|
||||||
export function compile(
|
export function compile(
|
||||||
template: string | Element,
|
template: string | Element,
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { OwlError } from "../runtime/error_handling";
|
import { OwlError } from "../common/owl_error";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Owl QWeb Expression Parser
|
* Owl QWeb Expression Parser
|
||||||
@@ -268,7 +268,7 @@ export function compileExprToArray(expr: string): Token[] {
|
|||||||
const localVars = new Set<string>();
|
const localVars = new Set<string>();
|
||||||
const tokens = tokenize(expr);
|
const tokens = tokenize(expr);
|
||||||
let i = 0;
|
let i = 0;
|
||||||
let stack = []; // to track last opening [ or {
|
let stack = []; // to track last opening (, [ or {
|
||||||
|
|
||||||
while (i < tokens.length) {
|
while (i < tokens.length) {
|
||||||
let token = tokens[i];
|
let token = tokens[i];
|
||||||
@@ -279,10 +279,12 @@ export function compileExprToArray(expr: string): Token[] {
|
|||||||
switch (token.type) {
|
switch (token.type) {
|
||||||
case "LEFT_BRACE":
|
case "LEFT_BRACE":
|
||||||
case "LEFT_BRACKET":
|
case "LEFT_BRACKET":
|
||||||
|
case "LEFT_PAREN":
|
||||||
stack.push(token.type);
|
stack.push(token.type);
|
||||||
break;
|
break;
|
||||||
case "RIGHT_BRACE":
|
case "RIGHT_BRACE":
|
||||||
case "RIGHT_BRACKET":
|
case "RIGHT_BRACKET":
|
||||||
|
case "RIGHT_PAREN":
|
||||||
stack.pop();
|
stack.pop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import { OwlError } from "../runtime/error_handling";
|
import { OwlError } from "../common/owl_error";
|
||||||
|
import { parseXML } from "../common/utils";
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
// AST Type definition
|
// AST Type definition
|
||||||
@@ -213,14 +214,14 @@ export function parse(xml: string | Element): AST {
|
|||||||
|
|
||||||
function _parse(xml: Element): AST {
|
function _parse(xml: Element): AST {
|
||||||
normalizeXML(xml);
|
normalizeXML(xml);
|
||||||
const ctx = { inPreTag: false, inSVG: false };
|
const ctx = { inPreTag: false };
|
||||||
return parseNode(xml, ctx) || { type: ASTType.Text, value: "" };
|
return parseNode(xml, ctx) || { type: ASTType.Text, value: "" };
|
||||||
}
|
}
|
||||||
|
|
||||||
interface ParsingContext {
|
interface ParsingContext {
|
||||||
tModelInfo?: TModelInfo | null;
|
tModelInfo?: TModelInfo | null;
|
||||||
|
nameSpace?: string;
|
||||||
inPreTag: boolean;
|
inPreTag: boolean;
|
||||||
inSVG: boolean;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function parseNode(node: Node, ctx: ParsingContext): AST | null {
|
function parseNode(node: Node, ctx: ParsingContext): AST | null {
|
||||||
@@ -323,9 +324,8 @@ function parseDOMNode(node: Element, ctx: ParsingContext): AST | null {
|
|||||||
if (tagName === "pre") {
|
if (tagName === "pre") {
|
||||||
ctx.inPreTag = true;
|
ctx.inPreTag = true;
|
||||||
}
|
}
|
||||||
const shouldAddSVGNS = ROOT_SVG_TAGS.has(tagName) && !ctx.inSVG;
|
|
||||||
ctx.inSVG = ctx.inSVG || shouldAddSVGNS;
|
let ns = !ctx.nameSpace && ROOT_SVG_TAGS.has(tagName) ? "http://www.w3.org/2000/svg" : null;
|
||||||
const ns = shouldAddSVGNS ? "http://www.w3.org/2000/svg" : null;
|
|
||||||
const ref = node.getAttribute("t-ref");
|
const ref = node.getAttribute("t-ref");
|
||||||
node.removeAttribute("t-ref");
|
node.removeAttribute("t-ref");
|
||||||
|
|
||||||
@@ -367,9 +367,9 @@ function parseDOMNode(node: Element, ctx: ParsingContext): AST | null {
|
|||||||
const isSelect = tagName === "select";
|
const isSelect = tagName === "select";
|
||||||
const isCheckboxInput = isInput && typeAttr === "checkbox";
|
const isCheckboxInput = isInput && typeAttr === "checkbox";
|
||||||
const isRadioInput = isInput && typeAttr === "radio";
|
const isRadioInput = isInput && typeAttr === "radio";
|
||||||
const hasLazyMod = attr.includes(".lazy");
|
|
||||||
const hasNumberMod = attr.includes(".number");
|
|
||||||
const hasTrimMod = attr.includes(".trim");
|
const hasTrimMod = attr.includes(".trim");
|
||||||
|
const hasLazyMod = hasTrimMod || attr.includes(".lazy");
|
||||||
|
const hasNumberMod = attr.includes(".number");
|
||||||
const eventType = isRadioInput ? "click" : isSelect || hasLazyMod ? "change" : "input";
|
const eventType = isRadioInput ? "click" : isSelect || hasLazyMod ? "change" : "input";
|
||||||
|
|
||||||
model = {
|
model = {
|
||||||
@@ -389,6 +389,8 @@ function parseDOMNode(node: Element, ctx: ParsingContext): AST | null {
|
|||||||
}
|
}
|
||||||
} else if (attr.startsWith("block-")) {
|
} else if (attr.startsWith("block-")) {
|
||||||
throw new OwlError(`Invalid attribute: '${attr}'`);
|
throw new OwlError(`Invalid attribute: '${attr}'`);
|
||||||
|
} else if (attr === "xmlns") {
|
||||||
|
ns = value;
|
||||||
} else if (attr !== "t-name") {
|
} else if (attr !== "t-name") {
|
||||||
if (attr.startsWith("t-") && !attr.startsWith("t-att")) {
|
if (attr.startsWith("t-") && !attr.startsWith("t-att")) {
|
||||||
throw new OwlError(`Unknown QWeb directive: '${attr}'`);
|
throw new OwlError(`Unknown QWeb directive: '${attr}'`);
|
||||||
@@ -401,6 +403,9 @@ function parseDOMNode(node: Element, ctx: ParsingContext): AST | null {
|
|||||||
attrs[attr] = value;
|
attrs[attr] = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (ns) {
|
||||||
|
ctx.nameSpace = ns;
|
||||||
|
}
|
||||||
|
|
||||||
const children = parseChildren(node, ctx);
|
const children = parseChildren(node, ctx);
|
||||||
return {
|
return {
|
||||||
@@ -736,14 +741,14 @@ function parseComponent(node: Element, ctx: ParsingContext): AST | null {
|
|||||||
// be ignored)
|
// be ignored)
|
||||||
let el = slotNode.parentElement!;
|
let el = slotNode.parentElement!;
|
||||||
let isInSubComponent = false;
|
let isInSubComponent = false;
|
||||||
while (el !== clone) {
|
while (el && el !== clone) {
|
||||||
if (el!.hasAttribute("t-component") || el!.tagName[0] === el!.tagName[0].toUpperCase()) {
|
if (el!.hasAttribute("t-component") || el!.tagName[0] === el!.tagName[0].toUpperCase()) {
|
||||||
isInSubComponent = true;
|
isInSubComponent = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
el = el.parentElement!;
|
el = el.parentElement!;
|
||||||
}
|
}
|
||||||
if (isInSubComponent) {
|
if (isInSubComponent || !el) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -968,40 +973,3 @@ function normalizeXML(el: Element) {
|
|||||||
normalizeTIf(el);
|
normalizeTIf(el);
|
||||||
normalizeTEscTOut(el);
|
normalizeTEscTOut(el);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Parses an XML string into an XML document, throwing errors on parser errors
|
|
||||||
* instead of returning an XML document containing the parseerror.
|
|
||||||
*
|
|
||||||
* @param xml the string to parse
|
|
||||||
* @returns an XML document corresponding to the content of the string
|
|
||||||
*/
|
|
||||||
function parseXML(xml: string): XMLDocument {
|
|
||||||
const parser = new DOMParser();
|
|
||||||
const doc = parser.parseFromString(xml, "text/xml");
|
|
||||||
if (doc.getElementsByTagName("parsererror").length) {
|
|
||||||
let msg = "Invalid XML in template.";
|
|
||||||
const parsererrorText = doc.getElementsByTagName("parsererror")[0].textContent;
|
|
||||||
if (parsererrorText) {
|
|
||||||
msg += "\nThe parser has produced the following error message:\n" + parsererrorText;
|
|
||||||
const re = /\d+/g;
|
|
||||||
const firstMatch = re.exec(parsererrorText);
|
|
||||||
if (firstMatch) {
|
|
||||||
const lineNumber = Number(firstMatch[0]);
|
|
||||||
const line = xml.split("\n")[lineNumber - 1];
|
|
||||||
const secondMatch = re.exec(parsererrorText);
|
|
||||||
if (line && secondMatch) {
|
|
||||||
const columnIndex = Number(secondMatch[0]) - 1;
|
|
||||||
if (line[columnIndex]) {
|
|
||||||
msg +=
|
|
||||||
`\nThe error might be located at xml line ${lineNumber} column ${columnIndex}\n` +
|
|
||||||
`${line}\n${"-".repeat(columnIndex - 1)}^`;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
throw new OwlError(msg);
|
|
||||||
}
|
|
||||||
|
|
||||||
return doc;
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -5,12 +5,10 @@ export * from "./runtime";
|
|||||||
|
|
||||||
TemplateSet.prototype._compileTemplate = function _compileTemplate(
|
TemplateSet.prototype._compileTemplate = function _compileTemplate(
|
||||||
name: string,
|
name: string,
|
||||||
template: string | Element,
|
template: string | Element
|
||||||
alias?: string
|
|
||||||
) {
|
) {
|
||||||
return compile(template, {
|
return compile(template, {
|
||||||
name,
|
name,
|
||||||
alias,
|
|
||||||
dev: this.dev,
|
dev: this.dev,
|
||||||
translateFn: this.translateFn,
|
translateFn: this.translateFn,
|
||||||
translatableAttributes: this.translatableAttributes,
|
translatableAttributes: this.translatableAttributes,
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
import { version } from "../version";
|
import { version } from "../version";
|
||||||
import { Component, ComponentConstructor, Props } from "./component";
|
import { Component, ComponentConstructor, Props } from "./component";
|
||||||
import { ComponentNode } from "./component_node";
|
import { ComponentNode } from "./component_node";
|
||||||
import { nodeErrorHandlers, OwlError, handleError } from "./error_handling";
|
import { nodeErrorHandlers, handleError } from "./error_handling";
|
||||||
|
import { OwlError } from "../common/owl_error";
|
||||||
import { Fiber, RootFiber, MountOptions } from "./fibers";
|
import { Fiber, RootFiber, MountOptions } from "./fibers";
|
||||||
import { Scheduler } from "./scheduler";
|
import { Scheduler } from "./scheduler";
|
||||||
import { validateProps } from "./template_helpers";
|
import { validateProps } from "./template_helpers";
|
||||||
@@ -34,6 +35,8 @@ This is not suitable for production use.
|
|||||||
See https://github.com/odoo/owl/blob/${hash}/doc/reference/app.md#configuration for more information.`;
|
See https://github.com/odoo/owl/blob/${hash}/doc/reference/app.md#configuration for more information.`;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const apps = new Set<App>();
|
||||||
|
|
||||||
declare global {
|
declare global {
|
||||||
interface Window {
|
interface Window {
|
||||||
__OWL_DEVTOOLS__: {
|
__OWL_DEVTOOLS__: {
|
||||||
@@ -46,13 +49,7 @@ declare global {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
window.__OWL_DEVTOOLS__ ||= {
|
window.__OWL_DEVTOOLS__ ||= { apps, Fiber, RootFiber, toRaw, reactive };
|
||||||
apps: new Set<App>(),
|
|
||||||
Fiber: Fiber,
|
|
||||||
RootFiber: RootFiber,
|
|
||||||
toRaw: toRaw,
|
|
||||||
reactive: reactive,
|
|
||||||
};
|
|
||||||
|
|
||||||
export class App<
|
export class App<
|
||||||
T extends abstract new (...args: any) => any = any,
|
T extends abstract new (...args: any) => any = any,
|
||||||
@@ -60,6 +57,7 @@ export class App<
|
|||||||
E = any
|
E = any
|
||||||
> extends TemplateSet {
|
> extends TemplateSet {
|
||||||
static validateTarget = validateTarget;
|
static validateTarget = validateTarget;
|
||||||
|
static apps = apps;
|
||||||
static version = version;
|
static version = version;
|
||||||
|
|
||||||
name: string;
|
name: string;
|
||||||
@@ -74,7 +72,7 @@ export class App<
|
|||||||
super(config);
|
super(config);
|
||||||
this.name = config.name || "";
|
this.name = config.name || "";
|
||||||
this.Root = Root;
|
this.Root = Root;
|
||||||
window.__OWL_DEVTOOLS__.apps.add(this);
|
apps.add(this);
|
||||||
if (config.test) {
|
if (config.test) {
|
||||||
this.dev = true;
|
this.dev = true;
|
||||||
}
|
}
|
||||||
@@ -139,7 +137,7 @@ export class App<
|
|||||||
this.root.destroy();
|
this.root.destroy();
|
||||||
this.scheduler.processTasks();
|
this.scheduler.processTasks();
|
||||||
}
|
}
|
||||||
window.__OWL_DEVTOOLS__.apps.delete(this);
|
apps.delete(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
createComponent<P extends Props>(
|
createComponent<P extends Props>(
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { OwlError } from "../error_handling";
|
import { OwlError } from "../../common/owl_error";
|
||||||
import { attrsSetter, attrsUpdater, createAttrUpdater, setClass, updateClass } from "./attributes";
|
import { attrsSetter, attrsUpdater, createAttrUpdater, setClass, updateClass } from "./attributes";
|
||||||
import { config } from "./config";
|
import { config } from "./config";
|
||||||
import { createEventHandler } from "./events";
|
import { createEventHandler } from "./events";
|
||||||
@@ -144,12 +144,7 @@ function buildTree(
|
|||||||
info.push({ type: "child", idx: index });
|
info.push({ type: "child", idx: index });
|
||||||
el = document.createTextNode("");
|
el = document.createTextNode("");
|
||||||
}
|
}
|
||||||
const attrs = (node as Element).attributes;
|
currentNS ||= (node as Element).namespaceURI;
|
||||||
const ns = attrs.getNamedItem("block-ns");
|
|
||||||
if (ns) {
|
|
||||||
attrs.removeNamedItem("block-ns");
|
|
||||||
currentNS = ns.value;
|
|
||||||
}
|
|
||||||
if (!el) {
|
if (!el) {
|
||||||
el = currentNS
|
el = currentNS
|
||||||
? document.createElementNS(currentNS, tagName)
|
? document.createElementNS(currentNS, tagName)
|
||||||
@@ -165,6 +160,7 @@ function buildTree(
|
|||||||
const fragment = document.createElement("template").content;
|
const fragment = document.createElement("template").content;
|
||||||
fragment.appendChild(el);
|
fragment.appendChild(el);
|
||||||
}
|
}
|
||||||
|
const attrs = (node as Element).attributes;
|
||||||
for (let i = 0; i < attrs.length; i++) {
|
for (let i = 0; i < attrs.length; i++) {
|
||||||
const attrName = attrs[i].name;
|
const attrName = attrs[i].name;
|
||||||
const attrValue = attrs[i].value;
|
const attrValue = attrs[i].value;
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ export type ComponentConstructor<P extends Props = any, E = any> = (new (
|
|||||||
|
|
||||||
export class Component<Props = any, Env = any> {
|
export class Component<Props = any, Env = any> {
|
||||||
static template: string = "";
|
static template: string = "";
|
||||||
static props?: any;
|
static props?: Schema;
|
||||||
static defaultProps?: any;
|
static defaultProps?: any;
|
||||||
|
|
||||||
props: Props;
|
props: Props;
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
import type { App, Env } from "./app";
|
import type { App, Env } from "./app";
|
||||||
import { BDom, VNode } from "./blockdom";
|
import { BDom, VNode } from "./blockdom";
|
||||||
import { Component, ComponentConstructor, Props } from "./component";
|
import { Component, ComponentConstructor, Props } from "./component";
|
||||||
import { fibersInError, OwlError } from "./error_handling";
|
import { fibersInError } from "./error_handling";
|
||||||
|
import { OwlError } from "../common/owl_error";
|
||||||
import { Fiber, makeChildFiber, makeRootFiber, MountFiber, MountOptions } from "./fibers";
|
import { Fiber, makeChildFiber, makeRootFiber, MountFiber, MountOptions } from "./fibers";
|
||||||
import { clearReactivesForCallback, getSubscriptions, reactive, targets } from "./reactivity";
|
import { clearReactivesForCallback, getSubscriptions, reactive, targets } from "./reactivity";
|
||||||
import { STATUS } from "./status";
|
import { STATUS } from "./status";
|
||||||
@@ -116,7 +117,7 @@ export class ComponentNode<P extends Props = any, E = any> implements VNode<Comp
|
|||||||
}
|
}
|
||||||
this.component = new C(props, env, this);
|
this.component = new C(props, env, this);
|
||||||
const ctx = Object.assign(Object.create(this.component), { this: this.component });
|
const ctx = Object.assign(Object.create(this.component), { this: this.component });
|
||||||
this.renderFn = app.getTemplate(C.template, C.name).bind(this.component, ctx, this);
|
this.renderFn = app.getTemplate(C.template).bind(this.component, ctx, this);
|
||||||
this.component.setup();
|
this.component.setup();
|
||||||
currentNode = null;
|
currentNode = null;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,7 @@
|
|||||||
|
import { OwlError } from "../common/owl_error";
|
||||||
import type { ComponentNode } from "./component_node";
|
import type { ComponentNode } from "./component_node";
|
||||||
import type { Fiber } from "./fibers";
|
import type { Fiber } from "./fibers";
|
||||||
|
|
||||||
// Custom error class that wraps error that happen in the owl lifecycle
|
|
||||||
export class OwlError extends Error {
|
|
||||||
cause?: any;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Maps fibers to thrown errors
|
// Maps fibers to thrown errors
|
||||||
export const fibersInError: WeakMap<Fiber, any> = new WeakMap();
|
export const fibersInError: WeakMap<Fiber, any> = new WeakMap();
|
||||||
export const nodeErrorHandlers: WeakMap<ComponentNode, ((error: any) => void)[]> = new WeakMap();
|
export const nodeErrorHandlers: WeakMap<ComponentNode, ((error: any) => void)[]> = new WeakMap();
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { filterOutModifiersFromData } from "./blockdom/config";
|
import { filterOutModifiersFromData } from "./blockdom/config";
|
||||||
import { STATUS } from "./status";
|
import { STATUS } from "./status";
|
||||||
import { OwlError } from "./error_handling";
|
import { OwlError } from "../common/owl_error";
|
||||||
|
|
||||||
export const mainEventHandler = (data: any, ev: Event, currentTarget?: EventTarget | null) => {
|
export const mainEventHandler = (data: any, ev: Event, currentTarget?: EventTarget | null) => {
|
||||||
const { data: _data, modifiers } = filterOutModifiersFromData(data);
|
const { data: _data, modifiers } = filterOutModifiersFromData(data);
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import { BDom, mount } from "./blockdom";
|
import { BDom, mount } from "./blockdom";
|
||||||
import type { ComponentNode } from "./component_node";
|
import type { ComponentNode } from "./component_node";
|
||||||
import { fibersInError, OwlError } from "./error_handling";
|
import { fibersInError } from "./error_handling";
|
||||||
|
import { OwlError } from "../common/owl_error";
|
||||||
import { STATUS } from "./status";
|
import { STATUS } from "./status";
|
||||||
|
|
||||||
export function makeChildFiber(node: ComponentNode, parent: Fiber): Fiber {
|
export function makeChildFiber(node: ComponentNode, parent: Fiber): Fiber {
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ export function useChildSubEnv(envExtension: Env) {
|
|||||||
// useEffect
|
// useEffect
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
type EffectDeps<T extends any[]> = T | (T extends [...infer H, never] ? EffectDeps<H> : never);
|
type EffectDeps<T extends unknown[]> = T | (T extends [...infer H, never] ? EffectDeps<H> : never);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @template T
|
* @template T
|
||||||
@@ -67,7 +67,7 @@ type EffectDeps<T extends any[]> = T | (T extends [...infer H, never] ? EffectDe
|
|||||||
* @returns {void|(()=>void)} a cleanup function that reverses the side
|
* @returns {void|(()=>void)} a cleanup function that reverses the side
|
||||||
* effects of the effect callback.
|
* effects of the effect callback.
|
||||||
*/
|
*/
|
||||||
type Effect<T extends [...T]> = (...dependencies: EffectDeps<T>) => void | (() => void);
|
type Effect<T extends unknown[]> = (...dependencies: EffectDeps<T>) => void | (() => void);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This hook will run a callback when a component is mounted and patched, and
|
* This hook will run a callback when a component is mounted and patched, and
|
||||||
@@ -76,15 +76,15 @@ type Effect<T extends [...T]> = (...dependencies: EffectDeps<T>) => void | (() =
|
|||||||
*
|
*
|
||||||
* @template T
|
* @template T
|
||||||
* @param {Effect<T>} effect the effect to run on component mount and/or patch
|
* @param {Effect<T>} effect the effect to run on component mount and/or patch
|
||||||
* @param {()=>T} [computeDependencies=()=>[NaN]] a callback to compute
|
* @param {()=>[...T]} [computeDependencies=()=>[NaN]] a callback to compute
|
||||||
* dependencies that will decide if the effect needs to be cleaned up and
|
* dependencies that will decide if the effect needs to be cleaned up and
|
||||||
* run again. If the dependencies did not change, the effect will not run
|
* run again. If the dependencies did not change, the effect will not run
|
||||||
* again. The default value returns an array containing only NaN because
|
* again. The default value returns an array containing only NaN because
|
||||||
* NaN !== NaN, which will cause the effect to rerun on every patch.
|
* NaN !== NaN, which will cause the effect to rerun on every patch.
|
||||||
*/
|
*/
|
||||||
export function useEffect<T extends [...T]>(
|
export function useEffect<T extends unknown[]>(
|
||||||
effect: Effect<T>,
|
effect: Effect<T>,
|
||||||
computeDependencies: () => T = () => [NaN] as never
|
computeDependencies: () => [...T] = () => [NaN] as never
|
||||||
) {
|
) {
|
||||||
let cleanup: (() => void) | void;
|
let cleanup: (() => void) | void;
|
||||||
let dependencies: T;
|
let dependencies: T;
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ export { useComponent, useState } from "./component_node";
|
|||||||
export { status } from "./status";
|
export { status } from "./status";
|
||||||
export { reactive, markRaw, toRaw } from "./reactivity";
|
export { reactive, markRaw, toRaw } from "./reactivity";
|
||||||
export { useEffect, useEnv, useExternalListener, useRef, useChildSubEnv, useSubEnv } from "./hooks";
|
export { useEffect, useEnv, useExternalListener, useRef, useChildSubEnv, useSubEnv } from "./hooks";
|
||||||
export { EventBus, whenReady, loadFile, markup } from "./utils";
|
export { batched, EventBus, whenReady, loadFile, markup } from "./utils";
|
||||||
export {
|
export {
|
||||||
onWillStart,
|
onWillStart,
|
||||||
onMounted,
|
onMounted,
|
||||||
@@ -55,7 +55,7 @@ export {
|
|||||||
onError,
|
onError,
|
||||||
} from "./lifecycle_hooks";
|
} from "./lifecycle_hooks";
|
||||||
export { validate, validateType } from "./validation";
|
export { validate, validateType } from "./validation";
|
||||||
export { OwlError } from "./error_handling";
|
export { OwlError } from "../common/owl_error";
|
||||||
|
|
||||||
export const __info__ = {
|
export const __info__ = {
|
||||||
version: App.version,
|
version: App.version,
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import { getCurrent } from "./component_node";
|
import { getCurrent } from "./component_node";
|
||||||
import { nodeErrorHandlers, OwlError } from "./error_handling";
|
import { nodeErrorHandlers } from "./error_handling";
|
||||||
|
import { OwlError } from "../common/owl_error";
|
||||||
|
|
||||||
const TIMEOUT = Symbol("timeout");
|
const TIMEOUT = Symbol("timeout");
|
||||||
function wrapError(fn: (...args: any[]) => any, hookName: string) {
|
function wrapError(fn: (...args: any[]) => any, hookName: string) {
|
||||||
@@ -27,7 +28,7 @@ function wrapError(fn: (...args: any[]) => any, hookName: string) {
|
|||||||
result.catch(() => {}),
|
result.catch(() => {}),
|
||||||
new Promise((resolve) => setTimeout(() => resolve(TIMEOUT), 3000)),
|
new Promise((resolve) => setTimeout(() => resolve(TIMEOUT), 3000)),
|
||||||
]).then((res) => {
|
]).then((res) => {
|
||||||
if (res === TIMEOUT && node.fiber === fiber) {
|
if (res === TIMEOUT && node.fiber === fiber && node.status <= 2) {
|
||||||
console.warn(timeoutError);
|
console.warn(timeoutError);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { onMounted, onWillUnmount } from "./lifecycle_hooks";
|
import { onMounted, onWillUnmount } from "./lifecycle_hooks";
|
||||||
import { BDom, text, VNode } from "./blockdom";
|
import { BDom, text, VNode } from "./blockdom";
|
||||||
import { Component } from "./component";
|
import { Component } from "./component";
|
||||||
import { OwlError } from "./error_handling";
|
import { OwlError } from "../common/owl_error";
|
||||||
|
|
||||||
const VText: any = text("").constructor;
|
const VText: any = text("").constructor;
|
||||||
|
|
||||||
@@ -65,7 +65,7 @@ export class Portal extends Component {
|
|||||||
type: String,
|
type: String,
|
||||||
},
|
},
|
||||||
slots: true,
|
slots: true,
|
||||||
};
|
} as const;
|
||||||
|
|
||||||
setup() {
|
setup() {
|
||||||
const node: any = this.__owl__;
|
const node: any = this.__owl__;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import type { Callback } from "./utils";
|
import type { Callback } from "./utils";
|
||||||
import { OwlError } from "./error_handling";
|
import { OwlError } from "../common/owl_error";
|
||||||
|
|
||||||
// Special key to subscribe to, to be notified of key creation/deletion
|
// Special key to subscribe to, to be notified of key creation/deletion
|
||||||
const KEYCHANGES = Symbol("Key changes");
|
const KEYCHANGES = Symbol("Key changes");
|
||||||
@@ -20,8 +20,9 @@ type CollectionRawType = "Set" | "Map" | "WeakMap";
|
|||||||
const objectToString = Object.prototype.toString;
|
const objectToString = Object.prototype.toString;
|
||||||
const objectHasOwnProperty = Object.prototype.hasOwnProperty;
|
const objectHasOwnProperty = Object.prototype.hasOwnProperty;
|
||||||
|
|
||||||
const SUPPORTED_RAW_TYPES = new Set(["Object", "Array", "Set", "Map", "WeakMap"]);
|
// Use arrays because Array.includes is faster than Set.has for small arrays
|
||||||
const COLLECTION_RAWTYPES = new Set(["Set", "Map", "WeakMap"]);
|
const SUPPORTED_RAW_TYPES = ["Object", "Array", "Set", "Map", "WeakMap"];
|
||||||
|
const COLLECTION_RAW_TYPES = ["Set", "Map", "WeakMap"];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* extract "RawType" from strings like "[object RawType]" => this lets us ignore
|
* extract "RawType" from strings like "[object RawType]" => this lets us ignore
|
||||||
@@ -45,7 +46,7 @@ function canBeMadeReactive(value: any): boolean {
|
|||||||
if (typeof value !== "object") {
|
if (typeof value !== "object") {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return SUPPORTED_RAW_TYPES.has(rawType(value));
|
return SUPPORTED_RAW_TYPES.includes(rawType(value));
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Creates a reactive from the given object/callback if possible and returns it,
|
* Creates a reactive from the given object/callback if possible and returns it,
|
||||||
@@ -220,7 +221,7 @@ export function reactive<T extends Target>(target: T, callback: Callback = NO_CA
|
|||||||
const reactivesForTarget = reactiveCache.get(target)!;
|
const reactivesForTarget = reactiveCache.get(target)!;
|
||||||
if (!reactivesForTarget.has(callback)) {
|
if (!reactivesForTarget.has(callback)) {
|
||||||
const targetRawType = rawType(target);
|
const targetRawType = rawType(target);
|
||||||
const handler = COLLECTION_RAWTYPES.has(targetRawType)
|
const handler = COLLECTION_RAW_TYPES.includes(targetRawType)
|
||||||
? collectionsProxyHandler(target as Collection, callback, targetRawType as CollectionRawType)
|
? collectionsProxyHandler(target as Collection, callback, targetRawType as CollectionRawType)
|
||||||
: basicProxyHandler<T>(callback);
|
: basicProxyHandler<T>(callback);
|
||||||
const proxy = new Proxy(target, handler as ProxyHandler<T>) as Reactive<T>;
|
const proxy = new Proxy(target, handler as ProxyHandler<T>) as Reactive<T>;
|
||||||
@@ -249,7 +250,7 @@ function basicProxyHandler<T extends Target>(callback: Callback): ProxyHandler<T
|
|||||||
set(target, key, value, receiver) {
|
set(target, key, value, receiver) {
|
||||||
const hadKey = objectHasOwnProperty.call(target, key);
|
const hadKey = objectHasOwnProperty.call(target, key);
|
||||||
const originalValue = Reflect.get(target, key, receiver);
|
const originalValue = Reflect.get(target, key, receiver);
|
||||||
const ret = Reflect.set(target, key, value, receiver);
|
const ret = Reflect.set(target, key, toRaw(value), receiver);
|
||||||
if (!hadKey && objectHasOwnProperty.call(target, key)) {
|
if (!hadKey && objectHasOwnProperty.call(target, key)) {
|
||||||
notifyReactives(target, KEYCHANGES);
|
notifyReactives(target, KEYCHANGES);
|
||||||
}
|
}
|
||||||
@@ -368,7 +369,7 @@ function delegateAndNotify(
|
|||||||
if (hadKey !== hasKey) {
|
if (hadKey !== hasKey) {
|
||||||
notifyReactives(target, KEYCHANGES);
|
notifyReactives(target, KEYCHANGES);
|
||||||
}
|
}
|
||||||
if (originalValue !== value) {
|
if (originalValue !== target[getterName](key)) {
|
||||||
notifyReactives(target, key);
|
notifyReactives(target, key);
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import { html } from "./blockdom/index";
|
|||||||
import { isOptional, validateSchema } from "./validation";
|
import { isOptional, validateSchema } from "./validation";
|
||||||
import type { ComponentConstructor } from "./component";
|
import type { ComponentConstructor } from "./component";
|
||||||
import { markRaw } from "./reactivity";
|
import { markRaw } from "./reactivity";
|
||||||
import { OwlError } from "./error_handling";
|
import { OwlError } from "../common/owl_error";
|
||||||
import type { ComponentNode } from "./component_node";
|
import type { ComponentNode } from "./component_node";
|
||||||
|
|
||||||
const ObjectCreate = Object.create;
|
const ObjectCreate = Object.create;
|
||||||
@@ -70,14 +70,12 @@ function prepareList(collection: unknown): [unknown[], unknown[], number, undefi
|
|||||||
} else if (collection instanceof Map) {
|
} else if (collection instanceof Map) {
|
||||||
keys = [...collection.keys()];
|
keys = [...collection.keys()];
|
||||||
values = [...collection.values()];
|
values = [...collection.values()];
|
||||||
|
} else if (Symbol.iterator in Object(collection)) {
|
||||||
|
keys = [...(<Iterable<unknown>>collection)];
|
||||||
|
values = keys;
|
||||||
} else if (collection && typeof collection === "object") {
|
} else if (collection && typeof collection === "object") {
|
||||||
if (Symbol.iterator in collection) {
|
values = Object.values(collection);
|
||||||
keys = [...(<Iterable<unknown>>collection)];
|
keys = Object.keys(collection);
|
||||||
values = keys;
|
|
||||||
} else {
|
|
||||||
values = Object.keys(collection);
|
|
||||||
keys = Object.values(collection);
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
throw new OwlError(`Invalid loop expression: "${collection}" is not iterable`);
|
throw new OwlError(`Invalid loop expression: "${collection}" is not iterable`);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,45 +3,17 @@ import { comment, createBlock, html, list, multi, text, toggler } from "./blockd
|
|||||||
import { getCurrent } from "./component_node";
|
import { getCurrent } from "./component_node";
|
||||||
import { Portal, portalTemplate } from "./portal";
|
import { Portal, portalTemplate } from "./portal";
|
||||||
import { helpers } from "./template_helpers";
|
import { helpers } from "./template_helpers";
|
||||||
import { OwlError } from "./error_handling";
|
import { OwlError } from "../common/owl_error";
|
||||||
|
import { parseXML } from "../common/utils";
|
||||||
|
|
||||||
const bdom = { text, createBlock, list, multi, html, toggler, comment };
|
const bdom = { text, createBlock, list, multi, html, toggler, comment };
|
||||||
|
|
||||||
function parseXML(xml: string): Document {
|
|
||||||
const parser = new DOMParser();
|
|
||||||
|
|
||||||
const doc = parser.parseFromString(xml, "text/xml");
|
|
||||||
if (doc.getElementsByTagName("parsererror").length) {
|
|
||||||
let msg = "Invalid XML in template.";
|
|
||||||
const parsererrorText = doc.getElementsByTagName("parsererror")[0].textContent;
|
|
||||||
if (parsererrorText) {
|
|
||||||
msg += "\nThe parser has produced the following error message:\n" + parsererrorText;
|
|
||||||
const re = /\d+/g;
|
|
||||||
const firstMatch = re.exec(parsererrorText);
|
|
||||||
if (firstMatch) {
|
|
||||||
const lineNumber = Number(firstMatch[0]);
|
|
||||||
const line = xml.split("\n")[lineNumber - 1];
|
|
||||||
const secondMatch = re.exec(parsererrorText);
|
|
||||||
if (line && secondMatch) {
|
|
||||||
const columnIndex = Number(secondMatch[0]) - 1;
|
|
||||||
if (line[columnIndex]) {
|
|
||||||
msg +=
|
|
||||||
`\nThe error might be located at xml line ${lineNumber} column ${columnIndex}\n` +
|
|
||||||
`${line}\n${"-".repeat(columnIndex - 1)}^`;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
throw new OwlError(msg);
|
|
||||||
}
|
|
||||||
return doc;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface TemplateSetConfig {
|
export interface TemplateSetConfig {
|
||||||
dev?: boolean;
|
dev?: boolean;
|
||||||
translatableAttributes?: string[];
|
translatableAttributes?: string[];
|
||||||
translateFn?: (s: string) => string;
|
translateFn?: (s: string) => string;
|
||||||
templates?: string | Document;
|
templates?: string | Document | Record<string, string>;
|
||||||
|
getTemplate?: (s: string) => Element | Function | string | void;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class TemplateSet {
|
export class TemplateSet {
|
||||||
@@ -51,6 +23,7 @@ export class TemplateSet {
|
|||||||
dev: boolean;
|
dev: boolean;
|
||||||
rawTemplates: typeof globalTemplates = Object.create(globalTemplates);
|
rawTemplates: typeof globalTemplates = Object.create(globalTemplates);
|
||||||
templates: { [name: string]: Template } = {};
|
templates: { [name: string]: Template } = {};
|
||||||
|
getRawTemplate?: (s: string) => Element | Function | string | void;
|
||||||
translateFn?: (s: string) => string;
|
translateFn?: (s: string) => string;
|
||||||
translatableAttributes?: string[];
|
translatableAttributes?: string[];
|
||||||
Portal = Portal;
|
Portal = Portal;
|
||||||
@@ -60,12 +33,23 @@ export class TemplateSet {
|
|||||||
this.translateFn = config.translateFn;
|
this.translateFn = config.translateFn;
|
||||||
this.translatableAttributes = config.translatableAttributes;
|
this.translatableAttributes = config.translatableAttributes;
|
||||||
if (config.templates) {
|
if (config.templates) {
|
||||||
this.addTemplates(config.templates);
|
if (config.templates instanceof Document || typeof config.templates === "string") {
|
||||||
|
this.addTemplates(config.templates);
|
||||||
|
} else {
|
||||||
|
for (const name in config.templates) {
|
||||||
|
this.addTemplate(name, config.templates[name]);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
this.getRawTemplate = config.getTemplate;
|
||||||
}
|
}
|
||||||
|
|
||||||
addTemplate(name: string, template: string | Element) {
|
addTemplate(name: string, template: string | Element) {
|
||||||
if (name in this.rawTemplates) {
|
if (name in this.rawTemplates) {
|
||||||
|
// this check can be expensive, just silently ignore double definitions outside dev mode
|
||||||
|
if (!this.dev) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
const rawTemplate = this.rawTemplates[name];
|
const rawTemplate = this.rawTemplates[name];
|
||||||
const currentAsString =
|
const currentAsString =
|
||||||
typeof rawTemplate === "string"
|
typeof rawTemplate === "string"
|
||||||
@@ -94,9 +78,9 @@ export class TemplateSet {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
getTemplate(name: string, alias?: string): Template {
|
getTemplate(name: string): Template {
|
||||||
if (!(name in this.templates)) {
|
if (!(name in this.templates)) {
|
||||||
const rawTemplate = this.rawTemplates[name];
|
const rawTemplate = this.getRawTemplate?.(name) || this.rawTemplates[name];
|
||||||
if (rawTemplate === undefined) {
|
if (rawTemplate === undefined) {
|
||||||
let extraInfo = "";
|
let extraInfo = "";
|
||||||
try {
|
try {
|
||||||
@@ -106,7 +90,7 @@ export class TemplateSet {
|
|||||||
throw new OwlError(`Missing template: "${name}"${extraInfo}`);
|
throw new OwlError(`Missing template: "${name}"${extraInfo}`);
|
||||||
}
|
}
|
||||||
const isFn = typeof rawTemplate === "function" && !(rawTemplate instanceof Element);
|
const isFn = typeof rawTemplate === "function" && !(rawTemplate instanceof Element);
|
||||||
const templateFn = isFn ? rawTemplate : this._compileTemplate(name, rawTemplate, alias);
|
const templateFn = isFn ? rawTemplate : this._compileTemplate(name, rawTemplate);
|
||||||
// first add a function to lazily get the template, in case there is a
|
// first add a function to lazily get the template, in case there is a
|
||||||
// recursive call to the template name
|
// recursive call to the template name
|
||||||
const templates = this.templates;
|
const templates = this.templates;
|
||||||
@@ -119,7 +103,7 @@ export class TemplateSet {
|
|||||||
return this.templates[name];
|
return this.templates[name];
|
||||||
}
|
}
|
||||||
|
|
||||||
_compileTemplate(name: string, template: string | Element, alias?: string): ReturnType<typeof compile> {
|
_compileTemplate(name: string, template: string | Element): ReturnType<typeof compile> {
|
||||||
throw new OwlError(`Unable to compile a template. Please use owl full build instead`);
|
throw new OwlError(`Unable to compile a template. Please use owl full build instead`);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -135,7 +119,7 @@ export class TemplateSet {
|
|||||||
export const globalTemplates: { [key: string]: string | Element | TemplateFunction } = {};
|
export const globalTemplates: { [key: string]: string | Element | TemplateFunction } = {};
|
||||||
|
|
||||||
export function xml(...args: Parameters<typeof String.raw>) {
|
export function xml(...args: Parameters<typeof String.raw>) {
|
||||||
const name = `xml_template_${xml.nextId++}`;
|
const name = `__template__${xml.nextId++}`;
|
||||||
const value = String.raw(...args);
|
const value = String.raw(...args);
|
||||||
globalTemplates[name] = value;
|
globalTemplates[name] = value;
|
||||||
return name;
|
return name;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { OwlError } from "./error_handling";
|
import { OwlError } from "../common/owl_error";
|
||||||
export type Callback = () => void;
|
export type Callback = () => void;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,15 +1,7 @@
|
|||||||
import { OwlError } from "./error_handling";
|
import { OwlError } from "../common/owl_error";
|
||||||
import { toRaw } from "./reactivity";
|
import { toRaw } from "./reactivity";
|
||||||
|
|
||||||
type BaseType =
|
type BaseType = { new (...args: any[]): any } | true | "*";
|
||||||
| typeof String
|
|
||||||
| typeof Boolean
|
|
||||||
| typeof Number
|
|
||||||
| typeof Date
|
|
||||||
| typeof Object
|
|
||||||
| typeof Array
|
|
||||||
| true
|
|
||||||
| "*";
|
|
||||||
|
|
||||||
interface TypeInfo {
|
interface TypeInfo {
|
||||||
type?: TypeDescription;
|
type?: TypeDescription;
|
||||||
|
|||||||
@@ -1,2 +1,2 @@
|
|||||||
// do not modify manually. This file is generated by the release script.
|
// do not modify manually. This file is generated by the release script.
|
||||||
export const version = "2.2.3";
|
export const version = "2.2.11";
|
||||||
|
|||||||
@@ -50,12 +50,11 @@ exports[`Reactivity: useState destroyed component before being mounted is inacti
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_1000\\"
|
|
||||||
const comp1 = app.createComponent(\`Child\`, true, false, false, []);
|
const comp1 = app.createComponent(\`Child\`, true, false, false, []);
|
||||||
|
|
||||||
let block1 = createBlock(\`<div><block-child-0/></div>\`);
|
let block1 = createBlock(\`<div><block-child-0/></div>\`);
|
||||||
|
|
||||||
return function xml_template_1000_Parent(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
let b2;
|
let b2;
|
||||||
if (ctx['state'].flag) {
|
if (ctx['state'].flag) {
|
||||||
b2 = comp1({}, key + \`__1\`, node, this, null);
|
b2 = comp1({}, key + \`__1\`, node, this, null);
|
||||||
@@ -69,11 +68,10 @@ exports[`Reactivity: useState destroyed component before being mounted is inacti
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_999\\"
|
|
||||||
|
|
||||||
let block1 = createBlock(\`<span><block-text-0/></span>\`);
|
let block1 = createBlock(\`<span><block-text-0/></span>\`);
|
||||||
|
|
||||||
return function xml_template_999_Child(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
let txt1 = ctx['contextObj'].a;
|
let txt1 = ctx['contextObj'].a;
|
||||||
return block1([txt1]);
|
return block1([txt1]);
|
||||||
}
|
}
|
||||||
@@ -84,12 +82,11 @@ exports[`Reactivity: useState destroyed component is inactive 1`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_1000\\"
|
|
||||||
const comp1 = app.createComponent(\`Child\`, true, false, false, []);
|
const comp1 = app.createComponent(\`Child\`, true, false, false, []);
|
||||||
|
|
||||||
let block1 = createBlock(\`<div><block-child-0/></div>\`);
|
let block1 = createBlock(\`<div><block-child-0/></div>\`);
|
||||||
|
|
||||||
return function xml_template_1000_Parent(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
let b2;
|
let b2;
|
||||||
if (ctx['state'].flag) {
|
if (ctx['state'].flag) {
|
||||||
b2 = comp1({}, key + \`__1\`, node, this, null);
|
b2 = comp1({}, key + \`__1\`, node, this, null);
|
||||||
@@ -103,11 +100,10 @@ exports[`Reactivity: useState destroyed component is inactive 2`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_999\\"
|
|
||||||
|
|
||||||
let block1 = createBlock(\`<span><block-text-0/></span>\`);
|
let block1 = createBlock(\`<span><block-text-0/></span>\`);
|
||||||
|
|
||||||
return function xml_template_999_Child(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
let txt1 = ctx['contextObj'].a;
|
let txt1 = ctx['contextObj'].a;
|
||||||
return block1([txt1]);
|
return block1([txt1]);
|
||||||
}
|
}
|
||||||
@@ -118,11 +114,10 @@ exports[`Reactivity: useState one components can subscribe twice to same context
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_999\\"
|
|
||||||
|
|
||||||
let block1 = createBlock(\`<div><block-text-0/><block-text-1/></div>\`);
|
let block1 = createBlock(\`<div><block-text-0/><block-text-1/></div>\`);
|
||||||
|
|
||||||
return function xml_template_999_Comp(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
let txt1 = ctx['contextObj1'].a;
|
let txt1 = ctx['contextObj1'].a;
|
||||||
let txt2 = ctx['contextObj2'].b;
|
let txt2 = ctx['contextObj2'].b;
|
||||||
return block1([txt1, txt2]);
|
return block1([txt1, txt2]);
|
||||||
@@ -134,12 +129,11 @@ exports[`Reactivity: useState parent and children subscribed to same context 1`]
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_1000\\"
|
|
||||||
const comp1 = app.createComponent(\`Child\`, true, false, false, []);
|
const comp1 = app.createComponent(\`Child\`, true, false, false, []);
|
||||||
|
|
||||||
let block1 = createBlock(\`<div><block-child-0/><block-text-0/></div>\`);
|
let block1 = createBlock(\`<div><block-child-0/><block-text-0/></div>\`);
|
||||||
|
|
||||||
return function xml_template_1000_Parent(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
const b2 = comp1({}, key + \`__1\`, node, this, null);
|
const b2 = comp1({}, key + \`__1\`, node, this, null);
|
||||||
let txt1 = ctx['contextObj'].b;
|
let txt1 = ctx['contextObj'].b;
|
||||||
return block1([txt1], [b2]);
|
return block1([txt1], [b2]);
|
||||||
@@ -151,11 +145,10 @@ exports[`Reactivity: useState parent and children subscribed to same context 2`]
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_999\\"
|
|
||||||
|
|
||||||
let block1 = createBlock(\`<span><block-text-0/></span>\`);
|
let block1 = createBlock(\`<span><block-text-0/></span>\`);
|
||||||
|
|
||||||
return function xml_template_999_Child(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
let txt1 = ctx['contextObj'].a;
|
let txt1 = ctx['contextObj'].a;
|
||||||
return block1([txt1]);
|
return block1([txt1]);
|
||||||
}
|
}
|
||||||
@@ -229,13 +222,12 @@ exports[`Reactivity: useState two components are updated in parallel 1`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_1000\\"
|
|
||||||
const comp1 = app.createComponent(\`Child\`, true, false, false, []);
|
const comp1 = app.createComponent(\`Child\`, true, false, false, []);
|
||||||
const comp2 = app.createComponent(\`Child\`, true, false, false, []);
|
const comp2 = app.createComponent(\`Child\`, true, false, false, []);
|
||||||
|
|
||||||
let block1 = createBlock(\`<div><block-child-0/><block-child-1/></div>\`);
|
let block1 = createBlock(\`<div><block-child-0/><block-child-1/></div>\`);
|
||||||
|
|
||||||
return function xml_template_1000_Parent(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
const b2 = comp1({}, key + \`__1\`, node, this, null);
|
const b2 = comp1({}, key + \`__1\`, node, this, null);
|
||||||
const b3 = comp2({}, key + \`__2\`, node, this, null);
|
const b3 = comp2({}, key + \`__2\`, node, this, null);
|
||||||
return block1([], [b2, b3]);
|
return block1([], [b2, b3]);
|
||||||
@@ -247,11 +239,10 @@ exports[`Reactivity: useState two components are updated in parallel 2`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_999\\"
|
|
||||||
|
|
||||||
let block1 = createBlock(\`<span><block-text-0/></span>\`);
|
let block1 = createBlock(\`<span><block-text-0/></span>\`);
|
||||||
|
|
||||||
return function xml_template_999_Child(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
let txt1 = ctx['contextObj'].value;
|
let txt1 = ctx['contextObj'].value;
|
||||||
return block1([txt1]);
|
return block1([txt1]);
|
||||||
}
|
}
|
||||||
@@ -262,13 +253,12 @@ exports[`Reactivity: useState two components can subscribe to same context 1`] =
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_1000\\"
|
|
||||||
const comp1 = app.createComponent(\`Child\`, true, false, false, []);
|
const comp1 = app.createComponent(\`Child\`, true, false, false, []);
|
||||||
const comp2 = app.createComponent(\`Child\`, true, false, false, []);
|
const comp2 = app.createComponent(\`Child\`, true, false, false, []);
|
||||||
|
|
||||||
let block1 = createBlock(\`<div><block-child-0/><block-child-1/></div>\`);
|
let block1 = createBlock(\`<div><block-child-0/><block-child-1/></div>\`);
|
||||||
|
|
||||||
return function xml_template_1000_Parent(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
const b2 = comp1({}, key + \`__1\`, node, this, null);
|
const b2 = comp1({}, key + \`__1\`, node, this, null);
|
||||||
const b3 = comp2({}, key + \`__2\`, node, this, null);
|
const b3 = comp2({}, key + \`__2\`, node, this, null);
|
||||||
return block1([], [b2, b3]);
|
return block1([], [b2, b3]);
|
||||||
@@ -280,11 +270,10 @@ exports[`Reactivity: useState two components can subscribe to same context 2`] =
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_999\\"
|
|
||||||
|
|
||||||
let block1 = createBlock(\`<span><block-text-0/></span>\`);
|
let block1 = createBlock(\`<span><block-text-0/></span>\`);
|
||||||
|
|
||||||
return function xml_template_999_Child(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
let txt1 = ctx['contextObj'].value;
|
let txt1 = ctx['contextObj'].value;
|
||||||
return block1([txt1]);
|
return block1([txt1]);
|
||||||
}
|
}
|
||||||
@@ -295,13 +284,12 @@ exports[`Reactivity: useState two independent components on different levels are
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_1001\\"
|
|
||||||
const comp1 = app.createComponent(\`Child\`, true, false, false, []);
|
const comp1 = app.createComponent(\`Child\`, true, false, false, []);
|
||||||
const comp2 = app.createComponent(\`Parent\`, true, false, false, []);
|
const comp2 = app.createComponent(\`Parent\`, true, false, false, []);
|
||||||
|
|
||||||
let block1 = createBlock(\`<div><block-child-0/><block-child-1/></div>\`);
|
let block1 = createBlock(\`<div><block-child-0/><block-child-1/></div>\`);
|
||||||
|
|
||||||
return function xml_template_1001_GrandFather(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
const b2 = comp1({}, key + \`__1\`, node, this, null);
|
const b2 = comp1({}, key + \`__1\`, node, this, null);
|
||||||
const b3 = comp2({}, key + \`__2\`, node, this, null);
|
const b3 = comp2({}, key + \`__2\`, node, this, null);
|
||||||
return block1([], [b2, b3]);
|
return block1([], [b2, b3]);
|
||||||
@@ -313,11 +301,10 @@ exports[`Reactivity: useState two independent components on different levels are
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_999\\"
|
|
||||||
|
|
||||||
let block1 = createBlock(\`<span><block-text-0/></span>\`);
|
let block1 = createBlock(\`<span><block-text-0/></span>\`);
|
||||||
|
|
||||||
return function xml_template_999_Child(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
let txt1 = ctx['contextObj'].value;
|
let txt1 = ctx['contextObj'].value;
|
||||||
return block1([txt1]);
|
return block1([txt1]);
|
||||||
}
|
}
|
||||||
@@ -328,12 +315,11 @@ exports[`Reactivity: useState two independent components on different levels are
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_1000\\"
|
|
||||||
const comp1 = app.createComponent(\`Child\`, true, false, false, []);
|
const comp1 = app.createComponent(\`Child\`, true, false, false, []);
|
||||||
|
|
||||||
let block1 = createBlock(\`<div><block-child-0/></div>\`);
|
let block1 = createBlock(\`<div><block-child-0/></div>\`);
|
||||||
|
|
||||||
return function xml_template_1000_Parent(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
const b2 = comp1({}, key + \`__1\`, node, this, null);
|
const b2 = comp1({}, key + \`__1\`, node, this, null);
|
||||||
return block1([], [b2]);
|
return block1([], [b2]);
|
||||||
}
|
}
|
||||||
@@ -344,11 +330,10 @@ exports[`Reactivity: useState useContext=useState hook is reactive, for one comp
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_999\\"
|
|
||||||
|
|
||||||
let block1 = createBlock(\`<div><block-text-0/></div>\`);
|
let block1 = createBlock(\`<div><block-text-0/></div>\`);
|
||||||
|
|
||||||
return function xml_template_999_Comp(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
let txt1 = ctx['contextObj'].value;
|
let txt1 = ctx['contextObj'].value;
|
||||||
return block1([txt1]);
|
return block1([txt1]);
|
||||||
}
|
}
|
||||||
@@ -360,16 +345,15 @@ exports[`Reactivity: useState useless atoms should be deleted 1`] = `
|
|||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
let { prepareList, withKey } = helpers;
|
let { prepareList, withKey } = helpers;
|
||||||
// Template name: \\"xml_template_1000\\"
|
|
||||||
const comp1 = app.createComponent(\`Quantity\`, true, false, false, [\\"id\\"]);
|
const comp1 = app.createComponent(\`Quantity\`, true, false, false, [\\"id\\"]);
|
||||||
|
|
||||||
let block1 = createBlock(\`<div><block-child-0/> Total: <block-text-0/> Count: <block-text-1/></div>\`);
|
let block1 = createBlock(\`<div><block-child-0/> Total: <block-text-0/> Count: <block-text-1/></div>\`);
|
||||||
|
|
||||||
return function xml_template_1000_ListOfQuantities(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
ctx = Object.create(ctx);
|
ctx = Object.create(ctx);
|
||||||
const [k_block2, v_block2, l_block2, c_block2] = prepareList(Object.keys(ctx['state']));;
|
const [k_block2, v_block2, l_block2, c_block2] = prepareList(Object.keys(ctx['state']));;
|
||||||
for (let i1 = 0; i1 < l_block2; i1++) {
|
for (let i1 = 0; i1 < l_block2; i1++) {
|
||||||
ctx[\`id\`] = v_block2[i1];
|
ctx[\`id\`] = k_block2[i1];
|
||||||
const key1 = ctx['id'];
|
const key1 = ctx['id'];
|
||||||
c_block2[i1] = withKey(comp1({id: ctx['id']}, key + \`__1__\${key1}\`, node, this, null), key1);
|
c_block2[i1] = withKey(comp1({id: ctx['id']}, key + \`__1__\${key1}\`, node, this, null), key1);
|
||||||
}
|
}
|
||||||
@@ -386,11 +370,10 @@ exports[`Reactivity: useState useless atoms should be deleted 2`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_999\\"
|
|
||||||
|
|
||||||
let block1 = createBlock(\`<div><block-text-0/></div>\`);
|
let block1 = createBlock(\`<div><block-text-0/></div>\`);
|
||||||
|
|
||||||
return function xml_template_999_Quantity(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
let txt1 = ctx['state'].quantity;
|
let txt1 = ctx['state'].quantity;
|
||||||
return block1([txt1]);
|
return block1([txt1]);
|
||||||
}
|
}
|
||||||
@@ -401,11 +384,10 @@ exports[`Reactivity: useState very simple use, with initial value 1`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_999\\"
|
|
||||||
|
|
||||||
let block1 = createBlock(\`<div><block-text-0/></div>\`);
|
let block1 = createBlock(\`<div><block-text-0/></div>\`);
|
||||||
|
|
||||||
return function xml_template_999_Comp(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
let txt1 = ctx['contextObj'].value;
|
let txt1 = ctx['contextObj'].value;
|
||||||
return block1([txt1]);
|
return block1([txt1]);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,11 +4,10 @@ exports[`app App supports env with getters/setters 1`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_999\\"
|
|
||||||
|
|
||||||
let block1 = createBlock(\`<div><block-text-0/> <block-text-1/></div>\`);
|
let block1 = createBlock(\`<div><block-text-0/> <block-text-1/></div>\`);
|
||||||
|
|
||||||
return function xml_template_999_SomeComponent(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
let txt1 = ctx['env'].someVal;
|
let txt1 = ctx['env'].someVal;
|
||||||
let txt2 = Object.keys(ctx['env'].services);
|
let txt2 = Object.keys(ctx['env'].services);
|
||||||
return block1([txt1, txt2]);
|
return block1([txt1, txt2]);
|
||||||
@@ -20,11 +19,10 @@ exports[`app app: clear scheduler tasks and destroy cancelled nodes immediately
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_1000\\"
|
|
||||||
const comp1 = app.createComponent(\`B\`, true, false, false, []);
|
const comp1 = app.createComponent(\`B\`, true, false, false, []);
|
||||||
|
|
||||||
return function xml_template_1000_A(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
let b2,b3;
|
let b2, b3;
|
||||||
b2 = text(\`A\`);
|
b2 = text(\`A\`);
|
||||||
if (ctx['state'].value) {
|
if (ctx['state'].value) {
|
||||||
b3 = comp1({}, key + \`__1\`, node, this, null);
|
b3 = comp1({}, key + \`__1\`, node, this, null);
|
||||||
@@ -34,13 +32,12 @@ exports[`app app: clear scheduler tasks and destroy cancelled nodes immediately
|
|||||||
}"
|
}"
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`app app: clear scheduler tasks and destroy cancelled nodes immediately on destroy 2`] = `
|
exports[`app app: clear scheduler tasks and destroy cancelled nodes immediately on destroy 3`] = `
|
||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_999\\"
|
|
||||||
|
|
||||||
return function xml_template_999_B(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
return text(\`B\`);
|
return text(\`B\`);
|
||||||
}
|
}
|
||||||
}"
|
}"
|
||||||
@@ -50,26 +47,37 @@ exports[`app can configure an app with props 1`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_999\\"
|
|
||||||
|
|
||||||
let block1 = createBlock(\`<div><block-text-0/></div>\`);
|
let block1 = createBlock(\`<div><block-text-0/></div>\`);
|
||||||
|
|
||||||
return function xml_template_999_SomeComponent(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
let txt1 = ctx['props'].value;
|
let txt1 = ctx['props'].value;
|
||||||
return block1([txt1]);
|
return block1([txt1]);
|
||||||
}
|
}
|
||||||
}"
|
}"
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
exports[`app can load templates from an object name-string 1`] = `
|
||||||
|
"function anonymous(app, bdom, helpers
|
||||||
|
) {
|
||||||
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
|
|
||||||
|
let block1 = createBlock(\`<div class=\\"hello\\">hello</div>\`);
|
||||||
|
|
||||||
|
return function template(ctx, node, key = \\"\\") {
|
||||||
|
return block1();
|
||||||
|
}
|
||||||
|
}"
|
||||||
|
`;
|
||||||
|
|
||||||
exports[`app can mount app in an iframe 1`] = `
|
exports[`app can mount app in an iframe 1`] = `
|
||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_999\\"
|
|
||||||
|
|
||||||
let block1 = createBlock(\`<div class=\\"my-div\\"/>\`);
|
let block1 = createBlock(\`<div class=\\"my-div\\"/>\`);
|
||||||
|
|
||||||
return function xml_template_999_SomeComponent(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
return block1();
|
return block1();
|
||||||
}
|
}
|
||||||
}"
|
}"
|
||||||
@@ -79,11 +87,10 @@ exports[`app destroy remove the widget from the DOM 1`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_999\\"
|
|
||||||
|
|
||||||
let block1 = createBlock(\`<div/>\`);
|
let block1 = createBlock(\`<div/>\`);
|
||||||
|
|
||||||
return function xml_template_999_SomeComponent(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
return block1();
|
return block1();
|
||||||
}
|
}
|
||||||
}"
|
}"
|
||||||
@@ -93,11 +100,10 @@ exports[`app warnIfNoStaticProps works as expected 1`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_999\\"
|
|
||||||
|
|
||||||
let block1 = createBlock(\`<div><block-text-0/></div>\`);
|
let block1 = createBlock(\`<div><block-text-0/></div>\`);
|
||||||
|
|
||||||
return function xml_template_999_Root(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
let txt1 = ctx['message'];
|
let txt1 = ctx['message'];
|
||||||
return block1([txt1]);
|
return block1([txt1]);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import {
|
|||||||
useLogLifecycle,
|
useLogLifecycle,
|
||||||
makeDeferred,
|
makeDeferred,
|
||||||
nextMicroTick,
|
nextMicroTick,
|
||||||
|
steps,
|
||||||
} from "../helpers";
|
} from "../helpers";
|
||||||
|
|
||||||
let fixture: HTMLElement;
|
let fixture: HTMLElement;
|
||||||
@@ -123,23 +124,64 @@ describe("app", () => {
|
|||||||
|
|
||||||
const app = new App(A);
|
const app = new App(A);
|
||||||
const comp = await app.mount(fixture);
|
const comp = await app.mount(fixture);
|
||||||
expect(["A:setup", "A:willStart", "A:willRender", "A:rendered", "A:mounted"]).toBeLogged();
|
expect(steps.splice(0)).toMatchInlineSnapshot(`
|
||||||
|
Array [
|
||||||
|
"A:setup",
|
||||||
|
"A:willStart",
|
||||||
|
"A:willRender",
|
||||||
|
"A:rendered",
|
||||||
|
"A:mounted",
|
||||||
|
]
|
||||||
|
`);
|
||||||
|
|
||||||
comp.state.value = true;
|
comp.state.value = true;
|
||||||
await nextTick();
|
await nextTick();
|
||||||
expect(["A:willRender", "B:setup", "B:willStart", "A:rendered"]).toBeLogged();
|
expect(steps.splice(0)).toMatchInlineSnapshot(`
|
||||||
|
Array [
|
||||||
|
"A:willRender",
|
||||||
|
"B:setup",
|
||||||
|
"B:willStart",
|
||||||
|
"A:rendered",
|
||||||
|
]
|
||||||
|
`);
|
||||||
|
|
||||||
// rerender to force the instantiation of a new B component (and cancelling the first)
|
// rerender to force the instantiation of a new B component (and cancelling the first)
|
||||||
comp.render();
|
comp.render();
|
||||||
await nextMicroTick();
|
await nextMicroTick();
|
||||||
expect(["A:willRender", "B:setup", "B:willStart", "A:rendered"]).toBeLogged();
|
expect(steps.splice(0)).toMatchInlineSnapshot(`
|
||||||
|
Array [
|
||||||
|
"A:willRender",
|
||||||
|
"B:setup",
|
||||||
|
"B:willStart",
|
||||||
|
"A:rendered",
|
||||||
|
]
|
||||||
|
`);
|
||||||
|
|
||||||
app.destroy();
|
app.destroy();
|
||||||
expect([
|
expect(steps.splice(0)).toMatchInlineSnapshot(`
|
||||||
"A:willUnmount",
|
Array [
|
||||||
"B:willDestroy",
|
"A:willUnmount",
|
||||||
"A:willDestroy",
|
"B:willDestroy",
|
||||||
"B:willDestroy", // make sure the 2 B instances have been destroyed synchronously
|
"A:willDestroy",
|
||||||
]).toBeLogged();
|
"B:willDestroy",
|
||||||
|
]
|
||||||
|
`);
|
||||||
|
});
|
||||||
|
|
||||||
|
test("can load templates from an object name-string", async () => {
|
||||||
|
const templates = {
|
||||||
|
hello: `<div class="hello">hello</div>`,
|
||||||
|
world: `<div>world</div>`,
|
||||||
|
};
|
||||||
|
class SomeComponent extends Component {
|
||||||
|
static template = "hello";
|
||||||
|
}
|
||||||
|
|
||||||
|
const app = new App(SomeComponent, { templates });
|
||||||
|
await app.mount(fixture);
|
||||||
|
expect(fixture.querySelector(".hello")).toBeDefined();
|
||||||
|
// Only the "hello" template is used, so the "world" template is not yet loaded
|
||||||
|
expect(Object.keys(app.templates)).toEqual(["hello"]);
|
||||||
|
expect(Object.keys(app.rawTemplates)).toEqual(["hello", "world"]);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -244,12 +244,14 @@ describe("misc", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test("namespace is not propagated to siblings", () => {
|
test("namespace is not propagated to siblings", () => {
|
||||||
const block = createBlock(`<div><svg block-ns="someNameSpace"><g/></svg><div></div></div>`);
|
const block = createBlock(`<div><svg xmlns="someNameSpace"><g/></svg><div></div></div>`);
|
||||||
|
|
||||||
const fixture = makeTestFixture();
|
const fixture = makeTestFixture();
|
||||||
mount(block(), fixture);
|
mount(block(), fixture);
|
||||||
|
|
||||||
expect(fixture.innerHTML).toBe("<div><svg><g></g></svg><div></div></div>");
|
expect(fixture.innerHTML).toBe(
|
||||||
|
'<div><svg xmlns="someNameSpace"><g></g></svg><div></div></div>'
|
||||||
|
);
|
||||||
expect(fixture.querySelector("svg")!.namespaceURI).toBe("someNameSpace");
|
expect(fixture.querySelector("svg")!.namespaceURI).toBe("someNameSpace");
|
||||||
expect(fixture.querySelector("g")!.namespaceURI).toBe("someNameSpace");
|
expect(fixture.querySelector("g")!.namespaceURI).toBe("someNameSpace");
|
||||||
const allDivs = fixture.querySelectorAll("div");
|
const allDivs = fixture.querySelectorAll("div");
|
||||||
|
|||||||
@@ -30,22 +30,22 @@ describe("namespace", () => {
|
|||||||
expect(fixture.firstElementChild!.namespaceURI).toBe(XHTML_URI);
|
expect(fixture.firstElementChild!.namespaceURI).toBe(XHTML_URI);
|
||||||
});
|
});
|
||||||
|
|
||||||
test("namespace can be changed with block-ns", () => {
|
test("namespace can be changed with xmlns", () => {
|
||||||
const block = createBlock(`<tag block-ns="${SVG_URI}"/>`);
|
const block = createBlock(`<tag xmlns="${SVG_URI}"/>`);
|
||||||
const tree = block();
|
const tree = block();
|
||||||
mount(tree, fixture);
|
mount(tree, fixture);
|
||||||
expect(fixture.innerHTML).toBe("<tag></tag>");
|
expect(fixture.innerHTML).toBe(`<tag xmlns="${SVG_URI}"></tag>`);
|
||||||
expect(fixture.firstElementChild!.namespaceURI).toBe(SVG_URI);
|
expect(fixture.firstElementChild!.namespaceURI).toBe(SVG_URI);
|
||||||
});
|
});
|
||||||
|
|
||||||
test("namespace is kept for children", () => {
|
test("namespace is kept for children", () => {
|
||||||
const block = createBlock(
|
const block = createBlock(
|
||||||
`<parent block-ns="${SVG_URI}"><child><subchild/></child><child/></parent>`
|
`<parent xmlns="${SVG_URI}"><child><subchild/></child><child/></parent>`
|
||||||
);
|
);
|
||||||
const tree = block();
|
const tree = block();
|
||||||
mount(tree, fixture);
|
mount(tree, fixture);
|
||||||
expect(fixture.innerHTML).toBe(
|
expect(fixture.innerHTML).toBe(
|
||||||
"<parent><child><subchild></subchild></child><child></child></parent>"
|
`<parent xmlns="${SVG_URI}"><child><subchild></subchild></child><child></child></parent>`
|
||||||
);
|
);
|
||||||
const parent = fixture.firstElementChild!;
|
const parent = fixture.firstElementChild!;
|
||||||
const child1 = parent.firstElementChild!;
|
const child1 = parent.firstElementChild!;
|
||||||
@@ -58,10 +58,10 @@ describe("namespace", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test("various namespaces in same block", () => {
|
test("various namespaces in same block", () => {
|
||||||
const block = createBlock(`<none><one block-ns="one"/><two block-ns="two"/></none>`);
|
const block = createBlock(`<none><one xmlns="one"/><two xmlns="two"/></none>`);
|
||||||
const tree = block();
|
const tree = block();
|
||||||
mount(tree, fixture);
|
mount(tree, fixture);
|
||||||
expect(fixture.innerHTML).toBe("<none><one></one><two></two></none>");
|
expect(fixture.innerHTML).toBe('<none><one xmlns="one"></one><two xmlns="two"></two></none>');
|
||||||
const none = fixture.firstElementChild!;
|
const none = fixture.firstElementChild!;
|
||||||
const one = none.firstElementChild!;
|
const one = none.firstElementChild!;
|
||||||
const two = one.nextElementSibling!;
|
const two = one.nextElementSibling!;
|
||||||
|
|||||||
@@ -1,5 +1,38 @@
|
|||||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||||
|
|
||||||
|
exports[`comments comment node with backslash at top level 1`] = `
|
||||||
|
"function anonymous(app, bdom, helpers
|
||||||
|
) {
|
||||||
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
|
|
||||||
|
return function template(ctx, node, key = \\"\\") {
|
||||||
|
return comment(\` \\\\\\\\ \`);
|
||||||
|
}
|
||||||
|
}"
|
||||||
|
`;
|
||||||
|
|
||||||
|
exports[`comments comment node with backtick at top-level 1`] = `
|
||||||
|
"function anonymous(app, bdom, helpers
|
||||||
|
) {
|
||||||
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
|
|
||||||
|
return function template(ctx, node, key = \\"\\") {
|
||||||
|
return comment(\` \\\\\` \`);
|
||||||
|
}
|
||||||
|
}"
|
||||||
|
`;
|
||||||
|
|
||||||
|
exports[`comments comment node with interpolation sigil at top level 1`] = `
|
||||||
|
"function anonymous(app, bdom, helpers
|
||||||
|
) {
|
||||||
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
|
|
||||||
|
return function template(ctx, node, key = \\"\\") {
|
||||||
|
return comment(\` \\\\\${very cool} \`);
|
||||||
|
}
|
||||||
|
}"
|
||||||
|
`;
|
||||||
|
|
||||||
exports[`comments only a comment 1`] = `
|
exports[`comments only a comment 1`] = `
|
||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
@@ -34,7 +67,7 @@ exports[`comments properly handle comments between t-if/t-else 1`] = `
|
|||||||
let block3 = createBlock(\`<span>owl</span>\`);
|
let block3 = createBlock(\`<span>owl</span>\`);
|
||||||
|
|
||||||
return function template(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
let b2,b3;
|
let b2, b3;
|
||||||
if (true) {
|
if (true) {
|
||||||
b2 = block2();
|
b2 = block2();
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ exports[`t-on can bind handlers with empty object (with non empty inner string)
|
|||||||
ctx = Object.create(ctx);
|
ctx = Object.create(ctx);
|
||||||
const [k_block2, v_block2, l_block2, c_block2] = prepareList(['someval']);;
|
const [k_block2, v_block2, l_block2, c_block2] = prepareList(['someval']);;
|
||||||
for (let i1 = 0; i1 < l_block2; i1++) {
|
for (let i1 = 0; i1 < l_block2; i1++) {
|
||||||
ctx[\`action\`] = v_block2[i1];
|
ctx[\`action\`] = k_block2[i1];
|
||||||
ctx[\`action_index\`] = i1;
|
ctx[\`action_index\`] = i1;
|
||||||
const key1 = ctx['action_index'];
|
const key1 = ctx['action_index'];
|
||||||
const v1 = ctx['activate'];
|
const v1 = ctx['activate'];
|
||||||
@@ -142,7 +142,7 @@ exports[`t-on handler is bound to proper owner, part 2 1`] = `
|
|||||||
ctx = Object.create(ctx);
|
ctx = Object.create(ctx);
|
||||||
const [k_block1, v_block1, l_block1, c_block1] = prepareList([1]);;
|
const [k_block1, v_block1, l_block1, c_block1] = prepareList([1]);;
|
||||||
for (let i1 = 0; i1 < l_block1; i1++) {
|
for (let i1 = 0; i1 < l_block1; i1++) {
|
||||||
ctx[\`value\`] = v_block1[i1];
|
ctx[\`value\`] = k_block1[i1];
|
||||||
const key1 = ctx['value'];
|
const key1 = ctx['value'];
|
||||||
let hdlr1 = [ctx['add'], ctx];
|
let hdlr1 = [ctx['add'], ctx];
|
||||||
c_block1[i1] = withKey(block2([hdlr1]), key1);
|
c_block1[i1] = withKey(block2([hdlr1]), key1);
|
||||||
@@ -156,10 +156,9 @@ exports[`t-on handler is bound to proper owner, part 3 1`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"main\\"
|
|
||||||
const callTemplate_1 = app.getTemplate(\`sub\`);
|
const callTemplate_1 = app.getTemplate(\`sub\`);
|
||||||
|
|
||||||
return function main(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
return callTemplate_1.call(this, ctx, node, key + \`__1\`);
|
return callTemplate_1.call(this, ctx, node, key + \`__1\`);
|
||||||
}
|
}
|
||||||
}"
|
}"
|
||||||
@@ -169,11 +168,10 @@ exports[`t-on handler is bound to proper owner, part 3 2`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"sub\\"
|
|
||||||
|
|
||||||
let block1 = createBlock(\`<button block-handler-0=\\"click\\">Click</button>\`);
|
let block1 = createBlock(\`<button block-handler-0=\\"click\\">Click</button>\`);
|
||||||
|
|
||||||
return function sub(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
let hdlr1 = [ctx['add'], ctx];
|
let hdlr1 = [ctx['add'], ctx];
|
||||||
return block1([hdlr1]);
|
return block1([hdlr1]);
|
||||||
}
|
}
|
||||||
@@ -185,18 +183,17 @@ exports[`t-on handler is bound to proper owner, part 4 1`] = `
|
|||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
let { prepareList, withKey } = helpers;
|
let { prepareList, withKey } = helpers;
|
||||||
// Template name: \\"main\\"
|
|
||||||
const callTemplate_1 = app.getTemplate(\`sub\`);
|
const callTemplate_1 = app.getTemplate(\`sub\`);
|
||||||
|
|
||||||
return function main(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
ctx = Object.create(ctx);
|
ctx = Object.create(ctx);
|
||||||
const [k_block1, v_block1, l_block1, c_block1] = prepareList([1]);;
|
const [k_block1, v_block1, l_block1, c_block1] = prepareList([1]);;
|
||||||
for (let i1 = 0; i1 < l_block1; i1++) {
|
for (let i1 = 0; i1 < l_block1; i1++) {
|
||||||
ctx[\`value\`] = v_block1[i1];
|
ctx[\`value\`] = k_block1[i1];
|
||||||
ctx[\`value_first\`] = i1 === 0;
|
ctx[\`value_first\`] = i1 === 0;
|
||||||
ctx[\`value_last\`] = i1 === v_block1.length - 1;
|
ctx[\`value_last\`] = i1 === k_block1.length - 1;
|
||||||
ctx[\`value_index\`] = i1;
|
ctx[\`value_index\`] = i1;
|
||||||
ctx[\`value_value\`] = k_block1[i1];
|
ctx[\`value_value\`] = v_block1[i1];
|
||||||
const key1 = ctx['value'];
|
const key1 = ctx['value'];
|
||||||
c_block1[i1] = withKey(callTemplate_1.call(this, ctx, node, key + \`__1__\${key1}\`), key1);
|
c_block1[i1] = withKey(callTemplate_1.call(this, ctx, node, key + \`__1__\${key1}\`), key1);
|
||||||
}
|
}
|
||||||
@@ -209,11 +206,10 @@ exports[`t-on handler is bound to proper owner, part 4 2`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"sub\\"
|
|
||||||
|
|
||||||
let block1 = createBlock(\`<button block-handler-0=\\"click\\">Click</button>\`);
|
let block1 = createBlock(\`<button block-handler-0=\\"click\\">Click</button>\`);
|
||||||
|
|
||||||
return function sub(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
let hdlr1 = [ctx['add'], ctx];
|
let hdlr1 = [ctx['add'], ctx];
|
||||||
return block1([hdlr1]);
|
return block1([hdlr1]);
|
||||||
}
|
}
|
||||||
@@ -352,7 +348,7 @@ exports[`t-on t-on modifiers (native listener) t-on with prevent modifier in t-f
|
|||||||
ctx = Object.create(ctx);
|
ctx = Object.create(ctx);
|
||||||
const [k_block2, v_block2, l_block2, c_block2] = prepareList(ctx['projects']);;
|
const [k_block2, v_block2, l_block2, c_block2] = prepareList(ctx['projects']);;
|
||||||
for (let i1 = 0; i1 < l_block2; i1++) {
|
for (let i1 = 0; i1 < l_block2; i1++) {
|
||||||
ctx[\`project\`] = v_block2[i1];
|
ctx[\`project\`] = k_block2[i1];
|
||||||
const key1 = ctx['project'];
|
const key1 = ctx['project'];
|
||||||
const v1 = ctx['onEdit'];
|
const v1 = ctx['onEdit'];
|
||||||
const v2 = ctx['project'];
|
const v2 = ctx['project'];
|
||||||
@@ -475,12 +471,11 @@ exports[`t-on t-on with t-call 1`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"main\\"
|
|
||||||
const callTemplate_1 = app.getTemplate(\`sub\`);
|
const callTemplate_1 = app.getTemplate(\`sub\`);
|
||||||
|
|
||||||
let block1 = createBlock(\`<div><block-child-0/></div>\`);
|
let block1 = createBlock(\`<div><block-child-0/></div>\`);
|
||||||
|
|
||||||
return function main(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
const b2 = callTemplate_1.call(this, ctx, node, key + \`__1\`);
|
const b2 = callTemplate_1.call(this, ctx, node, key + \`__1\`);
|
||||||
return block1([], [b2]);
|
return block1([], [b2]);
|
||||||
}
|
}
|
||||||
@@ -491,11 +486,10 @@ exports[`t-on t-on with t-call 2`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"sub\\"
|
|
||||||
|
|
||||||
let block1 = createBlock(\`<p block-handler-0=\\"click\\">lucas</p>\`);
|
let block1 = createBlock(\`<p block-handler-0=\\"click\\">lucas</p>\`);
|
||||||
|
|
||||||
return function sub(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
let hdlr1 = [ctx['update'], ctx];
|
let hdlr1 = [ctx['update'], ctx];
|
||||||
return block1([hdlr1]);
|
return block1([hdlr1]);
|
||||||
}
|
}
|
||||||
@@ -506,12 +500,11 @@ exports[`t-on t-on, with arguments and t-call 1`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"main\\"
|
|
||||||
const callTemplate_1 = app.getTemplate(\`sub\`);
|
const callTemplate_1 = app.getTemplate(\`sub\`);
|
||||||
|
|
||||||
let block1 = createBlock(\`<div><block-child-0/></div>\`);
|
let block1 = createBlock(\`<div><block-child-0/></div>\`);
|
||||||
|
|
||||||
return function main(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
const b2 = callTemplate_1.call(this, ctx, node, key + \`__1\`);
|
const b2 = callTemplate_1.call(this, ctx, node, key + \`__1\`);
|
||||||
return block1([], [b2]);
|
return block1([], [b2]);
|
||||||
}
|
}
|
||||||
@@ -522,11 +515,10 @@ exports[`t-on t-on, with arguments and t-call 2`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"sub\\"
|
|
||||||
|
|
||||||
let block1 = createBlock(\`<p block-handler-0=\\"click\\">lucas</p>\`);
|
let block1 = createBlock(\`<p block-handler-0=\\"click\\">lucas</p>\`);
|
||||||
|
|
||||||
return function sub(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
const v1 = ctx['this'];
|
const v1 = ctx['this'];
|
||||||
const v2 = ctx['value'];
|
const v2 = ctx['value'];
|
||||||
let hdlr1 = [()=>v1.update(v2), ctx];
|
let hdlr1 = [()=>v1.update(v2), ctx];
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ exports[`misc complex template 1`] = `
|
|||||||
let block13 = createBlock(\`<i class=\\"fa fa-fw fa-clock-o\\" title=\\"This commit is the head of a base branch\\"/>\`);
|
let block13 = createBlock(\`<i class=\\"fa fa-fw fa-clock-o\\" title=\\"This commit is the head of a base branch\\"/>\`);
|
||||||
|
|
||||||
return function template(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
let b2,b3,b4,b6,b8;
|
let b2, b3, b4, b6, b8;
|
||||||
let attr1 = \`batch_tile \${ctx['options'].more?'more':'nomore'}\`;
|
let attr1 = \`batch_tile \${ctx['options'].more?'more':'nomore'}\`;
|
||||||
let attr2 = \`card bg-\${ctx['klass']}-light\`;
|
let attr2 = \`card bg-\${ctx['klass']}-light\`;
|
||||||
let attr3 = \`/runbot/batch/\${ctx['batch'].id}\`;
|
let attr3 = \`/runbot/batch/\${ctx['batch'].id}\`;
|
||||||
@@ -33,7 +33,7 @@ exports[`misc complex template 1`] = `
|
|||||||
ctx = Object.create(ctx);
|
ctx = Object.create(ctx);
|
||||||
const [k_block4, v_block4, l_block4, c_block4] = prepareList(ctx['batch'].slot_ids.filter(_slot=>_slot.build_id.id&&!_slot.trigger_id.manual&&(ctx['options'].trigger_display[_slot.trigger_id.id])));;
|
const [k_block4, v_block4, l_block4, c_block4] = prepareList(ctx['batch'].slot_ids.filter(_slot=>_slot.build_id.id&&!_slot.trigger_id.manual&&(ctx['options'].trigger_display[_slot.trigger_id.id])));;
|
||||||
for (let i1 = 0; i1 < l_block4; i1++) {
|
for (let i1 = 0; i1 < l_block4; i1++) {
|
||||||
ctx[\`slot\`] = v_block4[i1];
|
ctx[\`slot\`] = k_block4[i1];
|
||||||
const key1 = ctx['slot'].id;
|
const key1 = ctx['slot'].id;
|
||||||
c_block4[i1] = withKey(comp1({class: ctx['slot_container'],slot: ctx['slot']}, key + \`__1__\${key1}\`, node, this, null), key1);
|
c_block4[i1] = withKey(comp1({class: ctx['slot_container'],slot: ctx['slot']}, key + \`__1__\${key1}\`, node, this, null), key1);
|
||||||
}
|
}
|
||||||
@@ -42,7 +42,7 @@ exports[`misc complex template 1`] = `
|
|||||||
ctx = Object.create(ctx);
|
ctx = Object.create(ctx);
|
||||||
const [k_block6, v_block6, l_block6, c_block6] = prepareList([1,2,3,4]);;
|
const [k_block6, v_block6, l_block6, c_block6] = prepareList([1,2,3,4]);;
|
||||||
for (let i1 = 0; i1 < l_block6; i1++) {
|
for (let i1 = 0; i1 < l_block6; i1++) {
|
||||||
ctx[\`x\`] = v_block6[i1];
|
ctx[\`x\`] = k_block6[i1];
|
||||||
const key1 = ctx['x'];
|
const key1 = ctx['x'];
|
||||||
c_block6[i1] = withKey(block7(), key1);
|
c_block6[i1] = withKey(block7(), key1);
|
||||||
}
|
}
|
||||||
@@ -51,9 +51,9 @@ exports[`misc complex template 1`] = `
|
|||||||
ctx = Object.create(ctx);
|
ctx = Object.create(ctx);
|
||||||
const [k_block8, v_block8, l_block8, c_block8] = prepareList(ctx['commit_links']);;
|
const [k_block8, v_block8, l_block8, c_block8] = prepareList(ctx['commit_links']);;
|
||||||
for (let i1 = 0; i1 < l_block8; i1++) {
|
for (let i1 = 0; i1 < l_block8; i1++) {
|
||||||
ctx[\`commit_link\`] = v_block8[i1];
|
ctx[\`commit_link\`] = k_block8[i1];
|
||||||
const key1 = ctx['commit_link'].id;
|
const key1 = ctx['commit_link'].id;
|
||||||
let b10,b11,b12,b13;
|
let b10, b11, b12, b13;
|
||||||
let attr5 = \`/runbot/commit/\${ctx['commit_link'].commit_id}\`;
|
let attr5 = \`/runbot/commit/\${ctx['commit_link'].commit_id}\`;
|
||||||
let attr6 = \`badge badge-light batch_commit match_type_\${ctx['commit_link'].match_type}\`;
|
let attr6 = \`badge badge-light batch_commit match_type_\${ctx['commit_link'].match_type}\`;
|
||||||
if (ctx['commit_link'].match_type=='new') {
|
if (ctx['commit_link'].match_type=='new') {
|
||||||
@@ -84,7 +84,6 @@ exports[`misc global 1`] = `
|
|||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
let { prepareList, isBoundary, withDefault, setContextValue, zero, withKey } = helpers;
|
let { prepareList, isBoundary, withDefault, setContextValue, zero, withKey } = helpers;
|
||||||
// Template name: \\"caller\\"
|
|
||||||
const callTemplate_1 = app.getTemplate(\`_callee-uses-foo\`);
|
const callTemplate_1 = app.getTemplate(\`_callee-uses-foo\`);
|
||||||
const callTemplate_2 = app.getTemplate(\`_callee-uses-foo\`);
|
const callTemplate_2 = app.getTemplate(\`_callee-uses-foo\`);
|
||||||
const callTemplate_3 = app.getTemplate(\`_callee-uses-foo\`);
|
const callTemplate_3 = app.getTemplate(\`_callee-uses-foo\`);
|
||||||
@@ -94,17 +93,17 @@ exports[`misc global 1`] = `
|
|||||||
let block1 = createBlock(\`<div><block-child-0/><block-child-1/></div>\`);
|
let block1 = createBlock(\`<div><block-child-0/><block-child-1/></div>\`);
|
||||||
let block4 = createBlock(\`<span><block-text-0/></span>\`);
|
let block4 = createBlock(\`<span><block-text-0/></span>\`);
|
||||||
|
|
||||||
return function caller(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
ctx = Object.create(ctx);
|
ctx = Object.create(ctx);
|
||||||
ctx[isBoundary] = 1
|
ctx[isBoundary] = 1
|
||||||
ctx = Object.create(ctx);
|
ctx = Object.create(ctx);
|
||||||
const [k_block2, v_block2, l_block2, c_block2] = prepareList([4,5,6]);;
|
const [k_block2, v_block2, l_block2, c_block2] = prepareList([4,5,6]);;
|
||||||
for (let i1 = 0; i1 < l_block2; i1++) {
|
for (let i1 = 0; i1 < l_block2; i1++) {
|
||||||
ctx[\`value\`] = v_block2[i1];
|
ctx[\`value\`] = k_block2[i1];
|
||||||
ctx[\`value_first\`] = i1 === 0;
|
ctx[\`value_first\`] = i1 === 0;
|
||||||
ctx[\`value_last\`] = i1 === v_block2.length - 1;
|
ctx[\`value_last\`] = i1 === k_block2.length - 1;
|
||||||
ctx[\`value_index\`] = i1;
|
ctx[\`value_index\`] = i1;
|
||||||
ctx[\`value_value\`] = k_block2[i1];
|
ctx[\`value_value\`] = v_block2[i1];
|
||||||
const key1 = ctx['value'];
|
const key1 = ctx['value'];
|
||||||
let txt1 = ctx['value'];
|
let txt1 = ctx['value'];
|
||||||
const b4 = block4([txt1]);
|
const b4 = block4([txt1]);
|
||||||
@@ -113,16 +112,16 @@ exports[`misc global 1`] = `
|
|||||||
ctx = Object.create(ctx);
|
ctx = Object.create(ctx);
|
||||||
ctx[isBoundary] = 1;
|
ctx[isBoundary] = 1;
|
||||||
setContextValue(ctx, \\"foo\\", 'aaa');
|
setContextValue(ctx, \\"foo\\", 'aaa');
|
||||||
const b6 = callTemplate_1.call(this, ctx, node, key + \`__1__\${key1}\`);
|
const b7 = callTemplate_1.call(this, ctx, node, key + \`__1__\${key1}\`);
|
||||||
ctx = ctx.__proto__;
|
ctx = ctx.__proto__;
|
||||||
const b7 = callTemplate_2.call(this, ctx, node, key + \`__2__\${key1}\`);
|
const b8 = callTemplate_2.call(this, ctx, node, key + \`__2__\${key1}\`);
|
||||||
setContextValue(ctx, \\"foo\\", 'bbb');
|
setContextValue(ctx, \\"foo\\", 'bbb');
|
||||||
const b8 = callTemplate_3.call(this, ctx, node, key + \`__3__\${key1}\`);
|
const b9 = callTemplate_3.call(this, ctx, node, key + \`__3__\${key1}\`);
|
||||||
const b5 = multi([b6, b7, b8]);
|
const b6 = multi([b7, b8, b9]);
|
||||||
ctx[zero] = b5;
|
ctx[zero] = b6;
|
||||||
const b9 = callTemplate_4.call(this, ctx, node, key + \`__4__\${key1}\`);
|
const b5 = callTemplate_4.call(this, ctx, node, key + \`__4__\${key1}\`);
|
||||||
ctx = ctx.__proto__;
|
ctx = ctx.__proto__;
|
||||||
c_block2[i1] = withKey(multi([b4, b9]), key1);
|
c_block2[i1] = withKey(multi([b4, b5]), key1);
|
||||||
}
|
}
|
||||||
ctx = ctx.__proto__;
|
ctx = ctx.__proto__;
|
||||||
const b2 = list(c_block2);
|
const b2 = list(c_block2);
|
||||||
@@ -137,11 +136,10 @@ exports[`misc global 2`] = `
|
|||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
let { withDefault } = helpers;
|
let { withDefault } = helpers;
|
||||||
// Template name: \\"_callee-uses-foo\\"
|
|
||||||
|
|
||||||
let block1 = createBlock(\`<span><block-text-0/></span>\`);
|
let block1 = createBlock(\`<span><block-text-0/></span>\`);
|
||||||
|
|
||||||
return function _callee_uses_foo(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
let txt1 = withDefault(ctx['foo'], \`foo default\`);
|
let txt1 = withDefault(ctx['foo'], \`foo default\`);
|
||||||
return block1([txt1]);
|
return block1([txt1]);
|
||||||
}
|
}
|
||||||
@@ -153,11 +151,10 @@ exports[`misc global 3`] = `
|
|||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
let { zero } = helpers;
|
let { zero } = helpers;
|
||||||
// Template name: \\"_callee-asc\\"
|
|
||||||
|
|
||||||
let block1 = createBlock(\`<año block-attribute-0=\\"falló\\"><block-child-0/></año>\`);
|
let block1 = createBlock(\`<año block-attribute-0=\\"falló\\"><block-child-0/></año>\`);
|
||||||
|
|
||||||
return function _callee_asc(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
let attr1 = 'agüero';
|
let attr1 = 'agüero';
|
||||||
const b2 = ctx[zero];
|
const b2 = ctx[zero];
|
||||||
return block1([attr1], [b2]);
|
return block1([attr1], [b2]);
|
||||||
@@ -170,11 +167,10 @@ exports[`misc global 4`] = `
|
|||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
let { safeOutput } = helpers;
|
let { safeOutput } = helpers;
|
||||||
// Template name: \\"_callee-asc-toto\\"
|
|
||||||
|
|
||||||
let block1 = createBlock(\`<div><block-child-0/></div>\`);
|
let block1 = createBlock(\`<div><block-child-0/></div>\`);
|
||||||
|
|
||||||
return function _callee_asc_toto(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
const b3 = text(\`toto default\`);
|
const b3 = text(\`toto default\`);
|
||||||
const b2 = safeOutput(ctx['toto'], b3);
|
const b2 = safeOutput(ctx['toto'], b3);
|
||||||
return block1([], [b2]);
|
return block1([], [b2]);
|
||||||
@@ -221,13 +217,13 @@ exports[`misc other complex template 1`] = `
|
|||||||
let block25 = createBlock(\`<div><block-child-0/><block-child-1/></div>\`);
|
let block25 = createBlock(\`<div><block-child-0/><block-child-1/></div>\`);
|
||||||
|
|
||||||
return function template(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
let b2,b4,b14,b17,b22,b23,b24,b25;
|
let b2, b4, b14, b17, b22, b23, b24, b25;
|
||||||
let attr1 = \`/runbot/\${ctx['project'].slug}\`;
|
let attr1 = \`/runbot/\${ctx['project'].slug}\`;
|
||||||
let txt1 = ctx['project'].name;
|
let txt1 = ctx['project'].name;
|
||||||
ctx = Object.create(ctx);
|
ctx = Object.create(ctx);
|
||||||
const [k_block2, v_block2, l_block2, c_block2] = prepareList(ctx['projects']);;
|
const [k_block2, v_block2, l_block2, c_block2] = prepareList(ctx['projects']);;
|
||||||
for (let i1 = 0; i1 < l_block2; i1++) {
|
for (let i1 = 0; i1 < l_block2; i1++) {
|
||||||
ctx[\`project\`] = v_block2[i1];
|
ctx[\`project\`] = k_block2[i1];
|
||||||
const key1 = ctx['project'].id;
|
const key1 = ctx['project'].id;
|
||||||
let hdlr1 = [ctx['selectProject'](ctx['project']), ctx];
|
let hdlr1 = [ctx['selectProject'](ctx['project']), ctx];
|
||||||
let txt2 = ctx['project'].name;
|
let txt2 = ctx['project'].name;
|
||||||
@@ -236,12 +232,12 @@ exports[`misc other complex template 1`] = `
|
|||||||
ctx = ctx.__proto__;
|
ctx = ctx.__proto__;
|
||||||
b2 = list(c_block2);
|
b2 = list(c_block2);
|
||||||
if (ctx['user']) {
|
if (ctx['user']) {
|
||||||
let b5,b6;
|
let b5, b6;
|
||||||
if (ctx['user'].public) {
|
if (ctx['user'].public) {
|
||||||
let attr2 = \`/web/login?redirect=/\`;
|
let attr2 = \`/web/login?redirect=/\`;
|
||||||
b5 = block5([attr2]);
|
b5 = block5([attr2]);
|
||||||
} else {
|
} else {
|
||||||
let b7,b10,b13;
|
let b7, b10, b13;
|
||||||
if (ctx['nb_assigned_errors']&&ctx['nb_assigned_errors']>0) {
|
if (ctx['nb_assigned_errors']&&ctx['nb_assigned_errors']>0) {
|
||||||
let attr3 = \`You have \${ctx['nb_assigned_errors']} random bug assigned\`;
|
let attr3 = \`You have \${ctx['nb_assigned_errors']} random bug assigned\`;
|
||||||
let txt3 = ctx['nb_assigned_errors'];
|
let txt3 = ctx['nb_assigned_errors'];
|
||||||
@@ -267,7 +263,7 @@ exports[`misc other complex template 1`] = `
|
|||||||
ctx = Object.create(ctx);
|
ctx = Object.create(ctx);
|
||||||
const [k_block15, v_block15, l_block15, c_block15] = prepareList(ctx['categories']);;
|
const [k_block15, v_block15, l_block15, c_block15] = prepareList(ctx['categories']);;
|
||||||
for (let i1 = 0; i1 < l_block15; i1++) {
|
for (let i1 = 0; i1 < l_block15; i1++) {
|
||||||
ctx[\`category\`] = v_block15[i1];
|
ctx[\`category\`] = k_block15[i1];
|
||||||
const key1 = ctx['category'].id;
|
const key1 = ctx['category'].id;
|
||||||
let attr6 = ctx['category'].id;
|
let attr6 = ctx['category'].id;
|
||||||
let prop1 = new Boolean(ctx['category'].id==ctx['options'].active_category_id);
|
let prop1 = new Boolean(ctx['category'].id==ctx['options'].active_category_id);
|
||||||
@@ -288,7 +284,7 @@ exports[`misc other complex template 1`] = `
|
|||||||
ctx = Object.create(ctx);
|
ctx = Object.create(ctx);
|
||||||
const [k_block18, v_block18, l_block18, c_block18] = prepareList(ctx['triggers']);;
|
const [k_block18, v_block18, l_block18, c_block18] = prepareList(ctx['triggers']);;
|
||||||
for (let i1 = 0; i1 < l_block18; i1++) {
|
for (let i1 = 0; i1 < l_block18; i1++) {
|
||||||
ctx[\`trigger\`] = v_block18[i1];
|
ctx[\`trigger\`] = k_block18[i1];
|
||||||
const key1 = ctx['trigger'].id;
|
const key1 = ctx['trigger'].id;
|
||||||
let b20;
|
let b20;
|
||||||
if (!ctx['trigger'].manual&&ctx['trigger'].project_id===ctx['project'].id&&ctx['trigger'].category_id===ctx['options'].active_category_id) {
|
if (!ctx['trigger'].manual&&ctx['trigger'].project_id===ctx['project'].id&&ctx['trigger'].category_id===ctx['options'].active_category_id) {
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ exports[`memory t-foreach does not leak stuff in global scope 1`] = `
|
|||||||
ctx = Object.create(ctx);
|
ctx = Object.create(ctx);
|
||||||
const [k_block2, v_block2, l_block2, c_block2] = prepareList([3,2,1]);;
|
const [k_block2, v_block2, l_block2, c_block2] = prepareList([3,2,1]);;
|
||||||
for (let i1 = 0; i1 < l_block2; i1++) {
|
for (let i1 = 0; i1 < l_block2; i1++) {
|
||||||
ctx[\`item\`] = v_block2[i1];
|
ctx[\`item\`] = k_block2[i1];
|
||||||
ctx[\`item_index\`] = i1;
|
ctx[\`item_index\`] = i1;
|
||||||
const key1 = ctx['item_index'];
|
const key1 = ctx['item_index'];
|
||||||
c_block2[i1] = withKey(text(ctx['item']), key1);
|
c_block2[i1] = withKey(text(ctx['item']), key1);
|
||||||
|
|||||||
@@ -158,9 +158,8 @@ exports[`simple templates, mostly static empty string in a template set 1`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"potato\\"
|
|
||||||
|
|
||||||
return function potato(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
return text(\`\`);
|
return text(\`\`);
|
||||||
}
|
}
|
||||||
}"
|
}"
|
||||||
@@ -342,6 +341,39 @@ exports[`simple templates, mostly static template with t tag with multiple conte
|
|||||||
}"
|
}"
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
exports[`simple templates, mostly static text node with backslash at top level 1`] = `
|
||||||
|
"function anonymous(app, bdom, helpers
|
||||||
|
) {
|
||||||
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
|
|
||||||
|
return function template(ctx, node, key = \\"\\") {
|
||||||
|
return text(\`\\\\\\\\\`);
|
||||||
|
}
|
||||||
|
}"
|
||||||
|
`;
|
||||||
|
|
||||||
|
exports[`simple templates, mostly static text node with backtick at top-level 1`] = `
|
||||||
|
"function anonymous(app, bdom, helpers
|
||||||
|
) {
|
||||||
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
|
|
||||||
|
return function template(ctx, node, key = \\"\\") {
|
||||||
|
return text(\`\\\\\`\`);
|
||||||
|
}
|
||||||
|
}"
|
||||||
|
`;
|
||||||
|
|
||||||
|
exports[`simple templates, mostly static text node with interpolation sigil at top level 1`] = `
|
||||||
|
"function anonymous(app, bdom, helpers
|
||||||
|
) {
|
||||||
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
|
|
||||||
|
return function template(ctx, node, key = \\"\\") {
|
||||||
|
return text(\`\\\\\${very cool}\`);
|
||||||
|
}
|
||||||
|
}"
|
||||||
|
`;
|
||||||
|
|
||||||
exports[`simple templates, mostly static two t-escs next to each other 1`] = `
|
exports[`simple templates, mostly static two t-escs next to each other 1`] = `
|
||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ exports[`properly support svg add proper namespace to g tags 1`] = `
|
|||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
|
|
||||||
let block1 = createBlock(\`<g block-ns=\\"http://www.w3.org/2000/svg\\"><circle cx=\\"50\\" cy=\\"50\\" r=\\"4\\" stroke=\\"green\\" stroke-width=\\"1\\" fill=\\"yellow\\"/> </g>\`);
|
let block1 = createBlock(\`<g xmlns=\\"http://www.w3.org/2000/svg\\"><circle cx=\\"50\\" cy=\\"50\\" r=\\"4\\" stroke=\\"green\\" stroke-width=\\"1\\" fill=\\"yellow\\"/> </g>\`);
|
||||||
|
|
||||||
return function template(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
return block1();
|
return block1();
|
||||||
@@ -18,7 +18,7 @@ exports[`properly support svg add proper namespace to svg 1`] = `
|
|||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
|
|
||||||
let block1 = createBlock(\`<svg block-ns=\\"http://www.w3.org/2000/svg\\" width=\\"100px\\" height=\\"90px\\"><circle cx=\\"50\\" cy=\\"50\\" r=\\"4\\" stroke=\\"green\\" stroke-width=\\"1\\" fill=\\"yellow\\"/> </svg>\`);
|
let block1 = createBlock(\`<svg xmlns=\\"http://www.w3.org/2000/svg\\" width=\\"100px\\" height=\\"90px\\"><circle cx=\\"50\\" cy=\\"50\\" r=\\"4\\" stroke=\\"green\\" stroke-width=\\"1\\" fill=\\"yellow\\"/> </svg>\`);
|
||||||
|
|
||||||
return function template(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
return block1();
|
return block1();
|
||||||
@@ -31,7 +31,7 @@ exports[`properly support svg namespace to g tags not added if already in svg na
|
|||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
|
|
||||||
let block1 = createBlock(\`<svg block-ns=\\"http://www.w3.org/2000/svg\\"><g/></svg>\`);
|
let block1 = createBlock(\`<svg xmlns=\\"http://www.w3.org/2000/svg\\"><g/></svg>\`);
|
||||||
|
|
||||||
return function template(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
return block1();
|
return block1();
|
||||||
@@ -44,7 +44,7 @@ exports[`properly support svg namespace to svg tags added even if already in svg
|
|||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
|
|
||||||
let block1 = createBlock(\`<svg block-ns=\\"http://www.w3.org/2000/svg\\"><svg/></svg>\`);
|
let block1 = createBlock(\`<svg xmlns=\\"http://www.w3.org/2000/svg\\"><svg/></svg>\`);
|
||||||
|
|
||||||
return function template(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
return block1();
|
return block1();
|
||||||
@@ -56,13 +56,12 @@ exports[`properly support svg svg creates new block if it is within html -- 2 1`
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_999\\"
|
|
||||||
|
|
||||||
let block1 = createBlock(\`<div><block-child-0/></div>\`);
|
let block1 = createBlock(\`<div><block-child-0/></div>\`);
|
||||||
let block2 = createBlock(\`<svg block-ns=\\"http://www.w3.org/2000/svg\\"><polygon fill=\\"#000000\\" points=\\"0 0 4 4 8 0\\" transform=\\"translate(5 7)\\"/><block-child-0/></svg>\`);
|
let block2 = createBlock(\`<svg xmlns=\\"http://www.w3.org/2000/svg\\"><polygon fill=\\"#000000\\" points=\\"0 0 4 4 8 0\\" transform=\\"translate(5 7)\\"/><block-child-0 xmlns=\\"\\"/></svg>\`);
|
||||||
let block3 = createBlock(\`<path block-ns=\\"http://www.w3.org/2000/svg\\"/>\`);
|
let block3 = createBlock(\`<path xmlns=\\"http://www.w3.org/2000/svg\\"/>\`);
|
||||||
|
|
||||||
return function xml_template_999_Test(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
let b3;
|
let b3;
|
||||||
if (ctx['hasPath']) {
|
if (ctx['hasPath']) {
|
||||||
b3 = block3();
|
b3 = block3();
|
||||||
@@ -77,12 +76,11 @@ exports[`properly support svg svg creates new block if it is within html 1`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_999\\"
|
|
||||||
|
|
||||||
let block1 = createBlock(\`<div><block-child-0/></div>\`);
|
let block1 = createBlock(\`<div><block-child-0/></div>\`);
|
||||||
let block2 = createBlock(\`<svg block-ns=\\"http://www.w3.org/2000/svg\\"><polygon fill=\\"#000000\\" points=\\"0 0 4 4 8 0\\" transform=\\"translate(5 7)\\"/></svg>\`);
|
let block2 = createBlock(\`<svg xmlns=\\"http://www.w3.org/2000/svg\\"><polygon fill=\\"#000000\\" points=\\"0 0 4 4 8 0\\" transform=\\"translate(5 7)\\"/></svg>\`);
|
||||||
|
|
||||||
return function xml_template_999_Test(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
const b2 = block2();
|
const b2 = block2();
|
||||||
return block1([], [b2]);
|
return block1([], [b2]);
|
||||||
}
|
}
|
||||||
@@ -93,12 +91,11 @@ exports[`properly support svg svg namespace added to sub templates if root tag i
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"svg\\"
|
|
||||||
const callTemplate_1 = app.getTemplate(\`path\`);
|
const callTemplate_1 = app.getTemplate(\`path\`);
|
||||||
|
|
||||||
let block1 = createBlock(\`<svg block-ns=\\"http://www.w3.org/2000/svg\\"><block-child-0/></svg>\`);
|
let block1 = createBlock(\`<svg xmlns=\\"http://www.w3.org/2000/svg\\"><block-child-0 xmlns=\\"\\"/></svg>\`);
|
||||||
|
|
||||||
return function svg_Svg(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
const b2 = callTemplate_1.call(this, ctx, node, key + \`__1\`);
|
const b2 = callTemplate_1.call(this, ctx, node, key + \`__1\`);
|
||||||
return block1([], [b2]);
|
return block1([], [b2]);
|
||||||
}
|
}
|
||||||
@@ -109,11 +106,10 @@ exports[`properly support svg svg namespace added to sub templates if root tag i
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"path\\"
|
|
||||||
|
|
||||||
let block1 = createBlock(\`<path block-ns=\\"http://www.w3.org/2000/svg\\"/>\`);
|
let block1 = createBlock(\`<path xmlns=\\"http://www.w3.org/2000/svg\\"/>\`);
|
||||||
|
|
||||||
return function path(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
return block1();
|
return block1();
|
||||||
}
|
}
|
||||||
}"
|
}"
|
||||||
@@ -124,8 +120,8 @@ exports[`properly support svg svg namespace added to sub-blocks 1`] = `
|
|||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
|
|
||||||
let block1 = createBlock(\`<svg block-ns=\\"http://www.w3.org/2000/svg\\"><block-child-0/></svg>\`);
|
let block1 = createBlock(\`<svg xmlns=\\"http://www.w3.org/2000/svg\\"><block-child-0 xmlns=\\"\\"/></svg>\`);
|
||||||
let block2 = createBlock(\`<path block-ns=\\"http://www.w3.org/2000/svg\\"/>\`);
|
let block2 = createBlock(\`<path xmlns=\\"http://www.w3.org/2000/svg\\"/>\`);
|
||||||
|
|
||||||
return function template(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
let b2;
|
let b2;
|
||||||
|
|||||||
@@ -1,5 +1,41 @@
|
|||||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||||
|
|
||||||
|
exports[`t-esc default with backslash at top level 1`] = `
|
||||||
|
"function anonymous(app, bdom, helpers
|
||||||
|
) {
|
||||||
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
|
let { withDefault } = helpers;
|
||||||
|
|
||||||
|
return function template(ctx, node, key = \\"\\") {
|
||||||
|
return text(withDefault(undefined, \`\\\\\\\\\`));
|
||||||
|
}
|
||||||
|
}"
|
||||||
|
`;
|
||||||
|
|
||||||
|
exports[`t-esc default with backtick at top-level 1`] = `
|
||||||
|
"function anonymous(app, bdom, helpers
|
||||||
|
) {
|
||||||
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
|
let { withDefault } = helpers;
|
||||||
|
|
||||||
|
return function template(ctx, node, key = \\"\\") {
|
||||||
|
return text(withDefault(undefined, \`\\\\\`\`));
|
||||||
|
}
|
||||||
|
}"
|
||||||
|
`;
|
||||||
|
|
||||||
|
exports[`t-esc default with interpolation sigil at top level 1`] = `
|
||||||
|
"function anonymous(app, bdom, helpers
|
||||||
|
) {
|
||||||
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
|
let { withDefault } = helpers;
|
||||||
|
|
||||||
|
return function template(ctx, node, key = \\"\\") {
|
||||||
|
return text(withDefault(undefined, \`\\\\\${very cool}\`));
|
||||||
|
}
|
||||||
|
}"
|
||||||
|
`;
|
||||||
|
|
||||||
exports[`t-esc div with falsy values 1`] = `
|
exports[`t-esc div with falsy values 1`] = `
|
||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
@@ -177,19 +213,18 @@ exports[`t-esc t-esc=0 is escaped 1`] = `
|
|||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
let { isBoundary, zero } = helpers;
|
let { isBoundary, zero } = helpers;
|
||||||
// Template name: \\"main\\"
|
|
||||||
const callTemplate_1 = app.getTemplate(\`sub\`);
|
const callTemplate_1 = app.getTemplate(\`sub\`);
|
||||||
|
|
||||||
let block1 = createBlock(\`<div><block-child-0/></div>\`);
|
let block1 = createBlock(\`<div><block-child-0/></div>\`);
|
||||||
let block2 = createBlock(\`<p>escaped</p>\`);
|
let block3 = createBlock(\`<p>escaped</p>\`);
|
||||||
|
|
||||||
return function main(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
ctx = Object.create(ctx);
|
ctx = Object.create(ctx);
|
||||||
ctx[isBoundary] = 1;
|
ctx[isBoundary] = 1;
|
||||||
const b2 = block2();
|
const b3 = block3();
|
||||||
ctx[zero] = b2;
|
ctx[zero] = b3;
|
||||||
const b3 = callTemplate_1.call(this, ctx, node, key + \`__1\`);
|
const b2 = callTemplate_1.call(this, ctx, node, key + \`__1\`);
|
||||||
return block1([], [b3]);
|
return block1([], [b2]);
|
||||||
}
|
}
|
||||||
}"
|
}"
|
||||||
`;
|
`;
|
||||||
@@ -199,11 +234,10 @@ exports[`t-esc t-esc=0 is escaped 2`] = `
|
|||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
let { zero } = helpers;
|
let { zero } = helpers;
|
||||||
// Template name: \\"sub\\"
|
|
||||||
|
|
||||||
let block1 = createBlock(\`<span><block-text-0/></span>\`);
|
let block1 = createBlock(\`<span><block-text-0/></span>\`);
|
||||||
|
|
||||||
return function sub(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
let txt1 = ctx[zero];
|
let txt1 = ctx[zero];
|
||||||
return block1([txt1]);
|
return block1([txt1]);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ exports[`t-foreach does not pollute the rendering context 1`] = `
|
|||||||
ctx = Object.create(ctx);
|
ctx = Object.create(ctx);
|
||||||
const [k_block2, v_block2, l_block2, c_block2] = prepareList([1]);;
|
const [k_block2, v_block2, l_block2, c_block2] = prepareList([1]);;
|
||||||
for (let i1 = 0; i1 < l_block2; i1++) {
|
for (let i1 = 0; i1 < l_block2; i1++) {
|
||||||
ctx[\`item\`] = v_block2[i1];
|
ctx[\`item\`] = k_block2[i1];
|
||||||
const key1 = ctx['item'];
|
const key1 = ctx['item'];
|
||||||
c_block2[i1] = withKey(text(ctx['item']), key1);
|
c_block2[i1] = withKey(text(ctx['item']), key1);
|
||||||
}
|
}
|
||||||
@@ -35,7 +35,7 @@ exports[`t-foreach iterate on items (on a element node) 1`] = `
|
|||||||
ctx = Object.create(ctx);
|
ctx = Object.create(ctx);
|
||||||
const [k_block2, v_block2, l_block2, c_block2] = prepareList([1,2]);;
|
const [k_block2, v_block2, l_block2, c_block2] = prepareList([1,2]);;
|
||||||
for (let i1 = 0; i1 < l_block2; i1++) {
|
for (let i1 = 0; i1 < l_block2; i1++) {
|
||||||
ctx[\`item\`] = v_block2[i1];
|
ctx[\`item\`] = k_block2[i1];
|
||||||
const key1 = ctx['item'];
|
const key1 = ctx['item'];
|
||||||
let txt1 = ctx['item'];
|
let txt1 = ctx['item'];
|
||||||
c_block2[i1] = withKey(block3([txt1]), key1);
|
c_block2[i1] = withKey(block3([txt1]), key1);
|
||||||
@@ -58,9 +58,9 @@ exports[`t-foreach iterate on items 1`] = `
|
|||||||
ctx = Object.create(ctx);
|
ctx = Object.create(ctx);
|
||||||
const [k_block2, v_block2, l_block2, c_block2] = prepareList([3,2,1]);;
|
const [k_block2, v_block2, l_block2, c_block2] = prepareList([3,2,1]);;
|
||||||
for (let i1 = 0; i1 < l_block2; i1++) {
|
for (let i1 = 0; i1 < l_block2; i1++) {
|
||||||
ctx[\`item\`] = v_block2[i1];
|
ctx[\`item\`] = k_block2[i1];
|
||||||
ctx[\`item_index\`] = i1;
|
ctx[\`item_index\`] = i1;
|
||||||
ctx[\`item_value\`] = k_block2[i1];
|
ctx[\`item_value\`] = v_block2[i1];
|
||||||
const key1 = ctx['item'];
|
const key1 = ctx['item'];
|
||||||
const b4 = text(\` [\`);
|
const b4 = text(\` [\`);
|
||||||
const b5 = text(ctx['item_index']);
|
const b5 = text(ctx['item_index']);
|
||||||
@@ -87,9 +87,9 @@ exports[`t-foreach iterate, Map param 1`] = `
|
|||||||
ctx = Object.create(ctx);
|
ctx = Object.create(ctx);
|
||||||
const [k_block1, v_block1, l_block1, c_block1] = prepareList(ctx['value']);;
|
const [k_block1, v_block1, l_block1, c_block1] = prepareList(ctx['value']);;
|
||||||
for (let i1 = 0; i1 < l_block1; i1++) {
|
for (let i1 = 0; i1 < l_block1; i1++) {
|
||||||
ctx[\`item\`] = v_block1[i1];
|
ctx[\`item\`] = k_block1[i1];
|
||||||
ctx[\`item_index\`] = i1;
|
ctx[\`item_index\`] = i1;
|
||||||
ctx[\`item_value\`] = k_block1[i1];
|
ctx[\`item_value\`] = v_block1[i1];
|
||||||
const key1 = ctx['item_index'];
|
const key1 = ctx['item_index'];
|
||||||
const b3 = text(\` [\`);
|
const b3 = text(\` [\`);
|
||||||
const b4 = text(ctx['item_index']);
|
const b4 = text(ctx['item_index']);
|
||||||
@@ -115,9 +115,9 @@ exports[`t-foreach iterate, Set param 1`] = `
|
|||||||
ctx = Object.create(ctx);
|
ctx = Object.create(ctx);
|
||||||
const [k_block1, v_block1, l_block1, c_block1] = prepareList(ctx['value']);;
|
const [k_block1, v_block1, l_block1, c_block1] = prepareList(ctx['value']);;
|
||||||
for (let i1 = 0; i1 < l_block1; i1++) {
|
for (let i1 = 0; i1 < l_block1; i1++) {
|
||||||
ctx[\`item\`] = v_block1[i1];
|
ctx[\`item\`] = k_block1[i1];
|
||||||
ctx[\`item_index\`] = i1;
|
ctx[\`item_index\`] = i1;
|
||||||
ctx[\`item_value\`] = k_block1[i1];
|
ctx[\`item_value\`] = v_block1[i1];
|
||||||
const key1 = ctx['item_index'];
|
const key1 = ctx['item_index'];
|
||||||
const b3 = text(\` [\`);
|
const b3 = text(\` [\`);
|
||||||
const b4 = text(ctx['item_index']);
|
const b4 = text(ctx['item_index']);
|
||||||
@@ -145,9 +145,9 @@ exports[`t-foreach iterate, dict param 1`] = `
|
|||||||
ctx = Object.create(ctx);
|
ctx = Object.create(ctx);
|
||||||
const [k_block2, v_block2, l_block2, c_block2] = prepareList(ctx['value']);;
|
const [k_block2, v_block2, l_block2, c_block2] = prepareList(ctx['value']);;
|
||||||
for (let i1 = 0; i1 < l_block2; i1++) {
|
for (let i1 = 0; i1 < l_block2; i1++) {
|
||||||
ctx[\`item\`] = v_block2[i1];
|
ctx[\`item\`] = k_block2[i1];
|
||||||
ctx[\`item_index\`] = i1;
|
ctx[\`item_index\`] = i1;
|
||||||
ctx[\`item_value\`] = k_block2[i1];
|
ctx[\`item_value\`] = v_block2[i1];
|
||||||
const key1 = ctx['item_index'];
|
const key1 = ctx['item_index'];
|
||||||
const b4 = text(\` [\`);
|
const b4 = text(\` [\`);
|
||||||
const b5 = text(ctx['item_index']);
|
const b5 = text(ctx['item_index']);
|
||||||
@@ -174,9 +174,9 @@ exports[`t-foreach iterate, generator param 1`] = `
|
|||||||
ctx = Object.create(ctx);
|
ctx = Object.create(ctx);
|
||||||
const [k_block1, v_block1, l_block1, c_block1] = prepareList(ctx['gen']());;
|
const [k_block1, v_block1, l_block1, c_block1] = prepareList(ctx['gen']());;
|
||||||
for (let i1 = 0; i1 < l_block1; i1++) {
|
for (let i1 = 0; i1 < l_block1; i1++) {
|
||||||
ctx[\`item\`] = v_block1[i1];
|
ctx[\`item\`] = k_block1[i1];
|
||||||
ctx[\`item_index\`] = i1;
|
ctx[\`item_index\`] = i1;
|
||||||
ctx[\`item_value\`] = k_block1[i1];
|
ctx[\`item_value\`] = v_block1[i1];
|
||||||
const key1 = ctx['item_index'];
|
const key1 = ctx['item_index'];
|
||||||
const b3 = text(\` [\`);
|
const b3 = text(\` [\`);
|
||||||
const b4 = text(ctx['item_index']);
|
const b4 = text(ctx['item_index']);
|
||||||
@@ -202,9 +202,9 @@ exports[`t-foreach iterate, iterable param 1`] = `
|
|||||||
ctx = Object.create(ctx);
|
ctx = Object.create(ctx);
|
||||||
const [k_block1, v_block1, l_block1, c_block1] = prepareList(ctx['map'].values());;
|
const [k_block1, v_block1, l_block1, c_block1] = prepareList(ctx['map'].values());;
|
||||||
for (let i1 = 0; i1 < l_block1; i1++) {
|
for (let i1 = 0; i1 < l_block1; i1++) {
|
||||||
ctx[\`item\`] = v_block1[i1];
|
ctx[\`item\`] = k_block1[i1];
|
||||||
ctx[\`item_index\`] = i1;
|
ctx[\`item_index\`] = i1;
|
||||||
ctx[\`item_value\`] = k_block1[i1];
|
ctx[\`item_value\`] = v_block1[i1];
|
||||||
const key1 = ctx['item_index'];
|
const key1 = ctx['item_index'];
|
||||||
const b3 = text(\` [\`);
|
const b3 = text(\` [\`);
|
||||||
const b4 = text(ctx['item_index']);
|
const b4 = text(ctx['item_index']);
|
||||||
@@ -232,12 +232,12 @@ exports[`t-foreach iterate, position 1`] = `
|
|||||||
ctx = Object.create(ctx);
|
ctx = Object.create(ctx);
|
||||||
const [k_block2, v_block2, l_block2, c_block2] = prepareList(Array(5));;
|
const [k_block2, v_block2, l_block2, c_block2] = prepareList(Array(5));;
|
||||||
for (let i1 = 0; i1 < l_block2; i1++) {
|
for (let i1 = 0; i1 < l_block2; i1++) {
|
||||||
ctx[\`elem\`] = v_block2[i1];
|
ctx[\`elem\`] = k_block2[i1];
|
||||||
ctx[\`elem_first\`] = i1 === 0;
|
ctx[\`elem_first\`] = i1 === 0;
|
||||||
ctx[\`elem_last\`] = i1 === v_block2.length - 1;
|
ctx[\`elem_last\`] = i1 === k_block2.length - 1;
|
||||||
ctx[\`elem_index\`] = i1;
|
ctx[\`elem_index\`] = i1;
|
||||||
const key1 = ctx['elem'];
|
const key1 = ctx['elem'];
|
||||||
let b4,b5,b6,b7,b8,b9;
|
let b4, b5, b6, b7, b8, b9;
|
||||||
b4 = text(\` -\`);
|
b4 = text(\` -\`);
|
||||||
if (ctx['elem_first']) {
|
if (ctx['elem_first']) {
|
||||||
b5 = text(\` first\`);
|
b5 = text(\` first\`);
|
||||||
@@ -256,6 +256,34 @@ exports[`t-foreach iterate, position 1`] = `
|
|||||||
}"
|
}"
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
exports[`t-foreach iterate, string param 1`] = `
|
||||||
|
"function anonymous(app, bdom, helpers
|
||||||
|
) {
|
||||||
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
|
let { prepareList, withKey } = helpers;
|
||||||
|
|
||||||
|
return function template(ctx, node, key = \\"\\") {
|
||||||
|
ctx = Object.create(ctx);
|
||||||
|
const [k_block1, v_block1, l_block1, c_block1] = prepareList('abc');;
|
||||||
|
for (let i1 = 0; i1 < l_block1; i1++) {
|
||||||
|
ctx[\`item\`] = k_block1[i1];
|
||||||
|
ctx[\`item_index\`] = i1;
|
||||||
|
ctx[\`item_value\`] = v_block1[i1];
|
||||||
|
const key1 = ctx['item_index'];
|
||||||
|
const b3 = text(\` [\`);
|
||||||
|
const b4 = text(ctx['item_index']);
|
||||||
|
const b5 = text(\`: \`);
|
||||||
|
const b6 = text(ctx['item']);
|
||||||
|
const b7 = text(\` \`);
|
||||||
|
const b8 = text(ctx['item_value']);
|
||||||
|
const b9 = text(\`] \`);
|
||||||
|
c_block1[i1] = withKey(multi([b3, b4, b5, b6, b7, b8, b9]), key1);
|
||||||
|
}
|
||||||
|
return list(c_block1);
|
||||||
|
}
|
||||||
|
}"
|
||||||
|
`;
|
||||||
|
|
||||||
exports[`t-foreach simple iteration (in a node) 1`] = `
|
exports[`t-foreach simple iteration (in a node) 1`] = `
|
||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
@@ -268,7 +296,7 @@ exports[`t-foreach simple iteration (in a node) 1`] = `
|
|||||||
ctx = Object.create(ctx);
|
ctx = Object.create(ctx);
|
||||||
const [k_block2, v_block2, l_block2, c_block2] = prepareList([3,2,1]);;
|
const [k_block2, v_block2, l_block2, c_block2] = prepareList([3,2,1]);;
|
||||||
for (let i1 = 0; i1 < l_block2; i1++) {
|
for (let i1 = 0; i1 < l_block2; i1++) {
|
||||||
ctx[\`item\`] = v_block2[i1];
|
ctx[\`item\`] = k_block2[i1];
|
||||||
const key1 = ctx['item'];
|
const key1 = ctx['item'];
|
||||||
c_block2[i1] = withKey(text(ctx['item']), key1);
|
c_block2[i1] = withKey(text(ctx['item']), key1);
|
||||||
}
|
}
|
||||||
@@ -288,7 +316,7 @@ exports[`t-foreach simple iteration 1`] = `
|
|||||||
ctx = Object.create(ctx);
|
ctx = Object.create(ctx);
|
||||||
const [k_block1, v_block1, l_block1, c_block1] = prepareList([3,2,1]);;
|
const [k_block1, v_block1, l_block1, c_block1] = prepareList([3,2,1]);;
|
||||||
for (let i1 = 0; i1 < l_block1; i1++) {
|
for (let i1 = 0; i1 < l_block1; i1++) {
|
||||||
ctx[\`item\`] = v_block1[i1];
|
ctx[\`item\`] = k_block1[i1];
|
||||||
const key1 = ctx['item'];
|
const key1 = ctx['item'];
|
||||||
c_block1[i1] = withKey(text(ctx['item']), key1);
|
c_block1[i1] = withKey(text(ctx['item']), key1);
|
||||||
}
|
}
|
||||||
@@ -310,7 +338,7 @@ exports[`t-foreach simple iteration with two nodes inside 1`] = `
|
|||||||
ctx = Object.create(ctx);
|
ctx = Object.create(ctx);
|
||||||
const [k_block1, v_block1, l_block1, c_block1] = prepareList([3,2,1]);;
|
const [k_block1, v_block1, l_block1, c_block1] = prepareList([3,2,1]);;
|
||||||
for (let i1 = 0; i1 < l_block1; i1++) {
|
for (let i1 = 0; i1 < l_block1; i1++) {
|
||||||
ctx[\`item\`] = v_block1[i1];
|
ctx[\`item\`] = k_block1[i1];
|
||||||
const key1 = ctx['item'];
|
const key1 = ctx['item'];
|
||||||
let txt1 = ctx['item'];
|
let txt1 = ctx['item'];
|
||||||
const b3 = block3([txt1]);
|
const b3 = block3([txt1]);
|
||||||
@@ -328,32 +356,31 @@ exports[`t-foreach t-call with body in t-foreach in t-foreach 1`] = `
|
|||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
let { prepareList, isBoundary, withDefault, setContextValue, withKey } = helpers;
|
let { prepareList, isBoundary, withDefault, setContextValue, withKey } = helpers;
|
||||||
// Template name: \\"main\\"
|
|
||||||
const callTemplate_1 = app.getTemplate(\`sub\`);
|
const callTemplate_1 = app.getTemplate(\`sub\`);
|
||||||
|
|
||||||
let block1 = createBlock(\`<div><block-child-0/><span>[<block-text-0/>][<block-text-1/>][<block-text-2/>]</span></div>\`);
|
let block1 = createBlock(\`<div><block-child-0/><span>[<block-text-0/>][<block-text-1/>][<block-text-2/>]</span></div>\`);
|
||||||
let block6 = createBlock(\`<span><block-text-0/></span>\`);
|
let block6 = createBlock(\`<span><block-text-0/></span>\`);
|
||||||
|
|
||||||
return function main(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
ctx = Object.create(ctx);
|
ctx = Object.create(ctx);
|
||||||
ctx[isBoundary] = 1
|
ctx[isBoundary] = 1
|
||||||
ctx = Object.create(ctx);
|
ctx = Object.create(ctx);
|
||||||
const [k_block2, v_block2, l_block2, c_block2] = prepareList(ctx['numbers']);;
|
const [k_block2, v_block2, l_block2, c_block2] = prepareList(ctx['numbers']);;
|
||||||
for (let i1 = 0; i1 < l_block2; i1++) {
|
for (let i1 = 0; i1 < l_block2; i1++) {
|
||||||
ctx[\`a\`] = v_block2[i1];
|
ctx[\`a\`] = k_block2[i1];
|
||||||
ctx[\`a_first\`] = i1 === 0;
|
ctx[\`a_first\`] = i1 === 0;
|
||||||
ctx[\`a_last\`] = i1 === v_block2.length - 1;
|
ctx[\`a_last\`] = i1 === k_block2.length - 1;
|
||||||
ctx[\`a_index\`] = i1;
|
ctx[\`a_index\`] = i1;
|
||||||
ctx[\`a_value\`] = k_block2[i1];
|
ctx[\`a_value\`] = v_block2[i1];
|
||||||
const key1 = ctx['a'];
|
const key1 = ctx['a'];
|
||||||
ctx = Object.create(ctx);
|
ctx = Object.create(ctx);
|
||||||
const [k_block4, v_block4, l_block4, c_block4] = prepareList(ctx['letters']);;
|
const [k_block4, v_block4, l_block4, c_block4] = prepareList(ctx['letters']);;
|
||||||
for (let i2 = 0; i2 < l_block4; i2++) {
|
for (let i2 = 0; i2 < l_block4; i2++) {
|
||||||
ctx[\`b\`] = v_block4[i2];
|
ctx[\`b\`] = k_block4[i2];
|
||||||
ctx[\`b_first\`] = i2 === 0;
|
ctx[\`b_first\`] = i2 === 0;
|
||||||
ctx[\`b_last\`] = i2 === v_block4.length - 1;
|
ctx[\`b_last\`] = i2 === k_block4.length - 1;
|
||||||
ctx[\`b_index\`] = i2;
|
ctx[\`b_index\`] = i2;
|
||||||
ctx[\`b_value\`] = k_block4[i2];
|
ctx[\`b_value\`] = v_block4[i2];
|
||||||
const key2 = ctx['b'];
|
const key2 = ctx['b'];
|
||||||
ctx = Object.create(ctx);
|
ctx = Object.create(ctx);
|
||||||
ctx[isBoundary] = 1;
|
ctx[isBoundary] = 1;
|
||||||
@@ -381,9 +408,8 @@ exports[`t-foreach t-call with body in t-foreach in t-foreach 2`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"sub\\"
|
|
||||||
|
|
||||||
return function sub(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
const b2 = text(\` [\`);
|
const b2 = text(\` [\`);
|
||||||
const b3 = text(ctx['a']);
|
const b3 = text(ctx['a']);
|
||||||
const b4 = text(\`] [\`);
|
const b4 = text(\`] [\`);
|
||||||
@@ -401,30 +427,29 @@ exports[`t-foreach t-call without body in t-foreach in t-foreach 1`] = `
|
|||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
let { prepareList, withKey } = helpers;
|
let { prepareList, withKey } = helpers;
|
||||||
// Template name: \\"main\\"
|
|
||||||
const callTemplate_1 = app.getTemplate(\`sub\`);
|
const callTemplate_1 = app.getTemplate(\`sub\`);
|
||||||
|
|
||||||
let block1 = createBlock(\`<div><block-child-0/><span>[<block-text-0/>][<block-text-1/>][<block-text-2/>]</span></div>\`);
|
let block1 = createBlock(\`<div><block-child-0/><span>[<block-text-0/>][<block-text-1/>][<block-text-2/>]</span></div>\`);
|
||||||
let block6 = createBlock(\`<span><block-text-0/></span>\`);
|
let block6 = createBlock(\`<span><block-text-0/></span>\`);
|
||||||
|
|
||||||
return function main(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
ctx = Object.create(ctx);
|
ctx = Object.create(ctx);
|
||||||
const [k_block2, v_block2, l_block2, c_block2] = prepareList(ctx['numbers']);;
|
const [k_block2, v_block2, l_block2, c_block2] = prepareList(ctx['numbers']);;
|
||||||
for (let i1 = 0; i1 < l_block2; i1++) {
|
for (let i1 = 0; i1 < l_block2; i1++) {
|
||||||
ctx[\`a\`] = v_block2[i1];
|
ctx[\`a\`] = k_block2[i1];
|
||||||
ctx[\`a_first\`] = i1 === 0;
|
ctx[\`a_first\`] = i1 === 0;
|
||||||
ctx[\`a_last\`] = i1 === v_block2.length - 1;
|
ctx[\`a_last\`] = i1 === k_block2.length - 1;
|
||||||
ctx[\`a_index\`] = i1;
|
ctx[\`a_index\`] = i1;
|
||||||
ctx[\`a_value\`] = k_block2[i1];
|
ctx[\`a_value\`] = v_block2[i1];
|
||||||
const key1 = ctx['a'];
|
const key1 = ctx['a'];
|
||||||
ctx = Object.create(ctx);
|
ctx = Object.create(ctx);
|
||||||
const [k_block4, v_block4, l_block4, c_block4] = prepareList(ctx['letters']);;
|
const [k_block4, v_block4, l_block4, c_block4] = prepareList(ctx['letters']);;
|
||||||
for (let i2 = 0; i2 < l_block4; i2++) {
|
for (let i2 = 0; i2 < l_block4; i2++) {
|
||||||
ctx[\`b\`] = v_block4[i2];
|
ctx[\`b\`] = k_block4[i2];
|
||||||
ctx[\`b_first\`] = i2 === 0;
|
ctx[\`b_first\`] = i2 === 0;
|
||||||
ctx[\`b_last\`] = i2 === v_block4.length - 1;
|
ctx[\`b_last\`] = i2 === k_block4.length - 1;
|
||||||
ctx[\`b_index\`] = i2;
|
ctx[\`b_index\`] = i2;
|
||||||
ctx[\`b_value\`] = k_block4[i2];
|
ctx[\`b_value\`] = v_block4[i2];
|
||||||
const key2 = ctx['b'];
|
const key2 = ctx['b'];
|
||||||
c_block4[i2] = withKey(callTemplate_1.call(this, ctx, node, key + \`__1__\${key1}__\${key2}\`), key2);
|
c_block4[i2] = withKey(callTemplate_1.call(this, ctx, node, key + \`__1__\${key1}__\${key2}\`), key2);
|
||||||
}
|
}
|
||||||
@@ -449,9 +474,8 @@ exports[`t-foreach t-call without body in t-foreach in t-foreach 2`] = `
|
|||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
let { isBoundary, withDefault, setContextValue } = helpers;
|
let { isBoundary, withDefault, setContextValue } = helpers;
|
||||||
// Template name: \\"sub\\"
|
|
||||||
|
|
||||||
return function sub(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
ctx = Object.create(ctx);
|
ctx = Object.create(ctx);
|
||||||
ctx[isBoundary] = 1
|
ctx[isBoundary] = 1
|
||||||
setContextValue(ctx, \\"c\\", 'x'+'_'+ctx['a']+'_'+ctx['b']);
|
setContextValue(ctx, \\"c\\", 'x'+'_'+ctx['a']+'_'+ctx['b']);
|
||||||
@@ -479,12 +503,12 @@ exports[`t-foreach t-foreach in t-foreach 1`] = `
|
|||||||
ctx = Object.create(ctx);
|
ctx = Object.create(ctx);
|
||||||
const [k_block2, v_block2, l_block2, c_block2] = prepareList(ctx['numbers']);;
|
const [k_block2, v_block2, l_block2, c_block2] = prepareList(ctx['numbers']);;
|
||||||
for (let i1 = 0; i1 < l_block2; i1++) {
|
for (let i1 = 0; i1 < l_block2; i1++) {
|
||||||
ctx[\`number\`] = v_block2[i1];
|
ctx[\`number\`] = k_block2[i1];
|
||||||
const key1 = ctx['number'];
|
const key1 = ctx['number'];
|
||||||
ctx = Object.create(ctx);
|
ctx = Object.create(ctx);
|
||||||
const [k_block3, v_block3, l_block3, c_block3] = prepareList(ctx['letters']);;
|
const [k_block3, v_block3, l_block3, c_block3] = prepareList(ctx['letters']);;
|
||||||
for (let i2 = 0; i2 < l_block3; i2++) {
|
for (let i2 = 0; i2 < l_block3; i2++) {
|
||||||
ctx[\`letter\`] = v_block3[i2];
|
ctx[\`letter\`] = k_block3[i2];
|
||||||
const key2 = ctx['letter'];
|
const key2 = ctx['letter'];
|
||||||
const b5 = text(\` [\`);
|
const b5 = text(\` [\`);
|
||||||
const b6 = text(ctx['number']);
|
const b6 = text(ctx['number']);
|
||||||
@@ -513,7 +537,7 @@ exports[`t-foreach t-foreach with t-if inside (no external node) 1`] = `
|
|||||||
ctx = Object.create(ctx);
|
ctx = Object.create(ctx);
|
||||||
const [k_block1, v_block1, l_block1, c_block1] = prepareList(ctx['elems']);;
|
const [k_block1, v_block1, l_block1, c_block1] = prepareList(ctx['elems']);;
|
||||||
for (let i1 = 0; i1 < l_block1; i1++) {
|
for (let i1 = 0; i1 < l_block1; i1++) {
|
||||||
ctx[\`elem\`] = v_block1[i1];
|
ctx[\`elem\`] = k_block1[i1];
|
||||||
const key1 = ctx['elem'].id;
|
const key1 = ctx['elem'].id;
|
||||||
let b3;
|
let b3;
|
||||||
if (ctx['elem'].id<3) {
|
if (ctx['elem'].id<3) {
|
||||||
@@ -540,7 +564,7 @@ exports[`t-foreach t-foreach with t-if inside 1`] = `
|
|||||||
ctx = Object.create(ctx);
|
ctx = Object.create(ctx);
|
||||||
const [k_block2, v_block2, l_block2, c_block2] = prepareList(ctx['elems']);;
|
const [k_block2, v_block2, l_block2, c_block2] = prepareList(ctx['elems']);;
|
||||||
for (let i1 = 0; i1 < l_block2; i1++) {
|
for (let i1 = 0; i1 < l_block2; i1++) {
|
||||||
ctx[\`elem\`] = v_block2[i1];
|
ctx[\`elem\`] = k_block2[i1];
|
||||||
const key1 = ctx['elem'].id;
|
const key1 = ctx['elem'].id;
|
||||||
let b4;
|
let b4;
|
||||||
if (ctx['elem'].id<3) {
|
if (ctx['elem'].id<3) {
|
||||||
@@ -568,7 +592,7 @@ exports[`t-foreach t-key on t-foreach 1`] = `
|
|||||||
ctx = Object.create(ctx);
|
ctx = Object.create(ctx);
|
||||||
const [k_block2, v_block2, l_block2, c_block2] = prepareList(ctx['things']);;
|
const [k_block2, v_block2, l_block2, c_block2] = prepareList(ctx['things']);;
|
||||||
for (let i1 = 0; i1 < l_block2; i1++) {
|
for (let i1 = 0; i1 < l_block2; i1++) {
|
||||||
ctx[\`thing\`] = v_block2[i1];
|
ctx[\`thing\`] = k_block2[i1];
|
||||||
const key1 = ctx['thing'];
|
const key1 = ctx['thing'];
|
||||||
c_block2[i1] = withKey(block3(), key1);
|
c_block2[i1] = withKey(block3(), key1);
|
||||||
}
|
}
|
||||||
@@ -591,7 +615,7 @@ exports[`t-foreach throws error if invalid loop expression 1`] = `
|
|||||||
ctx = Object.create(ctx);
|
ctx = Object.create(ctx);
|
||||||
const [k_block2, v_block2, l_block2, c_block2] = prepareList(ctx['abc']);;
|
const [k_block2, v_block2, l_block2, c_block2] = prepareList(ctx['abc']);;
|
||||||
for (let i1 = 0; i1 < l_block2; i1++) {
|
for (let i1 = 0; i1 < l_block2; i1++) {
|
||||||
ctx[\`item\`] = v_block2[i1];
|
ctx[\`item\`] = k_block2[i1];
|
||||||
ctx[\`item_index\`] = i1;
|
ctx[\`item_index\`] = i1;
|
||||||
const key1 = ctx['item'];
|
const key1 = ctx['item'];
|
||||||
const tKey_1 = ctx['item_index'];
|
const tKey_1 = ctx['item_index'];
|
||||||
@@ -618,7 +642,7 @@ exports[`t-foreach with t-memo 1`] = `
|
|||||||
ctx = Object.create(ctx);
|
ctx = Object.create(ctx);
|
||||||
const [k_block2, v_block2, l_block2, c_block2] = prepareList(ctx['items']);;
|
const [k_block2, v_block2, l_block2, c_block2] = prepareList(ctx['items']);;
|
||||||
for (let i1 = 0; i1 < l_block2; i1++) {
|
for (let i1 = 0; i1 < l_block2; i1++) {
|
||||||
ctx[\`item\`] = v_block2[i1];
|
ctx[\`item\`] = k_block2[i1];
|
||||||
const key1 = ctx['item'].id;
|
const key1 = ctx['item'].id;
|
||||||
const memo1 = [ctx['item'].x];
|
const memo1 = [ctx['item'].x];
|
||||||
const vnode1 = cache[key1];;
|
const vnode1 = cache[key1];;
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ exports[`t-if a t-if next to a div 1`] = `
|
|||||||
let block2 = createBlock(\`<div>foo</div>\`);
|
let block2 = createBlock(\`<div>foo</div>\`);
|
||||||
|
|
||||||
return function template(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
let b2,b3;
|
let b2, b3;
|
||||||
b2 = block2();
|
b2 = block2();
|
||||||
if (ctx['cond']) {
|
if (ctx['cond']) {
|
||||||
b3 = text(\`1\`);
|
b3 = text(\`1\`);
|
||||||
@@ -44,7 +44,7 @@ exports[`t-if boolean value condition elif (no outside node) 1`] = `
|
|||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
|
|
||||||
return function template(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
let b2,b3,b4,b5;
|
let b2, b3, b4, b5;
|
||||||
if (ctx['color']=='black') {
|
if (ctx['color']=='black') {
|
||||||
b2 = text(\`black pearl\`);
|
b2 = text(\`black pearl\`);
|
||||||
} else if (ctx['color']=='yellow') {
|
} else if (ctx['color']=='yellow') {
|
||||||
@@ -67,7 +67,7 @@ exports[`t-if boolean value condition elif 1`] = `
|
|||||||
let block1 = createBlock(\`<div><block-child-0/><block-child-1/><block-child-2/><block-child-3/></div>\`);
|
let block1 = createBlock(\`<div><block-child-0/><block-child-1/><block-child-2/><block-child-3/></div>\`);
|
||||||
|
|
||||||
return function template(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
let b2,b3,b4,b5;
|
let b2, b3, b4, b5;
|
||||||
if (ctx['color']=='black') {
|
if (ctx['color']=='black') {
|
||||||
b2 = text(\`black pearl\`);
|
b2 = text(\`black pearl\`);
|
||||||
} else if (ctx['color']=='yellow') {
|
} else if (ctx['color']=='yellow') {
|
||||||
@@ -90,7 +90,7 @@ exports[`t-if boolean value condition else 1`] = `
|
|||||||
let block1 = createBlock(\`<div><span>begin</span><block-child-0/><block-child-1/><span>end</span></div>\`);
|
let block1 = createBlock(\`<div><span>begin</span><block-child-0/><block-child-1/><span>end</span></div>\`);
|
||||||
|
|
||||||
return function template(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
let b2,b3;
|
let b2, b3;
|
||||||
if (ctx['condition']) {
|
if (ctx['condition']) {
|
||||||
b2 = text(\`ok\`);
|
b2 = text(\`ok\`);
|
||||||
} else {
|
} else {
|
||||||
@@ -109,7 +109,7 @@ exports[`t-if boolean value condition false else 1`] = `
|
|||||||
let block1 = createBlock(\`<div><span>begin</span><block-child-0/><block-child-1/><span>end</span></div>\`);
|
let block1 = createBlock(\`<div><span>begin</span><block-child-0/><block-child-1/><span>end</span></div>\`);
|
||||||
|
|
||||||
return function template(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
let b2,b3;
|
let b2, b3;
|
||||||
if (ctx['condition']) {
|
if (ctx['condition']) {
|
||||||
b2 = text(\`fail\`);
|
b2 = text(\`fail\`);
|
||||||
} else {
|
} else {
|
||||||
@@ -145,7 +145,7 @@ exports[`t-if can use some boolean operators in expressions 1`] = `
|
|||||||
let block1 = createBlock(\`<div><block-child-0/><block-child-1/><block-child-2/><block-child-3/><block-child-4/><block-child-5/><block-child-6/><block-child-7/></div>\`);
|
let block1 = createBlock(\`<div><block-child-0/><block-child-1/><block-child-2/><block-child-3/><block-child-4/><block-child-5/><block-child-6/><block-child-7/></div>\`);
|
||||||
|
|
||||||
return function template(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
let b2,b3,b4,b5,b6,b7,b8,b9;
|
let b2, b3, b4, b5, b6, b7, b8, b9;
|
||||||
if (ctx['cond1']&&ctx['cond2']) {
|
if (ctx['cond1']&&ctx['cond2']) {
|
||||||
b2 = text(\`and\`);
|
b2 = text(\`and\`);
|
||||||
}
|
}
|
||||||
@@ -239,7 +239,7 @@ exports[`t-if simple t-if/t-else 1`] = `
|
|||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
|
|
||||||
return function template(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
let b2,b3;
|
let b2, b3;
|
||||||
if (ctx['condition']) {
|
if (ctx['condition']) {
|
||||||
b2 = text(\`1\`);
|
b2 = text(\`1\`);
|
||||||
} else {
|
} else {
|
||||||
@@ -258,7 +258,7 @@ exports[`t-if simple t-if/t-else in a div 1`] = `
|
|||||||
let block1 = createBlock(\`<div><block-child-0/><block-child-1/></div>\`);
|
let block1 = createBlock(\`<div><block-child-0/><block-child-1/></div>\`);
|
||||||
|
|
||||||
return function template(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
let b2,b3;
|
let b2, b3;
|
||||||
if (ctx['condition']) {
|
if (ctx['condition']) {
|
||||||
b2 = text(\`1\`);
|
b2 = text(\`1\`);
|
||||||
} else {
|
} else {
|
||||||
@@ -277,7 +277,7 @@ exports[`t-if t-esc with t-elif 1`] = `
|
|||||||
let block1 = createBlock(\`<div><block-child-0/><block-child-1/></div>\`);
|
let block1 = createBlock(\`<div><block-child-0/><block-child-1/></div>\`);
|
||||||
|
|
||||||
return function template(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
let b2,b3;
|
let b2, b3;
|
||||||
if (false) {
|
if (false) {
|
||||||
b2 = text(\`abc\`);
|
b2 = text(\`abc\`);
|
||||||
} else {
|
} else {
|
||||||
@@ -314,7 +314,7 @@ exports[`t-if t-if and t-else with two nodes 1`] = `
|
|||||||
let block5 = createBlock(\`<span>b</span>\`);
|
let block5 = createBlock(\`<span>b</span>\`);
|
||||||
|
|
||||||
return function template(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
let b2,b3;
|
let b2, b3;
|
||||||
if (ctx['condition']) {
|
if (ctx['condition']) {
|
||||||
b2 = text(\`1\`);
|
b2 = text(\`1\`);
|
||||||
} else {
|
} else {
|
||||||
@@ -372,7 +372,7 @@ exports[`t-if t-if with empty content 1`] = `
|
|||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
|
|
||||||
return function template(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
let b2,b3;
|
let b2, b3;
|
||||||
b2 = text(\`hello\`);
|
b2 = text(\`hello\`);
|
||||||
if (ctx['condition']) {
|
if (ctx['condition']) {
|
||||||
b3 = text(\`\`);
|
b3 = text(\`\`);
|
||||||
@@ -388,7 +388,7 @@ exports[`t-if t-if/t-else with more content 1`] = `
|
|||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
|
|
||||||
return function template(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
let b2,b3;
|
let b2, b3;
|
||||||
if (ctx['condition']) {
|
if (ctx['condition']) {
|
||||||
if (ctx['condition']) {
|
if (ctx['condition']) {
|
||||||
b2 = text(\`asf\`);
|
b2 = text(\`asf\`);
|
||||||
@@ -458,7 +458,7 @@ exports[`t-if t-set, then t-if, part 3 1`] = `
|
|||||||
return function template(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
ctx = Object.create(ctx);
|
ctx = Object.create(ctx);
|
||||||
ctx[isBoundary] = 1
|
ctx[isBoundary] = 1
|
||||||
let b2,b3;
|
let b2, b3;
|
||||||
setContextValue(ctx, \\"y\\", false);
|
setContextValue(ctx, \\"y\\", false);
|
||||||
setContextValue(ctx, \\"x\\", ctx['y']);
|
setContextValue(ctx, \\"x\\", ctx['y']);
|
||||||
if (ctx['x']) {
|
if (ctx['x']) {
|
||||||
@@ -477,7 +477,7 @@ exports[`t-if two consecutive t-if 1`] = `
|
|||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
|
|
||||||
return function template(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
let b2,b3;
|
let b2, b3;
|
||||||
if (ctx['cond1']) {
|
if (ctx['cond1']) {
|
||||||
b2 = text(\`1\`);
|
b2 = text(\`1\`);
|
||||||
}
|
}
|
||||||
@@ -497,7 +497,7 @@ exports[`t-if two consecutive t-if in a div 1`] = `
|
|||||||
let block1 = createBlock(\`<div><block-child-0/><block-child-1/></div>\`);
|
let block1 = createBlock(\`<div><block-child-0/><block-child-1/></div>\`);
|
||||||
|
|
||||||
return function template(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
let b2,b3;
|
let b2, b3;
|
||||||
if (ctx['cond1']) {
|
if (ctx['cond1']) {
|
||||||
b2 = text(\`1\`);
|
b2 = text(\`1\`);
|
||||||
}
|
}
|
||||||
@@ -520,7 +520,7 @@ exports[`t-if two t-ifs next to each other 1`] = `
|
|||||||
let block5 = createBlock(\`<p>2</p>\`);
|
let block5 = createBlock(\`<p>2</p>\`);
|
||||||
|
|
||||||
return function template(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
let b2,b3;
|
let b2, b3;
|
||||||
if (ctx['condition']) {
|
if (ctx['condition']) {
|
||||||
let txt1 = ctx['text'];
|
let txt1 = ctx['text'];
|
||||||
b2 = block2([txt1]);
|
b2 = block2([txt1]);
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ exports[`t-key t-key directive in a list 1`] = `
|
|||||||
ctx = Object.create(ctx);
|
ctx = Object.create(ctx);
|
||||||
const [k_block2, v_block2, l_block2, c_block2] = prepareList(ctx['beers']);;
|
const [k_block2, v_block2, l_block2, c_block2] = prepareList(ctx['beers']);;
|
||||||
for (let i1 = 0; i1 < l_block2; i1++) {
|
for (let i1 = 0; i1 < l_block2; i1++) {
|
||||||
ctx[\`beer\`] = v_block2[i1];
|
ctx[\`beer\`] = k_block2[i1];
|
||||||
const key1 = ctx['beer'].id;
|
const key1 = ctx['beer'].id;
|
||||||
let txt1 = ctx['beer'].name;
|
let txt1 = ctx['beer'].name;
|
||||||
c_block2[i1] = withKey(block3([txt1]), key1);
|
c_block2[i1] = withKey(block3([txt1]), key1);
|
||||||
@@ -79,7 +79,7 @@ exports[`t-key t-key on sub dom node pushes a child block in its parent 1`] = `
|
|||||||
let block3 = createBlock(\`<div><h1/></div>\`);
|
let block3 = createBlock(\`<div><h1/></div>\`);
|
||||||
|
|
||||||
return function template(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
let b2,b3;
|
let b2, b3;
|
||||||
if (ctx['hasSpan']) {
|
if (ctx['hasSpan']) {
|
||||||
b2 = block2();
|
b2 = block2();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,19 +32,18 @@ exports[`t-out multiple calls to t-out 1`] = `
|
|||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
let { isBoundary, zero } = helpers;
|
let { isBoundary, zero } = helpers;
|
||||||
// Template name: \\"main\\"
|
|
||||||
const callTemplate_1 = app.getTemplate(\`sub\`);
|
const callTemplate_1 = app.getTemplate(\`sub\`);
|
||||||
|
|
||||||
let block1 = createBlock(\`<div><block-child-0/></div>\`);
|
let block1 = createBlock(\`<div><block-child-0/></div>\`);
|
||||||
let block2 = createBlock(\`<span>coucou</span>\`);
|
let block3 = createBlock(\`<span>coucou</span>\`);
|
||||||
|
|
||||||
return function main(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
ctx = Object.create(ctx);
|
ctx = Object.create(ctx);
|
||||||
ctx[isBoundary] = 1;
|
ctx[isBoundary] = 1;
|
||||||
const b2 = block2();
|
const b3 = block3();
|
||||||
ctx[zero] = b2;
|
ctx[zero] = b3;
|
||||||
const b3 = callTemplate_1.call(this, ctx, node, key + \`__1\`);
|
const b2 = callTemplate_1.call(this, ctx, node, key + \`__1\`);
|
||||||
return block1([], [b3]);
|
return block1([], [b2]);
|
||||||
}
|
}
|
||||||
}"
|
}"
|
||||||
`;
|
`;
|
||||||
@@ -54,11 +53,10 @@ exports[`t-out multiple calls to t-out 2`] = `
|
|||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
let { zero } = helpers;
|
let { zero } = helpers;
|
||||||
// Template name: \\"sub\\"
|
|
||||||
|
|
||||||
let block1 = createBlock(\`<div><block-child-0/><div>Greeter</div><block-child-1/></div>\`);
|
let block1 = createBlock(\`<div><block-child-0/><div>Greeter</div><block-child-1/></div>\`);
|
||||||
|
|
||||||
return function sub(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
const b2 = ctx[zero];
|
const b2 = ctx[zero];
|
||||||
const b3 = ctx[zero];
|
const b3 = ctx[zero];
|
||||||
return block1([], [b2, b3]);
|
return block1([], [b2, b3]);
|
||||||
@@ -101,19 +99,18 @@ exports[`t-out t-out 0 1`] = `
|
|||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
let { isBoundary, zero } = helpers;
|
let { isBoundary, zero } = helpers;
|
||||||
// Template name: \\"caller\\"
|
|
||||||
const callTemplate_1 = app.getTemplate(\`_basic-callee\`);
|
const callTemplate_1 = app.getTemplate(\`_basic-callee\`);
|
||||||
|
|
||||||
let block1 = createBlock(\`<div><block-child-0/></div>\`);
|
let block1 = createBlock(\`<div><block-child-0/></div>\`);
|
||||||
let block2 = createBlock(\`<div>zero</div>\`);
|
let block3 = createBlock(\`<div>zero</div>\`);
|
||||||
|
|
||||||
return function caller(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
ctx = Object.create(ctx);
|
ctx = Object.create(ctx);
|
||||||
ctx[isBoundary] = 1;
|
ctx[isBoundary] = 1;
|
||||||
const b2 = block2();
|
const b3 = block3();
|
||||||
ctx[zero] = b2;
|
ctx[zero] = b3;
|
||||||
const b3 = callTemplate_1.call(this, ctx, node, key + \`__1\`);
|
const b2 = callTemplate_1.call(this, ctx, node, key + \`__1\`);
|
||||||
return block1([], [b3]);
|
return block1([], [b2]);
|
||||||
}
|
}
|
||||||
}"
|
}"
|
||||||
`;
|
`;
|
||||||
@@ -123,11 +120,10 @@ exports[`t-out t-out 0 2`] = `
|
|||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
let { zero } = helpers;
|
let { zero } = helpers;
|
||||||
// Template name: \\"_basic-callee\\"
|
|
||||||
|
|
||||||
let block1 = createBlock(\`<div><block-child-0/></div>\`);
|
let block1 = createBlock(\`<div><block-child-0/></div>\`);
|
||||||
|
|
||||||
return function _basic_callee(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
const b2 = ctx[zero];
|
const b2 = ctx[zero];
|
||||||
return block1([], [b2]);
|
return block1([], [b2]);
|
||||||
}
|
}
|
||||||
@@ -313,7 +309,7 @@ exports[`t-out t-out switch markup on bdom 1`] = `
|
|||||||
return function template(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
ctx = Object.create(ctx);
|
ctx = Object.create(ctx);
|
||||||
ctx[isBoundary] = 1
|
ctx[isBoundary] = 1
|
||||||
let b3,b5;
|
let b3, b5;
|
||||||
ctx[\`bdom\`] = new LazyValue(value1, ctx, this, node, key);
|
ctx[\`bdom\`] = new LazyValue(value1, ctx, this, node, key);
|
||||||
if (ctx['hasBdom']) {
|
if (ctx['hasBdom']) {
|
||||||
const b4 = safeOutput(ctx['bdom']);
|
const b4 = safeOutput(ctx['bdom']);
|
||||||
|
|||||||
@@ -48,12 +48,11 @@ exports[`t-ref ref in a t-call 1`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"main\\"
|
|
||||||
const callTemplate_1 = app.getTemplate(\`sub\`);
|
const callTemplate_1 = app.getTemplate(\`sub\`);
|
||||||
|
|
||||||
let block1 = createBlock(\`<div><block-child-0/></div>\`);
|
let block1 = createBlock(\`<div><block-child-0/></div>\`);
|
||||||
|
|
||||||
return function main(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
const b2 = callTemplate_1.call(this, ctx, node, key + \`__1\`);
|
const b2 = callTemplate_1.call(this, ctx, node, key + \`__1\`);
|
||||||
return block1([], [b2]);
|
return block1([], [b2]);
|
||||||
}
|
}
|
||||||
@@ -64,11 +63,10 @@ exports[`t-ref ref in a t-call 2`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"sub\\"
|
|
||||||
|
|
||||||
let block1 = createBlock(\`<div>1<span block-ref=\\"0\\"/>2</div>\`);
|
let block1 = createBlock(\`<div>1<span block-ref=\\"0\\"/>2</div>\`);
|
||||||
|
|
||||||
return function sub(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
let ref1 = (el) => this.__owl__.setRef((\`name\`), el);
|
let ref1 = (el) => this.__owl__.setRef((\`name\`), el);
|
||||||
return block1([ref1]);
|
return block1([ref1]);
|
||||||
}
|
}
|
||||||
@@ -107,7 +105,7 @@ exports[`t-ref refs in a loop 1`] = `
|
|||||||
ctx = Object.create(ctx);
|
ctx = Object.create(ctx);
|
||||||
const [k_block2, v_block2, l_block2, c_block2] = prepareList(ctx['items']);;
|
const [k_block2, v_block2, l_block2, c_block2] = prepareList(ctx['items']);;
|
||||||
for (let i1 = 0; i1 < l_block2; i1++) {
|
for (let i1 = 0; i1 < l_block2; i1++) {
|
||||||
ctx[\`item\`] = v_block2[i1];
|
ctx[\`item\`] = k_block2[i1];
|
||||||
const key1 = ctx['item'];
|
const key1 = ctx['item'];
|
||||||
const tKey_1 = ctx['item'];
|
const tKey_1 = ctx['item'];
|
||||||
const v1 = ctx['item'];
|
const v1 = ctx['item'];
|
||||||
|
|||||||
@@ -1,5 +1,50 @@
|
|||||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||||
|
|
||||||
|
exports[`t-set body with backslash at top level 1`] = `
|
||||||
|
"function anonymous(app, bdom, helpers
|
||||||
|
) {
|
||||||
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
|
let { isBoundary, withDefault, setContextValue } = helpers;
|
||||||
|
|
||||||
|
return function template(ctx, node, key = \\"\\") {
|
||||||
|
ctx = Object.create(ctx);
|
||||||
|
ctx[isBoundary] = 1
|
||||||
|
setContextValue(ctx, \\"value\\", \`\\\\\\\\\`);
|
||||||
|
return text(ctx['value']);
|
||||||
|
}
|
||||||
|
}"
|
||||||
|
`;
|
||||||
|
|
||||||
|
exports[`t-set body with backtick at top-level 1`] = `
|
||||||
|
"function anonymous(app, bdom, helpers
|
||||||
|
) {
|
||||||
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
|
let { isBoundary, withDefault, setContextValue } = helpers;
|
||||||
|
|
||||||
|
return function template(ctx, node, key = \\"\\") {
|
||||||
|
ctx = Object.create(ctx);
|
||||||
|
ctx[isBoundary] = 1
|
||||||
|
setContextValue(ctx, \\"value\\", \`\\\\\`\`);
|
||||||
|
return text(ctx['value']);
|
||||||
|
}
|
||||||
|
}"
|
||||||
|
`;
|
||||||
|
|
||||||
|
exports[`t-set body with interpolation sigil at top level 1`] = `
|
||||||
|
"function anonymous(app, bdom, helpers
|
||||||
|
) {
|
||||||
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
|
let { isBoundary, withDefault, setContextValue } = helpers;
|
||||||
|
|
||||||
|
return function template(ctx, node, key = \\"\\") {
|
||||||
|
ctx = Object.create(ctx);
|
||||||
|
ctx[isBoundary] = 1
|
||||||
|
setContextValue(ctx, \\"value\\", \`\\\\\${very cool}\`);
|
||||||
|
return text(ctx['value']);
|
||||||
|
}
|
||||||
|
}"
|
||||||
|
`;
|
||||||
|
|
||||||
exports[`t-set evaluate value expression 1`] = `
|
exports[`t-set evaluate value expression 1`] = `
|
||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
@@ -94,7 +139,7 @@ exports[`t-set set from body literal (with t-if/t-else 1`] = `
|
|||||||
let { isBoundary, withDefault, LazyValue } = helpers;
|
let { isBoundary, withDefault, LazyValue } = helpers;
|
||||||
|
|
||||||
function value1(ctx, node, key = \\"\\") {
|
function value1(ctx, node, key = \\"\\") {
|
||||||
let b2,b3;
|
let b2, b3;
|
||||||
if (ctx['condition']) {
|
if (ctx['condition']) {
|
||||||
b2 = text(\`true\`);
|
b2 = text(\`true\`);
|
||||||
} else {
|
} else {
|
||||||
@@ -219,12 +264,11 @@ exports[`t-set t-set can't alter from within callee 1`] = `
|
|||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
let { isBoundary, withDefault, setContextValue } = helpers;
|
let { isBoundary, withDefault, setContextValue } = helpers;
|
||||||
// Template name: \\"main\\"
|
|
||||||
const callTemplate_1 = app.getTemplate(\`sub\`);
|
const callTemplate_1 = app.getTemplate(\`sub\`);
|
||||||
|
|
||||||
let block1 = createBlock(\`<div><p><block-text-0/></p><block-child-0/><p><block-text-1/></p></div>\`);
|
let block1 = createBlock(\`<div><p><block-text-0/></p><block-child-0/><p><block-text-1/></p></div>\`);
|
||||||
|
|
||||||
return function main(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
ctx = Object.create(ctx);
|
ctx = Object.create(ctx);
|
||||||
ctx[isBoundary] = 1
|
ctx[isBoundary] = 1
|
||||||
setContextValue(ctx, \\"iter\\", 'source');
|
setContextValue(ctx, \\"iter\\", 'source');
|
||||||
@@ -241,11 +285,10 @@ exports[`t-set t-set can't alter from within callee 2`] = `
|
|||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
let { isBoundary, withDefault, setContextValue } = helpers;
|
let { isBoundary, withDefault, setContextValue } = helpers;
|
||||||
// Template name: \\"sub\\"
|
|
||||||
|
|
||||||
let block1 = createBlock(\`<div><block-text-0/><block-text-1/></div>\`);
|
let block1 = createBlock(\`<div><block-text-0/><block-text-1/></div>\`);
|
||||||
|
|
||||||
return function sub(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
ctx = Object.create(ctx);
|
ctx = Object.create(ctx);
|
||||||
ctx[isBoundary] = 1
|
ctx[isBoundary] = 1
|
||||||
let txt1 = ctx['iter'];
|
let txt1 = ctx['iter'];
|
||||||
@@ -261,12 +304,11 @@ exports[`t-set t-set can't alter in t-call body 1`] = `
|
|||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
let { isBoundary, withDefault, setContextValue } = helpers;
|
let { isBoundary, withDefault, setContextValue } = helpers;
|
||||||
// Template name: \\"main\\"
|
|
||||||
const callTemplate_1 = app.getTemplate(\`sub\`);
|
const callTemplate_1 = app.getTemplate(\`sub\`);
|
||||||
|
|
||||||
let block1 = createBlock(\`<div><p><block-text-0/></p><block-child-0/><p><block-text-1/></p></div>\`);
|
let block1 = createBlock(\`<div><p><block-text-0/></p><block-child-0/><p><block-text-1/></p></div>\`);
|
||||||
|
|
||||||
return function main(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
ctx = Object.create(ctx);
|
ctx = Object.create(ctx);
|
||||||
ctx[isBoundary] = 1
|
ctx[isBoundary] = 1
|
||||||
setContextValue(ctx, \\"iter\\", 'source');
|
setContextValue(ctx, \\"iter\\", 'source');
|
||||||
@@ -287,11 +329,10 @@ exports[`t-set t-set can't alter in t-call body 2`] = `
|
|||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
let { isBoundary, withDefault, setContextValue } = helpers;
|
let { isBoundary, withDefault, setContextValue } = helpers;
|
||||||
// Template name: \\"sub\\"
|
|
||||||
|
|
||||||
let block1 = createBlock(\`<div><block-text-0/><block-text-1/></div>\`);
|
let block1 = createBlock(\`<div><block-text-0/><block-text-1/></div>\`);
|
||||||
|
|
||||||
return function sub(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
ctx = Object.create(ctx);
|
ctx = Object.create(ctx);
|
||||||
ctx[isBoundary] = 1
|
ctx[isBoundary] = 1
|
||||||
let txt1 = ctx['iter'];
|
let txt1 = ctx['iter'];
|
||||||
@@ -355,7 +396,7 @@ exports[`t-set t-set outside modified in t-foreach 1`] = `
|
|||||||
ctx = Object.create(ctx);
|
ctx = Object.create(ctx);
|
||||||
const [k_block2, v_block2, l_block2, c_block2] = prepareList(['a','b']);;
|
const [k_block2, v_block2, l_block2, c_block2] = prepareList(['a','b']);;
|
||||||
for (let i1 = 0; i1 < l_block2; i1++) {
|
for (let i1 = 0; i1 < l_block2; i1++) {
|
||||||
ctx[\`val\`] = v_block2[i1];
|
ctx[\`val\`] = k_block2[i1];
|
||||||
const key1 = ctx['val'];
|
const key1 = ctx['val'];
|
||||||
let txt1 = ctx['iter'];
|
let txt1 = ctx['iter'];
|
||||||
c_block2[i1] = withKey(block3([txt1]), key1);
|
c_block2[i1] = withKey(block3([txt1]), key1);
|
||||||
@@ -385,7 +426,7 @@ exports[`t-set t-set outside modified in t-foreach increment-after operator 1`]
|
|||||||
ctx = Object.create(ctx);
|
ctx = Object.create(ctx);
|
||||||
const [k_block2, v_block2, l_block2, c_block2] = prepareList(['a','b']);;
|
const [k_block2, v_block2, l_block2, c_block2] = prepareList(['a','b']);;
|
||||||
for (let i1 = 0; i1 < l_block2; i1++) {
|
for (let i1 = 0; i1 < l_block2; i1++) {
|
||||||
ctx[\`val\`] = v_block2[i1];
|
ctx[\`val\`] = k_block2[i1];
|
||||||
const key1 = ctx['val'];
|
const key1 = ctx['val'];
|
||||||
let txt1 = ctx['iter'];
|
let txt1 = ctx['iter'];
|
||||||
c_block2[i1] = withKey(block3([txt1]), key1);
|
c_block2[i1] = withKey(block3([txt1]), key1);
|
||||||
@@ -415,7 +456,7 @@ exports[`t-set t-set outside modified in t-foreach increment-before operator 1`]
|
|||||||
ctx = Object.create(ctx);
|
ctx = Object.create(ctx);
|
||||||
const [k_block2, v_block2, l_block2, c_block2] = prepareList(['a','b']);;
|
const [k_block2, v_block2, l_block2, c_block2] = prepareList(['a','b']);;
|
||||||
for (let i1 = 0; i1 < l_block2; i1++) {
|
for (let i1 = 0; i1 < l_block2; i1++) {
|
||||||
ctx[\`val\`] = v_block2[i1];
|
ctx[\`val\`] = k_block2[i1];
|
||||||
const key1 = ctx['val'];
|
const key1 = ctx['val'];
|
||||||
let txt1 = ctx['iter'];
|
let txt1 = ctx['iter'];
|
||||||
c_block2[i1] = withKey(block3([txt1]), key1);
|
c_block2[i1] = withKey(block3([txt1]), key1);
|
||||||
@@ -445,7 +486,7 @@ exports[`t-set t-set should reuse variable if possible 1`] = `
|
|||||||
ctx = Object.create(ctx);
|
ctx = Object.create(ctx);
|
||||||
const [k_block2, v_block2, l_block2, c_block2] = prepareList(ctx['list']);;
|
const [k_block2, v_block2, l_block2, c_block2] = prepareList(ctx['list']);;
|
||||||
for (let i1 = 0; i1 < l_block2; i1++) {
|
for (let i1 = 0; i1 < l_block2; i1++) {
|
||||||
ctx[\`elem\`] = v_block2[i1];
|
ctx[\`elem\`] = k_block2[i1];
|
||||||
ctx[\`elem_index\`] = i1;
|
ctx[\`elem_index\`] = i1;
|
||||||
const key1 = ctx['elem_index'];
|
const key1 = ctx['elem_index'];
|
||||||
let txt1 = ctx['v'];
|
let txt1 = ctx['v'];
|
||||||
|
|||||||
@@ -4,11 +4,10 @@ exports[`loading templates addTemplates does not modify its xml document in plac
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"hey\\"
|
|
||||||
|
|
||||||
let block1 = createBlock(\`<div><block-text-0/></div>\`);
|
let block1 = createBlock(\`<div><block-text-0/></div>\`);
|
||||||
|
|
||||||
return function hey(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
let txt1 = ctx['value'];
|
let txt1 = ctx['value'];
|
||||||
return block1([txt1]);
|
return block1([txt1]);
|
||||||
}
|
}
|
||||||
@@ -19,11 +18,10 @@ exports[`loading templates can initialize qweb with a string 1`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"hey\\"
|
|
||||||
|
|
||||||
let block1 = createBlock(\`<div>jupiler</div>\`);
|
let block1 = createBlock(\`<div>jupiler</div>\`);
|
||||||
|
|
||||||
return function hey(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
return block1();
|
return block1();
|
||||||
}
|
}
|
||||||
}"
|
}"
|
||||||
@@ -33,11 +31,10 @@ exports[`loading templates can initialize qweb with an XMLDocument 1`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"hey\\"
|
|
||||||
|
|
||||||
let block1 = createBlock(\`<div>jupiler</div>\`);
|
let block1 = createBlock(\`<div>jupiler</div>\`);
|
||||||
|
|
||||||
return function hey(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
return block1();
|
return block1();
|
||||||
}
|
}
|
||||||
}"
|
}"
|
||||||
@@ -47,12 +44,11 @@ exports[`loading templates can load a few templates from a xml string 1`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"main\\"
|
|
||||||
const callTemplate_1 = app.getTemplate(\`items\`);
|
const callTemplate_1 = app.getTemplate(\`items\`);
|
||||||
|
|
||||||
let block1 = createBlock(\`<ul><block-child-0/></ul>\`);
|
let block1 = createBlock(\`<ul><block-child-0/></ul>\`);
|
||||||
|
|
||||||
return function main(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
const b2 = callTemplate_1.call(this, ctx, node, key + \`__1\`);
|
const b2 = callTemplate_1.call(this, ctx, node, key + \`__1\`);
|
||||||
return block1([], [b2]);
|
return block1([], [b2]);
|
||||||
}
|
}
|
||||||
@@ -63,12 +59,11 @@ exports[`loading templates can load a few templates from a xml string 2`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"items\\"
|
|
||||||
|
|
||||||
let block2 = createBlock(\`<li>ok</li>\`);
|
let block2 = createBlock(\`<li>ok</li>\`);
|
||||||
let block3 = createBlock(\`<li>foo</li>\`);
|
let block3 = createBlock(\`<li>foo</li>\`);
|
||||||
|
|
||||||
return function items(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
const b2 = block2();
|
const b2 = block2();
|
||||||
const b3 = block3();
|
const b3 = block3();
|
||||||
return multi([b2, b3]);
|
return multi([b2, b3]);
|
||||||
@@ -80,12 +75,11 @@ exports[`loading templates can load a few templates from an XMLDocument 1`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"main\\"
|
|
||||||
const callTemplate_1 = app.getTemplate(\`items\`);
|
const callTemplate_1 = app.getTemplate(\`items\`);
|
||||||
|
|
||||||
let block1 = createBlock(\`<ul><block-child-0/></ul>\`);
|
let block1 = createBlock(\`<ul><block-child-0/></ul>\`);
|
||||||
|
|
||||||
return function main(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
const b2 = callTemplate_1.call(this, ctx, node, key + \`__1\`);
|
const b2 = callTemplate_1.call(this, ctx, node, key + \`__1\`);
|
||||||
return block1([], [b2]);
|
return block1([], [b2]);
|
||||||
}
|
}
|
||||||
@@ -96,15 +90,66 @@ exports[`loading templates can load a few templates from an XMLDocument 2`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"items\\"
|
|
||||||
|
|
||||||
let block2 = createBlock(\`<li>ok</li>\`);
|
let block2 = createBlock(\`<li>ok</li>\`);
|
||||||
let block3 = createBlock(\`<li>foo</li>\`);
|
let block3 = createBlock(\`<li>foo</li>\`);
|
||||||
|
|
||||||
return function items(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
const b2 = block2();
|
const b2 = block2();
|
||||||
const b3 = block3();
|
const b3 = block3();
|
||||||
return multi([b2, b3]);
|
return multi([b2, b3]);
|
||||||
}
|
}
|
||||||
}"
|
}"
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
exports[`loading templates getTemplate: element returned (2) 1`] = `
|
||||||
|
"function anonymous(app, bdom, helpers
|
||||||
|
) {
|
||||||
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
|
|
||||||
|
let block1 = createBlock(\`<div>Hello World!</div>\`);
|
||||||
|
|
||||||
|
return function template(ctx, node, key = \\"\\") {
|
||||||
|
return block1();
|
||||||
|
}
|
||||||
|
}"
|
||||||
|
`;
|
||||||
|
|
||||||
|
exports[`loading templates getTemplate: element returned 1`] = `
|
||||||
|
"function anonymous(app, bdom, helpers
|
||||||
|
) {
|
||||||
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
|
|
||||||
|
let block1 = createBlock(\`<div>Hello World!</div>\`);
|
||||||
|
|
||||||
|
return function template(ctx, node, key = \\"\\") {
|
||||||
|
return block1();
|
||||||
|
}
|
||||||
|
}"
|
||||||
|
`;
|
||||||
|
|
||||||
|
exports[`loading templates getTemplate: template string returned 1`] = `
|
||||||
|
"function anonymous(app, bdom, helpers
|
||||||
|
) {
|
||||||
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
|
|
||||||
|
let block1 = createBlock(\`<div>Hello World!</div>\`);
|
||||||
|
|
||||||
|
return function template(ctx, node, key = \\"\\") {
|
||||||
|
return block1();
|
||||||
|
}
|
||||||
|
}"
|
||||||
|
`;
|
||||||
|
|
||||||
|
exports[`loading templates getTemplate: undefined returned 1`] = `
|
||||||
|
"function anonymous(app, bdom, helpers
|
||||||
|
) {
|
||||||
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
|
|
||||||
|
let block1 = createBlock(\`<div>Hello World!</div>\`);
|
||||||
|
|
||||||
|
return function template(ctx, node, key = \\"\\") {
|
||||||
|
return block1();
|
||||||
|
}
|
||||||
|
}"
|
||||||
|
`;
|
||||||
|
|||||||
@@ -5,9 +5,8 @@ exports[`translation support body of t-sets are translated 1`] = `
|
|||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
let { isBoundary, withDefault, setContextValue } = helpers;
|
let { isBoundary, withDefault, setContextValue } = helpers;
|
||||||
// Template name: \\"xml_template_999\\"
|
|
||||||
|
|
||||||
return function xml_template_999_SomeComponent(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
ctx = Object.create(ctx);
|
ctx = Object.create(ctx);
|
||||||
ctx[isBoundary] = 1
|
ctx[isBoundary] = 1
|
||||||
setContextValue(ctx, \\"label\\", \`translated\`);
|
setContextValue(ctx, \\"label\\", \`translated\`);
|
||||||
@@ -21,9 +20,8 @@ exports[`translation support body of t-sets inside translation=off are not trans
|
|||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
let { isBoundary, withDefault, setContextValue } = helpers;
|
let { isBoundary, withDefault, setContextValue } = helpers;
|
||||||
// Template name: \\"xml_template_999\\"
|
|
||||||
|
|
||||||
return function xml_template_999_SomeComponent(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
ctx = Object.create(ctx);
|
ctx = Object.create(ctx);
|
||||||
ctx[isBoundary] = 1
|
ctx[isBoundary] = 1
|
||||||
setContextValue(ctx, \\"label\\", \`untranslated\`);
|
setContextValue(ctx, \\"label\\", \`untranslated\`);
|
||||||
@@ -37,7 +35,6 @@ exports[`translation support body of t-sets with html content are translated 1`]
|
|||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
let { isBoundary, withDefault, LazyValue, safeOutput } = helpers;
|
let { isBoundary, withDefault, LazyValue, safeOutput } = helpers;
|
||||||
// Template name: \\"xml_template_999\\"
|
|
||||||
|
|
||||||
let block1 = createBlock(\`<div>translated</div>\`);
|
let block1 = createBlock(\`<div>translated</div>\`);
|
||||||
|
|
||||||
@@ -45,7 +42,7 @@ exports[`translation support body of t-sets with html content are translated 1`]
|
|||||||
return block1();
|
return block1();
|
||||||
}
|
}
|
||||||
|
|
||||||
return function xml_template_999_SomeComponent(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
ctx = Object.create(ctx);
|
ctx = Object.create(ctx);
|
||||||
ctx[isBoundary] = 1
|
ctx[isBoundary] = 1
|
||||||
ctx[\`label\`] = new LazyValue(value1, ctx, this, node, key);
|
ctx[\`label\`] = new LazyValue(value1, ctx, this, node, key);
|
||||||
@@ -59,7 +56,6 @@ exports[`translation support body of t-sets with text and html content are trans
|
|||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
let { isBoundary, withDefault, LazyValue, safeOutput } = helpers;
|
let { isBoundary, withDefault, LazyValue, safeOutput } = helpers;
|
||||||
// Template name: \\"xml_template_999\\"
|
|
||||||
|
|
||||||
let block3 = createBlock(\`<div>translated</div>\`);
|
let block3 = createBlock(\`<div>translated</div>\`);
|
||||||
|
|
||||||
@@ -69,7 +65,7 @@ exports[`translation support body of t-sets with text and html content are trans
|
|||||||
return multi([b2, b3]);
|
return multi([b2, b3]);
|
||||||
}
|
}
|
||||||
|
|
||||||
return function xml_template_999_SomeComponent(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
ctx = Object.create(ctx);
|
ctx = Object.create(ctx);
|
||||||
ctx[isBoundary] = 1
|
ctx[isBoundary] = 1
|
||||||
ctx[\`label\`] = new LazyValue(value1, ctx, this, node, key);
|
ctx[\`label\`] = new LazyValue(value1, ctx, this, node, key);
|
||||||
@@ -82,11 +78,10 @@ exports[`translation support can set and remove translatable attributes 1`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_999\\"
|
|
||||||
|
|
||||||
let block1 = createBlock(\`<div tomato=\\"word\\" potato=\\"mot\\" title=\\"mot\\" label=\\"word\\">text</div>\`);
|
let block1 = createBlock(\`<div tomato=\\"word\\" potato=\\"mot\\" title=\\"mot\\" label=\\"word\\">text</div>\`);
|
||||||
|
|
||||||
return function xml_template_999_SomeComponent(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
return block1();
|
return block1();
|
||||||
}
|
}
|
||||||
}"
|
}"
|
||||||
@@ -96,11 +91,10 @@ exports[`translation support can translate node content 1`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_999\\"
|
|
||||||
|
|
||||||
let block1 = createBlock(\`<div>mot</div>\`);
|
let block1 = createBlock(\`<div>mot</div>\`);
|
||||||
|
|
||||||
return function xml_template_999_SomeComponent(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
return block1();
|
return block1();
|
||||||
}
|
}
|
||||||
}"
|
}"
|
||||||
@@ -110,11 +104,10 @@ exports[`translation support does not translate node content if disabled 1`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_999\\"
|
|
||||||
|
|
||||||
let block1 = createBlock(\`<div><span>mot</span><span>word</span></div>\`);
|
let block1 = createBlock(\`<div><span>mot</span><span>word</span></div>\`);
|
||||||
|
|
||||||
return function xml_template_999_SomeComponent(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
return block1();
|
return block1();
|
||||||
}
|
}
|
||||||
}"
|
}"
|
||||||
@@ -124,11 +117,10 @@ exports[`translation support some attributes are translated 1`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_999\\"
|
|
||||||
|
|
||||||
let block1 = createBlock(\`<div><p label=\\"mot\\">mot</p><p title=\\"mot\\">mot</p><p placeholder=\\"mot\\">mot</p><p alt=\\"mot\\">mot</p><p something=\\"word\\">mot</p></div>\`);
|
let block1 = createBlock(\`<div><p label=\\"mot\\">mot</p><p title=\\"mot\\">mot</p><p placeholder=\\"mot\\">mot</p><p alt=\\"mot\\">mot</p><p something=\\"word\\">mot</p></div>\`);
|
||||||
|
|
||||||
return function xml_template_999_SomeComponent(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
return block1();
|
return block1();
|
||||||
}
|
}
|
||||||
}"
|
}"
|
||||||
@@ -139,9 +131,8 @@ exports[`translation support t-set and falsy t-value: t-body are translated 1`]
|
|||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
let { isBoundary, withDefault, setContextValue } = helpers;
|
let { isBoundary, withDefault, setContextValue } = helpers;
|
||||||
// Template name: \\"xml_template_999\\"
|
|
||||||
|
|
||||||
return function xml_template_999_SomeComponent(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
ctx = Object.create(ctx);
|
ctx = Object.create(ctx);
|
||||||
ctx[isBoundary] = 1
|
ctx[isBoundary] = 1
|
||||||
setContextValue(ctx, \\"label\\", withDefault(false, \`translated\`));
|
setContextValue(ctx, \\"label\\", withDefault(false, \`translated\`));
|
||||||
@@ -154,11 +145,10 @@ exports[`translation support translation is done on the trimmed text, with extra
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_999\\"
|
|
||||||
|
|
||||||
let block1 = createBlock(\`<div> mot </div>\`);
|
let block1 = createBlock(\`<div> mot </div>\`);
|
||||||
|
|
||||||
return function xml_template_999_SomeComponent(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
return block1();
|
return block1();
|
||||||
}
|
}
|
||||||
}"
|
}"
|
||||||
@@ -168,11 +158,10 @@ exports[`translation support translation works, even if initial string has inner
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_999\\"
|
|
||||||
|
|
||||||
let block1 = createBlock(\`<div>un mot</div>\`);
|
let block1 = createBlock(\`<div>un mot</div>\`);
|
||||||
|
|
||||||
return function xml_template_999_SomeComponent(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
return block1();
|
return block1();
|
||||||
}
|
}
|
||||||
}"
|
}"
|
||||||
|
|||||||
@@ -26,4 +26,19 @@ describe("comments", () => {
|
|||||||
</div>`;
|
</div>`;
|
||||||
expect(renderToString(template)).toBe("<div><span>true</span></div>");
|
expect(renderToString(template)).toBe("<div><span>true</span></div>");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test("comment node with backslash at top level", () => {
|
||||||
|
const template = "<!-- \\ -->";
|
||||||
|
expect(renderToString(template)).toBe("<!-- \\ -->");
|
||||||
|
});
|
||||||
|
|
||||||
|
test("comment node with backtick at top-level", () => {
|
||||||
|
const template = "<!-- ` -->";
|
||||||
|
expect(renderToString(template)).toBe("<!-- ` -->");
|
||||||
|
});
|
||||||
|
|
||||||
|
test("comment node with interpolation sigil at top level", () => {
|
||||||
|
const template = "<!-- ${very cool} -->";
|
||||||
|
expect(renderToString(template)).toBe("<!-- ${very cool} -->");
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -174,6 +174,9 @@ describe("expression evaluation", () => {
|
|||||||
expect(compileExpr("list.data.map((data) => data)")).toBe(
|
expect(compileExpr("list.data.map((data) => data)")).toBe(
|
||||||
"ctx['list'].data.map((_data)=>_data)"
|
"ctx['list'].data.map((_data)=>_data)"
|
||||||
);
|
);
|
||||||
|
expect(compileExpr("(ev) => { myFunc(v1, v2, ev.target.value); }")).toBe(
|
||||||
|
"(_ev)=>{ctx['myFunc'](ctx['v1'],ctx['v2'],_ev.target.value);}"
|
||||||
|
);
|
||||||
});
|
});
|
||||||
test.skip("arrow functions: not yet supported", () => {
|
test.skip("arrow functions: not yet supported", () => {
|
||||||
// e is added to localvars in inline_expression but not removed after the arrow func body
|
// e is added to localvars in inline_expression but not removed after the arrow func body
|
||||||
|
|||||||
@@ -154,4 +154,19 @@ describe("simple templates, mostly static", () => {
|
|||||||
</div>`;
|
</div>`;
|
||||||
expect(renderToString(template, { a: "a", b: "b", c: "c" })).toBe("<div>abLoadingc</div>");
|
expect(renderToString(template, { a: "a", b: "b", c: "c" })).toBe("<div>abLoadingc</div>");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test("text node with backslash at top level", () => {
|
||||||
|
const template = "\\";
|
||||||
|
expect(renderToString(template)).toBe("\\");
|
||||||
|
});
|
||||||
|
|
||||||
|
test("text node with backtick at top-level", () => {
|
||||||
|
const template = "`";
|
||||||
|
expect(renderToString(template)).toBe("`");
|
||||||
|
});
|
||||||
|
|
||||||
|
test("text node with interpolation sigil at top level", () => {
|
||||||
|
const template = "${very cool}";
|
||||||
|
expect(renderToString(template)).toBe("${very cool}");
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -9,20 +9,20 @@ describe("properly support svg", () => {
|
|||||||
test("add proper namespace to svg", () => {
|
test("add proper namespace to svg", () => {
|
||||||
const template = `<svg width="100px" height="90px"><circle cx="50" cy="50" r="4" stroke="green" stroke-width="1" fill="yellow"/> </svg>`;
|
const template = `<svg width="100px" height="90px"><circle cx="50" cy="50" r="4" stroke="green" stroke-width="1" fill="yellow"/> </svg>`;
|
||||||
expect(renderToString(template)).toBe(
|
expect(renderToString(template)).toBe(
|
||||||
`<svg width=\"100px\" height=\"90px\"><circle cx=\"50\" cy=\"50\" r=\"4\" stroke=\"green\" stroke-width=\"1\" fill=\"yellow\"></circle> </svg>`
|
`<svg xmlns="http://www.w3.org/2000/svg" width="100px" height="90px"><circle cx="50" cy="50" r="4" stroke="green" stroke-width="1" fill="yellow"></circle> </svg>`
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
test("add proper namespace to g tags", () => {
|
test("add proper namespace to g tags", () => {
|
||||||
const template = `<g><circle cx="50" cy="50" r="4" stroke="green" stroke-width="1" fill="yellow"/> </g>`;
|
const template = `<g><circle cx="50" cy="50" r="4" stroke="green" stroke-width="1" fill="yellow"/> </g>`;
|
||||||
expect(renderToString(template)).toBe(
|
expect(renderToString(template)).toBe(
|
||||||
`<g><circle cx=\"50\" cy=\"50\" r=\"4\" stroke=\"green\" stroke-width=\"1\" fill=\"yellow\"></circle> </g>`
|
`<g xmlns="http://www.w3.org/2000/svg"><circle cx="50" cy="50" r="4" stroke="green" stroke-width="1" fill="yellow"></circle> </g>`
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
test("namespace to g tags not added if already in svg namespace", () => {
|
test("namespace to g tags not added if already in svg namespace", () => {
|
||||||
const template = `<svg><g/></svg>`;
|
const template = `<svg><g/></svg>`;
|
||||||
expect(renderToString(template)).toBe(`<svg><g></g></svg>`);
|
expect(renderToString(template)).toBe(`<svg xmlns="http://www.w3.org/2000/svg"><g></g></svg>`);
|
||||||
});
|
});
|
||||||
|
|
||||||
test("namespace to svg tags added even if already in svg namespace", () => {
|
test("namespace to svg tags added even if already in svg namespace", () => {
|
||||||
@@ -41,8 +41,13 @@ describe("properly support svg", () => {
|
|||||||
test("svg namespace added to sub-blocks", () => {
|
test("svg namespace added to sub-blocks", () => {
|
||||||
const template = `<svg><path t-if="path"/></svg>`;
|
const template = `<svg><path t-if="path"/></svg>`;
|
||||||
|
|
||||||
expect(renderToString(template, { path: false })).toBe(`<svg></svg>`);
|
expect(renderToString(template, { path: false })).toBe(
|
||||||
expect(renderToString(template, { path: true })).toBe(`<svg><path></path></svg>`);
|
`<svg xmlns="http://www.w3.org/2000/svg"></svg>`
|
||||||
|
);
|
||||||
|
// Because the path is its own block, it has its own xmlns attribute
|
||||||
|
expect(renderToString(template, { path: true })).toBe(
|
||||||
|
`<svg xmlns="http://www.w3.org/2000/svg"><path xmlns="http://www.w3.org/2000/svg"></path></svg>`
|
||||||
|
);
|
||||||
|
|
||||||
const bdom = renderToBdom(template, { path: true });
|
const bdom = renderToBdom(template, { path: true });
|
||||||
const fixture = makeTestFixture();
|
const fixture = makeTestFixture();
|
||||||
|
|||||||
@@ -430,6 +430,48 @@ describe("t-call (template calling)", () => {
|
|||||||
expect(context.renderToString("main")).toBe(expected);
|
expect(context.renderToString("main")).toBe(expected);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test("root t-call with body: t-if true", () => {
|
||||||
|
const context = new TestContext();
|
||||||
|
const subTemplate = `sub`;
|
||||||
|
const main = `<t t-call="subTemplate"><t t-if="true">zero</t></t>`;
|
||||||
|
context.addTemplate("subTemplate", subTemplate);
|
||||||
|
context.addTemplate("main", main);
|
||||||
|
const expected = "sub";
|
||||||
|
expect(context.renderToString("main")).toBe(expected);
|
||||||
|
});
|
||||||
|
|
||||||
|
test("root t-call with body: t-if false", () => {
|
||||||
|
const context = new TestContext();
|
||||||
|
const subTemplate = `sub`;
|
||||||
|
const main = `<t t-call="subTemplate"><t t-if="false">zero</t></t>`;
|
||||||
|
context.addTemplate("subTemplate", subTemplate);
|
||||||
|
context.addTemplate("main", main);
|
||||||
|
const expected = "sub";
|
||||||
|
expect(context.renderToString("main")).toBe(expected);
|
||||||
|
});
|
||||||
|
|
||||||
|
test("root t-call with body: t-out with default", () => {
|
||||||
|
const context = new TestContext();
|
||||||
|
const subTemplate = `sub`;
|
||||||
|
const main = `<t t-call="subTemplate"><t t-out="nothing">default</t></t>`;
|
||||||
|
context.addTemplate("subTemplate", subTemplate);
|
||||||
|
context.addTemplate("main", main);
|
||||||
|
const expected = "sub";
|
||||||
|
expect(context.renderToString("main")).toBe(expected);
|
||||||
|
});
|
||||||
|
|
||||||
|
test("root t-call with body: t-foreach", () => {
|
||||||
|
const context = new TestContext();
|
||||||
|
const subTemplate = `sub`;
|
||||||
|
const main = `<t t-call="subTemplate">
|
||||||
|
<t t-foreach="[1]" t-as="i" t-key="i">1</t>
|
||||||
|
</t>`;
|
||||||
|
context.addTemplate("subTemplate", subTemplate);
|
||||||
|
context.addTemplate("main", main);
|
||||||
|
const expected = "sub";
|
||||||
|
expect(context.renderToString("main")).toBe(expected);
|
||||||
|
});
|
||||||
|
|
||||||
test("dynamic t-call", () => {
|
test("dynamic t-call", () => {
|
||||||
const context = new TestContext();
|
const context = new TestContext();
|
||||||
const foo = `<foo><t t-esc="val"/></foo>`;
|
const foo = `<foo><t t-esc="val"/></foo>`;
|
||||||
|
|||||||
@@ -121,4 +121,19 @@ describe("t-esc", () => {
|
|||||||
mount(bdom, fixture);
|
mount(bdom, fixture);
|
||||||
expect(fixture.querySelector("span")!.textContent).toBe("<p>escaped</p>");
|
expect(fixture.querySelector("span")!.textContent).toBe("<p>escaped</p>");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test("default with backslash at top level", () => {
|
||||||
|
const template = '<t t-esc="undefined">\\</t>';
|
||||||
|
expect(renderToString(template)).toBe("\\");
|
||||||
|
});
|
||||||
|
|
||||||
|
test("default with backtick at top-level", () => {
|
||||||
|
const template = '<t t-esc="undefined">`</t>';
|
||||||
|
expect(renderToString(template)).toBe("`");
|
||||||
|
});
|
||||||
|
|
||||||
|
test("default with interpolation sigil at top level", () => {
|
||||||
|
const template = '<t t-esc="undefined">${very cool}</t>';
|
||||||
|
expect(renderToString(template)).toBe("${very cool}");
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -110,7 +110,7 @@ describe("t-foreach", () => {
|
|||||||
<t t-foreach="value" t-as="item" t-key="item_index">
|
<t t-foreach="value" t-as="item" t-key="item_index">
|
||||||
[<t t-esc="item_index"/>: <t t-esc="item"/> <t t-esc="item_value"/>]
|
[<t t-esc="item_index"/>: <t t-esc="item"/> <t t-esc="item_value"/>]
|
||||||
</t>`;
|
</t>`;
|
||||||
const expected = ` [0: 1 a] [1: 2 b] [2: 3 c] `;
|
const expected = ` [0: a 1] [1: b 2] [2: c 3] `;
|
||||||
const context = {
|
const context = {
|
||||||
value: new Map([
|
value: new Map([
|
||||||
["a", 1],
|
["a", 1],
|
||||||
@@ -131,6 +131,15 @@ describe("t-foreach", () => {
|
|||||||
expect(renderToString(template, context)).toBe(expected);
|
expect(renderToString(template, context)).toBe(expected);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test("iterate, string param", () => {
|
||||||
|
const template = `
|
||||||
|
<t t-foreach="'abc'" t-as="item" t-key="item_index">
|
||||||
|
[<t t-esc="item_index"/>: <t t-esc="item"/> <t t-esc="item_value"/>]
|
||||||
|
</t>`;
|
||||||
|
const expected = ` [0: a a] [1: b b] [2: c c] `;
|
||||||
|
expect(renderToString(template)).toBe(expected);
|
||||||
|
});
|
||||||
|
|
||||||
test("iterate, iterable param", () => {
|
test("iterate, iterable param", () => {
|
||||||
const template = `
|
const template = `
|
||||||
<t t-foreach="map.values()" t-as="item" t-key="item_index">
|
<t t-foreach="map.values()" t-as="item" t-key="item_index">
|
||||||
|
|||||||
@@ -54,6 +54,21 @@ describe("t-set", () => {
|
|||||||
expect(renderToString(template)).toBe("ok");
|
expect(renderToString(template)).toBe("ok");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test("body with backslash at top level", () => {
|
||||||
|
const template = '<t t-set="value">\\</t><t t-esc="value"/>';
|
||||||
|
expect(renderToString(template)).toBe("\\");
|
||||||
|
});
|
||||||
|
|
||||||
|
test("body with backtick at top-level", () => {
|
||||||
|
const template = '<t t-set="value">`</t><t t-esc="value"/>';
|
||||||
|
expect(renderToString(template)).toBe("`");
|
||||||
|
});
|
||||||
|
|
||||||
|
test("body with interpolation sigil at top level", () => {
|
||||||
|
const template = '<t t-set="value">${very cool}</t><t t-esc="value"/>';
|
||||||
|
expect(renderToString(template)).toBe("${very cool}");
|
||||||
|
});
|
||||||
|
|
||||||
test("set from body literal (with t-if/t-else", () => {
|
test("set from body literal (with t-if/t-else", () => {
|
||||||
const template = `
|
const template = `
|
||||||
<t>
|
<t>
|
||||||
|
|||||||
@@ -78,4 +78,62 @@ describe("loading templates", () => {
|
|||||||
context.addTemplates(xml);
|
context.addTemplates(xml);
|
||||||
expect(Object.keys(context.rawTemplates)).toEqual([]);
|
expect(Object.keys(context.rawTemplates)).toEqual([]);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test("getTemplate: element returned", () => {
|
||||||
|
const context = new TestContext({
|
||||||
|
getTemplate: (name) => {
|
||||||
|
if (name === "main") {
|
||||||
|
const data = `<div>Hello World!</div>`;
|
||||||
|
const xml = new DOMParser().parseFromString(data, "text/xml");
|
||||||
|
return xml.firstChild as Element;
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
},
|
||||||
|
});
|
||||||
|
const result = context.renderToString("main");
|
||||||
|
expect(result).toBe("<div>Hello World!</div>");
|
||||||
|
});
|
||||||
|
|
||||||
|
test("getTemplate: element returned (2)", () => {
|
||||||
|
const context = new TestContext({
|
||||||
|
getTemplate: (name) => {
|
||||||
|
if (name === "main") {
|
||||||
|
const doc = new Document();
|
||||||
|
const div = doc.createElement("div");
|
||||||
|
div.append(doc.createTextNode("Hello World!"));
|
||||||
|
return div;
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
},
|
||||||
|
});
|
||||||
|
const result = context.renderToString("main");
|
||||||
|
expect(result).toBe("<div>Hello World!</div>");
|
||||||
|
});
|
||||||
|
|
||||||
|
test("getTemplate: template string returned", () => {
|
||||||
|
const context = new TestContext({
|
||||||
|
getTemplate: (name) => {
|
||||||
|
if (name === "main") {
|
||||||
|
return `<div>Hello World!</div>`;
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
},
|
||||||
|
});
|
||||||
|
const result = context.renderToString("main");
|
||||||
|
expect(result).toBe("<div>Hello World!</div>");
|
||||||
|
});
|
||||||
|
|
||||||
|
test("getTemplate: undefined returned", () => {
|
||||||
|
const context = new TestContext({
|
||||||
|
getTemplate: () => {},
|
||||||
|
});
|
||||||
|
const data = `<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<templates id="template" xml:space="preserve">
|
||||||
|
<div t-name="main">Hello World!</div>
|
||||||
|
</templates>`;
|
||||||
|
const xml = new DOMParser().parseFromString(data, "text/xml");
|
||||||
|
context.addTemplates(xml);
|
||||||
|
const result = context.renderToString("main");
|
||||||
|
expect(result).toBe("<div>Hello World!</div>");
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -11,8 +11,8 @@ describe("basic validation", () => {
|
|||||||
expect(() => context.getTemplate("invalidname")).toThrow("Missing template");
|
expect(() => context.getTemplate("invalidname")).toThrow("Missing template");
|
||||||
});
|
});
|
||||||
|
|
||||||
test("cannot add a different template with the same name", () => {
|
test("cannot add a different template with the same name in dev mode", () => {
|
||||||
const context = new TemplateSet();
|
const context = new TemplateSet({ dev: true });
|
||||||
context.addTemplate("test", `<t/>`);
|
context.addTemplate("test", `<t/>`);
|
||||||
// Same template with the same name is fine
|
// Same template with the same name is fine
|
||||||
expect(() => context.addTemplate("test", "<t/>")).not.toThrow();
|
expect(() => context.addTemplate("test", "<t/>")).not.toThrow();
|
||||||
@@ -20,6 +20,13 @@ describe("basic validation", () => {
|
|||||||
expect(() => context.addTemplate("test", "<div/>")).toThrow("already defined");
|
expect(() => context.addTemplate("test", "<div/>")).toThrow("already defined");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test("adding different template with same name outside dev mode silently ignores it", () => {
|
||||||
|
const context = new TemplateSet({ dev: false });
|
||||||
|
context.addTemplate("test", `<t/>`);
|
||||||
|
expect(() => context.addTemplate("test", "<div/>")).not.toThrow();
|
||||||
|
expect(context.rawTemplates.test).toBe("<t/>");
|
||||||
|
});
|
||||||
|
|
||||||
test("invalid xml", () => {
|
test("invalid xml", () => {
|
||||||
const template = "<div>";
|
const template = "<div>";
|
||||||
expect(() => snapshotTemplate(template)).toThrow("Invalid XML in template");
|
expect(() => snapshotTemplate(template)).toThrow("Invalid XML in template");
|
||||||
|
|||||||
@@ -4,11 +4,10 @@ exports[`event handling Invalid handler throws an error 1`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_999\\"
|
|
||||||
|
|
||||||
let block1 = createBlock(\`<button block-handler-0=\\"click\\">click</button>\`);
|
let block1 = createBlock(\`<button block-handler-0=\\"click\\">click</button>\`);
|
||||||
|
|
||||||
return function xml_template_999_Parent(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
let hdlr1 = [ctx['dosomething'], ctx];
|
let hdlr1 = [ctx['dosomething'], ctx];
|
||||||
return block1([hdlr1]);
|
return block1([hdlr1]);
|
||||||
}
|
}
|
||||||
@@ -19,11 +18,10 @@ exports[`event handling handler is not called if component is destroyed 1`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_999\\"
|
|
||||||
|
|
||||||
let block1 = createBlock(\`<span block-handler-0=\\"click\\"/>\`);
|
let block1 = createBlock(\`<span block-handler-0=\\"click\\"/>\`);
|
||||||
|
|
||||||
return function xml_template_999_Parent(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
let hdlr1 = [ctx['click'], ctx];
|
let hdlr1 = [ctx['click'], ctx];
|
||||||
return block1([hdlr1]);
|
return block1([hdlr1]);
|
||||||
}
|
}
|
||||||
@@ -34,12 +32,11 @@ exports[`event handling handler receive the event as argument 1`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_1000\\"
|
|
||||||
const comp1 = app.createComponent(\`Child\`, true, false, false, []);
|
const comp1 = app.createComponent(\`Child\`, true, false, false, []);
|
||||||
|
|
||||||
let block1 = createBlock(\`<span block-handler-0=\\"click\\"><block-child-0/><block-text-1/></span>\`);
|
let block1 = createBlock(\`<span block-handler-0=\\"click\\"><block-child-0/><block-text-1/></span>\`);
|
||||||
|
|
||||||
return function xml_template_1000_Parent(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
let hdlr1 = [ctx['inc'], ctx];
|
let hdlr1 = [ctx['inc'], ctx];
|
||||||
const b2 = comp1({}, key + \`__1\`, node, this, null);
|
const b2 = comp1({}, key + \`__1\`, node, this, null);
|
||||||
let txt1 = ctx['state'].value;
|
let txt1 = ctx['state'].value;
|
||||||
@@ -52,11 +49,10 @@ exports[`event handling handler receive the event as argument 2`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_999\\"
|
|
||||||
|
|
||||||
let block1 = createBlock(\`<div>simple vnode</div>\`);
|
let block1 = createBlock(\`<div>simple vnode</div>\`);
|
||||||
|
|
||||||
return function xml_template_999_Child(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
return block1();
|
return block1();
|
||||||
}
|
}
|
||||||
}"
|
}"
|
||||||
@@ -66,11 +62,10 @@ exports[`event handling handler works when app is mounted in an iframe 1`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_999\\"
|
|
||||||
|
|
||||||
let block1 = createBlock(\`<span block-handler-0=\\"click\\">click me</span>\`);
|
let block1 = createBlock(\`<span block-handler-0=\\"click\\">click me</span>\`);
|
||||||
|
|
||||||
return function xml_template_999_Parent(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
let hdlr1 = [ctx['inc'], ctx];
|
let hdlr1 = [ctx['inc'], ctx];
|
||||||
return block1([hdlr1]);
|
return block1([hdlr1]);
|
||||||
}
|
}
|
||||||
@@ -81,12 +76,11 @@ exports[`event handling input blur event is not called if component is destroyed
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_1000\\"
|
|
||||||
const comp1 = app.createComponent(\`Child\`, true, false, false, []);
|
const comp1 = app.createComponent(\`Child\`, true, false, false, []);
|
||||||
|
|
||||||
let block1 = createBlock(\`<div><block-child-0/><textarea/></div>\`);
|
let block1 = createBlock(\`<div><block-child-0/><textarea/></div>\`);
|
||||||
|
|
||||||
return function xml_template_1000_Parent(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
let b2;
|
let b2;
|
||||||
if (ctx['state'].cond) {
|
if (ctx['state'].cond) {
|
||||||
b2 = comp1({}, key + \`__1\`, node, this, null);
|
b2 = comp1({}, key + \`__1\`, node, this, null);
|
||||||
@@ -100,11 +94,10 @@ exports[`event handling input blur event is not called if component is destroyed
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_999\\"
|
|
||||||
|
|
||||||
let block1 = createBlock(\`<input block-handler-0=\\"blur\\"/>\`);
|
let block1 = createBlock(\`<input block-handler-0=\\"blur\\"/>\`);
|
||||||
|
|
||||||
return function xml_template_999_Child(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
let hdlr1 = [ctx['blur'], ctx];
|
let hdlr1 = [ctx['blur'], ctx];
|
||||||
return block1([hdlr1]);
|
return block1([hdlr1]);
|
||||||
}
|
}
|
||||||
@@ -116,16 +109,15 @@ exports[`event handling objects from scope are properly captured by t-on 1`] = `
|
|||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
let { prepareList, withKey } = helpers;
|
let { prepareList, withKey } = helpers;
|
||||||
// Template name: \\"xml_template_999\\"
|
|
||||||
|
|
||||||
let block1 = createBlock(\`<div><block-child-0/></div>\`);
|
let block1 = createBlock(\`<div><block-child-0/></div>\`);
|
||||||
let block3 = createBlock(\`<div class=\\"item\\" block-handler-0=\\"click\\"/>\`);
|
let block3 = createBlock(\`<div class=\\"item\\" block-handler-0=\\"click\\"/>\`);
|
||||||
|
|
||||||
return function xml_template_999_Parent(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
ctx = Object.create(ctx);
|
ctx = Object.create(ctx);
|
||||||
const [k_block2, v_block2, l_block2, c_block2] = prepareList(ctx['items']);;
|
const [k_block2, v_block2, l_block2, c_block2] = prepareList(ctx['items']);;
|
||||||
for (let i1 = 0; i1 < l_block2; i1++) {
|
for (let i1 = 0; i1 < l_block2; i1++) {
|
||||||
ctx[\`item\`] = v_block2[i1];
|
ctx[\`item\`] = k_block2[i1];
|
||||||
const key1 = ctx['item'];
|
const key1 = ctx['item'];
|
||||||
const v1 = ctx['onClick'];
|
const v1 = ctx['onClick'];
|
||||||
const v2 = ctx['item'];
|
const v2 = ctx['item'];
|
||||||
@@ -142,11 +134,10 @@ exports[`event handling support for callable expression in event handler 1`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_999\\"
|
|
||||||
|
|
||||||
let block1 = createBlock(\`<div><block-text-0/><input type=\\"text\\" block-handler-1=\\"input\\"/></div>\`);
|
let block1 = createBlock(\`<div><block-text-0/><input type=\\"text\\" block-handler-1=\\"input\\"/></div>\`);
|
||||||
|
|
||||||
return function xml_template_999_Counter(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
let txt1 = ctx['state'].value;
|
let txt1 = ctx['state'].value;
|
||||||
let hdlr1 = [ctx['obj'].onInput, ctx];
|
let hdlr1 = [ctx['obj'].onInput, ctx];
|
||||||
return block1([txt1, hdlr1]);
|
return block1([txt1, hdlr1]);
|
||||||
@@ -159,16 +150,15 @@ exports[`event handling t-on with handler bound to dynamic argument on a t-forea
|
|||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
let { prepareList, withKey } = helpers;
|
let { prepareList, withKey } = helpers;
|
||||||
// Template name: \\"xml_template_999\\"
|
|
||||||
|
|
||||||
let block1 = createBlock(\`<div><block-child-0/></div>\`);
|
let block1 = createBlock(\`<div><block-child-0/></div>\`);
|
||||||
let block3 = createBlock(\`<div class=\\"item\\" block-handler-0=\\"click\\"/>\`);
|
let block3 = createBlock(\`<div class=\\"item\\" block-handler-0=\\"click\\"/>\`);
|
||||||
|
|
||||||
return function xml_template_999_Parent(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
ctx = Object.create(ctx);
|
ctx = Object.create(ctx);
|
||||||
const [k_block2, v_block2, l_block2, c_block2] = prepareList(ctx['items']);;
|
const [k_block2, v_block2, l_block2, c_block2] = prepareList(ctx['items']);;
|
||||||
for (let i1 = 0; i1 < l_block2; i1++) {
|
for (let i1 = 0; i1 < l_block2; i1++) {
|
||||||
ctx[\`item\`] = v_block2[i1];
|
ctx[\`item\`] = k_block2[i1];
|
||||||
const key1 = ctx['item'];
|
const key1 = ctx['item'];
|
||||||
const v1 = ctx['onClick'];
|
const v1 = ctx['onClick'];
|
||||||
const v2 = ctx['item'];
|
const v2 = ctx['item'];
|
||||||
|
|||||||
@@ -4,10 +4,9 @@ exports[`basics basic use 1`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_1000\\"
|
|
||||||
const comp1 = app.createComponent(\`Child\`, true, false, false, [\\"p\\"]);
|
const comp1 = app.createComponent(\`Child\`, true, false, false, [\\"p\\"]);
|
||||||
|
|
||||||
return function xml_template_1000_Parent(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
return comp1({p: 1}, key + \`__1\`, node, this, null);
|
return comp1({p: 1}, key + \`__1\`, node, this, null);
|
||||||
}
|
}
|
||||||
}"
|
}"
|
||||||
@@ -17,11 +16,10 @@ exports[`basics basic use 2`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_999\\"
|
|
||||||
|
|
||||||
let block1 = createBlock(\`<span>child<block-text-0/></span>\`);
|
let block1 = createBlock(\`<span>child<block-text-0/></span>\`);
|
||||||
|
|
||||||
return function xml_template_999_Child(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
let txt1 = ctx['props'].p;
|
let txt1 = ctx['props'].p;
|
||||||
return block1([txt1]);
|
return block1([txt1]);
|
||||||
}
|
}
|
||||||
@@ -32,12 +30,11 @@ exports[`basics can select a sub widget 1`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_1001\\"
|
|
||||||
const comp1 = app.createComponent(\`Child\`, true, false, false, []);
|
const comp1 = app.createComponent(\`Child\`, true, false, false, []);
|
||||||
const comp2 = app.createComponent(\`OtherChild\`, true, false, false, []);
|
const comp2 = app.createComponent(\`OtherChild\`, true, false, false, []);
|
||||||
|
|
||||||
return function xml_template_1001_Parent(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
let b2,b3;
|
let b2, b3;
|
||||||
if (ctx['env'].options.flag) {
|
if (ctx['env'].options.flag) {
|
||||||
b2 = comp1({}, key + \`__1\`, node, this, null);
|
b2 = comp1({}, key + \`__1\`, node, this, null);
|
||||||
}
|
}
|
||||||
@@ -53,11 +50,10 @@ exports[`basics can select a sub widget 2`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_999\\"
|
|
||||||
|
|
||||||
let block1 = createBlock(\`<span>CHILD 1</span>\`);
|
let block1 = createBlock(\`<span>CHILD 1</span>\`);
|
||||||
|
|
||||||
return function xml_template_999_Child(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
return block1();
|
return block1();
|
||||||
}
|
}
|
||||||
}"
|
}"
|
||||||
@@ -67,11 +63,10 @@ exports[`basics can select a sub widget 3`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_1000\\"
|
|
||||||
|
|
||||||
let block1 = createBlock(\`<div>CHILD 2</div>\`);
|
let block1 = createBlock(\`<div>CHILD 2</div>\`);
|
||||||
|
|
||||||
return function xml_template_1000_OtherChild(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
return block1();
|
return block1();
|
||||||
}
|
}
|
||||||
}"
|
}"
|
||||||
@@ -81,12 +76,11 @@ exports[`basics can select a sub widget, part 2 1`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_1001\\"
|
|
||||||
const comp1 = app.createComponent(\`Child\`, true, false, false, []);
|
const comp1 = app.createComponent(\`Child\`, true, false, false, []);
|
||||||
const comp2 = app.createComponent(\`OtherChild\`, true, false, false, []);
|
const comp2 = app.createComponent(\`OtherChild\`, true, false, false, []);
|
||||||
|
|
||||||
return function xml_template_1001_Parent(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
let b2,b3;
|
let b2, b3;
|
||||||
if (ctx['state'].flag) {
|
if (ctx['state'].flag) {
|
||||||
b2 = comp1({}, key + \`__1\`, node, this, null);
|
b2 = comp1({}, key + \`__1\`, node, this, null);
|
||||||
}
|
}
|
||||||
@@ -102,11 +96,10 @@ exports[`basics can select a sub widget, part 2 2`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_999\\"
|
|
||||||
|
|
||||||
let block1 = createBlock(\`<span>CHILD 1</span>\`);
|
let block1 = createBlock(\`<span>CHILD 1</span>\`);
|
||||||
|
|
||||||
return function xml_template_999_Child(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
return block1();
|
return block1();
|
||||||
}
|
}
|
||||||
}"
|
}"
|
||||||
@@ -116,11 +109,10 @@ exports[`basics can select a sub widget, part 2 3`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_1000\\"
|
|
||||||
|
|
||||||
let block1 = createBlock(\`<div>CHILD 2</div>\`);
|
let block1 = createBlock(\`<div>CHILD 2</div>\`);
|
||||||
|
|
||||||
return function xml_template_1000_OtherChild(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
return block1();
|
return block1();
|
||||||
}
|
}
|
||||||
}"
|
}"
|
||||||
@@ -130,10 +122,9 @@ exports[`basics sub widget is interactive 1`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_1000\\"
|
|
||||||
const comp1 = app.createComponent(\`Child\`, true, false, false, [\\"p\\"]);
|
const comp1 = app.createComponent(\`Child\`, true, false, false, [\\"p\\"]);
|
||||||
|
|
||||||
return function xml_template_1000_Parent(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
return comp1({p: 1}, key + \`__1\`, node, this, null);
|
return comp1({p: 1}, key + \`__1\`, node, this, null);
|
||||||
}
|
}
|
||||||
}"
|
}"
|
||||||
@@ -143,11 +134,10 @@ exports[`basics sub widget is interactive 2`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_999\\"
|
|
||||||
|
|
||||||
let block1 = createBlock(\`<span><button block-handler-0=\\"click\\">click</button>child<block-text-1/></span>\`);
|
let block1 = createBlock(\`<span><button block-handler-0=\\"click\\">click</button>child<block-text-1/></span>\`);
|
||||||
|
|
||||||
return function xml_template_999_Child(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
let hdlr1 = [ctx['inc'], ctx];
|
let hdlr1 = [ctx['inc'], ctx];
|
||||||
let txt1 = ctx['state'].val;
|
let txt1 = ctx['state'].val;
|
||||||
return block1([hdlr1, txt1]);
|
return block1([hdlr1, txt1]);
|
||||||
@@ -159,12 +149,11 @@ exports[`basics top level sub widget with a parent 1`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_1001\\"
|
|
||||||
const comp1 = app.createComponent(\`ComponentB\`, true, false, false, []);
|
const comp1 = app.createComponent(\`ComponentB\`, true, false, false, []);
|
||||||
|
|
||||||
let block1 = createBlock(\`<div><block-child-0/></div>\`);
|
let block1 = createBlock(\`<div><block-child-0/></div>\`);
|
||||||
|
|
||||||
return function xml_template_1001_ComponentA(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
const b2 = comp1({}, key + \`__1\`, node, this, null);
|
const b2 = comp1({}, key + \`__1\`, node, this, null);
|
||||||
return block1([], [b2]);
|
return block1([], [b2]);
|
||||||
}
|
}
|
||||||
@@ -175,10 +164,9 @@ exports[`basics top level sub widget with a parent 2`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_1000\\"
|
|
||||||
const comp1 = app.createComponent(\`ComponentC\`, true, false, false, []);
|
const comp1 = app.createComponent(\`ComponentC\`, true, false, false, []);
|
||||||
|
|
||||||
return function xml_template_1000_ComponentB(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
return comp1({}, key + \`__1\`, node, this, null);
|
return comp1({}, key + \`__1\`, node, this, null);
|
||||||
}
|
}
|
||||||
}"
|
}"
|
||||||
@@ -188,11 +176,10 @@ exports[`basics top level sub widget with a parent 3`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_999\\"
|
|
||||||
|
|
||||||
let block1 = createBlock(\`<span>Hello</span>\`);
|
let block1 = createBlock(\`<span>Hello</span>\`);
|
||||||
|
|
||||||
return function xml_template_999_ComponentC(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
return block1();
|
return block1();
|
||||||
}
|
}
|
||||||
}"
|
}"
|
||||||
|
|||||||
@@ -4,12 +4,11 @@ exports[`hooks autofocus hook input in a t-if 1`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_999\\"
|
|
||||||
|
|
||||||
let block1 = createBlock(\`<div><input block-ref=\\"0\\"/><block-child-0/></div>\`);
|
let block1 = createBlock(\`<div><input block-ref=\\"0\\"/><block-child-0/></div>\`);
|
||||||
let block2 = createBlock(\`<input block-ref=\\"0\\"/>\`);
|
let block2 = createBlock(\`<input block-ref=\\"0\\"/>\`);
|
||||||
|
|
||||||
return function xml_template_999_Test(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
let b2;
|
let b2;
|
||||||
let ref1 = (el) => this.__owl__.setRef((\`input1\`), el);
|
let ref1 = (el) => this.__owl__.setRef((\`input1\`), el);
|
||||||
if (ctx['state'].flag) {
|
if (ctx['state'].flag) {
|
||||||
@@ -25,11 +24,10 @@ exports[`hooks autofocus hook simple input 1`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_999\\"
|
|
||||||
|
|
||||||
let block1 = createBlock(\`<div><input block-ref=\\"0\\"/><input block-ref=\\"1\\"/></div>\`);
|
let block1 = createBlock(\`<div><input block-ref=\\"0\\"/><input block-ref=\\"1\\"/></div>\`);
|
||||||
|
|
||||||
return function xml_template_999_Test(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
let ref1 = (el) => this.__owl__.setRef((\`input1\`), el);
|
let ref1 = (el) => this.__owl__.setRef((\`input1\`), el);
|
||||||
let ref2 = (el) => this.__owl__.setRef((\`input2\`), el);
|
let ref2 = (el) => this.__owl__.setRef((\`input2\`), el);
|
||||||
return block1([ref1, ref2]);
|
return block1([ref1, ref2]);
|
||||||
@@ -41,10 +39,9 @@ exports[`hooks can use onWillStart, onWillUpdateProps 1`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_1000\\"
|
|
||||||
const comp1 = app.createComponent(\`MyComponent\`, true, false, false, [\\"value\\"]);
|
const comp1 = app.createComponent(\`MyComponent\`, true, false, false, [\\"value\\"]);
|
||||||
|
|
||||||
return function xml_template_1000_App(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
return comp1({value: ctx['state'].value}, key + \`__1\`, node, this, null);
|
return comp1({value: ctx['state'].value}, key + \`__1\`, node, this, null);
|
||||||
}
|
}
|
||||||
}"
|
}"
|
||||||
@@ -54,11 +51,10 @@ exports[`hooks can use onWillStart, onWillUpdateProps 2`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_999\\"
|
|
||||||
|
|
||||||
let block1 = createBlock(\`<span><block-text-0/></span>\`);
|
let block1 = createBlock(\`<span><block-text-0/></span>\`);
|
||||||
|
|
||||||
return function xml_template_999_MyComponent(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
let txt1 = ctx['props'].value;
|
let txt1 = ctx['props'].value;
|
||||||
return block1([txt1]);
|
return block1([txt1]);
|
||||||
}
|
}
|
||||||
@@ -69,11 +65,10 @@ exports[`hooks can use useComponent 1`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_999\\"
|
|
||||||
|
|
||||||
let block1 = createBlock(\`<div/>\`);
|
let block1 = createBlock(\`<div/>\`);
|
||||||
|
|
||||||
return function xml_template_999_Test(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
return block1();
|
return block1();
|
||||||
}
|
}
|
||||||
}"
|
}"
|
||||||
@@ -83,11 +78,10 @@ exports[`hooks can use useEnv 1`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_999\\"
|
|
||||||
|
|
||||||
let block1 = createBlock(\`<div><block-text-0/></div>\`);
|
let block1 = createBlock(\`<div><block-text-0/></div>\`);
|
||||||
|
|
||||||
return function xml_template_999_Test(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
let txt1 = ctx['env'].val;
|
let txt1 = ctx['env'].val;
|
||||||
return block1([txt1]);
|
return block1([txt1]);
|
||||||
}
|
}
|
||||||
@@ -98,11 +92,10 @@ exports[`hooks mounted callbacks should be called in reverse order from willUnmo
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_999\\"
|
|
||||||
|
|
||||||
let block1 = createBlock(\`<div>hey<block-text-0/></div>\`);
|
let block1 = createBlock(\`<div>hey<block-text-0/></div>\`);
|
||||||
|
|
||||||
return function xml_template_999_Test(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
let txt1 = ctx['state'].value;
|
let txt1 = ctx['state'].value;
|
||||||
return block1([txt1]);
|
return block1([txt1]);
|
||||||
}
|
}
|
||||||
@@ -113,10 +106,9 @@ exports[`hooks parent and child env (with useChildSubEnv then useSubEnv) 1`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_1000\\"
|
|
||||||
const comp1 = app.createComponent(\`Child\`, true, false, false, []);
|
const comp1 = app.createComponent(\`Child\`, true, false, false, []);
|
||||||
|
|
||||||
return function xml_template_1000_Parent(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
const b2 = text(ctx['env'].val);
|
const b2 = text(ctx['env'].val);
|
||||||
const b3 = comp1({}, key + \`__1\`, node, this, null);
|
const b3 = comp1({}, key + \`__1\`, node, this, null);
|
||||||
return multi([b2, b3]);
|
return multi([b2, b3]);
|
||||||
@@ -128,11 +120,10 @@ exports[`hooks parent and child env (with useChildSubEnv then useSubEnv) 2`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_999\\"
|
|
||||||
|
|
||||||
let block2 = createBlock(\`<div><block-text-0/></div>\`);
|
let block2 = createBlock(\`<div><block-text-0/></div>\`);
|
||||||
|
|
||||||
return function xml_template_999_Child(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
let b2;
|
let b2;
|
||||||
if (ctx['env'].hasParent) {
|
if (ctx['env'].hasParent) {
|
||||||
let txt1 = ctx['env'].val;
|
let txt1 = ctx['env'].val;
|
||||||
@@ -147,10 +138,9 @@ exports[`hooks parent and child env (with useChildSubEnv) 1`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_1000\\"
|
|
||||||
const comp1 = app.createComponent(\`Child\`, true, false, false, []);
|
const comp1 = app.createComponent(\`Child\`, true, false, false, []);
|
||||||
|
|
||||||
return function xml_template_1000_Parent(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
const b2 = text(ctx['env'].val);
|
const b2 = text(ctx['env'].val);
|
||||||
const b3 = comp1({}, key + \`__1\`, node, this, null);
|
const b3 = comp1({}, key + \`__1\`, node, this, null);
|
||||||
return multi([b2, b3]);
|
return multi([b2, b3]);
|
||||||
@@ -162,11 +152,10 @@ exports[`hooks parent and child env (with useChildSubEnv) 2`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_999\\"
|
|
||||||
|
|
||||||
let block1 = createBlock(\`<div><block-text-0/></div>\`);
|
let block1 = createBlock(\`<div><block-text-0/></div>\`);
|
||||||
|
|
||||||
return function xml_template_999_Child(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
let txt1 = ctx['env'].val;
|
let txt1 = ctx['env'].val;
|
||||||
return block1([txt1]);
|
return block1([txt1]);
|
||||||
}
|
}
|
||||||
@@ -177,10 +166,9 @@ exports[`hooks parent and child env (with useSubEnv) 1`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_1000\\"
|
|
||||||
const comp1 = app.createComponent(\`Child\`, true, false, false, []);
|
const comp1 = app.createComponent(\`Child\`, true, false, false, []);
|
||||||
|
|
||||||
return function xml_template_1000_Parent(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
const b2 = text(ctx['env'].val);
|
const b2 = text(ctx['env'].val);
|
||||||
const b3 = comp1({}, key + \`__1\`, node, this, null);
|
const b3 = comp1({}, key + \`__1\`, node, this, null);
|
||||||
return multi([b2, b3]);
|
return multi([b2, b3]);
|
||||||
@@ -192,11 +180,10 @@ exports[`hooks parent and child env (with useSubEnv) 2`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_999\\"
|
|
||||||
|
|
||||||
let block1 = createBlock(\`<div><block-text-0/></div>\`);
|
let block1 = createBlock(\`<div><block-text-0/></div>\`);
|
||||||
|
|
||||||
return function xml_template_999_Child(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
let txt1 = ctx['env'].val;
|
let txt1 = ctx['env'].val;
|
||||||
return block1([txt1]);
|
return block1([txt1]);
|
||||||
}
|
}
|
||||||
@@ -207,11 +194,10 @@ exports[`hooks two different call to willPatch/patched should work 1`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_999\\"
|
|
||||||
|
|
||||||
let block1 = createBlock(\`<div>hey<block-text-0/></div>\`);
|
let block1 = createBlock(\`<div>hey<block-text-0/></div>\`);
|
||||||
|
|
||||||
return function xml_template_999_Test(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
let txt1 = ctx['state'].value;
|
let txt1 = ctx['state'].value;
|
||||||
return block1([txt1]);
|
return block1([txt1]);
|
||||||
}
|
}
|
||||||
@@ -222,11 +208,10 @@ exports[`hooks useChildSubEnv does not pollute user env 1`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_999\\"
|
|
||||||
|
|
||||||
let block1 = createBlock(\`<div><block-text-0/></div>\`);
|
let block1 = createBlock(\`<div><block-text-0/></div>\`);
|
||||||
|
|
||||||
return function xml_template_999_Test(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
let txt1 = ctx['env'].val;
|
let txt1 = ctx['env'].val;
|
||||||
return block1([txt1]);
|
return block1([txt1]);
|
||||||
}
|
}
|
||||||
@@ -237,10 +222,9 @@ exports[`hooks useChildSubEnv supports arbitrary descriptor 1`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_1000\\"
|
|
||||||
const comp1 = app.createComponent(\`Child\`, true, false, false, []);
|
const comp1 = app.createComponent(\`Child\`, true, false, false, []);
|
||||||
|
|
||||||
return function xml_template_1000_Test(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
return comp1({}, key + \`__1\`, node, this, null);
|
return comp1({}, key + \`__1\`, node, this, null);
|
||||||
}
|
}
|
||||||
}"
|
}"
|
||||||
@@ -250,11 +234,10 @@ exports[`hooks useChildSubEnv supports arbitrary descriptor 2`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_999\\"
|
|
||||||
|
|
||||||
let block1 = createBlock(\`<div><block-text-0/> <block-text-1/></div>\`);
|
let block1 = createBlock(\`<div><block-text-0/> <block-text-1/></div>\`);
|
||||||
|
|
||||||
return function xml_template_999_Child(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
let txt1 = ctx['env'].someVal;
|
let txt1 = ctx['env'].someVal;
|
||||||
let txt2 = ctx['env'].someVal2;
|
let txt2 = ctx['env'].someVal2;
|
||||||
return block1([txt1, txt2]);
|
return block1([txt1, txt2]);
|
||||||
@@ -266,11 +249,10 @@ exports[`hooks useEffect hook dependencies prevent effects from rerunning when u
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_999\\"
|
|
||||||
|
|
||||||
let block1 = createBlock(\`<div/>\`);
|
let block1 = createBlock(\`<div/>\`);
|
||||||
|
|
||||||
return function xml_template_999_MyComponent(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
return block1();
|
return block1();
|
||||||
}
|
}
|
||||||
}"
|
}"
|
||||||
@@ -280,11 +262,10 @@ exports[`hooks useEffect hook effect can depend on stuff in dom 1`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_999\\"
|
|
||||||
|
|
||||||
let block2 = createBlock(\`<div block-ref=\\"0\\"/>\`);
|
let block2 = createBlock(\`<div block-ref=\\"0\\"/>\`);
|
||||||
|
|
||||||
return function xml_template_999_MyComponent(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
let b2;
|
let b2;
|
||||||
if (ctx['state'].value) {
|
if (ctx['state'].value) {
|
||||||
let ref1 = (el) => this.__owl__.setRef((\`div\`), el);
|
let ref1 = (el) => this.__owl__.setRef((\`div\`), el);
|
||||||
@@ -299,11 +280,10 @@ exports[`hooks useEffect hook effect runs on mount, is reapplied on patch, and i
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_999\\"
|
|
||||||
|
|
||||||
let block1 = createBlock(\`<div/>\`);
|
let block1 = createBlock(\`<div/>\`);
|
||||||
|
|
||||||
return function xml_template_999_MyComponent(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
return block1();
|
return block1();
|
||||||
}
|
}
|
||||||
}"
|
}"
|
||||||
@@ -313,11 +293,10 @@ exports[`hooks useEffect hook effect with empty dependency list never reruns 1`]
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_999\\"
|
|
||||||
|
|
||||||
let block1 = createBlock(\`<div><block-text-0/></div>\`);
|
let block1 = createBlock(\`<div><block-text-0/></div>\`);
|
||||||
|
|
||||||
return function xml_template_999_MyComponent(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
let txt1 = ctx['state'].value;
|
let txt1 = ctx['state'].value;
|
||||||
return block1([txt1]);
|
return block1([txt1]);
|
||||||
}
|
}
|
||||||
@@ -328,11 +307,10 @@ exports[`hooks useEffect hook properly behaves when the effect function throws 1
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_999\\"
|
|
||||||
|
|
||||||
let block1 = createBlock(\`<div/>\`);
|
let block1 = createBlock(\`<div/>\`);
|
||||||
|
|
||||||
return function xml_template_999_MyComponent(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
return block1();
|
return block1();
|
||||||
}
|
}
|
||||||
}"
|
}"
|
||||||
@@ -342,10 +320,9 @@ exports[`hooks useExternalListener 1`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_1000\\"
|
|
||||||
const comp1 = app.createComponent(\`MyComponent\`, true, false, false, []);
|
const comp1 = app.createComponent(\`MyComponent\`, true, false, false, []);
|
||||||
|
|
||||||
return function xml_template_1000_App(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
let b2;
|
let b2;
|
||||||
if (ctx['state'].flag) {
|
if (ctx['state'].flag) {
|
||||||
b2 = comp1({}, key + \`__1\`, node, this, null);
|
b2 = comp1({}, key + \`__1\`, node, this, null);
|
||||||
@@ -359,11 +336,10 @@ exports[`hooks useExternalListener 2`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_999\\"
|
|
||||||
|
|
||||||
let block1 = createBlock(\`<span><block-text-0/></span>\`);
|
let block1 = createBlock(\`<span><block-text-0/></span>\`);
|
||||||
|
|
||||||
return function xml_template_999_MyComponent(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
let txt1 = ctx['props'].value;
|
let txt1 = ctx['props'].value;
|
||||||
return block1([txt1]);
|
return block1([txt1]);
|
||||||
}
|
}
|
||||||
@@ -374,11 +350,10 @@ exports[`hooks useRef hook: basic use 1`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_999\\"
|
|
||||||
|
|
||||||
let block1 = createBlock(\`<div><button block-ref=\\"0\\"><block-text-1/></button></div>\`);
|
let block1 = createBlock(\`<div><button block-ref=\\"0\\"><block-text-1/></button></div>\`);
|
||||||
|
|
||||||
return function xml_template_999_Counter(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
let ref1 = (el) => this.__owl__.setRef((\`button\`), el);
|
let ref1 = (el) => this.__owl__.setRef((\`button\`), el);
|
||||||
let txt1 = ctx['value'];
|
let txt1 = ctx['value'];
|
||||||
return block1([ref1, txt1]);
|
return block1([ref1, txt1]);
|
||||||
@@ -390,11 +365,10 @@ exports[`hooks useSubEnv modifies user env 1`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_999\\"
|
|
||||||
|
|
||||||
let block1 = createBlock(\`<div><block-text-0/></div>\`);
|
let block1 = createBlock(\`<div><block-text-0/></div>\`);
|
||||||
|
|
||||||
return function xml_template_999_Test(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
let txt1 = ctx['env'].val;
|
let txt1 = ctx['env'].val;
|
||||||
return block1([txt1]);
|
return block1([txt1]);
|
||||||
}
|
}
|
||||||
@@ -405,10 +379,9 @@ exports[`hooks useSubEnv supports arbitrary descriptor 1`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_1000\\"
|
|
||||||
const comp1 = app.createComponent(\`Child\`, true, false, false, []);
|
const comp1 = app.createComponent(\`Child\`, true, false, false, []);
|
||||||
|
|
||||||
return function xml_template_1000_Test(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
return comp1({}, key + \`__1\`, node, this, null);
|
return comp1({}, key + \`__1\`, node, this, null);
|
||||||
}
|
}
|
||||||
}"
|
}"
|
||||||
@@ -418,11 +391,10 @@ exports[`hooks useSubEnv supports arbitrary descriptor 2`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_999\\"
|
|
||||||
|
|
||||||
let block1 = createBlock(\`<div><block-text-0/> <block-text-1/></div>\`);
|
let block1 = createBlock(\`<div><block-text-0/> <block-text-1/></div>\`);
|
||||||
|
|
||||||
return function xml_template_999_Child(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
let txt1 = ctx['env'].someVal;
|
let txt1 = ctx['env'].someVal;
|
||||||
let txt2 = ctx['env'].someVal2;
|
let txt2 = ctx['env'].someVal2;
|
||||||
return block1([txt1, txt2]);
|
return block1([txt1, txt2]);
|
||||||
|
|||||||
@@ -4,11 +4,10 @@ exports[`lifecycle hooks basic checks for a component 1`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_999\\"
|
|
||||||
|
|
||||||
let block1 = createBlock(\`<span>test</span>\`);
|
let block1 = createBlock(\`<span>test</span>\`);
|
||||||
|
|
||||||
return function xml_template_999_Test(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
return block1();
|
return block1();
|
||||||
}
|
}
|
||||||
}"
|
}"
|
||||||
@@ -18,13 +17,12 @@ exports[`lifecycle hooks component semantics 1`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_1004\\"
|
|
||||||
const comp1 = app.createComponent(\`B\`, true, false, false, []);
|
const comp1 = app.createComponent(\`B\`, true, false, false, []);
|
||||||
const comp2 = app.createComponent(\`C\`, true, false, false, []);
|
const comp2 = app.createComponent(\`C\`, true, false, false, []);
|
||||||
|
|
||||||
let block1 = createBlock(\`<div>A<block-child-0/><block-child-1/></div>\`);
|
let block1 = createBlock(\`<div>A<block-child-0/><block-child-1/></div>\`);
|
||||||
|
|
||||||
return function xml_template_1004_A(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
const b2 = comp1({}, key + \`__1\`, node, this, null);
|
const b2 = comp1({}, key + \`__1\`, node, this, null);
|
||||||
const b3 = comp2({}, key + \`__2\`, node, this, null);
|
const b3 = comp2({}, key + \`__2\`, node, this, null);
|
||||||
return block1([], [b2, b3]);
|
return block1([], [b2, b3]);
|
||||||
@@ -36,11 +34,10 @@ exports[`lifecycle hooks component semantics 2`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_999\\"
|
|
||||||
|
|
||||||
let block1 = createBlock(\`<div>B</div>\`);
|
let block1 = createBlock(\`<div>B</div>\`);
|
||||||
|
|
||||||
return function xml_template_999_B(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
return block1();
|
return block1();
|
||||||
}
|
}
|
||||||
}"
|
}"
|
||||||
@@ -50,15 +47,14 @@ exports[`lifecycle hooks component semantics 3`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_1003\\"
|
|
||||||
const comp1 = app.createComponent(\`D\`, true, false, false, []);
|
const comp1 = app.createComponent(\`D\`, true, false, false, []);
|
||||||
const comp2 = app.createComponent(\`E\`, true, false, false, []);
|
const comp2 = app.createComponent(\`E\`, true, false, false, []);
|
||||||
const comp3 = app.createComponent(\`F\`, true, false, false, []);
|
const comp3 = app.createComponent(\`F\`, true, false, false, []);
|
||||||
|
|
||||||
let block1 = createBlock(\`<div>C<block-child-0/><block-child-1/><block-child-2/></div>\`);
|
let block1 = createBlock(\`<div>C<block-child-0/><block-child-1/><block-child-2/></div>\`);
|
||||||
|
|
||||||
return function xml_template_1003_C(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
let b2,b3,b4;
|
let b2, b3, b4;
|
||||||
b2 = comp1({}, key + \`__1\`, node, this, null);
|
b2 = comp1({}, key + \`__1\`, node, this, null);
|
||||||
if (ctx['state'].flag) {
|
if (ctx['state'].flag) {
|
||||||
b3 = comp2({}, key + \`__2\`, node, this, null);
|
b3 = comp2({}, key + \`__2\`, node, this, null);
|
||||||
@@ -74,11 +70,10 @@ exports[`lifecycle hooks component semantics 4`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_1000\\"
|
|
||||||
|
|
||||||
let block1 = createBlock(\`<div>D</div>\`);
|
let block1 = createBlock(\`<div>D</div>\`);
|
||||||
|
|
||||||
return function xml_template_1000_D(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
return block1();
|
return block1();
|
||||||
}
|
}
|
||||||
}"
|
}"
|
||||||
@@ -88,25 +83,23 @@ exports[`lifecycle hooks component semantics 5`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_1001\\"
|
|
||||||
|
|
||||||
let block1 = createBlock(\`<div>E</div>\`);
|
let block1 = createBlock(\`<div>E</div>\`);
|
||||||
|
|
||||||
return function xml_template_1001_E(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
return block1();
|
return block1();
|
||||||
}
|
}
|
||||||
}"
|
}"
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`lifecycle hooks component semantics 6`] = `
|
exports[`lifecycle hooks component semantics 7`] = `
|
||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_1002\\"
|
|
||||||
|
|
||||||
let block1 = createBlock(\`<div>F</div>\`);
|
let block1 = createBlock(\`<div>F</div>\`);
|
||||||
|
|
||||||
return function xml_template_1002_F(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
return block1();
|
return block1();
|
||||||
}
|
}
|
||||||
}"
|
}"
|
||||||
@@ -116,12 +109,11 @@ exports[`lifecycle hooks components are unmounted and destroyed if no longer in
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_1000\\"
|
|
||||||
const comp1 = app.createComponent(\`Child\`, true, false, false, [\\"n\\"]);
|
const comp1 = app.createComponent(\`Child\`, true, false, false, [\\"n\\"]);
|
||||||
|
|
||||||
let block2 = createBlock(\`<div><block-child-0/></div>\`);
|
let block2 = createBlock(\`<div><block-child-0/></div>\`);
|
||||||
|
|
||||||
return function xml_template_1000_Parent(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
let b2;
|
let b2;
|
||||||
if (ctx['state'].flag) {
|
if (ctx['state'].flag) {
|
||||||
const b3 = comp1({n: ctx['state'].n}, key + \`__1\`, node, this, null);
|
const b3 = comp1({n: ctx['state'].n}, key + \`__1\`, node, this, null);
|
||||||
@@ -136,11 +128,10 @@ exports[`lifecycle hooks components are unmounted and destroyed if no longer in
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_999\\"
|
|
||||||
|
|
||||||
let block1 = createBlock(\`<span><block-text-0/></span>\`);
|
let block1 = createBlock(\`<span><block-text-0/></span>\`);
|
||||||
|
|
||||||
return function xml_template_999_Child(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
let txt1 = ctx['props'].n;
|
let txt1 = ctx['props'].n;
|
||||||
return block1([txt1]);
|
return block1([txt1]);
|
||||||
}
|
}
|
||||||
@@ -151,10 +142,9 @@ exports[`lifecycle hooks components are unmounted destroyed if no longer in DOM
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_1000\\"
|
|
||||||
const comp1 = app.createComponent(\`Child\`, true, false, false, []);
|
const comp1 = app.createComponent(\`Child\`, true, false, false, []);
|
||||||
|
|
||||||
return function xml_template_1000_Parent(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
let b2;
|
let b2;
|
||||||
if (ctx['state'].ok) {
|
if (ctx['state'].ok) {
|
||||||
b2 = comp1({}, key + \`__1\`, node, this, null);
|
b2 = comp1({}, key + \`__1\`, node, this, null);
|
||||||
@@ -168,11 +158,10 @@ exports[`lifecycle hooks components are unmounted destroyed if no longer in DOM
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_999\\"
|
|
||||||
|
|
||||||
let block1 = createBlock(\`<div/>\`);
|
let block1 = createBlock(\`<div/>\`);
|
||||||
|
|
||||||
return function xml_template_999_Child(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
return block1();
|
return block1();
|
||||||
}
|
}
|
||||||
}"
|
}"
|
||||||
@@ -182,11 +171,10 @@ exports[`lifecycle hooks destroy new children before being mountged 1`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_1000\\"
|
|
||||||
const comp1 = app.createComponent(\`Child\`, true, false, false, []);
|
const comp1 = app.createComponent(\`Child\`, true, false, false, []);
|
||||||
|
|
||||||
return function xml_template_1000_Parent(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
let b2,b3,b4;
|
let b2, b3, b4;
|
||||||
b2 = text(\`before\`);
|
b2 = text(\`before\`);
|
||||||
if (ctx['state'].flag) {
|
if (ctx['state'].flag) {
|
||||||
b3 = comp1({}, key + \`__1\`, node, this, null);
|
b3 = comp1({}, key + \`__1\`, node, this, null);
|
||||||
@@ -197,13 +185,12 @@ exports[`lifecycle hooks destroy new children before being mountged 1`] = `
|
|||||||
}"
|
}"
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`lifecycle hooks destroy new children before being mountged 2`] = `
|
exports[`lifecycle hooks destroy new children before being mountged 3`] = `
|
||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_999\\"
|
|
||||||
|
|
||||||
return function xml_template_999_Child(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
return text(\`child\`);
|
return text(\`child\`);
|
||||||
}
|
}
|
||||||
}"
|
}"
|
||||||
@@ -213,12 +200,11 @@ exports[`lifecycle hooks hooks are called in proper order in widget creation/des
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_1000\\"
|
|
||||||
const comp1 = app.createComponent(\`Child\`, true, false, false, []);
|
const comp1 = app.createComponent(\`Child\`, true, false, false, []);
|
||||||
|
|
||||||
let block1 = createBlock(\`<div><block-child-0/></div>\`);
|
let block1 = createBlock(\`<div><block-child-0/></div>\`);
|
||||||
|
|
||||||
return function xml_template_1000_Parent(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
const b2 = comp1({}, key + \`__1\`, node, this, null);
|
const b2 = comp1({}, key + \`__1\`, node, this, null);
|
||||||
return block1([], [b2]);
|
return block1([], [b2]);
|
||||||
}
|
}
|
||||||
@@ -229,11 +215,10 @@ exports[`lifecycle hooks hooks are called in proper order in widget creation/des
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_999\\"
|
|
||||||
|
|
||||||
let block1 = createBlock(\`<div/>\`);
|
let block1 = createBlock(\`<div/>\`);
|
||||||
|
|
||||||
return function xml_template_999_Child(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
return block1();
|
return block1();
|
||||||
}
|
}
|
||||||
}"
|
}"
|
||||||
@@ -243,10 +228,9 @@ exports[`lifecycle hooks lifecycle callbacks are bound to component 1`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_1000\\"
|
|
||||||
const comp1 = app.createComponent(\`Test\`, true, false, false, [\\"rev\\"]);
|
const comp1 = app.createComponent(\`Test\`, true, false, false, [\\"rev\\"]);
|
||||||
|
|
||||||
return function xml_template_1000_Parent(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
return comp1({rev: ctx['rev']}, key + \`__1\`, node, this, null);
|
return comp1({rev: ctx['rev']}, key + \`__1\`, node, this, null);
|
||||||
}
|
}
|
||||||
}"
|
}"
|
||||||
@@ -256,9 +240,8 @@ exports[`lifecycle hooks lifecycle callbacks are bound to component 2`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_999\\"
|
|
||||||
|
|
||||||
return function xml_template_999_Test(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
return text(ctx['props'].rev);
|
return text(ctx['props'].rev);
|
||||||
}
|
}
|
||||||
}"
|
}"
|
||||||
@@ -268,12 +251,11 @@ exports[`lifecycle hooks lifecycle semantics 1`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_1000\\"
|
|
||||||
const comp1 = app.createComponent(\`Child\`, true, false, false, [\\"a\\"]);
|
const comp1 = app.createComponent(\`Child\`, true, false, false, [\\"a\\"]);
|
||||||
|
|
||||||
let block1 = createBlock(\`<div><block-child-0/></div>\`);
|
let block1 = createBlock(\`<div><block-child-0/></div>\`);
|
||||||
|
|
||||||
return function xml_template_1000_Parent(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
const b2 = comp1({a: ctx['state'].a}, key + \`__1\`, node, this, null);
|
const b2 = comp1({a: ctx['state'].a}, key + \`__1\`, node, this, null);
|
||||||
return block1([], [b2]);
|
return block1([], [b2]);
|
||||||
}
|
}
|
||||||
@@ -284,11 +266,10 @@ exports[`lifecycle hooks lifecycle semantics 2`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_999\\"
|
|
||||||
|
|
||||||
let block1 = createBlock(\`<div/>\`);
|
let block1 = createBlock(\`<div/>\`);
|
||||||
|
|
||||||
return function xml_template_999_Child(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
return block1();
|
return block1();
|
||||||
}
|
}
|
||||||
}"
|
}"
|
||||||
@@ -298,10 +279,9 @@ exports[`lifecycle hooks lifecycle semantics, part 2 1`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_1001\\"
|
|
||||||
const comp1 = app.createComponent(\`Child\`, true, false, false, []);
|
const comp1 = app.createComponent(\`Child\`, true, false, false, []);
|
||||||
|
|
||||||
return function xml_template_1001_Parent(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
let b2;
|
let b2;
|
||||||
if (ctx['state'].hasChild) {
|
if (ctx['state'].hasChild) {
|
||||||
b2 = comp1({}, key + \`__1\`, node, this, null);
|
b2 = comp1({}, key + \`__1\`, node, this, null);
|
||||||
@@ -311,28 +291,26 @@ exports[`lifecycle hooks lifecycle semantics, part 2 1`] = `
|
|||||||
}"
|
}"
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`lifecycle hooks lifecycle semantics, part 2 2`] = `
|
exports[`lifecycle hooks lifecycle semantics, part 2 3`] = `
|
||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_1000\\"
|
|
||||||
const comp1 = app.createComponent(\`GrandChild\`, true, false, false, []);
|
const comp1 = app.createComponent(\`GrandChild\`, true, false, false, []);
|
||||||
|
|
||||||
return function xml_template_1000_Child(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
return comp1({}, key + \`__1\`, node, this, null);
|
return comp1({}, key + \`__1\`, node, this, null);
|
||||||
}
|
}
|
||||||
}"
|
}"
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`lifecycle hooks lifecycle semantics, part 2 3`] = `
|
exports[`lifecycle hooks lifecycle semantics, part 2 4`] = `
|
||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_999\\"
|
|
||||||
|
|
||||||
let block1 = createBlock(\`<div/>\`);
|
let block1 = createBlock(\`<div/>\`);
|
||||||
|
|
||||||
return function xml_template_999_GrandChild(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
return block1();
|
return block1();
|
||||||
}
|
}
|
||||||
}"
|
}"
|
||||||
@@ -342,10 +320,9 @@ exports[`lifecycle hooks lifecycle semantics, part 3 1`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_1001\\"
|
|
||||||
const comp1 = app.createComponent(\`Child\`, true, false, false, []);
|
const comp1 = app.createComponent(\`Child\`, true, false, false, []);
|
||||||
|
|
||||||
return function xml_template_1001_Parent(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
let b2;
|
let b2;
|
||||||
if (ctx['state'].hasChild) {
|
if (ctx['state'].hasChild) {
|
||||||
b2 = comp1({}, key + \`__1\`, node, this, null);
|
b2 = comp1({}, key + \`__1\`, node, this, null);
|
||||||
@@ -359,10 +336,9 @@ exports[`lifecycle hooks lifecycle semantics, part 4 1`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_1001\\"
|
|
||||||
const comp1 = app.createComponent(\`Child\`, true, false, false, []);
|
const comp1 = app.createComponent(\`Child\`, true, false, false, []);
|
||||||
|
|
||||||
return function xml_template_1001_Parent(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
let b2;
|
let b2;
|
||||||
if (ctx['state'].hasChild) {
|
if (ctx['state'].hasChild) {
|
||||||
b2 = comp1({}, key + \`__1\`, node, this, null);
|
b2 = comp1({}, key + \`__1\`, node, this, null);
|
||||||
@@ -372,28 +348,26 @@ exports[`lifecycle hooks lifecycle semantics, part 4 1`] = `
|
|||||||
}"
|
}"
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`lifecycle hooks lifecycle semantics, part 4 2`] = `
|
exports[`lifecycle hooks lifecycle semantics, part 4 3`] = `
|
||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_1000\\"
|
|
||||||
const comp1 = app.createComponent(\`GrandChild\`, true, false, false, []);
|
const comp1 = app.createComponent(\`GrandChild\`, true, false, false, []);
|
||||||
|
|
||||||
return function xml_template_1000_Child(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
return comp1({}, key + \`__1\`, node, this, null);
|
return comp1({}, key + \`__1\`, node, this, null);
|
||||||
}
|
}
|
||||||
}"
|
}"
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`lifecycle hooks lifecycle semantics, part 4 3`] = `
|
exports[`lifecycle hooks lifecycle semantics, part 4 4`] = `
|
||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_999\\"
|
|
||||||
|
|
||||||
let block1 = createBlock(\`<div/>\`);
|
let block1 = createBlock(\`<div/>\`);
|
||||||
|
|
||||||
return function xml_template_999_GrandChild(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
return block1();
|
return block1();
|
||||||
}
|
}
|
||||||
}"
|
}"
|
||||||
@@ -403,10 +377,9 @@ exports[`lifecycle hooks lifecycle semantics, part 5 1`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_1000\\"
|
|
||||||
const comp1 = app.createComponent(\`Child\`, true, false, false, []);
|
const comp1 = app.createComponent(\`Child\`, true, false, false, []);
|
||||||
|
|
||||||
return function xml_template_1000_Parent(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
let b2;
|
let b2;
|
||||||
if (ctx['state'].hasChild) {
|
if (ctx['state'].hasChild) {
|
||||||
b2 = comp1({}, key + \`__1\`, node, this, null);
|
b2 = comp1({}, key + \`__1\`, node, this, null);
|
||||||
@@ -420,11 +393,10 @@ exports[`lifecycle hooks lifecycle semantics, part 5 2`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_999\\"
|
|
||||||
|
|
||||||
let block1 = createBlock(\`<div/>\`);
|
let block1 = createBlock(\`<div/>\`);
|
||||||
|
|
||||||
return function xml_template_999_Child(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
return block1();
|
return block1();
|
||||||
}
|
}
|
||||||
}"
|
}"
|
||||||
@@ -434,10 +406,9 @@ exports[`lifecycle hooks lifecycle semantics, part 6 1`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_1000\\"
|
|
||||||
const comp1 = app.createComponent(\`Child\`, true, false, false, [\\"value\\"]);
|
const comp1 = app.createComponent(\`Child\`, true, false, false, [\\"value\\"]);
|
||||||
|
|
||||||
return function xml_template_1000_Parent(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
return comp1({value: ctx['state'].value}, key + \`__1\`, node, this, null);
|
return comp1({value: ctx['state'].value}, key + \`__1\`, node, this, null);
|
||||||
}
|
}
|
||||||
}"
|
}"
|
||||||
@@ -447,11 +418,10 @@ exports[`lifecycle hooks lifecycle semantics, part 6 2`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_999\\"
|
|
||||||
|
|
||||||
let block1 = createBlock(\`<div/>\`);
|
let block1 = createBlock(\`<div/>\`);
|
||||||
|
|
||||||
return function xml_template_999_Child(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
return block1();
|
return block1();
|
||||||
}
|
}
|
||||||
}"
|
}"
|
||||||
@@ -461,11 +431,10 @@ exports[`lifecycle hooks mounted hook is called if mounted in DOM 1`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_999\\"
|
|
||||||
|
|
||||||
let block1 = createBlock(\`<div/>\`);
|
let block1 = createBlock(\`<div/>\`);
|
||||||
|
|
||||||
return function xml_template_999_Test(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
return block1();
|
return block1();
|
||||||
}
|
}
|
||||||
}"
|
}"
|
||||||
@@ -475,10 +444,9 @@ exports[`lifecycle hooks mounted hook is called on every mount, not just the fir
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_1000\\"
|
|
||||||
const comp1 = app.createComponent(\`Child\`, true, false, false, []);
|
const comp1 = app.createComponent(\`Child\`, true, false, false, []);
|
||||||
|
|
||||||
return function xml_template_1000_Parent(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
let b2;
|
let b2;
|
||||||
if (ctx['state'].hasChild) {
|
if (ctx['state'].hasChild) {
|
||||||
b2 = comp1({}, key + \`__1\`, node, this, null);
|
b2 = comp1({}, key + \`__1\`, node, this, null);
|
||||||
@@ -492,11 +460,10 @@ exports[`lifecycle hooks mounted hook is called on every mount, not just the fir
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_999\\"
|
|
||||||
|
|
||||||
let block1 = createBlock(\`<div>child</div>\`);
|
let block1 = createBlock(\`<div>child</div>\`);
|
||||||
|
|
||||||
return function xml_template_999_Child(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
return block1();
|
return block1();
|
||||||
}
|
}
|
||||||
}"
|
}"
|
||||||
@@ -506,12 +473,11 @@ exports[`lifecycle hooks mounted hook is called on subcomponents, in proper orde
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_1000\\"
|
|
||||||
const comp1 = app.createComponent(\`Child\`, true, false, false, []);
|
const comp1 = app.createComponent(\`Child\`, true, false, false, []);
|
||||||
|
|
||||||
let block1 = createBlock(\`<div><block-child-0/></div>\`);
|
let block1 = createBlock(\`<div><block-child-0/></div>\`);
|
||||||
|
|
||||||
return function xml_template_1000_Parent(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
const b2 = comp1({}, key + \`__1\`, node, this, null);
|
const b2 = comp1({}, key + \`__1\`, node, this, null);
|
||||||
return block1([], [b2]);
|
return block1([], [b2]);
|
||||||
}
|
}
|
||||||
@@ -522,11 +488,10 @@ exports[`lifecycle hooks mounted hook is called on subcomponents, in proper orde
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_999\\"
|
|
||||||
|
|
||||||
let block1 = createBlock(\`<div/>\`);
|
let block1 = createBlock(\`<div/>\`);
|
||||||
|
|
||||||
return function xml_template_999_Child(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
return block1();
|
return block1();
|
||||||
}
|
}
|
||||||
}"
|
}"
|
||||||
@@ -536,12 +501,11 @@ exports[`lifecycle hooks mounted hook is called on subsubcomponents, in proper o
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_1001\\"
|
|
||||||
const comp1 = app.createComponent(\`Child\`, true, false, false, []);
|
const comp1 = app.createComponent(\`Child\`, true, false, false, []);
|
||||||
|
|
||||||
let block1 = createBlock(\`<div><block-child-0/></div>\`);
|
let block1 = createBlock(\`<div><block-child-0/></div>\`);
|
||||||
|
|
||||||
return function xml_template_1001_Parent(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
let b2;
|
let b2;
|
||||||
if (ctx['state'].flag) {
|
if (ctx['state'].flag) {
|
||||||
b2 = comp1({}, key + \`__1\`, node, this, null);
|
b2 = comp1({}, key + \`__1\`, node, this, null);
|
||||||
@@ -555,12 +519,11 @@ exports[`lifecycle hooks mounted hook is called on subsubcomponents, in proper o
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_1000\\"
|
|
||||||
const comp1 = app.createComponent(\`ChildChild\`, true, false, false, []);
|
const comp1 = app.createComponent(\`ChildChild\`, true, false, false, []);
|
||||||
|
|
||||||
let block1 = createBlock(\`<div><block-child-0/></div>\`);
|
let block1 = createBlock(\`<div><block-child-0/></div>\`);
|
||||||
|
|
||||||
return function xml_template_1000_Child(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
const b2 = comp1({}, key + \`__1\`, node, this, null);
|
const b2 = comp1({}, key + \`__1\`, node, this, null);
|
||||||
return block1([], [b2]);
|
return block1([], [b2]);
|
||||||
}
|
}
|
||||||
@@ -571,11 +534,10 @@ exports[`lifecycle hooks mounted hook is called on subsubcomponents, in proper o
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_999\\"
|
|
||||||
|
|
||||||
let block1 = createBlock(\`<div/>\`);
|
let block1 = createBlock(\`<div/>\`);
|
||||||
|
|
||||||
return function xml_template_999_ChildChild(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
return block1();
|
return block1();
|
||||||
}
|
}
|
||||||
}"
|
}"
|
||||||
@@ -585,10 +547,9 @@ exports[`lifecycle hooks onWillRender 1`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_1000\\"
|
|
||||||
const comp1 = app.createComponent(\`Child\`, true, false, false, [\\"someValue\\"]);
|
const comp1 = app.createComponent(\`Child\`, true, false, false, [\\"someValue\\"]);
|
||||||
|
|
||||||
return function xml_template_1000_Parent(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
return comp1({someValue: ctx['state'].value}, key + \`__1\`, node, this, null);
|
return comp1({someValue: ctx['state'].value}, key + \`__1\`, node, this, null);
|
||||||
}
|
}
|
||||||
}"
|
}"
|
||||||
@@ -598,11 +559,10 @@ exports[`lifecycle hooks onWillRender 2`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_999\\"
|
|
||||||
|
|
||||||
let block1 = createBlock(\`<button block-handler-0=\\"click\\"><block-text-1/></button>\`);
|
let block1 = createBlock(\`<button block-handler-0=\\"click\\"><block-text-1/></button>\`);
|
||||||
|
|
||||||
return function xml_template_999_Child(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
let hdlr1 = [ctx['increment'], ctx];
|
let hdlr1 = [ctx['increment'], ctx];
|
||||||
let txt1 = ctx['state'].value;
|
let txt1 = ctx['state'].value;
|
||||||
return block1([hdlr1, txt1]);
|
return block1([hdlr1, txt1]);
|
||||||
@@ -614,12 +574,11 @@ exports[`lifecycle hooks patched hook is called after updateProps 1`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_1000\\"
|
|
||||||
const comp1 = app.createComponent(\`Child\`, true, false, false, [\\"a\\"]);
|
const comp1 = app.createComponent(\`Child\`, true, false, false, [\\"a\\"]);
|
||||||
|
|
||||||
let block1 = createBlock(\`<div><block-child-0/></div>\`);
|
let block1 = createBlock(\`<div><block-child-0/></div>\`);
|
||||||
|
|
||||||
return function xml_template_1000_Parent(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
const b2 = comp1({a: ctx['state'].a}, key + \`__1\`, node, this, null);
|
const b2 = comp1({a: ctx['state'].a}, key + \`__1\`, node, this, null);
|
||||||
return block1([], [b2]);
|
return block1([], [b2]);
|
||||||
}
|
}
|
||||||
@@ -630,11 +589,10 @@ exports[`lifecycle hooks patched hook is called after updateProps 2`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_999\\"
|
|
||||||
|
|
||||||
let block1 = createBlock(\`<div/>\`);
|
let block1 = createBlock(\`<div/>\`);
|
||||||
|
|
||||||
return function xml_template_999_Child(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
return block1();
|
return block1();
|
||||||
}
|
}
|
||||||
}"
|
}"
|
||||||
@@ -644,11 +602,10 @@ exports[`lifecycle hooks patched hook is called after updating State 1`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_999\\"
|
|
||||||
|
|
||||||
let block1 = createBlock(\`<div><block-text-0/></div>\`);
|
let block1 = createBlock(\`<div><block-text-0/></div>\`);
|
||||||
|
|
||||||
return function xml_template_999_Test(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
let txt1 = ctx['state'].a;
|
let txt1 = ctx['state'].a;
|
||||||
return block1([txt1]);
|
return block1([txt1]);
|
||||||
}
|
}
|
||||||
@@ -659,11 +616,10 @@ exports[`lifecycle hooks render in mounted 1`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_999\\"
|
|
||||||
|
|
||||||
let block1 = createBlock(\`<span><block-text-0/></span>\`);
|
let block1 = createBlock(\`<span><block-text-0/></span>\`);
|
||||||
|
|
||||||
return function xml_template_999_Parent(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
let txt1 = ctx['patched'];
|
let txt1 = ctx['patched'];
|
||||||
return block1([txt1]);
|
return block1([txt1]);
|
||||||
}
|
}
|
||||||
@@ -674,11 +630,10 @@ exports[`lifecycle hooks render in patched 1`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_999\\"
|
|
||||||
|
|
||||||
let block1 = createBlock(\`<span><block-text-0/></span>\`);
|
let block1 = createBlock(\`<span><block-text-0/></span>\`);
|
||||||
|
|
||||||
return function xml_template_999_Parent(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
let txt1 = ctx['patched'];
|
let txt1 = ctx['patched'];
|
||||||
return block1([txt1]);
|
return block1([txt1]);
|
||||||
}
|
}
|
||||||
@@ -689,11 +644,10 @@ exports[`lifecycle hooks render in willPatch 1`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_999\\"
|
|
||||||
|
|
||||||
let block1 = createBlock(\`<span><block-text-0/></span>\`);
|
let block1 = createBlock(\`<span><block-text-0/></span>\`);
|
||||||
|
|
||||||
return function xml_template_999_Parent(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
let txt1 = ctx['patched'];
|
let txt1 = ctx['patched'];
|
||||||
return block1([txt1]);
|
return block1([txt1]);
|
||||||
}
|
}
|
||||||
@@ -704,10 +658,9 @@ exports[`lifecycle hooks sub widget (inside sub node): hooks are correctly calle
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_1000\\"
|
|
||||||
const comp1 = app.createComponent(\`Child\`, true, false, false, []);
|
const comp1 = app.createComponent(\`Child\`, true, false, false, []);
|
||||||
|
|
||||||
return function xml_template_1000_Parent(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
let b2;
|
let b2;
|
||||||
if (ctx['state'].flag) {
|
if (ctx['state'].flag) {
|
||||||
b2 = comp1({}, key + \`__1\`, node, this, null);
|
b2 = comp1({}, key + \`__1\`, node, this, null);
|
||||||
@@ -721,11 +674,23 @@ exports[`lifecycle hooks sub widget (inside sub node): hooks are correctly calle
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_999\\"
|
|
||||||
|
|
||||||
let block1 = createBlock(\`<div/>\`);
|
let block1 = createBlock(\`<div/>\`);
|
||||||
|
|
||||||
return function xml_template_999_Child(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
|
return block1();
|
||||||
|
}
|
||||||
|
}"
|
||||||
|
`;
|
||||||
|
|
||||||
|
exports[`lifecycle hooks timeout in onWillStart doesn't emit a warning if app is destroyed 1`] = `
|
||||||
|
"function anonymous(app, bdom, helpers
|
||||||
|
) {
|
||||||
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
|
|
||||||
|
let block1 = createBlock(\`<span/>\`);
|
||||||
|
|
||||||
|
return function template(ctx, node, key = \\"\\") {
|
||||||
return block1();
|
return block1();
|
||||||
}
|
}
|
||||||
}"
|
}"
|
||||||
@@ -735,11 +700,10 @@ exports[`lifecycle hooks timeout in onWillStart emits a warning 1`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_999\\"
|
|
||||||
|
|
||||||
let block1 = createBlock(\`<span/>\`);
|
let block1 = createBlock(\`<span/>\`);
|
||||||
|
|
||||||
return function xml_template_999_Test(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
return block1();
|
return block1();
|
||||||
}
|
}
|
||||||
}"
|
}"
|
||||||
@@ -749,10 +713,9 @@ exports[`lifecycle hooks timeout in onWillUpdateProps emits a warning 1`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_1000\\"
|
|
||||||
const comp1 = app.createComponent(\`Child\`, true, false, false, [\\"prop\\"]);
|
const comp1 = app.createComponent(\`Child\`, true, false, false, [\\"prop\\"]);
|
||||||
|
|
||||||
return function xml_template_1000_Parent(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
const props1 = {prop: ctx['state'].prop};
|
const props1 = {prop: ctx['state'].prop};
|
||||||
helpers.validateProps(\`Child\`, props1, this);
|
helpers.validateProps(\`Child\`, props1, this);
|
||||||
return comp1(props1, key + \`__1\`, node, this, null);
|
return comp1(props1, key + \`__1\`, node, this, null);
|
||||||
@@ -764,9 +727,8 @@ exports[`lifecycle hooks timeout in onWillUpdateProps emits a warning 2`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_999\\"
|
|
||||||
|
|
||||||
return function xml_template_999_Child(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
return text(\`\`);
|
return text(\`\`);
|
||||||
}
|
}
|
||||||
}"
|
}"
|
||||||
@@ -776,12 +738,11 @@ exports[`lifecycle hooks willPatch, patched hook are called on subsubcomponents,
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_1001\\"
|
|
||||||
const comp1 = app.createComponent(\`Child\`, true, false, false, [\\"n\\"]);
|
const comp1 = app.createComponent(\`Child\`, true, false, false, [\\"n\\"]);
|
||||||
|
|
||||||
let block1 = createBlock(\`<div><block-child-0/></div>\`);
|
let block1 = createBlock(\`<div><block-child-0/></div>\`);
|
||||||
|
|
||||||
return function xml_template_1001_Parent(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
const b2 = comp1({n: ctx['state'].n}, key + \`__1\`, node, this, null);
|
const b2 = comp1({n: ctx['state'].n}, key + \`__1\`, node, this, null);
|
||||||
return block1([], [b2]);
|
return block1([], [b2]);
|
||||||
}
|
}
|
||||||
@@ -792,12 +753,11 @@ exports[`lifecycle hooks willPatch, patched hook are called on subsubcomponents,
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_1000\\"
|
|
||||||
const comp1 = app.createComponent(\`ChildChild\`, true, false, false, [\\"n\\"]);
|
const comp1 = app.createComponent(\`ChildChild\`, true, false, false, [\\"n\\"]);
|
||||||
|
|
||||||
let block1 = createBlock(\`<div><block-child-0/></div>\`);
|
let block1 = createBlock(\`<div><block-child-0/></div>\`);
|
||||||
|
|
||||||
return function xml_template_1000_Child(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
const b2 = comp1({n: ctx['props'].n}, key + \`__1\`, node, this, null);
|
const b2 = comp1({n: ctx['props'].n}, key + \`__1\`, node, this, null);
|
||||||
return block1([], [b2]);
|
return block1([], [b2]);
|
||||||
}
|
}
|
||||||
@@ -808,11 +768,10 @@ exports[`lifecycle hooks willPatch, patched hook are called on subsubcomponents,
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_999\\"
|
|
||||||
|
|
||||||
let block1 = createBlock(\`<div><block-text-0/></div>\`);
|
let block1 = createBlock(\`<div><block-text-0/></div>\`);
|
||||||
|
|
||||||
return function xml_template_999_ChildChild(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
let txt1 = ctx['props'].n;
|
let txt1 = ctx['props'].n;
|
||||||
return block1([txt1]);
|
return block1([txt1]);
|
||||||
}
|
}
|
||||||
@@ -823,10 +782,9 @@ exports[`lifecycle hooks willStart hook is called on sub component 1`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_1000\\"
|
|
||||||
const comp1 = app.createComponent(\`Child\`, true, false, false, []);
|
const comp1 = app.createComponent(\`Child\`, true, false, false, []);
|
||||||
|
|
||||||
return function xml_template_1000_Parent(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
return comp1({}, key + \`__1\`, node, this, null);
|
return comp1({}, key + \`__1\`, node, this, null);
|
||||||
}
|
}
|
||||||
}"
|
}"
|
||||||
@@ -836,11 +794,10 @@ exports[`lifecycle hooks willStart hook is called on sub component 2`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_999\\"
|
|
||||||
|
|
||||||
let block1 = createBlock(\`<div/>\`);
|
let block1 = createBlock(\`<div/>\`);
|
||||||
|
|
||||||
return function xml_template_999_Child(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
return block1();
|
return block1();
|
||||||
}
|
}
|
||||||
}"
|
}"
|
||||||
@@ -850,11 +807,10 @@ exports[`lifecycle hooks willStart is called 1`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_999\\"
|
|
||||||
|
|
||||||
let block1 = createBlock(\`<span>simple vnode</span>\`);
|
let block1 = createBlock(\`<span>simple vnode</span>\`);
|
||||||
|
|
||||||
return function xml_template_999_Test(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
return block1();
|
return block1();
|
||||||
}
|
}
|
||||||
}"
|
}"
|
||||||
@@ -864,11 +820,10 @@ exports[`lifecycle hooks willStart is called with component as this 1`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_999\\"
|
|
||||||
|
|
||||||
let block1 = createBlock(\`<span>simple vnode</span>\`);
|
let block1 = createBlock(\`<span>simple vnode</span>\`);
|
||||||
|
|
||||||
return function xml_template_999_Test(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
return block1();
|
return block1();
|
||||||
}
|
}
|
||||||
}"
|
}"
|
||||||
@@ -878,14 +833,13 @@ exports[`lifecycle hooks willStart, mounted on subwidget rendered after main is
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_1000\\"
|
|
||||||
const comp1 = app.createComponent(\`Child\`, true, false, false, []);
|
const comp1 = app.createComponent(\`Child\`, true, false, false, []);
|
||||||
|
|
||||||
let block1 = createBlock(\`<div><block-child-0/><block-child-1/></div>\`);
|
let block1 = createBlock(\`<div><block-child-0/><block-child-1/></div>\`);
|
||||||
let block3 = createBlock(\`<div/>\`);
|
let block3 = createBlock(\`<div/>\`);
|
||||||
|
|
||||||
return function xml_template_1000_Parent(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
let b2,b3;
|
let b2, b3;
|
||||||
if (ctx['state'].ok) {
|
if (ctx['state'].ok) {
|
||||||
b2 = comp1({}, key + \`__1\`, node, this, null);
|
b2 = comp1({}, key + \`__1\`, node, this, null);
|
||||||
} else {
|
} else {
|
||||||
@@ -900,11 +854,10 @@ exports[`lifecycle hooks willStart, mounted on subwidget rendered after main is
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_999\\"
|
|
||||||
|
|
||||||
let block1 = createBlock(\`<div/>\`);
|
let block1 = createBlock(\`<div/>\`);
|
||||||
|
|
||||||
return function xml_template_999_Child(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
return block1();
|
return block1();
|
||||||
}
|
}
|
||||||
}"
|
}"
|
||||||
@@ -914,10 +867,9 @@ exports[`lifecycle hooks willUpdateProps hook is called 1`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_1000\\"
|
|
||||||
const comp1 = app.createComponent(\`Child\`, true, false, false, [\\"n\\"]);
|
const comp1 = app.createComponent(\`Child\`, true, false, false, [\\"n\\"]);
|
||||||
|
|
||||||
return function xml_template_1000_Parent(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
return comp1({n: ctx['state'].n}, key + \`__1\`, node, this, null);
|
return comp1({n: ctx['state'].n}, key + \`__1\`, node, this, null);
|
||||||
}
|
}
|
||||||
}"
|
}"
|
||||||
@@ -927,11 +879,10 @@ exports[`lifecycle hooks willUpdateProps hook is called 2`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_999\\"
|
|
||||||
|
|
||||||
let block1 = createBlock(\`<span><block-text-0/></span>\`);
|
let block1 = createBlock(\`<span><block-text-0/></span>\`);
|
||||||
|
|
||||||
return function xml_template_999_Child(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
let txt1 = ctx['props'].n;
|
let txt1 = ctx['props'].n;
|
||||||
return block1([txt1]);
|
return block1([txt1]);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,14 +5,13 @@ exports[`.alike suffix in a list 1`] = `
|
|||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
let { prepareList, withKey } = helpers;
|
let { prepareList, withKey } = helpers;
|
||||||
// Template name: \\"xml_template_1000\\"
|
|
||||||
const comp1 = app.createComponent(\`Todo\`, true, false, false, [\\"todo\\"]);
|
const comp1 = app.createComponent(\`Todo\`, true, false, false, [\\"todo\\"]);
|
||||||
|
|
||||||
return function xml_template_1000_Parent(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
ctx = Object.create(ctx);
|
ctx = Object.create(ctx);
|
||||||
const [k_block1, v_block1, l_block1, c_block1] = prepareList(ctx['state'].elems);;
|
const [k_block1, v_block1, l_block1, c_block1] = prepareList(ctx['state'].elems);;
|
||||||
for (let i1 = 0; i1 < l_block1; i1++) {
|
for (let i1 = 0; i1 < l_block1; i1++) {
|
||||||
ctx[\`elem\`] = v_block1[i1];
|
ctx[\`elem\`] = k_block1[i1];
|
||||||
const key1 = ctx['elem'].id;
|
const key1 = ctx['elem'].id;
|
||||||
const v1 = ctx['this'];
|
const v1 = ctx['this'];
|
||||||
const v2 = ctx['elem'];
|
const v2 = ctx['elem'];
|
||||||
@@ -27,11 +26,10 @@ exports[`.alike suffix in a list 2`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_999\\"
|
|
||||||
|
|
||||||
let block1 = createBlock(\`<button block-handler-0=\\"click\\"><block-text-1/><block-child-0/></button>\`);
|
let block1 = createBlock(\`<button block-handler-0=\\"click\\"><block-text-1/><block-child-0/></button>\`);
|
||||||
|
|
||||||
return function xml_template_999_Todo(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
let b2;
|
let b2;
|
||||||
let hdlr1 = [ctx['props'].toggle, ctx];
|
let hdlr1 = [ctx['props'].toggle, ctx];
|
||||||
let txt1 = ctx['props'].todo.id;
|
let txt1 = ctx['props'].todo.id;
|
||||||
@@ -47,10 +45,9 @@ exports[`.alike suffix in a simple case 1`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_1000\\"
|
|
||||||
const comp1 = app.createComponent(\`Child\`, true, false, false, []);
|
const comp1 = app.createComponent(\`Child\`, true, false, false, []);
|
||||||
|
|
||||||
return function xml_template_1000_Parent(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
const b2 = text(ctx['state'].counter);
|
const b2 = text(ctx['state'].counter);
|
||||||
const b3 = comp1({fn: ()=>1}, key + \`__1\`, node, this, null);
|
const b3 = comp1({fn: ()=>1}, key + \`__1\`, node, this, null);
|
||||||
return multi([b2, b3]);
|
return multi([b2, b3]);
|
||||||
@@ -62,9 +59,8 @@ exports[`.alike suffix in a simple case 2`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_999\\"
|
|
||||||
|
|
||||||
return function xml_template_999_Child(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
return text(ctx['props'].fn());
|
return text(ctx['props'].fn());
|
||||||
}
|
}
|
||||||
}"
|
}"
|
||||||
@@ -74,12 +70,11 @@ exports[`basics accept ES6-like syntax for props (with getters) 1`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_1000\\"
|
|
||||||
const comp1 = app.createComponent(\`Child\`, true, false, false, [\\"greetings\\"]);
|
const comp1 = app.createComponent(\`Child\`, true, false, false, [\\"greetings\\"]);
|
||||||
|
|
||||||
let block1 = createBlock(\`<div><block-child-0/></div>\`);
|
let block1 = createBlock(\`<div><block-child-0/></div>\`);
|
||||||
|
|
||||||
return function xml_template_1000_Parent(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
const b2 = comp1({greetings: ctx['greetings']}, key + \`__1\`, node, this, null);
|
const b2 = comp1({greetings: ctx['greetings']}, key + \`__1\`, node, this, null);
|
||||||
return block1([], [b2]);
|
return block1([], [b2]);
|
||||||
}
|
}
|
||||||
@@ -90,11 +85,10 @@ exports[`basics accept ES6-like syntax for props (with getters) 2`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_999\\"
|
|
||||||
|
|
||||||
let block1 = createBlock(\`<span><block-text-0/></span>\`);
|
let block1 = createBlock(\`<span><block-text-0/></span>\`);
|
||||||
|
|
||||||
return function xml_template_999_Child(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
let txt1 = ctx['props'].greetings;
|
let txt1 = ctx['props'].greetings;
|
||||||
return block1([txt1]);
|
return block1([txt1]);
|
||||||
}
|
}
|
||||||
@@ -106,14 +100,13 @@ exports[`basics arrow functions as prop correctly capture their scope 1`] = `
|
|||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
let { prepareList, withKey } = helpers;
|
let { prepareList, withKey } = helpers;
|
||||||
// Template name: \\"xml_template_1000\\"
|
|
||||||
const comp1 = app.createComponent(\`Child\`, true, false, false, [\\"onClick\\"]);
|
const comp1 = app.createComponent(\`Child\`, true, false, false, [\\"onClick\\"]);
|
||||||
|
|
||||||
return function xml_template_1000_Parent(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
ctx = Object.create(ctx);
|
ctx = Object.create(ctx);
|
||||||
const [k_block1, v_block1, l_block1, c_block1] = prepareList(ctx['items']);;
|
const [k_block1, v_block1, l_block1, c_block1] = prepareList(ctx['items']);;
|
||||||
for (let i1 = 0; i1 < l_block1; i1++) {
|
for (let i1 = 0; i1 < l_block1; i1++) {
|
||||||
ctx[\`item\`] = v_block1[i1];
|
ctx[\`item\`] = k_block1[i1];
|
||||||
const key1 = ctx['item'].val;
|
const key1 = ctx['item'].val;
|
||||||
const v1 = ctx['onClick'];
|
const v1 = ctx['onClick'];
|
||||||
const v2 = ctx['item'];
|
const v2 = ctx['item'];
|
||||||
@@ -128,11 +121,10 @@ exports[`basics arrow functions as prop correctly capture their scope 2`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_999\\"
|
|
||||||
|
|
||||||
let block1 = createBlock(\`<button block-handler-0=\\"click\\"/>\`);
|
let block1 = createBlock(\`<button block-handler-0=\\"click\\"/>\`);
|
||||||
|
|
||||||
return function xml_template_999_Child(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
let hdlr1 = [ctx['props'].onClick, ctx];
|
let hdlr1 = [ctx['props'].onClick, ctx];
|
||||||
return block1([hdlr1]);
|
return block1([hdlr1]);
|
||||||
}
|
}
|
||||||
@@ -143,12 +135,11 @@ exports[`basics explicit object prop 1`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_1000\\"
|
|
||||||
const comp1 = app.createComponent(\`Child\`, true, false, false, [\\"value\\"]);
|
const comp1 = app.createComponent(\`Child\`, true, false, false, [\\"value\\"]);
|
||||||
|
|
||||||
let block1 = createBlock(\`<div><block-child-0/></div>\`);
|
let block1 = createBlock(\`<div><block-child-0/></div>\`);
|
||||||
|
|
||||||
return function xml_template_1000_Parent(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
const b2 = comp1({value: ctx['state'].val}, key + \`__1\`, node, this, null);
|
const b2 = comp1({value: ctx['state'].val}, key + \`__1\`, node, this, null);
|
||||||
return block1([], [b2]);
|
return block1([], [b2]);
|
||||||
}
|
}
|
||||||
@@ -159,11 +150,10 @@ exports[`basics explicit object prop 2`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_999\\"
|
|
||||||
|
|
||||||
let block1 = createBlock(\`<span><block-text-0/></span>\`);
|
let block1 = createBlock(\`<span><block-text-0/></span>\`);
|
||||||
|
|
||||||
return function xml_template_999_Child(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
let txt1 = ctx['state'].someval;
|
let txt1 = ctx['state'].someval;
|
||||||
return block1([txt1]);
|
return block1([txt1]);
|
||||||
}
|
}
|
||||||
@@ -174,10 +164,9 @@ exports[`basics prop names can contain - 1`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_1000\\"
|
|
||||||
const comp1 = app.createComponent(\`Child\`, true, false, false, [\\"prop-name\\"]);
|
const comp1 = app.createComponent(\`Child\`, true, false, false, [\\"prop-name\\"]);
|
||||||
|
|
||||||
return function xml_template_1000_Parent(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
return comp1({'prop-name': 7}, key + \`__1\`, node, this, null);
|
return comp1({'prop-name': 7}, key + \`__1\`, node, this, null);
|
||||||
}
|
}
|
||||||
}"
|
}"
|
||||||
@@ -187,11 +176,10 @@ exports[`basics prop names can contain - 2`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_999\\"
|
|
||||||
|
|
||||||
let block1 = createBlock(\`<div><block-text-0/></div>\`);
|
let block1 = createBlock(\`<div><block-text-0/></div>\`);
|
||||||
|
|
||||||
return function xml_template_999_Child(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
let txt1 = ctx['props']['prop-name'];
|
let txt1 = ctx['props']['prop-name'];
|
||||||
return block1([txt1]);
|
return block1([txt1]);
|
||||||
}
|
}
|
||||||
@@ -202,10 +190,9 @@ exports[`basics support prop names that aren't valid bare object property names
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_1000\\"
|
|
||||||
const comp1 = app.createComponent(\`Child\`, true, false, false, [\\"some-dashed-prop\\"]);
|
const comp1 = app.createComponent(\`Child\`, true, false, false, [\\"some-dashed-prop\\"]);
|
||||||
|
|
||||||
return function xml_template_1000_Parent(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
return comp1({'some-dashed-prop': 5}, key + \`__1\`, node, this, null);
|
return comp1({'some-dashed-prop': 5}, key + \`__1\`, node, this, null);
|
||||||
}
|
}
|
||||||
}"
|
}"
|
||||||
@@ -215,11 +202,10 @@ exports[`basics support prop names that aren't valid bare object property names
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_999\\"
|
|
||||||
|
|
||||||
let block1 = createBlock(\`<button block-handler-0=\\"click\\"/>\`);
|
let block1 = createBlock(\`<button block-handler-0=\\"click\\"/>\`);
|
||||||
|
|
||||||
return function xml_template_999_Child(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
let hdlr1 = [ctx['props'].onClick, ctx];
|
let hdlr1 = [ctx['props'].onClick, ctx];
|
||||||
return block1([hdlr1]);
|
return block1([hdlr1]);
|
||||||
}
|
}
|
||||||
@@ -231,7 +217,6 @@ exports[`basics t-set with a body expression can be passed in props, and then t-
|
|||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
let { isBoundary, withDefault, LazyValue } = helpers;
|
let { isBoundary, withDefault, LazyValue } = helpers;
|
||||||
// Template name: \\"xml_template_1000\\"
|
|
||||||
const comp1 = app.createComponent(\`Child\`, true, false, false, [\\"val\\"]);
|
const comp1 = app.createComponent(\`Child\`, true, false, false, [\\"val\\"]);
|
||||||
|
|
||||||
let block1 = createBlock(\`<div><block-child-0/></div>\`);
|
let block1 = createBlock(\`<div><block-child-0/></div>\`);
|
||||||
@@ -241,7 +226,7 @@ exports[`basics t-set with a body expression can be passed in props, and then t-
|
|||||||
return block2();
|
return block2();
|
||||||
}
|
}
|
||||||
|
|
||||||
return function xml_template_1000_Parent(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
ctx = Object.create(ctx);
|
ctx = Object.create(ctx);
|
||||||
ctx[isBoundary] = 1
|
ctx[isBoundary] = 1
|
||||||
ctx[\`abc\`] = new LazyValue(value1, ctx, this, node, key);
|
ctx[\`abc\`] = new LazyValue(value1, ctx, this, node, key);
|
||||||
@@ -256,11 +241,10 @@ exports[`basics t-set with a body expression can be passed in props, and then t-
|
|||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
let { safeOutput } = helpers;
|
let { safeOutput } = helpers;
|
||||||
// Template name: \\"xml_template_999\\"
|
|
||||||
|
|
||||||
let block1 = createBlock(\`<span><block-text-0/><block-child-0/></span>\`);
|
let block1 = createBlock(\`<span><block-text-0/><block-child-0/></span>\`);
|
||||||
|
|
||||||
return function xml_template_999_Child(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
let txt1 = ctx['props'].val;
|
let txt1 = ctx['props'].val;
|
||||||
const b2 = safeOutput(ctx['props'].val);
|
const b2 = safeOutput(ctx['props'].val);
|
||||||
return block1([txt1], [b2]);
|
return block1([txt1], [b2]);
|
||||||
@@ -273,12 +257,11 @@ exports[`basics t-set with a body expression can be used as textual prop 1`] = `
|
|||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
let { isBoundary, withDefault, setContextValue } = helpers;
|
let { isBoundary, withDefault, setContextValue } = helpers;
|
||||||
// Template name: \\"xml_template_1000\\"
|
|
||||||
const comp1 = app.createComponent(\`Child\`, true, false, false, [\\"val\\"]);
|
const comp1 = app.createComponent(\`Child\`, true, false, false, [\\"val\\"]);
|
||||||
|
|
||||||
let block1 = createBlock(\`<div><block-child-0/></div>\`);
|
let block1 = createBlock(\`<div><block-child-0/></div>\`);
|
||||||
|
|
||||||
return function xml_template_1000_Parent(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
ctx = Object.create(ctx);
|
ctx = Object.create(ctx);
|
||||||
ctx[isBoundary] = 1
|
ctx[isBoundary] = 1
|
||||||
setContextValue(ctx, \\"abc\\", \`42\`);
|
setContextValue(ctx, \\"abc\\", \`42\`);
|
||||||
@@ -292,11 +275,10 @@ exports[`basics t-set with a body expression can be used as textual prop 2`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_999\\"
|
|
||||||
|
|
||||||
let block1 = createBlock(\`<span><block-text-0/></span>\`);
|
let block1 = createBlock(\`<span><block-text-0/></span>\`);
|
||||||
|
|
||||||
return function xml_template_999_Child(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
let txt1 = ctx['props'].val;
|
let txt1 = ctx['props'].val;
|
||||||
return block1([txt1]);
|
return block1([txt1]);
|
||||||
}
|
}
|
||||||
@@ -308,12 +290,11 @@ exports[`basics t-set works 1`] = `
|
|||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
let { isBoundary, withDefault, setContextValue } = helpers;
|
let { isBoundary, withDefault, setContextValue } = helpers;
|
||||||
// Template name: \\"xml_template_1000\\"
|
|
||||||
const comp1 = app.createComponent(\`Child\`, true, false, false, [\\"val\\"]);
|
const comp1 = app.createComponent(\`Child\`, true, false, false, [\\"val\\"]);
|
||||||
|
|
||||||
let block1 = createBlock(\`<div><block-child-0/></div>\`);
|
let block1 = createBlock(\`<div><block-child-0/></div>\`);
|
||||||
|
|
||||||
return function xml_template_1000_Parent(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
ctx = Object.create(ctx);
|
ctx = Object.create(ctx);
|
||||||
ctx[isBoundary] = 1
|
ctx[isBoundary] = 1
|
||||||
setContextValue(ctx, \\"val\\", 42);
|
setContextValue(ctx, \\"val\\", 42);
|
||||||
@@ -327,11 +308,10 @@ exports[`basics t-set works 2`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_999\\"
|
|
||||||
|
|
||||||
let block1 = createBlock(\`<span><block-text-0/></span>\`);
|
let block1 = createBlock(\`<span><block-text-0/></span>\`);
|
||||||
|
|
||||||
return function xml_template_999_Child(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
let txt1 = ctx['props'].val;
|
let txt1 = ctx['props'].val;
|
||||||
return block1([txt1]);
|
return block1([txt1]);
|
||||||
}
|
}
|
||||||
@@ -342,10 +322,9 @@ exports[`basics template string in prop 1`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_1000\\"
|
|
||||||
const comp1 = app.createComponent(\`Child\`, true, false, false, [\\"propName\\"]);
|
const comp1 = app.createComponent(\`Child\`, true, false, false, [\\"propName\\"]);
|
||||||
|
|
||||||
return function xml_template_1000_Parent(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
return comp1({propName: \`1\${ctx['someVal']}3\`}, key + \`__1\`, node, this, null);
|
return comp1({propName: \`1\${ctx['someVal']}3\`}, key + \`__1\`, node, this, null);
|
||||||
}
|
}
|
||||||
}"
|
}"
|
||||||
@@ -355,9 +334,8 @@ exports[`basics template string in prop 2`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_999\\"
|
|
||||||
|
|
||||||
return function xml_template_999_Child(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
return text(\`\`);
|
return text(\`\`);
|
||||||
}
|
}
|
||||||
}"
|
}"
|
||||||
@@ -367,10 +345,9 @@ exports[`bound functions are considered 'alike' 1`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_1000\\"
|
|
||||||
const comp1 = app.createComponent(\`Child\`, true, false, false, []);
|
const comp1 = app.createComponent(\`Child\`, true, false, false, []);
|
||||||
|
|
||||||
return function xml_template_1000_Parent(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
const b2 = text(ctx['state'].val);
|
const b2 = text(ctx['state'].val);
|
||||||
const b3 = comp1({fn: (ctx['someFunction']).bind(this)}, key + \`__1\`, node, this, null);
|
const b3 = comp1({fn: (ctx['someFunction']).bind(this)}, key + \`__1\`, node, this, null);
|
||||||
return multi([b2, b3]);
|
return multi([b2, b3]);
|
||||||
@@ -382,9 +359,8 @@ exports[`bound functions are considered 'alike' 2`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_999\\"
|
|
||||||
|
|
||||||
return function xml_template_999_Child(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
return text(\`child\`);
|
return text(\`child\`);
|
||||||
}
|
}
|
||||||
}"
|
}"
|
||||||
@@ -394,10 +370,9 @@ exports[`bound functions is not referentially equal after update 1`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_1000\\"
|
|
||||||
const comp1 = app.createComponent(\`Child\`, true, false, false, [\\"val\\"]);
|
const comp1 = app.createComponent(\`Child\`, true, false, false, [\\"val\\"]);
|
||||||
|
|
||||||
return function xml_template_1000_Parent(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
return comp1({val: ctx['state'].val,fn: (ctx['someFunction']).bind(this)}, key + \`__1\`, node, this, null);
|
return comp1({val: ctx['state'].val,fn: (ctx['someFunction']).bind(this)}, key + \`__1\`, node, this, null);
|
||||||
}
|
}
|
||||||
}"
|
}"
|
||||||
@@ -407,9 +382,8 @@ exports[`bound functions is not referentially equal after update 2`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_999\\"
|
|
||||||
|
|
||||||
return function xml_template_999_Child(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
return text(ctx['props'].val);
|
return text(ctx['props'].val);
|
||||||
}
|
}
|
||||||
}"
|
}"
|
||||||
@@ -419,10 +393,9 @@ exports[`can bind function prop with bind suffix 1`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_1000\\"
|
|
||||||
const comp1 = app.createComponent(\`Child\`, true, false, false, []);
|
const comp1 = app.createComponent(\`Child\`, true, false, false, []);
|
||||||
|
|
||||||
return function xml_template_1000_Parent(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
return comp1({doSomething: (ctx['doSomething']).bind(this)}, key + \`__1\`, node, this, null);
|
return comp1({doSomething: (ctx['doSomething']).bind(this)}, key + \`__1\`, node, this, null);
|
||||||
}
|
}
|
||||||
}"
|
}"
|
||||||
@@ -432,9 +405,8 @@ exports[`can bind function prop with bind suffix 2`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_999\\"
|
|
||||||
|
|
||||||
return function xml_template_999_Child(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
return text(\`child\`);
|
return text(\`child\`);
|
||||||
}
|
}
|
||||||
}"
|
}"
|
||||||
@@ -444,10 +416,9 @@ exports[`do not crash when binding anonymous function prop with bind suffix 1`]
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_1000\\"
|
|
||||||
const comp1 = app.createComponent(\`Child\`, true, false, false, []);
|
const comp1 = app.createComponent(\`Child\`, true, false, false, []);
|
||||||
|
|
||||||
return function xml_template_1000_Parent(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
const v1 = ctx['this'];
|
const v1 = ctx['this'];
|
||||||
return comp1({doSomething: ((_val)=>v1.doSomething(_val)).bind(this)}, key + \`__1\`, node, this, null);
|
return comp1({doSomething: ((_val)=>v1.doSomething(_val)).bind(this)}, key + \`__1\`, node, this, null);
|
||||||
}
|
}
|
||||||
@@ -458,9 +429,8 @@ exports[`do not crash when binding anonymous function prop with bind suffix 2`]
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_999\\"
|
|
||||||
|
|
||||||
return function xml_template_999_Child(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
return text(\`child\`);
|
return text(\`child\`);
|
||||||
}
|
}
|
||||||
}"
|
}"
|
||||||
|
|||||||
@@ -4,10 +4,9 @@ exports[`reactivity in lifecycle Child component doesn't render when state they
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_1000\\"
|
|
||||||
const comp1 = app.createComponent(\`Child\`, true, false, false, [\\"state\\"]);
|
const comp1 = app.createComponent(\`Child\`, true, false, false, [\\"state\\"]);
|
||||||
|
|
||||||
return function xml_template_1000_Parent(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
let b2;
|
let b2;
|
||||||
if (ctx['state'].renderChild) {
|
if (ctx['state'].renderChild) {
|
||||||
b2 = comp1({state: ctx['state']}, key + \`__1\`, node, this, null);
|
b2 = comp1({state: ctx['state']}, key + \`__1\`, node, this, null);
|
||||||
@@ -21,9 +20,8 @@ exports[`reactivity in lifecycle Child component doesn't render when state they
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_999\\"
|
|
||||||
|
|
||||||
return function xml_template_999_Child(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
return text(ctx['props'].state.content.a);
|
return text(ctx['props'].state.content.a);
|
||||||
}
|
}
|
||||||
}"
|
}"
|
||||||
@@ -33,10 +31,9 @@ exports[`reactivity in lifecycle Component is automatically subscribed to reacti
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_1000\\"
|
|
||||||
const comp1 = app.createComponent(\`Child\`, true, false, false, [\\"obj\\",\\"reactiveObj\\"]);
|
const comp1 = app.createComponent(\`Child\`, true, false, false, [\\"obj\\",\\"reactiveObj\\"]);
|
||||||
|
|
||||||
return function xml_template_1000_Parent(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
return comp1({obj: ctx['obj'],reactiveObj: ctx['reactiveObj']}, key + \`__1\`, node, this, null);
|
return comp1({obj: ctx['obj'],reactiveObj: ctx['reactiveObj']}, key + \`__1\`, node, this, null);
|
||||||
}
|
}
|
||||||
}"
|
}"
|
||||||
@@ -46,9 +43,8 @@ exports[`reactivity in lifecycle Component is automatically subscribed to reacti
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_999\\"
|
|
||||||
|
|
||||||
return function xml_template_999_Child(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
const b2 = text(ctx['props'].obj.a);
|
const b2 = text(ctx['props'].obj.a);
|
||||||
const b3 = text(ctx['props'].reactiveObj.b);
|
const b3 = text(ctx['props'].reactiveObj.b);
|
||||||
return multi([b2, b3]);
|
return multi([b2, b3]);
|
||||||
@@ -60,11 +56,10 @@ exports[`reactivity in lifecycle can use a state hook 1`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_999\\"
|
|
||||||
|
|
||||||
let block1 = createBlock(\`<div><block-text-0/></div>\`);
|
let block1 = createBlock(\`<div><block-text-0/></div>\`);
|
||||||
|
|
||||||
return function xml_template_999_Counter(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
let txt1 = ctx['counter'].value;
|
let txt1 = ctx['counter'].value;
|
||||||
return block1([txt1]);
|
return block1([txt1]);
|
||||||
}
|
}
|
||||||
@@ -75,11 +70,10 @@ exports[`reactivity in lifecycle can use a state hook 2 1`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_999\\"
|
|
||||||
|
|
||||||
let block1 = createBlock(\`<div><block-text-0/></div>\`);
|
let block1 = createBlock(\`<div><block-text-0/></div>\`);
|
||||||
|
|
||||||
return function xml_template_999_Comp(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
let txt1 = ctx['state'].a;
|
let txt1 = ctx['state'].a;
|
||||||
return block1([txt1]);
|
return block1([txt1]);
|
||||||
}
|
}
|
||||||
@@ -90,11 +84,10 @@ exports[`reactivity in lifecycle can use a state hook on Map 1`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_999\\"
|
|
||||||
|
|
||||||
let block1 = createBlock(\`<div><block-text-0/></div>\`);
|
let block1 = createBlock(\`<div><block-text-0/></div>\`);
|
||||||
|
|
||||||
return function xml_template_999_Counter(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
let txt1 = ctx['counter'].get('value');
|
let txt1 = ctx['counter'].get('value');
|
||||||
return block1([txt1]);
|
return block1([txt1]);
|
||||||
}
|
}
|
||||||
@@ -105,11 +98,10 @@ exports[`reactivity in lifecycle change state while mounting component 1`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_999\\"
|
|
||||||
|
|
||||||
let block1 = createBlock(\`<div><block-text-0/></div>\`);
|
let block1 = createBlock(\`<div><block-text-0/></div>\`);
|
||||||
|
|
||||||
return function xml_template_999_Comp(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
let txt1 = ctx['state'].val;
|
let txt1 = ctx['state'].val;
|
||||||
return block1([txt1]);
|
return block1([txt1]);
|
||||||
}
|
}
|
||||||
@@ -120,12 +112,11 @@ exports[`reactivity in lifecycle state changes in willUnmount do not trigger rer
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_1000\\"
|
|
||||||
const comp1 = app.createComponent(\`Child\`, true, false, false, [\\"val\\"]);
|
const comp1 = app.createComponent(\`Child\`, true, false, false, [\\"val\\"]);
|
||||||
|
|
||||||
let block1 = createBlock(\`<div><block-child-0/></div>\`);
|
let block1 = createBlock(\`<div><block-child-0/></div>\`);
|
||||||
|
|
||||||
return function xml_template_1000_Parent(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
let b2;
|
let b2;
|
||||||
if (ctx['state'].flag) {
|
if (ctx['state'].flag) {
|
||||||
b2 = comp1({val: ctx['state'].val}, key + \`__1\`, node, this, null);
|
b2 = comp1({val: ctx['state'].val}, key + \`__1\`, node, this, null);
|
||||||
@@ -139,11 +130,10 @@ exports[`reactivity in lifecycle state changes in willUnmount do not trigger rer
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_999\\"
|
|
||||||
|
|
||||||
let block1 = createBlock(\`<span><block-text-0/><block-text-1/></span>\`);
|
let block1 = createBlock(\`<span><block-text-0/><block-text-1/></span>\`);
|
||||||
|
|
||||||
return function xml_template_999_Child(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
let txt1 = ctx['props'].val;
|
let txt1 = ctx['props'].val;
|
||||||
let txt2 = ctx['state'].n;
|
let txt2 = ctx['state'].n;
|
||||||
return block1([txt1, txt2]);
|
return block1([txt1, txt2]);
|
||||||
@@ -155,9 +145,8 @@ exports[`subscriptions subscriptions returns the keys and targets observed by th
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_999\\"
|
|
||||||
|
|
||||||
return function xml_template_999_Comp(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
return text(ctx['state'].a);
|
return text(ctx['state'].a);
|
||||||
}
|
}
|
||||||
}"
|
}"
|
||||||
@@ -167,10 +156,9 @@ exports[`subscriptions subscriptions returns the keys observed by the component
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_1000\\"
|
|
||||||
const comp1 = app.createComponent(\`Child\`, true, false, false, [\\"state\\"]);
|
const comp1 = app.createComponent(\`Child\`, true, false, false, [\\"state\\"]);
|
||||||
|
|
||||||
return function xml_template_1000_Parent(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
const b2 = text(ctx['state'].a);
|
const b2 = text(ctx['state'].a);
|
||||||
const b3 = comp1({state: ctx['state']}, key + \`__1\`, node, this, null);
|
const b3 = comp1({state: ctx['state']}, key + \`__1\`, node, this, null);
|
||||||
return multi([b2, b3]);
|
return multi([b2, b3]);
|
||||||
@@ -182,9 +170,8 @@ exports[`subscriptions subscriptions returns the keys observed by the component
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_999\\"
|
|
||||||
|
|
||||||
return function xml_template_999_Child(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
return text(ctx['props'].state.b);
|
return text(ctx['props'].state.b);
|
||||||
}
|
}
|
||||||
}"
|
}"
|
||||||
|
|||||||
@@ -4,11 +4,10 @@ exports[`refs basic use 1`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_999\\"
|
|
||||||
|
|
||||||
let block1 = createBlock(\`<div block-ref=\\"0\\"/>\`);
|
let block1 = createBlock(\`<div block-ref=\\"0\\"/>\`);
|
||||||
|
|
||||||
return function xml_template_999_Test(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
let ref1 = (el) => this.__owl__.setRef((\`div\`), el);
|
let ref1 = (el) => this.__owl__.setRef((\`div\`), el);
|
||||||
return block1([ref1]);
|
return block1([ref1]);
|
||||||
}
|
}
|
||||||
@@ -19,13 +18,12 @@ exports[`refs can use 2 refs with same name in a t-if/t-else situation 1`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_999\\"
|
|
||||||
|
|
||||||
let block2 = createBlock(\`<div block-ref=\\"0\\"/>\`);
|
let block2 = createBlock(\`<div block-ref=\\"0\\"/>\`);
|
||||||
let block3 = createBlock(\`<span block-ref=\\"0\\"/>\`);
|
let block3 = createBlock(\`<span block-ref=\\"0\\"/>\`);
|
||||||
|
|
||||||
return function xml_template_999_Test(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
let b2,b3;
|
let b2, b3;
|
||||||
if (ctx['state'].value) {
|
if (ctx['state'].value) {
|
||||||
let ref1 = (el) => this.__owl__.setRef((\`coucou\`), el);
|
let ref1 = (el) => this.__owl__.setRef((\`coucou\`), el);
|
||||||
b2 = block2([ref1]);
|
b2 = block2([ref1]);
|
||||||
@@ -42,11 +40,10 @@ exports[`refs ref is unset when t-if goes to false after unrelated render 1`] =
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_999\\"
|
|
||||||
|
|
||||||
let block2 = createBlock(\`<div block-attribute-0=\\"class\\" block-ref=\\"1\\"/>\`);
|
let block2 = createBlock(\`<div block-attribute-0=\\"class\\" block-ref=\\"1\\"/>\`);
|
||||||
|
|
||||||
return function xml_template_999_Comp(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
let b2;
|
let b2;
|
||||||
if (ctx['state'].show) {
|
if (ctx['state'].show) {
|
||||||
let attr1 = ctx['state'].class;
|
let attr1 = ctx['state'].class;
|
||||||
@@ -62,12 +59,11 @@ exports[`refs refs and recursive templates 1`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_999\\"
|
|
||||||
const comp1 = app.createComponent(\`Test\`, true, false, false, [\\"tree\\"]);
|
const comp1 = app.createComponent(\`Test\`, true, false, false, [\\"tree\\"]);
|
||||||
|
|
||||||
let block1 = createBlock(\`<p block-ref=\\"0\\"><block-text-1/><block-child-0/></p>\`);
|
let block1 = createBlock(\`<p block-ref=\\"0\\"><block-text-1/><block-child-0/></p>\`);
|
||||||
|
|
||||||
return function xml_template_999_Test(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
let b2;
|
let b2;
|
||||||
let ref1 = (el) => this.__owl__.setRef((\`root\`), el);
|
let ref1 = (el) => this.__owl__.setRef((\`root\`), el);
|
||||||
let txt1 = ctx['props'].tree.value;
|
let txt1 = ctx['props'].tree.value;
|
||||||
@@ -83,12 +79,11 @@ exports[`refs refs and t-key 1`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_999\\"
|
|
||||||
|
|
||||||
let block2 = createBlock(\`<button block-handler-0=\\"click\\"/>\`);
|
let block2 = createBlock(\`<button block-handler-0=\\"click\\"/>\`);
|
||||||
let block3 = createBlock(\`<p block-ref=\\"0\\"/>\`);
|
let block3 = createBlock(\`<p block-ref=\\"0\\"/>\`);
|
||||||
|
|
||||||
return function xml_template_999_Test(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
const v1 = ctx['state'];
|
const v1 = ctx['state'];
|
||||||
let hdlr1 = [()=>v1.renderId++, ctx];
|
let hdlr1 = [()=>v1.renderId++, ctx];
|
||||||
const b2 = block2([hdlr1]);
|
const b2 = block2([hdlr1]);
|
||||||
@@ -105,7 +100,6 @@ exports[`refs refs are properly bound in slots 1`] = `
|
|||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
let { capture, markRaw } = helpers;
|
let { capture, markRaw } = helpers;
|
||||||
// Template name: \\"xml_template_1000\\"
|
|
||||||
const comp1 = app.createComponent(\`Dialog\`, true, true, false, []);
|
const comp1 = app.createComponent(\`Dialog\`, true, true, false, []);
|
||||||
|
|
||||||
let block1 = createBlock(\`<div><span class=\\"counter\\"><block-text-0/></span><block-child-0/></div>\`);
|
let block1 = createBlock(\`<div><span class=\\"counter\\"><block-text-0/></span><block-child-0/></div>\`);
|
||||||
@@ -117,7 +111,7 @@ exports[`refs refs are properly bound in slots 1`] = `
|
|||||||
return block2([hdlr1, ref1]);
|
return block2([hdlr1, ref1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
return function xml_template_1000_Parent(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
let txt1 = ctx['state'].val;
|
let txt1 = ctx['state'].val;
|
||||||
const ctx1 = capture(ctx);
|
const ctx1 = capture(ctx);
|
||||||
const b3 = comp1({slots: markRaw({'footer': {__render: slot1.bind(this), __ctx: ctx1}})}, key + \`__1\`, node, this, null);
|
const b3 = comp1({slots: markRaw({'footer': {__render: slot1.bind(this), __ctx: ctx1}})}, key + \`__1\`, node, this, null);
|
||||||
@@ -131,11 +125,10 @@ exports[`refs refs are properly bound in slots 2`] = `
|
|||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
let { callSlot } = helpers;
|
let { callSlot } = helpers;
|
||||||
// Template name: \\"xml_template_999\\"
|
|
||||||
|
|
||||||
let block1 = createBlock(\`<span><block-child-0/></span>\`);
|
let block1 = createBlock(\`<span><block-child-0/></span>\`);
|
||||||
|
|
||||||
return function xml_template_999_Dialog(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
const b2 = callSlot(ctx, node, key, 'footer', false, {});
|
const b2 = callSlot(ctx, node, key, 'footer', false, {});
|
||||||
return block1([], [b2]);
|
return block1([], [b2]);
|
||||||
}
|
}
|
||||||
@@ -147,12 +140,11 @@ exports[`refs throws if there are 2 same refs at the same time 1`] = `
|
|||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
let { makeRefWrapper } = helpers;
|
let { makeRefWrapper } = helpers;
|
||||||
// Template name: \\"xml_template_999\\"
|
|
||||||
|
|
||||||
let block2 = createBlock(\`<div block-ref=\\"0\\"/>\`);
|
let block2 = createBlock(\`<div block-ref=\\"0\\"/>\`);
|
||||||
let block3 = createBlock(\`<span block-ref=\\"0\\"/>\`);
|
let block3 = createBlock(\`<span block-ref=\\"0\\"/>\`);
|
||||||
|
|
||||||
return function xml_template_999_Test(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
let refWrapper = makeRefWrapper(this.__owl__);
|
let refWrapper = makeRefWrapper(this.__owl__);
|
||||||
let ref1 = refWrapper(\`coucou\`, (el) => this.__owl__.setRef((\`coucou\`), el));
|
let ref1 = refWrapper(\`coucou\`, (el) => this.__owl__.setRef((\`coucou\`), el));
|
||||||
const b2 = block2([ref1]);
|
const b2 = block2([ref1]);
|
||||||
|
|||||||
@@ -4,10 +4,9 @@ exports[`children, default props and renderings 1`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_1000\\"
|
|
||||||
const comp1 = app.createComponent(\`Child\`, true, false, false, []);
|
const comp1 = app.createComponent(\`Child\`, true, false, false, []);
|
||||||
|
|
||||||
return function xml_template_1000_Parent(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
const b2 = text(ctx['state'].value);
|
const b2 = text(ctx['state'].value);
|
||||||
const b3 = comp1({}, key + \`__1\`, node, this, null);
|
const b3 = comp1({}, key + \`__1\`, node, this, null);
|
||||||
return multi([b2, b3]);
|
return multi([b2, b3]);
|
||||||
@@ -19,9 +18,8 @@ exports[`children, default props and renderings 2`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_999\\"
|
|
||||||
|
|
||||||
return function xml_template_999_Child(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
return text(\`child\`);
|
return text(\`child\`);
|
||||||
}
|
}
|
||||||
}"
|
}"
|
||||||
@@ -31,10 +29,9 @@ exports[`force render in case of existing render 1`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_1001\\"
|
|
||||||
const comp1 = app.createComponent(\`B\`, true, false, false, [\\"val\\"]);
|
const comp1 = app.createComponent(\`B\`, true, false, false, [\\"val\\"]);
|
||||||
|
|
||||||
return function xml_template_1001_A(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
return comp1({val: ctx['state'].val}, key + \`__1\`, node, this, null);
|
return comp1({val: ctx['state'].val}, key + \`__1\`, node, this, null);
|
||||||
}
|
}
|
||||||
}"
|
}"
|
||||||
@@ -44,10 +41,9 @@ exports[`force render in case of existing render 2`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_1000\\"
|
|
||||||
const comp1 = app.createComponent(\`C\`, true, false, false, []);
|
const comp1 = app.createComponent(\`C\`, true, false, false, []);
|
||||||
|
|
||||||
return function xml_template_1000_B(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
const b2 = comp1({}, key + \`__1\`, node, this, null);
|
const b2 = comp1({}, key + \`__1\`, node, this, null);
|
||||||
const b3 = text(ctx['props'].val);
|
const b3 = text(ctx['props'].val);
|
||||||
return multi([b2, b3]);
|
return multi([b2, b3]);
|
||||||
@@ -59,9 +55,8 @@ exports[`force render in case of existing render 3`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_999\\"
|
|
||||||
|
|
||||||
return function xml_template_999_C(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
return text(\`C\`);
|
return text(\`C\`);
|
||||||
}
|
}
|
||||||
}"
|
}"
|
||||||
@@ -71,10 +66,9 @@ exports[`rendering semantics can force a render to update sub tree 1`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_1000\\"
|
|
||||||
const comp1 = app.createComponent(\`Child\`, true, false, false, []);
|
const comp1 = app.createComponent(\`Child\`, true, false, false, []);
|
||||||
|
|
||||||
return function xml_template_1000_Parent(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
const b2 = text(ctx['state'].value);
|
const b2 = text(ctx['state'].value);
|
||||||
const b3 = comp1({}, key + \`__1\`, node, this, null);
|
const b3 = comp1({}, key + \`__1\`, node, this, null);
|
||||||
return multi([b2, b3]);
|
return multi([b2, b3]);
|
||||||
@@ -86,9 +80,8 @@ exports[`rendering semantics can force a render to update sub tree 2`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_999\\"
|
|
||||||
|
|
||||||
return function xml_template_999_Child(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
return text(\`child\`);
|
return text(\`child\`);
|
||||||
}
|
}
|
||||||
}"
|
}"
|
||||||
@@ -98,10 +91,9 @@ exports[`rendering semantics can render a parent without rendering child 1`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_1000\\"
|
|
||||||
const comp1 = app.createComponent(\`Child\`, true, false, false, []);
|
const comp1 = app.createComponent(\`Child\`, true, false, false, []);
|
||||||
|
|
||||||
return function xml_template_1000_Parent(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
const b2 = text(ctx['state'].value);
|
const b2 = text(ctx['state'].value);
|
||||||
const b3 = comp1({}, key + \`__1\`, node, this, null);
|
const b3 = comp1({}, key + \`__1\`, node, this, null);
|
||||||
return multi([b2, b3]);
|
return multi([b2, b3]);
|
||||||
@@ -113,9 +105,8 @@ exports[`rendering semantics can render a parent without rendering child 2`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_999\\"
|
|
||||||
|
|
||||||
return function xml_template_999_Child(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
return text(\`child\`);
|
return text(\`child\`);
|
||||||
}
|
}
|
||||||
}"
|
}"
|
||||||
@@ -125,10 +116,9 @@ exports[`rendering semantics props are reactive (nested prop) 1`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_1000\\"
|
|
||||||
const comp1 = app.createComponent(\`Child\`, true, false, false, [\\"a\\"]);
|
const comp1 = app.createComponent(\`Child\`, true, false, false, [\\"a\\"]);
|
||||||
|
|
||||||
return function xml_template_1000_Parent(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
return comp1({a: ctx['state']}, key + \`__1\`, node, this, null);
|
return comp1({a: ctx['state']}, key + \`__1\`, node, this, null);
|
||||||
}
|
}
|
||||||
}"
|
}"
|
||||||
@@ -138,9 +128,8 @@ exports[`rendering semantics props are reactive (nested prop) 2`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_999\\"
|
|
||||||
|
|
||||||
return function xml_template_999_Child(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
return text(ctx['props'].a.b.c);
|
return text(ctx['props'].a.b.c);
|
||||||
}
|
}
|
||||||
}"
|
}"
|
||||||
@@ -150,10 +139,9 @@ exports[`rendering semantics props are reactive 1`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_1000\\"
|
|
||||||
const comp1 = app.createComponent(\`Child\`, true, false, false, [\\"a\\"]);
|
const comp1 = app.createComponent(\`Child\`, true, false, false, [\\"a\\"]);
|
||||||
|
|
||||||
return function xml_template_1000_Parent(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
return comp1({a: ctx['state']}, key + \`__1\`, node, this, null);
|
return comp1({a: ctx['state']}, key + \`__1\`, node, this, null);
|
||||||
}
|
}
|
||||||
}"
|
}"
|
||||||
@@ -163,9 +151,8 @@ exports[`rendering semantics props are reactive 2`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_999\\"
|
|
||||||
|
|
||||||
return function xml_template_999_Child(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
return text(ctx['props'].a.b);
|
return text(ctx['props'].a.b);
|
||||||
}
|
}
|
||||||
}"
|
}"
|
||||||
@@ -175,10 +162,9 @@ exports[`rendering semantics render need a boolean = true to be 'deep' 1`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_1000\\"
|
|
||||||
const comp1 = app.createComponent(\`Child\`, true, false, false, []);
|
const comp1 = app.createComponent(\`Child\`, true, false, false, []);
|
||||||
|
|
||||||
return function xml_template_1000_Parent(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
const b2 = text(ctx['state'].value);
|
const b2 = text(ctx['state'].value);
|
||||||
const b3 = comp1({}, key + \`__1\`, node, this, null);
|
const b3 = comp1({}, key + \`__1\`, node, this, null);
|
||||||
return multi([b2, b3]);
|
return multi([b2, b3]);
|
||||||
@@ -190,9 +176,8 @@ exports[`rendering semantics render need a boolean = true to be 'deep' 2`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_999\\"
|
|
||||||
|
|
||||||
return function xml_template_999_Child(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
return text(\`child\`);
|
return text(\`child\`);
|
||||||
}
|
}
|
||||||
}"
|
}"
|
||||||
@@ -202,10 +187,9 @@ exports[`rendering semantics render with deep=true followed by render with deep=
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_1000\\"
|
|
||||||
const comp1 = app.createComponent(\`Child\`, true, false, false, []);
|
const comp1 = app.createComponent(\`Child\`, true, false, false, []);
|
||||||
|
|
||||||
return function xml_template_1000_Parent(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
const b2 = text(\`parent\`);
|
const b2 = text(\`parent\`);
|
||||||
const b3 = text(ctx['state'].value);
|
const b3 = text(ctx['state'].value);
|
||||||
const b4 = comp1({}, key + \`__1\`, node, this, null);
|
const b4 = comp1({}, key + \`__1\`, node, this, null);
|
||||||
@@ -218,9 +202,8 @@ exports[`rendering semantics render with deep=true followed by render with deep=
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_999\\"
|
|
||||||
|
|
||||||
return function xml_template_999_Child(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
const b2 = text(\`child\`);
|
const b2 = text(\`child\`);
|
||||||
const b3 = text(ctx['env'].getValue());
|
const b3 = text(ctx['env'].getValue());
|
||||||
return multi([b2, b3]);
|
return multi([b2, b3]);
|
||||||
@@ -232,10 +215,9 @@ exports[`rendering semantics rendering is atomic (for one subtree) 1`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_1001\\"
|
|
||||||
const comp1 = app.createComponent(\`B\`, true, false, false, [\\"obj\\"]);
|
const comp1 = app.createComponent(\`B\`, true, false, false, [\\"obj\\"]);
|
||||||
|
|
||||||
return function xml_template_1001_A(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
const b2 = text(ctx['state'].obj.val);
|
const b2 = text(ctx['state'].obj.val);
|
||||||
const b3 = comp1({obj: ctx['state'].obj}, key + \`__1\`, node, this, null);
|
const b3 = comp1({obj: ctx['state'].obj}, key + \`__1\`, node, this, null);
|
||||||
return multi([b2, b3]);
|
return multi([b2, b3]);
|
||||||
@@ -247,10 +229,9 @@ exports[`rendering semantics rendering is atomic (for one subtree) 2`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_1000\\"
|
|
||||||
const comp1 = app.createComponent(\`C\`, true, false, false, [\\"obj\\"]);
|
const comp1 = app.createComponent(\`C\`, true, false, false, [\\"obj\\"]);
|
||||||
|
|
||||||
return function xml_template_1000_B(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
return comp1({obj: ctx['props'].obj}, key + \`__1\`, node, this, null);
|
return comp1({obj: ctx['props'].obj}, key + \`__1\`, node, this, null);
|
||||||
}
|
}
|
||||||
}"
|
}"
|
||||||
@@ -260,9 +241,8 @@ exports[`rendering semantics rendering is atomic (for one subtree) 3`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_999\\"
|
|
||||||
|
|
||||||
return function xml_template_999_C(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
return text(ctx['props'].obj.val);
|
return text(ctx['props'].obj.val);
|
||||||
}
|
}
|
||||||
}"
|
}"
|
||||||
@@ -272,10 +252,9 @@ exports[`rendering semantics works as expected for dynamic number of props 1`] =
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_1000\\"
|
|
||||||
const comp1 = app.createComponent(\`Child\`, true, false, true, []);
|
const comp1 = app.createComponent(\`Child\`, true, false, true, []);
|
||||||
|
|
||||||
return function xml_template_1000_Parent(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
return comp1(Object.assign({}, ctx['state']), key + \`__1\`, node, this, null);
|
return comp1(Object.assign({}, ctx['state']), key + \`__1\`, node, this, null);
|
||||||
}
|
}
|
||||||
}"
|
}"
|
||||||
@@ -285,9 +264,8 @@ exports[`rendering semantics works as expected for dynamic number of props 2`] =
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_999\\"
|
|
||||||
|
|
||||||
return function xml_template_999_Child(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
return text(Object.keys(ctx['props']).length);
|
return text(Object.keys(ctx['props']).length);
|
||||||
}
|
}
|
||||||
}"
|
}"
|
||||||
|
|||||||
@@ -4,10 +4,9 @@ exports[`style and class handling can set class on multi root component 1`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_1000\\"
|
|
||||||
const comp1 = app.createComponent(\`Child\`, true, false, false, [\\"class\\"]);
|
const comp1 = app.createComponent(\`Child\`, true, false, false, [\\"class\\"]);
|
||||||
|
|
||||||
return function xml_template_1000_Parent(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
return comp1({class: 'fromparent'}, key + \`__1\`, node, this, null);
|
return comp1({class: 'fromparent'}, key + \`__1\`, node, this, null);
|
||||||
}
|
}
|
||||||
}"
|
}"
|
||||||
@@ -17,12 +16,11 @@ exports[`style and class handling can set class on multi root component 2`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_999\\"
|
|
||||||
|
|
||||||
let block2 = createBlock(\`<div>a</div>\`);
|
let block2 = createBlock(\`<div>a</div>\`);
|
||||||
let block3 = createBlock(\`<span block-attribute-0=\\"class\\">b</span>\`);
|
let block3 = createBlock(\`<span block-attribute-0=\\"class\\">b</span>\`);
|
||||||
|
|
||||||
return function xml_template_999_Child(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
const b2 = block2();
|
const b2 = block2();
|
||||||
let attr1 = ctx['props'].class;
|
let attr1 = ctx['props'].class;
|
||||||
const b3 = block3([attr1]);
|
const b3 = block3([attr1]);
|
||||||
@@ -35,10 +33,9 @@ exports[`style and class handling can set class on sub component, as prop 1`] =
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_1000\\"
|
|
||||||
const comp1 = app.createComponent(\`Child\`, true, false, false, [\\"class\\"]);
|
const comp1 = app.createComponent(\`Child\`, true, false, false, [\\"class\\"]);
|
||||||
|
|
||||||
return function xml_template_1000_Parent(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
return comp1({class: 'some-class'}, key + \`__1\`, node, this, null);
|
return comp1({class: 'some-class'}, key + \`__1\`, node, this, null);
|
||||||
}
|
}
|
||||||
}"
|
}"
|
||||||
@@ -48,11 +45,10 @@ exports[`style and class handling can set class on sub component, as prop 2`] =
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_999\\"
|
|
||||||
|
|
||||||
let block1 = createBlock(\`<div block-attribute-0=\\"class\\">child</div>\`);
|
let block1 = createBlock(\`<div block-attribute-0=\\"class\\">child</div>\`);
|
||||||
|
|
||||||
return function xml_template_999_Child(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
let attr1 = ctx['props'].class;
|
let attr1 = ctx['props'].class;
|
||||||
return block1([attr1]);
|
return block1([attr1]);
|
||||||
}
|
}
|
||||||
@@ -63,10 +59,9 @@ exports[`style and class handling can set class on sub sub component 1`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_1001\\"
|
|
||||||
const comp1 = app.createComponent(\`Child\`, true, false, false, [\\"class\\"]);
|
const comp1 = app.createComponent(\`Child\`, true, false, false, [\\"class\\"]);
|
||||||
|
|
||||||
return function xml_template_1001_Parent(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
return comp1({class: 'fromparent'}, key + \`__1\`, node, this, null);
|
return comp1({class: 'fromparent'}, key + \`__1\`, node, this, null);
|
||||||
}
|
}
|
||||||
}"
|
}"
|
||||||
@@ -76,10 +71,9 @@ exports[`style and class handling can set class on sub sub component 2`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_1000\\"
|
|
||||||
const comp1 = app.createComponent(\`ChildChild\`, true, false, false, [\\"class\\"]);
|
const comp1 = app.createComponent(\`ChildChild\`, true, false, false, [\\"class\\"]);
|
||||||
|
|
||||||
return function xml_template_1000_Child(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
return comp1({class: (ctx['props'].class||'')+' fromchild'}, key + \`__1\`, node, this, null);
|
return comp1({class: (ctx['props'].class||'')+' fromchild'}, key + \`__1\`, node, this, null);
|
||||||
}
|
}
|
||||||
}"
|
}"
|
||||||
@@ -89,11 +83,10 @@ exports[`style and class handling can set class on sub sub component 3`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_999\\"
|
|
||||||
|
|
||||||
let block1 = createBlock(\`<div block-attribute-0=\\"class\\">childchild</div>\`);
|
let block1 = createBlock(\`<div block-attribute-0=\\"class\\">childchild</div>\`);
|
||||||
|
|
||||||
return function xml_template_999_ChildChild(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
let attr1 = ctx['props'].class;
|
let attr1 = ctx['props'].class;
|
||||||
return block1([attr1]);
|
return block1([attr1]);
|
||||||
}
|
}
|
||||||
@@ -104,10 +97,9 @@ exports[`style and class handling can set more than one class on sub component 1
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_1000\\"
|
|
||||||
const comp1 = app.createComponent(\`Child\`, true, false, false, [\\"class\\"]);
|
const comp1 = app.createComponent(\`Child\`, true, false, false, [\\"class\\"]);
|
||||||
|
|
||||||
return function xml_template_1000_Parent(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
return comp1({class: 'a b'}, key + \`__1\`, node, this, null);
|
return comp1({class: 'a b'}, key + \`__1\`, node, this, null);
|
||||||
}
|
}
|
||||||
}"
|
}"
|
||||||
@@ -117,11 +109,10 @@ exports[`style and class handling can set more than one class on sub component 2
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_999\\"
|
|
||||||
|
|
||||||
let block1 = createBlock(\`<div block-attribute-0=\\"class\\">child</div>\`);
|
let block1 = createBlock(\`<div block-attribute-0=\\"class\\">child</div>\`);
|
||||||
|
|
||||||
return function xml_template_999_Child(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
let attr1 = ctx['props'].class;
|
let attr1 = ctx['props'].class;
|
||||||
return block1([attr1]);
|
return block1([attr1]);
|
||||||
}
|
}
|
||||||
@@ -132,11 +123,10 @@ exports[`style and class handling can set style and class inside component 1`] =
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_999\\"
|
|
||||||
|
|
||||||
let block1 = createBlock(\`<div style=\\"font-weight:bold;\\" class=\\"some-class\\">world</div>\`);
|
let block1 = createBlock(\`<div style=\\"font-weight:bold;\\" class=\\"some-class\\">world</div>\`);
|
||||||
|
|
||||||
return function xml_template_999_Test(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
return block1();
|
return block1();
|
||||||
}
|
}
|
||||||
}"
|
}"
|
||||||
@@ -146,11 +136,10 @@ exports[`style and class handling class on components do not interfere with user
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_999\\"
|
|
||||||
|
|
||||||
let block1 = createBlock(\`<div block-attribute-0=\\"class\\"/>\`);
|
let block1 = createBlock(\`<div block-attribute-0=\\"class\\"/>\`);
|
||||||
|
|
||||||
return function xml_template_999_App(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
let attr1 = {c:ctx['state'].c};
|
let attr1 = {c:ctx['state'].c};
|
||||||
return block1([attr1]);
|
return block1([attr1]);
|
||||||
}
|
}
|
||||||
@@ -161,10 +150,9 @@ exports[`style and class handling class on sub component, which is switched to a
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_1002\\"
|
|
||||||
const comp1 = app.createComponent(\`Child\`, true, false, false, [\\"class\\",\\"child\\"]);
|
const comp1 = app.createComponent(\`Child\`, true, false, false, [\\"class\\",\\"child\\"]);
|
||||||
|
|
||||||
return function xml_template_1002_Parent(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
return comp1({class: 'someclass',child: ctx['state'].child}, key + \`__1\`, node, this, null);
|
return comp1({class: 'someclass',child: ctx['state'].child}, key + \`__1\`, node, this, null);
|
||||||
}
|
}
|
||||||
}"
|
}"
|
||||||
@@ -174,12 +162,11 @@ exports[`style and class handling class on sub component, which is switched to a
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_1001\\"
|
|
||||||
const comp1 = app.createComponent(\`ChildA\`, true, false, false, [\\"class\\"]);
|
const comp1 = app.createComponent(\`ChildA\`, true, false, false, [\\"class\\"]);
|
||||||
const comp2 = app.createComponent(\`ChildB\`, true, false, false, [\\"class\\"]);
|
const comp2 = app.createComponent(\`ChildB\`, true, false, false, [\\"class\\"]);
|
||||||
|
|
||||||
return function xml_template_1001_Child(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
let b2,b3;
|
let b2, b3;
|
||||||
if (ctx['props'].child==='a') {
|
if (ctx['props'].child==='a') {
|
||||||
b2 = comp1({class: ctx['props'].class}, key + \`__1\`, node, this, null);
|
b2 = comp1({class: ctx['props'].class}, key + \`__1\`, node, this, null);
|
||||||
} else {
|
} else {
|
||||||
@@ -194,11 +181,10 @@ exports[`style and class handling class on sub component, which is switched to a
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_999\\"
|
|
||||||
|
|
||||||
let block1 = createBlock(\`<div block-attribute-0=\\"class\\">a</div>\`);
|
let block1 = createBlock(\`<div block-attribute-0=\\"class\\">a</div>\`);
|
||||||
|
|
||||||
return function xml_template_999_ChildA(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
let attr1 = ctx['props'].class;
|
let attr1 = ctx['props'].class;
|
||||||
return block1([attr1]);
|
return block1([attr1]);
|
||||||
}
|
}
|
||||||
@@ -209,11 +195,10 @@ exports[`style and class handling class on sub component, which is switched to a
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_1000\\"
|
|
||||||
|
|
||||||
let block1 = createBlock(\`<span block-attribute-0=\\"class\\">b</span>\`);
|
let block1 = createBlock(\`<span block-attribute-0=\\"class\\">b</span>\`);
|
||||||
|
|
||||||
return function xml_template_1000_ChildB(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
let attr1 = ctx['props'].class;
|
let attr1 = ctx['props'].class;
|
||||||
return block1([attr1]);
|
return block1([attr1]);
|
||||||
}
|
}
|
||||||
@@ -224,12 +209,11 @@ exports[`style and class handling class with extra whitespaces (variation) 1`] =
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_1000\\"
|
|
||||||
const comp1 = app.createComponent(\`Child\`, true, false, false, [\\"class\\"]);
|
const comp1 = app.createComponent(\`Child\`, true, false, false, [\\"class\\"]);
|
||||||
|
|
||||||
let block1 = createBlock(\`<p><block-child-0/></p>\`);
|
let block1 = createBlock(\`<p><block-child-0/></p>\`);
|
||||||
|
|
||||||
return function xml_template_1000_Parent(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
const b2 = comp1({class: 'a b c d'}, key + \`__1\`, node, this, null);
|
const b2 = comp1({class: 'a b c d'}, key + \`__1\`, node, this, null);
|
||||||
return block1([], [b2]);
|
return block1([], [b2]);
|
||||||
}
|
}
|
||||||
@@ -240,11 +224,10 @@ exports[`style and class handling class with extra whitespaces (variation) 2`] =
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_999\\"
|
|
||||||
|
|
||||||
let block1 = createBlock(\`<div block-attribute-0=\\"class\\"/>\`);
|
let block1 = createBlock(\`<div block-attribute-0=\\"class\\"/>\`);
|
||||||
|
|
||||||
return function xml_template_999_Child(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
let attr1 = ctx['props'].class;
|
let attr1 = ctx['props'].class;
|
||||||
return block1([attr1]);
|
return block1([attr1]);
|
||||||
}
|
}
|
||||||
@@ -255,10 +238,9 @@ exports[`style and class handling class with extra whitespaces 1`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_1000\\"
|
|
||||||
const comp1 = app.createComponent(\`Child\`, true, false, false, [\\"class\\"]);
|
const comp1 = app.createComponent(\`Child\`, true, false, false, [\\"class\\"]);
|
||||||
|
|
||||||
return function xml_template_1000_Parent(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
return comp1({class: 'a b c d'}, key + \`__1\`, node, this, null);
|
return comp1({class: 'a b c d'}, key + \`__1\`, node, this, null);
|
||||||
}
|
}
|
||||||
}"
|
}"
|
||||||
@@ -268,11 +250,10 @@ exports[`style and class handling class with extra whitespaces 2`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_999\\"
|
|
||||||
|
|
||||||
let block1 = createBlock(\`<div block-attribute-0=\\"class\\"/>\`);
|
let block1 = createBlock(\`<div block-attribute-0=\\"class\\"/>\`);
|
||||||
|
|
||||||
return function xml_template_999_Child(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
let attr1 = ctx['props'].class;
|
let attr1 = ctx['props'].class;
|
||||||
return block1([attr1]);
|
return block1([attr1]);
|
||||||
}
|
}
|
||||||
@@ -283,10 +264,9 @@ exports[`style and class handling component class and parent class combine toget
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_1000\\"
|
|
||||||
const comp1 = app.createComponent(\`Child\`, true, false, false, [\\"class\\"]);
|
const comp1 = app.createComponent(\`Child\`, true, false, false, [\\"class\\"]);
|
||||||
|
|
||||||
return function xml_template_1000_Parent(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
return comp1({class: 'from parent'}, key + \`__1\`, node, this, null);
|
return comp1({class: 'from parent'}, key + \`__1\`, node, this, null);
|
||||||
}
|
}
|
||||||
}"
|
}"
|
||||||
@@ -296,11 +276,10 @@ exports[`style and class handling component class and parent class combine toget
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_999\\"
|
|
||||||
|
|
||||||
let block1 = createBlock(\`<div class=\\"child\\" block-attribute-0=\\"class\\">child</div>\`);
|
let block1 = createBlock(\`<div class=\\"child\\" block-attribute-0=\\"class\\">child</div>\`);
|
||||||
|
|
||||||
return function xml_template_999_Child(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
let attr1 = ctx['props'].class;
|
let attr1 = ctx['props'].class;
|
||||||
return block1([attr1]);
|
return block1([attr1]);
|
||||||
}
|
}
|
||||||
@@ -338,12 +317,11 @@ exports[`style and class handling empty class attribute is not added on widget r
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_1000\\"
|
|
||||||
const comp1 = app.createComponent(\`Child\`, true, false, false, [\\"class\\"]);
|
const comp1 = app.createComponent(\`Child\`, true, false, false, [\\"class\\"]);
|
||||||
|
|
||||||
let block1 = createBlock(\`<div><block-child-0/></div>\`);
|
let block1 = createBlock(\`<div><block-child-0/></div>\`);
|
||||||
|
|
||||||
return function xml_template_1000_Parent(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
const b2 = comp1({class: undefined}, key + \`__1\`, node, this, null);
|
const b2 = comp1({class: undefined}, key + \`__1\`, node, this, null);
|
||||||
return block1([], [b2]);
|
return block1([], [b2]);
|
||||||
}
|
}
|
||||||
@@ -354,11 +332,10 @@ exports[`style and class handling empty class attribute is not added on widget r
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_999\\"
|
|
||||||
|
|
||||||
let block1 = createBlock(\`<span block-attribute-0=\\"class\\"/>\`);
|
let block1 = createBlock(\`<span block-attribute-0=\\"class\\"/>\`);
|
||||||
|
|
||||||
return function xml_template_999_Child(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
let attr1 = ctx['props'].class;
|
let attr1 = ctx['props'].class;
|
||||||
return block1([attr1]);
|
return block1([attr1]);
|
||||||
}
|
}
|
||||||
@@ -369,10 +346,9 @@ exports[`style and class handling error in subcomponent with class 1`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_1000\\"
|
|
||||||
const comp1 = app.createComponent(\`Child\`, true, false, false, [\\"class\\"]);
|
const comp1 = app.createComponent(\`Child\`, true, false, false, [\\"class\\"]);
|
||||||
|
|
||||||
return function xml_template_1000_Parent(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
return comp1({class: 'a'}, key + \`__1\`, node, this, null);
|
return comp1({class: 'a'}, key + \`__1\`, node, this, null);
|
||||||
}
|
}
|
||||||
}"
|
}"
|
||||||
@@ -382,11 +358,10 @@ exports[`style and class handling error in subcomponent with class 2`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_999\\"
|
|
||||||
|
|
||||||
let block1 = createBlock(\`<div block-attribute-0=\\"class\\"><block-text-1/></div>\`);
|
let block1 = createBlock(\`<div block-attribute-0=\\"class\\"><block-text-1/></div>\`);
|
||||||
|
|
||||||
return function xml_template_999_Child(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
let attr1 = ctx['props'].class;
|
let attr1 = ctx['props'].class;
|
||||||
let txt1 = ctx['this'].will.crash;
|
let txt1 = ctx['this'].will.crash;
|
||||||
return block1([attr1, txt1]);
|
return block1([attr1, txt1]);
|
||||||
@@ -398,10 +373,9 @@ exports[`style and class handling no class is set is child ignores it 1`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_1000\\"
|
|
||||||
const comp1 = app.createComponent(\`Child\`, true, false, false, [\\"class\\"]);
|
const comp1 = app.createComponent(\`Child\`, true, false, false, [\\"class\\"]);
|
||||||
|
|
||||||
return function xml_template_1000_Parent(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
return comp1({class: 'hey'}, key + \`__1\`, node, this, null);
|
return comp1({class: 'hey'}, key + \`__1\`, node, this, null);
|
||||||
}
|
}
|
||||||
}"
|
}"
|
||||||
@@ -411,11 +385,10 @@ exports[`style and class handling no class is set is child ignores it 2`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_999\\"
|
|
||||||
|
|
||||||
let block1 = createBlock(\`<div>child</div>\`);
|
let block1 = createBlock(\`<div>child</div>\`);
|
||||||
|
|
||||||
return function xml_template_999_Child(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
return block1();
|
return block1();
|
||||||
}
|
}
|
||||||
}"
|
}"
|
||||||
@@ -425,10 +398,9 @@ exports[`style and class handling no class is set is parent does not give it as
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_1000\\"
|
|
||||||
const comp1 = app.createComponent(\`Child\`, true, false, false, []);
|
const comp1 = app.createComponent(\`Child\`, true, false, false, []);
|
||||||
|
|
||||||
return function xml_template_1000_Parent(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
return comp1({}, key + \`__1\`, node, this, null);
|
return comp1({}, key + \`__1\`, node, this, null);
|
||||||
}
|
}
|
||||||
}"
|
}"
|
||||||
@@ -438,11 +410,10 @@ exports[`style and class handling no class is set is parent does not give it as
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_999\\"
|
|
||||||
|
|
||||||
let block1 = createBlock(\`<div block-attribute-0=\\"class\\">child</div>\`);
|
let block1 = createBlock(\`<div block-attribute-0=\\"class\\">child</div>\`);
|
||||||
|
|
||||||
return function xml_template_999_Child(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
let attr1 = ctx['props'].class;
|
let attr1 = ctx['props'].class;
|
||||||
return block1([attr1]);
|
return block1([attr1]);
|
||||||
}
|
}
|
||||||
@@ -453,10 +424,9 @@ exports[`style and class handling style is properly added on widget root el 1`]
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_1000\\"
|
|
||||||
const comp1 = app.createComponent(\`Child\`, true, false, false, [\\"style\\"]);
|
const comp1 = app.createComponent(\`Child\`, true, false, false, [\\"style\\"]);
|
||||||
|
|
||||||
return function xml_template_1000_ParentWidget(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
return comp1({style: 'font-weight: bold;'}, key + \`__1\`, node, this, null);
|
return comp1({style: 'font-weight: bold;'}, key + \`__1\`, node, this, null);
|
||||||
}
|
}
|
||||||
}"
|
}"
|
||||||
@@ -466,11 +436,10 @@ exports[`style and class handling style is properly added on widget root el 2`]
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_999\\"
|
|
||||||
|
|
||||||
let block1 = createBlock(\`<div block-attribute-0=\\"style\\"/>\`);
|
let block1 = createBlock(\`<div block-attribute-0=\\"style\\"/>\`);
|
||||||
|
|
||||||
return function xml_template_999_SomeComponent(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
let attr1 = ctx['props'].style;
|
let attr1 = ctx['props'].style;
|
||||||
return block1([attr1]);
|
return block1([attr1]);
|
||||||
}
|
}
|
||||||
@@ -481,12 +450,11 @@ exports[`style and class handling t-att-class is properly added/removed on widge
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_1000\\"
|
|
||||||
const comp1 = app.createComponent(\`Child\`, true, false, false, [\\"class\\"]);
|
const comp1 = app.createComponent(\`Child\`, true, false, false, [\\"class\\"]);
|
||||||
|
|
||||||
let block1 = createBlock(\`<div><block-child-0/></div>\`);
|
let block1 = createBlock(\`<div><block-child-0/></div>\`);
|
||||||
|
|
||||||
return function xml_template_1000_Parent(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
const b2 = comp1({class: {b:ctx['state'].b}}, key + \`__1\`, node, this, null);
|
const b2 = comp1({class: {b:ctx['state'].b}}, key + \`__1\`, node, this, null);
|
||||||
return block1([], [b2]);
|
return block1([], [b2]);
|
||||||
}
|
}
|
||||||
@@ -497,11 +465,10 @@ exports[`style and class handling t-att-class is properly added/removed on widge
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_999\\"
|
|
||||||
|
|
||||||
let block1 = createBlock(\`<span class=\\"c\\" block-attribute-0=\\"class\\"/>\`);
|
let block1 = createBlock(\`<span class=\\"c\\" block-attribute-0=\\"class\\"/>\`);
|
||||||
|
|
||||||
return function xml_template_999_Child(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
let attr1 = {d:ctx['state'].d,...ctx['props'].class};
|
let attr1 = {d:ctx['state'].d,...ctx['props'].class};
|
||||||
return block1([attr1]);
|
return block1([attr1]);
|
||||||
}
|
}
|
||||||
@@ -512,10 +479,9 @@ exports[`style and class handling t-att-class is properly added/removed on widge
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_1000\\"
|
|
||||||
const comp1 = app.createComponent(\`Child\`, true, false, false, [\\"class\\"]);
|
const comp1 = app.createComponent(\`Child\`, true, false, false, [\\"class\\"]);
|
||||||
|
|
||||||
return function xml_template_1000_Parent(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
return comp1({class: {a:true,b:ctx['state'].b}}, key + \`__1\`, node, this, null);
|
return comp1({class: {a:true,b:ctx['state'].b}}, key + \`__1\`, node, this, null);
|
||||||
}
|
}
|
||||||
}"
|
}"
|
||||||
@@ -525,11 +491,10 @@ exports[`style and class handling t-att-class is properly added/removed on widge
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_999\\"
|
|
||||||
|
|
||||||
let block1 = createBlock(\`<span class=\\"c\\" block-attribute-0=\\"class\\"/>\`);
|
let block1 = createBlock(\`<span class=\\"c\\" block-attribute-0=\\"class\\"/>\`);
|
||||||
|
|
||||||
return function xml_template_999_Child(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
let attr1 = {d:ctx['state'].d,...ctx['props'].class};
|
let attr1 = {d:ctx['state'].d,...ctx['props'].class};
|
||||||
return block1([attr1]);
|
return block1([attr1]);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,14 +5,13 @@ exports[`t-call dynamic t-call 1`] = `
|
|||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
let { isBoundary, zero } = helpers;
|
let { isBoundary, zero } = helpers;
|
||||||
// Template name: \\"xml_template_999\\"
|
|
||||||
const call = app.callTemplate.bind(app);
|
const call = app.callTemplate.bind(app);
|
||||||
|
|
||||||
return function xml_template_999_Root(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
ctx = Object.create(ctx);
|
ctx = Object.create(ctx);
|
||||||
ctx[isBoundary] = 1;
|
ctx[isBoundary] = 1;
|
||||||
const b1 = text(\` owl \`);
|
const b2 = text(\` owl \`);
|
||||||
ctx[zero] = b1;
|
ctx[zero] = b2;
|
||||||
const template1 = (ctx['current'].template);
|
const template1 = (ctx['current'].template);
|
||||||
return call(this, template1, ctx, node, key + \`__1\`);
|
return call(this, template1, ctx, node, key + \`__1\`);
|
||||||
}
|
}
|
||||||
@@ -23,11 +22,10 @@ exports[`t-call dynamic t-call 2`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"foo\\"
|
|
||||||
|
|
||||||
let block1 = createBlock(\`<div>foo</div>\`);
|
let block1 = createBlock(\`<div>foo</div>\`);
|
||||||
|
|
||||||
return function foo(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
return block1();
|
return block1();
|
||||||
}
|
}
|
||||||
}"
|
}"
|
||||||
@@ -37,9 +35,8 @@ exports[`t-call dynamic t-call 3`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"bar\\"
|
|
||||||
|
|
||||||
return function bar(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
return text(\`bar\`);
|
return text(\`bar\`);
|
||||||
}
|
}
|
||||||
}"
|
}"
|
||||||
@@ -49,10 +46,9 @@ exports[`t-call dynamic t-call with same sub component 1`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_1000\\"
|
|
||||||
const call = app.callTemplate.bind(app);
|
const call = app.callTemplate.bind(app);
|
||||||
|
|
||||||
return function xml_template_1000_Root(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
const b2 = text(ctx['current'].template);
|
const b2 = text(ctx['current'].template);
|
||||||
const template1 = (ctx['current'].template);
|
const template1 = (ctx['current'].template);
|
||||||
const b3 = call(this, template1, ctx, node, key + \`__1\`);
|
const b3 = call(this, template1, ctx, node, key + \`__1\`);
|
||||||
@@ -65,10 +61,9 @@ exports[`t-call dynamic t-call with same sub component 2`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"A\\"
|
|
||||||
const comp1 = app.createComponent(\`Child\`, true, false, false, []);
|
const comp1 = app.createComponent(\`Child\`, true, false, false, []);
|
||||||
|
|
||||||
return function A(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
return comp1({}, key + \`__1\`, node, this, null);
|
return comp1({}, key + \`__1\`, node, this, null);
|
||||||
}
|
}
|
||||||
}"
|
}"
|
||||||
@@ -78,9 +73,8 @@ exports[`t-call dynamic t-call with same sub component 3`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_999\\"
|
|
||||||
|
|
||||||
return function xml_template_999_Child(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
return text(\`child\`);
|
return text(\`child\`);
|
||||||
}
|
}
|
||||||
}"
|
}"
|
||||||
@@ -90,10 +84,9 @@ exports[`t-call dynamic t-call with same sub component 4`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"B\\"
|
|
||||||
const comp1 = app.createComponent(\`Child\`, true, false, false, []);
|
const comp1 = app.createComponent(\`Child\`, true, false, false, []);
|
||||||
|
|
||||||
return function B(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
return comp1({}, key + \`__1\`, node, this, null);
|
return comp1({}, key + \`__1\`, node, this, null);
|
||||||
}
|
}
|
||||||
}"
|
}"
|
||||||
@@ -103,11 +96,10 @@ exports[`t-call dynamic t-call: key is propagated 1`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_1001\\"
|
|
||||||
const comp1 = app.createComponent(\`Child\`, true, false, false, []);
|
const comp1 = app.createComponent(\`Child\`, true, false, false, []);
|
||||||
const call = app.callTemplate.bind(app);
|
const call = app.callTemplate.bind(app);
|
||||||
|
|
||||||
return function xml_template_1001_Parent(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
const b2 = comp1({}, key + \`__1\`, node, this, null);
|
const b2 = comp1({}, key + \`__1\`, node, this, null);
|
||||||
const template1 = (ctx['sub']);
|
const template1 = (ctx['sub']);
|
||||||
const b3 = call(this, template1, ctx, node, key + \`__2\`);
|
const b3 = call(this, template1, ctx, node, key + \`__2\`);
|
||||||
@@ -120,11 +112,10 @@ exports[`t-call dynamic t-call: key is propagated 2`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_999\\"
|
|
||||||
|
|
||||||
let block1 = createBlock(\`<div block-attribute-0=\\"id\\"/>\`);
|
let block1 = createBlock(\`<div block-attribute-0=\\"id\\"/>\`);
|
||||||
|
|
||||||
return function xml_template_999_Child(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
let attr1 = ctx['id'];
|
let attr1 = ctx['id'];
|
||||||
return block1([attr1]);
|
return block1([attr1]);
|
||||||
}
|
}
|
||||||
@@ -135,10 +126,9 @@ exports[`t-call dynamic t-call: key is propagated 3`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_1000\\"
|
|
||||||
const comp1 = app.createComponent(\`Child\`, true, false, false, []);
|
const comp1 = app.createComponent(\`Child\`, true, false, false, []);
|
||||||
|
|
||||||
return function xml_template_1000(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
return comp1({}, key + \`__1\`, node, this, null);
|
return comp1({}, key + \`__1\`, node, this, null);
|
||||||
}
|
}
|
||||||
}"
|
}"
|
||||||
@@ -148,13 +138,12 @@ exports[`t-call handlers are properly bound through a dynamic t-call 1`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_1000\\"
|
|
||||||
const call = app.callTemplate.bind(app);
|
const call = app.callTemplate.bind(app);
|
||||||
|
|
||||||
let block1 = createBlock(\`<div><block-child-0/><block-text-0/></div>\`);
|
let block1 = createBlock(\`<div><block-child-0/><block-text-0/></div>\`);
|
||||||
|
|
||||||
return function xml_template_1000_Parent(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
const template1 = ('xml_template_999');
|
const template1 = ('__template__999');
|
||||||
const b2 = call(this, template1, ctx, node, key + \`__1\`);
|
const b2 = call(this, template1, ctx, node, key + \`__1\`);
|
||||||
let txt1 = ctx['counter'];
|
let txt1 = ctx['counter'];
|
||||||
return block1([txt1], [b2]);
|
return block1([txt1], [b2]);
|
||||||
@@ -166,11 +155,10 @@ exports[`t-call handlers are properly bound through a dynamic t-call 2`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_999\\"
|
|
||||||
|
|
||||||
let block1 = createBlock(\`<p block-handler-0=\\"click\\">lucas</p>\`);
|
let block1 = createBlock(\`<p block-handler-0=\\"click\\">lucas</p>\`);
|
||||||
|
|
||||||
return function xml_template_999(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
const v1 = ctx['this'];
|
const v1 = ctx['this'];
|
||||||
let hdlr1 = [()=>v1.update(), ctx];
|
let hdlr1 = [()=>v1.update(), ctx];
|
||||||
return block1([hdlr1]);
|
return block1([hdlr1]);
|
||||||
@@ -182,12 +170,11 @@ exports[`t-call handlers are properly bound through a t-call 1`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_1000\\"
|
const callTemplate_1 = app.getTemplate(\`__template__999\`);
|
||||||
const callTemplate_1 = app.getTemplate(\`xml_template_999\`);
|
|
||||||
|
|
||||||
let block1 = createBlock(\`<div><block-child-0/><block-text-0/></div>\`);
|
let block1 = createBlock(\`<div><block-child-0/><block-text-0/></div>\`);
|
||||||
|
|
||||||
return function xml_template_1000_Parent(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
const b2 = callTemplate_1.call(this, ctx, node, key + \`__1\`);
|
const b2 = callTemplate_1.call(this, ctx, node, key + \`__1\`);
|
||||||
let txt1 = ctx['counter'];
|
let txt1 = ctx['counter'];
|
||||||
return block1([txt1], [b2]);
|
return block1([txt1], [b2]);
|
||||||
@@ -199,11 +186,10 @@ exports[`t-call handlers are properly bound through a t-call 2`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_999\\"
|
|
||||||
|
|
||||||
let block1 = createBlock(\`<p block-handler-0=\\"click\\">lucas</p>\`);
|
let block1 = createBlock(\`<p block-handler-0=\\"click\\">lucas</p>\`);
|
||||||
|
|
||||||
return function xml_template_999(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
let hdlr1 = [ctx['update'], ctx];
|
let hdlr1 = [ctx['update'], ctx];
|
||||||
return block1([hdlr1]);
|
return block1([hdlr1]);
|
||||||
}
|
}
|
||||||
@@ -214,12 +200,11 @@ exports[`t-call handlers with arguments are properly bound through a t-call 1`]
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_1000\\"
|
const callTemplate_1 = app.getTemplate(\`__template__999\`);
|
||||||
const callTemplate_1 = app.getTemplate(\`xml_template_999\`);
|
|
||||||
|
|
||||||
let block1 = createBlock(\`<div><block-child-0/></div>\`);
|
let block1 = createBlock(\`<div><block-child-0/></div>\`);
|
||||||
|
|
||||||
return function xml_template_1000_Parent(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
const b2 = callTemplate_1.call(this, ctx, node, key + \`__1\`);
|
const b2 = callTemplate_1.call(this, ctx, node, key + \`__1\`);
|
||||||
return block1([], [b2]);
|
return block1([], [b2]);
|
||||||
}
|
}
|
||||||
@@ -230,11 +215,10 @@ exports[`t-call handlers with arguments are properly bound through a t-call 2`]
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_999\\"
|
|
||||||
|
|
||||||
let block1 = createBlock(\`<p block-handler-0=\\"click\\">lucas</p>\`);
|
let block1 = createBlock(\`<p block-handler-0=\\"click\\">lucas</p>\`);
|
||||||
|
|
||||||
return function xml_template_999(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
const v1 = ctx['this'];
|
const v1 = ctx['this'];
|
||||||
const v2 = ctx['a'];
|
const v2 = ctx['a'];
|
||||||
let hdlr1 = [()=>v1.update(v2), ctx];
|
let hdlr1 = [()=>v1.update(v2), ctx];
|
||||||
@@ -247,12 +231,11 @@ exports[`t-call parent is set within t-call 1`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_1001\\"
|
const callTemplate_1 = app.getTemplate(\`__template__999\`);
|
||||||
const callTemplate_1 = app.getTemplate(\`xml_template_999\`);
|
|
||||||
|
|
||||||
let block1 = createBlock(\`<div><block-child-0/></div>\`);
|
let block1 = createBlock(\`<div><block-child-0/></div>\`);
|
||||||
|
|
||||||
return function xml_template_1001_Parent(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
const b2 = callTemplate_1.call(this, ctx, node, key + \`__1\`);
|
const b2 = callTemplate_1.call(this, ctx, node, key + \`__1\`);
|
||||||
return block1([], [b2]);
|
return block1([], [b2]);
|
||||||
}
|
}
|
||||||
@@ -263,10 +246,9 @@ exports[`t-call parent is set within t-call 2`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_999\\"
|
|
||||||
const comp1 = app.createComponent(\`Child\`, true, false, false, []);
|
const comp1 = app.createComponent(\`Child\`, true, false, false, []);
|
||||||
|
|
||||||
return function xml_template_999(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
return comp1({}, key + \`__1\`, node, this, null);
|
return comp1({}, key + \`__1\`, node, this, null);
|
||||||
}
|
}
|
||||||
}"
|
}"
|
||||||
@@ -276,11 +258,10 @@ exports[`t-call parent is set within t-call 3`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_1000\\"
|
|
||||||
|
|
||||||
let block1 = createBlock(\`<span>lucas</span>\`);
|
let block1 = createBlock(\`<span>lucas</span>\`);
|
||||||
|
|
||||||
return function xml_template_1000_Child(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
return block1();
|
return block1();
|
||||||
}
|
}
|
||||||
}"
|
}"
|
||||||
@@ -290,10 +271,9 @@ exports[`t-call parent is set within t-call with no parentNode 1`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_1001\\"
|
const callTemplate_1 = app.getTemplate(\`__template__999\`);
|
||||||
const callTemplate_1 = app.getTemplate(\`xml_template_999\`);
|
|
||||||
|
|
||||||
return function xml_template_1001_Parent(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
return callTemplate_1.call(this, ctx, node, key + \`__1\`);
|
return callTemplate_1.call(this, ctx, node, key + \`__1\`);
|
||||||
}
|
}
|
||||||
}"
|
}"
|
||||||
@@ -303,10 +283,9 @@ exports[`t-call parent is set within t-call with no parentNode 2`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_999\\"
|
|
||||||
const comp1 = app.createComponent(\`Child\`, true, false, false, []);
|
const comp1 = app.createComponent(\`Child\`, true, false, false, []);
|
||||||
|
|
||||||
return function xml_template_999(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
return comp1({}, key + \`__1\`, node, this, null);
|
return comp1({}, key + \`__1\`, node, this, null);
|
||||||
}
|
}
|
||||||
}"
|
}"
|
||||||
@@ -316,11 +295,10 @@ exports[`t-call parent is set within t-call with no parentNode 3`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_1000\\"
|
|
||||||
|
|
||||||
let block1 = createBlock(\`<span>lucas</span>\`);
|
let block1 = createBlock(\`<span>lucas</span>\`);
|
||||||
|
|
||||||
return function xml_template_1000_Child(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
return block1();
|
return block1();
|
||||||
}
|
}
|
||||||
}"
|
}"
|
||||||
@@ -331,12 +309,11 @@ exports[`t-call recursive t-call binding this -- static t-call 1`] = `
|
|||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
let { isBoundary, withDefault, setContextValue } = helpers;
|
let { isBoundary, withDefault, setContextValue } = helpers;
|
||||||
// Template name: \\"xml_template_999\\"
|
|
||||||
const callTemplate_1 = app.getTemplate(\`recursive\`);
|
const callTemplate_1 = app.getTemplate(\`recursive\`);
|
||||||
|
|
||||||
let block1 = createBlock(\`<div><block-child-0/></div>\`);
|
let block1 = createBlock(\`<div><block-child-0/></div>\`);
|
||||||
|
|
||||||
return function xml_template_999_Parent(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
ctx = Object.create(ctx);
|
ctx = Object.create(ctx);
|
||||||
ctx[isBoundary] = 1
|
ctx[isBoundary] = 1
|
||||||
ctx = Object.create(ctx);
|
ctx = Object.create(ctx);
|
||||||
@@ -353,12 +330,11 @@ exports[`t-call recursive t-call binding this -- static t-call 2`] = `
|
|||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
let { isBoundary, withDefault, setContextValue } = helpers;
|
let { isBoundary, withDefault, setContextValue } = helpers;
|
||||||
// Template name: \\"recursive\\"
|
|
||||||
const callTemplate_1 = app.getTemplate(\`recursive\`);
|
const callTemplate_1 = app.getTemplate(\`recursive\`);
|
||||||
|
|
||||||
let block3 = createBlock(\`<div block-handler-0=\\"click.stop\\"><block-text-1/></div>\`);
|
let block3 = createBlock(\`<div block-handler-0=\\"click.stop\\"><block-text-1/></div>\`);
|
||||||
|
|
||||||
return function recursive(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
ctx = Object.create(ctx);
|
ctx = Object.create(ctx);
|
||||||
ctx[isBoundary] = 1
|
ctx[isBoundary] = 1
|
||||||
let b2;
|
let b2;
|
||||||
@@ -382,14 +358,13 @@ exports[`t-call sub components in two t-calls 1`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_1000\\"
|
|
||||||
const callTemplate_1 = app.getTemplate(\`sub\`);
|
const callTemplate_1 = app.getTemplate(\`sub\`);
|
||||||
const callTemplate_2 = app.getTemplate(\`sub\`);
|
const callTemplate_2 = app.getTemplate(\`sub\`);
|
||||||
|
|
||||||
let block3 = createBlock(\`<div><block-child-0/></div>\`);
|
let block3 = createBlock(\`<div><block-child-0/></div>\`);
|
||||||
|
|
||||||
return function xml_template_1000_Parent(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
let b2,b3;
|
let b2, b3;
|
||||||
if (ctx['state'].val===1) {
|
if (ctx['state'].val===1) {
|
||||||
b2 = callTemplate_1.call(this, ctx, node, key + \`__1\`);
|
b2 = callTemplate_1.call(this, ctx, node, key + \`__1\`);
|
||||||
} else {
|
} else {
|
||||||
@@ -405,10 +380,9 @@ exports[`t-call sub components in two t-calls 2`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"sub\\"
|
|
||||||
const comp1 = app.createComponent(\`Child\`, true, false, false, [\\"val\\"]);
|
const comp1 = app.createComponent(\`Child\`, true, false, false, [\\"val\\"]);
|
||||||
|
|
||||||
return function sub(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
return comp1({val: ctx['state'].val}, key + \`__1\`, node, this, null);
|
return comp1({val: ctx['state'].val}, key + \`__1\`, node, this, null);
|
||||||
}
|
}
|
||||||
}"
|
}"
|
||||||
@@ -418,11 +392,10 @@ exports[`t-call sub components in two t-calls 3`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_999\\"
|
|
||||||
|
|
||||||
let block1 = createBlock(\`<span><block-text-0/></span>\`);
|
let block1 = createBlock(\`<span><block-text-0/></span>\`);
|
||||||
|
|
||||||
return function xml_template_999_Child(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
let txt1 = ctx['props'].val;
|
let txt1 = ctx['props'].val;
|
||||||
return block1([txt1]);
|
return block1([txt1]);
|
||||||
}
|
}
|
||||||
@@ -434,20 +407,19 @@ exports[`t-call t-call in t-foreach and children component 1`] = `
|
|||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
let { prepareList, withKey } = helpers;
|
let { prepareList, withKey } = helpers;
|
||||||
// Template name: \\"xml_template_1001\\"
|
const callTemplate_1 = app.getTemplate(\`__template__999\`);
|
||||||
const callTemplate_1 = app.getTemplate(\`xml_template_999\`);
|
|
||||||
|
|
||||||
let block1 = createBlock(\`<div><block-child-0/></div>\`);
|
let block1 = createBlock(\`<div><block-child-0/></div>\`);
|
||||||
|
|
||||||
return function xml_template_1001_Parent(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
ctx = Object.create(ctx);
|
ctx = Object.create(ctx);
|
||||||
const [k_block2, v_block2, l_block2, c_block2] = prepareList(['a','b','c']);;
|
const [k_block2, v_block2, l_block2, c_block2] = prepareList(['a','b','c']);;
|
||||||
for (let i1 = 0; i1 < l_block2; i1++) {
|
for (let i1 = 0; i1 < l_block2; i1++) {
|
||||||
ctx[\`val\`] = v_block2[i1];
|
ctx[\`val\`] = k_block2[i1];
|
||||||
ctx[\`val_first\`] = i1 === 0;
|
ctx[\`val_first\`] = i1 === 0;
|
||||||
ctx[\`val_last\`] = i1 === v_block2.length - 1;
|
ctx[\`val_last\`] = i1 === k_block2.length - 1;
|
||||||
ctx[\`val_index\`] = i1;
|
ctx[\`val_index\`] = i1;
|
||||||
ctx[\`val_value\`] = k_block2[i1];
|
ctx[\`val_value\`] = v_block2[i1];
|
||||||
const key1 = ctx['val'];
|
const key1 = ctx['val'];
|
||||||
c_block2[i1] = withKey(callTemplate_1.call(this, ctx, node, key + \`__1__\${key1}\`), key1);
|
c_block2[i1] = withKey(callTemplate_1.call(this, ctx, node, key + \`__1__\${key1}\`), key1);
|
||||||
}
|
}
|
||||||
@@ -461,10 +433,9 @@ exports[`t-call t-call in t-foreach and children component 2`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_999\\"
|
|
||||||
const comp1 = app.createComponent(\`Child\`, true, false, false, [\\"val\\"]);
|
const comp1 = app.createComponent(\`Child\`, true, false, false, [\\"val\\"]);
|
||||||
|
|
||||||
return function xml_template_999(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
return comp1({val: ctx['val']}, key + \`__1\`, node, this, null);
|
return comp1({val: ctx['val']}, key + \`__1\`, node, this, null);
|
||||||
}
|
}
|
||||||
}"
|
}"
|
||||||
@@ -474,11 +445,10 @@ exports[`t-call t-call in t-foreach and children component 3`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_1000\\"
|
|
||||||
|
|
||||||
let block1 = createBlock(\`<span><block-text-0/></span>\`);
|
let block1 = createBlock(\`<span><block-text-0/></span>\`);
|
||||||
|
|
||||||
return function xml_template_1000_Child(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
let txt1 = ctx['props'].val;
|
let txt1 = ctx['props'].val;
|
||||||
return block1([txt1]);
|
return block1([txt1]);
|
||||||
}
|
}
|
||||||
@@ -489,10 +459,9 @@ exports[`t-call t-call with t-call-context and subcomponent 1`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_1000\\"
|
|
||||||
const callTemplate_1 = app.getTemplate(\`someTemplate\`);
|
const callTemplate_1 = app.getTemplate(\`someTemplate\`);
|
||||||
|
|
||||||
return function xml_template_1000_Root(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
let ctx1 = ctx['subctx'];
|
let ctx1 = ctx['subctx'];
|
||||||
return callTemplate_1.call(this, ctx1, node, key + \`__1\`);
|
return callTemplate_1.call(this, ctx1, node, key + \`__1\`);
|
||||||
}
|
}
|
||||||
@@ -503,11 +472,10 @@ exports[`t-call t-call with t-call-context and subcomponent 2`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"someTemplate\\"
|
|
||||||
const comp1 = app.createComponent(\`Child\`, true, false, false, [\\"name\\"]);
|
const comp1 = app.createComponent(\`Child\`, true, false, false, [\\"name\\"]);
|
||||||
const comp2 = app.createComponent(\`Child\`, true, false, false, [\\"name\\"]);
|
const comp2 = app.createComponent(\`Child\`, true, false, false, [\\"name\\"]);
|
||||||
|
|
||||||
return function someTemplate(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
const b2 = comp1({name: ctx['aab']}, key + \`__1\`, node, this, null);
|
const b2 = comp1({name: ctx['aab']}, key + \`__1\`, node, this, null);
|
||||||
const b3 = comp2({name: ctx['lpe']}, key + \`__2\`, node, this, null);
|
const b3 = comp2({name: ctx['lpe']}, key + \`__2\`, node, this, null);
|
||||||
return multi([b2, b3]);
|
return multi([b2, b3]);
|
||||||
@@ -519,9 +487,8 @@ exports[`t-call t-call with t-call-context and subcomponent 3`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_999\\"
|
|
||||||
|
|
||||||
return function xml_template_999_Child(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
const b2 = text(\`child\`);
|
const b2 = text(\`child\`);
|
||||||
const b3 = text(ctx['props'].name);
|
const b3 = text(ctx['props'].name);
|
||||||
return multi([b2, b3]);
|
return multi([b2, b3]);
|
||||||
@@ -533,10 +500,9 @@ exports[`t-call t-call with t-call-context and subcomponent, in dev mode 1`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_1000\\"
|
|
||||||
const callTemplate_1 = app.getTemplate(\`someTemplate\`);
|
const callTemplate_1 = app.getTemplate(\`someTemplate\`);
|
||||||
|
|
||||||
return function xml_template_1000_Root(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
let ctx1 = ctx['subctx'];
|
let ctx1 = ctx['subctx'];
|
||||||
return callTemplate_1.call(this, ctx1, node, key + \`__1\`);
|
return callTemplate_1.call(this, ctx1, node, key + \`__1\`);
|
||||||
}
|
}
|
||||||
@@ -547,11 +513,10 @@ exports[`t-call t-call with t-call-context and subcomponent, in dev mode 2`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"someTemplate\\"
|
|
||||||
const comp1 = app.createComponent(\`Child\`, true, false, false, [\\"name\\"]);
|
const comp1 = app.createComponent(\`Child\`, true, false, false, [\\"name\\"]);
|
||||||
const comp2 = app.createComponent(\`Child\`, true, false, false, [\\"name\\"]);
|
const comp2 = app.createComponent(\`Child\`, true, false, false, [\\"name\\"]);
|
||||||
|
|
||||||
return function someTemplate(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
const props1 = {name: ctx['aab']};
|
const props1 = {name: ctx['aab']};
|
||||||
helpers.validateProps(\`Child\`, props1, this);
|
helpers.validateProps(\`Child\`, props1, this);
|
||||||
const b2 = comp1(props1, key + \`__1\`, node, this, null);
|
const b2 = comp1(props1, key + \`__1\`, node, this, null);
|
||||||
@@ -567,9 +532,8 @@ exports[`t-call t-call with t-call-context and subcomponent, in dev mode 3`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_999\\"
|
|
||||||
|
|
||||||
return function xml_template_999_Child(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
const b2 = text(\`child\`);
|
const b2 = text(\`child\`);
|
||||||
const b3 = text(ctx['props'].name);
|
const b3 = text(ctx['props'].name);
|
||||||
return multi([b2, b3]);
|
return multi([b2, b3]);
|
||||||
@@ -581,10 +545,9 @@ exports[`t-call t-call with t-call-context, simple use 1`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_999\\"
|
|
||||||
const callTemplate_1 = app.getTemplate(\`someTemplate\`);
|
const callTemplate_1 = app.getTemplate(\`someTemplate\`);
|
||||||
|
|
||||||
return function xml_template_999_Root(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
let ctx1 = ctx['subctx'];
|
let ctx1 = ctx['subctx'];
|
||||||
return callTemplate_1.call(this, ctx1, node, key + \`__1\`);
|
return callTemplate_1.call(this, ctx1, node, key + \`__1\`);
|
||||||
}
|
}
|
||||||
@@ -595,9 +558,8 @@ exports[`t-call t-call with t-call-context, simple use 2`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"someTemplate\\"
|
|
||||||
|
|
||||||
return function someTemplate(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
const b2 = text(ctx['aab']);
|
const b2 = text(ctx['aab']);
|
||||||
const b3 = text(ctx['lpe']);
|
const b3 = text(ctx['lpe']);
|
||||||
return multi([b2, b3]);
|
return multi([b2, b3]);
|
||||||
@@ -609,10 +571,9 @@ exports[`t-call t-call-context: ComponentNode is not looked up in the context 1`
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_1000\\"
|
|
||||||
const callTemplate_1 = app.getTemplate(\`someTemplate\`);
|
const callTemplate_1 = app.getTemplate(\`someTemplate\`);
|
||||||
|
|
||||||
return function xml_template_1000_Root(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
let ctx1 = {method:function(){}};
|
let ctx1 = {method:function(){}};
|
||||||
return callTemplate_1.call(this, ctx1, node, key + \`__1\`);
|
return callTemplate_1.call(this, ctx1, node, key + \`__1\`);
|
||||||
}
|
}
|
||||||
@@ -624,7 +585,6 @@ exports[`t-call t-call-context: ComponentNode is not looked up in the context 2`
|
|||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
let { capture, isBoundary, withDefault, setContextValue, markRaw } = helpers;
|
let { capture, isBoundary, withDefault, setContextValue, markRaw } = helpers;
|
||||||
// Template name: \\"someTemplate\\"
|
|
||||||
const comp1 = app.createComponent(\`Child\`, true, true, false, []);
|
const comp1 = app.createComponent(\`Child\`, true, true, false, []);
|
||||||
|
|
||||||
let block2 = createBlock(\`<div block-ref=\\"0\\">outside slot</div>\`);
|
let block2 = createBlock(\`<div block-ref=\\"0\\">outside slot</div>\`);
|
||||||
@@ -642,7 +602,7 @@ exports[`t-call t-call-context: ComponentNode is not looked up in the context 2`
|
|||||||
return multi([b4, b5]);
|
return multi([b4, b5]);
|
||||||
}
|
}
|
||||||
|
|
||||||
return function someTemplate(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
let ref1 = (el) => this.__owl__.setRef((\`myRef\`), el);
|
let ref1 = (el) => this.__owl__.setRef((\`myRef\`), el);
|
||||||
const b2 = block2([ref1]);
|
const b2 = block2([ref1]);
|
||||||
const ctx1 = capture(ctx);
|
const ctx1 = capture(ctx);
|
||||||
@@ -657,9 +617,8 @@ exports[`t-call t-call-context: ComponentNode is not looked up in the context 3`
|
|||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
let { callSlot } = helpers;
|
let { callSlot } = helpers;
|
||||||
// Template name: \\"xml_template_999\\"
|
|
||||||
|
|
||||||
return function xml_template_999_Child(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
return callSlot(ctx, node, key, 'default', false, {});
|
return callSlot(ctx, node, key, 'default', false, {});
|
||||||
}
|
}
|
||||||
}"
|
}"
|
||||||
@@ -669,10 +628,9 @@ exports[`t-call t-call-context: slots don't make component available again when
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_1000\\"
|
|
||||||
const callTemplate_1 = app.getTemplate(\`template\`);
|
const callTemplate_1 = app.getTemplate(\`template\`);
|
||||||
|
|
||||||
return function xml_template_1000_Root(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
let ctx1 = {};
|
let ctx1 = {};
|
||||||
return callTemplate_1.call(this, ctx1, node, key + \`__1\`);
|
return callTemplate_1.call(this, ctx1, node, key + \`__1\`);
|
||||||
}
|
}
|
||||||
@@ -684,7 +642,6 @@ exports[`t-call t-call-context: slots don't make component available again when
|
|||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
let { isBoundary, withDefault, setContextValue, capture, markRaw } = helpers;
|
let { isBoundary, withDefault, setContextValue, capture, markRaw } = helpers;
|
||||||
// Template name: \\"template\\"
|
|
||||||
const comp1 = app.createComponent(\`Child\`, true, true, false, []);
|
const comp1 = app.createComponent(\`Child\`, true, true, false, []);
|
||||||
|
|
||||||
function slot1(ctx, node, key = \\"\\") {
|
function slot1(ctx, node, key = \\"\\") {
|
||||||
@@ -708,9 +665,8 @@ exports[`t-call t-call-context: slots don't make component available again when
|
|||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
let { callSlot } = helpers;
|
let { callSlot } = helpers;
|
||||||
// Template name: \\"xml_template_999\\"
|
|
||||||
|
|
||||||
return function xml_template_999_Child(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
return callSlot(ctx, node, key, 'default', false, {});
|
return callSlot(ctx, node, key, 'default', false, {});
|
||||||
}
|
}
|
||||||
}"
|
}"
|
||||||
@@ -720,10 +676,9 @@ exports[`t-call t-call-context: this is not available inside t-call-context 1`]
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_999\\"
|
|
||||||
const callTemplate_1 = app.getTemplate(\`someTemplate\`);
|
const callTemplate_1 = app.getTemplate(\`someTemplate\`);
|
||||||
|
|
||||||
return function xml_template_999_Root(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
let ctx1 = {};
|
let ctx1 = {};
|
||||||
return callTemplate_1.call(this, ctx1, node, key + \`__1\`);
|
return callTemplate_1.call(this, ctx1, node, key + \`__1\`);
|
||||||
}
|
}
|
||||||
@@ -734,9 +689,8 @@ exports[`t-call t-call-context: this is not available inside t-call-context 2`]
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"someTemplate\\"
|
|
||||||
|
|
||||||
return function someTemplate(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
return text(ctx['this']);
|
return text(ctx['this']);
|
||||||
}
|
}
|
||||||
}"
|
}"
|
||||||
|
|||||||
@@ -4,11 +4,10 @@ exports[`t-call-block simple t-call-block with static text 1`] = `
|
|||||||
"function anonymous(app, bdom, helpers
|
"function anonymous(app, bdom, helpers
|
||||||
) {
|
) {
|
||||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||||
// Template name: \\"xml_template_999\\"
|
|
||||||
|
|
||||||
let block1 = createBlock(\`<div><block-child-0/></div>\`);
|
let block1 = createBlock(\`<div><block-child-0/></div>\`);
|
||||||
|
|
||||||
return function xml_template_999_Test(ctx, node, key = \\"\\") {
|
return function template(ctx, node, key = \\"\\") {
|
||||||
const b2 = ctx['myBlock']();
|
const b2 = ctx['myBlock']();
|
||||||
return block1([], [b2]);
|
return block1([], [b2]);
|
||||||
}
|
}
|
||||||
|
|||||||