import { PropertyDeclaration } from 'lit'; /** * Enhanced property declaration for DDS components that extends Lit's PropertyDeclaration * with additional features for fallback values and property validation. * * The type ensures type safety with three possible configurations: * * 1. Standard property without fallback or validation * 2. Reflected property with fallback value * 3. Reflected property with both fallback value and validation function * * @template Type - The type of the property value * @template TypeHint - Optional type hint for property conversion * * @example * ```typescript * // Property with fallback value * @property({ reflect: true, fallbackValue: "default" }) * key!: string; * * // Property with validation * @property({ * reflect: true, * fallbackValue: 0, * isAllowedValue: (v) => v >= 0 * }) * count!: number; * ``` */ export type DDSPropertyDeclaration = PropertyDeclaration & ({ /** No fallback value specified */ fallbackValue?: undefined; /** No validation function specified */ isAllowedValue?: undefined; } | { /** Property reflects to attribute (required for fallback) */ reflect: true; /** Default value to use when property is undefined */ fallbackValue: Type; /** No validation function specified */ isAllowedValue?: undefined; } | { /** Property reflects to attribute (required for fallback) */ reflect: true; /** Default value to use when property is undefined */ fallbackValue: Type; /** Function to validate if a value is allowed for this property */ isAllowedValue: (value: Type) => boolean; }); /** * Property decorator for DDS components that enhances Lit's `@property` decorator * with additional features like fallback values and property validation. * * This decorator should be used instead of Lit's `@property` for DDS components * that need enhanced property handling capabilities. * * @param options - DDS property declaration options * @returns Property decorator function * * @example * ```typescript * class MyComponent extends DDSElement { * // Basic property * @property({ type: String }) * label = ""; * * // Property with fallback value * @property({ reflect: true, fallbackValue: "default" }) * value!: string; * * // Property with validation * @property({ * reflect: true, * fallbackValue: 0, * isAllowedValue: (v) => v >= 0 * }) * count!: number; * } * ``` */ export declare function property(options?: DDSPropertyDeclaration): PropertyDecorator; /** * Creates a validation function that checks if a value is one of the allowed values. * * This helper function is commonly used with the `isAllowedValue` option in property * declarations to restrict property values to a predefined set of allowed values. * * @template T - The type of the allowed values * @param values - Array of allowed values * @returns Validation function that returns true if the value is in the allowed values array */ export declare function oneOf(values: readonly T[]): (value: unknown) => boolean;