@likecoin/epub-ts 0.4.2 → 0.4.4

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 CHANGED
@@ -97,7 +97,7 @@ Key classes:
97
97
  | Type definitions | Generated from source | Hand-written `.d.ts` |
98
98
  | Dependencies | 1 (`jszip`) | 7+ (`core-js`, `lodash`, `event-emitter`, etc.) |
99
99
  | API compatibility | 100% (drop-in replacement) | — |
100
- | Bundle format | ESM + CJS | UMD |
100
+ | Bundle format | ESM + CJS + UMD | UMD |
101
101
  | Maintenance | Active | Inactive since 2022 |
102
102
 
103
103
  ## Supported Environments
package/dist/archive.d.ts CHANGED
@@ -4,7 +4,7 @@ import { default as JSZip } from 'jszip';
4
4
  * @class
5
5
  */
6
6
  declare class Archive {
7
- zip: JSZip;
7
+ zip: JSZip | undefined;
8
8
  urlCache: Record<string, string>;
9
9
  constructor();
10
10
  /**
@@ -33,7 +33,7 @@ declare class Archive {
33
33
  * @param {string} [type] specify the type of the returned result
34
34
  * @return {Promise<Blob | string | JSON | Document | XMLDocument>}
35
35
  */
36
- request(url: string, type?: string): Promise<any>;
36
+ request(url: string, type?: string): Promise<unknown>;
37
37
  /**
38
38
  * Handle the response from request
39
39
  * @private
@@ -41,7 +41,7 @@ declare class Archive {
41
41
  * @param {string} [type]
42
42
  * @return {any} the parsed result
43
43
  */
44
- handleResponse(response: any, type?: string): any;
44
+ handleResponse(response: string | Blob, type?: string): Document | object | Blob | string;
45
45
  /**
46
46
  * Get a Blob from Archive by Url
47
47
  * @param {string} url
package/dist/book.d.ts CHANGED
@@ -16,14 +16,14 @@ import { default as JSZip } from 'jszip';
16
16
  import { IEventEmitter, BookOptions, RenditionOptions, RequestFunction, PackagingManifestObject, PackagingMetadataObject } from './types';
17
17
  import { default as Section } from './section';
18
18
  interface BookLoadingState {
19
- manifest: defer;
20
- spine: defer;
21
- metadata: defer;
22
- cover: defer;
23
- navigation: defer;
24
- pageList: defer;
25
- resources: defer;
26
- displayOptions: defer;
19
+ manifest: defer<PackagingManifestObject>;
20
+ spine: defer<Spine>;
21
+ metadata: defer<PackagingMetadataObject>;
22
+ cover: defer<string>;
23
+ navigation: defer<Navigation>;
24
+ pageList: defer<PageList>;
25
+ resources: defer<Resources>;
26
+ displayOptions: defer<DisplayOptions>;
27
27
  }
28
28
  interface BookLoadedState {
29
29
  manifest: Promise<PackagingManifestObject>;
@@ -54,8 +54,8 @@ interface BookLoadedState {
54
54
  * @example new Book({ replacements: "blobUrl" })
55
55
  */
56
56
  declare class Book implements IEventEmitter {
57
- settings: BookOptions & Record<string, any>;
58
- opening: defer;
57
+ settings: BookOptions;
58
+ opening: defer<Book>;
59
59
  opened: Promise<Book> | undefined;
60
60
  isOpen: boolean;
61
61
  loading: BookLoadingState | undefined;
@@ -125,7 +125,7 @@ declare class Book implements IEventEmitter {
125
125
  * @param {string} path path to the resource to load
126
126
  * @return {Promise} returns a promise with the requested resource
127
127
  */
128
- load(path: string, _type?: string): Promise<any>;
128
+ load(path: string, _type?: string): Promise<unknown>;
129
129
  /**
130
130
  * Resolve a path to it's absolute position in the Book
131
131
  * @param {string} path
@@ -145,7 +145,7 @@ declare class Book implements IEventEmitter {
145
145
  * @param {string} input
146
146
  * @return {string} binary | directory | epub | opf
147
147
  */
148
- determineType(input: string | ArrayBuffer | Blob): string;
148
+ determineType(input: string | ArrayBuffer | Blob): string | undefined;
149
149
  /**
150
150
  * unpack the contents of the Books packaging
151
151
  * @private
@@ -4,9 +4,9 @@
4
4
  * @param {document} [containerDocument] xml document
5
5
  */
6
6
  declare class Container {
7
- packagePath: string;
8
- directory: string;
9
- encoding: string;
7
+ packagePath: string | undefined;
8
+ directory: string | undefined;
9
+ encoding: string | undefined;
10
10
  constructor(containerDocument?: Document);
11
11
  /**
12
12
  * Parse the Container XML
@@ -13,7 +13,8 @@ import { default as Section } from './section';
13
13
  declare class Contents implements IEventEmitter {
14
14
  on: (type: string, fn: (...args: any[]) => void) => this;
15
15
  off: (type: string, fn?: (...args: any[]) => void) => this;
16
- emit: (type: string, ...args: any[]) => void;
16
+ emit: (type: string, ...args: unknown[]) => void;
17
+ __listeners: IEventEmitter["__listeners"];
17
18
  epubcfi: EpubCFI;
18
19
  document: Document;
19
20
  documentElement: HTMLElement;
@@ -4,10 +4,10 @@
4
4
  * @param {document} displayOptionsDocument XML
5
5
  */
6
6
  declare class DisplayOptions {
7
- interactive: string;
8
- fixedLayout: string;
9
- openToSpread: string;
10
- orientationLock: string;
7
+ interactive: string | undefined;
8
+ fixedLayout: string | undefined;
9
+ openToSpread: string | undefined;
10
+ orientationLock: string | undefined;
11
11
  constructor(displayOptionsDocument?: Document);
12
12
  /**
13
13
  * Parse XML