@dvirus-js/angular-signals 0.0.16 → 0.0.18
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.
- package/README.md +8 -25
- package/fesm2022/dvirus-js-angular-signals-signal-form.mjs +1409 -0
- package/fesm2022/dvirus-js-angular-signals-signal-form.mjs.map +1 -0
- package/fesm2022/dvirus-js-angular-signals.mjs +1 -1401
- package/fesm2022/dvirus-js-angular-signals.mjs.map +1 -1
- package/package.json +5 -1
- package/types/dvirus-js-angular-signals-signal-form.d.ts +1000 -0
- package/types/dvirus-js-angular-signals.d.ts +2 -997
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dvirus-js-angular-signals.mjs","sources":["../../../../../packages/angular/signals/src/lib/utils/signals.utils.ts","../../../../../packages/angular/signals/src/lib/signal-form/errors.ts","../../../../../packages/angular/signals/src/lib/utils/signal-notifier.ts","../../../../../packages/angular/signals/src/lib/utils/try-catch.ts","../../../../../packages/angular/signals/src/lib/utils/signal-debounce.ts","../../../../../packages/angular/signals/src/lib/utils/writable-signal.ts","../../../../../packages/angular/signals/src/lib/utils/signal-set.ts","../../../../../packages/angular/signals/src/lib/utils/signal-map.ts","../../../../../packages/angular/signals/src/lib/utils/signal-object.ts","../../../../../packages/angular/signals/src/lib/utils/control-signal.ts","../../../../../packages/angular/signals/src/lib/signal-form/control.ts","../../../../../packages/angular/signals/src/lib/signal-form/form.ts","../../../../../packages/angular/signals/src/lib/signal-form/array.ts","../../../../../packages/angular/signals/src/lib/signal-form/validators.ts","../../../../../packages/angular/signals/src/lib/signal-form/index.ts","../../../../../packages/angular/signals/src/dvirus-js-angular-signals.ts"],"sourcesContent":["import { isSignal, signal, Signal, WritableSignal } from '@angular/core';\nimport { ObjectType } from './object-type';\n\n\n/**\n * Represents an object where each property is a read-only Signal.\n * Useful for mapping state objects to their signal equivalents.\n */\nexport type SignalObj<T extends ObjectType = ObjectType> = {\n [Key in keyof T]: Signal<T[Key]>;\n};\n\n/**\n * Represents an object where each property is a WritableSignal.\n * Allows for direct modification of the signal values within the object structure.\n */\nexport type SignalObjWritable<T extends ObjectType> = {\n [Key in keyof T]: WritableSignal<T[Key]>;\n};\n\n/**\n * A type representing either a Signal of type T or the raw value of type T.\n * Useful for inputs that can accept both static values and reactive signals.\n */\nexport type SignalOrValue<T> = Signal<T> | T;\n\n/**\n * Represents an object where each property can be either a Signal of a certain type\n * or the raw value of that type.\n *\n * @template TValues The type of the values contained within the SignalOrValue properties.\n * Defaults to a union of ObjectType, string, number, or undefined.\n */\nexport type SignalOrValueObj<TValues = ObjectType | string | number | boolean | undefined> =\n TValues extends object\n ? { [Key in keyof TValues]: SignalOrValue<TValues[Key]> }\n : Record<string, SignalOrValue<TValues>>;\n\n/**\n * Converts a plain object into a writable signal object.\n * Each property of the source object becomes a WritableSignal initialized with the property's value.\n *\n * @param src - The source object to convert.\n * @returns An object with the same keys as the source, but with values wrapped in WritableSignals.\n */\nexport function toSignalObj<T extends ObjectType>(src: T): SignalObjWritable<T> {\n return Object.entries(src).reduce(\n (prev, [key, value]) => ({ ...prev, [key]: signal(value) }),\n {} as SignalObjWritable<T>,\n );\n}\n\n/**\n * Converts a signal object into a plain object.\n * Each property of the signal object becomes a value from the signal.\n *\n * @param src - The signal object to convert.\n * @returns An object with the same keys as the source, but with values from the signals.\n */\nexport function fromSignalObj<TData extends ObjectType>(src: SignalOrValueObj<TData>): TData {\n return Object.entries(src).reduce<TData>(\n (prev, [key, $value]) => ({ ...prev, [key]: signalOrValue($value) }),\n {} as TData,\n );\n}\n\n/**\n * Unwraps a value that might be a Signal.\n * If the input is a Signal, it returns the signal's value.\n * If the input is a raw value, it returns the value itself.\n *\n * @param value - The signal or value to unwrap.\n * @returns The raw value of type T.\n */\nexport function signalOrValue<T>(value: SignalOrValue<T>): T {\n return isSignal(value) ? value() : value;\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function signalOrFunction<T, FnArgs extends any[] = []>(\n value: SignalOrValue<T> | ((...args: FnArgs) => T),\n ...fnArgs: FnArgs\n): T {\n let res = value;\n if (isSignal(res)) {\n res = res();\n }\n if (typeof res == 'function') {\n res = (res as (...args: FnArgs[]) => T)(...fnArgs);\n }\n\n return res;\n}\n\n// function main() {\n// const signalOrValue1: SignalOrValue<number> = signal(42);\n// const signalOrValue2: SignalOrValue<string> = 'Hello, World!';\n\n// console.log(signalOrValue(signalOrValue1)); // 42\n// console.log(signalOrValue(signalOrValue2)); // \"Hello, World!\"\n\n// // #############################################################\n\n// const signalOrFunction1: SignalOrValue<number> | (() => number) = signal(100);\n// const signalOrFunction2: SignalOrValue<number> | (() => number) = () => 200;\n// const signalOrFunction3: SignalOrValue<number> | (() => number) = 300;\n// const signalOrFunction4: SignalOrValue<number> | ((a: number, b: number) => number) = (a, b) => {\n// return a + b;\n// };\n\n// console.log(signalOrFunction(signalOrFunction1)); // 100\n// console.log(signalOrFunction(signalOrFunction2)); // 200\n// console.log(signalOrFunction(signalOrFunction3)); // 300\n// console.log(signalOrFunction(signalOrFunction4, 5, 10)); // 15\n\n// // #############################################################\n\n// const signalObj1: SignalObj<{ a: number; b: string }> = {\n// a: signal(10),\n// b: computed(() => 'Test'),\n// };\n// console.log(signalObj1); // { a: Signal<number>, b: Signal<string> }\n\n// const signalObjWritable1: SignalObjWritable<{ a: number; b: string }> = toSignalObj({\n// a: 10,\n// b: 'Test',\n// });\n// console.log(signalObjWritable1); // { a: WritableSignal<number>, b: WritableSignal<string> }\n\n// const plainObj1 = fromSignalObj(signalObj1);\n// console.log(plainObj1); // { a: 10, b: 'Test' }\n\n// const plainObj2 = fromSignalObj(signalObjWritable1);\n// console.log(plainObj2); // { a: 10, b: 'Test' }\n// }\n","import {\n SignalFormContext,\n SignalFormValidationError,\n SignalFormValidatorFn,\n} from './types';\n\n/**\n * Normalizes a validation error object by filtering out empty/null values.\n * \n * Converts a raw validation result into a clean error map containing only\n * non-empty string messages. Filters out undefined, null, and empty strings.\n * \n * @param error - Raw validation error object or null\n * @returns Clean error map with only valid error messages\n * \n * @example\n * ```typescript\n * normalizeValidationError({ required: 'Error', empty: '', invalid: null });\n * // Returns: { required: 'Error' }\n * ```\n */\nexport function normalizeValidationError(\n error: SignalFormValidationError,\n): Record<string, string> {\n if (!error) return {};\n return Object.entries(error).reduce<Record<string, string>>(\n (acc, [key, val]) => {\n if (typeof val === 'string' && val.length > 0) {\n acc[key] = val;\n }\n return acc;\n },\n {},\n );\n}\n\n/**\n * Executes an array of validators and collects all error messages.\n * \n * Runs each validator function with the provided context and merges all\n * error messages into a single error map. Empty/null results are filtered out.\n * \n * @template TControls - Object type defining available sibling controls\n * @template TValue - The type of value being validated\n * \n * @param validators - Array of validator functions to execute\n * @param ctx - Validation context with current value and control accessor\n * @returns Combined error map from all validators\n * \n * @example\n * ```typescript\n * const errors = collectValidationErrors(\n * [signalFormValidators.required, signalFormValidators.minLength(3)],\n * { item: { value: '' }, getControl: () => {} }\n * );\n * // Returns: { required: 'This field is required' }\n * ```\n */\nexport function collectValidationErrors<TControls extends object, TValue>(\n validators: SignalFormValidatorFn<TControls, TValue>[] | undefined,\n ctx: SignalFormContext<TControls, TValue>,\n): Record<string, string> {\n if (!validators?.length) return {};\n return validators.reduce<Record<string, string>>((acc, validator) => {\n const normalized = normalizeValidationError(validator(ctx));\n Object.entries(normalized).forEach(([key, val]) => {\n acc[key] = val;\n });\n return acc;\n }, {});\n}\n\n/**\n * Checks if an error map contains any errors.\n * \n * Simple utility to determine if a control has validation errors by\n * checking if the error map object has any keys.\n * \n * @param errorMap - Error map to check\n * @returns True if there are any errors, false if empty\n * \n * @example\n * ```typescript\n * hasErrors({ required: 'Error' }); // true\n * hasErrors({}); // false\n * ```\n */\nexport function hasErrors(errorMap: Record<string, string>): boolean {\n return Object.keys(errorMap).length > 0;\n}\n\n/**\n * Recursively checks if an error tree structure is completely empty.\n * \n * Traverses nested error structures (objects and arrays) to determine if\n * there are any actual error messages anywhere in the tree. Returns true\n * only when the entire structure contains no errors.\n * \n * @param value - Error tree to check (can be nested objects/arrays)\n * @returns True if no errors exist anywhere in the tree\n * \n * @example\n * ```typescript\n * isEmptyErrorTree({ name: undefined, address: { street: undefined } }); // true\n * isEmptyErrorTree({ name: { required: 'Error' } }); // false\n * isEmptyErrorTree([undefined, undefined]); // true\n * ```\n */\nexport function isEmptyErrorTree(value: unknown): boolean {\n if (value === null || value === undefined) return true;\n if (Array.isArray(value)) {\n return value.every(isEmptyErrorTree);\n }\n if (typeof value === 'object') {\n return Object.values(value as Record<string, unknown>).every(\n isEmptyErrorTree,\n );\n }\n return false;\n}\n","import { signal } from '@angular/core';\n\n/**\n * A function interface for a signal-based notification mechanism.\n * Calling the function returns the current notification count.\n * Calling `notify()` increments the count, triggering any listeners.\n */\nexport interface SignalNotifier {\n (): number;\n /**\n * Triggers a notification by incrementing the internal signal value.\n */\n notify: () => void;\n}\n\n/**\n * Creates a signal-based notifier function.\n *\n * Each call to the returned function returns the current notification count.\n * Calling `notify()` increments the count, triggering any listeners.\n *\n * @returns {SignalNotifier} A notifier function with a `notify` method.\n *\n * @example\n * const notifier = signalNotifier();\n * effect(() => {\n * notifier(); // Reacts to notifications\n * });\n * notifier.notify(); // Triggers the effect\n */\nexport function signalNotifier(): SignalNotifier {\n const _signal = signal(0);\n\n function get(): number {\n return _signal();\n }\n\n get.notify = (): void => _signal.update((n) => n + 1);\n\n return get;\n}\n","/**\n * Types for the result tuple with discriminated union\n * @template T - Type of the successful result\n * @template E - Type of the error, defaults to Error\n */\ntype TryResult<T, E = Error> = [T, null] | [null, E];\n\n/**\n * Main wrapper function to handle promise with try-catch\n * @template T - Type of the successful result\n * @template E - Type of the error, defaults to Error\n * @param {()=> T} fn - The function to handle\n * @returns {TryResult<T, E>} - A tuple with either the result or the error\n */\nexport function tryCatch<T, E = Error>(fn: () => T): TryResult<T, E> {\n try {\n const val = fn();\n return [val, null];\n } catch (error) {\n return [null, error as E];\n }\n}\n","import {\n DestroyRef,\n effect,\n inject,\n Injector,\n Signal,\n signal,\n untracked,\n WritableSignal,\n} from '@angular/core';\nimport { tryCatch } from './try-catch';\n\n/**\n * A writable signal enhanced with debounce capabilities.\n *\n * Extends `WritableSignal<T>` so it can be read and written like a normal signal,\n * but also exposes a `setDebounced` method that applies values after a configurable delay\n * and an `isLoading` signal that indicates whether a debounced update is pending.\n *\n * @typeParam T - The type of the signal's value.\n */\nexport interface SignalDebounce<T> extends WritableSignal<T> {\n /** Sets the signal value after the configured debounce delay. */\n setDebounced(value: T): void;\n /** Reactive flag that is `true` while a debounced update is pending. */\n isLoading: Signal<boolean>;\n}\n\n/**\n * Creates a debounced writable signal.\n *\n * The returned signal can be written to instantly via its `WritableSignal` interface\n * **or** through `setDebounced(value)` which delays the commit by `debounceTime` ms.\n * While a debounced write is pending, `isLoading()` returns `true`.\n *\n * If a reactive `params` function is supplied, the signal will also track that\n * source and debounce upstream changes (requires an injection context).\n *\n * @typeParam T - The type of the signal's value.\n * @param options - Configuration object.\n * @param options.source - Optional reactive source function whose return value\n * is tracked and debounced into the signal.\n * @param options.debounceTime - Delay in milliseconds before a debounced value\n * is committed.\n * @param options.initialValue - Optional initial value for the signal.\n * @param options.injector - Optional Angular `Injector` to use for setting up\n * reactive tracking. Required if `source` is provided and this function is called\n * outside of an injection context.\n * @returns A `SignalDebounce<T>` instance.\n *\n * @example\n * ```ts\n * // Simple debounced signal with an initial value\n * const search = signalDebounce<string>({ debounceTime: 300, initialValue: '' });\n * search.setDebounced('hello'); // commits after 300 ms\n *\n * // Tracking a reactive source\n * const query = signal('angular');\n * const debounced = signalDebounce({ source: () => query(), debounceTime: 500 });\n * ```\n */\nexport function signalDebounce<T>(options: {\n source?: () => T;\n debounceTime: number;\n initialValue?: T;\n injector?: unknown;\n}): SignalDebounce<T> {\n const timeout = signal<ReturnType<typeof setTimeout> | null>(null);\n const isLoading = signal(false);\n const _sig = signal(options.initialValue) as WritableSignal<T>;\n\n const scheduleDebounce = (value: T): void => {\n clearPendingTimeout(timeout);\n isLoading.set(true);\n timeout.set(\n setTimeout(() => {\n isLoading.set(false);\n _sig.set(value);\n }, options.debounceTime),\n );\n };\n\n if (options.source) {\n trackSource({\n source: options.source,\n scheduleDebounce,\n timeout,\n injector: options.injector as Injector,\n });\n }\n\n return Object.assign(_sig, {\n setDebounced: scheduleDebounce,\n isLoading: isLoading.asReadonly(),\n }) as SignalDebounce<T>;\n}\n\n/**\n * Clears a pending debounce timeout if one exists.\n * @internal\n */\nfunction clearPendingTimeout(\n timeout: WritableSignal<ReturnType<typeof setTimeout> | null>,\n): void {\n const t = timeout();\n if (t) clearTimeout(t);\n}\n\n/**\n * Sets up an effect that tracks a reactive source and debounces its changes.\n *\n * Requires an Angular injection context. If called outside one, logs a warning\n * and returns without setting up tracking (manual `setDebounced` still works).\n *\n * @typeParam T - The type of the source value.\n * @param source - Reactive function to track.\n * @param scheduleDebounce - Callback that schedules a debounced write.\n * @param timeout - Shared timeout handle for cleanup on destroy.\n * @internal\n */\nfunction trackSource<T>({\n source,\n scheduleDebounce,\n timeout,\n injector,\n}: {\n source: () => T;\n scheduleDebounce: (value: T) => void;\n timeout: WritableSignal<ReturnType<typeof setTimeout> | null>;\n injector?: Injector;\n}): void {\n if (!isInInjectionContext() && !injector) {\n console.error(\n 'Warning: signalDebounce is being used outside of an injection context. The debounced signal will not update based on the provided signal.\\n\\n',\n \"Still can be used with manual value updates via setDebounced, but won't react to changes in the provided signal.\",\n );\n return;\n }\n\n const _injector = injector ?? inject(Injector);\n const destroyRef = _injector.get(DestroyRef) ?? inject(DestroyRef);\n\n effect(\n () => {\n const val = source();\n untracked(() => scheduleDebounce(val));\n },\n { injector: _injector },\n );\n\n destroyRef.onDestroy(() => clearPendingTimeout(timeout));\n}\n\n/**\n * Checks if the current execution context has access to Angular's dependency injection.\n * @returns `true` when inside an injection context, `false` otherwise.\n * @internal\n */\nfunction isInInjectionContext(): boolean {\n const [, error] = tryCatch(() => inject(DestroyRef));\n return !error;\n}\n","import {\n computed,\n Signal,\n signal,\n untracked,\n WritableSignal,\n} from '@angular/core';\n\n/**\n * Type for value equality comparison function\n */\ntype ValueEqualityFn<T> = (a: T, b: T) => boolean;\n\n/**\n * Creates a `WritableSignal` whose value is derived from a computation function,\n * but can also be overridden manually via `.set()` / `.update()`.\n * When the reactive dependencies inside the computation change, the signal resets to the new derived value.\n *\n * Angular-16 compatible alternative to `linkedSignal` (Angular 19+).\n *\n * @overload\n * @param computation - A computation function that returns the derived value\n * @param options - Optional configuration (equal, debugName)\n * @returns A WritableSignal<D>\n */\nexport function writableSignal<D>(\n computation: () => D,\n options?: {\n equal?: ValueEqualityFn<D>;\n debugName?: string;\n },\n): WritableSignal<D>;\n\n/**\n * Creates a `WritableSignal` with explicit source tracking and computation.\n * The `source` function provides the reactive dependencies, and the `computation` function derives the value from the source.\n * Manual overrides via `.set()` / `.update()` are only valid for the specific source state they were set against.\n *\n * Angular-16 compatible alternative to `linkedSignal` (Angular 19+).\n *\n * @overload\n * @param options - Configuration object with source tracking and computation\n * @returns A WritableSignal<D>\n */\nexport function writableSignal<S, D>(options: {\n source: () => S;\n computation: (source: S, previous?: { source: S; value: D }) => D;\n equal?: ValueEqualityFn<D>;\n debugName?: string;\n}): WritableSignal<D>;\n\nexport function writableSignal<D, S = unknown>(\n computationOrOptions:\n | (() => D)\n | {\n source: () => S;\n computation: (source: S, previous?: { source: S; value: D }) => D;\n equal?: ValueEqualityFn<D>;\n debugName?: string;\n },\n maybeOptions?: {\n equal?: ValueEqualityFn<D>;\n debugName?: string;\n },\n): WritableSignal<D> {\n // Determine if input is a function or options object\n const isFunction = typeof computationOrOptions === 'function';\n\n if (isFunction) {\n return writableSignalFunctionOverload(computationOrOptions, maybeOptions);\n } else {\n return writableSignalOptionsOverload(computationOrOptions);\n }\n}\n\nfunction writableSignalFunctionOverload<D>(\n computation: () => D,\n options?: {\n equal?: ValueEqualityFn<D>;\n debugName?: string;\n },\n): WritableSignal<D> {\n // Create a fresh token whenever the source recomputes, even if the value is equal.\n const sourceState = computed(() => ({ value: computation() }), {\n equal: (a, b) =>\n options?.equal ? options.equal(a.value, b.value) : a.value === b.value,\n });\n\n // Manual overrides are only valid for the source-state token they were set against.\n const override = signal<{ state: { value: D }; value: D } | undefined>(\n undefined,\n );\n\n const result = computed<D>(\n () => {\n const state = sourceState();\n const currentOverride = override();\n if (currentOverride !== undefined && currentOverride.state === state) {\n return currentOverride.value;\n }\n return state.value;\n },\n { equal: options?.equal },\n );\n\n return Object.assign(result, {\n set(v: D): void {\n override.set({ state: untracked(sourceState), value: v });\n },\n update(updater: (value: D) => D): void {\n override.set({\n state: untracked(sourceState),\n value: updater(untracked(result)),\n });\n },\n asReadonly(): Signal<D> {\n return result;\n },\n }) as WritableSignal<D>;\n}\n\nfunction writableSignalOptionsOverload<S, D>(options: {\n source: () => S;\n computation: (source: S, previous?: { source: S; value: D }) => D;\n equal?: ValueEqualityFn<D>;\n debugName?: string;\n}): WritableSignal<D> {\n let previousState: { source: S; value: D } | undefined;\n const sourceState = computed(() => ({ value: options.source() }));\n const override = signal<{ state: { value: D }; value: D } | undefined>(\n undefined,\n );\n\n const result = computed<D>(\n () => {\n const state = sourceState();\n\n const currentOverride = override();\n\n if (\n currentOverride !== undefined &&\n (currentOverride.state as unknown as { value: S }) === state\n ) {\n // Update previous state for next computation\n previousState = { source: state.value, value: currentOverride.value };\n return currentOverride.value;\n }\n\n const computedValue = options.computation(state.value, previousState);\n\n // Update previous state for next computation\n previousState = { source: state.value, value: computedValue };\n\n return computedValue;\n },\n { equal: options.equal },\n );\n\n return Object.assign(result, {\n set(v: D): void {\n override.set({\n state: untracked(sourceState) as unknown as { value: D },\n value: v,\n });\n },\n update(updater: (value: D) => D): void {\n override.set({\n state: untracked(sourceState) as unknown as { value: D },\n value: updater(untracked(result)),\n });\n },\n asReadonly(): Signal<D> {\n return result;\n },\n }) as WritableSignal<D>;\n}\n","import { computed, Signal, } from '@angular/core';\nimport { writableSignal } from './writable-signal';\n\n/**\n * A reactive wrapper around a `Set` backed by Angular signals.\n * All mutations produce a new `Set` instance, ensuring signal-based change detection works correctly.\n *\n * @template T The type of elements stored in the set. Defaults to `number`.\n */\nexport interface SignalSet<T = number> {\n /** The current underlying `Set` (read via signal). */\n (): Set<T>;\n /** The number of elements in the set (reactive). */\n size: Signal<number>;\n /** A computed signal that returns the set contents as an array. */\n toArray: Signal<T[]>;\n /** Adds the element if absent, removes it if present. */\n toggle: (id: T) => void;\n /** Returns `true` if the element exists in the set. */\n has: (id: T) => boolean;\n /** Adds an element to the set. */\n add: (id: T) => void;\n /** Removes an element from the set. */\n delete: (id: T) => void;\n /** Removes all elements from the set. */\n clear: () => void;\n /** Returns a human-readable string representation, e.g. `SignalSet(1, 2, 3)`. */\n toString: () => string;\n /** Converts the set to a JSON-compatible array. e.g. `[1, 2, \"a\"]` */\n toJSON: () => T[];\n}\n\n/**\n * Creates a reactive `SignalSet` backed by Angular signals.\n *\n * Every mutation creates a new `Set`, so Angular's signal equality check triggers updates.\n *\n * @template T The element type. Defaults to `number`.\n * @param initialValue An optional iterable to seed the set with.\n * @returns A {@link SignalSet} instance.\n *\n * @example\n * ```ts\n * const selected = signalSet<number>();\n * selected.add(1);\n * selected.toggle(2);\n * console.log(selected.toArray()); // [1, 2]\n * selected.toggle(1);\n * console.log(selected.has(1)); // false\n * ```\n */\nexport function signalSet<T = number>(\n initialValue: Iterable<T> | (() => Iterable<T>) = new Set<T>(),\n): SignalSet<T> {\n // writableSignal = linkedSignal \n const setSignal = writableSignal(\n () => new Set(typeof initialValue === 'function' ? initialValue() : initialValue),\n );\n const toArray = computed(() => Array.from(setSignal()));\n\n return Object.assign(() => setSignal(), {\n toArray,\n size: computed(() => setSignal().size),\n toggle: (id: T): void => {\n setSignal.update((set) => {\n const next = new Set(set);\n if (next.has(id)) next.delete(id);\n else next.add(id);\n return next;\n });\n },\n has: (id: T): boolean => setSignal().has(id),\n add: (id: T): void => {\n setSignal.update((set) => {\n const next = new Set(set);\n next.add(id);\n return next;\n });\n },\n delete: (id: T): void => {\n setSignal.update((set) => {\n const next = new Set(set);\n next.delete(id);\n return next;\n });\n },\n clear: (values?: Iterable<T>): void => {\n setSignal.set(new Set(values));\n },\n toString: (): string => {\n return `SignalSet(${toArray().join(', ')})`;\n },\n toJSON: (): T[] => {\n return toArray();\n },\n });\n}\n","import { computed, Signal } from '@angular/core';\nimport { writableSignal } from './writable-signal';\n\n/**\n * Resolves `T` to itself when it is a valid object key (`string | number | symbol`),\n * otherwise falls back to `string`. Used to type-safe `Record` conversions.\n */\ntype ToKey<T> = T extends string | number | symbol ? T : string;\n\n/**\n * if an object have Symbol.iterator, treat it as Iterable<[K, V]>\n * @param value Iterable<[K, V]> or Record<ToKey<K>, V>\n * @returns Iterable<[K, V]>\n */\nfunction getIterable<K, V>(\n value: Iterable<[K, V]> | Record<ToKey<K>, V>,\n): Iterable<[K, V]> {\n if (Symbol.iterator in Object(value)) {\n return value as Iterable<[K, V]>;\n } else {\n return Object.entries(value as Record<ToKey<K>, V>) as Iterable<[K, V]>;\n }\n}\n\n/**\n * A reactive wrapper around a `Map` backed by Angular signals.\n * All mutations produce a new `Map` instance, ensuring signal-based change detection works correctly.\n *\n * @template K The key type. Defaults to `string`.\n * @template V The value type. Defaults to `unknown`.\n */\nexport interface SignalMap<K = string, V = unknown> {\n /** The current underlying `Map` (read via signal). */\n (): Map<K, V>;\n /** The number of entries in the map (reactive). */\n size: Signal<number>;\n /** A computed signal that returns the map keys as an array. */\n keys: Signal<K[]>;\n /** A computed signal that returns the map values as an array. */\n values: Signal<V[]>;\n /** A computed signal that returns the map entries as an array of `[key, value]` tuples. */\n entries: Signal<[K, V][]>;\n /** Returns the value associated with `key`, or `undefined` if absent. */\n get: (key: K) => V | undefined;\n /** Returns `true` if the map contains the given `key`. */\n has: (key: K) => boolean;\n /** Sets (or overwrites) the value for `key` and returns the updated `Map`. */\n set: (key: K, value: V) => Map<K, V>;\n /** Removes the entry for `key`. Returns `true` if the key existed. */\n delete: (key: K) => boolean;\n /** Removes all entries from the map. */\n clear: () => void;\n /** Returns a human-readable string, e.g. `SignalMap(a => 1, b => 2)`. */\n toString: () => string;\n /** Converts the map to a JSON-compatible object. */\n toJSON: () => Record<ToKey<K>, V>;\n}\n\n/**\n * Creates a reactive `SignalMap` backed by Angular signals.\n *\n * Every mutation creates a new `Map`, so Angular's signal equality check triggers updates.\n * Accepts either an iterable of `[key, value]` pairs or a plain object as the initial value.\n *\n * @template K The key type. Defaults to `string`.\n * @template V The value type. Defaults to `unknown`.\n * @param initialValue An optional iterable of entries or a plain object to seed the map.\n * @returns A {@link SignalMap} instance.\n *\n * @example\n * ```ts\n * const cache = signalMap<string, number>({ a: 1, b: 2 });\n * cache.set('c', 3);\n * console.log(cache.keys()); // ['a', 'b', 'c']\n * cache.delete('a'); // true\n * console.log(cache.toJSON()); // {b:2,c:3}\n * ```\n */\nexport function signalMap<K = string, V = unknown>(\n initialValue:\n | Iterable<[K, V]>\n | Record<ToKey<K>, V>\n | (() => Iterable<[K, V]> | Record<ToKey<K>, V>) = new Map<K, V>(),\n): SignalMap<K, V> {\n // writableSignal = linkedSignal \n const mapSignal = writableSignal(() => {\n const _val =\n typeof initialValue === 'function' ? initialValue() : initialValue;\n const init = getIterable(_val);\n return new Map<K, V>(init);\n });\n const entries = computed(() => Array.from(mapSignal().entries()));\n const keys = computed(() => Array.from(mapSignal().keys()));\n const values = computed(() => Array.from(mapSignal().values()));\n const size = computed(() => mapSignal().size);\n\n return Object.assign(() => mapSignal(), {\n entries,\n keys,\n values,\n size,\n get: (key: K): V | undefined => mapSignal().get(key),\n has: (key: K): boolean => mapSignal().has(key),\n set: (key: K, value: V): Map<K, V> => {\n mapSignal.update((map) => {\n const next = new Map(map);\n next.set(key, value);\n return next;\n });\n return mapSignal();\n },\n delete: (key: K): boolean => {\n let deleted = false;\n mapSignal.update((map) => {\n const next = new Map(map);\n deleted = next.delete(key);\n return next;\n });\n return deleted;\n },\n clear: (values?: Iterable<[K, V]> | Record<ToKey<K>, V>): void => {\n mapSignal.set(new Map(values ? getIterable(values) : undefined));\n },\n toString: (): string => {\n return `SignalMap(${entries()\n .map(([k, v]) => `${k} => ${v}`)\n .join(', ')})`;\n },\n toJSON: (): Record<ToKey<K>, V> => {\n return Object.fromEntries(entries());\n },\n toObject: (): Record<ToKey<K>, V> => {\n return Object.fromEntries(entries());\n },\n });\n}\n","import { computed, signal, Signal, WritableSignal } from '@angular/core';\n\nconst SIGNAL_OBJECT = Symbol('SignalObject');\n\n/**\n * A reactive object backed by Angular signals.\n * Each property is stored as a WritableSignal, so reads are tracked\n * by Angular's reactive system (templates, computed, effect).\n *\n * Usage:\n * const person = signalObject({ name: 'dvirus', age: 30 });\n * person.name; // reads the signal → 'dvirus' (tracked)\n * person['name'] = 'new'; // sets the signal (triggers reactivity)\n * person.age; // reads the signal → 30 (tracked)\n */\nclass _SignalObject<T extends Record<string, unknown>> {\n readonly [SIGNAL_OBJECT] = true;\n readonly #signals = new Map<string, WritableSignal<unknown>>();\n readonly #version = signal(0);\n readonly #boundCache = new Map<string | symbol, _Function>();\n\n constructor(initialValue: T) {\n for (const [key, value] of Object.entries(initialValue)) {\n this.#signals.set(key, signal(value));\n }\n\n // Use a function as the proxy target so the `apply` trap works (makes it callable).\n // All traps delegate to `self` (the real class instance) for property/signal access.\n\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n const self = this;\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n const callable = (() => {}) as unknown as this;\n\n return new Proxy(callable, {\n apply(): T {\n return self.$snapshot();\n },\n\n get(_, prop): unknown {\n // Symbols & class own members go through normally\n if (typeof prop === 'symbol' || prop in self) {\n const value = Reflect.get(self, prop, self);\n // Bind methods to the real target so private fields (#signals) work.\n // Cache the bound function so the same reference is returned each time\n // (important for Angular signal identity tracking on $snapshot).\n if (typeof value === 'function') {\n let bound = self.#boundCache.get(prop);\n if (!bound) {\n bound = value.bind(self) as _Function;\n self.#boundCache.set(prop, bound);\n }\n return bound;\n }\n return value;\n }\n // Read the signal — this is tracked by Angular's reactive context\n const s = self.#signals.get(prop)?.();\n /** create new signal if it doesn't exist */\n if (s === undefined && !self.#signals.has(prop)) {\n const newSignal = signal(undefined);\n self.#signals.set(prop, newSignal);\n return newSignal();\n }\n return s;\n },\n\n set(_, prop, value): boolean {\n if (typeof prop === 'symbol' || prop in self) {\n return Reflect.set(self, prop, value);\n }\n const existing = self.#signals.get(prop);\n if (existing) {\n existing.set(value);\n } else {\n // Dynamic property — create a new signal and bump version\n self.#signals.set(prop, signal(value));\n self.#version.update(addVersion);\n }\n return true;\n },\n\n deleteProperty(_, prop): boolean {\n // Prevent accidental deletion of internal methods or symbols\n if (typeof prop === 'symbol' || prop in self) {\n return false;\n }\n // If it's a tracked signal property, remove it and bump the version\n if (self.#signals.has(prop)) {\n self.#signals.delete(prop);\n self.#version.update(addVersion);\n return true;\n }\n // Standard JS behavior: deleting a non-existent property returns true\n return true;\n },\n\n has(_, prop): boolean {\n if (typeof prop === 'string' && self.#signals.has(prop)) {\n return true;\n }\n return Reflect.has(self, prop);\n },\n\n ownKeys(): string[] {\n return Array.from(self.#signals.keys());\n },\n\n getOwnPropertyDescriptor(_, prop): PropertyDescriptor | undefined {\n if (typeof prop === 'string' && self.#signals.has(prop)) {\n return {\n configurable: true,\n enumerable: true,\n writable: true,\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n value: self.#signals.get(prop)!(),\n };\n }\n return Reflect.getOwnPropertyDescriptor(self, prop);\n },\n }) as unknown as this;\n }\n\n /**\n * A computed signal that returns a plain snapshot of all properties.\n * Reading this tracks ALL properties — so any property change triggers reactivity.\n *\n * Usage:\n * effect(() => console.log(person.$snapshot()));\n * // logs whenever ANY property changes\n */\n private readonly $snapshot: Signal<T> = computed(() => {\n this.#version(); // track structural changes (new/removed props)\n return this.toJSON();\n });\n\n /**\n * Spreads one or more objects (plain or reactive) into this SignalObject.\n * Mimics `Object.assign(this, ...sources)` / `{ ...this, ...a, ...b }`.\n *\n * - Existing keys → updates the signal (triggers reactivity)\n * - New keys → creates a new signal and bumps the version\n * - Accepts plain objects and ReactiveObjects interchangeably\n *\n * @example\n * const person = signalObject({ name: 'dvirus' });\n * person.$assign({ age: 30 }, otherSignalObj);\n */\n $assign(...sources: object[]): void {\n for (const source of sources) {\n const entries = isSignalObject(source)\n ? Object.entries(\n (source as unknown as { $snapshot: Signal<object> }).$snapshot(),\n )\n : Object.entries(source);\n\n for (const [key, value] of entries) {\n const existing = this.#signals.get(key);\n if (existing) {\n existing.set(value);\n } else {\n this.#signals.set(key, signal(value));\n }\n }\n }\n this.#version.update(addVersion);\n }\n\n toJSON(): T {\n this.#version(); // track structural changes (new/removed props)\n const result: Record<string, unknown> = {};\n for (const [key, sig] of this.#signals) {\n result[key] = sig();\n }\n return result as T;\n }\n\n toString(): string {\n return JSON.stringify(this.toJSON());\n }\n}\n\n/**\n * Creates a reactive object backed by Angular signals.\n *\n * Every property is stored as a `WritableSignal`. Reading a property\n * (e.g. `obj.name` or `obj['name']`) calls the signal — so it's\n * automatically tracked in templates, `computed()`, and `effect()`.\n * Setting a property calls `signal.set()`, which triggers reactivity.\n *\n * @example\n * // In a component:\n * protected person = signalObject({ name: 'dvirus', age: 30 });\n *\n * // In the template (reactive — updates automatically):\n * // {{ person.name }}\n *\n * // In the class:\n * // person.name = 'changed'; → triggers re-render\n * // person['age'] = 31; → triggers re-render\n */\nexport type SignalObject<T> = T & {\n /**\n * Call the SignalObject as a function to get a reactive snapshot.\n *\n * @example\n * const person = signalObject({ name: 'dvirus', age: 30 });\n * person(); // { name: 'dvirus', age: 30 } — tracked by Angular\n */\n (): T;\n\n /**\n * A computed signal that returns a plain snapshot of all properties.\n * Reading this tracks ALL properties — any property change triggers reactivity.\n *\n * @example\n * effect(() => console.log(person.$snapshot()));\n * // logs whenever ANY property changes\n *\n * const label = computed(() => {\n * const snap = person.$snapshot();\n * return `${snap.name} (${snap.age})`;\n * });\n */\n // readonly $snapshot: Signal<T>;\n\n /**\n * Spreads one or more objects (plain or reactive) into this SignalObject.\n * Mimics `Object.assign(this, ...sources)` / `{ ...this, ...a, ...b }`.\n *\n * - Existing keys → updates the signal (triggers reactivity)\n * - New keys → creates a new signal and bumps the version\n * - Accepts plain objects and SignalObjects interchangeably\n *\n * @param sources - One or more plain objects or SignalObjects to merge in\n *\n * @example\n * const person = signalObject({ name: 'dvirus' });\n * person.$assign({ age: 30 }, otherSignalObj);\n */\n $assign(...sources: Partial<T>[]): void;\n};\n\n/**\n * Creates a reactive object backed by Angular signals.\n *\n * Every property is stored as a `WritableSignal`. Reading a property\n * (e.g. `obj.name` or `obj['name']`) calls the signal — so it's\n * automatically tracked in templates, `computed()`, and `effect()`.\n * Setting a property calls `signal.set()`, which triggers reactivity.\n *\n * @param initialValue - The plain object to make reactive\n * @returns A `SignalObject<T>` proxy with reactive property access, `$snapshot`, and `$assign`\n *\n * @example\n * // In a component:\n * protected person = signalObject({ name: 'dvirus', age: 30 });\n *\n * // In the template (reactive — updates automatically):\n * // {{ person.name }}\n *\n * // In the class:\n * person.name = 'changed'; // triggers re-render\n * person['age'] = 31; // triggers re-render\n *\n * // Spread (plain snapshot):\n * const copy = { ...person }; // { name: 'changed', age: 31 }\n *\n * // Track all properties reactively:\n * effect(() => console.log(person.$snapshot()));\n */\nexport function signalObject<T extends object>(\n initialValue: T,\n): SignalObject<T> {\n return new _SignalObject(\n initialValue as Record<string, unknown>,\n ) as unknown as SignalObject<T>;\n}\n\n/**\n * Type guard — checks if a value is a reactive SignalObject proxy.\n *\n * @example\n * isSignalObject(signalObject({ a: 1 })); // true\n * isSignalObject({ a: 1 }); // false\n * isSignalObject({ ...signalObject({ a: 1 }) }); // false (spread = plain copy)\n */\nexport function isSignalObject<T extends Record<string, unknown>>(\n value: unknown,\n): value is SignalObject<T> {\n return (\n typeof value === 'object' &&\n value !== null &&\n (value as Record<symbol, unknown>)[SIGNAL_OBJECT] === true\n );\n}\n\n/**\n * Reactively merges multiple SignalObjects (like `{ ...a, ...b }`).\n * Returns a `Signal` that re-evaluates whenever any source property changes.\n * Later sources win on key conflicts, just like spread.\n *\n * same as `computed(() => ({ ...a, ...b }))`\n * but with proper tracking of nested properties and support for non-reactive objects as sources.\n *\n * @example\n * const objA = signalObject({ name: 'dvirus', role: 'dev' });\n * const objB = signalObject({ age: 30, role: 'admin' });\n * const merged = mergeSignalObjects(objA, objB);\n * merged(); // { name: 'dvirus', role: 'admin', age: 30 }\n */\nexport function mergeSignalObjects<T extends object[]>(\n ...sources: [...{ [K in keyof T]: T[K] | SignalObject<T[K]> }]\n): Signal<UnionToIntersection<T[number]>> {\n return computed(() => {\n let result = {};\n for (const source of sources) {\n // Spreading a SignalObject triggers its Proxy traps (ownKeys + getOwnPropertyDescriptor),\n // which reads every signal — so it's automatically tracked by Angular's reactive context.\n // Plain objects are just spread normally.\n result = { ...result, ...source };\n }\n return result as UnionToIntersection<T[number]>;\n });\n}\n\n/**\n * Extracts the plain object type `U` from a `SignalObject<U>`.\n * Returns `T` as-is if it's not a `SignalObject`.\n */\n// type SnapshotOf<T> = T extends SignalObject<infer U> ? U : T;\n\n/**\n * Converts a union of types into an intersection.\n * Used to merge multiple object types from `mergeSignalObjects` into a single combined type.\n *\n * @example\n * // UnionToIntersection<{ a: 1 } | { b: 2 }> → { a: 1 } & { b: 2 }\n */\ntype UnionToIntersection<U> = (\n U extends unknown ? (k: U) => void : never\n) extends (k: infer I) => void\n ? I\n : never;\n\ntype _Function = (...args: unknown[]) => unknown;\n\nfunction addVersion(prev: number): number {\n if (prev > 1000) return 1;\n return prev + 1;\n}\n","import {\n computed,\n DestroyRef,\n inject,\n Signal,\n signal,\n untracked,\n} from '@angular/core';\nimport {\n FormControl,\n FormGroup,\n AbstractControl,\n FormControlStatus,\n ValidationErrors,\n FormArray,\n FormControlState,\n} from '@angular/forms';\nimport { Observable, startWith, Subscription } from 'rxjs';\nimport { tryCatch } from './try-catch';\nimport { writableSignal } from './writable-signal';\n\ninterface ControlEvent<T> {\n /**\n * Form control from which this event is originated.\n *\n * Note: the type of the control can't be inferred from T as the event can be emitted by any of child controls\n */\n readonly source: AbstractControl<unknown | T>;\n}\n\n// ########## CONTROL SIGNAL ##########\n\n/**\n * A reactive signal-based wrapper around an `AbstractControl`, exposing\n * the control's state (value, status, touched, dirty, errors, etc.) as\n * Angular signals for use in templates and computed expressions.\n *\n * @template T - The value type of the underlying form control.\n * @template TControl - The specific `AbstractControl` type being wrapped (e.g., `FormControl`, `FormGroup`, `FormArray`).\n */\nexport interface ControlSignal<\n T,\n TControl extends AbstractControl<unknown> = AbstractControl<T>,\n> {\n /** Signal returning the underlying `AbstractControl` instance with its specific type. */\n control: TControl;\n /** Signal returning the current value of the control. */\n value: Signal<UnwrapFromControlState<T> | null | undefined>;\n /** Signal returning the current validation status (`VALID`, `INVALID`, `PENDING`, `DISABLED`). */\n status: Signal<FormControlStatus | null | undefined>;\n /** Signal returning the most recent `ControlEvent` emitted by the control. */\n events: Signal<ControlEvent<T> | null | undefined>;\n /** Signal that is `true` when the control status is `DISABLED`. */\n disabled: Signal<boolean>;\n /** Signal that is `true` when the control status is `VALID`. */\n valid: Signal<boolean>;\n /** Signal that is `true` when the control status is `INVALID`. */\n invalid: Signal<boolean>;\n /** Signal that is `true` when the control has been touched. */\n touched: Signal<boolean>;\n /** Signal that is `true` when the control is dirty. */\n dirty: Signal<boolean>;\n /** Signal returning the current validation errors, or `null` if there are none. */\n errors: Signal<ValidationErrors | null>;\n /** Signal returning the key of the first validation error, or `null`. */\n firstErrorKey: Signal<string | null>;\n /** Signal that is `true` when the control is both touched and invalid. */\n touchedAndInvalid: Signal<boolean>;\n /**\n * Signal returning the control's synchronous validators as a `ValidationErrors`-like object, or `null` if there are none.\n * @Note that this does not include asynchronous validators, and the shape of the returned object may differ from the actual validation errors emitted by the control.\n */\n validators: Signal<ValidationErrors | null>;\n /** Tears down all internal subscriptions and effects. */\n unsubscribe(): void;\n}\n\n/**\n * Creates a {@link ControlSignal} that mirrors an `AbstractControl`'s\n * reactive state as Angular signals.\n *\n * **Important:** If called outside an injection context, you must manually handle\n * un-subscription by either:\n * - Calling the `unsubscribe()` method on the returned {@link ControlSignal}, or\n * - Passing a `DestroyRef` via the `options` parameter for automatic cleanup.\n *\n * If called within an injection context without providing a `DestroyRef`, the\n * subscriptions will be automatically cleaned up on component destruction.\n *\n * @template T - The value type of the form control.\n * @param control - The form control or a signal wrapping one.\n * @param options - Optional configuration object containing:\n * - `destroyRef`: A `DestroyRef` used for automatic cleanup on destruction.\n * If not provided, the function will attempt to inject one from the current\n * injection context. If neither is available, manual un-subscription is required.\n * @returns A {@link ControlSignal} exposing the control's state as signals.\n * @throws If `control` is a signal and no `Injector` is available.\n */\nexport function controlSignal<\n T,\n TControl extends AbstractControl<unknown> = FormControl<T>,\n>(\n control: TControl,\n options?: { destroyRef?: DestroyRef | null },\n): ControlSignal<T, TControl> {\n const destroyRef =\n options?.destroyRef ??\n tryCatch(() => inject(DestroyRef, { optional: true }))[0];\n\n let subscriptions: Subscription[] = [];\n const unsubscribe = (): void => {\n subscriptions.forEach((s) => s.unsubscribe());\n subscriptions = [];\n };\n // cleanUp\n unsubscribe();\n destroyRef?.onDestroy(() => unsubscribe());\n\n const $value = signal<T | null | undefined>(undefined);\n const $status = signal<FormControlStatus | null | undefined>(undefined);\n const _events = signal<ControlEvent<T> | null>(null);\n const $events = writableSignal<ControlEvent<T> | null | undefined>(() => {\n $value();\n $status();\n return _events();\n });\n\n subscriptions.push(\n control.valueChanges\n .pipe(startWith(control.value))\n .subscribe((x) => untracked(() => $value.set(x as T))),\n\n control.statusChanges\n .pipe(startWith(control.status))\n .subscribe((x) => untracked(() => $status.set(x))),\n\n // control.events.subscribe((x) => untracked(() => $events.set(x))),\n );\n\n // Subscribe to control.events if available (Angular v18+)\n const ctrl = control as unknown as { events: Observable<ControlEvent<T>> };\n if (ctrl.events && typeof ctrl.events.subscribe === 'function') {\n subscriptions.push(\n ctrl.events.subscribe((x: ControlEvent<T>) =>\n untracked(() => {\n _events.set(x);\n }),\n ),\n );\n }\n\n const invalid = computed(() => ($status(), control.invalid));\n const touched = computed(() => ($events(), control.touched));\n const errors = computed<ValidationErrors | null>(\n () => ($events(), control.errors),\n );\n\n return {\n control: control as TControl,\n value: computed(() => {\n $value();\n $events();\n return control.value as UnwrapFromControlState<T>;\n }),\n status: $status.asReadonly(),\n events: $events.asReadonly(),\n\n invalid: invalid,\n errors: errors,\n touched: touched,\n\n valid: computed(() => ($status(), control.valid)),\n dirty: computed(() => ($events(), control.dirty)),\n disabled: computed(() => ($status(), control.disabled)),\n touchedAndInvalid: computed(() => touched() && invalid()),\n firstErrorKey: computed<string | null>(\n () => Object.keys(errors() ?? {})[0] ?? null,\n ),\n validators: computed(\n () => ($events(), control.validator?.({} as AbstractControl) ?? null),\n ),\n unsubscribe: (): void => unsubscribe(),\n };\n}\n\n// ############ FORM GROUP SIGNAL ############\n\n/**\n * Extends {@link ControlSignal} with a strongly-typed `controls` map,\n * providing a `ControlSignal` for every control in the `FormGroup`.\n *\n * @template T - An object type whose keys correspond to the group's control names\n * and whose values are the respective control value types.\n */\nexport interface FormGroupSignal<TControls extends TypedControlMap>\n extends ControlSignal<ControlsValue<TControls>, FormGroup<TControls>> {\n /** The underlying `FormGroup` instance. */\n control: FormGroup<TControls>;\n /** A map of child control names to their individual {@link ControlSignal} instances. */\n controls: {\n [K in keyof TControls]: NestedControlSignal<TControls[K]>;\n };\n}\n\n/**\n * Creates a {@link FormGroupSignal} for a `FormGroup`. Child controls are\n * converted recursively, so nested `FormGroup` and `FormArray` structures\n * are supported.\n *\n * @template TControls - A typed map of control names to `AbstractControl` instances.\n * @param formGroup - The `FormGroup` to wrap.\n * @param options - Optional `DestroyRef` and `Injector` forwarded to\n * each underlying {@link controlSignal} call.\n * @returns A {@link FormGroupSignal} with both group-level and per-control signals.\n */\nexport function formGroupSignal<TControls extends TypedControlMap>(\n formGroup: FormGroup<TControls>,\n options?: { destroyRef?: DestroyRef | null },\n): FormGroupSignal<TControls> {\n const destroyRef =\n options?.destroyRef ??\n tryCatch(() => inject(DestroyRef, { optional: true }))[0];\n\n const controls = Object.fromEntries(\n Object.entries(formGroup.controls).map(([key, ctrl]) => {\n return [key, nestedControlSignal(ctrl, { destroyRef })];\n }),\n ) as { [K in keyof TControls]: NestedControlSignal<TControls[K]> };\n\n const groupSignal = controlSignal(formGroup);\n const selfUnsubscribe = groupSignal.unsubscribe.bind(groupSignal);\n\n return Object.assign(groupSignal, {\n controls,\n unsubscribe: () => {\n selfUnsubscribe();\n Object.values(controls).forEach((c) => c.unsubscribe());\n },\n }) as FormGroupSignal<TControls>;\n}\n\n// ############ FORM ARRAY SIGNAL ############\n\nexport interface FormArraySignal<TControl extends AbstractControl<unknown>>\n extends ControlSignal<ControlValue<TControl>[], FormArray<TControl>> {\n /** The underlying `FormArray` instance. */\n control: FormArray<TControl>;\n controls: NestedControlSignal<TControl>[];\n}\n\n/**\n * Creates a {@link FormArraySignal} for a `FormArray`. Child controls are\n * converted recursively, so arrays of `FormGroup`, arrays of `FormArray`,\n * and arrays of `FormControl` are all supported.\n */\nexport function formArraySignal<TControl extends AbstractControl<unknown>>(\n formArray: FormArray<TControl>,\n options?: { destroyRef?: DestroyRef | null },\n): FormArraySignal<TControl> {\n const destroyRef =\n options?.destroyRef ??\n tryCatch(() => inject(DestroyRef, { optional: true }))[0];\n\n const controls = formArray.controls.map((ctrl) =>\n nestedControlSignal(ctrl, { destroyRef }),\n ) as NestedControlSignal<TControl>[];\n\n const arraySignal = controlSignal(formArray);\n const selfUnsubscribe = arraySignal.unsubscribe.bind(arraySignal);\n\n return Object.assign(arraySignal, {\n controls,\n unsubscribe: () => {\n selfUnsubscribe();\n controls.forEach((c) => c.unsubscribe());\n },\n }) as FormArraySignal<TControl>;\n}\n\n// ############ HELPERS ############\n\ntype UnwrapFromControlState<T> =\n T extends FormControlState<unknown> ? T['value'] : T;\n\ntype TypedControlMap = Record<string, AbstractControl<unknown>>;\n\ntype ControlValue<TControl extends AbstractControl<unknown>> =\n TControl extends AbstractControl<infer TValue> ? TValue : never;\n\ntype ControlsValue<TControls extends TypedControlMap> = {\n [K in keyof TControls]: ControlValue<TControls[K]>;\n};\n\nexport type NestedControlSignal<TControl extends AbstractControl<unknown>> =\n TControl extends FormGroup<infer TControls>\n ? FormGroupSignal<TControls & TypedControlMap> //& TypedControlMap\n : TControl extends FormArray<infer TItemControl>\n ? FormArraySignal<TItemControl & AbstractControl<unknown>>\n : ControlSignal<ControlValue<TControl>, TControl>;\n\nfunction nestedControlSignal<TControl extends AbstractControl<unknown>>(\n control: TControl,\n options?: { destroyRef?: DestroyRef | null },\n): NestedControlSignal<TControl> {\n if (control instanceof FormGroup) {\n return formGroupSignal(\n control as FormGroup<TypedControlMap>,\n options,\n ) as NestedControlSignal<TControl>;\n }\n\n if (control instanceof FormArray) {\n return formArraySignal(\n control as FormArray<AbstractControl<unknown>>,\n options,\n ) as NestedControlSignal<TControl>;\n }\n\n return controlSignal(\n control as AbstractControl<ControlValue<TControl>>,\n options,\n ) as NestedControlSignal<TControl>;\n}\n","import { computed, isSignal, signal } from '@angular/core';\nimport {\n fromSignalObj,\n SignalOrValue,\n signalOrValue,\n SignalOrValueObj,\n} from '../utils/signals.utils';\nimport { collectValidationErrors, hasErrors } from './errors';\n\nimport {\n FirstError,\n SignalFormControl,\n SignalFormControlConfig,\n SignalFormControlInput,\n SignalFormControlLike,\n SignalFormContext,\n SignalFormDisabledFn,\n SignalFormSetValueOptions,\n} from './types';\nimport { writableSignal } from '../utils/';\n\n/**\n * Internal type for accessing sibling controls in a form.\n *\n * @internal\n */\ntype ControlAccessor<TControls extends object> = <Key extends keyof TControls>(\n controlName: Key,\n) => SignalFormControlLike<TControls[Key]>;\n\n/**\n * Shared empty error map object to avoid creating new objects.\n *\n * @internal\n */\nconst EMPTY_ERROR_MAP: Record<string, string> = {};\n\n/**\n * Checks if a value is a plain JavaScript object (not array, not null, not class instance).\n *\n * @internal\n * @param value - Value to check\n * @returns True if value is a plain object\n */\nfunction isPlainObject(value: unknown): value is Record<string, unknown> {\n if (!value || typeof value !== 'object') return false;\n const proto = Object.getPrototypeOf(value);\n return proto === Object.prototype || proto === null;\n}\n\n/**\n * Checks if an object contains any Angular signal values.\n *\n * @internal\n * @param obj - Object to check for signal values\n * @returns True if any property value is a signal\n */\nfunction hasSignalValues(obj: Record<string, unknown>): boolean {\n return Object.values(obj).some((value) => isSignal(value));\n}\n\n/**\n * Resolves a SignalOrValue to its actual value, handling nested signal objects.\n *\n * If the resolved value is a plain object containing signals, it converts\n * all signal properties to their values using fromSignalObj.\n *\n * @internal\n * @template TValue - The type of value to resolve\n * @param value - Signal or static value to resolve\n * @returns The resolved value\n */\nfunction resolveControlValue<TValue>(\n value: SignalOrValue<TValue | undefined>,\n): TValue | undefined {\n const resolved = signalOrValue(value);\n if (isPlainObject(resolved) && hasSignalValues(resolved)) {\n return fromSignalObj(resolved as SignalOrValueObj) as TValue;\n }\n return resolved;\n}\n\n/**\n * Normalizes various control input formats to a standard SignalFormControlConfig.\n *\n * Handles three input types:\n * - SignalFormControl: extracts current value\n * - Config object with 'value' property: uses as-is\n * - Raw value: wraps in config object\n *\n * @internal\n * @template TValue - The type of control value\n * @template TControls - Object type defining available sibling controls\n * @param input - Input in any accepted format\n * @returns Normalized control configuration\n */\nfunction normalizeControlInput<TValue, TControls extends object>(\n input: SignalFormControlInput<TValue, TControls>,\n): SignalFormControlConfig<TValue, TControls> {\n if (isSignalFormControl(input)) {\n return { value: input.value() } as SignalFormControlConfig<\n TValue,\n TControls\n >;\n }\n if (typeof input === 'object' && input !== null && 'value' in input) {\n return input as SignalFormControlConfig<TValue, TControls>;\n }\n return { value: input as SignalOrValue<TValue | undefined> };\n}\n\n/**\n * Type guard to check if an object is a SignalFormControl.\n *\n * @template TValue - The type of value the control manages\n * @param obj - Object to check\n * @returns True if obj is a SignalFormControl\n *\n * @example\n * ```typescript\n * if (isSignalFormControl(value)) {\n * console.log(value.value()); // TypeScript knows this is a control\n * }\n * ```\n */\nexport function isSignalFormControl<TValue>(\n obj: unknown,\n): obj is SignalFormControl<TValue> {\n return (\n !!obj &&\n typeof obj === 'object' &&\n (obj as SignalFormControl<TValue>).kind === 'control'\n );\n}\n\n/**\n * Creates a reactive form control with signal-based state management.\n *\n * Builds a control that wraps a primitive value (string, number, boolean, etc.)\n * with validation, state tracking, and reactive updates using Angular signals.\n *\n * Features:\n * - Reactive value updates through signals\n * - Validators for errors (mark control as invalid)\n * - Warnings (validation messages without invalidating)\n * - Dynamic disabled state based on form context\n * - State tracking (touched, dirty)\n * - Manual error/warning management\n *\n * @template TControls - Object type defining available sibling controls for cross-field validation\n * @template TValue - The type of value this control manages\n *\n * @param input - Control input (raw value, config object, or existing control)\n * @param getControl - Optional accessor function for sibling controls\n * @returns Fully configured SignalFormControl instance\n *\n * @example\n * ```typescript\n * // Simple control\n * const nameControl = createSignalFormControl('John');\n *\n * // With validators\n * const ageControl = createSignalFormControl({\n * value: 25,\n * validators: [signalFormValidators.required, signalFormValidators.min(0)],\n * warnings: [signalFormValidators.max(120)]\n * });\n *\n * // With dynamic disabled\n * const emailControl = createSignalFormControl({\n * value: '',\n * disabled: (ctx) => ctx.getControl('accountType').value() === 'guest'\n * });\n * ```\n */\nexport function createSignalFormControl<TControls extends object, TValue>(\n input: SignalFormControlInput<TValue, TControls>,\n getControl?: ControlAccessor<TControls>,\n): SignalFormControl<TValue> {\n if (isSignalFormControl(input)) {\n return input as SignalFormControl<TValue>;\n }\n\n const config = normalizeControlInput(input);\n const accessControl =\n getControl ??\n ((() => {\n throw new Error('getControl is not available for this control.');\n }) as ControlAccessor<TControls>);\n\n const initialValue = resolveControlValue(config.value);\n const value = writableSignal(() => resolveControlValue(config.value));\n const manualErrors = signal<Record<string, string>>({});\n const manualWarnings = signal<Record<string, string>>({});\n const selfTouched = signal(false);\n const selfDirty = signal(false);\n const selfDisabled = signal(false);\n\n const disabledResolver = config.disabled;\n const disabled = computed(() => {\n const derived =\n typeof disabledResolver === 'function'\n ? (disabledResolver as SignalFormDisabledFn<TControls, TValue>)({\n item: { value: value() },\n getControl: accessControl,\n })\n : disabledResolver\n ? signalOrValue(disabledResolver)\n : false;\n return selfDisabled() || derived;\n });\n\n const errors = computed(() => {\n if (disabled()) return EMPTY_ERROR_MAP;\n const ctx: SignalFormContext<TControls, TValue> = {\n item: { value: value() },\n getControl: accessControl,\n };\n return {\n ...collectValidationErrors(config.validators, ctx),\n ...manualErrors(),\n };\n });\n\n const warnings = computed(() => {\n if (disabled()) return EMPTY_ERROR_MAP;\n const ctx: SignalFormContext<TControls, TValue> = {\n item: { value: value() },\n getControl: accessControl,\n };\n return {\n ...collectValidationErrors(config.warnings, ctx),\n ...manualWarnings(),\n };\n });\n\n const invalid = computed(() => !disabled() && hasErrors(errors()));\n const valid = computed(() => !invalid());\n\n const firstError = computed<FirstError<'error'>>(() => {\n const entries = Object.entries(errors());\n if (!entries.length) return undefined;\n const [name, message] = entries[0] ?? ['', ''];\n return { name, message, type: 'error' };\n });\n\n const firstWarning = computed<FirstError<'warning'>>(() => {\n const entries = Object.entries(warnings());\n if (!entries.length) return undefined;\n const [name, message] = entries[0] ?? ['', ''];\n return { name, message, type: 'warning' };\n });\n\n const firstErrorOrWarning = computed<FirstError<'error' | 'warning'>>(() => {\n return firstError() ?? firstWarning();\n });\n\n const setValue = (\n next: TValue | undefined,\n options?: SignalFormSetValueOptions,\n ): void => {\n value.set(next);\n if (options?.markDirty ?? true) selfDirty.set(true);\n if (options?.markTouched) selfTouched.set(true);\n };\n\n const reset = (next?: TValue | undefined): void => {\n value.set(next ?? initialValue);\n selfDirty.set(false);\n selfTouched.set(false);\n manualErrors.set({});\n manualWarnings.set({});\n };\n\n return {\n kind: 'control',\n value,\n disabled,\n touched: computed(() => selfTouched()),\n dirty: computed(() => selfDirty()),\n errors,\n warnings,\n selfErrors: errors,\n selfWarnings: warnings,\n invalid,\n valid,\n firstError,\n firstWarning,\n firstErrorOrWarning,\n setValue,\n reset,\n markTouched: () => selfTouched.set(true),\n markUntouched: () => selfTouched.set(false),\n markDirty: () => selfDirty.set(true),\n markPristine: () => selfDirty.set(false),\n setDisabled: (next: boolean) => selfDisabled.set(next),\n setError: (key: string, message: string) =>\n manualErrors.update((current) => ({ ...current, [key]: message })),\n clearError: (key: string) =>\n manualErrors.update((current) => {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { [key]: _removed, ...rest } = current;\n return rest;\n }),\n clearErrors: () => manualErrors.set({}),\n setWarning: (key: string, message: string) =>\n manualWarnings.update((current) => ({ ...current, [key]: message })),\n clearWarning: (key: string) =>\n manualWarnings.update((current) => {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { [key]: _removed, ...rest } = current;\n return rest;\n }),\n clearWarnings: () => manualWarnings.set({}),\n };\n}\n","import { computed, signal } from '@angular/core';\n\nimport { createSignalFormArray, isSignalFormArray } from './array';\nimport { createSignalFormControl, isSignalFormControl } from './control';\nimport { hasErrors, isEmptyErrorTree } from './errors';\nimport {\n SignalForm,\n SignalFormArray,\n SignalFormControl,\n SignalFormControlConfig,\n SignalFormControlInput,\n SignalFormControlLike,\n SignalFormDisableOptions,\n SignalFormErrorFor,\n SignalFormInput,\n SignalFormInputs,\n SignalFormSetValueOptions,\n SignalFormValueFor,\n} from './types';\n\n/**\n * Internal type for accessing controls within a form group.\n * \n * @internal\n */\ntype ControlAccessor<TControls extends object> = <Key extends keyof TControls>(\n controlName: Key,\n) => SignalFormControlLike<TControls[Key]>;\n\n/**\n * Set of valid keys for control configuration objects.\n * Used to distinguish config objects from plain value objects.\n * \n * @internal\n */\nconst CONTROL_CONFIG_KEYS = new Set([\n 'value',\n 'validators',\n 'warnings',\n 'disabled',\n]);\n\n/**\n * Checks if a value is a control configuration object.\n * \n * Determines if the value has a 'value' property and only contains\n * valid control config keys (value, validators, warnings, disabled).\n * \n * @internal\n * @param value - Value to check\n * @returns True if value is a control config object\n */\nfunction isControlConfig(\n value: unknown,\n): value is SignalFormControlConfig<unknown, object> {\n if (!value || typeof value !== 'object') return false;\n if (!('value' in (value as Record<string, unknown>))) return false;\n return Object.keys(value as Record<string, unknown>).every(key =>\n CONTROL_CONFIG_KEYS.has(key),\n );\n}\n\n/**\n * Creates the appropriate control node from various input types.\n * \n * Recursively determines and creates the correct control type:\n * - Existing controls are returned as-is\n * - Arrays become SignalFormArray\n * - Objects (non-config) become SignalForm (group)\n * - Primitives/configs become SignalFormControl\n * \n * @internal\n * @template TValue - The type of value to create a control for\n * @template TControls - Object type defining available sibling controls\n * @param input - Input value in any accepted format\n * @param getControl - Accessor for sibling controls\n * @returns Appropriate control type for the input\n */\nfunction createNodeFromInput<TValue, TControls extends object>(\n input: SignalFormInput<TValue, TControls>,\n getControl: ControlAccessor<TControls>,\n): SignalFormControlLike<TValue> {\n if (isSignalFormControl<TValue>(input)) {\n return input as SignalFormControlLike<TValue>;\n }\n if (isSignalFormGroup<object>(input)) {\n return input as SignalFormControlLike<TValue>;\n }\n if (isSignalFormArray<TValue>(input)) {\n return input as SignalFormControlLike<TValue>;\n }\n if (Array.isArray(input)) {\n return createSignalFormArray(\n input as SignalFormInput<TValue, TControls>[],\n getControl,\n ) as SignalFormControlLike<TValue>;\n }\n if (typeof input === 'object' && input !== null && !isControlConfig(input)) {\n return createSignalFormGroup(\n input as SignalFormInputs<TValue & object>,\n ) as SignalFormControlLike<TValue>;\n }\n return createSignalFormControl(\n input as SignalFormControlInput<TValue, TControls>,\n getControl,\n ) as SignalFormControlLike<TValue>;\n}\n\n/**\n * Type guard to check if an object is a SignalForm (form group).\n * \n * @template TData - Object type defining the form structure\n * @param obj - Object to check\n * @returns True if obj is a SignalForm\n * \n * @example\n * ```typescript\n * if (isSignalFormGroup(value)) {\n * console.log(value.controls.name); // TypeScript knows this is a form group\n * }\n * ```\n */\nexport function isSignalFormGroup<TData extends object>(\n obj: unknown,\n): obj is SignalForm<TData> {\n return (\n !!obj &&\n typeof obj === 'object' &&\n (obj as SignalForm<TData>).kind === 'group'\n );\n}\n\n/**\n * Creates a reactive form group for managing structured form data.\n * \n * Builds a typed form container that holds multiple named controls, groups, or arrays.\n * Each property in the input object becomes a control with full signal-based reactivity.\n * Provides type-safe access to controls and tracks collective validation state.\n * \n * Features:\n * - Type-safe control access via `.controls` property\n * - Reactive value and error tracking across all controls\n * - Collective state management (touched, dirty, valid)\n * - Manual error/warning management at group level\n * - Support for nested groups and arrays\n * - Cross-field validation via getControl accessor\n * \n * @template TData - Object type defining the structure and types of all controls\n * \n * @param inputs - Object mapping property names to their control inputs\n * @returns Fully configured SignalForm instance\n * \n * @example\n * ```typescript\n * // Simple form\n * const form = createSignalFormGroup({\n * name: 'John',\n * age: 25\n * });\n * \n * // With validators and nested structure\n * const form = createSignalFormGroup<User>({\n * email: {\n * value: '',\n * validators: [signalFormValidators.required, signalFormValidators.email]\n * },\n * age: {\n * value: 25,\n * validators: [signalFormValidators.min(0)],\n * warnings: [signalFormValidators.max(120)]\n * },\n * address: {\n * street: '123 Main St',\n * city: 'NYC'\n * },\n * hobbies: ['coding', 'gaming']\n * });\n * \n * // Access controls\n * form.controls.email.value(); // Type-safe access\n * form.getControl('age').setValue(30);\n * ```\n */\nexport function createSignalFormGroup<TData extends object>(\n inputs: SignalFormInputs<TData>,\n): SignalForm<TData> {\n // type _Controls = { [Key in keyof TData]: SignalFormControlLike<TData[Key]> };\n type _ControlsValues = SignalFormControlLike<TData[keyof TData]>;\n\n const controls = {} as {\n [Key in keyof TData]: SignalFormControlLike<TData[Key]>;\n };\n\n const getControl: ControlAccessor<TData> = key => controls[key];\n\n Object.entries(inputs).forEach(([key, value]) => {\n controls[key as keyof TData] = createNodeFromInput(\n value as SignalFormInput<TData[keyof TData], TData>,\n getControl,\n );\n });\n\n const selfDirty = signal(false);\n const selfTouched = signal(false);\n const selfDisabled = signal(false);\n const manualErrors = signal<Record<string, string>>({});\n const manualWarnings = signal<Record<string, string>>({});\n\n const value = computed(() => {\n return (\n Object.entries(controls) as [\n string,\n SignalFormControlLike<TData[keyof TData]>,\n ][]\n ).reduce(\n (acc, [key, control]) => {\n acc[key as keyof TData] = control.value() as SignalFormValueFor<\n TData[keyof TData]\n >;\n return acc;\n },\n {} as { [Key in keyof TData]: SignalFormValueFor<TData[Key]> },\n );\n });\n\n const errors = computed(() => {\n const all = {} as { [Key in keyof TData]: SignalFormErrorFor<TData[Key]> };\n (\n Object.entries(controls) as [\n string,\n SignalFormControlLike<TData[keyof TData]>,\n ][]\n ).forEach(([key, control]) => {\n if (control.kind === 'control') {\n const map = control.errors();\n all[key as keyof TData] = (\n hasErrors(map) ? map : undefined\n ) as SignalFormErrorFor<TData[keyof TData]>;\n return;\n }\n const childErrors = control.errors();\n all[key as keyof TData] = (\n isEmptyErrorTree(childErrors) ? undefined : childErrors\n ) as SignalFormErrorFor<TData[keyof TData]>;\n });\n return all;\n });\n\n const warnings = computed(() => {\n const all = {} as { [Key in keyof TData]: SignalFormErrorFor<TData[Key]> };\n (\n Object.entries(controls) as [\n string,\n SignalFormControlLike<TData[keyof TData]>,\n ][]\n ).forEach(([key, control]) => {\n if (control.kind === 'control') {\n const map = control.warnings();\n all[key as keyof TData] = (\n hasErrors(map) ? map : undefined\n ) as SignalFormErrorFor<TData[keyof TData]>;\n return;\n }\n const childWarnings = control.warnings();\n all[key as keyof TData] = (\n isEmptyErrorTree(childWarnings) ? undefined : childWarnings\n ) as SignalFormErrorFor<TData[keyof TData]>;\n });\n return all;\n });\n\n const selfErrors = computed(() => {\n if (selfDisabled()) return {};\n return { ...manualErrors() };\n });\n\n const selfWarnings = computed(() => {\n if (selfDisabled()) return {};\n return { ...manualWarnings() };\n });\n\n const invalid = computed(() => {\n if (selfDisabled()) return false;\n return (\n hasErrors(selfErrors()) ||\n (Object.values(controls) as _ControlsValues[]).some(control =>\n control.invalid(),\n )\n );\n });\n\n const valid = computed(() => !invalid());\n\n const touched = computed(\n () =>\n selfTouched() ||\n (Object.values(controls) as _ControlsValues[]).some(control =>\n control.touched(),\n ),\n );\n\n const dirty = computed(\n () =>\n selfDirty() ||\n (Object.values(controls) as _ControlsValues[]).some(control =>\n control.dirty(),\n ),\n );\n\n const setValue = (\n nextValues: Partial<{\n [Key in keyof TData]: SignalFormValueFor<TData[Key]>;\n }>,\n options?: SignalFormSetValueOptions,\n ): void => {\n Object.entries(nextValues).forEach(([key, nextValue]) => {\n const control = controls[key as keyof TData];\n control?.setValue(nextValue as never, options);\n });\n if (options?.markDirty ?? true) selfDirty.set(true);\n if (options?.markTouched) selfTouched.set(true);\n };\n\n const reset = (\n nextValues?: Partial<{\n [Key in keyof TData]: SignalFormValueFor<TData[Key]>;\n }>,\n ): void => {\n if (nextValues) {\n setValue(nextValues, { markDirty: false });\n } else {\n (Object.values(controls) as _ControlsValues[]).forEach(control =>\n control.reset(),\n );\n }\n selfDirty.set(false);\n selfTouched.set(false);\n manualErrors.set({});\n manualWarnings.set({});\n };\n\n const setDisabled = (\n disabled: boolean,\n options?: SignalFormDisableOptions,\n ): void => {\n selfDisabled.set(disabled);\n if (!options?.onlySelf) {\n (Object.values(controls) as _ControlsValues[]).forEach(control =>\n control.setDisabled(disabled),\n );\n }\n };\n\n return {\n kind: 'group',\n controls,\n value,\n errors,\n warnings,\n selfErrors,\n selfWarnings,\n disabled: computed(() => selfDisabled()),\n touched,\n dirty,\n invalid,\n valid,\n getControl,\n setValue,\n reset,\n markTouched: () => selfTouched.set(true),\n markUntouched: () => selfTouched.set(false),\n markDirty: () => selfDirty.set(true),\n markPristine: () => selfDirty.set(false),\n markAllTouched: () =>\n (Object.values(controls) as _ControlsValues[]).forEach(control =>\n control.markTouched(),\n ),\n setDisabled,\n setError: (key: string, message: string) =>\n manualErrors.update(current => ({ ...current, [key]: message })),\n clearError: (key: string) =>\n manualErrors.update(current => {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { [key]: _removed, ...rest } = current;\n return rest;\n }),\n clearErrors: () => manualErrors.set({}),\n setWarning: (key: string, message: string) =>\n manualWarnings.update(current => ({ ...current, [key]: message })),\n clearWarning: (key: string) =>\n manualWarnings.update(current => {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { [key]: _removed, ...rest } = current;\n return rest;\n }),\n clearWarnings: () => manualWarnings.set({}),\n };\n}\n\n/**\n * Helper function to create a standalone form control.\n * \n * Creates a control without sibling control access. Useful for creating\n * individual controls outside of a form group context.\n * \n * @template TValue - The type of value the control manages\n * @param input - Control input (raw value, config object, or existing control)\n * @returns SignalFormControl instance\n * \n * @example\n * ```typescript\n * const nameControl = formControl('John');\n * const ageControl = formControl({\n * value: 25,\n * validators: [signalFormValidators.min(0)]\n * });\n * ```\n */\nexport function formControl<TValue>(\n input: SignalFormControlInput<TValue, object>,\n): SignalFormControl<TValue> {\n return createSignalFormControl(input, undefined);\n}\n\n/**\n * Helper function to create a standalone form array.\n * \n * Creates an array without sibling control access. Useful for creating\n * array controls outside of a form group context.\n * \n * @template TValue - The type of each item in the array\n * @param input - Array of initial items\n * @returns SignalFormArray instance\n * \n * @example\n * ```typescript\n * const tagsArray = formArray(['tag1', 'tag2', 'tag3']);\n * const addressesArray = formArray<Address>([\n * { street: '123 Main', city: 'NYC' }\n * ]);\n * ```\n */\nexport function formArray<TValue>(\n input: SignalFormInput<TValue, object>[],\n): SignalFormArray<TValue> {\n return createSignalFormArray(input, undefined);\n}\n\n/**\n * Helper function to create a form group.\n * \n * Alias for createSignalFormGroup. Creates a typed form with multiple controls.\n * \n * @template TData - Object type defining the form structure\n * @param input - Object mapping property names to control inputs\n * @returns SignalForm instance\n * \n * @example\n * ```typescript\n * const form = formGroup({\n * name: 'John',\n * email: {\n * value: 'john@example.com',\n * validators: [signalFormValidators.email]\n * }\n * });\n * ```\n */\nexport function formGroup<TData extends object>(\n input: SignalFormInputs<TData>,\n): SignalForm<TData> {\n return createSignalFormGroup(input);\n}\n\n/**\n * Primary API for creating signal-based reactive forms.\n * \n * Alias for `formGroup`. This is the main entry point for creating forms.\n * Provides type-safe, signal-based form state management with built-in validation.\n * \n * @example\n * ```typescript\n * // Basic form\n * const form = signalForm({ name: 'John', age: 25 });\n * \n * // Complex form with validation\n * const form = signalForm<Person>({\n * name: {\n * value: '',\n * validators: [signalFormValidators.required, signalFormValidators.minLength(2)]\n * },\n * age: {\n * value: 30,\n * validators: [signalFormValidators.min(0)],\n * warnings: [signalFormValidators.max(120)],\n * disabled: (ctx) => ctx.getControl('name').value() === 'admin'\n * },\n * address: {\n * street: '123 Main St',\n * city: 'NYC'\n * },\n * hobbies: ['coding', 'gaming']\n * });\n * \n * // Access form state\n * console.log(form.value()); // { name: '', age: 30, address: {...}, hobbies: [...] }\n * console.log(form.valid()); // boolean\n * console.log(form.controls.name.errors()); // { required: 'This field is required' }\n * ```\n */\nexport const signalForm = formGroup;\n","import { computed, signal } from '@angular/core';\n\nimport { createSignalFormControl, isSignalFormControl } from './control';\nimport { hasErrors, isEmptyErrorTree } from './errors';\nimport { createSignalFormGroup, isSignalFormGroup } from './form';\nimport {\n SignalFormArray,\n SignalFormControlLike,\n SignalFormDisableOptions,\n SignalFormErrorFor,\n SignalFormInput,\n SignalFormInputs,\n SignalFormSetValueOptions,\n SignalFormValueFor,\n} from './types';\n\n/**\n * Internal type for accessing sibling controls in a form.\n * \n * @internal\n */\ntype ControlAccessor<TControls extends object> = <Key extends keyof TControls>(\n controlName: Key,\n) => SignalFormControlLike<TControls[Key]>;\n\n/**\n * Set of valid keys for control configuration objects.\n * Used to distinguish config objects from plain value objects.\n * \n * @internal\n */\nconst CONTROL_CONFIG_KEYS = new Set([\n 'value',\n 'validators',\n 'warnings',\n 'disabled',\n]);\n\n/**\n * Checks if a value is a control configuration object.\n * \n * Determines if the value has a 'value' property and only contains\n * valid control config keys (value, validators, warnings, disabled).\n * \n * @internal\n * @param value - Value to check\n * @returns True if value is a control config object\n */\nfunction isControlConfig(value: unknown): boolean {\n if (!value || typeof value !== 'object') return false;\n if (!('value' in (value as Record<string, unknown>))) return false;\n return Object.keys(value as Record<string, unknown>).every(key =>\n CONTROL_CONFIG_KEYS.has(key),\n );\n}\n\n/**\n * Creates the appropriate control node from various input types.\n * \n * Recursively determines and creates the correct control type:\n * - Existing controls are returned as-is\n * - Arrays become SignalFormArray\n * - Objects (non-config) become SignalForm (group)\n * - Primitives/configs become SignalFormControl\n * \n * @internal\n * @template TItem - The type of item to create a control for\n * @template TControls - Object type defining available sibling controls\n * @param input - Input value in any accepted format\n * @param getControl - Accessor for sibling controls\n * @returns Appropriate control type for the input\n */\nfunction createNodeFromInput<TItem, TControls extends object>(\n input: SignalFormInput<TItem, TControls> | SignalFormValueFor<TItem>,\n getControl: ControlAccessor<TControls>,\n): SignalFormControlLike<TItem> {\n if (isSignalFormControl<TItem>(input)) {\n return input as SignalFormControlLike<TItem>;\n }\n if (isSignalFormGroup<object>(input)) {\n return input as SignalFormControlLike<TItem>;\n }\n if (isSignalFormArray<TItem>(input)) {\n return input as SignalFormControlLike<TItem>;\n }\n if (Array.isArray(input)) {\n return createSignalFormArray(\n input as SignalFormInput<TItem, TControls>[],\n getControl,\n ) as SignalFormControlLike<TItem>;\n }\n if (typeof input === 'object' && input !== null && !isControlConfig(input)) {\n return createSignalFormGroup(\n input as SignalFormInputs<TItem & object>,\n ) as SignalFormControlLike<TItem>;\n }\n return createSignalFormControl(\n input as SignalFormInput<TItem, TControls>,\n getControl,\n ) as SignalFormControlLike<TItem>;\n}\n\n/**\n * Type guard to check if an object is a SignalFormArray.\n * \n * @template TValue - The type of items in the array\n * @param obj - Object to check\n * @returns True if obj is a SignalFormArray\n * \n * @example\n * ```typescript\n * if (isSignalFormArray(value)) {\n * console.log(value.controls().length); // TypeScript knows this is an array\n * }\n * ```\n */\nexport function isSignalFormArray<TValue>(\n obj: unknown,\n): obj is SignalFormArray<TValue> {\n return (\n !!obj &&\n typeof obj === 'object' &&\n (obj as SignalFormArray<TValue>).kind === 'array'\n );\n}\n\n/**\n * Creates a reactive form array for managing dynamic collections of controls.\n * \n * Builds an array container that can hold multiple controls (primitives, groups, or nested arrays)\n * with full signal-based reactivity. Provides methods for dynamic addition/removal of items\n * and tracks collective validation state.\n * \n * Features:\n * - Dynamic array operations (push, insert, remove, clear)\n * - Reactive value and error tracking across all items\n * - Collective state management (touched, dirty, valid)\n * - Manual error/warning management at array level\n * - Type-safe access to individual controls\n * \n * @template TItem - The type of each item in the array\n * @template TControls - Object type defining available sibling controls\n * \n * @param inputItems - Array of initial items (values, configs, or controls)\n * @param getControl - Optional accessor for sibling controls\n * @returns Fully configured SignalFormArray instance\n * \n * @example\n * ```typescript\n * // Array of primitives\n * const tagsArray = createSignalFormArray(['tag1', 'tag2']);\n * tagsArray.push('tag3');\n * \n * // Array of objects\n * const addressesArray = createSignalFormArray<Address>([\n * { street: '123 Main', city: 'NYC' },\n * { street: '456 Oak', city: 'LA' }\n * ]);\n * \n * // Array with validators\n * const hobbiesArray = createSignalFormArray([\n * { value: 'coding', validators: [signalFormValidators.minLength(3)] },\n * 'gaming'\n * ]);\n * ```\n */\nexport function createSignalFormArray<TItem, TControls extends object = object>(\n inputItems: SignalFormInput<TItem, TControls>[],\n getControl?: ControlAccessor<TControls>,\n): SignalFormArray<TItem> {\n const accessControl =\n getControl ??\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n (((_: keyof TControls) => {\n throw new Error('getControl is not available for this array.');\n }) as ControlAccessor<TControls>);\n\n const controls = signal<SignalFormControlLike<TItem>[]>(\n inputItems.map(item => createNodeFromInput(item, accessControl)),\n );\n\n const selfDirty = signal(false);\n const selfTouched = signal(false);\n const selfDisabled = signal(false);\n const manualErrors = signal<Record<string, string>>({});\n const manualWarnings = signal<Record<string, string>>({});\n\n const value = computed<SignalFormValueFor<TItem>[]>(\n () =>\n controls().map(control => control.value()) as SignalFormValueFor<TItem>[],\n );\n\n const errors = computed<SignalFormErrorFor<TItem>[]>(\n () =>\n controls().map(control => {\n if (control.kind === 'control') {\n const map = control.errors();\n return hasErrors(map) ? map : undefined;\n }\n const childErrors = control.errors();\n return isEmptyErrorTree(childErrors) ? undefined : childErrors;\n }) as SignalFormErrorFor<TItem>[],\n );\n\n const warnings = computed<SignalFormErrorFor<TItem>[]>(\n () =>\n controls().map(control => {\n if (control.kind === 'control') {\n const map = control.warnings();\n return hasErrors(map) ? map : undefined;\n }\n const childWarnings = control.warnings();\n return isEmptyErrorTree(childWarnings) ? undefined : childWarnings;\n }) as SignalFormErrorFor<TItem>[],\n );\n\n const selfErrors = computed(() => {\n if (selfDisabled()) return {};\n return { ...manualErrors() };\n });\n\n const selfWarnings = computed(() => {\n if (selfDisabled()) return {};\n return { ...manualWarnings() };\n });\n\n const invalid = computed(() => {\n if (selfDisabled()) return false;\n return (\n hasErrors(selfErrors()) || controls().some(control => control.invalid())\n );\n });\n\n const valid = computed(() => !invalid());\n\n const touched = computed(\n () => selfTouched() || controls().some(control => control.touched()),\n );\n\n const dirty = computed(\n () => selfDirty() || controls().some(control => control.dirty()),\n );\n\n const insert = (\n item: SignalFormInput<TItem, TControls> | SignalFormValueFor<TItem>,\n index?: number,\n ): number => {\n const node = createNodeFromInput(item, accessControl);\n const position = index ?? controls().length;\n controls.update(old => {\n const newArray = [...old];\n newArray.splice(position, 0, node)\n return newArray;\n });\n selfDirty.set(true);\n return position;\n };\n\n const push = (\n item: SignalFormInput<TItem, TControls> | SignalFormValueFor<TItem>,\n ): number => insert(item);\n\n const removeAt = (index: number): void => {\n controls.update(old => {\n const newArray = [...old];\n newArray.splice(index, 1);\n return newArray;\n });\n selfDirty.set(true);\n };\n\n const clear = (): void => {\n controls.set([]);\n selfDirty.set(true);\n };\n\n const at = (index: number): SignalFormControlLike<TItem> | undefined =>\n controls()[index];\n\n const setValue = (\n nextValues: SignalFormValueFor<TItem>[],\n options?: SignalFormSetValueOptions,\n ): void => {\n controls.update(old => {\n if (nextValues.length !== old.length) {\n return nextValues.map(_value =>\n createNodeFromInput(_value, accessControl),\n );\n }\n old.forEach((control, index) => {\n control.setValue(nextValues[index] as never, options);\n });\n return old;\n });\n if (options?.markDirty ?? true) selfDirty.set(true);\n if (options?.markTouched) selfTouched.set(true);\n };\n\n const reset = (nextValues?: SignalFormValueFor<TItem>[]): void => {\n if (nextValues) {\n setValue(nextValues, { markDirty: false });\n } else {\n controls().forEach(control => control.reset());\n }\n selfDirty.set(false);\n selfTouched.set(false);\n manualErrors.set({});\n manualWarnings.set({});\n };\n\n const setDisabled = (\n disabled: boolean,\n options?: SignalFormDisableOptions,\n ): void => {\n selfDisabled.set(disabled);\n if (!options?.onlySelf) {\n controls().forEach(control => control.setDisabled(disabled));\n }\n };\n\n return {\n kind: 'array',\n controls,\n value,\n errors,\n warnings,\n selfErrors,\n selfWarnings,\n disabled: computed(() => selfDisabled()),\n touched,\n dirty,\n invalid,\n valid,\n insert,\n push,\n removeAt,\n clear,\n at,\n setValue,\n reset,\n markTouched: () => selfTouched.set(true),\n markUntouched: () => selfTouched.set(false),\n markDirty: () => selfDirty.set(true),\n markPristine: () => selfDirty.set(false),\n markAllTouched: () => controls().forEach(control => control.markTouched()),\n setDisabled,\n setError: (key: string, message: string) =>\n manualErrors.update(current => ({ ...current, [key]: message })),\n clearError: (key: string) =>\n manualErrors.update(current => {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { [key]: _removed, ...rest } = current;\n return rest;\n }),\n clearErrors: () => manualErrors.set({}),\n setWarning: (key: string, message: string) =>\n manualWarnings.update(current => ({ ...current, [key]: message })),\n clearWarning: (key: string) =>\n manualWarnings.update(current => {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { [key]: _removed, ...rest } = current;\n return rest;\n }),\n clearWarnings: () => manualWarnings.set({}),\n };\n}\n","import { SignalFormValidatorFn } from './types';\n\nexport type {\n FirstError,\n SignalFormValidationError,\n SignalFormValidatorFn,\n} from './types';\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype ValidatorFn = SignalFormValidatorFn<any, any>;\n\n/**\n * Regular expression for email validation.\n * \n * Aligned with Angular's built-in email validator. Validates standard email formats\n * with proper domain and local parts.\n * \n * Pattern requirements:\n * - Total length: 1-254 characters\n * - Local part (before @): 1-64 characters\n * - Allows alphanumeric and special characters: !#$%&'*+/=?^_`{|}~-\n * - Domain must have valid format with optional subdomains\n */\nconst EMAIL_REGEXP =\n /^(?=.{1,254}$)(?=.{1,64}@)[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+(?:\\.[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+)*@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/;\n\n/**\n * Determines if a value is considered empty for validation purposes.\n * \n * Checks various types:\n * - null/undefined: always empty\n * - Numbers: empty when equals 0\n * - Strings/Arrays: empty when length is 0\n * - Sets: empty when size is 0\n * \n * @param value - Value to check for emptiness\n * @returns True if the value is considered empty\n * \n * @example\n * ```typescript\n * isEmptyInputValue(null); // true\n * isEmptyInputValue(''); // true\n * isEmptyInputValue(0); // true\n * isEmptyInputValue('hello'); // false\n * ```\n */\nfunction isEmptyInputValue(value: unknown): boolean {\n if (value === null || value === undefined) return true;\n // TODO 1: check if number==0 is empty or number.length==0 is empty\n if (typeof value === 'number' /* or - isNumber(value) */) {\n return value == 0;\n }\n if (Array.isArray(value) || typeof value === 'string') {\n return value.length === 0;\n }\n if (value instanceof Set) {\n return value.size === 0;\n }\n return false;\n}\n\n/**\n * Type guard that checks if a value can be coerced to a valid number.\n * \n * Uses JavaScript's Number coercion and checks for NaN to determine\n * if a value represents a valid numeric value.\n * \n * @param value - Value to check\n * @returns True if value is or can be coerced to a number\n * \n * @example\n * ```typescript\n * isNumber(42); // true\n * isNumber('42'); // true\n * isNumber('hello'); // false\n * ```\n */\nfunction isNumber(value: unknown): value is number {\n return !Number.isNaN(Number(value));\n}\n\n/**\n * Validator that requires a non-empty value.\n * \n * Fails when the value is null, undefined, empty string, empty array,\n * zero (for numbers), or empty Set.\n * \n * @param ctx - Validation context with the value to check\n * @returns Error object with 'required' key if validation fails, null otherwise\n * \n * @example\n * ```typescript\n * const control = signalForm({ name: { value: '', validators: [signalFormValidators.required] } });\n * // control.controls.name.errors() => { required: 'This field is required' }\n * ```\n */\nconst required: ValidatorFn = ({ item: { value } }) =>\n isEmptyInputValue(value) ? { required: 'This field is required' } : null;\n\n/**\n * Validator that enforces a maximum string or number length.\n * \n * Converts the value to string and checks if its length exceeds the specified maximum.\n * Works with both string and number types.\n * \n * @param num - Maximum allowed length (inclusive)\n * @returns Validator function\n * \n * @example\n * ```typescript\n * const control = signalForm({\n * username: { value: 'verylongusername', validators: [signalFormValidators.maxLength(10)] }\n * });\n * // control.controls.username.errors() => { maxLength: 'To long' }\n * ```\n */\nfunction maxLength(num: number): ValidatorFn {\n return ({ item: { value } }) =>\n (typeof value == 'string' || typeof value == 'number') &&\n value.toString().length > num\n ? { maxLength: 'To long' }\n : null;\n}\n\n/**\n * Validator that enforces a minimum string or number length.\n * \n * Converts the value to string and checks if its length is less than or equal to the specified minimum.\n * Works with both string and number types.\n * \n * @param num - Minimum required length (inclusive)\n * @returns Validator function\n * \n * @example\n * ```typescript\n * const control = signalForm({\n * code: { value: 'ab', validators: [signalFormValidators.minLength(3)] }\n * });\n * // control.controls.code.errors() => { minLength: 'To short' }\n * ```\n */\nfunction minLength(num: number): ValidatorFn {\n return ({ item: { value } }) =>\n (typeof value == 'string' || typeof value == 'number') &&\n value.toString().length <= num\n ? { minLength: 'To short' }\n : null;\n}\n\n/**\n * Validator that enforces a minimum numeric value.\n * \n * Checks if a numeric value is less than or equal to the specified minimum.\n * Value is coerced to a number for comparison.\n * \n * @param num - Minimum allowed value (exclusive - value must be greater than this)\n * @returns Validator function\n * \n * @example\n * ```typescript\n * const control = signalForm({\n * age: { value: -5, validators: [signalFormValidators.min(0)] }\n * });\n * // control.controls.age.errors() => { minLength: 'To small' }\n * ```\n */\nfunction min(num: number): ValidatorFn {\n return ({ item: { value } }) =>\n isNumber(value) && value <= num ? { minLength: 'To small' } : null;\n}\n\n/**\n * Validator that enforces a maximum numeric value.\n * \n * Checks if a numeric value exceeds the specified maximum.\n * Value is coerced to a number for comparison.\n * \n * @param num - Maximum allowed value (inclusive)\n * @returns Validator function\n * \n * @example\n * ```typescript\n * const control = signalForm({\n * age: { value: 150, validators: [signalFormValidators.max(120)] }\n * });\n * // control.controls.age.errors() => { minLength: 'To big' }\n * ```\n */\nfunction max(num: number): ValidatorFn {\n return ({ item: { value } }) =>\n isNumber(value) && value > num ? { minLength: 'To big' } : null;\n}\n\n/**\n * Validator that checks if a value is a valid email address.\n * \n * Uses Angular-compatible email regex pattern to validate email format.\n * Skips validation for empty values (use with `required` if needed).\n * \n * @param ctx - Validation context with the email value to check\n * @returns Error object with 'email' key if validation fails, null otherwise\n * \n * @example\n * ```typescript\n * const control = signalForm({\n * email: { value: 'invalid-email', validators: [signalFormValidators.email] }\n * });\n * // control.controls.email.errors() => { email: 'Invalid email' }\n * ```\n */\nconst email: ValidatorFn = ({ item: { value } }) => {\n if (isEmptyInputValue(value)) return null;\n return EMAIL_REGEXP.test(String(value)) ? null : { email: 'Invalid email' };\n};\n\n/**\n * Validator that checks if a value matches a specified regular expression pattern.\n * \n * Accepts either a RegExp object or a string pattern. String patterns are automatically\n * wrapped with ^ and $ anchors to match the entire value.\n * \n * Skips validation for empty values (use with `required` if needed).\n * \n * @param valuePattern - Regular expression or pattern string to match against\n * @returns Validator function\n * \n * @example\n * ```typescript\n * // Using regex\n * const control1 = signalForm({\n * code: { value: 'abc', validators: [signalFormValidators.pattern(/^[0-9]+$/)] }\n * });\n * // control1.controls.code.errors() => { pattern: 'RequiredPattern: ^[0-9]+$, ActualValue: abc' }\n * \n * // Using string pattern\n * const control2 = signalForm({\n * zipCode: { value: 'ABC', validators: [signalFormValidators.pattern('[0-9]{5}')] }\n * });\n * ```\n */\nfunction pattern(valuePattern: string | RegExp): ValidatorFn {\n if (!valuePattern) return () => null;\n let regex: RegExp;\n let regexStr: string;\n if (typeof valuePattern === 'string') {\n regexStr = '';\n if (valuePattern.charAt(0) !== '^') regexStr += '^';\n regexStr += valuePattern;\n if (valuePattern.charAt(valuePattern.length - 1) !== '$') regexStr += '$';\n regex = new RegExp(regexStr);\n } else {\n regexStr = valuePattern.toString();\n regex = valuePattern;\n }\n\n return ({ item: { value } }) => {\n if (isEmptyInputValue(value)) return null;\n const valueStr = String(value);\n return regex.test(valueStr)\n ? null\n : {\n pattern: `RequiredPattern: ${regexStr}, ActualValue: ${valueStr}`,\n };\n };\n}\n\n/**\n * Collection of built-in validators for signal-form controls.\n * \n * Provides common validation functions that can be used in the `validators` or `warnings`\n * arrays of form controls. All validators skip empty values except `required`.\n * \n * @property required - Ensures the value is not empty (null, undefined, '', [], 0, empty Set)\n * @property maxLength - Ensures string/number length doesn't exceed maximum\n * @property minLength - Ensures string/number length meets minimum requirement\n * @property min - Ensures numeric value is greater than minimum (exclusive)\n * @property max - Ensures numeric value doesn't exceed maximum (inclusive)\n * @property email - Validates email address format using Angular-compatible regex\n * @property pattern - Validates value matches a regular expression pattern\n * \n * @example\n * ```typescript\n * const form = signalForm({\n * email: {\n * value: '',\n * validators: [signalFormValidators.required, signalFormValidators.email]\n * },\n * age: {\n * value: 25,\n * validators: [signalFormValidators.min(0), signalFormValidators.max(120)],\n * warnings: [signalFormValidators.max(100)] // Warning but doesn't invalidate\n * },\n * username: {\n * value: '',\n * validators: [\n * signalFormValidators.required,\n * signalFormValidators.minLength(3),\n * signalFormValidators.maxLength(20),\n * signalFormValidators.pattern(/^[a-zA-Z0-9_]+$/)\n * ]\n * }\n * });\n * ```\n */\nexport const signalFormValidators = {\n required,\n maxLength,\n minLength,\n min,\n max,\n email,\n pattern,\n};\n","export * from './array';\nexport * from './control';\nexport * from './form';\nexport * from './types';\nexport * from './validators';\n\n/**\n * Example demonstrating the usage of signal-based reactive forms.\n *\n * Shows various features including:\n * - Simple value initialization\n * - Validators that mark controls as invalid\n * - Warnings that don't affect validity\n * - Dynamic disabled state based on other controls\n * - Nested objects and arrays\n * - Type-safe control access\n *\n * This function is exported as an example and reference implementation.\n * It's not meant to be called in production code.\n *\n * @example\n * ```typescript\n * // Basic usage pattern from the example\n * const form = signalForm<Person>({\n * name: 'dvirus',\n * age: {\n * value: 130,\n * validators: [signalFormValidators.required, signalFormValidators.min(0)],\n * warnings: [signalFormValidators.max(120)],\n * disabled: (ctx) => ctx.getControl('name').value() === 'admin'\n * },\n * address: {\n * street: { value: '123 Main St', validators: [signalFormValidators.required] }\n * },\n * hobbies: [\n * { value: 'coding', validators: [signalFormValidators.minLength(3)] },\n * 'programming'\n * ]\n * });\n *\n * // Access form state\n * form.getControl('address').value(); // { street: '123 Main St' }\n * form.controls.hobbies.controls()[0].errors(); // {}\n * form.controls.age.firstErrorOrWarning(); // { name: 'max', message: 'To big', type: 'warning' }\n * ```\n */\n// function main() {\n// type Person = {\n// name: string;\n// age: number;\n// address: {\n// street: string;\n// city: string;\n// };\n// hobbies: string[];\n// };\n\n// /**\n// * Example 1: Simple form with direct value initialization.\n// *\n// * Creates a form from a plain object. Each property becomes\n// * a control with the provided value.\n// */\n// const model1: Person = {\n// name: 'dvirus',\n// age: 30,\n// address: {\n// street: '123 Main St',\n// city: 'Any-town',\n// },\n// hobbies: ['coding', 'gaming'],\n// };\n\n// const form1 = signalForm(model1);\n\n// /**\n// * Example 2: Advanced form with validators, warnings, and dynamic disabled state.\n// *\n// * Demonstrates:\n// * - Simple value for name field\n// * - Age control with validators (required, min) and warnings (max)\n// * - Dynamic disabled logic based on name value\n// * - Nested address object with validated street field\n// * - Array of hobbies with mixed control configs and simple values\n// */\n// const form2 = signalForm<Person>({\n// name: 'dvirus',\n// age: {\n// // initial value\n// value: 130,\n// // example of validators, they add error messages and mark the control as invalid if the validation fails\n// validators: [signalFormValidators.required, signalFormValidators.min(0)],\n// // warning are like validators but they don't make the control invalid, just add a warning message\n// warnings: [signalFormValidators.max(120)],\n// // example of dynamic disabling based on another control's value\n// disabled: (ctx) => ctx.getControl('name').value() === 'admin',\n// },\n// address: {\n// street: {\n// value: '123 Main St',\n// validators: [signalFormValidators.required],\n// disabled: false,\n// },\n// },\n// hobbies: [\n// {\n// value: 'coding',\n// validators: [signalFormValidators.minLength(3)],\n// disabled: computed(() => false),\n// },\n// 'programming',\n// 'Typing',\n// ],\n// });\n\n// // Example outputs demonstrating form access patterns\n// console.log(form2.getControl('address').value()); // { street: '123 Main St' }\n// console.log(form2.controls.hobbies.controls()[0].errors()); // {}\n// console.log(form2.controls.age.firstErrorOrWarning()); // {name: 'minLength', message: 'To big', type: 'warning'}\n// console.log(form2.controls.age.warnings()); // { minLength: 'To big' }\n// }\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["CONTROL_CONFIG_KEYS","isControlConfig","createNodeFromInput"],"mappings":";;;;AAsCA;;;;;;AAMG;AACG,SAAU,WAAW,CAAuB,GAAM,EAAA;AACtD,IAAA,OAAO,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,CAC/B,CAAC,IAAI,EAAE,CAAC,GAAG,EAAE,KAAK,CAAC,MAAM,EAAE,GAAG,IAAI,EAAE,CAAC,GAAG,GAAG,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,EAC3D,EAA0B,CAC3B;AACH;AAEA;;;;;;AAMG;AACG,SAAU,aAAa,CAA2B,GAA4B,EAAA;AAClF,IAAA,OAAO,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,CAC/B,CAAC,IAAI,EAAE,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,IAAI,EAAE,CAAC,GAAG,GAAG,aAAa,CAAC,MAAM,CAAC,EAAE,CAAC,EACpE,EAAW,CACZ;AACH;AAEA;;;;;;;AAOG;AACG,SAAU,aAAa,CAAI,KAAuB,EAAA;AACtD,IAAA,OAAO,QAAQ,CAAC,KAAK,CAAC,GAAG,KAAK,EAAE,GAAG,KAAK;AAC1C;AAEA;SACgB,gBAAgB,CAC9B,KAAkD,EAClD,GAAG,MAAc,EAAA;IAEjB,IAAI,GAAG,GAAG,KAAK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AAI;AACzC,QAAA,MAAM,QAAQ,GAAG,MAAM,CAAC,KAAK,CAAC;AAC9B,QAAA,OAAO,KAAK,CAAC,IAAI,CAAC,QAAQ;AACxB,cAAE;AACF,cAAE;AACE,gBAAA,OAAO,EAAE,CAAA,iBAAA,EAAoB,QAAQ,CAAA,eAAA,EAAkB,QAAQ,CAAA,CAAE;aAClE;AACP,IAAA,CAAC;AACH;AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqCG;AACI,MAAM,oBAAoB,GAAG;IAClC,QAAQ;IACR,SAAS;IACT,SAAS;IACT,GAAG;IACH,GAAG;IACH,KAAK;IACL,OAAO;;;ACjTT;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuCG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;;ACxHA;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"dvirus-js-angular-signals.mjs","sources":["../../../../../packages/angular/signals/src/lib/utils/signals.utils.ts","../../../../../packages/angular/signals/src/lib/utils/signal-notifier.ts","../../../../../packages/angular/signals/src/lib/utils/try-catch.ts","../../../../../packages/angular/signals/src/lib/utils/signal-debounce.ts","../../../../../packages/angular/signals/src/lib/utils/writable-signal.ts","../../../../../packages/angular/signals/src/lib/utils/signal-set.ts","../../../../../packages/angular/signals/src/lib/utils/signal-map.ts","../../../../../packages/angular/signals/src/lib/utils/signal-object.ts","../../../../../packages/angular/signals/src/lib/utils/control-signal.ts","../../../../../packages/angular/signals/src/dvirus-js-angular-signals.ts"],"sourcesContent":["import { isSignal, signal, Signal, WritableSignal } from '@angular/core';\nimport { ObjectType } from './object-type';\n\n\n/**\n * Represents an object where each property is a read-only Signal.\n * Useful for mapping state objects to their signal equivalents.\n */\nexport type SignalObj<T extends ObjectType = ObjectType> = {\n [Key in keyof T]: Signal<T[Key]>;\n};\n\n/**\n * Represents an object where each property is a WritableSignal.\n * Allows for direct modification of the signal values within the object structure.\n */\nexport type SignalObjWritable<T extends ObjectType> = {\n [Key in keyof T]: WritableSignal<T[Key]>;\n};\n\n/**\n * A type representing either a Signal of type T or the raw value of type T.\n * Useful for inputs that can accept both static values and reactive signals.\n */\nexport type SignalOrValue<T> = Signal<T> | T;\n\n/**\n * Represents an object where each property can be either a Signal of a certain type\n * or the raw value of that type.\n *\n * @template TValues The type of the values contained within the SignalOrValue properties.\n * Defaults to a union of ObjectType, string, number, or undefined.\n */\nexport type SignalOrValueObj<TValues = ObjectType | string | number | boolean | undefined> =\n TValues extends object\n ? { [Key in keyof TValues]: SignalOrValue<TValues[Key]> }\n : Record<string, SignalOrValue<TValues>>;\n\n/**\n * Converts a plain object into a writable signal object.\n * Each property of the source object becomes a WritableSignal initialized with the property's value.\n *\n * @param src - The source object to convert.\n * @returns An object with the same keys as the source, but with values wrapped in WritableSignals.\n */\nexport function toSignalObj<T extends ObjectType>(src: T): SignalObjWritable<T> {\n return Object.entries(src).reduce(\n (prev, [key, value]) => ({ ...prev, [key]: signal(value) }),\n {} as SignalObjWritable<T>,\n );\n}\n\n/**\n * Converts a signal object into a plain object.\n * Each property of the signal object becomes a value from the signal.\n *\n * @param src - The signal object to convert.\n * @returns An object with the same keys as the source, but with values from the signals.\n */\nexport function fromSignalObj<TData extends ObjectType>(src: SignalOrValueObj<TData>): TData {\n return Object.entries(src).reduce<TData>(\n (prev, [key, $value]) => ({ ...prev, [key]: signalOrValue($value) }),\n {} as TData,\n );\n}\n\n/**\n * Unwraps a value that might be a Signal.\n * If the input is a Signal, it returns the signal's value.\n * If the input is a raw value, it returns the value itself.\n *\n * @param value - The signal or value to unwrap.\n * @returns The raw value of type T.\n */\nexport function signalOrValue<T>(value: SignalOrValue<T>): T {\n return isSignal(value) ? value() : value;\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function signalOrFunction<T, FnArgs extends any[] = []>(\n value: SignalOrValue<T> | ((...args: FnArgs) => T),\n ...fnArgs: FnArgs\n): T {\n let res = value;\n if (isSignal(res)) {\n res = res();\n }\n if (typeof res == 'function') {\n res = (res as (...args: FnArgs[]) => T)(...fnArgs);\n }\n\n return res;\n}\n\n// function main() {\n// const signalOrValue1: SignalOrValue<number> = signal(42);\n// const signalOrValue2: SignalOrValue<string> = 'Hello, World!';\n\n// console.log(signalOrValue(signalOrValue1)); // 42\n// console.log(signalOrValue(signalOrValue2)); // \"Hello, World!\"\n\n// // #############################################################\n\n// const signalOrFunction1: SignalOrValue<number> | (() => number) = signal(100);\n// const signalOrFunction2: SignalOrValue<number> | (() => number) = () => 200;\n// const signalOrFunction3: SignalOrValue<number> | (() => number) = 300;\n// const signalOrFunction4: SignalOrValue<number> | ((a: number, b: number) => number) = (a, b) => {\n// return a + b;\n// };\n\n// console.log(signalOrFunction(signalOrFunction1)); // 100\n// console.log(signalOrFunction(signalOrFunction2)); // 200\n// console.log(signalOrFunction(signalOrFunction3)); // 300\n// console.log(signalOrFunction(signalOrFunction4, 5, 10)); // 15\n\n// // #############################################################\n\n// const signalObj1: SignalObj<{ a: number; b: string }> = {\n// a: signal(10),\n// b: computed(() => 'Test'),\n// };\n// console.log(signalObj1); // { a: Signal<number>, b: Signal<string> }\n\n// const signalObjWritable1: SignalObjWritable<{ a: number; b: string }> = toSignalObj({\n// a: 10,\n// b: 'Test',\n// });\n// console.log(signalObjWritable1); // { a: WritableSignal<number>, b: WritableSignal<string> }\n\n// const plainObj1 = fromSignalObj(signalObj1);\n// console.log(plainObj1); // { a: 10, b: 'Test' }\n\n// const plainObj2 = fromSignalObj(signalObjWritable1);\n// console.log(plainObj2); // { a: 10, b: 'Test' }\n// }\n","import { signal } from '@angular/core';\n\n/**\n * A function interface for a signal-based notification mechanism.\n * Calling the function returns the current notification count.\n * Calling `notify()` increments the count, triggering any listeners.\n */\nexport interface SignalNotifier {\n (): number;\n /**\n * Triggers a notification by incrementing the internal signal value.\n */\n notify: () => void;\n}\n\n/**\n * Creates a signal-based notifier function.\n *\n * Each call to the returned function returns the current notification count.\n * Calling `notify()` increments the count, triggering any listeners.\n *\n * @returns {SignalNotifier} A notifier function with a `notify` method.\n *\n * @example\n * const notifier = signalNotifier();\n * effect(() => {\n * notifier(); // Reacts to notifications\n * });\n * notifier.notify(); // Triggers the effect\n */\nexport function signalNotifier(): SignalNotifier {\n const _signal = signal(0);\n\n function get(): number {\n return _signal();\n }\n\n get.notify = (): void => _signal.update((n) => n + 1);\n\n return get;\n}\n","/**\n * Types for the result tuple with discriminated union\n * @template T - Type of the successful result\n * @template E - Type of the error, defaults to Error\n */\ntype TryResult<T, E = Error> = [T, null] | [null, E];\n\n/**\n * Main wrapper function to handle promise with try-catch\n * @template T - Type of the successful result\n * @template E - Type of the error, defaults to Error\n * @param {()=> T} fn - The function to handle\n * @returns {TryResult<T, E>} - A tuple with either the result or the error\n */\nexport function tryCatch<T, E = Error>(fn: () => T): TryResult<T, E> {\n try {\n const val = fn();\n return [val, null];\n } catch (error) {\n return [null, error as E];\n }\n}\n","import {\n DestroyRef,\n effect,\n inject,\n Injector,\n Signal,\n signal,\n untracked,\n WritableSignal,\n} from '@angular/core';\nimport { tryCatch } from './try-catch';\n\n/**\n * A writable signal enhanced with debounce capabilities.\n *\n * Extends `WritableSignal<T>` so it can be read and written like a normal signal,\n * but also exposes a `setDebounced` method that applies values after a configurable delay\n * and an `isLoading` signal that indicates whether a debounced update is pending.\n *\n * @typeParam T - The type of the signal's value.\n */\nexport interface SignalDebounce<T> extends WritableSignal<T> {\n /** Sets the signal value after the configured debounce delay. */\n setDebounced(value: T): void;\n /** Reactive flag that is `true` while a debounced update is pending. */\n isLoading: Signal<boolean>;\n}\n\n/**\n * Creates a debounced writable signal.\n *\n * The returned signal can be written to instantly via its `WritableSignal` interface\n * **or** through `setDebounced(value)` which delays the commit by `debounceTime` ms.\n * While a debounced write is pending, `isLoading()` returns `true`.\n *\n * If a reactive `params` function is supplied, the signal will also track that\n * source and debounce upstream changes (requires an injection context).\n *\n * @typeParam T - The type of the signal's value.\n * @param options - Configuration object.\n * @param options.source - Optional reactive source function whose return value\n * is tracked and debounced into the signal.\n * @param options.debounceTime - Delay in milliseconds before a debounced value\n * is committed.\n * @param options.initialValue - Optional initial value for the signal.\n * @param options.injector - Optional Angular `Injector` to use for setting up\n * reactive tracking. Required if `source` is provided and this function is called\n * outside of an injection context.\n * @returns A `SignalDebounce<T>` instance.\n *\n * @example\n * ```ts\n * // Simple debounced signal with an initial value\n * const search = signalDebounce<string>({ debounceTime: 300, initialValue: '' });\n * search.setDebounced('hello'); // commits after 300 ms\n *\n * // Tracking a reactive source\n * const query = signal('angular');\n * const debounced = signalDebounce({ source: () => query(), debounceTime: 500 });\n * ```\n */\nexport function signalDebounce<T>(options: {\n source?: () => T;\n debounceTime: number;\n initialValue?: T;\n injector?: unknown;\n}): SignalDebounce<T> {\n const timeout = signal<ReturnType<typeof setTimeout> | null>(null);\n const isLoading = signal(false);\n const _sig = signal(options.initialValue) as WritableSignal<T>;\n\n const scheduleDebounce = (value: T): void => {\n clearPendingTimeout(timeout);\n isLoading.set(true);\n timeout.set(\n setTimeout(() => {\n isLoading.set(false);\n _sig.set(value);\n }, options.debounceTime),\n );\n };\n\n if (options.source) {\n trackSource({\n source: options.source,\n scheduleDebounce,\n timeout,\n injector: options.injector as Injector,\n });\n }\n\n return Object.assign(_sig, {\n setDebounced: scheduleDebounce,\n isLoading: isLoading.asReadonly(),\n }) as SignalDebounce<T>;\n}\n\n/**\n * Clears a pending debounce timeout if one exists.\n * @internal\n */\nfunction clearPendingTimeout(\n timeout: WritableSignal<ReturnType<typeof setTimeout> | null>,\n): void {\n const t = timeout();\n if (t) clearTimeout(t);\n}\n\n/**\n * Sets up an effect that tracks a reactive source and debounces its changes.\n *\n * Requires an Angular injection context. If called outside one, logs a warning\n * and returns without setting up tracking (manual `setDebounced` still works).\n *\n * @typeParam T - The type of the source value.\n * @param source - Reactive function to track.\n * @param scheduleDebounce - Callback that schedules a debounced write.\n * @param timeout - Shared timeout handle for cleanup on destroy.\n * @internal\n */\nfunction trackSource<T>({\n source,\n scheduleDebounce,\n timeout,\n injector,\n}: {\n source: () => T;\n scheduleDebounce: (value: T) => void;\n timeout: WritableSignal<ReturnType<typeof setTimeout> | null>;\n injector?: Injector;\n}): void {\n if (!isInInjectionContext() && !injector) {\n console.error(\n 'Warning: signalDebounce is being used outside of an injection context. The debounced signal will not update based on the provided signal.\\n\\n',\n \"Still can be used with manual value updates via setDebounced, but won't react to changes in the provided signal.\",\n );\n return;\n }\n\n const _injector = injector ?? inject(Injector);\n const destroyRef = _injector.get(DestroyRef) ?? inject(DestroyRef);\n\n effect(\n () => {\n const val = source();\n untracked(() => scheduleDebounce(val));\n },\n { injector: _injector },\n );\n\n destroyRef.onDestroy(() => clearPendingTimeout(timeout));\n}\n\n/**\n * Checks if the current execution context has access to Angular's dependency injection.\n * @returns `true` when inside an injection context, `false` otherwise.\n * @internal\n */\nfunction isInInjectionContext(): boolean {\n const [, error] = tryCatch(() => inject(DestroyRef));\n return !error;\n}\n","import {\n computed,\n Signal,\n signal,\n untracked,\n WritableSignal,\n} from '@angular/core';\n\n/**\n * Type for value equality comparison function\n */\ntype ValueEqualityFn<T> = (a: T, b: T) => boolean;\n\n/**\n * Creates a `WritableSignal` whose value is derived from a computation function,\n * but can also be overridden manually via `.set()` / `.update()`.\n * When the reactive dependencies inside the computation change, the signal resets to the new derived value.\n *\n * Angular-16 compatible alternative to `linkedSignal` (Angular 19+).\n *\n * @overload\n * @param computation - A computation function that returns the derived value\n * @param options - Optional configuration (equal, debugName)\n * @returns A WritableSignal<D>\n */\nexport function writableSignal<D>(\n computation: () => D,\n options?: {\n equal?: ValueEqualityFn<D>;\n debugName?: string;\n },\n): WritableSignal<D>;\n\n/**\n * Creates a `WritableSignal` with explicit source tracking and computation.\n * The `source` function provides the reactive dependencies, and the `computation` function derives the value from the source.\n * Manual overrides via `.set()` / `.update()` are only valid for the specific source state they were set against.\n *\n * Angular-16 compatible alternative to `linkedSignal` (Angular 19+).\n *\n * @overload\n * @param options - Configuration object with source tracking and computation\n * @returns A WritableSignal<D>\n */\nexport function writableSignal<S, D>(options: {\n source: () => S;\n computation: (source: S, previous?: { source: S; value: D }) => D;\n equal?: ValueEqualityFn<D>;\n debugName?: string;\n}): WritableSignal<D>;\n\nexport function writableSignal<D, S = unknown>(\n computationOrOptions:\n | (() => D)\n | {\n source: () => S;\n computation: (source: S, previous?: { source: S; value: D }) => D;\n equal?: ValueEqualityFn<D>;\n debugName?: string;\n },\n maybeOptions?: {\n equal?: ValueEqualityFn<D>;\n debugName?: string;\n },\n): WritableSignal<D> {\n // Determine if input is a function or options object\n const isFunction = typeof computationOrOptions === 'function';\n\n if (isFunction) {\n return writableSignalFunctionOverload(computationOrOptions, maybeOptions);\n } else {\n return writableSignalOptionsOverload(computationOrOptions);\n }\n}\n\nfunction writableSignalFunctionOverload<D>(\n computation: () => D,\n options?: {\n equal?: ValueEqualityFn<D>;\n debugName?: string;\n },\n): WritableSignal<D> {\n // Create a fresh token whenever the source recomputes, even if the value is equal.\n const sourceState = computed(() => ({ value: computation() }), {\n equal: (a, b) =>\n options?.equal ? options.equal(a.value, b.value) : a.value === b.value,\n });\n\n // Manual overrides are only valid for the source-state token they were set against.\n const override = signal<{ state: { value: D }; value: D } | undefined>(\n undefined,\n );\n\n const result = computed<D>(\n () => {\n const state = sourceState();\n const currentOverride = override();\n if (currentOverride !== undefined && currentOverride.state === state) {\n return currentOverride.value;\n }\n return state.value;\n },\n { equal: options?.equal },\n );\n\n return Object.assign(result, {\n set(v: D): void {\n override.set({ state: untracked(sourceState), value: v });\n },\n update(updater: (value: D) => D): void {\n override.set({\n state: untracked(sourceState),\n value: updater(untracked(result)),\n });\n },\n asReadonly(): Signal<D> {\n return result;\n },\n }) as WritableSignal<D>;\n}\n\nfunction writableSignalOptionsOverload<S, D>(options: {\n source: () => S;\n computation: (source: S, previous?: { source: S; value: D }) => D;\n equal?: ValueEqualityFn<D>;\n debugName?: string;\n}): WritableSignal<D> {\n let previousState: { source: S; value: D } | undefined;\n const sourceState = computed(() => ({ value: options.source() }));\n const override = signal<{ state: { value: D }; value: D } | undefined>(\n undefined,\n );\n\n const result = computed<D>(\n () => {\n const state = sourceState();\n\n const currentOverride = override();\n\n if (\n currentOverride !== undefined &&\n (currentOverride.state as unknown as { value: S }) === state\n ) {\n // Update previous state for next computation\n previousState = { source: state.value, value: currentOverride.value };\n return currentOverride.value;\n }\n\n const computedValue = options.computation(state.value, previousState);\n\n // Update previous state for next computation\n previousState = { source: state.value, value: computedValue };\n\n return computedValue;\n },\n { equal: options.equal },\n );\n\n return Object.assign(result, {\n set(v: D): void {\n override.set({\n state: untracked(sourceState) as unknown as { value: D },\n value: v,\n });\n },\n update(updater: (value: D) => D): void {\n override.set({\n state: untracked(sourceState) as unknown as { value: D },\n value: updater(untracked(result)),\n });\n },\n asReadonly(): Signal<D> {\n return result;\n },\n }) as WritableSignal<D>;\n}\n","import { computed, Signal, } from '@angular/core';\nimport { writableSignal } from './writable-signal';\n\n/**\n * A reactive wrapper around a `Set` backed by Angular signals.\n * All mutations produce a new `Set` instance, ensuring signal-based change detection works correctly.\n *\n * @template T The type of elements stored in the set. Defaults to `number`.\n */\nexport interface SignalSet<T = number> {\n /** The current underlying `Set` (read via signal). */\n (): Set<T>;\n /** The number of elements in the set (reactive). */\n size: Signal<number>;\n /** A computed signal that returns the set contents as an array. */\n toArray: Signal<T[]>;\n /** Adds the element if absent, removes it if present. */\n toggle: (id: T) => void;\n /** Returns `true` if the element exists in the set. */\n has: (id: T) => boolean;\n /** Adds an element to the set. */\n add: (id: T) => void;\n /** Removes an element from the set. */\n delete: (id: T) => void;\n /** Removes all elements from the set. */\n clear: () => void;\n /** Returns a human-readable string representation, e.g. `SignalSet(1, 2, 3)`. */\n toString: () => string;\n /** Converts the set to a JSON-compatible array. e.g. `[1, 2, \"a\"]` */\n toJSON: () => T[];\n}\n\n/**\n * Creates a reactive `SignalSet` backed by Angular signals.\n *\n * Every mutation creates a new `Set`, so Angular's signal equality check triggers updates.\n *\n * @template T The element type. Defaults to `number`.\n * @param initialValue An optional iterable to seed the set with.\n * @returns A {@link SignalSet} instance.\n *\n * @example\n * ```ts\n * const selected = signalSet<number>();\n * selected.add(1);\n * selected.toggle(2);\n * console.log(selected.toArray()); // [1, 2]\n * selected.toggle(1);\n * console.log(selected.has(1)); // false\n * ```\n */\nexport function signalSet<T = number>(\n initialValue: Iterable<T> | (() => Iterable<T>) = new Set<T>(),\n): SignalSet<T> {\n // writableSignal = linkedSignal \n const setSignal = writableSignal(\n () => new Set(typeof initialValue === 'function' ? initialValue() : initialValue),\n );\n const toArray = computed(() => Array.from(setSignal()));\n\n return Object.assign(() => setSignal(), {\n toArray,\n size: computed(() => setSignal().size),\n toggle: (id: T): void => {\n setSignal.update((set) => {\n const next = new Set(set);\n if (next.has(id)) next.delete(id);\n else next.add(id);\n return next;\n });\n },\n has: (id: T): boolean => setSignal().has(id),\n add: (id: T): void => {\n setSignal.update((set) => {\n const next = new Set(set);\n next.add(id);\n return next;\n });\n },\n delete: (id: T): void => {\n setSignal.update((set) => {\n const next = new Set(set);\n next.delete(id);\n return next;\n });\n },\n clear: (values?: Iterable<T>): void => {\n setSignal.set(new Set(values));\n },\n toString: (): string => {\n return `SignalSet(${toArray().join(', ')})`;\n },\n toJSON: (): T[] => {\n return toArray();\n },\n });\n}\n","import { computed, Signal } from '@angular/core';\nimport { writableSignal } from './writable-signal';\n\n/**\n * Resolves `T` to itself when it is a valid object key (`string | number | symbol`),\n * otherwise falls back to `string`. Used to type-safe `Record` conversions.\n */\ntype ToKey<T> = T extends string | number | symbol ? T : string;\n\n/**\n * if an object have Symbol.iterator, treat it as Iterable<[K, V]>\n * @param value Iterable<[K, V]> or Record<ToKey<K>, V>\n * @returns Iterable<[K, V]>\n */\nfunction getIterable<K, V>(\n value: Iterable<[K, V]> | Record<ToKey<K>, V>,\n): Iterable<[K, V]> {\n if (Symbol.iterator in Object(value)) {\n return value as Iterable<[K, V]>;\n } else {\n return Object.entries(value as Record<ToKey<K>, V>) as Iterable<[K, V]>;\n }\n}\n\n/**\n * A reactive wrapper around a `Map` backed by Angular signals.\n * All mutations produce a new `Map` instance, ensuring signal-based change detection works correctly.\n *\n * @template K The key type. Defaults to `string`.\n * @template V The value type. Defaults to `unknown`.\n */\nexport interface SignalMap<K = string, V = unknown> {\n /** The current underlying `Map` (read via signal). */\n (): Map<K, V>;\n /** The number of entries in the map (reactive). */\n size: Signal<number>;\n /** A computed signal that returns the map keys as an array. */\n keys: Signal<K[]>;\n /** A computed signal that returns the map values as an array. */\n values: Signal<V[]>;\n /** A computed signal that returns the map entries as an array of `[key, value]` tuples. */\n entries: Signal<[K, V][]>;\n /** Returns the value associated with `key`, or `undefined` if absent. */\n get: (key: K) => V | undefined;\n /** Returns `true` if the map contains the given `key`. */\n has: (key: K) => boolean;\n /** Sets (or overwrites) the value for `key` and returns the updated `Map`. */\n set: (key: K, value: V) => Map<K, V>;\n /** Removes the entry for `key`. Returns `true` if the key existed. */\n delete: (key: K) => boolean;\n /** Removes all entries from the map. */\n clear: () => void;\n /** Returns a human-readable string, e.g. `SignalMap(a => 1, b => 2)`. */\n toString: () => string;\n /** Converts the map to a JSON-compatible object. */\n toJSON: () => Record<ToKey<K>, V>;\n}\n\n/**\n * Creates a reactive `SignalMap` backed by Angular signals.\n *\n * Every mutation creates a new `Map`, so Angular's signal equality check triggers updates.\n * Accepts either an iterable of `[key, value]` pairs or a plain object as the initial value.\n *\n * @template K The key type. Defaults to `string`.\n * @template V The value type. Defaults to `unknown`.\n * @param initialValue An optional iterable of entries or a plain object to seed the map.\n * @returns A {@link SignalMap} instance.\n *\n * @example\n * ```ts\n * const cache = signalMap<string, number>({ a: 1, b: 2 });\n * cache.set('c', 3);\n * console.log(cache.keys()); // ['a', 'b', 'c']\n * cache.delete('a'); // true\n * console.log(cache.toJSON()); // {b:2,c:3}\n * ```\n */\nexport function signalMap<K = string, V = unknown>(\n initialValue:\n | Iterable<[K, V]>\n | Record<ToKey<K>, V>\n | (() => Iterable<[K, V]> | Record<ToKey<K>, V>) = new Map<K, V>(),\n): SignalMap<K, V> {\n // writableSignal = linkedSignal \n const mapSignal = writableSignal(() => {\n const _val =\n typeof initialValue === 'function' ? initialValue() : initialValue;\n const init = getIterable(_val);\n return new Map<K, V>(init);\n });\n const entries = computed(() => Array.from(mapSignal().entries()));\n const keys = computed(() => Array.from(mapSignal().keys()));\n const values = computed(() => Array.from(mapSignal().values()));\n const size = computed(() => mapSignal().size);\n\n return Object.assign(() => mapSignal(), {\n entries,\n keys,\n values,\n size,\n get: (key: K): V | undefined => mapSignal().get(key),\n has: (key: K): boolean => mapSignal().has(key),\n set: (key: K, value: V): Map<K, V> => {\n mapSignal.update((map) => {\n const next = new Map(map);\n next.set(key, value);\n return next;\n });\n return mapSignal();\n },\n delete: (key: K): boolean => {\n let deleted = false;\n mapSignal.update((map) => {\n const next = new Map(map);\n deleted = next.delete(key);\n return next;\n });\n return deleted;\n },\n clear: (values?: Iterable<[K, V]> | Record<ToKey<K>, V>): void => {\n mapSignal.set(new Map(values ? getIterable(values) : undefined));\n },\n toString: (): string => {\n return `SignalMap(${entries()\n .map(([k, v]) => `${k} => ${v}`)\n .join(', ')})`;\n },\n toJSON: (): Record<ToKey<K>, V> => {\n return Object.fromEntries(entries());\n },\n toObject: (): Record<ToKey<K>, V> => {\n return Object.fromEntries(entries());\n },\n });\n}\n","import { computed, signal, Signal, WritableSignal } from '@angular/core';\n\nconst SIGNAL_OBJECT = Symbol('SignalObject');\n\n/**\n * A reactive object backed by Angular signals.\n * Each property is stored as a WritableSignal, so reads are tracked\n * by Angular's reactive system (templates, computed, effect).\n *\n * Usage:\n * const person = signalObject({ name: 'dvirus', age: 30 });\n * person.name; // reads the signal → 'dvirus' (tracked)\n * person['name'] = 'new'; // sets the signal (triggers reactivity)\n * person.age; // reads the signal → 30 (tracked)\n */\nclass _SignalObject<T extends Record<string, unknown>> {\n readonly [SIGNAL_OBJECT] = true;\n readonly #signals = new Map<string, WritableSignal<unknown>>();\n readonly #version = signal(0);\n readonly #boundCache = new Map<string | symbol, _Function>();\n\n constructor(initialValue: T) {\n for (const [key, value] of Object.entries(initialValue)) {\n this.#signals.set(key, signal(value));\n }\n\n // Use a function as the proxy target so the `apply` trap works (makes it callable).\n // All traps delegate to `self` (the real class instance) for property/signal access.\n\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n const self = this;\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n const callable = (() => {}) as unknown as this;\n\n return new Proxy(callable, {\n apply(): T {\n return self.$snapshot();\n },\n\n get(_, prop): unknown {\n // Symbols & class own members go through normally\n if (typeof prop === 'symbol' || prop in self) {\n const value = Reflect.get(self, prop, self);\n // Bind methods to the real target so private fields (#signals) work.\n // Cache the bound function so the same reference is returned each time\n // (important for Angular signal identity tracking on $snapshot).\n if (typeof value === 'function') {\n let bound = self.#boundCache.get(prop);\n if (!bound) {\n bound = value.bind(self) as _Function;\n self.#boundCache.set(prop, bound);\n }\n return bound;\n }\n return value;\n }\n // Read the signal — this is tracked by Angular's reactive context\n const s = self.#signals.get(prop)?.();\n /** create new signal if it doesn't exist */\n if (s === undefined && !self.#signals.has(prop)) {\n const newSignal = signal(undefined);\n self.#signals.set(prop, newSignal);\n return newSignal();\n }\n return s;\n },\n\n set(_, prop, value): boolean {\n if (typeof prop === 'symbol' || prop in self) {\n return Reflect.set(self, prop, value);\n }\n const existing = self.#signals.get(prop);\n if (existing) {\n existing.set(value);\n } else {\n // Dynamic property — create a new signal and bump version\n self.#signals.set(prop, signal(value));\n self.#version.update(addVersion);\n }\n return true;\n },\n\n deleteProperty(_, prop): boolean {\n // Prevent accidental deletion of internal methods or symbols\n if (typeof prop === 'symbol' || prop in self) {\n return false;\n }\n // If it's a tracked signal property, remove it and bump the version\n if (self.#signals.has(prop)) {\n self.#signals.delete(prop);\n self.#version.update(addVersion);\n return true;\n }\n // Standard JS behavior: deleting a non-existent property returns true\n return true;\n },\n\n has(_, prop): boolean {\n if (typeof prop === 'string' && self.#signals.has(prop)) {\n return true;\n }\n return Reflect.has(self, prop);\n },\n\n ownKeys(): string[] {\n return Array.from(self.#signals.keys());\n },\n\n getOwnPropertyDescriptor(_, prop): PropertyDescriptor | undefined {\n if (typeof prop === 'string' && self.#signals.has(prop)) {\n return {\n configurable: true,\n enumerable: true,\n writable: true,\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n value: self.#signals.get(prop)!(),\n };\n }\n return Reflect.getOwnPropertyDescriptor(self, prop);\n },\n }) as unknown as this;\n }\n\n /**\n * A computed signal that returns a plain snapshot of all properties.\n * Reading this tracks ALL properties — so any property change triggers reactivity.\n *\n * Usage:\n * effect(() => console.log(person.$snapshot()));\n * // logs whenever ANY property changes\n */\n private readonly $snapshot: Signal<T> = computed(() => {\n this.#version(); // track structural changes (new/removed props)\n return this.toJSON();\n });\n\n /**\n * Spreads one or more objects (plain or reactive) into this SignalObject.\n * Mimics `Object.assign(this, ...sources)` / `{ ...this, ...a, ...b }`.\n *\n * - Existing keys → updates the signal (triggers reactivity)\n * - New keys → creates a new signal and bumps the version\n * - Accepts plain objects and ReactiveObjects interchangeably\n *\n * @example\n * const person = signalObject({ name: 'dvirus' });\n * person.$assign({ age: 30 }, otherSignalObj);\n */\n $assign(...sources: object[]): void {\n for (const source of sources) {\n const entries = isSignalObject(source)\n ? Object.entries(\n (source as unknown as { $snapshot: Signal<object> }).$snapshot(),\n )\n : Object.entries(source);\n\n for (const [key, value] of entries) {\n const existing = this.#signals.get(key);\n if (existing) {\n existing.set(value);\n } else {\n this.#signals.set(key, signal(value));\n }\n }\n }\n this.#version.update(addVersion);\n }\n\n toJSON(): T {\n this.#version(); // track structural changes (new/removed props)\n const result: Record<string, unknown> = {};\n for (const [key, sig] of this.#signals) {\n result[key] = sig();\n }\n return result as T;\n }\n\n toString(): string {\n return JSON.stringify(this.toJSON());\n }\n}\n\n/**\n * Creates a reactive object backed by Angular signals.\n *\n * Every property is stored as a `WritableSignal`. Reading a property\n * (e.g. `obj.name` or `obj['name']`) calls the signal — so it's\n * automatically tracked in templates, `computed()`, and `effect()`.\n * Setting a property calls `signal.set()`, which triggers reactivity.\n *\n * @example\n * // In a component:\n * protected person = signalObject({ name: 'dvirus', age: 30 });\n *\n * // In the template (reactive — updates automatically):\n * // {{ person.name }}\n *\n * // In the class:\n * // person.name = 'changed'; → triggers re-render\n * // person['age'] = 31; → triggers re-render\n */\nexport type SignalObject<T> = T & {\n /**\n * Call the SignalObject as a function to get a reactive snapshot.\n *\n * @example\n * const person = signalObject({ name: 'dvirus', age: 30 });\n * person(); // { name: 'dvirus', age: 30 } — tracked by Angular\n */\n (): T;\n\n /**\n * A computed signal that returns a plain snapshot of all properties.\n * Reading this tracks ALL properties — any property change triggers reactivity.\n *\n * @example\n * effect(() => console.log(person.$snapshot()));\n * // logs whenever ANY property changes\n *\n * const label = computed(() => {\n * const snap = person.$snapshot();\n * return `${snap.name} (${snap.age})`;\n * });\n */\n // readonly $snapshot: Signal<T>;\n\n /**\n * Spreads one or more objects (plain or reactive) into this SignalObject.\n * Mimics `Object.assign(this, ...sources)` / `{ ...this, ...a, ...b }`.\n *\n * - Existing keys → updates the signal (triggers reactivity)\n * - New keys → creates a new signal and bumps the version\n * - Accepts plain objects and SignalObjects interchangeably\n *\n * @param sources - One or more plain objects or SignalObjects to merge in\n *\n * @example\n * const person = signalObject({ name: 'dvirus' });\n * person.$assign({ age: 30 }, otherSignalObj);\n */\n $assign(...sources: Partial<T>[]): void;\n};\n\n/**\n * Creates a reactive object backed by Angular signals.\n *\n * Every property is stored as a `WritableSignal`. Reading a property\n * (e.g. `obj.name` or `obj['name']`) calls the signal — so it's\n * automatically tracked in templates, `computed()`, and `effect()`.\n * Setting a property calls `signal.set()`, which triggers reactivity.\n *\n * @param initialValue - The plain object to make reactive\n * @returns A `SignalObject<T>` proxy with reactive property access, `$snapshot`, and `$assign`\n *\n * @example\n * // In a component:\n * protected person = signalObject({ name: 'dvirus', age: 30 });\n *\n * // In the template (reactive — updates automatically):\n * // {{ person.name }}\n *\n * // In the class:\n * person.name = 'changed'; // triggers re-render\n * person['age'] = 31; // triggers re-render\n *\n * // Spread (plain snapshot):\n * const copy = { ...person }; // { name: 'changed', age: 31 }\n *\n * // Track all properties reactively:\n * effect(() => console.log(person.$snapshot()));\n */\nexport function signalObject<T extends object>(\n initialValue: T,\n): SignalObject<T> {\n return new _SignalObject(\n initialValue as Record<string, unknown>,\n ) as unknown as SignalObject<T>;\n}\n\n/**\n * Type guard — checks if a value is a reactive SignalObject proxy.\n *\n * @example\n * isSignalObject(signalObject({ a: 1 })); // true\n * isSignalObject({ a: 1 }); // false\n * isSignalObject({ ...signalObject({ a: 1 }) }); // false (spread = plain copy)\n */\nexport function isSignalObject<T extends Record<string, unknown>>(\n value: unknown,\n): value is SignalObject<T> {\n return (\n typeof value === 'object' &&\n value !== null &&\n (value as Record<symbol, unknown>)[SIGNAL_OBJECT] === true\n );\n}\n\n/**\n * Reactively merges multiple SignalObjects (like `{ ...a, ...b }`).\n * Returns a `Signal` that re-evaluates whenever any source property changes.\n * Later sources win on key conflicts, just like spread.\n *\n * same as `computed(() => ({ ...a, ...b }))`\n * but with proper tracking of nested properties and support for non-reactive objects as sources.\n *\n * @example\n * const objA = signalObject({ name: 'dvirus', role: 'dev' });\n * const objB = signalObject({ age: 30, role: 'admin' });\n * const merged = mergeSignalObjects(objA, objB);\n * merged(); // { name: 'dvirus', role: 'admin', age: 30 }\n */\nexport function mergeSignalObjects<T extends object[]>(\n ...sources: [...{ [K in keyof T]: T[K] | SignalObject<T[K]> }]\n): Signal<UnionToIntersection<T[number]>> {\n return computed(() => {\n let result = {};\n for (const source of sources) {\n // Spreading a SignalObject triggers its Proxy traps (ownKeys + getOwnPropertyDescriptor),\n // which reads every signal — so it's automatically tracked by Angular's reactive context.\n // Plain objects are just spread normally.\n result = { ...result, ...source };\n }\n return result as UnionToIntersection<T[number]>;\n });\n}\n\n/**\n * Extracts the plain object type `U` from a `SignalObject<U>`.\n * Returns `T` as-is if it's not a `SignalObject`.\n */\n// type SnapshotOf<T> = T extends SignalObject<infer U> ? U : T;\n\n/**\n * Converts a union of types into an intersection.\n * Used to merge multiple object types from `mergeSignalObjects` into a single combined type.\n *\n * @example\n * // UnionToIntersection<{ a: 1 } | { b: 2 }> → { a: 1 } & { b: 2 }\n */\ntype UnionToIntersection<U> = (\n U extends unknown ? (k: U) => void : never\n) extends (k: infer I) => void\n ? I\n : never;\n\ntype _Function = (...args: unknown[]) => unknown;\n\nfunction addVersion(prev: number): number {\n if (prev > 1000) return 1;\n return prev + 1;\n}\n","import {\n computed,\n DestroyRef,\n inject,\n Signal,\n signal,\n untracked,\n} from '@angular/core';\nimport {\n FormControl,\n FormGroup,\n AbstractControl,\n FormControlStatus,\n ValidationErrors,\n FormArray,\n FormControlState,\n} from '@angular/forms';\nimport { Observable, startWith, Subscription } from 'rxjs';\nimport { tryCatch } from './try-catch';\nimport { writableSignal } from './writable-signal';\n\ninterface ControlEvent<T> {\n /**\n * Form control from which this event is originated.\n *\n * Note: the type of the control can't be inferred from T as the event can be emitted by any of child controls\n */\n readonly source: AbstractControl<unknown | T>;\n}\n\n// ########## CONTROL SIGNAL ##########\n\n/**\n * A reactive signal-based wrapper around an `AbstractControl`, exposing\n * the control's state (value, status, touched, dirty, errors, etc.) as\n * Angular signals for use in templates and computed expressions.\n *\n * @template T - The value type of the underlying form control.\n * @template TControl - The specific `AbstractControl` type being wrapped (e.g., `FormControl`, `FormGroup`, `FormArray`).\n */\nexport interface ControlSignal<\n T,\n TControl extends AbstractControl<unknown> = AbstractControl<T>,\n> {\n /** Signal returning the underlying `AbstractControl` instance with its specific type. */\n control: TControl;\n /** Signal returning the current value of the control. */\n value: Signal<UnwrapFromControlState<T> | null | undefined>;\n /** Signal returning the current validation status (`VALID`, `INVALID`, `PENDING`, `DISABLED`). */\n status: Signal<FormControlStatus | null | undefined>;\n /** Signal returning the most recent `ControlEvent` emitted by the control. */\n events: Signal<ControlEvent<T> | null | undefined>;\n /** Signal that is `true` when the control status is `DISABLED`. */\n disabled: Signal<boolean>;\n /** Signal that is `true` when the control status is `VALID`. */\n valid: Signal<boolean>;\n /** Signal that is `true` when the control status is `INVALID`. */\n invalid: Signal<boolean>;\n /** Signal that is `true` when the control has been touched. */\n touched: Signal<boolean>;\n /** Signal that is `true` when the control is dirty. */\n dirty: Signal<boolean>;\n /** Signal returning the current validation errors, or `null` if there are none. */\n errors: Signal<ValidationErrors | null>;\n /** Signal returning the key of the first validation error, or `null`. */\n firstErrorKey: Signal<string | null>;\n /** Signal that is `true` when the control is both touched and invalid. */\n touchedAndInvalid: Signal<boolean>;\n /**\n * Signal returning the control's synchronous validators as a `ValidationErrors`-like object, or `null` if there are none.\n * @Note that this does not include asynchronous validators, and the shape of the returned object may differ from the actual validation errors emitted by the control.\n */\n validators: Signal<ValidationErrors | null>;\n /** Tears down all internal subscriptions and effects. */\n unsubscribe(): void;\n}\n\n/**\n * Creates a {@link ControlSignal} that mirrors an `AbstractControl`'s\n * reactive state as Angular signals.\n *\n * **Important:** If called outside an injection context, you must manually handle\n * un-subscription by either:\n * - Calling the `unsubscribe()` method on the returned {@link ControlSignal}, or\n * - Passing a `DestroyRef` via the `options` parameter for automatic cleanup.\n *\n * If called within an injection context without providing a `DestroyRef`, the\n * subscriptions will be automatically cleaned up on component destruction.\n *\n * @template T - The value type of the form control.\n * @param control - The form control or a signal wrapping one.\n * @param options - Optional configuration object containing:\n * - `destroyRef`: A `DestroyRef` used for automatic cleanup on destruction.\n * If not provided, the function will attempt to inject one from the current\n * injection context. If neither is available, manual un-subscription is required.\n * @returns A {@link ControlSignal} exposing the control's state as signals.\n * @throws If `control` is a signal and no `Injector` is available.\n */\nexport function controlSignal<\n T,\n TControl extends AbstractControl<unknown> = FormControl<T>,\n>(\n control: TControl,\n options?: { destroyRef?: DestroyRef | null },\n): ControlSignal<T, TControl> {\n const destroyRef =\n options?.destroyRef ??\n tryCatch(() => inject(DestroyRef, { optional: true }))[0];\n\n let subscriptions: Subscription[] = [];\n const unsubscribe = (): void => {\n subscriptions.forEach((s) => s.unsubscribe());\n subscriptions = [];\n };\n // cleanUp\n unsubscribe();\n destroyRef?.onDestroy(() => unsubscribe());\n\n const $value = signal<T | null | undefined>(undefined);\n const $status = signal<FormControlStatus | null | undefined>(undefined);\n const _events = signal<ControlEvent<T> | null>(null);\n const $events = writableSignal<ControlEvent<T> | null | undefined>(() => {\n $value();\n $status();\n return _events();\n });\n\n subscriptions.push(\n control.valueChanges\n .pipe(startWith(control.value))\n .subscribe((x) => untracked(() => $value.set(x as T))),\n\n control.statusChanges\n .pipe(startWith(control.status))\n .subscribe((x) => untracked(() => $status.set(x))),\n\n // control.events.subscribe((x) => untracked(() => $events.set(x))),\n );\n\n // Subscribe to control.events if available (Angular v18+)\n const ctrl = control as unknown as { events: Observable<ControlEvent<T>> };\n if (ctrl.events && typeof ctrl.events.subscribe === 'function') {\n subscriptions.push(\n ctrl.events.subscribe((x: ControlEvent<T>) =>\n untracked(() => {\n _events.set(x);\n }),\n ),\n );\n }\n\n const invalid = computed(() => ($status(), control.invalid));\n const touched = computed(() => ($events(), control.touched));\n const errors = computed<ValidationErrors | null>(\n () => ($events(), control.errors),\n );\n\n return {\n control: control as TControl,\n value: computed(() => {\n $value();\n $events();\n return control.value as UnwrapFromControlState<T>;\n }),\n status: $status.asReadonly(),\n events: $events.asReadonly(),\n\n invalid: invalid,\n errors: errors,\n touched: touched,\n\n valid: computed(() => ($status(), control.valid)),\n dirty: computed(() => ($events(), control.dirty)),\n disabled: computed(() => ($status(), control.disabled)),\n touchedAndInvalid: computed(() => touched() && invalid()),\n firstErrorKey: computed<string | null>(\n () => Object.keys(errors() ?? {})[0] ?? null,\n ),\n validators: computed(\n () => ($events(), control.validator?.({} as AbstractControl) ?? null),\n ),\n unsubscribe: (): void => unsubscribe(),\n };\n}\n\n// ############ FORM GROUP SIGNAL ############\n\n/**\n * Extends {@link ControlSignal} with a strongly-typed `controls` map,\n * providing a `ControlSignal` for every control in the `FormGroup`.\n *\n * @template T - An object type whose keys correspond to the group's control names\n * and whose values are the respective control value types.\n */\nexport interface FormGroupSignal<TControls extends TypedControlMap>\n extends ControlSignal<ControlsValue<TControls>, FormGroup<TControls>> {\n /** The underlying `FormGroup` instance. */\n control: FormGroup<TControls>;\n /** A map of child control names to their individual {@link ControlSignal} instances. */\n controls: {\n [K in keyof TControls]: NestedControlSignal<TControls[K]>;\n };\n}\n\n/**\n * Creates a {@link FormGroupSignal} for a `FormGroup`. Child controls are\n * converted recursively, so nested `FormGroup` and `FormArray` structures\n * are supported.\n *\n * @template TControls - A typed map of control names to `AbstractControl` instances.\n * @param formGroup - The `FormGroup` to wrap.\n * @param options - Optional `DestroyRef` and `Injector` forwarded to\n * each underlying {@link controlSignal} call.\n * @returns A {@link FormGroupSignal} with both group-level and per-control signals.\n */\nexport function formGroupSignal<TControls extends TypedControlMap>(\n formGroup: FormGroup<TControls>,\n options?: { destroyRef?: DestroyRef | null },\n): FormGroupSignal<TControls> {\n const destroyRef =\n options?.destroyRef ??\n tryCatch(() => inject(DestroyRef, { optional: true }))[0];\n\n const controls = Object.fromEntries(\n Object.entries(formGroup.controls).map(([key, ctrl]) => {\n return [key, nestedControlSignal(ctrl, { destroyRef })];\n }),\n ) as { [K in keyof TControls]: NestedControlSignal<TControls[K]> };\n\n const groupSignal = controlSignal(formGroup);\n const selfUnsubscribe = groupSignal.unsubscribe.bind(groupSignal);\n\n return Object.assign(groupSignal, {\n controls,\n unsubscribe: () => {\n selfUnsubscribe();\n Object.values(controls).forEach((c) => c.unsubscribe());\n },\n }) as FormGroupSignal<TControls>;\n}\n\n// ############ FORM ARRAY SIGNAL ############\n\nexport interface FormArraySignal<TControl extends AbstractControl<unknown>>\n extends ControlSignal<ControlValue<TControl>[], FormArray<TControl>> {\n /** The underlying `FormArray` instance. */\n control: FormArray<TControl>;\n controls: NestedControlSignal<TControl>[];\n}\n\n/**\n * Creates a {@link FormArraySignal} for a `FormArray`. Child controls are\n * converted recursively, so arrays of `FormGroup`, arrays of `FormArray`,\n * and arrays of `FormControl` are all supported.\n */\nexport function formArraySignal<TControl extends AbstractControl<unknown>>(\n formArray: FormArray<TControl>,\n options?: { destroyRef?: DestroyRef | null },\n): FormArraySignal<TControl> {\n const destroyRef =\n options?.destroyRef ??\n tryCatch(() => inject(DestroyRef, { optional: true }))[0];\n\n const controls = formArray.controls.map((ctrl) =>\n nestedControlSignal(ctrl, { destroyRef }),\n ) as NestedControlSignal<TControl>[];\n\n const arraySignal = controlSignal(formArray);\n const selfUnsubscribe = arraySignal.unsubscribe.bind(arraySignal);\n\n return Object.assign(arraySignal, {\n controls,\n unsubscribe: () => {\n selfUnsubscribe();\n controls.forEach((c) => c.unsubscribe());\n },\n }) as FormArraySignal<TControl>;\n}\n\n// ############ HELPERS ############\n\ntype UnwrapFromControlState<T> =\n T extends FormControlState<unknown> ? T['value'] : T;\n\ntype TypedControlMap = Record<string, AbstractControl<unknown>>;\n\ntype ControlValue<TControl extends AbstractControl<unknown>> =\n TControl extends AbstractControl<infer TValue> ? TValue : never;\n\ntype ControlsValue<TControls extends TypedControlMap> = {\n [K in keyof TControls]: ControlValue<TControls[K]>;\n};\n\nexport type NestedControlSignal<TControl extends AbstractControl<unknown>> =\n TControl extends FormGroup<infer TControls>\n ? FormGroupSignal<TControls & TypedControlMap> //& TypedControlMap\n : TControl extends FormArray<infer TItemControl>\n ? FormArraySignal<TItemControl & AbstractControl<unknown>>\n : ControlSignal<ControlValue<TControl>, TControl>;\n\nfunction nestedControlSignal<TControl extends AbstractControl<unknown>>(\n control: TControl,\n options?: { destroyRef?: DestroyRef | null },\n): NestedControlSignal<TControl> {\n if (control instanceof FormGroup) {\n return formGroupSignal(\n control as FormGroup<TypedControlMap>,\n options,\n ) as NestedControlSignal<TControl>;\n }\n\n if (control instanceof FormArray) {\n return formArraySignal(\n control as FormArray<AbstractControl<unknown>>,\n options,\n ) as NestedControlSignal<TControl>;\n }\n\n return controlSignal(\n control as AbstractControl<ControlValue<TControl>>,\n options,\n ) as NestedControlSignal<TControl>;\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;AAsCA;;;;;;AAMG;AACG,SAAU,WAAW,CAAuB,GAAM,EAAA;AACtD,IAAA,OAAO,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,CAC/B,CAAC,IAAI,EAAE,CAAC,GAAG,EAAE,KAAK,CAAC,MAAM,EAAE,GAAG,IAAI,EAAE,CAAC,GAAG,GAAG,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,EAC3D,EAA0B,CAC3B;AACH;AAEA;;;;;;AAMG;AACG,SAAU,aAAa,CAA2B,GAA4B,EAAA;AAClF,IAAA,OAAO,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,CAC/B,CAAC,IAAI,EAAE,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,IAAI,EAAE,CAAC,GAAG,GAAG,aAAa,CAAC,MAAM,CAAC,EAAE,CAAC,EACpE,EAAW,CACZ;AACH;AAEA;;;;;;;AAOG;AACG,SAAU,aAAa,CAAI,KAAuB,EAAA;AACtD,IAAA,OAAO,QAAQ,CAAC,KAAK,CAAC,GAAG,KAAK,EAAE,GAAG,KAAK;AAC1C;AAEA;SACgB,gBAAgB,CAC9B,KAAkD,EAClD,GAAG,MAAc,EAAA;IAEjB,IAAI,GAAG,GAAG,KAAK;AACf,IAAA,IAAI,QAAQ,CAAC,GAAG,CAAC,EAAE;Q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IAAI,KAC3C,mBAAmB,CAAC,IAAI,EAAE,EAAE,UAAU,EAAE,CAAC,CACP;AAEpC,IAAA,MAAM,WAAW,GAAG,aAAa,CAAC,SAAS,CAAC;IAC5C,MAAM,eAAe,GAAG,WAAW,CAAC,WAAW,CAAC,IAAI,CAAC,WAAW,CAAC;AAEjE,IAAA,OAAO,MAAM,CAAC,MAAM,CAAC,WAAW,EAAE;QAChC,QAAQ;QACR,WAAW,EAAE,MAAK;AAChB,YAAA,eAAe,EAAE;AACjB,YAAA,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,WAAW,EAAE,CAAC;QAC1C,CAAC;AACF,KAAA,CAA8B;AACjC;AAuBA,SAAS,mBAAmB,CAC1B,OAAiB,EACjB,OAA4C,EAAA;AAE5C,IAAA,IAAI,OAAO,YAAY,SAAS,EAAE;AAChC,QAAA,OAAO,eAAe,CACpB,OAAqC,EACrC,OAAO,CACyB;IACpC;AAEA,IAAA,IAAI,OAAO,YAAY,SAAS,EAAE;AAChC,QAAA,OAAO,eAAe,CACpB,OAA8C,EAC9C,OAAO,CACyB;IACpC;AAEA,IAAA,OAAO,aAAa,CAClB,OAAkD,EAClD,OAAO,CACyB;AACpC;;AClUA;;AAEG;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dvirus-js/angular-signals",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.18",
|
|
4
4
|
"peerDependencies": {
|
|
5
5
|
"@angular/core": ">=16.0.0 <22.0.0",
|
|
6
6
|
"@angular/forms": ">=16.0.0 <22.0.0",
|
|
@@ -19,6 +19,10 @@
|
|
|
19
19
|
".": {
|
|
20
20
|
"types": "./types/dvirus-js-angular-signals.d.ts",
|
|
21
21
|
"default": "./fesm2022/dvirus-js-angular-signals.mjs"
|
|
22
|
+
},
|
|
23
|
+
"./signal-form": {
|
|
24
|
+
"types": "./types/dvirus-js-angular-signals-signal-form.d.ts",
|
|
25
|
+
"default": "./fesm2022/dvirus-js-angular-signals-signal-form.mjs"
|
|
22
26
|
}
|
|
23
27
|
},
|
|
24
28
|
"dependencies": {
|