@angular/compiler 20.3.2 → 20.3.3

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,5 +1,5 @@
1
1
  /**
2
- * @license Angular v20.3.2
2
+ * @license Angular v20.3.3
3
3
  * (c) 2010-2025 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -11825,6 +11825,16 @@ function extractAttributeOp(unit, op, elements) {
11825
11825
  }
11826
11826
  }
11827
11827
 
11828
+ const ARIA_PREFIX = 'aria-';
11829
+ /**
11830
+ * Returns whether `name` is an ARIA attribute name.
11831
+ *
11832
+ * This is a heuristic based on whether name begins with and is longer than `aria-`.
11833
+ */
11834
+ function isAriaAttribute(name) {
11835
+ return name.startsWith(ARIA_PREFIX) && name.length > ARIA_PREFIX.length;
11836
+ }
11837
+
11828
11838
  /**
11829
11839
  * Looks up an element in the given map by xref ID.
11830
11840
  */
@@ -11870,7 +11880,15 @@ function specializeBindings(job) {
11870
11880
  break;
11871
11881
  case BindingKind.Property:
11872
11882
  case BindingKind.LegacyAnimation:
11873
- if (job.kind === CompilationJobKind.Host) {
11883
+ // Convert a property binding targeting an ARIA attribute (e.g. [aria-label]) into an
11884
+ // attribute binding when we know it can't also target an input. Note that a `Host` job is
11885
+ // always `DomOnly`, so this condition must be checked first.
11886
+ if (job.mode === TemplateCompilationMode.DomOnly && isAriaAttribute(op.name)) {
11887
+ OpList.replace(op, createAttributeOp(op.target,
11888
+ /* namespace= */ null, op.name, op.expression, op.securityContext,
11889
+ /* isTextAttribute= */ false, op.isStructuralTemplateAttribute, op.templateKind, op.i18nMessage, op.sourceSpan));
11890
+ }
11891
+ else if (job.kind === CompilationJobKind.Host) {
11874
11892
  OpList.replace(op, createDomPropertyOp(op.name, op.expression, op.bindingKind, op.i18nContext, op.securityContext, op.sourceSpan));
11875
11893
  }
11876
11894
  else {
@@ -18356,9 +18374,6 @@ class Token {
18356
18374
  isTemplateLiteralInterpolationStart() {
18357
18375
  return this.isOperator('${');
18358
18376
  }
18359
- isTemplateLiteralInterpolationEnd() {
18360
- return this.isOperator('}');
18361
- }
18362
18377
  toString() {
18363
18378
  switch (this.type) {
18364
18379
  case TokenType.Character:
@@ -18531,7 +18546,7 @@ class _Scanner {
18531
18546
  this.advance();
18532
18547
  const currentBrace = this.braceStack.pop();
18533
18548
  if (currentBrace === 'interpolation') {
18534
- this.tokens.push(newOperatorToken(start, this.index, '}'));
18549
+ this.tokens.push(newCharacterToken(start, this.index, $RBRACE));
18535
18550
  return this.scanTemplateLiteralPart(this.index);
18536
18551
  }
18537
18552
  return newCharacterToken(start, this.index, code);
@@ -20025,6 +20040,7 @@ class _ParseAST {
20025
20040
  }
20026
20041
  else if (token.isTemplateLiteralInterpolationStart()) {
20027
20042
  this.advance();
20043
+ this.rbracesExpected++;
20028
20044
  const expression = this.parsePipe();
20029
20045
  if (expression instanceof EmptyExpr$1) {
20030
20046
  this.error('Template literal interpolation cannot be empty');
@@ -20032,6 +20048,7 @@ class _ParseAST {
20032
20048
  else {
20033
20049
  expressions.push(expression);
20034
20050
  }
20051
+ this.rbracesExpected--;
20035
20052
  }
20036
20053
  else {
20037
20054
  this.advance();
@@ -23967,7 +23984,6 @@ function callVariadicInstruction(config, baseArgs, interpolationArgs, extraArgs,
23967
23984
  return createStatementOp(callVariadicInstructionExpr(config, baseArgs, interpolationArgs, extraArgs, sourceSpan).toStmt());
23968
23985
  }
23969
23986
 
23970
- const ARIA_PREFIX = 'aria';
23971
23987
  /**
23972
23988
  * Map of target resolvers for event listeners.
23973
23989
  */
@@ -24346,33 +24362,6 @@ function reifyUpdateOperations(unit, ops) {
24346
24362
  }
24347
24363
  }
24348
24364
  }
24349
- /**
24350
- * Converts an ARIA property name to its corresponding attribute name, if necessary.
24351
- *
24352
- * For example, converts `ariaLabel` to `aria-label`.
24353
- *
24354
- * https://www.w3.org/TR/wai-aria-1.2/#accessibilityroleandproperties-correspondence
24355
- *
24356
- * This must be kept in sync with the the function of the same name in
24357
- * packages/core/src/render3/instructions/aria_property.ts.
24358
- *
24359
- * @param name A property name that starts with `aria`.
24360
- * @returns The corresponding attribute name.
24361
- */
24362
- function ariaAttrName(name) {
24363
- return name.charAt(ARIA_PREFIX.length) !== '-'
24364
- ? ARIA_PREFIX + '-' + name.slice(ARIA_PREFIX.length).toLowerCase()
24365
- : name; // Property already has attribute name.
24366
- }
24367
- /**
24368
- * Returns whether `name` is an ARIA property (or attribute) name.
24369
- *
24370
- * This is a heuristic based on whether name begins with and is longer than `aria`. For example,
24371
- * this returns true for both `ariaLabel` and `aria-label`.
24372
- */
24373
- function isAriaProperty(name) {
24374
- return name.startsWith(ARIA_PREFIX) && name.length > ARIA_PREFIX.length;
24375
- }
24376
24365
  /**
24377
24366
  * Reifies a DOM property binding operation.
24378
24367
  *
@@ -24383,9 +24372,7 @@ function isAriaProperty(name) {
24383
24372
  * @returns A statement to update the property at runtime.
24384
24373
  */
24385
24374
  function reifyDomProperty(op) {
24386
- return isAriaProperty(op.name)
24387
- ? attribute(ariaAttrName(op.name), op.expression, null, null, op.sourceSpan)
24388
- : domProperty(DOM_PROPERTY_REMAPPING.get(op.name) ?? op.name, op.expression, op.sanitizer, op.sourceSpan);
24375
+ return domProperty(DOM_PROPERTY_REMAPPING.get(op.name) ?? op.name, op.expression, op.sanitizer, op.sourceSpan);
24389
24376
  }
24390
24377
  /**
24391
24378
  * Reifies a property binding operation.
@@ -24397,7 +24384,7 @@ function reifyDomProperty(op) {
24397
24384
  * @returns A statement to update the property at runtime.
24398
24385
  */
24399
24386
  function reifyProperty(op) {
24400
- return isAriaProperty(op.name)
24387
+ return isAriaAttribute(op.name)
24401
24388
  ? ariaProperty(op.name, op.expression, op.sourceSpan)
24402
24389
  : property(op.name, op.expression, op.sanitizer, op.sourceSpan);
24403
24390
  }
@@ -29525,6 +29512,13 @@ class HtmlAstToIvyAst {
29525
29512
  }
29526
29513
  else {
29527
29514
  const attrs = this.categorizePropertyAttributes(element.name, parsedProperties, i18nAttrsMeta);
29515
+ if (element.name === 'ng-container') {
29516
+ for (const bound of attrs.bound) {
29517
+ if (bound.type === BindingType.Attribute) {
29518
+ this.reportError(`Attribute bindings are not supported on ng-container. Use property bindings instead.`, bound.sourceSpan);
29519
+ }
29520
+ }
29521
+ }
29528
29522
  parsedElement = new Element$1(element.name, attributes, attrs.bound, boundEvents, directives, children, references, element.isSelfClosing, element.sourceSpan, element.startSourceSpan, element.endSourceSpan, element.isVoid, element.i18n);
29529
29523
  }
29530
29524
  if (elementHasInlineTemplate) {
@@ -34259,7 +34253,7 @@ const MINIMUM_PARTIAL_LINKER_DEFER_SUPPORT_VERSION = '18.0.0';
34259
34253
  function compileDeclareClassMetadata(metadata) {
34260
34254
  const definitionMap = new DefinitionMap();
34261
34255
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$5));
34262
- definitionMap.set('version', literal('20.3.2'));
34256
+ definitionMap.set('version', literal('20.3.3'));
34263
34257
  definitionMap.set('ngImport', importExpr(Identifiers.core));
34264
34258
  definitionMap.set('type', metadata.type);
34265
34259
  definitionMap.set('decorators', metadata.decorators);
@@ -34277,7 +34271,7 @@ function compileComponentDeclareClassMetadata(metadata, dependencies) {
34277
34271
  callbackReturnDefinitionMap.set('ctorParameters', metadata.ctorParameters ?? literal(null));
34278
34272
  callbackReturnDefinitionMap.set('propDecorators', metadata.propDecorators ?? literal(null));
34279
34273
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_DEFER_SUPPORT_VERSION));
34280
- definitionMap.set('version', literal('20.3.2'));
34274
+ definitionMap.set('version', literal('20.3.3'));
34281
34275
  definitionMap.set('ngImport', importExpr(Identifiers.core));
34282
34276
  definitionMap.set('type', metadata.type);
34283
34277
  definitionMap.set('resolveDeferredDeps', compileComponentMetadataAsyncResolver(dependencies));
@@ -34372,7 +34366,7 @@ function createDirectiveDefinitionMap(meta) {
34372
34366
  const definitionMap = new DefinitionMap();
34373
34367
  const minVersion = getMinimumVersionForPartialOutput(meta);
34374
34368
  definitionMap.set('minVersion', literal(minVersion));
34375
- definitionMap.set('version', literal('20.3.2'));
34369
+ definitionMap.set('version', literal('20.3.3'));
34376
34370
  // e.g. `type: MyDirective`
34377
34371
  definitionMap.set('type', meta.type.value);
34378
34372
  if (meta.isStandalone !== undefined) {
@@ -34788,7 +34782,7 @@ const MINIMUM_PARTIAL_LINKER_VERSION$4 = '12.0.0';
34788
34782
  function compileDeclareFactoryFunction(meta) {
34789
34783
  const definitionMap = new DefinitionMap();
34790
34784
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$4));
34791
- definitionMap.set('version', literal('20.3.2'));
34785
+ definitionMap.set('version', literal('20.3.3'));
34792
34786
  definitionMap.set('ngImport', importExpr(Identifiers.core));
34793
34787
  definitionMap.set('type', meta.type.value);
34794
34788
  definitionMap.set('deps', compileDependencies(meta.deps));
@@ -34823,7 +34817,7 @@ function compileDeclareInjectableFromMetadata(meta) {
34823
34817
  function createInjectableDefinitionMap(meta) {
34824
34818
  const definitionMap = new DefinitionMap();
34825
34819
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$3));
34826
- definitionMap.set('version', literal('20.3.2'));
34820
+ definitionMap.set('version', literal('20.3.3'));
34827
34821
  definitionMap.set('ngImport', importExpr(Identifiers.core));
34828
34822
  definitionMap.set('type', meta.type.value);
34829
34823
  // Only generate providedIn property if it has a non-null value
@@ -34874,7 +34868,7 @@ function compileDeclareInjectorFromMetadata(meta) {
34874
34868
  function createInjectorDefinitionMap(meta) {
34875
34869
  const definitionMap = new DefinitionMap();
34876
34870
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$2));
34877
- definitionMap.set('version', literal('20.3.2'));
34871
+ definitionMap.set('version', literal('20.3.3'));
34878
34872
  definitionMap.set('ngImport', importExpr(Identifiers.core));
34879
34873
  definitionMap.set('type', meta.type.value);
34880
34874
  definitionMap.set('providers', meta.providers);
@@ -34907,7 +34901,7 @@ function createNgModuleDefinitionMap(meta) {
34907
34901
  throw new Error('Invalid path! Local compilation mode should not get into the partial compilation path');
34908
34902
  }
34909
34903
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$1));
34910
- definitionMap.set('version', literal('20.3.2'));
34904
+ definitionMap.set('version', literal('20.3.3'));
34911
34905
  definitionMap.set('ngImport', importExpr(Identifiers.core));
34912
34906
  definitionMap.set('type', meta.type.value);
34913
34907
  // We only generate the keys in the metadata if the arrays contain values.
@@ -34958,7 +34952,7 @@ function compileDeclarePipeFromMetadata(meta) {
34958
34952
  function createPipeDefinitionMap(meta) {
34959
34953
  const definitionMap = new DefinitionMap();
34960
34954
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION));
34961
- definitionMap.set('version', literal('20.3.2'));
34955
+ definitionMap.set('version', literal('20.3.3'));
34962
34956
  definitionMap.set('ngImport', importExpr(Identifiers.core));
34963
34957
  // e.g. `type: MyPipe`
34964
34958
  definitionMap.set('type', meta.type.value);
@@ -35114,7 +35108,7 @@ function compileHmrUpdateCallback(definitions, constantStatements, meta) {
35114
35108
  * @description
35115
35109
  * Entry point for all public APIs of the compiler package.
35116
35110
  */
35117
- const VERSION = new Version('20.3.2');
35111
+ const VERSION = new Version('20.3.3');
35118
35112
 
35119
35113
  //////////////////////////////////////
35120
35114
  // THIS FILE HAS GLOBAL SIDE EFFECT //