@odoo/owl 2.8.0 → 3.0.0-alpha.1

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.
Files changed (40) hide show
  1. package/dist/compile_templates.mjs +69 -23
  2. package/dist/owl-devtools.zip +0 -0
  3. package/dist/owl.cjs.js +649 -206
  4. package/dist/owl.es.js +642 -207
  5. package/dist/owl.iife.js +649 -206
  6. package/dist/owl.iife.min.js +1 -1
  7. package/dist/types/common/types.d.ts +28 -0
  8. package/dist/types/compiler/parser.d.ts +24 -19
  9. package/dist/types/owl.d.ts +162 -74
  10. package/dist/types/runtime/app.d.ts +3 -0
  11. package/dist/types/runtime/cancellableContext.d.ts +15 -0
  12. package/dist/types/runtime/cancellablePromise.d.ts +15 -0
  13. package/dist/types/runtime/component.d.ts +5 -0
  14. package/dist/types/runtime/component_node.d.ts +4 -2
  15. package/dist/types/runtime/executionContext.d.ts +0 -0
  16. package/dist/types/runtime/index.d.ts +3 -0
  17. package/dist/types/runtime/listOperation.d.ts +1 -0
  18. package/dist/types/runtime/plugins.d.ts +39 -0
  19. package/dist/types/runtime/reactivity.d.ts +1 -12
  20. package/dist/types/runtime/registry.d.ts +15 -0
  21. package/dist/types/runtime/relationalModel/discussModel.d.ts +19 -0
  22. package/dist/types/runtime/relationalModel/discussModelTypes.d.ts +22 -0
  23. package/dist/types/runtime/relationalModel/field.d.ts +20 -0
  24. package/dist/types/runtime/relationalModel/model.d.ts +59 -0
  25. package/dist/types/runtime/relationalModel/modelData.d.ts +18 -0
  26. package/dist/types/runtime/relationalModel/modelRegistry.d.ts +3 -0
  27. package/dist/types/runtime/relationalModel/modelUtils.d.ts +4 -0
  28. package/dist/types/runtime/relationalModel/store.d.ts +16 -0
  29. package/dist/types/runtime/relationalModel/types.d.ts +83 -0
  30. package/dist/types/runtime/relationalModel/util.d.ts +1 -0
  31. package/dist/types/runtime/relationalModel/web/WebDataPoint.d.ts +25 -0
  32. package/dist/types/runtime/relationalModel/web/WebRecord.d.ts +131 -0
  33. package/dist/types/runtime/relationalModel/web/WebStaticList.d.ts +63 -0
  34. package/dist/types/runtime/relationalModel/web/webModel.d.ts +5 -0
  35. package/dist/types/runtime/relationalModel/web/webModelTypes.d.ts +139 -0
  36. package/dist/types/runtime/signals.d.ts +17 -0
  37. package/dist/types/runtime/task.d.ts +12 -0
  38. package/dist/types/utils/registry.d.ts +15 -0
  39. package/dist/types/version.d.ts +1 -1
  40. package/package.json +1 -1
@@ -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