import type { ReactElement, ReactNode } from "react"; import { ItemStore } from "../db/ItemStore.js"; import type { AbstractProvider } from "../db/Provider.js"; import { QueryStore } from "../db/QueryStore.js"; import type { Database, DataKey } from "../util/data.js"; import type { Identifier } from "../util/item.js"; import type { Nullish } from "../util/null.js"; import type { ItemQuery } from "../util/query.js"; export interface DataContext { /** Get an `ItemStore` for the specified collection item in the current `DataProvider` context and subscribe to any changes in it. */ useItem>(this: void, collection: K, id: I): ItemStore; useItem>(this: void, collection: Nullish, id: Nullish): ItemStore | undefined; /** Get an `QueryStore` for the specified collection query in the current `DataProvider` context and subscribe to any changes in it. */ useQuery>(this: void, collection: K, query: ItemQuery): QueryStore; useQuery>(this: void, collection: Nullish, query: Nullish>): QueryStore | undefined; readonly DataContext: ({ children }: { children: ReactNode; }) => ReactElement; } /** * Create a data context * - Allows React elements to call `useItem()` and `useQuery()` to access items/queries in a database provider. * - If the database has a `CacheProvider` in its chain then in-memory data will be used in the returned stores. */ export declare function createDataContext(provider: AbstractProvider): DataContext;