@vivliostyle/core 2.24.3 → 2.25.1
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/lib/vivliostyle/adaptive-viewer.d.ts +167 -167
- package/lib/vivliostyle/asserts.d.ts +21 -21
- package/lib/vivliostyle/assets.d.ts +35 -35
- package/lib/vivliostyle/base.d.ts +189 -189
- package/lib/vivliostyle/break-position.d.ts +39 -39
- package/lib/vivliostyle/break.d.ts +112 -112
- package/lib/vivliostyle/cfi.d.ts +77 -77
- package/lib/vivliostyle/columns.d.ts +52 -52
- package/lib/vivliostyle/constants.d.ts +53 -53
- package/lib/vivliostyle/core-viewer.d.ts +240 -240
- package/lib/vivliostyle/counters.d.ts +130 -127
- package/lib/vivliostyle/css-cascade.d.ts +974 -954
- package/lib/vivliostyle/css-logical-util.d.ts +3 -3
- package/lib/vivliostyle/css-page.d.ts +451 -451
- package/lib/vivliostyle/css-parser.d.ts +320 -320
- package/lib/vivliostyle/css-prop.d.ts +74 -74
- package/lib/vivliostyle/css-styler.d.ts +210 -210
- package/lib/vivliostyle/css-tokenizer.d.ts +243 -243
- package/lib/vivliostyle/css-validator.d.ts +319 -319
- package/lib/vivliostyle/css.d.ts +205 -205
- package/lib/vivliostyle/diff.d.ts +26 -26
- package/lib/vivliostyle/display.d.ts +62 -57
- package/lib/vivliostyle/epub.d.ts +329 -329
- package/lib/vivliostyle/exprs.d.ts +395 -395
- package/lib/vivliostyle/font.d.ts +87 -87
- package/lib/vivliostyle/footnotes.d.ts +41 -41
- package/lib/vivliostyle/geometry-util.d.ts +110 -110
- package/lib/vivliostyle/layout-helper.d.ts +16 -15
- package/lib/vivliostyle/layout-processor.d.ts +73 -73
- package/lib/vivliostyle/layout-retryers.d.ts +21 -21
- package/lib/vivliostyle/layout-util.d.ts +55 -55
- package/lib/vivliostyle/layout.d.ts +456 -456
- package/lib/vivliostyle/logging.d.ts +56 -56
- package/lib/vivliostyle/matchers.d.ts +36 -36
- package/lib/vivliostyle/math-util.d.ts +22 -22
- package/lib/vivliostyle/net.d.ts +72 -72
- package/lib/vivliostyle/ops.d.ts +263 -263
- package/lib/vivliostyle/page-floats.d.ts +178 -178
- package/lib/vivliostyle/page-master.d.ts +247 -247
- package/lib/vivliostyle/plugin.d.ts +172 -172
- package/lib/vivliostyle/print.d.ts +7 -7
- package/lib/vivliostyle/profile.d.ts +59 -59
- package/lib/vivliostyle/pseudo-element.d.ts +32 -32
- package/lib/vivliostyle/repetitive-element.d.ts +162 -162
- package/lib/vivliostyle/scripts.d.ts +15 -15
- package/lib/vivliostyle/sha1.d.ts +33 -33
- package/lib/vivliostyle/shared.d.ts +24 -24
- package/lib/vivliostyle/sizing.d.ts +29 -29
- package/lib/vivliostyle/table.d.ts +263 -263
- package/lib/vivliostyle/task-util.d.ts +37 -37
- package/lib/vivliostyle/task.d.ts +357 -357
- package/lib/vivliostyle/text-polyfill.d.ts +3 -3
- package/lib/vivliostyle/toc.d.ts +64 -64
- package/lib/vivliostyle/types.d.ts +977 -977
- package/lib/vivliostyle/urls.d.ts +25 -25
- package/lib/vivliostyle/vgen.d.ts +213 -213
- package/lib/vivliostyle/viewer-app.d.ts +19 -19
- package/lib/vivliostyle/vtree.d.ts +392 -392
- package/lib/vivliostyle/xml-doc.d.ts +88 -88
- package/lib/vivliostyle.d.ts +6 -6
- package/lib/vivliostyle.js +1 -1
- package/lib/vivliostyle.js.map +1 -1
- package/package.json +5 -5
|
@@ -1,329 +1,329 @@
|
|
|
1
|
-
import * as Base from "./base";
|
|
2
|
-
import * as Constants from "./constants";
|
|
3
|
-
import * as Counters from "./counters";
|
|
4
|
-
import * as Css from "./css";
|
|
5
|
-
import * as Exprs from "./exprs";
|
|
6
|
-
import * as Font from "./font";
|
|
7
|
-
import * as Net from "./net";
|
|
8
|
-
import * as OPS from "./ops";
|
|
9
|
-
import * as Task from "./task";
|
|
10
|
-
import * as Toc from "./toc";
|
|
11
|
-
import * as Vgen from "./vgen";
|
|
12
|
-
import * as Vtree from "./vtree";
|
|
13
|
-
import * as XmlDoc from "./xml-doc";
|
|
14
|
-
export type Position = {
|
|
15
|
-
spineIndex: number;
|
|
16
|
-
pageIndex: number;
|
|
17
|
-
offsetInItem: number;
|
|
18
|
-
};
|
|
19
|
-
export declare class EPUBDocStore extends OPS.OPSDocStore {
|
|
20
|
-
plainXMLStore: XmlDoc.XMLDocStore;
|
|
21
|
-
jsonStore: Net.JSONStore;
|
|
22
|
-
opfByURL: {
|
|
23
|
-
[key: string]: OPFDoc;
|
|
24
|
-
};
|
|
25
|
-
primaryOPFByEPubURL: {
|
|
26
|
-
[key: string]: OPFDoc;
|
|
27
|
-
};
|
|
28
|
-
deobfuscators: {
|
|
29
|
-
[key: string]: (p1: Blob) => Task.Result<Blob>;
|
|
30
|
-
};
|
|
31
|
-
documents: {
|
|
32
|
-
[key: string]: Task.Result<XmlDoc.XMLDocHolder>;
|
|
33
|
-
};
|
|
34
|
-
constructor();
|
|
35
|
-
makeDeobfuscatorFactory(): ((p1: string) => ((p1: Blob) => Task.Result<Blob>) | null) | null;
|
|
36
|
-
loadAsPlainXML(url: string, opt_required?: boolean, opt_message?: string): Task.Result<XmlDoc.XMLDocHolder>;
|
|
37
|
-
startLoadingAsPlainXML(url: string): void;
|
|
38
|
-
loadAsJSON(url: string, opt_required?: boolean, opt_message?: string): Task.Result<Base.JSON>;
|
|
39
|
-
startLoadingAsJSON(url: string): void;
|
|
40
|
-
loadPubDoc(url: string, haveZipMetadata: boolean): Task.Result<OPFDoc>;
|
|
41
|
-
loadEPUBDoc(url: string, haveZipMetadata: boolean): Task.Result<OPFDoc>;
|
|
42
|
-
loadOPF(pubURL: string, root: string, haveZipMetadata: boolean): Task.Result<OPFDoc>;
|
|
43
|
-
loadWebPub(url: string): Task.Result<OPFDoc>;
|
|
44
|
-
addDocument(url: string, doc: Document): Task.Result<XmlDoc.XMLDocHolder>;
|
|
45
|
-
reportLoadError(docURL: string): void;
|
|
46
|
-
load(url: string): Task.Result<XmlDoc.XMLDocHolder>;
|
|
47
|
-
processViewportMeta(meta: Element): string;
|
|
48
|
-
}
|
|
49
|
-
export type OPFItemParam = {
|
|
50
|
-
url: string;
|
|
51
|
-
index: number;
|
|
52
|
-
startPage: number | null;
|
|
53
|
-
skipPagesBefore: number | null;
|
|
54
|
-
};
|
|
55
|
-
export declare class OPFItem {
|
|
56
|
-
id: string | null;
|
|
57
|
-
src: string;
|
|
58
|
-
mediaType: string | null;
|
|
59
|
-
title: string | null;
|
|
60
|
-
itemRefElement: Element | null;
|
|
61
|
-
spineIndex: number;
|
|
62
|
-
compressedSize: number;
|
|
63
|
-
compressed: boolean | null;
|
|
64
|
-
epage: number;
|
|
65
|
-
epageCount: number;
|
|
66
|
-
startPage: number | null;
|
|
67
|
-
skipPagesBefore: number | null;
|
|
68
|
-
itemProperties: {
|
|
69
|
-
[key: string]: boolean;
|
|
70
|
-
};
|
|
71
|
-
constructor();
|
|
72
|
-
initWithElement(itemElem: Element, opfURL: string): void;
|
|
73
|
-
initWithParam(param: OPFItemParam): void;
|
|
74
|
-
}
|
|
75
|
-
export declare function getOPFItemId(item: OPFItem): string | null;
|
|
76
|
-
export declare function makeDeobfuscator(uid: string): (p1: Blob) => Task.Result<Blob>;
|
|
77
|
-
export declare function makeObfuscationKey(uid: string): string;
|
|
78
|
-
export interface Meta {
|
|
79
|
-
[key: string]: MetaItem[];
|
|
80
|
-
}
|
|
81
|
-
export interface MetaItem {
|
|
82
|
-
v: string;
|
|
83
|
-
o?: number;
|
|
84
|
-
s?: string;
|
|
85
|
-
r?: Meta;
|
|
86
|
-
}
|
|
87
|
-
export declare const predefinedPrefixes: {
|
|
88
|
-
dcterms: string;
|
|
89
|
-
marc: string;
|
|
90
|
-
media: string;
|
|
91
|
-
rendition: string;
|
|
92
|
-
onix: string;
|
|
93
|
-
xsd: string;
|
|
94
|
-
opf: string;
|
|
95
|
-
};
|
|
96
|
-
export declare const defaultIRI = "http://idpf.org/epub/vocab/package/meta/#";
|
|
97
|
-
export declare const metaTerms: {
|
|
98
|
-
language: string;
|
|
99
|
-
title: string;
|
|
100
|
-
creator: string;
|
|
101
|
-
layout: string;
|
|
102
|
-
titleType: string;
|
|
103
|
-
displaySeq: string;
|
|
104
|
-
alternateScript: string;
|
|
105
|
-
role: string;
|
|
106
|
-
};
|
|
107
|
-
export declare function getMetadataComparator(term: string, lang: string): (p1: MetaItem, p2: MetaItem) => number;
|
|
108
|
-
export declare function readMetadata(mroot: XmlDoc.NodeList, prefixes: string | null): Meta;
|
|
109
|
-
export declare function getMathJaxHub(): object;
|
|
110
|
-
export declare function checkMathJax(): void;
|
|
111
|
-
export declare const supportedMediaTypes: {
|
|
112
|
-
"application/xhtml+xml": boolean;
|
|
113
|
-
"image/jpeg": boolean;
|
|
114
|
-
"image/png": boolean;
|
|
115
|
-
"image/svg+xml": boolean;
|
|
116
|
-
"image/gif": boolean;
|
|
117
|
-
"audio/mp3": boolean;
|
|
118
|
-
};
|
|
119
|
-
export declare const transformedIdPrefix = "viv-id-";
|
|
120
|
-
export declare class OPFDoc {
|
|
121
|
-
readonly store: EPUBDocStore;
|
|
122
|
-
readonly pubURL: string;
|
|
123
|
-
opfXML: XmlDoc.XMLDocHolder;
|
|
124
|
-
encXML: XmlDoc.XMLDocHolder;
|
|
125
|
-
items: OPFItem[];
|
|
126
|
-
spine: OPFItem[];
|
|
127
|
-
itemMap: {
|
|
128
|
-
[key: string]: OPFItem;
|
|
129
|
-
};
|
|
130
|
-
itemMapByPath: {
|
|
131
|
-
[key: string]: OPFItem;
|
|
132
|
-
};
|
|
133
|
-
uid: string | null;
|
|
134
|
-
bindings: {
|
|
135
|
-
[key: string]: string;
|
|
136
|
-
};
|
|
137
|
-
lang: string | null;
|
|
138
|
-
epageCount: number;
|
|
139
|
-
prePaginated: boolean;
|
|
140
|
-
epageIsRenderedPage: boolean;
|
|
141
|
-
epageCountCallback: (p1: number) => void | null;
|
|
142
|
-
metadata: Meta;
|
|
143
|
-
ncxToc: OPFItem;
|
|
144
|
-
xhtmlToc: OPFItem;
|
|
145
|
-
cover: OPFItem;
|
|
146
|
-
fallbackMap: {
|
|
147
|
-
[key: string]: string;
|
|
148
|
-
};
|
|
149
|
-
pageProgression: Constants.PageProgression | null;
|
|
150
|
-
documentURLTransformer: Base.DocumentURLTransformer;
|
|
151
|
-
constructor(store: EPUBDocStore, pubURL: string);
|
|
152
|
-
createDocumentURLTransformer(): Base.DocumentURLTransformer;
|
|
153
|
-
/**
|
|
154
|
-
* Metadata is organized in the following way: fully-expanded property names
|
|
155
|
-
* (with IRI prefixes prepended) point to an array of values. Array contains
|
|
156
|
-
* at least one element. First element is primary and should be used by
|
|
157
|
-
* default. Element values are objects have the following keys:
|
|
158
|
-
* - "v" - item value as string,
|
|
159
|
-
* - "s" - scheme,
|
|
160
|
-
* - "o" - index in the order of appearing in the source,
|
|
161
|
-
* - "r" - refinement submetadata (organized just like the top-level
|
|
162
|
-
* metadata).
|
|
163
|
-
*/
|
|
164
|
-
getMetadata(): Meta;
|
|
165
|
-
getPathFromURL(url: string): string | null;
|
|
166
|
-
initWithXMLDoc(opfXML: XmlDoc.XMLDocHolder, encXML: XmlDoc.XMLDocHolder, zipMetadata: Base.JSON, manifestURL: string): Task.Result<any>;
|
|
167
|
-
assignAutoPages(): void;
|
|
168
|
-
setEPageCountMode(epageIsRenderedPage: boolean): void;
|
|
169
|
-
countEPages(epageCountCallback: ((p1: number) => void) | null): Task.Result<boolean>;
|
|
170
|
-
/**
|
|
171
|
-
* Creates a fake OPF "document" that contains OPS chapters.
|
|
172
|
-
*/
|
|
173
|
-
initWithChapters(params: OPFItemParam[], doc?: Document | null): Task.Result<any>;
|
|
174
|
-
initWithWebPubManifest(manifestObj: Base.JSON, doc?: Document, manifestUrl?: string): Task.Result<boolean>;
|
|
175
|
-
/**
|
|
176
|
-
* @return cfi
|
|
177
|
-
*/
|
|
178
|
-
getCFI(spineIndex: number, offsetInItem: number): Task.Result<string | null>;
|
|
179
|
-
resolveFragment(fragstr: string | null): Task.Result<Position | null>;
|
|
180
|
-
resolveEPage(epage: number): Task.Result<Position | null>;
|
|
181
|
-
getEPageFromPosition(position: Position): Task.Result<number>;
|
|
182
|
-
}
|
|
183
|
-
export type PageAndPosition = {
|
|
184
|
-
page: Vtree.Page;
|
|
185
|
-
position: Position;
|
|
186
|
-
};
|
|
187
|
-
export declare const makePageAndPosition: (page: Vtree.Page, pageIndex: number) => PageAndPosition;
|
|
188
|
-
export type OPFViewItem = {
|
|
189
|
-
item: OPFItem;
|
|
190
|
-
xmldoc: XmlDoc.XMLDocHolder;
|
|
191
|
-
instance: OPS.StyleInstance;
|
|
192
|
-
layoutPositions: Vtree.LayoutPosition[];
|
|
193
|
-
pages: Vtree.Page[];
|
|
194
|
-
complete: boolean;
|
|
195
|
-
};
|
|
196
|
-
export declare class OPFView implements Vgen.CustomRendererFactory {
|
|
197
|
-
readonly opf: OPFDoc;
|
|
198
|
-
readonly viewport: Vgen.Viewport;
|
|
199
|
-
readonly fontMapper: Font.Mapper;
|
|
200
|
-
readonly pageSheetSizeReporter: (p1: {
|
|
201
|
-
width: number;
|
|
202
|
-
height: number;
|
|
203
|
-
}, p2: {
|
|
204
|
-
[key: string]: {
|
|
205
|
-
width: number;
|
|
206
|
-
height: number;
|
|
207
|
-
};
|
|
208
|
-
}, p3: number, p4: number) => any;
|
|
209
|
-
spineItems: OPFViewItem[];
|
|
210
|
-
spineItemLoadingContinuations: Task.Continuation<any>[][];
|
|
211
|
-
pref: Exprs.Preferences;
|
|
212
|
-
clientLayout: Vgen.DefaultClientLayout;
|
|
213
|
-
counterStore: Counters.CounterStore;
|
|
214
|
-
tocAutohide: boolean;
|
|
215
|
-
tocView?: Toc.TOCView;
|
|
216
|
-
constructor(opf: OPFDoc, viewport: Vgen.Viewport, fontMapper: Font.Mapper, pref: Exprs.Preferences, pageSheetSizeReporter: (p1: {
|
|
217
|
-
width: number;
|
|
218
|
-
height: number;
|
|
219
|
-
}, p2: {
|
|
220
|
-
[key: string]: {
|
|
221
|
-
width: number;
|
|
222
|
-
height: number;
|
|
223
|
-
};
|
|
224
|
-
}, p3: number, p4: number) => any);
|
|
225
|
-
private getPage;
|
|
226
|
-
getCurrentPageProgression(position: Position): Constants.PageProgression | null;
|
|
227
|
-
private finishPageContainer;
|
|
228
|
-
/**
|
|
229
|
-
* Render a single page. If the new page contains elements with ids that are
|
|
230
|
-
* referenced from other pages by 'target-counter()', those pages are rendered
|
|
231
|
-
* too (calling `renderSinglePage` recursively).
|
|
232
|
-
*/
|
|
233
|
-
private renderSinglePage;
|
|
234
|
-
private normalizeSeekPosition;
|
|
235
|
-
/**
|
|
236
|
-
* Find a page corresponding to a specified position among already laid out
|
|
237
|
-
* pages.
|
|
238
|
-
* @param sync If true, find the page synchronously (not waiting another
|
|
239
|
-
* rendering task)
|
|
240
|
-
*/
|
|
241
|
-
findPage(position: Position, sync: boolean): Task.Result<PageAndPosition | null>;
|
|
242
|
-
/**
|
|
243
|
-
* Renders a page at the specified position.
|
|
244
|
-
*/
|
|
245
|
-
renderPage(position: Position): Task.Result<PageAndPosition | null>;
|
|
246
|
-
renderAllPages(): Task.Result<PageAndPosition | null>;
|
|
247
|
-
/**
|
|
248
|
-
* Render pages from (spineIndex=0, pageIndex=0) to the specified (spineIndex,
|
|
249
|
-
* pageIndex).
|
|
250
|
-
* @param notAllPages If true, render from biginning of specified spine item.
|
|
251
|
-
*/
|
|
252
|
-
renderPagesUpto(position: Position, notAllPages: boolean): Task.Result<PageAndPosition | null>;
|
|
253
|
-
/**
|
|
254
|
-
* Move to the first page and render it.
|
|
255
|
-
*/
|
|
256
|
-
firstPage(position: Position, sync: boolean): Task.Result<PageAndPosition | null>;
|
|
257
|
-
/**
|
|
258
|
-
* Move to the last page and render it.
|
|
259
|
-
*/
|
|
260
|
-
lastPage(position: Position, sync: boolean): Task.Result<PageAndPosition | null>;
|
|
261
|
-
/**
|
|
262
|
-
* Move to the next page position and render page.
|
|
263
|
-
* @param sync If true, get the page synchronously (not waiting another
|
|
264
|
-
* rendering task)
|
|
265
|
-
*/
|
|
266
|
-
nextPage(position: Position, sync: boolean): Task.Result<PageAndPosition | null>;
|
|
267
|
-
/**
|
|
268
|
-
* Move to the previous page and render it.
|
|
269
|
-
*/
|
|
270
|
-
previousPage(position: Position, sync: boolean): Task.Result<PageAndPosition | null>;
|
|
271
|
-
/**
|
|
272
|
-
* @param page This page should be a currently displayed page.
|
|
273
|
-
*/
|
|
274
|
-
private isRectoPage;
|
|
275
|
-
/**
|
|
276
|
-
* Get a spread containing the currently displayed page.
|
|
277
|
-
* @param sync If true, get the spread synchronously (not waiting another
|
|
278
|
-
* rendering task)
|
|
279
|
-
*/
|
|
280
|
-
getSpread(position: Position, sync: boolean): Task.Result<Vtree.Spread>;
|
|
281
|
-
/**
|
|
282
|
-
* Move to the next spread and render pages.
|
|
283
|
-
* @param sync If true, get the spread synchronously (not waiting another
|
|
284
|
-
* rendering task)
|
|
285
|
-
* @returns The 'verso' page of the next spread.
|
|
286
|
-
*/
|
|
287
|
-
nextSpread(position: Position, sync: boolean): Task.Result<PageAndPosition | null>;
|
|
288
|
-
/**
|
|
289
|
-
* Move to the previous spread and render pages.
|
|
290
|
-
* @returns The 'recto' page of the previous spread.
|
|
291
|
-
*/
|
|
292
|
-
previousSpread(position: Position, sync: boolean): Task.Result<PageAndPosition | null>;
|
|
293
|
-
/**
|
|
294
|
-
* Move to the epage specified by the given number (zero-based) and render it.
|
|
295
|
-
*/
|
|
296
|
-
navigateToEPage(epage: number, position: Position, sync: boolean): Task.Result<PageAndPosition | null>;
|
|
297
|
-
/**
|
|
298
|
-
* Move to the page specified by the given CFI and render it.
|
|
299
|
-
*/
|
|
300
|
-
navigateToFragment(fragment: string, position: Position, sync: boolean): Task.Result<PageAndPosition | null>;
|
|
301
|
-
/**
|
|
302
|
-
* Move to the page specified by the given URL and render it.
|
|
303
|
-
*/
|
|
304
|
-
navigateTo(href: string, position: Position, sync: boolean): Task.Result<PageAndPosition | null>;
|
|
305
|
-
makePage(viewItem: OPFViewItem, pos: Vtree.LayoutPosition): Vtree.Page;
|
|
306
|
-
makeObjectView(xmldoc: XmlDoc.XMLDocHolder, srcElem: Element, viewParent: Element, computedStyle: {
|
|
307
|
-
[key: string]: Css.Val;
|
|
308
|
-
}): Task.Result<Element>;
|
|
309
|
-
makeMathJaxView(xmldoc: XmlDoc.XMLDocHolder, srcElem: Element, viewParent: Element, computedStyle: {
|
|
310
|
-
[key: string]: Css.Val;
|
|
311
|
-
}): Task.Result<Element>;
|
|
312
|
-
private resolveURLsInMathML;
|
|
313
|
-
/** @override */
|
|
314
|
-
makeCustomRenderer(xmldoc: XmlDoc.XMLDocHolder): Vgen.CustomRenderer;
|
|
315
|
-
getPageViewItem(spineIndex: number): Task.Result<OPFViewItem>;
|
|
316
|
-
removeRenderedPages(): void;
|
|
317
|
-
/**
|
|
318
|
-
* Returns if at least one page has 'auto' size
|
|
319
|
-
*/
|
|
320
|
-
hasAutoSizedPages(): boolean;
|
|
321
|
-
hasPages(): boolean;
|
|
322
|
-
showTOC(autohide: boolean): Task.Result<Vtree.Page>;
|
|
323
|
-
hideTOC(): void;
|
|
324
|
-
isTOCVisible(): boolean;
|
|
325
|
-
}
|
|
326
|
-
export interface RenderSinglePageResult {
|
|
327
|
-
pageAndPosition: PageAndPosition;
|
|
328
|
-
nextLayoutPosition: Vtree.LayoutPosition;
|
|
329
|
-
}
|
|
1
|
+
import * as Base from "./base";
|
|
2
|
+
import * as Constants from "./constants";
|
|
3
|
+
import * as Counters from "./counters";
|
|
4
|
+
import * as Css from "./css";
|
|
5
|
+
import * as Exprs from "./exprs";
|
|
6
|
+
import * as Font from "./font";
|
|
7
|
+
import * as Net from "./net";
|
|
8
|
+
import * as OPS from "./ops";
|
|
9
|
+
import * as Task from "./task";
|
|
10
|
+
import * as Toc from "./toc";
|
|
11
|
+
import * as Vgen from "./vgen";
|
|
12
|
+
import * as Vtree from "./vtree";
|
|
13
|
+
import * as XmlDoc from "./xml-doc";
|
|
14
|
+
export type Position = {
|
|
15
|
+
spineIndex: number;
|
|
16
|
+
pageIndex: number;
|
|
17
|
+
offsetInItem: number;
|
|
18
|
+
};
|
|
19
|
+
export declare class EPUBDocStore extends OPS.OPSDocStore {
|
|
20
|
+
plainXMLStore: XmlDoc.XMLDocStore;
|
|
21
|
+
jsonStore: Net.JSONStore;
|
|
22
|
+
opfByURL: {
|
|
23
|
+
[key: string]: OPFDoc;
|
|
24
|
+
};
|
|
25
|
+
primaryOPFByEPubURL: {
|
|
26
|
+
[key: string]: OPFDoc;
|
|
27
|
+
};
|
|
28
|
+
deobfuscators: {
|
|
29
|
+
[key: string]: (p1: Blob) => Task.Result<Blob>;
|
|
30
|
+
};
|
|
31
|
+
documents: {
|
|
32
|
+
[key: string]: Task.Result<XmlDoc.XMLDocHolder>;
|
|
33
|
+
};
|
|
34
|
+
constructor();
|
|
35
|
+
makeDeobfuscatorFactory(): ((p1: string) => ((p1: Blob) => Task.Result<Blob>) | null) | null;
|
|
36
|
+
loadAsPlainXML(url: string, opt_required?: boolean, opt_message?: string): Task.Result<XmlDoc.XMLDocHolder>;
|
|
37
|
+
startLoadingAsPlainXML(url: string): void;
|
|
38
|
+
loadAsJSON(url: string, opt_required?: boolean, opt_message?: string): Task.Result<Base.JSON>;
|
|
39
|
+
startLoadingAsJSON(url: string): void;
|
|
40
|
+
loadPubDoc(url: string, haveZipMetadata: boolean): Task.Result<OPFDoc>;
|
|
41
|
+
loadEPUBDoc(url: string, haveZipMetadata: boolean): Task.Result<OPFDoc>;
|
|
42
|
+
loadOPF(pubURL: string, root: string, haveZipMetadata: boolean): Task.Result<OPFDoc>;
|
|
43
|
+
loadWebPub(url: string): Task.Result<OPFDoc>;
|
|
44
|
+
addDocument(url: string, doc: Document): Task.Result<XmlDoc.XMLDocHolder>;
|
|
45
|
+
reportLoadError(docURL: string): void;
|
|
46
|
+
load(url: string): Task.Result<XmlDoc.XMLDocHolder>;
|
|
47
|
+
processViewportMeta(meta: Element): string;
|
|
48
|
+
}
|
|
49
|
+
export type OPFItemParam = {
|
|
50
|
+
url: string;
|
|
51
|
+
index: number;
|
|
52
|
+
startPage: number | null;
|
|
53
|
+
skipPagesBefore: number | null;
|
|
54
|
+
};
|
|
55
|
+
export declare class OPFItem {
|
|
56
|
+
id: string | null;
|
|
57
|
+
src: string;
|
|
58
|
+
mediaType: string | null;
|
|
59
|
+
title: string | null;
|
|
60
|
+
itemRefElement: Element | null;
|
|
61
|
+
spineIndex: number;
|
|
62
|
+
compressedSize: number;
|
|
63
|
+
compressed: boolean | null;
|
|
64
|
+
epage: number;
|
|
65
|
+
epageCount: number;
|
|
66
|
+
startPage: number | null;
|
|
67
|
+
skipPagesBefore: number | null;
|
|
68
|
+
itemProperties: {
|
|
69
|
+
[key: string]: boolean;
|
|
70
|
+
};
|
|
71
|
+
constructor();
|
|
72
|
+
initWithElement(itemElem: Element, opfURL: string): void;
|
|
73
|
+
initWithParam(param: OPFItemParam): void;
|
|
74
|
+
}
|
|
75
|
+
export declare function getOPFItemId(item: OPFItem): string | null;
|
|
76
|
+
export declare function makeDeobfuscator(uid: string): (p1: Blob) => Task.Result<Blob>;
|
|
77
|
+
export declare function makeObfuscationKey(uid: string): string;
|
|
78
|
+
export interface Meta {
|
|
79
|
+
[key: string]: MetaItem[];
|
|
80
|
+
}
|
|
81
|
+
export interface MetaItem {
|
|
82
|
+
v: string;
|
|
83
|
+
o?: number;
|
|
84
|
+
s?: string;
|
|
85
|
+
r?: Meta;
|
|
86
|
+
}
|
|
87
|
+
export declare const predefinedPrefixes: {
|
|
88
|
+
dcterms: string;
|
|
89
|
+
marc: string;
|
|
90
|
+
media: string;
|
|
91
|
+
rendition: string;
|
|
92
|
+
onix: string;
|
|
93
|
+
xsd: string;
|
|
94
|
+
opf: string;
|
|
95
|
+
};
|
|
96
|
+
export declare const defaultIRI = "http://idpf.org/epub/vocab/package/meta/#";
|
|
97
|
+
export declare const metaTerms: {
|
|
98
|
+
language: string;
|
|
99
|
+
title: string;
|
|
100
|
+
creator: string;
|
|
101
|
+
layout: string;
|
|
102
|
+
titleType: string;
|
|
103
|
+
displaySeq: string;
|
|
104
|
+
alternateScript: string;
|
|
105
|
+
role: string;
|
|
106
|
+
};
|
|
107
|
+
export declare function getMetadataComparator(term: string, lang: string): (p1: MetaItem, p2: MetaItem) => number;
|
|
108
|
+
export declare function readMetadata(mroot: XmlDoc.NodeList, prefixes: string | null): Meta;
|
|
109
|
+
export declare function getMathJaxHub(): object;
|
|
110
|
+
export declare function checkMathJax(): void;
|
|
111
|
+
export declare const supportedMediaTypes: {
|
|
112
|
+
"application/xhtml+xml": boolean;
|
|
113
|
+
"image/jpeg": boolean;
|
|
114
|
+
"image/png": boolean;
|
|
115
|
+
"image/svg+xml": boolean;
|
|
116
|
+
"image/gif": boolean;
|
|
117
|
+
"audio/mp3": boolean;
|
|
118
|
+
};
|
|
119
|
+
export declare const transformedIdPrefix = "viv-id-";
|
|
120
|
+
export declare class OPFDoc {
|
|
121
|
+
readonly store: EPUBDocStore;
|
|
122
|
+
readonly pubURL: string;
|
|
123
|
+
opfXML: XmlDoc.XMLDocHolder;
|
|
124
|
+
encXML: XmlDoc.XMLDocHolder;
|
|
125
|
+
items: OPFItem[];
|
|
126
|
+
spine: OPFItem[];
|
|
127
|
+
itemMap: {
|
|
128
|
+
[key: string]: OPFItem;
|
|
129
|
+
};
|
|
130
|
+
itemMapByPath: {
|
|
131
|
+
[key: string]: OPFItem;
|
|
132
|
+
};
|
|
133
|
+
uid: string | null;
|
|
134
|
+
bindings: {
|
|
135
|
+
[key: string]: string;
|
|
136
|
+
};
|
|
137
|
+
lang: string | null;
|
|
138
|
+
epageCount: number;
|
|
139
|
+
prePaginated: boolean;
|
|
140
|
+
epageIsRenderedPage: boolean;
|
|
141
|
+
epageCountCallback: (p1: number) => void | null;
|
|
142
|
+
metadata: Meta;
|
|
143
|
+
ncxToc: OPFItem;
|
|
144
|
+
xhtmlToc: OPFItem;
|
|
145
|
+
cover: OPFItem;
|
|
146
|
+
fallbackMap: {
|
|
147
|
+
[key: string]: string;
|
|
148
|
+
};
|
|
149
|
+
pageProgression: Constants.PageProgression | null;
|
|
150
|
+
documentURLTransformer: Base.DocumentURLTransformer;
|
|
151
|
+
constructor(store: EPUBDocStore, pubURL: string);
|
|
152
|
+
createDocumentURLTransformer(): Base.DocumentURLTransformer;
|
|
153
|
+
/**
|
|
154
|
+
* Metadata is organized in the following way: fully-expanded property names
|
|
155
|
+
* (with IRI prefixes prepended) point to an array of values. Array contains
|
|
156
|
+
* at least one element. First element is primary and should be used by
|
|
157
|
+
* default. Element values are objects have the following keys:
|
|
158
|
+
* - "v" - item value as string,
|
|
159
|
+
* - "s" - scheme,
|
|
160
|
+
* - "o" - index in the order of appearing in the source,
|
|
161
|
+
* - "r" - refinement submetadata (organized just like the top-level
|
|
162
|
+
* metadata).
|
|
163
|
+
*/
|
|
164
|
+
getMetadata(): Meta;
|
|
165
|
+
getPathFromURL(url: string): string | null;
|
|
166
|
+
initWithXMLDoc(opfXML: XmlDoc.XMLDocHolder, encXML: XmlDoc.XMLDocHolder, zipMetadata: Base.JSON, manifestURL: string): Task.Result<any>;
|
|
167
|
+
assignAutoPages(): void;
|
|
168
|
+
setEPageCountMode(epageIsRenderedPage: boolean): void;
|
|
169
|
+
countEPages(epageCountCallback: ((p1: number) => void) | null): Task.Result<boolean>;
|
|
170
|
+
/**
|
|
171
|
+
* Creates a fake OPF "document" that contains OPS chapters.
|
|
172
|
+
*/
|
|
173
|
+
initWithChapters(params: OPFItemParam[], doc?: Document | null): Task.Result<any>;
|
|
174
|
+
initWithWebPubManifest(manifestObj: Base.JSON, doc?: Document, manifestUrl?: string): Task.Result<boolean>;
|
|
175
|
+
/**
|
|
176
|
+
* @return cfi
|
|
177
|
+
*/
|
|
178
|
+
getCFI(spineIndex: number, offsetInItem: number): Task.Result<string | null>;
|
|
179
|
+
resolveFragment(fragstr: string | null): Task.Result<Position | null>;
|
|
180
|
+
resolveEPage(epage: number): Task.Result<Position | null>;
|
|
181
|
+
getEPageFromPosition(position: Position): Task.Result<number>;
|
|
182
|
+
}
|
|
183
|
+
export type PageAndPosition = {
|
|
184
|
+
page: Vtree.Page;
|
|
185
|
+
position: Position;
|
|
186
|
+
};
|
|
187
|
+
export declare const makePageAndPosition: (page: Vtree.Page, pageIndex: number) => PageAndPosition;
|
|
188
|
+
export type OPFViewItem = {
|
|
189
|
+
item: OPFItem;
|
|
190
|
+
xmldoc: XmlDoc.XMLDocHolder;
|
|
191
|
+
instance: OPS.StyleInstance;
|
|
192
|
+
layoutPositions: Vtree.LayoutPosition[];
|
|
193
|
+
pages: Vtree.Page[];
|
|
194
|
+
complete: boolean;
|
|
195
|
+
};
|
|
196
|
+
export declare class OPFView implements Vgen.CustomRendererFactory {
|
|
197
|
+
readonly opf: OPFDoc;
|
|
198
|
+
readonly viewport: Vgen.Viewport;
|
|
199
|
+
readonly fontMapper: Font.Mapper;
|
|
200
|
+
readonly pageSheetSizeReporter: (p1: {
|
|
201
|
+
width: number;
|
|
202
|
+
height: number;
|
|
203
|
+
}, p2: {
|
|
204
|
+
[key: string]: {
|
|
205
|
+
width: number;
|
|
206
|
+
height: number;
|
|
207
|
+
};
|
|
208
|
+
}, p3: number, p4: number) => any;
|
|
209
|
+
spineItems: OPFViewItem[];
|
|
210
|
+
spineItemLoadingContinuations: Task.Continuation<any>[][];
|
|
211
|
+
pref: Exprs.Preferences;
|
|
212
|
+
clientLayout: Vgen.DefaultClientLayout;
|
|
213
|
+
counterStore: Counters.CounterStore;
|
|
214
|
+
tocAutohide: boolean;
|
|
215
|
+
tocView?: Toc.TOCView;
|
|
216
|
+
constructor(opf: OPFDoc, viewport: Vgen.Viewport, fontMapper: Font.Mapper, pref: Exprs.Preferences, pageSheetSizeReporter: (p1: {
|
|
217
|
+
width: number;
|
|
218
|
+
height: number;
|
|
219
|
+
}, p2: {
|
|
220
|
+
[key: string]: {
|
|
221
|
+
width: number;
|
|
222
|
+
height: number;
|
|
223
|
+
};
|
|
224
|
+
}, p3: number, p4: number) => any);
|
|
225
|
+
private getPage;
|
|
226
|
+
getCurrentPageProgression(position: Position): Constants.PageProgression | null;
|
|
227
|
+
private finishPageContainer;
|
|
228
|
+
/**
|
|
229
|
+
* Render a single page. If the new page contains elements with ids that are
|
|
230
|
+
* referenced from other pages by 'target-counter()', those pages are rendered
|
|
231
|
+
* too (calling `renderSinglePage` recursively).
|
|
232
|
+
*/
|
|
233
|
+
private renderSinglePage;
|
|
234
|
+
private normalizeSeekPosition;
|
|
235
|
+
/**
|
|
236
|
+
* Find a page corresponding to a specified position among already laid out
|
|
237
|
+
* pages.
|
|
238
|
+
* @param sync If true, find the page synchronously (not waiting another
|
|
239
|
+
* rendering task)
|
|
240
|
+
*/
|
|
241
|
+
findPage(position: Position, sync: boolean): Task.Result<PageAndPosition | null>;
|
|
242
|
+
/**
|
|
243
|
+
* Renders a page at the specified position.
|
|
244
|
+
*/
|
|
245
|
+
renderPage(position: Position): Task.Result<PageAndPosition | null>;
|
|
246
|
+
renderAllPages(): Task.Result<PageAndPosition | null>;
|
|
247
|
+
/**
|
|
248
|
+
* Render pages from (spineIndex=0, pageIndex=0) to the specified (spineIndex,
|
|
249
|
+
* pageIndex).
|
|
250
|
+
* @param notAllPages If true, render from biginning of specified spine item.
|
|
251
|
+
*/
|
|
252
|
+
renderPagesUpto(position: Position, notAllPages: boolean): Task.Result<PageAndPosition | null>;
|
|
253
|
+
/**
|
|
254
|
+
* Move to the first page and render it.
|
|
255
|
+
*/
|
|
256
|
+
firstPage(position: Position, sync: boolean): Task.Result<PageAndPosition | null>;
|
|
257
|
+
/**
|
|
258
|
+
* Move to the last page and render it.
|
|
259
|
+
*/
|
|
260
|
+
lastPage(position: Position, sync: boolean): Task.Result<PageAndPosition | null>;
|
|
261
|
+
/**
|
|
262
|
+
* Move to the next page position and render page.
|
|
263
|
+
* @param sync If true, get the page synchronously (not waiting another
|
|
264
|
+
* rendering task)
|
|
265
|
+
*/
|
|
266
|
+
nextPage(position: Position, sync: boolean): Task.Result<PageAndPosition | null>;
|
|
267
|
+
/**
|
|
268
|
+
* Move to the previous page and render it.
|
|
269
|
+
*/
|
|
270
|
+
previousPage(position: Position, sync: boolean): Task.Result<PageAndPosition | null>;
|
|
271
|
+
/**
|
|
272
|
+
* @param page This page should be a currently displayed page.
|
|
273
|
+
*/
|
|
274
|
+
private isRectoPage;
|
|
275
|
+
/**
|
|
276
|
+
* Get a spread containing the currently displayed page.
|
|
277
|
+
* @param sync If true, get the spread synchronously (not waiting another
|
|
278
|
+
* rendering task)
|
|
279
|
+
*/
|
|
280
|
+
getSpread(position: Position, sync: boolean): Task.Result<Vtree.Spread>;
|
|
281
|
+
/**
|
|
282
|
+
* Move to the next spread and render pages.
|
|
283
|
+
* @param sync If true, get the spread synchronously (not waiting another
|
|
284
|
+
* rendering task)
|
|
285
|
+
* @returns The 'verso' page of the next spread.
|
|
286
|
+
*/
|
|
287
|
+
nextSpread(position: Position, sync: boolean): Task.Result<PageAndPosition | null>;
|
|
288
|
+
/**
|
|
289
|
+
* Move to the previous spread and render pages.
|
|
290
|
+
* @returns The 'recto' page of the previous spread.
|
|
291
|
+
*/
|
|
292
|
+
previousSpread(position: Position, sync: boolean): Task.Result<PageAndPosition | null>;
|
|
293
|
+
/**
|
|
294
|
+
* Move to the epage specified by the given number (zero-based) and render it.
|
|
295
|
+
*/
|
|
296
|
+
navigateToEPage(epage: number, position: Position, sync: boolean): Task.Result<PageAndPosition | null>;
|
|
297
|
+
/**
|
|
298
|
+
* Move to the page specified by the given CFI and render it.
|
|
299
|
+
*/
|
|
300
|
+
navigateToFragment(fragment: string, position: Position, sync: boolean): Task.Result<PageAndPosition | null>;
|
|
301
|
+
/**
|
|
302
|
+
* Move to the page specified by the given URL and render it.
|
|
303
|
+
*/
|
|
304
|
+
navigateTo(href: string, position: Position, sync: boolean): Task.Result<PageAndPosition | null>;
|
|
305
|
+
makePage(viewItem: OPFViewItem, pos: Vtree.LayoutPosition): Vtree.Page;
|
|
306
|
+
makeObjectView(xmldoc: XmlDoc.XMLDocHolder, srcElem: Element, viewParent: Element, computedStyle: {
|
|
307
|
+
[key: string]: Css.Val;
|
|
308
|
+
}): Task.Result<Element>;
|
|
309
|
+
makeMathJaxView(xmldoc: XmlDoc.XMLDocHolder, srcElem: Element, viewParent: Element, computedStyle: {
|
|
310
|
+
[key: string]: Css.Val;
|
|
311
|
+
}): Task.Result<Element>;
|
|
312
|
+
private resolveURLsInMathML;
|
|
313
|
+
/** @override */
|
|
314
|
+
makeCustomRenderer(xmldoc: XmlDoc.XMLDocHolder): Vgen.CustomRenderer;
|
|
315
|
+
getPageViewItem(spineIndex: number): Task.Result<OPFViewItem>;
|
|
316
|
+
removeRenderedPages(): void;
|
|
317
|
+
/**
|
|
318
|
+
* Returns if at least one page has 'auto' size
|
|
319
|
+
*/
|
|
320
|
+
hasAutoSizedPages(): boolean;
|
|
321
|
+
hasPages(): boolean;
|
|
322
|
+
showTOC(autohide: boolean): Task.Result<Vtree.Page>;
|
|
323
|
+
hideTOC(): void;
|
|
324
|
+
isTOCVisible(): boolean;
|
|
325
|
+
}
|
|
326
|
+
export interface RenderSinglePageResult {
|
|
327
|
+
pageAndPosition: PageAndPosition;
|
|
328
|
+
nextLayoutPosition: Vtree.LayoutPosition;
|
|
329
|
+
}
|