Files
wdi-dashboard/node_modules/@reduxjs/toolkit/dist/react/redux-toolkit-react.modern.mjs.map
2024-08-16 15:06:52 +05:30

1 line
3.9 KiB
Plaintext

{"version":3,"sources":["../../src/react/index.ts","../../src/dynamicMiddleware/react/index.ts"],"sourcesContent":["// This must remain here so that the `mangleErrors.cjs` build script\n// does not have to import this into each source file it rewrites.\nimport { formatProdErrorMessage } from '@reduxjs/toolkit';\nexport * from '@reduxjs/toolkit';\nexport { createDynamicMiddleware } from '../dynamicMiddleware/react';","import type { Action as ReduxAction, UnknownAction, Dispatch as ReduxDispatch, Middleware } from 'redux';\nimport type { TSHelpersExtractDispatchExtensions } from '@reduxjs/toolkit';\nimport { createDynamicMiddleware as cDM } from '@reduxjs/toolkit';\nimport type { ReactReduxContextValue } from 'react-redux';\nimport { ReactReduxContext, useDispatch as useDefaultDispatch, createDispatchHook } from 'react-redux';\nimport type { Context } from 'react';\nimport type { DynamicMiddlewareInstance, GetDispatch, GetState, MiddlewareApiConfig } from '@reduxjs/toolkit';\nexport type UseDispatchWithMiddlewareHook<Middlewares extends Middleware<any, State, Dispatch>[] = [], State = any, Dispatch extends ReduxDispatch<UnknownAction> = ReduxDispatch<UnknownAction>> = () => TSHelpersExtractDispatchExtensions<Middlewares> & Dispatch;\nexport type CreateDispatchWithMiddlewareHook<State = any, Dispatch extends ReduxDispatch<UnknownAction> = ReduxDispatch<UnknownAction>> = {\n <Middlewares extends [Middleware<any, State, Dispatch>, ...Middleware<any, State, Dispatch>[]]>(...middlewares: Middlewares): UseDispatchWithMiddlewareHook<Middlewares, State, Dispatch>;\n withTypes<MiddlewareConfig extends MiddlewareApiConfig>(): CreateDispatchWithMiddlewareHook<GetState<MiddlewareConfig>, GetDispatch<MiddlewareConfig>>;\n};\ntype ActionFromDispatch<Dispatch extends ReduxDispatch<ReduxAction>> = Dispatch extends ReduxDispatch<infer Action> ? Action : never;\ninterface ReactDynamicMiddlewareInstance<State = any, Dispatch extends ReduxDispatch<UnknownAction> = ReduxDispatch<UnknownAction>> extends DynamicMiddlewareInstance<State, Dispatch> {\n createDispatchWithMiddlewareHookFactory: (context?: Context<ReactReduxContextValue<State, ActionFromDispatch<Dispatch>> | null>) => CreateDispatchWithMiddlewareHook<State, Dispatch>;\n createDispatchWithMiddlewareHook: CreateDispatchWithMiddlewareHook<State, Dispatch>;\n}\nexport const createDynamicMiddleware = <State = any, Dispatch extends ReduxDispatch<UnknownAction> = ReduxDispatch<UnknownAction>>(): ReactDynamicMiddlewareInstance<State, Dispatch> => {\n const instance = cDM<State, Dispatch>();\n\n const createDispatchWithMiddlewareHookFactory = ( // @ts-ignore\n context: Context<ReactReduxContextValue<State, ActionFromDispatch<Dispatch>> | null> = ReactReduxContext) => {\n const useDispatch = context === ReactReduxContext ? useDefaultDispatch : createDispatchHook(context);\n\n function createDispatchWithMiddlewareHook<Middlewares extends Middleware<any, State, Dispatch>[]>(...middlewares: Middlewares) {\n instance.addMiddleware(...middlewares);\n return useDispatch;\n }\n\n createDispatchWithMiddlewareHook.withTypes = () => createDispatchWithMiddlewareHook;\n\n return (createDispatchWithMiddlewareHook as CreateDispatchWithMiddlewareHook<State, Dispatch>);\n };\n\n const createDispatchWithMiddlewareHook = createDispatchWithMiddlewareHookFactory();\n return { ...instance,\n createDispatchWithMiddlewareHookFactory,\n createDispatchWithMiddlewareHook\n };\n};"],"mappings":";AAGA,cAAc;;;ACDd,SAAS,2BAA2B,WAAW;AAE/C,SAAS,mBAAmB,eAAe,oBAAoB,0BAA0B;AAalF,IAAM,0BAA0B,MAAkJ;AACvL,QAAM,WAAW,IAAqB;AAEtC,QAAM,0CAA0C,CAChD,UAAuF,sBAAsB;AAC3G,UAAM,cAAc,YAAY,oBAAoB,qBAAqB,mBAAmB,OAAO;AAEnG,aAASA,qCAA4F,aAA0B;AAC7H,eAAS,cAAc,GAAG,WAAW;AACrC,aAAO;AAAA,IACT;AAEA,IAAAA,kCAAiC,YAAY,MAAMA;AAEnD,WAAQA;AAAA,EACV;AAEA,QAAM,mCAAmC,wCAAwC;AACjF,SAAO;AAAA,IAAE,GAAG;AAAA,IACV;AAAA,IACA;AAAA,EACF;AACF;","names":["createDispatchWithMiddlewareHook"]}