@odoo/owl 2.8.0 → 2.8.2

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.
@@ -1175,7 +1175,7 @@ class CodeGenerator {
1175
1175
  const isNewBlock = !block || forceNewBlock;
1176
1176
  let codeIdx = this.target.code.length;
1177
1177
  if (isNewBlock) {
1178
- const n = ast.content.filter((c) => c.type !== 6 /* TSet */).length;
1178
+ const n = ast.content.filter((c) => !c.hasNoRepresentation).length;
1179
1179
  let result = null;
1180
1180
  if (n <= 1) {
1181
1181
  for (let child of ast.content) {
@@ -1189,15 +1189,15 @@ class CodeGenerator {
1189
1189
  let index = 0;
1190
1190
  for (let i = 0, l = ast.content.length; i < l; i++) {
1191
1191
  const child = ast.content[i];
1192
- const isTSet = child.type === 6 /* TSet */;
1192
+ const forceNewBlock = !child.hasNoRepresentation;
1193
1193
  const subCtx = createContext(ctx, {
1194
1194
  block,
1195
1195
  index,
1196
- forceNewBlock: !isTSet,
1196
+ forceNewBlock,
1197
1197
  isLast: ctx.isLast && i === l - 1,
1198
1198
  });
1199
1199
  this.compileAST(child, subCtx);
1200
- if (!isTSet) {
1200
+ if (forceNewBlock) {
1201
1201
  index++;
1202
1202
  }
1203
1203
  }
@@ -1651,9 +1651,9 @@ function parseNode(node, ctx) {
1651
1651
  parseTCallBlock(node) ||
1652
1652
  parseTTranslation(node, ctx) ||
1653
1653
  parseTTranslationContext(node, ctx) ||
1654
+ parseTKey(node, ctx) ||
1654
1655
  parseTEscNode(node, ctx) ||
1655
1656
  parseTOutNode(node, ctx) ||
1656
- parseTKey(node, ctx) ||
1657
1657
  parseTSlot(node, ctx) ||
1658
1658
  parseComponent(node, ctx) ||
1659
1659
  parseDOMNode(node, ctx) ||
@@ -1721,19 +1721,29 @@ function parseTCustom(node, ctx) {
1721
1721
  function parseTDebugLog(node, ctx) {
1722
1722
  if (node.hasAttribute("t-debug")) {
1723
1723
  node.removeAttribute("t-debug");
1724
- return {
1724
+ const content = parseNode(node, ctx);
1725
+ const ast = {
1725
1726
  type: 12 /* TDebug */,
1726
- content: parseNode(node, ctx),
1727
+ content,
1727
1728
  };
1729
+ if (content === null || content === void 0 ? void 0 : content.hasNoRepresentation) {
1730
+ ast.hasNoRepresentation = true;
1731
+ }
1732
+ return ast;
1728
1733
  }
1729
1734
  if (node.hasAttribute("t-log")) {
1730
1735
  const expr = node.getAttribute("t-log");
1731
1736
  node.removeAttribute("t-log");
1732
- return {
1737
+ const content = parseNode(node, ctx);
1738
+ const ast = {
1733
1739
  type: 13 /* TLog */,
1734
1740
  expr,
1735
- content: parseNode(node, ctx),
1741
+ content,
1736
1742
  };
1743
+ if (content === null || content === void 0 ? void 0 : content.hasNoRepresentation) {
1744
+ ast.hasNoRepresentation = true;
1745
+ }
1746
+ return ast;
1737
1747
  }
1738
1748
  return null;
1739
1749
  }
@@ -1963,11 +1973,19 @@ function parseTKey(node, ctx) {
1963
1973
  }
1964
1974
  const key = node.getAttribute("t-key");
1965
1975
  node.removeAttribute("t-key");
1966
- const body = parseNode(node, ctx);
1967
- if (!body) {
1976
+ const content = parseNode(node, ctx);
1977
+ if (!content) {
1968
1978
  return null;
1969
1979
  }
1970
- return { type: 10 /* TKey */, expr: key, content: body };
1980
+ const ast = {
1981
+ type: 10 /* TKey */,
1982
+ expr: key,
1983
+ content,
1984
+ };
1985
+ if (content.hasNoRepresentation) {
1986
+ ast.hasNoRepresentation = true;
1987
+ }
1988
+ return ast;
1971
1989
  }
1972
1990
  // -----------------------------------------------------------------------------
1973
1991
  // t-call
@@ -2076,7 +2094,7 @@ function parseTSetNode(node, ctx) {
2076
2094
  if (node.textContent !== node.innerHTML) {
2077
2095
  body = parseChildren(node, ctx);
2078
2096
  }
2079
- return { type: 6 /* TSet */, name, value, defaultValue, body };
2097
+ return { type: 6 /* TSet */, name, value, defaultValue, body, hasNoRepresentation: true };
2080
2098
  }
2081
2099
  // -----------------------------------------------------------------------------
2082
2100
  // Components
@@ -2255,30 +2273,51 @@ function parseTSlot(node, ctx) {
2255
2273
  // -----------------------------------------------------------------------------
2256
2274
  // Translation
2257
2275
  // -----------------------------------------------------------------------------
2276
+ function wrapInTTranslationAST(r) {
2277
+ const ast = { type: 16 /* TTranslation */, content: r };
2278
+ if (r === null || r === void 0 ? void 0 : r.hasNoRepresentation) {
2279
+ ast.hasNoRepresentation = true;
2280
+ }
2281
+ return ast;
2282
+ }
2258
2283
  function parseTTranslation(node, ctx) {
2259
2284
  if (node.getAttribute("t-translation") !== "off") {
2260
2285
  return null;
2261
2286
  }
2262
2287
  node.removeAttribute("t-translation");
2263
- return {
2264
- type: 16 /* TTranslation */,
2265
- content: parseNode(node, ctx),
2266
- };
2288
+ const result = parseNode(node, ctx);
2289
+ if ((result === null || result === void 0 ? void 0 : result.type) === 3 /* Multi */) {
2290
+ const children = result.content.map(wrapInTTranslationAST);
2291
+ return makeASTMulti(children);
2292
+ }
2293
+ return wrapInTTranslationAST(result);
2267
2294
  }
2268
2295
  // -----------------------------------------------------------------------------
2269
2296
  // Translation Context
2270
2297
  // -----------------------------------------------------------------------------
2298
+ function wrapInTTranslationContextAST(r, translationCtx) {
2299
+ const ast = {
2300
+ type: 17 /* TTranslationContext */,
2301
+ content: r,
2302
+ translationCtx,
2303
+ };
2304
+ if (r === null || r === void 0 ? void 0 : r.hasNoRepresentation) {
2305
+ ast.hasNoRepresentation = true;
2306
+ }
2307
+ return ast;
2308
+ }
2271
2309
  function parseTTranslationContext(node, ctx) {
2272
2310
  const translationCtx = node.getAttribute("t-translation-context");
2273
2311
  if (!translationCtx) {
2274
2312
  return null;
2275
2313
  }
2276
2314
  node.removeAttribute("t-translation-context");
2277
- return {
2278
- type: 17 /* TTranslationContext */,
2279
- content: parseNode(node, ctx),
2280
- translationCtx,
2281
- };
2315
+ const result = parseNode(node, ctx);
2316
+ if ((result === null || result === void 0 ? void 0 : result.type) === 3 /* Multi */) {
2317
+ const children = result.content.map((c) => wrapInTTranslationContextAST(c, translationCtx));
2318
+ return makeASTMulti(children);
2319
+ }
2320
+ return wrapInTTranslationContextAST(result, translationCtx);
2282
2321
  }
2283
2322
  // -----------------------------------------------------------------------------
2284
2323
  // Portal
@@ -2323,6 +2362,13 @@ function parseChildren(node, ctx) {
2323
2362
  }
2324
2363
  return children;
2325
2364
  }
2365
+ function makeASTMulti(children) {
2366
+ const ast = { type: 3 /* Multi */, content: children };
2367
+ if (children.every((c) => c.hasNoRepresentation)) {
2368
+ ast.hasNoRepresentation = true;
2369
+ }
2370
+ return ast;
2371
+ }
2326
2372
  /**
2327
2373
  * Parse all the child nodes of a given node and return an ast if possible.
2328
2374
  * In the case there are multiple children, they are wrapped in a astmulti.
@@ -2335,7 +2381,7 @@ function parseChildNodes(node, ctx) {
2335
2381
  case 1:
2336
2382
  return children[0];
2337
2383
  default:
2338
- return { type: 3 /* Multi */, content: children };
2384
+ return makeASTMulti(children);
2339
2385
  }
2340
2386
  }
2341
2387
  /**
Binary file
package/dist/owl.cjs.js CHANGED
@@ -685,7 +685,7 @@ const characterDataProto = CharacterData.prototype;
685
685
  const characterDataSetData = getDescriptor$1(characterDataProto, "data").set;
686
686
  const nodeGetFirstChild = getDescriptor$1(nodeProto$2, "firstChild").get;
687
687
  const nodeGetNextSibling = getDescriptor$1(nodeProto$2, "nextSibling").get;
688
- const NO_OP = () => { };
688
+ const NO_OP$1 = () => { };
689
689
  function makePropSetter(name) {
690
690
  return function setProp(value) {
691
691
  // support 0, fallback to empty string for other falsy values
@@ -1015,7 +1015,7 @@ function updateCtx(ctx, tree) {
1015
1015
  idx: info.idx,
1016
1016
  refIdx: info.refIdx,
1017
1017
  setData: makeRefSetter(index, ctx.refList),
1018
- updateData: NO_OP,
1018
+ updateData: NO_OP$1,
1019
1019
  });
1020
1020
  }
1021
1021
  }
@@ -1641,6 +1641,7 @@ function handleError(params) {
1641
1641
  let current = fiber;
1642
1642
  do {
1643
1643
  current.node.fiber = current;
1644
+ fibersInError.set(current, error);
1644
1645
  current = current.parent;
1645
1646
  } while (current);
1646
1647
  fibersInError.set(fiber.root, error);
@@ -2387,13 +2388,19 @@ function useState(state) {
2387
2388
  const node = getCurrent();
2388
2389
  let render = batchedRenderFunctions.get(node);
2389
2390
  if (!render) {
2390
- render = batched(node.render.bind(node, false));
2391
+ const wrapper = { fn: batched(node.render.bind(node, false)) };
2392
+ render = (...args) => wrapper.fn(...args);
2391
2393
  batchedRenderFunctions.set(node, render);
2392
2394
  // manual implementation of onWillDestroy to break cyclic dependency
2393
- node.willDestroy.push(clearReactivesForCallback.bind(null, render));
2395
+ node.willDestroy.push(cleanupRenderAndReactives.bind(null, wrapper, render));
2394
2396
  }
2395
2397
  return reactive(state, render);
2396
2398
  }
2399
+ const NO_OP = () => { };
2400
+ function cleanupRenderAndReactives(wrapper, render) {
2401
+ wrapper.fn = NO_OP;
2402
+ clearReactivesForCallback(render);
2403
+ }
2397
2404
  class ComponentNode {
2398
2405
  constructor(C, props, app, parent, parentKey) {
2399
2406
  this.fiber = null;
@@ -4543,7 +4550,7 @@ class CodeGenerator {
4543
4550
  const isNewBlock = !block || forceNewBlock;
4544
4551
  let codeIdx = this.target.code.length;
4545
4552
  if (isNewBlock) {
4546
- const n = ast.content.filter((c) => c.type !== 6 /* TSet */).length;
4553
+ const n = ast.content.filter((c) => !c.hasNoRepresentation).length;
4547
4554
  let result = null;
4548
4555
  if (n <= 1) {
4549
4556
  for (let child of ast.content) {
@@ -4557,15 +4564,15 @@ class CodeGenerator {
4557
4564
  let index = 0;
4558
4565
  for (let i = 0, l = ast.content.length; i < l; i++) {
4559
4566
  const child = ast.content[i];
4560
- const isTSet = child.type === 6 /* TSet */;
4567
+ const forceNewBlock = !child.hasNoRepresentation;
4561
4568
  const subCtx = createContext(ctx, {
4562
4569
  block,
4563
4570
  index,
4564
- forceNewBlock: !isTSet,
4571
+ forceNewBlock,
4565
4572
  isLast: ctx.isLast && i === l - 1,
4566
4573
  });
4567
4574
  this.compileAST(child, subCtx);
4568
- if (!isTSet) {
4575
+ if (forceNewBlock) {
4569
4576
  index++;
4570
4577
  }
4571
4578
  }
@@ -4983,9 +4990,9 @@ function parseNode(node, ctx) {
4983
4990
  parseTCallBlock(node) ||
4984
4991
  parseTTranslation(node, ctx) ||
4985
4992
  parseTTranslationContext(node, ctx) ||
4993
+ parseTKey(node, ctx) ||
4986
4994
  parseTEscNode(node, ctx) ||
4987
4995
  parseTOutNode(node, ctx) ||
4988
- parseTKey(node, ctx) ||
4989
4996
  parseTSlot(node, ctx) ||
4990
4997
  parseComponent(node, ctx) ||
4991
4998
  parseDOMNode(node, ctx) ||
@@ -5053,19 +5060,29 @@ function parseTCustom(node, ctx) {
5053
5060
  function parseTDebugLog(node, ctx) {
5054
5061
  if (node.hasAttribute("t-debug")) {
5055
5062
  node.removeAttribute("t-debug");
5056
- return {
5063
+ const content = parseNode(node, ctx);
5064
+ const ast = {
5057
5065
  type: 12 /* TDebug */,
5058
- content: parseNode(node, ctx),
5066
+ content,
5059
5067
  };
5068
+ if (content === null || content === void 0 ? void 0 : content.hasNoRepresentation) {
5069
+ ast.hasNoRepresentation = true;
5070
+ }
5071
+ return ast;
5060
5072
  }
5061
5073
  if (node.hasAttribute("t-log")) {
5062
5074
  const expr = node.getAttribute("t-log");
5063
5075
  node.removeAttribute("t-log");
5064
- return {
5076
+ const content = parseNode(node, ctx);
5077
+ const ast = {
5065
5078
  type: 13 /* TLog */,
5066
5079
  expr,
5067
- content: parseNode(node, ctx),
5080
+ content,
5068
5081
  };
5082
+ if (content === null || content === void 0 ? void 0 : content.hasNoRepresentation) {
5083
+ ast.hasNoRepresentation = true;
5084
+ }
5085
+ return ast;
5069
5086
  }
5070
5087
  return null;
5071
5088
  }
@@ -5295,11 +5312,19 @@ function parseTKey(node, ctx) {
5295
5312
  }
5296
5313
  const key = node.getAttribute("t-key");
5297
5314
  node.removeAttribute("t-key");
5298
- const body = parseNode(node, ctx);
5299
- if (!body) {
5315
+ const content = parseNode(node, ctx);
5316
+ if (!content) {
5300
5317
  return null;
5301
5318
  }
5302
- return { type: 10 /* TKey */, expr: key, content: body };
5319
+ const ast = {
5320
+ type: 10 /* TKey */,
5321
+ expr: key,
5322
+ content,
5323
+ };
5324
+ if (content.hasNoRepresentation) {
5325
+ ast.hasNoRepresentation = true;
5326
+ }
5327
+ return ast;
5303
5328
  }
5304
5329
  // -----------------------------------------------------------------------------
5305
5330
  // t-call
@@ -5408,7 +5433,7 @@ function parseTSetNode(node, ctx) {
5408
5433
  if (node.textContent !== node.innerHTML) {
5409
5434
  body = parseChildren(node, ctx);
5410
5435
  }
5411
- return { type: 6 /* TSet */, name, value, defaultValue, body };
5436
+ return { type: 6 /* TSet */, name, value, defaultValue, body, hasNoRepresentation: true };
5412
5437
  }
5413
5438
  // -----------------------------------------------------------------------------
5414
5439
  // Components
@@ -5587,30 +5612,51 @@ function parseTSlot(node, ctx) {
5587
5612
  // -----------------------------------------------------------------------------
5588
5613
  // Translation
5589
5614
  // -----------------------------------------------------------------------------
5615
+ function wrapInTTranslationAST(r) {
5616
+ const ast = { type: 16 /* TTranslation */, content: r };
5617
+ if (r === null || r === void 0 ? void 0 : r.hasNoRepresentation) {
5618
+ ast.hasNoRepresentation = true;
5619
+ }
5620
+ return ast;
5621
+ }
5590
5622
  function parseTTranslation(node, ctx) {
5591
5623
  if (node.getAttribute("t-translation") !== "off") {
5592
5624
  return null;
5593
5625
  }
5594
5626
  node.removeAttribute("t-translation");
5595
- return {
5596
- type: 16 /* TTranslation */,
5597
- content: parseNode(node, ctx),
5598
- };
5627
+ const result = parseNode(node, ctx);
5628
+ if ((result === null || result === void 0 ? void 0 : result.type) === 3 /* Multi */) {
5629
+ const children = result.content.map(wrapInTTranslationAST);
5630
+ return makeASTMulti(children);
5631
+ }
5632
+ return wrapInTTranslationAST(result);
5599
5633
  }
5600
5634
  // -----------------------------------------------------------------------------
5601
5635
  // Translation Context
5602
5636
  // -----------------------------------------------------------------------------
5637
+ function wrapInTTranslationContextAST(r, translationCtx) {
5638
+ const ast = {
5639
+ type: 17 /* TTranslationContext */,
5640
+ content: r,
5641
+ translationCtx,
5642
+ };
5643
+ if (r === null || r === void 0 ? void 0 : r.hasNoRepresentation) {
5644
+ ast.hasNoRepresentation = true;
5645
+ }
5646
+ return ast;
5647
+ }
5603
5648
  function parseTTranslationContext(node, ctx) {
5604
5649
  const translationCtx = node.getAttribute("t-translation-context");
5605
5650
  if (!translationCtx) {
5606
5651
  return null;
5607
5652
  }
5608
5653
  node.removeAttribute("t-translation-context");
5609
- return {
5610
- type: 17 /* TTranslationContext */,
5611
- content: parseNode(node, ctx),
5612
- translationCtx,
5613
- };
5654
+ const result = parseNode(node, ctx);
5655
+ if ((result === null || result === void 0 ? void 0 : result.type) === 3 /* Multi */) {
5656
+ const children = result.content.map((c) => wrapInTTranslationContextAST(c, translationCtx));
5657
+ return makeASTMulti(children);
5658
+ }
5659
+ return wrapInTTranslationContextAST(result, translationCtx);
5614
5660
  }
5615
5661
  // -----------------------------------------------------------------------------
5616
5662
  // Portal
@@ -5655,6 +5701,13 @@ function parseChildren(node, ctx) {
5655
5701
  }
5656
5702
  return children;
5657
5703
  }
5704
+ function makeASTMulti(children) {
5705
+ const ast = { type: 3 /* Multi */, content: children };
5706
+ if (children.every((c) => c.hasNoRepresentation)) {
5707
+ ast.hasNoRepresentation = true;
5708
+ }
5709
+ return ast;
5710
+ }
5658
5711
  /**
5659
5712
  * Parse all the child nodes of a given node and return an ast if possible.
5660
5713
  * In the case there are multiple children, they are wrapped in a astmulti.
@@ -5667,7 +5720,7 @@ function parseChildNodes(node, ctx) {
5667
5720
  case 1:
5668
5721
  return children[0];
5669
5722
  default:
5670
- return { type: 3 /* Multi */, content: children };
5723
+ return makeASTMulti(children);
5671
5724
  }
5672
5725
  }
5673
5726
  /**
@@ -5771,7 +5824,7 @@ function compile(template, options = {
5771
5824
  }
5772
5825
 
5773
5826
  // do not modify manually. This file is generated by the release script.
5774
- const version = "2.8.0";
5827
+ const version = "2.8.2";
5775
5828
 
5776
5829
  // -----------------------------------------------------------------------------
5777
5830
  // Scheduler
@@ -6278,6 +6331,6 @@ exports.whenReady = whenReady;
6278
6331
  exports.xml = xml;
6279
6332
 
6280
6333
 
6281
- __info__.date = '2025-06-30T12:46:06.424Z';
6282
- __info__.hash = 'b620502';
6334
+ __info__.date = '2026-01-30T07:49:47.618Z';
6335
+ __info__.hash = '52abf8d';
6283
6336
  __info__.url = 'https://github.com/odoo/owl';