reamkit 1.30.0 → 1.32.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 (147) hide show
  1. package/README.md +70 -24
  2. package/dist/esm/core/bidi/index.d.ts +10 -0
  3. package/dist/esm/core/bidi/index.js +18 -2
  4. package/dist/esm/core/converter/facade.js +10 -5
  5. package/dist/esm/core/converter/project.js +4 -1
  6. package/dist/esm/core/converter/ream.js +17 -6
  7. package/dist/esm/core/converter/sheet-images.d.ts +17 -0
  8. package/dist/esm/core/converter/sheet-images.js +33 -0
  9. package/dist/esm/core/crypto/offcrypto.js +1 -1
  10. package/dist/esm/core/document-model/index.d.ts +1 -1
  11. package/dist/esm/core/document-model/types.d.ts +175 -0
  12. package/dist/esm/core/drawingml/chart-geometry.d.ts +21 -8
  13. package/dist/esm/core/drawingml/chart-geometry.js +198 -108
  14. package/dist/esm/core/drawingml/chart-parser.js +73 -2
  15. package/dist/esm/core/drawingml/colors.d.ts +6 -0
  16. package/dist/esm/core/drawingml/colors.js +23 -3
  17. package/dist/esm/core/drawingml/shape-render.d.ts +3 -1
  18. package/dist/esm/core/drawingml/shape-render.js +4 -2
  19. package/dist/esm/core/font/index.d.ts +2 -0
  20. package/dist/esm/core/font/measure.d.ts +9 -0
  21. package/dist/esm/core/font/measure.js +9 -1
  22. package/dist/esm/core/font/ttf-build.d.ts +113 -0
  23. package/dist/esm/core/font/ttf-build.js +1224 -0
  24. package/dist/esm/core/font/ttf-subset.d.ts +19 -0
  25. package/dist/esm/core/font/ttf-subset.js +14 -1
  26. package/dist/esm/core/fonts/families.js +4 -2
  27. package/dist/esm/core/fonts/provider.d.ts +17 -0
  28. package/dist/esm/core/fonts/provider.js +27 -2
  29. package/dist/esm/core/fonts/remote-fonts.js +8 -1
  30. package/dist/esm/core/fonts/scripts.js +4 -2
  31. package/dist/esm/core/ir/flow.d.ts +77 -1
  32. package/dist/esm/core/ir/sheet.d.ts +43 -0
  33. package/dist/esm/core/number-format.js +16 -11
  34. package/dist/esm/core/numbering/index.d.ts +1 -1
  35. package/dist/esm/core/numbering/state.d.ts +11 -1
  36. package/dist/esm/core/numbering/state.js +10 -1
  37. package/dist/esm/core/spreadsheet-model/index.d.ts +1 -1
  38. package/dist/esm/core/spreadsheet-model/types.d.ts +96 -0
  39. package/dist/esm/core/style-cascade/resolver.js +39 -6
  40. package/dist/esm/core/style-cascade/types.d.ts +19 -1
  41. package/dist/esm/core/style-cascade/types.js +3 -0
  42. package/dist/esm/excel/column-bands.d.ts +39 -6
  43. package/dist/esm/excel/column-bands.js +41 -17
  44. package/dist/esm/excel/comments-parser.js +19 -0
  45. package/dist/esm/excel/conditional-format.d.ts +7 -3
  46. package/dist/esm/excel/conditional-format.js +77 -39
  47. package/dist/esm/excel/formula/context.d.ts +18 -0
  48. package/dist/esm/excel/formula/eval.js +51 -0
  49. package/dist/esm/excel/formula/index.d.ts +2 -2
  50. package/dist/esm/excel/formula/lexer.d.ts +1 -1
  51. package/dist/esm/excel/formula/lexer.js +41 -0
  52. package/dist/esm/excel/formula/parser.d.ts +25 -0
  53. package/dist/esm/excel/formula/parser.js +95 -0
  54. package/dist/esm/excel/print-model.d.ts +38 -1
  55. package/dist/esm/excel/print-model.js +522 -80
  56. package/dist/esm/excel/shared-strings-parser.d.ts +9 -0
  57. package/dist/esm/excel/shared-strings-parser.js +11 -1
  58. package/dist/esm/excel/sheet-drawing.d.ts +38 -2
  59. package/dist/esm/excel/sheet-drawing.js +47 -13
  60. package/dist/esm/excel/sheet-shape-parser.d.ts +6 -2
  61. package/dist/esm/excel/sheet-shape-parser.js +18 -6
  62. package/dist/esm/excel/sheet-to-flow.d.ts +17 -0
  63. package/dist/esm/excel/sheet-to-flow.js +434 -47
  64. package/dist/esm/excel/styles-parser.d.ts +9 -0
  65. package/dist/esm/excel/styles-parser.js +80 -26
  66. package/dist/esm/excel/table-parser.js +5 -0
  67. package/dist/esm/excel/table-style-presets.d.ts +26 -0
  68. package/dist/esm/excel/table-style-presets.js +1555 -0
  69. package/dist/esm/excel/table-style.d.ts +13 -0
  70. package/dist/esm/excel/table-style.js +75 -0
  71. package/dist/esm/excel/tint.d.ts +10 -0
  72. package/dist/esm/excel/tint.js +75 -0
  73. package/dist/esm/excel/vml-drawing.d.ts +41 -3
  74. package/dist/esm/excel/vml-drawing.js +143 -10
  75. package/dist/esm/excel/worksheet-parser.js +89 -15
  76. package/dist/esm/excel/xls/biff-reader.js +10 -2
  77. package/dist/esm/excel/xlsx-reader.js +195 -14
  78. package/dist/esm/excel/xlsx-writer.js +8 -7
  79. package/dist/esm/html/html-writer.js +202 -20
  80. package/dist/esm/index.d.ts +2 -2
  81. package/dist/esm/layout/fit-pages.d.ts +11 -0
  82. package/dist/esm/layout/fit-pages.js +86 -0
  83. package/dist/esm/layout/line-paint.d.ts +58 -0
  84. package/dist/esm/layout/line-paint.js +107 -0
  85. package/dist/esm/layout/page-doc.d.ts +61 -3
  86. package/dist/esm/layout/page-doc.js +141 -1
  87. package/dist/esm/layout/styled-layout.d.ts +55 -7
  88. package/dist/esm/layout/styled-layout.js +1154 -169
  89. package/dist/esm/layout/turned-section.d.ts +38 -0
  90. package/dist/esm/layout/turned-section.js +205 -0
  91. package/dist/esm/markdown/markdown-writer.js +17 -6
  92. package/dist/esm/pdf/styled-page-emitter.js +114 -60
  93. package/dist/esm/pdf/styled-page-renderer.js +1 -1
  94. package/dist/esm/pdf-reader/cff-outline.d.ts +27 -0
  95. package/dist/esm/pdf-reader/cff-outline.js +169 -21
  96. package/dist/esm/pdf-reader/content.d.ts +53 -0
  97. package/dist/esm/pdf-reader/content.js +9 -1
  98. package/dist/esm/pdf-reader/display.d.ts +36 -0
  99. package/dist/esm/pdf-reader/display.js +66 -1
  100. package/dist/esm/pdf-reader/document.js +5 -1
  101. package/dist/esm/pdf-reader/embedded-fonts.d.ts +2 -1
  102. package/dist/esm/pdf-reader/embedded-fonts.js +32 -2
  103. package/dist/esm/pdf-reader/encodings.d.ts +8 -0
  104. package/dist/esm/pdf-reader/encodings.js +25 -3
  105. package/dist/esm/pdf-reader/face-outlines.d.ts +78 -0
  106. package/dist/esm/pdf-reader/face-outlines.js +362 -0
  107. package/dist/esm/pdf-reader/figures.d.ts +52 -0
  108. package/dist/esm/pdf-reader/figures.js +433 -0
  109. package/dist/esm/pdf-reader/flow-build.d.ts +131 -5
  110. package/dist/esm/pdf-reader/flow-build.js +345 -26
  111. package/dist/esm/pdf-reader/font.js +321 -36
  112. package/dist/esm/pdf-reader/glyf-outline.d.ts +33 -0
  113. package/dist/esm/pdf-reader/glyf-outline.js +135 -1
  114. package/dist/esm/pdf-reader/glyph-names.js +154 -1
  115. package/dist/esm/pdf-reader/layout.d.ts +93 -0
  116. package/dist/esm/pdf-reader/layout.js +1703 -214
  117. package/dist/esm/pdf-reader/page-numbers.d.ts +53 -0
  118. package/dist/esm/pdf-reader/page-numbers.js +167 -0
  119. package/dist/esm/pdf-reader/tagged.js +182 -23
  120. package/dist/esm/pdf-reader/text.d.ts +6 -3
  121. package/dist/esm/pdf-reader/text.js +98 -9
  122. package/dist/esm/pdf-reader/type1-outline.d.ts +11 -0
  123. package/dist/esm/pdf-reader/type1-outline.js +63 -8
  124. package/dist/esm/pdf-reader/vector.js +71 -1
  125. package/dist/esm/svg/svg-text.d.ts +58 -0
  126. package/dist/esm/svg/svg-text.js +322 -0
  127. package/dist/esm/svg/svg-writer.js +135 -71
  128. package/dist/esm/word/doc/doc-reader.js +6 -2
  129. package/dist/esm/word/doc/doc-text.d.ts +6 -0
  130. package/dist/esm/word/doc/doc-text.js +19 -1
  131. package/dist/esm/word/document-parser.d.ts +2 -2
  132. package/dist/esm/word/document-parser.js +11 -1
  133. package/dist/esm/word/docx-reader.js +5 -3
  134. package/dist/esm/word/docx-writer.js +218 -23
  135. package/dist/esm/word/drawing-parser.d.ts +5 -3
  136. package/dist/esm/word/drawing-parser.js +49 -8
  137. package/dist/esm/word/font-embed.d.ts +30 -0
  138. package/dist/esm/word/font-embed.js +173 -0
  139. package/dist/esm/word/font-table.d.ts +10 -0
  140. package/dist/esm/word/font-table.js +13 -1
  141. package/dist/esm/word/index.js +1 -1
  142. package/dist/esm/word/numbering-parser.d.ts +3 -1
  143. package/dist/esm/word/numbering-parser.js +2 -1
  144. package/dist/esm/word/paragraph-properties.d.ts +7 -6
  145. package/dist/esm/word/paragraph-properties.js +14 -2
  146. package/dist/esm/word/run-properties.js +26 -0
  147. package/package.json +12 -3
@@ -1,6 +1,14 @@
1
+ import { PageNumbering } from './page-numbers.js';
1
2
  import { PdfVector } from './vector.js';
3
+ import { BodyElement, SectionProperties } from '../core/document-model/index.js';
4
+ import { TextRun } from './content.js';
2
5
  import { PdfFile } from './document.js';
3
6
  import { Reconstruction } from './flow-build.js';
7
+ /** The relationships the reconstruction files its running head and foot under. */
8
+ export declare const FOOTER_PART = "pdf-running-foot";
9
+ /** The part the running foot of a book's even pages is written to (see `sidesOf`). */
10
+ export declare const EVEN_FOOTER_PART = "pdf-running-foot-even";
11
+ export declare const HEADER_PART = "pdf-running-head";
4
12
  /** §9.10.2 — a glyph the face maps to no character (see `./font`). */
5
13
  export declare const UNMAPPED = "\uFFFD";
6
14
  /**
@@ -19,6 +27,20 @@ export declare const UNMAPPED = "\uFFFD";
19
27
  * @returns The reconstructed {@link FlowDoc} plus any read-time losses.
20
28
  */
21
29
  export declare function reconstructByLayout(file: PdfFile, mode?: 'flow' | 'positional'): Reconstruction;
30
+ /** Where the page's text starts and ends, ignoring what is only a space. */
31
+ export declare function pageTextEdges(runs: ReadonlyArray<TextRun>): {
32
+ left: number;
33
+ right: number;
34
+ } | undefined;
35
+ /**
36
+ * Whether this page STEPS between its words rather than writing spaces.
37
+ *
38
+ * Counted rather than guessed: bigboundingbox.pdf writes a space in one run in
39
+ * a hundred, TAMReview.pdf in a third of them, and no page does a little of
40
+ * both. A page with almost no text says nothing either way and keeps the
41
+ * cautious reading.
42
+ */
43
+ export declare function stepsBetweenWords(runs: ReadonlyArray<TextRun>): boolean;
22
44
  /**
23
45
  * Whether a line ENDED a paragraph, rather than wrapping into the next.
24
46
  *
@@ -57,6 +79,77 @@ export declare function endedParagraph(prev: {
57
79
  left: number;
58
80
  right: number;
59
81
  } | undefined): boolean;
82
+ /**
83
+ * §17.6.13 — the running foot a document repeats at the bottom of its pages.
84
+ *
85
+ * A page number, a title, a URL: it stands below the text block, in the margin,
86
+ * and it is not part of what the page SAYS. Read as body it goes wherever the
87
+ * reflow puts it — bug1997343.pdf's "1" came out on a sheet of its own between
88
+ * the two the paper has, and TAMReview.pdf's "Sprouts — http://…" landed in the
89
+ * middle of the abstract.
90
+ *
91
+ * What makes it a running foot is that it RUNS: the same place, page after
92
+ * page, cut off from the text above it by more than a line of white. One page
93
+ * proves nothing, so two are asked for.
94
+ *
95
+ * @param pageRuns Each page's runs, placed.
96
+ * @param shown Each page's shown geometry.
97
+ * @returns The runs to lift off each page and the band to put them in, or
98
+ * `undefined` where the document repeats nothing.
99
+ */
100
+ export declare function runningFoot(pageRuns: ReadonlyArray<ReadonlyArray<TextRun>>, shown: ReadonlyArray<{
101
+ height: number;
102
+ }>, where: 'head' | 'foot'): {
103
+ lift: ReadonlyArray<ReadonlySet<TextRun>>;
104
+ band: ReadonlyArray<TextRun>;
105
+ /** Whether a number in it is the PAGE's number rather than part of the text. */
106
+ numbered: boolean;
107
+ } | undefined;
108
+ /** How many of a document's pages must carry the foot before it is running. */
109
+ /**
110
+ * §17.6.12 — how a document's pages are numbered, read off the band that
111
+ * prints their numbers (see ./page-numbers).
112
+ *
113
+ * @param band The running head or foot whose numbers change from page to page.
114
+ * @returns The numbering, or undefined where no band numbers the pages.
115
+ */
116
+ export declare function numberingOf(band: {
117
+ readonly lift: ReadonlyArray<ReadonlySet<TextRun>>;
118
+ } | undefined): PageNumbering | undefined;
119
+ /**
120
+ * The numbering a section opening at `page` states: the numerals of the
121
+ * sequence the page is counted in, and the number the sequence starts at where
122
+ * it starts there.
123
+ *
124
+ * @param numbering The document's numbering.
125
+ * @param page The section's first page.
126
+ * @returns The section's `pageNumberFormat` and `pageNumberStart`, as needed.
127
+ */
128
+ export declare function numberedFrom(numbering: PageNumbering | undefined, page: number): Pick<SectionProperties, 'pageNumberFormat' | 'pageNumberStart'>;
129
+ /**
130
+ * The band itself: the foot's own line, with the number in it made a field.
131
+ *
132
+ * §17.16.5.35 — a page number is not the text "1"; it is the number of the page
133
+ * it is drawn on, which is why the same band serves every page.
134
+ *
135
+ * A foot is written in REGIONS, the way a spreadsheet's is: something at the
136
+ * left of the sheet, something at the middle, something against the far edge.
137
+ * ZapfDingbats.pdf signs each page "© RenderX 2000" at the left and "XSL
138
+ * Formatting Objects Test Suite" at the right, and the two hundred points
139
+ * between them came back as one word space, the two texts crowding each other
140
+ * at the left. They stand on TAB STOPS instead (§17.3.1.38), which is what the
141
+ * two hundred points are.
142
+ *
143
+ * @param runs The foot's runs.
144
+ * @param stepped Whether the page steps between its words.
145
+ * @param measure The measure it was set across, for its alignment.
146
+ * @param numbered Whether a number in it is the page's own.
147
+ * @param numeral That number as this band prints it, where it is known.
148
+ */
149
+ export declare function footerBand(runs: ReadonlyArray<TextRun>, stepped: boolean, measure: {
150
+ left: number;
151
+ right: number;
152
+ } | undefined, numbered: boolean, numeral?: string): Array<BodyElement>;
60
153
  /**
61
154
  * §9.6.6 — the glyphs a page draws for want of characters, gathered into the
62
155
  * WORDS they stand in: a traced glyph that stands against the one before it,