@angular/compiler-cli 21.0.0-rc.0 → 21.0.0-rc.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.
@@ -8,7 +8,7 @@ import {
8
8
  TrackedIncrementalBuildStrategy,
9
9
  freshCompilationTicket,
10
10
  incrementalFromCompilerTicket
11
- } from "./chunk-ZOZ6XVF3.js";
11
+ } from "./chunk-JCBKDAHA.js";
12
12
  import {
13
13
  ActivePerfRecorder,
14
14
  OptimizeFor,
@@ -18,7 +18,7 @@ import {
18
18
  TsCreateProgramDriver,
19
19
  replaceTsWithNgInErrors,
20
20
  retagAllTsFiles
21
- } from "./chunk-3CWKYDQ7.js";
21
+ } from "./chunk-Y65S2AOA.js";
22
22
  import {
23
23
  absoluteFrom,
24
24
  createFileSystemTsReadDirectoryFn,
@@ -104,6 +104,7 @@ var ErrorCode;
104
104
  ErrorCode2[ErrorCode2["DEFER_IMPLICIT_TRIGGER_MISSING_PLACEHOLDER"] = 8019] = "DEFER_IMPLICIT_TRIGGER_MISSING_PLACEHOLDER";
105
105
  ErrorCode2[ErrorCode2["DEFER_IMPLICIT_TRIGGER_INVALID_PLACEHOLDER"] = 8020] = "DEFER_IMPLICIT_TRIGGER_INVALID_PLACEHOLDER";
106
106
  ErrorCode2[ErrorCode2["DEFER_TRIGGER_MISCONFIGURATION"] = 8021] = "DEFER_TRIGGER_MISCONFIGURATION";
107
+ ErrorCode2[ErrorCode2["FORM_FIELD_UNSUPPORTED_BINDING"] = 8022] = "FORM_FIELD_UNSUPPORTED_BINDING";
107
108
  ErrorCode2[ErrorCode2["INVALID_BANANA_IN_BOX"] = 8101] = "INVALID_BANANA_IN_BOX";
108
109
  ErrorCode2[ErrorCode2["NULLISH_COALESCING_NOT_NULLABLE"] = 8102] = "NULLISH_COALESCING_NOT_NULLABLE";
109
110
  ErrorCode2[ErrorCode2["MISSING_CONTROL_FLOW_DIRECTIVE"] = 8103] = "MISSING_CONTROL_FLOW_DIRECTIVE";
@@ -8260,7 +8261,6 @@ function extractDirectiveMetadata(clazz, decorator, reflector, importTracker, ev
8260
8261
  queries: contentQueries,
8261
8262
  viewQueries,
8262
8263
  selector,
8263
- fullInheritance: false,
8264
8264
  type,
8265
8265
  typeArgumentCount: reflector.getGenericArityOfClass(clazz) || 0,
8266
8266
  typeSourceSpan: createSourceSpan(clazz.name),
@@ -13686,7 +13686,7 @@ var Environment = class extends ReferenceEmitEnvironment {
13686
13686
  };
13687
13687
 
13688
13688
  // packages/compiler-cli/src/ngtsc/typecheck/src/oob.js
13689
- import { AbsoluteSourceSpan as AbsoluteSourceSpan3, TmplAstBoundEvent as TmplAstBoundEvent2, TmplAstComponent, TmplAstDirective, TmplAstElement } from "@angular/compiler";
13689
+ import { AbsoluteSourceSpan as AbsoluteSourceSpan3, TmplAstBoundAttribute as TmplAstBoundAttribute2, TmplAstBoundEvent as TmplAstBoundEvent2, TmplAstComponent, TmplAstDirective, TmplAstElement, ParseSourceSpan as ParseSourceSpan2, BindingType as BindingType2 } from "@angular/compiler";
13690
13690
  import ts58 from "typescript";
13691
13691
  var OutOfBandDiagnosticRecorderImpl = class {
13692
13692
  resolver;
@@ -13854,7 +13854,23 @@ Consider enabling the 'strictTemplates' option in your tsconfig.json for better
13854
13854
  }
13855
13855
  missingRequiredInputs(id, element, directiveName, isComponent, inputAliases) {
13856
13856
  const message = `Required input${inputAliases.length === 1 ? "" : "s"} ${inputAliases.map((n2) => `'${n2}'`).join(", ")} from ${isComponent ? "component" : "directive"} ${directiveName} must be specified.`;
13857
- this._diagnostics.push(makeTemplateDiagnostic(id, this.resolver.getTemplateSourceMapping(id), element.startSourceSpan, ts58.DiagnosticCategory.Error, ngErrorCode(ErrorCode.MISSING_REQUIRED_INPUTS), message));
13857
+ let span;
13858
+ let name;
13859
+ if (element instanceof TmplAstElement || element instanceof TmplAstDirective) {
13860
+ name = element.name;
13861
+ } else if (element instanceof TmplAstComponent) {
13862
+ name = element.componentName;
13863
+ } else {
13864
+ name = null;
13865
+ }
13866
+ if (name === null) {
13867
+ span = element.startSourceSpan;
13868
+ } else {
13869
+ const start = element.startSourceSpan.start.moveBy(1);
13870
+ const end = element.startSourceSpan.end.moveBy(start.offset + name.length - element.startSourceSpan.end.offset);
13871
+ span = new ParseSourceSpan2(start, end);
13872
+ }
13873
+ this._diagnostics.push(makeTemplateDiagnostic(id, this.resolver.getTemplateSourceMapping(id), span, ts58.DiagnosticCategory.Error, ngErrorCode(ErrorCode.MISSING_REQUIRED_INPUTS), message));
13858
13874
  }
13859
13875
  illegalForLoopTrackAccess(id, block, access) {
13860
13876
  const sourceSpan = this.resolver.toTemplateParseSourceSpan(id, access.sourceSpan);
@@ -13934,6 +13950,23 @@ Deferred blocks can only access triggers in same view, a parent embedded view or
13934
13950
  deferImplicitTriggerInvalidPlaceholder(id, trigger) {
13935
13951
  this._diagnostics.push(makeTemplateDiagnostic(id, this.resolver.getTemplateSourceMapping(id), trigger.sourceSpan, ts58.DiagnosticCategory.Error, ngErrorCode(ErrorCode.DEFER_IMPLICIT_TRIGGER_INVALID_PLACEHOLDER), "Trigger with no target can only be placed on an @defer that has a @placeholder block with exactly one root element node"));
13936
13952
  }
13953
+ formFieldUnsupportedBinding(id, node) {
13954
+ let message;
13955
+ if (node instanceof TmplAstBoundAttribute2) {
13956
+ let name;
13957
+ if (node.type === BindingType2.Property) {
13958
+ name = `[${node.name}]`;
13959
+ } else if (node.type === BindingType2.Attribute) {
13960
+ name = `[attr.${node.name}]`;
13961
+ } else {
13962
+ name = node.name;
13963
+ }
13964
+ message = `Binding to '${name}' is not allowed on nodes using the '[field]' directive`;
13965
+ } else {
13966
+ message = `Setting the '${node.name}' attribute is not allowed on nodes using the '[field]' directive`;
13967
+ }
13968
+ this._diagnostics.push(makeTemplateDiagnostic(id, this.resolver.getTemplateSourceMapping(id), node.sourceSpan, ts58.DiagnosticCategory.Error, ngErrorCode(ErrorCode.FORM_FIELD_UNSUPPORTED_BINDING), message));
13969
+ }
13937
13970
  };
13938
13971
  function makeInlineDiagnostic(id, code, node, messageText, relatedInformation) {
13939
13972
  return {
@@ -13960,7 +13993,7 @@ var TypeCheckShimGenerator = class {
13960
13993
  };
13961
13994
 
13962
13995
  // packages/compiler-cli/src/ngtsc/typecheck/src/type_check_block.js
13963
- import { BindingPipe, BindingType as BindingType2, Call as Call3, createCssSelectorFromNode, CssSelector as CssSelector3, DYNAMIC_TYPE, ImplicitReceiver as ImplicitReceiver3, ParsedEventType as ParsedEventType2, PropertyRead as PropertyRead4, R3Identifiers as R3Identifiers4, SafeCall as SafeCall2, SafePropertyRead as SafePropertyRead3, SelectorMatcher as SelectorMatcher2, ThisReceiver as ThisReceiver2, TmplAstBoundAttribute as TmplAstBoundAttribute2, TmplAstBoundText, TmplAstContent, TmplAstDeferredBlock, TmplAstElement as TmplAstElement2, TmplAstForLoopBlock, TmplAstIcu, TmplAstIfBlock, TmplAstIfBlockBranch, TmplAstLetDeclaration as TmplAstLetDeclaration2, TmplAstReference as TmplAstReference2, TmplAstSwitchBlock, TmplAstTemplate, TmplAstText, TmplAstTextAttribute as TmplAstTextAttribute2, TmplAstVariable, TmplAstHostElement as TmplAstHostElement2, TransplantedType, TmplAstComponent as TmplAstComponent2, TmplAstDirective as TmplAstDirective2, Binary } from "@angular/compiler";
13996
+ import { BindingPipe, BindingType as BindingType3, Call as Call3, createCssSelectorFromNode, CssSelector as CssSelector3, DYNAMIC_TYPE, ImplicitReceiver as ImplicitReceiver3, ParsedEventType as ParsedEventType2, PropertyRead as PropertyRead4, R3Identifiers as R3Identifiers4, SafeCall as SafeCall2, SafePropertyRead as SafePropertyRead3, SelectorMatcher as SelectorMatcher2, ThisReceiver as ThisReceiver2, TmplAstBoundAttribute as TmplAstBoundAttribute3, TmplAstBoundText, TmplAstContent, TmplAstDeferredBlock, TmplAstElement as TmplAstElement2, TmplAstForLoopBlock, TmplAstIcu, TmplAstIfBlock, TmplAstIfBlockBranch, TmplAstLetDeclaration as TmplAstLetDeclaration2, TmplAstReference as TmplAstReference2, TmplAstSwitchBlock, TmplAstTemplate, TmplAstText, TmplAstTextAttribute as TmplAstTextAttribute2, TmplAstVariable, TmplAstHostElement as TmplAstHostElement2, TransplantedType, TmplAstComponent as TmplAstComponent2, TmplAstDirective as TmplAstDirective2, Binary } from "@angular/compiler";
13964
13997
  import ts62 from "typescript";
13965
13998
 
13966
13999
  // packages/compiler-cli/src/ngtsc/typecheck/src/diagnostics.js
@@ -14649,7 +14682,7 @@ var TcbTemplateBodyOp = class extends TcbOp {
14649
14682
  const dirId = this.tcb.env.reference(dir.ref);
14650
14683
  dir.ngTemplateGuards.forEach((guard) => {
14651
14684
  const boundInput = hostNode.inputs.find((i) => i.name === guard.inputName) || (isTemplate ? hostNode.templateAttrs.find((input) => {
14652
- return input instanceof TmplAstBoundAttribute2 && input.name === guard.inputName;
14685
+ return input instanceof TmplAstBoundAttribute3 && input.name === guard.inputName;
14653
14686
  }) : void 0);
14654
14687
  if (boundInput !== void 0) {
14655
14688
  const expr = tcbExpression(boundInput.value, this.tcb, this.scope);
@@ -14762,6 +14795,161 @@ var TcbGenericDirectiveTypeWithAnyParamsOp = class extends TcbDirectiveTypeOpBas
14762
14795
  return super.execute();
14763
14796
  }
14764
14797
  };
14798
+ var TcbFieldDirectiveTypeBaseOp = class extends TcbOp {
14799
+ tcb;
14800
+ scope;
14801
+ node;
14802
+ dir;
14803
+ /** Bindings that aren't supported on signal form fields. */
14804
+ unsupportedBindingFields = /* @__PURE__ */ new Set([
14805
+ ...formControlInputFields,
14806
+ "value",
14807
+ "checked",
14808
+ "type",
14809
+ "maxlength",
14810
+ "minlength"
14811
+ ]);
14812
+ constructor(tcb, scope, node, dir) {
14813
+ super();
14814
+ this.tcb = tcb;
14815
+ this.scope = scope;
14816
+ this.node = node;
14817
+ this.dir = dir;
14818
+ }
14819
+ get optional() {
14820
+ return true;
14821
+ }
14822
+ execute() {
14823
+ const inputs = this.node instanceof TmplAstHostElement2 ? this.node.bindings : this.node.inputs;
14824
+ for (const input of inputs) {
14825
+ if (input.type === BindingType3.Property && this.unsupportedBindingFields.has(input.name)) {
14826
+ this.tcb.oobRecorder.formFieldUnsupportedBinding(this.tcb.id, input);
14827
+ } else if (input.type === BindingType3.Attribute && this.unsupportedBindingFields.has(input.name.toLowerCase())) {
14828
+ this.tcb.oobRecorder.formFieldUnsupportedBinding(this.tcb.id, input);
14829
+ }
14830
+ }
14831
+ if (!(this.node instanceof TmplAstHostElement2)) {
14832
+ for (const attr of this.node.attributes) {
14833
+ const name = attr.name.toLowerCase();
14834
+ if (name !== "type" && this.unsupportedBindingFields.has(name)) {
14835
+ this.tcb.oobRecorder.formFieldUnsupportedBinding(this.tcb.id, attr);
14836
+ }
14837
+ }
14838
+ }
14839
+ const refType = this.tcb.env.referenceType(this.dir.ref);
14840
+ if (!ts62.isTypeReferenceNode(refType)) {
14841
+ throw new Error(`Expected TypeReferenceNode when referencing the type for ${this.dir.ref.debugName}`);
14842
+ }
14843
+ const span = this.node instanceof TmplAstHostElement2 ? this.node.sourceSpan : this.node.startSourceSpan || this.node.sourceSpan;
14844
+ const type = ts62.factory.createTypeReferenceNode(refType.typeName, [this.getExpectedType()]);
14845
+ const id = this.tcb.allocateId();
14846
+ addExpressionIdentifier(id, ExpressionIdentifier.DIRECTIVE);
14847
+ addParseSpanInfo(id, span);
14848
+ this.scope.addStatement(tsDeclareVariable(id, type));
14849
+ return id;
14850
+ }
14851
+ };
14852
+ var TcbNativeFieldDirectiveTypeOp = class extends TcbFieldDirectiveTypeBaseOp {
14853
+ inputType;
14854
+ constructor(tcb, scope, node, dir) {
14855
+ super(tcb, scope, node, dir);
14856
+ this.inputType = node instanceof TmplAstElement2 && node.name === "input" && node.attributes.find((attr) => attr.name === "type")?.value || null;
14857
+ if (this.inputType === "radio") {
14858
+ this.unsupportedBindingFields.delete("value");
14859
+ }
14860
+ }
14861
+ getExpectedType() {
14862
+ if (this.node instanceof TmplAstElement2) {
14863
+ return this.getExpectedTypeFromDomNode(this.node);
14864
+ }
14865
+ return this.getUnsupportedType();
14866
+ }
14867
+ getExpectedTypeFromDomNode(node) {
14868
+ if (node.name === "textarea" || node.name === "select") {
14869
+ return ts62.factory.createKeywordTypeNode(ts62.SyntaxKind.StringKeyword);
14870
+ }
14871
+ if (node.name !== "input") {
14872
+ return this.getUnsupportedType();
14873
+ }
14874
+ switch (this.inputType) {
14875
+ case "checkbox":
14876
+ return ts62.factory.createKeywordTypeNode(ts62.SyntaxKind.BooleanKeyword);
14877
+ case "number":
14878
+ case "range":
14879
+ case "datetime-local":
14880
+ return ts62.factory.createUnionTypeNode([
14881
+ ts62.factory.createKeywordTypeNode(ts62.SyntaxKind.StringKeyword),
14882
+ ts62.factory.createKeywordTypeNode(ts62.SyntaxKind.NumberKeyword)
14883
+ ]);
14884
+ case "date":
14885
+ case "month":
14886
+ case "time":
14887
+ case "week":
14888
+ return ts62.factory.createUnionTypeNode([
14889
+ ts62.factory.createKeywordTypeNode(ts62.SyntaxKind.StringKeyword),
14890
+ ts62.factory.createKeywordTypeNode(ts62.SyntaxKind.NumberKeyword),
14891
+ ts62.factory.createTypeReferenceNode("Date"),
14892
+ ts62.factory.createLiteralTypeNode(ts62.factory.createNull())
14893
+ ]);
14894
+ }
14895
+ return ts62.factory.createKeywordTypeNode(ts62.SyntaxKind.StringKeyword);
14896
+ }
14897
+ getUnsupportedType() {
14898
+ return ts62.factory.createKeywordTypeNode(ts62.SyntaxKind.UnknownKeyword);
14899
+ }
14900
+ };
14901
+ var TcbCustomFieldDirectiveTypeOp = class extends TcbFieldDirectiveTypeBaseOp {
14902
+ customFieldDir;
14903
+ constructor(tcb, scope, node, dir, customFieldDir) {
14904
+ super(tcb, scope, node, dir);
14905
+ this.customFieldDir = customFieldDir;
14906
+ }
14907
+ execute() {
14908
+ const refId = super.execute();
14909
+ this.appendFormFieldConformanceStatements();
14910
+ return refId;
14911
+ }
14912
+ getExpectedType() {
14913
+ const id = R3Identifiers4.ExtractFormControlValue;
14914
+ const extractRef = this.tcb.env.referenceExternalType(id.moduleName, id.name);
14915
+ if (!ts62.isTypeReferenceNode(extractRef)) {
14916
+ throw new Error(`Expected TypeReferenceNode when referencing the type for ${id.name}`);
14917
+ }
14918
+ return ts62.factory.createTypeReferenceNode(extractRef.typeName, [
14919
+ this.getCustomFieldTypeReference()
14920
+ ]);
14921
+ }
14922
+ getCustomFieldTypeReference() {
14923
+ const customFieldRef = this.tcb.env.referenceType(this.customFieldDir.meta.ref);
14924
+ if (!ts62.isTypeReferenceNode(customFieldRef)) {
14925
+ throw new Error(`Expected TypeReferenceNode when referencing the type for ${this.customFieldDir.meta.ref.debugName}`);
14926
+ }
14927
+ return customFieldRef;
14928
+ }
14929
+ appendFormFieldConformanceStatements() {
14930
+ let span;
14931
+ if (this.node instanceof TmplAstHostElement2) {
14932
+ span = this.node.sourceSpan;
14933
+ } else {
14934
+ span = this.node.inputs.find((input) => {
14935
+ return input.type === BindingType3.Property && input.name === "field";
14936
+ })?.sourceSpan ?? this.node.startSourceSpan;
14937
+ }
14938
+ const isCheckbox = this.customFieldDir.type === "checkbox";
14939
+ const symbolName = isCheckbox ? "FormCheckboxControl" : "FormValueControl";
14940
+ const targetTypeRef = this.tcb.env.referenceExternalType("@angular/forms/signals", symbolName);
14941
+ if (!ts62.isTypeReferenceNode(targetTypeRef)) {
14942
+ throw new Error(`Expected TypeReferenceNode when referencing the type for ${symbolName}`);
14943
+ }
14944
+ const id = this.tcb.allocateId();
14945
+ const targetType = ts62.factory.createTypeReferenceNode(targetTypeRef.typeName, isCheckbox ? void 0 : [ts62.factory.createKeywordTypeNode(ts62.SyntaxKind.AnyKeyword)]);
14946
+ this.scope.addStatement(tsDeclareVariable(id, targetType));
14947
+ const controlType = ts62.factory.createAsExpression(ts62.factory.createNonNullExpression(ts62.factory.createNull()), this.getCustomFieldTypeReference());
14948
+ const assignment = ts62.factory.createBinaryExpression(id, ts62.SyntaxKind.EqualsToken, controlType);
14949
+ addParseSpanInfo(assignment, span);
14950
+ this.scope.addStatement(ts62.factory.createIfStatement(id, ts62.factory.createExpressionStatement(assignment)));
14951
+ }
14952
+ };
14765
14953
  var TcbReferenceOp = class extends TcbOp {
14766
14954
  tcb;
14767
14955
  scope;
@@ -14877,12 +15065,14 @@ var TcbDirectiveInputsOp = class extends TcbOp {
14877
15065
  scope;
14878
15066
  node;
14879
15067
  dir;
14880
- constructor(tcb, scope, node, dir) {
15068
+ ignoredRequiredInputs;
15069
+ constructor(tcb, scope, node, dir, ignoredRequiredInputs) {
14881
15070
  super();
14882
15071
  this.tcb = tcb;
14883
15072
  this.scope = scope;
14884
15073
  this.node = node;
14885
15074
  this.dir = dir;
15075
+ this.ignoredRequiredInputs = ignoredRequiredInputs;
14886
15076
  }
14887
15077
  get optional() {
14888
15078
  return false;
@@ -14961,7 +15151,7 @@ var TcbDirectiveInputsOp = class extends TcbOp {
14961
15151
  checkRequiredInputs(seenRequiredInputs) {
14962
15152
  const missing = [];
14963
15153
  for (const input of this.dir.inputs) {
14964
- if (input.required && !seenRequiredInputs.has(input.classPropertyName)) {
15154
+ if (input.required && !seenRequiredInputs.has(input.classPropertyName) && (this.ignoredRequiredInputs === null || !this.ignoredRequiredInputs.has(input.bindingPropertyName))) {
14965
15155
  missing.push(input.bindingPropertyName);
14966
15156
  }
14967
15157
  }
@@ -15019,7 +15209,7 @@ var TcbDomSchemaCheckerOp = class extends TcbOp {
15019
15209
  this.tcb.domSchemaChecker.checkElement(this.tcb.id, this.getTagName(element), element.startSourceSpan, this.tcb.schemas, this.tcb.hostIsStandalone);
15020
15210
  }
15021
15211
  for (const binding of bindings) {
15022
- const isPropertyBinding = binding.type === BindingType2.Property || binding.type === BindingType2.TwoWay;
15212
+ const isPropertyBinding = binding.type === BindingType3.Property || binding.type === BindingType3.TwoWay;
15023
15213
  if (isPropertyBinding && this.claimedInputs?.has(binding.name)) {
15024
15214
  continue;
15025
15215
  }
@@ -15174,7 +15364,7 @@ var TcbUnclaimedInputsOp = class extends TcbOp {
15174
15364
  execute() {
15175
15365
  let elId = null;
15176
15366
  for (const binding of this.inputs) {
15177
- const isPropertyBinding = binding.type === BindingType2.Property || binding.type === BindingType2.TwoWay;
15367
+ const isPropertyBinding = binding.type === BindingType3.Property || binding.type === BindingType3.TwoWay;
15178
15368
  if (isPropertyBinding && this.claimedInputs?.has(binding.name)) {
15179
15369
  continue;
15180
15370
  }
@@ -15992,7 +16182,7 @@ var Scope = class _Scope {
15992
16182
  }
15993
16183
  const dirMap = /* @__PURE__ */ new Map();
15994
16184
  for (const dir of directives) {
15995
- this.appendDirectiveInputs(dir, node, dirMap);
16185
+ this.appendDirectiveInputs(dir, node, dirMap, directives);
15996
16186
  }
15997
16187
  this.directiveOpMap.set(node, dirMap);
15998
16188
  if (node instanceof TmplAstElement2) {
@@ -16033,7 +16223,7 @@ var Scope = class _Scope {
16033
16223
  if (directives !== null && directives.length > 0) {
16034
16224
  const dirMap = /* @__PURE__ */ new Map();
16035
16225
  for (const dir of directives) {
16036
- this.appendDirectiveInputs(dir, node, dirMap);
16226
+ this.appendDirectiveInputs(dir, node, dirMap, directives);
16037
16227
  for (const propertyName of dir.inputs.propertyNames) {
16038
16228
  claimedInputs.add(propertyName);
16039
16229
  }
@@ -16077,15 +16267,37 @@ var Scope = class _Scope {
16077
16267
  this.opQueue.push(new TcbUnclaimedOutputsOp(this.tcb, this, node, node.outputs, node.inputs, claimedOutputs));
16078
16268
  }
16079
16269
  }
16080
- appendDirectiveInputs(dir, node, dirMap) {
16081
- const directiveOp = this.getDirectiveOp(dir, node);
16270
+ appendDirectiveInputs(dir, node, dirMap, allDirectiveMatches) {
16271
+ const directiveOp = this.getDirectiveOp(dir, node, allDirectiveMatches);
16082
16272
  const dirIndex = this.opQueue.push(directiveOp) - 1;
16083
16273
  dirMap.set(dir, dirIndex);
16084
- this.opQueue.push(new TcbDirectiveInputsOp(this.tcb, this, node, dir));
16274
+ let ignoredRequiredInputs = null;
16275
+ if (allDirectiveMatches.some(isFieldDirective)) {
16276
+ const customFieldType = getCustomFieldDirectiveType(dir);
16277
+ if (customFieldType !== null) {
16278
+ ignoredRequiredInputs = new Set(formControlInputFields);
16279
+ if (customFieldType === "value") {
16280
+ ignoredRequiredInputs.add("value");
16281
+ } else if (customFieldType === "checkbox") {
16282
+ ignoredRequiredInputs.add("checked");
16283
+ }
16284
+ }
16285
+ }
16286
+ this.opQueue.push(new TcbDirectiveInputsOp(this.tcb, this, node, dir, ignoredRequiredInputs));
16085
16287
  }
16086
- getDirectiveOp(dir, node) {
16288
+ getDirectiveOp(dir, node, allDirectiveMatches) {
16087
16289
  const dirRef = dir.ref;
16088
- if (!dir.isGeneric) {
16290
+ if (isFieldDirective(dir)) {
16291
+ let customControl = null;
16292
+ for (const meta of allDirectiveMatches) {
16293
+ const type = getCustomFieldDirectiveType(meta);
16294
+ if (type !== null) {
16295
+ customControl = { type, meta };
16296
+ break;
16297
+ }
16298
+ }
16299
+ return customControl === null ? new TcbNativeFieldDirectiveTypeOp(this.tcb, this, node, dir) : new TcbCustomFieldDirectiveTypeOp(this.tcb, this, node, dir, customControl);
16300
+ } else if (!dir.isGeneric) {
16089
16301
  return new TcbNonGenericDirectiveTypeOp(this.tcb, this, node, dir);
16090
16302
  } else if (!requiresInlineTypeCtor(dirRef.node, this.tcb.env.reflector, this.tcb.env) || this.tcb.env.config.useInlineTypeConstructors) {
16091
16303
  return new TcbDirectiveCtorOp(this.tcb, this, node, dir);
@@ -16219,7 +16431,7 @@ var Scope = class _Scope {
16219
16431
  if (directives !== null && directives.length > 0) {
16220
16432
  const directiveOpMap = /* @__PURE__ */ new Map();
16221
16433
  for (const directive of directives) {
16222
- const directiveOp = this.getDirectiveOp(directive, node);
16434
+ const directiveOp = this.getDirectiveOp(directive, node, directives);
16223
16435
  directiveOpMap.set(directive, this.opQueue.push(directiveOp) - 1);
16224
16436
  }
16225
16437
  this.directiveOpMap.set(node, directiveOpMap);
@@ -16418,7 +16630,7 @@ function tcbCallTypeCtor(dir, tcb, inputs) {
16418
16630
  function getBoundAttributes(directive, node) {
16419
16631
  const boundInputs = [];
16420
16632
  const processAttribute = (attr) => {
16421
- if (attr instanceof TmplAstBoundAttribute2 && attr.type !== BindingType2.Property && attr.type !== BindingType2.TwoWay) {
16633
+ if (attr instanceof TmplAstBoundAttribute3 && attr.type !== BindingType3.Property && attr.type !== BindingType3.TwoWay) {
16422
16634
  return;
16423
16635
  }
16424
16636
  const inputs = directive.inputs.getByBindingPropertyName(attr.name);
@@ -16431,7 +16643,7 @@ function getBoundAttributes(directive, node) {
16431
16643
  required: input.required,
16432
16644
  transformType: input.transform?.type || null,
16433
16645
  isSignal: input.isSignal,
16434
- isTwoWayBinding: attr instanceof TmplAstBoundAttribute2 && attr.type === BindingType2.TwoWay
16646
+ isTwoWayBinding: attr instanceof TmplAstBoundAttribute3 && attr.type === BindingType3.TwoWay
16435
16647
  };
16436
16648
  })
16437
16649
  });
@@ -16450,7 +16662,7 @@ function getBoundAttributes(directive, node) {
16450
16662
  return boundInputs;
16451
16663
  }
16452
16664
  function translateInput(attr, tcb, scope) {
16453
- if (attr instanceof TmplAstBoundAttribute2) {
16665
+ if (attr instanceof TmplAstBoundAttribute3) {
16454
16666
  return tcbExpression(attr.value, tcb, scope);
16455
16667
  } else {
16456
16668
  return ts62.factory.createStringLiteral(attr.value);
@@ -16590,6 +16802,43 @@ var TcbForLoopTrackTranslator = class extends TcbExpressionTranslator {
16590
16802
  function getComponentTagName(node) {
16591
16803
  return node.tagName || "ng-component";
16592
16804
  }
16805
+ function isFieldDirective(meta) {
16806
+ if (meta.name !== "Field") {
16807
+ return false;
16808
+ }
16809
+ if (meta.ref.bestGuessOwningModule?.specifier === "@angular/forms/signals") {
16810
+ return true;
16811
+ }
16812
+ return ts62.isClassDeclaration(meta.ref.node) && meta.ref.node.members.some((member) => ts62.isPropertyDeclaration(member) && ts62.isComputedPropertyName(member.name) && ts62.isIdentifier(member.name.expression) && member.name.expression.text === "\u0275CONTROL");
16813
+ }
16814
+ function hasModel(name, meta) {
16815
+ return !!meta.inputs.getByBindingPropertyName(name)?.some((v) => v.isSignal) && meta.outputs.hasBindingPropertyName(name + "Change");
16816
+ }
16817
+ var formControlInputFields = [
16818
+ // Should be kept in sync with the `FormUiControl` bindings,
16819
+ // defined in `packages/forms/signals/src/api/control.ts`.
16820
+ "errors",
16821
+ "invalid",
16822
+ "disabled",
16823
+ "disabledReasons",
16824
+ "name",
16825
+ "readonly",
16826
+ "touched",
16827
+ "max",
16828
+ "maxLength",
16829
+ "min",
16830
+ "minLength",
16831
+ "pattern",
16832
+ "required"
16833
+ ];
16834
+ function getCustomFieldDirectiveType(meta) {
16835
+ if (hasModel("value", meta)) {
16836
+ return "value";
16837
+ } else if (hasModel("checked", meta)) {
16838
+ return "checkbox";
16839
+ }
16840
+ return null;
16841
+ }
16593
16842
 
16594
16843
  // packages/compiler-cli/src/ngtsc/typecheck/src/type_check_file.js
16595
16844
  import ts63 from "typescript";
@@ -16971,7 +17220,7 @@ var TypeCtorOp = class {
16971
17220
  };
16972
17221
 
16973
17222
  // packages/compiler-cli/src/ngtsc/typecheck/src/source.js
16974
- import { ParseLocation as ParseLocation2, ParseSourceSpan as ParseSourceSpan2 } from "@angular/compiler";
17223
+ import { ParseLocation as ParseLocation2, ParseSourceSpan as ParseSourceSpan3 } from "@angular/compiler";
16975
17224
 
16976
17225
  // packages/compiler-cli/src/ngtsc/typecheck/src/line_mappings.js
16977
17226
  var LF_CHAR = 10;
@@ -17026,7 +17275,7 @@ var Source = class {
17026
17275
  toParseSourceSpan(start, end) {
17027
17276
  const startLoc = this.toParseLocation(start);
17028
17277
  const endLoc = this.toParseLocation(end);
17029
- return new ParseSourceSpan2(startLoc, endLoc);
17278
+ return new ParseSourceSpan3(startLoc, endLoc);
17030
17279
  }
17031
17280
  toParseLocation(position) {
17032
17281
  const lineStarts = this.acquireLineStarts();
@@ -17087,7 +17336,7 @@ var DirectiveSourceManager = class {
17087
17336
  };
17088
17337
 
17089
17338
  // packages/compiler-cli/src/ngtsc/typecheck/src/template_symbol_builder.js
17090
- import { AST, ASTWithName as ASTWithName2, ASTWithSource as ASTWithSource2, Binary as Binary2, BindingPipe as BindingPipe2, PropertyRead as PropertyRead5, R3Identifiers as R3Identifiers5, SafePropertyRead as SafePropertyRead4, TmplAstBoundAttribute as TmplAstBoundAttribute3, TmplAstBoundEvent as TmplAstBoundEvent3, TmplAstComponent as TmplAstComponent3, TmplAstDirective as TmplAstDirective3, TmplAstElement as TmplAstElement3, TmplAstLetDeclaration as TmplAstLetDeclaration3, TmplAstReference as TmplAstReference3, TmplAstTemplate as TmplAstTemplate2, TmplAstTextAttribute as TmplAstTextAttribute3, TmplAstVariable as TmplAstVariable2 } from "@angular/compiler";
17339
+ import { AST, ASTWithName as ASTWithName2, ASTWithSource as ASTWithSource2, Binary as Binary2, BindingPipe as BindingPipe2, PropertyRead as PropertyRead5, R3Identifiers as R3Identifiers5, SafePropertyRead as SafePropertyRead4, TmplAstBoundAttribute as TmplAstBoundAttribute4, TmplAstBoundEvent as TmplAstBoundEvent3, TmplAstComponent as TmplAstComponent3, TmplAstDirective as TmplAstDirective3, TmplAstElement as TmplAstElement3, TmplAstLetDeclaration as TmplAstLetDeclaration3, TmplAstReference as TmplAstReference3, TmplAstTemplate as TmplAstTemplate2, TmplAstTextAttribute as TmplAstTextAttribute3, TmplAstVariable as TmplAstVariable2 } from "@angular/compiler";
17091
17340
  import ts65 from "typescript";
17092
17341
  var SymbolBuilder = class {
17093
17342
  tcbPath;
@@ -17110,7 +17359,7 @@ var SymbolBuilder = class {
17110
17359
  return this.symbolCache.get(node);
17111
17360
  }
17112
17361
  let symbol = null;
17113
- if (node instanceof TmplAstBoundAttribute3 || node instanceof TmplAstTextAttribute3) {
17362
+ if (node instanceof TmplAstBoundAttribute4 || node instanceof TmplAstTextAttribute3) {
17114
17363
  symbol = this.getSymbolOfInputBinding(node);
17115
17364
  } else if (node instanceof TmplAstBoundEvent3) {
17116
17365
  symbol = this.getSymbolOfBoundEvent(node);
@@ -20888,7 +21137,7 @@ var ComponentDecoratorHandler = class {
20888
21137
  diagnostics.push(makeResourceNotFoundError(styleUrl.url, styleUrl.expression, resourceType).toDiagnostic());
20889
21138
  }
20890
21139
  }
20891
- if ((encapsulation === ViewEncapsulation2.ShadowDom || encapsulation === ViewEncapsulation2.IsolatedShadowDom) && metadata.selector !== null) {
21140
+ if ((encapsulation === ViewEncapsulation2.ShadowDom || encapsulation === ViewEncapsulation2.ExperimentalIsolatedShadowDom) && metadata.selector !== null) {
20892
21141
  const selectorError = checkCustomElementSelectorForErrors(metadata.selector);
20893
21142
  if (selectorError !== null) {
20894
21143
  if (diagnostics === void 0) {
@@ -12,7 +12,7 @@ import {
12
12
  formatDiagnostics,
13
13
  performCompilation,
14
14
  readConfiguration
15
- } from "./chunk-ZOLVJRLX.js";
15
+ } from "./chunk-UI6E44E7.js";
16
16
 
17
17
  // packages/compiler-cli/src/main.js
18
18
  import ts2 from "typescript";
@@ -455,7 +455,7 @@ import { compileDirectiveFromMetadata, makeBindingParser, ParseLocation, ParseSo
455
455
  // packages/compiler-cli/linker/src/file_linker/partial_linkers/util.js
456
456
  import { createMayBeForwardRefExpression, outputAst as o2 } from "@angular/compiler";
457
457
  import semver from "semver";
458
- var PLACEHOLDER_VERSION = "21.0.0-rc.0";
458
+ var PLACEHOLDER_VERSION = "21.0.0-rc.2";
459
459
  function wrapReference(wrapped) {
460
460
  return { value: wrapped, type: wrapped };
461
461
  }
@@ -546,7 +546,6 @@ function toR3DirectiveMeta(metaObj, code, sourceUrl, version) {
546
546
  queries: metaObj.has("queries") ? metaObj.getArray("queries").map((entry) => toQueryMetadata(entry.getObject())) : [],
547
547
  viewQueries: metaObj.has("viewQueries") ? metaObj.getArray("viewQueries").map((entry) => toQueryMetadata(entry.getObject())) : [],
548
548
  providers: metaObj.has("providers") ? metaObj.getOpaque("providers") : null,
549
- fullInheritance: false,
550
549
  selector: metaObj.has("selector") ? metaObj.getString("selector") : null,
551
550
  exportAs: metaObj.has("exportAs") ? metaObj.getArray("exportAs").map((entry) => entry.getString()) : null,
552
551
  lifecycle: {
package/bundles/index.js CHANGED
@@ -17,7 +17,7 @@ import {
17
17
  isTsDiagnostic,
18
18
  performCompilation,
19
19
  readConfiguration
20
- } from "./chunk-ZOLVJRLX.js";
20
+ } from "./chunk-UI6E44E7.js";
21
21
  import {
22
22
  ConsoleLogger,
23
23
  LogLevel
@@ -34,7 +34,7 @@ import {
34
34
  freshCompilationTicket,
35
35
  incrementalFromStateTicket,
36
36
  isDocEntryWithSourceInfo
37
- } from "./chunk-ZOZ6XVF3.js";
37
+ } from "./chunk-JCBKDAHA.js";
38
38
  import {
39
39
  ActivePerfRecorder,
40
40
  ErrorCode,
@@ -46,7 +46,7 @@ import {
46
46
  getInitializerApiJitTransform,
47
47
  isLocalCompilationDiagnostics,
48
48
  ngErrorCode
49
- } from "./chunk-3CWKYDQ7.js";
49
+ } from "./chunk-Y65S2AOA.js";
50
50
  import "./chunk-LS5RJ5CS.js";
51
51
  import {
52
52
  InvalidFileSystem,
@@ -77,7 +77,7 @@ import "./chunk-G7GFT6BU.js";
77
77
 
78
78
  // packages/compiler-cli/src/version.js
79
79
  import { Version } from "@angular/compiler";
80
- var VERSION = new Version("21.0.0-rc.0");
80
+ var VERSION = new Version("21.0.0-rc.2");
81
81
 
82
82
  // packages/compiler-cli/private/tooling.js
83
83
  var GLOBAL_DEFS_FOR_TERSER = {
@@ -8,7 +8,7 @@ import {
8
8
  LinkerEnvironment,
9
9
  assert,
10
10
  isFatalLinkerError
11
- } from "../../chunk-DT6FD4OE.js";
11
+ } from "../../chunk-ZJZNLTWN.js";
12
12
  import {
13
13
  ConsoleLogger,
14
14
  LogLevel
@@ -10,7 +10,7 @@ import {
10
10
  assert,
11
11
  isFatalLinkerError,
12
12
  needsLinking
13
- } from "../chunk-DT6FD4OE.js";
13
+ } from "../chunk-ZJZNLTWN.js";
14
14
  import "../chunk-HYJ2H3FU.js";
15
15
  import "../chunk-LS5RJ5CS.js";
16
16
  import "../chunk-G7GFT6BU.js";
@@ -5,7 +5,7 @@
5
5
  import {
6
6
  DiagnosticCategoryLabel,
7
7
  NgCompiler
8
- } from "../chunk-ZOZ6XVF3.js";
8
+ } from "../chunk-JCBKDAHA.js";
9
9
  import {
10
10
  CompilationMode,
11
11
  DtsMetadataReader,
@@ -32,7 +32,7 @@ import {
32
32
  queryDecoratorNames,
33
33
  reflectObjectLiteral,
34
34
  unwrapExpression
35
- } from "../chunk-3CWKYDQ7.js";
35
+ } from "../chunk-Y65S2AOA.js";
36
36
  import "../chunk-LS5RJ5CS.js";
37
37
  import {
38
38
  getFileSystem,
@@ -6,7 +6,7 @@ import {
6
6
  ImportedSymbolsTracker,
7
7
  TypeScriptReflectionHost,
8
8
  getInitializerApiJitTransform
9
- } from "../chunk-3CWKYDQ7.js";
9
+ } from "../chunk-Y65S2AOA.js";
10
10
  import "../chunk-LS5RJ5CS.js";
11
11
  import {
12
12
  InvalidFileSystem,
@@ -4,7 +4,7 @@
4
4
 
5
5
  import {
6
6
  angularJitApplicationTransform
7
- } from "../chunk-3CWKYDQ7.js";
7
+ } from "../chunk-Y65S2AOA.js";
8
8
  import "../chunk-LS5RJ5CS.js";
9
9
  import "../chunk-GWZQLAGK.js";
10
10
  import "../chunk-XYYEESKY.js";
@@ -6,12 +6,12 @@
6
6
  import {
7
7
  main,
8
8
  readCommandLineAndConfiguration
9
- } from "../../chunk-HSIRUBJU.js";
9
+ } from "../../chunk-Z6XYTYZD.js";
10
10
  import {
11
11
  EmitFlags
12
- } from "../../chunk-ZOLVJRLX.js";
13
- import "../../chunk-ZOZ6XVF3.js";
14
- import "../../chunk-3CWKYDQ7.js";
12
+ } from "../../chunk-UI6E44E7.js";
13
+ import "../../chunk-JCBKDAHA.js";
14
+ import "../../chunk-Y65S2AOA.js";
15
15
  import "../../chunk-LS5RJ5CS.js";
16
16
  import {
17
17
  setFileSystem
@@ -5,10 +5,10 @@
5
5
 
6
6
  import {
7
7
  main
8
- } from "../../chunk-HSIRUBJU.js";
9
- import "../../chunk-ZOLVJRLX.js";
10
- import "../../chunk-ZOZ6XVF3.js";
11
- import "../../chunk-3CWKYDQ7.js";
8
+ } from "../../chunk-Z6XYTYZD.js";
9
+ import "../../chunk-UI6E44E7.js";
10
+ import "../../chunk-JCBKDAHA.js";
11
+ import "../../chunk-Y65S2AOA.js";
12
12
  import "../../chunk-LS5RJ5CS.js";
13
13
  import {
14
14
  setFileSystem
@@ -7,7 +7,7 @@
7
7
  */
8
8
  import { MaybeForwardRefExpression, outputAst as o, R3DeclareDependencyMetadata, R3DependencyMetadata, R3Reference } from '@angular/compiler';
9
9
  import { AstObject, AstValue } from '../../ast/ast_value';
10
- export declare const PLACEHOLDER_VERSION = "21.0.0-rc.0";
10
+ export declare const PLACEHOLDER_VERSION = "21.0.0-rc.2";
11
11
  export declare function wrapReference<TExpression>(wrapped: o.WrappedNodeExpr<TExpression>): R3Reference;
12
12
  /**
13
13
  * Parses the value of an enum from the AST value's symbol name.