@vivliostyle/core 2.24.2 → 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 -450
- 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,392 +1,392 @@
|
|
|
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 Vtree - Basic view tree data structures and support utilities.
|
|
20
|
-
*/
|
|
21
|
-
import * as Base from "./base";
|
|
22
|
-
import * as Constants from "./constants";
|
|
23
|
-
import * as Css from "./css";
|
|
24
|
-
import * as Diff from "./diff";
|
|
25
|
-
import * as Exprs from "./exprs";
|
|
26
|
-
import * as GeometryUtil from "./geometry-util";
|
|
27
|
-
import * as TaskUtil from "./task-util";
|
|
28
|
-
import { CssStyler, PageFloats, Selectors, Vtree, XmlDoc } from "./types";
|
|
29
|
-
export declare const delayedProps: {
|
|
30
|
-
transform: boolean;
|
|
31
|
-
"transform-origin": boolean;
|
|
32
|
-
};
|
|
33
|
-
export declare const delayedPropsIfRelativePositioned: {
|
|
34
|
-
top: boolean;
|
|
35
|
-
bottom: boolean;
|
|
36
|
-
left: boolean;
|
|
37
|
-
right: boolean;
|
|
38
|
-
};
|
|
39
|
-
export declare class DelayedItem {
|
|
40
|
-
target: Element;
|
|
41
|
-
name: string;
|
|
42
|
-
value: Css.Val;
|
|
43
|
-
constructor(target: Element, name: string, value: Css.Val);
|
|
44
|
-
}
|
|
45
|
-
export
|
|
46
|
-
type: string;
|
|
47
|
-
target: any;
|
|
48
|
-
currentTarget: any;
|
|
49
|
-
anchorElement: Element;
|
|
50
|
-
href: string;
|
|
51
|
-
};
|
|
52
|
-
export
|
|
53
|
-
observer: string;
|
|
54
|
-
event: string;
|
|
55
|
-
action: string;
|
|
56
|
-
ref: string;
|
|
57
|
-
};
|
|
58
|
-
export declare const actions: {
|
|
59
|
-
show: (obj: any) => void;
|
|
60
|
-
hide: (obj: any) => void;
|
|
61
|
-
play: (obj: any) => void;
|
|
62
|
-
pause: (obj: any) => void;
|
|
63
|
-
resume: (obj: any) => void;
|
|
64
|
-
mute: (obj: any) => void;
|
|
65
|
-
unmute: (obj: any) => void;
|
|
66
|
-
};
|
|
67
|
-
export declare function makeListener(refs: Element[], action: string): EventListener | null;
|
|
68
|
-
export declare class Page extends Base.SimpleEventTarget {
|
|
69
|
-
readonly container: HTMLElement;
|
|
70
|
-
readonly bleedBox: HTMLElement;
|
|
71
|
-
private static AUTO_PAGE_WIDTH_ATTRIBUTE;
|
|
72
|
-
private static AUTO_PAGE_HEIGHT_ATTRIBUTE;
|
|
73
|
-
pageAreaElement: HTMLElement | null;
|
|
74
|
-
delayedItems: DelayedItem[];
|
|
75
|
-
hrefHandler: (e: Event) => void;
|
|
76
|
-
elementsById: {
|
|
77
|
-
[key: string]: Element[];
|
|
78
|
-
};
|
|
79
|
-
dimensions: {
|
|
80
|
-
width: number;
|
|
81
|
-
height: number;
|
|
82
|
-
};
|
|
83
|
-
isFirstPage: boolean;
|
|
84
|
-
isLastPage: boolean;
|
|
85
|
-
isBlankPage: boolean;
|
|
86
|
-
isAutoPageWidth: boolean;
|
|
87
|
-
isAutoPageHeight: boolean;
|
|
88
|
-
spineIndex: number;
|
|
89
|
-
position: LayoutPosition;
|
|
90
|
-
offset: number;
|
|
91
|
-
side: Constants.PageSide | null;
|
|
92
|
-
fetchers: TaskUtil.Fetcher<{}>[];
|
|
93
|
-
marginBoxes: {
|
|
94
|
-
top: {
|
|
95
|
-
[key: string]: Container;
|
|
96
|
-
};
|
|
97
|
-
bottom: {
|
|
98
|
-
[key: string]: Container;
|
|
99
|
-
};
|
|
100
|
-
left: {
|
|
101
|
-
[key: string]: Container;
|
|
102
|
-
};
|
|
103
|
-
right: {
|
|
104
|
-
[key: string]: Container;
|
|
105
|
-
};
|
|
106
|
-
};
|
|
107
|
-
pageType: string | null;
|
|
108
|
-
constructor(container: HTMLElement, bleedBox: HTMLElement);
|
|
109
|
-
setAutoPageWidth(isAuto: boolean): void;
|
|
110
|
-
setAutoPageHeight(isAuto: boolean): void;
|
|
111
|
-
registerElementWithId(element: Element, id: string): void;
|
|
112
|
-
finish(triggers: Trigger[], clientLayout: ClientLayout): void;
|
|
113
|
-
}
|
|
114
|
-
export
|
|
115
|
-
left: Page;
|
|
116
|
-
right: Page;
|
|
117
|
-
};
|
|
118
|
-
/**
|
|
119
|
-
* Marks an element as "special". It should not be used in bbox calculations.
|
|
120
|
-
*/
|
|
121
|
-
export declare const SPECIAL_ATTR = "data-adapt-spec";
|
|
122
|
-
export declare const Whitespace: typeof Vtree.Whitespace;
|
|
123
|
-
export
|
|
124
|
-
/**
|
|
125
|
-
* Resolves Whitespace value from a value of 'white-space' property
|
|
126
|
-
* @param whitespace The value of 'white-space' property
|
|
127
|
-
*/
|
|
128
|
-
export declare function whitespaceFromPropertyValue(whitespace: string): Whitespace | null;
|
|
129
|
-
export declare function canIgnore(node: Node, whitespace?: Whitespace): boolean;
|
|
130
|
-
export declare class Flow {
|
|
131
|
-
readonly flowName: string;
|
|
132
|
-
readonly parentFlowName: string | null;
|
|
133
|
-
forcedBreakOffsets: number[];
|
|
134
|
-
formattingContext: FormattingContext | null;
|
|
135
|
-
constructor(flowName: string, parentFlowName: string | null);
|
|
136
|
-
}
|
|
137
|
-
export declare class FlowChunk {
|
|
138
|
-
flowName: string;
|
|
139
|
-
element: Element;
|
|
140
|
-
startOffset: number;
|
|
141
|
-
priority: number;
|
|
142
|
-
linger: number;
|
|
143
|
-
exclusive: boolean;
|
|
144
|
-
repeated: boolean;
|
|
145
|
-
last: boolean;
|
|
146
|
-
breakBefore: string | null;
|
|
147
|
-
startPage: number;
|
|
148
|
-
constructor(flowName: string, element: Element, startOffset: number, priority: number, linger: number, exclusive: boolean, repeated: boolean, last: boolean, breakBefore: string | null);
|
|
149
|
-
isBetter(other: FlowChunk): boolean;
|
|
150
|
-
}
|
|
151
|
-
export
|
|
152
|
-
export declare function clientrectIncreasingTop(r1: ClientRect, r2: ClientRect): number;
|
|
153
|
-
export declare function clientrectDecreasingRight(r1: ClientRect, r2: ClientRect): number;
|
|
154
|
-
/**
|
|
155
|
-
* Interface to read the position assigned to the elements and ranges by the
|
|
156
|
-
* browser.
|
|
157
|
-
*/
|
|
158
|
-
export
|
|
159
|
-
/**
|
|
160
|
-
* Styling, creating a single node's view, etc.
|
|
161
|
-
*/
|
|
162
|
-
export
|
|
163
|
-
/**
|
|
164
|
-
* Formatting context.
|
|
165
|
-
*/
|
|
166
|
-
export
|
|
167
|
-
export declare function eachAncestorFormattingContext(nodeContext: NodeContext, callback: (p1: FormattingContext) => any): void;
|
|
168
|
-
export
|
|
169
|
-
export declare function isSameNodePositionStep(nps1: NodePositionStep, nps2: NodePositionStep): boolean;
|
|
170
|
-
export
|
|
171
|
-
export declare function isSameNodePosition(np1: NodePosition | null, np2: NodePosition | null): boolean;
|
|
172
|
-
export declare function newNodePositionFromNode(node: Node): NodePosition;
|
|
173
|
-
export declare function newNodePositionFromNodeContext(nodeContext: Vtree.NodeContext, initialFragmentIndex: number | null): NodePosition;
|
|
174
|
-
export declare function makeNodeContextFromNodePositionStep(step: NodePositionStep, parent: Vtree.NodeContext): NodeContext;
|
|
175
|
-
export declare const ShadowType: typeof Vtree.ShadowType;
|
|
176
|
-
export
|
|
177
|
-
/**
|
|
178
|
-
* Data about shadow tree instance.
|
|
179
|
-
*/
|
|
180
|
-
export declare class ShadowContext implements Vtree.ShadowContext {
|
|
181
|
-
readonly owner: Element;
|
|
182
|
-
readonly root: Element;
|
|
183
|
-
readonly xmldoc: XmlDoc.XMLDocHolder;
|
|
184
|
-
readonly parentShadow: ShadowContext;
|
|
185
|
-
readonly type: ShadowType;
|
|
186
|
-
readonly styler: CssStyler.AbstractStyler;
|
|
187
|
-
subShadow: ShadowContext;
|
|
188
|
-
constructor(owner: Element, root: Element, xmldoc: XmlDoc.XMLDocHolder, parentShadow: ShadowContext, superShadow: ShadowContext, type: ShadowType, styler: CssStyler.AbstractStyler);
|
|
189
|
-
equals(other: ShadowContext): boolean;
|
|
190
|
-
}
|
|
191
|
-
export declare function isSameShadowContext(sc1: Vtree.ShadowContext, sc2: Vtree.ShadowContext): boolean;
|
|
192
|
-
/**
|
|
193
|
-
* Information about :first-letter or :first-line pseudoelements
|
|
194
|
-
* @param count 0 - first-letter, 1 or more - first line(s)
|
|
195
|
-
*/
|
|
196
|
-
export declare class FirstPseudo implements Vtree.FirstPseudo {
|
|
197
|
-
readonly outer: FirstPseudo;
|
|
198
|
-
readonly count: number;
|
|
199
|
-
constructor(outer: FirstPseudo, count: number);
|
|
200
|
-
}
|
|
201
|
-
/**
|
|
202
|
-
* NodeContext represents a position in the document + layout-related
|
|
203
|
-
* information attached to it. When after=false and offsetInNode=0, the
|
|
204
|
-
* position is inside the element (node), but just before its first child.
|
|
205
|
-
* When offsetInNode>0 it represents offset in the textual content of the
|
|
206
|
-
* node. When after=true it represents position right after the last child
|
|
207
|
-
* of the node. boxOffset is incremented by 1 for any valid node position.
|
|
208
|
-
*/
|
|
209
|
-
export declare class NodeContext implements Vtree.NodeContext {
|
|
210
|
-
sourceNode: Node;
|
|
211
|
-
parent: NodeContext;
|
|
212
|
-
boxOffset: number;
|
|
213
|
-
offsetInNode: number;
|
|
214
|
-
after: boolean;
|
|
215
|
-
shadowType: ShadowType;
|
|
216
|
-
shadowContext: Vtree.ShadowContext;
|
|
217
|
-
nodeShadow: Vtree.ShadowContext;
|
|
218
|
-
shadowSibling: NodeContext;
|
|
219
|
-
shared: boolean;
|
|
220
|
-
inline: boolean;
|
|
221
|
-
overflow: boolean;
|
|
222
|
-
breakPenalty: number;
|
|
223
|
-
display: string | null;
|
|
224
|
-
floatReference: PageFloats.FloatReference;
|
|
225
|
-
floatSide: string | null;
|
|
226
|
-
clearSide: string | null;
|
|
227
|
-
floatMinWrapBlock: Css.Numeric | null;
|
|
228
|
-
columnSpan: Css.Val | null;
|
|
229
|
-
verticalAlign: string;
|
|
230
|
-
captionSide: string;
|
|
231
|
-
inlineBorderSpacing: number;
|
|
232
|
-
blockBorderSpacing: number;
|
|
233
|
-
flexContainer: boolean;
|
|
234
|
-
whitespace: Whitespace;
|
|
235
|
-
hyphenateCharacter: string | null;
|
|
236
|
-
breakWord: boolean;
|
|
237
|
-
establishesBFC: boolean;
|
|
238
|
-
containingBlockForAbsolute: boolean;
|
|
239
|
-
breakBefore: string | null;
|
|
240
|
-
breakAfter: string | null;
|
|
241
|
-
viewNode: Node;
|
|
242
|
-
clearSpacer: Node;
|
|
243
|
-
inheritedProps: {
|
|
244
|
-
[key: string]: number | string | Css.Val;
|
|
245
|
-
};
|
|
246
|
-
vertical: boolean;
|
|
247
|
-
direction: string;
|
|
248
|
-
firstPseudo: FirstPseudo;
|
|
249
|
-
lang: string | null;
|
|
250
|
-
preprocessedTextContent: Diff.Change[] | null;
|
|
251
|
-
formattingContext: FormattingContext;
|
|
252
|
-
repeatOnBreak: string | null;
|
|
253
|
-
pluginProps: {
|
|
254
|
-
[key: string]: string | number | undefined | null | (number | null)[];
|
|
255
|
-
};
|
|
256
|
-
fragmentIndex: number;
|
|
257
|
-
afterIfContinues: Selectors.AfterIfContinues;
|
|
258
|
-
footnotePolicy: Css.Ident | null;
|
|
259
|
-
pageType: string | null;
|
|
260
|
-
constructor(sourceNode: Node, parent: NodeContext, boxOffset: number);
|
|
261
|
-
resetView(): void;
|
|
262
|
-
private cloneItem;
|
|
263
|
-
modify(): NodeContext;
|
|
264
|
-
copy(): NodeContext;
|
|
265
|
-
clone(): NodeContext;
|
|
266
|
-
toNodePositionStep(): NodePositionStep;
|
|
267
|
-
toNodePosition(): NodePosition;
|
|
268
|
-
isInsideBFC(): boolean;
|
|
269
|
-
getContainingBlockForAbsolute(): NodeContext;
|
|
270
|
-
belongsTo(formattingContext: FormattingContext): boolean;
|
|
271
|
-
}
|
|
272
|
-
export declare class ChunkPosition implements Vtree.ChunkPosition {
|
|
273
|
-
primary: NodePosition;
|
|
274
|
-
floats: NodePosition[];
|
|
275
|
-
constructor(primary: NodePosition);
|
|
276
|
-
clone(): ChunkPosition;
|
|
277
|
-
isSamePosition(other: ChunkPosition): boolean;
|
|
278
|
-
}
|
|
279
|
-
export declare class FlowChunkPosition {
|
|
280
|
-
chunkPosition: ChunkPosition;
|
|
281
|
-
readonly flowChunk: FlowChunk;
|
|
282
|
-
constructor(chunkPosition: ChunkPosition, flowChunk: FlowChunk);
|
|
283
|
-
clone(): FlowChunkPosition;
|
|
284
|
-
isSamePosition(other: FlowChunkPosition): boolean;
|
|
285
|
-
}
|
|
286
|
-
export declare class FlowPosition {
|
|
287
|
-
positions: FlowChunkPosition[];
|
|
288
|
-
startBreakType: string | null;
|
|
289
|
-
breakAfter: string | null;
|
|
290
|
-
clone(): FlowPosition;
|
|
291
|
-
isSamePosition(other: FlowPosition): boolean;
|
|
292
|
-
hasContent(offset: number): boolean;
|
|
293
|
-
}
|
|
294
|
-
export declare class LayoutPosition {
|
|
295
|
-
/**
|
|
296
|
-
* One-based, incremented before layout.
|
|
297
|
-
*/
|
|
298
|
-
page: number;
|
|
299
|
-
flows: {
|
|
300
|
-
[key: string]: Flow;
|
|
301
|
-
};
|
|
302
|
-
flowPositions: {
|
|
303
|
-
[key: string]: FlowPosition;
|
|
304
|
-
};
|
|
305
|
-
isBlankPage: boolean;
|
|
306
|
-
/**
|
|
307
|
-
* flowPositions is built up to this offset.
|
|
308
|
-
*/
|
|
309
|
-
highestSeenOffset: number;
|
|
310
|
-
highestSeenNode: Node;
|
|
311
|
-
lookupPositionOffset: number;
|
|
312
|
-
clone(): LayoutPosition;
|
|
313
|
-
isSamePosition(other: LayoutPosition): boolean;
|
|
314
|
-
/**
|
|
315
|
-
* @param name flow name.
|
|
316
|
-
*/
|
|
317
|
-
hasContent(name: string, offset: number): boolean;
|
|
318
|
-
startSideOfFlow(name: string): string;
|
|
319
|
-
firstFlowChunkOfFlow(name: string): FlowChunk | null;
|
|
320
|
-
}
|
|
321
|
-
export declare class Container implements Vtree.Container {
|
|
322
|
-
element: Element;
|
|
323
|
-
left: number;
|
|
324
|
-
top: number;
|
|
325
|
-
marginLeft: number;
|
|
326
|
-
marginRight: number;
|
|
327
|
-
marginTop: number;
|
|
328
|
-
marginBottom: number;
|
|
329
|
-
borderLeft: number;
|
|
330
|
-
borderRight: number;
|
|
331
|
-
borderTop: number;
|
|
332
|
-
borderBottom: number;
|
|
333
|
-
paddingLeft: number;
|
|
334
|
-
paddingRight: number;
|
|
335
|
-
paddingTop: number;
|
|
336
|
-
paddingBottom: number;
|
|
337
|
-
width: number;
|
|
338
|
-
height: number;
|
|
339
|
-
originX: number;
|
|
340
|
-
originY: number;
|
|
341
|
-
exclusions: GeometryUtil.Shape[];
|
|
342
|
-
innerShape: GeometryUtil.Shape;
|
|
343
|
-
computedBlockSize: number;
|
|
344
|
-
snapWidth: number;
|
|
345
|
-
snapHeight: number;
|
|
346
|
-
snapOffsetX: number;
|
|
347
|
-
snapOffsetY: number;
|
|
348
|
-
vertical: boolean;
|
|
349
|
-
rtl: boolean;
|
|
350
|
-
constructor(element: Element);
|
|
351
|
-
getInsetTop(): number;
|
|
352
|
-
getInsetBottom(): number;
|
|
353
|
-
getInsetLeft(): number;
|
|
354
|
-
getInsetRight(): number;
|
|
355
|
-
getInsetBefore(): number;
|
|
356
|
-
getInsetAfter(): number;
|
|
357
|
-
getInsetStart(): number;
|
|
358
|
-
getInsetEnd(): number;
|
|
359
|
-
getBeforeEdge(box: ClientRect): number;
|
|
360
|
-
getAfterEdge(box: ClientRect): number;
|
|
361
|
-
getStartEdge(box: ClientRect): number;
|
|
362
|
-
getEndEdge(box: ClientRect): number;
|
|
363
|
-
getInlineSize(box: ClientRect): number;
|
|
364
|
-
getBoxSize(box: ClientRect): number;
|
|
365
|
-
getBoxDir(): number;
|
|
366
|
-
getInlineDir(): number;
|
|
367
|
-
copyFrom(other: Container): void;
|
|
368
|
-
setVerticalPosition(top: number, height: number): void;
|
|
369
|
-
setHorizontalPosition(left: number, width: number): void;
|
|
370
|
-
setBlockPosition(start: number, extent: number): void;
|
|
371
|
-
setInlinePosition(start: number, extent: number): void;
|
|
372
|
-
clear(): void;
|
|
373
|
-
getInnerShape(): GeometryUtil.Shape;
|
|
374
|
-
getInnerRect(): GeometryUtil.Rect;
|
|
375
|
-
getPaddingRect(): GeometryUtil.Rect;
|
|
376
|
-
getOuterShape(outerShapeProp: Css.Val, context: Exprs.Context): GeometryUtil.Shape;
|
|
377
|
-
getOuterRect(): GeometryUtil.Rect;
|
|
378
|
-
}
|
|
379
|
-
export
|
|
380
|
-
export declare class ContentPropertyHandler extends Css.Visitor {
|
|
381
|
-
readonly elem: Element;
|
|
382
|
-
readonly context: Exprs.Context;
|
|
383
|
-
readonly rootContentValue: Css.Val;
|
|
384
|
-
readonly exprContentListener: ExprContentListener;
|
|
385
|
-
constructor(elem: Element, context: Exprs.Context, rootContentValue: Css.Val, exprContentListener: ExprContentListener);
|
|
386
|
-
private visitStrInner;
|
|
387
|
-
visitStr(str: Css.Str): Css.Val;
|
|
388
|
-
visitURL(url: Css.URL): Css.Val;
|
|
389
|
-
visitSpaceList(list: Css.SpaceList): Css.Val;
|
|
390
|
-
visitExpr(expr: Css.Expr): Css.Val;
|
|
391
|
-
}
|
|
392
|
-
export declare function nonTrivialContent(val: Css.Val): boolean;
|
|
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 Vtree - Basic view tree data structures and support utilities.
|
|
20
|
+
*/
|
|
21
|
+
import * as Base from "./base";
|
|
22
|
+
import * as Constants from "./constants";
|
|
23
|
+
import * as Css from "./css";
|
|
24
|
+
import * as Diff from "./diff";
|
|
25
|
+
import * as Exprs from "./exprs";
|
|
26
|
+
import * as GeometryUtil from "./geometry-util";
|
|
27
|
+
import * as TaskUtil from "./task-util";
|
|
28
|
+
import { CssStyler, PageFloats, Selectors, Vtree, XmlDoc } from "./types";
|
|
29
|
+
export declare const delayedProps: {
|
|
30
|
+
transform: boolean;
|
|
31
|
+
"transform-origin": boolean;
|
|
32
|
+
};
|
|
33
|
+
export declare const delayedPropsIfRelativePositioned: {
|
|
34
|
+
top: boolean;
|
|
35
|
+
bottom: boolean;
|
|
36
|
+
left: boolean;
|
|
37
|
+
right: boolean;
|
|
38
|
+
};
|
|
39
|
+
export declare class DelayedItem {
|
|
40
|
+
target: Element;
|
|
41
|
+
name: string;
|
|
42
|
+
value: Css.Val;
|
|
43
|
+
constructor(target: Element, name: string, value: Css.Val);
|
|
44
|
+
}
|
|
45
|
+
export type PageHyperlinkEvent = {
|
|
46
|
+
type: string;
|
|
47
|
+
target: any;
|
|
48
|
+
currentTarget: any;
|
|
49
|
+
anchorElement: Element;
|
|
50
|
+
href: string;
|
|
51
|
+
};
|
|
52
|
+
export type Trigger = {
|
|
53
|
+
observer: string;
|
|
54
|
+
event: string;
|
|
55
|
+
action: string;
|
|
56
|
+
ref: string;
|
|
57
|
+
};
|
|
58
|
+
export declare const actions: {
|
|
59
|
+
show: (obj: any) => void;
|
|
60
|
+
hide: (obj: any) => void;
|
|
61
|
+
play: (obj: any) => void;
|
|
62
|
+
pause: (obj: any) => void;
|
|
63
|
+
resume: (obj: any) => void;
|
|
64
|
+
mute: (obj: any) => void;
|
|
65
|
+
unmute: (obj: any) => void;
|
|
66
|
+
};
|
|
67
|
+
export declare function makeListener(refs: Element[], action: string): EventListener | null;
|
|
68
|
+
export declare class Page extends Base.SimpleEventTarget {
|
|
69
|
+
readonly container: HTMLElement;
|
|
70
|
+
readonly bleedBox: HTMLElement;
|
|
71
|
+
private static AUTO_PAGE_WIDTH_ATTRIBUTE;
|
|
72
|
+
private static AUTO_PAGE_HEIGHT_ATTRIBUTE;
|
|
73
|
+
pageAreaElement: HTMLElement | null;
|
|
74
|
+
delayedItems: DelayedItem[];
|
|
75
|
+
hrefHandler: (e: Event) => void;
|
|
76
|
+
elementsById: {
|
|
77
|
+
[key: string]: Element[];
|
|
78
|
+
};
|
|
79
|
+
dimensions: {
|
|
80
|
+
width: number;
|
|
81
|
+
height: number;
|
|
82
|
+
};
|
|
83
|
+
isFirstPage: boolean;
|
|
84
|
+
isLastPage: boolean;
|
|
85
|
+
isBlankPage: boolean;
|
|
86
|
+
isAutoPageWidth: boolean;
|
|
87
|
+
isAutoPageHeight: boolean;
|
|
88
|
+
spineIndex: number;
|
|
89
|
+
position: LayoutPosition;
|
|
90
|
+
offset: number;
|
|
91
|
+
side: Constants.PageSide | null;
|
|
92
|
+
fetchers: TaskUtil.Fetcher<{}>[];
|
|
93
|
+
marginBoxes: {
|
|
94
|
+
top: {
|
|
95
|
+
[key: string]: Container;
|
|
96
|
+
};
|
|
97
|
+
bottom: {
|
|
98
|
+
[key: string]: Container;
|
|
99
|
+
};
|
|
100
|
+
left: {
|
|
101
|
+
[key: string]: Container;
|
|
102
|
+
};
|
|
103
|
+
right: {
|
|
104
|
+
[key: string]: Container;
|
|
105
|
+
};
|
|
106
|
+
};
|
|
107
|
+
pageType: string | null;
|
|
108
|
+
constructor(container: HTMLElement, bleedBox: HTMLElement);
|
|
109
|
+
setAutoPageWidth(isAuto: boolean): void;
|
|
110
|
+
setAutoPageHeight(isAuto: boolean): void;
|
|
111
|
+
registerElementWithId(element: Element, id: string): void;
|
|
112
|
+
finish(triggers: Trigger[], clientLayout: ClientLayout): void;
|
|
113
|
+
}
|
|
114
|
+
export type Spread = {
|
|
115
|
+
left: Page;
|
|
116
|
+
right: Page;
|
|
117
|
+
};
|
|
118
|
+
/**
|
|
119
|
+
* Marks an element as "special". It should not be used in bbox calculations.
|
|
120
|
+
*/
|
|
121
|
+
export declare const SPECIAL_ATTR = "data-adapt-spec";
|
|
122
|
+
export declare const Whitespace: typeof Vtree.Whitespace;
|
|
123
|
+
export type Whitespace = Vtree.Whitespace;
|
|
124
|
+
/**
|
|
125
|
+
* Resolves Whitespace value from a value of 'white-space' property
|
|
126
|
+
* @param whitespace The value of 'white-space' property
|
|
127
|
+
*/
|
|
128
|
+
export declare function whitespaceFromPropertyValue(whitespace: string): Whitespace | null;
|
|
129
|
+
export declare function canIgnore(node: Node, whitespace?: Whitespace): boolean;
|
|
130
|
+
export declare class Flow {
|
|
131
|
+
readonly flowName: string;
|
|
132
|
+
readonly parentFlowName: string | null;
|
|
133
|
+
forcedBreakOffsets: number[];
|
|
134
|
+
formattingContext: FormattingContext | null;
|
|
135
|
+
constructor(flowName: string, parentFlowName: string | null);
|
|
136
|
+
}
|
|
137
|
+
export declare class FlowChunk {
|
|
138
|
+
flowName: string;
|
|
139
|
+
element: Element;
|
|
140
|
+
startOffset: number;
|
|
141
|
+
priority: number;
|
|
142
|
+
linger: number;
|
|
143
|
+
exclusive: boolean;
|
|
144
|
+
repeated: boolean;
|
|
145
|
+
last: boolean;
|
|
146
|
+
breakBefore: string | null;
|
|
147
|
+
startPage: number;
|
|
148
|
+
constructor(flowName: string, element: Element, startOffset: number, priority: number, linger: number, exclusive: boolean, repeated: boolean, last: boolean, breakBefore: string | null);
|
|
149
|
+
isBetter(other: FlowChunk): boolean;
|
|
150
|
+
}
|
|
151
|
+
export type ClientRect = Vtree.ClientRect;
|
|
152
|
+
export declare function clientrectIncreasingTop(r1: ClientRect, r2: ClientRect): number;
|
|
153
|
+
export declare function clientrectDecreasingRight(r1: ClientRect, r2: ClientRect): number;
|
|
154
|
+
/**
|
|
155
|
+
* Interface to read the position assigned to the elements and ranges by the
|
|
156
|
+
* browser.
|
|
157
|
+
*/
|
|
158
|
+
export type ClientLayout = Vtree.ClientLayout;
|
|
159
|
+
/**
|
|
160
|
+
* Styling, creating a single node's view, etc.
|
|
161
|
+
*/
|
|
162
|
+
export type LayoutContext = Vtree.LayoutContext;
|
|
163
|
+
/**
|
|
164
|
+
* Formatting context.
|
|
165
|
+
*/
|
|
166
|
+
export type FormattingContext = Vtree.FormattingContext;
|
|
167
|
+
export declare function eachAncestorFormattingContext(nodeContext: NodeContext, callback: (p1: FormattingContext) => any): void;
|
|
168
|
+
export type NodePositionStep = Vtree.NodePositionStep;
|
|
169
|
+
export declare function isSameNodePositionStep(nps1: NodePositionStep, nps2: NodePositionStep): boolean;
|
|
170
|
+
export type NodePosition = Vtree.NodePosition;
|
|
171
|
+
export declare function isSameNodePosition(np1: NodePosition | null, np2: NodePosition | null): boolean;
|
|
172
|
+
export declare function newNodePositionFromNode(node: Node): NodePosition;
|
|
173
|
+
export declare function newNodePositionFromNodeContext(nodeContext: Vtree.NodeContext, initialFragmentIndex: number | null): NodePosition;
|
|
174
|
+
export declare function makeNodeContextFromNodePositionStep(step: NodePositionStep, parent: Vtree.NodeContext): NodeContext;
|
|
175
|
+
export declare const ShadowType: typeof Vtree.ShadowType;
|
|
176
|
+
export type ShadowType = Vtree.ShadowType;
|
|
177
|
+
/**
|
|
178
|
+
* Data about shadow tree instance.
|
|
179
|
+
*/
|
|
180
|
+
export declare class ShadowContext implements Vtree.ShadowContext {
|
|
181
|
+
readonly owner: Element;
|
|
182
|
+
readonly root: Element;
|
|
183
|
+
readonly xmldoc: XmlDoc.XMLDocHolder;
|
|
184
|
+
readonly parentShadow: ShadowContext;
|
|
185
|
+
readonly type: ShadowType;
|
|
186
|
+
readonly styler: CssStyler.AbstractStyler;
|
|
187
|
+
subShadow: ShadowContext;
|
|
188
|
+
constructor(owner: Element, root: Element, xmldoc: XmlDoc.XMLDocHolder, parentShadow: ShadowContext, superShadow: ShadowContext, type: ShadowType, styler: CssStyler.AbstractStyler);
|
|
189
|
+
equals(other: ShadowContext): boolean;
|
|
190
|
+
}
|
|
191
|
+
export declare function isSameShadowContext(sc1: Vtree.ShadowContext, sc2: Vtree.ShadowContext): boolean;
|
|
192
|
+
/**
|
|
193
|
+
* Information about :first-letter or :first-line pseudoelements
|
|
194
|
+
* @param count 0 - first-letter, 1 or more - first line(s)
|
|
195
|
+
*/
|
|
196
|
+
export declare class FirstPseudo implements Vtree.FirstPseudo {
|
|
197
|
+
readonly outer: FirstPseudo;
|
|
198
|
+
readonly count: number;
|
|
199
|
+
constructor(outer: FirstPseudo, count: number);
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* NodeContext represents a position in the document + layout-related
|
|
203
|
+
* information attached to it. When after=false and offsetInNode=0, the
|
|
204
|
+
* position is inside the element (node), but just before its first child.
|
|
205
|
+
* When offsetInNode>0 it represents offset in the textual content of the
|
|
206
|
+
* node. When after=true it represents position right after the last child
|
|
207
|
+
* of the node. boxOffset is incremented by 1 for any valid node position.
|
|
208
|
+
*/
|
|
209
|
+
export declare class NodeContext implements Vtree.NodeContext {
|
|
210
|
+
sourceNode: Node;
|
|
211
|
+
parent: NodeContext;
|
|
212
|
+
boxOffset: number;
|
|
213
|
+
offsetInNode: number;
|
|
214
|
+
after: boolean;
|
|
215
|
+
shadowType: ShadowType;
|
|
216
|
+
shadowContext: Vtree.ShadowContext;
|
|
217
|
+
nodeShadow: Vtree.ShadowContext;
|
|
218
|
+
shadowSibling: NodeContext;
|
|
219
|
+
shared: boolean;
|
|
220
|
+
inline: boolean;
|
|
221
|
+
overflow: boolean;
|
|
222
|
+
breakPenalty: number;
|
|
223
|
+
display: string | null;
|
|
224
|
+
floatReference: PageFloats.FloatReference;
|
|
225
|
+
floatSide: string | null;
|
|
226
|
+
clearSide: string | null;
|
|
227
|
+
floatMinWrapBlock: Css.Numeric | null;
|
|
228
|
+
columnSpan: Css.Val | null;
|
|
229
|
+
verticalAlign: string;
|
|
230
|
+
captionSide: string;
|
|
231
|
+
inlineBorderSpacing: number;
|
|
232
|
+
blockBorderSpacing: number;
|
|
233
|
+
flexContainer: boolean;
|
|
234
|
+
whitespace: Whitespace;
|
|
235
|
+
hyphenateCharacter: string | null;
|
|
236
|
+
breakWord: boolean;
|
|
237
|
+
establishesBFC: boolean;
|
|
238
|
+
containingBlockForAbsolute: boolean;
|
|
239
|
+
breakBefore: string | null;
|
|
240
|
+
breakAfter: string | null;
|
|
241
|
+
viewNode: Node;
|
|
242
|
+
clearSpacer: Node;
|
|
243
|
+
inheritedProps: {
|
|
244
|
+
[key: string]: number | string | Css.Val;
|
|
245
|
+
};
|
|
246
|
+
vertical: boolean;
|
|
247
|
+
direction: string;
|
|
248
|
+
firstPseudo: FirstPseudo;
|
|
249
|
+
lang: string | null;
|
|
250
|
+
preprocessedTextContent: Diff.Change[] | null;
|
|
251
|
+
formattingContext: FormattingContext;
|
|
252
|
+
repeatOnBreak: string | null;
|
|
253
|
+
pluginProps: {
|
|
254
|
+
[key: string]: string | number | undefined | null | (number | null)[];
|
|
255
|
+
};
|
|
256
|
+
fragmentIndex: number;
|
|
257
|
+
afterIfContinues: Selectors.AfterIfContinues;
|
|
258
|
+
footnotePolicy: Css.Ident | null;
|
|
259
|
+
pageType: string | null;
|
|
260
|
+
constructor(sourceNode: Node, parent: NodeContext, boxOffset: number);
|
|
261
|
+
resetView(): void;
|
|
262
|
+
private cloneItem;
|
|
263
|
+
modify(): NodeContext;
|
|
264
|
+
copy(): NodeContext;
|
|
265
|
+
clone(): NodeContext;
|
|
266
|
+
toNodePositionStep(): NodePositionStep;
|
|
267
|
+
toNodePosition(): NodePosition;
|
|
268
|
+
isInsideBFC(): boolean;
|
|
269
|
+
getContainingBlockForAbsolute(): NodeContext;
|
|
270
|
+
belongsTo(formattingContext: FormattingContext): boolean;
|
|
271
|
+
}
|
|
272
|
+
export declare class ChunkPosition implements Vtree.ChunkPosition {
|
|
273
|
+
primary: NodePosition;
|
|
274
|
+
floats: NodePosition[];
|
|
275
|
+
constructor(primary: NodePosition);
|
|
276
|
+
clone(): ChunkPosition;
|
|
277
|
+
isSamePosition(other: ChunkPosition): boolean;
|
|
278
|
+
}
|
|
279
|
+
export declare class FlowChunkPosition {
|
|
280
|
+
chunkPosition: ChunkPosition;
|
|
281
|
+
readonly flowChunk: FlowChunk;
|
|
282
|
+
constructor(chunkPosition: ChunkPosition, flowChunk: FlowChunk);
|
|
283
|
+
clone(): FlowChunkPosition;
|
|
284
|
+
isSamePosition(other: FlowChunkPosition): boolean;
|
|
285
|
+
}
|
|
286
|
+
export declare class FlowPosition {
|
|
287
|
+
positions: FlowChunkPosition[];
|
|
288
|
+
startBreakType: string | null;
|
|
289
|
+
breakAfter: string | null;
|
|
290
|
+
clone(): FlowPosition;
|
|
291
|
+
isSamePosition(other: FlowPosition): boolean;
|
|
292
|
+
hasContent(offset: number): boolean;
|
|
293
|
+
}
|
|
294
|
+
export declare class LayoutPosition {
|
|
295
|
+
/**
|
|
296
|
+
* One-based, incremented before layout.
|
|
297
|
+
*/
|
|
298
|
+
page: number;
|
|
299
|
+
flows: {
|
|
300
|
+
[key: string]: Flow;
|
|
301
|
+
};
|
|
302
|
+
flowPositions: {
|
|
303
|
+
[key: string]: FlowPosition;
|
|
304
|
+
};
|
|
305
|
+
isBlankPage: boolean;
|
|
306
|
+
/**
|
|
307
|
+
* flowPositions is built up to this offset.
|
|
308
|
+
*/
|
|
309
|
+
highestSeenOffset: number;
|
|
310
|
+
highestSeenNode: Node;
|
|
311
|
+
lookupPositionOffset: number;
|
|
312
|
+
clone(): LayoutPosition;
|
|
313
|
+
isSamePosition(other: LayoutPosition): boolean;
|
|
314
|
+
/**
|
|
315
|
+
* @param name flow name.
|
|
316
|
+
*/
|
|
317
|
+
hasContent(name: string, offset: number): boolean;
|
|
318
|
+
startSideOfFlow(name: string): string;
|
|
319
|
+
firstFlowChunkOfFlow(name: string): FlowChunk | null;
|
|
320
|
+
}
|
|
321
|
+
export declare class Container implements Vtree.Container {
|
|
322
|
+
element: Element;
|
|
323
|
+
left: number;
|
|
324
|
+
top: number;
|
|
325
|
+
marginLeft: number;
|
|
326
|
+
marginRight: number;
|
|
327
|
+
marginTop: number;
|
|
328
|
+
marginBottom: number;
|
|
329
|
+
borderLeft: number;
|
|
330
|
+
borderRight: number;
|
|
331
|
+
borderTop: number;
|
|
332
|
+
borderBottom: number;
|
|
333
|
+
paddingLeft: number;
|
|
334
|
+
paddingRight: number;
|
|
335
|
+
paddingTop: number;
|
|
336
|
+
paddingBottom: number;
|
|
337
|
+
width: number;
|
|
338
|
+
height: number;
|
|
339
|
+
originX: number;
|
|
340
|
+
originY: number;
|
|
341
|
+
exclusions: GeometryUtil.Shape[];
|
|
342
|
+
innerShape: GeometryUtil.Shape;
|
|
343
|
+
computedBlockSize: number;
|
|
344
|
+
snapWidth: number;
|
|
345
|
+
snapHeight: number;
|
|
346
|
+
snapOffsetX: number;
|
|
347
|
+
snapOffsetY: number;
|
|
348
|
+
vertical: boolean;
|
|
349
|
+
rtl: boolean;
|
|
350
|
+
constructor(element: Element);
|
|
351
|
+
getInsetTop(): number;
|
|
352
|
+
getInsetBottom(): number;
|
|
353
|
+
getInsetLeft(): number;
|
|
354
|
+
getInsetRight(): number;
|
|
355
|
+
getInsetBefore(): number;
|
|
356
|
+
getInsetAfter(): number;
|
|
357
|
+
getInsetStart(): number;
|
|
358
|
+
getInsetEnd(): number;
|
|
359
|
+
getBeforeEdge(box: ClientRect): number;
|
|
360
|
+
getAfterEdge(box: ClientRect): number;
|
|
361
|
+
getStartEdge(box: ClientRect): number;
|
|
362
|
+
getEndEdge(box: ClientRect): number;
|
|
363
|
+
getInlineSize(box: ClientRect): number;
|
|
364
|
+
getBoxSize(box: ClientRect): number;
|
|
365
|
+
getBoxDir(): number;
|
|
366
|
+
getInlineDir(): number;
|
|
367
|
+
copyFrom(other: Container): void;
|
|
368
|
+
setVerticalPosition(top: number, height: number): void;
|
|
369
|
+
setHorizontalPosition(left: number, width: number): void;
|
|
370
|
+
setBlockPosition(start: number, extent: number): void;
|
|
371
|
+
setInlinePosition(start: number, extent: number): void;
|
|
372
|
+
clear(): void;
|
|
373
|
+
getInnerShape(): GeometryUtil.Shape;
|
|
374
|
+
getInnerRect(): GeometryUtil.Rect;
|
|
375
|
+
getPaddingRect(): GeometryUtil.Rect;
|
|
376
|
+
getOuterShape(outerShapeProp: Css.Val, context: Exprs.Context): GeometryUtil.Shape;
|
|
377
|
+
getOuterRect(): GeometryUtil.Rect;
|
|
378
|
+
}
|
|
379
|
+
export type ExprContentListener = Vtree.ExprContentListener;
|
|
380
|
+
export declare class ContentPropertyHandler extends Css.Visitor {
|
|
381
|
+
readonly elem: Element;
|
|
382
|
+
readonly context: Exprs.Context;
|
|
383
|
+
readonly rootContentValue: Css.Val;
|
|
384
|
+
readonly exprContentListener: ExprContentListener;
|
|
385
|
+
constructor(elem: Element, context: Exprs.Context, rootContentValue: Css.Val, exprContentListener: ExprContentListener);
|
|
386
|
+
private visitStrInner;
|
|
387
|
+
visitStr(str: Css.Str): Css.Val;
|
|
388
|
+
visitURL(url: Css.URL): Css.Val;
|
|
389
|
+
visitSpaceList(list: Css.SpaceList): Css.Val;
|
|
390
|
+
visitExpr(expr: Css.Expr): Css.Val;
|
|
391
|
+
}
|
|
392
|
+
export declare function nonTrivialContent(val: Css.Val): boolean;
|