From b472cb89214a1d636b54d05c9a2a201fd314dec8 Mon Sep 17 00:00:00 2001 From: natxocc Date: Wed, 15 Apr 2026 17:54:23 +0200 Subject: [PATCH] Update to 1.2.12 --- sigpro.d.ts | 190 ++++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 153 insertions(+), 37 deletions(-) diff --git a/sigpro.d.ts b/sigpro.d.ts index 2547c40..104e24a 100644 --- a/sigpro.d.ts +++ b/sigpro.d.ts @@ -1,5 +1,5 @@ /** - * SigPro 1.2.0 + * SigPro 1.2.12 * A minimalistic reactive UI library with fine-grained reactivity, * deep reactive proxies, and intuitive component composition. */ @@ -66,7 +66,7 @@ export function $$(target: T): DeepReactive export type Signal = { (): T (value: T | ((prev: T) => T)): void - + // Internal properties (not meant for direct use) _isComputed?: boolean _subs?: Set @@ -85,7 +85,9 @@ export type DeepReactive = T extends object ? { [K in keyof T]: T[K] extends object ? DeepReactive : T[K] } & { - [Symbol.iterator]?: T extends Iterable ? () => Iterator> : never + [Symbol.iterator]?: T extends Iterable + ? () => Iterator> + : never } : T @@ -300,7 +302,7 @@ export function Mount( * @returns A container element that manages the conditional content * * @example - * If($show, + * If($show, * () => Div("Visible content"), * () => Div("Hidden state placeholder") * ) @@ -329,6 +331,31 @@ export function For( keyFn?: (item: T, index: number) => string | number ): HTMLDivElement +/** + * Conditionally renders content with CSS transition animations. + * + * @param show - Reactive signal or boolean that controls visibility + * @param render - Function that returns the content to render when visible + * @param options - Animation configuration (optional) + * @param options.enter - CSS class for enter transition start + * @param options.leave - CSS class for leave transition start + * @returns A container element that manages the animated content + * + * @example + * Anim(isOpen, + * () => Div({ class: "modal" }, "Modal content"), + * { + * enter: "fade-enter", + * leave: "fade-leave" + * } + * ) + */ +export function Anim( + show: boolean | Signal | (() => boolean), + render: () => any, + options?: { enter?: string; leave?: string } +): HTMLDivElement + // ============================================================================ // Router // ============================================================================ @@ -357,19 +384,19 @@ export namespace Router { * console.log(params.id) // from "/user/:id" */ export const params: Signal> - + /** * Navigate to a path. * @example * Router.to("/about") */ export function to(path: string): void - + /** * Go back in browser history. */ export function back(): void - + /** * Get the current path. */ @@ -403,31 +430,58 @@ export interface RouteDefinition { */ /** Creates a `
` element */ -export function Div(props?: Record, ...children: any[]): HTMLDivElement +export function Div( + props?: Record, + ...children: any[] +): HTMLDivElement /** Creates a `` element */ -export function Span(props?: Record, ...children: any[]): HTMLSpanElement +export function Span( + props?: Record, + ...children: any[] +): HTMLSpanElement /** Creates a `

` element */ -export function P(props?: Record, ...children: any[]): HTMLParagraphElement +export function P( + props?: Record, + ...children: any[] +): HTMLParagraphElement /** Creates an `

` element */ -export function H1(props?: Record, ...children: any[]): HTMLHeadingElement +export function H1( + props?: Record, + ...children: any[] +): HTMLHeadingElement /** Creates an `

` element */ -export function H2(props?: Record, ...children: any[]): HTMLHeadingElement +export function H2( + props?: Record, + ...children: any[] +): HTMLHeadingElement /** Creates an `

` element */ -export function H3(props?: Record, ...children: any[]): HTMLHeadingElement +export function H3( + props?: Record, + ...children: any[] +): HTMLHeadingElement /** Creates an `

` element */ -export function H4(props?: Record, ...children: any[]): HTMLHeadingElement +export function H4( + props?: Record, + ...children: any[] +): HTMLHeadingElement /** Creates an `
` element */ -export function H5(props?: Record, ...children: any[]): HTMLHeadingElement +export function H5( + props?: Record, + ...children: any[] +): HTMLHeadingElement /** Creates an `
` element */ -export function H6(props?: Record, ...children: any[]): HTMLHeadingElement +export function H6( + props?: Record, + ...children: any[] +): HTMLHeadingElement /** Creates a `
` element */ export function Br(props?: Record): HTMLBRElement @@ -436,55 +490,106 @@ export function Br(props?: Record): HTMLBRElement export function Hr(props?: Record): HTMLHRElement /** Creates a `
` element */ -export function Section(props?: Record, ...children: any[]): HTMLElement +export function Section( + props?: Record, + ...children: any[] +): HTMLElement /** Creates an `
` element */ -export function Article(props?: Record, ...children: any[]): HTMLElement +export function Article( + props?: Record, + ...children: any[] +): HTMLElement /** Creates an `