@likecoin/epub-ts 0.3.93
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +64 -0
- package/dist/annotations.d.ts +159 -0
- package/dist/archive.d.ts +82 -0
- package/dist/book.d.ts +228 -0
- package/dist/container.d.ts +18 -0
- package/dist/contents.d.ts +351 -0
- package/dist/displayoptions.d.ts +20 -0
- package/dist/epub.cjs +10 -0
- package/dist/epub.cjs.map +1 -0
- package/dist/epub.d.ts +17 -0
- package/dist/epub.js +9500 -0
- package/dist/epub.js.map +1 -0
- package/dist/epub.umd.js +10 -0
- package/dist/epub.umd.js.map +1 -0
- package/dist/epubcfi.d.ts +116 -0
- package/dist/index.d.ts +8 -0
- package/dist/layout.d.ts +77 -0
- package/dist/locations.d.ts +117 -0
- package/dist/managers/continuous/index.d.ts +46 -0
- package/dist/managers/default/index.d.ts +117 -0
- package/dist/managers/helpers/snap.d.ts +63 -0
- package/dist/managers/helpers/stage.d.ts +41 -0
- package/dist/managers/helpers/views.d.ts +27 -0
- package/dist/managers/views/iframe.d.ts +114 -0
- package/dist/managers/views/inline.d.ts +65 -0
- package/dist/mapping.d.ts +97 -0
- package/dist/marks-pane/index.d.ts +40 -0
- package/dist/navigation.d.ts +108 -0
- package/dist/packaging.d.ts +104 -0
- package/dist/pagelist.d.ts +80 -0
- package/dist/rendition.d.ts +293 -0
- package/dist/resources.d.ts +97 -0
- package/dist/section.d.ts +88 -0
- package/dist/spine.d.ts +79 -0
- package/dist/store.d.ts +122 -0
- package/dist/themes.d.ts +103 -0
- package/dist/types.d.ts +269 -0
- package/dist/utils/constants.d.ts +59 -0
- package/dist/utils/core.d.ts +337 -0
- package/dist/utils/event-emitter.d.ts +6 -0
- package/dist/utils/hook.d.ts +30 -0
- package/dist/utils/mime.d.ts +5 -0
- package/dist/utils/path-utils.d.ts +14 -0
- package/dist/utils/path.d.ts +55 -0
- package/dist/utils/queue.d.ts +66 -0
- package/dist/utils/replacements.d.ts +11 -0
- package/dist/utils/request.d.ts +2 -0
- package/dist/utils/scrolltype.d.ts +2 -0
- package/dist/utils/url.d.ts +42 -0
- package/license +28 -0
- package/package.json +55 -0
|
@@ -0,0 +1,337 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Vendor prefixed requestAnimationFrame
|
|
3
|
+
* @returns {function} requestAnimationFrame
|
|
4
|
+
* @memberof Core
|
|
5
|
+
*/
|
|
6
|
+
export declare const requestAnimationFrame: any;
|
|
7
|
+
/**
|
|
8
|
+
* Generates a UUID
|
|
9
|
+
* based on: http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript
|
|
10
|
+
* @returns {string} uuid
|
|
11
|
+
* @memberof Core
|
|
12
|
+
*/
|
|
13
|
+
export declare function uuid(): string;
|
|
14
|
+
/**
|
|
15
|
+
* Gets the height of a document
|
|
16
|
+
* @returns {number} height
|
|
17
|
+
* @memberof Core
|
|
18
|
+
*/
|
|
19
|
+
export declare function documentHeight(): number;
|
|
20
|
+
/**
|
|
21
|
+
* Checks if a node is an element
|
|
22
|
+
* @param {object} obj
|
|
23
|
+
* @returns {boolean}
|
|
24
|
+
* @memberof Core
|
|
25
|
+
*/
|
|
26
|
+
export declare function isElement(obj: unknown): boolean;
|
|
27
|
+
/**
|
|
28
|
+
* @param {any} n
|
|
29
|
+
* @returns {boolean}
|
|
30
|
+
* @memberof Core
|
|
31
|
+
*/
|
|
32
|
+
export declare function isNumber(n: unknown): boolean;
|
|
33
|
+
/**
|
|
34
|
+
* @param {any} n
|
|
35
|
+
* @returns {boolean}
|
|
36
|
+
* @memberof Core
|
|
37
|
+
*/
|
|
38
|
+
export declare function isFloat(n: unknown): boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Get a prefixed css property
|
|
41
|
+
* @param {string} unprefixed
|
|
42
|
+
* @returns {string}
|
|
43
|
+
* @memberof Core
|
|
44
|
+
*/
|
|
45
|
+
export declare function prefixed(unprefixed: string): string;
|
|
46
|
+
/**
|
|
47
|
+
* Apply defaults to an object
|
|
48
|
+
* @param {object} obj
|
|
49
|
+
* @returns {object}
|
|
50
|
+
* @memberof Core
|
|
51
|
+
*/
|
|
52
|
+
export declare function defaults(obj: any, ..._sources: any[]): any;
|
|
53
|
+
/**
|
|
54
|
+
* Extend properties of an object
|
|
55
|
+
* @param {object} target
|
|
56
|
+
* @returns {object}
|
|
57
|
+
* @memberof Core
|
|
58
|
+
*/
|
|
59
|
+
export declare function extend(target: any, ..._args: any[]): any;
|
|
60
|
+
/**
|
|
61
|
+
* Fast quicksort insert for sorted array -- based on:
|
|
62
|
+
* http://stackoverflow.com/questions/1344500/efficient-way-to-insert-a-number-into-a-sorted-array-of-numbers
|
|
63
|
+
* @param {any} item
|
|
64
|
+
* @param {array} array
|
|
65
|
+
* @param {function} [compareFunction]
|
|
66
|
+
* @returns {number} location (in array)
|
|
67
|
+
* @memberof Core
|
|
68
|
+
*/
|
|
69
|
+
export declare function insert(item: any, array: any[], compareFunction?: (a: any, b: any) => number): number;
|
|
70
|
+
/**
|
|
71
|
+
* Finds where something would fit into a sorted array
|
|
72
|
+
* @param {any} item
|
|
73
|
+
* @param {array} array
|
|
74
|
+
* @param {function} [compareFunction]
|
|
75
|
+
* @param {function} [_start]
|
|
76
|
+
* @param {function} [_end]
|
|
77
|
+
* @returns {number} location (in array)
|
|
78
|
+
* @memberof Core
|
|
79
|
+
*/
|
|
80
|
+
export declare function locationOf(item: any, array: any[], compareFunction?: (a: any, b: any) => number, _start?: number, _end?: number): number;
|
|
81
|
+
/**
|
|
82
|
+
* Finds index of something in a sorted array
|
|
83
|
+
* Returns -1 if not found
|
|
84
|
+
* @param {any} item
|
|
85
|
+
* @param {array} array
|
|
86
|
+
* @param {function} [compareFunction]
|
|
87
|
+
* @param {function} [_start]
|
|
88
|
+
* @param {function} [_end]
|
|
89
|
+
* @returns {number} index (in array) or -1
|
|
90
|
+
* @memberof Core
|
|
91
|
+
*/
|
|
92
|
+
export declare function indexOfSorted(item: any, array: any[], compareFunction?: (a: any, b: any) => number, _start?: number, _end?: number): number;
|
|
93
|
+
/**
|
|
94
|
+
* Find the bounds of an element
|
|
95
|
+
* taking padding and margin into account
|
|
96
|
+
* @param {element} el
|
|
97
|
+
* @returns {{ width: Number, height: Number}}
|
|
98
|
+
* @memberof Core
|
|
99
|
+
*/
|
|
100
|
+
export declare function bounds(el: Element): {
|
|
101
|
+
width: number;
|
|
102
|
+
height: number;
|
|
103
|
+
};
|
|
104
|
+
/**
|
|
105
|
+
* Find the bounds of an element
|
|
106
|
+
* taking padding, margin and borders into account
|
|
107
|
+
* @param {element} el
|
|
108
|
+
* @returns {{ width: Number, height: Number}}
|
|
109
|
+
* @memberof Core
|
|
110
|
+
*/
|
|
111
|
+
export declare function borders(el: Element): {
|
|
112
|
+
width: number;
|
|
113
|
+
height: number;
|
|
114
|
+
};
|
|
115
|
+
/**
|
|
116
|
+
* Find the bounds of any node
|
|
117
|
+
* allows for getting bounds of text nodes by wrapping them in a range
|
|
118
|
+
* @param {node} node
|
|
119
|
+
* @returns {BoundingClientRect}
|
|
120
|
+
* @memberof Core
|
|
121
|
+
*/
|
|
122
|
+
export declare function nodeBounds(node: Node): DOMRect;
|
|
123
|
+
/**
|
|
124
|
+
* Find the equivalent of getBoundingClientRect of a browser window
|
|
125
|
+
* @returns {{ width: Number, height: Number, top: Number, left: Number, right: Number, bottom: Number }}
|
|
126
|
+
* @memberof Core
|
|
127
|
+
*/
|
|
128
|
+
export declare function windowBounds(): {
|
|
129
|
+
top: number;
|
|
130
|
+
left: number;
|
|
131
|
+
right: number;
|
|
132
|
+
bottom: number;
|
|
133
|
+
width: number;
|
|
134
|
+
height: number;
|
|
135
|
+
};
|
|
136
|
+
/**
|
|
137
|
+
* Gets the index of a node in its parent
|
|
138
|
+
* @param {Node} node
|
|
139
|
+
* @param {string} typeId
|
|
140
|
+
* @return {number} index
|
|
141
|
+
* @memberof Core
|
|
142
|
+
*/
|
|
143
|
+
export declare function indexOfNode(node: Node, typeId: number): number;
|
|
144
|
+
/**
|
|
145
|
+
* Gets the index of a text node in its parent
|
|
146
|
+
* @param {node} textNode
|
|
147
|
+
* @returns {number} index
|
|
148
|
+
* @memberof Core
|
|
149
|
+
*/
|
|
150
|
+
export declare function indexOfTextNode(textNode: Node): number;
|
|
151
|
+
/**
|
|
152
|
+
* Gets the index of an element node in its parent
|
|
153
|
+
* @param {element} elementNode
|
|
154
|
+
* @returns {number} index
|
|
155
|
+
* @memberof Core
|
|
156
|
+
*/
|
|
157
|
+
export declare function indexOfElementNode(elementNode: Node): number;
|
|
158
|
+
/**
|
|
159
|
+
* Check if extension is xml
|
|
160
|
+
* @param {string} ext
|
|
161
|
+
* @returns {boolean}
|
|
162
|
+
* @memberof Core
|
|
163
|
+
*/
|
|
164
|
+
export declare function isXml(ext: string): boolean;
|
|
165
|
+
/**
|
|
166
|
+
* Create a new blob
|
|
167
|
+
* @param {any} content
|
|
168
|
+
* @param {string} mime
|
|
169
|
+
* @returns {Blob}
|
|
170
|
+
* @memberof Core
|
|
171
|
+
*/
|
|
172
|
+
export declare function createBlob(content: BlobPart, mime: string): Blob;
|
|
173
|
+
/**
|
|
174
|
+
* Create a new blob url
|
|
175
|
+
* @param {any} content
|
|
176
|
+
* @param {string} mime
|
|
177
|
+
* @returns {string} url
|
|
178
|
+
* @memberof Core
|
|
179
|
+
*/
|
|
180
|
+
export declare function createBlobUrl(content: BlobPart, mime: string): string;
|
|
181
|
+
/**
|
|
182
|
+
* Remove a blob url
|
|
183
|
+
* @param {string} url
|
|
184
|
+
* @memberof Core
|
|
185
|
+
*/
|
|
186
|
+
export declare function revokeBlobUrl(url: string): void;
|
|
187
|
+
/**
|
|
188
|
+
* Create a new base64 encoded url
|
|
189
|
+
* @param {any} content
|
|
190
|
+
* @param {string} mime
|
|
191
|
+
* @returns {string} url
|
|
192
|
+
* @memberof Core
|
|
193
|
+
*/
|
|
194
|
+
export declare function createBase64Url(content: string, mime: string): string | undefined;
|
|
195
|
+
/**
|
|
196
|
+
* Get type of an object
|
|
197
|
+
* @param {object} obj
|
|
198
|
+
* @returns {string} type
|
|
199
|
+
* @memberof Core
|
|
200
|
+
*/
|
|
201
|
+
export declare function type(obj: unknown): string;
|
|
202
|
+
/**
|
|
203
|
+
* Parse xml (or html) markup
|
|
204
|
+
* @param {string} markup
|
|
205
|
+
* @param {string} mime
|
|
206
|
+
* @param {boolean} forceXMLDom force using xmlDom to parse instead of native parser
|
|
207
|
+
* @returns {document} document
|
|
208
|
+
* @memberof Core
|
|
209
|
+
*/
|
|
210
|
+
export declare function parse(markup: string, mime: string, forceXMLDom?: boolean): Document;
|
|
211
|
+
/**
|
|
212
|
+
* querySelector polyfill
|
|
213
|
+
* @param {element} el
|
|
214
|
+
* @param {string} sel selector string
|
|
215
|
+
* @returns {element} element
|
|
216
|
+
* @memberof Core
|
|
217
|
+
*/
|
|
218
|
+
export declare function qs(el: Document | Element, sel: string): Element | undefined;
|
|
219
|
+
/**
|
|
220
|
+
* querySelectorAll polyfill
|
|
221
|
+
* @param {element} el
|
|
222
|
+
* @param {string} sel selector string
|
|
223
|
+
* @returns {element[]} elements
|
|
224
|
+
* @memberof Core
|
|
225
|
+
*/
|
|
226
|
+
export declare function qsa(el: Document | Element, sel: string): NodeListOf<Element> | HTMLCollectionOf<Element>;
|
|
227
|
+
/**
|
|
228
|
+
* querySelector by property
|
|
229
|
+
* @param {element} el
|
|
230
|
+
* @param {string} sel selector string
|
|
231
|
+
* @param {object[]} props
|
|
232
|
+
* @returns {element[]} elements
|
|
233
|
+
* @memberof Core
|
|
234
|
+
*/
|
|
235
|
+
export declare function qsp(el: Document | Element, sel: string, props: Record<string, string>): Element | undefined;
|
|
236
|
+
/**
|
|
237
|
+
* Sprint through all text nodes in a document
|
|
238
|
+
* @memberof Core
|
|
239
|
+
* @param {element} root element to start with
|
|
240
|
+
* @param {function} func function to run on each element
|
|
241
|
+
*/
|
|
242
|
+
export declare function sprint(root: Node, func: (node: Node) => void): void;
|
|
243
|
+
/**
|
|
244
|
+
* Create a treeWalker
|
|
245
|
+
* @memberof Core
|
|
246
|
+
* @param {element} root element to start with
|
|
247
|
+
* @param {function} func function to run on each element
|
|
248
|
+
* @param {function | object} filter function or object to filter with
|
|
249
|
+
*/
|
|
250
|
+
export declare function treeWalker(root: Node, func: (node: Node) => void, filter: number): void;
|
|
251
|
+
/**
|
|
252
|
+
* @memberof Core
|
|
253
|
+
* @param {node} node
|
|
254
|
+
* @param {callback} return false for continue,true for break inside callback
|
|
255
|
+
*/
|
|
256
|
+
export declare function walk(node: Node, callback: (node: Node) => boolean, _unused?: boolean): boolean | undefined;
|
|
257
|
+
/**
|
|
258
|
+
* Convert a blob to a base64 encoded string
|
|
259
|
+
* @param {Blog} blob
|
|
260
|
+
* @returns {string}
|
|
261
|
+
* @memberof Core
|
|
262
|
+
*/
|
|
263
|
+
export declare function blob2base64(blob: Blob): Promise<string | ArrayBuffer>;
|
|
264
|
+
/**
|
|
265
|
+
* Creates a new pending promise and provides methods to resolve or reject it.
|
|
266
|
+
* From: https://developer.mozilla.org/en-US/docs/Mozilla/JavaScript_code_modules/Promise.jsm/Deferred#backwards_forwards_compatible
|
|
267
|
+
* @memberof Core
|
|
268
|
+
*/
|
|
269
|
+
export declare class defer {
|
|
270
|
+
id: string;
|
|
271
|
+
resolve: (value?: any) => void;
|
|
272
|
+
reject: (reason?: any) => void;
|
|
273
|
+
promise: Promise<any>;
|
|
274
|
+
constructor();
|
|
275
|
+
}
|
|
276
|
+
/**
|
|
277
|
+
* querySelector with filter by epub type
|
|
278
|
+
* @param {element} html
|
|
279
|
+
* @param {string} element element type to find
|
|
280
|
+
* @param {string} type epub type to find
|
|
281
|
+
* @returns {element[]} elements
|
|
282
|
+
* @memberof Core
|
|
283
|
+
*/
|
|
284
|
+
export declare function querySelectorByType(html: Document | Element, element: string, type: string): Element | undefined;
|
|
285
|
+
/**
|
|
286
|
+
* Find direct descendents of an element
|
|
287
|
+
* @param {element} el
|
|
288
|
+
* @returns {element[]} children
|
|
289
|
+
* @memberof Core
|
|
290
|
+
*/
|
|
291
|
+
export declare function findChildren(el: Element): Element[];
|
|
292
|
+
/**
|
|
293
|
+
* Find all parents (ancestors) of an element
|
|
294
|
+
* @param {element} node
|
|
295
|
+
* @returns {element[]} parents
|
|
296
|
+
* @memberof Core
|
|
297
|
+
*/
|
|
298
|
+
export declare function parents(node: Node | null | undefined): Node[];
|
|
299
|
+
/**
|
|
300
|
+
* Find all direct descendents of a specific type
|
|
301
|
+
* @param {element} el
|
|
302
|
+
* @param {string} nodeName
|
|
303
|
+
* @param {boolean} [single]
|
|
304
|
+
* @returns {element[]} children
|
|
305
|
+
* @memberof Core
|
|
306
|
+
*/
|
|
307
|
+
export declare function filterChildren(el: Element, nodeName: string, single?: boolean): Element | Element[] | undefined;
|
|
308
|
+
/**
|
|
309
|
+
* Filter all parents (ancestors) with tag name
|
|
310
|
+
* @param {element} node
|
|
311
|
+
* @param {string} tagname
|
|
312
|
+
* @returns {element[]} parents
|
|
313
|
+
* @memberof Core
|
|
314
|
+
*/
|
|
315
|
+
export declare function getParentByTagName(node: Node, tagname: string): Element | undefined;
|
|
316
|
+
/**
|
|
317
|
+
* Lightweight Polyfill for DOM Range
|
|
318
|
+
* @class
|
|
319
|
+
* @memberof Core
|
|
320
|
+
*/
|
|
321
|
+
export declare class RangeObject {
|
|
322
|
+
collapsed: boolean;
|
|
323
|
+
commonAncestorContainer: Node | undefined;
|
|
324
|
+
endContainer: Node | undefined;
|
|
325
|
+
endOffset: number | undefined;
|
|
326
|
+
startContainer: Node | undefined;
|
|
327
|
+
startOffset: number | undefined;
|
|
328
|
+
constructor();
|
|
329
|
+
setStart(startNode: Node, startOffset: number): void;
|
|
330
|
+
setEnd(endNode: Node, endOffset: number): void;
|
|
331
|
+
collapse(toStart: boolean): void;
|
|
332
|
+
selectNode(referenceNode: Node): void;
|
|
333
|
+
selectNodeContents(referenceNode: Node): void;
|
|
334
|
+
_commonAncestorContainer(startContainer?: Node, endContainer?: Node): Node | undefined;
|
|
335
|
+
_checkCollapsed(): void;
|
|
336
|
+
toString(): string;
|
|
337
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hooks allow for injecting functions that must all complete in order before finishing
|
|
3
|
+
* They will execute in parallel but all must finish before continuing
|
|
4
|
+
* Functions may return a promise if they are async.
|
|
5
|
+
* @param {any} context scope of this
|
|
6
|
+
* @example this.content = new EPUBJS.Hook(this);
|
|
7
|
+
*/
|
|
8
|
+
declare class Hook {
|
|
9
|
+
context: any;
|
|
10
|
+
hooks: Function[];
|
|
11
|
+
constructor(context?: any);
|
|
12
|
+
/**
|
|
13
|
+
* Adds a function to be run before a hook completes
|
|
14
|
+
* @example this.content.register(function(){...});
|
|
15
|
+
*/
|
|
16
|
+
register(..._args: any[]): void;
|
|
17
|
+
/**
|
|
18
|
+
* Removes a function
|
|
19
|
+
* @example this.content.deregister(function(){...});
|
|
20
|
+
*/
|
|
21
|
+
deregister(func: Function): void;
|
|
22
|
+
/**
|
|
23
|
+
* Triggers a hook to run all functions
|
|
24
|
+
* @example this.content.trigger(args).then(function(){...});
|
|
25
|
+
*/
|
|
26
|
+
trigger(..._args: any[]): Promise<any[]>;
|
|
27
|
+
list(): Function[];
|
|
28
|
+
clear(): Function[];
|
|
29
|
+
}
|
|
30
|
+
export default Hook;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ParsedPath } from '../types';
|
|
2
|
+
export declare function resolve(..._args: string[]): string;
|
|
3
|
+
export declare function relative(from: string, to: string): string;
|
|
4
|
+
export declare function dirname(path: string): string;
|
|
5
|
+
export declare function isAbsolute(path: string): boolean;
|
|
6
|
+
export declare function parse(path: string): ParsedPath;
|
|
7
|
+
declare const pathUtils: {
|
|
8
|
+
resolve: typeof resolve;
|
|
9
|
+
relative: typeof relative;
|
|
10
|
+
dirname: typeof dirname;
|
|
11
|
+
isAbsolute: typeof isAbsolute;
|
|
12
|
+
parse: typeof parse;
|
|
13
|
+
};
|
|
14
|
+
export default pathUtils;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { ParsedPath } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Creates a Path object for parsing and manipulation of a path strings
|
|
4
|
+
*
|
|
5
|
+
* Uses a polyfill for Nodejs path: https://nodejs.org/api/path.html
|
|
6
|
+
* @param {string} pathString a url string (relative or absolute)
|
|
7
|
+
* @class
|
|
8
|
+
*/
|
|
9
|
+
declare class Path {
|
|
10
|
+
path: string;
|
|
11
|
+
directory: string;
|
|
12
|
+
filename: string;
|
|
13
|
+
extension: string;
|
|
14
|
+
constructor(pathString: string);
|
|
15
|
+
/**
|
|
16
|
+
* Parse the path: https://nodejs.org/api/path.html#path_path_parse_path
|
|
17
|
+
* @param {string} what
|
|
18
|
+
* @returns {object}
|
|
19
|
+
*/
|
|
20
|
+
parse(what: string): ParsedPath;
|
|
21
|
+
/**
|
|
22
|
+
* @param {string} what
|
|
23
|
+
* @returns {boolean}
|
|
24
|
+
*/
|
|
25
|
+
isAbsolute(what?: string): boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Check if path ends with a directory
|
|
28
|
+
* @param {string} what
|
|
29
|
+
* @returns {boolean}
|
|
30
|
+
*/
|
|
31
|
+
isDirectory(what: string): boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Resolve a path against the directory of the Path
|
|
34
|
+
*
|
|
35
|
+
* https://nodejs.org/api/path.html#path_path_resolve_paths
|
|
36
|
+
* @param {string} what
|
|
37
|
+
* @returns {string} resolved
|
|
38
|
+
*/
|
|
39
|
+
resolve(what: string): string;
|
|
40
|
+
/**
|
|
41
|
+
* Resolve a path relative to the directory of the Path
|
|
42
|
+
*
|
|
43
|
+
* https://nodejs.org/api/path.html#path_path_relative_from_to
|
|
44
|
+
* @param {string} what
|
|
45
|
+
* @returns {string} relative
|
|
46
|
+
*/
|
|
47
|
+
relative(what: string): string;
|
|
48
|
+
splitPath(filename: string): string[];
|
|
49
|
+
/**
|
|
50
|
+
* Return the path string
|
|
51
|
+
* @returns {string} path
|
|
52
|
+
*/
|
|
53
|
+
toString(): string;
|
|
54
|
+
}
|
|
55
|
+
export default Path;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Queue for handling tasks one at a time
|
|
3
|
+
* @class
|
|
4
|
+
* @param {scope} context what this will resolve to in the tasks
|
|
5
|
+
*/
|
|
6
|
+
declare class Queue {
|
|
7
|
+
_q: any[];
|
|
8
|
+
context: any;
|
|
9
|
+
tick: any;
|
|
10
|
+
running: any;
|
|
11
|
+
paused: boolean;
|
|
12
|
+
defered: any;
|
|
13
|
+
constructor(context: any);
|
|
14
|
+
/**
|
|
15
|
+
* Add an item to the queue
|
|
16
|
+
* @return {Promise}
|
|
17
|
+
*/
|
|
18
|
+
enqueue(..._args: any[]): Promise<any>;
|
|
19
|
+
/**
|
|
20
|
+
* Run one item
|
|
21
|
+
* @return {Promise}
|
|
22
|
+
*/
|
|
23
|
+
dequeue(): any;
|
|
24
|
+
dump(): void;
|
|
25
|
+
/**
|
|
26
|
+
* Run all tasks sequentially, at convince
|
|
27
|
+
* @return {Promise}
|
|
28
|
+
*/
|
|
29
|
+
run(): Promise<any>;
|
|
30
|
+
/**
|
|
31
|
+
* Flush all, as quickly as possible
|
|
32
|
+
* @return {Promise}
|
|
33
|
+
*/
|
|
34
|
+
flush(): any;
|
|
35
|
+
/**
|
|
36
|
+
* Clear all items in wait
|
|
37
|
+
*/
|
|
38
|
+
clear(): void;
|
|
39
|
+
/**
|
|
40
|
+
* Get the number of tasks in the queue
|
|
41
|
+
* @return {number} tasks
|
|
42
|
+
*/
|
|
43
|
+
length(): number;
|
|
44
|
+
/**
|
|
45
|
+
* Pause a running queue
|
|
46
|
+
*/
|
|
47
|
+
pause(): void;
|
|
48
|
+
/**
|
|
49
|
+
* End the queue
|
|
50
|
+
*/
|
|
51
|
+
stop(): void;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Create a new task from a callback
|
|
55
|
+
* @class
|
|
56
|
+
* @private
|
|
57
|
+
* @param {function} task
|
|
58
|
+
* @param {array} args
|
|
59
|
+
* @param {scope} context
|
|
60
|
+
* @return {function} task
|
|
61
|
+
*/
|
|
62
|
+
declare class Task {
|
|
63
|
+
constructor(task: Function, args: any[], context: any);
|
|
64
|
+
}
|
|
65
|
+
export default Queue;
|
|
66
|
+
export { Task };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare function replaceBase(doc: Document, section: {
|
|
2
|
+
url: string;
|
|
3
|
+
}): void;
|
|
4
|
+
export declare function replaceCanonical(doc: Document, section: {
|
|
5
|
+
canonical: string;
|
|
6
|
+
}): void;
|
|
7
|
+
export declare function replaceMeta(doc: Document, section: {
|
|
8
|
+
idref: string;
|
|
9
|
+
}): void;
|
|
10
|
+
export declare function replaceLinks(contents: Element, fn: (path: string) => void): void;
|
|
11
|
+
export declare function substitute(content: string, urls: string[], replacements: string[]): string;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { default as Path } from './path';
|
|
2
|
+
/**
|
|
3
|
+
* creates a Url object for parsing and manipulation of a url string
|
|
4
|
+
* @param {string} urlString a url string (relative or absolute)
|
|
5
|
+
* @param {string} [baseString] optional base for the url,
|
|
6
|
+
* default to window.location.href
|
|
7
|
+
*/
|
|
8
|
+
declare class Url {
|
|
9
|
+
Url: URL | undefined;
|
|
10
|
+
href: string;
|
|
11
|
+
protocol: string;
|
|
12
|
+
origin: string;
|
|
13
|
+
hash: string;
|
|
14
|
+
search: string;
|
|
15
|
+
base: string | false | undefined;
|
|
16
|
+
Path: Path;
|
|
17
|
+
directory: string;
|
|
18
|
+
filename: string;
|
|
19
|
+
extension: string;
|
|
20
|
+
constructor(urlString: string, baseString?: string | false);
|
|
21
|
+
/**
|
|
22
|
+
* @returns {Path}
|
|
23
|
+
*/
|
|
24
|
+
path(): Path;
|
|
25
|
+
/**
|
|
26
|
+
* Resolves a relative path to a absolute url
|
|
27
|
+
* @param {string} what
|
|
28
|
+
* @returns {string} url
|
|
29
|
+
*/
|
|
30
|
+
resolve(what: string): string;
|
|
31
|
+
/**
|
|
32
|
+
* Resolve a path relative to the url
|
|
33
|
+
* @param {string} what
|
|
34
|
+
* @returns {string} path
|
|
35
|
+
*/
|
|
36
|
+
relative(what: string): string;
|
|
37
|
+
/**
|
|
38
|
+
* @returns {string}
|
|
39
|
+
*/
|
|
40
|
+
toString(): string;
|
|
41
|
+
}
|
|
42
|
+
export default Url;
|
package/license
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
Copyright (c) 2024-2026, 3ook.com
|
|
2
|
+
Copyright (c) 2013, FuturePress
|
|
3
|
+
|
|
4
|
+
All rights reserved.
|
|
5
|
+
|
|
6
|
+
Redistribution and use in source and binary forms, with or without
|
|
7
|
+
modification, are permitted provided that the following conditions are met:
|
|
8
|
+
|
|
9
|
+
1. Redistributions of source code must retain the above copyright notice, this
|
|
10
|
+
list of conditions and the following disclaimer.
|
|
11
|
+
2. Redistributions in binary form must reproduce the above copyright notice,
|
|
12
|
+
this list of conditions and the following disclaimer in the documentation
|
|
13
|
+
and/or other materials provided with the distribution.
|
|
14
|
+
|
|
15
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
16
|
+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
17
|
+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
18
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
|
19
|
+
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
20
|
+
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
21
|
+
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
|
22
|
+
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
23
|
+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
24
|
+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
25
|
+
|
|
26
|
+
The views and conclusions contained in the software and documentation are those
|
|
27
|
+
of the authors and should not be interpreted as representing official policies,
|
|
28
|
+
either expressed or implied, of the FreeBSD Project.
|
package/package.json
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@likecoin/epub-ts",
|
|
3
|
+
"version": "0.3.93",
|
|
4
|
+
"description": "Parse and Render Epubs",
|
|
5
|
+
"keywords": ["epub", "ebook", "reader", "typescript", "epubjs", "parser", "renderer"],
|
|
6
|
+
"type": "module",
|
|
7
|
+
"main": "dist/epub.cjs",
|
|
8
|
+
"module": "dist/epub.js",
|
|
9
|
+
"types": "dist/index.d.ts",
|
|
10
|
+
"exports": {
|
|
11
|
+
".": {
|
|
12
|
+
"types": "./dist/index.d.ts",
|
|
13
|
+
"import": "./dist/epub.js",
|
|
14
|
+
"require": "./dist/epub.cjs"
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
"files": [
|
|
18
|
+
"dist"
|
|
19
|
+
],
|
|
20
|
+
"repository": "https://github.com/likecoin/epub.ts",
|
|
21
|
+
"scripts": {
|
|
22
|
+
"build": "vite build",
|
|
23
|
+
"test": "vitest run",
|
|
24
|
+
"test:watch": "vitest",
|
|
25
|
+
"typecheck": "tsc --noEmit",
|
|
26
|
+
"lint": "eslint src/",
|
|
27
|
+
"lint:fix": "eslint src/ --fix"
|
|
28
|
+
},
|
|
29
|
+
"author": "William Chong <me@williamchong.cloud>",
|
|
30
|
+
"contributors": [
|
|
31
|
+
{
|
|
32
|
+
"name": "Fred Chasen",
|
|
33
|
+
"email": "fchasen@gmail.com"
|
|
34
|
+
}
|
|
35
|
+
],
|
|
36
|
+
"homepage": "https://github.com/likecoin/epub.ts",
|
|
37
|
+
"bugs": "https://github.com/likecoin/epub.ts/issues",
|
|
38
|
+
"license": "BSD-2-Clause",
|
|
39
|
+
"devDependencies": {
|
|
40
|
+
"@eslint/js": "^9.39.2",
|
|
41
|
+
"@types/localforage": "0.0.34",
|
|
42
|
+
"eslint": "^9.39.2",
|
|
43
|
+
"jsdom": "^28.0.0",
|
|
44
|
+
"typescript": "^5.7.3",
|
|
45
|
+
"typescript-eslint": "^8.54.0",
|
|
46
|
+
"vite": "^6.1.0",
|
|
47
|
+
"vite-plugin-dts": "^4.5.4",
|
|
48
|
+
"vitest": "^3.0.5"
|
|
49
|
+
},
|
|
50
|
+
"dependencies": {
|
|
51
|
+
"@xmldom/xmldom": "^0.7.5",
|
|
52
|
+
"jszip": "^3.7.1",
|
|
53
|
+
"localforage": "^1.10.0"
|
|
54
|
+
}
|
|
55
|
+
}
|