1
0
mirror of https://github.com/jaandrle/deka-dom-el synced 2024-11-24 09:29:37 +01:00

Compare commits

...

4 Commits

Author SHA1 Message Date
b7d62dbce7
♻️ Refactor signal mapping to attributes 2023-10-19 17:11:55 +02:00
029ef5adb4
♻️ Update build.js to improve cli out 2023-10-19 15:28:44 +02:00
97da5441ee
Bundle DTS files 2023-10-19 15:01:54 +02:00
19fd857dac
♻️ Update build script to support minification levels
Full minification by default
2023-10-19 14:23:10 +02:00
13 changed files with 743 additions and 1923 deletions

View File

@ -1,40 +1,51 @@
#!/usr/bin/env -S npx nodejsscript
const files= [ "index.js", "index-with-signals.js" ];
import { bundle as bundleDTS } from "dts-bundler";
const files= [ "index", "index-with-signals" ];
const filesOut= (file, mark= "esm")=> "dist/"+file.replace("index", mark);
for(const file of files){
const out= filesOut(file);
s.run([
"npx esbuild '::file::'",
"--platform=neutral",
"--bundle",
//"--minify",
"--minify-syntax --minify-identifiers",
"--legal-comments=inline",
"--packages=external",
"--outfile='::out::'"
].join(" "), { file, out });
pipe(
f=> f.replace(/^ +/gm, m=> "\t".repeat(m.length/2)),
f=> s.echo(f).to(out)
)(s.cat(out));
toDDE(out, filesOut(file, "dde"));
}
$.exit(0);
$.api("", true)
.option("--minify", "Level of minification [ full (default), partial ]")
.action(function main({ minify= "full" }){
for(const file_root of files){
const file= file_root+".js";
const out= filesOut(file);
s.run([
"npx esbuild '::file::'",
"--platform=neutral",
"--bundle",
minify==="full" ? "--minify" : "--minify-syntax --minify-identifiers",
"--legal-comments=inline",
"--packages=external",
"--outfile='::out::'"
].join(" "), { file, out });
pipe(
f=> f.replace(/^ +/gm, m=> "\t".repeat(m.length/2)),
f=> s.echo(f).to(out)
)(s.cat(out));
const file_dts= file_root+".d.ts";
const file_dts_out= filesOut(file_dts);
echo(` ${file_dts_out}`)
s.echo(bundleDTS(file_dts)).to(file_dts_out);
echo("⚡ Done");
toDDE(out, filesOut(file, "dde"));
}
$.exit(0);
function toDDE(file, out){
const name= "dde";
echo(`\n ${out} (${file} → globalThis.${name})\n`);
let content= s.cat(file).toString().split(/export ?{/);
content.splice(1, 0, `\nglobalThis.${name}= {`);
content[2]= content[2].replace(/^(\t*)(.*) as ([^,\n]*)(,?)$/mg, "$1$3: $2$4");
s.echo([
`//deka-dom-el library is available via global namespace \`${name}\``,
"(()=> {",
"\t"+content.join("").split("\n").join("\n "),
"})();"
].join("\n")).to(out);
echo("⚡ Done\n");
}
function toDDE(file, out){
const name= "dde";
echo(` ${out} (${file} → globalThis.${name})`);
let content= s.cat(file).toString().split(/export ?{/);
content.splice(1, 0, `\nglobalThis.${name}= {`);
content[2]= content[2].replace(/,(?!\n)/g, ",\n").replace(/(?<!\n)}/, "\n}").replace(/^(\t*)(.*) as ([^,\n]*)(,?)$/mg, "$1$3: $2$4");
s.echo([
`//deka-dom-el library is available via global namespace \`${name}\``,
"(()=> {",
content.join(""),
"})();"
].join("\n")).to(out);
echo("⚡ Done");
}
})
.parse();

File diff suppressed because one or more lines are too long

353
dist/dde.js vendored

File diff suppressed because one or more lines are too long

248
dist/esm-with-signals.d.ts vendored Normal file
View File

@ -0,0 +1,248 @@
declare global {
type ddeComponentAttributes= Record<any, any> | undefined | string;
type ddeElementExtender<El extends Element>= (element: El)=> El;
}
type ElementTagNameMap= HTMLElementTagNameMap & SVGElementTagNameMap & {
'#text': Text
}
type Element= ElementTagNameMap[keyof ElementTagNameMap];
type AttrsModified= {
/**
* In fact argumen for `*.setAttribute("style", *)`.
*/
style: string
/**
* 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`
* */
ariaset: Record<string,string>,
}
/**
* Just element attributtes
*
* In most cases, you can use native propertie such as [MDN WEB/API/Element](https://developer.mozilla.org/en-US/docs/Web/API/Element) and so on (e.g. [`Text`](https://developer.mozilla.org/en-US/docs/Web/API/Text)).
*
* There is added support for `data[A-Z].*`/`aria[A-Z].*` to be converted to the kebab-case alternatives.
* @private
*/
type ElementAttributes<T extends keyof ElementTagNameMap | ElementTagNameMap[keyof ElementTagNameMap]>=
T extends keyof ElementTagNameMap ?
Omit<ElementTagNameMap[T],"classList"|"className"> & AttrsModified :
Omit<T,"classList"|"className"> & AttrsModified;
export function assign<El extends Element>(element: El, ...attrs_array: Partial<ElementAttributes<El>>[]): El
type TagNameFragment= "<>";
export function el<TAG extends keyof ElementTagNameMap>(
tag_name: TAG,
attrs?: Partial<ElementAttributes<ElementTagNameMap[TAG]>>,
...extenders: ddeElementExtender<ElementTagNameMap[TAG]>[]
): ElementTagNameMap[TAG]
export function el<T>(
tag_name: TagNameFragment,
): DocumentFragment
export function el<
A extends ddeComponentAttributes,
C extends (attr: A)=> Element>(
fComponent: C,
attrs?: A,
...extenders: ddeElementExtender<ReturnType<C>>[]
): ReturnType<C>
export function dispatchEvent(element: HTMLElement, name: keyof DocumentEventMap): void;
export function dispatchEvent(element: HTMLElement, name: string, data: any): void;
interface On{
<
EE extends ddeElementExtender<Element>,
El extends ( EE extends ddeElementExtender<infer El> ? El : never ),
Event extends keyof DocumentEventMap>(
type: Event,
listener: (this: El, ev: DocumentEventMap[Event]) => any,
options?: AddEventListenerOptions
) : EE;
connected<
EE extends ddeElementExtender<Element>,
El extends ( EE extends ddeElementExtender<infer El> ? El : never )
>(
listener: (el: El) => any,
options?: AddEventListenerOptions
) : EE;
disconnected<
EE extends ddeElementExtender<Element>,
El extends ( EE extends ddeElementExtender<infer El> ? El : never )
>(
listener: (el: El) => any,
options?: AddEventListenerOptions
) : EE;
}
export const on: On;
//TODO for SVG
declare global{
interface HTMLDivElement{ append(...nodes: (Node | string)[]): HTMLDivElement; }
interface HTMLAnchorElement{ append(...nodes: (Node | string)[]): HTMLAnchorElement; }
interface HTMLElement{ append(...nodes: (Node | string)[]): HTMLElement; }
interface HTMLElement{ append(...nodes: (Node | string)[]): HTMLElement; }
interface HTMLAreaElement{ append(...nodes: (Node | string)[]): HTMLAreaElement; }
interface HTMLElement{ append(...nodes: (Node | string)[]): HTMLElement; }
interface HTMLElement{ append(...nodes: (Node | string)[]): HTMLElement; }
interface HTMLAudioElement{ append(...nodes: (Node | string)[]): HTMLAudioElement; }
interface HTMLElement{ append(...nodes: (Node | string)[]): HTMLElement; }
interface HTMLBaseElement{ append(...nodes: (Node | string)[]): HTMLBaseElement; }
interface HTMLElement{ append(...nodes: (Node | string)[]): HTMLElement; }
interface HTMLElement{ append(...nodes: (Node | string)[]): HTMLElement; }
interface HTMLQuoteElement{ append(...nodes: (Node | string)[]): HTMLQuoteElement; }
interface HTMLBodyElement{ append(...nodes: (Node | string)[]): HTMLBodyElement; }
interface HTMLBRElement{ append(...nodes: (Node | string)[]): HTMLBRElement; }
interface HTMLButtonElement{ append(...nodes: (Node | string)[]): HTMLButtonElement; }
interface HTMLCanvasElement{ append(...nodes: (Node | string)[]): HTMLCanvasElement; }
interface HTMLTableCaptionElement{ append(...nodes: (Node | string)[]): HTMLTableCaptionElement; }
interface HTMLElement{ append(...nodes: (Node | string)[]): HTMLElement; }
interface HTMLElement{ append(...nodes: (Node | string)[]): HTMLElement; }
interface HTMLTableColElement{ append(...nodes: (Node | string)[]): HTMLTableColElement; }
interface HTMLTableColElement{ append(...nodes: (Node | string)[]): HTMLTableColElement; }
interface HTMLDataElement{ append(...nodes: (Node | string)[]): HTMLDataElement; }
interface HTMLDataListElement{ append(...nodes: (Node | string)[]): HTMLDataListElement; }
interface HTMLElement{ append(...nodes: (Node | string)[]): HTMLElement; }
interface HTMLModElement{ append(...nodes: (Node | string)[]): HTMLModElement; }
interface HTMLDetailsElement{ append(...nodes: (Node | string)[]): HTMLDetailsElement; }
interface HTMLElement{ append(...nodes: (Node | string)[]): HTMLElement; }
interface HTMLDialogElement{ append(...nodes: (Node | string)[]): HTMLDialogElement; }
interface HTMLDivElement{ append(...nodes: (Node | string)[]): HTMLDivElement; }
interface HTMLDListElement{ append(...nodes: (Node | string)[]): HTMLDListElement; }
interface HTMLElement{ append(...nodes: (Node | string)[]): HTMLElement; }
interface HTMLElement{ append(...nodes: (Node | string)[]): HTMLElement; }
interface HTMLEmbedElement{ append(...nodes: (Node | string)[]): HTMLEmbedElement; }
interface HTMLFieldSetElement{ append(...nodes: (Node | string)[]): HTMLFieldSetElement; }
interface HTMLElement{ append(...nodes: (Node | string)[]): HTMLElement; }
interface HTMLElement{ append(...nodes: (Node | string)[]): HTMLElement; }
interface HTMLElement{ append(...nodes: (Node | string)[]): HTMLElement; }
interface HTMLFormElement{ append(...nodes: (Node | string)[]): HTMLFormElement; }
interface HTMLHeadingElement{ append(...nodes: (Node | string)[]): HTMLHeadingElement; }
interface HTMLHeadingElement{ append(...nodes: (Node | string)[]): HTMLHeadingElement; }
interface HTMLHeadingElement{ append(...nodes: (Node | string)[]): HTMLHeadingElement; }
interface HTMLHeadingElement{ append(...nodes: (Node | string)[]): HTMLHeadingElement; }
interface HTMLHeadingElement{ append(...nodes: (Node | string)[]): HTMLHeadingElement; }
interface HTMLHeadingElement{ append(...nodes: (Node | string)[]): HTMLHeadingElement; }
interface HTMLHeadElement{ append(...nodes: (Node | string)[]): HTMLHeadElement; }
interface HTMLElement{ append(...nodes: (Node | string)[]): HTMLElement; }
interface HTMLElement{ append(...nodes: (Node | string)[]): HTMLElement; }
interface HTMLHRElement{ append(...nodes: (Node | string)[]): HTMLHRElement; }
interface HTMLHtmlElement{ append(...nodes: (Node | string)[]): HTMLHtmlElement; }
interface HTMLElement{ append(...nodes: (Node | string)[]): HTMLElement; }
interface HTMLIFrameElement{ append(...nodes: (Node | string)[]): HTMLIFrameElement; }
interface HTMLImageElement{ append(...nodes: (Node | string)[]): HTMLImageElement; }
interface HTMLInputElement{ append(...nodes: (Node | string)[]): HTMLInputElement; }
interface HTMLModElement{ append(...nodes: (Node | string)[]): HTMLModElement; }
interface HTMLElement{ append(...nodes: (Node | string)[]): HTMLElement; }
interface HTMLLabelElement{ append(...nodes: (Node | string)[]): HTMLLabelElement; }
interface HTMLLegendElement{ append(...nodes: (Node | string)[]): HTMLLegendElement; }
interface HTMLLIElement{ append(...nodes: (Node | string)[]): HTMLLIElement; }
interface HTMLLinkElement{ append(...nodes: (Node | string)[]): HTMLLinkElement; }
interface HTMLElement{ append(...nodes: (Node | string)[]): HTMLElement; }
interface HTMLMapElement{ append(...nodes: (Node | string)[]): HTMLMapElement; }
interface HTMLElement{ append(...nodes: (Node | string)[]): HTMLElement; }
interface HTMLMenuElement{ append(...nodes: (Node | string)[]): HTMLMenuElement; }
interface HTMLMetaElement{ append(...nodes: (Node | string)[]): HTMLMetaElement; }
interface HTMLMeterElement{ append(...nodes: (Node | string)[]): HTMLMeterElement; }
interface HTMLElement{ append(...nodes: (Node | string)[]): HTMLElement; }
interface HTMLElement{ append(...nodes: (Node | string)[]): HTMLElement; }
interface HTMLObjectElement{ append(...nodes: (Node | string)[]): HTMLObjectElement; }
interface HTMLOListElement{ append(...nodes: (Node | string)[]): HTMLOListElement; }
interface HTMLOptGroupElement{ append(...nodes: (Node | string)[]): HTMLOptGroupElement; }
interface HTMLOptionElement{ append(...nodes: (Node | string)[]): HTMLOptionElement; }
interface HTMLOutputElement{ append(...nodes: (Node | string)[]): HTMLOutputElement; }
interface HTMLParagraphElement{ append(...nodes: (Node | string)[]): HTMLParagraphElement; }
interface HTMLPictureElement{ append(...nodes: (Node | string)[]): HTMLPictureElement; }
interface HTMLPreElement{ append(...nodes: (Node | string)[]): HTMLPreElement; }
interface HTMLProgressElement{ append(...nodes: (Node | string)[]): HTMLProgressElement; }
interface HTMLQuoteElement{ append(...nodes: (Node | string)[]): HTMLQuoteElement; }
interface HTMLElement{ append(...nodes: (Node | string)[]): HTMLElement; }
interface HTMLElement{ append(...nodes: (Node | string)[]): HTMLElement; }
interface HTMLElement{ append(...nodes: (Node | string)[]): HTMLElement; }
interface HTMLElement{ append(...nodes: (Node | string)[]): HTMLElement; }
interface HTMLElement{ append(...nodes: (Node | string)[]): HTMLElement; }
interface HTMLScriptElement{ append(...nodes: (Node | string)[]): HTMLScriptElement; }
interface HTMLElement{ append(...nodes: (Node | string)[]): HTMLElement; }
interface HTMLSelectElement{ append(...nodes: (Node | string)[]): HTMLSelectElement; }
interface HTMLSlotElement{ append(...nodes: (Node | string)[]): HTMLSlotElement; }
interface HTMLElement{ append(...nodes: (Node | string)[]): HTMLElement; }
interface HTMLSourceElement{ append(...nodes: (Node | string)[]): HTMLSourceElement; }
interface HTMLSpanElement{ append(...nodes: (Node | string)[]): HTMLSpanElement; }
interface HTMLElement{ append(...nodes: (Node | string)[]): HTMLElement; }
interface HTMLStyleElement{ append(...nodes: (Node | string)[]): HTMLStyleElement; }
interface HTMLElement{ append(...nodes: (Node | string)[]): HTMLElement; }
interface HTMLElement{ append(...nodes: (Node | string)[]): HTMLElement; }
interface HTMLElement{ append(...nodes: (Node | string)[]): HTMLElement; }
interface HTMLTableElement{ append(...nodes: (Node | string)[]): HTMLTableElement; }
interface HTMLTableSectionElement{ append(...nodes: (Node | string)[]): HTMLTableSectionElement; }
interface HTMLTableCellElement{ append(...nodes: (Node | string)[]): HTMLTableCellElement; }
interface HTMLTemplateElement{ append(...nodes: (Node | string)[]): HTMLTemplateElement; }
interface HTMLTextAreaElement{ append(...nodes: (Node | string)[]): HTMLTextAreaElement; }
interface HTMLTableSectionElement{ append(...nodes: (Node | string)[]): HTMLTableSectionElement; }
interface HTMLTableCellElement{ append(...nodes: (Node | string)[]): HTMLTableCellElement; }
interface HTMLTableSectionElement{ append(...nodes: (Node | string)[]): HTMLTableSectionElement; }
interface HTMLTimeElement{ append(...nodes: (Node | string)[]): HTMLTimeElement; }
interface HTMLTitleElement{ append(...nodes: (Node | string)[]): HTMLTitleElement; }
interface HTMLTableRowElement{ append(...nodes: (Node | string)[]): HTMLTableRowElement; }
interface HTMLTrackElement{ append(...nodes: (Node | string)[]): HTMLTrackElement; }
interface HTMLElement{ append(...nodes: (Node | string)[]): HTMLElement; }
interface HTMLUListElement{ append(...nodes: (Node | string)[]): HTMLUListElement; }
interface HTMLElement{ append(...nodes: (Node | string)[]): HTMLElement; }
interface HTMLVideoElement{ append(...nodes: (Node | string)[]): HTMLVideoElement; }
interface HTMLElement{ append(...nodes: (Node | string)[]): HTMLElement; }
interface DocumentFragment{ append(...nodes: (Node | string)[]): DocumentFragment; }
}
export type Signal<V, A>= (set?: V)=> V & A;
type Action<V>= (this: { value: V }, ...a: any[])=> typeof S._ | void;
type SymbolOnclear= Symbol;
type SymbolSignal= Symbol;
type Actions<V>= Record<string, Action<V>>;
interface S {
_: Symbol
/**
* Simple example:
* ```js
* const hello= S("Hello Signal");
* ```
* simple todo signal:
* ```js
* const todos= S([], {
* add(v){ this.value.push(S(v)); },
* remove(i){ this.value.splice(i, 1); },
* [S.symbols.onclear](){ S.clear(...this.value); },
* });
* ```
* computed signal:
* ```js
* const name= S("Jan");
* const surname= S("Andrle");
* const fullname= S(()=> name()+" "+surname());
* ```
* @param value Initial signal value. Or function computing value from other signals.
* @param actions Use to define actions on the signal. Such as add item to the array.
* There is also a reserved function `S.symbol.onclear` which is called when the signal is cleared
* by `S.clear`.
* */
<V, A extends Actions<V>>(value: V, actions?: A): Signal<V, A>;
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,
...params: A[N] extends (...args: infer P)=> any ? P : never
): void;
clear(...signals: Signal<any, any>[]): void;
on<T>(signal: Signal<T, any>, onchange: (a: T)=> void, options?: AddEventListenerOptions): void;
symbols: {
signal: SymbolSignal;
onclear: SymbolOnclear;
}
el<S extends any, T extends HTMLElement>(signal: Signal<S, any>, el: (v: S)=> T): T;
}
export const S: S;
declare global {
type ddeSignal<T, A= {}>= Signal<T, A>;
type ddeActions<V>= Actions<V>
}

File diff suppressed because one or more lines are too long

198
dist/esm.d.ts vendored Normal file
View File

@ -0,0 +1,198 @@
declare global {
type ddeComponentAttributes= Record<any, any> | undefined | string;
type ddeElementExtender<El extends Element>= (element: El)=> El;
}
type ElementTagNameMap= HTMLElementTagNameMap & SVGElementTagNameMap & {
'#text': Text
}
type Element= ElementTagNameMap[keyof ElementTagNameMap];
type AttrsModified= {
/**
* In fact argumen for `*.setAttribute("style", *)`.
*/
style: string
/**
* 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`
* */
ariaset: Record<string,string>,
}
/**
* Just element attributtes
*
* In most cases, you can use native propertie such as [MDN WEB/API/Element](https://developer.mozilla.org/en-US/docs/Web/API/Element) and so on (e.g. [`Text`](https://developer.mozilla.org/en-US/docs/Web/API/Text)).
*
* There is added support for `data[A-Z].*`/`aria[A-Z].*` to be converted to the kebab-case alternatives.
* @private
*/
type ElementAttributes<T extends keyof ElementTagNameMap | ElementTagNameMap[keyof ElementTagNameMap]>=
T extends keyof ElementTagNameMap ?
Omit<ElementTagNameMap[T],"classList"|"className"> & AttrsModified :
Omit<T,"classList"|"className"> & AttrsModified;
export function assign<El extends Element>(element: El, ...attrs_array: Partial<ElementAttributes<El>>[]): El
type TagNameFragment= "<>";
export function el<TAG extends keyof ElementTagNameMap>(
tag_name: TAG,
attrs?: Partial<ElementAttributes<ElementTagNameMap[TAG]>>,
...extenders: ddeElementExtender<ElementTagNameMap[TAG]>[]
): ElementTagNameMap[TAG]
export function el<T>(
tag_name: TagNameFragment,
): DocumentFragment
export function el<
A extends ddeComponentAttributes,
C extends (attr: A)=> Element>(
fComponent: C,
attrs?: A,
...extenders: ddeElementExtender<ReturnType<C>>[]
): ReturnType<C>
export function dispatchEvent(element: HTMLElement, name: keyof DocumentEventMap): void;
export function dispatchEvent(element: HTMLElement, name: string, data: any): void;
interface On{
<
EE extends ddeElementExtender<Element>,
El extends ( EE extends ddeElementExtender<infer El> ? El : never ),
Event extends keyof DocumentEventMap>(
type: Event,
listener: (this: El, ev: DocumentEventMap[Event]) => any,
options?: AddEventListenerOptions
) : EE;
connected<
EE extends ddeElementExtender<Element>,
El extends ( EE extends ddeElementExtender<infer El> ? El : never )
>(
listener: (el: El) => any,
options?: AddEventListenerOptions
) : EE;
disconnected<
EE extends ddeElementExtender<Element>,
El extends ( EE extends ddeElementExtender<infer El> ? El : never )
>(
listener: (el: El) => any,
options?: AddEventListenerOptions
) : EE;
}
export const on: On;
//TODO for SVG
declare global{
interface HTMLDivElement{ append(...nodes: (Node | string)[]): HTMLDivElement; }
interface HTMLAnchorElement{ append(...nodes: (Node | string)[]): HTMLAnchorElement; }
interface HTMLElement{ append(...nodes: (Node | string)[]): HTMLElement; }
interface HTMLElement{ append(...nodes: (Node | string)[]): HTMLElement; }
interface HTMLAreaElement{ append(...nodes: (Node | string)[]): HTMLAreaElement; }
interface HTMLElement{ append(...nodes: (Node | string)[]): HTMLElement; }
interface HTMLElement{ append(...nodes: (Node | string)[]): HTMLElement; }
interface HTMLAudioElement{ append(...nodes: (Node | string)[]): HTMLAudioElement; }
interface HTMLElement{ append(...nodes: (Node | string)[]): HTMLElement; }
interface HTMLBaseElement{ append(...nodes: (Node | string)[]): HTMLBaseElement; }
interface HTMLElement{ append(...nodes: (Node | string)[]): HTMLElement; }
interface HTMLElement{ append(...nodes: (Node | string)[]): HTMLElement; }
interface HTMLQuoteElement{ append(...nodes: (Node | string)[]): HTMLQuoteElement; }
interface HTMLBodyElement{ append(...nodes: (Node | string)[]): HTMLBodyElement; }
interface HTMLBRElement{ append(...nodes: (Node | string)[]): HTMLBRElement; }
interface HTMLButtonElement{ append(...nodes: (Node | string)[]): HTMLButtonElement; }
interface HTMLCanvasElement{ append(...nodes: (Node | string)[]): HTMLCanvasElement; }
interface HTMLTableCaptionElement{ append(...nodes: (Node | string)[]): HTMLTableCaptionElement; }
interface HTMLElement{ append(...nodes: (Node | string)[]): HTMLElement; }
interface HTMLElement{ append(...nodes: (Node | string)[]): HTMLElement; }
interface HTMLTableColElement{ append(...nodes: (Node | string)[]): HTMLTableColElement; }
interface HTMLTableColElement{ append(...nodes: (Node | string)[]): HTMLTableColElement; }
interface HTMLDataElement{ append(...nodes: (Node | string)[]): HTMLDataElement; }
interface HTMLDataListElement{ append(...nodes: (Node | string)[]): HTMLDataListElement; }
interface HTMLElement{ append(...nodes: (Node | string)[]): HTMLElement; }
interface HTMLModElement{ append(...nodes: (Node | string)[]): HTMLModElement; }
interface HTMLDetailsElement{ append(...nodes: (Node | string)[]): HTMLDetailsElement; }
interface HTMLElement{ append(...nodes: (Node | string)[]): HTMLElement; }
interface HTMLDialogElement{ append(...nodes: (Node | string)[]): HTMLDialogElement; }
interface HTMLDivElement{ append(...nodes: (Node | string)[]): HTMLDivElement; }
interface HTMLDListElement{ append(...nodes: (Node | string)[]): HTMLDListElement; }
interface HTMLElement{ append(...nodes: (Node | string)[]): HTMLElement; }
interface HTMLElement{ append(...nodes: (Node | string)[]): HTMLElement; }
interface HTMLEmbedElement{ append(...nodes: (Node | string)[]): HTMLEmbedElement; }
interface HTMLFieldSetElement{ append(...nodes: (Node | string)[]): HTMLFieldSetElement; }
interface HTMLElement{ append(...nodes: (Node | string)[]): HTMLElement; }
interface HTMLElement{ append(...nodes: (Node | string)[]): HTMLElement; }
interface HTMLElement{ append(...nodes: (Node | string)[]): HTMLElement; }
interface HTMLFormElement{ append(...nodes: (Node | string)[]): HTMLFormElement; }
interface HTMLHeadingElement{ append(...nodes: (Node | string)[]): HTMLHeadingElement; }
interface HTMLHeadingElement{ append(...nodes: (Node | string)[]): HTMLHeadingElement; }
interface HTMLHeadingElement{ append(...nodes: (Node | string)[]): HTMLHeadingElement; }
interface HTMLHeadingElement{ append(...nodes: (Node | string)[]): HTMLHeadingElement; }
interface HTMLHeadingElement{ append(...nodes: (Node | string)[]): HTMLHeadingElement; }
interface HTMLHeadingElement{ append(...nodes: (Node | string)[]): HTMLHeadingElement; }
interface HTMLHeadElement{ append(...nodes: (Node | string)[]): HTMLHeadElement; }
interface HTMLElement{ append(...nodes: (Node | string)[]): HTMLElement; }
interface HTMLElement{ append(...nodes: (Node | string)[]): HTMLElement; }
interface HTMLHRElement{ append(...nodes: (Node | string)[]): HTMLHRElement; }
interface HTMLHtmlElement{ append(...nodes: (Node | string)[]): HTMLHtmlElement; }
interface HTMLElement{ append(...nodes: (Node | string)[]): HTMLElement; }
interface HTMLIFrameElement{ append(...nodes: (Node | string)[]): HTMLIFrameElement; }
interface HTMLImageElement{ append(...nodes: (Node | string)[]): HTMLImageElement; }
interface HTMLInputElement{ append(...nodes: (Node | string)[]): HTMLInputElement; }
interface HTMLModElement{ append(...nodes: (Node | string)[]): HTMLModElement; }
interface HTMLElement{ append(...nodes: (Node | string)[]): HTMLElement; }
interface HTMLLabelElement{ append(...nodes: (Node | string)[]): HTMLLabelElement; }
interface HTMLLegendElement{ append(...nodes: (Node | string)[]): HTMLLegendElement; }
interface HTMLLIElement{ append(...nodes: (Node | string)[]): HTMLLIElement; }
interface HTMLLinkElement{ append(...nodes: (Node | string)[]): HTMLLinkElement; }
interface HTMLElement{ append(...nodes: (Node | string)[]): HTMLElement; }
interface HTMLMapElement{ append(...nodes: (Node | string)[]): HTMLMapElement; }
interface HTMLElement{ append(...nodes: (Node | string)[]): HTMLElement; }
interface HTMLMenuElement{ append(...nodes: (Node | string)[]): HTMLMenuElement; }
interface HTMLMetaElement{ append(...nodes: (Node | string)[]): HTMLMetaElement; }
interface HTMLMeterElement{ append(...nodes: (Node | string)[]): HTMLMeterElement; }
interface HTMLElement{ append(...nodes: (Node | string)[]): HTMLElement; }
interface HTMLElement{ append(...nodes: (Node | string)[]): HTMLElement; }
interface HTMLObjectElement{ append(...nodes: (Node | string)[]): HTMLObjectElement; }
interface HTMLOListElement{ append(...nodes: (Node | string)[]): HTMLOListElement; }
interface HTMLOptGroupElement{ append(...nodes: (Node | string)[]): HTMLOptGroupElement; }
interface HTMLOptionElement{ append(...nodes: (Node | string)[]): HTMLOptionElement; }
interface HTMLOutputElement{ append(...nodes: (Node | string)[]): HTMLOutputElement; }
interface HTMLParagraphElement{ append(...nodes: (Node | string)[]): HTMLParagraphElement; }
interface HTMLPictureElement{ append(...nodes: (Node | string)[]): HTMLPictureElement; }
interface HTMLPreElement{ append(...nodes: (Node | string)[]): HTMLPreElement; }
interface HTMLProgressElement{ append(...nodes: (Node | string)[]): HTMLProgressElement; }
interface HTMLQuoteElement{ append(...nodes: (Node | string)[]): HTMLQuoteElement; }
interface HTMLElement{ append(...nodes: (Node | string)[]): HTMLElement; }
interface HTMLElement{ append(...nodes: (Node | string)[]): HTMLElement; }
interface HTMLElement{ append(...nodes: (Node | string)[]): HTMLElement; }
interface HTMLElement{ append(...nodes: (Node | string)[]): HTMLElement; }
interface HTMLElement{ append(...nodes: (Node | string)[]): HTMLElement; }
interface HTMLScriptElement{ append(...nodes: (Node | string)[]): HTMLScriptElement; }
interface HTMLElement{ append(...nodes: (Node | string)[]): HTMLElement; }
interface HTMLSelectElement{ append(...nodes: (Node | string)[]): HTMLSelectElement; }
interface HTMLSlotElement{ append(...nodes: (Node | string)[]): HTMLSlotElement; }
interface HTMLElement{ append(...nodes: (Node | string)[]): HTMLElement; }
interface HTMLSourceElement{ append(...nodes: (Node | string)[]): HTMLSourceElement; }
interface HTMLSpanElement{ append(...nodes: (Node | string)[]): HTMLSpanElement; }
interface HTMLElement{ append(...nodes: (Node | string)[]): HTMLElement; }
interface HTMLStyleElement{ append(...nodes: (Node | string)[]): HTMLStyleElement; }
interface HTMLElement{ append(...nodes: (Node | string)[]): HTMLElement; }
interface HTMLElement{ append(...nodes: (Node | string)[]): HTMLElement; }
interface HTMLElement{ append(...nodes: (Node | string)[]): HTMLElement; }
interface HTMLTableElement{ append(...nodes: (Node | string)[]): HTMLTableElement; }
interface HTMLTableSectionElement{ append(...nodes: (Node | string)[]): HTMLTableSectionElement; }
interface HTMLTableCellElement{ append(...nodes: (Node | string)[]): HTMLTableCellElement; }
interface HTMLTemplateElement{ append(...nodes: (Node | string)[]): HTMLTemplateElement; }
interface HTMLTextAreaElement{ append(...nodes: (Node | string)[]): HTMLTextAreaElement; }
interface HTMLTableSectionElement{ append(...nodes: (Node | string)[]): HTMLTableSectionElement; }
interface HTMLTableCellElement{ append(...nodes: (Node | string)[]): HTMLTableCellElement; }
interface HTMLTableSectionElement{ append(...nodes: (Node | string)[]): HTMLTableSectionElement; }
interface HTMLTimeElement{ append(...nodes: (Node | string)[]): HTMLTimeElement; }
interface HTMLTitleElement{ append(...nodes: (Node | string)[]): HTMLTitleElement; }
interface HTMLTableRowElement{ append(...nodes: (Node | string)[]): HTMLTableRowElement; }
interface HTMLTrackElement{ append(...nodes: (Node | string)[]): HTMLTrackElement; }
interface HTMLElement{ append(...nodes: (Node | string)[]): HTMLElement; }
interface HTMLUListElement{ append(...nodes: (Node | string)[]): HTMLUListElement; }
interface HTMLElement{ append(...nodes: (Node | string)[]): HTMLElement; }
interface HTMLVideoElement{ append(...nodes: (Node | string)[]): HTMLVideoElement; }
interface HTMLElement{ append(...nodes: (Node | string)[]): HTMLElement; }
interface DocumentFragment{ append(...nodes: (Node | string)[]): DocumentFragment; }
}

339
dist/esm.js vendored

File diff suppressed because one or more lines are too long

2
index-with-signals.d.ts vendored Normal file
View File

@ -0,0 +1,2 @@
export * from "./index";
export * from "./signals";

298
package-lock.json generated
View File

@ -1,15 +1,16 @@
{
"name": "deka-dom-el",
"version": "0.4.0",
"version": "0.6.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "deka-dom-el",
"version": "0.4.0",
"version": "0.6.0",
"license": "MIT",
"devDependencies": {
"@size-limit/preset-small-lib": "^8.2.6",
"dts-bundler": "^0.1.0",
"esbuild": "^0.19.2",
"jshint": "^2.13.6",
"nodejsscript": "github:jaandrle/nodejsscript#dev-v1",
@ -20,9 +21,9 @@
}
},
"node_modules/@esbuild/android-arm": {
"version": "0.19.2",
"resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.19.2.tgz",
"integrity": "sha512-tM8yLeYVe7pRyAu9VMi/Q7aunpLwD139EY1S99xbQkT4/q2qa6eA4ige/WJQYdJ8GBL1K33pPFhPfPdJ/WzT8Q==",
"version": "0.19.5",
"resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.19.5.tgz",
"integrity": "sha512-bhvbzWFF3CwMs5tbjf3ObfGqbl/17ict2/uwOSfr3wmxDE6VdS2GqY/FuzIPe0q0bdhj65zQsvqfArI9MY6+AA==",
"cpu": [
"arm"
],
@ -36,9 +37,9 @@
}
},
"node_modules/@esbuild/android-arm64": {
"version": "0.19.2",
"resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.19.2.tgz",
"integrity": "sha512-lsB65vAbe90I/Qe10OjkmrdxSX4UJDjosDgb8sZUKcg3oefEuW2OT2Vozz8ef7wrJbMcmhvCC+hciF8jY/uAkw==",
"version": "0.19.5",
"resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.19.5.tgz",
"integrity": "sha512-5d1OkoJxnYQfmC+Zd8NBFjkhyCNYwM4n9ODrycTFY6Jk1IGiZ+tjVJDDSwDt77nK+tfpGP4T50iMtVi4dEGzhQ==",
"cpu": [
"arm64"
],
@ -52,9 +53,9 @@
}
},
"node_modules/@esbuild/android-x64": {
"version": "0.19.2",
"resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.19.2.tgz",
"integrity": "sha512-qK/TpmHt2M/Hg82WXHRc/W/2SGo/l1thtDHZWqFq7oi24AjZ4O/CpPSu6ZuYKFkEgmZlFoa7CooAyYmuvnaG8w==",
"version": "0.19.5",
"resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.19.5.tgz",
"integrity": "sha512-9t+28jHGL7uBdkBjL90QFxe7DVA+KGqWlHCF8ChTKyaKO//VLuoBricQCgwhOjA1/qOczsw843Fy4cbs4H3DVA==",
"cpu": [
"x64"
],
@ -68,9 +69,9 @@
}
},
"node_modules/@esbuild/darwin-arm64": {
"version": "0.19.2",
"resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.19.2.tgz",
"integrity": "sha512-Ora8JokrvrzEPEpZO18ZYXkH4asCdc1DLdcVy8TGf5eWtPO1Ie4WroEJzwI52ZGtpODy3+m0a2yEX9l+KUn0tA==",
"version": "0.19.5",
"resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.19.5.tgz",
"integrity": "sha512-mvXGcKqqIqyKoxq26qEDPHJuBYUA5KizJncKOAf9eJQez+L9O+KfvNFu6nl7SCZ/gFb2QPaRqqmG0doSWlgkqw==",
"cpu": [
"arm64"
],
@ -84,9 +85,9 @@
}
},
"node_modules/@esbuild/darwin-x64": {
"version": "0.19.2",
"resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.19.2.tgz",
"integrity": "sha512-tP+B5UuIbbFMj2hQaUr6EALlHOIOmlLM2FK7jeFBobPy2ERdohI4Ka6ZFjZ1ZYsrHE/hZimGuU90jusRE0pwDw==",
"version": "0.19.5",
"resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.19.5.tgz",
"integrity": "sha512-Ly8cn6fGLNet19s0X4unjcniX24I0RqjPv+kurpXabZYSXGM4Pwpmf85WHJN3lAgB8GSth7s5A0r856S+4DyiA==",
"cpu": [
"x64"
],
@ -100,9 +101,9 @@
}
},
"node_modules/@esbuild/freebsd-arm64": {
"version": "0.19.2",
"resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.19.2.tgz",
"integrity": "sha512-YbPY2kc0acfzL1VPVK6EnAlig4f+l8xmq36OZkU0jzBVHcOTyQDhnKQaLzZudNJQyymd9OqQezeaBgkTGdTGeQ==",
"version": "0.19.5",
"resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.19.5.tgz",
"integrity": "sha512-GGDNnPWTmWE+DMchq1W8Sd0mUkL+APvJg3b11klSGUDvRXh70JqLAO56tubmq1s2cgpVCSKYywEiKBfju8JztQ==",
"cpu": [
"arm64"
],
@ -116,9 +117,9 @@
}
},
"node_modules/@esbuild/freebsd-x64": {
"version": "0.19.2",
"resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.19.2.tgz",
"integrity": "sha512-nSO5uZT2clM6hosjWHAsS15hLrwCvIWx+b2e3lZ3MwbYSaXwvfO528OF+dLjas1g3bZonciivI8qKR/Hm7IWGw==",
"version": "0.19.5",
"resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.19.5.tgz",
"integrity": "sha512-1CCwDHnSSoA0HNwdfoNY0jLfJpd7ygaLAp5EHFos3VWJCRX9DMwWODf96s9TSse39Br7oOTLryRVmBoFwXbuuQ==",
"cpu": [
"x64"
],
@ -132,9 +133,9 @@
}
},
"node_modules/@esbuild/linux-arm": {
"version": "0.19.2",
"resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.19.2.tgz",
"integrity": "sha512-Odalh8hICg7SOD7XCj0YLpYCEc+6mkoq63UnExDCiRA2wXEmGlK5JVrW50vZR9Qz4qkvqnHcpH+OFEggO3PgTg==",
"version": "0.19.5",
"resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.19.5.tgz",
"integrity": "sha512-lrWXLY/vJBzCPC51QN0HM71uWgIEpGSjSZZADQhq7DKhPcI6NH1IdzjfHkDQws2oNpJKpR13kv7/pFHBbDQDwQ==",
"cpu": [
"arm"
],
@ -148,9 +149,9 @@
}
},
"node_modules/@esbuild/linux-arm64": {
"version": "0.19.2",
"resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.19.2.tgz",
"integrity": "sha512-ig2P7GeG//zWlU0AggA3pV1h5gdix0MA3wgB+NsnBXViwiGgY77fuN9Wr5uoCrs2YzaYfogXgsWZbm+HGr09xg==",
"version": "0.19.5",
"resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.19.5.tgz",
"integrity": "sha512-o3vYippBmSrjjQUCEEiTZ2l+4yC0pVJD/Dl57WfPwwlvFkrxoSO7rmBZFii6kQB3Wrn/6GwJUPLU5t52eq2meA==",
"cpu": [
"arm64"
],
@ -164,9 +165,9 @@
}
},
"node_modules/@esbuild/linux-ia32": {
"version": "0.19.2",
"resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.19.2.tgz",
"integrity": "sha512-mLfp0ziRPOLSTek0Gd9T5B8AtzKAkoZE70fneiiyPlSnUKKI4lp+mGEnQXcQEHLJAcIYDPSyBvsUbKUG2ri/XQ==",
"version": "0.19.5",
"resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.19.5.tgz",
"integrity": "sha512-MkjHXS03AXAkNp1KKkhSKPOCYztRtK+KXDNkBa6P78F8Bw0ynknCSClO/ztGszILZtyO/lVKpa7MolbBZ6oJtQ==",
"cpu": [
"ia32"
],
@ -180,9 +181,9 @@
}
},
"node_modules/@esbuild/linux-loong64": {
"version": "0.19.2",
"resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.19.2.tgz",
"integrity": "sha512-hn28+JNDTxxCpnYjdDYVMNTR3SKavyLlCHHkufHV91fkewpIyQchS1d8wSbmXhs1fiYDpNww8KTFlJ1dHsxeSw==",
"version": "0.19.5",
"resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.19.5.tgz",
"integrity": "sha512-42GwZMm5oYOD/JHqHska3Jg0r+XFb/fdZRX+WjADm3nLWLcIsN27YKtqxzQmGNJgu0AyXg4HtcSK9HuOk3v1Dw==",
"cpu": [
"loong64"
],
@ -196,9 +197,9 @@
}
},
"node_modules/@esbuild/linux-mips64el": {
"version": "0.19.2",
"resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.19.2.tgz",
"integrity": "sha512-KbXaC0Sejt7vD2fEgPoIKb6nxkfYW9OmFUK9XQE4//PvGIxNIfPk1NmlHmMg6f25x57rpmEFrn1OotASYIAaTg==",
"version": "0.19.5",
"resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.19.5.tgz",
"integrity": "sha512-kcjndCSMitUuPJobWCnwQ9lLjiLZUR3QLQmlgaBfMX23UEa7ZOrtufnRds+6WZtIS9HdTXqND4yH8NLoVVIkcg==",
"cpu": [
"mips64el"
],
@ -212,9 +213,9 @@
}
},
"node_modules/@esbuild/linux-ppc64": {
"version": "0.19.2",
"resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.19.2.tgz",
"integrity": "sha512-dJ0kE8KTqbiHtA3Fc/zn7lCd7pqVr4JcT0JqOnbj4LLzYnp+7h8Qi4yjfq42ZlHfhOCM42rBh0EwHYLL6LEzcw==",
"version": "0.19.5",
"resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.19.5.tgz",
"integrity": "sha512-yJAxJfHVm0ZbsiljbtFFP1BQKLc8kUF6+17tjQ78QjqjAQDnhULWiTA6u0FCDmYT1oOKS9PzZ2z0aBI+Mcyj7Q==",
"cpu": [
"ppc64"
],
@ -228,9 +229,9 @@
}
},
"node_modules/@esbuild/linux-riscv64": {
"version": "0.19.2",
"resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.19.2.tgz",
"integrity": "sha512-7Z/jKNFufZ/bbu4INqqCN6DDlrmOTmdw6D0gH+6Y7auok2r02Ur661qPuXidPOJ+FSgbEeQnnAGgsVynfLuOEw==",
"version": "0.19.5",
"resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.19.5.tgz",
"integrity": "sha512-5u8cIR/t3gaD6ad3wNt1MNRstAZO+aNyBxu2We8X31bA8XUNyamTVQwLDA1SLoPCUehNCymhBhK3Qim1433Zag==",
"cpu": [
"riscv64"
],
@ -244,9 +245,9 @@
}
},
"node_modules/@esbuild/linux-s390x": {
"version": "0.19.2",
"resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.19.2.tgz",
"integrity": "sha512-U+RinR6aXXABFCcAY4gSlv4CL1oOVvSSCdseQmGO66H+XyuQGZIUdhG56SZaDJQcLmrSfRmx5XZOWyCJPRqS7g==",
"version": "0.19.5",
"resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.19.5.tgz",
"integrity": "sha512-Z6JrMyEw/EmZBD/OFEFpb+gao9xJ59ATsoTNlj39jVBbXqoZm4Xntu6wVmGPB/OATi1uk/DB+yeDPv2E8PqZGw==",
"cpu": [
"s390x"
],
@ -260,9 +261,9 @@
}
},
"node_modules/@esbuild/linux-x64": {
"version": "0.19.2",
"resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.19.2.tgz",
"integrity": "sha512-oxzHTEv6VPm3XXNaHPyUTTte+3wGv7qVQtqaZCrgstI16gCuhNOtBXLEBkBREP57YTd68P0VgDgG73jSD8bwXQ==",
"version": "0.19.5",
"resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.19.5.tgz",
"integrity": "sha512-psagl+2RlK1z8zWZOmVdImisMtrUxvwereIdyJTmtmHahJTKb64pAcqoPlx6CewPdvGvUKe2Jw+0Z/0qhSbG1A==",
"cpu": [
"x64"
],
@ -276,9 +277,9 @@
}
},
"node_modules/@esbuild/netbsd-x64": {
"version": "0.19.2",
"resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.19.2.tgz",
"integrity": "sha512-WNa5zZk1XpTTwMDompZmvQLHszDDDN7lYjEHCUmAGB83Bgs20EMs7ICD+oKeT6xt4phV4NDdSi/8OfjPbSbZfQ==",
"version": "0.19.5",
"resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.19.5.tgz",
"integrity": "sha512-kL2l+xScnAy/E/3119OggX8SrWyBEcqAh8aOY1gr4gPvw76la2GlD4Ymf832UCVbmuWeTf2adkZDK+h0Z/fB4g==",
"cpu": [
"x64"
],
@ -292,9 +293,9 @@
}
},
"node_modules/@esbuild/openbsd-x64": {
"version": "0.19.2",
"resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.19.2.tgz",
"integrity": "sha512-S6kI1aT3S++Dedb7vxIuUOb3oAxqxk2Rh5rOXOTYnzN8JzW1VzBd+IqPiSpgitu45042SYD3HCoEyhLKQcDFDw==",
"version": "0.19.5",
"resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.19.5.tgz",
"integrity": "sha512-sPOfhtzFufQfTBgRnE1DIJjzsXukKSvZxloZbkJDG383q0awVAq600pc1nfqBcl0ice/WN9p4qLc39WhBShRTA==",
"cpu": [
"x64"
],
@ -308,9 +309,9 @@
}
},
"node_modules/@esbuild/sunos-x64": {
"version": "0.19.2",
"resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.19.2.tgz",
"integrity": "sha512-VXSSMsmb+Z8LbsQGcBMiM+fYObDNRm8p7tkUDMPG/g4fhFX5DEFmjxIEa3N8Zr96SjsJ1woAhF0DUnS3MF3ARw==",
"version": "0.19.5",
"resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.19.5.tgz",
"integrity": "sha512-dGZkBXaafuKLpDSjKcB0ax0FL36YXCvJNnztjKV+6CO82tTYVDSH2lifitJ29jxRMoUhgkg9a+VA/B03WK5lcg==",
"cpu": [
"x64"
],
@ -324,9 +325,9 @@
}
},
"node_modules/@esbuild/win32-arm64": {
"version": "0.19.2",
"resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.19.2.tgz",
"integrity": "sha512-5NayUlSAyb5PQYFAU9x3bHdsqB88RC3aM9lKDAz4X1mo/EchMIT1Q+pSeBXNgkfNmRecLXA0O8xP+x8V+g/LKg==",
"version": "0.19.5",
"resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.19.5.tgz",
"integrity": "sha512-dWVjD9y03ilhdRQ6Xig1NWNgfLtf2o/STKTS+eZuF90fI2BhbwD6WlaiCGKptlqXlURVB5AUOxUj09LuwKGDTg==",
"cpu": [
"arm64"
],
@ -340,9 +341,9 @@
}
},
"node_modules/@esbuild/win32-ia32": {
"version": "0.19.2",
"resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.19.2.tgz",
"integrity": "sha512-47gL/ek1v36iN0wL9L4Q2MFdujR0poLZMJwhO2/N3gA89jgHp4MR8DKCmwYtGNksbfJb9JoTtbkoe6sDhg2QTA==",
"version": "0.19.5",
"resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.19.5.tgz",
"integrity": "sha512-4liggWIA4oDgUxqpZwrDhmEfAH4d0iljanDOK7AnVU89T6CzHon/ony8C5LeOdfgx60x5cnQJFZwEydVlYx4iw==",
"cpu": [
"ia32"
],
@ -356,9 +357,9 @@
}
},
"node_modules/@esbuild/win32-x64": {
"version": "0.19.2",
"resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.19.2.tgz",
"integrity": "sha512-tcuhV7ncXBqbt/Ybf0IyrMcwVOAPDckMK9rXNHtF17UTK18OKLpg08glminN06pt2WCoALhXdLfSPbVvK/6fxw==",
"version": "0.19.5",
"resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.19.5.tgz",
"integrity": "sha512-czTrygUsB/jlM8qEW5MD8bgYU2Xg14lo6kBDXW6HdxKjh8M5PzETGiSHaz9MtbXBYDloHNUAUW2tMiKW4KM9Mw==",
"cpu": [
"x64"
],
@ -857,30 +858,33 @@
"dev": true
},
"node_modules/@types/mri": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/@types/mri/-/mri-1.1.1.tgz",
"integrity": "sha512-nJOuiTlsvmClSr3+a/trTSx4DTuY/VURsWGKSf/eeavh0LRMqdsK60ti0TlwM5iHiGOK3/Ibkxsbr7i9rzGreA==",
"version": "1.1.3",
"resolved": "https://registry.npmjs.org/@types/mri/-/mri-1.1.3.tgz",
"integrity": "sha512-U2Dng2M0MSOi+W3PQq3nX57/0Mgo0HRsIrGswobuu1/W6DlxH+bhlBapzxlpQyVv+rcsSc+qeUXgQ1CqmUhV0w==",
"dev": true
},
"node_modules/@types/node": {
"version": "20.5.6",
"resolved": "https://registry.npmjs.org/@types/node/-/node-20.5.6.tgz",
"integrity": "sha512-Gi5wRGPbbyOTX+4Y2iULQ27oUPrefaB0PxGQJnfyWN3kvEDGM3mIB5M/gQLmitZf7A9FmLeaqxD3L1CXpm3VKQ==",
"dev": true
"version": "20.8.7",
"resolved": "https://registry.npmjs.org/@types/node/-/node-20.8.7.tgz",
"integrity": "sha512-21TKHHh3eUHIi2MloeptJWALuCu5H7HQTdTrWIFReA8ad+aggoX+lRes3ex7/FtpC+sVUpFMQ+QTfYr74mruiQ==",
"dev": true,
"dependencies": {
"undici-types": "~5.25.1"
}
},
"node_modules/@types/sade": {
"version": "1.7.4",
"resolved": "https://registry.npmjs.org/@types/sade/-/sade-1.7.4.tgz",
"integrity": "sha512-6ys13kmtlY0aIOz4KtMdeBD9BHs6vSE3aRcj4vAZqXjypT2el8WZt6799CMjElVgh1cbOH/t3vrpQ4IpwytcPA==",
"version": "1.7.6",
"resolved": "https://registry.npmjs.org/@types/sade/-/sade-1.7.6.tgz",
"integrity": "sha512-YfIO6wZicRVmJZQ/fWmHrFrqDtES2byhP6HZ34il6S2RoGJucwO5ZjhXOOI7g1IcVUX7xdkSZVl8Z+nVXoiHJw==",
"dev": true,
"dependencies": {
"@types/mri": "*"
}
},
"node_modules/@types/shelljs": {
"version": "0.8.12",
"resolved": "https://registry.npmjs.org/@types/shelljs/-/shelljs-0.8.12.tgz",
"integrity": "sha512-ZA8U81/gldY+rR5zl/7HSHrG2KDfEb3lzG6uCUDhW1DTQE9yC/VBQ45fXnXq8f3CgInfhZmjtdu/WOUlrXRQUg==",
"version": "0.8.14",
"resolved": "https://registry.npmjs.org/@types/shelljs/-/shelljs-0.8.14.tgz",
"integrity": "sha512-eqKaGPi60riuxI9pUVeCT02EGo94Y6HT119h7w5bXSELsis6+JqzdEy6H/w2xXl881wcN3VDnb/D0WlgSety5w==",
"dev": true,
"dependencies": {
"@types/glob": "~7.2.0",
@ -1192,6 +1196,15 @@
"domelementtype": "1"
}
},
"node_modules/dts-bundler": {
"version": "0.1.0",
"resolved": "https://registry.npmjs.org/dts-bundler/-/dts-bundler-0.1.0.tgz",
"integrity": "sha512-h0llx8DbWDMLJoB/jT5+YghYse1RA7SKDDPG3h0E+ecgkRDFMsr1aa8vaPTmrv6Qta79mme78tIyFStXBxijCg==",
"dev": true,
"peerDependencies": {
"typescript": "^2.4.0"
}
},
"node_modules/emoji-regex": {
"version": "8.0.0",
"resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz",
@ -1205,9 +1218,9 @@
"dev": true
},
"node_modules/esbuild": {
"version": "0.19.2",
"resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.19.2.tgz",
"integrity": "sha512-G6hPax8UbFakEj3hWO0Vs52LQ8k3lnBhxZWomUJDxfz3rZTLqF5k/FCzuNdLx2RbpBiQQF9H9onlDDH1lZsnjg==",
"version": "0.19.5",
"resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.19.5.tgz",
"integrity": "sha512-bUxalY7b1g8vNhQKdB24QDmHeY4V4tw/s6Ak5z+jJX9laP5MoQseTOMemAr0gxssjNcH0MCViG8ONI2kksvfFQ==",
"dev": true,
"hasInstallScript": true,
"bin": {
@ -1217,28 +1230,28 @@
"node": ">=12"
},
"optionalDependencies": {
"@esbuild/android-arm": "0.19.2",
"@esbuild/android-arm64": "0.19.2",
"@esbuild/android-x64": "0.19.2",
"@esbuild/darwin-arm64": "0.19.2",
"@esbuild/darwin-x64": "0.19.2",
"@esbuild/freebsd-arm64": "0.19.2",
"@esbuild/freebsd-x64": "0.19.2",
"@esbuild/linux-arm": "0.19.2",
"@esbuild/linux-arm64": "0.19.2",
"@esbuild/linux-ia32": "0.19.2",
"@esbuild/linux-loong64": "0.19.2",
"@esbuild/linux-mips64el": "0.19.2",
"@esbuild/linux-ppc64": "0.19.2",
"@esbuild/linux-riscv64": "0.19.2",
"@esbuild/linux-s390x": "0.19.2",
"@esbuild/linux-x64": "0.19.2",
"@esbuild/netbsd-x64": "0.19.2",
"@esbuild/openbsd-x64": "0.19.2",
"@esbuild/sunos-x64": "0.19.2",
"@esbuild/win32-arm64": "0.19.2",
"@esbuild/win32-ia32": "0.19.2",
"@esbuild/win32-x64": "0.19.2"
"@esbuild/android-arm": "0.19.5",
"@esbuild/android-arm64": "0.19.5",
"@esbuild/android-x64": "0.19.5",
"@esbuild/darwin-arm64": "0.19.5",
"@esbuild/darwin-x64": "0.19.5",
"@esbuild/freebsd-arm64": "0.19.5",
"@esbuild/freebsd-x64": "0.19.5",
"@esbuild/linux-arm": "0.19.5",
"@esbuild/linux-arm64": "0.19.5",
"@esbuild/linux-ia32": "0.19.5",
"@esbuild/linux-loong64": "0.19.5",
"@esbuild/linux-mips64el": "0.19.5",
"@esbuild/linux-ppc64": "0.19.5",
"@esbuild/linux-riscv64": "0.19.5",
"@esbuild/linux-s390x": "0.19.5",
"@esbuild/linux-x64": "0.19.5",
"@esbuild/netbsd-x64": "0.19.5",
"@esbuild/openbsd-x64": "0.19.5",
"@esbuild/sunos-x64": "0.19.5",
"@esbuild/win32-arm64": "0.19.5",
"@esbuild/win32-ia32": "0.19.5",
"@esbuild/win32-x64": "0.19.5"
}
},
"node_modules/event-target-shim": {
@ -1351,12 +1364,6 @@
"node": "^8.16.0 || ^10.6.0 || >=11.0.0"
}
},
"node_modules/function-bind": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz",
"integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==",
"dev": true
},
"node_modules/glob": {
"version": "7.2.3",
"resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz",
@ -1389,6 +1396,18 @@
"node": ">= 6"
}
},
"node_modules/glob/node_modules/minimatch": {
"version": "3.1.2",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz",
"integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==",
"dev": true,
"dependencies": {
"brace-expansion": "^1.1.7"
},
"engines": {
"node": "*"
}
},
"node_modules/globby": {
"version": "11.1.0",
"resolved": "https://registry.npmjs.org/globby/-/globby-11.1.0.tgz",
@ -1410,13 +1429,10 @@
}
},
"node_modules/has": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz",
"integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==",
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/has/-/has-1.0.4.tgz",
"integrity": "sha512-qdSAmqLF6209RFj4VVItywPMbm3vWylknmB3nvNiUIs72xAimcM8nVYxYr7ncvZq5qzk9MKIZR8ijqD/1QuYjQ==",
"dev": true,
"dependencies": {
"function-bind": "^1.1.1"
},
"engines": {
"node": ">= 0.4.0"
}
@ -1561,18 +1577,6 @@
"jshint": "bin/jshint"
}
},
"node_modules/jshint/node_modules/minimatch": {
"version": "3.0.8",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.8.tgz",
"integrity": "sha512-6FsRAQsxQ61mw+qP1ZzbL9Bc78x2p5OqNgNpnoAFLTrX8n5Kxph0CsnhmKKNXTWjXqU5L0pGPR7hYk+XWZr60Q==",
"dev": true,
"dependencies": {
"brace-expansion": "^1.1.7"
},
"engines": {
"node": "*"
}
},
"node_modules/just-flatten-it": {
"version": "2.2.1",
"resolved": "https://registry.npmjs.org/just-flatten-it/-/just-flatten-it-2.2.1.tgz",
@ -1656,9 +1660,9 @@
}
},
"node_modules/minimatch": {
"version": "3.1.2",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz",
"integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==",
"version": "3.0.8",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.8.tgz",
"integrity": "sha512-6FsRAQsxQ61mw+qP1ZzbL9Bc78x2p5OqNgNpnoAFLTrX8n5Kxph0CsnhmKKNXTWjXqU5L0pGPR7hYk+XWZr60Q==",
"dev": true,
"dependencies": {
"brace-expansion": "^1.1.7"
@ -1742,7 +1746,7 @@
},
"node_modules/nodejsscript": {
"version": "1.0.0",
"resolved": "git+ssh://git@github.com/jaandrle/nodejsscript.git#efb342b22c1a3e6ef0d5d460aafae7276946cca6",
"resolved": "git+ssh://git@github.com/jaandrle/nodejsscript.git#0e368f4f74b4c8f7a30f1f595128b5d0b823015d",
"dev": true,
"license": "MIT",
"dependencies": {
@ -1893,9 +1897,9 @@
}
},
"node_modules/resolve": {
"version": "1.22.4",
"resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.4.tgz",
"integrity": "sha512-PXNdCiPqDqeUou+w1C2eTQbNfxKSuMxqTCuvlmmMsk1NWHL5fRrhY6Pl0qEYYc6+QqGClco1Qj8XnjPego4wfg==",
"version": "1.22.8",
"resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.8.tgz",
"integrity": "sha512-oKWePCxqpd6FlLvGV1VU0x7bkPmmCNolxzjMf4NczoDnQcIWrAF+cPtZn5i6n+RfD2d9i0tzpKnG6Yk168yIyw==",
"dev": true,
"dependencies": {
"is-core-module": "^2.13.0",
@ -2130,6 +2134,26 @@
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/typescript": {
"version": "2.9.2",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-2.9.2.tgz",
"integrity": "sha512-Gr4p6nFNaoufRIY4NMdpQRNmgxVIGMs4Fcu/ujdYk3nAZqk7supzBE9idmvfZIlH/Cuj//dvi+019qEue9lV0w==",
"dev": true,
"peer": true,
"bin": {
"tsc": "bin/tsc",
"tsserver": "bin/tsserver"
},
"engines": {
"node": ">=4.2.0"
}
},
"node_modules/undici-types": {
"version": "5.25.3",
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.25.3.tgz",
"integrity": "sha512-Ga1jfYwRn7+cP9v8auvEXN1rX3sWqlayd4HP7OKk4mZWylEmu3KzXDUGrQUN6Ol7qo1gPvB2e5gX6udnyEPgdA==",
"dev": true
},
"node_modules/web-streams-polyfill": {
"version": "3.2.1",
"resolved": "https://registry.npmjs.org/web-streams-polyfill/-/web-streams-polyfill-3.2.1.tgz",

View File

@ -1,6 +1,6 @@
{
"name": "deka-dom-el",
"version": "0.5.3",
"version": "0.6.0",
"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",
@ -63,7 +63,7 @@
},
{
"path": "./signals.js",
"limit": "8 kB",
"limit": "8.5 kB",
"gzip": false
},
{
@ -73,7 +73,7 @@
},
{
"path": "./examples/components/webComponent.js",
"limit": "12kb",
"limit": "12.5 kB",
"gzip": false
}
],
@ -91,6 +91,7 @@
],
"devDependencies": {
"@size-limit/preset-small-lib": "^8.2.6",
"dts-bundler": "^0.1.0",
"esbuild": "^0.19.2",
"jshint": "^2.13.6",
"nodejsscript": "github:jaandrle/nodejsscript#dev-v1",

2
signals.d.ts vendored
View File

@ -35,7 +35,7 @@ interface S {
name: N,
...params: A[N] extends (...args: infer P)=> any ? P : never
): void;
clear(...signals: Signal<any, any>): void;
clear(...signals: Signal<any, any>[]): void;
on<T>(signal: Signal<T, any>, onchange: (a: T)=> void, options?: AddEventListenerOptions): void;
symbols: {
signal: SymbolSignal;

View File

@ -8,7 +8,9 @@ export function isSignal(candidate){
const stack_watch= [];
/**
* ### `WeakMap<function, Set<ddeSignal<any, any>>>`
* The `Set` is in the form of `[ source, ...depended signals (DSs) ]`. When the DS is cleaned it is removed from DSs, if remains only one (`source`) it is cleared too.
* The `Set` is in the form of `[ source, ...depended signals (DSs) ]`.
* When the DS is cleaned (`S.clear`) it is removed from DSs,
* if remains only one (`source`) it is cleared too.
* ### `WeakMap<object, function>`
* This is used for revesed deps, the `function` is also key for `deps`.
* @type {WeakMap<function|object,Set<ddeSignal<any, any>>|function>}
@ -62,18 +64,34 @@ S.symbols= {
};
import { on } from "./events.js";
import { scope } from "./dom.js";
const key_attributes= "__dde_attributes";
S.attribute= function(name, initial= undefined){
const { host }= scope;
const value= host() && host().hasAttribute(name) ? host().getAttribute(name) : initial;
const ac= new AbortController();
const out= S(value, {
[S.symbols.onclear](){ ac.abort(); }
const out= S(initial);
scope.host(element=> {
if(element instanceof HTMLElement){
if(element.hasAttribute(name)) out(element.getAttribute(name));
} else {
if(element.hasAttributeNS(null, name)) out(element.getAttributeNS(null, name));
}
if(element[key_attributes]){
element[key_attributes][name]= out;
return;
}
element[key_attributes]= { [name]: out };
on.attributeChanged(function attributeChangeToSignal({ detail }){
/*! This maps attributes to signals (`S.attribute`).
* Investigate `__dde_attributes` key of the element.*/
const [ name, value ]= detail;
const curr= element[key_attributes][name];
if(curr) curr(value);
})(element);
on.disconnected(function(){
/*! This removes all signals mapped to attributes (`S.attribute`).
* Investigate `__dde_attributes` key of the element.*/
S.clear(...Object.values(element[key_attributes]));
})(element);
return element;
});
scope.host(on.attributeChanged(function attributeChangeToSignal({ detail }){
const [ name_c, value ]= detail;
if(name_c!==name) return;
out(value);
}, { signal: ac.signal }));
return out;
};
S.clear= function(...signals){
@ -182,11 +200,16 @@ function toSignal(signal, value, actions){
Reflect.deleteProperty(actions, ocs);
}
const { host }= scope;
signal[mark]= {
value, actions, onclear, host,
listeners: new Set(),
defined: new SignalDefined()
};
Reflect.defineProperty(signal, mark, {
value: {
value, actions, onclear, host,
listeners: new Set(),
defined: new SignalDefined()
},
enumerable: false,
writable: false,
configurable: true
});
signal.toJSON= ()=> signal();
Object.setPrototypeOf(signal[mark], protoSigal);
return signal;

7
tsconfig.json Normal file
View File

@ -0,0 +1,7 @@
{
"compilerOptions": {
"emitDeclarationOnly": true,
"declaration": true,
"declarationDir": "dist"
}
}