UNPKG

@razen-core/zenweb

Version:

A minimalist TypeScript framework for building reactive web applications with no virtual DOM

37 lines 1.62 kB
/** * ZenWeb Utility Helpers * Utility functions for conditional rendering, fragments, etc. */ import { DOMChildren } from '../dom.js'; /** * Fragment - render children without wrapper */ export declare function fragment(...children: DOMChildren[]): HTMLElement[]; /** * Conditional rendering - show content when condition is true */ export declare function when(condition: boolean, content: () => HTMLElement | DOMChildren): HTMLElement | null; /** * Show/hide based on condition with reactive support * Usage: show(state.visible, element) or show(() => state.count > 0, element) * Properly toggles DOM presence (not just display:none) */ export declare function show(condition: boolean | (() => boolean), content: HTMLElement): HTMLElement; /** * Iterate over array and render items */ export declare function each<T>(items: T[], renderFn: (item: T, index: number) => HTMLElement, keyFn?: (item: T, index: number) => string | number): HTMLElement[]; /** * Switch case rendering */ export declare function switchCase<T>(value: T, cases: Record<string, () => HTMLElement>, defaultCase?: () => HTMLElement): HTMLElement | null; /** * Dynamic component - render component based on type */ export declare function dynamic(component: Function | string, props: any, ...children: DOMChildren[]): HTMLElement; /** * Portal - render content in a different DOM location */ export declare function portal(children: DOMChildren[], target: string | HTMLElement): HTMLElement; export declare function css(selector: string, styles: Partial<CSSStyleDeclaration> | string): void; //# sourceMappingURL=utilities.d.ts.map