UNPKG

@exadel/esl

Version:

Exadel Smart Library (ESL) is the lightweight custom elements library that provide a set of super-flexible components

20 lines (19 loc) 806 B
import type { ESLAttributeDecorator } from '../dom/attr'; /** HTML attribute to object property mapping configuration */ interface JsonAttrDescriptor<T> { /** HTML attribute name. Uses kebab-cased variable name by default */ name?: string; /** Create getter only */ readonly?: boolean; /** Use data-* attribute */ dataAttr?: boolean; /** Default property value. Used if no attribute is present on the element. Empty string by default. */ defaultValue?: T; } /** * Decorator to map current property to element attribute value using JSON (de-)serialization rules. * Maps object type property. * @param config - mapping configuration. See {@link JsonAttrDescriptor} */ export declare const jsonAttr: <T>(config?: JsonAttrDescriptor<T>) => ESLAttributeDecorator; export {};