/** * LadrillosJS Directives * * Directives are special attributes that provide reactive behavior to elements. * Unlike interpolation which uses curly braces {value}, directives receive raw expressions. * * Syntax Pattern: * - Directives: $directive="expression" * - Interpolation: {expression} */ /** * $for - Loop Directive * * Repeats an element for each item in an iterable. * * Syntax: * $for="item in items" * $for="item of items" * $for="(item, index) in items" * $for="(value, key, index) in object" * * Examples: *
  • {item.name}
  • *
  • {index}: {item.name}
  • * * * Destructuring: *
    {id}: {name}
    *
    {first} - {second}
    */ export declare const FOR_DIRECTIVE = "$for"; /** * $if - Conditional Directive * * Conditionally renders an element based on a truthy expression. * * Syntax: * $if="condition" * * Examples: *
    Visible content
    *
    Admin panel
    *
    Has items
    */ export declare const IF_DIRECTIVE = "$if"; /** * $else - Else Directive * * Renders when the preceding $if condition is falsy. * Must immediately follow an element with $if. * * Syntax: * $else * * Examples: *
    Welcome back!
    *
    Please log in
    */ export declare const ELSE_DIRECTIVE = "$else"; /** * $else-if - Else If Directive * * Conditional fallback when preceding $if is falsy. * Must immediately follow an element with $if or $else-if. * * Syntax: * $else-if="condition" * * Examples: *
    Loading...
    *
    Error occurred
    *
    Content loaded
    */ export declare const ELSE_IF_DIRECTIVE = "$else-if"; /** * $show - Show/Hide Directive * * Toggles element visibility using CSS display property. * Unlike $if, the element remains in the DOM. * * Syntax: * $show="condition" * * Examples: *
    Expandable content
    * 🔔 */ export declare const SHOW_DIRECTIVE = "$show"; /** * $bind - Two-way Binding Directive * * Creates a two-way binding between an input and a reactive value. * * Syntax: * $bind="variableName" * * Examples: * * * */ export declare const BIND_DIRECTIVE = "$bind"; /** * Ensures a $bind element's value is synced to state before a user event * handler for the same event runs. * * Inline handlers (onchange, oninput, $on:) are registered before $bind's * own listener, so without this the handler would read the previous value * from state. setupTwoWayBinding stores the sync function on the element; * handler wrappers call this first so user code always sees fresh state. */ export declare function syncBindBeforeHandler(event: Event): void; /** * $ref - Reference Directive * * Creates a reference to the DOM element. * * Syntax: * $ref="referenceName" * * Examples: * * */ export declare const REF_DIRECTIVE = "$ref"; export declare const DIRECTIVE_PATTERNS: { /** * Matches for/of loop expressions: * - "item in items" * - "(item, index) in items" * - "{ id, name } of users" */ readonly forAlias: RegExp; /** * Matches iterator with optional key/index: * - "item" -> [item] * - "item, index" -> [item, index] * - "value, key, index" -> [value, key, index] */ readonly forIterator: RegExp; /** * Strips parentheses from iterator expression: * "(item, index)" -> "item, index" */ readonly stripParens: RegExp; }; export declare const SUPPORTED_DIRECTIVES: readonly ["$for", "$if", "$else", "$else-if", "$show", "$bind", "$ref"]; export type DirectiveName = (typeof SUPPORTED_DIRECTIVES)[number]; /** * Escapes a directive name for use in CSS selectors. * The $ character is not valid in CSS selectors and must be escaped. * * Example: "$for" -> "\\$for" */ export declare function escapeCssSelector(directive: string): string; /** * Check if an attribute name is a directive */ export declare function isDirective(attrName: string): boolean;