1
0
mirror of https://github.com/jaandrle/deka-dom-el synced 2025-07-01 04:12:14 +02:00

🚧 mainly wc/ce

This commit is contained in:
2023-11-22 17:39:46 +01:00
parent 56206343d1
commit 10ed0802f2
7 changed files with 132 additions and 82 deletions

File diff suppressed because one or more lines are too long

View File

@ -166,6 +166,34 @@ export const scope: {
pop(): ReturnType<Array<Scope>["pop"]>,
};
/*
* TODO TypeScript HACK (better way?)
* this doesnt works
* ```ts
* interface element<el> extends Node{
* prototype: el;
* append(...els: (SupportedElement | DocumentFragment | string | element<SupportedElement | DocumentFragment>)[]): el
* }
*
export function el<T>(
* tag_name?: "<>",
* ): element<DocumentFragment>
* ```
* …as its complains here
* ```
ts
*
const d= el("div");
*
const f= (a: HTMLDivElement)=> a;
* f(d);
//←
* document.head.append( //←
* el("script", { src: "https://flems.io/flems.html", type: "text/javascript", charset: "utf-8" }),
* );
* ```
* TODO for SVG
* */
type ddeAppend<el>= (...nodes: (Node | string)[])=> el;
declare global{
interface HTMLAnchorElement{
@ -493,8 +521,7 @@ interface S {
* */
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, {}>
fromAttribute<T>(element: HTMLElement, name: string, value?: T): Signal<T, {}>;
}
export const S: S;
declare global {

File diff suppressed because one or more lines are too long

28
dist/esm.d.ts vendored
View File

@ -166,6 +166,34 @@ export const scope: {
pop(): ReturnType<Array<Scope>["pop"]>,
};
/*
* TODO TypeScript HACK (better way?)
* this doesnt works
* ```ts
* interface element<el> extends Node{
* prototype: el;
* append(...els: (SupportedElement | DocumentFragment | string | element<SupportedElement | DocumentFragment>)[]): el
* }
*
export function el<T>(
* tag_name?: "<>",
* ): element<DocumentFragment>
* ```
* …as its complains here
* ```
ts
*
const d= el("div");
*
const f= (a: HTMLDivElement)=> a;
* f(d);
//←
* document.head.append( //←
* el("script", { src: "https://flems.io/flems.html", type: "text/javascript", charset: "utf-8" }),
* );
* ```
* TODO for SVG
* */
type ddeAppend<el>= (...nodes: (Node | string)[])=> el;
declare global{
interface HTMLAnchorElement{