UNPKG

@mongez/react-atom

Version:
1 lines 1.35 kB
{"version":3,"file":"context.mjs","names":[],"sources":["../../../../@mongez/react-atom/src/context.tsx"],"sourcesContent":["\"use client\";\n\nimport { type Atom } from \"@mongez/atom\";\nimport React from \"react\";\nimport { AtomStoreContext, AtomStoreProvider } from \"./store\";\n\n/**\n * @deprecated Re-export of `AtomStoreContext` from \"./store\". The context\n * value type changed from a key→atom record to an `AtomStore` instance; if\n * you only consumed this via `useAtom(key)` the migration is transparent.\n */\nexport const AtomContext = AtomStoreContext;\n\n/**\n * Backwards-compatible alias for `<AtomStoreProvider>`.\n *\n * Maps the legacy `register` (atoms to pre-clone) to `initialAtoms`, and\n * `defaultValue` (record of initial atom values) to `initialValues`.\n *\n * @deprecated Use `<AtomStoreProvider>` from \"./store\" directly.\n */\nexport function AtomProvider({\n register,\n defaultValue,\n children,\n}: {\n register?: Atom<any>[];\n defaultValue?: Record<string, unknown>;\n children: React.ReactNode;\n}) {\n return (\n <AtomStoreProvider initialAtoms={register} initialValues={defaultValue}>\n {children}\n </AtomStoreProvider>\n );\n}\n"],"mappings":";;;;;;;;;;;;AAWA,MAAa,cAAc;;;;;;;;;AAU3B,SAAgB,aAAa,EAC3B,UACA,cACA,YAKC;CACD,OACE,oBAAC,mBAAD;EAAmB,cAAc;EAAU,eAAe;EACvD;CACgB;AAEvB"}