@context-query/react 0.2.2-beta.2 → 0.2.2
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/index.cjs.map +1 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../src/hooks.ts","../../../node_modules/.pnpm/@context-query+core@0.3.2-beta.2/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, useSyncExternalStore } from \"react\";\nimport { createStoreContext } from \"./context\";\n\nfunction createUseStoreInternal<TAtoms extends Record<string, any>>(\n StoreContext: ReturnType<typeof createStoreContext<TAtoms>>,\n hookName: string\n): () => ContextQueryStore<TAtoms> {\n return () => {\n const store = useContext(StoreContext);\n\n if (!store) {\n throw new Error(`${hookName} must be used within a ContextQueryProvider`);\n }\n\n return store;\n };\n}\n\nexport function createUseStore<TAtoms extends Record<string, any>>(\n StoreContext: ReturnType<typeof createStoreContext<TAtoms>>\n): () => ContextQueryStore<TAtoms> {\n return createUseStoreInternal(StoreContext, \"useStore\");\n}\n\nexport function createUseContextAtom<TAtoms extends Record<string, any>>(\n StoreContext: ReturnType<typeof createStoreContext<TAtoms>>\n) {\n const useStore = createUseStoreInternal(StoreContext, \"useContextAtom\");\n\n return <TKey extends keyof TAtoms>(key: TKey) => {\n const store = useStore();\n\n const value = useSyncExternalStore(\n useCallback(\n (onStoreChange: () => void) => {\n const subscription = store.subscribeToAtom(key, onStoreChange);\n return () => subscription.unsubscribe();\n },\n [store, key]\n ),\n useCallback(() => store.getAtomValue(key), [store, key]),\n useCallback(() => store.getAtomValue(key), [store, key])\n );\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 = createUseStoreInternal(StoreContext, \"useContextAtomValue\");\n\n return <TKey extends keyof TAtoms>(key: TKey): TAtoms[TKey] => {\n const store = useStore();\n\n return useSyncExternalStore(\n useCallback(\n (onStoreChange: () => void) => {\n const subscription = store.subscribeToAtom(key, onStoreChange);\n return () => subscription.unsubscribe();\n },\n [store, key]\n ),\n useCallback(() => store.getAtomValue(key), [store, key]),\n useCallback(() => store.getAtomValue(key), [store, key])\n );\n };\n}\n\nexport function createUseContextSetAtom<TAtoms extends Record<string, any>>(\n StoreContext: ReturnType<typeof createStoreContext<TAtoms>>\n) {\n const useStore = createUseStoreInternal(StoreContext, \"useContextSetAtom\");\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 = createUseStoreInternal(StoreContext, \"useAllAtoms\");\n\n return (): [TAtoms, (newAtoms: Partial<TAtoms>) => void] => {\n const store = useStore();\n\n const subscribe = useCallback(\n (onStoreChange: () => void) => {\n const currentAtoms = store.getAllAtomValues();\n const subscriptions = Object.keys(currentAtoms).map((key) =>\n store.subscribeToAtom(key as keyof TAtoms, onStoreChange)\n );\n\n return () => {\n subscriptions.forEach((sub) => sub.unsubscribe());\n };\n },\n [store]\n );\n\n const getSnapshot = useCallback(() => store.getAllAtomValues(), [store]);\n\n const allValues = useSyncExternalStore(subscribe, getSnapshot, getSnapshot);\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 = createUseStoreInternal(StoreContext, \"useAllAtomsValue\");\n\n return (): TAtoms => {\n const store = useStore();\n\n const subscribe = useCallback(\n (onStoreChange: () => void) => {\n const currentAtoms = store.getAllAtomValues();\n const subscriptions = Object.keys(currentAtoms).map((key) =>\n store.subscribeToAtom(key as keyof TAtoms, onStoreChange)\n );\n\n return () => {\n subscriptions.forEach((sub) => sub.unsubscribe());\n };\n },\n [store]\n );\n\n const getSnapshot = useCallback(() => store.getAllAtomValues(), [store]);\n\n return useSyncExternalStore(subscribe, getSnapshot, getSnapshot);\n };\n}\n\nexport function createUseUpdateAllAtoms<TAtoms extends Record<string, any>>(\n StoreContext: ReturnType<typeof createStoreContext<TAtoms>>\n) {\n const useStore = createUseStoreInternal(StoreContext, \"useUpdateAllAtoms\");\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()))}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(e)}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":["createUseStoreInternal","StoreContext","hookName","store","useContext","Error","t","value","listeners","constructor","this","Set","getValue","setValue","Object","is","notifyListeners","forEach","subscribe","add","unsubscribe","delete","e","atoms","Map","entries","s","set","getAtomValue","get","String","setAtomValue","subscribeToAtom","getAllAtomValues","updateAllAtoms","createReactContextQuery","createContext","ContextQueryProvider","children","useMemo","ContextQueryStore","_jsx","jsx","Provider","useContextAtom","useStore","key","useSyncExternalStore","useCallback","onStoreChange","subscription","newValue","currentValue","updatedValue","createUseContextAtom","useContextAtomValue","createUseContextAtomValue","useContextSetAtom","createUseContextSetAtom","createUseStore","useAllAtoms","currentAtoms","subscriptions","keys","map","sub","getSnapshot","newAtoms","createUseAllAtoms","useAllAtomsValue","createUseAllAtomsValue","useUpdateAllAtoms","createUseUpdateAllAtoms"],"mappings":"mEAIA,SAASA,EACPC,EACAC,GAEA,MAAO,KACL,MAAMC,EAAQC,EAAUA,WAACH,GAEzB,IAAKE,EACH,MAAM,IAAIE,MAAM,GAAGH,gDAGrB,OAAOC,CAAK,CAEhB,CCjBA,MAAMG,EAAEC,MAAMC,UAAU,WAAAC,CAAYH,GAAGI,KAAKH,MAAMD,EAAEI,KAAKF,UAAU,IAAIG,GAAG,CAAC,QAAAC,GAAW,OAAOF,KAAKH,KAAK,CAAC,QAAAM,CAASP,GAAGQ,OAAOC,GA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EAAclB,EAAAA,aAAY,IAAM7C,EAAM8B,oBAAoB,CAAC9B,IAEjE,OAAO4C,uBAAqB7B,EAAWgD,EAAaA,EAAY,CAEpE,CI1J2BI,CAA+BrE,GAClDsE,EJ2JF,SACJtE,GAEA,MAAM4C,EAAW7C,EAAuBC,EAAc,qBAEtD,MAAO,KACL,MAAME,EAAQ0C,IAEd,OAAOG,EAAAA,aACJmB,IACChE,EAAM+B,eAAeiC,EAAS,GAEhC,CAAChE,GACF,CAEL,CI1K4BqE,CAAgCvE,GAE1D,MAAO,CACLoC,uBACAO,iBACAW,sBACAE,oBACAZ,WACAe,cACAS,mBACAE,oBAEJ","x_google_ignoreList":[1]}
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../src/hooks.ts","../../../node_modules/.pnpm/@context-query+core@0.3.2/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, useSyncExternalStore } from \"react\";\nimport { createStoreContext } from \"./context\";\n\nfunction createUseStoreInternal<TAtoms extends Record<string, any>>(\n StoreContext: ReturnType<typeof createStoreContext<TAtoms>>,\n hookName: string\n): () => ContextQueryStore<TAtoms> {\n return () => {\n const store = useContext(StoreContext);\n\n if (!store) {\n throw new Error(`${hookName} must be used within a ContextQueryProvider`);\n }\n\n return store;\n };\n}\n\nexport function createUseStore<TAtoms extends Record<string, any>>(\n StoreContext: ReturnType<typeof createStoreContext<TAtoms>>\n): () => ContextQueryStore<TAtoms> {\n return createUseStoreInternal(StoreContext, \"useStore\");\n}\n\nexport function createUseContextAtom<TAtoms extends Record<string, any>>(\n StoreContext: ReturnType<typeof createStoreContext<TAtoms>>\n) {\n const useStore = createUseStoreInternal(StoreContext, \"useContextAtom\");\n\n return <TKey extends keyof TAtoms>(key: TKey) => {\n const store = useStore();\n\n const value = useSyncExternalStore(\n useCallback(\n (onStoreChange: () => void) => {\n const subscription = store.subscribeToAtom(key, onStoreChange);\n return () => subscription.unsubscribe();\n },\n [store, key]\n ),\n useCallback(() => store.getAtomValue(key), [store, key]),\n useCallback(() => store.getAtomValue(key), [store, key])\n );\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 = createUseStoreInternal(StoreContext, \"useContextAtomValue\");\n\n return <TKey extends keyof TAtoms>(key: TKey): TAtoms[TKey] => {\n const store = useStore();\n\n return useSyncExternalStore(\n useCallback(\n (onStoreChange: () => void) => {\n const subscription = store.subscribeToAtom(key, onStoreChange);\n return () => subscription.unsubscribe();\n },\n [store, key]\n ),\n useCallback(() => store.getAtomValue(key), [store, key]),\n useCallback(() => store.getAtomValue(key), [store, key])\n );\n };\n}\n\nexport function createUseContextSetAtom<TAtoms extends Record<string, any>>(\n StoreContext: ReturnType<typeof createStoreContext<TAtoms>>\n) {\n const useStore = createUseStoreInternal(StoreContext, \"useContextSetAtom\");\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 = createUseStoreInternal(StoreContext, \"useAllAtoms\");\n\n return (): [TAtoms, (newAtoms: Partial<TAtoms>) => void] => {\n const store = useStore();\n\n const subscribe = useCallback(\n (onStoreChange: () => void) => {\n const currentAtoms = store.getAllAtomValues();\n const subscriptions = Object.keys(currentAtoms).map((key) =>\n store.subscribeToAtom(key as keyof TAtoms, onStoreChange)\n );\n\n return () => {\n subscriptions.forEach((sub) => sub.unsubscribe());\n };\n },\n [store]\n );\n\n const getSnapshot = useCallback(() => store.getAllAtomValues(), [store]);\n\n const allValues = useSyncExternalStore(subscribe, getSnapshot, getSnapshot);\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 = createUseStoreInternal(StoreContext, \"useAllAtomsValue\");\n\n return (): TAtoms => {\n const store = useStore();\n\n const subscribe = useCallback(\n (onStoreChange: () => void) => {\n const currentAtoms = store.getAllAtomValues();\n const subscriptions = Object.keys(currentAtoms).map((key) =>\n store.subscribeToAtom(key as keyof TAtoms, onStoreChange)\n );\n\n return () => {\n subscriptions.forEach((sub) => sub.unsubscribe());\n };\n },\n [store]\n );\n\n const getSnapshot = useCallback(() => store.getAllAtomValues(), [store]);\n\n return useSyncExternalStore(subscribe, getSnapshot, getSnapshot);\n };\n}\n\nexport function createUseUpdateAllAtoms<TAtoms extends Record<string, any>>(\n StoreContext: ReturnType<typeof createStoreContext<TAtoms>>\n) {\n const useStore = createUseStoreInternal(StoreContext, \"useUpdateAllAtoms\");\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()))}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(e)}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":["createUseStoreInternal","StoreContext","hookName","store","useContext","Error","t","value","listeners","constructor","this","Set","getValue","setValue","Object","is","notifyListeners","forEach","subscribe","add","unsubscribe","delete","e","atoms","Map","entries","s","set","getAtomValue","get","String","setAtomValue","subscribeToAtom","getAllAtomValues","updateAllAtoms","createReactContextQuery","createContext","ContextQueryProvider","children","useMemo","ContextQueryStore","_jsx","jsx","Provider","useContextAtom","useStore","key","useSyncExternalStore","useCallback","onStoreChange","subscription","newValue","currentValue","updatedValue","createUseContextAtom","useContextAtomValue","createUseContextAtomValue","useContextSetAtom","createUseContextSetAtom","createUseStore","useAllAtoms","currentAtoms","subscriptions","keys","map","sub","getSnapshot","newAtoms","createUseAllAtoms","useAllAtomsValue","createUseAllAtomsValue","useUpdateAllAtoms","createUseUpdateAllAtoms"],"mappings":"mEAIA,SAASA,EACPC,EACAC,GAEA,MAAO,KACL,MAAMC,EAAQC,EAAUA,WAACH,GAEzB,IAAKE,EACH,MAAM,IAAIE,MAAM,GAAGH,gDAGrB,O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C,IACC,MAAMY,EAAe1D,EAAM8B,mBACrB6B,EAAgBhD,OAAOiD,KAAKF,GAAcG,KAAKlB,GACnD3C,EAAM6B,gBAAgBc,EAAqBG,KAG7C,MAAO,KACLa,EAAc7C,SAASgD,GAAQA,EAAI7C,eAAc,CAClD,GAEH,CAACjB,IAGG+D,EAAclB,EAAAA,aAAY,IAAM7C,EAAM8B,oBAAoB,CAAC9B,IAEjE,OAAO4C,uBAAqB7B,EAAWgD,EAAaA,EAAY,CAEpE,CI1J2BI,CAA+BrE,GAClDsE,EJ2JF,SACJtE,GAEA,MAAM4C,EAAW7C,EAAuBC,EAAc,qBAEtD,MAAO,KACL,MAAME,EAAQ0C,IAEd,OAAOG,EAAAA,aACJmB,IACChE,EAAM+B,eAAeiC,EAAS,GAEhC,CAAChE,GACF,CAEL,CI1K4BqE,CAAgCvE,GAE1D,MAAO,CACLoC,uBACAO,iBACAW,sBACAE,oBACAZ,WACAe,cACAS,mBACAE,oBAEJ","x_google_ignoreList":[1]}
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":["../src/hooks.ts","../../../node_modules/.pnpm/@context-query+core@0.3.2-beta.2/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, useSyncExternalStore } from \"react\";\nimport { createStoreContext } from \"./context\";\n\nfunction createUseStoreInternal<TAtoms extends Record<string, any>>(\n StoreContext: ReturnType<typeof createStoreContext<TAtoms>>,\n hookName: string\n): () => ContextQueryStore<TAtoms> {\n return () => {\n const store = useContext(StoreContext);\n\n if (!store) {\n throw new Error(`${hookName} must be used within a ContextQueryProvider`);\n }\n\n return store;\n };\n}\n\nexport function createUseStore<TAtoms extends Record<string, any>>(\n StoreContext: ReturnType<typeof createStoreContext<TAtoms>>\n): () => ContextQueryStore<TAtoms> {\n return createUseStoreInternal(StoreContext, \"useStore\");\n}\n\nexport function createUseContextAtom<TAtoms extends Record<string, any>>(\n StoreContext: ReturnType<typeof createStoreContext<TAtoms>>\n) {\n const useStore = createUseStoreInternal(StoreContext, \"useContextAtom\");\n\n return <TKey extends keyof TAtoms>(key: TKey) => {\n const store = useStore();\n\n const value = useSyncExternalStore(\n useCallback(\n (onStoreChange: () => void) => {\n const subscription = store.subscribeToAtom(key, onStoreChange);\n return () => subscription.unsubscribe();\n },\n [store, key]\n ),\n useCallback(() => store.getAtomValue(key), [store, key]),\n useCallback(() => store.getAtomValue(key), [store, key])\n );\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 = createUseStoreInternal(StoreContext, \"useContextAtomValue\");\n\n return <TKey extends keyof TAtoms>(key: TKey): TAtoms[TKey] => {\n const store = useStore();\n\n return useSyncExternalStore(\n useCallback(\n (onStoreChange: () => void) => {\n const subscription = store.subscribeToAtom(key, onStoreChange);\n return () => subscription.unsubscribe();\n },\n [store, key]\n ),\n useCallback(() => store.getAtomValue(key), [store, key]),\n useCallback(() => store.getAtomValue(key), [store, key])\n );\n };\n}\n\nexport function createUseContextSetAtom<TAtoms extends Record<string, any>>(\n StoreContext: ReturnType<typeof createStoreContext<TAtoms>>\n) {\n const useStore = createUseStoreInternal(StoreContext, \"useContextSetAtom\");\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 = createUseStoreInternal(StoreContext, \"useAllAtoms\");\n\n return (): [TAtoms, (newAtoms: Partial<TAtoms>) => void] => {\n const store = useStore();\n\n const subscribe = useCallback(\n (onStoreChange: () => void) => {\n const currentAtoms = store.getAllAtomValues();\n const subscriptions = Object.keys(currentAtoms).map((key) =>\n store.subscribeToAtom(key as keyof TAtoms, onStoreChange)\n );\n\n return () => {\n subscriptions.forEach((sub) => sub.unsubscribe());\n };\n },\n [store]\n );\n\n const getSnapshot = useCallback(() => store.getAllAtomValues(), [store]);\n\n const allValues = useSyncExternalStore(subscribe, getSnapshot, getSnapshot);\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 = createUseStoreInternal(StoreContext, \"useAllAtomsValue\");\n\n return (): TAtoms => {\n const store = useStore();\n\n const subscribe = useCallback(\n (onStoreChange: () => void) => {\n const currentAtoms = store.getAllAtomValues();\n const subscriptions = Object.keys(currentAtoms).map((key) =>\n store.subscribeToAtom(key as keyof TAtoms, onStoreChange)\n );\n\n return () => {\n subscriptions.forEach((sub) => sub.unsubscribe());\n };\n },\n [store]\n );\n\n const getSnapshot = useCallback(() => store.getAllAtomValues(), [store]);\n\n return useSyncExternalStore(subscribe, getSnapshot, getSnapshot);\n };\n}\n\nexport function createUseUpdateAllAtoms<TAtoms extends Record<string, any>>(\n StoreContext: ReturnType<typeof createStoreContext<TAtoms>>\n) {\n const useStore = createUseStoreInternal(StoreContext, \"useUpdateAllAtoms\");\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()))}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(e)}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":["createUseStoreInternal","StoreContext","hookName","store","useContext","Error","t","value","listeners","constructor","this","Set","getValue","setValue","Object","is","notifyListeners","forEach","subscribe","add","unsubscribe","delete","e","atoms","Map","entries","s","set","getAtomValue","get","String","setAtomValue","subscribeToAtom","getAllAtomValues","updateAllAtoms","createReactContextQuery","createContext","ContextQueryProvider","children","useMemo","ContextQueryStore","_jsx","Provider","createContextQuery","useContextAtom","useStore","key","useSyncExternalStore","useCallback","onStoreChange","subscription","newValue","currentValue","updatedValue","createUseContextAtom","useContextAtomValue","createUseContextAtomValue","useContextSetAtom","createUseContextSetAtom","createUseStore","useAllAtoms","currentAtoms","subscriptions","keys","map","sub","getSnapshot","newAtoms","createUseAllAtoms","useAllAtomsValue","createUseAllAtomsValue","useUpdateAllAtoms","createUseUpdateAllAtoms"],"mappings":"sJAIA,SAASA,EACPC,EACAC,GAEA,MAAO,KACL,MAAMC,EAAQC,EAAWH,GAEzB,IAAKE,EACH,MAAM,IAAIE,MAAM,GAAGH,gDAGrB,OAAOC,CAAK,CAEhB,CCjBA,MAAMG,EAAEC,MAAMC,UAAU,WAAAC,CAAYH,GAAGI,KAAKH,MAAMD,EAAEI,KAAKF,UAAU,IAAIG,GAAG,CAAC,QAAAC,GAAW,OAAOF,KAAKH,KAAK,CAAC,QAAAM,CAASP,GAAGQ,OAAOC,GAAGL,KAAKH,MAAMD,KAAKI,KAAKH,MAAMD,EAAEI,KAAKM,kBAAkB,CAAC,eAAAA,GAAkBN,KAAKF,UAAUS,SAASX,GAAGA,KAAK,CAAC,SAAAY,CAAUZ,GAAyB,OAAtBI,KAAKF,UAAUW,IAAIb,GAAS,CAACc,YAAY,KAAKV,KAAKF,UAAUa,OAAOf,EAAC,EAAG,EAAE,MAAMgB,EAAEC,MAAM,WAAAd,CAAYa,GAAGZ,KAAKa,MAAM,IAAIC,IAAIV,OAAOW,QAAQH,GAAGL,SAAO,EAAIK,EAAEI,MAAMhB,KAAKa,MAAMI,IAAIL,EAAE,IAAIhB,EAAEoB,GAAI,GAAE,CAAC,YAAAE,CAAatB,GAAG,MAAMgB,EAAEZ,KAAKa,MAAMM,IAAIvB,GAAG,IAAIgB,EAAE,MAAM,IAAIjB,MAAM,kBAAkByB,OAAOxB,iBAAiB,OAAOgB,EAAEV,UAAU,CAAC,YAAAmB,CAAazB,EAAEgB,GAAG,MAAMI,EAAEhB,KAAKa,MAAMM,IAAIvB,GAAG,IAAIoB,EAAE,MAAM,IAAIrB,MAAM,kBAAkByB,OAAOxB,iBAAiBoB,EAAEb,SAASS,EAAE,CAAC,eAAAU,CAAgB1B,EAAEgB,GAAG,MAA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AS,GAEhC,CAAChE,IAGwC,CAE/C,CI/HsBiE,CAA0BnE,GACxCoE,EJgIF,SACJpE,GAEA,MAAM4C,EAAW7C,EAAuBC,EAAc,oBAEtD,MAAO,KACL,MAAME,EAAQ0C,IAER3B,EAAY8B,GACfC,IACC,MAAMY,EAAe1D,EAAM8B,mBACrB6B,EAAgBhD,OAAOiD,KAAKF,GAAcG,KAAKlB,GACnD3C,EAAM6B,gBAAgBc,EAAqBG,KAG7C,MAAO,KACLa,EAAc7C,SAASgD,GAAQA,EAAI7C,eAAc,CAClD,GAEH,CAACjB,IAGG+D,EAAclB,GAAY,IAAM7C,EAAM8B,oBAAoB,CAAC9B,IAEjE,OAAO4C,EAAqB7B,EAAWgD,EAAaA,EAAY,CAEpE,CI1J2BI,CAA+BrE,GAClDsE,EJ2JF,SACJtE,GAEA,MAAM4C,EAAW7C,EAAuBC,EAAc,qBAEtD,MAAO,KACL,MAAME,EAAQ0C,IAEd,OAAOG,GACJmB,IACChE,EAAM+B,eAAeiC,EAAS,GAEhC,CAAChE,GACF,CAEL,CI1K4BqE,CAAgCvE,GAE1D,MAAO,CACLoC,uBACAO,iBACAW,sBACAE,oBACAZ,WACAe,cACAS,mBACAE,oBAEJ","x_google_ignoreList":[1]}
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../src/hooks.ts","../../../node_modules/.pnpm/@context-query+core@0.3.2/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, useSyncExternalStore } from \"react\";\nimport { createStoreContext } from \"./context\";\n\nfunction createUseStoreInternal<TAtoms extends Record<string, any>>(\n StoreContext: ReturnType<typeof createStoreContext<TAtoms>>,\n hookName: string\n): () => ContextQueryStore<TAtoms> {\n return () => {\n const store = useContext(StoreContext);\n\n if (!store) {\n throw new Error(`${hookName} must be used within a ContextQueryProvider`);\n }\n\n return store;\n };\n}\n\nexport function createUseStore<TAtoms extends Record<string, any>>(\n StoreContext: ReturnType<typeof createStoreContext<TAtoms>>\n): () => ContextQueryStore<TAtoms> {\n return createUseStoreInternal(StoreContext, \"useStore\");\n}\n\nexport function createUseContextAtom<TAtoms extends Record<string, any>>(\n StoreContext: ReturnType<typeof createStoreContext<TAtoms>>\n) {\n const useStore = createUseStoreInternal(StoreContext, \"useContextAtom\");\n\n return <TKey extends keyof TAtoms>(key: TKey) => {\n const store = useStore();\n\n const value = useSyncExternalStore(\n useCallback(\n (onStoreChange: () => void) => {\n const subscription = store.subscribeToAtom(key, onStoreChange);\n return () => subscription.unsubscribe();\n },\n [store, key]\n ),\n useCallback(() => store.getAtomValue(key), [store, key]),\n useCallback(() => store.getAtomValue(key), [store, key])\n );\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 = createUseStoreInternal(StoreContext, \"useContextAtomValue\");\n\n return <TKey extends keyof TAtoms>(key: TKey): TAtoms[TKey] => {\n const store = useStore();\n\n return useSyncExternalStore(\n useCallback(\n (onStoreChange: () => void) => {\n const subscription = store.subscribeToAtom(key, onStoreChange);\n return () => subscription.unsubscribe();\n },\n [store, key]\n ),\n useCallback(() => store.getAtomValue(key), [store, key]),\n useCallback(() => store.getAtomValue(key), [store, key])\n );\n };\n}\n\nexport function createUseContextSetAtom<TAtoms extends Record<string, any>>(\n StoreContext: ReturnType<typeof createStoreContext<TAtoms>>\n) {\n const useStore = createUseStoreInternal(StoreContext, \"useContextSetAtom\");\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 = createUseStoreInternal(StoreContext, \"useAllAtoms\");\n\n return (): [TAtoms, (newAtoms: Partial<TAtoms>) => void] => {\n const store = useStore();\n\n const subscribe = useCallback(\n (onStoreChange: () => void) => {\n const currentAtoms = store.getAllAtomValues();\n const subscriptions = Object.keys(currentAtoms).map((key) =>\n store.subscribeToAtom(key as keyof TAtoms, onStoreChange)\n );\n\n return () => {\n subscriptions.forEach((sub) => sub.unsubscribe());\n };\n },\n [store]\n );\n\n const getSnapshot = useCallback(() => store.getAllAtomValues(), [store]);\n\n const allValues = useSyncExternalStore(subscribe, getSnapshot, getSnapshot);\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 = createUseStoreInternal(StoreContext, \"useAllAtomsValue\");\n\n return (): TAtoms => {\n const store = useStore();\n\n const subscribe = useCallback(\n (onStoreChange: () => void) => {\n const currentAtoms = store.getAllAtomValues();\n const subscriptions = Object.keys(currentAtoms).map((key) =>\n store.subscribeToAtom(key as keyof TAtoms, onStoreChange)\n );\n\n return () => {\n subscriptions.forEach((sub) => sub.unsubscribe());\n };\n },\n [store]\n );\n\n const getSnapshot = useCallback(() => store.getAllAtomValues(), [store]);\n\n return useSyncExternalStore(subscribe, getSnapshot, getSnapshot);\n };\n}\n\nexport function createUseUpdateAllAtoms<TAtoms extends Record<string, any>>(\n StoreContext: ReturnType<typeof createStoreContext<TAtoms>>\n) {\n const useStore = createUseStoreInternal(StoreContext, \"useUpdateAllAtoms\");\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()))}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(e)}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":["createUseStoreInternal","StoreContext","hookName","store","useContext","Error","t","value","listeners","constructor","this","Set","getValue","setValue","Object","is","notifyListeners","forEach","subscribe","add","unsubscribe","delete","e","atoms","Map","entries","s","set","getAtomValue","get","String","setAtomValue","subscribeToAtom","getAllAtomValues","updateAllAtoms","createReactContextQuery","createContext","ContextQueryProvider","children","useMemo","ContextQueryStore","_jsx","Provider","createContextQuery","useContextAtom","useStore","key","useSyncExternalStore","useCallback","onStoreChange","subscription","newValue","currentValue","updatedValue","createUseContextAtom","useContextAtomValue","createUseContextAtomValue","useContextSetAtom","createUseContextSetAtom","createUseStore","useAllAtoms","currentAtoms","subscriptions","keys","map","sub","getSnapshot","newAtoms","createUseAllAtoms","useAllAtomsValue","createUseAllAtomsValue","useUpdateAllAtoms","createUseUpdateAllAtoms"],"mappings":"sJAIA,SAASA,EACPC,EACAC,GAEA,MAAO,KACL,MAAMC,EAAQC,EAAWH,GAEzB,IAAKE,EACH,MAAM,IAAIE,MAAM,GAAGH,gDAGrB,OAAOC,CAAK,CAEhB,CCjBA,MAAMG,EAAEC,MAAMC,UAAU,WAAAC,CAAYH,GAAGI,KAAKH,MAAMD,EAAEI,KAAKF,UAAU,IAAIG,GAAG,CAAC,QAAAC,GAAW,OAAOF,KAAKH,KAAK,CAAC,QAAAM,CAASP,GAAGQ,OAAOC,GAAGL,KAAKH,MAAMD,KAAKI,KAAKH,MAAMD,EAAEI,KAAKM,kBAAkB,CAAC,eAAAA,GAAkBN,KAAKF,UAAUS,SAASX,GAAGA,KAAK,CAAC,SAAAY,CAAUZ,GAAyB,OAAtBI,KAAKF,UAAUW,IAAIb,GAAS,CAACc,YAAY,KAAKV,KAAKF,UAAUa,OAAOf,EAAC,EAAG,EAAE,MAAMgB,EAAEC,MAAM,WAAAd,CAAYa,GAAGZ,KAAKa,MAAM,IAAIC,IAAIV,OAAOW,QAAQH,GAAGL,SAAO,EAAIK,EAAEI,MAAMhB,KAAKa,MAAMI,IAAIL,EAAE,IAAIhB,EAAEoB,GAAI,GAAE,CAAC,YAAAE,CAAatB,GAAG,MAAMgB,EAAEZ,KAAKa,MAAMM,IAAIvB,GAAG,IAAIgB,EAAE,MAAM,IAAIjB,MAAM,kBAAkByB,OAAOxB,iBAAiB,OAAOgB,EAAEV,UAAU,CAAC,YAAAmB,CAAazB,EAAEgB,GAAG,MAAMI,EAAEhB,KAAKa,MAAMM,IAAIvB,GAAG,IAAIoB,EAAE,MAAM,IA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AAoB,CAAC9B,IAWjE,MAAO,CATW4C,EAAqB7B,EAAWgD,EAAaA,GAExClB,GACpBmB,IACChE,EAAM+B,eAAeiC,EAAS,GAEhC,CAAChE,IAGwC,CAE/C,CI/HsBiE,CAA0BnE,GACxCoE,EJgIF,SACJpE,GAEA,MAAM4C,EAAW7C,EAAuBC,EAAc,oBAEtD,MAAO,KACL,MAAME,EAAQ0C,IAER3B,EAAY8B,GACfC,IACC,MAAMY,EAAe1D,EAAM8B,mBACrB6B,EAAgBhD,OAAOiD,KAAKF,GAAcG,KAAKlB,GACnD3C,EAAM6B,gBAAgBc,EAAqBG,KAG7C,MAAO,KACLa,EAAc7C,SAASgD,GAAQA,EAAI7C,eAAc,CAClD,GAEH,CAACjB,IAGG+D,EAAclB,GAAY,IAAM7C,EAAM8B,oBAAoB,CAAC9B,IAEjE,OAAO4C,EAAqB7B,EAAWgD,EAAaA,EAAY,CAEpE,CI1J2BI,CAA+BrE,GAClDsE,EJ2JF,SACJtE,GAEA,MAAM4C,EAAW7C,EAAuBC,EAAc,qBAEtD,MAAO,KACL,MAAME,EAAQ0C,IAEd,OAAOG,GACJmB,IACChE,EAAM+B,eAAeiC,EAAS,GAEhC,CAAChE,GACF,CAEL,CI1K4BqE,CAAgCvE,GAE1D,MAAO,CACLoC,uBACAO,iBACAW,sBACAE,oBACAZ,WACAe,cACAS,mBACAE,oBAEJ","x_google_ignoreList":[1]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@context-query/react",
|
|
3
|
-
"version": "0.2.2
|
|
3
|
+
"version": "0.2.2",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "React bindings for ContextQuery",
|
|
6
6
|
"author": "Minyeoung Seo <tjalsdud89@naver.com>",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"react": "^18.0.0 || ^19.0.0"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@context-query/core": "0.3.2
|
|
41
|
+
"@context-query/core": "0.3.2",
|
|
42
42
|
"react": "^18.3.1"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|