@gaddario98/react-core 2.0.8 → 2.0.9

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.
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sources":["../../notifications/notificationAtom.ts","../../notifications/useNotification.ts"],"sourcesContent":["import { atomStateGenerator } from '@gaddario98/react-state';\nimport type { NotificationMessage } from './types';\n\nconst {\n atom: notificationAtom,\n useValue: useNotificationValue,\n useState: useNotificationState,\n} = atomStateGenerator<NotificationMessage | null>({\n defaultValue: null,\n key: 'reactNotificationAtom',\n persist: false,\n});\n\nexport { notificationAtom, useNotificationValue, useNotificationState };\n","import { useCallback, useEffect, useRef } from 'react';\nimport { useNotificationState } from './notificationAtom';\nimport type { NotificationMessage } from './types';\n\n const useNotificationSet = () => {\n const [, setValue] = useNotificationState();\n return setValue;\n };\n\nexport const useNotification = (ns = 'notifications') => {\n const setNotification = useNotificationSet();\n const ref =useRef({setNotification, ns})\n\n useEffect(() => {\n ref.current = { setNotification, ns };\n }, [setNotification, ns]);\n\n const showNotification = useCallback(\n (notification: Omit<NotificationMessage, 'id'>) => {\n ref.current.setNotification({\n ns: ref.current.ns,\n ...notification,\n id: Date.now().toString(),\n });\n },\n [],\n );\n\n const clearNotification = useCallback(() => {\n ref.current.setNotification(null);\n }, []);\n\n return {\n showNotification,\n clearNotification,\n };\n};\n"],"names":["atom","notificationAtom","useValue","useNotificationValue","useState","useNotificationState","atomStateGenerator","defaultValue","key","persist","useNotificationSet","setValue","useNotification","t0","$","_c","ns","undefined","setNotification","t1","ref","useRef","t2","t3","current","useEffect","t4","Symbol","for","notification","Object","assign","id","Date","now","toString","showNotification","t5","clearNotification","t6"],"mappings":"qIAGA,MAAM;AACJA,EAAAA,IAAI,EAAEC,gBAAgB;AACtBC,EAAAA,QAAQ,EAAEC,oBAAoB;AAC9BC,EAAAA,QAAQ,EAAEC;AAAoB,CAC/B,GAAGC,kBAAkB,CAA6B;AACjDC,EA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AFD,MAAAwB,iBAAA,GAA0BD,EAEpB;AAAC,EAAA,IAAAE,EAAA;AAAA,EAAA,IAAAzB,CAAA,CAAA,CAAA,CAAA,KAAAa,MAAA,CAAAC,GAAA,CAAA,2BAAA,CAAA,EAAA;IAEAW,EAAA,GAAA;MAAAH,gBAAA;AAAAE,MAAAA;KAGN;AAAAxB,IAAAA,CAAA,MAAAyB,EAAA;AAAA,EAAA,CAAA,MAAA;AAAAA,IAAAA,EAAA,GAAAzB,CAAA,CAAA,CAAA,CAAA;AAAA,EAAA;AAAA,EAAA,OAHMyB,EAGN;AAAA"}
1
+ {"version":3,"file":"index.mjs","sources":["../../state/storage.ts","../../state/atomStateGenerator.ts","../../notifications/notificationAtom.ts","../../notifications/useNotification.ts"],"sourcesContent":["import { deflateSync, inflateSync, strFromU8, strToU8 } from 'fflate'\n\nexport type SyncStorage = Pick<Storage, 'getItem' | 'setItem' | 'removeItem'>\n\nconst RAW_PREFIX = 'storage:raw:'\nconst DEFLATE_PREFIX = 'storage:deflate:v1:'\n\nconst isProbablyJson = (value: string) => {\n if (!value) return false\n const c = value.charCodeAt(0)\n // { [ \" digits, t/f/n (true/false/null)\n return (\n c === 123 ||\n c === 91 ||\n c === 34 ||\n (c >= 48 && c <= 57) ||\n c === 45 ||\n c === 116 ||\n c === 102 ||\n c === 110\n )\n}\n\nconst u8ToBase64 = (bytes: Uint8Array) => {\n let binary = ''\n const chunkSize = 0x8000\n for (let i = 0; i < bytes.length; i += chunkSize) {\n binary += String.fromCharCode(...bytes.subarray(i, i + chunkSize))\n }\n return btoa(binary)\n}\n\nconst base64ToU8 = (base64: string) => {\n const binary = atob(base64)\n const bytes = new Uint8Array(binary.length)\n for (let i = 0; i < binary.length; i++) {\n bytes[i] = binary.charCodeAt(i)\n }\n return bytes\n}\n\ntype CompressedStorageOptions = {\n minSizeToCompress?: number\n deflateLevel?: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9\n writeDebounceMs?: number\n}\n\nconst createCompressedStorage = (\n base: SyncStorage,\n options: CompressedStorageOptions = {},\n): SyncStorage => {\n const {\n minSizeToCompress = 1024,\n deflateLevel = 1,\n writeDebounceMs = 50,\n } = options\n\n const pendingWrites = new Map<string, string>()\n let flushTimer: number | undefined\n let lifecycleHooksInstalled = false\n\n const flush = () => {\n flushTimer = undefined\n for (const [key, value] of pendingWrites) {\n try {\n if (value.length < minSizeToCompress) {\n base.setItem(key, RAW_PREFIX + value)\n continue\n }\n\n const input = strToU8(value)\n const compressed = deflateSync(input, { level: deflateLevel })\n base.setItem(key, DEFLATE_PREFIX + u8ToBase64(compressed))\n } catch (error) {\n console.error('Error setting item:', error)\n try {\n base.setItem(key, RAW_PREFIX + value)\n } catch {\n // ignore\n }\n }\n }\n pendingWrites.clear()\n }\n\n const scheduleFlush = () => {\n if (flushTimer != null) return\n if (!lifecycleHooksInstalled && typeof window !== 'undefined') {\n lifecycleHooksInstalled = true\n window.addEventListener('beforeunload', flush)\n document.addEventListener('visibilitychange', () => {\n if (document.visibilityState === 'hidden') flush()\n })\n }\n flushTimer = globalThis.setTimeout(\n flush,\n writeDebounceMs,\n ) as unknown as number\n }\n\n return {\n getItem: (key: string): string | null => {\n try {\n const stored = base.getItem(key)\n if (!stored) return null\n\n if (stored.startsWith(RAW_PREFIX)) {\n return stored.slice(RAW_PREFIX.length)\n }\n\n if (stored.startsWith(DEFLATE_PREFIX)) {\n const b64 = stored.slice(DEFLATE_PREFIX.length)\n const bytes = base64ToU8(b64)\n const decompressed = inflateSync(bytes)\n return strFromU8(decompressed)\n }\n\n // Back-compat: older versions may have stored raw JSON without any prefix\n if (isProbablyJson(stored)) return stored\n\n return null\n } catch (error) {\n console.error('Error getting item:', error)\n return null\n }\n },\n\n setItem: (key: string, value: string) => {\n try {\n // Some upstream serializers can return `undefined` (e.g. JSON.stringify(undefined)).\n const rawValue = value as unknown as string | null | undefined\n if (rawValue == null) {\n pendingWrites.delete(key)\n base.removeItem(key)\n return\n }\n\n const stringValue = typeof rawValue === 'string' ? rawValue : String(rawValue)\n pendingWrites.set(key, stringValue)\n scheduleFlush()\n } catch (error) {\n console.error('Error setting item:', error)\n }\n },\n\n removeItem: (key: string) => {\n try {\n pendingWrites.delete(key)\n base.removeItem(key)\n } catch (error) {\n console.error('Error removing item:', error)\n }\n },\n }\n}\n\nconst baseStorage: SyncStorage = {\n getItem: (key) => {\n if (typeof localStorage === 'undefined') return null\n return localStorage.getItem(key)\n },\n setItem: (key, value) => {\n if (typeof localStorage === 'undefined') return\n localStorage.setItem(key, value)\n },\n removeItem: (key) => {\n if (typeof localStorage === 'undefined') return\n localStorage.removeItem(key)\n },\n}\n\nexport let storage: SyncStorage = createCompressedStorage(baseStorage)\n\nexport const setCustomStorage = (newStorage: SyncStorage) => {\n storage = newStorage\n}\n","import { atom, useAtom } from 'jotai'\nimport { atomWithStorage, createJSONStorage } from 'jotai/utils'\nimport { storage } from './storage'\nimport type { PrimitiveAtom } from 'jotai'\n\nexport type { PrimitiveAtom } from 'jotai'\n\nexport type AtomGeneratorOptions<T> = {\n key: string\n defaultValue: T\n persist?: boolean\n storage?: Pick<Storage, 'getItem' | 'setItem' | 'removeItem'>\n}\n\nexport type AtomState<T> = {\n atom: PrimitiveAtom<T>\n useValue: () => T\n useState: () => [T, (value: T) => void]\n useReset: () => () => void\n}\n\n// Overload per persist = true\nexport function atomStateGenerator<T>(\n options: AtomGeneratorOptions<T> & { persist: true },\n): AtomState<T>\n\n// Overload per persist = false o undefined\nexport function atomStateGenerator<T>(\n options: AtomGeneratorOptions<T> & { persist?: false },\n): AtomState<T>\n\n// Implementazione\nexport function atomStateGenerator<T>({\n key,\n defaultValue,\n persist = false,\n storage: customStorage,\n}: AtomGeneratorOptions<T>): AtomState<T> {\n const resolvedStorage = customStorage || storage\n\n // Usa atomWithStorage solo se persist è true, altrimenti atom normale\n const jotaiAtom = persist\n ? atomWithStorage<T>(\n key,\n defaultValue,\n createJSONStorage<T>(() => resolvedStorage),\n )\n : atom<T>(defaultValue)\n\n const useValue = () => {\n const [value] = useAtom(jotaiAtom as PrimitiveAtom<T>)\n return value\n }\n\n const useState = () => {\n const [value, setValue] = useAtom(jotaiAtom as PrimitiveAtom<T>)\n return [value, setValue] as [T, (value: T) => void]\n }\n\n const useReset = () => {\n const [, setValue] = useAtom(jotaiAtom as PrimitiveAtom<T>)\n return () => {\n setValue(defaultValue)\n // Rimuovi dallo storage solo se era persistente\n if (persist) {\n resolvedStorage.removeItem(key)\n }\n }\n }\n\n return {\n atom: jotaiAtom as PrimitiveAtom<T>,\n useValue,\n useState,\n useReset,\n }\n}\n","import { atomStateGenerator } from \"../state\";\nimport type { NotificationMessage } from \"./types\";\n\nconst {\n atom: notificationAtom,\n useValue: useNotificationValue,\n useState: useNotificationState,\n} = atomStateGenerator<NotificationMessage | null>({\n defaultValue: null,\n key: \"reactNotificationAtom\",\n persist: false,\n});\n\nexport { notificationAtom, useNotificationValue, useNotificationState };\n","import { useCallback, useEffect, useRef } from 'react';\nimport { useNotificationState } from './notificationAtom';\nimport type { NotificationMessage } from './types';\n\n const useNotificationSet = () => {\n const [, setValue] = useNotificationState();\n return setValue;\n };\n\nexport const useNotification = (ns = 'notifications') => {\n const setNotification = useNotificationSet();\n const ref =useRef({setNotification, ns})\n\n useEffect(() => {\n ref.current = { setNotification, ns };\n }, [setNotification, ns]);\n\n const showNotification = useCallback(\n (notification: Omit<NotificationMessage, 'id'>) => {\n ref.current.setNotification({\n ns: ref.current.ns,\n ...notification,\n id: Date.now().toString(),\n });\n },\n [],\n );\n\n const clearNotification = useCallback(() => {\n ref.current.setNotification(null);\n }, []);\n\n return {\n showNotification,\n clearNotification,\n };\n};\n"],"names":["RAW_PREFIX","DEFLATE_PREFIX","isProbablyJson","value","c","charCodeAt","u8ToBase64","bytes","binary","chunkSize","i","length","String","fromCharCode","subarray","btoa","base64ToU8","base64","atob","Uint8Array","createCompressedStorage","base","options","minSizeToCompress","deflateLevel","writeDebounceMs","pendingWrites","Map","flushTimer","lifecycleHooksInstalled","flush","undefined","key","setItem","input","strToU8","compressed","deflateSync","level","error","console","_a","clear","scheduleFlush","window","addEventListener","document","visibilityState","globalThis","setTimeout","getItem","stored","startsWith","slice","b64","decompressed","inflateSync","strFromU8","rawValue","delete","removeItem","stringValue","set","baseStorage","localStorage","storage","atomStateGenerator","defaultValue","persist","customStorage","resolvedStorage","jotaiAtom","atomWithStorage","createJSONStorage","atom","useValue","useAtom","useState","$","_c","setValue","t0","useReset","notificationAtom","useNotificationValue","useNotificationState","useNotificationSet","useNotification","ns","setNotification","t1","ref","useRef","t2","t3","current","useEffect","t4","Symbol","for","notification","Object","assign","id","Date","now","toString","showNotification","t5","clearNotification","t6"],"mappings":"wOAIA,MAAMA,UAAU,GAAG,cAAc;AACjC,MAAMC,cAAc,GAAG,qBAAqB;AAE5C,MAAMC,cAAc,GAAIC,KAAa,IAAI;AACvC,EAAA,IAAI,CAACA,KAAK,EAAE,OAAO,KAAK;AACxB,EAAA,MAAMC,CAAC,GAAGD,KAAK,CAACE,UAAU,CAAC,CAAC,CAAC;AAC7B;AACA,EAAA,OACED,CAAC,KAAK,GAAG,IACTA,CAAC,KAAK,EAAE,IACRA,CAAC,KAAK,EAAE,IACPA,CAAC,IAAI,EAAE,IAAIA,CAAC,IAAI,EAAG,IACpBA,CAAC,KAAK,EAAE,IACRA,CAAC,KAAK,GAAG,IACTA,CAAC,KAAK,GAAG,IACTA,CAAC,KAAK,GAAG;AAEb,CAAC;AAED,MAAME,UAAU,GAAIC,KAAiB,IAAI;EACvC,IAAIC,MAAM,GAAG,EAAE;EACf,MAAMC,SAAS,GAAG,MAAM;AACxB,EAAA,KAAK,IAAIC,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGH,KAAK,CAACI,MAAM,EAAED,CAAC,IAAID,SAAS,EAAE;AAChDD,IAAAA,MAAM,IAAII,MAAM,CAACC,YAAY,CAAC,GAAGN,KAAK,CAACO,QAAQ,CAACJ,CAAC,EAAEA,CAAC,GAAGD,SAAS,CAAC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