@angular/forms
Advanced tools
| /** | ||
| * @license Angular v22.0.0-rc.0 | ||
| * @license Angular v22.0.0-rc.1 | ||
| * (c) 2010-2026 Google LLC. https://angular.dev/ | ||
@@ -7,3 +7,3 @@ * License: MIT | ||
| import { untracked, ɵRuntimeError as _RuntimeError, computed, runInInjectionContext, Injector, linkedSignal, signal, APP_ID, effect, inject } from '@angular/core'; | ||
| import { untracked, ɵRuntimeError as _RuntimeError, computed, runInInjectionContext, Injector, linkedSignal, signal, APP_ID, effect, InjectionToken, inject } from '@angular/core'; | ||
| import { AbstractControl, FormGroup, FormArray } from '@angular/forms'; | ||
@@ -1753,2 +1753,4 @@ import { SIGNAL } from '@angular/core/primitives/signals'; | ||
| const REGISTER_WEBMCP_FORM = new InjectionToken(typeof ngDevMode !== 'undefined' && ngDevMode ? 'REGISTER_WEBMCP_FORM' : ''); | ||
| function normalizeFormArgs(args) { | ||
@@ -1780,2 +1782,20 @@ let model; | ||
| fieldManager.createFieldManagementEffect(fieldRoot.structure); | ||
| const { | ||
| experimentalWebMcpTool | ||
| } = options ?? {}; | ||
| if (experimentalWebMcpTool) { | ||
| const registerWebMcpForm = runInInjectionContext(injector, () => inject(REGISTER_WEBMCP_FORM, { | ||
| optional: true | ||
| })); | ||
| if (registerWebMcpForm) { | ||
| runInInjectionContext(injector, () => registerWebMcpForm(fieldRoot.fieldTree, { | ||
| name: experimentalWebMcpTool.name, | ||
| description: experimentalWebMcpTool.description | ||
| })); | ||
| } else { | ||
| if (typeof ngDevMode !== 'undefined' && ngDevMode) { | ||
| throw new Error(`Cannot register form "${experimentalWebMcpTool.name}" as a WebMCP tool. ` + `Make sure to use \`provideExperimentalWebMcpForms()\` in your application bootstrap configuration.`); | ||
| } | ||
| } | ||
| } | ||
| return fieldRoot.fieldTree; | ||
@@ -1924,3 +1944,3 @@ } | ||
| export { BasicFieldAdapter, CompatValidationError, DEBOUNCER, FieldNode, FieldNodeState, FieldNodeStructure, FieldPathNode, IS_ASYNC_VALIDATION_RESOURCE, MAX, MAX_DATE, MAX_LENGTH, MAX_NUMBER, MIN, MIN_DATE, MIN_LENGTH, MIN_NUMBER, MetadataKey, MetadataReducer, PATTERN, REQUIRED, addDefaultField, apply, applyEach, applyWhen, applyWhenValue, assertPathIsCurrent, calculateValidationSelfStatus, createLimitSelectionKey, createManagedMetadataKey, createMetadataKey, extractNestedReactiveErrors, form, getInjectorFromOptions, isArray, isObject, metadata, normalizeFormArgs, reactiveErrorsToSignalErrors, schema, shallowArrayEquals, signalErrorsToValidationErrors, submit }; | ||
| export { BasicFieldAdapter, CompatValidationError, DEBOUNCER, FieldNode, FieldNodeState, FieldNodeStructure, FieldPathNode, IS_ASYNC_VALIDATION_RESOURCE, MAX, MAX_DATE, MAX_LENGTH, MAX_NUMBER, MIN, MIN_DATE, MIN_LENGTH, MIN_NUMBER, MetadataKey, MetadataReducer, PATTERN, REGISTER_WEBMCP_FORM, REQUIRED, addDefaultField, apply, applyEach, applyWhen, applyWhenValue, assertPathIsCurrent, calculateValidationSelfStatus, createLimitSelectionKey, createManagedMetadataKey, createMetadataKey, extractNestedReactiveErrors, form, getInjectorFromOptions, isArray, isObject, metadata, normalizeFormArgs, reactiveErrorsToSignalErrors, schema, shallowArrayEquals, signalErrorsToValidationErrors, submit }; | ||
| //# sourceMappingURL=_validation_errors-chunk.mjs.map |
| /** | ||
| * @license Angular v22.0.0-rc.0 | ||
| * @license Angular v22.0.0-rc.1 | ||
| * (c) 2010-2026 Google LLC. https://angular.dev/ | ||
@@ -4,0 +4,0 @@ * License: MIT |
+108
-19
| /** | ||
| * @license Angular v22.0.0-rc.0 | ||
| * @license Angular v22.0.0-rc.1 | ||
| * (c) 2010-2026 Google LLC. https://angular.dev/ | ||
@@ -8,5 +8,5 @@ * License: MIT | ||
| import * as i0 from '@angular/core'; | ||
| import { InjectionToken, debounced, computed, ɵchain as _chain, resource, ɵisPromise as _isPromise, linkedSignal, inject, ɵRuntimeError as _RuntimeError, untracked, signal, CSP_NONCE, PLATFORM_ID, Injectable, forwardRef, input, Renderer2, DestroyRef, Injector, ElementRef, afterRenderEffect, effect, ɵformatRuntimeError as _formatRuntimeError, Directive } from '@angular/core'; | ||
| import { InjectionToken, debounced, computed, ɵchain as _chain, resource, ɵisPromise as _isPromise, linkedSignal, inject, ɵRuntimeError as _RuntimeError, untracked, signal, CSP_NONCE, PLATFORM_ID, Injectable, forwardRef, input, Renderer2, DestroyRef, Injector, ElementRef, afterRenderEffect, effect, ɵformatRuntimeError as _formatRuntimeError, Directive, makeEnvironmentProviders, declareExperimentalWebMcpTool } from '@angular/core'; | ||
| import { ɵFORM_CONTROL_INTEGRATION as _FORM_CONTROL_INTEGRATION, Validators, ɵsetNativeDomProperty as _setNativeDomProperty, NG_VALIDATORS, ɵisNativeFormElement as _isNativeFormElement, ɵisTextualFormElement as _isTextualFormElement, NG_VALUE_ACCESSOR, ɵselectValueAccessor as _selectValueAccessor, ɵelementAcceptsMinMax as _elementAcceptsMinMax, NgControl } from '@angular/forms'; | ||
| import { assertPathIsCurrent, FieldPathNode, addDefaultField, createMetadataKey, metadata, MAX_NUMBER, MAX, MAX_DATE, MAX_LENGTH, MIN_NUMBER, MIN, MIN_DATE, MIN_LENGTH, PATTERN, REQUIRED, createManagedMetadataKey, IS_ASYNC_VALIDATION_RESOURCE, DEBOUNCER, signalErrorsToValidationErrors, reactiveErrorsToSignalErrors, shallowArrayEquals, submit } from './_validation_errors-chunk.mjs'; | ||
| import { assertPathIsCurrent, FieldPathNode, addDefaultField, createMetadataKey, metadata, MAX_NUMBER, MAX, MAX_DATE, MAX_LENGTH, MIN_NUMBER, MIN, MIN_DATE, MIN_LENGTH, PATTERN, REQUIRED, createManagedMetadataKey, IS_ASYNC_VALIDATION_RESOURCE, DEBOUNCER, signalErrorsToValidationErrors, reactiveErrorsToSignalErrors, shallowArrayEquals, submit, REGISTER_WEBMCP_FORM } from './_validation_errors-chunk.mjs'; | ||
| export { MetadataKey, MetadataReducer, apply, applyEach, applyWhen, applyWhenValue, createLimitSelectionKey, form, schema } from './_validation_errors-chunk.mjs'; | ||
@@ -1132,3 +1132,3 @@ import { DOCUMENT, isPlatformBrowser } from '@angular/common'; | ||
| minVersion: "12.0.0", | ||
| version: "22.0.0-rc.0", | ||
| version: "22.0.0-rc.1", | ||
| ngImport: i0, | ||
@@ -1141,3 +1141,3 @@ type: InputValidityMonitor, | ||
| minVersion: "12.0.0", | ||
| version: "22.0.0-rc.0", | ||
| version: "22.0.0-rc.1", | ||
| ngImport: i0, | ||
@@ -1151,3 +1151,3 @@ type: InputValidityMonitor, | ||
| minVersion: "12.0.0", | ||
| version: "22.0.0-rc.0", | ||
| version: "22.0.0-rc.1", | ||
| ngImport: i0, | ||
@@ -1215,3 +1215,3 @@ type: InputValidityMonitor, | ||
| minVersion: "12.0.0", | ||
| version: "22.0.0-rc.0", | ||
| version: "22.0.0-rc.1", | ||
| ngImport: i0, | ||
@@ -1224,3 +1224,3 @@ type: AnimationInputValidityMonitor, | ||
| minVersion: "12.0.0", | ||
| version: "22.0.0-rc.0", | ||
| version: "22.0.0-rc.1", | ||
| ngImport: i0, | ||
@@ -1232,3 +1232,3 @@ type: AnimationInputValidityMonitor | ||
| minVersion: "12.0.0", | ||
| version: "22.0.0-rc.0", | ||
| version: "22.0.0-rc.1", | ||
| ngImport: i0, | ||
@@ -1281,5 +1281,8 @@ type: AnimationInputValidityMonitor, | ||
| formField: this | ||
| })) ?? [], ...(ngDevMode ? [{ | ||
| debugName: "parseErrors" | ||
| }] : [])); | ||
| })) ?? [], { | ||
| ...(ngDevMode ? { | ||
| debugName: "parseErrors" | ||
| } : {}), | ||
| equal: shallowArrayEquals | ||
| }); | ||
| errors = computed(() => this.state().errors().filter(err => !err.formField || err.formField === this), { | ||
@@ -1410,3 +1413,3 @@ ...(ngDevMode ? { | ||
| minVersion: "12.0.0", | ||
| version: "22.0.0-rc.0", | ||
| version: "22.0.0-rc.1", | ||
| ngImport: i0, | ||
@@ -1419,3 +1422,3 @@ type: FormField, | ||
| minVersion: "17.1.0", | ||
| version: "22.0.0-rc.0", | ||
| version: "22.0.0-rc.1", | ||
| type: FormField, | ||
@@ -1454,3 +1457,3 @@ isStandalone: true, | ||
| minVersion: "12.0.0", | ||
| version: "22.0.0-rc.0", | ||
| version: "22.0.0-rc.1", | ||
| ngImport: i0, | ||
@@ -1508,3 +1511,3 @@ type: FormField, | ||
| minVersion: "12.0.0", | ||
| version: "22.0.0-rc.0", | ||
| version: "22.0.0-rc.1", | ||
| ngImport: i0, | ||
@@ -1517,3 +1520,3 @@ type: FormRoot, | ||
| minVersion: "17.1.0", | ||
| version: "22.0.0-rc.0", | ||
| version: "22.0.0-rc.1", | ||
| type: FormRoot, | ||
@@ -1544,3 +1547,3 @@ isStandalone: true, | ||
| minVersion: "12.0.0", | ||
| version: "22.0.0-rc.0", | ||
| version: "22.0.0-rc.1", | ||
| ngImport: i0, | ||
@@ -1570,3 +1573,89 @@ type: FormRoot, | ||
| export { BaseNgValidationError, EmailValidationError, FORM_FIELD, FormField, FormRoot, IS_ASYNC_VALIDATION_RESOURCE, MAX, MAX_DATE, MAX_LENGTH, MAX_NUMBER, MIN, MIN_DATE, MIN_LENGTH, MIN_NUMBER, MaxDateValidationError, MaxLengthValidationError, MaxValidationError, MinDateValidationError, MinLengthValidationError, MinValidationError, NativeInputParseError, NgValidationError, PATTERN, PatternValidationError, REQUIRED, RequiredValidationError, StandardSchemaValidationError, createManagedMetadataKey, createMetadataKey, debounce, disabled, email, emailError, hidden, max, maxDate, maxDateError, maxError, maxLength, maxLengthError, metadata, min, minDate, minDateError, minError, minLength, minLengthError, pattern, patternError, provideSignalFormsConfig, readonly, required, requiredError, standardSchemaError, submit, transformedValue, validate, validateAsync, validateHttp, validateStandardSchema, validateTree, ɵNgFieldDirective }; | ||
| const registerWebMcpForm = (formTree, options) => { | ||
| untracked(() => { | ||
| const node = formTree(); | ||
| const inputSchema = inferSchemaFromFieldNode(node); | ||
| if (!inputSchema) { | ||
| throw new Error(`Could not accurately infer WebMCP schema for form "${options.name}". ` + `Ensure that the form model does not contain null, undefined, empty arrays, or unsupported types.`); | ||
| } | ||
| declareExperimentalWebMcpTool({ | ||
| name: options.name, | ||
| description: options.description, | ||
| inputSchema, | ||
| execute: async args => { | ||
| node.value.set(args); | ||
| const success = await submit(formTree); | ||
| if (success) { | ||
| return { | ||
| content: [{ | ||
| type: 'text', | ||
| text: 'Form submitted successfully.' | ||
| }] | ||
| }; | ||
| } else { | ||
| const errorMessages = node.errorSummary().map(err => { | ||
| const fieldName = err.fieldTree().structure.pathKeys().join('.'); | ||
| return `${fieldName ? `${fieldName}: ` : ''}${err.message || err.kind}`; | ||
| }).join('\n'); | ||
| return { | ||
| content: [{ | ||
| type: 'text', | ||
| text: `Form submission failed:\n${errorMessages}` | ||
| }] | ||
| }; | ||
| } | ||
| } | ||
| }); | ||
| }); | ||
| }; | ||
| function inferSchemaFromFieldNode(node) { | ||
| const value = node.value(); | ||
| if (typeof value === 'string') return { | ||
| type: 'string' | ||
| }; | ||
| if (typeof value === 'number') return { | ||
| type: 'number' | ||
| }; | ||
| if (typeof value === 'boolean') return { | ||
| type: 'boolean' | ||
| }; | ||
| if (value === null || value === undefined) return undefined; | ||
| if (Array.isArray(value)) { | ||
| if (value.length === 0) return undefined; | ||
| const firstChild = node.structure.getChild('0'); | ||
| if (!firstChild) return undefined; | ||
| const itemSchema = inferSchemaFromFieldNode(firstChild); | ||
| if (!itemSchema) return undefined; | ||
| return { | ||
| type: 'array', | ||
| items: itemSchema | ||
| }; | ||
| } | ||
| if (typeof value === 'object') { | ||
| const properties = {}; | ||
| const required = []; | ||
| const children = node.structure.children(); | ||
| for (const child of children) { | ||
| const key = child.keyInParent(); | ||
| const childSchema = inferSchemaFromFieldNode(child); | ||
| if (!childSchema) return undefined; | ||
| properties[key] = childSchema; | ||
| if (child.required()) required.push(key.toString()); | ||
| } | ||
| return { | ||
| type: 'object', | ||
| properties, | ||
| required | ||
| }; | ||
| } | ||
| return undefined; | ||
| } | ||
| function provideExperimentalWebMcpForms() { | ||
| return makeEnvironmentProviders([{ | ||
| provide: REGISTER_WEBMCP_FORM, | ||
| useValue: registerWebMcpForm | ||
| }]); | ||
| } | ||
| export { BaseNgValidationError, EmailValidationError, FORM_FIELD, FormField, FormRoot, IS_ASYNC_VALIDATION_RESOURCE, MAX, MAX_DATE, MAX_LENGTH, MAX_NUMBER, MIN, MIN_DATE, MIN_LENGTH, MIN_NUMBER, MaxDateValidationError, MaxLengthValidationError, MaxValidationError, MinDateValidationError, MinLengthValidationError, MinValidationError, NativeInputParseError, NgValidationError, PATTERN, PatternValidationError, REQUIRED, RequiredValidationError, StandardSchemaValidationError, createManagedMetadataKey, createMetadataKey, debounce, disabled, email, emailError, hidden, max, maxDate, maxDateError, maxError, maxLength, maxLengthError, metadata, min, minDate, minDateError, minError, minLength, minLengthError, pattern, patternError, provideExperimentalWebMcpForms, provideSignalFormsConfig, readonly, required, requiredError, standardSchemaError, submit, transformedValue, validate, validateAsync, validateHttp, validateStandardSchema, validateTree, ɵNgFieldDirective }; | ||
| //# sourceMappingURL=signals.mjs.map |
+8
-4
| { | ||
| "name": "@angular/forms", | ||
| "version": "22.0.0-rc.0", | ||
| "version": "22.0.0-rc.1", | ||
| "description": "Angular - directives and services for creating forms", | ||
@@ -15,6 +15,10 @@ "author": "angular", | ||
| }, | ||
| "devDependencies": { | ||
| "@mcp-b/webmcp-polyfill": "^2.2.0", | ||
| "@mcp-b/webmcp-types": "^2.2.0" | ||
| }, | ||
| "peerDependencies": { | ||
| "@angular/core": "22.0.0-rc.0", | ||
| "@angular/common": "22.0.0-rc.0", | ||
| "@angular/platform-browser": "22.0.0-rc.0", | ||
| "@angular/core": "22.0.0-rc.1", | ||
| "@angular/common": "22.0.0-rc.1", | ||
| "@angular/platform-browser": "22.0.0-rc.1", | ||
| "rxjs": "^6.5.3 || ^7.4.0" | ||
@@ -21,0 +25,0 @@ }, |
| /** | ||
| * @license Angular v22.0.0-rc.0 | ||
| * @license Angular v22.0.0-rc.1 | ||
| * (c) 2010-2026 Google LLC. https://angular.dev/ | ||
@@ -4,0 +4,0 @@ * License: MIT |
+11
-3
| /** | ||
| * @license Angular v22.0.0-rc.0 | ||
| * @license Angular v22.0.0-rc.1 | ||
| * (c) 2010-2026 Google LLC. https://angular.dev/ | ||
@@ -8,3 +8,3 @@ * License: MIT | ||
| import * as i0 from '@angular/core'; | ||
| import { DebounceTimer, Signal, ResourceRef, InputSignal, InputSignalWithTransform, OutputRef, ModelSignal, WritableSignal } from '@angular/core'; | ||
| import { DebounceTimer, Signal, ResourceRef, InputSignal, InputSignalWithTransform, OutputRef, ModelSignal, WritableSignal, EnvironmentProviders } from '@angular/core'; | ||
| import { PathKind, SchemaPath, SchemaPathRules, LogicFn, OneOrMany, ValidationError, FieldValidator, FieldContext, TreeValidationResult, TreeValidator, WithOptionalFieldTree, DisabledReason, Debouncer, FieldTree } from './_structure-chunk.js'; | ||
@@ -760,3 +760,11 @@ export { AsyncValidationResult, BaseNgValidationError, ChildFieldContext, CompatFieldState, CompatSchemaPath, EmailValidationError, FORM_FIELD, Field, FieldState, FieldStateByMode, FormField, FormFieldBinding, FormFieldBindingOptions, FormOptions, FormSubmitOptions, IS_ASYNC_VALIDATION_RESOURCE, IgnoreUnknownProperties, ItemFieldContext, ItemType, LimitKey, LimitSelectionKey, MAX, MAX_DATE, MAX_LENGTH, MAX_NUMBER, MIN, MIN_DATE, MIN_LENGTH, MIN_NUMBER, MarkAsTouchedOptions, MaxDateValidationError, MaxLengthValidationError, MaxValidationError, MaybeFieldTree, MaybeSchemaPathTree, MetadataKey, MetadataReducer, MetadataSetterType, MinDateValidationError, MinLengthValidationError, MinValidationError, NativeInputParseError, NgValidationError, PATTERN, PatternValidationError, REQUIRED, ReadonlyArrayLike, ReadonlyCompatFieldState, ReadonlyFieldState, ReadonlyFieldTree, RemoveStringIndexUnknownKey, RequiredValidationError, RootFieldContext, Schema, SchemaFn, SchemaOrSchemaFn, SchemaPathTree, SignalFormsConfig, StandardSchemaValidationError, Subfields, ValidationErrorOptions, ValidationResult, ValidationSuccess, Validator, WithFieldTree, WithoutFieldTree, apply, applyEach, applyWhen, applyWhenValue, createLimitSelectionKey, createManagedMetadataKey, createMetadataKey, emailError, form, maxDateError, maxError, maxLengthError, metadata, minDateError, minError, minLengthError, patternError, provideSignalFormsConfig, requiredError, schema, standardSchemaError, submit, validateStandardSchema, ɵNgFieldDirective } from './_structure-chunk.js'; | ||
| export { Debouncer, DisabledReason, FieldContext, FieldTree, FieldValidator, FormRoot, LogicFn, OneOrMany, PathKind, SchemaPath, SchemaPathRules, TreeValidationResult, TreeValidator, ValidationError, WithOptionalFieldTree, debounce, disabled, email, hidden, max, maxDate, maxLength, min, minDate, minLength, pattern, readonly, required, transformedValue, validate, validateAsync, validateHttp, validateTree }; | ||
| /** | ||
| * Creates a provider that configures all signal forms with `experimentalWebMcpTool` | ||
| * to be registered as WebMCP tools. | ||
| * | ||
| * @experimental | ||
| */ | ||
| declare function provideExperimentalWebMcpForms(): EnvironmentProviders; | ||
| export { Debouncer, DisabledReason, FieldContext, FieldTree, FieldValidator, FormRoot, LogicFn, OneOrMany, PathKind, SchemaPath, SchemaPathRules, TreeValidationResult, TreeValidator, ValidationError, WithOptionalFieldTree, debounce, disabled, email, hidden, max, maxDate, maxLength, min, minDate, minLength, pattern, provideExperimentalWebMcpForms, readonly, required, transformedValue, validate, validateAsync, validateHttp, validateTree }; | ||
| export type { AsyncValidatorOptions, FormCheckboxControl, FormUiControl, FormValueControl, HttpValidatorOptions, MapToErrorsFn, ParseResult, TransformedValueOptions, TransformedValueSignal }; |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
1747025
1.04%18394
0.88%2
Infinity%