@treinetic/treinetic-epub-reader 2.0.0 → 2.0.2

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.
@@ -0,0 +1,40 @@
1
+ export declare class ExternalControls {
2
+ private static instance;
3
+ metadata: any;
4
+ reader: any;
5
+ channel: any;
6
+ auto_bookmark: boolean;
7
+ TocJsonObject: any;
8
+ currentPackageDocument: any;
9
+ readerSettings: any;
10
+ callbackFunctions: {
11
+ [key: string]: Function;
12
+ };
13
+ private constructor();
14
+ static getInstance(): ExternalControls;
15
+ static createInstance(): void;
16
+ epubLoaded(metadata: any, currentPackageDocument: any, reader: any): void;
17
+ registerEvent(eventName: string, func: Function): void;
18
+ epubFailed(error: any): void;
19
+ registerChannel(func: Function): void;
20
+ onTOCLoad(tocJson: any): void;
21
+ getReaderHeight(): number | null;
22
+ nextPage(): void;
23
+ prevPage(): void;
24
+ hasNextPage(): boolean;
25
+ hasPrevPage(): boolean;
26
+ makeBookMark(): void;
27
+ setAutoBookmark(val: boolean): void;
28
+ isAutoBookmark(): boolean;
29
+ getTOCJson(): string;
30
+ hasTOC(): boolean;
31
+ goToPage(href: string): void;
32
+ changeFontSize(size: number): void;
33
+ getRecommendedFontSizeRange(): {
34
+ min: number;
35
+ max: number;
36
+ };
37
+ setTheme(theme_id: string): void;
38
+ setScrollOption(type: 'auto' | 'scroll-continuous'): void;
39
+ private cloneUpdate;
40
+ }
@@ -0,0 +1,14 @@
1
+ export declare const Keyboard: {
2
+ scope: string;
3
+ handlers: {
4
+ [key: string]: Function[];
5
+ };
6
+ init: () => void;
7
+ on: (keyName: string, scope: string, callback: Function) => void;
8
+ handleKey: (e: KeyboardEvent) => void;
9
+ dispatch: (action: string) => void;
10
+ PagePrevious: string;
11
+ PageNext: string;
12
+ NightTheme: string;
13
+ applySettings: (_json: any) => void;
14
+ };
@@ -0,0 +1,14 @@
1
+ export declare const ModuleConfig: {
2
+ imagePathPrefix: string;
3
+ epubLibraryPath: string;
4
+ canHandleUrl: boolean;
5
+ canHandleDirectory: boolean;
6
+ epubReadingSystemUrl: string;
7
+ workerUrl: string;
8
+ annotationCSSUrl: string;
9
+ mathJaxUrl: string;
10
+ jsLibRoot: string;
11
+ fonts: never[];
12
+ useSimpleLoader: boolean;
13
+ loader: null;
14
+ };
@@ -0,0 +1,6 @@
1
+ export declare const Settings: {
2
+ put: (key: string, val: any, callback?: () => void) => void;
3
+ clear: (key: string, callback?: () => void) => void;
4
+ get: (key: string, callback?: (val: any) => void) => any;
5
+ getMultiple: (keys: string[], callback?: (val: any) => void) => any;
6
+ };
@@ -0,0 +1,11 @@
1
+ export declare const TOCJsonCreator: {
2
+ createTOCJson: (tocDom: HTMLElement) => any[];
3
+ getRootOL: (dom: HTMLElement) => HTMLElement;
4
+ findRecursively: (ol: HTMLElement) => any[];
5
+ createTOCItem: (a: HTMLAnchorElement) => {
6
+ Id_link: string | null;
7
+ name: string;
8
+ sub: any[];
9
+ };
10
+ getFixedTocElement: (dom: Document | HTMLElement) => HTMLElement;
11
+ };
@@ -0,0 +1,20 @@
1
+ export interface ReaderTheme {
2
+ name: string;
3
+ properties: {
4
+ "background-color": string;
5
+ "color": string;
6
+ "font-family"?: string;
7
+ [key: string]: string | undefined;
8
+ };
9
+ css?: string;
10
+ }
11
+ export declare class ThemeManager {
12
+ private static instance;
13
+ private themes;
14
+ private constructor();
15
+ static getInstance(): ThemeManager;
16
+ registerTheme(theme: ReaderTheme): void;
17
+ getTheme(name: string): ReaderTheme | undefined;
18
+ private resolveThemeAlias;
19
+ private registerDefaultThemes;
20
+ }
@@ -0,0 +1,38 @@
1
+ import { ExternalControls } from './ExternalControls';
2
+ import { ReaderView } from './view/ReaderView';
3
+ import { ReaderTheme } from './ThemeManager';
4
+ declare global {
5
+ interface Window {
6
+ READIUM: any;
7
+ }
8
+ }
9
+ declare const TreineticEpubReader: {
10
+ readium: any;
11
+ readerView: ReaderView | null;
12
+ currentPackageDocument: any;
13
+ ebookURL_filepath: string | null;
14
+ embeded: boolean;
15
+ init: (selectorOrElement: string | HTMLElement) => ExternalControls | null;
16
+ /**
17
+ * Alias for init() to align with standard library patterns.
18
+ */
19
+ create: (selectorOrElement: string | HTMLElement) => ExternalControls | null;
20
+ open: (epubUrlOrFolder: string) => void;
21
+ initReader: (element: HTMLElement) => void;
22
+ handleReaderEvents: () => void;
23
+ loadEpub: (_readerSettings: any, ebookURL: string, _openPageRequest: any) => Promise<void>;
24
+ setReaderPreferences: () => {
25
+ reader: any;
26
+ };
27
+ getOpenPageRequest: (_settings: any, _ebookURL: string) => null;
28
+ savePlace: () => void;
29
+ nextPage: () => void;
30
+ prevPage: () => void;
31
+ goToPage: (href: string) => void;
32
+ setTheme: (theme: string) => void;
33
+ registerTheme: (theme: ReaderTheme) => void;
34
+ setFontSize: (size: number) => void;
35
+ setScrollOption: (type: "auto" | "scroll-continuous") => void;
36
+ clearSettings: () => void;
37
+ };
38
+ export default TreineticEpubReader;
@@ -0,0 +1,19 @@
1
+ export declare const TreineticHelpers: {
2
+ updateReader: (reader: any, readerSettings: any) => void;
3
+ getBookStyles: (theme: string) => ({
4
+ selector: string;
5
+ declarations: {
6
+ backgroundColor: string | null | undefined;
7
+ color: string | null | undefined;
8
+ fontFamily: string;
9
+ };
10
+ } | {
11
+ selector: string;
12
+ declarations: {
13
+ backgroundColor: string | null | undefined;
14
+ color: string | null | undefined;
15
+ fontFamily?: undefined;
16
+ };
17
+ })[];
18
+ getPropertyFromThemeClass: (classOrId: string, property: string) => string | null | undefined;
19
+ };
@@ -0,0 +1,13 @@
1
+ export declare class Metadata {
2
+ identifier?: string;
3
+ title?: string;
4
+ author?: string;
5
+ description?: string;
6
+ publisher?: string;
7
+ language?: string;
8
+ rights?: string;
9
+ modifiedDate?: string;
10
+ publishedDate?: string;
11
+ epubVersion?: string;
12
+ constructor(packageMetadata?: any);
13
+ }
@@ -0,0 +1,21 @@
1
+ import { default as JSZip } from 'jszip';
2
+ import { Spine } from './Spine';
3
+ import { Metadata } from './Metadata';
4
+ export declare class Package {
5
+ rootUrl: string;
6
+ rootUrlMO?: string;
7
+ spine: Spine;
8
+ metadata: Metadata;
9
+ zip: JSZip | null;
10
+ rendition_viewport?: string;
11
+ rendition_layout?: string;
12
+ rendition_flow?: string;
13
+ rendition_orientation?: string;
14
+ rendition_spread?: string;
15
+ toc?: any;
16
+ constructor(packageData: any);
17
+ resolveRelativeUrl(relativeUrl: string): string;
18
+ isFixedLayout(): boolean;
19
+ loadFile(relativePath: string): Promise<string | null>;
20
+ loadBlob(relativePath: string): Promise<Blob | null>;
21
+ }
@@ -0,0 +1,19 @@
1
+ import { Package } from './Package';
2
+ import { SpineItem } from './SpineItem';
3
+ export declare class Spine {
4
+ package: Package;
5
+ items: SpineItem[];
6
+ direction: string;
7
+ private handleLinear;
8
+ constructor(epubPackage: Package, spineDTO?: any);
9
+ isValidLinearItem(index: number): boolean;
10
+ item(index: number): SpineItem | undefined;
11
+ getItemByHref(href: string): SpineItem | undefined;
12
+ first(): SpineItem | undefined;
13
+ firstLinear(): SpineItem | undefined;
14
+ nextItem(item: SpineItem): SpineItem | undefined;
15
+ prevItem(item: SpineItem): SpineItem | undefined;
16
+ nextLinear(item: SpineItem): SpineItem | undefined;
17
+ prevLinear(item: SpineItem): SpineItem | undefined;
18
+ last(): SpineItem | undefined;
19
+ }
@@ -0,0 +1,34 @@
1
+ import { Spine } from './Spine';
2
+ export declare class SpineItem {
3
+ idref: string;
4
+ href: string;
5
+ cfi: string;
6
+ linear: string;
7
+ page_spread: string;
8
+ rendition_viewport?: string;
9
+ rendition_spread?: string;
10
+ rendition_orientation?: string;
11
+ rendition_layout?: string;
12
+ rendition_flow?: string;
13
+ media_overlay_id?: string;
14
+ media_type?: string;
15
+ index: number;
16
+ spine: Spine;
17
+ static readonlyRENDITION_LAYOUT_REFLOWABLE: string;
18
+ static readonly RENDITION_LAYOUT_PREPAGINATED = "pre-paginated";
19
+ static readonly SPREAD_LEFT = "page-spread-left";
20
+ static readonly SPREAD_RIGHT = "page-spread-right";
21
+ static readonly SPREAD_CENTER = "page-spread-center";
22
+ static readonly SPREAD_NONE = "none";
23
+ static readonly SPREAD_AUTO = "auto";
24
+ static readonly FLOW_PAGINATED = "paginated";
25
+ static readonly FLOW_SCROLLED_CONTINUOUS = "scrolled-continuous";
26
+ static readonly FLOW_SCROLLED_DOC = "scrolled-doc";
27
+ static readonly FLOW_AUTO = "auto";
28
+ constructor(itemData: any, index: number, spine: Spine);
29
+ private validateSpread;
30
+ isReflowable(): boolean;
31
+ isFixedLayout(): boolean;
32
+ getRenditionLayout(): string | undefined;
33
+ static alternateSpread(spread: string): string;
34
+ }
@@ -0,0 +1,6 @@
1
+ import { Package } from '../model/Package';
2
+ export declare class EpubParser {
3
+ static load(rootUrl: string): Promise<Package>;
4
+ private static parseOpf;
5
+ private static parseNcx;
6
+ }