{"version":3,"file":"reduxjs-angular-redux.mjs","sources":["../../../projects/angular-redux/src/lib/utils/Subscription.ts","../../../projects/angular-redux/src/lib/provider.ts","../../../projects/angular-redux/src/lib/inject-store.ts","../../../projects/angular-redux/src/lib/inject-dispatch.ts","../../../projects/angular-redux/src/lib/inject-selector.ts","../../../projects/angular-redux/src/lib/provide-redux.ts","../../../projects/angular-redux/src/lib/utils/shallowEqual.ts","../../../projects/angular-redux/src/public-api.ts","../../../projects/angular-redux/src/reduxjs-angular-redux.ts"],"sourcesContent":["// encapsulates the subscription logic for connecting a component to the redux store, as\n// well as nesting subscriptions of descendant components, so that we can ensure the\n// ancestor components re-render before descendants\n\ntype VoidFunc = () => void;\n\ntype Listener = {\n  callback: VoidFunc;\n  next: Listener | null;\n  prev: Listener | null;\n};\n\nfunction createListenerCollection() {\n  let first: Listener | null = null;\n  let last: Listener | null = null;\n\n  return {\n    clear() {\n      first = null;\n      last = null;\n    },\n\n    notify() {\n      let listener = first;\n      while (listener) {\n        listener.callback();\n        listener = listener.next;\n      }\n    },\n\n    get() {\n      const listeners: Listener[] = [];\n      let listener = first;\n      while (listener) {\n        listeners.push(listener);\n        listener = listener.next;\n      }\n      return listeners;\n    },\n\n    subscribe(callback: () => void) {\n      let isSubscribed = true;\n\n      const listener: Listener = (last = {\n        callback,\n        next: null,\n        prev: last,\n      });\n\n      if (listener.prev) {\n        listener.prev.next = listener;\n      } else {\n        first = listener;\n      }\n\n      return function unsubscribe() {\n        if (!isSubscribed || first === null) return;\n        isSubscribed = false;\n\n        if (listener.next) {\n          listener.next.prev = listener.prev;\n        } else {\n          last = listener.prev;\n        }\n        if (listener.prev) {\n          listener.prev.next = listener.next;\n        } else {\n          first = listener.next;\n        }\n      };\n    },\n  };\n}\n\ntype ListenerCollection = ReturnType<typeof createListenerCollection>;\n\nexport interface Subscription {\n  addNestedSub: (listener: VoidFunc) => VoidFunc;\n  notifyNestedSubs: VoidFunc;\n  handleChangeWrapper: VoidFunc;\n  isSubscribed: () => boolean;\n  onStateChange?: VoidFunc | null;\n  trySubscribe: VoidFunc;\n  tryUnsubscribe: VoidFunc;\n  getListeners: () => ListenerCollection;\n}\n\nconst nullListeners = {\n  notify() {},\n  get: () => [],\n} as unknown as ListenerCollection;\n\nexport function createSubscription(store: any, parentSub?: Subscription) {\n  let unsubscribe: VoidFunc | undefined;\n  let listeners: ListenerCollection = nullListeners;\n\n  // Reasons to keep the subscription active\n  let subscriptionsAmount = 0;\n\n  // Is this specific subscription subscribed (or only nested ones?)\n  let selfSubscribed = false;\n\n  function addNestedSub(listener: () => void) {\n    trySubscribe();\n\n    const cleanupListener = listeners.subscribe(listener);\n\n    // cleanup nested sub\n    let removed = false;\n    return () => {\n      if (!removed) {\n        removed = true;\n        cleanupListener();\n        tryUnsubscribe();\n      }\n    };\n  }\n\n  function notifyNestedSubs() {\n    listeners.notify();\n  }\n\n  function handleChangeWrapper() {\n    if (subscription.onStateChange) {\n      subscription.onStateChange();\n    }\n  }\n\n  function isSubscribed() {\n    return selfSubscribed;\n  }\n\n  function trySubscribe() {\n    subscriptionsAmount++;\n    if (!unsubscribe) {\n      unsubscribe = parentSub\n        ? parentSub.addNestedSub(handleChangeWrapper)\n        : store.subscribe(handleChangeWrapper);\n\n      listeners = createListenerCollection();\n    }\n  }\n\n  function tryUnsubscribe() {\n    subscriptionsAmount--;\n    if (unsubscribe && subscriptionsAmount === 0) {\n      unsubscribe();\n      unsubscribe = undefined;\n      listeners.clear();\n      listeners = nullListeners;\n    }\n  }\n\n  function trySubscribeSelf() {\n    if (!selfSubscribed) {\n      selfSubscribed = true;\n      trySubscribe();\n    }\n  }\n\n  function tryUnsubscribeSelf() {\n    if (selfSubscribed) {\n      selfSubscribed = false;\n      tryUnsubscribe();\n    }\n  }\n\n  const subscription: Subscription = {\n    addNestedSub,\n    notifyNestedSubs,\n    handleChangeWrapper,\n    isSubscribed,\n    trySubscribe: trySubscribeSelf,\n    tryUnsubscribe: tryUnsubscribeSelf,\n    getListeners: () => listeners,\n  };\n\n  return subscription;\n}\n","import { Injectable, OnDestroy } from '@angular/core';\nimport type { Action, Store, UnknownAction } from 'redux';\nimport { createSubscription } from './utils/Subscription';\n\n@Injectable({ providedIn: null })\nexport class ReduxProvider<\n  A extends Action<string> = UnknownAction,\n  S = unknown,\n> implements OnDestroy\n{\n  store!: Store<S, A>;\n  subscription!: ReturnType<typeof createSubscription>;\n\n  ngOnDestroy() {\n    this.subscription.tryUnsubscribe();\n    this.subscription.onStateChange = undefined;\n  }\n}\n\n// TODO: Ideally this runs in the constructor, but DI doesn't allow us to pass items to the constructor?\nexport function createReduxProvider<\n  A extends Action<string> = UnknownAction,\n  S = unknown,\n>(store: Store<S, A>) {\n  const provider = new ReduxProvider<A, S>();\n  provider.store = store;\n  const subscription = createSubscription(store);\n  provider.subscription = subscription;\n  subscription.onStateChange = subscription.notifyNestedSubs;\n  subscription.trySubscribe();\n\n  return provider;\n}\n","import { assertInInjectionContext, inject } from '@angular/core';\nimport { ReduxProvider } from './provider';\nimport type { Store, Action } from 'redux';\n\n/**\n * Represents a type that extracts the action type from a given Redux store.\n *\n * @template StoreType - The specific type of the Redux store.\n *\n * @internal\n */\nexport type ExtractStoreActionType<StoreType extends Store> =\n  StoreType extends Store<any, infer ActionType> ? ActionType : never;\n\n/**\n * Represents a custom injection that provides access to the Redux store.\n *\n * @template StoreType - The specific type of the Redux store that gets returned.\n *\n * @public\n */\nexport interface InjectStore<StoreType extends Store> {\n  /**\n   * Returns the Redux store instance.\n   *\n   * @returns The Redux store instance.\n   */\n  (): StoreType;\n\n  /**\n   * Returns the Redux store instance with specific state and action types.\n   *\n   * @returns The Redux store with the specified state and action types.\n   *\n   * @template StateType - The specific type of the state used in the store.\n   * @template ActionType - The specific type of the actions used in the store.\n   */\n  <\n    StateType extends ReturnType<StoreType['getState']> = ReturnType<\n      StoreType['getState']\n    >,\n    ActionType extends Action = ExtractStoreActionType<Store>,\n  >(): Store<StateType, ActionType>;\n\n  /**\n   * Creates a \"pre-typed\" version of {@linkcode injectStore injectStore}\n   * where the type of the Redux `store` is predefined.\n   *\n   * This allows you to set the `store` type once, eliminating the need to\n   * specify it with every {@linkcode injectStore injectStore} call.\n   *\n   * @returns A pre-typed `injectStore` with the store type already defined.\n   *\n   * @example\n   * ```ts\n   * export const useAppStore = injectStore.withTypes<AppStore>()\n   * ```\n   *\n   * @template OverrideStoreType - The specific type of the Redux store that gets returned.\n   */\n  withTypes: <\n    OverrideStoreType extends StoreType,\n  >() => InjectStore<OverrideStoreType>;\n}\n\n/**\n * Injection factory, which creates a `injectStore` injection bound to a given context.\n *\n * @returns {Function} A `injectStore` injection bound to the specified context.\n */\nexport function createStoreInjection<\n  StateType = unknown,\n  ActionType extends Action = Action,\n>() {\n  const injectStore = () => {\n    assertInInjectionContext(injectStore);\n    const context = inject(ReduxProvider);\n    const { store } = context;\n    return store;\n  };\n\n  Object.assign(injectStore, {\n    withTypes: () => injectStore,\n  });\n\n  return injectStore as InjectStore<Store<StateType, ActionType>>;\n}\n\n/**\n * A injection to access the redux store.\n *\n * @returns {any} the redux store\n *\n * @example\n *\n * import { injectStore } from '@reduxjs/angular-redux'\n *\n * @Component({\n *   selector: 'example-component',\n *   template: `<div>{{store.getState()}}</div>`\n * })\n * export class CounterComponent {\n *   store = injectStore()\n * }\n */\nexport const injectStore = /* #__PURE__*/ createStoreInjection();\n","import type { Dispatch, UnknownAction, Action } from 'redux';\r\nimport { assertInInjectionContext } from '@angular/core';\r\nimport { injectStore } from './inject-store';\r\n\r\n/**\r\n * Represents a custom injection that provides a dispatch function\r\n * from the Redux store.\r\n *\r\n * @template DispatchType - The specific type of the dispatch function.\r\n *\r\n * @public\r\n */\r\nexport interface InjectDispatch<\r\n  DispatchType extends Dispatch<UnknownAction> = Dispatch<UnknownAction>,\r\n> {\r\n  /**\r\n   * Returns the dispatch function from the Redux store.\r\n   *\r\n   * @returns The dispatch function from the Redux store.\r\n   *\r\n   * @template AppDispatch - The specific type of the dispatch function.\r\n   */\r\n  <AppDispatch extends DispatchType = DispatchType>(): AppDispatch;\r\n\r\n  /**\r\n   * Creates a \"pre-typed\" version of {@linkcode injectDispatch injectDispatch}\r\n   * where the type of the `dispatch` function is predefined.\r\n   *\r\n   * This allows you to set the `dispatch` type once, eliminating the need to\r\n   * specify it with every {@linkcode injectDispatch injectDispatch} call.\r\n   *\r\n   * @returns A pre-typed `injectDispatch` with the dispatch type already defined.\r\n   *\r\n   * @example\r\n   * ```ts\r\n   * export const injectAppDispatch = injectDispatch.withTypes<AppDispatch>()\r\n   * ```\r\n   *\r\n   * @template OverrideDispatchType - The specific type of the dispatch function.\r\n   */\r\n  withTypes: <\r\n    OverrideDispatchType extends DispatchType,\r\n  >() => InjectDispatch<OverrideDispatchType>;\r\n}\r\n\r\n/**\r\n * Injection factory, which creates a `injectDispatch` injection bound to a given context.\r\n *\r\n * @returns {Function} A `injectDispatch` injection bound to the specified context.\r\n */\r\nexport function createDispatchInjection<\r\n  ActionType extends Action = UnknownAction,\r\n>() {\r\n  const injectDispatch = <\r\n    AppDispatch extends Dispatch<UnknownAction> = Dispatch<UnknownAction>,\r\n  >(): AppDispatch => {\r\n    assertInInjectionContext(injectDispatch);\r\n    const store = injectStore();\r\n    return store.dispatch as AppDispatch;\r\n  };\r\n\r\n  Object.assign(injectDispatch, {\r\n    withTypes: () => injectDispatch,\r\n  });\r\n\r\n  return injectDispatch as InjectDispatch<Dispatch<ActionType>>;\r\n}\r\n\r\n/**\r\n * A injection to access the redux `dispatch` function.\r\n *\r\n * @returns {any|function} redux store's `dispatch` function\r\n *\r\n * @example\r\n *\r\n * import { injectDispatch } from '@reduxjs/angular-redux'\r\n *\r\n * @Component({\r\n *   selector: 'example-component',\r\n *   template: `\r\n *     <div>\r\n *       <span>{{value}}</span>\r\n *       <button (click)=\"increaseCounter()\">Increase counter</button>\r\n *     </div>\r\n *   `\r\n * })\r\n * export class CounterComponent {\r\n *   dispatch = injectDispatch()\r\n *   increaseCounter = () => dispatch({ type: 'increase-counter' })\r\n * }\r\n */\r\nexport const injectDispatch = /* #__PURE__*/ createDispatchInjection();\r\n","import { EqualityFn } from './types';\r\nimport {\r\n  assertInInjectionContext,\r\n  DestroyRef,\r\n  effect,\r\n  inject,\r\n  linkedSignal,\r\n  Signal,\r\n  signal,\r\n} from '@angular/core';\r\nimport { ReduxProvider } from './provider';\r\n\r\nexport interface InjectSelectorOptions<Selected = unknown> {\r\n  equalityFn?: EqualityFn<Selected>;\r\n}\r\n\r\nconst refEquality: EqualityFn<any> = (a, b) => a === b;\r\n\r\n/**\r\n * Represents a custom injection that allows you to extract data from the\r\n * Redux store state, using a selector function. The selector function\r\n * takes the current state as an argument and returns a part of the state\r\n * or some derived data. The injection also supports an optional equality\r\n * function or options object to customize its behavior.\r\n *\r\n * @template StateType - The specific type of state this injection operates on.\r\n *\r\n * @public\r\n */\r\nexport interface InjectSelector<StateType = unknown> {\r\n  /**\r\n   * A function that takes a selector function as its first argument.\r\n   * The selector function is responsible for selecting a part of\r\n   * the Redux store's state or computing derived data.\r\n   *\r\n   * @param selector - A function that receives the current state and returns a part of the state or some derived data.\r\n   * @param equalityFnOrOptions - An optional equality function or options object for customizing the behavior of the selector.\r\n   * @returns The selected part of the state or derived data.\r\n   *\r\n   * @template TState - The specific type of state this injection operates on.\r\n   * @template Selected - The type of the value that the selector function will return.\r\n   */\r\n  <TState extends StateType = StateType, Selected = unknown>(\r\n    selector: (state: TState) => Selected,\r\n    equalityFnOrOptions?:\r\n      | EqualityFn<Selected>\r\n      | InjectSelectorOptions<Selected>,\r\n  ): Signal<Selected>;\r\n\r\n  /**\r\n   * Creates a \"pre-typed\" version of {@linkcode injectSelector injectSelector}\r\n   * where the `state` type is predefined.\r\n   *\r\n   * This allows you to set the `state` type once, eliminating the need to\r\n   * specify it with every {@linkcode injectSelector injectSelector} call.\r\n   *\r\n   * @returns A pre-typed `injectSelector` with the state type already defined.\r\n   *\r\n   * @example\r\n   * ```ts\r\n   * export const injectAppSelector = injectSelector.withTypes<RootState>()\r\n   * ```\r\n   *\r\n   * @template OverrideStateType - The specific type of state this injection operates on.\r\n   */\r\n  withTypes: <\r\n    OverrideStateType extends StateType,\r\n  >() => InjectSelector<OverrideStateType>;\r\n}\r\n\r\n/**\r\n * Injection factory, which creates a `injectSelector` injection bound to a given context.\r\n *\r\n * @returns {Function} A `injectSelector` injection bound to the specified context.\r\n */\r\nexport function createSelectorInjection(): InjectSelector {\r\n  const injectSelector = <TState, Selected>(\r\n    selector: (state: TState) => Selected,\r\n    equalityFnOrOptions:\r\n      | EqualityFn<Selected>\r\n      | InjectSelectorOptions<Selected> = {},\r\n  ): Signal<Selected> => {\r\n    assertInInjectionContext(injectSelector);\r\n    const reduxContext = inject(ReduxProvider);\r\n    const destroyRef = inject(DestroyRef);\r\n\r\n    const { equalityFn = refEquality } =\r\n      typeof equalityFnOrOptions === 'function'\r\n        ? { equalityFn: equalityFnOrOptions }\r\n        : equalityFnOrOptions;\r\n\r\n    const { store, subscription } = reduxContext;\r\n\r\n    const selectedState = linkedSignal(() => selector(store.getState()), {\r\n      equal: equalityFn,\r\n    });\r\n\r\n    const unsubscribe = subscription.addNestedSub(() => {\r\n      const data = selector(store.getState());\r\n\r\n      selectedState.set(data);\r\n    });\r\n\r\n    destroyRef.onDestroy(() => {\r\n      unsubscribe();\r\n    });\r\n\r\n    return selectedState.asReadonly();\r\n  };\r\n\r\n  Object.assign(injectSelector, {\r\n    withTypes: () => injectSelector,\r\n  });\r\n\r\n  return injectSelector as InjectSelector;\r\n}\r\n\r\n/**\r\n * A injection to access the redux store's state. This injection takes a selector function\r\n * as an argument. The selector is called with the store state.\r\n *\r\n * This injection takes an optional equality comparison function as the second parameter\r\n * that allows you to customize the way the selected state is compared to determine\r\n * whether the component needs to be re-rendered.\r\n *\r\n * @param {Function} selector the selector function\r\n * @param {Function=} equalityFn the function that will be used to determine equality\r\n *\r\n * @returns {any} the selected state\r\n *\r\n * @example\r\n *\r\n * import { injectSelector } from '@reduxjs/angular-redux'\r\n *\r\n * @Component({\r\n *   selector: 'counter-component',\r\n *   template: `<div>{{counter}}</div>`\r\n * })\r\n * export class CounterComponent {\r\n *   counter = injectSelector(state => state.counter)\r\n * }\r\n */\r\nexport const injectSelector = /* #__PURE__*/ createSelectorInjection();\r\n","import type { Action, Store, UnknownAction } from 'redux';\nimport { createReduxProvider, ReduxProvider } from './provider';\n\nexport interface ProviderProps<\n  A extends Action<string> = UnknownAction,\n  S = unknown,\n> {\n  /**\n   * The single Redux store in your application.\n   */\n  store: Store<S, A>;\n}\n\nexport function provideRedux<\n  A extends Action<string> = UnknownAction,\n  S = unknown,\n>({ store }: ProviderProps<A, S>) {\n  return {\n    provide: ReduxProvider,\n    useValue: createReduxProvider(store),\n  };\n}\n","function is(x: unknown, y: unknown) {\n  if (x === y) {\n    return x !== 0 || y !== 0 || 1 / x === 1 / y;\n  } else {\n    return x !== x && y !== y;\n  }\n}\n\nexport function shallowEqual(objA: any, objB: any) {\n  if (is(objA, objB)) return true;\n\n  if (\n    typeof objA !== 'object' ||\n    objA === null ||\n    typeof objB !== 'object' ||\n    objB === null\n  ) {\n    return false;\n  }\n\n  const keysA = Object.keys(objA);\n  const keysB = Object.keys(objB);\n\n  if (keysA.length !== keysB.length) return false;\n\n  for (let i = 0; i < keysA.length; i++) {\n    if (\n      !Object.prototype.hasOwnProperty.call(objB, keysA[i]) ||\n      !is(objA[keysA[i]], objB[keysA[i]])\n    ) {\n      return false;\n    }\n  }\n\n  return true;\n}\n","/*\n * Public API Surface of @reduxjs/angular-redux\n */\n\nexport * from './lib/inject-dispatch';\nexport * from './lib/inject-selector';\nexport * from './lib/inject-store';\nexport * from './lib/provide-redux';\nexport * from './lib/provider';\nexport * from './lib/utils/shallowEqual';\nexport type { Subscription } from './lib/utils/Subscription';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;AAAA;AACA;AACA;AAUA,SAAS,wBAAwB,GAAA;IAC/B,IAAI,KAAK,GAAoB,IAAI;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