@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
|
@@ -1,451 +1,451 @@
|
|
|
1
|
-
import * as Constants from "./constants";
|
|
2
|
-
import * as Css from "./css";
|
|
3
|
-
import * as CssCascade from "./css-cascade";
|
|
4
|
-
import * as CssParser from "./css-parser";
|
|
5
|
-
import * as CssValidator from "./css-validator";
|
|
6
|
-
import * as Exprs from "./exprs";
|
|
7
|
-
import * as Font from "./font";
|
|
8
|
-
import * as PageMaster from "./page-master";
|
|
9
|
-
import * as Vtree from "./vtree";
|
|
10
|
-
/**
|
|
11
|
-
* Resolve page progression direction from writing-mode and direction.
|
|
12
|
-
*/
|
|
13
|
-
export declare function resolvePageProgression(style: CssCascade.ElementStyle): Constants.PageProgression;
|
|
14
|
-
export type PageSize = {
|
|
15
|
-
width: Css.Numeric;
|
|
16
|
-
height: Css.Numeric;
|
|
17
|
-
};
|
|
18
|
-
/**
|
|
19
|
-
* Named page sizes.
|
|
20
|
-
*/
|
|
21
|
-
export declare const pageSizes: {
|
|
22
|
-
[key: string]: PageSize;
|
|
23
|
-
};
|
|
24
|
-
/**
|
|
25
|
-
* Default value for line width of printer marks
|
|
26
|
-
*/
|
|
27
|
-
export declare const defaultPrinterMarkLineWidth: Css.Numeric;
|
|
28
|
-
/**
|
|
29
|
-
* Default value for distance between an edge of the page and printer marks
|
|
30
|
-
*/
|
|
31
|
-
export declare const defaultPrinterMarkOffset: Css.Numeric;
|
|
32
|
-
/**
|
|
33
|
-
* Default value for line length of the (shorter) line of a crop mark and the
|
|
34
|
-
* shorter line of a cross mark
|
|
35
|
-
*/
|
|
36
|
-
export declare const defaultPrinterMarkLineLength: Css.Numeric;
|
|
37
|
-
/**
|
|
38
|
-
* Default value for bleed offset (= defaultPrinterMarkOffset +
|
|
39
|
-
* defaultPrinterMarkLineLength)
|
|
40
|
-
*/
|
|
41
|
-
export declare const defaultBleedOffset: Css.Numeric;
|
|
42
|
-
export type PageSizeAndBleed = {
|
|
43
|
-
width: Css.Numeric;
|
|
44
|
-
height: Css.Numeric;
|
|
45
|
-
bleed: Css.Numeric;
|
|
46
|
-
bleedOffset: Css.Numeric;
|
|
47
|
-
cropOffset: Css.Numeric;
|
|
48
|
-
};
|
|
49
|
-
export declare function resolvePageSizeAndBleed(style: {
|
|
50
|
-
[key: string]: CssCascade.CascadeValue;
|
|
51
|
-
}): PageSizeAndBleed;
|
|
52
|
-
export type EvaluatedPageSizeAndBleed = {
|
|
53
|
-
pageWidth: number;
|
|
54
|
-
pageHeight: number;
|
|
55
|
-
bleed: number;
|
|
56
|
-
bleedOffset: number;
|
|
57
|
-
cropOffset: number;
|
|
58
|
-
};
|
|
59
|
-
/**
|
|
60
|
-
* Evaluate actual page width, height and bleed from style specified in page
|
|
61
|
-
* context.
|
|
62
|
-
*/
|
|
63
|
-
export declare function evaluatePageSizeAndBleed(pageSizeAndBleed: PageSizeAndBleed, context: Exprs.Context): EvaluatedPageSizeAndBleed;
|
|
64
|
-
/**
|
|
65
|
-
* Create an 'svg' element for a printer mark.
|
|
66
|
-
*/
|
|
67
|
-
export declare function createPrinterMarkSvg(doc: Document, width: number, height: number): Element;
|
|
68
|
-
/**
|
|
69
|
-
* Create an SVG element for a printer mark line.
|
|
70
|
-
* @param elementType Specifies which type of element to create. Default value
|
|
71
|
-
* is "polyline".
|
|
72
|
-
*/
|
|
73
|
-
export declare function createPrinterMarkElement(doc: Document, lineWidth: number, elementType?: string): Element;
|
|
74
|
-
/**
|
|
75
|
-
* Position of a corner mark
|
|
76
|
-
* @enum {string}
|
|
77
|
-
*/
|
|
78
|
-
export declare enum CornerMarkPosition {
|
|
79
|
-
TOP_LEFT = "top left",
|
|
80
|
-
TOP_RIGHT = "top right",
|
|
81
|
-
BOTTOM_LEFT = "bottom left",
|
|
82
|
-
BOTTOM_RIGHT = "bottom right"
|
|
83
|
-
}
|
|
84
|
-
/**
|
|
85
|
-
* Create a corner mark.
|
|
86
|
-
*/
|
|
87
|
-
export declare function createCornerMark(doc: Document, position: CornerMarkPosition, lineWidth: number, cropMarkLineLength: number, bleed: number, offset: number): Element;
|
|
88
|
-
/**
|
|
89
|
-
* Position of a cross mark
|
|
90
|
-
* @enum {string}
|
|
91
|
-
*/
|
|
92
|
-
export declare enum CrossMarkPosition {
|
|
93
|
-
TOP = "top",
|
|
94
|
-
BOTTOM = "bottom",
|
|
95
|
-
LEFT = "left",
|
|
96
|
-
RIGHT = "right"
|
|
97
|
-
}
|
|
98
|
-
/**
|
|
99
|
-
* Create a cross mark.
|
|
100
|
-
*/
|
|
101
|
-
export declare function createCrossMark(doc: Document, position: CrossMarkPosition, lineWidth: number, lineLength: number, offset: number): Element;
|
|
102
|
-
/**
|
|
103
|
-
* Add printer marks to the page.
|
|
104
|
-
*/
|
|
105
|
-
export declare function addPrinterMarks(cascadedPageStyle: CssCascade.ElementStyle, evaluatedPageSizeAndBleed: EvaluatedPageSizeAndBleed, page: Vtree.Page, context: Exprs.Context): void;
|
|
106
|
-
/**
|
|
107
|
-
* Properties transfered from the PageRuleMaster to the PageRulePartition
|
|
108
|
-
*/
|
|
109
|
-
export declare const propertiesAppliedToPartition: {
|
|
110
|
-
width: boolean;
|
|
111
|
-
height: boolean;
|
|
112
|
-
"block-size": boolean;
|
|
113
|
-
"inline-size": boolean;
|
|
114
|
-
margin: boolean;
|
|
115
|
-
padding: boolean;
|
|
116
|
-
border: boolean;
|
|
117
|
-
outline: boolean;
|
|
118
|
-
"outline-width": boolean;
|
|
119
|
-
"outline-style": boolean;
|
|
120
|
-
"outline-color": boolean;
|
|
121
|
-
};
|
|
122
|
-
/**
|
|
123
|
-
* Represents position of a margin box along the variable dimension of the page.
|
|
124
|
-
* START and END can be interpreted as 'inline-start' and 'inline-end' in
|
|
125
|
-
* horizontal and vertical writing modes. For example, for top margin boxes
|
|
126
|
-
* (@top-left-corner, @top-left, @top-center, @top-right, @top-right-corner),
|
|
127
|
-
* @top-left corresponds to START, @top-center to CENTER, and @top-right to END.
|
|
128
|
-
* The corner boxes (@top-left-corner and @top-right-corner) have a 'null'
|
|
129
|
-
* position.
|
|
130
|
-
* @enum {string}
|
|
131
|
-
*/
|
|
132
|
-
export declare enum MarginBoxPositionAlongVariableDimension {
|
|
133
|
-
START = "start",
|
|
134
|
-
CENTER = "center",
|
|
135
|
-
END = "end"
|
|
136
|
-
}
|
|
137
|
-
export type PageMarginBoxInformation = {
|
|
138
|
-
order: number;
|
|
139
|
-
isInTopRow: boolean;
|
|
140
|
-
isInBottomRow: boolean;
|
|
141
|
-
isInLeftColumn: boolean;
|
|
142
|
-
isInRightColumn: boolean;
|
|
143
|
-
positionAlongVariableDimension: MarginBoxPositionAlongVariableDimension;
|
|
144
|
-
};
|
|
145
|
-
/**
|
|
146
|
-
* Page-margin boxes.
|
|
147
|
-
* @dict
|
|
148
|
-
*/
|
|
149
|
-
export declare const pageMarginBoxes: {
|
|
150
|
-
[key: string]: PageMarginBoxInformation;
|
|
151
|
-
};
|
|
152
|
-
/**
|
|
153
|
-
* Names for page-margin boxes order in the default painting order.
|
|
154
|
-
*/
|
|
155
|
-
export declare const pageMarginBoxNames: string[];
|
|
156
|
-
/**
|
|
157
|
-
* Indicates that the page master is generated for `@page` rules.
|
|
158
|
-
*/
|
|
159
|
-
export declare const pageRuleMasterPseudoName = "vivliostyle-page-rule-master";
|
|
160
|
-
/**
|
|
161
|
-
* Key for properties in margin contexts.
|
|
162
|
-
* Styles in margin contexts are stored in pageStyle["_marginBoxes"][(margin
|
|
163
|
-
* box's name)].
|
|
164
|
-
*/
|
|
165
|
-
export declare const marginBoxesKey: string;
|
|
166
|
-
/**
|
|
167
|
-
* Represent a page master generated for `@page` rules
|
|
168
|
-
* @param style Cascaded style for `@page` rules
|
|
169
|
-
*/
|
|
170
|
-
export declare class PageRuleMaster extends PageMaster.PageMaster<PageRuleMasterInstance> {
|
|
171
|
-
private bodyPartitionKey;
|
|
172
|
-
private pageMarginBoxes;
|
|
173
|
-
constructor(scope: Exprs.LexicalScope, parent: PageMaster.RootPageBox, style: CssCascade.ElementStyle);
|
|
174
|
-
/**
|
|
175
|
-
* Create page-margin boxes
|
|
176
|
-
*/
|
|
177
|
-
createPageMarginBoxes(style: CssCascade.ElementStyle): void;
|
|
178
|
-
/**
|
|
179
|
-
* Transfer cascaded style for `@page` rules to 'specified' style of this
|
|
180
|
-
* PageBox
|
|
181
|
-
*/
|
|
182
|
-
private applySpecified;
|
|
183
|
-
createInstance(parentInstance: any): PageRuleMasterInstance;
|
|
184
|
-
}
|
|
185
|
-
/**
|
|
186
|
-
* Represent a partition placed in a PageRuleMaster
|
|
187
|
-
* @param style Cascaded style for `@page` rules
|
|
188
|
-
*/
|
|
189
|
-
export declare class PageRulePartition extends PageMaster.Partition<PageRulePartitionInstance> {
|
|
190
|
-
readonly pageSize: PageSize;
|
|
191
|
-
constructor(scope: Exprs.LexicalScope, parent: PageRuleMaster, style: CssCascade.ElementStyle, pageSize: PageSize);
|
|
192
|
-
/**
|
|
193
|
-
* Transfer cascaded style for `@page` rules to 'specified' style of this
|
|
194
|
-
* PageBox
|
|
195
|
-
*/
|
|
196
|
-
private applySpecified;
|
|
197
|
-
createInstance(parentInstance: any): PageMaster.PageBoxInstance;
|
|
198
|
-
}
|
|
199
|
-
/**
|
|
200
|
-
* Represent a partition for a page-margin box
|
|
201
|
-
*/
|
|
202
|
-
export declare class PageMarginBoxPartition extends PageMaster.Partition<PageMarginBoxPartitionInstance> {
|
|
203
|
-
readonly marginBoxName: string;
|
|
204
|
-
constructor(scope: Exprs.LexicalScope, parent: PageRuleMaster, marginBoxName: string, style: CssCascade.ElementStyle);
|
|
205
|
-
/**
|
|
206
|
-
* Transfer cascaded style for `@page` rules to 'specified' style of this
|
|
207
|
-
* PageMarginBox
|
|
208
|
-
*/
|
|
209
|
-
applySpecified(style: CssCascade.ElementStyle): void;
|
|
210
|
-
createInstance(parentInstance: any): PageMaster.PageBoxInstance;
|
|
211
|
-
}
|
|
212
|
-
export type PageAreaDimension = {
|
|
213
|
-
borderBoxWidth: Exprs.Val;
|
|
214
|
-
borderBoxHeight: Exprs.Val;
|
|
215
|
-
marginTop: Exprs.Val;
|
|
216
|
-
marginBottom: Exprs.Val;
|
|
217
|
-
marginLeft: Exprs.Val;
|
|
218
|
-
marginRight: Exprs.Val;
|
|
219
|
-
};
|
|
220
|
-
export declare class PageRuleMasterInstance extends PageMaster.PageMasterInstance<PageRuleMaster> {
|
|
221
|
-
pageAreaDimension: PageAreaDimension | null;
|
|
222
|
-
pageMarginBoxInstances: {
|
|
223
|
-
[key: string]: PageMarginBoxPartitionInstance;
|
|
224
|
-
};
|
|
225
|
-
constructor(parentInstance: PageMaster.PageBoxInstance, pageRuleMaster: PageRuleMaster);
|
|
226
|
-
applyCascadeAndInit(cascade: CssCascade.CascadeInstance, docElementStyle: CssCascade.ElementStyle): void;
|
|
227
|
-
initHorizontal(): void;
|
|
228
|
-
initVertical(): void;
|
|
229
|
-
setPageAreaDimension(dim: PageAreaDimension): void;
|
|
230
|
-
adjustPageLayout(context: Exprs.Context, page: Vtree.Page, clientLayout: Vtree.ClientLayout): void;
|
|
231
|
-
/**
|
|
232
|
-
* Determine and set margin boxes' sizes along variable dimension using an
|
|
233
|
-
* algorithm specified in CSS Paged Media spec.
|
|
234
|
-
* @param marginBoxContainers Containers corresponding to the target margin
|
|
235
|
-
* boxes in one page edge (top, bottom, left, right)
|
|
236
|
-
* @param isHorizontal Indicates if the target margin boxes are on the
|
|
237
|
-
* horizontal edge (top or bottom) or not (left or right).
|
|
238
|
-
* @param dimensions Page dimensions. start: margin-left or margin-top. end:
|
|
239
|
-
* margin-right or margin-bottom. extent: border-box width or height of
|
|
240
|
-
* the page area (= available width or height for the target margin boxes)
|
|
241
|
-
*/
|
|
242
|
-
private sizeMarginBoxesAlongVariableDimension;
|
|
243
|
-
private getSizesOfMarginBoxesAlongVariableDimension;
|
|
244
|
-
/**
|
|
245
|
-
* Distribute auto margin sizes among two margin boxes using an algorithm
|
|
246
|
-
* specified in CSS Paged Media spec.
|
|
247
|
-
* @param x Parameter for the first margin box. null if the box is not
|
|
248
|
-
* generated.
|
|
249
|
-
* @param y Parameter for the second margin box. null if the box is not
|
|
250
|
-
* generated.
|
|
251
|
-
* @param availableSize Available size for the margin boxes.
|
|
252
|
-
* @returns Determined sizes for the two boxes. Each value is present only
|
|
253
|
-
* when the size of the corresponding box is 'auto'.
|
|
254
|
-
*/
|
|
255
|
-
private distributeAutoMarginBoxSizes;
|
|
256
|
-
prepareContainer(context: Exprs.Context, container: Vtree.Container, page: Vtree.Page, docFaces: Font.DocumentFaces, clientLayout: Vtree.ClientLayout): void;
|
|
257
|
-
}
|
|
258
|
-
export declare class PageRulePartitionInstance extends PageMaster.PartitionInstance<PageRulePartition> {
|
|
259
|
-
borderBoxWidth: Exprs.Val;
|
|
260
|
-
borderBoxHeight: Exprs.Val;
|
|
261
|
-
marginTop: Exprs.Val;
|
|
262
|
-
marginRight: Exprs.Val;
|
|
263
|
-
marginBottom: Exprs.Val;
|
|
264
|
-
marginLeft: Exprs.Val;
|
|
265
|
-
constructor(parentInstance: PageMaster.PageBoxInstance, pageRulePartition: PageRulePartition);
|
|
266
|
-
applyCascadeAndInit(cascade: CssCascade.CascadeInstance, docElementStyle: CssCascade.ElementStyle): void;
|
|
267
|
-
initHorizontal(): void;
|
|
268
|
-
initVertical(): void;
|
|
269
|
-
/**
|
|
270
|
-
* Calculate page dimensions as specified in CSS Paged Media
|
|
271
|
-
* (http://dev.w3.org/csswg/css-page/#page-model) Page border box extent and
|
|
272
|
-
* margins. Since the containing block can be resized in the over-constrained
|
|
273
|
-
* case, the sum of these values is not necessarily same to the original page
|
|
274
|
-
* dimension specified in the page at-rules.
|
|
275
|
-
*/
|
|
276
|
-
private resolvePageBoxDimensions;
|
|
277
|
-
private hasBorderOrOutline;
|
|
278
|
-
prepareContainer(context: Exprs.Context, container: Vtree.Container, page: Vtree.Page, docFaces: Font.DocumentFaces, clientLayout: Vtree.ClientLayout): void;
|
|
279
|
-
}
|
|
280
|
-
export declare class PageMarginBoxPartitionInstance extends PageMaster.PartitionInstance<PageMarginBoxPartition> {
|
|
281
|
-
boxInfo: PageMarginBoxInformation;
|
|
282
|
-
suppressEmptyBoxGeneration: boolean;
|
|
283
|
-
constructor(parentInstance: PageMaster.PageBoxInstance, pageMarginBoxPartition: PageMarginBoxPartition);
|
|
284
|
-
prepareContainer(context: Exprs.Context, container: Vtree.Container, page: Vtree.Page, docFaces: Font.DocumentFaces, clientLayout: Vtree.ClientLayout): void;
|
|
285
|
-
private applyVerticalAlign;
|
|
286
|
-
/**
|
|
287
|
-
* Calculate page-margin boxes positions along the variable dimension of the
|
|
288
|
-
* page. For CENTER and END margin boxes, the position is calculated only if
|
|
289
|
-
* the dimension (width or height) is non-auto, so that it can be resolved at
|
|
290
|
-
* this point. If the dimension is auto, the calculation is deffered.
|
|
291
|
-
*/
|
|
292
|
-
private positionAlongVariableDimension;
|
|
293
|
-
/**
|
|
294
|
-
* Calculate page-margin boxes positions along the fixed dimension of the
|
|
295
|
-
* page.
|
|
296
|
-
*/
|
|
297
|
-
private positionAndSizeAlongFixedDimension;
|
|
298
|
-
initHorizontal(): void;
|
|
299
|
-
initVertical(): void;
|
|
300
|
-
finishContainer(context: Exprs.Context, container: Vtree.Container, page: Vtree.Page, column: Vtree.Container, columnCount: number, clientLayout: Vtree.ClientLayout, docFaces: Font.DocumentFaces): void;
|
|
301
|
-
}
|
|
302
|
-
/**
|
|
303
|
-
* Dynamically generate and manage page masters corresponding to page at-rules.
|
|
304
|
-
*/
|
|
305
|
-
export declare class PageManager {
|
|
306
|
-
private readonly cascadeInstance;
|
|
307
|
-
private readonly pageScope;
|
|
308
|
-
private readonly rootPageBoxInstance;
|
|
309
|
-
private readonly context;
|
|
310
|
-
private readonly docElementStyle;
|
|
311
|
-
private pageMasterCache;
|
|
312
|
-
constructor(cascadeInstance: CssCascade.CascadeInstance, pageScope: Exprs.LexicalScope, rootPageBoxInstance: PageMaster.RootPageBoxInstance, context: Exprs.Context, docElementStyle: CssCascade.ElementStyle);
|
|
313
|
-
/**
|
|
314
|
-
* Determine the page progression and define left/right/recto/verso pages.
|
|
315
|
-
*/
|
|
316
|
-
private definePageProgression;
|
|
317
|
-
/**
|
|
318
|
-
* Get cascaded page style specified in page context for the current page.
|
|
319
|
-
*/
|
|
320
|
-
getCascadedPageStyle(pageType: string): CssCascade.ElementStyle;
|
|
321
|
-
/**
|
|
322
|
-
* Return a PageMasterInstance with page rules applied. Return a cached
|
|
323
|
-
* instance if there already exists one with the same styles.
|
|
324
|
-
* @param pageMasterInstance The original page master instance.
|
|
325
|
-
* @param cascadedPageStyle Cascaded page style specified in page context.
|
|
326
|
-
*/
|
|
327
|
-
getPageRulePageMaster(pageMasterInstance: PageMaster.PageMasterInstance, cascadedPageStyle: CssCascade.ElementStyle): PageMaster.PageMasterInstance;
|
|
328
|
-
/**
|
|
329
|
-
* Generate a cache key from the specified styles and the original page master
|
|
330
|
-
* key.
|
|
331
|
-
*/
|
|
332
|
-
private makeCacheKey;
|
|
333
|
-
private makeCascadeValueObjectKey;
|
|
334
|
-
private generatePageRuleMaster;
|
|
335
|
-
/**
|
|
336
|
-
* Cascade some properties from `@page` rules to a page master.
|
|
337
|
-
* For now, only 'width' and 'height' resolved from 'size' value are cascaded.
|
|
338
|
-
* @param style Cascaded style in the page context
|
|
339
|
-
* @param pageMaster The original page master
|
|
340
|
-
*/
|
|
341
|
-
private generateCascadedPageMaster;
|
|
342
|
-
}
|
|
343
|
-
export declare class CheckPageTypeAction extends CssCascade.ChainedAction {
|
|
344
|
-
readonly pageType: string;
|
|
345
|
-
constructor(pageType: string);
|
|
346
|
-
apply(cascadeInstance: CssCascade.CascadeInstance): void;
|
|
347
|
-
getPriority(): number;
|
|
348
|
-
makePrimary(cascade: CssCascade.Cascade): boolean;
|
|
349
|
-
}
|
|
350
|
-
export declare class IsFirstPageAction extends CssCascade.ChainedAction {
|
|
351
|
-
readonly scope: Exprs.LexicalScope;
|
|
352
|
-
constructor(scope: Exprs.LexicalScope);
|
|
353
|
-
apply(cascadeInstance: CssCascade.CascadeInstance): void;
|
|
354
|
-
getPriority(): number;
|
|
355
|
-
}
|
|
356
|
-
export declare class IsBlankPageAction extends CssCascade.ChainedAction {
|
|
357
|
-
readonly scope: Exprs.LexicalScope;
|
|
358
|
-
constructor(scope: Exprs.LexicalScope);
|
|
359
|
-
apply(cascadeInstance: CssCascade.CascadeInstance): void;
|
|
360
|
-
getPriority(): number;
|
|
361
|
-
}
|
|
362
|
-
export declare class IsLeftPageAction extends CssCascade.ChainedAction {
|
|
363
|
-
readonly scope: Exprs.LexicalScope;
|
|
364
|
-
constructor(scope: Exprs.LexicalScope);
|
|
365
|
-
apply(cascadeInstance: CssCascade.CascadeInstance): void;
|
|
366
|
-
getPriority(): number;
|
|
367
|
-
}
|
|
368
|
-
export declare class IsRightPageAction extends CssCascade.ChainedAction {
|
|
369
|
-
readonly scope: Exprs.LexicalScope;
|
|
370
|
-
constructor(scope: Exprs.LexicalScope);
|
|
371
|
-
apply(cascadeInstance: CssCascade.CascadeInstance): void;
|
|
372
|
-
getPriority(): number;
|
|
373
|
-
}
|
|
374
|
-
export declare class IsRectoPageAction extends CssCascade.ChainedAction {
|
|
375
|
-
readonly scope: Exprs.LexicalScope;
|
|
376
|
-
constructor(scope: Exprs.LexicalScope);
|
|
377
|
-
apply(cascadeInstance: CssCascade.CascadeInstance): void;
|
|
378
|
-
getPriority(): number;
|
|
379
|
-
}
|
|
380
|
-
export declare class IsVersoPageAction extends CssCascade.ChainedAction {
|
|
381
|
-
readonly scope: Exprs.LexicalScope;
|
|
382
|
-
constructor(scope: Exprs.LexicalScope);
|
|
383
|
-
apply(cascadeInstance: CssCascade.CascadeInstance): void;
|
|
384
|
-
getPriority(): number;
|
|
385
|
-
}
|
|
386
|
-
export declare class IsNthPageAction extends CssCascade.IsNthAction {
|
|
387
|
-
readonly scope: Exprs.LexicalScope;
|
|
388
|
-
readonly a: number;
|
|
389
|
-
readonly b: number;
|
|
390
|
-
constructor(scope: Exprs.LexicalScope, a: number, b: number);
|
|
391
|
-
apply(cascadeInstance: CssCascade.CascadeInstance): void;
|
|
392
|
-
getPriority(): number;
|
|
393
|
-
}
|
|
394
|
-
/**
|
|
395
|
-
* Action applying an at-page rule
|
|
396
|
-
*/
|
|
397
|
-
export declare class ApplyPageRuleAction extends CssCascade.ApplyRuleAction {
|
|
398
|
-
constructor(style: CssCascade.ElementStyle, specificity: number);
|
|
399
|
-
apply(cascadeInstance: CssCascade.CascadeInstance): void;
|
|
400
|
-
}
|
|
401
|
-
/**
|
|
402
|
-
* Merge page styles, including styles specified on page-margin boxes,
|
|
403
|
-
* considering specificity. Intended to be used in place of
|
|
404
|
-
* CssCascade.mergeIn, which is for element styles.
|
|
405
|
-
*/
|
|
406
|
-
export declare function mergeInPageRule(context: Exprs.Context, target: CssCascade.ElementStyle, style: CssCascade.ElementStyle, specificity: number, cascadeInstance: CssCascade.CascadeInstance): void;
|
|
407
|
-
/**
|
|
408
|
-
* ParserHandler for `@page` rules. It handles properties specified with page
|
|
409
|
-
* contexts. It also does basic cascading (which can be done without information
|
|
410
|
-
* other than the page rules themselves) and stores the result in `pageProps`
|
|
411
|
-
* object as a map from page selectors to sets of properties. This result is
|
|
412
|
-
* later used for adding `@page` rules to the real DOM, which are then used by
|
|
413
|
-
* the PDF renderer (Chromium) to determine page sizes.
|
|
414
|
-
*/
|
|
415
|
-
export declare class PageParserHandler extends CssCascade.CascadeParserHandler implements CssValidator.PropertyReceiver {
|
|
416
|
-
private readonly pageProps;
|
|
417
|
-
private currentPageSelectors;
|
|
418
|
-
private currentNamedPageSelector;
|
|
419
|
-
private currentPseudoPageClassSelectors;
|
|
420
|
-
constructor(scope: Exprs.LexicalScope, owner: CssParser.DispatchParserHandler, parent: CssCascade.CascadeParserHandler, validatorSet: CssValidator.ValidatorSet, pageProps: {
|
|
421
|
-
[key: string]: CssCascade.ElementStyle;
|
|
422
|
-
});
|
|
423
|
-
startPageRule(): void;
|
|
424
|
-
tagSelector(ns: string | null, name: string | null): void;
|
|
425
|
-
pseudoclassSelector(name: string, params: (number | string)[]): void;
|
|
426
|
-
/**
|
|
427
|
-
* Save currently processed selector and reset variables.
|
|
428
|
-
*/
|
|
429
|
-
private finishSelector;
|
|
430
|
-
nextSelector(): void;
|
|
431
|
-
startRuleBody(): void;
|
|
432
|
-
simpleProperty(name: string, value: Css.Val, important: any): void;
|
|
433
|
-
insertNonPrimary(action: CssCascade.CascadeAction): void;
|
|
434
|
-
makeApplyRuleAction(specificity: number): CssCascade.ApplyRuleAction;
|
|
435
|
-
startPageMarginBoxRule(name: string): void;
|
|
436
|
-
}
|
|
437
|
-
/**
|
|
438
|
-
* Parser handler for a page-margin box rule.
|
|
439
|
-
*/
|
|
440
|
-
export declare class PageMarginBoxParserHandler extends CssParser.SlaveParserHandler implements CssValidator.PropertyReceiver {
|
|
441
|
-
readonly validatorSet: CssValidator.ValidatorSet;
|
|
442
|
-
readonly boxStyle: CssCascade.ElementStyle;
|
|
443
|
-
constructor(scope: Exprs.LexicalScope, owner: CssParser.DispatchParserHandler, validatorSet: CssValidator.ValidatorSet, boxStyle: CssCascade.ElementStyle);
|
|
444
|
-
property(name: string, value: Css.Val, important: boolean): void;
|
|
445
|
-
/** @override */
|
|
446
|
-
invalidPropertyValue(name: string, value: Css.Val): void;
|
|
447
|
-
/** @override */
|
|
448
|
-
unknownProperty(name: string, value: Css.Val): void;
|
|
449
|
-
/** @override */
|
|
450
|
-
simpleProperty(name: string, value: Css.Val, important: any): void;
|
|
451
|
-
}
|
|
1
|
+
import * as Constants from "./constants";
|
|
2
|
+
import * as Css from "./css";
|
|
3
|
+
import * as CssCascade from "./css-cascade";
|
|
4
|
+
import * as CssParser from "./css-parser";
|
|
5
|
+
import * as CssValidator from "./css-validator";
|
|
6
|
+
import * as Exprs from "./exprs";
|
|
7
|
+
import * as Font from "./font";
|
|
8
|
+
import * as PageMaster from "./page-master";
|
|
9
|
+
import * as Vtree from "./vtree";
|
|
10
|
+
/**
|
|
11
|
+
* Resolve page progression direction from writing-mode and direction.
|
|
12
|
+
*/
|
|
13
|
+
export declare function resolvePageProgression(style: CssCascade.ElementStyle): Constants.PageProgression;
|
|
14
|
+
export type PageSize = {
|
|
15
|
+
width: Css.Numeric;
|
|
16
|
+
height: Css.Numeric;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Named page sizes.
|
|
20
|
+
*/
|
|
21
|
+
export declare const pageSizes: {
|
|
22
|
+
[key: string]: PageSize;
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Default value for line width of printer marks
|
|
26
|
+
*/
|
|
27
|
+
export declare const defaultPrinterMarkLineWidth: Css.Numeric;
|
|
28
|
+
/**
|
|
29
|
+
* Default value for distance between an edge of the page and printer marks
|
|
30
|
+
*/
|
|
31
|
+
export declare const defaultPrinterMarkOffset: Css.Numeric;
|
|
32
|
+
/**
|
|
33
|
+
* Default value for line length of the (shorter) line of a crop mark and the
|
|
34
|
+
* shorter line of a cross mark
|
|
35
|
+
*/
|
|
36
|
+
export declare const defaultPrinterMarkLineLength: Css.Numeric;
|
|
37
|
+
/**
|
|
38
|
+
* Default value for bleed offset (= defaultPrinterMarkOffset +
|
|
39
|
+
* defaultPrinterMarkLineLength)
|
|
40
|
+
*/
|
|
41
|
+
export declare const defaultBleedOffset: Css.Numeric;
|
|
42
|
+
export type PageSizeAndBleed = {
|
|
43
|
+
width: Css.Numeric;
|
|
44
|
+
height: Css.Numeric;
|
|
45
|
+
bleed: Css.Numeric;
|
|
46
|
+
bleedOffset: Css.Numeric;
|
|
47
|
+
cropOffset: Css.Numeric;
|
|
48
|
+
};
|
|
49
|
+
export declare function resolvePageSizeAndBleed(style: {
|
|
50
|
+
[key: string]: CssCascade.CascadeValue;
|
|
51
|
+
}): PageSizeAndBleed;
|
|
52
|
+
export type EvaluatedPageSizeAndBleed = {
|
|
53
|
+
pageWidth: number;
|
|
54
|
+
pageHeight: number;
|
|
55
|
+
bleed: number;
|
|
56
|
+
bleedOffset: number;
|
|
57
|
+
cropOffset: number;
|
|
58
|
+
};
|
|
59
|
+
/**
|
|
60
|
+
* Evaluate actual page width, height and bleed from style specified in page
|
|
61
|
+
* context.
|
|
62
|
+
*/
|
|
63
|
+
export declare function evaluatePageSizeAndBleed(pageSizeAndBleed: PageSizeAndBleed, context: Exprs.Context): EvaluatedPageSizeAndBleed;
|
|
64
|
+
/**
|
|
65
|
+
* Create an 'svg' element for a printer mark.
|
|
66
|
+
*/
|
|
67
|
+
export declare function createPrinterMarkSvg(doc: Document, width: number, height: number): Element;
|
|
68
|
+
/**
|
|
69
|
+
* Create an SVG element for a printer mark line.
|
|
70
|
+
* @param elementType Specifies which type of element to create. Default value
|
|
71
|
+
* is "polyline".
|
|
72
|
+
*/
|
|
73
|
+
export declare function createPrinterMarkElement(doc: Document, lineWidth: number, elementType?: string): Element;
|
|
74
|
+
/**
|
|
75
|
+
* Position of a corner mark
|
|
76
|
+
* @enum {string}
|
|
77
|
+
*/
|
|
78
|
+
export declare enum CornerMarkPosition {
|
|
79
|
+
TOP_LEFT = "top left",
|
|
80
|
+
TOP_RIGHT = "top right",
|
|
81
|
+
BOTTOM_LEFT = "bottom left",
|
|
82
|
+
BOTTOM_RIGHT = "bottom right"
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Create a corner mark.
|
|
86
|
+
*/
|
|
87
|
+
export declare function createCornerMark(doc: Document, position: CornerMarkPosition, lineWidth: number, cropMarkLineLength: number, bleed: number, offset: number): Element;
|
|
88
|
+
/**
|
|
89
|
+
* Position of a cross mark
|
|
90
|
+
* @enum {string}
|
|
91
|
+
*/
|
|
92
|
+
export declare enum CrossMarkPosition {
|
|
93
|
+
TOP = "top",
|
|
94
|
+
BOTTOM = "bottom",
|
|
95
|
+
LEFT = "left",
|
|
96
|
+
RIGHT = "right"
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Create a cross mark.
|
|
100
|
+
*/
|
|
101
|
+
export declare function createCrossMark(doc: Document, position: CrossMarkPosition, lineWidth: number, lineLength: number, offset: number): Element;
|
|
102
|
+
/**
|
|
103
|
+
* Add printer marks to the page.
|
|
104
|
+
*/
|
|
105
|
+
export declare function addPrinterMarks(cascadedPageStyle: CssCascade.ElementStyle, evaluatedPageSizeAndBleed: EvaluatedPageSizeAndBleed, page: Vtree.Page, context: Exprs.Context): void;
|
|
106
|
+
/**
|
|
107
|
+
* Properties transfered from the PageRuleMaster to the PageRulePartition
|
|
108
|
+
*/
|
|
109
|
+
export declare const propertiesAppliedToPartition: {
|
|
110
|
+
width: boolean;
|
|
111
|
+
height: boolean;
|
|
112
|
+
"block-size": boolean;
|
|
113
|
+
"inline-size": boolean;
|
|
114
|
+
margin: boolean;
|
|
115
|
+
padding: boolean;
|
|
116
|
+
border: boolean;
|
|
117
|
+
outline: boolean;
|
|
118
|
+
"outline-width": boolean;
|
|
119
|
+
"outline-style": boolean;
|
|
120
|
+
"outline-color": boolean;
|
|
121
|
+
};
|
|
122
|
+
/**
|
|
123
|
+
* Represents position of a margin box along the variable dimension of the page.
|
|
124
|
+
* START and END can be interpreted as 'inline-start' and 'inline-end' in
|
|
125
|
+
* horizontal and vertical writing modes. For example, for top margin boxes
|
|
126
|
+
* (@top-left-corner, @top-left, @top-center, @top-right, @top-right-corner),
|
|
127
|
+
* @top-left corresponds to START, @top-center to CENTER, and @top-right to END.
|
|
128
|
+
* The corner boxes (@top-left-corner and @top-right-corner) have a 'null'
|
|
129
|
+
* position.
|
|
130
|
+
* @enum {string}
|
|
131
|
+
*/
|
|
132
|
+
export declare enum MarginBoxPositionAlongVariableDimension {
|
|
133
|
+
START = "start",
|
|
134
|
+
CENTER = "center",
|
|
135
|
+
END = "end"
|
|
136
|
+
}
|
|
137
|
+
export type PageMarginBoxInformation = {
|
|
138
|
+
order: number;
|
|
139
|
+
isInTopRow: boolean;
|
|
140
|
+
isInBottomRow: boolean;
|
|
141
|
+
isInLeftColumn: boolean;
|
|
142
|
+
isInRightColumn: boolean;
|
|
143
|
+
positionAlongVariableDimension: MarginBoxPositionAlongVariableDimension;
|
|
144
|
+
};
|
|
145
|
+
/**
|
|
146
|
+
* Page-margin boxes.
|
|
147
|
+
* @dict
|
|
148
|
+
*/
|
|
149
|
+
export declare const pageMarginBoxes: {
|
|
150
|
+
[key: string]: PageMarginBoxInformation;
|
|
151
|
+
};
|
|
152
|
+
/**
|
|
153
|
+
* Names for page-margin boxes order in the default painting order.
|
|
154
|
+
*/
|
|
155
|
+
export declare const pageMarginBoxNames: string[];
|
|
156
|
+
/**
|
|
157
|
+
* Indicates that the page master is generated for `@page` rules.
|
|
158
|
+
*/
|
|
159
|
+
export declare const pageRuleMasterPseudoName = "vivliostyle-page-rule-master";
|
|
160
|
+
/**
|
|
161
|
+
* Key for properties in margin contexts.
|
|
162
|
+
* Styles in margin contexts are stored in pageStyle["_marginBoxes"][(margin
|
|
163
|
+
* box's name)].
|
|
164
|
+
*/
|
|
165
|
+
export declare const marginBoxesKey: string;
|
|
166
|
+
/**
|
|
167
|
+
* Represent a page master generated for `@page` rules
|
|
168
|
+
* @param style Cascaded style for `@page` rules
|
|
169
|
+
*/
|
|
170
|
+
export declare class PageRuleMaster extends PageMaster.PageMaster<PageRuleMasterInstance> {
|
|
171
|
+
private bodyPartitionKey;
|
|
172
|
+
private pageMarginBoxes;
|
|
173
|
+
constructor(scope: Exprs.LexicalScope, parent: PageMaster.RootPageBox, style: CssCascade.ElementStyle);
|
|
174
|
+
/**
|
|
175
|
+
* Create page-margin boxes
|
|
176
|
+
*/
|
|
177
|
+
createPageMarginBoxes(style: CssCascade.ElementStyle): void;
|
|
178
|
+
/**
|
|
179
|
+
* Transfer cascaded style for `@page` rules to 'specified' style of this
|
|
180
|
+
* PageBox
|
|
181
|
+
*/
|
|
182
|
+
private applySpecified;
|
|
183
|
+
createInstance(parentInstance: any): PageRuleMasterInstance;
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* Represent a partition placed in a PageRuleMaster
|
|
187
|
+
* @param style Cascaded style for `@page` rules
|
|
188
|
+
*/
|
|
189
|
+
export declare class PageRulePartition extends PageMaster.Partition<PageRulePartitionInstance> {
|
|
190
|
+
readonly pageSize: PageSize;
|
|
191
|
+
constructor(scope: Exprs.LexicalScope, parent: PageRuleMaster, style: CssCascade.ElementStyle, pageSize: PageSize);
|
|
192
|
+
/**
|
|
193
|
+
* Transfer cascaded style for `@page` rules to 'specified' style of this
|
|
194
|
+
* PageBox
|
|
195
|
+
*/
|
|
196
|
+
private applySpecified;
|
|
197
|
+
createInstance(parentInstance: any): PageMaster.PageBoxInstance;
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* Represent a partition for a page-margin box
|
|
201
|
+
*/
|
|
202
|
+
export declare class PageMarginBoxPartition extends PageMaster.Partition<PageMarginBoxPartitionInstance> {
|
|
203
|
+
readonly marginBoxName: string;
|
|
204
|
+
constructor(scope: Exprs.LexicalScope, parent: PageRuleMaster, marginBoxName: string, style: CssCascade.ElementStyle);
|
|
205
|
+
/**
|
|
206
|
+
* Transfer cascaded style for `@page` rules to 'specified' style of this
|
|
207
|
+
* PageMarginBox
|
|
208
|
+
*/
|
|
209
|
+
applySpecified(style: CssCascade.ElementStyle): void;
|
|
210
|
+
createInstance(parentInstance: any): PageMaster.PageBoxInstance;
|
|
211
|
+
}
|
|
212
|
+
export type PageAreaDimension = {
|
|
213
|
+
borderBoxWidth: Exprs.Val;
|
|
214
|
+
borderBoxHeight: Exprs.Val;
|
|
215
|
+
marginTop: Exprs.Val;
|
|
216
|
+
marginBottom: Exprs.Val;
|
|
217
|
+
marginLeft: Exprs.Val;
|
|
218
|
+
marginRight: Exprs.Val;
|
|
219
|
+
};
|
|
220
|
+
export declare class PageRuleMasterInstance extends PageMaster.PageMasterInstance<PageRuleMaster> {
|
|
221
|
+
pageAreaDimension: PageAreaDimension | null;
|
|
222
|
+
pageMarginBoxInstances: {
|
|
223
|
+
[key: string]: PageMarginBoxPartitionInstance;
|
|
224
|
+
};
|
|
225
|
+
constructor(parentInstance: PageMaster.PageBoxInstance, pageRuleMaster: PageRuleMaster);
|
|
226
|
+
applyCascadeAndInit(cascade: CssCascade.CascadeInstance, docElementStyle: CssCascade.ElementStyle): void;
|
|
227
|
+
initHorizontal(): void;
|
|
228
|
+
initVertical(): void;
|
|
229
|
+
setPageAreaDimension(dim: PageAreaDimension): void;
|
|
230
|
+
adjustPageLayout(context: Exprs.Context, page: Vtree.Page, clientLayout: Vtree.ClientLayout): void;
|
|
231
|
+
/**
|
|
232
|
+
* Determine and set margin boxes' sizes along variable dimension using an
|
|
233
|
+
* algorithm specified in CSS Paged Media spec.
|
|
234
|
+
* @param marginBoxContainers Containers corresponding to the target margin
|
|
235
|
+
* boxes in one page edge (top, bottom, left, right)
|
|
236
|
+
* @param isHorizontal Indicates if the target margin boxes are on the
|
|
237
|
+
* horizontal edge (top or bottom) or not (left or right).
|
|
238
|
+
* @param dimensions Page dimensions. start: margin-left or margin-top. end:
|
|
239
|
+
* margin-right or margin-bottom. extent: border-box width or height of
|
|
240
|
+
* the page area (= available width or height for the target margin boxes)
|
|
241
|
+
*/
|
|
242
|
+
private sizeMarginBoxesAlongVariableDimension;
|
|
243
|
+
private getSizesOfMarginBoxesAlongVariableDimension;
|
|
244
|
+
/**
|
|
245
|
+
* Distribute auto margin sizes among two margin boxes using an algorithm
|
|
246
|
+
* specified in CSS Paged Media spec.
|
|
247
|
+
* @param x Parameter for the first margin box. null if the box is not
|
|
248
|
+
* generated.
|
|
249
|
+
* @param y Parameter for the second margin box. null if the box is not
|
|
250
|
+
* generated.
|
|
251
|
+
* @param availableSize Available size for the margin boxes.
|
|
252
|
+
* @returns Determined sizes for the two boxes. Each value is present only
|
|
253
|
+
* when the size of the corresponding box is 'auto'.
|
|
254
|
+
*/
|
|
255
|
+
private distributeAutoMarginBoxSizes;
|
|
256
|
+
prepareContainer(context: Exprs.Context, container: Vtree.Container, page: Vtree.Page, docFaces: Font.DocumentFaces, clientLayout: Vtree.ClientLayout): void;
|
|
257
|
+
}
|
|
258
|
+
export declare class PageRulePartitionInstance extends PageMaster.PartitionInstance<PageRulePartition> {
|
|
259
|
+
borderBoxWidth: Exprs.Val;
|
|
260
|
+
borderBoxHeight: Exprs.Val;
|
|
261
|
+
marginTop: Exprs.Val;
|
|
262
|
+
marginRight: Exprs.Val;
|
|
263
|
+
marginBottom: Exprs.Val;
|
|
264
|
+
marginLeft: Exprs.Val;
|
|
265
|
+
constructor(parentInstance: PageMaster.PageBoxInstance, pageRulePartition: PageRulePartition);
|
|
266
|
+
applyCascadeAndInit(cascade: CssCascade.CascadeInstance, docElementStyle: CssCascade.ElementStyle): void;
|
|
267
|
+
initHorizontal(): void;
|
|
268
|
+
initVertical(): void;
|
|
269
|
+
/**
|
|
270
|
+
* Calculate page dimensions as specified in CSS Paged Media
|
|
271
|
+
* (http://dev.w3.org/csswg/css-page/#page-model) Page border box extent and
|
|
272
|
+
* margins. Since the containing block can be resized in the over-constrained
|
|
273
|
+
* case, the sum of these values is not necessarily same to the original page
|
|
274
|
+
* dimension specified in the page at-rules.
|
|
275
|
+
*/
|
|
276
|
+
private resolvePageBoxDimensions;
|
|
277
|
+
private hasBorderOrOutline;
|
|
278
|
+
prepareContainer(context: Exprs.Context, container: Vtree.Container, page: Vtree.Page, docFaces: Font.DocumentFaces, clientLayout: Vtree.ClientLayout): void;
|
|
279
|
+
}
|
|
280
|
+
export declare class PageMarginBoxPartitionInstance extends PageMaster.PartitionInstance<PageMarginBoxPartition> {
|
|
281
|
+
boxInfo: PageMarginBoxInformation;
|
|
282
|
+
suppressEmptyBoxGeneration: boolean;
|
|
283
|
+
constructor(parentInstance: PageMaster.PageBoxInstance, pageMarginBoxPartition: PageMarginBoxPartition);
|
|
284
|
+
prepareContainer(context: Exprs.Context, container: Vtree.Container, page: Vtree.Page, docFaces: Font.DocumentFaces, clientLayout: Vtree.ClientLayout): void;
|
|
285
|
+
private applyVerticalAlign;
|
|
286
|
+
/**
|
|
287
|
+
* Calculate page-margin boxes positions along the variable dimension of the
|
|
288
|
+
* page. For CENTER and END margin boxes, the position is calculated only if
|
|
289
|
+
* the dimension (width or height) is non-auto, so that it can be resolved at
|
|
290
|
+
* this point. If the dimension is auto, the calculation is deffered.
|
|
291
|
+
*/
|
|
292
|
+
private positionAlongVariableDimension;
|
|
293
|
+
/**
|
|
294
|
+
* Calculate page-margin boxes positions along the fixed dimension of the
|
|
295
|
+
* page.
|
|
296
|
+
*/
|
|
297
|
+
private positionAndSizeAlongFixedDimension;
|
|
298
|
+
initHorizontal(): void;
|
|
299
|
+
initVertical(): void;
|
|
300
|
+
finishContainer(context: Exprs.Context, container: Vtree.Container, page: Vtree.Page, column: Vtree.Container, columnCount: number, clientLayout: Vtree.ClientLayout, docFaces: Font.DocumentFaces): void;
|
|
301
|
+
}
|
|
302
|
+
/**
|
|
303
|
+
* Dynamically generate and manage page masters corresponding to page at-rules.
|
|
304
|
+
*/
|
|
305
|
+
export declare class PageManager {
|
|
306
|
+
private readonly cascadeInstance;
|
|
307
|
+
private readonly pageScope;
|
|
308
|
+
private readonly rootPageBoxInstance;
|
|
309
|
+
private readonly context;
|
|
310
|
+
private readonly docElementStyle;
|
|
311
|
+
private pageMasterCache;
|
|
312
|
+
constructor(cascadeInstance: CssCascade.CascadeInstance, pageScope: Exprs.LexicalScope, rootPageBoxInstance: PageMaster.RootPageBoxInstance, context: Exprs.Context, docElementStyle: CssCascade.ElementStyle);
|
|
313
|
+
/**
|
|
314
|
+
* Determine the page progression and define left/right/recto/verso pages.
|
|
315
|
+
*/
|
|
316
|
+
private definePageProgression;
|
|
317
|
+
/**
|
|
318
|
+
* Get cascaded page style specified in page context for the current page.
|
|
319
|
+
*/
|
|
320
|
+
getCascadedPageStyle(pageType: string): CssCascade.ElementStyle;
|
|
321
|
+
/**
|
|
322
|
+
* Return a PageMasterInstance with page rules applied. Return a cached
|
|
323
|
+
* instance if there already exists one with the same styles.
|
|
324
|
+
* @param pageMasterInstance The original page master instance.
|
|
325
|
+
* @param cascadedPageStyle Cascaded page style specified in page context.
|
|
326
|
+
*/
|
|
327
|
+
getPageRulePageMaster(pageMasterInstance: PageMaster.PageMasterInstance, cascadedPageStyle: CssCascade.ElementStyle): PageMaster.PageMasterInstance;
|
|
328
|
+
/**
|
|
329
|
+
* Generate a cache key from the specified styles and the original page master
|
|
330
|
+
* key.
|
|
331
|
+
*/
|
|
332
|
+
private makeCacheKey;
|
|
333
|
+
private makeCascadeValueObjectKey;
|
|
334
|
+
private generatePageRuleMaster;
|
|
335
|
+
/**
|
|
336
|
+
* Cascade some properties from `@page` rules to a page master.
|
|
337
|
+
* For now, only 'width' and 'height' resolved from 'size' value are cascaded.
|
|
338
|
+
* @param style Cascaded style in the page context
|
|
339
|
+
* @param pageMaster The original page master
|
|
340
|
+
*/
|
|
341
|
+
private generateCascadedPageMaster;
|
|
342
|
+
}
|
|
343
|
+
export declare class CheckPageTypeAction extends CssCascade.ChainedAction {
|
|
344
|
+
readonly pageType: string;
|
|
345
|
+
constructor(pageType: string);
|
|
346
|
+
apply(cascadeInstance: CssCascade.CascadeInstance): void;
|
|
347
|
+
getPriority(): number;
|
|
348
|
+
makePrimary(cascade: CssCascade.Cascade): boolean;
|
|
349
|
+
}
|
|
350
|
+
export declare class IsFirstPageAction extends CssCascade.ChainedAction {
|
|
351
|
+
readonly scope: Exprs.LexicalScope;
|
|
352
|
+
constructor(scope: Exprs.LexicalScope);
|
|
353
|
+
apply(cascadeInstance: CssCascade.CascadeInstance): void;
|
|
354
|
+
getPriority(): number;
|
|
355
|
+
}
|
|
356
|
+
export declare class IsBlankPageAction extends CssCascade.ChainedAction {
|
|
357
|
+
readonly scope: Exprs.LexicalScope;
|
|
358
|
+
constructor(scope: Exprs.LexicalScope);
|
|
359
|
+
apply(cascadeInstance: CssCascade.CascadeInstance): void;
|
|
360
|
+
getPriority(): number;
|
|
361
|
+
}
|
|
362
|
+
export declare class IsLeftPageAction extends CssCascade.ChainedAction {
|
|
363
|
+
readonly scope: Exprs.LexicalScope;
|
|
364
|
+
constructor(scope: Exprs.LexicalScope);
|
|
365
|
+
apply(cascadeInstance: CssCascade.CascadeInstance): void;
|
|
366
|
+
getPriority(): number;
|
|
367
|
+
}
|
|
368
|
+
export declare class IsRightPageAction extends CssCascade.ChainedAction {
|
|
369
|
+
readonly scope: Exprs.LexicalScope;
|
|
370
|
+
constructor(scope: Exprs.LexicalScope);
|
|
371
|
+
apply(cascadeInstance: CssCascade.CascadeInstance): void;
|
|
372
|
+
getPriority(): number;
|
|
373
|
+
}
|
|
374
|
+
export declare class IsRectoPageAction extends CssCascade.ChainedAction {
|
|
375
|
+
readonly scope: Exprs.LexicalScope;
|
|
376
|
+
constructor(scope: Exprs.LexicalScope);
|
|
377
|
+
apply(cascadeInstance: CssCascade.CascadeInstance): void;
|
|
378
|
+
getPriority(): number;
|
|
379
|
+
}
|
|
380
|
+
export declare class IsVersoPageAction extends CssCascade.ChainedAction {
|
|
381
|
+
readonly scope: Exprs.LexicalScope;
|
|
382
|
+
constructor(scope: Exprs.LexicalScope);
|
|
383
|
+
apply(cascadeInstance: CssCascade.CascadeInstance): void;
|
|
384
|
+
getPriority(): number;
|
|
385
|
+
}
|
|
386
|
+
export declare class IsNthPageAction extends CssCascade.IsNthAction {
|
|
387
|
+
readonly scope: Exprs.LexicalScope;
|
|
388
|
+
readonly a: number;
|
|
389
|
+
readonly b: number;
|
|
390
|
+
constructor(scope: Exprs.LexicalScope, a: number, b: number);
|
|
391
|
+
apply(cascadeInstance: CssCascade.CascadeInstance): void;
|
|
392
|
+
getPriority(): number;
|
|
393
|
+
}
|
|
394
|
+
/**
|
|
395
|
+
* Action applying an at-page rule
|
|
396
|
+
*/
|
|
397
|
+
export declare class ApplyPageRuleAction extends CssCascade.ApplyRuleAction {
|
|
398
|
+
constructor(style: CssCascade.ElementStyle, specificity: number);
|
|
399
|
+
apply(cascadeInstance: CssCascade.CascadeInstance): void;
|
|
400
|
+
}
|
|
401
|
+
/**
|
|
402
|
+
* Merge page styles, including styles specified on page-margin boxes,
|
|
403
|
+
* considering specificity. Intended to be used in place of
|
|
404
|
+
* CssCascade.mergeIn, which is for element styles.
|
|
405
|
+
*/
|
|
406
|
+
export declare function mergeInPageRule(context: Exprs.Context, target: CssCascade.ElementStyle, style: CssCascade.ElementStyle, specificity: number, cascadeInstance: CssCascade.CascadeInstance): void;
|
|
407
|
+
/**
|
|
408
|
+
* ParserHandler for `@page` rules. It handles properties specified with page
|
|
409
|
+
* contexts. It also does basic cascading (which can be done without information
|
|
410
|
+
* other than the page rules themselves) and stores the result in `pageProps`
|
|
411
|
+
* object as a map from page selectors to sets of properties. This result is
|
|
412
|
+
* later used for adding `@page` rules to the real DOM, which are then used by
|
|
413
|
+
* the PDF renderer (Chromium) to determine page sizes.
|
|
414
|
+
*/
|
|
415
|
+
export declare class PageParserHandler extends CssCascade.CascadeParserHandler implements CssValidator.PropertyReceiver {
|
|
416
|
+
private readonly pageProps;
|
|
417
|
+
private currentPageSelectors;
|
|
418
|
+
private currentNamedPageSelector;
|
|
419
|
+
private currentPseudoPageClassSelectors;
|
|
420
|
+
constructor(scope: Exprs.LexicalScope, owner: CssParser.DispatchParserHandler, parent: CssCascade.CascadeParserHandler, validatorSet: CssValidator.ValidatorSet, pageProps: {
|
|
421
|
+
[key: string]: CssCascade.ElementStyle;
|
|
422
|
+
});
|
|
423
|
+
startPageRule(): void;
|
|
424
|
+
tagSelector(ns: string | null, name: string | null): void;
|
|
425
|
+
pseudoclassSelector(name: string, params: (number | string)[]): void;
|
|
426
|
+
/**
|
|
427
|
+
* Save currently processed selector and reset variables.
|
|
428
|
+
*/
|
|
429
|
+
private finishSelector;
|
|
430
|
+
nextSelector(): void;
|
|
431
|
+
startRuleBody(): void;
|
|
432
|
+
simpleProperty(name: string, value: Css.Val, important: any): void;
|
|
433
|
+
insertNonPrimary(action: CssCascade.CascadeAction): void;
|
|
434
|
+
makeApplyRuleAction(specificity: number): CssCascade.ApplyRuleAction;
|
|
435
|
+
startPageMarginBoxRule(name: string): void;
|
|
436
|
+
}
|
|
437
|
+
/**
|
|
438
|
+
* Parser handler for a page-margin box rule.
|
|
439
|
+
*/
|
|
440
|
+
export declare class PageMarginBoxParserHandler extends CssParser.SlaveParserHandler implements CssValidator.PropertyReceiver {
|
|
441
|
+
readonly validatorSet: CssValidator.ValidatorSet;
|
|
442
|
+
readonly boxStyle: CssCascade.ElementStyle;
|
|
443
|
+
constructor(scope: Exprs.LexicalScope, owner: CssParser.DispatchParserHandler, validatorSet: CssValidator.ValidatorSet, boxStyle: CssCascade.ElementStyle);
|
|
444
|
+
property(name: string, value: Css.Val, important: boolean): void;
|
|
445
|
+
/** @override */
|
|
446
|
+
invalidPropertyValue(name: string, value: Css.Val): void;
|
|
447
|
+
/** @override */
|
|
448
|
+
unknownProperty(name: string, value: Css.Val): void;
|
|
449
|
+
/** @override */
|
|
450
|
+
simpleProperty(name: string, value: Css.Val, important: any): void;
|
|
451
|
+
}
|