@angular/forms
Advanced tools
| /** | ||
| * @license Angular v22.0.0 | ||
| * @license Angular v22.0.1 | ||
| * (c) 2010-2026 Google LLC. https://angular.dev/ | ||
@@ -4,0 +4,0 @@ * License: MIT |
| /** | ||
| * @license Angular v22.0.0 | ||
| * @license Angular v22.0.1 | ||
| * (c) 2010-2026 Google LLC. https://angular.dev/ | ||
@@ -4,0 +4,0 @@ * License: MIT |
+65
-55
| /** | ||
| * @license Angular v22.0.0 | ||
| * @license Angular v22.0.1 | ||
| * (c) 2010-2026 Google LLC. https://angular.dev/ | ||
@@ -8,7 +8,7 @@ * 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, makeEnvironmentProviders, declareExperimentalWebMcpTool } from '@angular/core'; | ||
| import { InjectionToken, debounced, computed, ɵchain as _chain, resource, ɵisPromise as _isPromise, linkedSignal, inject, ɵRuntimeError as _RuntimeError, untracked, signal, CSP_NONCE, 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, shallowArrayEquals, signalErrorsToValidationErrors, reactiveErrorsToSignalErrors, submit, REGISTER_WEBMCP_FORM } from './_validation_errors-chunk.mjs'; | ||
| export { MetadataKey, MetadataReducer, apply, applyEach, applyWhen, applyWhenValue, createLimitSelectionKey, form, schema } from './_validation_errors-chunk.mjs'; | ||
| import { DOCUMENT, isPlatformBrowser } from '@angular/common'; | ||
| import { DOCUMENT } from '@angular/common'; | ||
| import { httpResource } from '@angular/common/http'; | ||
@@ -1098,3 +1098,3 @@ import '@angular/core/primitives/signals'; | ||
| if (isInput(input) && inputRequiresValidityTracking(input)) { | ||
| validityMonitor.watchValidity(input, () => parser.setRawValue(undefined)); | ||
| validityMonitor.watchValidity(parent.destroyRef, input, () => parser.setRawValue(undefined)); | ||
| } | ||
@@ -1134,3 +1134,3 @@ parent.registerAsBinding(); | ||
| minVersion: "12.0.0", | ||
| version: "22.0.0", | ||
| version: "22.0.1", | ||
| ngImport: i0, | ||
@@ -1143,3 +1143,3 @@ type: InputValidityMonitor, | ||
| minVersion: "12.0.0", | ||
| version: "22.0.0", | ||
| version: "22.0.1", | ||
| ngImport: i0, | ||
@@ -1153,3 +1153,3 @@ type: InputValidityMonitor, | ||
| minVersion: "12.0.0", | ||
| version: "22.0.0", | ||
| version: "22.0.1", | ||
| ngImport: i0, | ||
@@ -1170,6 +1170,5 @@ type: InputValidityMonitor, | ||
| }); | ||
| isBrowser = isPlatformBrowser(inject(PLATFORM_ID)); | ||
| injectedStyles = new WeakMap(); | ||
| watchValidity(element, callback) { | ||
| if (!this.isBrowser) { | ||
| watchValidity(destroyRef, element, callback) { | ||
| if (typeof ngServerMode !== 'undefined' && ngServerMode) { | ||
| return; | ||
@@ -1181,3 +1180,3 @@ } | ||
| } | ||
| element.addEventListener('animationstart', event => { | ||
| const onAnimationStart = event => { | ||
| const animationEvent = event; | ||
@@ -1187,2 +1186,6 @@ if (animationEvent.animationName === 'ng-valid' || animationEvent.animationName === 'ng-invalid') { | ||
| } | ||
| }; | ||
| element.addEventListener('animationstart', onAnimationStart); | ||
| destroyRef.onDestroy(() => { | ||
| element.removeEventListener('animationstart', onAnimationStart); | ||
| }); | ||
@@ -1220,3 +1223,3 @@ } | ||
| minVersion: "12.0.0", | ||
| version: "22.0.0", | ||
| version: "22.0.1", | ||
| ngImport: i0, | ||
@@ -1229,3 +1232,3 @@ type: AnimationInputValidityMonitor, | ||
| minVersion: "12.0.0", | ||
| version: "22.0.0", | ||
| version: "22.0.1", | ||
| ngImport: i0, | ||
@@ -1237,3 +1240,3 @@ type: AnimationInputValidityMonitor | ||
| minVersion: "12.0.0", | ||
| version: "22.0.0", | ||
| version: "22.0.1", | ||
| ngImport: i0, | ||
@@ -1417,3 +1420,3 @@ type: AnimationInputValidityMonitor, | ||
| minVersion: "12.0.0", | ||
| version: "22.0.0", | ||
| version: "22.0.1", | ||
| ngImport: i0, | ||
@@ -1426,3 +1429,3 @@ type: FormField, | ||
| minVersion: "17.1.0", | ||
| version: "22.0.0", | ||
| version: "22.0.1", | ||
| type: FormField, | ||
@@ -1461,3 +1464,3 @@ isStandalone: true, | ||
| minVersion: "12.0.0", | ||
| version: "22.0.0", | ||
| version: "22.0.1", | ||
| ngImport: i0, | ||
@@ -1515,3 +1518,3 @@ type: FormField, | ||
| minVersion: "12.0.0", | ||
| version: "22.0.0", | ||
| version: "22.0.1", | ||
| ngImport: i0, | ||
@@ -1524,3 +1527,3 @@ type: FormRoot, | ||
| minVersion: "17.1.0", | ||
| version: "22.0.0", | ||
| version: "22.0.1", | ||
| type: FormRoot, | ||
@@ -1551,3 +1554,3 @@ isStandalone: true, | ||
| minVersion: "12.0.0", | ||
| version: "22.0.0", | ||
| version: "22.0.1", | ||
| ngImport: i0, | ||
@@ -1577,39 +1580,45 @@ type: FormRoot, | ||
| 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}` | ||
| }] | ||
| }; | ||
| } | ||
| } | ||
| const registerWebMcpForm = async (formTree, options) => { | ||
| const injector = inject(Injector); | ||
| effect(() => { | ||
| untracked(() => { | ||
| initWebMcpForm(formTree, options, injector); | ||
| }); | ||
| }); | ||
| }; | ||
| function initWebMcpForm(formTree, options, injector) { | ||
| 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}` | ||
| }] | ||
| }; | ||
| } | ||
| } | ||
| }, injector); | ||
| } | ||
| function inferSchemaFromFieldNode(node) { | ||
@@ -1652,3 +1661,4 @@ const value = node.value(); | ||
| properties, | ||
| required | ||
| required, | ||
| additionalProperties: false | ||
| }; | ||
@@ -1655,0 +1665,0 @@ } |
+4
-4
| { | ||
| "name": "@angular/forms", | ||
| "version": "22.0.0", | ||
| "version": "22.0.1", | ||
| "description": "Angular - directives and services for creating forms", | ||
@@ -20,5 +20,5 @@ "author": "angular", | ||
| "peerDependencies": { | ||
| "@angular/core": "22.0.0", | ||
| "@angular/common": "22.0.0", | ||
| "@angular/platform-browser": "22.0.0", | ||
| "@angular/core": "22.0.1", | ||
| "@angular/common": "22.0.1", | ||
| "@angular/platform-browser": "22.0.1", | ||
| "rxjs": "^6.5.3 || ^7.4.0" | ||
@@ -25,0 +25,0 @@ }, |
| /** | ||
| * @license Angular v22.0.0 | ||
| * @license Angular v22.0.1 | ||
| * (c) 2010-2026 Google LLC. https://angular.dev/ | ||
@@ -4,0 +4,0 @@ * License: MIT |
| /** | ||
| * @license Angular v22.0.0 | ||
| * @license Angular v22.0.1 | ||
| * (c) 2010-2026 Google LLC. https://angular.dev/ | ||
@@ -4,0 +4,0 @@ * License: MIT |
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 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
1747620
0.05%18414
0.09%