@likecoin/epub-ts 0.4.9 → 0.5.0

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/dist/index.d.ts CHANGED
@@ -16,9 +16,10 @@ import { default as DisplayOptions } from './displayoptions';
16
16
  import { default as Annotations } from './annotations';
17
17
  import { default as Themes } from './themes';
18
18
  import { default as Mapping } from './mapping';
19
+ import { EpubError } from './utils/core';
19
20
  import { default as ePub } from './epub';
20
21
  export default ePub;
21
- export { Book, EpubCFI, Rendition, Contents, Layout, Section, Spine, Locations, Navigation, PageList, Resources, Packaging, Archive, Store, DisplayOptions, Annotations, Themes, Mapping, };
22
+ export { Book, EpubCFI, EpubError, Rendition, Contents, Layout, Section, Spine, Locations, Navigation, PageList, Resources, Packaging, Archive, Store, DisplayOptions, Annotations, Themes, Mapping, };
22
23
  export * from './types';
23
24
  export type { BookEvents } from './book';
24
25
  export type { RenditionEvents } from './rendition';
@@ -1,4 +1,3 @@
1
- import { defer, requestAnimationFrame } from '../../utils/core';
2
1
  import { default as DefaultViewManager } from '../default';
3
2
  import { default as Snap } from '../helpers/snap';
4
3
  import { default as Section } from '../../section';
@@ -7,7 +6,6 @@ import { default as Stage } from '../helpers/stage';
7
6
  import { ManagerOptions, ReframeBounds } from '../../types';
8
7
  declare class ContinuousViewManager extends DefaultViewManager {
9
8
  snapper: Snap | undefined;
10
- tick: typeof requestAnimationFrame;
11
9
  scrollDeltaVert: number;
12
10
  scrollDeltaHorz: number;
13
11
  _scrolled: (...args: unknown[]) => void;
@@ -18,7 +16,7 @@ declare class ContinuousViewManager extends DefaultViewManager {
18
16
  trimTimeout: ReturnType<typeof setTimeout>;
19
17
  constructor(options: ManagerOptions);
20
18
  display(section: Section, target?: string): Promise<void>;
21
- fill(_full?: defer<void>): Promise<void>;
19
+ fill(): Promise<void>;
22
20
  moveTo(offset: {
23
21
  left: number;
24
22
  top: number;
@@ -61,17 +61,8 @@ declare class DefaultViewManager implements IEventEmitter<DefaultManagerEvents>
61
61
  _hasScrolled: boolean;
62
62
  _onScroll: ((e?: Event) => void) | undefined;
63
63
  _onUnload: ((e: Event) => void) | undefined;
64
- orientationTimeout: ReturnType<typeof setTimeout> | undefined;
65
64
  resizeTimeout: ReturnType<typeof setTimeout>;
66
65
  afterScrolled: ReturnType<typeof setTimeout>;
67
- winBounds: {
68
- top: number;
69
- left: number;
70
- right: number;
71
- bottom: number;
72
- width: number;
73
- height: number;
74
- };
75
66
  on: IEventEmitter<DefaultManagerEvents>["on"];
76
67
  off: IEventEmitter<DefaultManagerEvents>["off"];
77
68
  emit: IEventEmitter<DefaultManagerEvents>["emit"];
package/dist/types.d.ts CHANGED
@@ -1,7 +1,6 @@
1
1
  import { default as Section } from './section';
2
2
  import { default as Queue } from './utils/queue';
3
3
  export interface Deferred<T = unknown> {
4
- id: string;
5
4
  resolve: (value: T | PromiseLike<T>) => void;
6
5
  reject: (reason?: unknown) => void;
7
6
  promise: Promise<T>;
@@ -283,10 +282,6 @@ export interface ParsedPath {
283
282
  name: string;
284
283
  }
285
284
  declare global {
286
- interface Window {
287
- webkitURL?: typeof URL;
288
- mozURL?: typeof URL;
289
- }
290
285
  interface Navigator {
291
286
  epubReadingSystem?: {
292
287
  name: string;
@@ -6,7 +6,8 @@
6
6
  * @returns {function} requestAnimationFrame
7
7
  * @memberof Core
8
8
  */
9
- export declare const requestAnimationFrame: boolean | (((callback: FrameRequestCallback) => number) & typeof globalThis.requestAnimationFrame);
9
+ export declare const microTick: (cb: FrameRequestCallback) => number;
10
+ export declare const requestAnimationFrame: (cb: FrameRequestCallback) => number;
10
11
  /**
11
12
  * Generates a UUID
12
13
  * based on: http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript
@@ -39,13 +40,6 @@ export declare function isNumber(n: unknown): boolean;
39
40
  * @memberof Core
40
41
  */
41
42
  export declare function isFloat(n: unknown): boolean;
42
- /**
43
- * Get a prefixed css property
44
- * @param {string} unprefixed
45
- * @returns {string}
46
- * @memberof Core
47
- */
48
- export declare function prefixed(unprefixed: string): string;
49
43
  /**
50
44
  * Apply defaults to an object
51
45
  * @param {object} obj
@@ -165,6 +159,23 @@ export declare function indexOfElementNode(elementNode: Node): number;
165
159
  * @memberof Core
166
160
  */
167
161
  export declare function isXml(ext: string): boolean;
162
+ /**
163
+ * Handle a response string or Blob, parsing it based on file type
164
+ * @param {string | Blob} response
165
+ * @param {string} [type]
166
+ * @returns {Document | object | Blob | string} the parsed result
167
+ * @memberof Core
168
+ */
169
+ export declare function handleResponse(response: string | Blob, type?: string): Document | object | Blob | string;
170
+ /**
171
+ * Error subclass for EPUB-related errors
172
+ * @class
173
+ * @memberof Core
174
+ */
175
+ export declare class EpubError extends Error {
176
+ status?: number;
177
+ constructor(message: string, status?: number);
178
+ }
168
179
  /**
169
180
  * Create a new blob
170
181
  * @param {any} content
@@ -268,7 +279,6 @@ export declare function blob2base64(blob: Blob): Promise<string | ArrayBuffer>;
268
279
  * From: https://developer.mozilla.org/en-US/docs/Mozilla/JavaScript_code_modules/Promise.jsm/Deferred#backwards_forwards_compatible
269
280
  */
270
281
  export declare class defer<T = unknown> {
271
- id: string;
272
282
  resolve: (value: T | PromiseLike<T>) => void;
273
283
  reject: (reason?: unknown) => void;
274
284
  promise: Promise<T>;
@@ -13,7 +13,7 @@ interface QueueItem {
13
13
  declare class Queue {
14
14
  _q: QueueItem[];
15
15
  context: object | undefined;
16
- tick: ((cb: FrameRequestCallback) => number) | false;
16
+ tick: (cb: FrameRequestCallback) => number;
17
17
  running: boolean | Promise<void> | undefined;
18
18
  paused: boolean;
19
19
  defered: defer<void> | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@likecoin/epub-ts",
3
- "version": "0.4.9",
3
+ "version": "0.5.0",
4
4
  "description": "TypeScript EPUB parser and renderer, forked from epubjs",
5
5
  "keywords": [
6
6
  "epub",