import { ComponentType } from 'react';
import { InvariantOf } from 'type-fest';

type AttributesMap<N extends string> = Readonly<{
    [attributeName: string]: N extends 'dispatchEvent' ? never : N;
}>;
type DefineAsCustomElementInit = Readonly<{
    builtInElement?: {
        customElementConstructor: CustomElementConstructor;
        extends: string;
    } | undefined;
    shadowRoot?: ShadowRootInit | undefined;
}>;
type AttributeAsProps<T extends string> = InvariantOf<{
    readonly [PropName in T]?: string | undefined;
}>;

declare function defineAsCustomElement$1<T extends string>(componentType: ComponentType<AttributeAsProps<T>>, tagName: string, attributesMap: AttributesMap<T>, init?: DefineAsCustomElementInit | undefined): void;

declare function defineAsCustomElement<T extends string>(componentType: ComponentType<AttributeAsProps<T>>, tagName: string, attributesMap: AttributesMap<T>, init?: DefineAsCustomElementInit | undefined): {
    Portal: ComponentType<{
        children?: never;
    }>;
};

declare function useCustomElement(): readonly [HTMLElement | ShadowRoot];

declare function useMethodCallback<F extends (...args: any[]) => any>(name: string, fn?: F | undefined): void;

export { type AttributeAsProps, type AttributesMap, type DefineAsCustomElementInit, defineAsCustomElement$1 as defineAsCustomElement, defineAsCustomElement as defineAsCustomElementWithPortal, useCustomElement, useMethodCallback };
