@likecoin/epub-ts 0.4.4 → 0.4.5

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.
@@ -2,12 +2,12 @@ import { IEventEmitter } from './types';
2
2
  import { default as Rendition } from './rendition';
3
3
  interface AnnotationView {
4
4
  index: number;
5
- highlight: Function;
6
- underline: Function;
7
- mark: Function;
8
- unhighlight: Function;
9
- ununderline: Function;
10
- unmark: Function;
5
+ highlight: (cfiRange: string, data?: Record<string, string>, cb?: EventListener, className?: string, styles?: Record<string, string>) => object | undefined;
6
+ underline: (cfiRange: string, data?: Record<string, string>, cb?: EventListener, className?: string, styles?: Record<string, string>) => object | undefined;
7
+ mark: (cfiRange: string, data?: Record<string, string>, cb?: EventListener) => object | null | undefined;
8
+ unhighlight: (cfiRange: string) => void;
9
+ ununderline: (cfiRange: string) => void;
10
+ unmark: (cfiRange: string) => void;
11
11
  }
12
12
  /**
13
13
  * Handles managing adding & removing Annotations
@@ -32,7 +32,7 @@ declare class Annotations {
32
32
  * @param {object} styles CSS styles to assign to annotation
33
33
  * @returns {Annotation} annotation
34
34
  */
35
- add(type: string, cfiRange: string, data?: Record<string, any>, cb?: Function, className?: string, styles?: Record<string, string>): Annotation;
35
+ add(type: string, cfiRange: string, data?: Record<string, any>, cb?: EventListener, className?: string, styles?: Record<string, string>): Annotation;
36
36
  /**
37
37
  * Remove an annotation from store
38
38
  * @param {EpubCFI} cfiRange EpubCFI range the annotation is attached to
@@ -57,7 +57,7 @@ declare class Annotations {
57
57
  * @param {string} className CSS class to assign to annotation
58
58
  * @param {object} styles CSS styles to assign to annotation
59
59
  */
60
- highlight(cfiRange: string, data?: Record<string, any>, cb?: Function, className?: string, styles?: Record<string, string>): Annotation;
60
+ highlight(cfiRange: string, data?: Record<string, any>, cb?: EventListener, className?: string, styles?: Record<string, string>): Annotation;
61
61
  /**
62
62
  * Add a underline to the store
63
63
  * @param {EpubCFI} cfiRange EpubCFI range to attach annotation to
@@ -66,14 +66,14 @@ declare class Annotations {
66
66
  * @param {string} className CSS class to assign to annotation
67
67
  * @param {object} styles CSS styles to assign to annotation
68
68
  */
69
- underline(cfiRange: string, data?: Record<string, any>, cb?: Function, className?: string, styles?: Record<string, string>): Annotation;
69
+ underline(cfiRange: string, data?: Record<string, any>, cb?: EventListener, className?: string, styles?: Record<string, string>): Annotation;
70
70
  /**
71
71
  * Add a mark to the store
72
72
  * @param {EpubCFI} cfiRange EpubCFI range to attach annotation to
73
73
  * @param {object} data Data to assign to annotation
74
74
  * @param {function} cb Callback after annotation is clicked
75
75
  */
76
- mark(cfiRange: string, data?: Record<string, any>, cb?: Function): Annotation;
76
+ mark(cfiRange: string, data?: Record<string, any>, cb?: EventListener): Annotation;
77
77
  /**
78
78
  * iterate over annotations in the store
79
79
  */
@@ -119,8 +119,8 @@ declare class Annotation implements IEventEmitter {
119
119
  cfiRange: string;
120
120
  data: Record<string, any>;
121
121
  sectionIndex: number;
122
- mark: object | undefined;
123
- cb: Function;
122
+ mark: object | null | undefined;
123
+ cb: EventListener;
124
124
  className: string;
125
125
  styles: Record<string, string>;
126
126
  on: IEventEmitter["on"];
@@ -131,7 +131,7 @@ declare class Annotation implements IEventEmitter {
131
131
  cfiRange: string;
132
132
  data?: Record<string, any>;
133
133
  sectionIndex?: number;
134
- cb?: Function;
134
+ cb?: EventListener;
135
135
  className?: string;
136
136
  styles?: Record<string, string>;
137
137
  });
@@ -144,12 +144,12 @@ declare class Annotation implements IEventEmitter {
144
144
  * Add to a view
145
145
  * @param {View} view
146
146
  */
147
- attach(view: AnnotationView): object | undefined;
147
+ attach(view: AnnotationView): object | null | undefined;
148
148
  /**
149
149
  * Remove from a view
150
150
  * @param {View} view
151
151
  */
152
- detach(view: AnnotationView): object | undefined;
152
+ detach(view: AnnotationView): void;
153
153
  /**
154
154
  * [Not Implemented] Get text of an annotation
155
155
  * @TODO: needs implementation in contents
package/dist/book.d.ts CHANGED
@@ -56,15 +56,15 @@ interface BookLoadedState {
56
56
  declare class Book implements IEventEmitter {
57
57
  settings: BookOptions;
58
58
  opening: defer<Book>;
59
- opened: Promise<Book> | undefined;
59
+ opened: Promise<Book>;
60
60
  isOpen: boolean;
61
- loading: BookLoadingState | undefined;
62
- loaded: BookLoadedState | undefined;
63
- ready: Promise<[PackagingManifestObject, Spine, PackagingMetadataObject, string, Navigation, Resources, DisplayOptions]> | undefined;
61
+ loading: BookLoadingState;
62
+ loaded: BookLoadedState;
63
+ ready: Promise<[PackagingManifestObject, Spine, PackagingMetadataObject, string, Navigation, Resources, DisplayOptions]>;
64
64
  isRendered: boolean;
65
65
  request: RequestFunction;
66
- spine: Spine | undefined;
67
- locations: Locations | undefined;
66
+ spine: Spine;
67
+ locations: Locations;
68
68
  navigation: Navigation | undefined;
69
69
  pageList: PageList | undefined;
70
70
  url: Url | undefined;