@d-i-t-a/reader 3.0.0-alpha.6 → 3.0.0-alpha.8
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/esm/index.js +313 -121
- package/dist/esm/index.js.map +4 -4
- package/dist/reader.js +59 -59
- package/dist/reader.js.map +4 -4
- package/dist/types/index.d.ts +2 -0
- package/dist/types/model/Link.d.ts +7 -5
- package/dist/types/model/v3/Publication.d.ts +6 -0
- package/dist/types/modules/highlight/TextHighlighter.d.ts +2 -1
- package/dist/types/modules/mediaoverlays/MediaOverlayModule.d.ts +1 -0
- package/dist/types/utils/Events.d.ts +108 -0
- package/package.json +1 -1
package/dist/types/index.d.ts
CHANGED
|
@@ -5,6 +5,8 @@ export default D2Reader;
|
|
|
5
5
|
export declare const load: typeof D2Reader.load;
|
|
6
6
|
export { Link } from "./model/Link";
|
|
7
7
|
export { Locator, Locations, LocatorText, ReadingPosition, Bookmark, Annotation, AnnotationMarker, } from "./model/Locator";
|
|
8
|
+
export { ReaderEvent } from "./utils/Events";
|
|
9
|
+
export type { ReaderEventName, ReaderEventMap } from "./utils/Events";
|
|
8
10
|
export type { ReaderConfig, ReaderRights, NavigatorAPI, IFrameAttributes, Injectable, RequestConfig, SampleRead, PublicationServices, InitialAnnotations, } from "./navigator/IFrameNavigator";
|
|
9
11
|
export type { IUserSettings, InitialUserSettings, } from "./model/user-settings/UserSettings";
|
|
10
12
|
export type { UserSettingsIncrementable } from "./model/user-settings/UserProperties";
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
export { Link, D2Link, Links } from "./v3/Link";
|
|
1
2
|
/**
|
|
2
|
-
* @
|
|
3
|
+
* Converts @readium/shared objects to plain JSON-safe objects.
|
|
4
|
+
* Unwraps Links wrappers (.items), converts Sets to Arrays,
|
|
5
|
+
* and recursively processes nested objects.
|
|
3
6
|
*/
|
|
4
|
-
export
|
|
7
|
+
export declare function toPlainObject(o: any): any;
|
|
5
8
|
/**
|
|
6
|
-
* @deprecated
|
|
7
|
-
* Kept for backwards compatibility with code that calls convertAndCamel().
|
|
9
|
+
* @deprecated Use toPlainObject() instead.
|
|
8
10
|
*/
|
|
9
|
-
export declare
|
|
11
|
+
export declare const convertAndCamel: typeof toPlainObject;
|
|
@@ -19,6 +19,12 @@ export declare class Publication {
|
|
|
19
19
|
private _toc?;
|
|
20
20
|
private _links?;
|
|
21
21
|
constructor(manifest: Manifest, manifestUrl: URL);
|
|
22
|
+
/**
|
|
23
|
+
* Create a Publication from a raw JSON object.
|
|
24
|
+
* Handles both RWPM (camelCase) and legacy (PascalCase) key formats.
|
|
25
|
+
* Returns null if the JSON cannot be parsed.
|
|
26
|
+
*/
|
|
27
|
+
static fromJSON(json: any, url: URL): Publication | null;
|
|
22
28
|
static fromUrl(url: URL, requestConfig?: RequestConfig): Promise<Publication>;
|
|
23
29
|
get metadata(): import("@readium/shared").Metadata;
|
|
24
30
|
get readingOrder(): Link[];
|
|
@@ -167,7 +167,8 @@ export declare class TextHighlighter {
|
|
|
167
167
|
isSelectionMenuOpen: boolean;
|
|
168
168
|
selectionMenuOpened: debounce.DebouncedFunction<() => void>;
|
|
169
169
|
selectionMenuClosed: debounce.DebouncedFunction<() => void>;
|
|
170
|
-
|
|
170
|
+
/** @deprecated Selection callback now fires from selectionMenuOpened */
|
|
171
|
+
selection: debounce.DebouncedFunction<(_text: string, _selection: any) => void>;
|
|
171
172
|
toolboxPlacement(): void;
|
|
172
173
|
toolboxHandler(): void;
|
|
173
174
|
/**
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { Locator, ReadingPosition, Bookmark, Annotation } from "../model/Locator";
|
|
2
|
+
/**
|
|
3
|
+
* Typed event names for the R2D2BC reader.
|
|
4
|
+
*
|
|
5
|
+
* Both navigators and modules emit these events through the EventEmitter.
|
|
6
|
+
* Integrators can listen via:
|
|
7
|
+
* reader.addEventListener("resource.ready", handler)
|
|
8
|
+
* reader.addEventListener(ReaderEvent.ResourceReady, handler)
|
|
9
|
+
*
|
|
10
|
+
* All existing string event names are preserved for backwards compatibility.
|
|
11
|
+
*/
|
|
12
|
+
export declare const ReaderEvent: {
|
|
13
|
+
readonly ResourceReady: "resource.ready";
|
|
14
|
+
readonly ResourceStart: "resource.start";
|
|
15
|
+
readonly ResourceEnd: "resource.end";
|
|
16
|
+
readonly ResourceFits: "resource.fits";
|
|
17
|
+
readonly ResourceError: "resource.error";
|
|
18
|
+
readonly Direction: "direction";
|
|
19
|
+
readonly ChapterInfo: "chapterinfo";
|
|
20
|
+
readonly PositionInfo: "positioninfo";
|
|
21
|
+
readonly LocationChanged: "location.changed";
|
|
22
|
+
readonly Click: "click";
|
|
23
|
+
readonly KeyDown: "keydown";
|
|
24
|
+
readonly Error: "error";
|
|
25
|
+
readonly ReadAloudStarted: "readaloud.started";
|
|
26
|
+
readonly ReadAloudStopped: "readaloud.stopped";
|
|
27
|
+
readonly ReadAloudPaused: "readaloud.paused";
|
|
28
|
+
readonly ReadAloudResumed: "readaloud.resumed";
|
|
29
|
+
readonly ReadAloudFinished: "readaloud.finished";
|
|
30
|
+
readonly ReadAlongStarted: "readalong.started";
|
|
31
|
+
readonly ReadAlongStopped: "readalong.stopped";
|
|
32
|
+
readonly ReadAlongPaused: "readalong.paused";
|
|
33
|
+
readonly ReadAlongResumed: "readalong.resumed";
|
|
34
|
+
readonly ReadAlongFinished: "readalong.finished";
|
|
35
|
+
readonly BookmarkCreated: "bookmark.created";
|
|
36
|
+
readonly BookmarkDeleted: "bookmark.deleted";
|
|
37
|
+
readonly AnnotationCreated: "annotation.created";
|
|
38
|
+
readonly AnnotationDeleted: "annotation.deleted";
|
|
39
|
+
readonly AnnotationUpdated: "annotation.updated";
|
|
40
|
+
readonly AnnotationSelected: "annotation.selected";
|
|
41
|
+
readonly AnnotationCommentAdded: "annotation.comment.added";
|
|
42
|
+
readonly ToolboxOpened: "toolbox.opened";
|
|
43
|
+
readonly ToolboxClosed: "toolbox.closed";
|
|
44
|
+
readonly TextSelected: "text.selected";
|
|
45
|
+
readonly DefinitionSuccess: "definition.success";
|
|
46
|
+
readonly DefinitionClick: "definition.click";
|
|
47
|
+
readonly DefinitionVisible: "definition.visible";
|
|
48
|
+
readonly CitationCreated: "citation.created";
|
|
49
|
+
readonly CitationFailed: "citation.failed";
|
|
50
|
+
readonly InspectDetected: "inspect.detected";
|
|
51
|
+
readonly ActionTracked: "consumption.action";
|
|
52
|
+
readonly IdleSince: "consumption.idle";
|
|
53
|
+
};
|
|
54
|
+
export type ReaderEventName = (typeof ReaderEvent)[keyof typeof ReaderEvent];
|
|
55
|
+
export interface ReaderEventMap {
|
|
56
|
+
[ReaderEvent.ResourceReady]: void;
|
|
57
|
+
[ReaderEvent.ResourceStart]: void;
|
|
58
|
+
[ReaderEvent.ResourceEnd]: void;
|
|
59
|
+
[ReaderEvent.ResourceFits]: void;
|
|
60
|
+
[ReaderEvent.ResourceError]: Error;
|
|
61
|
+
[ReaderEvent.Direction]: string;
|
|
62
|
+
[ReaderEvent.ChapterInfo]: string | undefined;
|
|
63
|
+
[ReaderEvent.PositionInfo]: Locator;
|
|
64
|
+
[ReaderEvent.LocationChanged]: ReadingPosition;
|
|
65
|
+
[ReaderEvent.Click]: MouseEvent | TouchEvent;
|
|
66
|
+
[ReaderEvent.KeyDown]: KeyboardEvent;
|
|
67
|
+
[ReaderEvent.Error]: Error;
|
|
68
|
+
[ReaderEvent.ReadAloudStarted]: string;
|
|
69
|
+
[ReaderEvent.ReadAloudStopped]: string;
|
|
70
|
+
[ReaderEvent.ReadAloudPaused]: string;
|
|
71
|
+
[ReaderEvent.ReadAloudResumed]: string;
|
|
72
|
+
[ReaderEvent.ReadAloudFinished]: string;
|
|
73
|
+
[ReaderEvent.ReadAlongStarted]: string;
|
|
74
|
+
[ReaderEvent.ReadAlongStopped]: string;
|
|
75
|
+
[ReaderEvent.ReadAlongPaused]: string;
|
|
76
|
+
[ReaderEvent.ReadAlongResumed]: string;
|
|
77
|
+
[ReaderEvent.ReadAlongFinished]: string;
|
|
78
|
+
[ReaderEvent.BookmarkCreated]: Bookmark;
|
|
79
|
+
[ReaderEvent.BookmarkDeleted]: Bookmark;
|
|
80
|
+
[ReaderEvent.AnnotationCreated]: Annotation;
|
|
81
|
+
[ReaderEvent.AnnotationDeleted]: Annotation;
|
|
82
|
+
[ReaderEvent.AnnotationUpdated]: Annotation;
|
|
83
|
+
[ReaderEvent.AnnotationSelected]: Annotation;
|
|
84
|
+
[ReaderEvent.AnnotationCommentAdded]: Annotation;
|
|
85
|
+
[ReaderEvent.ToolboxOpened]: string;
|
|
86
|
+
[ReaderEvent.ToolboxClosed]: string;
|
|
87
|
+
[ReaderEvent.TextSelected]: {
|
|
88
|
+
text: string;
|
|
89
|
+
selection: any;
|
|
90
|
+
};
|
|
91
|
+
[ReaderEvent.DefinitionSuccess]: any;
|
|
92
|
+
[ReaderEvent.DefinitionClick]: {
|
|
93
|
+
result: any;
|
|
94
|
+
highlight: any;
|
|
95
|
+
};
|
|
96
|
+
[ReaderEvent.DefinitionVisible]: {
|
|
97
|
+
item: any;
|
|
98
|
+
highlight: any;
|
|
99
|
+
};
|
|
100
|
+
[ReaderEvent.CitationCreated]: string;
|
|
101
|
+
[ReaderEvent.CitationFailed]: string;
|
|
102
|
+
[ReaderEvent.InspectDetected]: void;
|
|
103
|
+
[ReaderEvent.ActionTracked]: {
|
|
104
|
+
locator: Locator;
|
|
105
|
+
action: any;
|
|
106
|
+
};
|
|
107
|
+
[ReaderEvent.IdleSince]: number;
|
|
108
|
+
}
|