1
0
mirror of https://github.com/jaandrle/deka-dom-el synced 2025-07-29 07:00:16 +02:00

🔨 mainly types + 💥 ddePublicElementTagNameMap

This commit is contained in:
2023-11-08 18:53:22 +01:00
parent 14fe70e8f6
commit 5c038f0427
12 changed files with 195 additions and 54 deletions

16
signals.d.ts vendored
View File

@@ -30,6 +30,10 @@ interface S {
* by `S.clear`.
* */
<V, A extends Actions<V>>(value: V, actions?: A): Signal<V, A>;
/**
* Computations signal. This creates a signal which is computed from other signals.
* */
<V>(computation: ()=> V): Signal<V, {}>
action<S extends Signal<any, Actions<any>>, A extends (S extends Signal<any, infer A> ? A : never), N extends keyof A>(
signal: S,
name: N,
@@ -41,7 +45,17 @@ interface S {
signal: SymbolSignal;
onclear: SymbolOnclear;
}
el<S extends any, T extends HTMLElement>(signal: Signal<S, any>, el: (v: S)=> T): T;
/**
* Reactive element, which is rendered based on the given signal.
* ```js
* S.el(signal, value=> value ? el("b", "True") : el("i", "False"));
* S.el(listS, list=> list.map(li=> el("li", li)));
* ```
* */
el<S extends any>(signal: Signal<S, any>, el: (v: S)=> Element | Element[]): DocumentFragment;
/** Mirrors element attributes for current host (both way). */
attribute<T>(name: string, initial?: T): Signal<T, {}>
}
export const S: S;
declare global {