import { CSSResultGroup } from 'lit'; import { LitElement } from 'lit'; import { PropertyDeclaration } from 'lit'; import { PropertyValues } from 'lit'; import { ReactiveElement } from 'lit'; declare type AlphaLowercase = 'a' | 'b' | 'c' | 'd' | 'e' | 'f' | 'g' | 'h' | 'i' | 'j' | 'k' | 'l' | 'm' | 'n' | 'o' | 'p' | 'q' | 'r' | 's' | 't' | 'u' | 'v' | 'w' | 'x' | 'y' | 'z'; declare type ApplyMixins, TMixins extends readonly unknown[]> = TMixins extends readonly [] ? TBase : TMixins extends readonly [infer First, ...infer Rest] ? First extends (base: Class & typeof LitElement) => Class ? TBase & ApplyMixins, Rest> : never : TBase; declare type ChangedPropertiesConsumer = (changedProperties: PropertyValues) => void; declare type ChangedPropertiesPredicate = (changedProperties: PropertyValues) => boolean; declare type Class = new (...args: any[]) => T; export declare type DefinedComponent = ReturnType; export declare type DefinedComponentInstance = InstanceType; export declare function defineElement(name: ValidCustomElementName, render: () => unknown, opts?: FunctionComponentOptions): typeof LitElement; export declare function defineElement, Styles extends UseShadowRoot extends true | undefined ? CSSResultGroup | undefined : undefined, Parent extends typeof LitElement, Instance extends InstanceType & UnwrapProps, Render extends (this: Instance) => unknown, Setup extends (this: Instance, comp?: Instance) => void | Render>(options: { name?: ValidatedCustomElementName; parent?: Parent; styles?: Styles; props?: Properties; register?: boolean; shadowRoot?: UseShadowRoot; setup?: Setup; render?: Render; }): typeof LitElement; declare const defineElementWithOptions: , Styles extends UseShadowRoot extends true | undefined ? CSSResultGroup : never, Parent extends typeof LitElement, Instance extends InstanceType & UnwrapProps, Render extends (this: Instance) => unknown, Setup extends (this: Instance, comp?: Instance) => void | Render>(options: { name?: ValidatedCustomElementName; parent?: Parent; styles?: Styles; props?: Properties; register?: boolean; shadowRoot?: UseShadowRoot; setup?: Setup; render?: Render; }, decorator: LitElementDecorator) => typeof LitElement; declare interface DefinePropertyDeclaration extends PropertyDeclaration { readonly type?: TypeHint; readonly default?: TypeHint | (() => TypeHint); } declare type FirstCharacter = AlphaLowercase; declare type ForbiddenCustomElementNames = 'annotation-xml' | 'color-profile' | 'font-face' | 'font-face-src' | 'font-face-uri' | 'font-face-format' | 'font-face-name' | 'missing-glyph'; declare type FunctionComponentOptions = { [K in keyof Parameters[0]]: Parameters[0][K]; } & { styles: any; }; /** * Get the current instance of a LitElement. * There is only one thread of execution, so there is only one current instance at a time. */ export declare const getCurrentInstance: () => T; declare type IllegalCharacter = '<' | '>' | '/' | '\r' | '\t' | '\n' | '\f' | '\0' | '\u0020'; declare type InferPropType = [T] extends [null] ? NullAsAny extends true ? unknown : null : [T] extends [{ type: null | true; }] ? unknown : [T] extends [DefinePropertyDeclaration] ? Record : [T] extends [DefinePropertyDeclaration] ? boolean : [T] extends [DefinePropertyDeclaration] ? Date : [T] extends [DefinePropertyDeclaration] ? U extends DateConstructor ? Date | InferPropType : InferPropType : [T] extends [DefinePropertyDeclaration] ? V extends StringConstructor ? string : V extends NumberConstructor ? number : V extends BooleanConstructor ? boolean : V extends DateConstructor ? Date : V extends PropType ? P : V : T; declare type LitElementDecorator = (t: typeof LitElement) => typeof t; export declare type Mixin = typeof LitElement & Class, Result extends BaseClass = BaseClass> = (base: BaseClass) => Result; export declare const mixin: , TMixins extends readonly Mixin[]>(base: TBase, ...mixins: TMixins) => ApplyMixins; export declare const onConnected: (cb: SomeFunction) => number; export declare const onDisconnected: (cb: SomeFunction) => number; export declare const onFirstUpdated: (cb: ChangedPropertiesConsumer) => number; export declare const onPerformUpdate: (cb: SomeFunction) => number; export declare const onShouldUpdate: (cb: ChangedPropertiesPredicate) => number; export declare const onUpdate: (cb: ChangedPropertiesConsumer) => number; export declare const onUpdated: (cb: ChangedPropertiesConsumer) => number; export declare const onWillUpdate: (cb: ChangedPropertiesConsumer) => number; export declare type PropType = TypeConstructor | (TypeConstructor | null)[]; declare type SomeFunction = (...args: unknown[]) => unknown; declare type TypeConstructor = (new (...args: unknown[]) => T & {}) | (() => T) | TypeMethod; declare type TypeMethod = [T] extends [((...args: unknown[]) => unknown) | undefined] ? { new (): Ctor; (): T; readonly prototype: Ctor; } : never; declare type UnwrapProps> = { [K in keyof Props]: InferPropType; }; declare type ValidatedCustomElementName = Name extends ForbiddenCustomElementNames ? never : Name extends `${string}${IllegalCharacter}${string}` ? never : Name; /** * A very basic validator for custom element names. */ export declare type ValidCustomElementName = `${Lowercase<`${FirstCharacter}${string}-${string}`>}`; export { }