elexis/index.ts

41 lines
1.7 KiB
TypeScript
Raw Normal View History

2024-02-01 23:47:13 +08:00
declare global {
var $: import('./$index').$;
2024-02-01 23:47:13 +08:00
interface Array<T> {
detype<F extends undefined | null, O>(...types: F[]): Array<Exclude<T, F>>
}
type OrMatrix<T> = T | OrMatrix<T>[];
type OrArray<T> = T | T[];
type OrPromise<T> = T | Promise<T>;
type Mutable<T> = {
-readonly [k in keyof T]: T[k];
};
type Types = 'string' | 'number' | 'boolean' | 'object' | 'symbol' | 'bigint' | 'function' | 'undefined'
type Autocapitalize = 'none' | 'off' | 'sentences' | 'on' | 'words' | 'characters';
type SelectionDirection = "forward" | "backward" | "none";
type InputType = "button" | "checkbox" | "color" | "date" | "datetime-local" | "email" | "file" | "hidden" | "image" | "month" | "number" | "password" | "radio" | "range" | "reset" | "search" | "submit" | "tel" | "text" | "time" | "url" | "week";
type ButtonType = "submit" | "reset" | "button" | "menu";
type TextDirection = 'ltr' | 'rtl' | 'auto' | '';
interface Node {
$: import('./lib/$Node').$Node;
}
2024-02-01 23:47:13 +08:00
}
Array.prototype.detype = function <T extends undefined | null, O>(this: O[], ...types: T[]) {
return this.filter(item => {
if (!types.length) return item !== undefined;
else for (const type of types) if (typeof item !== typeof type) return false; else return true
2024-02-01 23:47:13 +08:00
}) as Exclude<O, T>[];
}
export * from "./$index";
export * from "./lib/Router/Route";
export * from "./lib/Router/Router";
export * from "./lib/$Node";
export * from "./lib/$Anchor";
export * from "./lib/$Element";
export * from "./lib/$NodeManager";
2024-02-01 23:47:13 +08:00
export * from "./lib/$Text";
export * from "./lib/$Container";
export * from "./lib/$Button";
export * from "./lib/$Form";
export * from "./lib/$EventManager";
export * from "./lib/$State";