import { CSSResultGroup } from 'lit'; import { LitElement } from 'lit'; import { PropertyDeclaration } from 'lit'; import { PropertyValues } from 'lit'; import { ReactiveElement } from 'lit'; import { Signal } from '@lit-labs/signals'; 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 ChangedPropertiesConsumer = (changedProperties: PropertyValues) => void; declare type ChangedPropertiesPredicate = (changedProperties: PropertyValues) => boolean; 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 FnSubscriber unknown> = ReturnType>; declare const fnSubscriber: unknown>() => { add: (fn: FN) => number; run: (t: unknown, ...args: Parameters) => unknown[]; }; 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; }; 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; /* Excluded from this release type: InternalOptions */ /** * Check if a value is a reactive proxy created by reactive(). * * @typeParam T - The target object type. * @param target - The value to test. * @returns True if the value is a reactive object produced by reactive(). */ export declare const isReactive: (target: T) => target is Reactive; declare type LitElementDecorator = (t: typeof LitElement) => typeof t; declare type LitRender = LitElement['render']; 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; declare type PropType = TypeConstructor | (TypeConstructor | null)[]; declare type Reactive = T extends object ? { [K in keyof T]: T[K] extends Signal.State ? V : T[K] extends (...args: any[]) => unknown ? T[K] : T[K] extends object ? Reactive : T[K]; } : T; /** * Turn an object containing Effects into a reactive object. * @param target * @param deep - if true, recursively make all properties reactive */ export declare const reactive: (target: T, deep?: boolean) => Reactive; 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. */ declare type ValidCustomElementName = `${Lowercase<`${FirstCharacter}${string}-${string}`>}`; export declare const withHooks: LitElement, Result = abstract new () => LitElement & InstanceType & { __opts: InternalOptions>; }>(Base: Base) => Result; export { }