@e1011/es-kit 1.0.154 → 1.0.158

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.
Files changed (56) hide show
  1. package/dist/hooks/esm/index.css +43 -43
  2. package/dist/hooks/esm/node_modules/core-js/internals/iterator-define.js +1 -1
  3. package/dist/hooks/esm/node_modules/core-js/internals/iterator-define.js.map +1 -1
  4. package/dist/hooks/esm/node_modules/core-js/internals/shared.js +1 -1
  5. package/dist/hooks/esm/node_modules/core-js/internals/shared.js.map +1 -1
  6. package/dist/hooks/index.css +43 -43
  7. package/dist/hooks/node_modules/core-js/internals/iterator-define.js +1 -1
  8. package/dist/hooks/node_modules/core-js/internals/iterator-define.js.map +1 -1
  9. package/dist/hooks/node_modules/core-js/internals/shared.js +1 -1
  10. package/dist/hooks/node_modules/core-js/internals/shared.js.map +1 -1
  11. package/dist/lib/cjs/node_modules/core-js/internals/fix-regexp-well-known-symbol-logic.js.map +1 -1
  12. package/dist/lib/cjs/node_modules/core-js/internals/iterator-define.js +1 -1
  13. package/dist/lib/cjs/node_modules/core-js/internals/iterator-define.js.map +1 -1
  14. package/dist/lib/cjs/node_modules/core-js/internals/shared.js +1 -1
  15. package/dist/lib/cjs/node_modules/core-js/internals/shared.js.map +1 -1
  16. package/dist/lib/cjs/src/core/utils/appState/store/store.vanillajs.js.map +1 -1
  17. package/dist/lib/cjs/src/core/utils/appState/store/useStore.react.js.map +1 -1
  18. package/dist/lib/esm/node_modules/core-js/internals/fix-regexp-well-known-symbol-logic.js.map +1 -1
  19. package/dist/lib/esm/node_modules/core-js/internals/iterator-define.js +1 -1
  20. package/dist/lib/esm/node_modules/core-js/internals/iterator-define.js.map +1 -1
  21. package/dist/lib/esm/node_modules/core-js/internals/shared.js +1 -1
  22. package/dist/lib/esm/node_modules/core-js/internals/shared.js.map +1 -1
  23. package/dist/lib/esm/src/core/utils/appState/store/store.vanillajs.js.map +1 -1
  24. package/dist/lib/esm/src/core/utils/appState/store/useStore.react.js.map +1 -1
  25. package/dist/lib/src/core/utils/appState/store/store.vanillajs.js.map +1 -1
  26. package/dist/lib/src/core/utils/appState/store/useStore.react.js.map +1 -1
  27. package/dist/lib/tsconfig.tsbuildinfo +1 -1
  28. package/dist/types/src/core/utils/appState/store/store.vanillajs.d.ts +3 -2
  29. package/dist/types/src/core/utils/appState/store/store.vanillajs.d.ts.map +1 -1
  30. package/dist/ui/esm/node_modules/core-js/internals/fix-regexp-well-known-symbol-logic.js.map +1 -1
  31. package/dist/ui/esm/node_modules/core-js/internals/iterator-define.js +1 -1
  32. package/dist/ui/esm/node_modules/core-js/internals/iterator-define.js.map +1 -1
  33. package/dist/ui/esm/node_modules/core-js/internals/shared.js +1 -1
  34. package/dist/ui/esm/node_modules/core-js/internals/shared.js.map +1 -1
  35. package/dist/ui/node_modules/core-js/internals/fix-regexp-well-known-symbol-logic.js.map +1 -1
  36. package/dist/ui/node_modules/core-js/internals/iterator-define.js +1 -1
  37. package/dist/ui/node_modules/core-js/internals/iterator-define.js.map +1 -1
  38. package/dist/ui/node_modules/core-js/internals/shared.js +1 -1
  39. package/dist/ui/node_modules/core-js/internals/shared.js.map +1 -1
  40. package/dist/utils/esm/index.css +43 -43
  41. package/dist/utils/esm/node_modules/core-js/internals/fix-regexp-well-known-symbol-logic.js.map +1 -1
  42. package/dist/utils/esm/node_modules/core-js/internals/iterator-define.js +1 -1
  43. package/dist/utils/esm/node_modules/core-js/internals/iterator-define.js.map +1 -1
  44. package/dist/utils/esm/node_modules/core-js/internals/shared.js +1 -1
  45. package/dist/utils/esm/node_modules/core-js/internals/shared.js.map +1 -1
  46. package/dist/utils/esm/src/core/utils/appState/store/store.vanillajs.js.map +1 -1
  47. package/dist/utils/esm/src/core/utils/appState/store/useStore.react.js.map +1 -1
  48. package/dist/utils/index.css +43 -43
  49. package/dist/utils/node_modules/core-js/internals/fix-regexp-well-known-symbol-logic.js.map +1 -1
  50. package/dist/utils/node_modules/core-js/internals/iterator-define.js +1 -1
  51. package/dist/utils/node_modules/core-js/internals/iterator-define.js.map +1 -1
  52. package/dist/utils/node_modules/core-js/internals/shared.js +1 -1
  53. package/dist/utils/node_modules/core-js/internals/shared.js.map +1 -1
  54. package/dist/utils/src/core/utils/appState/store/store.vanillajs.js.map +1 -1
  55. package/dist/utils/src/core/utils/appState/store/useStore.react.js.map +1 -1
  56. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"store.vanillajs.js","sources":["../../../../../../../../src/core/utils/appState/store/store.vanillajs.ts"],"sourcesContent":["\n// TinyStore, inspired by https://github.com/jherr/syncexternalstore/blob/main/csr/src/store.js\n\n/**\n * Represents the callback function for a store listener.\n */\nexport type ListenerCallBack<T> = (state: Partial<T>) => void\n\n/**\n * Represents a selector function that transforms the store state.\n */\nexport type Selector<T> = (state: Partial<T>) => Partial<T>;\n\n/**\n * Represents a listener for the store.\n */\nexport type Listener<T> = {\n selector?: Selector<T>\n previousValue?: Partial<T>\n} & ListenerCallBack<T>\n\n/**\n * Represents a store.\n */\nexport type Store<T> = {\n /**\n * Get the current state of the store.\n * @returns The current state of the store.\n */\n getState: () => Partial<T>\n /**\n * Set the state of the store.\n * @param state - The new state to set.\n * @returns A promise that resolves to the new state.\n */\n setState: (state: Partial<T>) => Promise<Partial<T>>\n /**\n * Subscribe a listener to the store.\n * @param listener - The listener function to be subscribed.\n * @returns A function to unsubscribe the listener.\n */\n subscribe: (listener: Listener<T>) => () => void\n /**\n * Unubscribe a listener from the store.\n * @param listener - The listener function to be unsubscribed.\n */\n unsubscribe: (listener: Listener<T>) => void\n}\n// & { actions?: { [actionName: string]: ActionHandlerCaller } }\n\n/**\n * Represents a store with additional actions.\n */\nexport type StoreWithActions<T> = Store<T> & { actions: { [actionName: string]: ActionHandlerCaller } }\n\n/**\n * Represents an action handler function.\n */\nexport type ActionHandler<T> = (\n getState: Store<T>['getState'], // Function to get the current state of the store\n setState: Store<T>['setState'], // Function to set the state of the store\n ...rest: unknown[]\n) => void | Partial<T> | Promise<void | Partial<T>>\n\n/**\n * Represents an reducer function.\n */\nexport type Reducer<T> = (\n state: Partial<T>,\n action: string,\n ...rest: unknown[]\n) => Partial<T>\n\n\n/**\n * Represents a function that calls an action handler.\n */\nexport type ActionHandlerCaller = (...args: unknown[]) => void\n\n\n/**\n * Creates a new store.\n * @param initialState - The initial state of the store.\n * @param actions - Optional actions for the store.\n * @returns The created store.\n */\nexport const createStore = <T>(\n initialState: Partial<T>,\n actions?: Record<string, ActionHandler<T>>,\n reducer?: Reducer<T>,\n): Store<T> | StoreWithActions<T> => {\n let currentState: Partial<T> = initialState\n const listeners = new Set<Listener<T>>()\n\n /**\n * Gets the current state of the store.\n * @returns The current state of the store.\n */\n const getState = () => currentState\n\n // TODO debounce, batch? what is the meaningful time between setState ofr UI to be rendered and registerd by User?\n /**\n * Sets the state of the store.\n * @param newState - The new state to set.\n * @returns A promise that resolves to the new state.\n */\n const setState = async (newState: Partial<T>) => {\n currentState = newState\n\n // eslint-disable-next-line no-restricted-syntax\n for (const listener of listeners) {\n // has Listener selector?\n const selector: Selector<T> | undefined = listener?.selector\n\n // TODO compare selected value to the previous values of that listener/selector pair\n // if listener.previousValue === selector(currentState) no call\n // else listener.previousValue = selector(currentState) and call\n // l1 cache, weak references?\n const newValue: Partial<T> = selector ? selector(currentState) : currentState\n\n // TODO plugin equality\n if (listener.previousValue === undefined || listener.previousValue !== newValue) {\n listener.previousValue = newValue\n // eslint-disable-next-line no-await-in-loop\n await listener(newValue)\n }\n }\n return currentState\n }\n\n /**\n * Represents the basic API of the store.\n */\n const storeBaseicApi: Store<T> = {\n /**\n * Get the current state of the store.\n * @returns The current state of the store.\n */\n getState,\n /**\n * Set the state of the store.\n * @param state - The new state to set.\n * @returns A promise that resolves to the new state.\n */\n setState,\n /**\n * Subscribe a listener to the store.\n * @param listener - The listener function to be subscribed.\n * @returns A function to unsubscribe the listener.\n */\n subscribe: (listener: Listener<T>) => {\n listeners.add(listener)\n return () => listeners.delete(listener)\n },\n /**\n * Unsubscribe a listener from the store.\n * @param listener - The listener function to be unsubscribed.\n */\n unsubscribe: (listener: Listener<T>) => {\n listeners.delete(listener)\n },\n }\n\n /**\n * Resolves the actions and creates action handlers.\n */\n const resolvedActions: Record<string, ActionHandlerCaller> | null | undefined\n = actions ? Object.entries(actions)?.reduce(\n (\n aggregator: Record<string, ActionHandlerCaller>,\n [actionName, actionHandler]: [string, ActionHandler<T>],\n ) => ({\n ...aggregator,\n [actionName]: async(...rest: unknown[]) => {\n const resultOfAction = await actionHandler(getState, setState, ...rest)\n\n if (reducer) {\n setState(reducer(getState(), actionName, ...rest))\n }\n return resultOfAction\n },\n }),\n {},\n ) : null\n\n /**\n * Represents the store combined with actions.\n */\n const storeCombinedWithActions = {\n ...storeBaseicApi,\n ...(resolvedActions ? { actions: { ...resolvedActions } } : {}),\n }\n\n return resolvedActions\n ? storeCombinedWithActions as StoreWithActions<T>\n : storeCombinedWithActions as Store<T>\n}\n"],"names":["createStore","initialState","actions","reducer","_Object$entries","currentState","listeners","Set","getState","setState","_ref","_asyncToGenerator","newState","listener","selector","newValue","undefined","previousValue","_x","apply","this","arguments","storeBaseicApi","subscribe","add","delete","unsubscribe","resolvedActions","Object","entries","reduce","aggregator","_ref2","actionName","actionHandler","_len","length","rest","Array","_key","resultOfAction","storeCombinedWithActions"],"mappings":"4KAsFO,MAAMA,EAAcA,CACzBC,EACAC,EACAC,KACmC,IAAAC,EACnC,IAAIC,EAA2BJ,EAC/B,MAAMK,EAAY,IAAIC,IAMhBC,EAAWA,IAAMH,EAQjBI,EAAQ,WAAA,IAAAC,EAAAC,GAAG,UAAOC,GACtBP,EAAeO,EAGf,IAAK,MAAMC,KAAYP,EAAW,CAEhC,MAAMQ,EAAoCD,aAAAA,EAAAA,EAAUC,SAM9CC,EAAuBD,EAAWA,EAAST,GAAgBA,OAGlCW,IAA3BH,EAASI,eAA+BJ,EAASI,gBAAkBF,IACrEF,EAASI,cAAgBF,QAEnBF,EAASE,GAEnB,CACA,OAAOV,KACR,OAtBKI,SAAQS,GAAA,OAAAR,EAAAS,MAAAC,KAAAC,UAAA,EAAA,GA2BRC,EAA2B,CAK/Bd,WAMAC,WAMAc,UAAYV,IACVP,EAAUkB,IAAIX,GACP,IAAMP,EAAUmB,OAAOZ,IAMhCa,YAAcb,IACZP,EAAUmB,OAAOZ,EAAS,GAOxBc,EACFzB,EAAiCE,QAA1BA,EAAGwB,OAAOC,QAAQ3B,cAAQE,SAAvBA,EAAyB0B,QACnC,CACEC,EAA+CC,KAAA,IAC9CC,EAAYC,GAA0CF,EAAA,MACnD,IACDD,EACHE,CAACA,GAAUtB,GAAG,YAA6B,IAAA,IAAAwB,EAAAd,UAAAe,OAApBC,EAAIC,IAAAA,MAAAH,GAAAI,EAAA,EAAAA,EAAAJ,EAAAI,IAAJF,EAAIE,GAAAlB,UAAAkB,GACzB,MAAMC,QAAuBN,EAAc1B,EAAUC,KAAa4B,GAKlE,OAHIlC,GACFM,EAASN,EAAQK,IAAYyB,KAAeI,IAEvCG,KAEV,GACD,CAAA,GACE,KAKAC,EAA2B,IAC5BnB,KACCK,EAAkB,CAAEzB,QAAS,IAAKyB,IAAsB,IAG9D,OACIc,CACoC"}
1
+ {"version":3,"file":"store.vanillajs.js","sources":["../../../../../../../../src/core/utils/appState/store/store.vanillajs.ts"],"sourcesContent":["\n// TinyStore, inspired by https://github.com/jherr/syncexternalstore/blob/main/csr/src/store.js\n\n/**\n * Represents the callback function for a store listener.\n */\nexport type ListenerCallBack<T> = (state: Partial<T>) => void\n\n/**\n * Represents a selector function that transforms the store state.\n */\n// export type Selector<T> = (state: Partial<T>) => Partial<T>;\nexport type SelectedValueType<T> = Partial<T> | Partial<keyof T> | string | number | boolean | undefined;\nexport type Selector<T> = (state: Partial<T>) => SelectedValueType<T>;\n\n\n/**\n * Represents a listener for the store.\n */\nexport type Listener<T> = {\n selector?: Selector<T>\n previousValue?: SelectedValueType<T>\n} & ListenerCallBack<T>\n\n/**\n * Represents a store.\n */\nexport type Store<T> = {\n /**\n * Get the current state of the store.\n * @returns The current state of the store.\n */\n getState: () => Partial<T>\n /**\n * Set the state of the store.\n * @param state - The new state to set.\n * @returns A promise that resolves to the new state.\n */\n setState: (state: Partial<T>) => Promise<Partial<T>>\n /**\n * Subscribe a listener to the store.\n * @param listener - The listener function to be subscribed.\n * @returns A function to unsubscribe the listener.\n */\n subscribe: (listener: Listener<T>) => () => void\n /**\n * Unubscribe a listener from the store.\n * @param listener - The listener function to be unsubscribed.\n */\n unsubscribe: (listener: Listener<T>) => void\n}\n// & { actions?: { [actionName: string]: ActionHandlerCaller } }\n\n/**\n * Represents a store with additional actions.\n */\nexport type StoreWithActions<T> = Store<T> & { actions: { [actionName: string]: ActionHandlerCaller } }\n\n/**\n * Represents an action handler function.\n */\nexport type ActionHandler<T> = (\n getState: Store<T>['getState'], // Function to get the current state of the store\n setState: Store<T>['setState'], // Function to set the state of the store\n ...rest: unknown[]\n) => void | Partial<T> | Promise<void | Partial<T>>\n\n/**\n * Represents an reducer function.\n */\nexport type Reducer<T> = (\n state: Partial<T>,\n action: string,\n ...rest: unknown[]\n) => Partial<T>\n\n\n/**\n * Represents a function that calls an action handler.\n */\nexport type ActionHandlerCaller = (...args: unknown[]) => void\n\n\n/**\n * Creates a new store.\n * @param initialState - The initial state of the store.\n * @param actions - Optional actions for the store.\n * @returns The created store.\n */\nexport const createStore = <T>(\n initialState: Partial<T>,\n actions?: Record<string, ActionHandler<T>>,\n reducer?: Reducer<T>,\n): Store<T> | StoreWithActions<T> => {\n let currentState: Partial<T> = initialState\n const listeners = new Set<Listener<T>>()\n\n /**\n * Gets the current state of the store.\n * @returns The current state of the store.\n */\n const getState = () => currentState\n\n // TODO debounce, batch? what is the meaningful time between setState ofr UI to be rendered and registerd by User?\n /**\n * Sets the state of the store.\n * @param newState - The new state to set.\n * @returns A promise that resolves to the new state.\n */\n const setState = async (newState: Partial<T>) => {\n currentState = newState\n\n // eslint-disable-next-line no-restricted-syntax\n for (const listener of listeners) {\n // has Listener selector?\n const selector: Selector<T> | undefined = listener?.selector\n\n // TODO compare selected value to the previous values of that listener/selector pair\n // if listener.previousValue === selector(currentState) no call\n // else listener.previousValue = selector(currentState) and call\n // l1 cache, weak references?\n const newValue: SelectedValueType<T> = selector ? selector(currentState) : currentState\n\n // TODO plugin equality\n if (listener.previousValue === undefined || listener.previousValue !== newValue) {\n listener.previousValue = newValue\n // eslint-disable-next-line no-await-in-loop\n await listener(newValue as Partial<T>)\n }\n }\n return currentState\n }\n\n /**\n * Represents the basic API of the store.\n */\n const storeBaseicApi: Store<T> = {\n /**\n * Get the current state of the store.\n * @returns The current state of the store.\n */\n getState,\n /**\n * Set the state of the store.\n * @param state - The new state to set.\n * @returns A promise that resolves to the new state.\n */\n setState,\n /**\n * Subscribe a listener to the store.\n * @param listener - The listener function to be subscribed.\n * @returns A function to unsubscribe the listener.\n */\n subscribe: (listener: Listener<T>) => {\n listeners.add(listener)\n return () => listeners.delete(listener)\n },\n /**\n * Unsubscribe a listener from the store.\n * @param listener - The listener function to be unsubscribed.\n */\n unsubscribe: (listener: Listener<T>) => {\n listeners.delete(listener)\n },\n }\n\n /**\n * Resolves the actions and creates action handlers.\n */\n const resolvedActions: Record<string, ActionHandlerCaller> | null | undefined\n = actions ? Object.entries(actions)?.reduce(\n (\n aggregator: Record<string, ActionHandlerCaller>,\n [actionName, actionHandler]: [string, ActionHandler<T>],\n ) => ({\n ...aggregator,\n [actionName]: async(...rest: unknown[]) => {\n const resultOfAction = await actionHandler(getState, setState, ...rest)\n\n if (reducer) {\n setState(reducer(getState(), actionName, ...rest))\n }\n return resultOfAction\n },\n }),\n {},\n ) : null\n\n /**\n * Represents the store combined with actions.\n */\n const storeCombinedWithActions = {\n ...storeBaseicApi,\n ...(resolvedActions ? { actions: { ...resolvedActions } } : {}),\n }\n\n return resolvedActions\n ? storeCombinedWithActions as StoreWithActions<T>\n : storeCombinedWithActions as Store<T>\n}\n"],"names":["createStore","initialState","actions","reducer","_Object$entries","currentState","listeners","Set","getState","setState","_ref","_asyncToGenerator","newState","listener","selector","newValue","undefined","previousValue","_x","apply","this","arguments","storeBaseicApi","subscribe","add","delete","unsubscribe","resolvedActions","Object","entries","reduce","aggregator","_ref2","actionName","actionHandler","_len","length","rest","Array","_key","resultOfAction","storeCombinedWithActions"],"mappings":"4KAyFO,MAAMA,EAAcA,CACzBC,EACAC,EACAC,KACmC,IAAAC,EACnC,IAAIC,EAA2BJ,EAC/B,MAAMK,EAAY,IAAIC,IAMhBC,EAAWA,IAAMH,EAQjBI,EAAQ,WAAA,IAAAC,EAAAC,GAAG,UAAOC,GACtBP,EAAeO,EAGf,IAAK,MAAMC,KAAYP,EAAW,CAEhC,MAAMQ,EAAoCD,aAAAA,EAAAA,EAAUC,SAM9CC,EAAiCD,EAAWA,EAAST,GAAgBA,OAG5CW,IAA3BH,EAASI,eAA+BJ,EAASI,gBAAkBF,IACrEF,EAASI,cAAgBF,QAEnBF,EAASE,GAEnB,CACA,OAAOV,KACR,OAtBKI,SAAQS,GAAA,OAAAR,EAAAS,MAAAC,KAAAC,UAAA,EAAA,GA2BRC,EAA2B,CAK/Bd,WAMAC,WAMAc,UAAYV,IACVP,EAAUkB,IAAIX,GACP,IAAMP,EAAUmB,OAAOZ,IAMhCa,YAAcb,IACZP,EAAUmB,OAAOZ,EAAS,GAOxBc,EACFzB,EAAiCE,QAA1BA,EAAGwB,OAAOC,QAAQ3B,cAAQE,SAAvBA,EAAyB0B,QACnC,CACEC,EAA+CC,KAAA,IAC9CC,EAAYC,GAA0CF,EAAA,MACnD,IACDD,EACHE,CAACA,GAAUtB,GAAG,YAA6B,IAAA,IAAAwB,EAAAd,UAAAe,OAApBC,EAAIC,IAAAA,MAAAH,GAAAI,EAAA,EAAAA,EAAAJ,EAAAI,IAAJF,EAAIE,GAAAlB,UAAAkB,GACzB,MAAMC,QAAuBN,EAAc1B,EAAUC,KAAa4B,GAKlE,OAHIlC,GACFM,EAASN,EAAQK,IAAYyB,KAAeI,IAEvCG,KAEV,GACD,CAAA,GACE,KAKAC,EAA2B,IAC5BnB,KACCK,EAAkB,CAAEzB,QAAS,IAAKyB,IAAsB,IAG9D,OACIc,CACoC"}
@@ -1 +1 @@
1
- {"version":3,"file":"useStore.react.js","sources":["../../../../../../../../src/core/utils/appState/store/useStore.react.ts"],"sourcesContent":["import { useSyncExternalStore } from 'react'\n\nimport { Store, StoreWithActions, Selector } from './store.vanillajs'\n\n\n/**\n * Represents the type for the partial store state used in the `useStore` hook.\n */\nexport type useStoreType<T> = Partial<T>\n\n/**\n * Custom hook to subscribe to a store and retrieve the selected state.\n * @param store - The store to subscribe to.\n * @param selector - Optional selector function to transform the store state.\n * @returns The selected state from the store.\n */\nexport function useStore<T>(\n store: Store<T> | StoreWithActions<T>,\n selector: Selector<T> = (state: Partial<T>) => state,\n // TODO pass selector\n // useSyncExternalStore((...args) => {\n // args[0].selector?? store.subscribe(...args) }, () => selector(store.getState()));\n): useStoreType<T> {\n return useSyncExternalStore(store.subscribe, () => selector(store.getState()))\n}\n\n/**\n * Represents the type for the API returned by the `useStoreApi` hook.\n */\nexport type useStoreApiType<T> = [\n ReturnType<typeof useStore>,\n Store<T>['getState'],\n Store<T>['setState'],\n StoreWithActions<T>['actions'],\n]\n\n/**\n * Custom hook to retrieve the store API including state, getters, setters, and actions (if applicable).\n * @param store - The store to retrieve the API from.\n * @param selector - Optional selector function to transform the store state.\n * @returns The store API including state, getters, setters, and actions (if applicable).\n */\nexport function useStoreApi<T>(\n store: Store<T>,\n selector: Selector<T> = (state: Partial<T>) => state,\n): useStoreApiType<T> {\n return [\n useStore(store, selector),\n store.getState,\n store.setState,\n (store as StoreWithActions<T>).actions,\n ]\n}\n"],"names":["useStore","store","selector","arguments","length","undefined","state","useSyncExternalStore","subscribe","getState","useStoreApi","setState","actions"],"mappings":"6CAgBO,SAASA,EACdC,GAKiB,IAJjBC,EAAqBC,UAAAC,OAAAD,QAAAE,IAAAF,UAAAE,GAAAF,UAAIG,GAAAA,GAAsBA,EAK/C,OAAOC,EAAqBN,EAAMO,WAAW,IAAMN,EAASD,EAAMQ,aACpE,CAkBO,SAASC,EACdT,GAGA,MAAO,CACLD,EAASC,EAHUE,UAAAC,OAAAD,QAAAE,IAAAF,UAAAE,GAAAF,UAAIG,GAAAA,GAAsBA,GAI7CL,EAAMQ,SACNR,EAAMU,SACLV,EAA8BW,QAEnC"}
1
+ {"version":3,"file":"useStore.react.js","sources":["../../../../../../../../src/core/utils/appState/store/useStore.react.ts"],"sourcesContent":["import { useSyncExternalStore } from 'react'\n\nimport { Store, StoreWithActions, Selector } from './store.vanillajs'\n\n\n/**\n * Represents the type for the partial store state used in the `useStore` hook.\n */\nexport type useStoreType<T> = Partial<T>\n\n/**\n * Custom hook to subscribe to a store and retrieve the selected state.\n * @param store - The store to subscribe to.\n * @param selector - Optional selector function to transform the store state.\n * @returns The selected state from the store.\n */\nexport function useStore<T>(\n store: Store<T> | StoreWithActions<T>,\n selector: Selector<T> = (state: Partial<T>) => state,\n // TODO pass selector\n // useSyncExternalStore((...args) => {\n // args[0].selector?? store.subscribe(...args) }, () => selector(store.getState()));\n): useStoreType<T> {\n return useSyncExternalStore(store.subscribe, () => (selector(store.getState()) as Partial<T>))\n}\n\n/**\n * Represents the type for the API returned by the `useStoreApi` hook.\n */\nexport type useStoreApiType<T> = [\n ReturnType<typeof useStore>,\n Store<T>['getState'],\n Store<T>['setState'],\n StoreWithActions<T>['actions'],\n]\n\n/**\n * Custom hook to retrieve the store API including state, getters, setters, and actions (if applicable).\n * @param store - The store to retrieve the API from.\n * @param selector - Optional selector function to transform the store state.\n * @returns The store API including state, getters, setters, and actions (if applicable).\n */\nexport function useStoreApi<T>(\n store: Store<T>,\n selector: Selector<T> = (state: Partial<T>) => state,\n): useStoreApiType<T> {\n return [\n useStore(store, selector),\n store.getState,\n store.setState,\n (store as StoreWithActions<T>).actions,\n ]\n}\n"],"names":["useStore","store","selector","arguments","length","undefined","state","useSyncExternalStore","subscribe","getState","useStoreApi","setState","actions"],"mappings":"6CAgBO,SAASA,EACdC,GAKiB,IAJjBC,EAAqBC,UAAAC,OAAAD,QAAAE,IAAAF,UAAAE,GAAAF,UAAIG,GAAAA,GAAsBA,EAK/C,OAAOC,EAAqBN,EAAMO,WAAW,IAAON,EAASD,EAAMQ,aACrE,CAkBO,SAASC,EACdT,GAGA,MAAO,CACLD,EAASC,EAHUE,UAAAC,OAAAD,QAAAE,IAAAF,UAAAE,GAAAF,UAAIG,GAAAA,GAAsBA,GAI7CL,EAAMQ,SACNR,EAAMU,SACLV,EAA8BW,QAEnC"}
@@ -1 +1 @@
1
- {"version":3,"file":"store.vanillajs.js","sourceRoot":"","sources":["../../../../../../../src/core/utils/appState/store/store.vanillajs.ts"],"names":[],"mappings":"AACA,+FAA+F;AA+E/F;;;;;GAKG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,CACzB,YAAwB,EACxB,OAA0C,EAC1C,OAAoB,EACY,EAAE;IAClC,IAAI,YAAY,GAAe,YAAY,CAAA;IAC3C,MAAM,SAAS,GAAG,IAAI,GAAG,EAAe,CAAA;IAExC;;;OAGG;IACH,MAAM,QAAQ,GAAG,GAAG,EAAE,CAAC,YAAY,CAAA;IAEnC,kHAAkH;IAClH;;;;OAIG;IACH,MAAM,QAAQ,GAAG,KAAK,EAAE,QAAoB,EAAE,EAAE;QAC9C,YAAY,GAAG,QAAQ,CAAA;QAEvB,gDAAgD;QAChD,KAAK,MAAM,QAAQ,IAAI,SAAS,EAAE;YAChC,yBAAyB;YACzB,MAAM,QAAQ,GAA4B,QAAQ,EAAE,QAAQ,CAAA;YAE5D,oFAAoF;YACpF,+DAA+D;YAC/D,gEAAgE;YAChE,6BAA6B;YAC7B,MAAM,QAAQ,GAAe,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,YAAY,CAAA;YAE7E,uBAAuB;YACvB,IAAI,QAAQ,CAAC,aAAa,KAAK,SAAS,IAAI,QAAQ,CAAC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O,eAAe;QACpB,CAAC,CAAC,wBAA+C;QACjD,CAAC,CAAC,wBAAoC,CAAA;AAC1C,CAAC,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"useStore.react.js","sourceRoot":"","sources":["../../../../../../../src/core/utils/appState/store/useStore.react.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,OAAO,CAAA;AAU5C;;;;;GAKG;AACH,MAAM,UAAU,QAAQ,CACtB,KAAqC,EACrC,WAAwB,CAAC,KAAiB,EAAE,EAAE,CAAC,KAAK;IAKpD,OAAO,oBAAoB,CAAC,KAAK,CAAC,SAAS,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAA;AAChF,CAAC;AAYD;;;;;GAKG;AACH,MAAM,UAAU,WAAW,CACzB,KAAe,EACf,WAAwB,CAAC,KAAiB,EAAE,EAAE,CAAC,KAAK;IAEpD,OAAO;QACL,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC;QACzB,KAAK,CAAC,QAAQ;QACd,KAAK,CAAC,QAAQ;QACb,KAA6B,CAAC,OAAO;KACvC,CAAA;AACH,CAAC"}
1
+ {"version":3,"file":"useStore.react.js","sourceRoot":"","sources":["../../../../../../../src/core/utils/appState/store/useStore.react.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,OAAO,CAAA;AAU5C;;;;;GAKG;AACH,MAAM,UAAU,QAAQ,CACtB,KAAqC,EACrC,WAAwB,CAAC,KAAiB,EAAE,EAAE,CAAC,KAAK;IAKpD,OAAO,oBAAoB,CAAC,KAAK,CAAC,SAAS,EAAE,GAAG,EAAE,CAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAgB,CAAC,CAAA;AAChG,CAAC;AAYD;;;;;GAKG;AACH,MAAM,UAAU,WAAW,CACzB,KAAe,EACf,WAAwB,CAAC,KAAiB,EAAE,EAAE,CAAC,KAAK;IAEpD,OAAO;QACL,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC;QACzB,KAAK,CAAC,QAAQ;QACd,KAAK,CAAC,QAAQ;QACb,KAA6B,CAAC,OAAO;KACvC,CAAA;AACH,CAAC"}