@vivliostyle/core 2.24.3 → 2.25.0
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 +127 -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
package/lib/vivliostyle/ops.d.ts
CHANGED
|
@@ -1,263 +1,263 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright 2013 Google, Inc.
|
|
3
|
-
* Copyright 2015 Trim-marks Inc.
|
|
4
|
-
* Copyright 2019 Vivliostyle Foundation
|
|
5
|
-
*
|
|
6
|
-
* Vivliostyle.js is free software: you can redistribute it and/or modify
|
|
7
|
-
* it under the terms of the GNU Affero General Public License as published by
|
|
8
|
-
* the Free Software Foundation, either version 3 of the License, or
|
|
9
|
-
* (at your option) any later version.
|
|
10
|
-
*
|
|
11
|
-
* Vivliostyle.js is distributed in the hope that it will be useful,
|
|
12
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
14
|
-
* GNU Affero General Public License for more details.
|
|
15
|
-
*
|
|
16
|
-
* You should have received a copy of the GNU Affero General Public License
|
|
17
|
-
* along with Vivliostyle.js. If not, see <http://www.gnu.org/licenses/>.
|
|
18
|
-
*
|
|
19
|
-
* @fileoverview Ops - Render EPUB content files by applying page masters,
|
|
20
|
-
* styling and layout.
|
|
21
|
-
*/
|
|
22
|
-
import "./footnotes";
|
|
23
|
-
import "./table";
|
|
24
|
-
import * as Base from "./base";
|
|
25
|
-
import * as Constants from "./constants";
|
|
26
|
-
import * as Counters from "./counters";
|
|
27
|
-
import * as Css from "./css";
|
|
28
|
-
import * as CssCascade from "./css-cascade";
|
|
29
|
-
import * as CssParser from "./css-parser";
|
|
30
|
-
import * as CssStyler from "./css-styler";
|
|
31
|
-
import * as CssValidator from "./css-validator";
|
|
32
|
-
import * as Exprs from "./exprs";
|
|
33
|
-
import * as Font from "./font";
|
|
34
|
-
import * as GeometryUtil from "./geometry-util";
|
|
35
|
-
import * as Net from "./net";
|
|
36
|
-
import * as PageFloats from "./page-floats";
|
|
37
|
-
import * as CssPage from "./css-page";
|
|
38
|
-
import * as PageMaster from "./page-master";
|
|
39
|
-
import * as Task from "./task";
|
|
40
|
-
import * as TaskUtil from "./task-util";
|
|
41
|
-
import * as Vgen from "./vgen";
|
|
42
|
-
import * as Vtree from "./vtree";
|
|
43
|
-
import * as XmlDoc from "./xml-doc";
|
|
44
|
-
import { Layout as LayoutType } from "./types";
|
|
45
|
-
export declare const uaStylesheetBaseFetcher: TaskUtil.Fetcher<boolean>;
|
|
46
|
-
export declare function loadUABase(): Task.Result<boolean>;
|
|
47
|
-
export type FontFace = {
|
|
48
|
-
properties: CssCascade.ElementStyle;
|
|
49
|
-
condition: Exprs.Val;
|
|
50
|
-
};
|
|
51
|
-
export declare class Style {
|
|
52
|
-
readonly store: OPSDocStore;
|
|
53
|
-
readonly rootScope: Exprs.LexicalScope;
|
|
54
|
-
readonly pageScope: Exprs.LexicalScope;
|
|
55
|
-
readonly cascade: CssCascade.Cascade;
|
|
56
|
-
readonly rootBox: PageMaster.RootPageBox;
|
|
57
|
-
readonly fontFaces: FontFace[];
|
|
58
|
-
readonly footnoteProps: CssCascade.ElementStyle;
|
|
59
|
-
readonly flowProps: {
|
|
60
|
-
[key: string]: CssCascade.ElementStyle;
|
|
61
|
-
};
|
|
62
|
-
readonly viewportProps: CssCascade.ElementStyle[];
|
|
63
|
-
readonly pageProps: {
|
|
64
|
-
[key: string]: CssCascade.ElementStyle;
|
|
65
|
-
};
|
|
66
|
-
fontDeobfuscator: ((p1: string) => ((p1: Blob) => Task.Result<Blob>) | null) | null;
|
|
67
|
-
validatorSet: CssValidator.ValidatorSet;
|
|
68
|
-
constructor(store: OPSDocStore, rootScope: Exprs.LexicalScope, pageScope: Exprs.LexicalScope, cascade: CssCascade.Cascade, rootBox: PageMaster.RootPageBox, fontFaces: FontFace[], footnoteProps: CssCascade.ElementStyle, flowProps: {
|
|
69
|
-
[key: string]: CssCascade.ElementStyle;
|
|
70
|
-
}, viewportProps: CssCascade.ElementStyle[], pageProps: {
|
|
71
|
-
[key: string]: CssCascade.ElementStyle;
|
|
72
|
-
});
|
|
73
|
-
sizeViewport(viewportWidth: number, viewportHeight: number, fontSize: number, pref?: Exprs.Preferences): {
|
|
74
|
-
width: number;
|
|
75
|
-
height: number;
|
|
76
|
-
fontSize: number;
|
|
77
|
-
};
|
|
78
|
-
}
|
|
79
|
-
export declare class StyleInstance extends Exprs.Context implements CssStyler.FlowListener, PageMaster.InstanceHolder, Vgen.StylerProducer {
|
|
80
|
-
readonly style: Style;
|
|
81
|
-
readonly xmldoc: XmlDoc.XMLDocHolder;
|
|
82
|
-
readonly viewport: Vgen.Viewport;
|
|
83
|
-
readonly clientLayout: Vtree.ClientLayout;
|
|
84
|
-
readonly fontMapper: Font.Mapper;
|
|
85
|
-
readonly customRenderer: Vgen.CustomRenderer;
|
|
86
|
-
readonly fallbackMap: {
|
|
87
|
-
[key: string]: string;
|
|
88
|
-
};
|
|
89
|
-
readonly pageNumberOffset: number;
|
|
90
|
-
readonly documentURLTransformer: Base.DocumentURLTransformer;
|
|
91
|
-
readonly counterStore: Counters.CounterStore;
|
|
92
|
-
lang: string | null;
|
|
93
|
-
primaryFlows: {
|
|
94
|
-
[key: string]: boolean;
|
|
95
|
-
};
|
|
96
|
-
rootPageBoxInstance: PageMaster.RootPageBoxInstance;
|
|
97
|
-
styler: CssStyler.Styler;
|
|
98
|
-
stylerMap: {
|
|
99
|
-
[key: string]: CssStyler.Styler;
|
|
100
|
-
};
|
|
101
|
-
currentLayoutPosition: Vtree.LayoutPosition;
|
|
102
|
-
layoutPositionAtPageStart: Vtree.LayoutPosition;
|
|
103
|
-
lookupOffset: number;
|
|
104
|
-
faces: Font.DocumentFaces;
|
|
105
|
-
pageBoxInstances: {
|
|
106
|
-
[key: string]: PageMaster.PageBoxInstance;
|
|
107
|
-
};
|
|
108
|
-
pageManager: CssPage.PageManager;
|
|
109
|
-
private rootPageFloatLayoutContext;
|
|
110
|
-
pageBreaks: {
|
|
111
|
-
[key: string]: boolean;
|
|
112
|
-
};
|
|
113
|
-
pageProgression: Constants.PageProgression | null;
|
|
114
|
-
isVersoFirstPage: boolean;
|
|
115
|
-
blankPageAtStart: boolean;
|
|
116
|
-
pageSheetSize: {
|
|
117
|
-
[key: string]: {
|
|
118
|
-
width: number;
|
|
119
|
-
height: number;
|
|
120
|
-
};
|
|
121
|
-
};
|
|
122
|
-
pageSheetHeight: number;
|
|
123
|
-
pageSheetWidth: number;
|
|
124
|
-
constructor(style: Style, xmldoc: XmlDoc.XMLDocHolder, defaultLang: string | null, viewport: Vgen.Viewport, clientLayout: Vtree.ClientLayout, fontMapper: Font.Mapper, customRenderer: Vgen.CustomRenderer, fallbackMap: {
|
|
125
|
-
[key: string]: string;
|
|
126
|
-
}, pageNumberOffset: number, documentURLTransformer: Base.DocumentURLTransformer, counterStore: Counters.CounterStore, pageProgression?: Constants.PageProgression, isVersoFirstPage?: boolean);
|
|
127
|
-
init(): Task.Result<boolean>;
|
|
128
|
-
private matchStartPageSide;
|
|
129
|
-
/** @override */
|
|
130
|
-
getStylerForDoc(xmldoc: XmlDoc.XMLDocHolder): CssStyler.AbstractStyler;
|
|
131
|
-
/** @override */
|
|
132
|
-
registerInstance(key: string, instance: PageMaster.PageBoxInstance): void;
|
|
133
|
-
/** @override */
|
|
134
|
-
lookupInstance(key: string): PageMaster.PageBoxInstance;
|
|
135
|
-
/** @override */
|
|
136
|
-
encounteredFlowChunk(flowChunk: Vtree.FlowChunk, flow: Vtree.Flow): void;
|
|
137
|
-
evalSupportsTest(name: string, value: string, isFunc: boolean): boolean;
|
|
138
|
-
/**
|
|
139
|
-
* @param selectorText
|
|
140
|
-
* @returns true if selectorText is supported selector
|
|
141
|
-
*/
|
|
142
|
-
private evalSupportsSelector;
|
|
143
|
-
getConsumedOffset(flowPosition: Vtree.FlowPosition): number;
|
|
144
|
-
/**
|
|
145
|
-
* @param noLookAhead Do not look ahead elements that are not styled yet
|
|
146
|
-
* @return document offset of the given layoutPosition
|
|
147
|
-
*/
|
|
148
|
-
getPosition(layoutPosition?: Vtree.LayoutPosition, noLookAhead?: boolean): number;
|
|
149
|
-
dumpLocation(position: any): void;
|
|
150
|
-
matchPageSide(side: string | null): boolean;
|
|
151
|
-
updateStartSide(layoutPosition: Vtree.LayoutPosition): void;
|
|
152
|
-
/**
|
|
153
|
-
* @param cascadedPageStyle Cascaded page style specified in page context
|
|
154
|
-
*/
|
|
155
|
-
selectPageMaster(cascadedPageStyle: CssCascade.ElementStyle): PageMaster.PageMasterInstance;
|
|
156
|
-
flowChunkIsAfterParentFlowForcedBreak(flowChunk: Vtree.FlowChunk): boolean;
|
|
157
|
-
setFormattingContextToColumn(column: LayoutType.Column, flowName: string): void;
|
|
158
|
-
layoutDeferredPageFloats(column: LayoutType.Column): Task.Result<boolean>;
|
|
159
|
-
getLastAfterPositionIfDeferredFloatsExists(column: LayoutType.Column, newPosition: Vtree.ChunkPosition | null): Vtree.ChunkPosition | null;
|
|
160
|
-
/**
|
|
161
|
-
* @return holding true
|
|
162
|
-
*/
|
|
163
|
-
layoutColumn(column: LayoutType.Column, flowName: string): Task.Result<boolean>;
|
|
164
|
-
createLayoutConstraint(pageFloatLayoutContext: PageFloats.PageFloatLayoutContext): LayoutType.LayoutConstraint;
|
|
165
|
-
private createAndLayoutColumn;
|
|
166
|
-
setPagePageFloatLayoutContextContainer(pagePageFloatLayoutContext: PageFloats.PageFloatLayoutContext, boxInstance: PageMaster.PageBoxInstance, layoutContainer: Vtree.Container): void;
|
|
167
|
-
getRegionPageFloatLayoutContext(pagePageFloatLayoutContext: PageFloats.PageFloatLayoutContext, boxInstance: PageMaster.PageBoxInstance, layoutContainer: Vtree.Container, flowName: string): PageFloats.PageFloatLayoutContext;
|
|
168
|
-
layoutFlowColumnsWithBalancing(page: Vtree.Page, boxInstance: PageMaster.PageBoxInstance, offsetX: number, offsetY: number, exclusions: GeometryUtil.Shape[], pagePageFloatLayoutContext: PageFloats.PageFloatLayoutContext, layoutContainer: Vtree.Container, flowNameStr: string, columnCount: number): Task.Result<LayoutType.Column[]>;
|
|
169
|
-
layoutFlowColumns(page: Vtree.Page, boxInstance: PageMaster.PageBoxInstance, offsetX: number, offsetY: number, exclusions: GeometryUtil.Shape[], pagePageFloatLayoutContext: PageFloats.PageFloatLayoutContext, regionPageFloatLayoutContext: PageFloats.PageFloatLayoutContext, layoutContainer: Vtree.Container, flowNameStr: string, columnCount: number, forceNonFitting: boolean): Task.Result<LayoutType.Column[] | null>;
|
|
170
|
-
/**
|
|
171
|
-
* @return holding true
|
|
172
|
-
*/
|
|
173
|
-
layoutContainer(page: Vtree.Page, boxInstance: PageMaster.PageBoxInstance, parentContainer: HTMLElement, offsetX: number, offsetY: number, exclusions: GeometryUtil.Shape[], pagePageFloatLayoutContext: PageFloats.PageFloatLayoutContext): Task.Result<boolean>;
|
|
174
|
-
processLinger(): void;
|
|
175
|
-
initLingering(): void;
|
|
176
|
-
noMorePrimaryFlows(cp: Vtree.LayoutPosition): boolean;
|
|
177
|
-
layoutNextPage(page: Vtree.Page, cp?: Vtree.LayoutPosition): Task.Result<Vtree.LayoutPosition>;
|
|
178
|
-
/**
|
|
179
|
-
* Set actual page width, height and bleed from style specified in page
|
|
180
|
-
* context.
|
|
181
|
-
*/
|
|
182
|
-
private setPageSizeAndBleed;
|
|
183
|
-
}
|
|
184
|
-
export declare class BaseParserHandler extends CssCascade.CascadeParserHandler {
|
|
185
|
-
masterHandler: StyleParserHandler;
|
|
186
|
-
insideRegion: boolean;
|
|
187
|
-
constructor(masterHandler: StyleParserHandler, condition: Exprs.Val, parent: BaseParserHandler, regionId: string | null);
|
|
188
|
-
startPageTemplateRule(): void;
|
|
189
|
-
startPageMasterRule(name: string | null, pseudoName: string | null, classes: string[]): void;
|
|
190
|
-
startWhenRule(expr: Css.Expr): void;
|
|
191
|
-
startDefineRule(): void;
|
|
192
|
-
startFontFaceRule(): void;
|
|
193
|
-
startFlowRule(flowName: string): void;
|
|
194
|
-
startViewportRule(): void;
|
|
195
|
-
startFootnoteRule(pseudoelem: string | null): void;
|
|
196
|
-
startRegionRule(): void;
|
|
197
|
-
startPageRule(): void;
|
|
198
|
-
startRuleBody(): void;
|
|
199
|
-
}
|
|
200
|
-
export declare class StyleParserHandler extends CssParser.DispatchParserHandler {
|
|
201
|
-
readonly validatorSet: CssValidator.ValidatorSet;
|
|
202
|
-
rootScope: Exprs.LexicalScope;
|
|
203
|
-
pageScope: Exprs.LexicalScope;
|
|
204
|
-
rootBox: PageMaster.RootPageBox;
|
|
205
|
-
cascadeParserHandler: BaseParserHandler;
|
|
206
|
-
regionCount: number;
|
|
207
|
-
fontFaces: FontFace[];
|
|
208
|
-
footnoteProps: CssCascade.ElementStyle;
|
|
209
|
-
flowProps: {
|
|
210
|
-
[key: string]: CssCascade.ElementStyle;
|
|
211
|
-
};
|
|
212
|
-
viewportProps: CssCascade.ElementStyle[];
|
|
213
|
-
pageProps: {
|
|
214
|
-
[key: string]: CssCascade.ElementStyle;
|
|
215
|
-
};
|
|
216
|
-
constructor(validatorSet: CssValidator.ValidatorSet);
|
|
217
|
-
}
|
|
218
|
-
export type StyleSource = {
|
|
219
|
-
url: string;
|
|
220
|
-
text: string | null;
|
|
221
|
-
flavor: CssParser.StylesheetFlavor;
|
|
222
|
-
classes: string | null;
|
|
223
|
-
media: string | null;
|
|
224
|
-
};
|
|
225
|
-
export declare function parseOPSResource(response: Net.Response, store: XmlDoc.XMLDocStore): Task.Result<XmlDoc.XMLDocHolder>;
|
|
226
|
-
export declare class OPSDocStore extends Net.ResourceStore<XmlDoc.XMLDocHolder> {
|
|
227
|
-
fontDeobfuscator: ((p1: string) => ((p1: Blob) => Task.Result<Blob>) | null) | null;
|
|
228
|
-
styleByKey: {
|
|
229
|
-
[key: string]: Style;
|
|
230
|
-
};
|
|
231
|
-
styleFetcherByKey: {
|
|
232
|
-
[key: string]: TaskUtil.Fetcher<Style>;
|
|
233
|
-
};
|
|
234
|
-
styleByDocURL: {
|
|
235
|
-
[key: string]: Style;
|
|
236
|
-
};
|
|
237
|
-
triggersByDocURL: {
|
|
238
|
-
[key: string]: Vtree.Trigger[];
|
|
239
|
-
};
|
|
240
|
-
validatorSet: CssValidator.ValidatorSet;
|
|
241
|
-
private styleSheets;
|
|
242
|
-
private triggerSingleDocumentPreprocessing;
|
|
243
|
-
constructor(fontDeobfuscator: ((p1: string) => ((p1: Blob) => Task.Result<Blob>) | null) | null);
|
|
244
|
-
init(authorStyleSheets: {
|
|
245
|
-
url: string | null;
|
|
246
|
-
text: string | null;
|
|
247
|
-
}[] | null, userStyleSheets: {
|
|
248
|
-
url: string | null;
|
|
249
|
-
text: string | null;
|
|
250
|
-
}[] | null): Task.Result<boolean>;
|
|
251
|
-
getStyleForDoc(xmldoc: XmlDoc.XMLDocHolder): Style;
|
|
252
|
-
getTriggersForDoc(xmldoc: XmlDoc.XMLDocHolder): Vtree.Trigger[];
|
|
253
|
-
/**
|
|
254
|
-
* Set author stylesheets and user stylesheets. Existing style sheets are
|
|
255
|
-
* removed.
|
|
256
|
-
*/
|
|
257
|
-
private setStyleSheets;
|
|
258
|
-
private clearStyleSheets;
|
|
259
|
-
private addAuthorStyleSheet;
|
|
260
|
-
private addUserStyleSheet;
|
|
261
|
-
parseOPSResource(response: Net.Response): Task.Result<XmlDoc.XMLDocHolder>;
|
|
262
|
-
processViewportMeta(meta: Element): string;
|
|
263
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2013 Google, Inc.
|
|
3
|
+
* Copyright 2015 Trim-marks Inc.
|
|
4
|
+
* Copyright 2019 Vivliostyle Foundation
|
|
5
|
+
*
|
|
6
|
+
* Vivliostyle.js is free software: you can redistribute it and/or modify
|
|
7
|
+
* it under the terms of the GNU Affero General Public License as published by
|
|
8
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
9
|
+
* (at your option) any later version.
|
|
10
|
+
*
|
|
11
|
+
* Vivliostyle.js is distributed in the hope that it will be useful,
|
|
12
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
14
|
+
* GNU Affero General Public License for more details.
|
|
15
|
+
*
|
|
16
|
+
* You should have received a copy of the GNU Affero General Public License
|
|
17
|
+
* along with Vivliostyle.js. If not, see <http://www.gnu.org/licenses/>.
|
|
18
|
+
*
|
|
19
|
+
* @fileoverview Ops - Render EPUB content files by applying page masters,
|
|
20
|
+
* styling and layout.
|
|
21
|
+
*/
|
|
22
|
+
import "./footnotes";
|
|
23
|
+
import "./table";
|
|
24
|
+
import * as Base from "./base";
|
|
25
|
+
import * as Constants from "./constants";
|
|
26
|
+
import * as Counters from "./counters";
|
|
27
|
+
import * as Css from "./css";
|
|
28
|
+
import * as CssCascade from "./css-cascade";
|
|
29
|
+
import * as CssParser from "./css-parser";
|
|
30
|
+
import * as CssStyler from "./css-styler";
|
|
31
|
+
import * as CssValidator from "./css-validator";
|
|
32
|
+
import * as Exprs from "./exprs";
|
|
33
|
+
import * as Font from "./font";
|
|
34
|
+
import * as GeometryUtil from "./geometry-util";
|
|
35
|
+
import * as Net from "./net";
|
|
36
|
+
import * as PageFloats from "./page-floats";
|
|
37
|
+
import * as CssPage from "./css-page";
|
|
38
|
+
import * as PageMaster from "./page-master";
|
|
39
|
+
import * as Task from "./task";
|
|
40
|
+
import * as TaskUtil from "./task-util";
|
|
41
|
+
import * as Vgen from "./vgen";
|
|
42
|
+
import * as Vtree from "./vtree";
|
|
43
|
+
import * as XmlDoc from "./xml-doc";
|
|
44
|
+
import { Layout as LayoutType } from "./types";
|
|
45
|
+
export declare const uaStylesheetBaseFetcher: TaskUtil.Fetcher<boolean>;
|
|
46
|
+
export declare function loadUABase(): Task.Result<boolean>;
|
|
47
|
+
export type FontFace = {
|
|
48
|
+
properties: CssCascade.ElementStyle;
|
|
49
|
+
condition: Exprs.Val;
|
|
50
|
+
};
|
|
51
|
+
export declare class Style {
|
|
52
|
+
readonly store: OPSDocStore;
|
|
53
|
+
readonly rootScope: Exprs.LexicalScope;
|
|
54
|
+
readonly pageScope: Exprs.LexicalScope;
|
|
55
|
+
readonly cascade: CssCascade.Cascade;
|
|
56
|
+
readonly rootBox: PageMaster.RootPageBox;
|
|
57
|
+
readonly fontFaces: FontFace[];
|
|
58
|
+
readonly footnoteProps: CssCascade.ElementStyle;
|
|
59
|
+
readonly flowProps: {
|
|
60
|
+
[key: string]: CssCascade.ElementStyle;
|
|
61
|
+
};
|
|
62
|
+
readonly viewportProps: CssCascade.ElementStyle[];
|
|
63
|
+
readonly pageProps: {
|
|
64
|
+
[key: string]: CssCascade.ElementStyle;
|
|
65
|
+
};
|
|
66
|
+
fontDeobfuscator: ((p1: string) => ((p1: Blob) => Task.Result<Blob>) | null) | null;
|
|
67
|
+
validatorSet: CssValidator.ValidatorSet;
|
|
68
|
+
constructor(store: OPSDocStore, rootScope: Exprs.LexicalScope, pageScope: Exprs.LexicalScope, cascade: CssCascade.Cascade, rootBox: PageMaster.RootPageBox, fontFaces: FontFace[], footnoteProps: CssCascade.ElementStyle, flowProps: {
|
|
69
|
+
[key: string]: CssCascade.ElementStyle;
|
|
70
|
+
}, viewportProps: CssCascade.ElementStyle[], pageProps: {
|
|
71
|
+
[key: string]: CssCascade.ElementStyle;
|
|
72
|
+
});
|
|
73
|
+
sizeViewport(viewportWidth: number, viewportHeight: number, fontSize: number, pref?: Exprs.Preferences): {
|
|
74
|
+
width: number;
|
|
75
|
+
height: number;
|
|
76
|
+
fontSize: number;
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
export declare class StyleInstance extends Exprs.Context implements CssStyler.FlowListener, PageMaster.InstanceHolder, Vgen.StylerProducer {
|
|
80
|
+
readonly style: Style;
|
|
81
|
+
readonly xmldoc: XmlDoc.XMLDocHolder;
|
|
82
|
+
readonly viewport: Vgen.Viewport;
|
|
83
|
+
readonly clientLayout: Vtree.ClientLayout;
|
|
84
|
+
readonly fontMapper: Font.Mapper;
|
|
85
|
+
readonly customRenderer: Vgen.CustomRenderer;
|
|
86
|
+
readonly fallbackMap: {
|
|
87
|
+
[key: string]: string;
|
|
88
|
+
};
|
|
89
|
+
readonly pageNumberOffset: number;
|
|
90
|
+
readonly documentURLTransformer: Base.DocumentURLTransformer;
|
|
91
|
+
readonly counterStore: Counters.CounterStore;
|
|
92
|
+
lang: string | null;
|
|
93
|
+
primaryFlows: {
|
|
94
|
+
[key: string]: boolean;
|
|
95
|
+
};
|
|
96
|
+
rootPageBoxInstance: PageMaster.RootPageBoxInstance;
|
|
97
|
+
styler: CssStyler.Styler;
|
|
98
|
+
stylerMap: {
|
|
99
|
+
[key: string]: CssStyler.Styler;
|
|
100
|
+
};
|
|
101
|
+
currentLayoutPosition: Vtree.LayoutPosition;
|
|
102
|
+
layoutPositionAtPageStart: Vtree.LayoutPosition;
|
|
103
|
+
lookupOffset: number;
|
|
104
|
+
faces: Font.DocumentFaces;
|
|
105
|
+
pageBoxInstances: {
|
|
106
|
+
[key: string]: PageMaster.PageBoxInstance;
|
|
107
|
+
};
|
|
108
|
+
pageManager: CssPage.PageManager;
|
|
109
|
+
private rootPageFloatLayoutContext;
|
|
110
|
+
pageBreaks: {
|
|
111
|
+
[key: string]: boolean;
|
|
112
|
+
};
|
|
113
|
+
pageProgression: Constants.PageProgression | null;
|
|
114
|
+
isVersoFirstPage: boolean;
|
|
115
|
+
blankPageAtStart: boolean;
|
|
116
|
+
pageSheetSize: {
|
|
117
|
+
[key: string]: {
|
|
118
|
+
width: number;
|
|
119
|
+
height: number;
|
|
120
|
+
};
|
|
121
|
+
};
|
|
122
|
+
pageSheetHeight: number;
|
|
123
|
+
pageSheetWidth: number;
|
|
124
|
+
constructor(style: Style, xmldoc: XmlDoc.XMLDocHolder, defaultLang: string | null, viewport: Vgen.Viewport, clientLayout: Vtree.ClientLayout, fontMapper: Font.Mapper, customRenderer: Vgen.CustomRenderer, fallbackMap: {
|
|
125
|
+
[key: string]: string;
|
|
126
|
+
}, pageNumberOffset: number, documentURLTransformer: Base.DocumentURLTransformer, counterStore: Counters.CounterStore, pageProgression?: Constants.PageProgression, isVersoFirstPage?: boolean);
|
|
127
|
+
init(): Task.Result<boolean>;
|
|
128
|
+
private matchStartPageSide;
|
|
129
|
+
/** @override */
|
|
130
|
+
getStylerForDoc(xmldoc: XmlDoc.XMLDocHolder): CssStyler.AbstractStyler;
|
|
131
|
+
/** @override */
|
|
132
|
+
registerInstance(key: string, instance: PageMaster.PageBoxInstance): void;
|
|
133
|
+
/** @override */
|
|
134
|
+
lookupInstance(key: string): PageMaster.PageBoxInstance;
|
|
135
|
+
/** @override */
|
|
136
|
+
encounteredFlowChunk(flowChunk: Vtree.FlowChunk, flow: Vtree.Flow): void;
|
|
137
|
+
evalSupportsTest(name: string, value: string, isFunc: boolean): boolean;
|
|
138
|
+
/**
|
|
139
|
+
* @param selectorText
|
|
140
|
+
* @returns true if selectorText is supported selector
|
|
141
|
+
*/
|
|
142
|
+
private evalSupportsSelector;
|
|
143
|
+
getConsumedOffset(flowPosition: Vtree.FlowPosition): number;
|
|
144
|
+
/**
|
|
145
|
+
* @param noLookAhead Do not look ahead elements that are not styled yet
|
|
146
|
+
* @return document offset of the given layoutPosition
|
|
147
|
+
*/
|
|
148
|
+
getPosition(layoutPosition?: Vtree.LayoutPosition, noLookAhead?: boolean): number;
|
|
149
|
+
dumpLocation(position: any): void;
|
|
150
|
+
matchPageSide(side: string | null): boolean;
|
|
151
|
+
updateStartSide(layoutPosition: Vtree.LayoutPosition): void;
|
|
152
|
+
/**
|
|
153
|
+
* @param cascadedPageStyle Cascaded page style specified in page context
|
|
154
|
+
*/
|
|
155
|
+
selectPageMaster(cascadedPageStyle: CssCascade.ElementStyle): PageMaster.PageMasterInstance;
|
|
156
|
+
flowChunkIsAfterParentFlowForcedBreak(flowChunk: Vtree.FlowChunk): boolean;
|
|
157
|
+
setFormattingContextToColumn(column: LayoutType.Column, flowName: string): void;
|
|
158
|
+
layoutDeferredPageFloats(column: LayoutType.Column): Task.Result<boolean>;
|
|
159
|
+
getLastAfterPositionIfDeferredFloatsExists(column: LayoutType.Column, newPosition: Vtree.ChunkPosition | null): Vtree.ChunkPosition | null;
|
|
160
|
+
/**
|
|
161
|
+
* @return holding true
|
|
162
|
+
*/
|
|
163
|
+
layoutColumn(column: LayoutType.Column, flowName: string): Task.Result<boolean>;
|
|
164
|
+
createLayoutConstraint(pageFloatLayoutContext: PageFloats.PageFloatLayoutContext): LayoutType.LayoutConstraint;
|
|
165
|
+
private createAndLayoutColumn;
|
|
166
|
+
setPagePageFloatLayoutContextContainer(pagePageFloatLayoutContext: PageFloats.PageFloatLayoutContext, boxInstance: PageMaster.PageBoxInstance, layoutContainer: Vtree.Container): void;
|
|
167
|
+
getRegionPageFloatLayoutContext(pagePageFloatLayoutContext: PageFloats.PageFloatLayoutContext, boxInstance: PageMaster.PageBoxInstance, layoutContainer: Vtree.Container, flowName: string): PageFloats.PageFloatLayoutContext;
|
|
168
|
+
layoutFlowColumnsWithBalancing(page: Vtree.Page, boxInstance: PageMaster.PageBoxInstance, offsetX: number, offsetY: number, exclusions: GeometryUtil.Shape[], pagePageFloatLayoutContext: PageFloats.PageFloatLayoutContext, layoutContainer: Vtree.Container, flowNameStr: string, columnCount: number): Task.Result<LayoutType.Column[]>;
|
|
169
|
+
layoutFlowColumns(page: Vtree.Page, boxInstance: PageMaster.PageBoxInstance, offsetX: number, offsetY: number, exclusions: GeometryUtil.Shape[], pagePageFloatLayoutContext: PageFloats.PageFloatLayoutContext, regionPageFloatLayoutContext: PageFloats.PageFloatLayoutContext, layoutContainer: Vtree.Container, flowNameStr: string, columnCount: number, forceNonFitting: boolean): Task.Result<LayoutType.Column[] | null>;
|
|
170
|
+
/**
|
|
171
|
+
* @return holding true
|
|
172
|
+
*/
|
|
173
|
+
layoutContainer(page: Vtree.Page, boxInstance: PageMaster.PageBoxInstance, parentContainer: HTMLElement, offsetX: number, offsetY: number, exclusions: GeometryUtil.Shape[], pagePageFloatLayoutContext: PageFloats.PageFloatLayoutContext): Task.Result<boolean>;
|
|
174
|
+
processLinger(): void;
|
|
175
|
+
initLingering(): void;
|
|
176
|
+
noMorePrimaryFlows(cp: Vtree.LayoutPosition): boolean;
|
|
177
|
+
layoutNextPage(page: Vtree.Page, cp?: Vtree.LayoutPosition): Task.Result<Vtree.LayoutPosition>;
|
|
178
|
+
/**
|
|
179
|
+
* Set actual page width, height and bleed from style specified in page
|
|
180
|
+
* context.
|
|
181
|
+
*/
|
|
182
|
+
private setPageSizeAndBleed;
|
|
183
|
+
}
|
|
184
|
+
export declare class BaseParserHandler extends CssCascade.CascadeParserHandler {
|
|
185
|
+
masterHandler: StyleParserHandler;
|
|
186
|
+
insideRegion: boolean;
|
|
187
|
+
constructor(masterHandler: StyleParserHandler, condition: Exprs.Val, parent: BaseParserHandler, regionId: string | null);
|
|
188
|
+
startPageTemplateRule(): void;
|
|
189
|
+
startPageMasterRule(name: string | null, pseudoName: string | null, classes: string[]): void;
|
|
190
|
+
startWhenRule(expr: Css.Expr): void;
|
|
191
|
+
startDefineRule(): void;
|
|
192
|
+
startFontFaceRule(): void;
|
|
193
|
+
startFlowRule(flowName: string): void;
|
|
194
|
+
startViewportRule(): void;
|
|
195
|
+
startFootnoteRule(pseudoelem: string | null): void;
|
|
196
|
+
startRegionRule(): void;
|
|
197
|
+
startPageRule(): void;
|
|
198
|
+
startRuleBody(): void;
|
|
199
|
+
}
|
|
200
|
+
export declare class StyleParserHandler extends CssParser.DispatchParserHandler {
|
|
201
|
+
readonly validatorSet: CssValidator.ValidatorSet;
|
|
202
|
+
rootScope: Exprs.LexicalScope;
|
|
203
|
+
pageScope: Exprs.LexicalScope;
|
|
204
|
+
rootBox: PageMaster.RootPageBox;
|
|
205
|
+
cascadeParserHandler: BaseParserHandler;
|
|
206
|
+
regionCount: number;
|
|
207
|
+
fontFaces: FontFace[];
|
|
208
|
+
footnoteProps: CssCascade.ElementStyle;
|
|
209
|
+
flowProps: {
|
|
210
|
+
[key: string]: CssCascade.ElementStyle;
|
|
211
|
+
};
|
|
212
|
+
viewportProps: CssCascade.ElementStyle[];
|
|
213
|
+
pageProps: {
|
|
214
|
+
[key: string]: CssCascade.ElementStyle;
|
|
215
|
+
};
|
|
216
|
+
constructor(validatorSet: CssValidator.ValidatorSet);
|
|
217
|
+
}
|
|
218
|
+
export type StyleSource = {
|
|
219
|
+
url: string;
|
|
220
|
+
text: string | null;
|
|
221
|
+
flavor: CssParser.StylesheetFlavor;
|
|
222
|
+
classes: string | null;
|
|
223
|
+
media: string | null;
|
|
224
|
+
};
|
|
225
|
+
export declare function parseOPSResource(response: Net.Response, store: XmlDoc.XMLDocStore): Task.Result<XmlDoc.XMLDocHolder>;
|
|
226
|
+
export declare class OPSDocStore extends Net.ResourceStore<XmlDoc.XMLDocHolder> {
|
|
227
|
+
fontDeobfuscator: ((p1: string) => ((p1: Blob) => Task.Result<Blob>) | null) | null;
|
|
228
|
+
styleByKey: {
|
|
229
|
+
[key: string]: Style;
|
|
230
|
+
};
|
|
231
|
+
styleFetcherByKey: {
|
|
232
|
+
[key: string]: TaskUtil.Fetcher<Style>;
|
|
233
|
+
};
|
|
234
|
+
styleByDocURL: {
|
|
235
|
+
[key: string]: Style;
|
|
236
|
+
};
|
|
237
|
+
triggersByDocURL: {
|
|
238
|
+
[key: string]: Vtree.Trigger[];
|
|
239
|
+
};
|
|
240
|
+
validatorSet: CssValidator.ValidatorSet;
|
|
241
|
+
private styleSheets;
|
|
242
|
+
private triggerSingleDocumentPreprocessing;
|
|
243
|
+
constructor(fontDeobfuscator: ((p1: string) => ((p1: Blob) => Task.Result<Blob>) | null) | null);
|
|
244
|
+
init(authorStyleSheets: {
|
|
245
|
+
url: string | null;
|
|
246
|
+
text: string | null;
|
|
247
|
+
}[] | null, userStyleSheets: {
|
|
248
|
+
url: string | null;
|
|
249
|
+
text: string | null;
|
|
250
|
+
}[] | null): Task.Result<boolean>;
|
|
251
|
+
getStyleForDoc(xmldoc: XmlDoc.XMLDocHolder): Style;
|
|
252
|
+
getTriggersForDoc(xmldoc: XmlDoc.XMLDocHolder): Vtree.Trigger[];
|
|
253
|
+
/**
|
|
254
|
+
* Set author stylesheets and user stylesheets. Existing style sheets are
|
|
255
|
+
* removed.
|
|
256
|
+
*/
|
|
257
|
+
private setStyleSheets;
|
|
258
|
+
private clearStyleSheets;
|
|
259
|
+
private addAuthorStyleSheet;
|
|
260
|
+
private addUserStyleSheet;
|
|
261
|
+
parseOPSResource(response: Net.Response): Task.Result<XmlDoc.XMLDocHolder>;
|
|
262
|
+
processViewportMeta(meta: Element): string;
|
|
263
|
+
}
|