@angular/core 17.1.0-rc.0 → 17.1.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 (34) hide show
  1. package/esm2022/src/core_reactivity_export_internal.mjs +2 -2
  2. package/esm2022/src/defer/interfaces.mjs +3 -2
  3. package/esm2022/src/linker/compiler.mjs +1 -1
  4. package/esm2022/src/metadata/directives.mjs +1 -1
  5. package/esm2022/src/render3/component_ref.mjs +1 -1
  6. package/esm2022/src/render3/index.mjs +2 -3
  7. package/esm2022/src/render3/instructions/all.mjs +3 -2
  8. package/esm2022/src/render3/instructions/queries.mjs +98 -0
  9. package/esm2022/src/render3/interfaces/view.mjs +1 -1
  10. package/esm2022/src/render3/node_manipulation.mjs +2 -5
  11. package/esm2022/src/render3/query.mjs +11 -98
  12. package/esm2022/src/render3/reactivity/effect.mjs +15 -37
  13. package/esm2022/src/render3/util/global_utils.mjs +3 -1
  14. package/esm2022/src/version.mjs +1 -1
  15. package/esm2022/testing/src/component_fixture.mjs +5 -5
  16. package/esm2022/testing/src/logger.mjs +3 -3
  17. package/esm2022/testing/src/test_bed.mjs +7 -6
  18. package/fesm2022/core.mjs +8006 -8028
  19. package/fesm2022/core.mjs.map +1 -1
  20. package/fesm2022/primitives/signals.mjs +1 -1
  21. package/fesm2022/rxjs-interop.mjs +1 -1
  22. package/fesm2022/testing.mjs +10 -9
  23. package/fesm2022/testing.mjs.map +1 -1
  24. package/index.d.ts +9 -36
  25. package/package.json +1 -1
  26. package/primitives/signals/index.d.ts +1 -1
  27. package/rxjs-interop/index.d.ts +1 -1
  28. package/schematics/migrations/block-template-entities/bundle.js +42 -8
  29. package/schematics/migrations/block-template-entities/bundle.js.map +3 -3
  30. package/schematics/ng-generate/control-flow-migration/bundle.js +42 -8
  31. package/schematics/ng-generate/control-flow-migration/bundle.js.map +3 -3
  32. package/schematics/ng-generate/standalone-migration/bundle.js +481 -186
  33. package/schematics/ng-generate/standalone-migration/bundle.js.map +3 -3
  34. package/testing/index.d.ts +1 -1
@@ -9582,7 +9582,7 @@ function createI18nContexts(job) {
9582
9582
  throw Error("AssertionError: Unexpected ICU outside of an i18n block.");
9583
9583
  }
9584
9584
  if (op.message.id !== currentI18nOp.message.id) {
9585
- const contextOp = createI18nContextOp(I18nContextKind.Icu, job.allocateXrefId(), currentI18nOp.xref, op.message, null);
9585
+ const contextOp = createI18nContextOp(I18nContextKind.Icu, job.allocateXrefId(), currentI18nOp.root, op.message, null);
9586
9586
  unit.create.push(contextOp);
9587
9587
  op.context = contextOp.xref;
9588
9588
  } else {
@@ -22136,7 +22136,7 @@ var TemplateData = class {
22136
22136
  }
22137
22137
  };
22138
22138
  var TemplateDefinitionBuilder = class {
22139
- constructor(constantPool, parentBindingScope, level = 0, contextName, i18nContext, templateIndex, templateName, _namespace, relativeContextFilePath, i18nUseExternalIds, deferBlocks, elementLocations, _constants = createComponentDefConsts()) {
22139
+ constructor(constantPool, parentBindingScope, level = 0, contextName, i18nContext, templateIndex, templateName, _namespace, relativeContextFilePath, i18nUseExternalIds, deferBlocks, elementLocations, allDeferrableDepsFn, _constants = createComponentDefConsts()) {
22140
22140
  this.constantPool = constantPool;
22141
22141
  this.level = level;
22142
22142
  this.contextName = contextName;
@@ -22147,6 +22147,7 @@ var TemplateDefinitionBuilder = class {
22147
22147
  this.i18nUseExternalIds = i18nUseExternalIds;
22148
22148
  this.deferBlocks = deferBlocks;
22149
22149
  this.elementLocations = elementLocations;
22150
+ this.allDeferrableDepsFn = allDeferrableDepsFn;
22150
22151
  this._constants = _constants;
22151
22152
  this._dataIndex = 0;
22152
22153
  this._bindingContext = 0;
@@ -22622,7 +22623,7 @@ var TemplateDefinitionBuilder = class {
22622
22623
  }
22623
22624
  const contextName = `${this.contextName}${contextNameSuffix}_${index}`;
22624
22625
  const name = `${contextName}_Template`;
22625
- const visitor = new TemplateDefinitionBuilder(this.constantPool, this._bindingScope, this.level + 1, contextName, this.i18n, index, name, this._namespace, this.fileBasedI18nSuffix, this.i18nUseExternalIds, this.deferBlocks, this.elementLocations, this._constants);
22626
+ const visitor = new TemplateDefinitionBuilder(this.constantPool, this._bindingScope, this.level + 1, contextName, this.i18n, index, name, this._namespace, this.fileBasedI18nSuffix, this.i18nUseExternalIds, this.deferBlocks, this.elementLocations, this.allDeferrableDepsFn, this._constants);
22626
22627
  this._nestedTemplateFns.push(() => {
22627
22628
  const templateFunctionExpr = visitor.buildTemplateFunction(children, variables, this._ngContentReservedSlots.length + this._ngContentSelectorsOffset, i18nMeta, variableAliases);
22628
22629
  this.constantPool.statements.push(templateFunctionExpr.toDeclStmt(name));
@@ -22794,6 +22795,7 @@ var TemplateDefinitionBuilder = class {
22794
22795
  });
22795
22796
  }
22796
22797
  visitDeferredBlock(deferred) {
22798
+ var _a2;
22797
22799
  const { loading, placeholder, error: error2, triggers, prefetchTriggers } = deferred;
22798
22800
  const metadata = this.deferBlocks.get(deferred);
22799
22801
  if (!metadata) {
@@ -22810,7 +22812,7 @@ var TemplateDefinitionBuilder = class {
22810
22812
  this.creationInstruction(deferred.sourceSpan, Identifiers.defer, trimTrailingNulls([
22811
22813
  literal(deferredIndex),
22812
22814
  literal(primaryTemplateIndex),
22813
- this.createDeferredDepsFunction(depsFnName, metadata),
22815
+ (_a2 = this.allDeferrableDepsFn) != null ? _a2 : this.createDeferredDepsFunction(depsFnName, metadata),
22814
22816
  literal(loadingIndex),
22815
22817
  literal(placeholderIndex),
22816
22818
  literal(errorIndex),
@@ -23824,6 +23826,17 @@ function compileDirectiveFromMetadata(meta, constantPool, bindingParser) {
23824
23826
  const type = createDirectiveType(meta);
23825
23827
  return { expression, type, statements: [] };
23826
23828
  }
23829
+ function createDeferredDepsFunction(constantPool, name, deps) {
23830
+ const dependencyExp = [];
23831
+ for (const [symbolName, importPath] of deps) {
23832
+ const innerFn = arrowFn([new FnParam("m", DYNAMIC_TYPE)], variable("m").prop(symbolName));
23833
+ const importExpr2 = new DynamicImportExpr(importPath).prop("then").callFn([innerFn]);
23834
+ dependencyExp.push(importExpr2);
23835
+ }
23836
+ const depsFnExpr = arrowFn([], literalArr(dependencyExp));
23837
+ constantPool.statements.push(depsFnExpr.toDeclStmt(name, StmtModifier.Final));
23838
+ return variable(name);
23839
+ }
23827
23840
  function compileComponentFromMetadata(meta, constantPool, bindingParser) {
23828
23841
  const definitionMap = baseDirectiveFields(meta, constantPool, bindingParser);
23829
23842
  addFeatures(definitionMap, meta);
@@ -23841,8 +23854,13 @@ function compileComponentFromMetadata(meta, constantPool, bindingParser) {
23841
23854
  const templateTypeName = meta.name;
23842
23855
  const templateName = templateTypeName ? `${templateTypeName}_Template` : null;
23843
23856
  if (!USE_TEMPLATE_PIPELINE) {
23857
+ let allDeferrableDepsFn = null;
23858
+ if (meta.deferBlocks.size > 0 && meta.deferrableTypes.size > 0 && meta.deferBlockDepsEmitMode === 1) {
23859
+ const fnName = `${templateTypeName}_DeferFn`;
23860
+ allDeferrableDepsFn = createDeferredDepsFunction(constantPool, fnName, meta.deferrableTypes);
23861
+ }
23844
23862
  const template2 = meta.template;
23845
- const templateBuilder = new TemplateDefinitionBuilder(constantPool, BindingScope.createRootScope(), 0, templateTypeName, null, null, templateName, Identifiers.namespaceHTML, meta.relativeContextFilePath, meta.i18nUseExternalIds, meta.deferBlocks, /* @__PURE__ */ new Map());
23863
+ const templateBuilder = new TemplateDefinitionBuilder(constantPool, BindingScope.createRootScope(), 0, templateTypeName, null, null, templateName, Identifiers.namespaceHTML, meta.relativeContextFilePath, meta.i18nUseExternalIds, meta.deferBlocks, /* @__PURE__ */ new Map(), allDeferrableDepsFn);
23846
23864
  const templateFunctionExpression = templateBuilder.buildTemplateFunction(template2.nodes, []);
23847
23865
  const ngContentSelectors = templateBuilder.getNgContentSelectors();
23848
23866
  if (ngContentSelectors) {
@@ -24375,7 +24393,7 @@ var R3TargetBinder = class {
24375
24393
  const scopedNodeEntities = extractScopedNodeEntities(scope);
24376
24394
  const { directives, eagerDirectives, bindings, references } = DirectiveBinder.apply(target.template, this.directiveMatcher);
24377
24395
  const { expressions, symbols, nestingLevel, usedPipes, eagerPipes, deferBlocks } = TemplateBinder.applyWithScope(target.template, scope);
24378
- return new R3BoundTarget(target, directives, eagerDirectives, bindings, references, expressions, symbols, nestingLevel, scopedNodeEntities, usedPipes, eagerPipes, deferBlocks);
24396
+ return new R3BoundTarget(target, directives, eagerDirectives, bindings, references, expressions, symbols, nestingLevel, scopedNodeEntities, usedPipes, eagerPipes, deferBlocks, scope);
24379
24397
  }
24380
24398
  };
24381
24399
  var Scope2 = class {
@@ -24383,6 +24401,7 @@ var Scope2 = class {
24383
24401
  this.parentScope = parentScope;
24384
24402
  this.rootNode = rootNode;
24385
24403
  this.namedEntities = /* @__PURE__ */ new Map();
24404
+ this.elementsInScope = /* @__PURE__ */ new Set();
24386
24405
  this.childScopes = /* @__PURE__ */ new Map();
24387
24406
  this.isDeferred = parentScope !== null && parentScope.isDeferred ? true : rootNode instanceof DeferredBlock;
24388
24407
  }
@@ -24416,6 +24435,7 @@ var Scope2 = class {
24416
24435
  visitElement(element2) {
24417
24436
  element2.references.forEach((node) => this.visitReference(node));
24418
24437
  element2.children.forEach((node) => node.visit(this));
24438
+ this.elementsInScope.add(element2);
24419
24439
  }
24420
24440
  visitTemplate(template2) {
24421
24441
  template2.references.forEach((node) => this.visitReference(node));
@@ -24825,7 +24845,7 @@ var TemplateBinder = class extends RecursiveAstVisitor {
24825
24845
  }
24826
24846
  };
24827
24847
  var R3BoundTarget = class {
24828
- constructor(target, directives, eagerDirectives, bindings, references, exprTargets, symbols, nestingLevel, scopedNodeEntities, usedPipes, eagerPipes, deferredBlocks) {
24848
+ constructor(target, directives, eagerDirectives, bindings, references, exprTargets, symbols, nestingLevel, scopedNodeEntities, usedPipes, eagerPipes, deferredBlocks, rootScope) {
24829
24849
  this.target = target;
24830
24850
  this.directives = directives;
24831
24851
  this.eagerDirectives = eagerDirectives;
@@ -24838,6 +24858,7 @@ var R3BoundTarget = class {
24838
24858
  this.usedPipes = usedPipes;
24839
24859
  this.eagerPipes = eagerPipes;
24840
24860
  this.deferredBlocks = deferredBlocks;
24861
+ this.rootScope = rootScope;
24841
24862
  }
24842
24863
  getEntitiesInScope(node) {
24843
24864
  var _a2;
@@ -24917,6 +24938,15 @@ var R3BoundTarget = class {
24917
24938
  }
24918
24939
  return null;
24919
24940
  }
24941
+ isDeferred(element2) {
24942
+ for (const deferBlock of this.deferredBlocks) {
24943
+ const scope = this.rootScope.childScopes.get(deferBlock);
24944
+ if (scope && scope.elementsInScope.has(element2)) {
24945
+ return true;
24946
+ }
24947
+ }
24948
+ return false;
24949
+ }
24920
24950
  findEntityInScope(rootNode, name) {
24921
24951
  const entities = this.getEntitiesInScope(rootNode);
24922
24952
  for (const entitity of entities) {
@@ -25094,7 +25124,9 @@ var CompilerFacadeImpl = class {
25094
25124
  declarations: facade.declarations.map(convertDeclarationFacadeToMetadata),
25095
25125
  declarationListEmitMode: 0,
25096
25126
  deferBlocks,
25127
+ deferrableTypes: /* @__PURE__ */ new Map(),
25097
25128
  deferrableDeclToImportDecl: /* @__PURE__ */ new Map(),
25129
+ deferBlockDepsEmitMode: 0,
25098
25130
  styles: [...facade.styles, ...template2.styles],
25099
25131
  encapsulation: facade.encapsulation,
25100
25132
  interpolation,
@@ -25301,7 +25333,9 @@ function convertDeclareComponentFacadeToMetadata(decl, typeSourceSpan, sourceMap
25301
25333
  viewProviders: decl.viewProviders !== void 0 ? new WrappedNodeExpr(decl.viewProviders) : null,
25302
25334
  animations: decl.animations !== void 0 ? new WrappedNodeExpr(decl.animations) : null,
25303
25335
  deferBlocks,
25336
+ deferrableTypes: /* @__PURE__ */ new Map(),
25304
25337
  deferrableDeclToImportDecl: /* @__PURE__ */ new Map(),
25338
+ deferBlockDepsEmitMode: 0,
25305
25339
  changeDetection: (_c2 = decl.changeDetection) != null ? _c2 : ChangeDetectionStrategy.Default,
25306
25340
  encapsulation: (_d2 = decl.encapsulation) != null ? _d2 : ViewEncapsulation.Emulated,
25307
25341
  interpolation,
@@ -25541,7 +25575,7 @@ function publishFacade(global) {
25541
25575
  }
25542
25576
 
25543
25577
  // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/version.mjs
25544
- var VERSION2 = new Version("17.1.0-rc.0");
25578
+ var VERSION2 = new Version("17.1.1");
25545
25579
 
25546
25580
  // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/i18n/extractor_merger.mjs
25547
25581
  var _VisitorMode;