import { Atomico } from "./dom.js"; import { EventProp } from "./schema.js"; export type ValueContext = Record; export type DispatchConnectContext = (detail: DetailConnectContext) => any; export type DetailConnectContext = { id: Context; connect(value: HTMLElement): void; }; export type Context = Atomico<{ props: { value: { type: ObjectConstructor; value: () => Value }; ChangedValue: EventProp; }; }>; export type GetValueFromContext> = CustomContext extends Context ? Type : unknown; export type CreateContext = ( value: Value ) => Context; export type UseContext = >( context: AtomicoContext ) => GetValueFromContext; export type UseProvider = >( id: CustomContext, value: GetValueFromContext ) => void; export type ReturnUseConsumer = Value; export type UseConsumer = (id: Context) => any; export const useContext: UseContext; export const useProvider: UseProvider; export const createContext: CreateContext;