{"version":3,"file":"angular-signals.mjs","sources":["../../../projects/angular-signals/src/lib/signal/signal.ts","../../../projects/angular-signals/src/lib/computed/computed.ts","../../../projects/angular-signals/src/lib/animation/spring.ts","../../../projects/angular-signals/src/lib/animation/tween.ts","../../../projects/angular-signals/src/lib/state/previous.ts","../../../projects/angular-signals/src/lib/state/toggle.ts","../../../projects/angular-signals/src/lib/state/counter.ts","../../../projects/angular-signals/src/lib/state/array.ts","../../../projects/angular-signals/src/lib/async/debounce.ts","../../../projects/angular-signals/src/lib/async/throttle.ts","../../../projects/angular-signals/src/lib/timing/interval.ts","../../../projects/angular-signals/src/lib/timing/timeout.ts","../../../projects/angular-signals/src/lib/timing/now.ts","../../../projects/angular-signals/src/lib/browser/media-query.ts","../../../projects/angular-signals/src/lib/browser/event-listener.ts","../../../projects/angular-signals/src/lib/browser/storage.ts","../../../projects/angular-signals/src/public-api.ts","../../../projects/angular-signals/src/angular-signals.ts"],"sourcesContent":["import {signal, WritableSignal, computed} from '@angular/core';\nimport {isEqual} from 'lodash-es';\n\n\nexport function deepSignal<T>(value: T): WritableSignal<T> {\n  return signal(value, {equal: isEqual});\n}\n\n\n","import { computed } from \"@angular/core\";\nimport { isEqual } from \"lodash-es\";\n\nexport function deepComputed<T>(computation: () => T) {\n  return computed(\n    computation, { equal: isEqual }\n  );\n}\n","import { signal, effect, WritableSignal, Signal } from '@angular/core';\n\nexport interface SpringConfig {\n  stiffness?: number;\n  damping?: number;\n  precision?: number;\n}\n\nexport interface SpringSignals<T extends number | number[]> {\n  current: Signal<T>;\n  target: WritableSignal<T>;\n}\n\nconst DEFAULT_CONFIG: Required<SpringConfig> = {\n  stiffness: 0.15,\n  damping: 0.8,\n  precision: 0.01,\n};\n\n/**\n * Creates a spring animation that smoothly interpolates between values.\n *\n * @param initialValue - The initial value (number or array of numbers)\n * @param config - Spring configuration with stiffness, damping, and precision\n * @returns Object with `current` (readonly signal) and `target` (writable signal)\n *\n * @example\n * ```ts\n * const { current, target } = spring(0, { stiffness: 0.15, damping: 0.8 });\n *\n * // Update target to animate\n * target.set(100);\n *\n * // Read current animated value\n * console.log(current());\n * ```\n */\nexport function spring(\n  initialValue: number,\n  config?: SpringConfig\n): SpringSignals<number>;\nexport function spring(\n  initialValue: number[],\n  config?: SpringConfig\n): SpringSignals<number[]>;\nexport function spring<T extends number | number[]>(\n  initialValue: T,\n  config: SpringConfig = {}\n): SpringSignals<T> {\n  const { stiffness, damping, precision } = { ...DEFAULT_CONFIG, ...config };\n\n  const target = signal<T>(initialValue);\n  const current = signal<T>(initialValue);\n  const velocity = signal<T>(\n    Array.isArray(initialValue) ? (new Array(initialValue.length).fill(0) as T) : (0 as T)\n  );\n\n  let animationFrameId: number | null = null;\n\n  const tick = () => {\n    const currentValue = current();\n    const targetValue = target();\n    const currentVelocity = velocity();\n\n    if (Array.isArray(currentValue) && Array.isArray(targetValue) && Array.isArray(currentVelocity)) {\n      const newValue: number[] = [];\n      const newVelocity: number[] = [];\n      let isSettled = true;\n\n      for (let i = 0; i < currentValue.length; i++) {\n        const delta = targetValue[i] - currentValue[i];\n        const spring = delta * stiffness;\n        const damper = currentVelocity[i] * damping;\n        const acceleration = spring - damper;\n\n        newVelocity[i] = currentVelocity[i] + acceleration;\n        newValue[i] = currentValue[i] + newVelocity[i];\n\n        if (Math.abs(delta) > precision || Math.abs(newVelocity[i]) > precision) {\n          isSettled = false;\n        }\n      }\n\n      if (!isSettled) {\n        current.set(newValue as T);\n        velocity.set(newVelocity as T);\n        animationFrameId = requestAnimationFrame(tick);\n      } else {\n        current.set(targetValue);\n        velocity.set(new Array(currentValue.length).fill(0) as T);\n        animationFrameId = null;\n      }\n    } else if (typeof currentValue === 'number' && typeof targetValue === 'number' && typeof currentVelocity === 'number') {\n      const delta = targetValue - currentValue;\n      const spring = delta * stiffness;\n      const damper = currentVelocity * damping;\n      const acceleration = spring - damper;\n\n      const newVelocity = currentVelocity + acceleration;\n      const newValue = currentValue + newVelocity;\n\n      if (Math.abs(delta) > precision || Math.abs(newVelocity) > precision) {\n        current.set(newValue as T);\n        velocity.set(newVelocity as T);\n        animationFrameId = requestAnimationFrame(tick);\n      } else {\n        current.set(targetValue);\n        velocity.set(0 as T);\n        animationFrameId = null;\n      }\n    }\n  };\n\n  // Watch target changes and start animation\n  effect(() => {\n    const newTarget = target();\n\n    if (animationFrameId !== null) {\n      cancelAnimationFrame(animationFrameId);\n    }\n\n    animationFrameId = requestAnimationFrame(tick);\n  });\n\n  return {\n    current: current.asReadonly(),\n    target,\n  };\n}\n","import { effect, Signal, signal, WritableSignal } from '@angular/core';\n\nexport type InterpolateFunction<T> = (from: T, to: T,) => (t: number) => T;\n\nexport interface TweenOptions<T extends number | number[]> {\n  duration: number;\n  delay?: number;\n  easing?: (t: number) => number;\n  interpolate?: InterpolateFunction<T>;\n}\n\nexport interface TweenSignals<T extends number | number[]> {\n  current: Signal<T>;\n  target: WritableSignal<T>;\n}\n\n/**\n * Default interpolation function for numbers\n */\nfunction defaultNumberInterpolate(from: number, to: number): (t: number) => number {\n  return (t: number) => from + (to - from) * t;\n}\n\n/**\n * Default interpolation function for arrays\n */\nfunction defaultArrayInterpolate(from: number[], to: number[]): (t: number) => number[] {\n  return (t: number) => {\n    const result: number[] = [];\n    for (let i = 0; i < from.length; i++) {\n      result[i] = from[i] + (to[i] - from[i]) * t;\n    }\n    return result;\n  };\n}\n\n/**\n * Creates a tween animation that smoothly interpolates between values over a fixed duration.\n *\n * @param initialValue - The initial value (number or array of numbers)\n * @param options - Tween configuration with duration, delay, easing function, and interpolation\n * @returns Object with `current` (readonly signal) and `target` (writable signal)\n *\n * @example\n * ```ts\n * // Basic usage\n * const { current, target } = tween(0, {\n *   duration: 1000,\n *   delay: 500,\n *   easing: (t) => t * t\n * });\n *\n * // With custom interpolation (curried function)\n * const { current, target } = tween(0, {\n *   duration: 1000,\n *   interpolate: (from, to) => (t) => from + (to - from) * t\n * });\n *\n * // Update target to animate\n * target.set(100);\n *\n * // Read current animated value\n * console.log(current());\n * ```\n */\nexport function tween(\n  initialValue: number,\n  options: TweenOptions<number>\n): TweenSignals<number>;\nexport function tween(\n  initialValue: number[],\n  options: TweenOptions<number[]>\n): TweenSignals<number[]>;\nexport function tween<T extends number | number[]>(\n  initialValue: T,\n  options: TweenOptions<T>\n): TweenSignals<T> {\n  const {\n    duration,\n    delay = 0,\n    easing = (t) => t,\n    interpolate\n  } = options;\n\n  const target = signal<T>(initialValue);\n  const current = signal<T>(initialValue);\n\n  let startValue: T = initialValue;\n  let delayStartTime: number | null = null;\n  let animationStartTime: number | null = null;\n  let animationFrameId: number | null = null;\n  let timeoutId: number | null = null;\n\n  const animate = (time: number) => {\n    // Handle delay\n    if (delay > 0 && delayStartTime === null) {\n      delayStartTime = time;\n    }\n\n    if (delay > 0 && delayStartTime !== null) {\n      const delayElapsed = time - delayStartTime;\n      if (delayElapsed < delay) {\n        animationFrameId = requestAnimationFrame(animate);\n        return;\n      }\n    }\n\n    // Start animation after delay\n    if (animationStartTime === null) {\n      animationStartTime = time;\n    }\n\n    const elapsed = time - animationStartTime;\n    const t = Math.min(elapsed / duration, 1);\n    const easedT = easing(t);\n\n    const targetValue = target();\n\n    // Use custom interpolate function if provided\n    if (interpolate) {\n      const interpolateFn = interpolate(startValue, targetValue);\n      const newValue = interpolateFn(easedT);\n      current.set(newValue);\n    } else if (Array.isArray(startValue) && Array.isArray(targetValue)) {\n      const interpolateFn = defaultArrayInterpolate(startValue, targetValue);\n      const newValue = interpolateFn(easedT);\n      current.set(newValue as T);\n    } else if (typeof startValue === 'number' && typeof targetValue === 'number') {\n      const interpolateFn = defaultNumberInterpolate(startValue, targetValue);\n      const newValue = interpolateFn(easedT);\n      current.set(newValue as T);\n    }\n\n    if (t < 1) {\n      animationFrameId = requestAnimationFrame(animate);\n    } else {\n      current.set(targetValue);\n      animationFrameId = null;\n      delayStartTime = null;\n      animationStartTime = null;\n    }\n  };\n\n  // Watch target changes and start animation\n  effect(() => {\n    const newTarget = target();\n\n    // Cancel any pending animations\n    if (animationFrameId !== null) {\n      cancelAnimationFrame(animationFrameId);\n      animationFrameId = null;\n    }\n    if (timeoutId !== null) {\n      clearTimeout(timeoutId);\n      timeoutId = null;\n    }\n\n    startValue = current() as T;\n    delayStartTime = null;\n    animationStartTime = null;\n\n    if (delay > 0) {\n      // Use setTimeout for delay if specified\n      timeoutId = window.setTimeout(() => {\n        animationFrameId = requestAnimationFrame(animate);\n        timeoutId = null;\n      }, delay);\n    } else {\n      animationFrameId = requestAnimationFrame(animate);\n    }\n  });\n\n  return {\n    current: current.asReadonly(),\n    target,\n  };\n}\n\n","import { effect, signal, Signal, WritableSignal } from '@angular/core';\n\n/**\n * Creates a signal that tracks the previous value of another signal.\n *\n * @param source - The signal to track\n * @returns A signal containing the previous value (undefined on first read)\n *\n * @example\n * ```ts\n * const count = signal(0);\n * const prevCount = usePrevious(count);\n *\n * console.log(prevCount()); // undefined\n * count.set(1);\n * console.log(prevCount()); // 0\n * count.set(2);\n * console.log(prevCount()); // 1\n * ```\n */\nexport function usePrevious<T>(source: Signal<T>): Signal<T | undefined> {\n  const previous: WritableSignal<T | undefined> = signal(undefined);\n  let lastValue: T | undefined = undefined;\n  let isFirst = true;\n\n  effect(() => {\n    const current = source();\n\n    if (!isFirst) {\n      previous.set(lastValue);\n    }\n\n    lastValue = current;\n    isFirst = false;\n  });\n\n  return previous.asReadonly();\n}\n","import { signal, Signal, WritableSignal } from '@angular/core';\n\n/**\n * Return type for the useToggle function.\n */\nexport interface ToggleReturn {\n  /** The current boolean value */\n  value: Signal<boolean>;\n  /** Toggle the value */\n  toggle: () => void;\n  /** Set value to true */\n  setTrue: () => void;\n  /** Set value to false */\n  setFalse: () => void;\n}\n\n/**\n * Creates a boolean signal with convenient toggle methods.\n *\n * @param initial - Initial boolean value (default: false)\n * @returns Object with value signal and toggle methods\n *\n * @example\n * ```ts\n * const modal = useToggle(false);\n *\n * console.log(modal.value()); // false\n * modal.toggle();\n * console.log(modal.value()); // true\n * modal.setFalse();\n * console.log(modal.value()); // false\n * ```\n */\nexport function useToggle(initial = false): ToggleReturn {\n  const value: WritableSignal<boolean> = signal(initial);\n\n  return {\n    value: value.asReadonly(),\n    toggle: () => value.update(v => !v),\n    setTrue: () => value.set(true),\n    setFalse: () => value.set(false),\n  };\n}\n","import { signal, Signal, WritableSignal } from '@angular/core';\n\n/**\n * Return type for the useCounter function.\n */\nexport interface CounterReturn {\n  /** The current count value */\n  count: Signal<number>;\n  /** Increment the counter by step (default: 1) */\n  increment: (step?: number) => void;\n  /** Decrement the counter by step (default: 1) */\n  decrement: (step?: number) => void;\n  /** Reset the counter to initial or specified value */\n  reset: (value?: number) => void;\n  /** Set the counter to a specific value */\n  set: (value: number) => void;\n}\n\n/**\n * Creates a counter signal with increment/decrement methods and optional bounds.\n *\n * @param initial - Initial count value (default: 0)\n * @param min - Minimum allowed value (default: -Infinity)\n * @param max - Maximum allowed value (default: Infinity)\n * @returns Object with count signal and manipulation methods\n *\n * @example\n * ```ts\n * const counter = useCounter(0, 0, 10);\n *\n * console.log(counter.count()); // 0\n * counter.increment();\n * console.log(counter.count()); // 1\n * counter.increment(5);\n * console.log(counter.count()); // 6\n * counter.increment(10);\n * console.log(counter.count()); // 10 (clamped to max)\n * counter.reset();\n * console.log(counter.count()); // 0\n * ```\n */\nexport function useCounter(\n  initial = 0,\n  min = -Infinity,\n  max = Infinity\n): CounterReturn {\n  const initialValue = Math.max(min, Math.min(max, initial));\n  const count: WritableSignal<number> = signal(initialValue);\n\n  const clamp = (value: number): number => {\n    return Math.max(min, Math.min(max, value));\n  };\n\n  return {\n    count: count.asReadonly(),\n    increment: (step = 1) => count.update(v => clamp(v + step)),\n    decrement: (step = 1) => count.update(v => clamp(v - step)),\n    reset: (value?: number) => count.set(clamp(value ?? initialValue)),\n    set: (value: number) => count.set(clamp(value)),\n  };\n}\n","import { signal, Signal, WritableSignal } from '@angular/core';\n\n/**\n * Return type for the useArray function.\n */\nexport interface ArrayReturn<T> {\n  /** The current array value */\n  items: Signal<readonly T[]>;\n  /** Add items to the end of the array */\n  push: (...items: T[]) => void;\n  /** Remove and return the last item */\n  pop: () => T | undefined;\n  /** Remove and return the first item */\n  shift: () => T | undefined;\n  /** Add items to the beginning of the array */\n  unshift: (...items: T[]) => void;\n  /** Filter items based on predicate */\n  filter: (predicate: (item: T, index: number) => boolean) => void;\n  /** Map items to new values */\n  map: <U>(fn: (item: T, index: number) => U) => void;\n  /** Remove all items */\n  clear: () => void;\n  /** Remove item at specific index */\n  remove: (index: number) => void;\n  /** Insert item at specific index */\n  insert: (index: number, item: T) => void;\n  /** Replace the entire array */\n  set: (items: T[]) => void;\n  /** Find first item matching predicate */\n  find: (predicate: (item: T) => boolean) => T | undefined;\n  /** Find index of first item matching predicate */\n  findIndex: (predicate: (item: T) => boolean) => number;\n}\n\n/**\n * Creates an array signal with convenient manipulation methods.\n * All operations return new arrays (immutable).\n *\n * @param initial - Initial array value (default: [])\n * @returns Object with items signal and array manipulation methods\n *\n * @example\n * ```ts\n * const todos = useArray<string>(['Buy milk', 'Walk dog']);\n *\n * console.log(todos.items()); // ['Buy milk', 'Walk dog']\n * todos.push('Clean room');\n * console.log(todos.items()); // ['Buy milk', 'Walk dog', 'Clean room']\n * todos.remove(0);\n * console.log(todos.items()); // ['Walk dog', 'Clean room']\n * todos.clear();\n * console.log(todos.items()); // []\n * ```\n */\nexport function useArray<T>(initial: T[] = []): ArrayReturn<T> {\n  const items: WritableSignal<readonly T[]> = signal([...initial]);\n\n  return {\n    items: items.asReadonly(),\n    push: (...newItems: T[]) => items.update(arr => [...arr, ...newItems]),\n    pop: () => {\n      let popped: T | undefined;\n      items.update(arr => {\n        if (arr.length === 0) return arr;\n        const newArr = [...arr];\n        popped = newArr.pop();\n        return newArr;\n      });\n      return popped;\n    },\n    shift: () => {\n      let shifted: T | undefined;\n      items.update(arr => {\n        if (arr.length === 0) return arr;\n        const newArr = [...arr];\n        shifted = newArr.shift();\n        return newArr;\n      });\n      return shifted;\n    },\n    unshift: (...newItems: T[]) => items.update(arr => [...newItems, ...arr]),\n    filter: (predicate: (item: T, index: number) => boolean) =>\n      items.update(arr => arr.filter(predicate)),\n    map: <U>(fn: (item: T, index: number) => U) =>\n      items.update(arr => arr.map(fn) as any),\n    clear: () => items.set([]),\n    remove: (index: number) =>\n      items.update(arr => arr.filter((_, i) => i !== index)),\n    insert: (index: number, item: T) =>\n      items.update(arr => {\n        const newArr = [...arr];\n        newArr.splice(index, 0, item);\n        return newArr;\n      }),\n    set: (newItems: T[]) => items.set([...newItems]),\n    find: (predicate: (item: T) => boolean) => items().find(predicate),\n    findIndex: (predicate: (item: T) => boolean) => items().findIndex(predicate),\n  };\n}\n","import { effect, signal, Signal, WritableSignal } from '@angular/core';\n\n/**\n * Configuration options for debouncing.\n */\nexport interface DebounceOptions {\n  /** Delay in milliseconds */\n  delay: number;\n  /** Execute on the leading edge (default: false) */\n  leading?: boolean;\n  /** Execute on the trailing edge (default: true) */\n  trailing?: boolean;\n}\n\n/**\n * Creates a debounced version of a signal that delays updates.\n *\n * @param source - The signal to debounce\n * @param options - Debounce configuration\n * @returns A debounced signal\n *\n * @example\n * ```ts\n * const search = signal('');\n * const debouncedSearch = useDebounce(search, { delay: 300 });\n *\n * search.set('hello'); // debouncedSearch updates after 300ms\n * ```\n */\nexport function useDebounce<T>(\n  source: Signal<T>,\n  options: DebounceOptions\n): Signal<T> {\n  const { delay, leading = false, trailing = true } = options;\n  const debounced: WritableSignal<T> = signal(source());\n\n  let timeoutId: ReturnType<typeof setTimeout> | null = null;\n  let lastLeadingTime = 0;\n  let isFirstRun = true;\n\n  effect(() => {\n    const value = source();\n\n    // Skip the initial effect run\n    if (isFirstRun) {\n      isFirstRun = false;\n      return;\n    }\n\n    // Clear any pending timeout\n    if (timeoutId !== null) {\n      clearTimeout(timeoutId);\n      timeoutId = null;\n    }\n\n    // Leading edge execution\n    const now = Date.now();\n    if (leading && now - lastLeadingTime >= delay) {\n      debounced.set(value);\n      lastLeadingTime = now;\n    }\n\n    // Trailing edge execution\n    if (trailing) {\n      timeoutId = setTimeout(() => {\n        debounced.set(value);\n        timeoutId = null;\n      }, delay);\n    }\n  });\n\n  return debounced.asReadonly();\n}\n","import { effect, signal, Signal, WritableSignal } from '@angular/core';\n\n/**\n * Configuration options for throttling.\n */\nexport interface ThrottleOptions {\n  /** Delay in milliseconds */\n  delay: number;\n  /** Execute on the leading edge (default: true) */\n  leading?: boolean;\n  /** Execute on the trailing edge (default: false) */\n  trailing?: boolean;\n}\n\n/**\n * Creates a throttled version of a signal that limits update frequency.\n *\n * @param source - The signal to throttle\n * @param options - Throttle configuration\n * @returns A throttled signal\n *\n * @example\n * ```ts\n * const scrollY = signal(0);\n * const throttledScrollY = useThrottle(scrollY, { delay: 100 });\n *\n * // scrollY updates frequently, but throttledScrollY updates at most once per 100ms\n * ```\n */\nexport function useThrottle<T>(\n  source: Signal<T>,\n  options: ThrottleOptions\n): Signal<T> {\n  const { delay, leading = true, trailing = false } = options;\n  const throttled: WritableSignal<T> = signal(source());\n\n  let timeoutId: ReturnType<typeof setTimeout> | null = null;\n  let lastExecuted = 0;\n  let isFirstRun = true;\n\n  effect(() => {\n    const value = source();\n\n    // Skip the initial effect run\n    if (isFirstRun) {\n      isFirstRun = false;\n      return;\n    }\n\n    const execute = () => {\n      throttled.set(value);\n      lastExecuted = Date.now();\n    };\n\n    const timeSinceLastExecute = Date.now() - lastExecuted;\n\n    if (leading && timeSinceLastExecute >= delay) {\n      execute();\n    } else if (trailing) {\n      if (timeoutId !== null) {\n        clearTimeout(timeoutId);\n      }\n      timeoutId = setTimeout(execute, delay - timeSinceLastExecute);\n    }\n  });\n\n  return throttled.asReadonly();\n}\n","import { effect, signal, Signal, WritableSignal, isSignal } from '@angular/core';\n\n/**\n * Return type for the useInterval function.\n */\nexport interface IntervalReturn {\n  /** Number of times the interval has executed */\n  count: Signal<number>;\n  /** Whether the interval is currently active */\n  isActive: Signal<boolean>;\n  /** Pause the interval */\n  pause: () => void;\n  /** Resume the interval */\n  resume: () => void;\n  /** Reset the count and restart the interval */\n  reset: () => void;\n}\n\n/**\n * Creates an interval that executes a callback repeatedly with pause/resume control.\n *\n * @param callback - Function to execute on each interval\n * @param delay - Delay in milliseconds (or signal of delay)\n * @returns Object with control methods and state signals\n *\n * @example\n * ```ts\n * const timer = useInterval(() => {\n *   console.log('Tick');\n * }, 1000);\n *\n * console.log(timer.count()); // Number of ticks\n * timer.pause(); // Pause the interval\n * timer.resume(); // Resume the interval\n * timer.reset(); // Reset count and restart\n * ```\n */\nexport function useInterval(\n  callback: () => void,\n  delay: number | Signal<number>\n): IntervalReturn {\n  const count: WritableSignal<number> = signal(0);\n  const isActive: WritableSignal<boolean> = signal(true);\n\n  let intervalId: ReturnType<typeof setInterval> | null = null;\n\n  effect(() => {\n    const active = isActive();\n    const currentDelay = isSignal(delay) ? delay() : delay;\n\n    // Clear any existing interval\n    if (intervalId !== null) {\n      clearInterval(intervalId);\n      intervalId = null;\n    }\n\n    // Create new interval if active\n    if (active) {\n      intervalId = setInterval(() => {\n        callback();\n        count.update(c => c + 1);\n      }, currentDelay);\n    }\n  });\n\n  return {\n    count: count.asReadonly(),\n    isActive: isActive.asReadonly(),\n    pause: () => isActive.set(false),\n    resume: () => isActive.set(true),\n    reset: () => {\n      count.set(0);\n      isActive.set(true);\n    },\n  };\n}\n","import { effect, signal, Signal, WritableSignal, isSignal } from '@angular/core';\n\n/**\n * Return type for the useTimeout function.\n */\nexport interface TimeoutReturn {\n  /** Whether the timeout has completed */\n  isReady: Signal<boolean>;\n  /** Whether the timeout is currently pending */\n  isPending: Signal<boolean>;\n  /** Cancel the timeout */\n  cancel: () => void;\n  /** Reset and restart the timeout */\n  reset: () => void;\n}\n\n/**\n * Creates a timeout that executes a callback after a delay with cancel/reset control.\n *\n * @param callback - Function to execute after timeout\n * @param delay - Delay in milliseconds (or signal of delay)\n * @returns Object with control methods and state signals\n *\n * @example\n * ```ts\n * const timeout = useTimeout(() => {\n *   console.log('Timeout completed!');\n * }, 3000);\n *\n * effect(() => {\n *   if (timeout.isReady()) {\n *     console.log('Ready!');\n *   }\n * });\n *\n * timeout.cancel(); // Cancel the timeout\n * timeout.reset(); // Reset and restart\n * ```\n */\nexport function useTimeout(\n  callback: () => void,\n  delay: number | Signal<number>\n): TimeoutReturn {\n  const isReady: WritableSignal<boolean> = signal(false);\n  const isPending: WritableSignal<boolean> = signal(true);\n  const resetTrigger: WritableSignal<number> = signal(0);\n\n  let timeoutId: ReturnType<typeof setTimeout> | null = null;\n  let isCancelled = false;\n\n  effect(() => {\n    resetTrigger(); // Subscribe to reset trigger\n    const currentDelay = isSignal(delay) ? delay() : delay;\n\n    // Clear any existing timeout\n    if (timeoutId !== null) {\n      clearTimeout(timeoutId);\n      timeoutId = null;\n    }\n\n    if (isCancelled) {\n      isPending.set(false);\n      isReady.set(false);\n      return;\n    }\n\n    isReady.set(false);\n    isPending.set(true);\n\n    timeoutId = setTimeout(() => {\n      if (!isCancelled) {\n        callback();\n        isReady.set(true);\n        isPending.set(false);\n      }\n      timeoutId = null;\n    }, currentDelay);\n  });\n\n  return {\n    isReady: isReady.asReadonly(),\n    isPending: isPending.asReadonly(),\n    cancel: () => {\n      isCancelled = true;\n      isPending.set(false);\n      if (timeoutId !== null) {\n        clearTimeout(timeoutId);\n        timeoutId = null;\n      }\n    },\n    reset: () => {\n      isCancelled = false;\n      resetTrigger.update(n => n + 1); // Trigger effect re-run\n    },\n  };\n}\n","import { effect, signal, Signal, WritableSignal } from '@angular/core';\n\n/**\n * Configuration options for useNow.\n */\nexport interface NowOptions {\n  /** Update interval in milliseconds (default: 1000) */\n  interval?: number;\n}\n\n/**\n * Creates a signal that contains the current Date, updating at a specified interval.\n *\n * @param options - Configuration options\n * @returns A signal containing the current Date\n *\n * @example\n * ```ts\n * const now = useNow({ interval: 1000 });\n *\n * effect(() => {\n *   console.log('Current time:', now().toLocaleTimeString());\n * });\n * ```\n */\nexport function useNow(options: NowOptions = {}): Signal<Date> {\n  const { interval = 1000 } = options;\n  const now: WritableSignal<Date> = signal(new Date());\n\n  effect(() => {\n    const intervalId = setInterval(() => {\n      now.set(new Date());\n    }, interval);\n\n    return () => {\n      clearInterval(intervalId);\n    };\n  });\n\n  return now.asReadonly();\n}\n","import { effect, signal, Signal, WritableSignal, isSignal } from '@angular/core';\n\n/**\n * Creates a signal that tracks whether a media query matches.\n *\n * @param query - CSS media query string or signal of query\n * @returns A signal indicating if the media query matches\n *\n * @example\n * ```ts\n * const isMobile = useMediaQuery('(max-width: 768px)');\n * const isDark = useMediaQuery('(prefers-color-scheme: dark)');\n *\n * effect(() => {\n *   console.log('Is mobile:', isMobile());\n *   console.log('Dark mode:', isDark());\n * });\n * ```\n */\nexport function useMediaQuery(query: string | Signal<string>): Signal<boolean> {\n  const matches: WritableSignal<boolean> = signal(false);\n\n  effect(() => {\n    if (typeof window === 'undefined') return;\n\n    const currentQuery = isSignal(query) ? query() : query;\n    const mediaQuery = window.matchMedia(currentQuery);\n\n    matches.set(mediaQuery.matches);\n\n    const handler = (event: MediaQueryListEvent) => {\n      matches.set(event.matches);\n    };\n\n    mediaQuery.addEventListener('change', handler);\n\n    return () => {\n      mediaQuery.removeEventListener('change', handler);\n    };\n  });\n\n  return matches.asReadonly();\n}\n","import { effect, Signal, isSignal } from '@angular/core';\n\n/**\n * Attaches an event listener to a target with automatic cleanup.\n *\n * @param target - Event target (Window, Document, HTMLElement, or signal of element)\n * @param event - Event name\n * @param handler - Event handler function\n * @param options - AddEventListener options\n *\n * @example\n * ```ts\n * // Listen to window resize\n * useEventListener(window, 'resize', () => {\n *   console.log('Window resized');\n * });\n *\n * // Listen to element clicks\n * const button = signal<HTMLElement | null>(null);\n * useEventListener(button, 'click', (event) => {\n *   console.log('Button clicked', event);\n * });\n * ```\n */\nexport function useEventListener<K extends keyof WindowEventMap>(\n  target: Window,\n  event: K,\n  handler: (event: WindowEventMap[K]) => void,\n  options?: AddEventListenerOptions\n): void;\n\nexport function useEventListener<K extends keyof DocumentEventMap>(\n  target: Document,\n  event: K,\n  handler: (event: DocumentEventMap[K]) => void,\n  options?: AddEventListenerOptions\n): void;\n\nexport function useEventListener<K extends keyof HTMLElementEventMap>(\n  target: HTMLElement | Signal<HTMLElement | null>,\n  event: K,\n  handler: (event: HTMLElementEventMap[K]) => void,\n  options?: AddEventListenerOptions\n): void;\n\nexport function useEventListener(\n  target: any,\n  event: string,\n  handler: (event: any) => void,\n  options?: AddEventListenerOptions\n): void {\n  effect(() => {\n    if (typeof window === 'undefined') return;\n\n    const currentTarget = isSignal(target) ? target() : target;\n    if (!currentTarget) return;\n\n    currentTarget.addEventListener(event, handler, options);\n\n    return () => {\n      currentTarget.removeEventListener(event, handler, options);\n    };\n  });\n}\n","import { effect, signal, Signal, WritableSignal } from '@angular/core';\n\n/**\n * Return type for storage functions.\n */\nexport interface StorageReturn<T> {\n  /** The stored value */\n  value: WritableSignal<T>;\n  /** Remove the value from storage */\n  remove: () => void;\n}\n\n/**\n * Creates a signal synced with localStorage.\n *\n * @param key - Storage key\n * @param initialValue - Initial value if key doesn't exist\n * @returns Object with value signal and remove method\n *\n * @example\n * ```ts\n * const theme = useLocalStorage('theme', 'light');\n *\n * theme.value.set('dark'); // Persists to localStorage\n * console.log(theme.value()); // 'dark'\n * theme.remove(); // Removes from localStorage\n * ```\n */\nexport function useLocalStorage<T>(\n  key: string,\n  initialValue: T\n): StorageReturn<T> {\n  return useStorage(localStorage, key, initialValue);\n}\n\n/**\n * Creates a signal synced with sessionStorage.\n *\n * @param key - Storage key\n * @param initialValue - Initial value if key doesn't exist\n * @returns Object with value signal and remove method\n *\n * @example\n * ```ts\n * const sessionData = useSessionStorage('user', { name: 'Guest' });\n *\n * sessionData.value.set({ name: 'John' }); // Persists to sessionStorage\n * ```\n */\nexport function useSessionStorage<T>(\n  key: string,\n  initialValue: T\n): StorageReturn<T> {\n  return useStorage(sessionStorage, key, initialValue);\n}\n\nfunction useStorage<T>(\n  storage: Storage,\n  key: string,\n  initialValue: T\n): StorageReturn<T> {\n  // Read initial value from storage\n  const readValue = (): T => {\n    if (typeof window === 'undefined') return initialValue;\n\n    try {\n      const item = storage.getItem(key);\n      return item ? JSON.parse(item) : initialValue;\n    } catch (error) {\n      console.warn(`Error reading ${key} from storage:`, error);\n      return initialValue;\n    }\n  };\n\n  const value: WritableSignal<T> = signal(readValue());\n\n  // Write to storage on change\n  effect(() => {\n    if (typeof window === 'undefined') return;\n\n    const currentValue = value();\n\n    try {\n      storage.setItem(key, JSON.stringify(currentValue));\n    } catch (error) {\n      console.warn(`Error writing ${key} to storage:`, error);\n    }\n  });\n\n  // Listen to storage events from other tabs\n  effect(() => {\n    if (typeof window === 'undefined') return;\n\n    const handleStorageChange = (event: StorageEvent) => {\n      if (event.key === key && event.newValue) {\n        try {\n          value.set(JSON.parse(event.newValue));\n        } catch (error) {\n          console.warn(`Error parsing storage event for ${key}:`, error);\n        }\n      }\n    };\n\n    window.addEventListener('storage', handleStorageChange);\n\n    return () => {\n      window.removeEventListener('storage', handleStorageChange);\n    };\n  });\n\n  return {\n    value,\n    remove: () => {\n      if (typeof window !== 'undefined') {\n        storage.removeItem(key);\n        value.set(initialValue);\n      }\n    },\n  };\n}\n","/*\n * Public API Surface of angular-signals\n */\n\n// Signal utilities\nexport * from './lib/signal/signal';\nexport * from './lib/computed/computed';\n\n// Animation utilities\nexport * from './lib/animation/spring';\nexport * from './lib/animation/tween';\n\n// State management\nexport * from './lib/state/previous';\nexport * from './lib/state/toggle';\nexport * from './lib/state/counter';\nexport * from './lib/state/array';\n\n// Async utilities\nexport * from './lib/async/debounce';\nexport * from './lib/async/throttle';\n\n// Timing utilities\nexport * from './lib/timing/interval';\nexport * from './lib/timing/timeout';\nexport * from './lib/timing/now';\n\n// Browser APIs\nexport * from './lib/browser/media-query';\nexport * from './lib/browser/event-listener';\nexport * from './lib/browser/storage';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;AAIM,SAAU,UAAU,CAAI,KAAQ,EAAA;I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