mirror of
				https://github.com/jaandrle/deka-dom-el
				synced 2025-10-31 13:59:14 +01:00 
			
		
		
		
	✨ Add ddeSignal type to global scope + TODOs updated
This commit is contained in:
		
							
								
								
									
										1
									
								
								index.d.ts
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								index.d.ts
									
									
									
									
										vendored
									
									
								
							| @@ -2,7 +2,6 @@ import { Signal } from "./src/signals"; | ||||
| //TODO? | ||||
| declare global { | ||||
| 	type ddeFires<T extends string[]>= ( (...a: any[])=> any ) & { events: T }; | ||||
| 	type ddeSignal<T, A>= Signal<T, A>; | ||||
| } | ||||
| type ElementTagNameMap= HTMLElementTagNameMap & SVGElementTagNameMap & { | ||||
| 	'#text': Text | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| { | ||||
| 	"name": "deka-dom-el", | ||||
| 	"version": "0.1.2", | ||||
| 	"version": "0.1.3", | ||||
| 	"description": "A low-code library that simplifies the creation of native DOM elements/components using small wrappers and tweaks.", | ||||
| 	"author": "Jan Andrle <andrle.jan@centrum.cz>", | ||||
| 	"license": "MIT", | ||||
|   | ||||
| @@ -12,7 +12,7 @@ export function S(value, actions){ | ||||
| 	const out= create(); | ||||
| 	watch(()=> out(value())); | ||||
| 	return out; | ||||
| 	//TODO is auto remove if used for args, if external listener needs also S.clear | ||||
| 	//TODO for docs: is auto remove if used for args, if external listener needs also S.clear | ||||
| } | ||||
| S.action= function(signal, name, ...a){ | ||||
| 	const s= signal[mark], { actions }= s; | ||||
| @@ -28,7 +28,7 @@ S.on= function on(signals, listener, options= {}){ | ||||
| 	if(Array.isArray(signals)) return signals.forEach(s=> on(s, listener, options)); | ||||
| 	addSignalListener(signals, listener); | ||||
| 	if(as) as.addEventListener("abort", ()=> removeSignalListener(signals, listener)); | ||||
| 	//TODO cleanup when signal removed (also TODO) | ||||
| 	//TODO cleanup when signal removed | ||||
| }; | ||||
| S.symbols= { | ||||
| 	signal: mark, | ||||
|   | ||||
							
								
								
									
										4
									
								
								src/signals.d.ts
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										4
									
								
								src/signals.d.ts
									
									
									
									
										vendored
									
									
								
							| @@ -43,3 +43,7 @@ interface S { | ||||
| 	} | ||||
| } | ||||
| export const S: S; | ||||
| declare global { | ||||
| 	type ddeSignal<T, A>= Signal<T, A>; | ||||
| 	type ddeActions<V>= Actions<V> | ||||
| } | ||||
|   | ||||
| @@ -14,9 +14,7 @@ const className= style.host(todosComponent).css` | ||||
| /** @param {{ todos: string[] }} */ | ||||
| export function todosComponent({ todos= [ "A" ] }= {}){ | ||||
| 	const todosS= S([], { | ||||
| 		/** @param {string} v */ | ||||
| 		add(v){ this.value.push(S(v)); }, | ||||
| 		/** @param {number} i */ | ||||
| 		remove(i){ this.value.splice(i, 1); }, | ||||
| 		[S.symbols.onclear](){ S.clear(...this.value); }, | ||||
| 	}); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user