mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-02-24 16:54:03 +00:00
Rename to ts (#92)
Rename Remove ts-nocheck, fix errors Update state when graph cleared via UI (#88) Convert to ts, fix imports Co-authored-by: pythongosssss <125205205+pythongosssss@users.noreply.github.com>
This commit is contained in:
@@ -24,11 +24,15 @@ type Props = {
|
||||
|
||||
type Children = Element[] | Element | string | string[];
|
||||
|
||||
export function $el(
|
||||
tag: string,
|
||||
type ElementType<K extends string> = K extends keyof HTMLElementTagNameMap
|
||||
? HTMLElementTagNameMap[K]
|
||||
: HTMLElement;
|
||||
|
||||
export function $el<TTag extends string>(
|
||||
tag: TTag,
|
||||
propsOrChildren?: Children | Props,
|
||||
children?: Children
|
||||
): HTMLElement {
|
||||
): ElementType<TTag> {
|
||||
const split = tag.split(".");
|
||||
const element = document.createElement(split.shift() as string);
|
||||
if (split.length > 0) {
|
||||
@@ -78,10 +82,10 @@ export function $el(
|
||||
}
|
||||
}
|
||||
}
|
||||
return element;
|
||||
return element as ElementType<TTag>;
|
||||
}
|
||||
|
||||
function dragElement(dragEl, settings) {
|
||||
function dragElement(dragEl, settings): () => void {
|
||||
var posDiffX = 0,
|
||||
posDiffY = 0,
|
||||
posStartX = 0,
|
||||
@@ -340,6 +344,8 @@ export class ComfyUI {
|
||||
menuHamburger: HTMLDivElement;
|
||||
menuContainer: HTMLDivElement;
|
||||
queueSize: Element;
|
||||
restoreMenuPosition: () => void;
|
||||
loadFile: () => void;
|
||||
|
||||
constructor(app) {
|
||||
this.app = app;
|
||||
@@ -425,7 +431,6 @@ export class ComfyUI {
|
||||
},
|
||||
}) as HTMLInputElement;
|
||||
|
||||
// @ts-ignore
|
||||
this.loadFile = () => fileInput.click();
|
||||
|
||||
const autoQueueModeEl = toggleSwitch(
|
||||
@@ -740,7 +745,6 @@ export class ComfyUI {
|
||||
},
|
||||
});
|
||||
|
||||
// @ts-ignore
|
||||
this.restoreMenuPosition = dragElement(this.menuContainer, this.settings);
|
||||
|
||||
this.setStatus({ exec_info: { queue_remaining: "X" } });
|
||||
|
||||
Reference in New Issue
Block a user