@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.
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 +127 -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 -450
  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,395 +1,395 @@
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 Exprs - `-epubx-expr` Adaptive Layout expressions.
20
- */
21
- import * as Base from "./base";
22
- export declare type Preferences = {
23
- fontFamily: string;
24
- lineHeight: number;
25
- margin: number;
26
- hyphenate: boolean;
27
- columnWidth: number;
28
- horizontal: boolean;
29
- nightMode: boolean;
30
- spreadView: boolean;
31
- pageBorder: number;
32
- enabledMediaTypes: {
33
- [key: string]: boolean;
34
- };
35
- defaultPaperSize?: {
36
- [key: string]: number;
37
- };
38
- };
39
- export declare function defaultPreferences(): Preferences;
40
- export declare function clonePreferences(pref: Preferences): Preferences;
41
- export declare const defaultPreferencesInstance: Preferences;
42
- interface Pending {
43
- }
44
- declare type Special = Pending;
45
- /**
46
- * Special marker value that indicates that the expression result is being
47
- * calculated.
48
- */
49
- export declare const Special: {
50
- PENDING: Pending;
51
- };
52
- export declare type Result = string | number | boolean | undefined;
53
- export declare type PendingResult = Special | Result;
54
- export declare function letterbox(viewW: number, viewH: number, objW: number, objH: number): string;
55
- /**
56
- * @return string that can be parsed as CSS string with value str
57
- */
58
- export declare function cssString(str: string): string;
59
- /**
60
- * @return string that can be parsed as CSS name
61
- */
62
- export declare function cssIdent(name: string): string;
63
- export declare function makeQualifiedName(objName: string | null, memberName: string): string;
64
- export declare let nextKeyIndex: number;
65
- /**
66
- * Lexical scope of the expression.
67
- */
68
- export declare class LexicalScope {
69
- parent: LexicalScope;
70
- resolver?: (p1: string, p2: boolean) => Val;
71
- scopeKey: string;
72
- children: LexicalScope[];
73
- zero: Const;
74
- one: Const;
75
- _true: Const;
76
- _false: Const;
77
- values: {
78
- [key: string]: Val;
79
- };
80
- funcs: {
81
- [key: string]: Val;
82
- };
83
- builtIns: {
84
- [key: string]: (...p1: Result[]) => Result;
85
- };
86
- constructor(parent: LexicalScope, resolver?: (p1: string, p2: boolean) => Val);
87
- defineBuiltInName(name: string, fn: () => Result): void;
88
- defineName(qualifiedName: string, val: Val): void;
89
- defineFunc(qualifiedName: string, val: Val): void;
90
- defineBuiltIn(qualifiedName: string, fn: (...p1: Result[]) => Result): void;
91
- }
92
- export declare function isAbsoluteLengthUnit(unit: string): boolean;
93
- export declare function isViewportRelativeLengthUnit(unit: string): boolean;
94
- export declare function isFontRelativeLengthUnit(unit: string): boolean;
95
- export declare function isRootFontRelativeLengthUnit(unit: string): boolean;
96
- export declare const defaultUnitSizes: {
97
- [key: string]: number;
98
- };
99
- /**
100
- * Returns if a unit should be converted to px before applied to the raw DOM.
101
- */
102
- export declare function needUnitConversion(unit: string): boolean;
103
- export declare type ScopeContext = {
104
- [key: string]: Result;
105
- };
106
- /**
107
- * Run-time instance of a scope and its children.
108
- */
109
- export declare class Context {
110
- readonly rootScope: LexicalScope;
111
- readonly viewportWidth: number;
112
- readonly viewportHeight: number;
113
- protected actualPageWidth: number | null;
114
- pageWidth: () => number;
115
- protected actualPageHeight: number | null;
116
- pageHeight: () => number;
117
- initialFontSize: number;
118
- rootFontSize: number | null;
119
- isRelativeRootFontSize: boolean | null;
120
- fontSize: () => number;
121
- rootLineHeight: number | null;
122
- pref: Preferences;
123
- scopes: {
124
- [key: string]: ScopeContext;
125
- };
126
- pageAreaWidth: number | null;
127
- pageAreaHeight: number | null;
128
- pageVertical: boolean | null;
129
- pubTitle: string | null;
130
- docTitle: string | null;
131
- constructor(rootScope: LexicalScope, viewportWidth: number, viewportHeight: number, fontSize: number);
132
- private getScopeContext;
133
- clearScope(scope: LexicalScope): void;
134
- queryUnitSize(unit: string, isRoot: boolean): number;
135
- evalName(scope: LexicalScope, qualifiedName: string): Val;
136
- /**
137
- * @param noBuiltInEval don't evaluate built-ins (for dependency calculations)
138
- */
139
- evalCall(scope: LexicalScope, qualifiedName: string, params: Val[], noBuiltInEval: boolean): Val;
140
- evalMediaName(name: string, not: boolean): boolean;
141
- evalMediaTest(feature: string, value: Val): boolean;
142
- evalSupportsTest(name: string, value: string, isFunc: boolean): boolean;
143
- queryVal(scope: LexicalScope, key: string): Result | undefined;
144
- storeVal(scope: LexicalScope, key: string, val: Result): void;
145
- }
146
- export declare type DependencyCache = {
147
- [key: string]: boolean | Special;
148
- };
149
- export declare class Val {
150
- scope: LexicalScope;
151
- key: string;
152
- constructor(scope: LexicalScope);
153
- /** @override */
154
- toString(): string;
155
- appendTo(buf: Base.StringBuffer, priority: number): void;
156
- protected evaluateCore(context: Context): Result;
157
- expand(context: Context, params: Val[]): Val;
158
- dependCore(other: Val, context: Context, dependencyCache: DependencyCache): boolean;
159
- dependOuter(other: Val, context: Context, dependencyCache: DependencyCache): boolean;
160
- depend(other: Val, context: Context): boolean;
161
- evaluate(context: Context): Result;
162
- isMediaName(): boolean;
163
- }
164
- export declare class Prefix extends Val {
165
- val: Val;
166
- constructor(scope: LexicalScope, val: Val);
167
- protected getOp(): string;
168
- evalPrefix(val: Result): Result;
169
- evaluateCore(context: Context): Result;
170
- dependCore(other: Val, context: Context, dependencyCache: DependencyCache): boolean;
171
- appendTo(buf: Base.StringBuffer, priority: number): void;
172
- expand(context: Context, params: Val[]): Val;
173
- }
174
- export declare class Infix extends Val {
175
- lhs: Val;
176
- rhs: Val;
177
- constructor(scope: LexicalScope, lhs: Val, rhs: Val);
178
- getPriority(): number;
179
- getOp(): string;
180
- evalInfix(lhs: Result, rhs: Result): Result;
181
- evaluateCore(context: Context): Result;
182
- dependCore(other: Val, context: Context, dependencyCache: DependencyCache): boolean;
183
- appendTo(buf: Base.StringBuffer, priority: number): void;
184
- expand(context: Context, params: Val[]): Val;
185
- }
186
- export declare class Logical extends Infix {
187
- constructor(scope: LexicalScope, lhs: Val, rhs: Val);
188
- getPriority(): number;
189
- }
190
- export declare class Comparison extends Infix {
191
- constructor(scope: LexicalScope, lhs: Val, rhs: Val);
192
- getPriority(): number;
193
- }
194
- export declare class Additive extends Infix {
195
- constructor(scope: LexicalScope, lhs: Val, rhs: Val);
196
- getPriority(): number;
197
- }
198
- export declare class Multiplicative extends Infix {
199
- constructor(scope: LexicalScope, lhs: Val, rhs: Val);
200
- getPriority(): number;
201
- }
202
- export declare class Not extends Prefix {
203
- constructor(scope: LexicalScope, val: Val);
204
- getOp(): string;
205
- evalPrefix(val: Result): Result;
206
- }
207
- export declare class NotMedia extends Not {
208
- constructor(scope: LexicalScope, val: Val);
209
- getOp(): string;
210
- }
211
- export declare class Negate extends Prefix {
212
- constructor(scope: LexicalScope, val: Val);
213
- getOp(): string;
214
- evalPrefix(val: Result): Result;
215
- }
216
- export declare class And extends Logical {
217
- constructor(scope: LexicalScope, lhs: Val, rhs: Val);
218
- getOp(): string;
219
- evaluateCore(context: Context): Result;
220
- }
221
- export declare class AndMedia extends And {
222
- constructor(scope: LexicalScope, lhs: Val, rhs: Val);
223
- getOp(): string;
224
- }
225
- export declare class Or extends Logical {
226
- constructor(scope: LexicalScope, lhs: Val, rhs: Val);
227
- getOp(): string;
228
- evaluateCore(context: Context): Result;
229
- }
230
- export declare class Comma extends Or {
231
- constructor(scope: LexicalScope, lhs: Val, rhs: Val);
232
- getOp(): string;
233
- }
234
- export declare class OrMedia extends Or {
235
- constructor(scope: LexicalScope, lhs: Val, rhs: Val);
236
- getOp(): string;
237
- }
238
- export declare class Lt extends Comparison {
239
- constructor(scope: LexicalScope, lhs: Val, rhs: Val);
240
- getOp(): string;
241
- evalInfix(lhs: Result, rhs: Result): Result;
242
- }
243
- export declare class Le extends Comparison {
244
- constructor(scope: LexicalScope, lhs: Val, rhs: Val);
245
- getOp(): string;
246
- evalInfix(lhs: Result, rhs: Result): Result;
247
- }
248
- export declare class Gt extends Comparison {
249
- constructor(scope: LexicalScope, lhs: Val, rhs: Val);
250
- getOp(): string;
251
- evalInfix(lhs: Result, rhs: Result): Result;
252
- }
253
- export declare class Ge extends Comparison {
254
- constructor(scope: LexicalScope, lhs: Val, rhs: Val);
255
- getOp(): string;
256
- evalInfix(lhs: Result, rhs: Result): Result;
257
- }
258
- export declare class Eq extends Comparison {
259
- constructor(scope: LexicalScope, lhs: Val, rhs: Val);
260
- getOp(): string;
261
- evalInfix(lhs: Result, rhs: Result): Result;
262
- }
263
- export declare class Ne extends Comparison {
264
- constructor(scope: LexicalScope, lhs: Val, rhs: Val);
265
- getOp(): string;
266
- evalInfix(lhs: Result, rhs: Result): Result;
267
- }
268
- export declare class Add extends Additive {
269
- constructor(scope: LexicalScope, lhs: Val, rhs: Val);
270
- getOp(): string;
271
- evalInfix(lhs: Result, rhs: Result): Result;
272
- }
273
- export declare class Subtract extends Additive {
274
- constructor(scope: LexicalScope, lhs: Val, rhs: Val);
275
- getOp(): string;
276
- evalInfix(lhs: Result, rhs: Result): Result;
277
- }
278
- export declare class Multiply extends Multiplicative {
279
- constructor(scope: LexicalScope, lhs: Val, rhs: Val);
280
- getOp(): string;
281
- evalInfix(lhs: Result, rhs: Result): Result;
282
- }
283
- export declare class Divide extends Multiplicative {
284
- constructor(scope: LexicalScope, lhs: Val, rhs: Val);
285
- getOp(): string;
286
- evalInfix(lhs: Result, rhs: Result): Result;
287
- }
288
- export declare class Modulo extends Multiplicative {
289
- constructor(scope: LexicalScope, lhs: Val, rhs: Val);
290
- getOp(): string;
291
- evalInfix(lhs: Result, rhs: Result): Result;
292
- }
293
- /**
294
- * Numerical value with a unit.
295
- */
296
- export declare class Numeric extends Val {
297
- num: number;
298
- unit: string;
299
- constructor(scope: LexicalScope, num: number, unit: string);
300
- appendTo(buf: Base.StringBuffer, priority: number): void;
301
- evaluateCore(context: Context): Result;
302
- }
303
- /**
304
- * Named value.
305
- * @param qualifiedName CSS-escaped name sequence separated by dots.
306
- */
307
- export declare class Named extends Val {
308
- qualifiedName: string;
309
- constructor(scope: LexicalScope, qualifiedName: string);
310
- appendTo(buf: Base.StringBuffer, priority: number): void;
311
- evaluateCore(context: Context): Result;
312
- dependCore(other: Val, context: Context, dependencyCache: DependencyCache): boolean;
313
- }
314
- /**
315
- * Named value.
316
- */
317
- export declare class MediaName extends Val {
318
- not: boolean;
319
- name: string;
320
- constructor(scope: LexicalScope, not: boolean, name: string);
321
- appendTo(buf: Base.StringBuffer, priority: number): void;
322
- evaluateCore(context: Context): Result;
323
- isMediaName(): boolean;
324
- }
325
- /**
326
- * A value that is calculated by calling a JavaScript function. Note that the
327
- * result is cached and this function will be called only once between any
328
- * clears for its scope in the context.
329
- * @param fn function to call.
330
- * @param str a way to represent this value in toString() call.
331
- */
332
- export declare class Native extends Val {
333
- fn: () => Result;
334
- str: string;
335
- constructor(scope: LexicalScope, fn: () => Result, str: string);
336
- appendTo(buf: Base.StringBuffer, priority: number): void;
337
- evaluateCore(context: Context): Result;
338
- }
339
- export declare function appendValArray(buf: Base.StringBuffer, arr: Val[]): void;
340
- export declare function expandValArray(context: Context, arr: Val[], params: Val[]): Val[];
341
- export declare function evalValArray(context: Context, arr: Val[]): Result[];
342
- export declare class Call extends Val {
343
- qualifiedName: string;
344
- params: Val[];
345
- constructor(scope: LexicalScope, qualifiedName: string, params: Val[]);
346
- appendTo(buf: Base.StringBuffer, priority: number): void;
347
- evaluateCore(context: Context): Result;
348
- dependCore(other: Val, context: Context, dependencyCache: DependencyCache): boolean;
349
- expand(context: Context, params: Val[]): Val;
350
- }
351
- export declare class Cond extends Val {
352
- cond: Val;
353
- ifTrue: Val;
354
- ifFalse: Val;
355
- constructor(scope: LexicalScope, cond: Val, ifTrue: Val, ifFalse: Val);
356
- appendTo(buf: Base.StringBuffer, priority: number): void;
357
- evaluateCore(context: Context): Result;
358
- dependCore(other: Val, context: Context, dependencyCache: DependencyCache): boolean;
359
- expand(context: Context, params: Val[]): Val;
360
- }
361
- export declare class Const extends Val {
362
- val: Result;
363
- constructor(scope: LexicalScope, val: Result);
364
- appendTo(buf: Base.StringBuffer, priority: number): void;
365
- evaluateCore(context: Context): Result;
366
- }
367
- export declare class MediaTest extends Val {
368
- name: MediaName;
369
- value: Val;
370
- constructor(scope: LexicalScope, name: MediaName, value: Val);
371
- appendTo(buf: Base.StringBuffer, priority: number): void;
372
- evaluateCore(context: Context): Result;
373
- dependCore(other: Val, context: Context, dependencyCache: DependencyCache): boolean;
374
- expand(context: Context, params: Val[]): Val;
375
- }
376
- export declare class SupportsTest extends Val {
377
- name: string;
378
- value: string;
379
- isFunc: boolean;
380
- constructor(scope: LexicalScope, name: string, value: string, isFunc: boolean);
381
- appendTo(buf: Base.StringBuffer, priority: number): void;
382
- evaluateCore(context: Context): Result;
383
- }
384
- export declare class Param extends Val {
385
- index: number;
386
- constructor(scope: LexicalScope, index: number);
387
- appendTo(buf: Base.StringBuffer, priority: number): void;
388
- expand(context: Context, params: Val[]): Val;
389
- }
390
- export declare function and(scope: LexicalScope, v1: Val, v2: Val): Val;
391
- export declare function add(scope: LexicalScope, v1: Val, v2: Val): Val;
392
- export declare function sub(scope: LexicalScope, v1: Val, v2: Val): Val;
393
- export declare function mul(scope: LexicalScope, v1: Val, v2: Val): Val;
394
- export declare function div(scope: LexicalScope, v1: Val, v2: Val): Val;
395
- export {};
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 Exprs - `-epubx-expr` Adaptive Layout expressions.
20
+ */
21
+ import * as Base from "./base";
22
+ export type Preferences = {
23
+ fontFamily: string;
24
+ lineHeight: number;
25
+ margin: number;
26
+ hyphenate: boolean;
27
+ columnWidth: number;
28
+ horizontal: boolean;
29
+ nightMode: boolean;
30
+ spreadView: boolean;
31
+ pageBorder: number;
32
+ enabledMediaTypes: {
33
+ [key: string]: boolean;
34
+ };
35
+ defaultPaperSize?: {
36
+ [key: string]: number;
37
+ };
38
+ };
39
+ export declare function defaultPreferences(): Preferences;
40
+ export declare function clonePreferences(pref: Preferences): Preferences;
41
+ export declare const defaultPreferencesInstance: Preferences;
42
+ interface Pending {
43
+ }
44
+ type Special = Pending;
45
+ /**
46
+ * Special marker value that indicates that the expression result is being
47
+ * calculated.
48
+ */
49
+ export declare const Special: {
50
+ PENDING: Pending;
51
+ };
52
+ export type Result = string | number | boolean | undefined;
53
+ export type PendingResult = Special | Result;
54
+ export declare function letterbox(viewW: number, viewH: number, objW: number, objH: number): string;
55
+ /**
56
+ * @return string that can be parsed as CSS string with value str
57
+ */
58
+ export declare function cssString(str: string): string;
59
+ /**
60
+ * @return string that can be parsed as CSS name
61
+ */
62
+ export declare function cssIdent(name: string): string;
63
+ export declare function makeQualifiedName(objName: string | null, memberName: string): string;
64
+ export declare let nextKeyIndex: number;
65
+ /**
66
+ * Lexical scope of the expression.
67
+ */
68
+ export declare class LexicalScope {
69
+ parent: LexicalScope;
70
+ resolver?: (p1: string, p2: boolean) => Val;
71
+ scopeKey: string;
72
+ children: LexicalScope[];
73
+ zero: Const;
74
+ one: Const;
75
+ _true: Const;
76
+ _false: Const;
77
+ values: {
78
+ [key: string]: Val;
79
+ };
80
+ funcs: {
81
+ [key: string]: Val;
82
+ };
83
+ builtIns: {
84
+ [key: string]: (...p1: Result[]) => Result;
85
+ };
86
+ constructor(parent: LexicalScope, resolver?: (p1: string, p2: boolean) => Val);
87
+ defineBuiltInName(name: string, fn: () => Result): void;
88
+ defineName(qualifiedName: string, val: Val): void;
89
+ defineFunc(qualifiedName: string, val: Val): void;
90
+ defineBuiltIn(qualifiedName: string, fn: (...p1: Result[]) => Result): void;
91
+ }
92
+ export declare function isAbsoluteLengthUnit(unit: string): boolean;
93
+ export declare function isViewportRelativeLengthUnit(unit: string): boolean;
94
+ export declare function isFontRelativeLengthUnit(unit: string): boolean;
95
+ export declare function isRootFontRelativeLengthUnit(unit: string): boolean;
96
+ export declare const defaultUnitSizes: {
97
+ [key: string]: number;
98
+ };
99
+ /**
100
+ * Returns if a unit should be converted to px before applied to the raw DOM.
101
+ */
102
+ export declare function needUnitConversion(unit: string): boolean;
103
+ export type ScopeContext = {
104
+ [key: string]: Result;
105
+ };
106
+ /**
107
+ * Run-time instance of a scope and its children.
108
+ */
109
+ export declare class Context {
110
+ readonly rootScope: LexicalScope;
111
+ readonly viewportWidth: number;
112
+ readonly viewportHeight: number;
113
+ protected actualPageWidth: number | null;
114
+ pageWidth: () => number;
115
+ protected actualPageHeight: number | null;
116
+ pageHeight: () => number;
117
+ initialFontSize: number;
118
+ rootFontSize: number | null;
119
+ isRelativeRootFontSize: boolean | null;
120
+ fontSize: () => number;
121
+ rootLineHeight: number | null;
122
+ pref: Preferences;
123
+ scopes: {
124
+ [key: string]: ScopeContext;
125
+ };
126
+ pageAreaWidth: number | null;
127
+ pageAreaHeight: number | null;
128
+ pageVertical: boolean | null;
129
+ pubTitle: string | null;
130
+ docTitle: string | null;
131
+ constructor(rootScope: LexicalScope, viewportWidth: number, viewportHeight: number, fontSize: number);
132
+ private getScopeContext;
133
+ clearScope(scope: LexicalScope): void;
134
+ queryUnitSize(unit: string, isRoot: boolean): number;
135
+ evalName(scope: LexicalScope, qualifiedName: string): Val;
136
+ /**
137
+ * @param noBuiltInEval don't evaluate built-ins (for dependency calculations)
138
+ */
139
+ evalCall(scope: LexicalScope, qualifiedName: string, params: Val[], noBuiltInEval: boolean): Val;
140
+ evalMediaName(name: string, not: boolean): boolean;
141
+ evalMediaTest(feature: string, value: Val): boolean;
142
+ evalSupportsTest(name: string, value: string, isFunc: boolean): boolean;
143
+ queryVal(scope: LexicalScope, key: string): Result | undefined;
144
+ storeVal(scope: LexicalScope, key: string, val: Result): void;
145
+ }
146
+ export type DependencyCache = {
147
+ [key: string]: boolean | Special;
148
+ };
149
+ export declare class Val {
150
+ scope: LexicalScope;
151
+ key: string;
152
+ constructor(scope: LexicalScope);
153
+ /** @override */
154
+ toString(): string;
155
+ appendTo(buf: Base.StringBuffer, priority: number): void;
156
+ protected evaluateCore(context: Context): Result;
157
+ expand(context: Context, params: Val[]): Val;
158
+ dependCore(other: Val, context: Context, dependencyCache: DependencyCache): boolean;
159
+ dependOuter(other: Val, context: Context, dependencyCache: DependencyCache): boolean;
160
+ depend(other: Val, context: Context): boolean;
161
+ evaluate(context: Context): Result;
162
+ isMediaName(): boolean;
163
+ }
164
+ export declare class Prefix extends Val {
165
+ val: Val;
166
+ constructor(scope: LexicalScope, val: Val);
167
+ protected getOp(): string;
168
+ evalPrefix(val: Result): Result;
169
+ evaluateCore(context: Context): Result;
170
+ dependCore(other: Val, context: Context, dependencyCache: DependencyCache): boolean;
171
+ appendTo(buf: Base.StringBuffer, priority: number): void;
172
+ expand(context: Context, params: Val[]): Val;
173
+ }
174
+ export declare class Infix extends Val {
175
+ lhs: Val;
176
+ rhs: Val;
177
+ constructor(scope: LexicalScope, lhs: Val, rhs: Val);
178
+ getPriority(): number;
179
+ getOp(): string;
180
+ evalInfix(lhs: Result, rhs: Result): Result;
181
+ evaluateCore(context: Context): Result;
182
+ dependCore(other: Val, context: Context, dependencyCache: DependencyCache): boolean;
183
+ appendTo(buf: Base.StringBuffer, priority: number): void;
184
+ expand(context: Context, params: Val[]): Val;
185
+ }
186
+ export declare class Logical extends Infix {
187
+ constructor(scope: LexicalScope, lhs: Val, rhs: Val);
188
+ getPriority(): number;
189
+ }
190
+ export declare class Comparison extends Infix {
191
+ constructor(scope: LexicalScope, lhs: Val, rhs: Val);
192
+ getPriority(): number;
193
+ }
194
+ export declare class Additive extends Infix {
195
+ constructor(scope: LexicalScope, lhs: Val, rhs: Val);
196
+ getPriority(): number;
197
+ }
198
+ export declare class Multiplicative extends Infix {
199
+ constructor(scope: LexicalScope, lhs: Val, rhs: Val);
200
+ getPriority(): number;
201
+ }
202
+ export declare class Not extends Prefix {
203
+ constructor(scope: LexicalScope, val: Val);
204
+ getOp(): string;
205
+ evalPrefix(val: Result): Result;
206
+ }
207
+ export declare class NotMedia extends Not {
208
+ constructor(scope: LexicalScope, val: Val);
209
+ getOp(): string;
210
+ }
211
+ export declare class Negate extends Prefix {
212
+ constructor(scope: LexicalScope, val: Val);
213
+ getOp(): string;
214
+ evalPrefix(val: Result): Result;
215
+ }
216
+ export declare class And extends Logical {
217
+ constructor(scope: LexicalScope, lhs: Val, rhs: Val);
218
+ getOp(): string;
219
+ evaluateCore(context: Context): Result;
220
+ }
221
+ export declare class AndMedia extends And {
222
+ constructor(scope: LexicalScope, lhs: Val, rhs: Val);
223
+ getOp(): string;
224
+ }
225
+ export declare class Or extends Logical {
226
+ constructor(scope: LexicalScope, lhs: Val, rhs: Val);
227
+ getOp(): string;
228
+ evaluateCore(context: Context): Result;
229
+ }
230
+ export declare class Comma extends Or {
231
+ constructor(scope: LexicalScope, lhs: Val, rhs: Val);
232
+ getOp(): string;
233
+ }
234
+ export declare class OrMedia extends Or {
235
+ constructor(scope: LexicalScope, lhs: Val, rhs: Val);
236
+ getOp(): string;
237
+ }
238
+ export declare class Lt extends Comparison {
239
+ constructor(scope: LexicalScope, lhs: Val, rhs: Val);
240
+ getOp(): string;
241
+ evalInfix(lhs: Result, rhs: Result): Result;
242
+ }
243
+ export declare class Le extends Comparison {
244
+ constructor(scope: LexicalScope, lhs: Val, rhs: Val);
245
+ getOp(): string;
246
+ evalInfix(lhs: Result, rhs: Result): Result;
247
+ }
248
+ export declare class Gt extends Comparison {
249
+ constructor(scope: LexicalScope, lhs: Val, rhs: Val);
250
+ getOp(): string;
251
+ evalInfix(lhs: Result, rhs: Result): Result;
252
+ }
253
+ export declare class Ge extends Comparison {
254
+ constructor(scope: LexicalScope, lhs: Val, rhs: Val);
255
+ getOp(): string;
256
+ evalInfix(lhs: Result, rhs: Result): Result;
257
+ }
258
+ export declare class Eq extends Comparison {
259
+ constructor(scope: LexicalScope, lhs: Val, rhs: Val);
260
+ getOp(): string;
261
+ evalInfix(lhs: Result, rhs: Result): Result;
262
+ }
263
+ export declare class Ne extends Comparison {
264
+ constructor(scope: LexicalScope, lhs: Val, rhs: Val);
265
+ getOp(): string;
266
+ evalInfix(lhs: Result, rhs: Result): Result;
267
+ }
268
+ export declare class Add extends Additive {
269
+ constructor(scope: LexicalScope, lhs: Val, rhs: Val);
270
+ getOp(): string;
271
+ evalInfix(lhs: Result, rhs: Result): Result;
272
+ }
273
+ export declare class Subtract extends Additive {
274
+ constructor(scope: LexicalScope, lhs: Val, rhs: Val);
275
+ getOp(): string;
276
+ evalInfix(lhs: Result, rhs: Result): Result;
277
+ }
278
+ export declare class Multiply extends Multiplicative {
279
+ constructor(scope: LexicalScope, lhs: Val, rhs: Val);
280
+ getOp(): string;
281
+ evalInfix(lhs: Result, rhs: Result): Result;
282
+ }
283
+ export declare class Divide extends Multiplicative {
284
+ constructor(scope: LexicalScope, lhs: Val, rhs: Val);
285
+ getOp(): string;
286
+ evalInfix(lhs: Result, rhs: Result): Result;
287
+ }
288
+ export declare class Modulo extends Multiplicative {
289
+ constructor(scope: LexicalScope, lhs: Val, rhs: Val);
290
+ getOp(): string;
291
+ evalInfix(lhs: Result, rhs: Result): Result;
292
+ }
293
+ /**
294
+ * Numerical value with a unit.
295
+ */
296
+ export declare class Numeric extends Val {
297
+ num: number;
298
+ unit: string;
299
+ constructor(scope: LexicalScope, num: number, unit: string);
300
+ appendTo(buf: Base.StringBuffer, priority: number): void;
301
+ evaluateCore(context: Context): Result;
302
+ }
303
+ /**
304
+ * Named value.
305
+ * @param qualifiedName CSS-escaped name sequence separated by dots.
306
+ */
307
+ export declare class Named extends Val {
308
+ qualifiedName: string;
309
+ constructor(scope: LexicalScope, qualifiedName: string);
310
+ appendTo(buf: Base.StringBuffer, priority: number): void;
311
+ evaluateCore(context: Context): Result;
312
+ dependCore(other: Val, context: Context, dependencyCache: DependencyCache): boolean;
313
+ }
314
+ /**
315
+ * Named value.
316
+ */
317
+ export declare class MediaName extends Val {
318
+ not: boolean;
319
+ name: string;
320
+ constructor(scope: LexicalScope, not: boolean, name: string);
321
+ appendTo(buf: Base.StringBuffer, priority: number): void;
322
+ evaluateCore(context: Context): Result;
323
+ isMediaName(): boolean;
324
+ }
325
+ /**
326
+ * A value that is calculated by calling a JavaScript function. Note that the
327
+ * result is cached and this function will be called only once between any
328
+ * clears for its scope in the context.
329
+ * @param fn function to call.
330
+ * @param str a way to represent this value in toString() call.
331
+ */
332
+ export declare class Native extends Val {
333
+ fn: () => Result;
334
+ str: string;
335
+ constructor(scope: LexicalScope, fn: () => Result, str: string);
336
+ appendTo(buf: Base.StringBuffer, priority: number): void;
337
+ evaluateCore(context: Context): Result;
338
+ }
339
+ export declare function appendValArray(buf: Base.StringBuffer, arr: Val[]): void;
340
+ export declare function expandValArray(context: Context, arr: Val[], params: Val[]): Val[];
341
+ export declare function evalValArray(context: Context, arr: Val[]): Result[];
342
+ export declare class Call extends Val {
343
+ qualifiedName: string;
344
+ params: Val[];
345
+ constructor(scope: LexicalScope, qualifiedName: string, params: Val[]);
346
+ appendTo(buf: Base.StringBuffer, priority: number): void;
347
+ evaluateCore(context: Context): Result;
348
+ dependCore(other: Val, context: Context, dependencyCache: DependencyCache): boolean;
349
+ expand(context: Context, params: Val[]): Val;
350
+ }
351
+ export declare class Cond extends Val {
352
+ cond: Val;
353
+ ifTrue: Val;
354
+ ifFalse: Val;
355
+ constructor(scope: LexicalScope, cond: Val, ifTrue: Val, ifFalse: Val);
356
+ appendTo(buf: Base.StringBuffer, priority: number): void;
357
+ evaluateCore(context: Context): Result;
358
+ dependCore(other: Val, context: Context, dependencyCache: DependencyCache): boolean;
359
+ expand(context: Context, params: Val[]): Val;
360
+ }
361
+ export declare class Const extends Val {
362
+ val: Result;
363
+ constructor(scope: LexicalScope, val: Result);
364
+ appendTo(buf: Base.StringBuffer, priority: number): void;
365
+ evaluateCore(context: Context): Result;
366
+ }
367
+ export declare class MediaTest extends Val {
368
+ name: MediaName;
369
+ value: Val;
370
+ constructor(scope: LexicalScope, name: MediaName, value: Val);
371
+ appendTo(buf: Base.StringBuffer, priority: number): void;
372
+ evaluateCore(context: Context): Result;
373
+ dependCore(other: Val, context: Context, dependencyCache: DependencyCache): boolean;
374
+ expand(context: Context, params: Val[]): Val;
375
+ }
376
+ export declare class SupportsTest extends Val {
377
+ name: string;
378
+ value: string;
379
+ isFunc: boolean;
380
+ constructor(scope: LexicalScope, name: string, value: string, isFunc: boolean);
381
+ appendTo(buf: Base.StringBuffer, priority: number): void;
382
+ evaluateCore(context: Context): Result;
383
+ }
384
+ export declare class Param extends Val {
385
+ index: number;
386
+ constructor(scope: LexicalScope, index: number);
387
+ appendTo(buf: Base.StringBuffer, priority: number): void;
388
+ expand(context: Context, params: Val[]): Val;
389
+ }
390
+ export declare function and(scope: LexicalScope, v1: Val, v2: Val): Val;
391
+ export declare function add(scope: LexicalScope, v1: Val, v2: Val): Val;
392
+ export declare function sub(scope: LexicalScope, v1: Val, v2: Val): Val;
393
+ export declare function mul(scope: LexicalScope, v1: Val, v2: Val): Val;
394
+ export declare function div(scope: LexicalScope, v1: Val, v2: Val): Val;
395
+ export {};