js.documents 1.102.2 → 2.0.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 (40) hide show
  1. package/README.md +8 -5
  2. package/dist/convert/composition.cjs +15 -4
  3. package/dist/convert/composition.js +15 -4
  4. package/dist/convert/convert.cjs +6 -3
  5. package/dist/convert/convert.js +6 -3
  6. package/dist/convert/from-package.cjs +179 -2
  7. package/dist/convert/from-package.d.cts +3 -2
  8. package/dist/convert/from-package.d.ts +3 -2
  9. package/dist/convert/from-package.js +179 -3
  10. package/dist/index.cjs +1 -0
  11. package/dist/index.d.cts +3 -3
  12. package/dist/index.d.ts +3 -3
  13. package/dist/index.js +2 -2
  14. package/dist/layout/drawing.cjs +71 -9
  15. package/dist/layout/drawing.d.cts +8 -3
  16. package/dist/layout/drawing.d.ts +8 -3
  17. package/dist/layout/drawing.js +71 -10
  18. package/dist/layout/engine.cjs +55 -43
  19. package/dist/layout/engine.d.cts +2 -1
  20. package/dist/layout/engine.d.ts +2 -1
  21. package/dist/layout/engine.js +57 -45
  22. package/dist/layout/reconstruct.cjs +259 -104
  23. package/dist/layout/reconstruct.js +259 -104
  24. package/dist/layout/shared.cjs +47 -2
  25. package/dist/layout/shared.d.cts +15 -4
  26. package/dist/layout/shared.d.ts +15 -4
  27. package/dist/layout/shared.js +44 -4
  28. package/dist/layout/sheets.cjs +18 -13
  29. package/dist/layout/sheets.d.cts +4 -2
  30. package/dist/layout/sheets.d.ts +4 -2
  31. package/dist/layout/sheets.js +20 -16
  32. package/dist/layout/slides.cjs +35 -31
  33. package/dist/layout/slides.d.cts +3 -2
  34. package/dist/layout/slides.d.ts +3 -2
  35. package/dist/layout/slides.js +37 -33
  36. package/dist/layout/text-layout.cjs +2 -1
  37. package/dist/layout/text-layout.d.cts +14 -3
  38. package/dist/layout/text-layout.d.ts +14 -3
  39. package/dist/layout/text-layout.js +2 -1
  40. package/package.json +5 -5
@@ -5,6 +5,45 @@ let ooxml_js = require("ooxml.js");
5
5
  let document_schema_js = require("document-schema.js");
6
6
  let byte_codec = require("byte-codec");
7
7
  //#region src/layout/shared.ts
8
+ function stampFrame(node, pageIndex, box) {
9
+ const frame = {
10
+ pageIndex,
11
+ xPt: box.xPt,
12
+ yPt: box.yPt,
13
+ widthPt: box.widthPt,
14
+ heightPt: box.heightPt
15
+ };
16
+ if (node.frames === void 0) node.frames = [frame];
17
+ else node.frames.push(frame);
18
+ }
19
+ function textBoxForFragment(item, textWidthPt, ascentPt, descentPt) {
20
+ return {
21
+ xPt: item.xPt,
22
+ yPt: item.yPt + descentPt,
23
+ widthPt: textWidthPt,
24
+ heightPt: ascentPt - descentPt
25
+ };
26
+ }
27
+ function stampFragmentFrame(runs, fragment, pageIndex, item, measurer, line) {
28
+ if (fragment.runIndex === void 0) return;
29
+ const run = runs[fragment.runIndex];
30
+ if (run === void 0) return;
31
+ stampFrame(run, pageIndex, textBoxForFragment(item, measurer.widthOfTextAtSize(fragment.text, fragment.font, fragment.sizePt), line.ascentPt, line.descentPt));
32
+ }
33
+ function packagePagesOf(pages) {
34
+ return pages.map((page) => ({
35
+ widthPt: page.widthPt,
36
+ heightPt: page.heightPt
37
+ }));
38
+ }
39
+ function layoutDocumentOf(metadata, pages, images) {
40
+ return {
41
+ formatVersion: document_schema_js.LAYOUT_FORMAT_VERSION,
42
+ metadata,
43
+ pages,
44
+ images
45
+ };
46
+ }
8
47
  const NOMINAL_TEXT_SIZE_PT = 18;
9
48
  const MIN_FORMULA_SIZE_PT = 8;
10
49
  const REFERENCE_FORMULA_SIZE_PT = 12;
@@ -61,14 +100,15 @@ function runFont(run, headingBold) {
61
100
  };
62
101
  }
63
102
  function toStyledRuns(runs, fontScale = 1, headingStyle) {
64
- return runs.map((run) => ({
103
+ return runs.map((run, runIndex) => ({
65
104
  text: run.text,
66
105
  font: runFont(run, headingStyle?.bold),
67
106
  sizePt: (run.sizePt ?? headingStyle?.sizePt ?? 18) * fontScale,
68
107
  color: run.color ?? document_schema_js.COLOR_BLACK,
69
108
  underline: run.underline,
70
109
  hyperlink: run.hyperlink,
71
- sourcePath: run.sourcePath
110
+ sourcePath: run.sourcePath,
111
+ runIndex
72
112
  }));
73
113
  }
74
114
  function effectiveStyledRuns(runs, fontScale = 1, headingStyle) {
@@ -199,9 +239,14 @@ exports.estimateRowHeightPt = estimateRowHeightPt;
199
239
  exports.formulaSizePtForFrame = formulaSizePtForFrame;
200
240
  exports.headingStyleFor = headingStyleFor;
201
241
  exports.justifyLineGapsPt = justifyLineGapsPt;
242
+ exports.layoutDocumentOf = layoutDocumentOf;
202
243
  exports.lineNaturalHeightPt = lineNaturalHeightPt;
244
+ exports.packagePagesOf = packagePagesOf;
203
245
  exports.pushCellBorderLines = pushCellBorderLines;
204
246
  exports.registerImage = registerImage;
205
247
  exports.runFont = runFont;
248
+ exports.stampFragmentFrame = stampFragmentFrame;
249
+ exports.stampFrame = stampFrame;
206
250
  exports.sumColumnWidthsPt = sumColumnWidthsPt;
251
+ exports.textBoxForFragment = textBoxForFragment;
207
252
  exports.toStyledRuns = toStyledRuns;
@@ -1,5 +1,16 @@
1
- import { Alignment, Box, ContentCellBorders, ContentImageBlock, ContentRun, ContentTableRow, LayoutFont, LayoutImageAsset, LayoutItem, MathFontMetrics, MathMlNode, StyledRun, TextMeasurer, WrappedLine } from "document-schema.js";
1
+ import { SourcedFragment, SourcedRun } from "./text-layout.cjs";
2
+ import { Alignment, Box, ContentCellBorders, ContentImageBlock, ContentRun, ContentTableRow, LayoutDocument, LayoutFont, LayoutFrame, LayoutImageAsset, LayoutItem, LayoutMetadata, LayoutPage, LayoutText, MathFontMetrics, MathMlNode, PageSize, StyledRun, TextMeasurer, WrappedLine } from "document-schema.js";
2
3
  //#region src/layout/shared.d.ts
4
+ declare function stampFrame(node: {
5
+ frames?: LayoutFrame[];
6
+ }, pageIndex: number, box: Box): void;
7
+ declare function textBoxForFragment(item: LayoutText, textWidthPt: number, ascentPt: number, descentPt: number): Box;
8
+ declare function stampFragmentFrame(runs: readonly ContentRun[], fragment: SourcedFragment, pageIndex: number, item: LayoutText, measurer: TextMeasurer, line: {
9
+ readonly ascentPt: number;
10
+ readonly descentPt: number;
11
+ }): void;
12
+ declare function packagePagesOf(pages: readonly LayoutPage[]): PageSize[];
13
+ declare function layoutDocumentOf(metadata: LayoutMetadata, pages: LayoutPage[], images: Record<string, LayoutImageAsset>): LayoutDocument;
3
14
  declare const NOMINAL_TEXT_SIZE_PT = 18;
4
15
  declare function formulaSizePtForFrame(mathml: readonly MathMlNode[], frame: Box, mathMetricsAt: (sizePt: number) => MathFontMetrics): number;
5
16
  declare function headingStyleFor(styleId: string | undefined): {
@@ -10,11 +21,11 @@ declare function runFont(run: ContentRun, headingBold?: boolean): LayoutFont;
10
21
  declare function toStyledRuns(runs: readonly ContentRun[], fontScale?: number, headingStyle?: {
11
22
  bold: boolean;
12
23
  sizePt: number;
13
- }): StyledRun[];
24
+ }): SourcedRun[];
14
25
  declare function effectiveStyledRuns(runs: readonly ContentRun[], fontScale?: number, headingStyle?: {
15
26
  bold: boolean;
16
27
  sizePt: number;
17
- }): StyledRun[];
28
+ }): SourcedRun[];
18
29
  declare function lineNaturalHeightPt(line: WrappedLine, measurer: TextMeasurer, fallback: StyledRun): number;
19
30
  declare function alignmentOffsetPt(alignment: Alignment | undefined, contentWidthPt: number, lineWidthPt: number): number;
20
31
  declare function justifyLineGapsPt(line: WrappedLine, targetWidthPt: number, measurer: TextMeasurer): readonly number[];
@@ -23,4 +34,4 @@ declare function registerImage(block: ContentImageBlock, images: Record<string,
23
34
  declare function sumColumnWidthsPt(columnWidthsPt: readonly number[], startIndex: number, span: number): number;
24
35
  declare function estimateRowHeightPt(row: ContentTableRow, measurer: TextMeasurer, columnWidthsPt: readonly number[], scale: number): number;
25
36
  //#endregion
26
- export { NOMINAL_TEXT_SIZE_PT, alignmentOffsetPt, effectiveStyledRuns, estimateRowHeightPt, formulaSizePtForFrame, headingStyleFor, justifyLineGapsPt, lineNaturalHeightPt, pushCellBorderLines, registerImage, runFont, sumColumnWidthsPt, toStyledRuns };
37
+ export { NOMINAL_TEXT_SIZE_PT, alignmentOffsetPt, effectiveStyledRuns, estimateRowHeightPt, formulaSizePtForFrame, headingStyleFor, justifyLineGapsPt, layoutDocumentOf, lineNaturalHeightPt, packagePagesOf, pushCellBorderLines, registerImage, runFont, stampFragmentFrame, stampFrame, sumColumnWidthsPt, textBoxForFragment, toStyledRuns };
@@ -1,5 +1,16 @@
1
- import { Alignment, Box, ContentCellBorders, ContentImageBlock, ContentRun, ContentTableRow, LayoutFont, LayoutImageAsset, LayoutItem, MathFontMetrics, MathMlNode, StyledRun, TextMeasurer, WrappedLine } from "document-schema.js";
1
+ import { SourcedFragment, SourcedRun } from "./text-layout.js";
2
+ import { Alignment, Box, ContentCellBorders, ContentImageBlock, ContentRun, ContentTableRow, LayoutDocument, LayoutFont, LayoutFrame, LayoutImageAsset, LayoutItem, LayoutMetadata, LayoutPage, LayoutText, MathFontMetrics, MathMlNode, PageSize, StyledRun, TextMeasurer, WrappedLine } from "document-schema.js";
2
3
  //#region src/layout/shared.d.ts
4
+ declare function stampFrame(node: {
5
+ frames?: LayoutFrame[];
6
+ }, pageIndex: number, box: Box): void;
7
+ declare function textBoxForFragment(item: LayoutText, textWidthPt: number, ascentPt: number, descentPt: number): Box;
8
+ declare function stampFragmentFrame(runs: readonly ContentRun[], fragment: SourcedFragment, pageIndex: number, item: LayoutText, measurer: TextMeasurer, line: {
9
+ readonly ascentPt: number;
10
+ readonly descentPt: number;
11
+ }): void;
12
+ declare function packagePagesOf(pages: readonly LayoutPage[]): PageSize[];
13
+ declare function layoutDocumentOf(metadata: LayoutMetadata, pages: LayoutPage[], images: Record<string, LayoutImageAsset>): LayoutDocument;
3
14
  declare const NOMINAL_TEXT_SIZE_PT = 18;
4
15
  declare function formulaSizePtForFrame(mathml: readonly MathMlNode[], frame: Box, mathMetricsAt: (sizePt: number) => MathFontMetrics): number;
5
16
  declare function headingStyleFor(styleId: string | undefined): {
@@ -10,11 +21,11 @@ declare function runFont(run: ContentRun, headingBold?: boolean): LayoutFont;
10
21
  declare function toStyledRuns(runs: readonly ContentRun[], fontScale?: number, headingStyle?: {
11
22
  bold: boolean;
12
23
  sizePt: number;
13
- }): StyledRun[];
24
+ }): SourcedRun[];
14
25
  declare function effectiveStyledRuns(runs: readonly ContentRun[], fontScale?: number, headingStyle?: {
15
26
  bold: boolean;
16
27
  sizePt: number;
17
- }): StyledRun[];
28
+ }): SourcedRun[];
18
29
  declare function lineNaturalHeightPt(line: WrappedLine, measurer: TextMeasurer, fallback: StyledRun): number;
19
30
  declare function alignmentOffsetPt(alignment: Alignment | undefined, contentWidthPt: number, lineWidthPt: number): number;
20
31
  declare function justifyLineGapsPt(line: WrappedLine, targetWidthPt: number, measurer: TextMeasurer): readonly number[];
@@ -23,4 +34,4 @@ declare function registerImage(block: ContentImageBlock, images: Record<string,
23
34
  declare function sumColumnWidthsPt(columnWidthsPt: readonly number[], startIndex: number, span: number): number;
24
35
  declare function estimateRowHeightPt(row: ContentTableRow, measurer: TextMeasurer, columnWidthsPt: readonly number[], scale: number): number;
25
36
  //#endregion
26
- export { NOMINAL_TEXT_SIZE_PT, alignmentOffsetPt, effectiveStyledRuns, estimateRowHeightPt, formulaSizePtForFrame, headingStyleFor, justifyLineGapsPt, lineNaturalHeightPt, pushCellBorderLines, registerImage, runFont, sumColumnWidthsPt, toStyledRuns };
37
+ export { NOMINAL_TEXT_SIZE_PT, alignmentOffsetPt, effectiveStyledRuns, estimateRowHeightPt, formulaSizePtForFrame, headingStyleFor, justifyLineGapsPt, layoutDocumentOf, lineNaturalHeightPt, packagePagesOf, pushCellBorderLines, registerImage, runFont, stampFragmentFrame, stampFrame, sumColumnWidthsPt, textBoxForFragment, toStyledRuns };
@@ -1,9 +1,48 @@
1
1
  import { layoutFormula } from "../mathml/layout.js";
2
2
  import { wrapRunsToWidth } from "./text-layout.js";
3
3
  import { base64ToBytes } from "ooxml.js";
4
- import { COLOR_BLACK, DEFAULT_LAYOUT_FONT } from "document-schema.js";
4
+ import { COLOR_BLACK, DEFAULT_LAYOUT_FONT, LAYOUT_FORMAT_VERSION } from "document-schema.js";
5
5
  import { crc32, decodePng, readJpegInfo } from "byte-codec";
6
6
  //#region src/layout/shared.ts
7
+ function stampFrame(node, pageIndex, box) {
8
+ const frame = {
9
+ pageIndex,
10
+ xPt: box.xPt,
11
+ yPt: box.yPt,
12
+ widthPt: box.widthPt,
13
+ heightPt: box.heightPt
14
+ };
15
+ if (node.frames === void 0) node.frames = [frame];
16
+ else node.frames.push(frame);
17
+ }
18
+ function textBoxForFragment(item, textWidthPt, ascentPt, descentPt) {
19
+ return {
20
+ xPt: item.xPt,
21
+ yPt: item.yPt + descentPt,
22
+ widthPt: textWidthPt,
23
+ heightPt: ascentPt - descentPt
24
+ };
25
+ }
26
+ function stampFragmentFrame(runs, fragment, pageIndex, item, measurer, line) {
27
+ if (fragment.runIndex === void 0) return;
28
+ const run = runs[fragment.runIndex];
29
+ if (run === void 0) return;
30
+ stampFrame(run, pageIndex, textBoxForFragment(item, measurer.widthOfTextAtSize(fragment.text, fragment.font, fragment.sizePt), line.ascentPt, line.descentPt));
31
+ }
32
+ function packagePagesOf(pages) {
33
+ return pages.map((page) => ({
34
+ widthPt: page.widthPt,
35
+ heightPt: page.heightPt
36
+ }));
37
+ }
38
+ function layoutDocumentOf(metadata, pages, images) {
39
+ return {
40
+ formatVersion: LAYOUT_FORMAT_VERSION,
41
+ metadata,
42
+ pages,
43
+ images
44
+ };
45
+ }
7
46
  const NOMINAL_TEXT_SIZE_PT = 18;
8
47
  const MIN_FORMULA_SIZE_PT = 8;
9
48
  const REFERENCE_FORMULA_SIZE_PT = 12;
@@ -60,14 +99,15 @@ function runFont(run, headingBold) {
60
99
  };
61
100
  }
62
101
  function toStyledRuns(runs, fontScale = 1, headingStyle) {
63
- return runs.map((run) => ({
102
+ return runs.map((run, runIndex) => ({
64
103
  text: run.text,
65
104
  font: runFont(run, headingStyle?.bold),
66
105
  sizePt: (run.sizePt ?? headingStyle?.sizePt ?? 18) * fontScale,
67
106
  color: run.color ?? COLOR_BLACK,
68
107
  underline: run.underline,
69
108
  hyperlink: run.hyperlink,
70
- sourcePath: run.sourcePath
109
+ sourcePath: run.sourcePath,
110
+ runIndex
71
111
  }));
72
112
  }
73
113
  function effectiveStyledRuns(runs, fontScale = 1, headingStyle) {
@@ -191,4 +231,4 @@ function estimateRowHeightPt(row, measurer, columnWidthsPt, scale) {
191
231
  return max;
192
232
  }
193
233
  //#endregion
194
- export { NOMINAL_TEXT_SIZE_PT, alignmentOffsetPt, effectiveStyledRuns, estimateRowHeightPt, formulaSizePtForFrame, headingStyleFor, justifyLineGapsPt, lineNaturalHeightPt, pushCellBorderLines, registerImage, runFont, sumColumnWidthsPt, toStyledRuns };
234
+ export { NOMINAL_TEXT_SIZE_PT, alignmentOffsetPt, effectiveStyledRuns, estimateRowHeightPt, formulaSizePtForFrame, headingStyleFor, justifyLineGapsPt, layoutDocumentOf, lineNaturalHeightPt, packagePagesOf, pushCellBorderLines, registerImage, runFont, stampFragmentFrame, stampFrame, sumColumnWidthsPt, textBoxForFragment, toStyledRuns };
@@ -138,14 +138,14 @@ function cellStyledRuns(cell) {
138
138
  if (cell.runs !== void 0 && cell.runs.length > 0) {
139
139
  const runsWithNominalSize = cell.runs.map((run) => run.sizePt === void 0 ? {
140
140
  ...run,
141
- sizePt: NOMINAL_CELL_TEXT_SIZE_PT
141
+ sizePt: 10
142
142
  } : run);
143
143
  return require_layout_shared.toStyledRuns(runsWithNominalSize);
144
144
  }
145
145
  return [{
146
146
  text: cell.displayText,
147
147
  font: document_schema_js.DEFAULT_LAYOUT_FONT,
148
- sizePt: NOMINAL_CELL_TEXT_SIZE_PT,
148
+ sizePt: 10,
149
149
  color: document_schema_js.COLOR_BLACK
150
150
  }];
151
151
  }
@@ -237,7 +237,7 @@ function verticalLineTopYDownPt(verticalAlignment, cellTopYDownPt, cellHeightPt,
237
237
  if (verticalAlignment === "middle") return cellTopYDownPt + Math.max(CELL_TEXT_PADDING_PT, (cellHeightPt - lineHeightPt) / 2);
238
238
  return cellTopYDownPt + Math.max(CELL_TEXT_PADDING_PT, cellHeightPt - CELL_TEXT_PADDING_PT - lineHeightPt);
239
239
  }
240
- function renderCellText(cell, frameYDown, rowCells, columnAxis, pageHeightPt, measurer, out) {
240
+ function renderCellText(cell, frameYDown, pageIndex, rowCells, columnAxis, pageHeightPt, measurer, out) {
241
241
  const { xPt: xLeftPt, yPt: yTopDownPt, widthPt: ownWidthPt, heightPt } = frameYDown;
242
242
  const alignment = cell.alignment ?? defaultAlignmentForValue(cell.value.kind);
243
243
  const numericLike = isNumericLikeValue(cell.value.kind);
@@ -289,6 +289,7 @@ function renderCellText(cell, frameYDown, rowCells, columnAxis, pageHeightPt, me
289
289
  sourcePath: fragment.sourcePath
290
290
  };
291
291
  out.push(textItem);
292
+ require_layout_shared.stampFragmentFrame(cell.runs ?? [], fragment, pageIndex, textItem, measurer, naturalLine);
292
293
  });
293
294
  }
294
295
  function renderHeaderLabels(gutter, columnAxis, rowAxis, gridLeftXPt, gridTopYDownPt, pageHeightPt, measurer, out) {
@@ -382,7 +383,7 @@ function renderAnchoredFormulas(formulas, columnAxis, rowAxis, gridLeftXPt, grid
382
383
  });
383
384
  }
384
385
  }
385
- function renderAnchoredImages(sheetImages, columnAxis, rowAxis, gridLeftXPt, gridTopYDownPt, pageHeightPt, hiddenColumnIndices, hiddenRowIndices, out, images) {
386
+ function renderAnchoredImages(sheetImages, columnAxis, rowAxis, gridLeftXPt, gridTopYDownPt, pageHeightPt, pageIndex, hiddenColumnIndices, hiddenRowIndices, out, images) {
386
387
  for (const image of sheetImages) {
387
388
  const columnPosition = columnAxis.positionByIndex.get(image.anchorColumn);
388
389
  const rowPosition = rowAxis.positionByIndex.get(image.anchorRow);
@@ -405,6 +406,12 @@ function renderAnchoredImages(sheetImages, columnAxis, rowAxis, gridLeftXPt, gri
405
406
  sourcePath: image.sourcePath
406
407
  };
407
408
  out.push(imageItem);
409
+ require_layout_shared.stampFrame(image, pageIndex, {
410
+ xPt: imageItem.xPt,
411
+ yPt: imageItem.yPt,
412
+ widthPt: imageItem.widthPt,
413
+ heightPt: imageItem.heightPt
414
+ });
408
415
  }
409
416
  }
410
417
  function bandableIndices(start, end, repeat) {
@@ -499,9 +506,10 @@ function convertSheetToPages(sheet, measurer, signal, out, formulasOut, images,
499
506
  if (!columnAxis.positionByIndex.has(columnIndex) || hiddenColumnIndices.has(columnIndex) || hiddenRowIndices.has(cell.row)) continue;
500
507
  const cellFrame = resolveCellFrame(cell, columnAxis, rowAxis, gridLeftXPt, gridTopYDownPt);
501
508
  if (cellFrame === void 0) continue;
509
+ require_layout_shared.stampFrame(cell, out.length, require_model_geometry.flipY(cellFrame, pageSize.heightPt));
502
510
  renderCellBackground(cell, cellFrame, pageSize.heightPt, backgroundItems);
503
511
  if (cell.borders !== void 0) require_layout_shared.pushCellBorderLines(cell.borders, cellFrame, pageSize.heightPt, cell.sourcePath, borderItems);
504
- renderCellText(cell, cellFrame, rowCells, columnAxis, pageSize.heightPt, measurer, textItems);
512
+ renderCellText(cell, cellFrame, out.length, rowCells, columnAxis, pageSize.heightPt, measurer, textItems);
505
513
  }
506
514
  }
507
515
  const items = [...backgroundItems];
@@ -510,7 +518,7 @@ function convertSheetToPages(sheet, measurer, signal, out, formulasOut, images,
510
518
  if (printSettings.headers) renderHeaderLabels(gutter, columnAxis, rowAxis, gridLeftXPt, gridTopYDownPt, pageSize.heightPt, measurer, items);
511
519
  items.push(...textItems);
512
520
  renderAnchoredFormulas(formulas, columnAxis, rowAxis, gridLeftXPt, gridTopYDownPt, pageSize.heightPt, out.length, hiddenColumnIndices, hiddenRowIndices, formulasOut, mathMetricsAt);
513
- renderAnchoredImages(sheet.images, columnAxis, rowAxis, gridLeftXPt, gridTopYDownPt, pageSize.heightPt, hiddenColumnIndices, hiddenRowIndices, items, images);
521
+ renderAnchoredImages(sheet.images, columnAxis, rowAxis, gridLeftXPt, gridTopYDownPt, pageSize.heightPt, out.length, hiddenColumnIndices, hiddenRowIndices, items, images);
514
522
  out.push({
515
523
  widthPt: pageSize.widthPt,
516
524
  heightPt: pageSize.heightPt,
@@ -524,14 +532,11 @@ function convertSpreadsheetToLayout(doc, options) {
524
532
  const images = {};
525
533
  for (const sheet of doc.sheets) convertSheetToPages(sheet, options.measurer, options.signal, pages, formulas, images, options.mathMetricsAt);
526
534
  return {
527
- document: {
528
- formatVersion: document_schema_js.LAYOUT_FORMAT_VERSION,
529
- metadata: doc.metadata,
530
- pages,
531
- images
532
- },
533
- formulas
535
+ document: require_layout_shared.layoutDocumentOf(doc.metadata, pages, images),
536
+ formulas,
537
+ pages: require_layout_shared.packagePagesOf(pages)
534
538
  };
535
539
  }
536
540
  //#endregion
541
+ exports.NOMINAL_CELL_TEXT_SIZE_PT = NOMINAL_CELL_TEXT_SIZE_PT;
537
542
  exports.convertSpreadsheetToLayout = convertSpreadsheetToLayout;
@@ -1,4 +1,4 @@
1
- import { ContentDocument, LayoutDocument, MathFontMetrics, PositionedFormula, TextMeasurer } from "document-schema.js";
1
+ import { ContentDocument, LayoutDocument, MathFontMetrics, PageSize, PositionedFormula, TextMeasurer } from "document-schema.js";
2
2
  //#region src/layout/sheets.d.ts
3
3
  interface SheetsLayoutOptions {
4
4
  readonly measurer: TextMeasurer;
@@ -8,10 +8,12 @@ interface SheetsLayoutOptions {
8
8
  interface SpreadsheetLayoutResult {
9
9
  readonly document: LayoutDocument;
10
10
  readonly formulas: readonly PositionedFormula[];
11
+ readonly pages: readonly PageSize[];
11
12
  }
12
13
  type SpreadsheetContentDocument = Extract<ContentDocument, {
13
14
  kind: 'spreadsheet';
14
15
  }>;
16
+ declare const NOMINAL_CELL_TEXT_SIZE_PT = 10;
15
17
  declare function convertSpreadsheetToLayout(doc: SpreadsheetContentDocument, options: SheetsLayoutOptions): SpreadsheetLayoutResult;
16
18
  //#endregion
17
- export { SheetsLayoutOptions, SpreadsheetLayoutResult, convertSpreadsheetToLayout };
19
+ export { NOMINAL_CELL_TEXT_SIZE_PT, SheetsLayoutOptions, SpreadsheetLayoutResult, convertSpreadsheetToLayout };
@@ -1,4 +1,4 @@
1
- import { ContentDocument, LayoutDocument, MathFontMetrics, PositionedFormula, TextMeasurer } from "document-schema.js";
1
+ import { ContentDocument, LayoutDocument, MathFontMetrics, PageSize, PositionedFormula, TextMeasurer } from "document-schema.js";
2
2
  //#region src/layout/sheets.d.ts
3
3
  interface SheetsLayoutOptions {
4
4
  readonly measurer: TextMeasurer;
@@ -8,10 +8,12 @@ interface SheetsLayoutOptions {
8
8
  interface SpreadsheetLayoutResult {
9
9
  readonly document: LayoutDocument;
10
10
  readonly formulas: readonly PositionedFormula[];
11
+ readonly pages: readonly PageSize[];
11
12
  }
12
13
  type SpreadsheetContentDocument = Extract<ContentDocument, {
13
14
  kind: 'spreadsheet';
14
15
  }>;
16
+ declare const NOMINAL_CELL_TEXT_SIZE_PT = 10;
15
17
  declare function convertSpreadsheetToLayout(doc: SpreadsheetContentDocument, options: SheetsLayoutOptions): SpreadsheetLayoutResult;
16
18
  //#endregion
17
- export { SheetsLayoutOptions, SpreadsheetLayoutResult, convertSpreadsheetToLayout };
19
+ export { NOMINAL_CELL_TEXT_SIZE_PT, SheetsLayoutOptions, SpreadsheetLayoutResult, convertSpreadsheetToLayout };
@@ -1,9 +1,9 @@
1
1
  import { flipY } from "../model/geometry.js";
2
2
  import { layoutFormula } from "../mathml/layout.js";
3
3
  import { wrapRunsToWidth } from "./text-layout.js";
4
- import { alignmentOffsetPt, formulaSizePtForFrame, justifyLineGapsPt, lineNaturalHeightPt, pushCellBorderLines, registerImage, sumColumnWidthsPt, toStyledRuns } from "./shared.js";
4
+ import { alignmentOffsetPt, formulaSizePtForFrame, justifyLineGapsPt, layoutDocumentOf, lineNaturalHeightPt, packagePagesOf, pushCellBorderLines, registerImage, stampFragmentFrame, stampFrame, sumColumnWidthsPt, toStyledRuns } from "./shared.js";
5
5
  import { throwIfAborted } from "../ports/abort.js";
6
- import { COLOR_BLACK, DEFAULT_LAYOUT_FONT, LAYOUT_FORMAT_VERSION, columnIndexToLetters, rgbHexToColor } from "document-schema.js";
6
+ import { COLOR_BLACK, DEFAULT_LAYOUT_FONT, columnIndexToLetters, rgbHexToColor } from "document-schema.js";
7
7
  //#region src/layout/sheets.ts
8
8
  function anchoredFormulas(sheet) {
9
9
  const resolved = [];
@@ -137,14 +137,14 @@ function cellStyledRuns(cell) {
137
137
  if (cell.runs !== void 0 && cell.runs.length > 0) {
138
138
  const runsWithNominalSize = cell.runs.map((run) => run.sizePt === void 0 ? {
139
139
  ...run,
140
- sizePt: NOMINAL_CELL_TEXT_SIZE_PT
140
+ sizePt: 10
141
141
  } : run);
142
142
  return toStyledRuns(runsWithNominalSize);
143
143
  }
144
144
  return [{
145
145
  text: cell.displayText,
146
146
  font: DEFAULT_LAYOUT_FONT,
147
- sizePt: NOMINAL_CELL_TEXT_SIZE_PT,
147
+ sizePt: 10,
148
148
  color: COLOR_BLACK
149
149
  }];
150
150
  }
@@ -236,7 +236,7 @@ function verticalLineTopYDownPt(verticalAlignment, cellTopYDownPt, cellHeightPt,
236
236
  if (verticalAlignment === "middle") return cellTopYDownPt + Math.max(CELL_TEXT_PADDING_PT, (cellHeightPt - lineHeightPt) / 2);
237
237
  return cellTopYDownPt + Math.max(CELL_TEXT_PADDING_PT, cellHeightPt - CELL_TEXT_PADDING_PT - lineHeightPt);
238
238
  }
239
- function renderCellText(cell, frameYDown, rowCells, columnAxis, pageHeightPt, measurer, out) {
239
+ function renderCellText(cell, frameYDown, pageIndex, rowCells, columnAxis, pageHeightPt, measurer, out) {
240
240
  const { xPt: xLeftPt, yPt: yTopDownPt, widthPt: ownWidthPt, heightPt } = frameYDown;
241
241
  const alignment = cell.alignment ?? defaultAlignmentForValue(cell.value.kind);
242
242
  const numericLike = isNumericLikeValue(cell.value.kind);
@@ -288,6 +288,7 @@ function renderCellText(cell, frameYDown, rowCells, columnAxis, pageHeightPt, me
288
288
  sourcePath: fragment.sourcePath
289
289
  };
290
290
  out.push(textItem);
291
+ stampFragmentFrame(cell.runs ?? [], fragment, pageIndex, textItem, measurer, naturalLine);
291
292
  });
292
293
  }
293
294
  function renderHeaderLabels(gutter, columnAxis, rowAxis, gridLeftXPt, gridTopYDownPt, pageHeightPt, measurer, out) {
@@ -381,7 +382,7 @@ function renderAnchoredFormulas(formulas, columnAxis, rowAxis, gridLeftXPt, grid
381
382
  });
382
383
  }
383
384
  }
384
- function renderAnchoredImages(sheetImages, columnAxis, rowAxis, gridLeftXPt, gridTopYDownPt, pageHeightPt, hiddenColumnIndices, hiddenRowIndices, out, images) {
385
+ function renderAnchoredImages(sheetImages, columnAxis, rowAxis, gridLeftXPt, gridTopYDownPt, pageHeightPt, pageIndex, hiddenColumnIndices, hiddenRowIndices, out, images) {
385
386
  for (const image of sheetImages) {
386
387
  const columnPosition = columnAxis.positionByIndex.get(image.anchorColumn);
387
388
  const rowPosition = rowAxis.positionByIndex.get(image.anchorRow);
@@ -404,6 +405,12 @@ function renderAnchoredImages(sheetImages, columnAxis, rowAxis, gridLeftXPt, gri
404
405
  sourcePath: image.sourcePath
405
406
  };
406
407
  out.push(imageItem);
408
+ stampFrame(image, pageIndex, {
409
+ xPt: imageItem.xPt,
410
+ yPt: imageItem.yPt,
411
+ widthPt: imageItem.widthPt,
412
+ heightPt: imageItem.heightPt
413
+ });
407
414
  }
408
415
  }
409
416
  function bandableIndices(start, end, repeat) {
@@ -498,9 +505,10 @@ function convertSheetToPages(sheet, measurer, signal, out, formulasOut, images,
498
505
  if (!columnAxis.positionByIndex.has(columnIndex) || hiddenColumnIndices.has(columnIndex) || hiddenRowIndices.has(cell.row)) continue;
499
506
  const cellFrame = resolveCellFrame(cell, columnAxis, rowAxis, gridLeftXPt, gridTopYDownPt);
500
507
  if (cellFrame === void 0) continue;
508
+ stampFrame(cell, out.length, flipY(cellFrame, pageSize.heightPt));
501
509
  renderCellBackground(cell, cellFrame, pageSize.heightPt, backgroundItems);
502
510
  if (cell.borders !== void 0) pushCellBorderLines(cell.borders, cellFrame, pageSize.heightPt, cell.sourcePath, borderItems);
503
- renderCellText(cell, cellFrame, rowCells, columnAxis, pageSize.heightPt, measurer, textItems);
511
+ renderCellText(cell, cellFrame, out.length, rowCells, columnAxis, pageSize.heightPt, measurer, textItems);
504
512
  }
505
513
  }
506
514
  const items = [...backgroundItems];
@@ -509,7 +517,7 @@ function convertSheetToPages(sheet, measurer, signal, out, formulasOut, images,
509
517
  if (printSettings.headers) renderHeaderLabels(gutter, columnAxis, rowAxis, gridLeftXPt, gridTopYDownPt, pageSize.heightPt, measurer, items);
510
518
  items.push(...textItems);
511
519
  renderAnchoredFormulas(formulas, columnAxis, rowAxis, gridLeftXPt, gridTopYDownPt, pageSize.heightPt, out.length, hiddenColumnIndices, hiddenRowIndices, formulasOut, mathMetricsAt);
512
- renderAnchoredImages(sheet.images, columnAxis, rowAxis, gridLeftXPt, gridTopYDownPt, pageSize.heightPt, hiddenColumnIndices, hiddenRowIndices, items, images);
520
+ renderAnchoredImages(sheet.images, columnAxis, rowAxis, gridLeftXPt, gridTopYDownPt, pageSize.heightPt, out.length, hiddenColumnIndices, hiddenRowIndices, items, images);
513
521
  out.push({
514
522
  widthPt: pageSize.widthPt,
515
523
  heightPt: pageSize.heightPt,
@@ -523,14 +531,10 @@ function convertSpreadsheetToLayout(doc, options) {
523
531
  const images = {};
524
532
  for (const sheet of doc.sheets) convertSheetToPages(sheet, options.measurer, options.signal, pages, formulas, images, options.mathMetricsAt);
525
533
  return {
526
- document: {
527
- formatVersion: LAYOUT_FORMAT_VERSION,
528
- metadata: doc.metadata,
529
- pages,
530
- images
531
- },
532
- formulas
534
+ document: layoutDocumentOf(doc.metadata, pages, images),
535
+ formulas,
536
+ pages: packagePagesOf(pages)
533
537
  };
534
538
  }
535
539
  //#endregion
536
- export { convertSpreadsheetToLayout };
540
+ export { NOMINAL_CELL_TEXT_SIZE_PT, convertSpreadsheetToLayout };
@@ -21,7 +21,7 @@ function shapePlacement(flippedFrame, rotationDeg) {
21
21
  layoutRotationDeg: ccwDeg
22
22
  };
23
23
  }
24
- function layoutParagraph(paragraph, contentLeftXDown, contentWidthPt, startYDown, slideHeightPt, placement, fontScale, spacingScale, measurer, out) {
24
+ function layoutParagraph(paragraph, contentLeftXDown, contentWidthPt, startYDown, slideHeightPt, pageIndex, placement, fontScale, spacingScale, measurer, out) {
25
25
  let cursorYDown = startYDown + (paragraph.spacingBeforePt ?? 0);
26
26
  const effectiveRuns = require_layout_shared.effectiveStyledRuns(paragraph.runs, fontScale);
27
27
  const fallbackRun = effectiveRuns[0];
@@ -53,6 +53,7 @@ function layoutParagraph(paragraph, contentLeftXDown, contentWidthPt, startYDown
53
53
  sourcePath: fragment.sourcePath
54
54
  };
55
55
  out.push(textItem);
56
+ require_layout_shared.stampFragmentFrame(paragraph.runs, fragment, pageIndex, textItem, measurer, line);
56
57
  if (fragment.hyperlink !== void 0) {
57
58
  const fragmentWidthPt = measurer.widthOfTextAtSize(fragment.text, fragment.font, fragment.sizePt);
58
59
  const linkBottomLeft = placement.place({
@@ -76,7 +77,7 @@ function layoutParagraph(paragraph, contentLeftXDown, contentWidthPt, startYDown
76
77
  cursorYDown += paragraph.spacingAfterPt ?? 0;
77
78
  return cursorYDown;
78
79
  }
79
- function layoutTable(table, contentLeftXDown, contentWidthPt, startYDown, slideHeightPt, placement, measurer, out) {
80
+ function layoutTable(table, contentLeftXDown, contentWidthPt, startYDown, slideHeightPt, pageIndex, placement, measurer, out) {
80
81
  let cursorYDown = startYDown;
81
82
  const gridWidthPt = table.columnWidthsPt.reduce((sum, w) => sum + w, 0);
82
83
  const scale = gridWidthPt > 0 ? contentWidthPt / gridWidthPt : 1;
@@ -87,25 +88,24 @@ function layoutTable(table, contentLeftXDown, contentWidthPt, startYDown, slideH
87
88
  for (const cell of row.cells) {
88
89
  const span = cell.colSpan ?? 1;
89
90
  const cellWidthPt = require_layout_shared.sumColumnWidthsPt(table.columnWidthsPt, colIndex, span) * scale;
90
- if (cell.background !== void 0 && placement.layoutRotationDeg === void 0) {
91
- const cellFrame = require_model_geometry.flipY({
92
- xPt: cellXDown,
93
- yPt: cursorYDown,
94
- widthPt: cellWidthPt,
95
- heightPt: rowHeightPt
96
- }, slideHeightPt);
97
- out.push({
98
- kind: "rect",
99
- xPt: cellFrame.xPt,
100
- yPt: cellFrame.yPt,
101
- widthPt: cellFrame.widthPt,
102
- heightPt: cellFrame.heightPt,
103
- fill: cell.background,
104
- sourcePath: table.sourcePath
105
- });
106
- }
91
+ const cellFrame = require_model_geometry.flipY({
92
+ xPt: cellXDown,
93
+ yPt: cursorYDown,
94
+ widthPt: cellWidthPt,
95
+ heightPt: rowHeightPt
96
+ }, slideHeightPt);
97
+ if (placement.layoutRotationDeg === void 0) require_layout_shared.stampFrame(cell, pageIndex, cellFrame);
98
+ if (cell.background !== void 0 && placement.layoutRotationDeg === void 0) out.push({
99
+ kind: "rect",
100
+ xPt: cellFrame.xPt,
101
+ yPt: cellFrame.yPt,
102
+ widthPt: cellFrame.widthPt,
103
+ heightPt: cellFrame.heightPt,
104
+ fill: cell.background,
105
+ sourcePath: table.sourcePath
106
+ });
107
107
  let cellCursorYDown = cursorYDown;
108
- for (const block of cell.blocks) if (block.kind === "paragraph") cellCursorYDown = layoutParagraph(block, cellXDown, cellWidthPt, cellCursorYDown, slideHeightPt, placement, 1, 1, measurer, out);
108
+ for (const block of cell.blocks) if (block.kind === "paragraph") cellCursorYDown = layoutParagraph(block, cellXDown, cellWidthPt, cellCursorYDown, slideHeightPt, pageIndex, placement, 1, 1, measurer, out);
109
109
  cellXDown += cellWidthPt;
110
110
  colIndex += span;
111
111
  }
@@ -129,16 +129,18 @@ function layoutShapeFormula(block, flippedFrame, formulaContext) {
129
129
  yPt: flippedFrame.yPt,
130
130
  box
131
131
  });
132
+ require_layout_shared.stampFrame(block, formulaContext.pageIndex, flippedFrame);
132
133
  }
133
- function convertShape(shape, slideHeightPt, measurer, images, out, formulaContext) {
134
+ function convertShape(shape, slideHeightPt, pageIndex, measurer, images, out, formulaContext) {
134
135
  const flippedFrame = require_model_geometry.flipY(shape.frame, slideHeightPt);
136
+ require_layout_shared.stampFrame(shape, pageIndex, flippedFrame);
135
137
  const placement = shapePlacement(flippedFrame, shape.rotationDeg);
136
138
  const contentLeftXDown = shape.frame.xPt + shape.insetLeftPt;
137
139
  const contentWidthPt = Math.max(0, shape.frame.widthPt - shape.insetLeftPt - shape.insetRightPt);
138
140
  const fontScale = shape.fontScale ?? 1;
139
141
  const spacingScale = 1 - (shape.lineSpacingReduction ?? 0);
140
142
  let cursorYDown = shape.frame.yPt + shape.insetTopPt;
141
- for (const block of shape.blocks) if (block.kind === "paragraph") cursorYDown = layoutParagraph(block, contentLeftXDown, contentWidthPt, cursorYDown, slideHeightPt, placement, fontScale, spacingScale, measurer, out);
143
+ for (const block of shape.blocks) if (block.kind === "paragraph") cursorYDown = layoutParagraph(block, contentLeftXDown, contentWidthPt, cursorYDown, slideHeightPt, pageIndex, placement, fontScale, spacingScale, measurer, out);
142
144
  else if (block.kind === "image") {
143
145
  const imageId = require_layout_shared.registerImage(block, images);
144
146
  const placed = placement.place({
@@ -156,7 +158,13 @@ function convertShape(shape, slideHeightPt, measurer, images, out, formulaContex
156
158
  sourcePath: block.sourcePath
157
159
  };
158
160
  out.push(imageItem);
159
- } else if (block.kind === "table") cursorYDown = layoutTable(block, contentLeftXDown, contentWidthPt, cursorYDown, slideHeightPt, placement, measurer, out);
161
+ require_layout_shared.stampFrame(block, pageIndex, {
162
+ xPt: placed.x,
163
+ yPt: placed.y,
164
+ widthPt: imageItem.widthPt,
165
+ heightPt: imageItem.heightPt
166
+ });
167
+ } else if (block.kind === "table") cursorYDown = layoutTable(block, contentLeftXDown, contentWidthPt, cursorYDown, slideHeightPt, pageIndex, placement, measurer, out);
160
168
  else if (block.kind === "embeddedObject" && block.objectKind === "formula" && formulaContext !== void 0) layoutShapeFormula(block, flippedFrame, formulaContext);
161
169
  }
162
170
  function convertSlide(slide, slideIndex, measurer, images, positioned, mathMetricsAt) {
@@ -166,7 +174,7 @@ function convertSlide(slide, slideIndex, measurer, images, positioned, mathMetri
166
174
  positioned,
167
175
  mathMetricsAt
168
176
  };
169
- for (const shape of slide.shapes) convertShape(shape, slide.size.heightPt, measurer, images, items, formulaContext);
177
+ for (const shape of slide.shapes) convertShape(shape, slide.size.heightPt, slideIndex, measurer, images, items, formulaContext);
170
178
  return {
171
179
  widthPt: slide.size.widthPt,
172
180
  heightPt: slide.size.heightPt,
@@ -179,13 +187,9 @@ function convertPresentationToLayout(doc, options) {
179
187
  const formulas = [];
180
188
  const pages = doc.slides.map((slide, slideIndex) => convertSlide(slide, slideIndex, options.measurer, images, formulas, options.mathMetricsAt));
181
189
  return {
182
- document: {
183
- formatVersion: document_schema_js.LAYOUT_FORMAT_VERSION,
184
- metadata: doc.metadata,
185
- pages,
186
- images
187
- },
188
- formulas
190
+ document: require_layout_shared.layoutDocumentOf(doc.metadata, pages, images),
191
+ formulas,
192
+ pages: require_layout_shared.packagePagesOf(pages)
189
193
  };
190
194
  }
191
195
  //#endregion
@@ -1,4 +1,4 @@
1
- import { ContentDocument, ContentShape, LayoutDocument, LayoutImageAsset, LayoutItem, MathFontMetrics, PositionedFormula, TextMeasurer } from "document-schema.js";
1
+ import { ContentDocument, ContentShape, LayoutDocument, LayoutImageAsset, LayoutItem, MathFontMetrics, PageSize, PositionedFormula, TextMeasurer } from "document-schema.js";
2
2
  //#region src/layout/slides.d.ts
3
3
  interface SlidesLayoutOptions {
4
4
  readonly measurer: TextMeasurer;
@@ -7,6 +7,7 @@ interface SlidesLayoutOptions {
7
7
  interface PresentationLayoutResult {
8
8
  readonly document: LayoutDocument;
9
9
  readonly formulas: readonly PositionedFormula[];
10
+ readonly pages: readonly PageSize[];
10
11
  }
11
12
  type PresentationContentDocument = Extract<ContentDocument, {
12
13
  kind: 'presentation';
@@ -16,7 +17,7 @@ interface ShapeFormulaContext {
16
17
  readonly positioned: PositionedFormula[];
17
18
  readonly mathMetricsAt: (sizePt: number) => MathFontMetrics;
18
19
  }
19
- declare function convertShape(shape: ContentShape, slideHeightPt: number, measurer: TextMeasurer, images: Record<string, LayoutImageAsset>, out: LayoutItem[], formulaContext?: ShapeFormulaContext): void;
20
+ declare function convertShape(shape: ContentShape, slideHeightPt: number, pageIndex: number, measurer: TextMeasurer, images: Record<string, LayoutImageAsset>, out: LayoutItem[], formulaContext?: ShapeFormulaContext): void;
20
21
  declare function convertPresentationToLayout(doc: PresentationContentDocument, options: SlidesLayoutOptions): PresentationLayoutResult;
21
22
  //#endregion
22
23
  export { PresentationLayoutResult, ShapeFormulaContext, SlidesLayoutOptions, convertPresentationToLayout, convertShape };
@@ -1,4 +1,4 @@
1
- import { ContentDocument, ContentShape, LayoutDocument, LayoutImageAsset, LayoutItem, MathFontMetrics, PositionedFormula, TextMeasurer } from "document-schema.js";
1
+ import { ContentDocument, ContentShape, LayoutDocument, LayoutImageAsset, LayoutItem, MathFontMetrics, PageSize, PositionedFormula, TextMeasurer } from "document-schema.js";
2
2
  //#region src/layout/slides.d.ts
3
3
  interface SlidesLayoutOptions {
4
4
  readonly measurer: TextMeasurer;
@@ -7,6 +7,7 @@ interface SlidesLayoutOptions {
7
7
  interface PresentationLayoutResult {
8
8
  readonly document: LayoutDocument;
9
9
  readonly formulas: readonly PositionedFormula[];
10
+ readonly pages: readonly PageSize[];
10
11
  }
11
12
  type PresentationContentDocument = Extract<ContentDocument, {
12
13
  kind: 'presentation';
@@ -16,7 +17,7 @@ interface ShapeFormulaContext {
16
17
  readonly positioned: PositionedFormula[];
17
18
  readonly mathMetricsAt: (sizePt: number) => MathFontMetrics;
18
19
  }
19
- declare function convertShape(shape: ContentShape, slideHeightPt: number, measurer: TextMeasurer, images: Record<string, LayoutImageAsset>, out: LayoutItem[], formulaContext?: ShapeFormulaContext): void;
20
+ declare function convertShape(shape: ContentShape, slideHeightPt: number, pageIndex: number, measurer: TextMeasurer, images: Record<string, LayoutImageAsset>, out: LayoutItem[], formulaContext?: ShapeFormulaContext): void;
20
21
  declare function convertPresentationToLayout(doc: PresentationContentDocument, options: SlidesLayoutOptions): PresentationLayoutResult;
21
22
  //#endregion
22
23
  export { PresentationLayoutResult, ShapeFormulaContext, SlidesLayoutOptions, convertPresentationToLayout, convertShape };