@odoo/owl 2.2.4 → 2.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/owl-devtools.zip +0 -0
- package/dist/owl.cjs.js +55 -65
- package/dist/owl.es.js +55 -65
- package/dist/owl.iife.js +55 -65
- package/dist/owl.iife.min.js +1 -1
- package/dist/types/compiler/code_generator.d.ts +0 -1
- package/dist/types/owl.d.ts +1 -0
- package/dist/types/runtime/app.d.ts +1 -0
- package/dist/types/version.d.ts +1 -1
- package/package.json +1 -1
package/dist/owl-devtools.zip
CHANGED
|
Binary file
|
package/dist/owl.cjs.js
CHANGED
|
@@ -714,12 +714,7 @@ function buildTree(node, parent = null, domParentTree = null) {
|
|
|
714
714
|
info.push({ type: "child", idx: index });
|
|
715
715
|
el = document.createTextNode("");
|
|
716
716
|
}
|
|
717
|
-
|
|
718
|
-
const ns = attrs.getNamedItem("block-ns");
|
|
719
|
-
if (ns) {
|
|
720
|
-
attrs.removeNamedItem("block-ns");
|
|
721
|
-
currentNS = ns.value;
|
|
722
|
-
}
|
|
717
|
+
currentNS || (currentNS = node.namespaceURI);
|
|
723
718
|
if (!el) {
|
|
724
719
|
el = currentNS
|
|
725
720
|
? document.createElementNS(currentNS, tagName)
|
|
@@ -735,6 +730,7 @@ function buildTree(node, parent = null, domParentTree = null) {
|
|
|
735
730
|
const fragment = document.createElement("template").content;
|
|
736
731
|
fragment.appendChild(el);
|
|
737
732
|
}
|
|
733
|
+
const attrs = node.attributes;
|
|
738
734
|
for (let i = 0; i < attrs.length; i++) {
|
|
739
735
|
const attrName = attrs[i].name;
|
|
740
736
|
const attrValue = attrs[i].value;
|
|
@@ -2185,7 +2181,7 @@ function delegateAndNotify(setterName, getterName, target) {
|
|
|
2185
2181
|
if (hadKey !== hasKey) {
|
|
2186
2182
|
notifyReactives(target, KEYCHANGES);
|
|
2187
2183
|
}
|
|
2188
|
-
if (originalValue !==
|
|
2184
|
+
if (originalValue !== target[getterName](key)) {
|
|
2189
2185
|
notifyReactives(target, key);
|
|
2190
2186
|
}
|
|
2191
2187
|
return ret;
|
|
@@ -3006,15 +3002,13 @@ function prepareList(collection) {
|
|
|
3006
3002
|
keys = [...collection.keys()];
|
|
3007
3003
|
values = [...collection.values()];
|
|
3008
3004
|
}
|
|
3005
|
+
else if (Symbol.iterator in Object(collection)) {
|
|
3006
|
+
keys = [...collection];
|
|
3007
|
+
values = keys;
|
|
3008
|
+
}
|
|
3009
3009
|
else if (collection && typeof collection === "object") {
|
|
3010
|
-
|
|
3011
|
-
|
|
3012
|
-
values = keys;
|
|
3013
|
-
}
|
|
3014
|
-
else {
|
|
3015
|
-
values = Object.values(collection);
|
|
3016
|
-
keys = Object.keys(collection);
|
|
3017
|
-
}
|
|
3010
|
+
values = Object.values(collection);
|
|
3011
|
+
keys = Object.keys(collection);
|
|
3018
3012
|
}
|
|
3019
3013
|
else {
|
|
3020
3014
|
throw new OwlError(`Invalid loop expression: "${collection}" is not iterable`);
|
|
@@ -3215,6 +3209,10 @@ class TemplateSet {
|
|
|
3215
3209
|
}
|
|
3216
3210
|
addTemplate(name, template) {
|
|
3217
3211
|
if (name in this.rawTemplates) {
|
|
3212
|
+
// this check can be expensive, just silently ignore double definitions outside dev mode
|
|
3213
|
+
if (!this.dev) {
|
|
3214
|
+
return;
|
|
3215
|
+
}
|
|
3218
3216
|
const rawTemplate = this.rawTemplates[name];
|
|
3219
3217
|
const currentAsString = typeof rawTemplate === "string"
|
|
3220
3218
|
? rawTemplate
|
|
@@ -3858,7 +3856,7 @@ class CodeGenerator {
|
|
|
3858
3856
|
createBlock(parentBlock, type, ctx) {
|
|
3859
3857
|
const hasRoot = this.target.hasRoot;
|
|
3860
3858
|
const block = new BlockDescription(this.target, type);
|
|
3861
|
-
if (!hasRoot
|
|
3859
|
+
if (!hasRoot) {
|
|
3862
3860
|
this.target.hasRoot = true;
|
|
3863
3861
|
block.isRoot = true;
|
|
3864
3862
|
}
|
|
@@ -3881,7 +3879,7 @@ class CodeGenerator {
|
|
|
3881
3879
|
if (ctx.tKeyExpr) {
|
|
3882
3880
|
blockExpr = `toggler(${ctx.tKeyExpr}, ${blockExpr})`;
|
|
3883
3881
|
}
|
|
3884
|
-
if (block.isRoot
|
|
3882
|
+
if (block.isRoot) {
|
|
3885
3883
|
if (this.target.on) {
|
|
3886
3884
|
blockExpr = this.wrapWithEventCatcher(blockExpr, this.target.on);
|
|
3887
3885
|
}
|
|
@@ -4057,11 +4055,6 @@ class CodeGenerator {
|
|
|
4057
4055
|
}
|
|
4058
4056
|
// attributes
|
|
4059
4057
|
const attrs = {};
|
|
4060
|
-
const nameSpace = ast.ns || ctx.nameSpace;
|
|
4061
|
-
if (nameSpace && isNewBlock) {
|
|
4062
|
-
// specific namespace uri
|
|
4063
|
-
attrs["block-ns"] = nameSpace;
|
|
4064
|
-
}
|
|
4065
4058
|
for (let key in ast.attrs) {
|
|
4066
4059
|
let expr, attrName;
|
|
4067
4060
|
if (key.startsWith("t-attf")) {
|
|
@@ -4177,7 +4170,10 @@ class CodeGenerator {
|
|
|
4177
4170
|
const idx = block.insertData(setRefStr, "ref");
|
|
4178
4171
|
attrs["block-ref"] = String(idx);
|
|
4179
4172
|
}
|
|
4180
|
-
const
|
|
4173
|
+
const nameSpace = ast.ns || ctx.nameSpace;
|
|
4174
|
+
const dom = nameSpace
|
|
4175
|
+
? xmlDoc.createElementNS(nameSpace, ast.tag)
|
|
4176
|
+
: xmlDoc.createElement(ast.tag);
|
|
4181
4177
|
for (const [attr, val] of Object.entries(attrs)) {
|
|
4182
4178
|
if (!(attr === "class" && val === "")) {
|
|
4183
4179
|
dom.setAttribute(attr, val);
|
|
@@ -4219,7 +4215,7 @@ class CodeGenerator {
|
|
|
4219
4215
|
break;
|
|
4220
4216
|
}
|
|
4221
4217
|
}
|
|
4222
|
-
this.addLine(`let ${block.children.map((c) => c.varName)};`, codeIdx);
|
|
4218
|
+
this.addLine(`let ${block.children.map((c) => c.varName).join(", ")};`, codeIdx);
|
|
4223
4219
|
}
|
|
4224
4220
|
}
|
|
4225
4221
|
return block.varName;
|
|
@@ -4322,7 +4318,7 @@ class CodeGenerator {
|
|
|
4322
4318
|
break;
|
|
4323
4319
|
}
|
|
4324
4320
|
}
|
|
4325
|
-
this.addLine(`let ${block.children.map((c) => c.varName)};`, codeIdx);
|
|
4321
|
+
this.addLine(`let ${block.children.map((c) => c.varName).join(", ")};`, codeIdx);
|
|
4326
4322
|
}
|
|
4327
4323
|
// note: this part is duplicated from end of compilemulti:
|
|
4328
4324
|
const args = block.children.map((c) => c.varName).join(", ");
|
|
@@ -4437,7 +4433,6 @@ class CodeGenerator {
|
|
|
4437
4433
|
block,
|
|
4438
4434
|
index,
|
|
4439
4435
|
forceNewBlock: !isTSet,
|
|
4440
|
-
preventRoot: ctx.preventRoot,
|
|
4441
4436
|
isLast: ctx.isLast && i === l - 1,
|
|
4442
4437
|
});
|
|
4443
4438
|
this.compileAST(child, subCtx);
|
|
@@ -4446,21 +4441,19 @@ class CodeGenerator {
|
|
|
4446
4441
|
}
|
|
4447
4442
|
}
|
|
4448
4443
|
if (isNewBlock) {
|
|
4449
|
-
if (block.hasDynamicChildren) {
|
|
4450
|
-
|
|
4451
|
-
|
|
4452
|
-
|
|
4453
|
-
|
|
4454
|
-
|
|
4455
|
-
|
|
4456
|
-
|
|
4457
|
-
|
|
4458
|
-
|
|
4459
|
-
break;
|
|
4460
|
-
}
|
|
4444
|
+
if (block.hasDynamicChildren && block.children.length) {
|
|
4445
|
+
const code = this.target.code;
|
|
4446
|
+
const children = block.children.slice();
|
|
4447
|
+
let current = children.shift();
|
|
4448
|
+
for (let i = codeIdx; i < code.length; i++) {
|
|
4449
|
+
if (code[i].trimStart().startsWith(`const ${current.varName} `)) {
|
|
4450
|
+
code[i] = code[i].replace(`const ${current.varName}`, current.varName);
|
|
4451
|
+
current = children.shift();
|
|
4452
|
+
if (!current)
|
|
4453
|
+
break;
|
|
4461
4454
|
}
|
|
4462
|
-
this.addLine(`let ${block.children.map((c) => c.varName)};`, codeIdx);
|
|
4463
4455
|
}
|
|
4456
|
+
this.addLine(`let ${block.children.map((c) => c.varName).join(", ")};`, codeIdx);
|
|
4464
4457
|
}
|
|
4465
4458
|
const args = block.children.map((c) => c.varName).join(", ");
|
|
4466
4459
|
this.insertBlock(`multi([${args}])`, block, ctx);
|
|
@@ -4474,24 +4467,23 @@ class CodeGenerator {
|
|
|
4474
4467
|
ctxVar = generateId("ctx");
|
|
4475
4468
|
this.addLine(`let ${ctxVar} = ${compileExpr(ast.context)};`);
|
|
4476
4469
|
}
|
|
4470
|
+
const isDynamic = INTERP_REGEXP.test(ast.name);
|
|
4471
|
+
const subTemplate = isDynamic ? interpolate(ast.name) : "`" + ast.name + "`";
|
|
4472
|
+
if (block && !forceNewBlock) {
|
|
4473
|
+
this.insertAnchor(block);
|
|
4474
|
+
}
|
|
4475
|
+
block = this.createBlock(block, "multi", ctx);
|
|
4477
4476
|
if (ast.body) {
|
|
4478
4477
|
this.addLine(`${ctxVar} = Object.create(${ctxVar});`);
|
|
4479
4478
|
this.addLine(`${ctxVar}[isBoundary] = 1;`);
|
|
4480
4479
|
this.helpers.add("isBoundary");
|
|
4481
|
-
const subCtx = createContext(ctx, {
|
|
4480
|
+
const subCtx = createContext(ctx, { ctxVar });
|
|
4482
4481
|
const bl = this.compileMulti({ type: 3 /* Multi */, content: ast.body }, subCtx);
|
|
4483
4482
|
if (bl) {
|
|
4484
4483
|
this.helpers.add("zero");
|
|
4485
4484
|
this.addLine(`${ctxVar}[zero] = ${bl};`);
|
|
4486
4485
|
}
|
|
4487
4486
|
}
|
|
4488
|
-
const isDynamic = INTERP_REGEXP.test(ast.name);
|
|
4489
|
-
const subTemplate = isDynamic ? interpolate(ast.name) : "`" + ast.name + "`";
|
|
4490
|
-
if (block) {
|
|
4491
|
-
if (!forceNewBlock) {
|
|
4492
|
-
this.insertAnchor(block);
|
|
4493
|
-
}
|
|
4494
|
-
}
|
|
4495
4487
|
const key = `key + \`${this.generateComponentKey()}\``;
|
|
4496
4488
|
if (isDynamic) {
|
|
4497
4489
|
const templateVar = generateId("template");
|
|
@@ -4499,7 +4491,6 @@ class CodeGenerator {
|
|
|
4499
4491
|
this.staticDefs.push({ id: "call", expr: `app.callTemplate.bind(app)` });
|
|
4500
4492
|
}
|
|
4501
4493
|
this.define(templateVar, subTemplate);
|
|
4502
|
-
block = this.createBlock(block, "multi", ctx);
|
|
4503
4494
|
this.insertBlock(`call(this, ${templateVar}, ${ctxVar}, node, ${key})`, block, {
|
|
4504
4495
|
...ctx,
|
|
4505
4496
|
forceNewBlock: !block,
|
|
@@ -4508,7 +4499,6 @@ class CodeGenerator {
|
|
|
4508
4499
|
else {
|
|
4509
4500
|
const id = generateId(`callTemplate_`);
|
|
4510
4501
|
this.staticDefs.push({ id, expr: `app.getTemplate(${subTemplate})` });
|
|
4511
|
-
block = this.createBlock(block, "multi", ctx);
|
|
4512
4502
|
this.insertBlock(`${id}.call(this, ${ctxVar}, node, ${key})`, block, {
|
|
4513
4503
|
...ctx,
|
|
4514
4504
|
forceNewBlock: !block,
|
|
@@ -4830,7 +4820,7 @@ function parse(xml) {
|
|
|
4830
4820
|
}
|
|
4831
4821
|
function _parse(xml) {
|
|
4832
4822
|
normalizeXML(xml);
|
|
4833
|
-
const ctx = { inPreTag: false
|
|
4823
|
+
const ctx = { inPreTag: false };
|
|
4834
4824
|
return parseNode(xml, ctx) || { type: 0 /* Text */, value: "" };
|
|
4835
4825
|
}
|
|
4836
4826
|
function parseNode(node, ctx) {
|
|
@@ -4921,9 +4911,7 @@ function parseDOMNode(node, ctx) {
|
|
|
4921
4911
|
if (tagName === "pre") {
|
|
4922
4912
|
ctx.inPreTag = true;
|
|
4923
4913
|
}
|
|
4924
|
-
|
|
4925
|
-
ctx.inSVG = ctx.inSVG || shouldAddSVGNS;
|
|
4926
|
-
const ns = shouldAddSVGNS ? "http://www.w3.org/2000/svg" : null;
|
|
4914
|
+
let ns = !ctx.nameSpace && ROOT_SVG_TAGS.has(tagName) ? "http://www.w3.org/2000/svg" : null;
|
|
4927
4915
|
const ref = node.getAttribute("t-ref");
|
|
4928
4916
|
node.removeAttribute("t-ref");
|
|
4929
4917
|
const nodeAttrsNames = node.getAttributeNames();
|
|
@@ -4985,6 +4973,9 @@ function parseDOMNode(node, ctx) {
|
|
|
4985
4973
|
else if (attr.startsWith("block-")) {
|
|
4986
4974
|
throw new OwlError(`Invalid attribute: '${attr}'`);
|
|
4987
4975
|
}
|
|
4976
|
+
else if (attr === "xmlns") {
|
|
4977
|
+
ns = value;
|
|
4978
|
+
}
|
|
4988
4979
|
else if (attr !== "t-name") {
|
|
4989
4980
|
if (attr.startsWith("t-") && !attr.startsWith("t-att")) {
|
|
4990
4981
|
throw new OwlError(`Unknown QWeb directive: '${attr}'`);
|
|
@@ -4997,6 +4988,9 @@ function parseDOMNode(node, ctx) {
|
|
|
4997
4988
|
attrs[attr] = value;
|
|
4998
4989
|
}
|
|
4999
4990
|
}
|
|
4991
|
+
if (ns) {
|
|
4992
|
+
ctx.nameSpace = ns;
|
|
4993
|
+
}
|
|
5000
4994
|
const children = parseChildren(node, ctx);
|
|
5001
4995
|
return {
|
|
5002
4996
|
type: 2 /* DomNode */,
|
|
@@ -5565,7 +5559,7 @@ function compile(template, options = {}) {
|
|
|
5565
5559
|
}
|
|
5566
5560
|
|
|
5567
5561
|
// do not modify manually. This file is generated by the release script.
|
|
5568
|
-
const version = "2.2.
|
|
5562
|
+
const version = "2.2.6";
|
|
5569
5563
|
|
|
5570
5564
|
// -----------------------------------------------------------------------------
|
|
5571
5565
|
// Scheduler
|
|
@@ -5654,13 +5648,8 @@ const DEV_MSG = () => {
|
|
|
5654
5648
|
This is not suitable for production use.
|
|
5655
5649
|
See https://github.com/odoo/owl/blob/${hash}/doc/reference/app.md#configuration for more information.`;
|
|
5656
5650
|
};
|
|
5657
|
-
|
|
5658
|
-
|
|
5659
|
-
Fiber: Fiber,
|
|
5660
|
-
RootFiber: RootFiber,
|
|
5661
|
-
toRaw: toRaw,
|
|
5662
|
-
reactive: reactive,
|
|
5663
|
-
});
|
|
5651
|
+
const apps = new Set();
|
|
5652
|
+
window.__OWL_DEVTOOLS__ || (window.__OWL_DEVTOOLS__ = { apps, Fiber, RootFiber, toRaw, reactive });
|
|
5664
5653
|
class App extends TemplateSet {
|
|
5665
5654
|
constructor(Root, config = {}) {
|
|
5666
5655
|
super(config);
|
|
@@ -5668,7 +5657,7 @@ class App extends TemplateSet {
|
|
|
5668
5657
|
this.root = null;
|
|
5669
5658
|
this.name = config.name || "";
|
|
5670
5659
|
this.Root = Root;
|
|
5671
|
-
|
|
5660
|
+
apps.add(this);
|
|
5672
5661
|
if (config.test) {
|
|
5673
5662
|
this.dev = true;
|
|
5674
5663
|
}
|
|
@@ -5725,7 +5714,7 @@ class App extends TemplateSet {
|
|
|
5725
5714
|
this.root.destroy();
|
|
5726
5715
|
this.scheduler.processTasks();
|
|
5727
5716
|
}
|
|
5728
|
-
|
|
5717
|
+
apps.delete(this);
|
|
5729
5718
|
}
|
|
5730
5719
|
createComponent(name, isStatic, hasSlotsProp, hasDynamicPropList, propList) {
|
|
5731
5720
|
const isDynamic = !isStatic;
|
|
@@ -5800,6 +5789,7 @@ class App extends TemplateSet {
|
|
|
5800
5789
|
}
|
|
5801
5790
|
}
|
|
5802
5791
|
App.validateTarget = validateTarget;
|
|
5792
|
+
App.apps = apps;
|
|
5803
5793
|
App.version = version;
|
|
5804
5794
|
async function mount(C, target, config = {}) {
|
|
5805
5795
|
return new App(C, config).mount(target, config);
|
|
@@ -6032,6 +6022,6 @@ exports.whenReady = whenReady;
|
|
|
6032
6022
|
exports.xml = xml;
|
|
6033
6023
|
|
|
6034
6024
|
|
|
6035
|
-
__info__.date = '2023-
|
|
6036
|
-
__info__.hash = '
|
|
6025
|
+
__info__.date = '2023-09-25T11:48:01.531Z';
|
|
6026
|
+
__info__.hash = '752160f';
|
|
6037
6027
|
__info__.url = 'https://github.com/odoo/owl';
|
package/dist/owl.es.js
CHANGED
|
@@ -710,12 +710,7 @@ function buildTree(node, parent = null, domParentTree = null) {
|
|
|
710
710
|
info.push({ type: "child", idx: index });
|
|
711
711
|
el = document.createTextNode("");
|
|
712
712
|
}
|
|
713
|
-
|
|
714
|
-
const ns = attrs.getNamedItem("block-ns");
|
|
715
|
-
if (ns) {
|
|
716
|
-
attrs.removeNamedItem("block-ns");
|
|
717
|
-
currentNS = ns.value;
|
|
718
|
-
}
|
|
713
|
+
currentNS || (currentNS = node.namespaceURI);
|
|
719
714
|
if (!el) {
|
|
720
715
|
el = currentNS
|
|
721
716
|
? document.createElementNS(currentNS, tagName)
|
|
@@ -731,6 +726,7 @@ function buildTree(node, parent = null, domParentTree = null) {
|
|
|
731
726
|
const fragment = document.createElement("template").content;
|
|
732
727
|
fragment.appendChild(el);
|
|
733
728
|
}
|
|
729
|
+
const attrs = node.attributes;
|
|
734
730
|
for (let i = 0; i < attrs.length; i++) {
|
|
735
731
|
const attrName = attrs[i].name;
|
|
736
732
|
const attrValue = attrs[i].value;
|
|
@@ -2181,7 +2177,7 @@ function delegateAndNotify(setterName, getterName, target) {
|
|
|
2181
2177
|
if (hadKey !== hasKey) {
|
|
2182
2178
|
notifyReactives(target, KEYCHANGES);
|
|
2183
2179
|
}
|
|
2184
|
-
if (originalValue !==
|
|
2180
|
+
if (originalValue !== target[getterName](key)) {
|
|
2185
2181
|
notifyReactives(target, key);
|
|
2186
2182
|
}
|
|
2187
2183
|
return ret;
|
|
@@ -3002,15 +2998,13 @@ function prepareList(collection) {
|
|
|
3002
2998
|
keys = [...collection.keys()];
|
|
3003
2999
|
values = [...collection.values()];
|
|
3004
3000
|
}
|
|
3001
|
+
else if (Symbol.iterator in Object(collection)) {
|
|
3002
|
+
keys = [...collection];
|
|
3003
|
+
values = keys;
|
|
3004
|
+
}
|
|
3005
3005
|
else if (collection && typeof collection === "object") {
|
|
3006
|
-
|
|
3007
|
-
|
|
3008
|
-
values = keys;
|
|
3009
|
-
}
|
|
3010
|
-
else {
|
|
3011
|
-
values = Object.values(collection);
|
|
3012
|
-
keys = Object.keys(collection);
|
|
3013
|
-
}
|
|
3006
|
+
values = Object.values(collection);
|
|
3007
|
+
keys = Object.keys(collection);
|
|
3014
3008
|
}
|
|
3015
3009
|
else {
|
|
3016
3010
|
throw new OwlError(`Invalid loop expression: "${collection}" is not iterable`);
|
|
@@ -3211,6 +3205,10 @@ class TemplateSet {
|
|
|
3211
3205
|
}
|
|
3212
3206
|
addTemplate(name, template) {
|
|
3213
3207
|
if (name in this.rawTemplates) {
|
|
3208
|
+
// this check can be expensive, just silently ignore double definitions outside dev mode
|
|
3209
|
+
if (!this.dev) {
|
|
3210
|
+
return;
|
|
3211
|
+
}
|
|
3214
3212
|
const rawTemplate = this.rawTemplates[name];
|
|
3215
3213
|
const currentAsString = typeof rawTemplate === "string"
|
|
3216
3214
|
? rawTemplate
|
|
@@ -3854,7 +3852,7 @@ class CodeGenerator {
|
|
|
3854
3852
|
createBlock(parentBlock, type, ctx) {
|
|
3855
3853
|
const hasRoot = this.target.hasRoot;
|
|
3856
3854
|
const block = new BlockDescription(this.target, type);
|
|
3857
|
-
if (!hasRoot
|
|
3855
|
+
if (!hasRoot) {
|
|
3858
3856
|
this.target.hasRoot = true;
|
|
3859
3857
|
block.isRoot = true;
|
|
3860
3858
|
}
|
|
@@ -3877,7 +3875,7 @@ class CodeGenerator {
|
|
|
3877
3875
|
if (ctx.tKeyExpr) {
|
|
3878
3876
|
blockExpr = `toggler(${ctx.tKeyExpr}, ${blockExpr})`;
|
|
3879
3877
|
}
|
|
3880
|
-
if (block.isRoot
|
|
3878
|
+
if (block.isRoot) {
|
|
3881
3879
|
if (this.target.on) {
|
|
3882
3880
|
blockExpr = this.wrapWithEventCatcher(blockExpr, this.target.on);
|
|
3883
3881
|
}
|
|
@@ -4053,11 +4051,6 @@ class CodeGenerator {
|
|
|
4053
4051
|
}
|
|
4054
4052
|
// attributes
|
|
4055
4053
|
const attrs = {};
|
|
4056
|
-
const nameSpace = ast.ns || ctx.nameSpace;
|
|
4057
|
-
if (nameSpace && isNewBlock) {
|
|
4058
|
-
// specific namespace uri
|
|
4059
|
-
attrs["block-ns"] = nameSpace;
|
|
4060
|
-
}
|
|
4061
4054
|
for (let key in ast.attrs) {
|
|
4062
4055
|
let expr, attrName;
|
|
4063
4056
|
if (key.startsWith("t-attf")) {
|
|
@@ -4173,7 +4166,10 @@ class CodeGenerator {
|
|
|
4173
4166
|
const idx = block.insertData(setRefStr, "ref");
|
|
4174
4167
|
attrs["block-ref"] = String(idx);
|
|
4175
4168
|
}
|
|
4176
|
-
const
|
|
4169
|
+
const nameSpace = ast.ns || ctx.nameSpace;
|
|
4170
|
+
const dom = nameSpace
|
|
4171
|
+
? xmlDoc.createElementNS(nameSpace, ast.tag)
|
|
4172
|
+
: xmlDoc.createElement(ast.tag);
|
|
4177
4173
|
for (const [attr, val] of Object.entries(attrs)) {
|
|
4178
4174
|
if (!(attr === "class" && val === "")) {
|
|
4179
4175
|
dom.setAttribute(attr, val);
|
|
@@ -4215,7 +4211,7 @@ class CodeGenerator {
|
|
|
4215
4211
|
break;
|
|
4216
4212
|
}
|
|
4217
4213
|
}
|
|
4218
|
-
this.addLine(`let ${block.children.map((c) => c.varName)};`, codeIdx);
|
|
4214
|
+
this.addLine(`let ${block.children.map((c) => c.varName).join(", ")};`, codeIdx);
|
|
4219
4215
|
}
|
|
4220
4216
|
}
|
|
4221
4217
|
return block.varName;
|
|
@@ -4318,7 +4314,7 @@ class CodeGenerator {
|
|
|
4318
4314
|
break;
|
|
4319
4315
|
}
|
|
4320
4316
|
}
|
|
4321
|
-
this.addLine(`let ${block.children.map((c) => c.varName)};`, codeIdx);
|
|
4317
|
+
this.addLine(`let ${block.children.map((c) => c.varName).join(", ")};`, codeIdx);
|
|
4322
4318
|
}
|
|
4323
4319
|
// note: this part is duplicated from end of compilemulti:
|
|
4324
4320
|
const args = block.children.map((c) => c.varName).join(", ");
|
|
@@ -4433,7 +4429,6 @@ class CodeGenerator {
|
|
|
4433
4429
|
block,
|
|
4434
4430
|
index,
|
|
4435
4431
|
forceNewBlock: !isTSet,
|
|
4436
|
-
preventRoot: ctx.preventRoot,
|
|
4437
4432
|
isLast: ctx.isLast && i === l - 1,
|
|
4438
4433
|
});
|
|
4439
4434
|
this.compileAST(child, subCtx);
|
|
@@ -4442,21 +4437,19 @@ class CodeGenerator {
|
|
|
4442
4437
|
}
|
|
4443
4438
|
}
|
|
4444
4439
|
if (isNewBlock) {
|
|
4445
|
-
if (block.hasDynamicChildren) {
|
|
4446
|
-
|
|
4447
|
-
|
|
4448
|
-
|
|
4449
|
-
|
|
4450
|
-
|
|
4451
|
-
|
|
4452
|
-
|
|
4453
|
-
|
|
4454
|
-
|
|
4455
|
-
break;
|
|
4456
|
-
}
|
|
4440
|
+
if (block.hasDynamicChildren && block.children.length) {
|
|
4441
|
+
const code = this.target.code;
|
|
4442
|
+
const children = block.children.slice();
|
|
4443
|
+
let current = children.shift();
|
|
4444
|
+
for (let i = codeIdx; i < code.length; i++) {
|
|
4445
|
+
if (code[i].trimStart().startsWith(`const ${current.varName} `)) {
|
|
4446
|
+
code[i] = code[i].replace(`const ${current.varName}`, current.varName);
|
|
4447
|
+
current = children.shift();
|
|
4448
|
+
if (!current)
|
|
4449
|
+
break;
|
|
4457
4450
|
}
|
|
4458
|
-
this.addLine(`let ${block.children.map((c) => c.varName)};`, codeIdx);
|
|
4459
4451
|
}
|
|
4452
|
+
this.addLine(`let ${block.children.map((c) => c.varName).join(", ")};`, codeIdx);
|
|
4460
4453
|
}
|
|
4461
4454
|
const args = block.children.map((c) => c.varName).join(", ");
|
|
4462
4455
|
this.insertBlock(`multi([${args}])`, block, ctx);
|
|
@@ -4470,24 +4463,23 @@ class CodeGenerator {
|
|
|
4470
4463
|
ctxVar = generateId("ctx");
|
|
4471
4464
|
this.addLine(`let ${ctxVar} = ${compileExpr(ast.context)};`);
|
|
4472
4465
|
}
|
|
4466
|
+
const isDynamic = INTERP_REGEXP.test(ast.name);
|
|
4467
|
+
const subTemplate = isDynamic ? interpolate(ast.name) : "`" + ast.name + "`";
|
|
4468
|
+
if (block && !forceNewBlock) {
|
|
4469
|
+
this.insertAnchor(block);
|
|
4470
|
+
}
|
|
4471
|
+
block = this.createBlock(block, "multi", ctx);
|
|
4473
4472
|
if (ast.body) {
|
|
4474
4473
|
this.addLine(`${ctxVar} = Object.create(${ctxVar});`);
|
|
4475
4474
|
this.addLine(`${ctxVar}[isBoundary] = 1;`);
|
|
4476
4475
|
this.helpers.add("isBoundary");
|
|
4477
|
-
const subCtx = createContext(ctx, {
|
|
4476
|
+
const subCtx = createContext(ctx, { ctxVar });
|
|
4478
4477
|
const bl = this.compileMulti({ type: 3 /* Multi */, content: ast.body }, subCtx);
|
|
4479
4478
|
if (bl) {
|
|
4480
4479
|
this.helpers.add("zero");
|
|
4481
4480
|
this.addLine(`${ctxVar}[zero] = ${bl};`);
|
|
4482
4481
|
}
|
|
4483
4482
|
}
|
|
4484
|
-
const isDynamic = INTERP_REGEXP.test(ast.name);
|
|
4485
|
-
const subTemplate = isDynamic ? interpolate(ast.name) : "`" + ast.name + "`";
|
|
4486
|
-
if (block) {
|
|
4487
|
-
if (!forceNewBlock) {
|
|
4488
|
-
this.insertAnchor(block);
|
|
4489
|
-
}
|
|
4490
|
-
}
|
|
4491
4483
|
const key = `key + \`${this.generateComponentKey()}\``;
|
|
4492
4484
|
if (isDynamic) {
|
|
4493
4485
|
const templateVar = generateId("template");
|
|
@@ -4495,7 +4487,6 @@ class CodeGenerator {
|
|
|
4495
4487
|
this.staticDefs.push({ id: "call", expr: `app.callTemplate.bind(app)` });
|
|
4496
4488
|
}
|
|
4497
4489
|
this.define(templateVar, subTemplate);
|
|
4498
|
-
block = this.createBlock(block, "multi", ctx);
|
|
4499
4490
|
this.insertBlock(`call(this, ${templateVar}, ${ctxVar}, node, ${key})`, block, {
|
|
4500
4491
|
...ctx,
|
|
4501
4492
|
forceNewBlock: !block,
|
|
@@ -4504,7 +4495,6 @@ class CodeGenerator {
|
|
|
4504
4495
|
else {
|
|
4505
4496
|
const id = generateId(`callTemplate_`);
|
|
4506
4497
|
this.staticDefs.push({ id, expr: `app.getTemplate(${subTemplate})` });
|
|
4507
|
-
block = this.createBlock(block, "multi", ctx);
|
|
4508
4498
|
this.insertBlock(`${id}.call(this, ${ctxVar}, node, ${key})`, block, {
|
|
4509
4499
|
...ctx,
|
|
4510
4500
|
forceNewBlock: !block,
|
|
@@ -4826,7 +4816,7 @@ function parse(xml) {
|
|
|
4826
4816
|
}
|
|
4827
4817
|
function _parse(xml) {
|
|
4828
4818
|
normalizeXML(xml);
|
|
4829
|
-
const ctx = { inPreTag: false
|
|
4819
|
+
const ctx = { inPreTag: false };
|
|
4830
4820
|
return parseNode(xml, ctx) || { type: 0 /* Text */, value: "" };
|
|
4831
4821
|
}
|
|
4832
4822
|
function parseNode(node, ctx) {
|
|
@@ -4917,9 +4907,7 @@ function parseDOMNode(node, ctx) {
|
|
|
4917
4907
|
if (tagName === "pre") {
|
|
4918
4908
|
ctx.inPreTag = true;
|
|
4919
4909
|
}
|
|
4920
|
-
|
|
4921
|
-
ctx.inSVG = ctx.inSVG || shouldAddSVGNS;
|
|
4922
|
-
const ns = shouldAddSVGNS ? "http://www.w3.org/2000/svg" : null;
|
|
4910
|
+
let ns = !ctx.nameSpace && ROOT_SVG_TAGS.has(tagName) ? "http://www.w3.org/2000/svg" : null;
|
|
4923
4911
|
const ref = node.getAttribute("t-ref");
|
|
4924
4912
|
node.removeAttribute("t-ref");
|
|
4925
4913
|
const nodeAttrsNames = node.getAttributeNames();
|
|
@@ -4981,6 +4969,9 @@ function parseDOMNode(node, ctx) {
|
|
|
4981
4969
|
else if (attr.startsWith("block-")) {
|
|
4982
4970
|
throw new OwlError(`Invalid attribute: '${attr}'`);
|
|
4983
4971
|
}
|
|
4972
|
+
else if (attr === "xmlns") {
|
|
4973
|
+
ns = value;
|
|
4974
|
+
}
|
|
4984
4975
|
else if (attr !== "t-name") {
|
|
4985
4976
|
if (attr.startsWith("t-") && !attr.startsWith("t-att")) {
|
|
4986
4977
|
throw new OwlError(`Unknown QWeb directive: '${attr}'`);
|
|
@@ -4993,6 +4984,9 @@ function parseDOMNode(node, ctx) {
|
|
|
4993
4984
|
attrs[attr] = value;
|
|
4994
4985
|
}
|
|
4995
4986
|
}
|
|
4987
|
+
if (ns) {
|
|
4988
|
+
ctx.nameSpace = ns;
|
|
4989
|
+
}
|
|
4996
4990
|
const children = parseChildren(node, ctx);
|
|
4997
4991
|
return {
|
|
4998
4992
|
type: 2 /* DomNode */,
|
|
@@ -5561,7 +5555,7 @@ function compile(template, options = {}) {
|
|
|
5561
5555
|
}
|
|
5562
5556
|
|
|
5563
5557
|
// do not modify manually. This file is generated by the release script.
|
|
5564
|
-
const version = "2.2.
|
|
5558
|
+
const version = "2.2.6";
|
|
5565
5559
|
|
|
5566
5560
|
// -----------------------------------------------------------------------------
|
|
5567
5561
|
// Scheduler
|
|
@@ -5650,13 +5644,8 @@ const DEV_MSG = () => {
|
|
|
5650
5644
|
This is not suitable for production use.
|
|
5651
5645
|
See https://github.com/odoo/owl/blob/${hash}/doc/reference/app.md#configuration for more information.`;
|
|
5652
5646
|
};
|
|
5653
|
-
|
|
5654
|
-
|
|
5655
|
-
Fiber: Fiber,
|
|
5656
|
-
RootFiber: RootFiber,
|
|
5657
|
-
toRaw: toRaw,
|
|
5658
|
-
reactive: reactive,
|
|
5659
|
-
});
|
|
5647
|
+
const apps = new Set();
|
|
5648
|
+
window.__OWL_DEVTOOLS__ || (window.__OWL_DEVTOOLS__ = { apps, Fiber, RootFiber, toRaw, reactive });
|
|
5660
5649
|
class App extends TemplateSet {
|
|
5661
5650
|
constructor(Root, config = {}) {
|
|
5662
5651
|
super(config);
|
|
@@ -5664,7 +5653,7 @@ class App extends TemplateSet {
|
|
|
5664
5653
|
this.root = null;
|
|
5665
5654
|
this.name = config.name || "";
|
|
5666
5655
|
this.Root = Root;
|
|
5667
|
-
|
|
5656
|
+
apps.add(this);
|
|
5668
5657
|
if (config.test) {
|
|
5669
5658
|
this.dev = true;
|
|
5670
5659
|
}
|
|
@@ -5721,7 +5710,7 @@ class App extends TemplateSet {
|
|
|
5721
5710
|
this.root.destroy();
|
|
5722
5711
|
this.scheduler.processTasks();
|
|
5723
5712
|
}
|
|
5724
|
-
|
|
5713
|
+
apps.delete(this);
|
|
5725
5714
|
}
|
|
5726
5715
|
createComponent(name, isStatic, hasSlotsProp, hasDynamicPropList, propList) {
|
|
5727
5716
|
const isDynamic = !isStatic;
|
|
@@ -5796,6 +5785,7 @@ class App extends TemplateSet {
|
|
|
5796
5785
|
}
|
|
5797
5786
|
}
|
|
5798
5787
|
App.validateTarget = validateTarget;
|
|
5788
|
+
App.apps = apps;
|
|
5799
5789
|
App.version = version;
|
|
5800
5790
|
async function mount(C, target, config = {}) {
|
|
5801
5791
|
return new App(C, config).mount(target, config);
|
|
@@ -5994,6 +5984,6 @@ TemplateSet.prototype._compileTemplate = function _compileTemplate(name, templat
|
|
|
5994
5984
|
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 };
|
|
5995
5985
|
|
|
5996
5986
|
|
|
5997
|
-
__info__.date = '2023-
|
|
5998
|
-
__info__.hash = '
|
|
5987
|
+
__info__.date = '2023-09-25T11:48:01.531Z';
|
|
5988
|
+
__info__.hash = '752160f';
|
|
5999
5989
|
__info__.url = 'https://github.com/odoo/owl';
|