UNPKG

@exadel/esl

Version:

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

23 lines (22 loc) 1.16 kB
import type { ESLAttributeDecorator } from '../dom/attr'; /** HTML boolean (marker) attribute mapping configuration */ type BoolAttrDescriptor = { /** HTML attribute name. Uses kebab-cased variable name by default */ name?: string; /** Create getter only */ readonly?: boolean; /** Use data-* attribute */ dataAttr?: boolean; }; /** * Decorator to map current property to element boolean (marker) attribute state. * - Presence mapping: attribute present means true, attribute absent means false (no third state) * - No `defaultValue` option; cannot implicitly default to true without attribute (use `@attr` tri‑state pattern for that) * - Setting property: truthy value ensures attribute presence (empty string); falsy value removes the attribute * - `readonly` option exposes getter only (writes ignored at JS level) * - Supports `data-*` via `dataAttr` * - Works with wrapper objects exposing `$host` (resolved internally by underlying DOM helpers) * @param config - mapping configuration. See {@link BoolAttrDescriptor} */ export declare const boolAttr: (config?: BoolAttrDescriptor) => ESLAttributeDecorator; export {};