@angular/forms 21.1.3 → 21.2.0-next.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.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v21.1.3
2
+ * @license Angular v21.2.0-next.1
3
3
  * (c) 2010-2026 Google LLC. https://angular.dev/
4
4
  * License: MIT
5
5
  */
@@ -206,6 +206,9 @@ class CompatValidationState {
206
206
  pending;
207
207
  invalid;
208
208
  valid;
209
+ parseErrors = computed(() => [], ...(ngDevMode ? [{
210
+ debugName: "parseErrors"
211
+ }] : []));
209
212
  constructor(options) {
210
213
  this.syncValid = getControlStatusSignal(options, c => c.status === 'VALID');
211
214
  this.errors = getControlStatusSignal(options, extractNestedReactiveErrors);
@@ -1 +1 @@
1
- {"version":3,"file":"signals-compat.mjs","sources":["../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/packages/forms/signals/compat/src/compat_field_node.ts","../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/packages/forms/signals/compat/src/compat_node_state.ts","../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/packages/forms/signals/compat/src/compat_structure.ts","../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/packages/forms/signals/compat/src/api/compat_validation_error.ts","../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/packages/forms/signals/compat/src/compat_validation_error.ts","../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/packages/forms/signals/compat/src/compat_validation_state.ts","../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/packages/forms/signals/compat/src/compat_field_adapter.ts","../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/packages/forms/signals/compat/src/api/compat_form.ts","../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/packages/forms/signals/compat/src/api/di.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {computed, linkedSignal, runInInjectionContext, Signal, untracked} from '@angular/core';\nimport {toSignal} from '@angular/core/rxjs-interop';\nimport {AbstractControl} from '@angular/forms';\nimport {Observable, ReplaySubject} from 'rxjs';\nimport {map, takeUntil} from 'rxjs/operators';\nimport {FieldNode} from '../../src/field/node';\nimport {getInjectorFromOptions} from '../../src/field/util';\nimport type {CompatFieldNodeOptions} from './compat_structure';\n\n/**\n * Field node with additional control property.\n *\n * Compat node has no children.\n */\nexport class CompatFieldNode extends FieldNode {\n readonly control: Signal<AbstractControl>;\n\n constructor(public readonly options: CompatFieldNodeOptions) {\n super(options);\n this.control = this.options.control;\n }\n}\n\n/**\n * Makes a function which creates a new subject (and unsubscribes/destroys the previous one).\n *\n * This allows us to automatically unsubscribe from status changes of the previous FormControl when we go to subscribe to a new one\n */\nfunction makeCreateDestroySubject() {\n let destroy$ = new ReplaySubject<void>(1);\n return () => {\n if (destroy$) {\n destroy$.next();\n destroy$.complete();\n }\n return (destroy$ = new ReplaySubject<void>(1));\n };\n}\n\n/**\n * Helper function taking options, and a callback which takes options, and a function\n * converting reactive control to appropriate property using toSignal from rxjs compat.\n *\n * This helper keeps all complexity in one place by doing the following things:\n * - Running the callback in injection context\n * - Not tracking the callback, as it creates a new signal.\n * - Reacting to control changes, allowing to swap control dynamically.\n *\n * @param options\n * @param makeSignal\n */\nexport function extractControlPropToSignal<T, R = T>(\n options: CompatFieldNodeOptions,\n makeSignal: (c: AbstractControl<unknown, T>, destroy$: Observable<void>) => Signal<R>,\n): Signal<R> {\n const injector = getInjectorFromOptions(options);\n\n // Creates a subject that could be used in takeUntil.\n const createDestroySubject = makeCreateDestroySubject();\n\n const signalOfControlSignal = linkedSignal({\n source: options.control,\n computation: (control) => {\n return untracked(() => {\n return runInInjectionContext(injector, () => makeSignal(control, createDestroySubject()));\n });\n },\n });\n\n // We have to have computed, because we need to react to both:\n // linked signal changes as well as the inner signal changes.\n return computed(() => signalOfControlSignal()());\n}\n\n/**\n * A helper function, simplifying getting reactive control properties after status changes.\n *\n * Used to extract errors and statuses such as valid, pending.\n *\n * @param options\n * @param getValue\n */\nexport const getControlStatusSignal = <T>(\n options: CompatFieldNodeOptions,\n getValue: (c: AbstractControl<unknown>) => T,\n) => {\n return extractControlPropToSignal<unknown, T>(options, (c, destroy$) =>\n toSignal(\n c.statusChanges.pipe(\n map(() => getValue(c)),\n takeUntil(destroy$),\n ),\n {\n initialValue: getValue(c),\n },\n ),\n );\n};\n\n/**\n * A helper function, simplifying converting convert events to signals.\n *\n * Used to get dirty and touched signals from control.\n *\n * @param options\n * @param getValue A function which takes control and returns required value.\n */\nexport const getControlEventsSignal = <T>(\n options: CompatFieldNodeOptions,\n getValue: (c: AbstractControl) => T,\n) => {\n return extractControlPropToSignal<unknown, T>(options, (c, destroy$) =>\n toSignal(\n c.events.pipe(\n map(() => {\n return getValue(c);\n }),\n takeUntil(destroy$),\n ),\n {\n initialValue: getValue(c),\n },\n ),\n );\n};\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {computed, Signal} from '@angular/core';\nimport {AbstractControl} from '@angular/forms';\nimport {FieldNodeState} from '../../src/field/state';\nimport {CompatFieldNode, getControlEventsSignal, getControlStatusSignal} from './compat_field_node';\nimport {CompatFieldNodeOptions} from './compat_structure';\n\n/**\n * A FieldNodeState class wrapping a FormControl and proxying it's state.\n */\nexport class CompatNodeState extends FieldNodeState {\n override readonly touched: Signal<boolean>;\n override readonly dirty: Signal<boolean>;\n override readonly disabled: Signal<boolean>;\n private readonly control: Signal<AbstractControl>;\n\n constructor(\n readonly compatNode: CompatFieldNode,\n options: CompatFieldNodeOptions,\n ) {\n super(compatNode);\n this.control = options.control;\n this.touched = getControlEventsSignal(options, (c) => c.touched);\n this.dirty = getControlEventsSignal(options, (c) => c.dirty);\n const controlDisabled = getControlStatusSignal(options, (c) => c.disabled);\n\n this.disabled = computed(() => {\n return controlDisabled() || this.disabledReasons().length > 0;\n });\n }\n\n override markAsDirty() {\n this.control().markAsDirty();\n }\n\n override markAsTouched() {\n this.control().markAsTouched();\n }\n\n override markAsPristine() {\n this.control().markAsPristine();\n }\n\n override markAsUntouched() {\n this.control().markAsUntouched();\n }\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {\n computed,\n Signal,\n signal,\n WritableSignal,\n ɵRuntimeError as RuntimeError,\n} from '@angular/core';\nimport {SignalFormsErrorCode} from '../../src/errors';\nimport {FormFieldManager} from '../../src/field/manager';\nimport {FieldNode, ParentFieldNode} from '../../src/field/node';\nimport {\n ChildFieldNodeOptions,\n FieldNodeOptions,\n FieldNodeStructure,\n RootFieldNodeOptions,\n} from '../../src/field/structure';\n\nimport {toSignal} from '@angular/core/rxjs-interop';\nimport {AbstractControl} from '@angular/forms';\nimport {map, takeUntil} from 'rxjs/operators';\nimport {extractControlPropToSignal} from './compat_field_node';\n\n/**\n * Child Field Node options also exposing control property.\n */\nexport interface CompatChildFieldNodeOptions extends ChildFieldNodeOptions {\n control: Signal<AbstractControl>;\n}\n\n/**\n * Root Field Node options also exposing control property.\n */\nexport interface CompatRootFieldNodeOptions extends RootFieldNodeOptions {\n control: Signal<AbstractControl>;\n}\n\n/**\n * Field Node options also exposing control property.\n */\nexport type CompatFieldNodeOptions = CompatRootFieldNodeOptions | CompatChildFieldNodeOptions;\n\n/**\n * A helper function allowing to get parent if it exists.\n */\nfunction getParentFromOptions(options: FieldNodeOptions) {\n if (options.kind === 'root') {\n return undefined;\n }\n\n return options.parent;\n}\n\n/**\n * A helper function allowing to get fieldManager regardless of the option type.\n */\nfunction getFieldManagerFromOptions(options: FieldNodeOptions) {\n if (options.kind === 'root') {\n return options.fieldManager;\n }\n\n return options.parent.structure.root.structure.fieldManager;\n}\n\n/**\n * A helper function that takes CompatFieldNodeOptions, and produce a writable signal synced to the\n * value of contained AbstractControl.\n *\n * This uses toSignal, which requires an injector.\n *\n * @param options\n */\nfunction getControlValueSignal<T>(options: CompatFieldNodeOptions) {\n const value = extractControlPropToSignal<T>(options, (control, destroy$) => {\n return toSignal(\n control.valueChanges.pipe(\n map(() => control.getRawValue()),\n takeUntil(destroy$),\n ),\n {\n initialValue: control.getRawValue(),\n },\n );\n }) as WritableSignal<T>;\n\n value.set = (value: T) => {\n options.control().setValue(value);\n };\n\n value.update = (fn: (current: T) => T) => {\n value.set(fn(value()));\n };\n\n return value;\n}\n\n/**\n * Compat version of FieldNodeStructure,\n * - It has no children\n * - It wraps FormControl and proxies its value.\n */\nexport class CompatStructure extends FieldNodeStructure {\n override value: WritableSignal<unknown>;\n override keyInParent: Signal<string>;\n override root: FieldNode;\n override pathKeys: Signal<readonly string[]>;\n override readonly children = signal([]);\n override readonly childrenMap = computed(() => undefined);\n override readonly parent: ParentFieldNode | undefined;\n override readonly fieldManager: FormFieldManager;\n\n constructor(node: FieldNode, options: CompatFieldNodeOptions) {\n super(options.logic, node, () => {\n throw new RuntimeError(\n SignalFormsErrorCode.COMPAT_NO_CHILDREN,\n ngDevMode && `Compat nodes don't have children.`,\n );\n });\n this.value = getControlValueSignal(options);\n this.parent = getParentFromOptions(options);\n this.root = this.parent?.structure.root ?? node;\n this.fieldManager = getFieldManagerFromOptions(options);\n\n const identityInParent = options.kind === 'child' ? options.identityInParent : undefined;\n const initialKeyInParent = options.kind === 'child' ? options.initialKeyInParent : undefined;\n this.keyInParent = this.createKeyInParent(options, identityInParent, initialKeyInParent);\n\n this.pathKeys = computed(() =>\n this.parent ? [...this.parent.structure.pathKeys(), this.keyInParent()] : [],\n );\n }\n\n override getChild(): FieldNode | undefined {\n return undefined;\n }\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {AbstractControl} from '@angular/forms';\nimport {ValidationError} from '../../../src/api/rules/validation/validation_errors';\nimport {FieldTree} from '../../../src/api/types';\n\n/**\n * An error used for compat errors.\n *\n * @experimental 21.0.0\n * @category interop\n */\nexport class CompatValidationError<T = unknown> implements ValidationError {\n readonly kind: string = 'compat';\n readonly control: AbstractControl;\n readonly fieldTree!: FieldTree<unknown>;\n readonly context: T;\n readonly message?: string;\n\n constructor({context, kind, control}: {context: T; kind: string; control: AbstractControl}) {\n this.context = context;\n this.kind = kind;\n this.control = control;\n }\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {AbstractControl, FormArray, FormGroup, ValidationErrors} from '@angular/forms';\nimport {CompatValidationError} from './api/compat_validation_error';\n\n/**\n * Converts reactive form validation error to signal forms CompatValidationError.\n * @param errors\n * @param control\n * @return list of errors.\n */\nexport function reactiveErrorsToSignalErrors(\n errors: ValidationErrors | null,\n control: AbstractControl,\n): CompatValidationError[] {\n if (errors === null) {\n return [];\n }\n\n return Object.entries(errors).map(([kind, context]) => {\n return new CompatValidationError({context, kind, control});\n });\n}\n\nexport function extractNestedReactiveErrors(control: AbstractControl): CompatValidationError[] {\n const errors: CompatValidationError[] = [];\n\n if (control.errors) {\n errors.push(...reactiveErrorsToSignalErrors(control.errors, control));\n }\n\n if (control instanceof FormGroup || control instanceof FormArray) {\n for (const c of Object.values(control.controls)) {\n errors.push(...extractNestedReactiveErrors(c));\n }\n }\n\n return errors;\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {computed, Signal} from '@angular/core';\nimport {AbstractControl} from '@angular/forms';\nimport {ValidationError} from '../../src/api/rules/validation/validation_errors';\nimport {calculateValidationSelfStatus, ValidationState} from '../../src/field/validation';\nimport type {CompatValidationError} from './api/compat_validation_error';\nimport {getControlStatusSignal} from './compat_field_node';\nimport {CompatFieldNodeOptions} from './compat_structure';\nimport {extractNestedReactiveErrors} from './compat_validation_error';\n\n// Readonly signal containing an empty array, used for optimization.\nconst EMPTY_ARRAY_SIGNAL = computed(() => []);\nconst TRUE_SIGNAL = computed(() => true);\n\n/**\n * Compat version of a validation state that wraps a FormControl, and proxies it's validation state.\n */\nexport class CompatValidationState implements ValidationState {\n readonly syncValid: Signal<boolean>;\n /**\n * All validation errors for this field.\n */\n readonly errors: Signal<CompatValidationError[]>;\n readonly pending: Signal<boolean>;\n readonly invalid: Signal<boolean>;\n readonly valid: Signal<boolean>;\n\n constructor(options: CompatFieldNodeOptions) {\n this.syncValid = getControlStatusSignal(options, (c: AbstractControl) => c.status === 'VALID');\n this.errors = getControlStatusSignal(options, extractNestedReactiveErrors);\n this.pending = getControlStatusSignal(options, (c) => c.pending);\n\n this.valid = getControlStatusSignal(options, (c) => {\n return c.valid;\n });\n\n this.invalid = getControlStatusSignal(options, (c) => {\n return c.invalid;\n });\n }\n\n asyncErrors: Signal<(ValidationError.WithField | 'pending')[]> = EMPTY_ARRAY_SIGNAL;\n errorSummary: Signal<ValidationError.WithField[]> = EMPTY_ARRAY_SIGNAL;\n\n // Those are irrelevant for compat mode, as it has no children\n rawSyncTreeErrors = EMPTY_ARRAY_SIGNAL;\n syncErrors = EMPTY_ARRAY_SIGNAL;\n rawAsyncErrors = EMPTY_ARRAY_SIGNAL;\n shouldSkipValidation = TRUE_SIGNAL;\n\n /**\n * Computes status based on whether the field is valid/invalid/pending.\n */\n readonly status: Signal<'valid' | 'invalid' | 'unknown'> = computed(() => {\n return calculateValidationSelfStatus(this);\n });\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {computed, Signal, WritableSignal} from '@angular/core';\nimport {AbstractControl} from '@angular/forms';\nimport {BasicFieldAdapter, FieldAdapter} from '../../src/field/field_adapter';\nimport {FormFieldManager} from '../../src/field/manager';\nimport {FieldNode} from '../../src/field/node';\nimport {FieldNodeState} from '../../src/field/state';\nimport {\n ChildFieldNodeOptions,\n FieldNodeOptions,\n FieldNodeStructure,\n} from '../../src/field/structure';\nimport {ValidationState} from '../../src/field/validation';\nimport {FieldPathNode} from '../../src/schema/path_node';\nimport {CompatFieldNode} from './compat_field_node';\nimport {CompatNodeState} from './compat_node_state';\nimport {CompatChildFieldNodeOptions, CompatStructure} from './compat_structure';\nimport {CompatValidationState} from './compat_validation_state';\n\n/**\n * This is a tree-shakable Field adapter that can create a compat node\n * that proxies FormControl state and value to a field.\n */\nexport class CompatFieldAdapter implements FieldAdapter {\n readonly basicAdapter = new BasicFieldAdapter();\n\n /**\n * Creates a regular or compat root node state based on whether the control is present.\n * @param fieldManager\n * @param value\n * @param pathNode\n * @param adapter\n */\n newRoot<TModel>(\n fieldManager: FormFieldManager,\n value: WritableSignal<TModel>,\n pathNode: FieldPathNode,\n adapter: FieldAdapter,\n ): FieldNode {\n if (value() instanceof AbstractControl) {\n return createCompatNode({\n kind: 'root',\n fieldManager,\n value,\n pathNode,\n logic: pathNode.builder.build(),\n fieldAdapter: adapter,\n });\n }\n\n return this.basicAdapter.newRoot<TModel>(fieldManager, value, pathNode, adapter);\n }\n\n /**\n * Creates a regular or compat node state based on whether the control is present.\n * @param node\n * @param options\n */\n createNodeState(node: CompatFieldNode, options: CompatChildFieldNodeOptions): FieldNodeState {\n if (!options.control) {\n return this.basicAdapter.createNodeState(node);\n }\n return new CompatNodeState(node, options);\n }\n\n /**\n * Creates a regular or compat structure based on whether the control is present.\n * @param node\n * @param options\n */\n createStructure(node: CompatFieldNode, options: CompatChildFieldNodeOptions): FieldNodeStructure {\n if (!options.control) {\n return this.basicAdapter.createStructure(node, options);\n }\n return new CompatStructure(node, options);\n }\n\n /**\n * Creates a regular or compat validation state based on whether the control is present.\n * @param node\n * @param options\n */\n createValidationState(\n node: CompatFieldNode,\n options: CompatChildFieldNodeOptions,\n ): ValidationState {\n if (!options.control) {\n return this.basicAdapter.createValidationState(node);\n }\n return new CompatValidationState(options);\n }\n\n /**\n * Creates a regular or compat node based on whether the control is present.\n * @param options\n */\n newChild(options: ChildFieldNodeOptions): FieldNode {\n const value = options.parent.value()[options.initialKeyInParent];\n\n if (value instanceof AbstractControl) {\n return createCompatNode(options);\n }\n\n return new FieldNode(options);\n }\n}\n\n/**\n * Creates a CompatFieldNode from options.\n * @param options\n */\nexport function createCompatNode(options: FieldNodeOptions) {\n const control = (\n options.kind === 'root'\n ? options.value\n : computed(() => {\n return options.parent.value()[options.initialKeyInParent];\n })\n ) as Signal<AbstractControl>;\n\n return new CompatFieldNode({\n ...options,\n control,\n });\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {WritableSignal} from '@angular/core';\nimport {form, FormOptions} from '../../../public_api';\nimport {FieldTree, PathKind, SchemaOrSchemaFn} from '../../../src/api/types';\nimport {normalizeFormArgs} from '../../../src/util/normalize_form_args';\nimport {CompatFieldAdapter} from '../compat_field_adapter';\n\n/**\n * Options that may be specified when creating a compat form.\n *\n * @category interop\n * @experimental 21.0.0\n */\nexport type CompatFormOptions = Omit<FormOptions, 'adapter'>;\n\n/**\n * Creates a compatibility form wrapped around the given model data.\n *\n * `compatForm` is a version of the `form` function that is designed for backwards\n * compatibility with Reactive forms by accepting Reactive controls as a part of the data.\n *\n * @example\n * ```ts\n * const lastName = new FormControl('lastName');\n *\n * const nameModel = signal({\n * first: '',\n * last: lastName\n * });\n *\n * const nameForm = compatForm(nameModel, (name) => {\n * required(name.first);\n * });\n *\n * nameForm.last().value(); // lastName, not FormControl\n * ```\n * \n * @param model A writable signal that contains the model data for the form. The resulting field\n * structure will match the shape of the model and any changes to the form data will be written to\n * the model.\n\n * @category interop\n * @experimental 21.0.0\n */\nexport function compatForm<TModel>(model: WritableSignal<TModel>): FieldTree<TModel>;\n\n/**\n * Creates a compatibility form wrapped around the given model data.\n *\n * `compatForm` is a version of the `form` function that is designed for backwards\n * compatibility with Reactive forms by accepting Reactive controls as a part of the data.\n *\n * @example\n * ```ts\n * const lastName = new FormControl('lastName');\n *\n * const nameModel = signal({\n * first: '',\n * last: lastName\n * });\n *\n * const nameForm = compatForm(nameModel, (name) => {\n * required(name.first);\n * });\n *\n * nameForm.last().value(); // lastName, not FormControl\n *\n * @param model A writable signal that contains the model data for the form. The resulting field\n * structure will match the shape of the model and any changes to the form data will be written to\n * the model.\n * @param schemaOrOptions The second argument can be either\n * 1. A schema or a function used to specify logic for the form (e.g. validation, disabled fields, etc.).\n * When passing a schema, the form options can be passed as a third argument if needed.\n * 2. The form options (excluding adapter, since it's provided).\n *\n * @category interop\n * @experimental 21.0.0\n */\nexport function compatForm<TModel>(\n model: WritableSignal<TModel>,\n schemaOrOptions: SchemaOrSchemaFn<TModel> | CompatFormOptions,\n): FieldTree<TModel>;\n\n/**\n * Creates a compatibility form wrapped around the given model data.\n *\n * `compatForm` is a version of the `form` function that is designed for backwards\n * compatibility with Reactive forms by accepting Reactive controls as a part of the data.\n *\n * @example\n * ```ts\n * const lastName = new FormControl('lastName');\n *\n * const nameModel = signal({\n * first: '',\n * last: lastName\n * });\n *\n * const nameForm = compatForm(nameModel, (name) => {\n * required(name.first);\n * });\n *\n * nameForm.last().value(); // lastName, not FormControl\n *\n * @param model A writable signal that contains the model data for the form. The resulting field\n * structure will match the shape of the model and any changes to the form data will be written to\n * the model.\n * @param schemaOrOptions A schema or a function used to specify logic for the form (e.g. validation, disabled fields, etc.).\n * When passing a schema, the form options can be passed as a third argument if needed.\n * @param options The form options (excluding adapter, since it's provided).\n *\n * @category interop\n * @experimental 21.0.0\n */\nexport function compatForm<TModel>(\n model: WritableSignal<TModel>,\n schema: SchemaOrSchemaFn<TModel>,\n options: CompatFormOptions,\n): FieldTree<TModel>;\n\nexport function compatForm<TModel>(...args: any[]): FieldTree<TModel> {\n const [model, maybeSchema, maybeOptions] = normalizeFormArgs<TModel>(args);\n\n const options = {...maybeOptions, adapter: new CompatFieldAdapter()};\n const schema = maybeSchema || ((() => {}) as SchemaOrSchemaFn<TModel, PathKind>);\n return form(model, schema, options) as FieldTree<TModel>;\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport type {SignalFormsConfig} from '../../../src/api/di';\n\n/**\n * A value that can be used for `SignalFormsConfig.classes` to automatically add\n * the `ng-*` status classes from reactive forms.\n *\n * @experimental 21.0.1\n */\nexport const NG_STATUS_CLASSES: SignalFormsConfig['classes'] = {\n 'ng-touched': ({state}) => state().touched(),\n 'ng-untouched': ({state}) => !state().touched(),\n 'ng-dirty': ({state}) => state().dirty(),\n 'ng-pristine': ({state}) => !state().dirty(),\n 'ng-valid': ({state}) => state().valid(),\n 'ng-invalid': ({state}) => state().invalid(),\n 'ng-pending': ({state}) => state().pending(),\n};\n"],"names":["CompatFieldNode","FieldNode","options","control","constructor","makeCreateDestroySubject","destroy$","ReplaySubject","next","complete","extractControlPropToSignal","makeSignal","injector","getInjectorFromOptions","createDestroySubject","signalOfControlSignal","linkedSignal","ngDevMode","debugName","source","computation","untracked","runInInjectionContext","computed","getControlStatusSignal","getValue","c","toSignal","statusChanges","pipe","map","takeUntil","initialValue","getControlEventsSignal","events","CompatNodeState","FieldNodeState","compatNode","touched","dirty","disabled","controlDisabled","disabledReasons","length","markAsDirty","markAsTouched","markAsPristine","markAsUntouched","getParentFromOptions","kind","undefined","parent","getFieldManagerFromOptions","fieldManager","structure","root","getControlValueSignal","value","valueChanges","getRawValue","set","setValue","update","fn","CompatStructure","FieldNodeStructure","keyInParent","pathKeys","children","signal","childrenMap","node","logic","RuntimeError","identityInParent","initialKeyInParent","createKeyInParent","getChild","CompatValidationError","fieldTree","context","message","reactiveErrorsToSignalErrors","errors","Object","entries","extractNestedReactiveErrors","push","FormGroup","FormArray","values","controls","EMPTY_ARRAY_SIGNAL","TRUE_SIGNAL","CompatValidationState","syncValid","pending","invalid","valid","status","asyncErrors","errorSummary","rawSyncTreeErrors","syncErrors","rawAsyncErrors","shouldSkipValidation","calculateValidationSelfStatus","CompatFieldAdapter","basicAdapter","BasicFieldAdapter","newRoot","pathNode","adapter","AbstractControl","createCompatNode","builder","build","fieldAdapter","createNodeState","createStructure","createValidationState","newChild","compatForm","args","model","maybeSchema","maybeOptions","normalizeFormArgs","schema","form","NG_STATUS_CLASSES","ng-touched","state","ng-untouched","ng-dirty","ng-pristine","ng-valid","ng-invalid","ng-pending"],"mappings":";;;;;;;;;;;;;;AAsBM,MAAOA,eAAgB,SAAQC,SAAS,CAAA;EAGhBC,OAAA;EAFnBC,OAAO;EAEhBC,WAAAA,CAA4BF,OAA+B,EAAA;IACzD,KAAK,CAACA,OAAO,CAAC;IADY,IAAO,CAAAA,OAAA,GAAPA,OAAO;AAEjC,IAAA,IAAI,CAACC,OAAO,GAAG,IAAI,CAACD,OAAO,CAACC,OAAO;AACrC;AACD;AAOD,SAASE,wBAAwBA,GAAA;AAC/B,EAAA,IAAIC,QAAQ,GAAG,IAAIC,aAAa,CAAO,CAAC,CAAC;AACzC,EAAA,OAAO,MAAK;AACV,IAAA,IAAID,QAAQ,EAAE;MACZA,QAAQ,CAACE,IAAI,EAAE;MACfF,QAAQ,CAACG,QAAQ,EAAE;AACrB;AACA,IAAA,OAAQH,QAAQ,GAAG,IAAIC,aAAa,CAAO,CAAC,CAAC;GAC9C;AACH;AAcgB,SAAAG,0BAA0BA,CACxCR,OAA+B,EAC/BS,UAAqF,EAAA;AAErF,EAAA,MAAMC,QAAQ,GAAGC,sBAAsB,CAACX,OAAO,CAAC;AAGhD,EAAA,MAAMY,oBAAoB,GAAGT,wBAAwB,EAAE;EAEvD,MAAMU,qBAAqB,GAAGC,YAAY,CAAA;AAAA,IAAA,IAAAC,SAAA,GAAA;AA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F,IAAAA;AAAM,GAAA,KAAKA,KAAK,EAAE,CAAC7F,KAAK,EAAE;AACxC,EAAA,aAAa,EAAEgG,CAAC;AAACH,IAAAA;GAAM,KAAK,CAACA,KAAK,EAAE,CAAC7F,KAAK,EAAE;AAC5C,EAAA,UAAU,EAAEiG,CAAC;AAACJ,IAAAA;AAAM,GAAA,KAAKA,KAAK,EAAE,CAAClC,KAAK,EAAE;AACxC,EAAA,YAAY,EAAEuC,CAAC;AAACL,IAAAA;AAAM,GAAA,KAAKA,KAAK,EAAE,CAACnC,OAAO,EAAE;AAC5C,EAAA,YAAY,EAAEyC,CAAC;AAACN,IAAAA;AAAM,GAAA,KAAKA,KAAK,EAAE,CAACpC,OAAO;;;;;"}
1
+ {"version":3,"file":"signals-compat.mjs","sources":["../../../../../k8-fastbuild-ST-fdfa778d11ba/bin/packages/forms/signals/compat/src/compat_field_node.ts","../../../../../k8-fastbuild-ST-fdfa778d11ba/bin/packages/forms/signals/compat/src/compat_node_state.ts","../../../../../k8-fastbuild-ST-fdfa778d11ba/bin/packages/forms/signals/compat/src/compat_structure.ts","../../../../../k8-fastbuild-ST-fdfa778d11ba/bin/packages/forms/signals/compat/src/api/compat_validation_error.ts","../../../../../k8-fastbuild-ST-fdfa778d11ba/bin/packages/forms/signals/compat/src/compat_validation_error.ts","../../../../../k8-fastbuild-ST-fdfa778d11ba/bin/packages/forms/signals/compat/src/compat_validation_state.ts","../../../../../k8-fastbuild-ST-fdfa778d11ba/bin/packages/forms/signals/compat/src/compat_field_adapter.ts","../../../../../k8-fastbuild-ST-fdfa778d11ba/bin/packages/forms/signals/compat/src/api/compat_form.ts","../../../../../k8-fastbuild-ST-fdfa778d11ba/bin/packages/forms/signals/compat/src/api/di.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {computed, linkedSignal, runInInjectionContext, Signal, untracked} from '@angular/core';\nimport {toSignal} from '@angular/core/rxjs-interop';\nimport {AbstractControl} from '@angular/forms';\nimport {Observable, ReplaySubject} from 'rxjs';\nimport {map, takeUntil} from 'rxjs/operators';\nimport {FieldNode} from '../../src/field/node';\nimport {getInjectorFromOptions} from '../../src/field/util';\nimport type {CompatFieldNodeOptions} from './compat_structure';\n\n/**\n * Field node with additional control property.\n *\n * Compat node has no children.\n */\nexport class CompatFieldNode extends FieldNode {\n readonly control: Signal<AbstractControl>;\n\n constructor(public readonly options: CompatFieldNodeOptions) {\n super(options);\n this.control = this.options.control;\n }\n}\n\n/**\n * Makes a function which creates a new subject (and unsubscribes/destroys the previous one).\n *\n * This allows us to automatically unsubscribe from status changes of the previous FormControl when we go to subscribe to a new one\n */\nfunction makeCreateDestroySubject() {\n let destroy$ = new ReplaySubject<void>(1);\n return () => {\n if (destroy$) {\n destroy$.next();\n destroy$.complete();\n }\n return (destroy$ = new ReplaySubject<void>(1));\n };\n}\n\n/**\n * Helper function taking options, and a callback which takes options, and a function\n * converting reactive control to appropriate property using toSignal from rxjs compat.\n *\n * This helper keeps all complexity in one place by doing the following things:\n * - Running the callback in injection context\n * - Not tracking the callback, as it creates a new signal.\n * - Reacting to control changes, allowing to swap control dynamically.\n *\n * @param options\n * @param makeSignal\n */\nexport function extractControlPropToSignal<T, R = T>(\n options: CompatFieldNodeOptions,\n makeSignal: (c: AbstractControl<unknown, T>, destroy$: Observable<void>) => Signal<R>,\n): Signal<R> {\n const injector = getInjectorFromOptions(options);\n\n // Creates a subject that could be used in takeUntil.\n const createDestroySubject = makeCreateDestroySubject();\n\n const signalOfControlSignal = linkedSignal({\n source: options.control,\n computation: (control) => {\n return untracked(() => {\n return runInInjectionContext(injector, () => makeSignal(control, createDestroySubject()));\n });\n },\n });\n\n // We have to have computed, because we need to react to both:\n // linked signal changes as well as the inner signal changes.\n return computed(() => signalOfControlSignal()());\n}\n\n/**\n * A helper function, simplifying getting reactive control properties after status changes.\n *\n * Used to extract errors and statuses such as valid, pending.\n *\n * @param options\n * @param getValue\n */\nexport const getControlStatusSignal = <T>(\n options: CompatFieldNodeOptions,\n getValue: (c: AbstractControl<unknown>) => T,\n) => {\n return extractControlPropToSignal<unknown, T>(options, (c, destroy$) =>\n toSignal(\n c.statusChanges.pipe(\n map(() => getValue(c)),\n takeUntil(destroy$),\n ),\n {\n initialValue: getValue(c),\n },\n ),\n );\n};\n\n/**\n * A helper function, simplifying converting convert events to signals.\n *\n * Used to get dirty and touched signals from control.\n *\n * @param options\n * @param getValue A function which takes control and returns required value.\n */\nexport const getControlEventsSignal = <T>(\n options: CompatFieldNodeOptions,\n getValue: (c: AbstractControl) => T,\n) => {\n return extractControlPropToSignal<unknown, T>(options, (c, destroy$) =>\n toSignal(\n c.events.pipe(\n map(() => {\n return getValue(c);\n }),\n takeUntil(destroy$),\n ),\n {\n initialValue: getValue(c),\n },\n ),\n );\n};\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {computed, Signal} from '@angular/core';\nimport {AbstractControl} from '@angular/forms';\nimport {FieldNodeState} from '../../src/field/state';\nimport {CompatFieldNode, getControlEventsSignal, getControlStatusSignal} from './compat_field_node';\nimport {CompatFieldNodeOptions} from './compat_structure';\n\n/**\n * A FieldNodeState class wrapping a FormControl and proxying it's state.\n */\nexport class CompatNodeState extends FieldNodeState {\n override readonly touched: Signal<boolean>;\n override readonly dirty: Signal<boolean>;\n override readonly disabled: Signal<boolean>;\n private readonly control: Signal<AbstractControl>;\n\n constructor(\n readonly compatNode: CompatFieldNode,\n options: CompatFieldNodeOptions,\n ) {\n super(compatNode);\n this.control = options.control;\n this.touched = getControlEventsSignal(options, (c) => c.touched);\n this.dirty = getControlEventsSignal(options, (c) => c.dirty);\n const controlDisabled = getControlStatusSignal(options, (c) => c.disabled);\n\n this.disabled = computed(() => {\n return controlDisabled() || this.disabledReasons().length > 0;\n });\n }\n\n override markAsDirty() {\n this.control().markAsDirty();\n }\n\n override markAsTouched() {\n this.control().markAsTouched();\n }\n\n override markAsPristine() {\n this.control().markAsPristine();\n }\n\n override markAsUntouched() {\n this.control().markAsUntouched();\n }\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {\n computed,\n Signal,\n signal,\n WritableSignal,\n ɵRuntimeError as RuntimeError,\n} from '@angular/core';\nimport {SignalFormsErrorCode} from '../../src/errors';\nimport {FormFieldManager} from '../../src/field/manager';\nimport {FieldNode, ParentFieldNode} from '../../src/field/node';\nimport {\n ChildFieldNodeOptions,\n FieldNodeOptions,\n FieldNodeStructure,\n RootFieldNodeOptions,\n} from '../../src/field/structure';\n\nimport {toSignal} from '@angular/core/rxjs-interop';\nimport {AbstractControl} from '@angular/forms';\nimport {map, takeUntil} from 'rxjs/operators';\nimport {extractControlPropToSignal} from './compat_field_node';\n\n/**\n * Child Field Node options also exposing control property.\n */\nexport interface CompatChildFieldNodeOptions extends ChildFieldNodeOptions {\n control: Signal<AbstractControl>;\n}\n\n/**\n * Root Field Node options also exposing control property.\n */\nexport interface CompatRootFieldNodeOptions extends RootFieldNodeOptions {\n control: Signal<AbstractControl>;\n}\n\n/**\n * Field Node options also exposing control property.\n */\nexport type CompatFieldNodeOptions = CompatRootFieldNodeOptions | CompatChildFieldNodeOptions;\n\n/**\n * A helper function allowing to get parent if it exists.\n */\nfunction getParentFromOptions(options: FieldNodeOptions) {\n if (options.kind === 'root') {\n return undefined;\n }\n\n return options.parent;\n}\n\n/**\n * A helper function allowing to get fieldManager regardless of the option type.\n */\nfunction getFieldManagerFromOptions(options: FieldNodeOptions) {\n if (options.kind === 'root') {\n return options.fieldManager;\n }\n\n return options.parent.structure.root.structure.fieldManager;\n}\n\n/**\n * A helper function that takes CompatFieldNodeOptions, and produce a writable signal synced to the\n * value of contained AbstractControl.\n *\n * This uses toSignal, which requires an injector.\n *\n * @param options\n */\nfunction getControlValueSignal<T>(options: CompatFieldNodeOptions) {\n const value = extractControlPropToSignal<T>(options, (control, destroy$) => {\n return toSignal(\n control.valueChanges.pipe(\n map(() => control.getRawValue()),\n takeUntil(destroy$),\n ),\n {\n initialValue: control.getRawValue(),\n },\n );\n }) as WritableSignal<T>;\n\n value.set = (value: T) => {\n options.control().setValue(value);\n };\n\n value.update = (fn: (current: T) => T) => {\n value.set(fn(value()));\n };\n\n return value;\n}\n\n/**\n * Compat version of FieldNodeStructure,\n * - It has no children\n * - It wraps FormControl and proxies its value.\n */\nexport class CompatStructure extends FieldNodeStructure {\n override value: WritableSignal<unknown>;\n override keyInParent: Signal<string>;\n override root: FieldNode;\n override pathKeys: Signal<readonly string[]>;\n override readonly children = signal([]);\n override readonly childrenMap = computed(() => undefined);\n override readonly parent: ParentFieldNode | undefined;\n override readonly fieldManager: FormFieldManager;\n\n constructor(node: FieldNode, options: CompatFieldNodeOptions) {\n super(options.logic, node, () => {\n throw new RuntimeError(\n SignalFormsErrorCode.COMPAT_NO_CHILDREN,\n ngDevMode && `Compat nodes don't have children.`,\n );\n });\n this.value = getControlValueSignal(options);\n this.parent = getParentFromOptions(options);\n this.root = this.parent?.structure.root ?? node;\n this.fieldManager = getFieldManagerFromOptions(options);\n\n const identityInParent = options.kind === 'child' ? options.identityInParent : undefined;\n const initialKeyInParent = options.kind === 'child' ? options.initialKeyInParent : undefined;\n this.keyInParent = this.createKeyInParent(options, identityInParent, initialKeyInParent);\n\n this.pathKeys = computed(() =>\n this.parent ? [...this.parent.structure.pathKeys(), this.keyInParent()] : [],\n );\n }\n\n override getChild(): FieldNode | undefined {\n return undefined;\n }\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {AbstractControl} from '@angular/forms';\nimport {ValidationError} from '../../../src/api/rules/validation/validation_errors';\nimport {FieldTree} from '../../../src/api/types';\n\n/**\n * An error used for compat errors.\n *\n * @experimental 21.0.0\n * @category interop\n */\nexport class CompatValidationError<T = unknown> implements ValidationError {\n readonly kind: string = 'compat';\n readonly control: AbstractControl;\n readonly fieldTree!: FieldTree<unknown>;\n readonly context: T;\n readonly message?: string;\n\n constructor({context, kind, control}: {context: T; kind: string; control: AbstractControl}) {\n this.context = context;\n this.kind = kind;\n this.control = control;\n }\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {AbstractControl, FormArray, FormGroup, ValidationErrors} from '@angular/forms';\nimport {CompatValidationError} from './api/compat_validation_error';\n\n/**\n * Converts reactive form validation error to signal forms CompatValidationError.\n * @param errors\n * @param control\n * @return list of errors.\n */\nexport function reactiveErrorsToSignalErrors(\n errors: ValidationErrors | null,\n control: AbstractControl,\n): CompatValidationError[] {\n if (errors === null) {\n return [];\n }\n\n return Object.entries(errors).map(([kind, context]) => {\n return new CompatValidationError({context, kind, control});\n });\n}\n\nexport function extractNestedReactiveErrors(control: AbstractControl): CompatValidationError[] {\n const errors: CompatValidationError[] = [];\n\n if (control.errors) {\n errors.push(...reactiveErrorsToSignalErrors(control.errors, control));\n }\n\n if (control instanceof FormGroup || control instanceof FormArray) {\n for (const c of Object.values(control.controls)) {\n errors.push(...extractNestedReactiveErrors(c));\n }\n }\n\n return errors;\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {computed, Signal} from '@angular/core';\nimport {AbstractControl} from '@angular/forms';\nimport {ValidationError} from '../../src/api/rules/validation/validation_errors';\nimport {calculateValidationSelfStatus, ValidationState} from '../../src/field/validation';\nimport type {CompatValidationError} from './api/compat_validation_error';\nimport {getControlStatusSignal} from './compat_field_node';\nimport {CompatFieldNodeOptions} from './compat_structure';\nimport {extractNestedReactiveErrors} from './compat_validation_error';\n\n// Readonly signal containing an empty array, used for optimization.\nconst EMPTY_ARRAY_SIGNAL = computed(() => []);\nconst TRUE_SIGNAL = computed(() => true);\n\n/**\n * Compat version of a validation state that wraps a FormControl, and proxies it's validation state.\n */\nexport class CompatValidationState implements ValidationState {\n readonly syncValid: Signal<boolean>;\n /**\n * All validation errors for this field.\n */\n readonly errors: Signal<CompatValidationError[]>;\n readonly pending: Signal<boolean>;\n readonly invalid: Signal<boolean>;\n readonly valid: Signal<boolean>;\n\n readonly parseErrors: Signal<ValidationError.WithFormField[]> = computed(() => []);\n\n constructor(options: CompatFieldNodeOptions) {\n this.syncValid = getControlStatusSignal(options, (c: AbstractControl) => c.status === 'VALID');\n this.errors = getControlStatusSignal(options, extractNestedReactiveErrors);\n this.pending = getControlStatusSignal(options, (c) => c.pending);\n\n this.valid = getControlStatusSignal(options, (c) => {\n return c.valid;\n });\n\n this.invalid = getControlStatusSignal(options, (c) => {\n return c.invalid;\n });\n }\n\n asyncErrors: Signal<(ValidationError.WithFieldTree | 'pending')[]> = EMPTY_ARRAY_SIGNAL;\n errorSummary: Signal<ValidationError.WithFieldTree[]> = EMPTY_ARRAY_SIGNAL;\n\n // Those are irrelevant for compat mode, as it has no children\n rawSyncTreeErrors = EMPTY_ARRAY_SIGNAL;\n syncErrors = EMPTY_ARRAY_SIGNAL;\n rawAsyncErrors = EMPTY_ARRAY_SIGNAL;\n shouldSkipValidation = TRUE_SIGNAL;\n\n /**\n * Computes status based on whether the field is valid/invalid/pending.\n */\n readonly status: Signal<'valid' | 'invalid' | 'unknown'> = computed(() => {\n return calculateValidationSelfStatus(this);\n });\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {computed, Signal, WritableSignal} from '@angular/core';\nimport {AbstractControl} from '@angular/forms';\nimport {BasicFieldAdapter, FieldAdapter} from '../../src/field/field_adapter';\nimport {FormFieldManager} from '../../src/field/manager';\nimport {FieldNode} from '../../src/field/node';\nimport {FieldNodeState} from '../../src/field/state';\nimport {\n ChildFieldNodeOptions,\n FieldNodeOptions,\n FieldNodeStructure,\n} from '../../src/field/structure';\nimport {ValidationState} from '../../src/field/validation';\nimport {FieldPathNode} from '../../src/schema/path_node';\nimport {CompatFieldNode} from './compat_field_node';\nimport {CompatNodeState} from './compat_node_state';\nimport {CompatChildFieldNodeOptions, CompatStructure} from './compat_structure';\nimport {CompatValidationState} from './compat_validation_state';\n\n/**\n * This is a tree-shakable Field adapter that can create a compat node\n * that proxies FormControl state and value to a field.\n */\nexport class CompatFieldAdapter implements FieldAdapter {\n readonly basicAdapter = new BasicFieldAdapter();\n\n /**\n * Creates a regular or compat root node state based on whether the control is present.\n * @param fieldManager\n * @param value\n * @param pathNode\n * @param adapter\n */\n newRoot<TModel>(\n fieldManager: FormFieldManager,\n value: WritableSignal<TModel>,\n pathNode: FieldPathNode,\n adapter: FieldAdapter,\n ): FieldNode {\n if (value() instanceof AbstractControl) {\n return createCompatNode({\n kind: 'root',\n fieldManager,\n value,\n pathNode,\n logic: pathNode.builder.build(),\n fieldAdapter: adapter,\n });\n }\n\n return this.basicAdapter.newRoot<TModel>(fieldManager, value, pathNode, adapter);\n }\n\n /**\n * Creates a regular or compat node state based on whether the control is present.\n * @param node\n * @param options\n */\n createNodeState(node: CompatFieldNode, options: CompatChildFieldNodeOptions): FieldNodeState {\n if (!options.control) {\n return this.basicAdapter.createNodeState(node);\n }\n return new CompatNodeState(node, options);\n }\n\n /**\n * Creates a regular or compat structure based on whether the control is present.\n * @param node\n * @param options\n */\n createStructure(node: CompatFieldNode, options: CompatChildFieldNodeOptions): FieldNodeStructure {\n if (!options.control) {\n return this.basicAdapter.createStructure(node, options);\n }\n return new CompatStructure(node, options);\n }\n\n /**\n * Creates a regular or compat validation state based on whether the control is present.\n * @param node\n * @param options\n */\n createValidationState(\n node: CompatFieldNode,\n options: CompatChildFieldNodeOptions,\n ): ValidationState {\n if (!options.control) {\n return this.basicAdapter.createValidationState(node);\n }\n return new CompatValidationState(options);\n }\n\n /**\n * Creates a regular or compat node based on whether the control is present.\n * @param options\n */\n newChild(options: ChildFieldNodeOptions): FieldNode {\n const value = options.parent.value()[options.initialKeyInParent];\n\n if (value instanceof AbstractControl) {\n return createCompatNode(options);\n }\n\n return new FieldNode(options);\n }\n}\n\n/**\n * Creates a CompatFieldNode from options.\n * @param options\n */\nexport function createCompatNode(options: FieldNodeOptions) {\n const control = (\n options.kind === 'root'\n ? options.value\n : computed(() => {\n return options.parent.value()[options.initialKeyInParent];\n })\n ) as Signal<AbstractControl>;\n\n return new CompatFieldNode({\n ...options,\n control,\n });\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {WritableSignal} from '@angular/core';\nimport {form, FormOptions} from '../../../public_api';\nimport {FieldTree, PathKind, SchemaOrSchemaFn} from '../../../src/api/types';\nimport {normalizeFormArgs} from '../../../src/util/normalize_form_args';\nimport {CompatFieldAdapter} from '../compat_field_adapter';\n\n/**\n * Options that may be specified when creating a compat form.\n *\n * @category interop\n * @experimental 21.0.0\n */\nexport type CompatFormOptions = Omit<FormOptions, 'adapter'>;\n\n/**\n * Creates a compatibility form wrapped around the given model data.\n *\n * `compatForm` is a version of the `form` function that is designed for backwards\n * compatibility with Reactive forms by accepting Reactive controls as a part of the data.\n *\n * @example\n * ```ts\n * const lastName = new FormControl('lastName');\n *\n * const nameModel = signal({\n * first: '',\n * last: lastName\n * });\n *\n * const nameForm = compatForm(nameModel, (name) => {\n * required(name.first);\n * });\n *\n * nameForm.last().value(); // lastName, not FormControl\n * ```\n * \n * @param model A writable signal that contains the model data for the form. The resulting field\n * structure will match the shape of the model and any changes to the form data will be written to\n * the model.\n\n * @category interop\n * @experimental 21.0.0\n */\nexport function compatForm<TModel>(model: WritableSignal<TModel>): FieldTree<TModel>;\n\n/**\n * Creates a compatibility form wrapped around the given model data.\n *\n * `compatForm` is a version of the `form` function that is designed for backwards\n * compatibility with Reactive forms by accepting Reactive controls as a part of the data.\n *\n * @example\n * ```ts\n * const lastName = new FormControl('lastName');\n *\n * const nameModel = signal({\n * first: '',\n * last: lastName\n * });\n *\n * const nameForm = compatForm(nameModel, (name) => {\n * required(name.first);\n * });\n *\n * nameForm.last().value(); // lastName, not FormControl\n *\n * @param model A writable signal that contains the model data for the form. The resulting field\n * structure will match the shape of the model and any changes to the form data will be written to\n * the model.\n * @param schemaOrOptions The second argument can be either\n * 1. A schema or a function used to specify logic for the form (e.g. validation, disabled fields, etc.).\n * When passing a schema, the form options can be passed as a third argument if needed.\n * 2. The form options (excluding adapter, since it's provided).\n *\n * @category interop\n * @experimental 21.0.0\n */\nexport function compatForm<TModel>(\n model: WritableSignal<TModel>,\n schemaOrOptions: SchemaOrSchemaFn<TModel> | CompatFormOptions,\n): FieldTree<TModel>;\n\n/**\n * Creates a compatibility form wrapped around the given model data.\n *\n * `compatForm` is a version of the `form` function that is designed for backwards\n * compatibility with Reactive forms by accepting Reactive controls as a part of the data.\n *\n * @example\n * ```ts\n * const lastName = new FormControl('lastName');\n *\n * const nameModel = signal({\n * first: '',\n * last: lastName\n * });\n *\n * const nameForm = compatForm(nameModel, (name) => {\n * required(name.first);\n * });\n *\n * nameForm.last().value(); // lastName, not FormControl\n *\n * @param model A writable signal that contains the model data for the form. The resulting field\n * structure will match the shape of the model and any changes to the form data will be written to\n * the model.\n * @param schemaOrOptions A schema or a function used to specify logic for the form (e.g. validation, disabled fields, etc.).\n * When passing a schema, the form options can be passed as a third argument if needed.\n * @param options The form options (excluding adapter, since it's provided).\n *\n * @category interop\n * @experimental 21.0.0\n */\nexport function compatForm<TModel>(\n model: WritableSignal<TModel>,\n schema: SchemaOrSchemaFn<TModel>,\n options: CompatFormOptions,\n): FieldTree<TModel>;\n\nexport function compatForm<TModel>(...args: any[]): FieldTree<TModel> {\n const [model, maybeSchema, maybeOptions] = normalizeFormArgs<TModel>(args);\n\n const options = {...maybeOptions, adapter: new CompatFieldAdapter()};\n const schema = maybeSchema || ((() => {}) as SchemaOrSchemaFn<TModel, PathKind>);\n return form(model, schema, options) as FieldTree<TModel>;\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport type {SignalFormsConfig} from '../../../src/api/di';\n\n/**\n * A value that can be used for `SignalFormsConfig.classes` to automatically add\n * the `ng-*` status classes from reactive forms.\n *\n * @experimental 21.0.1\n */\nexport const NG_STATUS_CLASSES: SignalFormsConfig['classes'] = {\n 'ng-touched': ({state}) => state().touched(),\n 'ng-untouched': ({state}) => !state().touched(),\n 'ng-dirty': ({state}) => state().dirty(),\n 'ng-pristine': ({state}) => !state().dirty(),\n 'ng-valid': ({state}) => state().valid(),\n 'ng-invalid': ({state}) => state().invalid(),\n 'ng-pending': ({state}) => state().pending(),\n};\n"],"names":["CompatFieldNode","FieldNode","options","control","constructor","makeCreateDestroySubject","destroy$","ReplaySubject","next","complete","extractControlPropToSignal","makeSignal","injector","getInjectorFromOptions","createDestroySubject","signalOfControlSignal","linkedSignal","ngDevMode","debugName","source","computation","untracked","runInInjectionContext","computed","getControlStatusSignal","getValue","c","toSignal","statusChanges","pipe","map","takeUntil","initialValue","getControlEventsSignal","events","CompatNodeState","FieldNodeState","compatNode","touched","dirty","disabled","controlDisabled","disabledReasons","length","markAsDirty","markAsTouched","markAsPristine","markAsUntouched","getParentFromOptions","kind","undefined","parent","getFieldManagerFromOptions","fieldManager","structure","root","getControlValueSignal","value","valueChanges","getRawValue","set","setValue","update","fn","CompatStructure","FieldNodeStructure","keyInParent","pathKeys","children","signal","childrenMap","node","logic","RuntimeError","identityInParent","initialKeyInParent","createKeyInParent","getChild","CompatValidationError","fieldTree","context","message","reactiveErrorsToSignalErrors","errors","Object","entries","extractNestedReactiveErrors","push","FormGroup","FormArray","values","controls","EMPTY_ARRAY_SIGNAL","TRUE_SIGNAL","CompatValidationState","syncValid","pending","invalid","valid","parseErrors","status","asyncErrors","errorSummary","rawSyncTreeErrors","syncErrors","rawAsyncErrors","shouldSkipValidation","calculateValidationSelfStatus","CompatFieldAdapter","basicAdapter","BasicFieldAdapter","newRoot","pathNode","adapter","AbstractControl","createCompatNode","builder","build","fieldAdapter","createNodeState","createStructure","createValidationState","newChild","compatForm","args","model","maybeSchema","maybeOptions","normalizeFormArgs","schema","form","NG_STATUS_CLASSES","ng-touched","state","ng-untouched","ng-dirty","ng-pristine","ng-valid","ng-invalid","ng-pending"],"mappings":";;;;;;;;;;;;;;AAsBM,MAAOA,eAAgB,SAAQC,SAAS,CAAA;EAGhBC,OAAA;EAFnBC,OAAO;EAEhBC,WAAAA,CAA4BF,OAA+B,EAAA;IACzD,KAAK,CAACA,OAAO,CAAC;IADY,IAAO,CAAAA,OAAA,GAAPA,OAAO;AAEjC,IAAA,IAAI,CAACC,OAAO,GAAG,IAAI,CAACD,OAAO,CAACC,OAAO;AACrC;AACD;AAOD,SAASE,wBAAwBA,GAAA;AAC/B,EAAA,IAAIC,QAAQ,GAAG,IAAIC,aAAa,CAAO,CAAC,CAAC;AACzC,EAAA,OAAO,MAAK;AACV,IAAA,IAAID,QAAQ,EAAE;MACZA,QAAQ,CAACE,IAAI,EAAE;MACfF,QAAQ,CAACG,QAAQ,EAAE;AACrB;AACA,IAAA,OAAQH,QAAQ,GAAG,IAAIC,aAAa,CAAO,CAAC,CAAC;GAC9C;AACH;AAcgB,SAAAG,0BAA0BA,CACxCR,OAA+B,EAC/BS,UAAqF,EAAA;AAErF,EAAA,MAAMC,QAAQ,GAAGC,sBAAsB,CAACX,OAAO,CAAC;AAGhD,EAAA,MAAMY,oBAAoB,GAAGT,wBAAwB,EAAE;EAEvD,MAAMU,qBAAqB,GAAGC,YAAY,CAAA;AAAA,IAAA,IAAAC,SAAA,GAAA;AAAAC,MAAAA,SAAA,EAAA;KAAA,GAAA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AAU,EAAEiG,CAAC;AAACF,IAAAA;AAAM,GAAA,KAAKA,KAAK,EAAE,CAAC9F,KAAK,EAAE;AACxC,EAAA,aAAa,EAAEiG,CAAC;AAACH,IAAAA;GAAM,KAAK,CAACA,KAAK,EAAE,CAAC9F,KAAK,EAAE;AAC5C,EAAA,UAAU,EAAEkG,CAAC;AAACJ,IAAAA;AAAM,GAAA,KAAKA,KAAK,EAAE,CAACnC,KAAK,EAAE;AACxC,EAAA,YAAY,EAAEwC,CAAC;AAACL,IAAAA;AAAM,GAAA,KAAKA,KAAK,EAAE,CAACpC,OAAO,EAAE;AAC5C,EAAA,YAAY,EAAE0C,CAAC;AAACN,IAAAA;AAAM,GAAA,KAAKA,KAAK,EAAE,CAACrC,OAAO;;;;;"}
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v21.1.3
2
+ * @license Angular v21.2.0-next.1
3
3
  * (c) 2010-2026 Google LLC. https://angular.dev/
4
4
  * License: MIT
5
5
  */
@@ -101,15 +101,28 @@ const controlInstructions = {
101
101
  class FormField {
102
102
  element = inject(ElementRef).nativeElement;
103
103
  injector = inject(Injector);
104
- formField = input.required(...(ngDevMode ? [{
105
- debugName: "formField"
106
- }] : []));
107
- state = computed(() => this.formField()(), ...(ngDevMode ? [{
104
+ fieldTree = input.required({
105
+ ...(ngDevMode ? {
106
+ debugName: "fieldTree"
107
+ } : {}),
108
+ alias: 'formField'
109
+ });
110
+ state = computed(() => this.fieldTree()(), ...(ngDevMode ? [{
108
111
  debugName: "state"
109
112
  }] : []));
110
113
  bindingOptions = signal(undefined, ...(ngDevMode ? [{
111
114
  debugName: "bindingOptions"
112
115
  }] : []));
116
+ parseErrors = computed(() => this.bindingOptions()?.parseErrors?.().map(err => ({
117
+ ...err,
118
+ fieldTree: this.fieldTree(),
119
+ formField: this
120
+ })) ?? [], ...(ngDevMode ? [{
121
+ debugName: "parseErrors"
122
+ }] : []));
123
+ errors = computed(() => this.state().errors().filter(err => !err.formField || err.formField === this), ...(ngDevMode ? [{
124
+ debugName: "errors"
125
+ }] : []));
113
126
  [_CONTROL] = controlInstructions;
114
127
  config = inject(SIGNAL_FORMS_CONFIG, {
115
128
  optional: true
@@ -141,17 +154,17 @@ class FormField {
141
154
  injector: this.injector
142
155
  });
143
156
  }
144
- focus() {
157
+ focus(options) {
145
158
  const bindingOptions = untracked(this.bindingOptions);
146
159
  if (bindingOptions?.focus) {
147
- bindingOptions.focus();
160
+ bindingOptions.focus(options);
148
161
  } else {
149
- this.element.focus();
162
+ this.element.focus(options);
150
163
  }
151
164
  }
152
165
  static ɵfac = i0.ɵɵngDeclareFactory({
153
166
  minVersion: "12.0.0",
154
- version: "21.1.3",
167
+ version: "21.2.0-next.1",
155
168
  ngImport: i0,
156
169
  type: FormField,
157
170
  deps: [],
@@ -159,13 +172,13 @@ class FormField {
159
172
  });
160
173
  static ɵdir = i0.ɵɵngDeclareDirective({
161
174
  minVersion: "17.1.0",
162
- version: "21.1.3",
175
+ version: "21.2.0-next.1",
163
176
  type: FormField,
164
177
  isStandalone: true,
165
178
  selector: "[formField]",
166
179
  inputs: {
167
- formField: {
168
- classPropertyName: "formField",
180
+ fieldTree: {
181
+ classPropertyName: "fieldTree",
169
182
  publicName: "formField",
170
183
  isSignal: true,
171
184
  isRequired: true,
@@ -179,18 +192,20 @@ class FormField {
179
192
  provide: NgControl,
180
193
  useFactory: () => inject(FormField).getOrCreateNgControl()
181
194
  }],
195
+ exportAs: ["formField"],
182
196
  ngImport: i0
183
197
  });
184
198
  }
185
199
  i0.ɵɵngDeclareClassMetadata({
186
200
  minVersion: "12.0.0",
187
- version: "21.1.3",
201
+ version: "21.2.0-next.1",
188
202
  ngImport: i0,
189
203
  type: FormField,
190
204
  decorators: [{
191
205
  type: Directive,
192
206
  args: [{
193
207
  selector: '[formField]',
208
+ exportAs: 'formField',
194
209
  providers: [{
195
210
  provide: FORM_FIELD,
196
211
  useExisting: FormField
@@ -201,7 +216,7 @@ i0.ɵɵngDeclareClassMetadata({
201
216
  }]
202
217
  }],
203
218
  propDecorators: {
204
- formField: [{
219
+ fieldTree: [{
205
220
  type: i0.Input,
206
221
  args: [{
207
222
  isSignal: true,
@@ -643,7 +658,6 @@ function debounceForDuration(durationInMilliseconds) {
643
658
  let timeoutId;
644
659
  const onAbort = () => {
645
660
  clearTimeout(timeoutId);
646
- resolve();
647
661
  };
648
662
  timeoutId = setTimeout(() => {
649
663
  abortSignal.removeEventListener('abort', onAbort);