2024-02-01 23:47:13 +08:00
|
|
|
declare global {
|
2024-02-03 09:33:34 +08:00
|
|
|
var $: import('./$index').$;
|
2024-02-01 23:47:13 +08:00
|
|
|
interface Array<T> {
|
2024-10-03 23:21:55 +08:00
|
|
|
detype<F extends any, O>(...types: F[]): Array<Exclude<T, F | undefined | void>>
|
2024-02-01 23:47:13 +08:00
|
|
|
}
|
2024-10-17 11:54:28 +08:00
|
|
|
interface Set<T> {
|
|
|
|
get array(): T[]
|
|
|
|
sort(handler: ((a: T, b: T) => number) | undefined): T[];
|
|
|
|
}
|
2024-02-03 09:33:34 +08:00
|
|
|
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";
|
2024-03-28 20:03:03 +08:00
|
|
|
type InputMode = "" | "none" | "text" | "decimal" | "numeric" | "tel" | "search" | "email" | "url";
|
2024-02-03 09:33:34 +08:00
|
|
|
type ButtonType = "submit" | "reset" | "button" | "menu";
|
|
|
|
type TextDirection = 'ltr' | 'rtl' | 'auto' | '';
|
2024-02-13 19:38:46 +08:00
|
|
|
type ImageDecoding = "async" | "sync" | "auto";
|
|
|
|
type ImageLoading = "eager" | "lazy";
|
2024-04-25 21:11:20 +08:00
|
|
|
type ConstructorType<T> = { new (...args: any[]): T }
|
2024-02-03 09:33:34 +08:00
|
|
|
interface Node {
|
2024-04-23 18:18:43 +08:00
|
|
|
$: import('./lib/node/$Node').$Node;
|
2024-02-03 09:33:34 +08:00
|
|
|
}
|
2024-02-01 23:47:13 +08:00
|
|
|
}
|
2024-10-03 23:21:55 +08:00
|
|
|
Array.prototype.detype = function <T extends any, O>(this: O[], ...types: T[]) {
|
2024-02-01 23:47:13 +08:00
|
|
|
return this.filter(item => {
|
2024-02-03 09:33:34 +08:00
|
|
|
if (!types.length) return item !== undefined;
|
2024-08-29 02:27:14 +08:00
|
|
|
else for (const type of types) if (typeof item !== typeof type) return true; else return false;
|
2024-10-03 23:21:55 +08:00
|
|
|
}) as Exclude<O, T | undefined | void>[];
|
2024-02-01 23:47:13 +08:00
|
|
|
}
|
2024-10-17 11:54:28 +08:00
|
|
|
Object.defineProperties(Set.prototype, {
|
|
|
|
array: { get: function <T>(this: Set<T>) { return Array.from(this)} }
|
|
|
|
})
|
|
|
|
Set.prototype.sort = function <T>(this: Set<T>, handler: ((a: T, b: T) => number) | undefined) { return this.array.sort(handler)}
|
2024-02-01 23:47:13 +08:00
|
|
|
export * from "./$index";
|
2024-10-17 11:54:28 +08:00
|
|
|
export * from "./lib/$NodeManager";
|
|
|
|
export * from "./lib/$EventManager";
|
|
|
|
export * from "./lib/$EventTarget";
|
|
|
|
export * from "./lib/$KeyboardManager";
|
|
|
|
export * from "./lib/$FocusManager";
|
|
|
|
export * from "./lib/$PointerManager";
|
|
|
|
export * from "./lib/$Window";
|
|
|
|
export * from "./lib/$State";
|
2024-04-23 18:18:43 +08:00
|
|
|
export * from "./lib/node/$Node";
|
|
|
|
export * from "./lib/node/$Anchor";
|
|
|
|
export * from "./lib/node/$Element";
|
2024-10-17 11:54:28 +08:00
|
|
|
export * from "./lib/node/$HTMLElement";
|
2024-04-23 18:18:43 +08:00
|
|
|
export * from "./lib/node/$Text";
|
|
|
|
export * from "./lib/node/$Container";
|
|
|
|
export * from "./lib/node/$Button";
|
|
|
|
export * from "./lib/node/$Form";
|
|
|
|
export * from "./lib/node/$Select";
|
|
|
|
export * from "./lib/node/$Option";
|
|
|
|
export * from "./lib/node/$OptGroup";
|
|
|
|
export * from "./lib/node/$Textarea";
|
|
|
|
export * from "./lib/node/$Image";
|
2024-04-25 21:11:20 +08:00
|
|
|
export * from "./lib/node/$Async";
|
2024-08-29 02:27:14 +08:00
|
|
|
export * from "./lib/node/$Document";
|
|
|
|
export * from "./lib/node/$Media";
|
|
|
|
export * from "./lib/node/$Video";
|