jelenjs
Version:
Core runtime library for JelenJS - an experimental UI framework with fine-grained reactivity
27 lines (26 loc) • 922 B
TypeScript
/**
* Shared utility functions for JelenJS
*/
import { ReadonlySignal, Signal } from "./signal";
export declare const DEBUG: boolean;
/**
* Helper to detect if an object is a signal
*/
export declare function isSignal(value: any): boolean;
/**
* Generate a unique ID
*/
export declare function generateId(prefix?: string): string;
/**
* Helper to safely get value from a signal
* Works with both getter functions and signal tuples
* For class attributes, converts boolean value to string ('active' or '')
*/
export declare function getSignalValue<T>(signal: Signal<T> | ReadonlySignal<T> | T, isClassAttr?: boolean): T;
/**
* Helper for using signals directly in JSX
* This is a convenience function that ensures signals are properly tracked in JSX
*
* Usage: <div>{useSignal(count)}</div> instead of <div>{count}</div>
*/
export declare function useSignal<T>(signal: Signal<T> | ReadonlySignal<T> | T): T;