@vivliostyle/core 2.24.3 → 2.25.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. package/lib/vivliostyle/adaptive-viewer.d.ts +167 -167
  2. package/lib/vivliostyle/asserts.d.ts +21 -21
  3. package/lib/vivliostyle/assets.d.ts +35 -35
  4. package/lib/vivliostyle/base.d.ts +189 -189
  5. package/lib/vivliostyle/break-position.d.ts +39 -39
  6. package/lib/vivliostyle/break.d.ts +112 -112
  7. package/lib/vivliostyle/cfi.d.ts +77 -77
  8. package/lib/vivliostyle/columns.d.ts +52 -52
  9. package/lib/vivliostyle/constants.d.ts +53 -53
  10. package/lib/vivliostyle/core-viewer.d.ts +240 -240
  11. package/lib/vivliostyle/counters.d.ts +130 -127
  12. package/lib/vivliostyle/css-cascade.d.ts +974 -954
  13. package/lib/vivliostyle/css-logical-util.d.ts +3 -3
  14. package/lib/vivliostyle/css-page.d.ts +451 -451
  15. package/lib/vivliostyle/css-parser.d.ts +320 -320
  16. package/lib/vivliostyle/css-prop.d.ts +74 -74
  17. package/lib/vivliostyle/css-styler.d.ts +210 -210
  18. package/lib/vivliostyle/css-tokenizer.d.ts +243 -243
  19. package/lib/vivliostyle/css-validator.d.ts +319 -319
  20. package/lib/vivliostyle/css.d.ts +205 -205
  21. package/lib/vivliostyle/diff.d.ts +26 -26
  22. package/lib/vivliostyle/display.d.ts +62 -57
  23. package/lib/vivliostyle/epub.d.ts +329 -329
  24. package/lib/vivliostyle/exprs.d.ts +395 -395
  25. package/lib/vivliostyle/font.d.ts +87 -87
  26. package/lib/vivliostyle/footnotes.d.ts +41 -41
  27. package/lib/vivliostyle/geometry-util.d.ts +110 -110
  28. package/lib/vivliostyle/layout-helper.d.ts +16 -15
  29. package/lib/vivliostyle/layout-processor.d.ts +73 -73
  30. package/lib/vivliostyle/layout-retryers.d.ts +21 -21
  31. package/lib/vivliostyle/layout-util.d.ts +55 -55
  32. package/lib/vivliostyle/layout.d.ts +456 -456
  33. package/lib/vivliostyle/logging.d.ts +56 -56
  34. package/lib/vivliostyle/matchers.d.ts +36 -36
  35. package/lib/vivliostyle/math-util.d.ts +22 -22
  36. package/lib/vivliostyle/net.d.ts +72 -72
  37. package/lib/vivliostyle/ops.d.ts +263 -263
  38. package/lib/vivliostyle/page-floats.d.ts +178 -178
  39. package/lib/vivliostyle/page-master.d.ts +247 -247
  40. package/lib/vivliostyle/plugin.d.ts +172 -172
  41. package/lib/vivliostyle/print.d.ts +7 -7
  42. package/lib/vivliostyle/profile.d.ts +59 -59
  43. package/lib/vivliostyle/pseudo-element.d.ts +32 -32
  44. package/lib/vivliostyle/repetitive-element.d.ts +162 -162
  45. package/lib/vivliostyle/scripts.d.ts +15 -15
  46. package/lib/vivliostyle/sha1.d.ts +33 -33
  47. package/lib/vivliostyle/shared.d.ts +24 -24
  48. package/lib/vivliostyle/sizing.d.ts +29 -29
  49. package/lib/vivliostyle/table.d.ts +263 -263
  50. package/lib/vivliostyle/task-util.d.ts +37 -37
  51. package/lib/vivliostyle/task.d.ts +357 -357
  52. package/lib/vivliostyle/text-polyfill.d.ts +3 -3
  53. package/lib/vivliostyle/toc.d.ts +64 -64
  54. package/lib/vivliostyle/types.d.ts +977 -977
  55. package/lib/vivliostyle/urls.d.ts +25 -25
  56. package/lib/vivliostyle/vgen.d.ts +213 -213
  57. package/lib/vivliostyle/viewer-app.d.ts +19 -19
  58. package/lib/vivliostyle/vtree.d.ts +392 -392
  59. package/lib/vivliostyle/xml-doc.d.ts +88 -88
  60. package/lib/vivliostyle.d.ts +6 -6
  61. package/lib/vivliostyle.js +1 -1
  62. package/lib/vivliostyle.js.map +1 -1
  63. package/package.json +5 -5
@@ -1,954 +1,974 @@
1
- import * as Css from "./css";
2
- import * as CssParser from "./css-parser";
3
- import * as CssTokenizer from "./css-tokenizer";
4
- import * as CssValidator from "./css-validator";
5
- import * as Exprs from "./exprs";
6
- import * as Matchers from "./matchers";
7
- import * as Vtree from "./vtree";
8
- import { CssStyler } from "./types";
9
- import { TokenType } from "./css-tokenizer";
10
- export type ElementStyle = {
11
- [key: string]: CascadeValue | CascadeValue[] | ElementStyleMap | {
12
- matcher: Matchers.Matcher;
13
- styles: ElementStyle;
14
- }[];
15
- };
16
- export declare const inheritedProps: {
17
- "border-collapse": boolean;
18
- "border-spacing": boolean;
19
- "caption-side": boolean;
20
- "clip-rule": boolean;
21
- color: boolean;
22
- "color-interpolation": boolean;
23
- "color-rendering": boolean;
24
- cursor: boolean;
25
- direction: boolean;
26
- "empty-cells": boolean;
27
- fill: boolean;
28
- "fill-opacity": boolean;
29
- "fill-rule": boolean;
30
- "font-kerning": boolean;
31
- "font-size": boolean;
32
- "font-size-adjust": boolean;
33
- "font-family": boolean;
34
- "font-feature-settings": boolean;
35
- "font-style": boolean;
36
- "font-stretch": boolean;
37
- "font-variant-ligatures": boolean;
38
- "font-variant-caps": boolean;
39
- "font-variant-numeric": boolean;
40
- "font-variant-east-asian": boolean;
41
- "font-weight": boolean;
42
- "glyph-orientation-vertical": boolean;
43
- "hanging-punctuation": boolean;
44
- hyphens: boolean;
45
- "hyphenate-character": boolean;
46
- "hyphenate-limit-chars": boolean;
47
- "hyphenate-limit-last": boolean;
48
- "image-rendering": boolean;
49
- "image-resolution": boolean;
50
- "letter-spacing": boolean;
51
- "line-break": boolean;
52
- "line-height": boolean;
53
- "list-style-image": boolean;
54
- "list-style-position": boolean;
55
- "list-style-type": boolean;
56
- marker: boolean;
57
- "marker-end": boolean;
58
- "marker-mid": boolean;
59
- "marker-start": boolean;
60
- orphans: boolean;
61
- "overflow-wrap": boolean;
62
- "paint-order": boolean;
63
- "pointer-events": boolean;
64
- quotes: boolean;
65
- "ruby-align": boolean;
66
- "ruby-position": boolean;
67
- "shape-rendering": boolean;
68
- stroke: boolean;
69
- "stroke-dasharray": boolean;
70
- "stroke-dashoffset": boolean;
71
- "stroke-linecap": boolean;
72
- "stroke-linejoin": boolean;
73
- "stroke-miterlimit": boolean;
74
- "stroke-opacity": boolean;
75
- "stroke-width": boolean;
76
- "tab-size": boolean;
77
- "text-align": boolean;
78
- "text-align-last": boolean;
79
- "text-anchor": boolean;
80
- "text-autospace": boolean;
81
- "text-decoration-skip": boolean;
82
- "text-emphasis-color": boolean;
83
- "text-emphasis-position": boolean;
84
- "text-emphasis-style": boolean;
85
- "text-fill-color": boolean;
86
- "text-combine-upright": boolean;
87
- "text-indent": boolean;
88
- "text-justify": boolean;
89
- "text-orientation": boolean;
90
- "text-rendering": boolean;
91
- "text-size-adjust": boolean;
92
- "text-spacing-trim": boolean;
93
- "text-stroke-color": boolean;
94
- "text-stroke-width": boolean;
95
- "text-transform": boolean;
96
- "text-underline-position": boolean;
97
- visibility: boolean;
98
- "white-space": boolean;
99
- widows: boolean;
100
- "word-break": boolean;
101
- "word-spacing": boolean;
102
- "writing-mode": boolean;
103
- };
104
- export declare const polyfilledInheritedProps: string[];
105
- export declare function getPolyfilledInheritedProps(): string[];
106
- export declare const supportedNamespaces: {
107
- "http://www.idpf.org/2007/ops": boolean;
108
- "http://www.w3.org/1999/xhtml": boolean;
109
- "http://www.w3.org/2000/svg": boolean;
110
- };
111
- export declare const coupledPatterns: string[];
112
- export declare const coupledExtentPatterns: string[];
113
- export declare const geomNames: {
114
- [key: string]: boolean;
115
- };
116
- export declare function buildCouplingMap(sideMap: {
117
- [key: string]: string;
118
- }, extentMap: {
119
- [key: string]: string;
120
- }): {
121
- [key: string]: string;
122
- };
123
- export declare const couplingMapVert: {
124
- [key: string]: string;
125
- };
126
- export declare const couplingMapHor: {
127
- [key: string]: string;
128
- };
129
- export declare const couplingMapVertRtl: {
130
- [key: string]: string;
131
- };
132
- export declare const couplingMapHorRtl: {
133
- [key: string]: string;
134
- };
135
- export declare class CascadeValue {
136
- readonly value: Css.Val;
137
- readonly priority: number;
138
- constructor(value: Css.Val, priority: number);
139
- getBaseValue(): CascadeValue;
140
- filterValue(visitor: Css.Visitor): CascadeValue;
141
- increaseSpecificity(specificity: number): CascadeValue;
142
- evaluate(context: Exprs.Context, propName?: string): Css.Val;
143
- isEnabled(context: Exprs.Context): boolean;
144
- }
145
- /**
146
- * Internal subclass of CascadeValue. Should never be seen outside of the
147
- * cascade engine.
148
- */
149
- export declare class ConditionalCascadeValue extends CascadeValue {
150
- readonly condition: Exprs.Val;
151
- constructor(value: Css.Val, priority: number, condition: Exprs.Val);
152
- getBaseValue(): CascadeValue;
153
- filterValue(visitor: Css.Visitor): CascadeValue;
154
- increaseSpecificity(specificity: number): CascadeValue;
155
- isEnabled(context: Exprs.Context): boolean;
156
- }
157
- /**
158
- * @param tv current value (cannot be conditional)
159
- * @param av cascaded value (can be conditional)
160
- */
161
- export declare function cascadeValues(context: Exprs.Context, tv: CascadeValue, av: CascadeValue): CascadeValue;
162
- /**
163
- * setProp with priority checking.
164
- * If context is given it is same as
165
- * setProp(style, name, cascadeValues(context, getProp(style, name), value))
166
- */
167
- export declare function setPropCascadeValue(style: ElementStyle, name: string, value: CascadeValue, context?: Exprs.Context): void;
168
- export type ElementStyleMap = {
169
- [key: string]: ElementStyle;
170
- };
171
- export declare const SPECIALS: {
172
- "region-id": boolean;
173
- "fragment-selector-id": boolean;
174
- };
175
- export declare function isSpecialName(name: string): boolean;
176
- export declare function isMapName(name: string): boolean;
177
- export declare function isPropName(name: string): boolean;
178
- export declare function isInherited(name: string): boolean;
179
- export declare function getProp(style: ElementStyle, name: string): CascadeValue;
180
- export declare function setProp(style: ElementStyle, name: string, value: CascadeValue): void;
181
- export declare function getStyleMap(style: ElementStyle, name: string): ElementStyleMap;
182
- export declare function getMutableStyleMap(style: ElementStyle, name: string): ElementStyleMap;
183
- export declare const getViewConditionalStyleMap: (style: ElementStyle) => {
184
- matcher: Matchers.Matcher;
185
- styles: ElementStyle;
186
- }[];
187
- export declare function getSpecial(style: ElementStyle, name: string): CascadeValue[];
188
- export declare function getMutableSpecial(style: ElementStyle, name: string): CascadeValue[];
189
- export declare function mergeIn(context: Exprs.Context, target: ElementStyle, style: ElementStyle, specificity: number, pseudoelement: string | null, regionId: string | null, viewConditionMatcher: Matchers.Matcher | null): void;
190
- export declare function mergeAll(context: Exprs.Context, styles: ElementStyle[]): ElementStyle;
191
- export declare function chainActions(chain: ChainedAction[], action: CascadeAction): CascadeAction;
192
- export declare class InheritanceVisitor extends Css.FilterVisitor {
193
- readonly props: ElementStyle;
194
- readonly context: Exprs.Context;
195
- propName: string;
196
- constructor(props: ElementStyle, context: Exprs.Context);
197
- setPropName(name: string): void;
198
- private getFontSize;
199
- visitNumeric(numeric: Css.Numeric): Css.Val;
200
- visitExpr(expr: Css.Expr): Css.Val;
201
- }
202
- export declare function convertFontRelativeLengthToPx(numeric: Css.Numeric, baseFontSize: number, context: Exprs.Context): Css.Numeric;
203
- export declare function convertFontSizeToPx(numeric: Css.Numeric, parentFontSize: number, context: Exprs.Context): Css.Numeric;
204
- export type ActionTable = {
205
- [key: string]: CascadeAction;
206
- };
207
- export declare class CascadeAction {
208
- apply(cascadeInstance: CascadeInstance): void;
209
- mergeWith(other: CascadeAction): CascadeAction;
210
- clone(): CascadeAction;
211
- }
212
- export declare class ConditionItemAction extends CascadeAction {
213
- readonly conditionItem: ConditionItem;
214
- constructor(conditionItem: ConditionItem);
215
- apply(cascadeInstance: CascadeInstance): void;
216
- }
217
- export declare class CompoundAction extends CascadeAction {
218
- readonly list: CascadeAction[];
219
- constructor(list: CascadeAction[]);
220
- apply(cascadeInstance: CascadeInstance): void;
221
- mergeWith(other: CascadeAction): CascadeAction;
222
- clone(): CascadeAction;
223
- }
224
- export declare class ApplyRuleAction extends CascadeAction {
225
- readonly style: ElementStyle;
226
- readonly specificity: number;
227
- readonly pseudoelement: string | null;
228
- readonly regionId: string | null;
229
- readonly viewConditionId: string | null;
230
- constructor(style: ElementStyle, specificity: number, pseudoelement: string | null, regionId: string | null, viewConditionId: string | null);
231
- apply(cascadeInstance: CascadeInstance): void;
232
- }
233
- export declare class ChainedAction extends CascadeAction {
234
- chained: CascadeAction;
235
- constructor();
236
- apply(cascadeInstance: CascadeInstance): void;
237
- getPriority(): number;
238
- makePrimary(cascade: Cascade): boolean;
239
- }
240
- export declare class CheckClassAction extends ChainedAction {
241
- readonly className: string;
242
- constructor(className: string);
243
- apply(cascadeInstance: CascadeInstance): void;
244
- getPriority(): number;
245
- makePrimary(cascade: Cascade): boolean;
246
- }
247
- export declare class CheckIdAction extends ChainedAction {
248
- readonly id: string;
249
- constructor(id: string);
250
- apply(cascadeInstance: CascadeInstance): void;
251
- getPriority(): number;
252
- makePrimary(cascade: Cascade): boolean;
253
- }
254
- export declare class CheckLocalNameAction extends ChainedAction {
255
- readonly localName: string;
256
- constructor(localName: string);
257
- apply(cascadeInstance: CascadeInstance): void;
258
- getPriority(): number;
259
- makePrimary(cascade: Cascade): boolean;
260
- }
261
- export declare class CheckNSTagAction extends ChainedAction {
262
- readonly ns: string;
263
- readonly localName: string;
264
- constructor(ns: string, localName: string);
265
- apply(cascadeInstance: CascadeInstance): void;
266
- getPriority(): number;
267
- makePrimary(cascade: Cascade): boolean;
268
- }
269
- export declare class CheckTargetEpubTypeAction extends ChainedAction {
270
- readonly epubTypePatt: RegExp;
271
- constructor(epubTypePatt: RegExp);
272
- apply(cascadeInstance: CascadeInstance): void;
273
- }
274
- export declare class CheckNamespaceAction extends ChainedAction {
275
- readonly ns: string;
276
- constructor(ns: string);
277
- apply(cascadeInstance: CascadeInstance): void;
278
- }
279
- export declare class CheckAttributePresentAction extends ChainedAction {
280
- readonly ns: string;
281
- readonly name: string;
282
- constructor(ns: string, name: string);
283
- apply(cascadeInstance: CascadeInstance): void;
284
- }
285
- export declare class CheckAttributeEqAction extends ChainedAction {
286
- readonly ns: string;
287
- readonly name: string;
288
- readonly value: string;
289
- constructor(ns: string, name: string, value: string);
290
- apply(cascadeInstance: CascadeInstance): void;
291
- getPriority(): number;
292
- makePrimary(cascade: Cascade): boolean;
293
- }
294
- export declare class CheckNamespaceSupportedAction extends ChainedAction {
295
- readonly ns: string;
296
- readonly name: string;
297
- constructor(ns: string, name: string);
298
- apply(cascadeInstance: CascadeInstance): void;
299
- getPriority(): number;
300
- makePrimary(cascade: Cascade): boolean;
301
- }
302
- export declare class CheckAttributeRegExpAction extends ChainedAction {
303
- readonly ns: string;
304
- readonly name: string;
305
- readonly regexp: RegExp;
306
- constructor(ns: string, name: string, regexp: RegExp);
307
- apply(cascadeInstance: CascadeInstance): void;
308
- }
309
- export declare class CheckLangAction extends ChainedAction {
310
- readonly langRegExp: RegExp;
311
- constructor(langRegExp: RegExp);
312
- apply(cascadeInstance: CascadeInstance): void;
313
- }
314
- export declare class IsFirstAction extends ChainedAction {
315
- constructor();
316
- apply(cascadeInstance: CascadeInstance): void;
317
- getPriority(): number;
318
- }
319
- export declare class IsRootAction extends ChainedAction {
320
- constructor();
321
- apply(cascadeInstance: CascadeInstance): void;
322
- getPriority(): number;
323
- }
324
- export declare class IsNthAction extends ChainedAction {
325
- readonly a: number;
326
- readonly b: number;
327
- constructor(a: number, b: number);
328
- /**
329
- * Checkes whether given order can be represented as an+b with a non-negative
330
- * interger n
331
- */
332
- protected matchANPlusB(order: number): boolean;
333
- }
334
- export declare class IsNthSiblingAction extends IsNthAction {
335
- constructor(a: number, b: number);
336
- apply(cascadeInstance: CascadeInstance): void;
337
- getPriority(): number;
338
- }
339
- export declare class IsNthSiblingOfTypeAction extends IsNthAction {
340
- constructor(a: number, b: number);
341
- apply(cascadeInstance: CascadeInstance): void;
342
- getPriority(): number;
343
- }
344
- export declare class IsNthLastSiblingAction extends IsNthAction {
345
- constructor(a: number, b: number);
346
- apply(cascadeInstance: CascadeInstance): void;
347
- getPriority(): number;
348
- }
349
- export declare class IsNthLastSiblingOfTypeAction extends IsNthAction {
350
- constructor(a: number, b: number);
351
- apply(cascadeInstance: CascadeInstance): void;
352
- getPriority(): number;
353
- }
354
- export declare class IsEmptyAction extends ChainedAction {
355
- constructor();
356
- apply(cascadeInstance: CascadeInstance): void;
357
- getPriority(): number;
358
- }
359
- export declare class IsEnabledAction extends ChainedAction {
360
- constructor();
361
- apply(cascadeInstance: CascadeInstance): void;
362
- getPriority(): number;
363
- }
364
- export declare class IsDisabledAction extends ChainedAction {
365
- constructor();
366
- apply(cascadeInstance: CascadeInstance): void;
367
- getPriority(): number;
368
- }
369
- export declare class IsCheckedAction extends ChainedAction {
370
- constructor();
371
- apply(cascadeInstance: CascadeInstance): void;
372
- getPriority(): number;
373
- }
374
- export declare class CheckConditionAction extends ChainedAction {
375
- readonly condition: string;
376
- constructor(condition: string);
377
- apply(cascadeInstance: CascadeInstance): void;
378
- getPriority(): number;
379
- }
380
- export declare class CheckAppliedAction extends CascadeAction {
381
- applied: boolean;
382
- constructor();
383
- apply(cascadeInstance: CascadeInstance): void;
384
- clone(): CascadeAction;
385
- }
386
- /**
387
- * Cascade Action for :is() and similar pseudo-classes
388
- */
389
- export declare class MatchesAction extends ChainedAction {
390
- checkAppliedAction: CheckAppliedAction;
391
- firstActions: CascadeAction[];
392
- constructor(chains: ChainedAction[][]);
393
- apply(cascadeInstance: CascadeInstance): void;
394
- getPriority(): number;
395
- positive(): boolean;
396
- relational(): boolean;
397
- }
398
- /**
399
- * Cascade Action for :not() pseudo-class
400
- */
401
- export declare class MatchesNoneAction extends MatchesAction {
402
- positive(): boolean;
403
- }
404
- /**
405
- * Cascade Action for :has() pseudo-class
406
- */
407
- export declare class MatchesRelationalAction extends MatchesAction {
408
- selectorTexts: string[];
409
- constructor(selectorTexts: string[]);
410
- apply(cascadeInstance: CascadeInstance): void;
411
- relational(): boolean;
412
- }
413
- /**
414
- * An object that is notified as elements are pushed and popped and typically
415
- * controls a "named condition" (which is a count associated with a name).
416
- */
417
- export interface ConditionItem {
418
- /**
419
- * Returns a "fresh" copy of this item. May be this if immutable.
420
- */
421
- fresh(cascadeInstance: CascadeInstance): ConditionItem;
422
- /**
423
- * Depth is 0 for element itself and its siblings, 1 for direct children and
424
- * -1 for the parent.
425
- */
426
- push(cascadeInstance: CascadeInstance, depth: number): boolean;
427
- /**
428
- * @return return true if no more notifications are desired
429
- */
430
- pop(cascadeInstance: CascadeInstance, depth: number): boolean;
431
- }
432
- export declare class AbstractConditionItem {
433
- readonly condition: string;
434
- readonly viewConditionId: string | null;
435
- readonly viewCondition: Matchers.Matcher;
436
- constructor(condition: string, viewConditionId: string | null, viewCondition: Matchers.Matcher);
437
- increment(cascadeInstance: CascadeInstance): void;
438
- decrement(cascadeInstance: CascadeInstance): void;
439
- buildViewConditionMatcher(cascadeInstance: CascadeInstance): Matchers.Matcher;
440
- }
441
- export declare class DescendantConditionItem extends AbstractConditionItem implements ConditionItem {
442
- constructor(condition: string, viewConditionId: string | null, viewCondition: Matchers.Matcher);
443
- /** @override */
444
- fresh(cascadeInstance: CascadeInstance): ConditionItem;
445
- /** @override */
446
- push(cascadeInstance: CascadeInstance, depth: number): boolean;
447
- /** @override */
448
- pop(cascadeInstance: CascadeInstance, depth: number): boolean;
449
- }
450
- export declare class ChildConditionItem extends AbstractConditionItem implements ConditionItem {
451
- constructor(condition: string, viewConditionId: string | null, viewCondition: Matchers.Matcher);
452
- /** @override */
453
- fresh(cascadeInstance: CascadeInstance): ConditionItem;
454
- /** @override */
455
- push(cascadeInstance: CascadeInstance, depth: number): boolean;
456
- /** @override */
457
- pop(cascadeInstance: CascadeInstance, depth: number): boolean;
458
- }
459
- export declare class AdjacentSiblingConditionItem extends AbstractConditionItem implements ConditionItem {
460
- fired: boolean;
461
- constructor(condition: string, viewConditionId: string | null, viewCondition: Matchers.Matcher);
462
- /** @override */
463
- fresh(cascadeInstance: CascadeInstance): ConditionItem;
464
- /** @override */
465
- push(cascadeInstance: CascadeInstance, depth: number): boolean;
466
- /** @override */
467
- pop(cascadeInstance: CascadeInstance, depth: number): boolean;
468
- }
469
- export declare class FollowingSiblingConditionItem extends AbstractConditionItem implements ConditionItem {
470
- fired: boolean;
471
- constructor(condition: string, viewConditionId: string | null, viewCondition: Matchers.Matcher);
472
- /** @override */
473
- fresh(cascadeInstance: CascadeInstance): ConditionItem;
474
- /** @override */
475
- push(cascadeInstance: CascadeInstance, depth: number): boolean;
476
- /** @override */
477
- pop(cascadeInstance: CascadeInstance, depth: number): boolean;
478
- }
479
- /**
480
- * Not a true condition item, this class manages proper handling of "after"
481
- * pseudoelement.
482
- */
483
- export declare class AfterPseudoelementItem implements ConditionItem {
484
- readonly afterprop: ElementStyle;
485
- readonly element: Element;
486
- constructor(afterprop: ElementStyle, element: Element);
487
- /** @override */
488
- fresh(cascadeInstance: CascadeInstance): ConditionItem;
489
- /** @override */
490
- push(cascadeInstance: CascadeInstance, depth: number): boolean;
491
- /** @override */
492
- pop(cascadeInstance: CascadeInstance, depth: number): boolean;
493
- }
494
- /**
495
- * Not a true condition item, this class restores current language.
496
- */
497
- export declare class RestoreLangItem implements ConditionItem {
498
- readonly lang: string;
499
- constructor(lang: string);
500
- /** @override */
501
- fresh(cascadeInstance: CascadeInstance): ConditionItem;
502
- /** @override */
503
- push(cascadeInstance: CascadeInstance, depth: number): boolean;
504
- /** @override */
505
- pop(cascadeInstance: CascadeInstance, depth: number): boolean;
506
- }
507
- /**
508
- * Not a true condition item, this class manages inheritance of quotes property
509
- */
510
- export declare class QuotesScopeItem implements ConditionItem {
511
- readonly oldQuotes: Css.Str[];
512
- constructor(oldQuotes: Css.Str[]);
513
- /** @override */
514
- fresh(cascadeInstance: CascadeInstance): ConditionItem;
515
- /** @override */
516
- push(cascadeInstance: CascadeInstance, depth: number): boolean;
517
- /** @override */
518
- pop(cascadeInstance: CascadeInstance, depth: number): boolean;
519
- }
520
- export type CounterValues = {
521
- [key: string]: number[];
522
- };
523
- export interface CounterListener {
524
- countersOfId(id: string, counters: CounterValues): any;
525
- getExprContentListener(): Vtree.ExprContentListener;
526
- }
527
- export interface CounterResolver {
528
- setStyler(styler: CssStyler.AbstractStyler): void;
529
- /**
530
- * Returns an Exprs.Val, whose value is calculated at the layout time by
531
- * retrieving the innermost page-based counter (null if it does not exist) by
532
- * its name and formatting the value into a string.
533
- * @param name Name of the page-based counter to be retrieved
534
- * @param format A function that formats the counter value into a string
535
- */
536
- getPageCounterVal(name: string, format: (p1: number | null) => string): Exprs.Val;
537
- /**
538
- * Returns an Exprs.Val, whose value is calculated at the layout time by
539
- * retrieving the page-based counters by its name and formatting the values
540
- * into a string.
541
- * @param name Name of the page-based counters to be retrieved
542
- * @param format A function that formats the counter values (passed as an
543
- * array ordered by the nesting depth with the outermost counter first and
544
- * the innermost last) into a string
545
- */
546
- getPageCountersVal(name: string, format: (p1: number[]) => string): Exprs.Val;
547
- getTargetCounterVal(url: string, name: string, format: (p1: number | null) => string): Exprs.Val;
548
- getTargetCountersVal(url: string, name: string, format: (p1: number[]) => string): Exprs.Val;
549
- /**
550
- * Get value of the CSS string() function
551
- * https://drafts.csswg.org/css-gcpm-3/#using-named-strings
552
- */
553
- getNamedStringVal(name: string, retrievePosition: string): Exprs.Val;
554
- /**
555
- * Set named string for the CSS string-set property
556
- * https://drafts.csswg.org/css-gcpm-3/#setting-named-strings-the-string-set-pro
557
- */
558
- setNamedString(name: string, stringValue: string, cascadeInstance: CascadeInstance): void;
559
- }
560
- export declare class AttrValueFilterVisitor extends Css.FilterVisitor {
561
- element: Element;
562
- constructor(element: Element);
563
- private createValueFromString;
564
- visitFunc(func: Css.Func): Css.Val;
565
- }
566
- export declare class ContentPropVisitor extends Css.FilterVisitor {
567
- cascade: CascadeInstance;
568
- element: Element;
569
- readonly counterResolver: CounterResolver;
570
- constructor(cascade: CascadeInstance, element: Element, counterResolver: CounterResolver);
571
- visitIdent(ident: Css.Ident): Css.Val;
572
- private format;
573
- visitFuncCounter(values: Css.Val[]): Css.Val;
574
- visitFuncCounters(values: Css.Val[]): Css.Val;
575
- visitFuncTargetCounter(values: Css.Val[]): Css.Val;
576
- visitFuncTargetCounters(values: Css.Val[]): Css.Val;
577
- /**
578
- * CSS `string()` function
579
- * https://drafts.csswg.org/css-gcpm-3/#using-named-strings
580
- */
581
- visitFuncString(values: Css.Val[]): Css.Val;
582
- /**
583
- * CSS `content()` function
584
- * https://drafts.csswg.org/css-gcpm-3/#content-function-header
585
- */
586
- visitFuncContent(values: Css.Val[]): Css.Val;
587
- /**
588
- * CSS `leader()` function
589
- * https://www.w3.org/TR/css-content-3/#leaders
590
- */
591
- visitFuncLeader(values: Css.Val[]): Css.Val;
592
- visitFunc(func: Css.Func): Css.Val;
593
- }
594
- export declare function roman(num: number): string;
595
- export declare const additiveNumbering: {
596
- roman: (string | number)[];
597
- armenian: (string | number)[];
598
- georgian: (string | number)[];
599
- hebrew: (string | number)[];
600
- };
601
- export declare const alphabeticNumbering: {
602
- latin: string;
603
- alpha: string;
604
- greek: string;
605
- russian: string;
606
- };
607
- export declare const fixed: {
608
- square: string;
609
- disc: string;
610
- circle: string;
611
- none: string;
612
- };
613
- export declare function additiveFormat(entries: any[], num: number): string;
614
- export declare function expandAlphabet(str: string): string[] | null;
615
- export declare function alphabeticFormat(alphabetStr: string, num: number): string;
616
- export type ChineseNumbering = {
617
- digits: string;
618
- markers: string;
619
- negative: string;
620
- formal: boolean;
621
- };
622
- /**
623
- * From http://www.w3.org/TR/css3-lists/
624
- */
625
- export declare const chineseTradInformal: ChineseNumbering;
626
- export declare function chineseCounter(num: number, numbering: ChineseNumbering): string;
627
- /**
628
- * Fitting order and specificity in the same number. Order is recorded in the
629
- * fractional part. Select value so that
630
- *
631
- * 0x7FFFFFFF != 0x7FFFFFFF + ORDER_INCREMENT
632
- *
633
- */
634
- export declare const ORDER_INCREMENT: number;
635
- export declare function copyTable(src: ActionTable, dst: ActionTable): void;
636
- export declare class Cascade {
637
- nsCount: number;
638
- nsPrefix: {
639
- [key: string]: string;
640
- };
641
- tags: ActionTable;
642
- nstags: ActionTable;
643
- epubtypes: ActionTable;
644
- classes: ActionTable;
645
- ids: ActionTable;
646
- pagetypes: ActionTable;
647
- order: number;
648
- clone(): Cascade;
649
- insertInTable(table: ActionTable, key: string, action: CascadeAction): void;
650
- createInstance(context: Exprs.Context, counterListener: CounterListener, counterResolver: CounterResolver, lang: any): CascadeInstance;
651
- nextOrder(): number;
652
- }
653
- export declare class CascadeInstance {
654
- readonly context: Exprs.Context;
655
- readonly counterListener: CounterListener;
656
- readonly counterResolver: CounterResolver;
657
- code: Cascade;
658
- stack: ConditionItem[][];
659
- conditions: {
660
- [key: string]: number;
661
- };
662
- currentElement: Element | null;
663
- currentElementOffset: number | null;
664
- currentStyle: ElementStyle | null;
665
- currentClassNames: string[] | null;
666
- currentLocalName: string;
667
- currentNamespace: string;
668
- currentId: string;
669
- currentXmlId: string;
670
- currentNSTag: string;
671
- currentEpubTypes: string[] | null;
672
- currentPageType: string | null;
673
- previousPageType: string | null;
674
- firstPageType: string | null;
675
- isFirst: boolean;
676
- isRoot: boolean;
677
- counters: CounterValues;
678
- counterScoping: {
679
- [key: string]: boolean;
680
- }[];
681
- quotes: Css.Str[];
682
- quoteDepth: number;
683
- lang: string;
684
- siblingOrderStack: number[];
685
- currentSiblingOrder: number;
686
- siblingTypeCountsStack: {
687
- [key: string]: {
688
- [key: string]: number;
689
- };
690
- }[];
691
- currentSiblingTypeCounts: {
692
- [key: string]: {
693
- [key: string]: number;
694
- };
695
- };
696
- currentFollowingSiblingOrder: number | null;
697
- followingSiblingOrderStack: (number | null)[];
698
- followingSiblingTypeCountsStack: {
699
- [key: string]: {
700
- [key: string]: number;
701
- };
702
- }[];
703
- currentFollowingSiblingTypeCounts: {
704
- [key: string]: {
705
- [key: string]: number;
706
- };
707
- };
708
- viewConditions: {
709
- [key: string]: Matchers.Matcher[];
710
- };
711
- dependentConditions: string[];
712
- elementStack: Element[];
713
- constructor(cascade: Cascade, context: Exprs.Context, counterListener: CounterListener, counterResolver: CounterResolver, lang: string);
714
- pushConditionItem(item: ConditionItem): void;
715
- increment(condition: string, viewCondition: Matchers.Matcher): void;
716
- decrement(condition: string, viewCondition: Matchers.Matcher): void;
717
- buildViewConditionMatcher(viewConditionId: string | null): Matchers.Matcher;
718
- applyAction(table: ActionTable, key: string): void;
719
- pushRule(classes: string[], pageType: string | null, baseStyle: ElementStyle): void;
720
- defineCounter(counterName: string, value: number): void;
721
- pushCounters(props: ElementStyle): void;
722
- popCounters(): void;
723
- /**
724
- * Process CSS string-set property
725
- * https://drafts.csswg.org/css-gcpm-3/#setting-named-strings-the-string-set-pro
726
- */
727
- setNamedStrings(props: ElementStyle): void;
728
- processPseudoelementProps(pseudoprops: ElementStyle, element: Element): void;
729
- pushElement(styler: CssStyler.AbstractStyler, element: Element, baseStyle: ElementStyle, elementOffset: number): void;
730
- private applyAttrFilterInner;
731
- private applyAttrFilter;
732
- /**
733
- * Substitute all variables in property values in elementStyle
734
- */
735
- applyVarFilter(elementStyles: ElementStyle[], styler: CssStyler.AbstractStyler, element: Element | null): void;
736
- /**
737
- * Calculate all calc() in property values in elementStyle
738
- */
739
- applyCalcFilter(elementStyle: ElementStyle, context: Exprs.Context): void;
740
- private applyActions;
741
- private pop;
742
- popRule(): void;
743
- popElement(element: Element): void;
744
- }
745
- export declare const EMPTY: string[];
746
- /**
747
- * Pseudoelement names in the order they should be processed, empty string is
748
- * the place where the element's DOM children are processed.
749
- */
750
- export declare const pseudoNames: string[];
751
- /**
752
- * @enum {number}
753
- */
754
- export declare enum ParseState {
755
- TOP = 0,
756
- SELECTOR = 1,
757
- RULE = 2
758
- }
759
- /**
760
- * Cascade for base User Agent stylesheet.
761
- */
762
- export declare let uaBaseCascade: Cascade;
763
- export declare function setUABaseCascade(value: Cascade): void;
764
- export declare class CascadeParserHandler extends CssParser.SlaveParserHandler implements CssValidator.PropertyReceiver {
765
- readonly condition: Exprs.Val;
766
- readonly regionId: string | null;
767
- readonly validatorSet: CssValidator.ValidatorSet;
768
- chain: ChainedAction[];
769
- specificity: number;
770
- elementStyle: ElementStyle;
771
- conditionCount: number;
772
- pseudoelement: string | null;
773
- footnoteContent: boolean;
774
- cascade: Cascade;
775
- state: ParseState;
776
- viewConditionId: string | null;
777
- insideSelectorRule: ParseState;
778
- invalid: boolean;
779
- constructor(scope: Exprs.LexicalScope, owner: CssParser.DispatchParserHandler, condition: Exprs.Val, parent: CascadeParserHandler, regionId: string | null, validatorSet: CssValidator.ValidatorSet, topLevel: boolean);
780
- protected insertNonPrimary(action: CascadeAction): void;
781
- processChain(action: CascadeAction): void;
782
- isInsideSelectorRule(mnemonics: string): boolean;
783
- tagSelector(ns: string | null, name: string | null): void;
784
- invalidSelector(message: string): void;
785
- setInvalid(): void;
786
- classSelector(name: string): void;
787
- pseudoclassSelector(name: string, params: (number | string)[]): void;
788
- pseudoelementSelector(name: string, params: (number | string)[]): void;
789
- idSelector(id: string): void;
790
- attributeSelector(ns: string, name: string, op: TokenType, value: string | null): void;
791
- descendantSelector(): void;
792
- childSelector(): void;
793
- adjacentSiblingSelector(): void;
794
- followingSiblingSelector(): void;
795
- nextSelector(): void;
796
- startSelectorRule(): void;
797
- error(mnemonics: string, token: CssTokenizer.Token): void;
798
- startStylesheet(flavor: CssParser.StylesheetFlavor): void;
799
- startRuleBody(): void;
800
- endRule(): void;
801
- finishChain(): void;
802
- protected makeApplyRuleAction(specificity: number): ApplyRuleAction;
803
- special(name: string, value: Css.Val): void;
804
- property(name: string, value: Css.Val, important: boolean): void;
805
- /** @override */
806
- invalidPropertyValue(name: string, value: Css.Val): void;
807
- /** @override */
808
- unknownProperty(name: string, value: Css.Val): void;
809
- /** @override */
810
- simpleProperty(name: string, value: Css.Val, important: any): void;
811
- finish(): Cascade;
812
- startFuncWithSelector(funcName: string): void;
813
- }
814
- export declare const nthSelectorActionClasses: {
815
- [key: string]: typeof IsNthAction;
816
- };
817
- export declare let conditionCount: number;
818
- /**
819
- * Cascade Parser Handler for :is() and similar pseudo-classes parameter
820
- */
821
- export declare class MatchesParameterParserHandler extends CascadeParserHandler {
822
- readonly parent: CascadeParserHandler;
823
- parentChain: ChainedAction[];
824
- chains: ChainedAction[][];
825
- maxSpecificity: number;
826
- selectorTexts: string[];
827
- constructor(parent: CascadeParserHandler);
828
- nextSelector(): void;
829
- endFuncWithSelector(): void;
830
- startRuleBody(): void;
831
- error(mnemonics: string, token: CssTokenizer.Token): void;
832
- pushSelectorText(selectorText: string): void;
833
- /**
834
- * @returns true unless this is `:not()`
835
- */
836
- positive(): boolean;
837
- /**
838
- * @returns true unless this is `:where()`
839
- */
840
- increasingSpecificity(): boolean;
841
- /**
842
- * @returns true if this takes a forgiving selector list (:is/where/has)
843
- */
844
- forgiving(): boolean;
845
- /**
846
- * @returns true if this is `:has()`
847
- */
848
- relational(): boolean;
849
- }
850
- /**
851
- * Cascade Parser Handler for :not() pseudo-class parameter
852
- */
853
- export declare class NotParameterParserHandler extends MatchesParameterParserHandler {
854
- positive(): boolean;
855
- forgiving(): boolean;
856
- }
857
- /**
858
- * Cascade Parser Handler for :where() pseudo-class parameter
859
- */
860
- export declare class WhereParameterParserHandler extends MatchesParameterParserHandler {
861
- increasingSpecificity(): boolean;
862
- }
863
- /**
864
- * Cascade Parser Handler for :has() pseudo-class parameter
865
- */
866
- export declare class HasParameterParserHandler extends MatchesParameterParserHandler {
867
- relational(): boolean;
868
- }
869
- export declare class DefineParserHandler extends CssParser.SlaveParserHandler {
870
- constructor(scope: Exprs.LexicalScope, owner: CssParser.DispatchParserHandler);
871
- property(name: string, value: Css.Val, important: boolean): void;
872
- }
873
- export declare class PropSetParserHandler extends CssParser.SlaveParserHandler implements CssValidator.PropertyReceiver {
874
- readonly condition: Exprs.Val;
875
- readonly elementStyle: ElementStyle;
876
- readonly validatorSet: CssValidator.ValidatorSet;
877
- order: number;
878
- constructor(scope: Exprs.LexicalScope, owner: CssParser.DispatchParserHandler, condition: Exprs.Val, elementStyle: ElementStyle, validatorSet: CssValidator.ValidatorSet);
879
- property(name: string, value: Css.Val, important: boolean): void;
880
- /** @override */
881
- invalidPropertyValue(name: string, value: Css.Val): void;
882
- /** @override */
883
- unknownProperty(name: string, value: Css.Val): void;
884
- /** @override */
885
- simpleProperty(name: string, value: Css.Val, important: any): void;
886
- }
887
- export declare class PropertyParserHandler extends CssParser.ErrorHandler implements CssValidator.PropertyReceiver {
888
- readonly validatorSet: CssValidator.ValidatorSet;
889
- elementStyle: ElementStyle;
890
- order: number;
891
- constructor(scope: Exprs.LexicalScope, validatorSet: CssValidator.ValidatorSet);
892
- property(name: string, value: Css.Val, important: boolean): void;
893
- /** @override */
894
- invalidPropertyValue(name: string, value: Css.Val): void;
895
- /** @override */
896
- unknownProperty(name: string, value: Css.Val): void;
897
- /** @override */
898
- simpleProperty(name: string, value: Css.Val, important: any): void;
899
- }
900
- export declare function forEachViewConditionalStyles(style: ElementStyle, callback: (p1: ElementStyle) => any): void;
901
- export declare function mergeViewConditionalStyles(cascMap: {
902
- [key: string]: CascadeValue;
903
- }, context: Exprs.Context, style: ElementStyle): void;
904
- export declare function parseStyleAttribute(scope: Exprs.LexicalScope, validatorSet: CssValidator.ValidatorSet, baseURL: string, styleAttrValue: string): ElementStyle;
905
- export declare function isVertical(cascaded: {
906
- [key: string]: CascadeValue;
907
- }, context: Exprs.Context, vertical: boolean): boolean;
908
- export declare function isRtl(cascaded: {
909
- [key: string]: CascadeValue;
910
- }, context: Exprs.Context, rtl: boolean): boolean;
911
- export declare function flattenCascadedStyle(style: ElementStyle, context: Exprs.Context, regionIds: string[], isFootnote: boolean, nodeContext: Vtree.NodeContext): {
912
- [key: string]: CascadeValue;
913
- };
914
- export declare function forEachStylesInRegion(style: ElementStyle, regionIds: string[], isFootnote: boolean, callback: (p1: string, p2: ElementStyle) => any): void;
915
- export declare function mergeStyle(to: {
916
- [key: string]: CascadeValue;
917
- }, from: ElementStyle, context: Exprs.Context): void;
918
- /**
919
- * Convert logical properties to physical ones, taking specificity into account.
920
- * @param src Source properties map
921
- * @param dest Destination map
922
- * @param transform If supplied, property values are transformed by this
923
- * function before inserted into the destination map. The first parameter is
924
- * the property name and the second one is the property value.
925
- * @template T
926
- */
927
- export declare const convertToPhysical: <T>(src: {
928
- [key: string]: CascadeValue;
929
- }, dest: {
930
- [key: string]: T;
931
- }, vertical: boolean, rtl: boolean, transform: (p1: string, p2: CascadeValue) => T) => void;
932
- /**
933
- * Convert var() to its value
934
- */
935
- export declare class VarFilterVisitor extends Css.FilterVisitor {
936
- elementStyles: ElementStyle[];
937
- styler: CssStyler.AbstractStyler;
938
- element: Element | null;
939
- constructor(elementStyles: ElementStyle[], styler: CssStyler.AbstractStyler, element: Element | null);
940
- private getVarValue;
941
- visitFunc(func: Css.Func): Css.Val;
942
- }
943
- /**
944
- * Convert calc() to its value
945
- */
946
- export declare class CalcFilterVisitor extends Css.FilterVisitor {
947
- context: Exprs.Context;
948
- resolveViewportUnit?: boolean;
949
- percentRef?: number;
950
- constructor(context: Exprs.Context, resolveViewportUnit?: boolean, percentRef?: number);
951
- visitFunc(func: Css.Func): Css.Val;
952
- visitNumeric(numeric: Css.Numeric): Css.Val;
953
- }
954
- export declare function evaluateCSSToCSS(context: Exprs.Context, val: Css.Val, propName?: string, percentRef?: number): Css.Val;
1
+ import * as Css from "./css";
2
+ import * as CssParser from "./css-parser";
3
+ import * as CssTokenizer from "./css-tokenizer";
4
+ import * as CssValidator from "./css-validator";
5
+ import * as Exprs from "./exprs";
6
+ import * as Matchers from "./matchers";
7
+ import * as Vtree from "./vtree";
8
+ import { CssStyler } from "./types";
9
+ import { TokenType } from "./css-tokenizer";
10
+ export type ElementStyle = {
11
+ [key: string]: CascadeValue | CascadeValue[] | ElementStyleMap | {
12
+ matcher: Matchers.Matcher;
13
+ styles: ElementStyle;
14
+ }[];
15
+ };
16
+ export declare const inheritedProps: {
17
+ "border-collapse": boolean;
18
+ "border-spacing": boolean;
19
+ "caption-side": boolean;
20
+ "clip-rule": boolean;
21
+ color: boolean;
22
+ "color-interpolation": boolean;
23
+ "color-rendering": boolean;
24
+ cursor: boolean;
25
+ direction: boolean;
26
+ "empty-cells": boolean;
27
+ fill: boolean;
28
+ "fill-opacity": boolean;
29
+ "fill-rule": boolean;
30
+ "font-kerning": boolean;
31
+ "font-size": boolean;
32
+ "font-size-adjust": boolean;
33
+ "font-family": boolean;
34
+ "font-feature-settings": boolean;
35
+ "font-style": boolean;
36
+ "font-stretch": boolean;
37
+ "font-variant-ligatures": boolean;
38
+ "font-variant-caps": boolean;
39
+ "font-variant-numeric": boolean;
40
+ "font-variant-east-asian": boolean;
41
+ "font-weight": boolean;
42
+ "glyph-orientation-vertical": boolean;
43
+ "hanging-punctuation": boolean;
44
+ hyphens: boolean;
45
+ "hyphenate-character": boolean;
46
+ "hyphenate-limit-chars": boolean;
47
+ "hyphenate-limit-last": boolean;
48
+ "image-rendering": boolean;
49
+ "image-resolution": boolean;
50
+ "letter-spacing": boolean;
51
+ "line-break": boolean;
52
+ "line-height": boolean;
53
+ "list-style-image": boolean;
54
+ "list-style-position": boolean;
55
+ "list-style-type": boolean;
56
+ marker: boolean;
57
+ "marker-end": boolean;
58
+ "marker-mid": boolean;
59
+ "marker-start": boolean;
60
+ orphans: boolean;
61
+ "overflow-wrap": boolean;
62
+ "paint-order": boolean;
63
+ "pointer-events": boolean;
64
+ quotes: boolean;
65
+ "ruby-align": boolean;
66
+ "ruby-position": boolean;
67
+ "shape-rendering": boolean;
68
+ stroke: boolean;
69
+ "stroke-dasharray": boolean;
70
+ "stroke-dashoffset": boolean;
71
+ "stroke-linecap": boolean;
72
+ "stroke-linejoin": boolean;
73
+ "stroke-miterlimit": boolean;
74
+ "stroke-opacity": boolean;
75
+ "stroke-width": boolean;
76
+ "tab-size": boolean;
77
+ "text-align": boolean;
78
+ "text-align-last": boolean;
79
+ "text-anchor": boolean;
80
+ "text-autospace": boolean;
81
+ "text-decoration-skip": boolean;
82
+ "text-emphasis-color": boolean;
83
+ "text-emphasis-position": boolean;
84
+ "text-emphasis-style": boolean;
85
+ "text-fill-color": boolean;
86
+ "text-combine-upright": boolean;
87
+ "text-indent": boolean;
88
+ "text-justify": boolean;
89
+ "text-orientation": boolean;
90
+ "text-rendering": boolean;
91
+ "text-size-adjust": boolean;
92
+ "text-spacing-trim": boolean;
93
+ "text-stroke-color": boolean;
94
+ "text-stroke-width": boolean;
95
+ "text-transform": boolean;
96
+ "text-underline-position": boolean;
97
+ visibility: boolean;
98
+ "white-space": boolean;
99
+ widows: boolean;
100
+ "word-break": boolean;
101
+ "word-spacing": boolean;
102
+ "writing-mode": boolean;
103
+ };
104
+ export declare const polyfilledInheritedProps: string[];
105
+ export declare function getPolyfilledInheritedProps(): string[];
106
+ export declare const supportedNamespaces: {
107
+ "http://www.idpf.org/2007/ops": boolean;
108
+ "http://www.w3.org/1999/xhtml": boolean;
109
+ "http://www.w3.org/2000/svg": boolean;
110
+ };
111
+ export declare const coupledPatterns: string[];
112
+ export declare const coupledExtentPatterns: string[];
113
+ export declare const geomNames: {
114
+ [key: string]: boolean;
115
+ };
116
+ export declare function buildCouplingMap(sideMap: {
117
+ [key: string]: string;
118
+ }, extentMap: {
119
+ [key: string]: string;
120
+ }): {
121
+ [key: string]: string;
122
+ };
123
+ export declare const couplingMapVert: {
124
+ [key: string]: string;
125
+ };
126
+ export declare const couplingMapHor: {
127
+ [key: string]: string;
128
+ };
129
+ export declare const couplingMapVertRtl: {
130
+ [key: string]: string;
131
+ };
132
+ export declare const couplingMapHorRtl: {
133
+ [key: string]: string;
134
+ };
135
+ export declare class CascadeValue {
136
+ readonly value: Css.Val;
137
+ readonly priority: number;
138
+ constructor(value: Css.Val, priority: number);
139
+ getBaseValue(): CascadeValue;
140
+ filterValue(visitor: Css.Visitor): CascadeValue;
141
+ increaseSpecificity(specificity: number): CascadeValue;
142
+ evaluate(context: Exprs.Context, propName?: string): Css.Val;
143
+ isEnabled(context: Exprs.Context): boolean;
144
+ }
145
+ /**
146
+ * Internal subclass of CascadeValue. Should never be seen outside of the
147
+ * cascade engine.
148
+ */
149
+ export declare class ConditionalCascadeValue extends CascadeValue {
150
+ readonly condition: Exprs.Val;
151
+ constructor(value: Css.Val, priority: number, condition: Exprs.Val);
152
+ getBaseValue(): CascadeValue;
153
+ filterValue(visitor: Css.Visitor): CascadeValue;
154
+ increaseSpecificity(specificity: number): CascadeValue;
155
+ isEnabled(context: Exprs.Context): boolean;
156
+ }
157
+ /**
158
+ * @param tv current value (cannot be conditional)
159
+ * @param av cascaded value (can be conditional)
160
+ */
161
+ export declare function cascadeValues(context: Exprs.Context, tv: CascadeValue, av: CascadeValue): CascadeValue;
162
+ /**
163
+ * setProp with priority checking.
164
+ * If context is given it is same as
165
+ * setProp(style, name, cascadeValues(context, getProp(style, name), value))
166
+ */
167
+ export declare function setPropCascadeValue(style: ElementStyle, name: string, value: CascadeValue, context?: Exprs.Context): void;
168
+ export type ElementStyleMap = {
169
+ [key: string]: ElementStyle;
170
+ };
171
+ export declare const SPECIALS: {
172
+ "region-id": boolean;
173
+ "fragment-selector-id": boolean;
174
+ };
175
+ export declare function isSpecialName(name: string): boolean;
176
+ export declare function isMapName(name: string): boolean;
177
+ export declare function isPropName(name: string): boolean;
178
+ export declare function isInherited(name: string): boolean;
179
+ export declare function getProp(style: ElementStyle, name: string): CascadeValue;
180
+ export declare function setProp(style: ElementStyle, name: string, value: CascadeValue): void;
181
+ export declare function getStyleMap(style: ElementStyle, name: string): ElementStyleMap;
182
+ export declare function getMutableStyleMap(style: ElementStyle, name: string): ElementStyleMap;
183
+ export declare const getViewConditionalStyleMap: (style: ElementStyle) => {
184
+ matcher: Matchers.Matcher;
185
+ styles: ElementStyle;
186
+ }[];
187
+ export declare function getSpecial(style: ElementStyle, name: string): CascadeValue[];
188
+ export declare function getMutableSpecial(style: ElementStyle, name: string): CascadeValue[];
189
+ export declare function mergeIn(context: Exprs.Context, target: ElementStyle, style: ElementStyle, specificity: number, pseudoelement: string | null, regionId: string | null, viewConditionMatcher: Matchers.Matcher | null): void;
190
+ export declare function mergeAll(context: Exprs.Context, styles: ElementStyle[]): ElementStyle;
191
+ export declare function chainActions(chain: ChainedAction[], action: CascadeAction): CascadeAction;
192
+ export declare class InheritanceVisitor extends Css.FilterVisitor {
193
+ readonly props: ElementStyle;
194
+ readonly context: Exprs.Context;
195
+ propName: string;
196
+ constructor(props: ElementStyle, context: Exprs.Context);
197
+ setPropName(name: string): void;
198
+ private getFontSize;
199
+ visitNumeric(numeric: Css.Numeric): Css.Val;
200
+ visitExpr(expr: Css.Expr): Css.Val;
201
+ }
202
+ export declare function convertFontRelativeLengthToPx(numeric: Css.Numeric, baseFontSize: number, context: Exprs.Context): Css.Numeric;
203
+ export declare function convertFontSizeToPx(numeric: Css.Numeric, parentFontSize: number, context: Exprs.Context): Css.Numeric;
204
+ export type ActionTable = {
205
+ [key: string]: CascadeAction;
206
+ };
207
+ export declare class CascadeAction {
208
+ apply(cascadeInstance: CascadeInstance): void;
209
+ mergeWith(other: CascadeAction): CascadeAction;
210
+ clone(): CascadeAction;
211
+ }
212
+ export declare class ConditionItemAction extends CascadeAction {
213
+ readonly conditionItem: ConditionItem;
214
+ constructor(conditionItem: ConditionItem);
215
+ apply(cascadeInstance: CascadeInstance): void;
216
+ }
217
+ export declare class CompoundAction extends CascadeAction {
218
+ readonly list: CascadeAction[];
219
+ constructor(list: CascadeAction[]);
220
+ apply(cascadeInstance: CascadeInstance): void;
221
+ mergeWith(other: CascadeAction): CascadeAction;
222
+ clone(): CascadeAction;
223
+ }
224
+ export declare class ApplyRuleAction extends CascadeAction {
225
+ readonly style: ElementStyle;
226
+ readonly specificity: number;
227
+ readonly pseudoelement: string | null;
228
+ readonly regionId: string | null;
229
+ readonly viewConditionId: string | null;
230
+ constructor(style: ElementStyle, specificity: number, pseudoelement: string | null, regionId: string | null, viewConditionId: string | null);
231
+ apply(cascadeInstance: CascadeInstance): void;
232
+ }
233
+ export declare class ChainedAction extends CascadeAction {
234
+ chained: CascadeAction;
235
+ constructor();
236
+ apply(cascadeInstance: CascadeInstance): void;
237
+ getPriority(): number;
238
+ makePrimary(cascade: Cascade): boolean;
239
+ }
240
+ export declare class CheckClassAction extends ChainedAction {
241
+ readonly className: string;
242
+ constructor(className: string);
243
+ apply(cascadeInstance: CascadeInstance): void;
244
+ getPriority(): number;
245
+ makePrimary(cascade: Cascade): boolean;
246
+ }
247
+ export declare class CheckIdAction extends ChainedAction {
248
+ readonly id: string;
249
+ constructor(id: string);
250
+ apply(cascadeInstance: CascadeInstance): void;
251
+ getPriority(): number;
252
+ makePrimary(cascade: Cascade): boolean;
253
+ }
254
+ export declare class CheckLocalNameAction extends ChainedAction {
255
+ readonly localName: string;
256
+ constructor(localName: string);
257
+ apply(cascadeInstance: CascadeInstance): void;
258
+ getPriority(): number;
259
+ makePrimary(cascade: Cascade): boolean;
260
+ }
261
+ export declare class CheckNSTagAction extends ChainedAction {
262
+ readonly ns: string;
263
+ readonly localName: string;
264
+ constructor(ns: string, localName: string);
265
+ apply(cascadeInstance: CascadeInstance): void;
266
+ getPriority(): number;
267
+ makePrimary(cascade: Cascade): boolean;
268
+ }
269
+ export declare class CheckTargetEpubTypeAction extends ChainedAction {
270
+ readonly epubTypePatt: RegExp;
271
+ constructor(epubTypePatt: RegExp);
272
+ apply(cascadeInstance: CascadeInstance): void;
273
+ }
274
+ export declare class CheckNamespaceAction extends ChainedAction {
275
+ readonly ns: string;
276
+ constructor(ns: string);
277
+ apply(cascadeInstance: CascadeInstance): void;
278
+ }
279
+ export declare class CheckAttributePresentAction extends ChainedAction {
280
+ readonly ns: string;
281
+ readonly name: string;
282
+ constructor(ns: string, name: string);
283
+ apply(cascadeInstance: CascadeInstance): void;
284
+ }
285
+ export declare class CheckAttributeEqAction extends ChainedAction {
286
+ readonly ns: string;
287
+ readonly name: string;
288
+ readonly value: string;
289
+ constructor(ns: string, name: string, value: string);
290
+ apply(cascadeInstance: CascadeInstance): void;
291
+ getPriority(): number;
292
+ makePrimary(cascade: Cascade): boolean;
293
+ }
294
+ export declare class CheckNamespaceSupportedAction extends ChainedAction {
295
+ readonly ns: string;
296
+ readonly name: string;
297
+ constructor(ns: string, name: string);
298
+ apply(cascadeInstance: CascadeInstance): void;
299
+ getPriority(): number;
300
+ makePrimary(cascade: Cascade): boolean;
301
+ }
302
+ export declare class CheckAttributeRegExpAction extends ChainedAction {
303
+ readonly ns: string;
304
+ readonly name: string;
305
+ readonly regexp: RegExp;
306
+ constructor(ns: string, name: string, regexp: RegExp);
307
+ apply(cascadeInstance: CascadeInstance): void;
308
+ }
309
+ export declare class CheckLangAction extends ChainedAction {
310
+ readonly langRegExp: RegExp;
311
+ constructor(langRegExp: RegExp);
312
+ apply(cascadeInstance: CascadeInstance): void;
313
+ }
314
+ export declare class IsFirstAction extends ChainedAction {
315
+ constructor();
316
+ apply(cascadeInstance: CascadeInstance): void;
317
+ getPriority(): number;
318
+ }
319
+ export declare class IsRootAction extends ChainedAction {
320
+ constructor();
321
+ apply(cascadeInstance: CascadeInstance): void;
322
+ getPriority(): number;
323
+ }
324
+ export declare class IsNthAction extends ChainedAction {
325
+ readonly a: number;
326
+ readonly b: number;
327
+ constructor(a: number, b: number);
328
+ /**
329
+ * Checkes whether given order can be represented as an+b with a non-negative
330
+ * interger n
331
+ */
332
+ protected matchANPlusB(order: number): boolean;
333
+ }
334
+ export declare class IsNthSiblingAction extends IsNthAction {
335
+ constructor(a: number, b: number);
336
+ apply(cascadeInstance: CascadeInstance): void;
337
+ getPriority(): number;
338
+ }
339
+ export declare class IsNthSiblingOfTypeAction extends IsNthAction {
340
+ constructor(a: number, b: number);
341
+ apply(cascadeInstance: CascadeInstance): void;
342
+ getPriority(): number;
343
+ }
344
+ export declare class IsNthLastSiblingAction extends IsNthAction {
345
+ constructor(a: number, b: number);
346
+ apply(cascadeInstance: CascadeInstance): void;
347
+ getPriority(): number;
348
+ }
349
+ export declare class IsNthLastSiblingOfTypeAction extends IsNthAction {
350
+ constructor(a: number, b: number);
351
+ apply(cascadeInstance: CascadeInstance): void;
352
+ getPriority(): number;
353
+ }
354
+ export declare class IsEmptyAction extends ChainedAction {
355
+ constructor();
356
+ apply(cascadeInstance: CascadeInstance): void;
357
+ getPriority(): number;
358
+ }
359
+ export declare class IsEnabledAction extends ChainedAction {
360
+ constructor();
361
+ apply(cascadeInstance: CascadeInstance): void;
362
+ getPriority(): number;
363
+ }
364
+ export declare class IsDisabledAction extends ChainedAction {
365
+ constructor();
366
+ apply(cascadeInstance: CascadeInstance): void;
367
+ getPriority(): number;
368
+ }
369
+ export declare class IsCheckedAction extends ChainedAction {
370
+ constructor();
371
+ apply(cascadeInstance: CascadeInstance): void;
372
+ getPriority(): number;
373
+ }
374
+ export declare class CheckConditionAction extends ChainedAction {
375
+ readonly condition: string;
376
+ constructor(condition: string);
377
+ apply(cascadeInstance: CascadeInstance): void;
378
+ getPriority(): number;
379
+ }
380
+ export declare class CheckAppliedAction extends CascadeAction {
381
+ applied: boolean;
382
+ constructor();
383
+ apply(cascadeInstance: CascadeInstance): void;
384
+ clone(): CascadeAction;
385
+ }
386
+ /**
387
+ * Cascade Action for :is() and similar pseudo-classes
388
+ */
389
+ export declare class MatchesAction extends ChainedAction {
390
+ checkAppliedAction: CheckAppliedAction;
391
+ firstActions: CascadeAction[];
392
+ constructor(chains: ChainedAction[][]);
393
+ apply(cascadeInstance: CascadeInstance): void;
394
+ getPriority(): number;
395
+ positive(): boolean;
396
+ relational(): boolean;
397
+ }
398
+ /**
399
+ * Cascade Action for :not() pseudo-class
400
+ */
401
+ export declare class MatchesNoneAction extends MatchesAction {
402
+ positive(): boolean;
403
+ }
404
+ /**
405
+ * Cascade Action for :has() pseudo-class
406
+ */
407
+ export declare class MatchesRelationalAction extends MatchesAction {
408
+ selectorTexts: string[];
409
+ constructor(selectorTexts: string[]);
410
+ apply(cascadeInstance: CascadeInstance): void;
411
+ relational(): boolean;
412
+ }
413
+ /**
414
+ * An object that is notified as elements are pushed and popped and typically
415
+ * controls a "named condition" (which is a count associated with a name).
416
+ */
417
+ export interface ConditionItem {
418
+ /**
419
+ * Returns a "fresh" copy of this item. May be this if immutable.
420
+ */
421
+ fresh(cascadeInstance: CascadeInstance): ConditionItem;
422
+ /**
423
+ * Depth is 0 for element itself and its siblings, 1 for direct children and
424
+ * -1 for the parent.
425
+ */
426
+ push(cascadeInstance: CascadeInstance, depth: number): boolean;
427
+ /**
428
+ * @return return true if no more notifications are desired
429
+ */
430
+ pop(cascadeInstance: CascadeInstance, depth: number): boolean;
431
+ }
432
+ export declare class AbstractConditionItem {
433
+ readonly condition: string;
434
+ readonly viewConditionId: string | null;
435
+ readonly viewCondition: Matchers.Matcher;
436
+ constructor(condition: string, viewConditionId: string | null, viewCondition: Matchers.Matcher);
437
+ increment(cascadeInstance: CascadeInstance): void;
438
+ decrement(cascadeInstance: CascadeInstance): void;
439
+ buildViewConditionMatcher(cascadeInstance: CascadeInstance): Matchers.Matcher;
440
+ }
441
+ export declare class DescendantConditionItem extends AbstractConditionItem implements ConditionItem {
442
+ constructor(condition: string, viewConditionId: string | null, viewCondition: Matchers.Matcher);
443
+ /** @override */
444
+ fresh(cascadeInstance: CascadeInstance): ConditionItem;
445
+ /** @override */
446
+ push(cascadeInstance: CascadeInstance, depth: number): boolean;
447
+ /** @override */
448
+ pop(cascadeInstance: CascadeInstance, depth: number): boolean;
449
+ }
450
+ export declare class ChildConditionItem extends AbstractConditionItem implements ConditionItem {
451
+ constructor(condition: string, viewConditionId: string | null, viewCondition: Matchers.Matcher);
452
+ /** @override */
453
+ fresh(cascadeInstance: CascadeInstance): ConditionItem;
454
+ /** @override */
455
+ push(cascadeInstance: CascadeInstance, depth: number): boolean;
456
+ /** @override */
457
+ pop(cascadeInstance: CascadeInstance, depth: number): boolean;
458
+ }
459
+ export declare class AdjacentSiblingConditionItem extends AbstractConditionItem implements ConditionItem {
460
+ fired: boolean;
461
+ constructor(condition: string, viewConditionId: string | null, viewCondition: Matchers.Matcher);
462
+ /** @override */
463
+ fresh(cascadeInstance: CascadeInstance): ConditionItem;
464
+ /** @override */
465
+ push(cascadeInstance: CascadeInstance, depth: number): boolean;
466
+ /** @override */
467
+ pop(cascadeInstance: CascadeInstance, depth: number): boolean;
468
+ }
469
+ export declare class FollowingSiblingConditionItem extends AbstractConditionItem implements ConditionItem {
470
+ fired: boolean;
471
+ constructor(condition: string, viewConditionId: string | null, viewCondition: Matchers.Matcher);
472
+ /** @override */
473
+ fresh(cascadeInstance: CascadeInstance): ConditionItem;
474
+ /** @override */
475
+ push(cascadeInstance: CascadeInstance, depth: number): boolean;
476
+ /** @override */
477
+ pop(cascadeInstance: CascadeInstance, depth: number): boolean;
478
+ }
479
+ /**
480
+ * Not a true condition item, this class manages proper handling of "after"
481
+ * pseudoelement.
482
+ */
483
+ export declare class AfterPseudoelementItem implements ConditionItem {
484
+ readonly afterprop: ElementStyle;
485
+ readonly element: Element;
486
+ constructor(afterprop: ElementStyle, element: Element);
487
+ /** @override */
488
+ fresh(cascadeInstance: CascadeInstance): ConditionItem;
489
+ /** @override */
490
+ push(cascadeInstance: CascadeInstance, depth: number): boolean;
491
+ /** @override */
492
+ pop(cascadeInstance: CascadeInstance, depth: number): boolean;
493
+ }
494
+ /**
495
+ * Not a true condition item, this class restores current language.
496
+ */
497
+ export declare class RestoreLangItem implements ConditionItem {
498
+ readonly lang: string;
499
+ constructor(lang: string);
500
+ /** @override */
501
+ fresh(cascadeInstance: CascadeInstance): ConditionItem;
502
+ /** @override */
503
+ push(cascadeInstance: CascadeInstance, depth: number): boolean;
504
+ /** @override */
505
+ pop(cascadeInstance: CascadeInstance, depth: number): boolean;
506
+ }
507
+ /**
508
+ * Not a true condition item, this class manages inheritance of quotes property
509
+ */
510
+ export declare class QuotesScopeItem implements ConditionItem {
511
+ readonly oldQuotes: Css.Str[];
512
+ constructor(oldQuotes: Css.Str[]);
513
+ /** @override */
514
+ fresh(cascadeInstance: CascadeInstance): ConditionItem;
515
+ /** @override */
516
+ push(cascadeInstance: CascadeInstance, depth: number): boolean;
517
+ /** @override */
518
+ pop(cascadeInstance: CascadeInstance, depth: number): boolean;
519
+ }
520
+ export type CounterValues = {
521
+ [key: string]: number[];
522
+ };
523
+ export interface CounterListener {
524
+ countersOfId(id: string, counters: CounterValues): any;
525
+ getExprContentListener(): Vtree.ExprContentListener;
526
+ }
527
+ export interface CounterResolver {
528
+ setStyler(styler: CssStyler.AbstractStyler): void;
529
+ /**
530
+ * Returns an Exprs.Val, whose value is calculated at the layout time by
531
+ * retrieving the innermost page-based counter (null if it does not exist) by
532
+ * its name and formatting the value into a string.
533
+ * @param name Name of the page-based counter to be retrieved
534
+ * @param format A function that formats the counter value into a string
535
+ */
536
+ getPageCounterVal(name: string, format: (p1: number | null) => string): Exprs.Val;
537
+ /**
538
+ * Returns an Exprs.Val, whose value is calculated at the layout time by
539
+ * retrieving the page-based counters by its name and formatting the values
540
+ * into a string.
541
+ * @param name Name of the page-based counters to be retrieved
542
+ * @param format A function that formats the counter values (passed as an
543
+ * array ordered by the nesting depth with the outermost counter first and
544
+ * the innermost last) into a string
545
+ */
546
+ getPageCountersVal(name: string, format: (p1: number[]) => string): Exprs.Val;
547
+ getTargetCounterVal(url: string, name: string, format: (p1: number | null) => string): Exprs.Val;
548
+ getTargetCountersVal(url: string, name: string, format: (p1: number[]) => string): Exprs.Val;
549
+ /**
550
+ * Get value of the CSS string() function
551
+ * https://drafts.csswg.org/css-gcpm-3/#using-named-strings
552
+ */
553
+ getNamedStringVal(name: string, retrievePosition: string): Exprs.Val;
554
+ /**
555
+ * Set named string for the CSS string-set property
556
+ * https://drafts.csswg.org/css-gcpm-3/#setting-named-strings-the-string-set-pro
557
+ */
558
+ setNamedString(name: string, stringValue: string, elementOffset: number): void;
559
+ /**
560
+ * Get value of the CSS element() function
561
+ * https://drafts.csswg.org/css-gcpm-3/#running-elements
562
+ */
563
+ getRunningElementVal(name: string, retrievePosition: string): Exprs.Val;
564
+ /**
565
+ * Set running element
566
+ * https://drafts.csswg.org/css-gcpm-3/#running-elements
567
+ */
568
+ setRunningElement(name: string, elementOffset: number): void;
569
+ }
570
+ export declare class AttrValueFilterVisitor extends Css.FilterVisitor {
571
+ element: Element;
572
+ constructor(element: Element);
573
+ private createValueFromString;
574
+ visitFunc(func: Css.Func): Css.Val;
575
+ }
576
+ export declare class ContentPropVisitor extends Css.FilterVisitor {
577
+ cascade: CascadeInstance;
578
+ element: Element;
579
+ readonly counterResolver: CounterResolver;
580
+ constructor(cascade: CascadeInstance, element: Element, counterResolver: CounterResolver);
581
+ visitIdent(ident: Css.Ident): Css.Val;
582
+ private format;
583
+ visitFuncCounter(values: Css.Val[]): Css.Val;
584
+ visitFuncCounters(values: Css.Val[]): Css.Val;
585
+ visitFuncTargetCounter(values: Css.Val[]): Css.Val;
586
+ visitFuncTargetCounters(values: Css.Val[]): Css.Val;
587
+ /**
588
+ * CSS `string()` function
589
+ * https://drafts.csswg.org/css-gcpm-3/#using-named-strings
590
+ */
591
+ visitFuncString(values: Css.Val[]): Css.Val;
592
+ /**
593
+ * CSS `element()` function
594
+ * https://drafts.csswg.org/css-gcpm-3/#running-elements
595
+ */
596
+ visitFuncElement(values: Css.Val[]): Css.Val;
597
+ /**
598
+ * CSS `content()` function
599
+ * https://drafts.csswg.org/css-gcpm-3/#content-function-header
600
+ */
601
+ visitFuncContent(values: Css.Val[]): Css.Val;
602
+ /**
603
+ * CSS `leader()` function
604
+ * https://www.w3.org/TR/css-content-3/#leaders
605
+ */
606
+ visitFuncLeader(values: Css.Val[]): Css.Val;
607
+ visitFunc(func: Css.Func): Css.Val;
608
+ }
609
+ export declare function roman(num: number): string;
610
+ export declare const additiveNumbering: {
611
+ roman: (string | number)[];
612
+ armenian: (string | number)[];
613
+ georgian: (string | number)[];
614
+ hebrew: (string | number)[];
615
+ };
616
+ export declare const alphabeticNumbering: {
617
+ latin: string;
618
+ alpha: string;
619
+ greek: string;
620
+ russian: string;
621
+ };
622
+ export declare const fixed: {
623
+ square: string;
624
+ disc: string;
625
+ circle: string;
626
+ none: string;
627
+ };
628
+ export declare function additiveFormat(entries: any[], num: number): string;
629
+ export declare function expandAlphabet(str: string): string[] | null;
630
+ export declare function alphabeticFormat(alphabetStr: string, num: number): string;
631
+ export type ChineseNumbering = {
632
+ digits: string;
633
+ markers: string;
634
+ negative: string;
635
+ formal: boolean;
636
+ };
637
+ /**
638
+ * From http://www.w3.org/TR/css3-lists/
639
+ */
640
+ export declare const chineseTradInformal: ChineseNumbering;
641
+ export declare function chineseCounter(num: number, numbering: ChineseNumbering): string;
642
+ /**
643
+ * Fitting order and specificity in the same number. Order is recorded in the
644
+ * fractional part. Select value so that
645
+ *
646
+ * 0x7FFFFFFF != 0x7FFFFFFF + ORDER_INCREMENT
647
+ *
648
+ */
649
+ export declare const ORDER_INCREMENT: number;
650
+ export declare function copyTable(src: ActionTable, dst: ActionTable): void;
651
+ export declare class Cascade {
652
+ nsCount: number;
653
+ nsPrefix: {
654
+ [key: string]: string;
655
+ };
656
+ tags: ActionTable;
657
+ nstags: ActionTable;
658
+ epubtypes: ActionTable;
659
+ classes: ActionTable;
660
+ ids: ActionTable;
661
+ pagetypes: ActionTable;
662
+ order: number;
663
+ clone(): Cascade;
664
+ insertInTable(table: ActionTable, key: string, action: CascadeAction): void;
665
+ createInstance(context: Exprs.Context, counterListener: CounterListener, counterResolver: CounterResolver, lang: any): CascadeInstance;
666
+ nextOrder(): number;
667
+ }
668
+ export declare class CascadeInstance {
669
+ readonly context: Exprs.Context;
670
+ readonly counterListener: CounterListener;
671
+ readonly counterResolver: CounterResolver;
672
+ code: Cascade;
673
+ stack: ConditionItem[][];
674
+ conditions: {
675
+ [key: string]: number;
676
+ };
677
+ currentElement: Element | null;
678
+ currentElementOffset: number | null;
679
+ currentStyle: ElementStyle | null;
680
+ currentClassNames: string[] | null;
681
+ currentLocalName: string;
682
+ currentNamespace: string;
683
+ currentId: string;
684
+ currentXmlId: string;
685
+ currentNSTag: string;
686
+ currentEpubTypes: string[] | null;
687
+ currentPageType: string | null;
688
+ previousPageType: string | null;
689
+ firstPageType: string | null;
690
+ isFirst: boolean;
691
+ isRoot: boolean;
692
+ counters: CounterValues;
693
+ counterScoping: {
694
+ [key: string]: boolean;
695
+ }[];
696
+ quotes: Css.Str[];
697
+ quoteDepth: number;
698
+ lang: string;
699
+ siblingOrderStack: number[];
700
+ currentSiblingOrder: number;
701
+ siblingTypeCountsStack: {
702
+ [key: string]: {
703
+ [key: string]: number;
704
+ };
705
+ }[];
706
+ currentSiblingTypeCounts: {
707
+ [key: string]: {
708
+ [key: string]: number;
709
+ };
710
+ };
711
+ currentFollowingSiblingOrder: number | null;
712
+ followingSiblingOrderStack: (number | null)[];
713
+ followingSiblingTypeCountsStack: {
714
+ [key: string]: {
715
+ [key: string]: number;
716
+ };
717
+ }[];
718
+ currentFollowingSiblingTypeCounts: {
719
+ [key: string]: {
720
+ [key: string]: number;
721
+ };
722
+ };
723
+ viewConditions: {
724
+ [key: string]: Matchers.Matcher[];
725
+ };
726
+ dependentConditions: string[];
727
+ elementStack: Element[];
728
+ constructor(cascade: Cascade, context: Exprs.Context, counterListener: CounterListener, counterResolver: CounterResolver, lang: string);
729
+ pushConditionItem(item: ConditionItem): void;
730
+ increment(condition: string, viewCondition: Matchers.Matcher): void;
731
+ decrement(condition: string, viewCondition: Matchers.Matcher): void;
732
+ buildViewConditionMatcher(viewConditionId: string | null): Matchers.Matcher;
733
+ applyAction(table: ActionTable, key: string): void;
734
+ pushRule(classes: string[], pageType: string | null, baseStyle: ElementStyle): void;
735
+ defineCounter(counterName: string, value: number): void;
736
+ pushCounters(props: ElementStyle): void;
737
+ popCounters(): void;
738
+ /**
739
+ * Process CSS string-set property
740
+ * https://drafts.csswg.org/css-gcpm-3/#setting-named-strings-the-string-set-pro
741
+ */
742
+ setNamedStrings(props: ElementStyle): void;
743
+ /**
744
+ * Process CSS running elements
745
+ * https://drafts.csswg.org/css-gcpm-3/#running-elements
746
+ */
747
+ setRunningElement(props: ElementStyle): void;
748
+ processPseudoelementProps(pseudoprops: ElementStyle, element: Element): void;
749
+ pushElement(styler: CssStyler.AbstractStyler, element: Element, baseStyle: ElementStyle, elementOffset: number): void;
750
+ private applyAttrFilterInner;
751
+ private applyAttrFilter;
752
+ /**
753
+ * Substitute all variables in property values in elementStyle
754
+ */
755
+ applyVarFilter(elementStyles: ElementStyle[], styler: CssStyler.AbstractStyler, element: Element | null): void;
756
+ /**
757
+ * Calculate all calc() in property values in elementStyle
758
+ */
759
+ applyCalcFilter(elementStyle: ElementStyle, context: Exprs.Context): void;
760
+ private applyActions;
761
+ private pop;
762
+ popRule(): void;
763
+ popElement(element: Element): void;
764
+ }
765
+ export declare const EMPTY: string[];
766
+ /**
767
+ * Pseudoelement names in the order they should be processed, empty string is
768
+ * the place where the element's DOM children are processed.
769
+ */
770
+ export declare const pseudoNames: string[];
771
+ /**
772
+ * @enum {number}
773
+ */
774
+ export declare enum ParseState {
775
+ TOP = 0,
776
+ SELECTOR = 1,
777
+ RULE = 2
778
+ }
779
+ /**
780
+ * Cascade for base User Agent stylesheet.
781
+ */
782
+ export declare let uaBaseCascade: Cascade;
783
+ export declare function setUABaseCascade(value: Cascade): void;
784
+ export declare class CascadeParserHandler extends CssParser.SlaveParserHandler implements CssValidator.PropertyReceiver {
785
+ readonly condition: Exprs.Val;
786
+ readonly regionId: string | null;
787
+ readonly validatorSet: CssValidator.ValidatorSet;
788
+ chain: ChainedAction[];
789
+ specificity: number;
790
+ elementStyle: ElementStyle;
791
+ conditionCount: number;
792
+ pseudoelement: string | null;
793
+ footnoteContent: boolean;
794
+ cascade: Cascade;
795
+ state: ParseState;
796
+ viewConditionId: string | null;
797
+ insideSelectorRule: ParseState;
798
+ invalid: boolean;
799
+ constructor(scope: Exprs.LexicalScope, owner: CssParser.DispatchParserHandler, condition: Exprs.Val, parent: CascadeParserHandler, regionId: string | null, validatorSet: CssValidator.ValidatorSet, topLevel: boolean);
800
+ protected insertNonPrimary(action: CascadeAction): void;
801
+ processChain(action: CascadeAction): void;
802
+ isInsideSelectorRule(mnemonics: string): boolean;
803
+ tagSelector(ns: string | null, name: string | null): void;
804
+ invalidSelector(message: string): void;
805
+ setInvalid(): void;
806
+ classSelector(name: string): void;
807
+ pseudoclassSelector(name: string, params: (number | string)[]): void;
808
+ pseudoelementSelector(name: string, params: (number | string)[]): void;
809
+ idSelector(id: string): void;
810
+ attributeSelector(ns: string, name: string, op: TokenType, value: string | null): void;
811
+ descendantSelector(): void;
812
+ childSelector(): void;
813
+ adjacentSiblingSelector(): void;
814
+ followingSiblingSelector(): void;
815
+ nextSelector(): void;
816
+ startSelectorRule(): void;
817
+ error(mnemonics: string, token: CssTokenizer.Token): void;
818
+ startStylesheet(flavor: CssParser.StylesheetFlavor): void;
819
+ startRuleBody(): void;
820
+ endRule(): void;
821
+ finishChain(): void;
822
+ protected makeApplyRuleAction(specificity: number): ApplyRuleAction;
823
+ special(name: string, value: Css.Val): void;
824
+ property(name: string, value: Css.Val, important: boolean): void;
825
+ /** @override */
826
+ invalidPropertyValue(name: string, value: Css.Val): void;
827
+ /** @override */
828
+ unknownProperty(name: string, value: Css.Val): void;
829
+ /** @override */
830
+ simpleProperty(name: string, value: Css.Val, important: any): void;
831
+ finish(): Cascade;
832
+ startFuncWithSelector(funcName: string): void;
833
+ }
834
+ export declare const nthSelectorActionClasses: {
835
+ [key: string]: typeof IsNthAction;
836
+ };
837
+ export declare let conditionCount: number;
838
+ /**
839
+ * Cascade Parser Handler for :is() and similar pseudo-classes parameter
840
+ */
841
+ export declare class MatchesParameterParserHandler extends CascadeParserHandler {
842
+ readonly parent: CascadeParserHandler;
843
+ parentChain: ChainedAction[];
844
+ chains: ChainedAction[][];
845
+ maxSpecificity: number;
846
+ selectorTexts: string[];
847
+ constructor(parent: CascadeParserHandler);
848
+ nextSelector(): void;
849
+ endFuncWithSelector(): void;
850
+ startRuleBody(): void;
851
+ error(mnemonics: string, token: CssTokenizer.Token): void;
852
+ pushSelectorText(selectorText: string): void;
853
+ /**
854
+ * @returns true unless this is `:not()`
855
+ */
856
+ positive(): boolean;
857
+ /**
858
+ * @returns true unless this is `:where()`
859
+ */
860
+ increasingSpecificity(): boolean;
861
+ /**
862
+ * @returns true if this takes a forgiving selector list (:is/where/has)
863
+ */
864
+ forgiving(): boolean;
865
+ /**
866
+ * @returns true if this is `:has()`
867
+ */
868
+ relational(): boolean;
869
+ }
870
+ /**
871
+ * Cascade Parser Handler for :not() pseudo-class parameter
872
+ */
873
+ export declare class NotParameterParserHandler extends MatchesParameterParserHandler {
874
+ positive(): boolean;
875
+ forgiving(): boolean;
876
+ }
877
+ /**
878
+ * Cascade Parser Handler for :where() pseudo-class parameter
879
+ */
880
+ export declare class WhereParameterParserHandler extends MatchesParameterParserHandler {
881
+ increasingSpecificity(): boolean;
882
+ }
883
+ /**
884
+ * Cascade Parser Handler for :has() pseudo-class parameter
885
+ */
886
+ export declare class HasParameterParserHandler extends MatchesParameterParserHandler {
887
+ relational(): boolean;
888
+ }
889
+ export declare class DefineParserHandler extends CssParser.SlaveParserHandler {
890
+ constructor(scope: Exprs.LexicalScope, owner: CssParser.DispatchParserHandler);
891
+ property(name: string, value: Css.Val, important: boolean): void;
892
+ }
893
+ export declare class PropSetParserHandler extends CssParser.SlaveParserHandler implements CssValidator.PropertyReceiver {
894
+ readonly condition: Exprs.Val;
895
+ readonly elementStyle: ElementStyle;
896
+ readonly validatorSet: CssValidator.ValidatorSet;
897
+ order: number;
898
+ constructor(scope: Exprs.LexicalScope, owner: CssParser.DispatchParserHandler, condition: Exprs.Val, elementStyle: ElementStyle, validatorSet: CssValidator.ValidatorSet);
899
+ property(name: string, value: Css.Val, important: boolean): void;
900
+ /** @override */
901
+ invalidPropertyValue(name: string, value: Css.Val): void;
902
+ /** @override */
903
+ unknownProperty(name: string, value: Css.Val): void;
904
+ /** @override */
905
+ simpleProperty(name: string, value: Css.Val, important: any): void;
906
+ }
907
+ export declare class PropertyParserHandler extends CssParser.ErrorHandler implements CssValidator.PropertyReceiver {
908
+ readonly validatorSet: CssValidator.ValidatorSet;
909
+ elementStyle: ElementStyle;
910
+ order: number;
911
+ constructor(scope: Exprs.LexicalScope, validatorSet: CssValidator.ValidatorSet);
912
+ property(name: string, value: Css.Val, important: boolean): void;
913
+ /** @override */
914
+ invalidPropertyValue(name: string, value: Css.Val): void;
915
+ /** @override */
916
+ unknownProperty(name: string, value: Css.Val): void;
917
+ /** @override */
918
+ simpleProperty(name: string, value: Css.Val, important: any): void;
919
+ }
920
+ export declare function forEachViewConditionalStyles(style: ElementStyle, callback: (p1: ElementStyle) => any): void;
921
+ export declare function mergeViewConditionalStyles(cascMap: {
922
+ [key: string]: CascadeValue;
923
+ }, context: Exprs.Context, style: ElementStyle): void;
924
+ export declare function parseStyleAttribute(scope: Exprs.LexicalScope, validatorSet: CssValidator.ValidatorSet, baseURL: string, styleAttrValue: string): ElementStyle;
925
+ export declare function isVertical(cascaded: {
926
+ [key: string]: CascadeValue;
927
+ }, context: Exprs.Context, vertical: boolean): boolean;
928
+ export declare function isRtl(cascaded: {
929
+ [key: string]: CascadeValue;
930
+ }, context: Exprs.Context, rtl: boolean): boolean;
931
+ export declare function flattenCascadedStyle(style: ElementStyle, context: Exprs.Context, regionIds: string[], isFootnote: boolean, nodeContext: Vtree.NodeContext): {
932
+ [key: string]: CascadeValue;
933
+ };
934
+ export declare function forEachStylesInRegion(style: ElementStyle, regionIds: string[], isFootnote: boolean, callback: (p1: string, p2: ElementStyle) => any): void;
935
+ export declare function mergeStyle(to: {
936
+ [key: string]: CascadeValue;
937
+ }, from: ElementStyle, context: Exprs.Context): void;
938
+ /**
939
+ * Convert logical properties to physical ones, taking specificity into account.
940
+ * @param src Source properties map
941
+ * @param dest Destination map
942
+ * @param transform If supplied, property values are transformed by this
943
+ * function before inserted into the destination map. The first parameter is
944
+ * the property name and the second one is the property value.
945
+ * @template T
946
+ */
947
+ export declare const convertToPhysical: <T>(src: {
948
+ [key: string]: CascadeValue;
949
+ }, dest: {
950
+ [key: string]: T;
951
+ }, vertical: boolean, rtl: boolean, transform: (p1: string, p2: CascadeValue) => T) => void;
952
+ /**
953
+ * Convert var() to its value
954
+ */
955
+ export declare class VarFilterVisitor extends Css.FilterVisitor {
956
+ elementStyles: ElementStyle[];
957
+ styler: CssStyler.AbstractStyler;
958
+ element: Element | null;
959
+ constructor(elementStyles: ElementStyle[], styler: CssStyler.AbstractStyler, element: Element | null);
960
+ private getVarValue;
961
+ visitFunc(func: Css.Func): Css.Val;
962
+ }
963
+ /**
964
+ * Convert calc() to its value
965
+ */
966
+ export declare class CalcFilterVisitor extends Css.FilterVisitor {
967
+ context: Exprs.Context;
968
+ resolveViewportUnit?: boolean;
969
+ percentRef?: number;
970
+ constructor(context: Exprs.Context, resolveViewportUnit?: boolean, percentRef?: number);
971
+ visitFunc(func: Css.Func): Css.Val;
972
+ visitNumeric(numeric: Css.Numeric): Css.Val;
973
+ }
974
+ export declare function evaluateCSSToCSS(context: Exprs.Context, val: Css.Val, propName?: string, percentRef?: number): Css.Val;