mirror of
https://github.com/jaandrle/deka-dom-el
synced 2025-07-01 12:22:15 +02:00
🐛 fixes completitions for el with components
This commit is contained in:
@ -45,7 +45,7 @@ export function todosComponent({ todos= [ "Task A" ] }= {}){
|
|||||||
: el("ul").append(
|
: el("ul").append(
|
||||||
...Array.from(ts).map(([ value, textContent ])=>
|
...Array.from(ts).map(([ value, textContent ])=>
|
||||||
memo(value, ()=> el(todoComponent, { textContent, value, className }, onremove)))
|
memo(value, ()=> el(todoComponent, { textContent, value, className }, onremove)))
|
||||||
)
|
),
|
||||||
),
|
),
|
||||||
el("p", "Click to the text to edit it.")
|
el("p", "Click to the text to edit it.")
|
||||||
),
|
),
|
||||||
@ -54,7 +54,7 @@ export function todosComponent({ todos= [ "Task A" ] }= {}){
|
|||||||
el("label", "New todo: ").append(
|
el("label", "New todo: ").append(
|
||||||
el("input", { name, type: "text", required: true }),
|
el("input", { name, type: "text", required: true }),
|
||||||
),
|
),
|
||||||
el("button", "+")
|
el("button", "+"),
|
||||||
),
|
),
|
||||||
el("div").append(
|
el("div").append(
|
||||||
el("h3", "Output (JSON):"),
|
el("h3", "Output (JSON):"),
|
||||||
|
20
index.d.ts
vendored
20
index.d.ts
vendored
@ -72,6 +72,16 @@ export function assignAttribute<El extends SupportedElement, ATT extends keyof E
|
|||||||
): ElementAttributes<El>[ATT]
|
): ElementAttributes<El>[ATT]
|
||||||
|
|
||||||
type ExtendedHTMLElementTagNameMap= HTMLElementTagNameMap & CustomElementTagNameMap;
|
type ExtendedHTMLElementTagNameMap= HTMLElementTagNameMap & CustomElementTagNameMap;
|
||||||
|
export function el<
|
||||||
|
A extends ddeComponentAttributes,
|
||||||
|
EL extends SupportedElement | ddeDocumentFragment
|
||||||
|
>(
|
||||||
|
component: (attr: A)=> EL,
|
||||||
|
attrs?: A extends { textContent: any } ? ( NoInfer<A> | ddeStringable ) : NoInfer<A>,
|
||||||
|
...addons: ddeElementAddon<EL>[]
|
||||||
|
): EL extends ddeHTMLElementTagNameMap[keyof ddeHTMLElementTagNameMap]
|
||||||
|
? EL
|
||||||
|
: ( EL extends ddeDocumentFragment ? EL : ddeHTMLElement )
|
||||||
export function el<
|
export function el<
|
||||||
TAG extends keyof ExtendedHTMLElementTagNameMap,
|
TAG extends keyof ExtendedHTMLElementTagNameMap,
|
||||||
>(
|
>(
|
||||||
@ -89,16 +99,6 @@ export function el(
|
|||||||
attrs?: ElementAttributes<HTMLElement> | ddeStringable,
|
attrs?: ElementAttributes<HTMLElement> | ddeStringable,
|
||||||
...addons: ddeElementAddon<HTMLElement>[]
|
...addons: ddeElementAddon<HTMLElement>[]
|
||||||
): ddeHTMLElement
|
): ddeHTMLElement
|
||||||
|
|
||||||
export function el<
|
|
||||||
C extends (attr: ddeComponentAttributes)=> SupportedElement | ddeDocumentFragment
|
|
||||||
>(
|
|
||||||
component: C,
|
|
||||||
attrs?: Parameters<C>[0] | ddeStringable,
|
|
||||||
...addons: ddeElementAddon<ReturnType<C>>[]
|
|
||||||
): ReturnType<C> extends ddeHTMLElementTagNameMap[keyof ddeHTMLElementTagNameMap]
|
|
||||||
? ReturnType<C>
|
|
||||||
: ( ReturnType<C> extends ddeDocumentFragment ? ReturnType<C> : ddeHTMLElement )
|
|
||||||
export { el as createElement }
|
export { el as createElement }
|
||||||
|
|
||||||
export function elNS(
|
export function elNS(
|
||||||
|
Reference in New Issue
Block a user