import { Lang } from '../i18n'; import { ComponentChildren, RefObject, VNode } from 'preact'; import { HTMLAttributes } from 'preact/compat'; import { StateUpdater } from 'preact/hooks'; type MutateElement = (elem: HTMLElement) => void; interface State { get: (key: string) => void; set: (key: string, value: any) => void; } interface SlotElement { appendChild: MutateElement; prependChild: MutateElement; appendSibling: MutateElement; prependSibling: MutateElement; remove: () => void; } interface PrivateContext { _setProps: (s: StateUpdater<{}>) => void; _registerMethod: (cb: (next: T & DefaultSlotContext, state: State) => void) => void; _htmlElementToVNode: (element: HTMLElement, tag: keyof HTMLElementTagNameMap) => VNode; } interface DefaultSlotContext extends PrivateContext { dictionary: Lang; getSlotElement: (key: string) => SlotElement; replaceWith: MutateElement; appendChild: MutateElement; prependChild: MutateElement; appendSibling: MutateElement; prependSibling: MutateElement; remove: () => void; onRender: (cb: (next: T & DefaultSlotContext) => void) => void; onChange: (cb: (next: T & DefaultSlotContext) => void) => void; } type Context = T & ThisType>; export type SlotProps = (ctx: T & DefaultSlotContext, element: HTMLDivElement | null) => Promise | void; export type SlotMethod

= (callback: (next: unknown, state: State) => P) => void; export declare function useSlot(name: string, context?: Context, callback?: SlotProps, children?: ComponentChildren, render?: Function, contentTag?: keyof HTMLElementTagNameMap): [RefObject, Record, 'loading' | 'pending' | 'ready']; interface SlotPropsComponent extends Omit, 'slot'> { name: string; lazy?: boolean; slot?: SlotProps; context?: Context; render?: (props: Record) => VNode | VNode[]; slotTag?: keyof HTMLElementTagNameMap; contentTag?: keyof HTMLElementTagNameMap; children?: ComponentChildren; } export declare function Slot({ name, lazy, context, slot, children, render, slotTag, contentTag, ...props }: Readonly>): VNode<{ ref: RefObject; 'data-slot': string; [key: string]: any; }>; export {}; //# sourceMappingURL=slot.d.ts.map