@context-query/react 0.3.2-beta.3 → 0.3.2-beta.4

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.
package/dist/hooks.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { createStoreContext } from "./context";
2
1
  import type { ContextQueryStore } from "@context-query/core";
2
+ import { createStoreContext } from "./context";
3
3
  export declare function createUseStore<TAtoms extends Record<string, any>>(StoreContext: ReturnType<typeof createStoreContext<TAtoms>>): () => ContextQueryStore<TAtoms>;
4
4
  export declare function createUseContextAtom<TAtoms extends Record<string, any>>(StoreContext: ReturnType<typeof createStoreContext<TAtoms>>): <TKey extends keyof TAtoms>(key: TKey) => readonly [TAtoms[TKey], (newValue: TAtoms[TKey] | ((prev: TAtoms[TKey]) => TAtoms[TKey])) => void];
5
5
  export declare function createUseContextAtomValue<TAtoms extends Record<string, any>>(StoreContext: ReturnType<typeof createStoreContext<TAtoms>>): <TKey extends keyof TAtoms>(key: TKey) => TAtoms[TKey];
package/dist/index.cjs CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";var t=require("react"),e=require("react/jsx-runtime");function r(e){return r=>{const s=(()=>{const r=t.useContext(e);if(!r)throw new Error("useContextAtom must be used within a ContextQueryProvider");return r})(),[o,u]=t.useState((()=>s.getAtomValue(r)));t.useEffect((()=>{const t=s.subscribeToAtom(r,((t,e)=>{u(e)}));return()=>{t.unsubscribe()}}),[r,s]);return[o,t.useCallback((t=>{const e=s.getAtomValue(r),o="function"==typeof t?t(e):t;s.setAtomValue(r,o)}),[r,s])]}}function s(e){return r=>{const s=(()=>{const r=t.useContext(e);if(!r)throw new Error("useContextAtomValue must be used within a ContextQueryProvider");return r})(),[o,u]=t.useState((()=>s.getAtomValue(r)));return t.useEffect((()=>{const t=s.subscribeToAtom(r,((t,e)=>{u(e)}));return()=>{t.unsubscribe()}}),[r,s]),o}}function o(e){return r=>{const s=(()=>{const r=t.useContext(e);if(!r)throw new Error("useContextSetAtom must be used within a ContextQueryProvider");return r})();return t.useCallback((t=>{const e=s.getAtomValue(r),o="function"==typeof t?t(e):t;s.setAtomValue(r,o)}),[r,s])}}function u(e){return()=>{const r=(()=>{const r=t.useContext(e);if(!r)throw new Error("useAllAtoms must be used within a ContextQueryProvider");return r})(),[s,o]=t.useState((()=>r.getAllAtomValues()));t.useEffect((()=>{const t=[],e=r.getAllAtomValues();return Object.keys(e).forEach((e=>{const s=r.subscribeToAtom(e,(()=>{o(r.getAllAtomValues())}));t.push(s)})),()=>{t.forEach((t=>t.unsubscribe()))}}),[r]);return[s,t.useCallback((t=>{r.updateAllAtoms(t)}),[r])]}}function n(e){return()=>{const r=(()=>{const r=t.useContext(e);if(!r)throw new Error("useAllAtomsValue must be used within a ContextQueryProvider");return r})(),[s,o]=t.useState((()=>r.getAllAtomValues()));return t.useEffect((()=>{const t=[],e=r.getAllAtomValues();return Object.keys(e).forEach((e=>{const s=r.subscribeToAtom(e,(()=>{o(r.getAllAtomValues())}));t.push(s)})),()=>{t.forEach((t=>t.unsubscribe()))}}),[r]),s}}function i(e){return()=>{const r=(()=>{const r=t.useContext(e);if(!r)throw new Error("useUpdateAllAtoms must be used within a ContextQueryProvider");return r})();return t.useCallback((t=>{r.updateAllAtoms(t)}),[r])}}class c{value;listeners;constructor(t){this.value=t,this.listeners=new Set}getValue(){return this.value}setValue(t){Object.is(this.value,t)||(this.value=t,this.notifyListeners())}notifyListeners(){this.listeners.forEach((t=>t(this.value)))}subscribe(t){return this.listeners.add(t),{unsubscribe:()=>{this.listeners.delete(t)}}}}class l{atoms;constructor(t){this.atoms=new Map,Object.entries(t).forEach((([t,e])=>{this.atoms.set(t,new c(e))}))}getAtomValue(t){const e=this.atoms.get(t);if(!e)throw new Error(`Atom with key "${String(t)}" not found`);return e.getValue()}setAtomValue(t,e){const r=this.atoms.get(t);if(!r)throw new Error(`Atom with key "${String(t)}" not found`);r.setValue(e)}subscribeToAtom(t,e){const r=this.atoms.get(t);if(!r)throw new Error(`Atom with key "${String(t)}" not found`);return r.subscribe((r=>{e(t,r)}))}getAllAtomValues(){const t={};return this.atoms.forEach(((e,r)=>{t[r]=e.getValue()})),t}updateAllAtoms(t){Object.entries(t).forEach((([t,e])=>{const r=this.atoms.get(t);r&&r.setValue(e)}))}}function a(){const r=t.createContext(null);return{ContextQueryProvider:function({children:s,atoms:o}){const u=t.useMemo((()=>new l(o)),[o]);return e.jsx(r.Provider,{value:u,children:s})},StoreContext:r}}exports.createContextQuery=function(){const{ContextQueryProvider:e,StoreContext:c}=a(),l=r(c),m=s(c),A=o(c),h=function(e){return()=>{const r=t.useContext(e);if(!r)throw new Error("useStore must be used within a ContextQueryProvider");return r}}(c);return{ContextQueryProvider:e,useContextAtom:l,useContextAtomValue:m,useContextSetAtom:A,useStore:h,useAllAtoms:u(c),useAllAtomsValue:n(c),useUpdateAllAtoms:i(c)}};
1
+ "use strict";var t=require("react"),e=require("react/jsx-runtime");function r(e){return r=>{const s=(()=>{const r=t.useContext(e);if(!r)throw new Error("useContextAtom must be used within a ContextQueryProvider");return r})(),[o,u]=t.useState((()=>s.getAtomValue(r)));t.useEffect((()=>{u(s.getAtomValue(r))}),[s,r]),t.useEffect((()=>{const t=s.subscribeToAtom(r,((t,e)=>{u(e)}));return()=>{t.unsubscribe()}}),[r,s]);return[o,t.useCallback((t=>{const e=s.getAtomValue(r),o="function"==typeof t?t(e):t;s.setAtomValue(r,o)}),[r,s])]}}function s(e){return r=>{const s=(()=>{const r=t.useContext(e);if(!r)throw new Error("useContextAtomValue must be used within a ContextQueryProvider");return r})(),[o,u]=t.useState((()=>s.getAtomValue(r)));return t.useEffect((()=>{u(s.getAtomValue(r))}),[s,r]),t.useEffect((()=>{const t=s.subscribeToAtom(r,((t,e)=>{u(e)}));return()=>{t.unsubscribe()}}),[r,s]),o}}function o(e){return r=>{const s=(()=>{const r=t.useContext(e);if(!r)throw new Error("useContextSetAtom must be used within a ContextQueryProvider");return r})();return t.useCallback((t=>{const e=s.getAtomValue(r),o="function"==typeof t?t(e):t;s.setAtomValue(r,o)}),[r,s])}}function u(e){return()=>{const r=(()=>{const r=t.useContext(e);if(!r)throw new Error("useAllAtoms must be used within a ContextQueryProvider");return r})(),[s,o]=t.useState((()=>r.getAllAtomValues()));t.useEffect((()=>{o(r.getAllAtomValues())}),[r]),t.useEffect((()=>{const t=[],e=r.getAllAtomValues();return Object.keys(e).forEach((e=>{const s=r.subscribeToAtom(e,(()=>{o(r.getAllAtomValues())}));t.push(s)})),()=>{t.forEach((t=>t.unsubscribe()))}}),[r]);return[s,t.useCallback((t=>{r.updateAllAtoms(t)}),[r])]}}function n(e){return()=>{const r=(()=>{const r=t.useContext(e);if(!r)throw new Error("useAllAtomsValue must be used within a ContextQueryProvider");return r})(),[s,o]=t.useState((()=>r.getAllAtomValues()));return t.useEffect((()=>{o(r.getAllAtomValues())}),[r]),t.useEffect((()=>{const t=[],e=r.getAllAtomValues();return Object.keys(e).forEach((e=>{const s=r.subscribeToAtom(e,(()=>{o(r.getAllAtomValues())}));t.push(s)})),()=>{t.forEach((t=>t.unsubscribe()))}}),[r]),s}}function i(e){return()=>{const r=(()=>{const r=t.useContext(e);if(!r)throw new Error("useUpdateAllAtoms must be used within a ContextQueryProvider");return r})();return t.useCallback((t=>{r.updateAllAtoms(t)}),[r])}}class l{value;listeners;constructor(t){this.value=t,this.listeners=new Set}getValue(){return this.value}setValue(t){Object.is(this.value,t)||(this.value=t,this.notifyListeners())}notifyListeners(){this.listeners.forEach((t=>t(this.value)))}subscribe(t){return this.listeners.add(t),{unsubscribe:()=>{this.listeners.delete(t)}}}}class c{atoms;constructor(t){this.atoms=new Map,Object.entries(t).forEach((([t,e])=>{this.atoms.set(t,new l(e))}))}getAtomValue(t){const e=this.atoms.get(t);if(!e)throw new Error(`Atom with key "${String(t)}" not found`);return e.getValue()}setAtomValue(t,e){const r=this.atoms.get(t);if(!r)throw new Error(`Atom with key "${String(t)}" not found`);r.setValue(e)}subscribeToAtom(t,e){const r=this.atoms.get(t);if(!r)throw new Error(`Atom with key "${String(t)}" not found`);return r.subscribe((r=>{e(t,r)}))}getAllAtomValues(){const t={};return this.atoms.forEach(((e,r)=>{t[r]=e.getValue()})),t}updateAllAtoms(t){Object.entries(t).forEach((([t,e])=>{const r=this.atoms.get(t);r&&r.setValue(e)}))}}function a(){const r=t.createContext(null);return{ContextQueryProvider:function({children:s,atoms:o}){const u=t.useMemo((()=>new c(o)),[o]);return e.jsx(r.Provider,{value:u,children:s})},StoreContext:r}}exports.createContextQuery=function(){const{ContextQueryProvider:e,StoreContext:l}=a(),c=r(l),m=s(l),A=o(l),f=function(e){return()=>{const r=t.useContext(e);if(!r)throw new Error("useStore must be used within a ContextQueryProvider");return r}}(l);return{ContextQueryProvider:e,useContextAtom:c,useContextAtomValue:m,useContextSetAtom:A,useStore:f,useAllAtoms:u(l),useAllAtomsValue:n(l),useUpdateAllAtoms:i(l)}};
2
2
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","sources":["../src/hooks.ts","../../../node_modules/.pnpm/@context-query+core@0.3.2-beta.1/node_modules/@context-query/core/dist/index.mjs","../src/provider.tsx","../src/context.ts","../src/index.ts"],"sourcesContent":["import { useCallback, useContext, useEffect, useState } from \"react\";\nimport { createStoreContext } from \"./context\";\nimport type { ContextQueryStore } from \"@context-query/core\";\n\nexport function createUseStore<TAtoms extends Record<string, any>>(\n StoreContext: ReturnType<typeof createStoreContext<TAtoms>>\n): () => ContextQueryStore<TAtoms> {\n return () => {\n const store = useContext(StoreContext);\n\n if (!store) {\n throw new Error(\n \"useStore must be used within a ContextQueryProvider\"\n );\n }\n\n return store;\n };\n}\n\nexport function createUseContextAtom<TAtoms extends Record<string, any>>(\n StoreContext: ReturnType<typeof createStoreContext<TAtoms>>\n) {\n const useStore = () => {\n const store = useContext(StoreContext);\n\n if (!store) {\n throw new Error(\n \"useContextAtom must be used within a ContextQueryProvider\"\n );\n }\n\n return store;\n };\n\n return <TKey extends keyof TAtoms>(key: TKey) => {\n const store = useStore();\n const [value, setValue] = useState<TAtoms[TKey]>(() =>\n store.getAtomValue(key)\n );\n\n useEffect(() => {\n const handleChange = (_: TKey, newValue: TAtoms[TKey]) => {\n setValue(newValue);\n };\n\n const subscription = store.subscribeToAtom(key, handleChange);\n\n return () => {\n subscription.unsubscribe();\n };\n }, [key, store]);\n\n const setAtom = useCallback(\n (newValue: TAtoms[TKey] | ((prev: TAtoms[TKey]) => TAtoms[TKey])) => {\n const currentValue = store.getAtomValue(key);\n const updatedValue =\n typeof newValue === \"function\"\n ? (newValue as Function)(currentValue)\n : newValue;\n\n store.setAtomValue(key, updatedValue);\n },\n [key, store]\n );\n\n return [value, setAtom] as const;\n };\n}\n\nexport function createUseContextAtomValue<TAtoms extends Record<string, any>>(\n StoreContext: ReturnType<typeof createStoreContext<TAtoms>>\n) {\n const useStore = () => {\n const store = useContext(StoreContext);\n\n if (!store) {\n throw new Error(\n \"useContextAtomValue must be used within a ContextQueryProvider\"\n );\n }\n\n return store;\n };\n\n return <TKey extends keyof TAtoms>(key: TKey): TAtoms[TKey] => {\n const store = useStore();\n const [value, setValue] = useState<TAtoms[TKey]>(() =>\n store.getAtomValue(key)\n );\n\n useEffect(() => {\n const handleChange = (_: TKey, newValue: TAtoms[TKey]) => {\n setValue(newValue);\n };\n\n const subscription = store.subscribeToAtom(key, handleChange);\n\n return () => {\n subscription.unsubscribe();\n };\n }, [key, store]);\n\n return value;\n };\n}\n\nexport function createUseContextSetAtom<TAtoms extends Record<string, any>>(\n StoreContext: ReturnType<typeof createStoreContext<TAtoms>>\n) {\n const useStore = () => {\n const store = useContext(StoreContext);\n\n if (!store) {\n throw new Error(\n \"useContextSetAtom must be used within a ContextQueryProvider\"\n );\n }\n\n return store;\n };\n\n return <TKey extends keyof TAtoms>(\n key: TKey\n ): ((\n value: TAtoms[TKey] | ((prev: TAtoms[TKey]) => TAtoms[TKey])\n ) => void) => {\n const store = useStore();\n\n return useCallback(\n (newValue: TAtoms[TKey] | ((prev: TAtoms[TKey]) => TAtoms[TKey])) => {\n const currentValue = store.getAtomValue(key);\n const updatedValue =\n typeof newValue === \"function\"\n ? (newValue as Function)(currentValue)\n : newValue;\n\n store.setAtomValue(key, updatedValue);\n },\n [key, store]\n );\n };\n}\n\nexport function createUseAllAtoms<TAtoms extends Record<string, any>>(\n StoreContext: ReturnType<typeof createStoreContext<TAtoms>>\n) {\n const useStore = () => {\n const store = useContext(StoreContext);\n\n if (!store) {\n throw new Error(\n \"useAllAtoms must be used within a ContextQueryProvider\"\n );\n }\n\n return store;\n };\n\n return (): [TAtoms, (newAtoms: Partial<TAtoms>) => void] => {\n const store = useStore();\n const [allValues, setAllValues] = useState<TAtoms>(() =>\n store.getAllAtomValues()\n );\n\n useEffect(() => {\n // Subscribe to all atoms by getting all keys and subscribing to each\n const subscriptions: Array<{ unsubscribe: () => void }> = [];\n const currentAtoms = store.getAllAtomValues();\n \n Object.keys(currentAtoms).forEach((key) => {\n const subscription = store.subscribeToAtom(key as keyof TAtoms, () => {\n setAllValues(store.getAllAtomValues());\n });\n subscriptions.push(subscription);\n });\n\n return () => {\n subscriptions.forEach(sub => sub.unsubscribe());\n };\n }, [store]);\n\n const updateAllAtoms = useCallback(\n (newAtoms: Partial<TAtoms>) => {\n store.updateAllAtoms(newAtoms);\n },\n [store]\n );\n\n return [allValues, updateAllAtoms] as const;\n };\n}\n\nexport function createUseAllAtomsValue<TAtoms extends Record<string, any>>(\n StoreContext: ReturnType<typeof createStoreContext<TAtoms>>\n) {\n const useStore = () => {\n const store = useContext(StoreContext);\n\n if (!store) {\n throw new Error(\n \"useAllAtomsValue must be used within a ContextQueryProvider\"\n );\n }\n\n return store;\n };\n\n return (): TAtoms => {\n const store = useStore();\n const [allValues, setAllValues] = useState<TAtoms>(() =>\n store.getAllAtomValues()\n );\n\n useEffect(() => {\n // Subscribe to all atoms by getting all keys and subscribing to each\n const subscriptions: Array<{ unsubscribe: () => void }> = [];\n const currentAtoms = store.getAllAtomValues();\n \n Object.keys(currentAtoms).forEach((key) => {\n const subscription = store.subscribeToAtom(key as keyof TAtoms, () => {\n setAllValues(store.getAllAtomValues());\n });\n subscriptions.push(subscription);\n });\n\n return () => {\n subscriptions.forEach(sub => sub.unsubscribe());\n };\n }, [store]);\n\n return allValues;\n };\n}\n\nexport function createUseUpdateAllAtoms<TAtoms extends Record<string, any>>(\n StoreContext: ReturnType<typeof createStoreContext<TAtoms>>\n) {\n const useStore = () => {\n const store = useContext(StoreContext);\n\n if (!store) {\n throw new Error(\n \"useUpdateAllAtoms must be used within a ContextQueryProvider\"\n );\n }\n\n return store;\n };\n\n return (): ((newAtoms: Partial<TAtoms>) => void) => {\n const store = useStore();\n\n return useCallback(\n (newAtoms: Partial<TAtoms>) => {\n store.updateAllAtoms(newAtoms);\n },\n [store]\n );\n };\n}\n","class t{value;listeners;constructor(t){this.value=t,this.listeners=new Set}getValue(){return this.value}setValue(t){Object.is(this.value,t)||(this.value=t,this.notifyListeners())}notifyListeners(){this.listeners.forEach((t=>t(this.value)))}subscribe(t){this.listeners.add(t);return{unsubscribe:()=>{this.listeners.delete(t)}}}}class e{atoms;constructor(e){this.atoms=new Map,Object.entries(e).forEach((([e,s])=>{this.atoms.set(e,new t(s))}))}getAtomValue(t){const e=this.atoms.get(t);if(!e)throw new Error(`Atom with key \"${String(t)}\" not found`);return e.getValue()}setAtomValue(t,e){const s=this.atoms.get(t);if(!s)throw new Error(`Atom with key \"${String(t)}\" not found`);s.setValue(e)}subscribeToAtom(t,e){const s=this.atoms.get(t);if(!s)throw new Error(`Atom with key \"${String(t)}\" not found`);return s.subscribe((s=>{e(t,s)}))}getAllAtomValues(){const t={};return this.atoms.forEach(((e,s)=>{t[s]=e.getValue()})),t}updateAllAtoms(t){Object.entries(t).forEach((([t,e])=>{const s=this.atoms.get(t);s&&s.setValue(e)}))}}export{t as AtomStore,e as ContextQueryStore};\n//# sourceMappingURL=index.mjs.map\n","import { ContextQueryStore } from \"@context-query/core\";\nimport { PropsWithChildren, useMemo } from \"react\";\nimport { createStoreContext } from \"./context\";\n\ntype AtomValues<T extends Record<string, any>> = {\n [K in keyof T]: T[K];\n};\n\nexport function createReactContextQuery<TAtoms extends Record<string, any>>() {\n const StoreContext = createStoreContext<TAtoms>();\n \n const ContextQueryProvider = function ContextQueryProvider({\n children,\n atoms,\n }: PropsWithChildren<{ atoms: AtomValues<TAtoms> }>) {\n const store = useMemo(\n () => new ContextQueryStore<TAtoms>(atoms),\n [atoms]\n );\n\n return (\n <StoreContext.Provider value={store}>{children}</StoreContext.Provider>\n );\n };\n\n return {\n ContextQueryProvider,\n StoreContext,\n };\n}\n","import type { ContextQueryStore } from \"@context-query/core\";\nimport { createContext } from \"react\";\n\nexport const createStoreContext = <TAtoms extends Record<string, any>>() => {\n return createContext<ContextQueryStore<TAtoms> | null>(null);\n};\n","import { \n createUseContextAtom, \n createUseContextAtomValue, \n createUseContextSetAtom,\n createUseStore,\n createUseAllAtoms,\n createUseAllAtomsValue,\n createUseUpdateAllAtoms\n} from \"./hooks\";\nimport { createReactContextQuery } from \"./provider\";\n\nexport function createContextQuery<TAtoms extends Record<string, any>>() {\n const { ContextQueryProvider, StoreContext } =\n createReactContextQuery<TAtoms>();\n \n const useContextAtom = createUseContextAtom<TAtoms>(StoreContext);\n const useContextAtomValue = createUseContextAtomValue<TAtoms>(StoreContext);\n const useContextSetAtom = createUseContextSetAtom<TAtoms>(StoreContext);\n const useStore = createUseStore<TAtoms>(StoreContext);\n const useAllAtoms = createUseAllAtoms<TAtoms>(StoreContext);\n const useAllAtomsValue = createUseAllAtomsValue<TAtoms>(StoreContext);\n const useUpdateAllAtoms = createUseUpdateAllAtoms<TAtoms>(StoreContext);\n \n return {\n ContextQueryProvider,\n useContextAtom,\n useContextAtomValue,\n useContextSetAtom,\n useStore,\n useAllAtoms,\n useAllAtomsValue,\n useUpdateAllAtoms,\n };\n}\n"],"names":["createUseContextAtom","StoreContext","key","store","useContext","Error","useStore","value","setValue","useState","getAtomValue","useEffect","subscription","subscribeToAtom","_","newValue","unsubscribe","useCallback","currentValue","updatedValue","setAtomValue","createUseContextAtomValue","createUseContextSetAtom","createUseAllAtoms","allValues","setAllValues","getAllAtomValues","subscriptions","currentAtoms","Object","keys","forEach","push","sub","newAtoms","updateAllAtoms","createUseAllAtomsValue","createUseUpdateAllAtoms","t","listeners","constructor","this","Set","getValue","is","notifyListeners","subscribe","add","delete","e","atoms","Map","entries","s","set","get","String","createReactContextQuery","createContext","ContextQueryProvider","children","useMemo","ContextQueryStore","_jsx","jsx","Provider","useContextAtom","useContextAtomValue","useContextSetAtom","createUseStore","useAllAtoms","useAllAtomsValue","useUpdateAllAtoms"],"mappings":"mEAoBM,SAAUA,EACdC,GAcA,OAAmCC,IACjC,MAAMC,EAbS,MACf,MAAMA,EAAQC,EAAUA,WAACH,GAEzB,IAAKE,EACH,MAAM,IAAIE,MACR,6DAIJ,OAAOF,CAAK,EAIEG,IACPC,EAAOC,GAAYC,EAAAA,UAAuB,IAC/CN,EAAMO,aAAaR,KAGrBS,EAAAA,WAAU,KACR,MAIMC,EAAeT,EAAMU,gBAAgBX,GAJtB,CAACY,EAASC,KAC7BP,EAASO,EAAS,IAKpB,MAAO,KACLH,EAAaI,aAAa,CAC3B,GACA,CAACd,EAAKC,IAeT,MAAO,CAACI,EAbQU,eACbF,IACC,MAAMG,EAAef,EAAMO,aAAaR,GAClCiB,EACgB,mBAAbJ,EACFA,EAAsBG,GACvBH,EAENZ,EAAMiB,aAAalB,EAAKiB,EAAa,GAEvC,CAACjB,EAAKC,IAGwB,CAEpC,CAEM,SAAUkB,EACdpB,GAcA,OAAmCC,IACjC,MAAMC,EAbS,MACf,MAAMA,EAAQC,EAAUA,WAACH,GAEzB,IAAKE,EACH,MAAM,IAAIE,MACR,kEAIJ,OAAOF,CAAK,EAIEG,IACPC,EAAOC,GAAYC,EAAAA,UAAuB,IAC/CN,EAAMO,aAAaR,KAerB,OAZAS,EAAAA,WAAU,KACR,MAIMC,EAAeT,EA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AUA,WAACH,GAEzB,IAAKE,EACH,MAAM,IAAIE,MACR,uDAIJ,OAAOF,CAAK,CAEhB,CIAmBkE,CAAuBpE,GAKxC,MAAO,CACL0D,uBACAO,iBACAC,sBACAC,oBACA9D,WACAgE,YAVkB/C,EAA0BtB,GAW5CsE,iBAVuBnC,EAA+BnC,GAWtDuE,kBAVwBnC,EAAgCpC,GAY5D","x_google_ignoreList":[1]}
1
+ {"version":3,"file":"index.cjs","sources":["../src/hooks.ts","../../../node_modules/.pnpm/@context-query+core@0.3.2-beta.1/node_modules/@context-query/core/dist/index.mjs","../src/provider.tsx","../src/context.ts","../src/index.ts"],"sourcesContent":["import type { ContextQueryStore } from \"@context-query/core\";\nimport { useCallback, useContext, useEffect, useState } from \"react\";\nimport { createStoreContext } from \"./context\";\n\nexport function createUseStore<TAtoms extends Record<string, any>>(\n StoreContext: ReturnType<typeof createStoreContext<TAtoms>>\n): () => ContextQueryStore<TAtoms> {\n return () => {\n const store = useContext(StoreContext);\n\n if (!store) {\n throw new Error(\"useStore must be used within a ContextQueryProvider\");\n }\n\n return store;\n };\n}\n\nexport function createUseContextAtom<TAtoms extends Record<string, any>>(\n StoreContext: ReturnType<typeof createStoreContext<TAtoms>>\n) {\n const useStore = () => {\n const store = useContext(StoreContext);\n\n if (!store) {\n throw new Error(\n \"useContextAtom must be used within a ContextQueryProvider\"\n );\n }\n\n return store;\n };\n\n return <TKey extends keyof TAtoms>(key: TKey) => {\n const store = useStore();\n const [value, setValue] = useState<TAtoms[TKey]>(() =>\n store.getAtomValue(key)\n );\n\n useEffect(() => {\n setValue(store.getAtomValue(key));\n }, [store, key]);\n\n useEffect(() => {\n const handleChange = (_: TKey, newValue: TAtoms[TKey]) => {\n setValue(newValue);\n };\n\n const subscription = store.subscribeToAtom(key, handleChange);\n\n return () => {\n subscription.unsubscribe();\n };\n }, [key, store]);\n\n const setAtom = useCallback(\n (newValue: TAtoms[TKey] | ((prev: TAtoms[TKey]) => TAtoms[TKey])) => {\n const currentValue = store.getAtomValue(key);\n const updatedValue =\n typeof newValue === \"function\"\n ? (newValue as Function)(currentValue)\n : newValue;\n\n store.setAtomValue(key, updatedValue);\n },\n [key, store]\n );\n\n return [value, setAtom] as const;\n };\n}\n\nexport function createUseContextAtomValue<TAtoms extends Record<string, any>>(\n StoreContext: ReturnType<typeof createStoreContext<TAtoms>>\n) {\n const useStore = () => {\n const store = useContext(StoreContext);\n\n if (!store) {\n throw new Error(\n \"useContextAtomValue must be used within a ContextQueryProvider\"\n );\n }\n\n return store;\n };\n\n return <TKey extends keyof TAtoms>(key: TKey): TAtoms[TKey] => {\n const store = useStore();\n const [value, setValue] = useState<TAtoms[TKey]>(() =>\n store.getAtomValue(key)\n );\n\n useEffect(() => {\n setValue(store.getAtomValue(key));\n }, [store, key]);\n\n useEffect(() => {\n const handleChange = (_: TKey, newValue: TAtoms[TKey]) => {\n setValue(newValue);\n };\n\n const subscription = store.subscribeToAtom(key, handleChange);\n\n return () => {\n subscription.unsubscribe();\n };\n }, [key, store]);\n\n return value;\n };\n}\n\nexport function createUseContextSetAtom<TAtoms extends Record<string, any>>(\n StoreContext: ReturnType<typeof createStoreContext<TAtoms>>\n) {\n const useStore = () => {\n const store = useContext(StoreContext);\n\n if (!store) {\n throw new Error(\n \"useContextSetAtom must be used within a ContextQueryProvider\"\n );\n }\n\n return store;\n };\n\n return <TKey extends keyof TAtoms>(\n key: TKey\n ): ((\n value: TAtoms[TKey] | ((prev: TAtoms[TKey]) => TAtoms[TKey])\n ) => void) => {\n const store = useStore();\n\n return useCallback(\n (newValue: TAtoms[TKey] | ((prev: TAtoms[TKey]) => TAtoms[TKey])) => {\n const currentValue = store.getAtomValue(key);\n const updatedValue =\n typeof newValue === \"function\"\n ? (newValue as Function)(currentValue)\n : newValue;\n\n store.setAtomValue(key, updatedValue);\n },\n [key, store]\n );\n };\n}\n\nexport function createUseAllAtoms<TAtoms extends Record<string, any>>(\n StoreContext: ReturnType<typeof createStoreContext<TAtoms>>\n) {\n const useStore = () => {\n const store = useContext(StoreContext);\n\n if (!store) {\n throw new Error(\"useAllAtoms must be used within a ContextQueryProvider\");\n }\n\n return store;\n };\n\n return (): [TAtoms, (newAtoms: Partial<TAtoms>) => void] => {\n const store = useStore();\n const [allValues, setAllValues] = useState<TAtoms>(() =>\n store.getAllAtomValues()\n );\n\n useEffect(() => {\n setAllValues(store.getAllAtomValues());\n }, [store]);\n\n useEffect(() => {\n const subscriptions: Array<{ unsubscribe: () => void }> = [];\n const currentAtoms = store.getAllAtomValues();\n\n Object.keys(currentAtoms).forEach((key) => {\n const subscription = store.subscribeToAtom(key as keyof TAtoms, () => {\n setAllValues(store.getAllAtomValues());\n });\n subscriptions.push(subscription);\n });\n\n return () => {\n subscriptions.forEach((sub) => sub.unsubscribe());\n };\n }, [store]);\n\n const updateAllAtoms = useCallback(\n (newAtoms: Partial<TAtoms>) => {\n store.updateAllAtoms(newAtoms);\n },\n [store]\n );\n\n return [allValues, updateAllAtoms] as const;\n };\n}\n\nexport function createUseAllAtomsValue<TAtoms extends Record<string, any>>(\n StoreContext: ReturnType<typeof createStoreContext<TAtoms>>\n) {\n const useStore = () => {\n const store = useContext(StoreContext);\n\n if (!store) {\n throw new Error(\n \"useAllAtomsValue must be used within a ContextQueryProvider\"\n );\n }\n\n return store;\n };\n\n return (): TAtoms => {\n const store = useStore();\n const [allValues, setAllValues] = useState<TAtoms>(() =>\n store.getAllAtomValues()\n );\n\n useEffect(() => {\n setAllValues(store.getAllAtomValues());\n }, [store]);\n\n useEffect(() => {\n const subscriptions: Array<{ unsubscribe: () => void }> = [];\n const currentAtoms = store.getAllAtomValues();\n\n Object.keys(currentAtoms).forEach((key) => {\n const subscription = store.subscribeToAtom(key as keyof TAtoms, () => {\n setAllValues(store.getAllAtomValues());\n });\n subscriptions.push(subscription);\n });\n\n return () => {\n subscriptions.forEach((sub) => sub.unsubscribe());\n };\n }, [store]);\n\n return allValues;\n };\n}\n\nexport function createUseUpdateAllAtoms<TAtoms extends Record<string, any>>(\n StoreContext: ReturnType<typeof createStoreContext<TAtoms>>\n) {\n const useStore = () => {\n const store = useContext(StoreContext);\n\n if (!store) {\n throw new Error(\n \"useUpdateAllAtoms must be used within a ContextQueryProvider\"\n );\n }\n\n return store;\n };\n\n return (): ((newAtoms: Partial<TAtoms>) => void) => {\n const store = useStore();\n\n return useCallback(\n (newAtoms: Partial<TAtoms>) => {\n store.updateAllAtoms(newAtoms);\n },\n [store]\n );\n };\n}\n","class t{value;listeners;constructor(t){this.value=t,this.listeners=new Set}getValue(){return this.value}setValue(t){Object.is(this.value,t)||(this.value=t,this.notifyListeners())}notifyListeners(){this.listeners.forEach((t=>t(this.value)))}subscribe(t){this.listeners.add(t);return{unsubscribe:()=>{this.listeners.delete(t)}}}}class e{atoms;constructor(e){this.atoms=new Map,Object.entries(e).forEach((([e,s])=>{this.atoms.set(e,new t(s))}))}getAtomValue(t){const e=this.atoms.get(t);if(!e)throw new Error(`Atom with key \"${String(t)}\" not found`);return e.getValue()}setAtomValue(t,e){const s=this.atoms.get(t);if(!s)throw new Error(`Atom with key \"${String(t)}\" not found`);s.setValue(e)}subscribeToAtom(t,e){const s=this.atoms.get(t);if(!s)throw new Error(`Atom with key \"${String(t)}\" not found`);return s.subscribe((s=>{e(t,s)}))}getAllAtomValues(){const t={};return this.atoms.forEach(((e,s)=>{t[s]=e.getValue()})),t}updateAllAtoms(t){Object.entries(t).forEach((([t,e])=>{const s=this.atoms.get(t);s&&s.setValue(e)}))}}export{t as AtomStore,e as ContextQueryStore};\n//# sourceMappingURL=index.mjs.map\n","import { ContextQueryStore } from \"@context-query/core\";\nimport { PropsWithChildren, useMemo } from \"react\";\nimport { createStoreContext } from \"./context\";\n\ntype AtomValues<T extends Record<string, any>> = {\n [K in keyof T]: T[K];\n};\n\nexport function createReactContextQuery<TAtoms extends Record<string, any>>() {\n const StoreContext = createStoreContext<TAtoms>();\n \n const ContextQueryProvider = function ContextQueryProvider({\n children,\n atoms,\n }: PropsWithChildren<{ atoms: AtomValues<TAtoms> }>) {\n const store = useMemo(\n () => new ContextQueryStore<TAtoms>(atoms),\n [atoms]\n );\n\n return (\n <StoreContext.Provider value={store}>{children}</StoreContext.Provider>\n );\n };\n\n return {\n ContextQueryProvider,\n StoreContext,\n };\n}\n","import type { ContextQueryStore } from \"@context-query/core\";\nimport { createContext } from \"react\";\n\nexport const createStoreContext = <TAtoms extends Record<string, any>>() => {\n return createContext<ContextQueryStore<TAtoms> | null>(null);\n};\n","import { \n createUseContextAtom, \n createUseContextAtomValue, \n createUseContextSetAtom,\n createUseStore,\n createUseAllAtoms,\n createUseAllAtomsValue,\n createUseUpdateAllAtoms\n} from \"./hooks\";\nimport { createReactContextQuery } from \"./provider\";\n\nexport function createContextQuery<TAtoms extends Record<string, any>>() {\n const { ContextQueryProvider, StoreContext } =\n createReactContextQuery<TAtoms>();\n \n const useContextAtom = createUseContextAtom<TAtoms>(StoreContext);\n const useContextAtomValue = createUseContextAtomValue<TAtoms>(StoreContext);\n const useContextSetAtom = createUseContextSetAtom<TAtoms>(StoreContext);\n const useStore = createUseStore<TAtoms>(StoreContext);\n const useAllAtoms = createUseAllAtoms<TAtoms>(StoreContext);\n const useAllAtomsValue = createUseAllAtomsValue<TAtoms>(StoreContext);\n const useUpdateAllAtoms = createUseUpdateAllAtoms<TAtoms>(StoreContext);\n \n return {\n ContextQueryProvider,\n useContextAtom,\n useContextAtomValue,\n useContextSetAtom,\n useStore,\n useAllAtoms,\n useAllAtomsValue,\n useUpdateAllAtoms,\n };\n}\n"],"names":["createUseContextAtom","StoreContext","key","store","useContext","Error","useStore","value","setValue","useState","getAtomValue","useEffect","subscription","subscribeToAtom","_","newValue","unsubscribe","useCallback","currentValue","updatedValue","setAtomValue","createUseContextAtomValue","createUseContextSetAtom","createUseAllAtoms","allValues","setAllValues","getAllAtomValues","subscriptions","currentAtoms","Object","keys","forEach","push","sub","newAtoms","updateAllAtoms","createUseAllAtomsValue","createUseUpdateAllAtoms","t","listeners","constructor","this","Set","getValue","is","notifyListeners","subscribe","add","delete","e","atoms","Map","entries","s","set","get","String","createReactContextQuery","createContext","ContextQueryProvider","children","useMemo","ContextQueryStore","_jsx","jsx","Provider","useContextAtom","useContextAtomValue","useContextSetAtom","createUseStore","useAllAtoms","useAllAtomsValue","useUpdateAllAtoms"],"mappings":"mEAkBM,SAAUA,EACdC,GAcA,OAAmCC,IACjC,MAAMC,EAbS,MACf,MAAMA,EAAQC,EAAUA,WAACH,GAEzB,IAAKE,EACH,MAAM,IAAIE,MACR,6DAIJ,OAAOF,CAAK,EAIEG,IACPC,EAAOC,GAAYC,EAAAA,UAAuB,IAC/CN,EAAMO,aAAaR,KAGrBS,EAAAA,WAAU,KACRH,EAASL,EAAMO,aAAaR,GAAK,GAChC,CAACC,EAAOD,IAEXS,EAAAA,WAAU,KACR,MAIMC,EAAeT,EAAMU,gBAAgBX,GAJtB,CAACY,EAASC,KAC7BP,EAASO,EAAS,IAKpB,MAAO,KACLH,EAAaI,aAAa,CAC3B,GACA,CAACd,EAAKC,IAeT,MAAO,CAACI,EAbQU,eACbF,IACC,MAAMG,EAAef,EAAMO,aAAaR,GAClCiB,EACgB,mBAAbJ,EACFA,EAAsBG,GACvBH,EAENZ,EAAMiB,aAAalB,EAAKiB,EAAa,GAEvC,CAACjB,EAAKC,IAGwB,CAEpC,CAEM,SAAUkB,EACdpB,GAcA,OAAmCC,IACjC,MAAMC,EAbS,MACf,MAAMA,EAAQC,EAAUA,WAACH,GAEzB,IAAKE,EACH,MAAM,IAAIE,MACR,kEAIJ,OAAOF,CAAK,EAIEG,IACPC,EAAOC,GAAYC,EAAAA,UAAuB,IAC/CN,EAAMO,aAAaR,KAmBrB,OAhBAS,EAAAA,WAAU,KACRH,EAASL,EAAMO,aAAaR,GAAK,GAChC,CAACC,EAAOD,IAEXS,EAAAA,WAAU,KACR,MAIMC,EAAeT,EAAMU,gBAAgBX,GAJtB,CAACY,EAASC,KAC7BP,EAASO,EAAS,IAKpB,MAAO,KACLH,EAAaI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DK,EJdF,SACJL,GAEA,MAAO,KACL,MAAME,EAAQC,EAAUA,WAACH,GAEzB,IAAKE,EACH,MAAM,IAAIE,MAAM,uDAGlB,OAAOF,CAAK,CAEhB,CIEmBkE,CAAuBpE,GAKxC,MAAO,CACL0D,uBACAO,iBACAC,sBACAC,oBACA9D,WACAgE,YAVkB/C,EAA0BtB,GAW5CsE,iBAVuBnC,EAA+BnC,GAWtDuE,kBAVwBnC,EAAgCpC,GAY5D","x_google_ignoreList":[1]}
package/dist/index.mjs CHANGED
@@ -1,2 +1,2 @@
1
- import{useCallback as t,useState as e,useEffect as r,useContext as o,createContext as s,useMemo as n}from"react";import{jsx as u}from"react/jsx-runtime";function i(s){return n=>{const u=(()=>{const t=o(s);if(!t)throw new Error("useContextAtom must be used within a ContextQueryProvider");return t})(),[i,c]=e((()=>u.getAtomValue(n)));r((()=>{const t=u.subscribeToAtom(n,((t,e)=>{c(e)}));return()=>{t.unsubscribe()}}),[n,u]);return[i,t((t=>{const e=u.getAtomValue(n),r="function"==typeof t?t(e):t;u.setAtomValue(n,r)}),[n,u])]}}function c(t){return s=>{const n=(()=>{const e=o(t);if(!e)throw new Error("useContextAtomValue must be used within a ContextQueryProvider");return e})(),[u,i]=e((()=>n.getAtomValue(s)));return r((()=>{const t=n.subscribeToAtom(s,((t,e)=>{i(e)}));return()=>{t.unsubscribe()}}),[s,n]),u}}function l(e){return r=>{const s=(()=>{const t=o(e);if(!t)throw new Error("useContextSetAtom must be used within a ContextQueryProvider");return t})();return t((t=>{const e=s.getAtomValue(r),o="function"==typeof t?t(e):t;s.setAtomValue(r,o)}),[r,s])}}function a(s){return()=>{const n=(()=>{const t=o(s);if(!t)throw new Error("useAllAtoms must be used within a ContextQueryProvider");return t})(),[u,i]=e((()=>n.getAllAtomValues()));r((()=>{const t=[],e=n.getAllAtomValues();return Object.keys(e).forEach((e=>{const r=n.subscribeToAtom(e,(()=>{i(n.getAllAtomValues())}));t.push(r)})),()=>{t.forEach((t=>t.unsubscribe()))}}),[n]);return[u,t((t=>{n.updateAllAtoms(t)}),[n])]}}function m(t){return()=>{const s=(()=>{const e=o(t);if(!e)throw new Error("useAllAtomsValue must be used within a ContextQueryProvider");return e})(),[n,u]=e((()=>s.getAllAtomValues()));return r((()=>{const t=[],e=s.getAllAtomValues();return Object.keys(e).forEach((e=>{const r=s.subscribeToAtom(e,(()=>{u(s.getAllAtomValues())}));t.push(r)})),()=>{t.forEach((t=>t.unsubscribe()))}}),[s]),n}}function A(e){return()=>{const r=(()=>{const t=o(e);if(!t)throw new Error("useUpdateAllAtoms must be used within a ContextQueryProvider");return t})();return t((t=>{r.updateAllAtoms(t)}),[r])}}class h{value;listeners;constructor(t){this.value=t,this.listeners=new Set}getValue(){return this.value}setValue(t){Object.is(this.value,t)||(this.value=t,this.notifyListeners())}notifyListeners(){this.listeners.forEach((t=>t(this.value)))}subscribe(t){return this.listeners.add(t),{unsubscribe:()=>{this.listeners.delete(t)}}}}class f{atoms;constructor(t){this.atoms=new Map,Object.entries(t).forEach((([t,e])=>{this.atoms.set(t,new h(e))}))}getAtomValue(t){const e=this.atoms.get(t);if(!e)throw new Error(`Atom with key "${String(t)}" not found`);return e.getValue()}setAtomValue(t,e){const r=this.atoms.get(t);if(!r)throw new Error(`Atom with key "${String(t)}" not found`);r.setValue(e)}subscribeToAtom(t,e){const r=this.atoms.get(t);if(!r)throw new Error(`Atom with key "${String(t)}" not found`);return r.subscribe((r=>{e(t,r)}))}getAllAtomValues(){const t={};return this.atoms.forEach(((e,r)=>{t[r]=e.getValue()})),t}updateAllAtoms(t){Object.entries(t).forEach((([t,e])=>{const r=this.atoms.get(t);r&&r.setValue(e)}))}}function b(){const t=s(null);return{ContextQueryProvider:function({children:e,atoms:r}){const o=n((()=>new f(r)),[r]);return u(t.Provider,{value:o,children:e})},StoreContext:t}}function w(){const{ContextQueryProvider:t,StoreContext:e}=b(),r=i(e),s=c(e),n=l(e),u=function(t){return()=>{const e=o(t);if(!e)throw new Error("useStore must be used within a ContextQueryProvider");return e}}(e);return{ContextQueryProvider:t,useContextAtom:r,useContextAtomValue:s,useContextSetAtom:n,useStore:u,useAllAtoms:a(e),useAllAtomsValue:m(e),useUpdateAllAtoms:A(e)}}export{w as createContextQuery};
1
+ import{useCallback as t,useState as e,useEffect as r,useContext as o,createContext as s,useMemo as n}from"react";import{jsx as u}from"react/jsx-runtime";function i(s){return n=>{const u=(()=>{const t=o(s);if(!t)throw new Error("useContextAtom must be used within a ContextQueryProvider");return t})(),[i,l]=e((()=>u.getAtomValue(n)));r((()=>{l(u.getAtomValue(n))}),[u,n]),r((()=>{const t=u.subscribeToAtom(n,((t,e)=>{l(e)}));return()=>{t.unsubscribe()}}),[n,u]);return[i,t((t=>{const e=u.getAtomValue(n),r="function"==typeof t?t(e):t;u.setAtomValue(n,r)}),[n,u])]}}function l(t){return s=>{const n=(()=>{const e=o(t);if(!e)throw new Error("useContextAtomValue must be used within a ContextQueryProvider");return e})(),[u,i]=e((()=>n.getAtomValue(s)));return r((()=>{i(n.getAtomValue(s))}),[n,s]),r((()=>{const t=n.subscribeToAtom(s,((t,e)=>{i(e)}));return()=>{t.unsubscribe()}}),[s,n]),u}}function c(e){return r=>{const s=(()=>{const t=o(e);if(!t)throw new Error("useContextSetAtom must be used within a ContextQueryProvider");return t})();return t((t=>{const e=s.getAtomValue(r),o="function"==typeof t?t(e):t;s.setAtomValue(r,o)}),[r,s])}}function a(s){return()=>{const n=(()=>{const t=o(s);if(!t)throw new Error("useAllAtoms must be used within a ContextQueryProvider");return t})(),[u,i]=e((()=>n.getAllAtomValues()));r((()=>{i(n.getAllAtomValues())}),[n]),r((()=>{const t=[],e=n.getAllAtomValues();return Object.keys(e).forEach((e=>{const r=n.subscribeToAtom(e,(()=>{i(n.getAllAtomValues())}));t.push(r)})),()=>{t.forEach((t=>t.unsubscribe()))}}),[n]);return[u,t((t=>{n.updateAllAtoms(t)}),[n])]}}function m(t){return()=>{const s=(()=>{const e=o(t);if(!e)throw new Error("useAllAtomsValue must be used within a ContextQueryProvider");return e})(),[n,u]=e((()=>s.getAllAtomValues()));return r((()=>{u(s.getAllAtomValues())}),[s]),r((()=>{const t=[],e=s.getAllAtomValues();return Object.keys(e).forEach((e=>{const r=s.subscribeToAtom(e,(()=>{u(s.getAllAtomValues())}));t.push(r)})),()=>{t.forEach((t=>t.unsubscribe()))}}),[s]),n}}function A(e){return()=>{const r=(()=>{const t=o(e);if(!t)throw new Error("useUpdateAllAtoms must be used within a ContextQueryProvider");return t})();return t((t=>{r.updateAllAtoms(t)}),[r])}}class h{value;listeners;constructor(t){this.value=t,this.listeners=new Set}getValue(){return this.value}setValue(t){Object.is(this.value,t)||(this.value=t,this.notifyListeners())}notifyListeners(){this.listeners.forEach((t=>t(this.value)))}subscribe(t){return this.listeners.add(t),{unsubscribe:()=>{this.listeners.delete(t)}}}}class f{atoms;constructor(t){this.atoms=new Map,Object.entries(t).forEach((([t,e])=>{this.atoms.set(t,new h(e))}))}getAtomValue(t){const e=this.atoms.get(t);if(!e)throw new Error(`Atom with key "${String(t)}" not found`);return e.getValue()}setAtomValue(t,e){const r=this.atoms.get(t);if(!r)throw new Error(`Atom with key "${String(t)}" not found`);r.setValue(e)}subscribeToAtom(t,e){const r=this.atoms.get(t);if(!r)throw new Error(`Atom with key "${String(t)}" not found`);return r.subscribe((r=>{e(t,r)}))}getAllAtomValues(){const t={};return this.atoms.forEach(((e,r)=>{t[r]=e.getValue()})),t}updateAllAtoms(t){Object.entries(t).forEach((([t,e])=>{const r=this.atoms.get(t);r&&r.setValue(e)}))}}function b(){const t=s(null);return{ContextQueryProvider:function({children:e,atoms:r}){const o=n((()=>new f(r)),[r]);return u(t.Provider,{value:o,children:e})},StoreContext:t}}function w(){const{ContextQueryProvider:t,StoreContext:e}=b(),r=i(e),s=l(e),n=c(e),u=function(t){return()=>{const e=o(t);if(!e)throw new Error("useStore must be used within a ContextQueryProvider");return e}}(e);return{ContextQueryProvider:t,useContextAtom:r,useContextAtomValue:s,useContextSetAtom:n,useStore:u,useAllAtoms:a(e),useAllAtomsValue:m(e),useUpdateAllAtoms:A(e)}}export{w as createContextQuery};
2
2
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sources":["../src/hooks.ts","../../../node_modules/.pnpm/@context-query+core@0.3.2-beta.1/node_modules/@context-query/core/dist/index.mjs","../src/provider.tsx","../src/context.ts","../src/index.ts"],"sourcesContent":["import { useCallback, useContext, useEffect, useState } from \"react\";\nimport { createStoreContext } from \"./context\";\nimport type { ContextQueryStore } from \"@context-query/core\";\n\nexport function createUseStore<TAtoms extends Record<string, any>>(\n StoreContext: ReturnType<typeof createStoreContext<TAtoms>>\n): () => ContextQueryStore<TAtoms> {\n return () => {\n const store = useContext(StoreContext);\n\n if (!store) {\n throw new Error(\n \"useStore must be used within a ContextQueryProvider\"\n );\n }\n\n return store;\n };\n}\n\nexport function createUseContextAtom<TAtoms extends Record<string, any>>(\n StoreContext: ReturnType<typeof createStoreContext<TAtoms>>\n) {\n const useStore = () => {\n const store = useContext(StoreContext);\n\n if (!store) {\n throw new Error(\n \"useContextAtom must be used within a ContextQueryProvider\"\n );\n }\n\n return store;\n };\n\n return <TKey extends keyof TAtoms>(key: TKey) => {\n const store = useStore();\n const [value, setValue] = useState<TAtoms[TKey]>(() =>\n store.getAtomValue(key)\n );\n\n useEffect(() => {\n const handleChange = (_: TKey, newValue: TAtoms[TKey]) => {\n setValue(newValue);\n };\n\n const subscription = store.subscribeToAtom(key, handleChange);\n\n return () => {\n subscription.unsubscribe();\n };\n }, [key, store]);\n\n const setAtom = useCallback(\n (newValue: TAtoms[TKey] | ((prev: TAtoms[TKey]) => TAtoms[TKey])) => {\n const currentValue = store.getAtomValue(key);\n const updatedValue =\n typeof newValue === \"function\"\n ? (newValue as Function)(currentValue)\n : newValue;\n\n store.setAtomValue(key, updatedValue);\n },\n [key, store]\n );\n\n return [value, setAtom] as const;\n };\n}\n\nexport function createUseContextAtomValue<TAtoms extends Record<string, any>>(\n StoreContext: ReturnType<typeof createStoreContext<TAtoms>>\n) {\n const useStore = () => {\n const store = useContext(StoreContext);\n\n if (!store) {\n throw new Error(\n \"useContextAtomValue must be used within a ContextQueryProvider\"\n );\n }\n\n return store;\n };\n\n return <TKey extends keyof TAtoms>(key: TKey): TAtoms[TKey] => {\n const store = useStore();\n const [value, setValue] = useState<TAtoms[TKey]>(() =>\n store.getAtomValue(key)\n );\n\n useEffect(() => {\n const handleChange = (_: TKey, newValue: TAtoms[TKey]) => {\n setValue(newValue);\n };\n\n const subscription = store.subscribeToAtom(key, handleChange);\n\n return () => {\n subscription.unsubscribe();\n };\n }, [key, store]);\n\n return value;\n };\n}\n\nexport function createUseContextSetAtom<TAtoms extends Record<string, any>>(\n StoreContext: ReturnType<typeof createStoreContext<TAtoms>>\n) {\n const useStore = () => {\n const store = useContext(StoreContext);\n\n if (!store) {\n throw new Error(\n \"useContextSetAtom must be used within a ContextQueryProvider\"\n );\n }\n\n return store;\n };\n\n return <TKey extends keyof TAtoms>(\n key: TKey\n ): ((\n value: TAtoms[TKey] | ((prev: TAtoms[TKey]) => TAtoms[TKey])\n ) => void) => {\n const store = useStore();\n\n return useCallback(\n (newValue: TAtoms[TKey] | ((prev: TAtoms[TKey]) => TAtoms[TKey])) => {\n const currentValue = store.getAtomValue(key);\n const updatedValue =\n typeof newValue === \"function\"\n ? (newValue as Function)(currentValue)\n : newValue;\n\n store.setAtomValue(key, updatedValue);\n },\n [key, store]\n );\n };\n}\n\nexport function createUseAllAtoms<TAtoms extends Record<string, any>>(\n StoreContext: ReturnType<typeof createStoreContext<TAtoms>>\n) {\n const useStore = () => {\n const store = useContext(StoreContext);\n\n if (!store) {\n throw new Error(\n \"useAllAtoms must be used within a ContextQueryProvider\"\n );\n }\n\n return store;\n };\n\n return (): [TAtoms, (newAtoms: Partial<TAtoms>) => void] => {\n const store = useStore();\n const [allValues, setAllValues] = useState<TAtoms>(() =>\n store.getAllAtomValues()\n );\n\n useEffect(() => {\n // Subscribe to all atoms by getting all keys and subscribing to each\n const subscriptions: Array<{ unsubscribe: () => void }> = [];\n const currentAtoms = store.getAllAtomValues();\n \n Object.keys(currentAtoms).forEach((key) => {\n const subscription = store.subscribeToAtom(key as keyof TAtoms, () => {\n setAllValues(store.getAllAtomValues());\n });\n subscriptions.push(subscription);\n });\n\n return () => {\n subscriptions.forEach(sub => sub.unsubscribe());\n };\n }, [store]);\n\n const updateAllAtoms = useCallback(\n (newAtoms: Partial<TAtoms>) => {\n store.updateAllAtoms(newAtoms);\n },\n [store]\n );\n\n return [allValues, updateAllAtoms] as const;\n };\n}\n\nexport function createUseAllAtomsValue<TAtoms extends Record<string, any>>(\n StoreContext: ReturnType<typeof createStoreContext<TAtoms>>\n) {\n const useStore = () => {\n const store = useContext(StoreContext);\n\n if (!store) {\n throw new Error(\n \"useAllAtomsValue must be used within a ContextQueryProvider\"\n );\n }\n\n return store;\n };\n\n return (): TAtoms => {\n const store = useStore();\n const [allValues, setAllValues] = useState<TAtoms>(() =>\n store.getAllAtomValues()\n );\n\n useEffect(() => {\n // Subscribe to all atoms by getting all keys and subscribing to each\n const subscriptions: Array<{ unsubscribe: () => void }> = [];\n const currentAtoms = store.getAllAtomValues();\n \n Object.keys(currentAtoms).forEach((key) => {\n const subscription = store.subscribeToAtom(key as keyof TAtoms, () => {\n setAllValues(store.getAllAtomValues());\n });\n subscriptions.push(subscription);\n });\n\n return () => {\n subscriptions.forEach(sub => sub.unsubscribe());\n };\n }, [store]);\n\n return allValues;\n };\n}\n\nexport function createUseUpdateAllAtoms<TAtoms extends Record<string, any>>(\n StoreContext: ReturnType<typeof createStoreContext<TAtoms>>\n) {\n const useStore = () => {\n const store = useContext(StoreContext);\n\n if (!store) {\n throw new Error(\n \"useUpdateAllAtoms must be used within a ContextQueryProvider\"\n );\n }\n\n return store;\n };\n\n return (): ((newAtoms: Partial<TAtoms>) => void) => {\n const store = useStore();\n\n return useCallback(\n (newAtoms: Partial<TAtoms>) => {\n store.updateAllAtoms(newAtoms);\n },\n [store]\n );\n };\n}\n","class t{value;listeners;constructor(t){this.value=t,this.listeners=new Set}getValue(){return this.value}setValue(t){Object.is(this.value,t)||(this.value=t,this.notifyListeners())}notifyListeners(){this.listeners.forEach((t=>t(this.value)))}subscribe(t){this.listeners.add(t);return{unsubscribe:()=>{this.listeners.delete(t)}}}}class e{atoms;constructor(e){this.atoms=new Map,Object.entries(e).forEach((([e,s])=>{this.atoms.set(e,new t(s))}))}getAtomValue(t){const e=this.atoms.get(t);if(!e)throw new Error(`Atom with key \"${String(t)}\" not found`);return e.getValue()}setAtomValue(t,e){const s=this.atoms.get(t);if(!s)throw new Error(`Atom with key \"${String(t)}\" not found`);s.setValue(e)}subscribeToAtom(t,e){const s=this.atoms.get(t);if(!s)throw new Error(`Atom with key \"${String(t)}\" not found`);return s.subscribe((s=>{e(t,s)}))}getAllAtomValues(){const t={};return this.atoms.forEach(((e,s)=>{t[s]=e.getValue()})),t}updateAllAtoms(t){Object.entries(t).forEach((([t,e])=>{const s=this.atoms.get(t);s&&s.setValue(e)}))}}export{t as AtomStore,e as ContextQueryStore};\n//# sourceMappingURL=index.mjs.map\n","import { ContextQueryStore } from \"@context-query/core\";\nimport { PropsWithChildren, useMemo } from \"react\";\nimport { createStoreContext } from \"./context\";\n\ntype AtomValues<T extends Record<string, any>> = {\n [K in keyof T]: T[K];\n};\n\nexport function createReactContextQuery<TAtoms extends Record<string, any>>() {\n const StoreContext = createStoreContext<TAtoms>();\n \n const ContextQueryProvider = function ContextQueryProvider({\n children,\n atoms,\n }: PropsWithChildren<{ atoms: AtomValues<TAtoms> }>) {\n const store = useMemo(\n () => new ContextQueryStore<TAtoms>(atoms),\n [atoms]\n );\n\n return (\n <StoreContext.Provider value={store}>{children}</StoreContext.Provider>\n );\n };\n\n return {\n ContextQueryProvider,\n StoreContext,\n };\n}\n","import type { ContextQueryStore } from \"@context-query/core\";\nimport { createContext } from \"react\";\n\nexport const createStoreContext = <TAtoms extends Record<string, any>>() => {\n return createContext<ContextQueryStore<TAtoms> | null>(null);\n};\n","import { \n createUseContextAtom, \n createUseContextAtomValue, \n createUseContextSetAtom,\n createUseStore,\n createUseAllAtoms,\n createUseAllAtomsValue,\n createUseUpdateAllAtoms\n} from \"./hooks\";\nimport { createReactContextQuery } from \"./provider\";\n\nexport function createContextQuery<TAtoms extends Record<string, any>>() {\n const { ContextQueryProvider, StoreContext } =\n createReactContextQuery<TAtoms>();\n \n const useContextAtom = createUseContextAtom<TAtoms>(StoreContext);\n const useContextAtomValue = createUseContextAtomValue<TAtoms>(StoreContext);\n const useContextSetAtom = createUseContextSetAtom<TAtoms>(StoreContext);\n const useStore = createUseStore<TAtoms>(StoreContext);\n const useAllAtoms = createUseAllAtoms<TAtoms>(StoreContext);\n const useAllAtomsValue = createUseAllAtomsValue<TAtoms>(StoreContext);\n const useUpdateAllAtoms = createUseUpdateAllAtoms<TAtoms>(StoreContext);\n \n return {\n ContextQueryProvider,\n useContextAtom,\n useContextAtomValue,\n useContextSetAtom,\n useStore,\n useAllAtoms,\n useAllAtomsValue,\n useUpdateAllAtoms,\n };\n}\n"],"names":["createUseContextAtom","StoreContext","key","store","useContext","Error","useStore","value","setValue","useState","getAtomValue","useEffect","subscription","subscribeToAtom","_","newValue","unsubscribe","useCallback","currentValue","updatedValue","setAtomValue","createUseContextAtomValue","createUseContextSetAtom","createUseAllAtoms","allValues","setAllValues","getAllAtomValues","subscriptions","currentAtoms","Object","keys","forEach","push","sub","newAtoms","updateAllAtoms","createUseAllAtomsValue","createUseUpdateAllAtoms","t","listeners","constructor","this","Set","getValue","is","notifyListeners","subscribe","add","delete","e","atoms","Map","entries","s","set","get","String","createReactContextQuery","createContext","ContextQueryProvider","children","useMemo","ContextQueryStore","_jsx","Provider","createContextQuery","useContextAtom","useContextAtomValue","useContextSetAtom","createUseStore","useAllAtoms","useAllAtomsValue","useUpdateAllAtoms"],"mappings":"yJAoBM,SAAUA,EACdC,GAcA,OAAmCC,IACjC,MAAMC,EAbS,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J,EAAEN,UAAW,IAAGL,CAAC,CAAC,cAAAH,CAAeG,GAAGT,OAAOuB,QAAQd,GAAGP,SAAS,EAAEO,EAAEW,MAAM,MAAMI,EAAEZ,KAAKS,MAAMK,IAAIjB,GAAGe,GAAGA,EAAE7C,SAASyC,EAAG,GAAE,WCQ/+BQ,IACd,MAAMxD,ECLCyD,EAAgD,MDqBvD,MAAO,CACLC,qBAf2B,UAA8BC,SACzDA,EAAQV,MACRA,IAEA,MAAM/C,EAAQ0D,GACZ,IAAM,IAAIC,EAA0BZ,IACpC,CAACA,IAGH,OACEa,EAAC9D,EAAa+D,SAAQ,CAACzD,MAAOJ,EAAKyD,SAAGA,GAEzC,EAIC3D,eAEJ,UElBgBgE,IACd,MAAMN,qBAAEA,EAAoB1D,aAAEA,GAC5BwD,IAEIS,EAAiBlE,EAA6BC,GAC9CkE,EAAsB9C,EAAkCpB,GACxDmE,EAAoB9C,EAAgCrB,GACpDK,EJdF,SACJL,GAEA,MAAO,KACL,MAAME,EAAQC,EAAWH,GAEzB,IAAKE,EACH,MAAM,IAAIE,MACR,uDAIJ,OAAOF,CAAK,CAEhB,CIAmBkE,CAAuBpE,GAKxC,MAAO,CACL0D,uBACAO,iBACAC,sBACAC,oBACA9D,WACAgE,YAVkB/C,EAA0BtB,GAW5CsE,iBAVuBnC,EAA+BnC,GAWtDuE,kBAVwBnC,EAAgCpC,GAY5D","x_google_ignoreList":[1]}
1
+ {"version":3,"file":"index.mjs","sources":["../src/hooks.ts","../../../node_modules/.pnpm/@context-query+core@0.3.2-beta.1/node_modules/@context-query/core/dist/index.mjs","../src/provider.tsx","../src/context.ts","../src/index.ts"],"sourcesContent":["import type { ContextQueryStore } from \"@context-query/core\";\nimport { useCallback, useContext, useEffect, useState } from \"react\";\nimport { createStoreContext } from \"./context\";\n\nexport function createUseStore<TAtoms extends Record<string, any>>(\n StoreContext: ReturnType<typeof createStoreContext<TAtoms>>\n): () => ContextQueryStore<TAtoms> {\n return () => {\n const store = useContext(StoreContext);\n\n if (!store) {\n throw new Error(\"useStore must be used within a ContextQueryProvider\");\n }\n\n return store;\n };\n}\n\nexport function createUseContextAtom<TAtoms extends Record<string, any>>(\n StoreContext: ReturnType<typeof createStoreContext<TAtoms>>\n) {\n const useStore = () => {\n const store = useContext(StoreContext);\n\n if (!store) {\n throw new Error(\n \"useContextAtom must be used within a ContextQueryProvider\"\n );\n }\n\n return store;\n };\n\n return <TKey extends keyof TAtoms>(key: TKey) => {\n const store = useStore();\n const [value, setValue] = useState<TAtoms[TKey]>(() =>\n store.getAtomValue(key)\n );\n\n useEffect(() => {\n setValue(store.getAtomValue(key));\n }, [store, key]);\n\n useEffect(() => {\n const handleChange = (_: TKey, newValue: TAtoms[TKey]) => {\n setValue(newValue);\n };\n\n const subscription = store.subscribeToAtom(key, handleChange);\n\n return () => {\n subscription.unsubscribe();\n };\n }, [key, store]);\n\n const setAtom = useCallback(\n (newValue: TAtoms[TKey] | ((prev: TAtoms[TKey]) => TAtoms[TKey])) => {\n const currentValue = store.getAtomValue(key);\n const updatedValue =\n typeof newValue === \"function\"\n ? (newValue as Function)(currentValue)\n : newValue;\n\n store.setAtomValue(key, updatedValue);\n },\n [key, store]\n );\n\n return [value, setAtom] as const;\n };\n}\n\nexport function createUseContextAtomValue<TAtoms extends Record<string, any>>(\n StoreContext: ReturnType<typeof createStoreContext<TAtoms>>\n) {\n const useStore = () => {\n const store = useContext(StoreContext);\n\n if (!store) {\n throw new Error(\n \"useContextAtomValue must be used within a ContextQueryProvider\"\n );\n }\n\n return store;\n };\n\n return <TKey extends keyof TAtoms>(key: TKey): TAtoms[TKey] => {\n const store = useStore();\n const [value, setValue] = useState<TAtoms[TKey]>(() =>\n store.getAtomValue(key)\n );\n\n useEffect(() => {\n setValue(store.getAtomValue(key));\n }, [store, key]);\n\n useEffect(() => {\n const handleChange = (_: TKey, newValue: TAtoms[TKey]) => {\n setValue(newValue);\n };\n\n const subscription = store.subscribeToAtom(key, handleChange);\n\n return () => {\n subscription.unsubscribe();\n };\n }, [key, store]);\n\n return value;\n };\n}\n\nexport function createUseContextSetAtom<TAtoms extends Record<string, any>>(\n StoreContext: ReturnType<typeof createStoreContext<TAtoms>>\n) {\n const useStore = () => {\n const store = useContext(StoreContext);\n\n if (!store) {\n throw new Error(\n \"useContextSetAtom must be used within a ContextQueryProvider\"\n );\n }\n\n return store;\n };\n\n return <TKey extends keyof TAtoms>(\n key: TKey\n ): ((\n value: TAtoms[TKey] | ((prev: TAtoms[TKey]) => TAtoms[TKey])\n ) => void) => {\n const store = useStore();\n\n return useCallback(\n (newValue: TAtoms[TKey] | ((prev: TAtoms[TKey]) => TAtoms[TKey])) => {\n const currentValue = store.getAtomValue(key);\n const updatedValue =\n typeof newValue === \"function\"\n ? (newValue as Function)(currentValue)\n : newValue;\n\n store.setAtomValue(key, updatedValue);\n },\n [key, store]\n );\n };\n}\n\nexport function createUseAllAtoms<TAtoms extends Record<string, any>>(\n StoreContext: ReturnType<typeof createStoreContext<TAtoms>>\n) {\n const useStore = () => {\n const store = useContext(StoreContext);\n\n if (!store) {\n throw new Error(\"useAllAtoms must be used within a ContextQueryProvider\");\n }\n\n return store;\n };\n\n return (): [TAtoms, (newAtoms: Partial<TAtoms>) => void] => {\n const store = useStore();\n const [allValues, setAllValues] = useState<TAtoms>(() =>\n store.getAllAtomValues()\n );\n\n useEffect(() => {\n setAllValues(store.getAllAtomValues());\n }, [store]);\n\n useEffect(() => {\n const subscriptions: Array<{ unsubscribe: () => void }> = [];\n const currentAtoms = store.getAllAtomValues();\n\n Object.keys(currentAtoms).forEach((key) => {\n const subscription = store.subscribeToAtom(key as keyof TAtoms, () => {\n setAllValues(store.getAllAtomValues());\n });\n subscriptions.push(subscription);\n });\n\n return () => {\n subscriptions.forEach((sub) => sub.unsubscribe());\n };\n }, [store]);\n\n const updateAllAtoms = useCallback(\n (newAtoms: Partial<TAtoms>) => {\n store.updateAllAtoms(newAtoms);\n },\n [store]\n );\n\n return [allValues, updateAllAtoms] as const;\n };\n}\n\nexport function createUseAllAtomsValue<TAtoms extends Record<string, any>>(\n StoreContext: ReturnType<typeof createStoreContext<TAtoms>>\n) {\n const useStore = () => {\n const store = useContext(StoreContext);\n\n if (!store) {\n throw new Error(\n \"useAllAtomsValue must be used within a ContextQueryProvider\"\n );\n }\n\n return store;\n };\n\n return (): TAtoms => {\n const store = useStore();\n const [allValues, setAllValues] = useState<TAtoms>(() =>\n store.getAllAtomValues()\n );\n\n useEffect(() => {\n setAllValues(store.getAllAtomValues());\n }, [store]);\n\n useEffect(() => {\n const subscriptions: Array<{ unsubscribe: () => void }> = [];\n const currentAtoms = store.getAllAtomValues();\n\n Object.keys(currentAtoms).forEach((key) => {\n const subscription = store.subscribeToAtom(key as keyof TAtoms, () => {\n setAllValues(store.getAllAtomValues());\n });\n subscriptions.push(subscription);\n });\n\n return () => {\n subscriptions.forEach((sub) => sub.unsubscribe());\n };\n }, [store]);\n\n return allValues;\n };\n}\n\nexport function createUseUpdateAllAtoms<TAtoms extends Record<string, any>>(\n StoreContext: ReturnType<typeof createStoreContext<TAtoms>>\n) {\n const useStore = () => {\n const store = useContext(StoreContext);\n\n if (!store) {\n throw new Error(\n \"useUpdateAllAtoms must be used within a ContextQueryProvider\"\n );\n }\n\n return store;\n };\n\n return (): ((newAtoms: Partial<TAtoms>) => void) => {\n const store = useStore();\n\n return useCallback(\n (newAtoms: Partial<TAtoms>) => {\n store.updateAllAtoms(newAtoms);\n },\n [store]\n );\n };\n}\n","class t{value;listeners;constructor(t){this.value=t,this.listeners=new Set}getValue(){return this.value}setValue(t){Object.is(this.value,t)||(this.value=t,this.notifyListeners())}notifyListeners(){this.listeners.forEach((t=>t(this.value)))}subscribe(t){this.listeners.add(t);return{unsubscribe:()=>{this.listeners.delete(t)}}}}class e{atoms;constructor(e){this.atoms=new Map,Object.entries(e).forEach((([e,s])=>{this.atoms.set(e,new t(s))}))}getAtomValue(t){const e=this.atoms.get(t);if(!e)throw new Error(`Atom with key \"${String(t)}\" not found`);return e.getValue()}setAtomValue(t,e){const s=this.atoms.get(t);if(!s)throw new Error(`Atom with key \"${String(t)}\" not found`);s.setValue(e)}subscribeToAtom(t,e){const s=this.atoms.get(t);if(!s)throw new Error(`Atom with key \"${String(t)}\" not found`);return s.subscribe((s=>{e(t,s)}))}getAllAtomValues(){const t={};return this.atoms.forEach(((e,s)=>{t[s]=e.getValue()})),t}updateAllAtoms(t){Object.entries(t).forEach((([t,e])=>{const s=this.atoms.get(t);s&&s.setValue(e)}))}}export{t as AtomStore,e as ContextQueryStore};\n//# sourceMappingURL=index.mjs.map\n","import { ContextQueryStore } from \"@context-query/core\";\nimport { PropsWithChildren, useMemo } from \"react\";\nimport { createStoreContext } from \"./context\";\n\ntype AtomValues<T extends Record<string, any>> = {\n [K in keyof T]: T[K];\n};\n\nexport function createReactContextQuery<TAtoms extends Record<string, any>>() {\n const StoreContext = createStoreContext<TAtoms>();\n \n const ContextQueryProvider = function ContextQueryProvider({\n children,\n atoms,\n }: PropsWithChildren<{ atoms: AtomValues<TAtoms> }>) {\n const store = useMemo(\n () => new ContextQueryStore<TAtoms>(atoms),\n [atoms]\n );\n\n return (\n <StoreContext.Provider value={store}>{children}</StoreContext.Provider>\n );\n };\n\n return {\n ContextQueryProvider,\n StoreContext,\n };\n}\n","import type { ContextQueryStore } from \"@context-query/core\";\nimport { createContext } from \"react\";\n\nexport const createStoreContext = <TAtoms extends Record<string, any>>() => {\n return createContext<ContextQueryStore<TAtoms> | null>(null);\n};\n","import { \n createUseContextAtom, \n createUseContextAtomValue, \n createUseContextSetAtom,\n createUseStore,\n createUseAllAtoms,\n createUseAllAtomsValue,\n createUseUpdateAllAtoms\n} from \"./hooks\";\nimport { createReactContextQuery } from \"./provider\";\n\nexport function createContextQuery<TAtoms extends Record<string, any>>() {\n const { ContextQueryProvider, StoreContext } =\n createReactContextQuery<TAtoms>();\n \n const useContextAtom = createUseContextAtom<TAtoms>(StoreContext);\n const useContextAtomValue = createUseContextAtomValue<TAtoms>(StoreContext);\n const useContextSetAtom = createUseContextSetAtom<TAtoms>(StoreContext);\n const useStore = createUseStore<TAtoms>(StoreContext);\n const useAllAtoms = createUseAllAtoms<TAtoms>(StoreContext);\n const useAllAtomsValue = createUseAllAtomsValue<TAtoms>(StoreContext);\n const useUpdateAllAtoms = createUseUpdateAllAtoms<TAtoms>(StoreContext);\n \n return {\n ContextQueryProvider,\n useContextAtom,\n useContextAtomValue,\n useContextSetAtom,\n useStore,\n useAllAtoms,\n useAllAtomsValue,\n useUpdateAllAtoms,\n };\n}\n"],"names":["createUseContextAtom","StoreContext","key","store","useContext","Error","useStore","value","setValue","useState","getAtomValue","useEffect","subscription","subscribeToAtom","_","newValue","unsubscribe","useCallback","currentValue","updatedValue","setAtomValue","createUseContextAtomValue","createUseContextSetAtom","createUseAllAtoms","allValues","setAllValues","getAllAtomValues","subscriptions","currentAtoms","Object","keys","forEach","push","sub","newAtoms","updateAllAtoms","createUseAllAtomsValue","createUseUpdateAllAtoms","t","listeners","constructor","this","Set","getValue","is","notifyListeners","subscribe","add","delete","e","atoms","Map","entries","s","set","get","String","createReactContextQuery","createContext","ContextQueryProvider","children","useMemo","ContextQueryStore","_jsx","Provider","createContextQuery","useContextAtom","useContextAtomValue","useContextSetAtom","createUseStore","useAllAtoms","useAllAtomsValue","useUpdateAllAtoms"],"mappings":"yJAkBM,SAAUA,EACdC,GAcA,OAAmCC,IACjC,MAAMC,EAbS,MACf,MAAMA,EAAQC,EAAWH,GAEzB,IAAKE,EACH,MAAM,IAAIE,MACR,6DAIJ,OAAOF,CAAK,EAIEG,IACPC,EAAOC,GAAYC,GAAuB,IAC/CN,EAAMO,aAAaR,KAGrBS,GAAU,KACRH,EAASL,EAAMO,aAAaR,GAAK,GAChC,CAACC,EAAOD,IAEXS,GAAU,KACR,MAIMC,EAAeT,EAAMU,gBAAgBX,GAJtB,CAACY,EAASC,KAC7BP,EAASO,EAAS,IAKpB,MAAO,KACLH,EAAaI,aAAa,CAC3B,GACA,CAACd,EAA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,MAAMI,EAAEZ,KAAKS,MAAMK,IAAIjB,GAAGe,GAAGA,EAAE7C,SAASyC,EAAG,GAAE,WCQ/+BQ,IACd,MAAMxD,ECLCyD,EAAgD,MDqBvD,MAAO,CACLC,qBAf2B,UAA8BC,SACzDA,EAAQV,MACRA,IAEA,MAAM/C,EAAQ0D,GACZ,IAAM,IAAIC,EAA0BZ,IACpC,CAACA,IAGH,OACEa,EAAC9D,EAAa+D,SAAQ,CAACzD,MAAOJ,EAAKyD,SAAGA,GAEzC,EAIC3D,eAEJ,UElBgBgE,IACd,MAAMN,qBAAEA,EAAoB1D,aAAEA,GAC5BwD,IAEIS,EAAiBlE,EAA6BC,GAC9CkE,EAAsB9C,EAAkCpB,GACxDmE,EAAoB9C,EAAgCrB,GACpDK,EJdF,SACJL,GAEA,MAAO,KACL,MAAME,EAAQC,EAAWH,GAEzB,IAAKE,EACH,MAAM,IAAIE,MAAM,uDAGlB,OAAOF,CAAK,CAEhB,CIEmBkE,CAAuBpE,GAKxC,MAAO,CACL0D,uBACAO,iBACAC,sBACAC,oBACA9D,WACAgE,YAVkB/C,EAA0BtB,GAW5CsE,iBAVuBnC,EAA+BnC,GAWtDuE,kBAVwBnC,EAAgCpC,GAY5D","x_google_ignoreList":[1]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@context-query/react",
3
- "version": "0.3.2-beta.3",
3
+ "version": "0.3.2-beta.4",
4
4
  "license": "MIT",
5
5
  "description": "React bindings for ContextQuery",
6
6
  "author": "Minyeoung Seo <tjalsdud89@naver.com>",