From 4fd9b8f2b5a98bfcde57970b48fed2488a80f356 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Fri, 17 Sep 2021 21:53:37 +0300 Subject: add in master snapshot of epubjs --- lib/epub.js/types/utils/constants.d.ts | 9 ++++ lib/epub.js/types/utils/core.d.ts | 79 +++++++++++++++++++++++++++++++ lib/epub.js/types/utils/hook.d.ts | 18 +++++++ lib/epub.js/types/utils/path.d.ts | 17 +++++++ lib/epub.js/types/utils/queue.d.ts | 34 +++++++++++++ lib/epub.js/types/utils/replacements.d.ts | 12 +++++ lib/epub.js/types/utils/request.d.ts | 1 + lib/epub.js/types/utils/scrolltype.d.ts | 3 ++ lib/epub.js/types/utils/url.d.ts | 13 +++++ 9 files changed, 186 insertions(+) create mode 100644 lib/epub.js/types/utils/constants.d.ts create mode 100644 lib/epub.js/types/utils/core.d.ts create mode 100644 lib/epub.js/types/utils/hook.d.ts create mode 100644 lib/epub.js/types/utils/path.d.ts create mode 100644 lib/epub.js/types/utils/queue.d.ts create mode 100644 lib/epub.js/types/utils/replacements.d.ts create mode 100644 lib/epub.js/types/utils/request.d.ts create mode 100644 lib/epub.js/types/utils/scrolltype.d.ts create mode 100644 lib/epub.js/types/utils/url.d.ts (limited to 'lib/epub.js/types/utils') diff --git a/lib/epub.js/types/utils/constants.d.ts b/lib/epub.js/types/utils/constants.d.ts new file mode 100644 index 0000000..1c5c5c5 --- /dev/null +++ b/lib/epub.js/types/utils/constants.d.ts @@ -0,0 +1,9 @@ +export const EPUBJS_VERSION: string; + +export const DOM_EVENTS: Array; + +export const EVENTS: { + [key: string]: { + [key: string]: string + } +} diff --git a/lib/epub.js/types/utils/core.d.ts b/lib/epub.js/types/utils/core.d.ts new file mode 100644 index 0000000..6469a66 --- /dev/null +++ b/lib/epub.js/types/utils/core.d.ts @@ -0,0 +1,79 @@ +export function uuid(): string; + +export function documentHeight(): number; + +export function isElement(obj: object): boolean; + +export function isNumber(n: any): boolean; + +export function isFloat(n: any): boolean; + +export function prefixed(unprefixed: string): string; + +export function defaults(obj: object): object; + +export function extend(target: object): object; + +export function insert(item: any, array: Array, compareFunction: Function): number; + +export function locationOf(item: any, array: Array, compareFunction: Function, _start: Function, _end: Function): number; + +export function indexOfSorted(item: any, array: Array, compareFunction: Function, _start: Function, _end: Function): number; + +export function bounds(el: Element): { width: Number, height: Number}; + +export function borders(el: Element): { width: Number, height: Number}; + +export function nodeBounds(node: Node): object; + +export function windowBounds(): { width: Number, height: Number, top: Number, left: Number, right: Number, bottom: Number }; + +export function indexOfNode(node: Node, typeId: string): number; + +export function indexOfTextNode(textNode: Node): number; + +export function indexOfElementNode(elementNode: Element): number; + +export function isXml(ext: string): boolean; + +export function createBlob(content: any, mime: string): Blob; + +export function createBlobUrl(content: any, mime: string): string; + +export function revokeBlobUrl(url: string): void; + +export function createBase64Url(content: any, mime: string): string + +export function type(obj: object): string; + +export function parse(markup: string, mime: string, forceXMLDom: boolean): Document; + +export function qs(el: Element, sel: string): Element; + +export function qsa(el: Element, sel: string): ArrayLike; + +export function qsp(el: Element, sel: string, props: Array): ArrayLike; + +export function sprint(root: Node, func: Function): void; + +export function treeWalker(root: Node, func: Function, filter: object | Function): void; + +export function walk(node: Node, callback: Function): void; + +export function blob2base64(blob: Blob): string; + +export function defer(): Promise; + +export function querySelectorByType(html: Element, element: string, type: string): Array; + +export function findChildren(el: Element): Array; + +export function parents(node: Element): Array; + +export function filterChildren(el: Element, nodeName: string, single: boolean): Array; + +export function getParentByTagName(node: Element, tagname: string): Array; + +export class RangeObject extends Range { + +} diff --git a/lib/epub.js/types/utils/hook.d.ts b/lib/epub.js/types/utils/hook.d.ts new file mode 100644 index 0000000..9db1491 --- /dev/null +++ b/lib/epub.js/types/utils/hook.d.ts @@ -0,0 +1,18 @@ +interface HooksObject { + [key: string]: Hook +} + +export default class Hook { + constructor(context: any); + + register(func: Function): void; + register(arr: Array): void; + + deregister(func: Function): void; + + trigger(...args: any[]): Promise; + + list(): Array; + + clear(): void; +} diff --git a/lib/epub.js/types/utils/path.d.ts b/lib/epub.js/types/utils/path.d.ts new file mode 100644 index 0000000..b91e88b --- /dev/null +++ b/lib/epub.js/types/utils/path.d.ts @@ -0,0 +1,17 @@ +export default class Path { + constructor(pathString: string); + + parse(what: string): object; + + isAbsolute(what: string): boolean; + + isDirectory(what: string): boolean; + + resolve(what: string): string; + + relative(what: string): string; + + splitPath(filename: string): string; + + toString(): string; +} diff --git a/lib/epub.js/types/utils/queue.d.ts b/lib/epub.js/types/utils/queue.d.ts new file mode 100644 index 0000000..4813ef6 --- /dev/null +++ b/lib/epub.js/types/utils/queue.d.ts @@ -0,0 +1,34 @@ +import { defer } from "./core"; + +export interface QueuedTask { + task: any | Task, + args: any[], + deferred: any, // should be defer, but not working + promise: Promise +} + +export default class Queue { + constructor(context: any); + + enqueue(func: Promise | Function, ...args: any[]): Promise; + + dequeue(): Promise; + + dump(): void; + + run(): Promise; + + flush(): Promise; + + clear(): void; + + length(): number; + + pause(): void; + + stop(): void; +} + +declare class Task { + constructor(task: any, args: any[], context: any); +} diff --git a/lib/epub.js/types/utils/replacements.d.ts b/lib/epub.js/types/utils/replacements.d.ts new file mode 100644 index 0000000..9728ee4 --- /dev/null +++ b/lib/epub.js/types/utils/replacements.d.ts @@ -0,0 +1,12 @@ +import Section from "../section"; +import Contents from "../contents"; + +export function replaceBase(doc: Document, section: Section): void; + +export function replaceCanonical(doc: Document, section: Section): void; + +export function replaceMeta(doc: Document, section: Section): void; + +export function replaceLinks(contents: Contents, fn: Function): void; + +export function substitute(contents: Contents, urls: string[], replacements: string[]): void; diff --git a/lib/epub.js/types/utils/request.d.ts b/lib/epub.js/types/utils/request.d.ts new file mode 100644 index 0000000..e6c9653 --- /dev/null +++ b/lib/epub.js/types/utils/request.d.ts @@ -0,0 +1 @@ +export default function request(url: string, type?: string, withCredentials?: boolean, headers?: object): Promise; diff --git a/lib/epub.js/types/utils/scrolltype.d.ts b/lib/epub.js/types/utils/scrolltype.d.ts new file mode 100644 index 0000000..f1dd74f --- /dev/null +++ b/lib/epub.js/types/utils/scrolltype.d.ts @@ -0,0 +1,3 @@ +export default function scrollType(): string; + +export function createDefiner(): Node; diff --git a/lib/epub.js/types/utils/url.d.ts b/lib/epub.js/types/utils/url.d.ts new file mode 100644 index 0000000..bf30dfb --- /dev/null +++ b/lib/epub.js/types/utils/url.d.ts @@ -0,0 +1,13 @@ +import Path from "./path"; + +export default class Url { + constructor(urlString: string, baseString: string); + + path(): Path; + + resolve(what: string): string; + + relative(what: string): string; + + toString(): string; +} -- cgit v1.2.3