mirror of
https://github.com/jaandrle/deka-dom-el
synced 2024-11-21 23:39:37 +01:00
✨ add className and classList to ElementAttributes
This commit is contained in:
parent
0794659104
commit
8df6aa19fe
8
index.d.ts
vendored
8
index.d.ts
vendored
@ -25,6 +25,10 @@ type AttrsModified= {
|
||||
* Provide option to add/remove/toggle CSS clasess (index of object) using 1/0/-1. In fact `el.classList.toggle(class_name)` for `-1` and `el.classList.toggle(class_name, Boolean(...))` for others.
|
||||
*/
|
||||
classList: Record<string,-1|0|1>,
|
||||
/**
|
||||
* By default simiral to `className`, but also supports `string[]`
|
||||
* */
|
||||
className: string | (string|boolean|undefined)[];
|
||||
/**
|
||||
* Sets `aria-*` simiraly to `dataset`
|
||||
* */
|
||||
@ -40,8 +44,8 @@ type AttrsModified= {
|
||||
*/
|
||||
type ElementAttributes<T extends keyof ElementTagNameMap | ElementTagNameMap[keyof ElementTagNameMap]>=
|
||||
T extends keyof ElementTagNameMap ?
|
||||
Omit<ElementTagNameMap[T],"classList"> & AttrsModified :
|
||||
Omit<T,"classList"> & AttrsModified;
|
||||
Omit<ElementTagNameMap[T],"classList"|"className"> & AttrsModified :
|
||||
Omit<T,"classList"|"className"> & AttrsModified;
|
||||
export function assign<El extends Element>(element: El, ...attrs_array: ElementAttributes<El>[]): El
|
||||
|
||||
type ElementExtender<El extends Element>= (element: El)=> El;
|
||||
|
Loading…
Reference in New Issue
Block a user