@intlayer/design-system 3.3.5 → 3.3.6

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 (83) hide show
  1. package/dist/.vite/manifest.json +20 -0
  2. package/dist/components/DictionaryEditor/DictionaryEditor.cjs +9 -6
  3. package/dist/components/DictionaryEditor/DictionaryEditor.cjs.map +1 -1
  4. package/dist/components/DictionaryEditor/DictionaryEditor.d.ts.map +1 -1
  5. package/dist/components/DictionaryEditor/DictionaryEditor.mjs +9 -6
  6. package/dist/components/DictionaryEditor/DictionaryEditor.mjs.map +1 -1
  7. package/dist/components/DictionaryEditor/ValidDictionaryChangeButtons.cjs +3 -2
  8. package/dist/components/DictionaryEditor/ValidDictionaryChangeButtons.cjs.map +1 -1
  9. package/dist/components/DictionaryEditor/ValidDictionaryChangeButtons.d.ts.map +1 -1
  10. package/dist/components/DictionaryEditor/ValidDictionaryChangeButtons.mjs +3 -2
  11. package/dist/components/DictionaryEditor/ValidDictionaryChangeButtons.mjs.map +1 -1
  12. package/dist/components/DictionaryFieldEditor/DictionariesSelector/DictionariesSelector.cjs +6 -3
  13. package/dist/components/DictionaryFieldEditor/DictionariesSelector/DictionariesSelector.cjs.map +1 -1
  14. package/dist/components/DictionaryFieldEditor/DictionariesSelector/DictionariesSelector.d.ts.map +1 -1
  15. package/dist/components/DictionaryFieldEditor/DictionariesSelector/DictionariesSelector.mjs +6 -3
  16. package/dist/components/DictionaryFieldEditor/DictionariesSelector/DictionariesSelector.mjs.map +1 -1
  17. package/dist/components/DictionaryFieldEditor/DictionaryFieldEditor.cjs +3 -2
  18. package/dist/components/DictionaryFieldEditor/DictionaryFieldEditor.cjs.map +1 -1
  19. package/dist/components/DictionaryFieldEditor/DictionaryFieldEditor.d.ts.map +1 -1
  20. package/dist/components/DictionaryFieldEditor/DictionaryFieldEditor.mjs +3 -2
  21. package/dist/components/DictionaryFieldEditor/DictionaryFieldEditor.mjs.map +1 -1
  22. package/dist/components/DictionaryFieldEditor/EditorView/EditorView.cjs +12 -9
  23. package/dist/components/DictionaryFieldEditor/EditorView/EditorView.cjs.map +1 -1
  24. package/dist/components/DictionaryFieldEditor/EditorView/EditorView.d.ts.map +1 -1
  25. package/dist/components/DictionaryFieldEditor/EditorView/EditorView.mjs +12 -9
  26. package/dist/components/DictionaryFieldEditor/EditorView/EditorView.mjs.map +1 -1
  27. package/dist/components/DictionaryFieldEditor/EditorView/TextEditor.cjs +13 -4
  28. package/dist/components/DictionaryFieldEditor/EditorView/TextEditor.cjs.map +1 -1
  29. package/dist/components/DictionaryFieldEditor/EditorView/TextEditor.d.ts.map +1 -1
  30. package/dist/components/DictionaryFieldEditor/EditorView/TextEditor.mjs +13 -4
  31. package/dist/components/DictionaryFieldEditor/EditorView/TextEditor.mjs.map +1 -1
  32. package/dist/components/DictionaryFieldEditor/JSONEditor.cjs +7 -4
  33. package/dist/components/DictionaryFieldEditor/JSONEditor.cjs.map +1 -1
  34. package/dist/components/DictionaryFieldEditor/JSONEditor.d.ts.map +1 -1
  35. package/dist/components/DictionaryFieldEditor/JSONEditor.mjs +7 -4
  36. package/dist/components/DictionaryFieldEditor/JSONEditor.mjs.map +1 -1
  37. package/dist/components/DictionaryFieldEditor/NavigationView/NavigationViewNode.cjs +6 -3
  38. package/dist/components/DictionaryFieldEditor/NavigationView/NavigationViewNode.cjs.map +1 -1
  39. package/dist/components/DictionaryFieldEditor/NavigationView/NavigationViewNode.d.ts.map +1 -1
  40. package/dist/components/DictionaryFieldEditor/NavigationView/NavigationViewNode.mjs +6 -3
  41. package/dist/components/DictionaryFieldEditor/NavigationView/NavigationViewNode.mjs.map +1 -1
  42. package/dist/components/DictionaryFieldEditor/NodeEditor.cjs +10 -7
  43. package/dist/components/DictionaryFieldEditor/NodeEditor.cjs.map +1 -1
  44. package/dist/components/DictionaryFieldEditor/NodeEditor.d.ts.map +1 -1
  45. package/dist/components/DictionaryFieldEditor/NodeEditor.mjs +10 -7
  46. package/dist/components/DictionaryFieldEditor/NodeEditor.mjs.map +1 -1
  47. package/dist/components/DictionaryFieldEditor/NodeTypeSelector.cjs +6 -3
  48. package/dist/components/DictionaryFieldEditor/NodeTypeSelector.cjs.map +1 -1
  49. package/dist/components/DictionaryFieldEditor/NodeTypeSelector.d.ts.map +1 -1
  50. package/dist/components/DictionaryFieldEditor/NodeTypeSelector.mjs +6 -3
  51. package/dist/components/DictionaryFieldEditor/NodeTypeSelector.mjs.map +1 -1
  52. package/dist/components/DictionaryFieldEditor/SaveForm/SaveForm.cjs +3 -2
  53. package/dist/components/DictionaryFieldEditor/SaveForm/SaveForm.cjs.map +1 -1
  54. package/dist/components/DictionaryFieldEditor/SaveForm/SaveForm.d.ts.map +1 -1
  55. package/dist/components/DictionaryFieldEditor/SaveForm/SaveForm.mjs +3 -2
  56. package/dist/components/DictionaryFieldEditor/SaveForm/SaveForm.mjs.map +1 -1
  57. package/dist/components/RightDrawer/RightDrawer.cjs +19 -5
  58. package/dist/components/RightDrawer/RightDrawer.cjs.map +1 -1
  59. package/dist/components/RightDrawer/RightDrawer.d.ts +2 -0
  60. package/dist/components/RightDrawer/RightDrawer.d.ts.map +1 -1
  61. package/dist/components/RightDrawer/RightDrawer.mjs +19 -5
  62. package/dist/components/RightDrawer/RightDrawer.mjs.map +1 -1
  63. package/dist/components/RightDrawer/index.cjs +0 -1
  64. package/dist/components/RightDrawer/index.cjs.map +1 -1
  65. package/dist/components/RightDrawer/index.mjs +1 -2
  66. package/dist/components/RightDrawer/useRightDrawerStore.cjs +11 -10
  67. package/dist/components/RightDrawer/useRightDrawerStore.cjs.map +1 -1
  68. package/dist/components/RightDrawer/useRightDrawerStore.d.ts +2 -2
  69. package/dist/components/RightDrawer/useRightDrawerStore.d.ts.map +1 -1
  70. package/dist/components/RightDrawer/useRightDrawerStore.mjs +11 -10
  71. package/dist/components/RightDrawer/useRightDrawerStore.mjs.map +1 -1
  72. package/dist/components/index.cjs +0 -1
  73. package/dist/components/index.cjs.map +1 -1
  74. package/dist/components/index.mjs +1 -2
  75. package/dist/hooks/useAsync/useAsync.cjs +3 -46
  76. package/dist/hooks/useAsync/useAsync.cjs.map +1 -1
  77. package/dist/hooks/useAsync/useAsync.mjs +3 -46
  78. package/dist/hooks/useAsync/useAsync.mjs.map +1 -1
  79. package/dist/shallow-lhDIFtEp.cjs +48 -0
  80. package/dist/shallow-lhDIFtEp.cjs.map +1 -0
  81. package/dist/shallow-m9BpCkKh.js +49 -0
  82. package/dist/shallow-m9BpCkKh.js.map +1 -0
  83. package/package.json +14 -14
@@ -1 +1 @@
1
- {"version":3,"file":"useAsync.mjs","sources":["../../../../../../node_modules/.pnpm/zustand@4.5.5_@types+react@18.3.12_immer@9.0.21_react@18.3.1/node_modules/zustand/esm/react/shallow.mjs","../../../src/hooks/useAsync/useAsync.ts"],"sourcesContent":["import ReactExports from 'react';\n\nfunction shallow(objA, objB) {\n if (Object.is(objA, objB)) {\n return true;\n }\n if (typeof objA !== \"object\" || objA === null || typeof objB !== \"object\" || objB === null) {\n return false;\n }\n if (objA instanceof Map && objB instanceof Map) {\n if (objA.size !== objB.size) return false;\n for (const [key, value] of objA) {\n if (!Object.is(value, objB.get(key))) {\n return false;\n }\n }\n return true;\n }\n if (objA instanceof Set && objB instanceof Set) {\n if (objA.size !== objB.size) return false;\n for (const value of objA) {\n if (!objB.has(value)) {\n return false;\n }\n }\n return true;\n }\n const keysA = Object.keys(objA);\n if (keysA.length !== Object.keys(objB).length) {\n return false;\n }\n for (const keyA of keysA) {\n if (!Object.prototype.hasOwnProperty.call(objB, keyA) || !Object.is(objA[keyA], objB[keyA])) {\n return false;\n }\n }\n return true;\n}\n\nconst { useRef } = ReactExports;\nfunction useShallow(selector) {\n const prev = useRef();\n return (state) => {\n const next = selector(state);\n return shallow(prev.current, next) ? prev.current : prev.current = next;\n };\n}\n\nexport { useShallow };\n","'use client';\n\n// This is an ESLint directive to disable specific rules.\n/* eslint-disable @typescript-eslint/no-explicit-any */\n\nimport { useCallback, useEffect, useMemo, useRef } from 'react';\nimport { useShallow } from 'zustand/react/shallow';\nimport { useAsyncStateStore } from './useAsyncStateStore';\n\n// Pending promises cache to prevent parallel requests when multiple components use the hook\nconst pendingPromises = new Map();\n\n// Defines the base structure for the result of the custom hook.\ntype UseAsyncResultBase<T extends (...args: any[]) => Promise<any>> = {\n isFetched: boolean;\n isLoading: boolean;\n isInvalidated: boolean;\n isSuccess: boolean;\n isDisabled: boolean;\n error: string | null;\n data: Awaited<ReturnType<T>> | null;\n retryCount: number;\n revalidate: T;\n setData: (data: Awaited<ReturnType<T> | null>) => void;\n};\n\n// Options type for the hook, allowing customization of behavior.\nexport type UseAsyncOptions<T extends (...args: any[]) => Promise<any>> = {\n retryLimit?: number; // The number of times the hook should retry the function on failure before giving up\n retryTime?: number; // Time in milliseconds for retrying the data\n cache?: boolean; // Cache the result of the function using zustand\n store?: boolean; // Store the result of the function in session storage\n enable?: boolean; // Enable the hook\n autoFetch?: boolean; // Automatically fetch the data when the hook is mounted\n revalidation?: boolean; // Enable revalidation\n revalidateTime?: number; // Time in milliseconds for revalidating the data\n invalidateQueries?: string[]; // Invalidate other queries when the data is updated\n updateQueries?: string[]; // Update other queries when the data is updated\n onSuccess?: (data: Awaited<ReturnType<T>>) => void; // Callback function that is called when the asynchronous function resolves successfully\n onError?: (error: string) => void; // Callback function that is called when the asynchronous function rejects or encounters an error\n args?: Parameters<T>; // Arguments to pass to the asynchronous function\n};\n\n// Default values for the hook's options\nconst DEFAULT_CACHE_ENABLED = false;\nconst DEFAULT_STORE_ENABLED = false;\nconst DEFAULT_ENABLED = true;\nconst DEFAULT_AUTO_FETCH = false;\nconst DEFAULT_RETRY_LIMIT = 1;\nconst DEFAULT_REVALIDATION_ENABLED = false;\nconst DEFAULT_REVALIDATE_TIME = 5 * 60 * 1000; // 5 minutes\nconst DEFAULT_RETRY_TIME = 5 * 60 * 1000; // 5 minutes\n\n// The main hook type that includes the async function along with its additional properties.\nexport type UseAsyncResult<\n U extends string,\n T extends (...args: any[]) => Promise<any>,\n> = UseAsyncResultBase<T> & Record<U, T>;\n\nconst getArgs = (args?: any[]): any[] =>\n args ? (Array.isArray(args) ? args : [args]) : [];\n\nconst getKeyWithArgs = (key: string, args: any[]) =>\n getArgs(args).length > 0 ? `${key}/${JSON.stringify(args)}` : key;\n\n/**\n * A custom React hook that manages asynchronous operations, providing easy-to-use states and controls over fetching, caching, and retry mechanisms.\n * This hook abstracts away the complexity of handling loading, error, and success states for any asynchronous function.\n *\n * @template U - A string type that extends the keys of the async function, used as a key to store and retrieve state.\n * @template T - A function type that must return a Promise, representing the asynchronous operation to be managed.\n *\n * @param {U} key - A unique identifier for the async operation, used to handle state internally and avoid conflicts.\n * @param {T} asyncFunction - The asynchronous function that will be managed by this hook. This function should return a Promise.\n * @param {UseAsyncOptions<T>} [options] - Optional configuration options to customize the behavior of the hook.\n * @returns {UseAsyncResult<U, T>} The states and controls related to the managed async function. Includes states like isLoading, isSuccess, and provides control methods like revalidate and setData.\n *\n * @typedef {Object} UseAsyncOptions\n * @property {number} [retryTime=300000] - Time in milliseconds for retrying the data after an error occurs.\n * @property {number} [retryLimit=1] - The number of times the hook should retry the asynchronous function on failure before giving up.\n * @property {boolean} [revalidation=false] - Enable revalidation.\n * @property {number} [revalidateTime=300000] - Time in milliseconds after which the cached data is considered stale and the async function is re-invoked, if caching is enabled.\n * @property {boolean} [cache=false] - Whether to cache the result of the async function. When enabled, revalidation is controlled by `revalidateTime`.\n * @property {boolean} [store=false] - Store the result of the function in session storage.\n * @property {boolean} [autoFetch=false] - Whether the hook should automatically invoke the asynchronous function on mount.\n * @property {number} [revalidateTime=300000] - Time in milliseconds after which the cached data is considered stale and the async function is re-invoked, if caching is enabled.\n * @property {string[]} [updateQueries=[]] - Update other queries when the data is updated.\n * @property {string[]} [invalidateQueries=[]] - Invalidate other queries when the data is updated.\n * @property {(data: Awaited<ReturnType<T>>) => void} [onSuccess] - Callback function that is called when the asynchronous function resolves successfully.\n * @property {(error: string) => void} [onError] - Callback function that is called when the asynchronous function rejects or encounters an error.\n * @property {Parameters<T>} [args=[]] - Arguments to pass to the asynchronous function.\n *\n *\n * @example\n * // Example of using useAsync to manage fetching user data from an API.\n * const fetchUserData = async (userId) => {\n * const response = await fetch(`/api/users/${userId}`);\n * if (!response.ok) throw new Error('Failed to fetch');\n * return await response.json();\n * };\n *\n * const UserDetails = ({ userId }) => {\n * const {\n * isLoading,\n * data,\n * error,\n * revalidate,\n * } = useAsync('userDetails', fetchUserData, {\n * cache: true,\n * revalidateTime: 60000, // 1 minute\n * autoFetch: true,\n * onSuccess: (data) => console.log('User data fetched successfully:', data),\n * onError: (error) => console.error('Error fetching user data:', error),\n * });\n *\n * if (isLoading) return <div>Loading...</div>;\n * if (error) return <div>Error: {error}</div>;\n * return (\n * <div>\n * <h1>{data.name}</h1>\n * <button onClick={() => revalidate()}>Refresh</button>\n * </div>\n * );\n * };\n */\nexport const useAsync = <\n U extends string,\n T extends (...args: any[]) => Promise<any>,\n>(\n key: U,\n asyncFunction: T,\n options?: UseAsyncOptions<T>\n): UseAsyncResult<U, T> => {\n // Resolving optional parameters with default values\n const retryLimit = options?.retryLimit ?? DEFAULT_RETRY_LIMIT;\n const autoFetch = options?.autoFetch ?? DEFAULT_AUTO_FETCH;\n const retryTime = options?.retryTime ?? DEFAULT_RETRY_TIME;\n const cacheEnabled = options?.cache ?? DEFAULT_CACHE_ENABLED;\n const storeEnabled = options?.store ?? DEFAULT_STORE_ENABLED;\n const enabled = options?.enable ?? DEFAULT_ENABLED;\n const revalidationEnabled =\n options?.revalidation ?? DEFAULT_REVALIDATION_ENABLED;\n const revalidateTime = options?.revalidateTime ?? DEFAULT_REVALIDATE_TIME;\n const updateQueries = options?.updateQueries ?? [];\n const invalidateQueries = options?.invalidateQueries ?? [];\n const onSuccess = options?.onSuccess;\n const onError = options?.onError;\n const args = getArgs(options?.args ?? []);\n\n // Using a custom hook to manage state specific to asynchronous operations\n const { setQueryState, setQueriesState, makeQueryInError } =\n useAsyncStateStore(\n useShallow((state) => ({\n setQueryState: state.setQueryState,\n setQueriesState: state.setQueriesState,\n makeQueryInError: state.makeQueryInError,\n }))\n );\n\n // Storing the last arguments used to call the async function\n const storedArgsRef = useRef<any[]>(args);\n\n // Apply different key for different requests\n const keyWithArgs = getKeyWithArgs(key, storedArgsRef.current);\n\n // Retrieving the current state of async operations using the same custom hook\n const {\n isFetched,\n fetchedDateTime,\n isLoading,\n isEnabled,\n error,\n isSuccess,\n isInvalidated,\n data,\n retryCount: errorCount,\n } = useAsyncStateStore(useShallow((state) => state.getStates(keyWithArgs)));\n\n // The core fetching function, designed to be called directly or automatically based on configuration\n const fetch: T = useCallback<T>(\n (async (...args) => {\n const keyWithArgs = getKeyWithArgs(key, args);\n\n if (pendingPromises.has(keyWithArgs)) {\n // Return the existing pending promise\n return pendingPromises.get(keyWithArgs);\n }\n\n const promise = (async () => {\n setQueryState(keyWithArgs, { isLoading: true });\n let response = null;\n\n await asyncFunction(...args)\n .then((result) => {\n response = result;\n\n setQueryState(keyWithArgs, {\n data: result,\n retryCount: 0,\n isLoading: false,\n isFetched: true,\n isSuccess: true,\n isInvalidated: false,\n error: null,\n });\n\n onSuccess?.(result);\n\n // Invalidate other queries if necessary\n if (invalidateQueries.length > 0) {\n setQueriesState(invalidateQueries, {\n isInvalidated: true,\n });\n }\n\n // Update other queries if necessary\n if (updateQueries.length > 0) {\n setQueriesState(updateQueries, {\n data: result,\n });\n }\n\n // Store the result in session storage\n if (storeEnabled) {\n sessionStorage.setItem(keyWithArgs, JSON.stringify(result));\n }\n })\n .catch((error) => {\n makeQueryInError(keyWithArgs, error.message);\n onError?.(error.message);\n })\n .finally(() => {\n // Remove the pending promise from the cache\n pendingPromises.delete(keyWithArgs);\n });\n\n return response;\n })();\n\n // Store the pending promise in the cache\n pendingPromises.set(keyWithArgs, promise);\n\n return await promise;\n }) as T,\n [asyncFunction, keyWithArgs, storeEnabled, cacheEnabled, onSuccess, onError]\n );\n\n // Wrapped execution function to handle disabled state and check for success before re-fetching\n const execute: T = useCallback<T>(\n (async (...args) => {\n if (!isEnabled || !enabled) return;\n if (isLoading) return;\n if (!isInvalidated && isSuccess && cacheEnabled && data) return data;\n\n if (args) {\n storedArgsRef.current = getArgs(...args);\n }\n\n return await fetch(...args);\n }) as T,\n [\n isEnabled,\n enabled,\n isInvalidated,\n cacheEnabled,\n isSuccess,\n data,\n isLoading,\n fetch,\n ]\n );\n\n // Function to revalidate the data when necessary\n const revalidate: T = useCallback<T>(\n (async (...args) => {\n if (!isEnabled || !enabled) return;\n\n if (args) {\n storedArgsRef.current = getArgs(...args);\n }\n\n const result = await fetch(...storedArgsRef.current);\n\n return result;\n }) as T,\n [isEnabled, enabled, storedArgsRef, fetch]\n );\n\n const autoRevalidate = useCallback(async () => {\n if (!isEnabled || !enabled) return;\n if (isLoading) return;\n if (!(cacheEnabled || storeEnabled)) return;\n if (!isSuccess) return;\n if (!revalidationEnabled || revalidateTime <= 0) return;\n if (!fetchedDateTime) return;\n\n const now = new Date().getTime();\n const lastFetchedTime = new Date(fetchedDateTime).getTime();\n const shouldRevalidate = now - lastFetchedTime >= revalidateTime;\n if (shouldRevalidate) {\n return await fetch(...storedArgsRef.current);\n }\n }, [\n cacheEnabled,\n revalidationEnabled,\n revalidateTime,\n isSuccess,\n fetchedDateTime,\n isLoading,\n isEnabled,\n enabled,\n ]);\n\n useEffect(() => {\n if (enabled !== isEnabled) {\n setQueryState(keyWithArgs, {\n isEnabled,\n });\n }\n }, [enabled, isEnabled, keyWithArgs]);\n\n // Auto-fetch data on hook mount if autoFetch is true\n useEffect(() => {\n if (!autoFetch) return;\n if (!isEnabled || !enabled) return;\n if (isFetched && !isInvalidated) return;\n if (isLoading) return;\n\n fetch(...storedArgsRef.current);\n }, [\n autoFetch,\n isFetched,\n isInvalidated,\n isEnabled,\n enabled,\n isLoading,\n fetch,\n ]);\n\n // Handle retry based on conditions set in options\n useEffect(() => {\n const isRetryEnabled = errorCount > 0 && retryLimit > 0;\n const isRetryLimitReached = errorCount >= retryLimit;\n if (!isEnabled || !enabled) return;\n if (!(cacheEnabled || storeEnabled)) return;\n if (!isRetryEnabled || isRetryLimitReached) return;\n if (isSuccess) return;\n if (isLoading) return;\n\n const timeOut = setTimeout(() => {\n fetch(...storedArgsRef.current);\n }, retryTime);\n\n return () => clearTimeout(timeOut);\n }, [\n fetch,\n errorCount,\n retryLimit,\n retryTime,\n isSuccess,\n isEnabled,\n enabled,\n isLoading,\n cacheEnabled,\n storeEnabled,\n ]);\n\n // Handle periodic revalidation if caching is enabled\n useEffect(() => {\n const interval = setInterval(autoRevalidate, revalidateTime);\n\n return () => clearInterval(interval);\n }, [autoRevalidate, revalidateTime]);\n\n // Load data from session storage if storeEnabled is true\n useEffect(() => {\n if (!isEnabled || !enabled) return;\n if (!storeEnabled) return;\n if (isInvalidated) return;\n if (isFetched) return;\n if (data) return;\n\n const storedData = sessionStorage.getItem(keyWithArgs);\n\n if (storedData && JSON.stringify(storedData) !== JSON.stringify(data)) {\n setQueryState(keyWithArgs, {\n data: JSON.parse(storedData),\n });\n }\n }, [\n storeEnabled,\n keyWithArgs,\n isFetched,\n isInvalidated,\n isEnabled,\n enabled,\n data,\n ]);\n\n // Memoization of the setData function to prevent unnecessary re-renders\n const setDataMemo = useCallback(\n (data: Awaited<ReturnType<T> | null>) => {\n setQueryState(keyWithArgs, {\n data,\n });\n },\n [keyWithArgs]\n );\n\n const memoResult = useMemo(\n () => ({\n isFetched,\n isLoading,\n isInvalidated,\n error,\n isSuccess,\n data,\n retryCount: errorCount,\n isDisabled: !isEnabled,\n isEnabled,\n [key]: execute,\n revalidate,\n setData: setDataMemo,\n }),\n [\n isFetched,\n isLoading,\n isInvalidated,\n error,\n isSuccess,\n data,\n errorCount,\n isEnabled,\n key,\n execute,\n revalidate,\n setDataMemo,\n ]\n );\n\n // Return the hook's result, including all state and control functions\n return memoResult as UseAsyncResultBase<T> & Record<U, T>;\n};\n"],"names":["ReactExports","useRef","args","keyWithArgs","error","data"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AAU;AAAA,MAAA,CAC5B;AAAA,IACH;AAAA,EAAA,GACC;AAAA,IACD;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EAAA,CACD;AAGD,QAAM,cAAc;AAAA,IAClB,CAACG,UAAwC;AACvC,oBAAc,aAAa;AAAA,QACzB,MAAAA;AAAAA,MAAA,CACD;AAAA,IACH;AAAA,IACA,CAAC,WAAW;AAAA,EAAA;AAGd,QAAM,aAAa;AAAA,IACjB,OAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA,YAAY;AAAA,MACZ,YAAY,CAAC;AAAA,MACb;AAAA,MACA,CAAC,GAAG,GAAG;AAAA,MACP;AAAA,MACA,SAAS;AAAA,IAAA;AAAA,IAEX;AAAA,MACE;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EAAA;AAIK,SAAA;AACT;","x_google_ignoreList":[0]}
1
+ {"version":3,"file":"useAsync.mjs","sources":["../../../src/hooks/useAsync/useAsync.ts"],"sourcesContent":["'use client';\n\n// This is an ESLint directive to disable specific rules.\n/* eslint-disable @typescript-eslint/no-explicit-any */\n\nimport { useCallback, useEffect, useMemo, useRef } from 'react';\nimport { useShallow } from 'zustand/react/shallow';\nimport { useAsyncStateStore } from './useAsyncStateStore';\n\n// Pending promises cache to prevent parallel requests when multiple components use the hook\nconst pendingPromises = new Map();\n\n// Defines the base structure for the result of the custom hook.\ntype UseAsyncResultBase<T extends (...args: any[]) => Promise<any>> = {\n isFetched: boolean;\n isLoading: boolean;\n isInvalidated: boolean;\n isSuccess: boolean;\n isDisabled: boolean;\n error: string | null;\n data: Awaited<ReturnType<T>> | null;\n retryCount: number;\n revalidate: T;\n setData: (data: Awaited<ReturnType<T> | null>) => void;\n};\n\n// Options type for the hook, allowing customization of behavior.\nexport type UseAsyncOptions<T extends (...args: any[]) => Promise<any>> = {\n retryLimit?: number; // The number of times the hook should retry the function on failure before giving up\n retryTime?: number; // Time in milliseconds for retrying the data\n cache?: boolean; // Cache the result of the function using zustand\n store?: boolean; // Store the result of the function in session storage\n enable?: boolean; // Enable the hook\n autoFetch?: boolean; // Automatically fetch the data when the hook is mounted\n revalidation?: boolean; // Enable revalidation\n revalidateTime?: number; // Time in milliseconds for revalidating the data\n invalidateQueries?: string[]; // Invalidate other queries when the data is updated\n updateQueries?: string[]; // Update other queries when the data is updated\n onSuccess?: (data: Awaited<ReturnType<T>>) => void; // Callback function that is called when the asynchronous function resolves successfully\n onError?: (error: string) => void; // Callback function that is called when the asynchronous function rejects or encounters an error\n args?: Parameters<T>; // Arguments to pass to the asynchronous function\n};\n\n// Default values for the hook's options\nconst DEFAULT_CACHE_ENABLED = false;\nconst DEFAULT_STORE_ENABLED = false;\nconst DEFAULT_ENABLED = true;\nconst DEFAULT_AUTO_FETCH = false;\nconst DEFAULT_RETRY_LIMIT = 1;\nconst DEFAULT_REVALIDATION_ENABLED = false;\nconst DEFAULT_REVALIDATE_TIME = 5 * 60 * 1000; // 5 minutes\nconst DEFAULT_RETRY_TIME = 5 * 60 * 1000; // 5 minutes\n\n// The main hook type that includes the async function along with its additional properties.\nexport type UseAsyncResult<\n U extends string,\n T extends (...args: any[]) => Promise<any>,\n> = UseAsyncResultBase<T> & Record<U, T>;\n\nconst getArgs = (args?: any[]): any[] =>\n args ? (Array.isArray(args) ? args : [args]) : [];\n\nconst getKeyWithArgs = (key: string, args: any[]) =>\n getArgs(args).length > 0 ? `${key}/${JSON.stringify(args)}` : key;\n\n/**\n * A custom React hook that manages asynchronous operations, providing easy-to-use states and controls over fetching, caching, and retry mechanisms.\n * This hook abstracts away the complexity of handling loading, error, and success states for any asynchronous function.\n *\n * @template U - A string type that extends the keys of the async function, used as a key to store and retrieve state.\n * @template T - A function type that must return a Promise, representing the asynchronous operation to be managed.\n *\n * @param {U} key - A unique identifier for the async operation, used to handle state internally and avoid conflicts.\n * @param {T} asyncFunction - The asynchronous function that will be managed by this hook. This function should return a Promise.\n * @param {UseAsyncOptions<T>} [options] - Optional configuration options to customize the behavior of the hook.\n * @returns {UseAsyncResult<U, T>} The states and controls related to the managed async function. Includes states like isLoading, isSuccess, and provides control methods like revalidate and setData.\n *\n * @typedef {Object} UseAsyncOptions\n * @property {number} [retryTime=300000] - Time in milliseconds for retrying the data after an error occurs.\n * @property {number} [retryLimit=1] - The number of times the hook should retry the asynchronous function on failure before giving up.\n * @property {boolean} [revalidation=false] - Enable revalidation.\n * @property {number} [revalidateTime=300000] - Time in milliseconds after which the cached data is considered stale and the async function is re-invoked, if caching is enabled.\n * @property {boolean} [cache=false] - Whether to cache the result of the async function. When enabled, revalidation is controlled by `revalidateTime`.\n * @property {boolean} [store=false] - Store the result of the function in session storage.\n * @property {boolean} [autoFetch=false] - Whether the hook should automatically invoke the asynchronous function on mount.\n * @property {number} [revalidateTime=300000] - Time in milliseconds after which the cached data is considered stale and the async function is re-invoked, if caching is enabled.\n * @property {string[]} [updateQueries=[]] - Update other queries when the data is updated.\n * @property {string[]} [invalidateQueries=[]] - Invalidate other queries when the data is updated.\n * @property {(data: Awaited<ReturnType<T>>) => void} [onSuccess] - Callback function that is called when the asynchronous function resolves successfully.\n * @property {(error: string) => void} [onError] - Callback function that is called when the asynchronous function rejects or encounters an error.\n * @property {Parameters<T>} [args=[]] - Arguments to pass to the asynchronous function.\n *\n *\n * @example\n * // Example of using useAsync to manage fetching user data from an API.\n * const fetchUserData = async (userId) => {\n * const response = await fetch(`/api/users/${userId}`);\n * if (!response.ok) throw new Error('Failed to fetch');\n * return await response.json();\n * };\n *\n * const UserDetails = ({ userId }) => {\n * const {\n * isLoading,\n * data,\n * error,\n * revalidate,\n * } = useAsync('userDetails', fetchUserData, {\n * cache: true,\n * revalidateTime: 60000, // 1 minute\n * autoFetch: true,\n * onSuccess: (data) => console.log('User data fetched successfully:', data),\n * onError: (error) => console.error('Error fetching user data:', error),\n * });\n *\n * if (isLoading) return <div>Loading...</div>;\n * if (error) return <div>Error: {error}</div>;\n * return (\n * <div>\n * <h1>{data.name}</h1>\n * <button onClick={() => revalidate()}>Refresh</button>\n * </div>\n * );\n * };\n */\nexport const useAsync = <\n U extends string,\n T extends (...args: any[]) => Promise<any>,\n>(\n key: U,\n asyncFunction: T,\n options?: UseAsyncOptions<T>\n): UseAsyncResult<U, T> => {\n // Resolving optional parameters with default values\n const retryLimit = options?.retryLimit ?? DEFAULT_RETRY_LIMIT;\n const autoFetch = options?.autoFetch ?? DEFAULT_AUTO_FETCH;\n const retryTime = options?.retryTime ?? DEFAULT_RETRY_TIME;\n const cacheEnabled = options?.cache ?? DEFAULT_CACHE_ENABLED;\n const storeEnabled = options?.store ?? DEFAULT_STORE_ENABLED;\n const enabled = options?.enable ?? DEFAULT_ENABLED;\n const revalidationEnabled =\n options?.revalidation ?? DEFAULT_REVALIDATION_ENABLED;\n const revalidateTime = options?.revalidateTime ?? DEFAULT_REVALIDATE_TIME;\n const updateQueries = options?.updateQueries ?? [];\n const invalidateQueries = options?.invalidateQueries ?? [];\n const onSuccess = options?.onSuccess;\n const onError = options?.onError;\n const args = getArgs(options?.args ?? []);\n\n // Using a custom hook to manage state specific to asynchronous operations\n const { setQueryState, setQueriesState, makeQueryInError } =\n useAsyncStateStore(\n useShallow((state) => ({\n setQueryState: state.setQueryState,\n setQueriesState: state.setQueriesState,\n makeQueryInError: state.makeQueryInError,\n }))\n );\n\n // Storing the last arguments used to call the async function\n const storedArgsRef = useRef<any[]>(args);\n\n // Apply different key for different requests\n const keyWithArgs = getKeyWithArgs(key, storedArgsRef.current);\n\n // Retrieving the current state of async operations using the same custom hook\n const {\n isFetched,\n fetchedDateTime,\n isLoading,\n isEnabled,\n error,\n isSuccess,\n isInvalidated,\n data,\n retryCount: errorCount,\n } = useAsyncStateStore(useShallow((state) => state.getStates(keyWithArgs)));\n\n // The core fetching function, designed to be called directly or automatically based on configuration\n const fetch: T = useCallback<T>(\n (async (...args) => {\n const keyWithArgs = getKeyWithArgs(key, args);\n\n if (pendingPromises.has(keyWithArgs)) {\n // Return the existing pending promise\n return pendingPromises.get(keyWithArgs);\n }\n\n const promise = (async () => {\n setQueryState(keyWithArgs, { isLoading: true });\n let response = null;\n\n await asyncFunction(...args)\n .then((result) => {\n response = result;\n\n setQueryState(keyWithArgs, {\n data: result,\n retryCount: 0,\n isLoading: false,\n isFetched: true,\n isSuccess: true,\n isInvalidated: false,\n error: null,\n });\n\n onSuccess?.(result);\n\n // Invalidate other queries if necessary\n if (invalidateQueries.length > 0) {\n setQueriesState(invalidateQueries, {\n isInvalidated: true,\n });\n }\n\n // Update other queries if necessary\n if (updateQueries.length > 0) {\n setQueriesState(updateQueries, {\n data: result,\n });\n }\n\n // Store the result in session storage\n if (storeEnabled) {\n sessionStorage.setItem(keyWithArgs, JSON.stringify(result));\n }\n })\n .catch((error) => {\n makeQueryInError(keyWithArgs, error.message);\n onError?.(error.message);\n })\n .finally(() => {\n // Remove the pending promise from the cache\n pendingPromises.delete(keyWithArgs);\n });\n\n return response;\n })();\n\n // Store the pending promise in the cache\n pendingPromises.set(keyWithArgs, promise);\n\n return await promise;\n }) as T,\n [asyncFunction, keyWithArgs, storeEnabled, cacheEnabled, onSuccess, onError]\n );\n\n // Wrapped execution function to handle disabled state and check for success before re-fetching\n const execute: T = useCallback<T>(\n (async (...args) => {\n if (!isEnabled || !enabled) return;\n if (isLoading) return;\n if (!isInvalidated && isSuccess && cacheEnabled && data) return data;\n\n if (args) {\n storedArgsRef.current = getArgs(...args);\n }\n\n return await fetch(...args);\n }) as T,\n [\n isEnabled,\n enabled,\n isInvalidated,\n cacheEnabled,\n isSuccess,\n data,\n isLoading,\n fetch,\n ]\n );\n\n // Function to revalidate the data when necessary\n const revalidate: T = useCallback<T>(\n (async (...args) => {\n if (!isEnabled || !enabled) return;\n\n if (args) {\n storedArgsRef.current = getArgs(...args);\n }\n\n const result = await fetch(...storedArgsRef.current);\n\n return result;\n }) as T,\n [isEnabled, enabled, storedArgsRef, fetch]\n );\n\n const autoRevalidate = useCallback(async () => {\n if (!isEnabled || !enabled) return;\n if (isLoading) return;\n if (!(cacheEnabled || storeEnabled)) return;\n if (!isSuccess) return;\n if (!revalidationEnabled || revalidateTime <= 0) return;\n if (!fetchedDateTime) return;\n\n const now = new Date().getTime();\n const lastFetchedTime = new Date(fetchedDateTime).getTime();\n const shouldRevalidate = now - lastFetchedTime >= revalidateTime;\n if (shouldRevalidate) {\n return await fetch(...storedArgsRef.current);\n }\n }, [\n cacheEnabled,\n revalidationEnabled,\n revalidateTime,\n isSuccess,\n fetchedDateTime,\n isLoading,\n isEnabled,\n enabled,\n ]);\n\n useEffect(() => {\n if (enabled !== isEnabled) {\n setQueryState(keyWithArgs, {\n isEnabled,\n });\n }\n }, [enabled, isEnabled, keyWithArgs]);\n\n // Auto-fetch data on hook mount if autoFetch is true\n useEffect(() => {\n if (!autoFetch) return;\n if (!isEnabled || !enabled) return;\n if (isFetched && !isInvalidated) return;\n if (isLoading) return;\n\n fetch(...storedArgsRef.current);\n }, [\n autoFetch,\n isFetched,\n isInvalidated,\n isEnabled,\n enabled,\n isLoading,\n fetch,\n ]);\n\n // Handle retry based on conditions set in options\n useEffect(() => {\n const isRetryEnabled = errorCount > 0 && retryLimit > 0;\n const isRetryLimitReached = errorCount >= retryLimit;\n if (!isEnabled || !enabled) return;\n if (!(cacheEnabled || storeEnabled)) return;\n if (!isRetryEnabled || isRetryLimitReached) return;\n if (isSuccess) return;\n if (isLoading) return;\n\n const timeOut = setTimeout(() => {\n fetch(...storedArgsRef.current);\n }, retryTime);\n\n return () => clearTimeout(timeOut);\n }, [\n fetch,\n errorCount,\n retryLimit,\n retryTime,\n isSuccess,\n isEnabled,\n enabled,\n isLoading,\n cacheEnabled,\n storeEnabled,\n ]);\n\n // Handle periodic revalidation if caching is enabled\n useEffect(() => {\n const interval = setInterval(autoRevalidate, revalidateTime);\n\n return () => clearInterval(interval);\n }, [autoRevalidate, revalidateTime]);\n\n // Load data from session storage if storeEnabled is true\n useEffect(() => {\n if (!isEnabled || !enabled) return;\n if (!storeEnabled) return;\n if (isInvalidated) return;\n if (isFetched) return;\n if (data) return;\n\n const storedData = sessionStorage.getItem(keyWithArgs);\n\n if (storedData && JSON.stringify(storedData) !== JSON.stringify(data)) {\n setQueryState(keyWithArgs, {\n data: JSON.parse(storedData),\n });\n }\n }, [\n storeEnabled,\n keyWithArgs,\n isFetched,\n isInvalidated,\n isEnabled,\n enabled,\n data,\n ]);\n\n // Memoization of the setData function to prevent unnecessary re-renders\n const setDataMemo = useCallback(\n (data: Awaited<ReturnType<T> | null>) => {\n setQueryState(keyWithArgs, {\n data,\n });\n },\n [keyWithArgs]\n );\n\n const memoResult = useMemo(\n () => ({\n isFetched,\n isLoading,\n isInvalidated,\n error,\n isSuccess,\n data,\n retryCount: errorCount,\n isDisabled: !isEnabled,\n isEnabled,\n [key]: execute,\n revalidate,\n setData: setDataMemo,\n }),\n [\n isFetched,\n isLoading,\n isInvalidated,\n error,\n isSuccess,\n data,\n errorCount,\n isEnabled,\n key,\n execute,\n revalidate,\n setDataMemo,\n ]\n );\n\n // Return the hook's result, including all state and control functions\n return memoResult as UseAsyncResultBase<T> & Record<U, T>;\n};\n"],"names":["args","keyWithArgs","error","data"],"mappings":";;;;AAUA,MAAM,sCAAsB;AAkC5B,MAAM,wBAAwB;AAC9B,MAAM,wBAAwB;AAC9B,MAAM,kBAAkB;AACxB,MAAM,qBAAqB;AAC3B,MAAM,sBAAsB;AAC5B,MAAM,+BAA+B;AACrC,MAAM,0BAA0B,IAAI,KAAK;AACzC,MAAM,qBAAqB,IAAI,KAAK;AAQpC,MAAM,UAAU,CAAC,SACf,OAAQ,MAAM,QAAQ,IAAI,IAAI,OAAO,CAAC,IAAI,IAAK,CAAA;AAEjD,MAAM,iBAAiB,CAAC,KAAa,SACnC,QAAQ,IAAI,EA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jB,OAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA,YAAY;AAAA,MACZ,YAAY,CAAC;AAAA,MACb;AAAA,MACA,CAAC,GAAG,GAAG;AAAA,MACP;AAAA,MACA,SAAS;AAAA,IAAA;AAAA,IAEX;AAAA,MACE;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EAAA;AAIK,SAAA;AACT;"}
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ const require$$0 = require("react");
3
+ function shallow(objA, objB) {
4
+ if (Object.is(objA, objB)) {
5
+ return true;
6
+ }
7
+ if (typeof objA !== "object" || objA === null || typeof objB !== "object" || objB === null) {
8
+ return false;
9
+ }
10
+ if (objA instanceof Map && objB instanceof Map) {
11
+ if (objA.size !== objB.size) return false;
12
+ for (const [key, value] of objA) {
13
+ if (!Object.is(value, objB.get(key))) {
14
+ return false;
15
+ }
16
+ }
17
+ return true;
18
+ }
19
+ if (objA instanceof Set && objB instanceof Set) {
20
+ if (objA.size !== objB.size) return false;
21
+ for (const value of objA) {
22
+ if (!objB.has(value)) {
23
+ return false;
24
+ }
25
+ }
26
+ return true;
27
+ }
28
+ const keysA = Object.keys(objA);
29
+ if (keysA.length !== Object.keys(objB).length) {
30
+ return false;
31
+ }
32
+ for (const keyA of keysA) {
33
+ if (!Object.prototype.hasOwnProperty.call(objB, keyA) || !Object.is(objA[keyA], objB[keyA])) {
34
+ return false;
35
+ }
36
+ }
37
+ return true;
38
+ }
39
+ const { useRef } = require$$0;
40
+ function useShallow(selector) {
41
+ const prev = useRef();
42
+ return (state) => {
43
+ const next = selector(state);
44
+ return shallow(prev.current, next) ? prev.current : prev.current = next;
45
+ };
46
+ }
47
+ exports.useShallow = useShallow;
48
+ //# sourceMappingURL=shallow-lhDIFtEp.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shallow-lhDIFtEp.cjs","sources":["../../../../node_modules/.pnpm/zustand@4.5.5_@types+react@18.3.12_immer@9.0.21_react@18.3.1/node_modules/zustand/esm/react/shallow.mjs"],"sourcesContent":["import ReactExports from 'react';\n\nfunction shallow(objA, objB) {\n if (Object.is(objA, objB)) {\n return true;\n }\n if (typeof objA !== \"object\" || objA === null || typeof objB !== \"object\" || objB === null) {\n return false;\n }\n if (objA instanceof Map && objB instanceof Map) {\n if (objA.size !== objB.size) return false;\n for (const [key, value] of objA) {\n if (!Object.is(value, objB.get(key))) {\n return false;\n }\n }\n return true;\n }\n if (objA instanceof Set && objB instanceof Set) {\n if (objA.size !== objB.size) return false;\n for (const value of objA) {\n if (!objB.has(value)) {\n return false;\n }\n }\n return true;\n }\n const keysA = Object.keys(objA);\n if (keysA.length !== Object.keys(objB).length) {\n return false;\n }\n for (const keyA of keysA) {\n if (!Object.prototype.hasOwnProperty.call(objB, keyA) || !Object.is(objA[keyA], objB[keyA])) {\n return false;\n }\n }\n return true;\n}\n\nconst { useRef } = ReactExports;\nfunction useShallow(selector) {\n const prev = useRef();\n return (state) => {\n const next = selector(state);\n return shallow(prev.current, next) ? prev.current : prev.current = next;\n };\n}\n\nexport { useShallow };\n"],"names":["ReactExports"],"mappings":";;AAEA,SAAS,QAAQ,MAAM,MAAM;AAC3B,MAAI,OAAO,GAAG,MAAM,IAAI,GAAG;AACzB,WAAO;AAAA,EACR;AACD,MAAI,OAAO,SAAS,YAAY,SAAS,QAAQ,OAAO,SAAS,YAAY,SAAS,MAAM;AAC1F,WAAO;AAAA,EACR;AACD,MAAI,gBAAgB,OAAO,gBAAgB,KAAK;AAC9C,QAAI,KAAK,SAAS,KAAK,KAAM,QAAO;AACpC,eAAW,CAAC,KAAK,KAAK,KAAK,MAAM;AAC/B,UAAI,CAAC,OAAO,GAAG,OAAO,KAAK,IAAI,GAAG,CAAC,GAAG;AACpC,eAAO;AAAA,MACR;AAAA,IACF;AACD,WAAO;AAAA,EACR;AACD,MAAI,gBAAgB,OAAO,gBAAgB,KAAK;AAC9C,QAAI,KAAK,SAAS,KAAK,KAAM,QAAO;AACpC,eAAW,SAAS,MAAM;AACxB,UAAI,CAAC,KAAK,IAAI,KAAK,GAAG;AACpB,eAAO;AAAA,MACR;AAAA,IACF;AACD,WAAO;AAAA,EACR;AACD,QAAM,QAAQ,OAAO,KAAK,IAAI;AAC9B,MAAI,MAAM,WAAW,OAAO,KAAK,IAAI,EAAE,QAAQ;AAC7C,WAAO;AAAA,EACR;AACD,aAAW,QAAQ,OAAO;AACxB,QAAI,CAAC,OAAO,UAAU,eAAe,KAAK,MAAM,IAAI,KAAK,CAAC,OAAO,GAAG,KAAK,IAAI,GAAG,KAAK,IAAI,CAAC,GAAG;AAC3F,aAAO;AAAA,IACR;AAAA,EACF;AACD,SAAO;AACT;AAEA,MAAM,EAAE,OAAQ,IAAGA;AACnB,SAAS,WAAW,UAAU;AAC5B,QAAM,OAAO;AACb,SAAO,CAAC,UAAU;AAChB,UAAM,OAAO,SAAS,KAAK;AAC3B,WAAO,QAAQ,KAAK,SAAS,IAAI,IAAI,KAAK,UAAU,KAAK,UAAU;AAAA,EACvE;AACA;;","x_google_ignoreList":[0]}
@@ -0,0 +1,49 @@
1
+ import require$$0 from "react";
2
+ function shallow(objA, objB) {
3
+ if (Object.is(objA, objB)) {
4
+ return true;
5
+ }
6
+ if (typeof objA !== "object" || objA === null || typeof objB !== "object" || objB === null) {
7
+ return false;
8
+ }
9
+ if (objA instanceof Map && objB instanceof Map) {
10
+ if (objA.size !== objB.size) return false;
11
+ for (const [key, value] of objA) {
12
+ if (!Object.is(value, objB.get(key))) {
13
+ return false;
14
+ }
15
+ }
16
+ return true;
17
+ }
18
+ if (objA instanceof Set && objB instanceof Set) {
19
+ if (objA.size !== objB.size) return false;
20
+ for (const value of objA) {
21
+ if (!objB.has(value)) {
22
+ return false;
23
+ }
24
+ }
25
+ return true;
26
+ }
27
+ const keysA = Object.keys(objA);
28
+ if (keysA.length !== Object.keys(objB).length) {
29
+ return false;
30
+ }
31
+ for (const keyA of keysA) {
32
+ if (!Object.prototype.hasOwnProperty.call(objB, keyA) || !Object.is(objA[keyA], objB[keyA])) {
33
+ return false;
34
+ }
35
+ }
36
+ return true;
37
+ }
38
+ const { useRef } = require$$0;
39
+ function useShallow(selector) {
40
+ const prev = useRef();
41
+ return (state) => {
42
+ const next = selector(state);
43
+ return shallow(prev.current, next) ? prev.current : prev.current = next;
44
+ };
45
+ }
46
+ export {
47
+ useShallow as u
48
+ };
49
+ //# sourceMappingURL=shallow-m9BpCkKh.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shallow-m9BpCkKh.js","sources":["../../../../node_modules/.pnpm/zustand@4.5.5_@types+react@18.3.12_immer@9.0.21_react@18.3.1/node_modules/zustand/esm/react/shallow.mjs"],"sourcesContent":["import ReactExports from 'react';\n\nfunction shallow(objA, objB) {\n if (Object.is(objA, objB)) {\n return true;\n }\n if (typeof objA !== \"object\" || objA === null || typeof objB !== \"object\" || objB === null) {\n return false;\n }\n if (objA instanceof Map && objB instanceof Map) {\n if (objA.size !== objB.size) return false;\n for (const [key, value] of objA) {\n if (!Object.is(value, objB.get(key))) {\n return false;\n }\n }\n return true;\n }\n if (objA instanceof Set && objB instanceof Set) {\n if (objA.size !== objB.size) return false;\n for (const value of objA) {\n if (!objB.has(value)) {\n return false;\n }\n }\n return true;\n }\n const keysA = Object.keys(objA);\n if (keysA.length !== Object.keys(objB).length) {\n return false;\n }\n for (const keyA of keysA) {\n if (!Object.prototype.hasOwnProperty.call(objB, keyA) || !Object.is(objA[keyA], objB[keyA])) {\n return false;\n }\n }\n return true;\n}\n\nconst { useRef } = ReactExports;\nfunction useShallow(selector) {\n const prev = useRef();\n return (state) => {\n const next = selector(state);\n return shallow(prev.current, next) ? prev.current : prev.current = next;\n };\n}\n\nexport { useShallow };\n"],"names":["ReactExports"],"mappings":";AAEA,SAAS,QAAQ,M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system",
3
- "version": "3.3.5",
3
+ "version": "3.3.6",
4
4
  "private": false,
5
5
  "keywords": [
6
6
  "design-system",
@@ -79,10 +79,10 @@
79
79
  "tailwindcss-animate": "^1.0.7",
80
80
  "zod": "^3.23.8",
81
81
  "zustand": "^4.5.5",
82
- "@intlayer/dictionaries-entry": "^3.3.5",
83
- "@intlayer/config": "^3.3.5",
84
- "@intlayer/core": "^3.3.5",
85
- "react-intlayer": "^3.3.5"
82
+ "@intlayer/config": "^3.3.6",
83
+ "@intlayer/dictionaries-entry": "^3.3.6",
84
+ "@intlayer/core": "^3.3.6",
85
+ "react-intlayer": "^3.3.6"
86
86
  },
87
87
  "devDependencies": {
88
88
  "@chromatic-com/storybook": "^3.2.2",
@@ -120,21 +120,21 @@
120
120
  "typescript": "^5.7.2",
121
121
  "vite": "^6.0.1",
122
122
  "vite-plugin-dts": "^4.3.0",
123
- "@intlayer/backend": "^3.3.5",
124
123
  "@utils/ts-config": "^1.0.4",
125
- "@utils/tsup-config": "^1.0.4",
126
- "@utils/ts-config-types": "^1.0.4"
124
+ "@utils/ts-config-types": "^1.0.4",
125
+ "@intlayer/backend": "^3.3.6",
126
+ "@utils/tsup-config": "^1.0.4"
127
127
  },
128
128
  "peerDependencies": {
129
129
  "react": ">=18.3.1",
130
130
  "react-dom": ">=18.3.1",
131
131
  "zustand": "^4.5.5",
132
- "@intlayer/backend": "^3.3.5",
133
- "@intlayer/config": "^3.3.5",
134
- "intlayer": "^3.3.5",
135
- "@intlayer/core": "^3.3.5",
136
- "@intlayer/dictionaries-entry": "^3.3.5",
137
- "react-intlayer": "^3.3.5"
132
+ "@intlayer/backend": "^3.3.6",
133
+ "@intlayer/core": "^3.3.6",
134
+ "@intlayer/config": "^3.3.6",
135
+ "@intlayer/dictionaries-entry": "^3.3.6",
136
+ "intlayer": "^3.3.6",
137
+ "react-intlayer": "^3.3.6"
138
138
  },
139
139
  "scripts": {
140
140
  "build": "pnpm build:package && pnpm build:css && pnpm build:storybook",