@angular/compiler 21.0.0-next.6 → 21.0.0-next.7

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.
@@ -1,6 +1,6 @@
1
1
  /**
2
- * @license Angular v21.0.0-next.6
3
- * (c) 2010-2025 Google LLC. https://angular.io/
2
+ * @license Angular v21.0.0-next.7
3
+ * (c) 2010-2025 Google LLC. https://angular.dev/
4
4
  * License: MIT
5
5
  */
6
6
 
@@ -2844,6 +2844,8 @@ class Identifiers {
2844
2844
  static domProperty = { name: 'ɵɵdomProperty', moduleName: CORE };
2845
2845
  static ariaProperty = { name: 'ɵɵariaProperty', moduleName: CORE };
2846
2846
  static property = { name: 'ɵɵproperty', moduleName: CORE };
2847
+ static control = { name: 'ɵɵcontrol', moduleName: CORE };
2848
+ static controlCreate = { name: 'ɵɵcontrolCreate', moduleName: CORE };
2847
2849
  static animationEnterListener = {
2848
2850
  name: 'ɵɵanimateEnterListener',
2849
2851
  moduleName: CORE,
@@ -8783,6 +8785,17 @@ var OpKind;
8783
8785
  * An operation to bind animation events to an element.
8784
8786
  */
8785
8787
  OpKind[OpKind["AnimationListener"] = 56] = "AnimationListener";
8788
+ /**
8789
+ * An operation to bind an expression to a `control` property of an element.
8790
+ */
8791
+ OpKind[OpKind["Control"] = 57] = "Control";
8792
+ /**
8793
+ * An operation to set up a corresponding {@link Control} operation.
8794
+ *
8795
+ * This is responsible for setting up event listeners on a native or custom form control when
8796
+ * bound to a specialized control directive.
8797
+ */
8798
+ OpKind[OpKind["ControlCreate"] = 58] = "ControlCreate";
8786
8799
  })(OpKind || (OpKind = {}));
8787
8800
  /**
8788
8801
  * Distinguishes different kinds of IR expressions.
@@ -9453,6 +9466,25 @@ function createStoreLetOp(target, declaredName, value, sourceSpan) {
9453
9466
  ...NEW_OP,
9454
9467
  };
9455
9468
  }
9469
+ /** Creates a {@link ControlOp}. */
9470
+ function createControlOp(op) {
9471
+ return {
9472
+ kind: OpKind.Control,
9473
+ target: op.target,
9474
+ expression: op.expression,
9475
+ bindingKind: op.bindingKind,
9476
+ securityContext: op.securityContext,
9477
+ sanitizer: null,
9478
+ isStructuralTemplateAttribute: op.isStructuralTemplateAttribute,
9479
+ templateKind: op.templateKind,
9480
+ i18nContext: op.i18nContext,
9481
+ i18nMessage: op.i18nMessage,
9482
+ sourceSpan: op.sourceSpan,
9483
+ ...TRAIT_DEPENDS_ON_SLOT_CONTEXT,
9484
+ ...TRAIT_CONSUMES_VARS,
9485
+ ...NEW_OP,
9486
+ };
9487
+ }
9456
9488
 
9457
9489
  /**
9458
9490
  * Check whether a given `o.Expression` is a logical IR expression type.
@@ -10235,6 +10267,7 @@ function transformExpressionsInOp(op, transform, flags) {
10235
10267
  case OpKind.Property:
10236
10268
  case OpKind.DomProperty:
10237
10269
  case OpKind.Attribute:
10270
+ case OpKind.Control:
10238
10271
  if (op.expression instanceof Interpolation) {
10239
10272
  transformExpressionsInInterpolation(op.expression, transform, flags);
10240
10273
  }
@@ -10360,6 +10393,7 @@ function transformExpressionsInOp(op, transform, flags) {
10360
10393
  case OpKind.SourceLocation:
10361
10394
  case OpKind.ConditionalCreate:
10362
10395
  case OpKind.ConditionalBranchCreate:
10396
+ case OpKind.ControlCreate:
10363
10397
  // These operations contain no expressions.
10364
10398
  break;
10365
10399
  default:
@@ -11260,6 +11294,10 @@ function createSourceLocationOp(templatePath, locations) {
11260
11294
  ...NEW_OP,
11261
11295
  };
11262
11296
  }
11297
+ /** Creates a {@link ControlCreateOp}. */
11298
+ function createControlCreateOp(sourceSpan) {
11299
+ return { kind: OpKind.ControlCreate, sourceSpan, ...NEW_OP };
11300
+ }
11263
11301
 
11264
11302
  function createDomPropertyOp(name, expression, bindingKind, i18nContext, securityContext, sourceSpan) {
11265
11303
  return {
@@ -11738,6 +11776,14 @@ function extractAttributes(job) {
11738
11776
  /* i18nMessage */ null, op.securityContext), lookupElement$3(elements, op.target));
11739
11777
  }
11740
11778
  break;
11779
+ case OpKind.Control:
11780
+ OpList.insertBefore(
11781
+ // Deliberately null i18nMessage value
11782
+ createExtractedAttributeOp(op.target, BindingKind.Property, null, 'control',
11783
+ /* expression */ null,
11784
+ /* i18nContext */ null,
11785
+ /* i18nMessage */ null, op.securityContext), lookupElement$3(elements, op.target));
11786
+ break;
11741
11787
  case OpKind.TwoWayProperty:
11742
11788
  OpList.insertBefore(createExtractedAttributeOp(op.target, BindingKind.TwoWayProperty, null, op.name,
11743
11789
  /* expression */ null,
@@ -11897,6 +11943,9 @@ function specializeBindings(job) {
11897
11943
  else if (job.kind === CompilationJobKind.Host) {
11898
11944
  OpList.replace(op, createDomPropertyOp(op.name, op.expression, op.bindingKind, op.i18nContext, op.securityContext, op.sourceSpan));
11899
11945
  }
11946
+ else if (op.name === 'control') {
11947
+ OpList.replace(op, createControlOp(op));
11948
+ }
11900
11949
  else {
11901
11950
  OpList.replace(op, createPropertyOp(op.target, op.name, op.expression, op.bindingKind, op.securityContext, op.isStructuralTemplateAttribute, op.templateKind, op.i18nContext, op.i18nMessage, op.sourceSpan));
11902
11951
  }
@@ -23909,6 +23958,22 @@ function ariaProperty(name, expression, sourceSpan) {
23909
23958
  function property(name, expression, sanitizer, sourceSpan) {
23910
23959
  return propertyBase(Identifiers.property, name, expression, sanitizer, sourceSpan);
23911
23960
  }
23961
+ function control(expression, sanitizer, sourceSpan) {
23962
+ const args = [];
23963
+ if (expression instanceof Interpolation) {
23964
+ args.push(interpolationToExpression(expression, sourceSpan));
23965
+ }
23966
+ else {
23967
+ args.push(expression);
23968
+ }
23969
+ if (sanitizer !== null) {
23970
+ args.push(sanitizer);
23971
+ }
23972
+ return call(Identifiers.control, args, sourceSpan);
23973
+ }
23974
+ function controlCreate(sourceSpan) {
23975
+ return call(Identifiers.controlCreate, [], sourceSpan);
23976
+ }
23912
23977
  function twoWayProperty(name, expression, sanitizer, sourceSpan) {
23913
23978
  const args = [literal(name), expression];
23914
23979
  if (sanitizer !== null) {
@@ -24469,6 +24534,9 @@ function reifyCreateOperations(unit, ops) {
24469
24534
  }));
24470
24535
  OpList.replace(op, attachSourceLocation(op.templatePath, locationsLiteral));
24471
24536
  break;
24537
+ case OpKind.ControlCreate:
24538
+ OpList.replace(op, controlCreate(op.sourceSpan));
24539
+ break;
24472
24540
  case OpKind.Statement:
24473
24541
  // Pass statement operations directly through.
24474
24542
  break;
@@ -24491,6 +24559,9 @@ function reifyUpdateOperations(unit, ops) {
24491
24559
  ? reifyDomProperty(op)
24492
24560
  : reifyProperty(op));
24493
24561
  break;
24562
+ case OpKind.Control:
24563
+ OpList.replace(op, reifyControl(op));
24564
+ break;
24494
24565
  case OpKind.TwoWayProperty:
24495
24566
  OpList.replace(op, twoWayProperty(op.name, op.expression, op.sanitizer, op.sourceSpan));
24496
24567
  break;
@@ -24586,6 +24657,9 @@ function reifyProperty(op) {
24586
24657
  ? ariaProperty(op.name, op.expression, op.sourceSpan)
24587
24658
  : property(op.name, op.expression, op.sanitizer, op.sourceSpan);
24588
24659
  }
24660
+ function reifyControl(op) {
24661
+ return control(op.expression, op.sanitizer, op.sourceSpan);
24662
+ }
24589
24663
  function reifyIrExpression(expr) {
24590
24664
  if (!isIrExpression(expr)) {
24591
24665
  return expr;
@@ -26098,6 +26172,7 @@ function varsUsedByOp(op) {
26098
26172
  return slots;
26099
26173
  case OpKind.Property:
26100
26174
  case OpKind.DomProperty:
26175
+ case OpKind.Control:
26101
26176
  slots = 1;
26102
26177
  // We need to assign a slot even for singleton interpolations, because the
26103
26178
  // runtime needs to store both the raw value and the stringified one.
@@ -27565,6 +27640,11 @@ function ingestElementBindings(unit, op, element) {
27565
27640
  }
27566
27641
  // All dynamic bindings (both attribute and property bindings).
27567
27642
  bindings.push(createBindingOp(op.xref, BINDING_KINDS.get(input.type), input.name, convertAstWithInterpolation(unit.job, astOf(input.value), input.i18n), input.unit, input.securityContext, false, false, null, asMessage(input.i18n) ?? null, input.sourceSpan));
27643
+ // If the input name is 'control', this could be a form control binding which requires a
27644
+ // `ControlCreateOp` to properly initialize.
27645
+ if (input.type === BindingType.Property && input.name === 'control') {
27646
+ unit.create.push(createControlCreateOp(input.sourceSpan));
27647
+ }
27568
27648
  }
27569
27649
  unit.create.push(bindings.filter((b) => b?.kind === OpKind.ExtractedAttribute));
27570
27650
  unit.update.push(bindings.filter((b) => b?.kind === OpKind.Binding));
@@ -30526,7 +30606,7 @@ function compileComponentFromMetadata(meta, constantPool, bindingParser) {
30526
30606
  : TemplateCompilationMode.Full;
30527
30607
  // First the template is ingested into IR:
30528
30608
  const tpl = ingestComponent(meta.name, meta.template.nodes, constantPool, compilationMode, meta.relativeContextFilePath, meta.i18nUseExternalIds, meta.defer, allDeferrableDepsFn, meta.relativeTemplatePath, getTemplateSourceLocationsEnabled());
30529
- // Then the IR is transformed to prepare it for cod egeneration.
30609
+ // Then the IR is transformed to prepare it for code generation.
30530
30610
  transform(tpl, CompilationJobKind.Tmpl);
30531
30611
  // Finally we emit the template function:
30532
30612
  const templateFn = emitTemplateFn(tpl, constantPool);
@@ -34434,7 +34514,7 @@ const MINIMUM_PARTIAL_LINKER_DEFER_SUPPORT_VERSION = '18.0.0';
34434
34514
  function compileDeclareClassMetadata(metadata) {
34435
34515
  const definitionMap = new DefinitionMap();
34436
34516
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$5));
34437
- definitionMap.set('version', literal('21.0.0-next.6'));
34517
+ definitionMap.set('version', literal('21.0.0-next.7'));
34438
34518
  definitionMap.set('ngImport', importExpr(Identifiers.core));
34439
34519
  definitionMap.set('type', metadata.type);
34440
34520
  definitionMap.set('decorators', metadata.decorators);
@@ -34452,7 +34532,7 @@ function compileComponentDeclareClassMetadata(metadata, dependencies) {
34452
34532
  callbackReturnDefinitionMap.set('ctorParameters', metadata.ctorParameters ?? literal(null));
34453
34533
  callbackReturnDefinitionMap.set('propDecorators', metadata.propDecorators ?? literal(null));
34454
34534
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_DEFER_SUPPORT_VERSION));
34455
- definitionMap.set('version', literal('21.0.0-next.6'));
34535
+ definitionMap.set('version', literal('21.0.0-next.7'));
34456
34536
  definitionMap.set('ngImport', importExpr(Identifiers.core));
34457
34537
  definitionMap.set('type', metadata.type);
34458
34538
  definitionMap.set('resolveDeferredDeps', compileComponentMetadataAsyncResolver(dependencies));
@@ -34547,7 +34627,7 @@ function createDirectiveDefinitionMap(meta) {
34547
34627
  const definitionMap = new DefinitionMap();
34548
34628
  const minVersion = getMinimumVersionForPartialOutput(meta);
34549
34629
  definitionMap.set('minVersion', literal(minVersion));
34550
- definitionMap.set('version', literal('21.0.0-next.6'));
34630
+ definitionMap.set('version', literal('21.0.0-next.7'));
34551
34631
  // e.g. `type: MyDirective`
34552
34632
  definitionMap.set('type', meta.type.value);
34553
34633
  if (meta.isStandalone !== undefined) {
@@ -34960,7 +35040,7 @@ const MINIMUM_PARTIAL_LINKER_VERSION$4 = '12.0.0';
34960
35040
  function compileDeclareFactoryFunction(meta) {
34961
35041
  const definitionMap = new DefinitionMap();
34962
35042
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$4));
34963
- definitionMap.set('version', literal('21.0.0-next.6'));
35043
+ definitionMap.set('version', literal('21.0.0-next.7'));
34964
35044
  definitionMap.set('ngImport', importExpr(Identifiers.core));
34965
35045
  definitionMap.set('type', meta.type.value);
34966
35046
  definitionMap.set('deps', compileDependencies(meta.deps));
@@ -34995,7 +35075,7 @@ function compileDeclareInjectableFromMetadata(meta) {
34995
35075
  function createInjectableDefinitionMap(meta) {
34996
35076
  const definitionMap = new DefinitionMap();
34997
35077
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$3));
34998
- definitionMap.set('version', literal('21.0.0-next.6'));
35078
+ definitionMap.set('version', literal('21.0.0-next.7'));
34999
35079
  definitionMap.set('ngImport', importExpr(Identifiers.core));
35000
35080
  definitionMap.set('type', meta.type.value);
35001
35081
  // Only generate providedIn property if it has a non-null value
@@ -35046,7 +35126,7 @@ function compileDeclareInjectorFromMetadata(meta) {
35046
35126
  function createInjectorDefinitionMap(meta) {
35047
35127
  const definitionMap = new DefinitionMap();
35048
35128
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$2));
35049
- definitionMap.set('version', literal('21.0.0-next.6'));
35129
+ definitionMap.set('version', literal('21.0.0-next.7'));
35050
35130
  definitionMap.set('ngImport', importExpr(Identifiers.core));
35051
35131
  definitionMap.set('type', meta.type.value);
35052
35132
  definitionMap.set('providers', meta.providers);
@@ -35079,7 +35159,7 @@ function createNgModuleDefinitionMap(meta) {
35079
35159
  throw new Error('Invalid path! Local compilation mode should not get into the partial compilation path');
35080
35160
  }
35081
35161
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$1));
35082
- definitionMap.set('version', literal('21.0.0-next.6'));
35162
+ definitionMap.set('version', literal('21.0.0-next.7'));
35083
35163
  definitionMap.set('ngImport', importExpr(Identifiers.core));
35084
35164
  definitionMap.set('type', meta.type.value);
35085
35165
  // We only generate the keys in the metadata if the arrays contain values.
@@ -35130,7 +35210,7 @@ function compileDeclarePipeFromMetadata(meta) {
35130
35210
  function createPipeDefinitionMap(meta) {
35131
35211
  const definitionMap = new DefinitionMap();
35132
35212
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION));
35133
- definitionMap.set('version', literal('21.0.0-next.6'));
35213
+ definitionMap.set('version', literal('21.0.0-next.7'));
35134
35214
  definitionMap.set('ngImport', importExpr(Identifiers.core));
35135
35215
  // e.g. `type: MyPipe`
35136
35216
  definitionMap.set('type', meta.type.value);
@@ -35286,7 +35366,7 @@ function compileHmrUpdateCallback(definitions, constantStatements, meta) {
35286
35366
  * @description
35287
35367
  * Entry point for all public APIs of the compiler package.
35288
35368
  */
35289
- const VERSION = new Version('21.0.0-next.6');
35369
+ const VERSION = new Version('21.0.0-next.7');
35290
35370
 
35291
35371
  //////////////////////////////////////
35292
35372
  // THIS FILE HAS GLOBAL SIDE EFFECT //