summaryrefslogtreecommitdiff
path: root/lib/epub.js/types/utils
diff options
context:
space:
mode:
Diffstat (limited to 'lib/epub.js/types/utils')
-rw-r--r--lib/epub.js/types/utils/constants.d.ts9
-rw-r--r--lib/epub.js/types/utils/core.d.ts79
-rw-r--r--lib/epub.js/types/utils/hook.d.ts18
-rw-r--r--lib/epub.js/types/utils/path.d.ts17
-rw-r--r--lib/epub.js/types/utils/queue.d.ts34
-rw-r--r--lib/epub.js/types/utils/replacements.d.ts12
-rw-r--r--lib/epub.js/types/utils/request.d.ts1
-rw-r--r--lib/epub.js/types/utils/scrolltype.d.ts3
-rw-r--r--lib/epub.js/types/utils/url.d.ts13
9 files changed, 186 insertions, 0 deletions
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<string>;
+
+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<any>, compareFunction: Function): number;
+
+export function locationOf(item: any, array: Array<any>, compareFunction: Function, _start: Function, _end: Function): number;
+
+export function indexOfSorted(item: any, array: Array<any>, 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<Element>;
+
+export function qsp(el: Element, sel: string, props: Array<object>): ArrayLike<Element>;
+
+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<any>;
+
+export function querySelectorByType(html: Element, element: string, type: string): Array<Element>;
+
+export function findChildren(el: Element): Array<Element>;
+
+export function parents(node: Element): Array<Element>;
+
+export function filterChildren(el: Element, nodeName: string, single: boolean): Array<Element>;
+
+export function getParentByTagName(node: Element, tagname: string): Array<Element>;
+
+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<Function>): void;
+
+ deregister(func: Function): void;
+
+ trigger(...args: any[]): Promise<any>;
+
+ list(): Array<any>;
+
+ 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<any>
+}
+
+export default class Queue {
+ constructor(context: any);
+
+ enqueue(func: Promise<Function> | Function, ...args: any[]): Promise<any>;
+
+ dequeue(): Promise<QueuedTask>;
+
+ dump(): void;
+
+ run(): Promise<void>;
+
+ flush(): Promise<void>;
+
+ 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<Blob | string | JSON | Document | XMLDocument>;
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;
+}