@@ -33,20 +33,6 @@ import { ɵFieldState } from '@angular/core';
3333import { ɵInteropControl } from ' @angular/core' ;
3434import { ɵɵcontrolCreate } from ' @angular/core' ;
3535
36- // @public
37- export function aggregateMetadata<TValue , TMetadataItem , TPathKind extends PathKind = PathKind .Root >(path : SchemaPath <TValue , SchemaPathRules .Supported , TPathKind >, key : AggregateMetadataKey <any , TMetadataItem >, logic : NoInfer <LogicFn <TValue , TMetadataItem , TPathKind >>): void ;
38-
39- // @public
40- export class AggregateMetadataKey <TAcc , TItem > {
41- // (undocumented)
42- readonly getInitial: () => TAcc ;
43- // (undocumented)
44- readonly reduce: (acc : TAcc , item : TItem ) => TAcc ;
45- }
46-
47- // @public
48- export function andMetadataKey(): AggregateMetadataKey <boolean , boolean >;
49-
5036// @public
5137export function apply<TValue >(path : SchemaPath <TValue >, schema : NoInfer <SchemaOrSchemaFn <TValue >>): void ;
5238
@@ -94,7 +80,16 @@ export type CompatSchemaPath<TControl extends AbstractControl, TPathKind extends
9480};
9581
9682// @public
97- export function createMetadataKey<TValue >(): MetadataKey <TValue >;
83+ export function createManagedMetadataKey<TRead , TWrite >(create : (s : Signal <TWrite | undefined >) => TRead ): MetadataKey <TRead , TWrite , TWrite | undefined >;
84+
85+ // @public
86+ export function createManagedMetadataKey<TRead , TWrite , TAcc >(create : (s : Signal <TAcc >) => TRead , reducer : MetadataReducer <TAcc , TWrite >): MetadataKey <TRead , TWrite , TAcc >;
87+
88+ // @public
89+ export function createMetadataKey<TWrite >(): MetadataKey <Signal <TWrite | undefined >, TWrite , TWrite | undefined >;
90+
91+ // @public
92+ export function createMetadataKey<TWrite , TAcc >(reducer : MetadataReducer <TAcc , TWrite >): MetadataKey <Signal <TAcc >, TWrite , TAcc >;
9893
9994// @public
10095export function customError<E extends Partial <ValidationError .WithField >>(obj : WithField <E >): CustomValidationError ;
@@ -179,12 +174,10 @@ export interface FieldState<TValue, TKey extends string | number = string | numb
179174 readonly errors: Signal <ValidationError .WithField []>;
180175 readonly errorSummary: Signal <ValidationError .WithField []>;
181176 readonly fieldBindings: Signal <readonly Field <unknown >[]>;
182- hasMetadata(key : MetadataKey <any > | AggregateMetadataKey <any , any >): boolean ;
183177 readonly hidden: Signal <boolean >;
184178 readonly invalid: Signal <boolean >;
185179 readonly keyInParent: Signal <TKey >;
186- metadata<M >(key : AggregateMetadataKey <M , any >): Signal <M >;
187- metadata<M >(key : MetadataKey <M >): M | undefined ;
180+ metadata<M >(key : MetadataKey <M , any , any >): M | undefined ;
188181 readonly pending: Signal <boolean >;
189182 reset(value ? : TValue ): void ;
190183 readonly submitting: Signal <boolean >;
@@ -270,23 +263,20 @@ export interface ItemFieldContext<TValue> extends ChildFieldContext<TValue> {
270263// @public
271264export type ItemType <T extends Object > = T extends ReadonlyArray <any > ? T [number ] : T [keyof T ];
272265
273- // @public
274- export function listMetadataKey<TItem >(): AggregateMetadataKey <TItem [], TItem | undefined >;
275-
276266// @public
277267export type LogicFn <TValue , TReturn , TPathKind extends PathKind = PathKind .Root > = (ctx : FieldContext <TValue , TPathKind >) => TReturn ;
278268
279269// @public
280270export type MapToErrorsFn <TValue , TResult , TPathKind extends PathKind = PathKind .Root > = (result : TResult , ctx : FieldContext <TValue , TPathKind >) => TreeValidationResult ;
281271
282272// @public
283- export const MAX: AggregateMetadataKey < number | undefined , number | undefined >;
273+ export const MAX: MetadataKey < Signal < number | undefined >, number | undefined , number | undefined >;
284274
285275// @public
286276export function max<TPathKind extends PathKind = PathKind .Root >(path : SchemaPath <number | string | null , SchemaPathRules .Supported , TPathKind >, maxValue : number | LogicFn <number | string | null , number | undefined , TPathKind >, config ? : BaseValidatorConfig <number | string | null , TPathKind >): void ;
287277
288278// @public
289- export const MAX_LENGTH: AggregateMetadataKey < number | undefined , number | undefined >;
279+ export const MAX_LENGTH: MetadataKey < Signal < number | undefined >, number | undefined , number | undefined >;
290280
291281// @public
292282export function maxError(max : number , options : WithField <ValidationErrorOptions >): MaxValidationError ;
@@ -312,9 +302,6 @@ export class MaxLengthValidationError extends _NgValidationError {
312302 readonly maxLength: number ;
313303}
314304
315- // @public
316- export function maxMetadataKey(): AggregateMetadataKey <number | undefined , number | undefined >;
317-
318305// @public
319306export class MaxValidationError extends _NgValidationError {
320307 constructor (max : number , options ? : ValidationErrorOptions );
@@ -331,23 +318,44 @@ export type MaybeFieldTree<TModel, TKey extends string | number = string | numbe
331318export type MaybeSchemaPathTree <TModel , TPathKind extends PathKind = PathKind .Root > = (TModel & undefined ) | SchemaPathTree <Exclude <TModel , undefined >, TPathKind >;
332319
333320// @public
334- export function metadata<TValue , TData , TPathKind extends PathKind = PathKind .Root >(path : SchemaPath <TValue , SchemaPathRules .Supported , TPathKind >, factory : ( ctx : FieldContext < TValue , TPathKind >) => TData ): MetadataKey < TData > ;
321+ export function metadata<TValue , TKey extends MetadataKey < any , any , any >, TPathKind extends PathKind = PathKind .Root >(path : SchemaPath <TValue , SchemaPathRules .Supported , TPathKind >, key : TKey , logic : NoInfer < LogicFn < TValue , MetadataSetterType < TKey >, TPathKind >> ): TKey ;
335322
336323// @public
337- export function metadata<TValue , TData , TPathKind extends PathKind = PathKind .Root >(path : SchemaPath <TValue , SchemaPathRules .Supported , TPathKind >, key : MetadataKey <TData >, factory : (ctx : FieldContext <TValue , TPathKind >) => TData ): MetadataKey <TData >;
324+ export class MetadataKey <TRead , TWrite , TAcc > {
325+ protected constructor (reducer : MetadataReducer <TAcc , TWrite >, create : ((s : Signal <TAcc >) => TRead ) | undefined );
326+ // (undocumented)
327+ readonly create: ((s : Signal <TAcc >) => TRead ) | undefined ;
328+ // (undocumented)
329+ readonly reducer: MetadataReducer <TAcc , TWrite >;
330+ }
338331
339332// @public
340- export class MetadataKey <TValue > {
333+ export interface MetadataReducer <TAcc , TItem > {
334+ getInitial: () => TAcc ;
335+ reduce: (acc : TAcc , item : TItem ) => TAcc ;
341336}
342337
338+ // @public (undocumented)
339+ export const MetadataReducer: {
340+ readonly list: <TItem >() => MetadataReducer <TItem [], TItem | undefined >;
341+ readonly min: () => MetadataReducer <number | undefined , number | undefined >;
342+ readonly max: () => MetadataReducer <number | undefined , number | undefined >;
343+ readonly or: () => MetadataReducer <boolean , boolean >;
344+ readonly and: () => MetadataReducer <boolean , boolean >;
345+ readonly override: typeof override ;
346+ };
347+
343348// @public
344- export const MIN: AggregateMetadataKey <number | undefined , number | undefined >;
349+ export type MetadataSetterType <TKey > = TKey extends MetadataKey <any , infer TWrite , any > ? TWrite : never ;
350+
351+ // @public
352+ export const MIN: MetadataKey <Signal <number | undefined >, number | undefined , number | undefined >;
345353
346354// @public
347355export function min<TValue extends number | string | null , TPathKind extends PathKind = PathKind .Root >(path : SchemaPath <TValue , SchemaPathRules .Supported , TPathKind >, minValue : number | LogicFn <TValue , number | undefined , TPathKind >, config ? : BaseValidatorConfig <TValue , TPathKind >): void ;
348356
349357// @public
350- export const MIN_LENGTH: AggregateMetadataKey < number | undefined , number | undefined >;
358+ export const MIN_LENGTH: MetadataKey < Signal < number | undefined >, number | undefined , number | undefined >;
351359
352360// @public
353361export function minError(min : number , options : WithField <ValidationErrorOptions >): MinValidationError ;
@@ -373,9 +381,6 @@ export class MinLengthValidationError extends _NgValidationError {
373381 readonly minLength: number ;
374382}
375383
376- // @public
377- export function minMetadataKey(): AggregateMetadataKey <number | undefined , number | undefined >;
378-
379384// @public
380385export class MinValidationError extends _NgValidationError {
381386 constructor (min : number , options ? : ValidationErrorOptions );
@@ -394,9 +399,6 @@ export type NgValidationError = RequiredValidationError | MinValidationError | M
394399// @public
395400export type OneOrMany <T > = T | readonly T [];
396401
397- // @public
398- export function orMetadataKey(): AggregateMetadataKey <boolean , boolean >;
399-
400402// @public
401403export type PathKind = PathKind .Root | PathKind .Child | PathKind .Item ;
402404
@@ -416,7 +418,7 @@ export namespace PathKind {
416418}
417419
418420// @public
419- export const PATTERN: AggregateMetadataKey < RegExp [], RegExp | undefined >;
421+ export const PATTERN: MetadataKey < Signal < RegExp []> , RegExp | undefined , RegExp [] >;
420422
421423// @public
422424export function pattern<TPathKind extends PathKind = PathKind .Root >(path : SchemaPath <string , SchemaPathRules .Supported , TPathKind >, pattern : RegExp | LogicFn <string | undefined , RegExp | undefined , TPathKind >, config ? : BaseValidatorConfig <string , TPathKind >): void ;
@@ -445,14 +447,11 @@ export function readonly<TValue, TPathKind extends PathKind = PathKind.Root>(pat
445447// @public
446448export type ReadonlyArrayLike <T > = Pick <ReadonlyArray <T >, number | ' length' | typeof Symbol .iterator >;
447449
448- // @public
449- export function reducedMetadataKey<TAcc , TItem >(reduce : (acc : TAcc , item : TItem ) => TAcc , getInitial : NoInfer <() => TAcc >): AggregateMetadataKey <TAcc , TItem >;
450-
451450// @public
452451export type RemoveStringIndexUnknownKey <K , V > = string extends K ? unknown extends V ? never : K : K ;
453452
454453// @public
455- export const REQUIRED: AggregateMetadataKey < boolean , boolean >;
454+ export const REQUIRED: MetadataKey < Signal < boolean >, boolean , boolean >;
456455
457456// @public
458457export function required<TValue , TPathKind extends PathKind = PathKind .Root >(path : SchemaPath <TValue , SchemaPathRules .Supported , TPathKind >, config ? : BaseValidatorConfig <TValue , TPathKind > & {
0 commit comments