UNPKG

@stacksjs/stx

Version:

A performant UI Framework. Powered by Bun.

35 lines 1.14 kB
/** * x-element: Lightweight two-way binding for STX * * Provides client-side reactivity for forms and interactive elements: * - x-data: Define reactive data scope * - x-model: Two-way binding for inputs * - x-text: Reactive text content * - @event: Event handling (e.g., @click, @submit) * * Note: Use @if, @for, @foreach for server-side rendering. * x-element is only for client-side interactivity that SSR can't handle. * * @example * ```html * <div x-data="{ name: '', count: 0 }"> * <input x-model="name" /> * <p>Hello, <span x-text="name"></span>!</p> * <button @click="count++">Count: <span x-text="count"></span></button> * </div> * ``` */ /** * Generate the x-element runtime script * This is injected once per page that uses x-* directives */ export declare function generateXElementRuntime(): string; /** * Check if template uses x-* directives */ export declare function hasXElementDirectives(template: string): boolean; /** * Process x-element directives in template * Injects the runtime if x-* directives are found */ export declare function processXElementDirectives(template: string): string;