@vivliostyle/core 2.24.3 → 2.25.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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 -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,112 +1,112 @@
1
- /**
2
- * Copyright 2016 Trim-marks Inc.
3
- * Copyright 2019 Vivliostyle Foundation
4
- *
5
- * Vivliostyle.js is free software: you can redistribute it and/or modify
6
- * it under the terms of the GNU Affero General Public License as published by
7
- * the Free Software Foundation, either version 3 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * Vivliostyle.js is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU Affero General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU Affero General Public License
16
- * along with Vivliostyle.js. If not, see <http://www.gnu.org/licenses/>.
17
- *
18
- * @fileoverview Break - Control fragmentation.
19
- */
20
- import * as Css from "./css";
21
- /**
22
- * Check if style="box-decoration-break: clone" is set
23
- */
24
- export declare function isCloneBoxDecorationBreak(element: Element): boolean;
25
- /**
26
- * data-viv-box-break attribute
27
- *
28
- * Value: [ [inline-start || inline-end] |
29
- * [block-start text-start? || block-end text-end?] justify? ]
30
- * clone?
31
- *
32
- * inline-start, inline-end, block-start, block-end: the side at which a box break occurs
33
- * text-start: the fragment starts with text or inline box
34
- * text-end: the fragment ends with text or inline box
35
- * justify: the computed value of `text-align` property is `justify`
36
- * clone: the computed value of `box-decoration-break` property is `clone`
37
- */
38
- type BoxBreakFlag = "inline-start" | "inline-end" | "block-start" | "block-end" | "text-start" | "text-end" | "justify" | "clone";
39
- export declare function getBoxBreakFlags(element: Element): BoxBreakFlag[];
40
- export declare function setBoxBreakFlags(element: Element, boxBreakFlags: BoxBreakFlag[]): void;
41
- export declare function setBoxBreakFlag(element: Element, boxBreakFlag: BoxBreakFlag): void;
42
- /**
43
- * data-viv-margin-discard attribute
44
- *
45
- * Value: block-start || block-end || inline-start || inline-end
46
- *
47
- * block-start: the block-start margin is discarded
48
- * block-end: the block-end margin is discarded
49
- * inline-start: the inline-start margin is discarded
50
- * inline-end: the inline-end margin is discarded
51
- */
52
- type MarginDiscardFlag = "block-start" | "block-end" | "inline-start" | "inline-end";
53
- export declare function getMarginDiscardFlags(element: Element): MarginDiscardFlag[];
54
- export declare function setMarginDiscardFlags(element: Element, marginDiscardFlags: MarginDiscardFlag[]): void;
55
- export declare function setMarginDiscardFlag(element: Element, marginDiscardFlag: MarginDiscardFlag): void;
56
- /**
57
- * Convert old page-break-* properties to break-* properties with appropriate
58
- * values as specified by CSS Fragmentation module:
59
- * https://drafts.csswg.org/css-break/#page-break-properties
60
- */
61
- export declare function convertPageBreakAliases(original: {
62
- name: string;
63
- value: Css.Val;
64
- important: boolean;
65
- }): {
66
- name: string;
67
- value: Css.Val;
68
- important: boolean;
69
- };
70
- export declare const forcedBreakValues: {
71
- [key: string]: boolean | null;
72
- };
73
- /**
74
- * Returns if the value is one of the forced break values.
75
- * @param value The break value to be judged. Treats null as 'auto'.
76
- */
77
- export declare function isForcedBreakValue(value: string | null): boolean;
78
- export declare const spreadBreakValues: {
79
- [key: string]: boolean | null;
80
- };
81
- /**
82
- * Returns if the value is one of left/right/recto/verso values.
83
- * @param value The break value to be judged. Treats null as 'auto'.
84
- */
85
- export declare function isSpreadBreakValue(value: string | null): boolean;
86
- export declare const avoidBreakValues: {
87
- [key: string]: boolean | null;
88
- };
89
- /**
90
- * Returns if the value is one of the avoid break values.
91
- * @param value The break value to be judged. Treats null as 'auto'.
92
- */
93
- export declare function isAvoidBreakValue(value: string | null): boolean;
94
- /**
95
- * Resolves the effective break value given two break values at a single break
96
- * point. The order of the arguments are relevant, since a value specified on
97
- * the latter element takes precedence over one on the former. A forced break
98
- * value is chosen if present. Otherwise, an avoid break value is chosen if
99
- * present. See CSS Fragmentation Module for the rule:
100
- * https://drafts.csswg.org/css-break/#forced-breaks
101
- * https://drafts.csswg.org/css-break/#unforced-breaks
102
- * Note that though the spec requires to honor multiple break values at a single
103
- * break point, the current implementation choose one of them and discard the
104
- * others.
105
- * @param first The break value specified on the former element. null means
106
- * 'auto' (not specified)
107
- * @param second The break value specified on the latter element. null means
108
- * 'auto' (not specified)
109
- */
110
- export declare function resolveEffectiveBreakValue(first: string | null, second: string | null): string | null;
111
- export declare function breakValueToStartBreakType(breakValue: string | null): string;
112
- export {};
1
+ /**
2
+ * Copyright 2016 Trim-marks Inc.
3
+ * Copyright 2019 Vivliostyle Foundation
4
+ *
5
+ * Vivliostyle.js is free software: you can redistribute it and/or modify
6
+ * it under the terms of the GNU Affero General Public License as published by
7
+ * the Free Software Foundation, either version 3 of the License, or
8
+ * (at your option) any later version.
9
+ *
10
+ * Vivliostyle.js is distributed in the hope that it will be useful,
11
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ * GNU Affero General Public License for more details.
14
+ *
15
+ * You should have received a copy of the GNU Affero General Public License
16
+ * along with Vivliostyle.js. If not, see <http://www.gnu.org/licenses/>.
17
+ *
18
+ * @fileoverview Break - Control fragmentation.
19
+ */
20
+ import * as Css from "./css";
21
+ /**
22
+ * Check if style="box-decoration-break: clone" is set
23
+ */
24
+ export declare function isCloneBoxDecorationBreak(element: Element): boolean;
25
+ /**
26
+ * data-viv-box-break attribute
27
+ *
28
+ * Value: [ [inline-start || inline-end] |
29
+ * [block-start text-start? || block-end text-end?] justify? ]
30
+ * clone?
31
+ *
32
+ * inline-start, inline-end, block-start, block-end: the side at which a box break occurs
33
+ * text-start: the fragment starts with text or inline box
34
+ * text-end: the fragment ends with text or inline box
35
+ * justify: the computed value of `text-align` property is `justify`
36
+ * clone: the computed value of `box-decoration-break` property is `clone`
37
+ */
38
+ type BoxBreakFlag = "inline-start" | "inline-end" | "block-start" | "block-end" | "text-start" | "text-end" | "justify" | "clone";
39
+ export declare function getBoxBreakFlags(element: Element): BoxBreakFlag[];
40
+ export declare function setBoxBreakFlags(element: Element, boxBreakFlags: BoxBreakFlag[]): void;
41
+ export declare function setBoxBreakFlag(element: Element, boxBreakFlag: BoxBreakFlag): void;
42
+ /**
43
+ * data-viv-margin-discard attribute
44
+ *
45
+ * Value: block-start || block-end || inline-start || inline-end
46
+ *
47
+ * block-start: the block-start margin is discarded
48
+ * block-end: the block-end margin is discarded
49
+ * inline-start: the inline-start margin is discarded
50
+ * inline-end: the inline-end margin is discarded
51
+ */
52
+ type MarginDiscardFlag = "block-start" | "block-end" | "inline-start" | "inline-end";
53
+ export declare function getMarginDiscardFlags(element: Element): MarginDiscardFlag[];
54
+ export declare function setMarginDiscardFlags(element: Element, marginDiscardFlags: MarginDiscardFlag[]): void;
55
+ export declare function setMarginDiscardFlag(element: Element, marginDiscardFlag: MarginDiscardFlag): void;
56
+ /**
57
+ * Convert old page-break-* properties to break-* properties with appropriate
58
+ * values as specified by CSS Fragmentation module:
59
+ * https://drafts.csswg.org/css-break/#page-break-properties
60
+ */
61
+ export declare function convertPageBreakAliases(original: {
62
+ name: string;
63
+ value: Css.Val;
64
+ important: boolean;
65
+ }): {
66
+ name: string;
67
+ value: Css.Val;
68
+ important: boolean;
69
+ };
70
+ export declare const forcedBreakValues: {
71
+ [key: string]: boolean | null;
72
+ };
73
+ /**
74
+ * Returns if the value is one of the forced break values.
75
+ * @param value The break value to be judged. Treats null as 'auto'.
76
+ */
77
+ export declare function isForcedBreakValue(value: string | null): boolean;
78
+ export declare const spreadBreakValues: {
79
+ [key: string]: boolean | null;
80
+ };
81
+ /**
82
+ * Returns if the value is one of left/right/recto/verso values.
83
+ * @param value The break value to be judged. Treats null as 'auto'.
84
+ */
85
+ export declare function isSpreadBreakValue(value: string | null): boolean;
86
+ export declare const avoidBreakValues: {
87
+ [key: string]: boolean | null;
88
+ };
89
+ /**
90
+ * Returns if the value is one of the avoid break values.
91
+ * @param value The break value to be judged. Treats null as 'auto'.
92
+ */
93
+ export declare function isAvoidBreakValue(value: string | null): boolean;
94
+ /**
95
+ * Resolves the effective break value given two break values at a single break
96
+ * point. The order of the arguments are relevant, since a value specified on
97
+ * the latter element takes precedence over one on the former. A forced break
98
+ * value is chosen if present. Otherwise, an avoid break value is chosen if
99
+ * present. See CSS Fragmentation Module for the rule:
100
+ * https://drafts.csswg.org/css-break/#forced-breaks
101
+ * https://drafts.csswg.org/css-break/#unforced-breaks
102
+ * Note that though the spec requires to honor multiple break values at a single
103
+ * break point, the current implementation choose one of them and discard the
104
+ * others.
105
+ * @param first The break value specified on the former element. null means
106
+ * 'auto' (not specified)
107
+ * @param second The break value specified on the latter element. null means
108
+ * 'auto' (not specified)
109
+ */
110
+ export declare function resolveEffectiveBreakValue(first: string | null, second: string | null): string | null;
111
+ export declare function breakValueToStartBreakType(breakValue: string | null): string;
112
+ export {};
@@ -1,77 +1,77 @@
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 Cfi - Support for EPUB Canonical Fragment Identifiers.
20
- */
21
- import * as Base from "./base";
22
- export type Position = {
23
- node: Node;
24
- offset: number;
25
- after: boolean;
26
- sideBias: string | null;
27
- ref: Fragment;
28
- };
29
- export declare function getId(node: Node): string | null;
30
- export declare function escapeChar(ch: string): string;
31
- export declare function escape(str: string): string;
32
- export declare function unescapeChar(str: string): string;
33
- export declare function unescape(str: string): string;
34
- export declare function parseExtVal(extstr: string): string | string[];
35
- export declare function parseExt(extstr: string): {
36
- [key: string]: string | string[];
37
- };
38
- export interface Step {
39
- appendTo(sb: Base.StringBuffer): void;
40
- applyTo(pos: Position): boolean;
41
- }
42
- export declare class RefStep implements Step {
43
- appendTo(sb: Base.StringBuffer): void;
44
- /** @override */
45
- applyTo(pos: Position): boolean;
46
- }
47
- export declare class ChildStep implements Step {
48
- readonly index: number;
49
- readonly id: string | null;
50
- readonly sideBias: string | null;
51
- constructor(index: number, id: string | null, sideBias: string | null);
52
- /** @override */
53
- appendTo(sb: Base.StringBuffer): void;
54
- /** @override */
55
- applyTo(pos: Position): boolean;
56
- }
57
- export declare class OffsetStep implements Step {
58
- readonly offset: number;
59
- readonly textBefore: string | null;
60
- readonly textAfter: string | null;
61
- readonly sideBias: string | null;
62
- constructor(offset: number, textBefore: string | null, textAfter: string | null, sideBias: string | null);
63
- applyTo(pos: Position): boolean;
64
- /** @override */
65
- appendTo(sb: Base.StringBuffer): void;
66
- }
67
- export declare class Fragment {
68
- steps: Step[];
69
- fromString(fragstr: string): void;
70
- navigate(doc: Document): Position;
71
- trim(text: string, after: boolean): string;
72
- /**
73
- * Initialize from a node and an offset.
74
- */
75
- prependPathFromNode(node: Node, offset: number, after: boolean, sideBias: string | null): void;
76
- toString(): string;
77
- }
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 Cfi - Support for EPUB Canonical Fragment Identifiers.
20
+ */
21
+ import * as Base from "./base";
22
+ export type Position = {
23
+ node: Node;
24
+ offset: number;
25
+ after: boolean;
26
+ sideBias: string | null;
27
+ ref: Fragment;
28
+ };
29
+ export declare function getId(node: Node): string | null;
30
+ export declare function escapeChar(ch: string): string;
31
+ export declare function escape(str: string): string;
32
+ export declare function unescapeChar(str: string): string;
33
+ export declare function unescape(str: string): string;
34
+ export declare function parseExtVal(extstr: string): string | string[];
35
+ export declare function parseExt(extstr: string): {
36
+ [key: string]: string | string[];
37
+ };
38
+ export interface Step {
39
+ appendTo(sb: Base.StringBuffer): void;
40
+ applyTo(pos: Position): boolean;
41
+ }
42
+ export declare class RefStep implements Step {
43
+ appendTo(sb: Base.StringBuffer): void;
44
+ /** @override */
45
+ applyTo(pos: Position): boolean;
46
+ }
47
+ export declare class ChildStep implements Step {
48
+ readonly index: number;
49
+ readonly id: string | null;
50
+ readonly sideBias: string | null;
51
+ constructor(index: number, id: string | null, sideBias: string | null);
52
+ /** @override */
53
+ appendTo(sb: Base.StringBuffer): void;
54
+ /** @override */
55
+ applyTo(pos: Position): boolean;
56
+ }
57
+ export declare class OffsetStep implements Step {
58
+ readonly offset: number;
59
+ readonly textBefore: string | null;
60
+ readonly textAfter: string | null;
61
+ readonly sideBias: string | null;
62
+ constructor(offset: number, textBefore: string | null, textAfter: string | null, sideBias: string | null);
63
+ applyTo(pos: Position): boolean;
64
+ /** @override */
65
+ appendTo(sb: Base.StringBuffer): void;
66
+ }
67
+ export declare class Fragment {
68
+ steps: Step[];
69
+ fromString(fragstr: string): void;
70
+ navigate(doc: Document): Position;
71
+ trim(text: string, after: boolean): string;
72
+ /**
73
+ * Initialize from a node and an offset.
74
+ */
75
+ prependPathFromNode(node: Node, offset: number, after: boolean, sideBias: string | null): void;
76
+ toString(): string;
77
+ }
@@ -1,52 +1,52 @@
1
- import * as Css from "./css";
2
- import * as PageFloats from "./page-floats";
3
- import * as Task from "./task";
4
- import * as Vtree from "./vtree";
5
- import { Layout } from "./types";
6
- export type ColumnLayoutResult = {
7
- columns: Layout.Column[];
8
- position: Vtree.LayoutPosition;
9
- columnPageFloatLayoutContexts?: PageFloats.PageFloatLayoutContext[];
10
- };
11
- export type ColumnGenerator = () => Task.Result<ColumnLayoutResult | null>;
12
- export declare class ColumnBalancingTrialResult {
13
- readonly layoutResult: ColumnLayoutResult;
14
- readonly penalty: number;
15
- constructor(layoutResult: ColumnLayoutResult, penalty: number);
16
- }
17
- export declare abstract class ColumnBalancer {
18
- readonly layoutContainer: Vtree.Container;
19
- readonly columnGenerator: ColumnGenerator;
20
- readonly regionPageFloatLayoutContext: PageFloats.PageFloatLayoutContext;
21
- originalContainerBlockSize: number;
22
- constructor(layoutContainer: Vtree.Container, columnGenerator: ColumnGenerator, regionPageFloatLayoutContext: PageFloats.PageFloatLayoutContext);
23
- balanceColumns(layoutResult: ColumnLayoutResult): Task.Result<ColumnLayoutResult>;
24
- private createTrialResult;
25
- protected preBalance(layoutResult: ColumnLayoutResult): void;
26
- protected abstract calculatePenalty(layoutResult: ColumnLayoutResult): number;
27
- protected abstract hasNextCandidate(candidates: ColumnBalancingTrialResult[]): boolean;
28
- protected abstract updateCondition(candidates: ColumnBalancingTrialResult[]): void;
29
- protected postBalance(): void;
30
- savePageFloatLayoutContexts(layoutResult: ColumnLayoutResult | null): void;
31
- private restoreContents;
32
- }
33
- export declare function canReduceContainerSize(candidates: ColumnBalancingTrialResult[]): boolean;
34
- export declare function reduceContainerSize(candidates: ColumnBalancingTrialResult[], container: Vtree.Container): void;
35
- export declare class BalanceLastColumnBalancer extends ColumnBalancer {
36
- readonly columnCount: number;
37
- originalPosition: Vtree.LayoutPosition | null;
38
- foundUpperBound: boolean;
39
- constructor(columnGenerator: ColumnGenerator, regionPageFloatLayoutContext: any, layoutContainer: Vtree.Container, columnCount: number);
40
- preBalance(layoutResult: ColumnLayoutResult): void;
41
- private checkPosition;
42
- calculatePenalty(layoutResult: ColumnLayoutResult): number;
43
- hasNextCandidate(candidates: ColumnBalancingTrialResult[]): boolean;
44
- updateCondition(candidates: ColumnBalancingTrialResult[]): void;
45
- }
46
- export declare class BalanceNonLastColumnBalancer extends ColumnBalancer {
47
- constructor(columnGenerator: ColumnGenerator, regionPageFloatLayoutContext: any, layoutContainer: Vtree.Container);
48
- calculatePenalty(layoutResult: ColumnLayoutResult): number;
49
- hasNextCandidate(candidates: ColumnBalancingTrialResult[]): boolean;
50
- updateCondition(candidates: ColumnBalancingTrialResult[]): void;
51
- }
52
- export declare function createColumnBalancer(columnCount: number, columnFill: Css.Ident, columnGenerator: ColumnGenerator, regionPageFloatLayoutContext: PageFloats.PageFloatLayoutContext, layoutContainer: Vtree.Container, columns: Layout.Column[], flowPosition: Vtree.FlowPosition): ColumnBalancer | null;
1
+ import * as Css from "./css";
2
+ import * as PageFloats from "./page-floats";
3
+ import * as Task from "./task";
4
+ import * as Vtree from "./vtree";
5
+ import { Layout } from "./types";
6
+ export type ColumnLayoutResult = {
7
+ columns: Layout.Column[];
8
+ position: Vtree.LayoutPosition;
9
+ columnPageFloatLayoutContexts?: PageFloats.PageFloatLayoutContext[];
10
+ };
11
+ export type ColumnGenerator = () => Task.Result<ColumnLayoutResult | null>;
12
+ export declare class ColumnBalancingTrialResult {
13
+ readonly layoutResult: ColumnLayoutResult;
14
+ readonly penalty: number;
15
+ constructor(layoutResult: ColumnLayoutResult, penalty: number);
16
+ }
17
+ export declare abstract class ColumnBalancer {
18
+ readonly layoutContainer: Vtree.Container;
19
+ readonly columnGenerator: ColumnGenerator;
20
+ readonly regionPageFloatLayoutContext: PageFloats.PageFloatLayoutContext;
21
+ originalContainerBlockSize: number;
22
+ constructor(layoutContainer: Vtree.Container, columnGenerator: ColumnGenerator, regionPageFloatLayoutContext: PageFloats.PageFloatLayoutContext);
23
+ balanceColumns(layoutResult: ColumnLayoutResult): Task.Result<ColumnLayoutResult>;
24
+ private createTrialResult;
25
+ protected preBalance(layoutResult: ColumnLayoutResult): void;
26
+ protected abstract calculatePenalty(layoutResult: ColumnLayoutResult): number;
27
+ protected abstract hasNextCandidate(candidates: ColumnBalancingTrialResult[]): boolean;
28
+ protected abstract updateCondition(candidates: ColumnBalancingTrialResult[]): void;
29
+ protected postBalance(): void;
30
+ savePageFloatLayoutContexts(layoutResult: ColumnLayoutResult | null): void;
31
+ private restoreContents;
32
+ }
33
+ export declare function canReduceContainerSize(candidates: ColumnBalancingTrialResult[]): boolean;
34
+ export declare function reduceContainerSize(candidates: ColumnBalancingTrialResult[], container: Vtree.Container): void;
35
+ export declare class BalanceLastColumnBalancer extends ColumnBalancer {
36
+ readonly columnCount: number;
37
+ originalPosition: Vtree.LayoutPosition | null;
38
+ foundUpperBound: boolean;
39
+ constructor(columnGenerator: ColumnGenerator, regionPageFloatLayoutContext: any, layoutContainer: Vtree.Container, columnCount: number);
40
+ preBalance(layoutResult: ColumnLayoutResult): void;
41
+ private checkPosition;
42
+ calculatePenalty(layoutResult: ColumnLayoutResult): number;
43
+ hasNextCandidate(candidates: ColumnBalancingTrialResult[]): boolean;
44
+ updateCondition(candidates: ColumnBalancingTrialResult[]): void;
45
+ }
46
+ export declare class BalanceNonLastColumnBalancer extends ColumnBalancer {
47
+ constructor(columnGenerator: ColumnGenerator, regionPageFloatLayoutContext: any, layoutContainer: Vtree.Container);
48
+ calculatePenalty(layoutResult: ColumnLayoutResult): number;
49
+ hasNextCandidate(candidates: ColumnBalancingTrialResult[]): boolean;
50
+ updateCondition(candidates: ColumnBalancingTrialResult[]): void;
51
+ }
52
+ export declare function createColumnBalancer(columnCount: number, columnFill: Css.Ident, columnGenerator: ColumnGenerator, regionPageFloatLayoutContext: PageFloats.PageFloatLayoutContext, layoutContainer: Vtree.Container, columns: Layout.Column[], flowPosition: Vtree.FlowPosition): ColumnBalancer | null;
@@ -1,53 +1,53 @@
1
- /**
2
- * Copyright 2015 Trim-marks Inc.
3
- * Copyright 2019 Vivliostyle Foundation
4
- *
5
- * Vivliostyle.js is free software: you can redistribute it and/or modify
6
- * it under the terms of the GNU Affero General Public License as published by
7
- * the Free Software Foundation, either version 3 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * Vivliostyle.js is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU Affero General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU Affero General Public License
16
- * along with Vivliostyle.js. If not, see <http://www.gnu.org/licenses/>.
17
- *
18
- * @fileoverview Constants
19
- */
20
- /**
21
- * Debug flag.
22
- */
23
- export declare let isDebug: boolean;
24
- export declare function setDebug(value: boolean): void;
25
- /**
26
- * Page progression direction.
27
- * @enum {string}
28
- */
29
- export declare enum PageProgression {
30
- LTR = "ltr",
31
- RTL = "rtl"
32
- }
33
- /**
34
- * Return PageProgression corresponding to the specified string
35
- */
36
- export declare function pageProgressionOf(str: string): PageProgression;
37
- /**
38
- * Page side (left/right).
39
- * @enum {string}
40
- */
41
- export declare enum PageSide {
42
- LEFT = "left",
43
- RIGHT = "right"
44
- }
45
- /**
46
- * Viewer ready state.
47
- * @enum {string}
48
- */
49
- export declare enum ReadyState {
50
- LOADING = "loading",
51
- INTERACTIVE = "interactive",
52
- COMPLETE = "complete"
53
- }
1
+ /**
2
+ * Copyright 2015 Trim-marks Inc.
3
+ * Copyright 2019 Vivliostyle Foundation
4
+ *
5
+ * Vivliostyle.js is free software: you can redistribute it and/or modify
6
+ * it under the terms of the GNU Affero General Public License as published by
7
+ * the Free Software Foundation, either version 3 of the License, or
8
+ * (at your option) any later version.
9
+ *
10
+ * Vivliostyle.js is distributed in the hope that it will be useful,
11
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ * GNU Affero General Public License for more details.
14
+ *
15
+ * You should have received a copy of the GNU Affero General Public License
16
+ * along with Vivliostyle.js. If not, see <http://www.gnu.org/licenses/>.
17
+ *
18
+ * @fileoverview Constants
19
+ */
20
+ /**
21
+ * Debug flag.
22
+ */
23
+ export declare let isDebug: boolean;
24
+ export declare function setDebug(value: boolean): void;
25
+ /**
26
+ * Page progression direction.
27
+ * @enum {string}
28
+ */
29
+ export declare enum PageProgression {
30
+ LTR = "ltr",
31
+ RTL = "rtl"
32
+ }
33
+ /**
34
+ * Return PageProgression corresponding to the specified string
35
+ */
36
+ export declare function pageProgressionOf(str: string): PageProgression;
37
+ /**
38
+ * Page side (left/right).
39
+ * @enum {string}
40
+ */
41
+ export declare enum PageSide {
42
+ LEFT = "left",
43
+ RIGHT = "right"
44
+ }
45
+ /**
46
+ * Viewer ready state.
47
+ * @enum {string}
48
+ */
49
+ export declare enum ReadyState {
50
+ LOADING = "loading",
51
+ INTERACTIVE = "interactive",
52
+ COMPLETE = "complete"
53
+ }