UNPKG

lambda.html

Version:

Lambda.html is a TypeScript-based HTML builder framework that leverages functional programming principles to provide a declarative, composable, and extensible approach for building dynamic web interfaces. Designed for robustness and maintainability, it in

65 lines (64 loc) 2.92 kB
export type HxHttpMethod = "get" | "post" | "put" | "delete"; export type HxTrigger = HxTriggerValue | `${HxTriggerValue}, ${HxTriggerValue}`; export type HxEncoding = "multipart/form-data"; export type HxSwap = SwapType | `${SwapType} ${TransitionModifier | TimingModifier | TitleModifier | ScrollModifier | FocusScrollModifier}`; export type HxTarget = StandardCSSSelector | ExtendedCSSSelector; export interface HTMX { endpoint: string; method: HxHttpMethod; target?: HxTarget; trigger?: HxTrigger; swap?: HxSwap; replaceUrl?: boolean; encoding?: HxEncoding; validate?: boolean; pushUrl?: boolean; vals?: any; headers?: Record<string, string>; confirm?: string; ext?: string; include?: string; indicator?: string; params?: string; select?: string; selectOob?: string; sync?: string; } export declare function hx(endpoint: string, options?: { method?: HxHttpMethod; target?: HxTarget; trigger?: HxTrigger; swap?: HxSwap; encoding?: HxEncoding; replaceUrl?: boolean; validate?: boolean; pushUrl?: boolean; vals?: any; headers?: Record<string, string>; confirm?: string; ext?: string; include?: string; indicator?: string; params?: string; select?: string; selectOob?: string; sync?: string; }): HTMX; export declare function id(id: string): HxTarget; export declare function clss(clss: string): HxTarget; type SwapType = 'innerHTML' | 'outerHTML' | 'textContent' | 'beforebegin' | 'afterbegin' | 'beforeend' | 'afterend' | 'delete' | 'none'; type TransitionModifier = `transition:${boolean}`; type TimingModifier = `swap:${string}` | `settle:${string}`; type TitleModifier = `ignoreTitle:${boolean}`; type ScrollModifier = `scroll:${'top' | 'bottom'}` | `show:${'top' | 'bottom' | `window:${'' | 'bottom'}` | `${string}:${'top' | 'bottom'}`}`; type FocusScrollModifier = `focus-scroll:${boolean}`; type StandardCSSSelector = string; type ExtendedCSSSelector = 'this' | `closest ${string}` | `next ${string}` | `previous ${string}` | `find ${string}`; type HxTriggerTimingDeclaration = `${number}s` | `${number}ms`; type HXTriggerStandardEvent = 'click' | 'keyup' | 'load' | 'change'; type HxTriggerNonStandardEvent = 'load' | 'revealed' | 'intersect'; type HxTriggerEventModifier = 'once' | 'changed' | `delay:${HxTriggerTimingDeclaration}` | `throttle:${HxTriggerTimingDeclaration}` | `from:${string}` | `target:${string}` | 'consume' | `queue:${'first' | 'last' | 'all' | 'none'}`; type HxTriggerPolling = `every ${HxTriggerTimingDeclaration}`; type HxTriggerEventWithModifiers = `${HXTriggerStandardEvent}[${string}]` | `${HXTriggerStandardEvent} ${HxTriggerEventModifier}`; type HxTriggerValue = HXTriggerStandardEvent | HxTriggerNonStandardEvent | HxTriggerEventWithModifiers | HxTriggerPolling | `${HxTriggerNonStandardEvent} ${HxTriggerEventModifier}`; export {};