on-codemerge
Version:
A WYSIWYG editor for on-codemerge is a user-friendly interface that allows users to edit and view their code in real time, exactly as it will appear in the final product
54 lines (53 loc) • 3.87 kB
TypeScript
type Callback = (value: string) => void;
type CallbackChecked = (isChecked: boolean) => void;
type FileChecked = (files: FileList | null) => void;
export declare function createInputField(type?: string, placeholder?: string, defaultValue?: string, onChange?: Callback | null): HTMLInputElement;
export declare function createSelectField(options: {
value: string;
label: string;
}[], defaultValue?: string, onChange?: Callback | null): HTMLSelectElement;
export declare function createCheckbox(labelText: string | null, isChecked?: boolean, onChange?: CallbackChecked | null): HTMLElement;
export declare function createLabel(text: string, forId?: string): HTMLLabelElement;
export declare function createButton(text: string, onClick: (e: MouseEvent) => void, variant?: 'primary' | 'secondary' | 'danger'): HTMLButtonElement;
export declare function createContainer(className?: string, content?: null | string): HTMLDivElement;
export declare function createP(className?: string, content?: null | string): HTMLDivElement;
export declare function createSpan(className?: string, content?: null | string): HTMLSpanElement;
export declare function createKbd(className?: string, content?: null | string): HTMLElement;
export declare function createLink(text: string, href?: string, target?: '_blank' | '_self' | '_parent' | '_top', className?: string): HTMLAnchorElement;
export declare function createTextarea(placeholder?: string, defaultValue?: string, onChange?: Callback | null): HTMLTextAreaElement;
export declare function createFileInput(multiple?: boolean, onChange?: FileChecked | null): HTMLInputElement;
export declare function createFieldset(legend?: string): HTMLFieldSetElement;
export declare function createForm(className?: string, action?: string | 'POST' | 'GET' | null, method?: string | null): HTMLFormElement;
export declare function createSelectOption(value: string, text: string): HTMLOptionElement;
export declare function createLineBreak(className?: string, content?: null | string): HTMLBRElement;
export declare function createHr(className?: string, content?: null | string): HTMLHRElement;
export declare function createH(type: 'h1' | 'h2' | 'h3' | 'h4', className?: string, content?: null | string): HTMLHeadingElement;
export declare function createIframe(className?: string, content?: null | string): HTMLIFrameElement;
export declare function createVideo(className?: string, content?: null | string): HTMLVideoElement;
export declare function createPre(className?: string, content?: null | string): HTMLPreElement;
export declare function createSup(className?: string, content?: null | string): HTMLElement;
export declare function createCode(className?: string, content?: null | string): HTMLElement;
export declare function createImg(className?: string, src?: null | string): HTMLImageElement;
export declare function createOl(className?: string): HTMLOListElement;
export declare function createLi(className?: string): HTMLLIElement;
export declare function createUl(className?: string): HTMLUListElement;
export declare function createTh(className?: string): HTMLTableCellElement;
export declare function createCanvas(): HTMLCanvasElement;
export interface FormData {
[key: string]: string | number | boolean | undefined;
}
export declare function getFormData(form: HTMLFormElement): FormData;
export declare function validateForm(form: HTMLFormElement): boolean;
export declare function showFormValidationErrors(form: HTMLFormElement): void;
export declare function createFormSubmitHandler(form: HTMLFormElement, onSubmit: (data: FormData) => void, onError?: (errors: string[]) => void): (e: Event) => void;
export interface CalendarEventData {
title: string;
description?: string;
date: string;
time: string;
duration?: number;
location?: string;
color?: string;
isAllDay?: boolean;
}
export {};