pptx-ts 0.0.1 → 4.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 (136) hide show
  1. package/README.md +116 -269
  2. package/dist/autopage-odPz7zZO.js +536 -0
  3. package/dist/autopage-odPz7zZO.js.map +1 -0
  4. package/dist/binary-string-CKVAYI3M.js +24 -0
  5. package/dist/binary-string-CKVAYI3M.js.map +1 -0
  6. package/dist/body-insets-Dw_BeWD_.js +54 -0
  7. package/dist/body-insets-Dw_BeWD_.js.map +1 -0
  8. package/dist/browser.d.ts +29 -9
  9. package/dist/browser.d.ts.map +1 -1
  10. package/dist/browser.js +41 -14
  11. package/dist/browser.js.map +1 -1
  12. package/dist/clip-Bl01BPcN.d.ts +67 -0
  13. package/dist/clip-Bl01BPcN.d.ts.map +1 -0
  14. package/dist/diagnostics-D8ot4Ei7.d.ts +244 -0
  15. package/dist/diagnostics-D8ot4Ei7.d.ts.map +1 -0
  16. package/dist/embedded-fonts-DarT9aoa.d.ts +20 -0
  17. package/dist/embedded-fonts-DarT9aoa.d.ts.map +1 -0
  18. package/dist/entry-compose-DCnvBZz2.d.ts +1046 -0
  19. package/dist/entry-compose-DCnvBZz2.d.ts.map +1 -0
  20. package/dist/{enums-CvRYniUA.d.ts → enums-BUKTUB6V.d.ts} +21 -13
  21. package/dist/{enums-CvRYniUA.d.ts.map → enums-BUKTUB6V.d.ts.map} +1 -1
  22. package/dist/{errors-Bvln0H-7.js → errors-C4oENPcu.js} +92 -2
  23. package/dist/errors-C4oENPcu.js.map +1 -0
  24. package/dist/families.d.ts +260 -0
  25. package/dist/families.d.ts.map +1 -0
  26. package/dist/families.js +57 -0
  27. package/dist/families.js.map +1 -0
  28. package/dist/{fit-BKs0zxMI.js → fit-Cb7naFj6.js} +249 -167
  29. package/dist/fit-Cb7naFj6.js.map +1 -0
  30. package/dist/font-metrics-v5fn7s7e.d.ts +613 -0
  31. package/dist/font-metrics-v5fn7s7e.d.ts.map +1 -0
  32. package/dist/grid-DikTjFey.js +187 -0
  33. package/dist/grid-DikTjFey.js.map +1 -0
  34. package/dist/{html-dom-B0I0QSbU.js → html-dom-Iuog2wdK.js} +121 -91
  35. package/dist/html-dom-Iuog2wdK.js.map +1 -0
  36. package/dist/html.d.ts +6 -6
  37. package/dist/html.d.ts.map +1 -1
  38. package/dist/html.js +7 -6
  39. package/dist/html.js.map +1 -1
  40. package/dist/image-size-CvN2iCA4.js +1611 -0
  41. package/dist/image-size-CvN2iCA4.js.map +1 -0
  42. package/dist/index.d.ts +24 -10
  43. package/dist/index.d.ts.map +1 -1
  44. package/dist/index.js +31 -11
  45. package/dist/index.js.map +1 -1
  46. package/dist/inspect.d.ts +40 -31
  47. package/dist/inspect.d.ts.map +1 -1
  48. package/dist/inspect.js +40 -48
  49. package/dist/inspect.js.map +1 -1
  50. package/dist/math.d.ts +7 -5
  51. package/dist/math.d.ts.map +1 -1
  52. package/dist/math.js +16 -7
  53. package/dist/math.js.map +1 -1
  54. package/dist/measure.d.ts +12 -225
  55. package/dist/measure.d.ts.map +1 -1
  56. package/dist/measure.js +3 -3
  57. package/dist/node.d.ts +22 -8
  58. package/dist/node.d.ts.map +1 -1
  59. package/dist/node.js +27 -7
  60. package/dist/node.js.map +1 -1
  61. package/dist/notes-Dh12JAbn.js +3264 -0
  62. package/dist/notes-Dh12JAbn.js.map +1 -0
  63. package/dist/options-internal-WqgMf720.js +43 -0
  64. package/dist/options-internal-WqgMf720.js.map +1 -0
  65. package/dist/{package-CaOLXSNi.d.ts → package-J49Ck6S2.d.ts} +27 -12
  66. package/dist/package-J49Ck6S2.d.ts.map +1 -0
  67. package/dist/playbtn-CUqQdoDf.js +22 -0
  68. package/dist/playbtn-CUqQdoDf.js.map +1 -0
  69. package/dist/{slide-js0QpRV-.d.ts → pres-C6qgOFAa.d.ts} +1021 -1370
  70. package/dist/pres-C6qgOFAa.d.ts.map +1 -0
  71. package/dist/{presentation-Cp7vzlAw.js → presentation-DGYlAWhl.js} +3208 -2727
  72. package/dist/presentation-DGYlAWhl.js.map +1 -0
  73. package/dist/{presentation-types-DP_8jog7.d.ts → presentation-types-8jLQHI4M.d.ts} +1070 -683
  74. package/dist/presentation-types-8jLQHI4M.d.ts.map +1 -0
  75. package/dist/read.d.ts +9 -9
  76. package/dist/read.d.ts.map +1 -1
  77. package/dist/read.js +4 -4
  78. package/dist/script.d.ts +80 -66
  79. package/dist/script.d.ts.map +1 -1
  80. package/dist/script.js +2399 -1139
  81. package/dist/script.js.map +1 -1
  82. package/dist/{shapes-BemroU-z.js → shapes-re0KyQk_.js} +2807 -1609
  83. package/dist/shapes-re0KyQk_.js.map +1 -0
  84. package/dist/slide-Dx2ZeVZ6.d.ts +1256 -0
  85. package/dist/slide-Dx2ZeVZ6.d.ts.map +1 -0
  86. package/dist/slide-size-BalTjFuv.js +88 -0
  87. package/dist/slide-size-BalTjFuv.js.map +1 -0
  88. package/dist/{units-internal-Dg95w_YD.js → table-cell-margins-EVg0EwxT.js} +235 -273
  89. package/dist/table-cell-margins-EVg0EwxT.js.map +1 -0
  90. package/dist/table-dom-BTDP3lEP.js +21 -0
  91. package/dist/table-dom-BTDP3lEP.js.map +1 -0
  92. package/dist/text-KnLOtEEu.js +3980 -0
  93. package/dist/text-KnLOtEEu.js.map +1 -0
  94. package/dist/text-anchor-CrYXAfUu.js +176 -0
  95. package/dist/text-anchor-CrYXAfUu.js.map +1 -0
  96. package/dist/transition-speed-kUEWDWTx.js +14 -0
  97. package/dist/transition-speed-kUEWDWTx.js.map +1 -0
  98. package/dist/units-internal-XJlf-hOl.js +649 -0
  99. package/dist/units-internal-XJlf-hOl.js.map +1 -0
  100. package/dist/zip-C0leZZMj.d.ts +67 -0
  101. package/dist/zip-C0leZZMj.d.ts.map +1 -0
  102. package/dist/zip-CKd8ihcf.js +177 -0
  103. package/dist/zip-CKd8ihcf.js.map +1 -0
  104. package/dist/zip.d.ts +3 -68
  105. package/dist/zip.js +3 -163
  106. package/dist/zoom-cX9sllpH.js +8865 -0
  107. package/dist/zoom-cX9sllpH.js.map +1 -0
  108. package/package.json +106 -19
  109. package/skills/ts-pptx-upstream/SKILL.md +58 -57
  110. package/dist/autopage-DkjYZUFD.js +0 -423
  111. package/dist/autopage-DkjYZUFD.js.map +0 -1
  112. package/dist/diagnostics-Du_s75MT.d.ts +0 -829
  113. package/dist/diagnostics-Du_s75MT.d.ts.map +0 -1
  114. package/dist/errors-Bvln0H-7.js.map +0 -1
  115. package/dist/errors-PflMPWBn.d.ts +0 -182
  116. package/dist/errors-PflMPWBn.d.ts.map +0 -1
  117. package/dist/fit-BKs0zxMI.js.map +0 -1
  118. package/dist/html-dom-B0I0QSbU.js.map +0 -1
  119. package/dist/namespaces-BVnNu7sg.js +0 -666
  120. package/dist/namespaces-BVnNu7sg.js.map +0 -1
  121. package/dist/notes-RLCwdlTE.js +0 -1703
  122. package/dist/notes-RLCwdlTE.js.map +0 -1
  123. package/dist/package-CaOLXSNi.d.ts.map +0 -1
  124. package/dist/pres-C5__xkDh.d.ts +0 -202
  125. package/dist/pres-C5__xkDh.d.ts.map +0 -1
  126. package/dist/presentation-Cp7vzlAw.js.map +0 -1
  127. package/dist/presentation-types-DP_8jog7.d.ts.map +0 -1
  128. package/dist/shapes-BemroU-z.js.map +0 -1
  129. package/dist/slide-js0QpRV-.d.ts.map +0 -1
  130. package/dist/text-CyetbF6p.js +0 -11278
  131. package/dist/text-CyetbF6p.js.map +0 -1
  132. package/dist/units-1kRzYShk.js +0 -231
  133. package/dist/units-1kRzYShk.js.map +0 -1
  134. package/dist/units-internal-Dg95w_YD.js.map +0 -1
  135. package/dist/zip.d.ts.map +0 -1
  136. package/dist/zip.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"autopage-odPz7zZO.js","names":[],"sources":["../src/gen/table/autopage.ts"],"sourcesContent":["/**\n * ts-pptx: Table auto-paging core\n *\n * The DOM-independent heart of table generation: given rows that overflow a slide,\n * split them across as many slides as needed, measuring wrapped text to compute line\n * counts and row heights. `getSlidesForTableRows` is the in-memory core (fully\n * Node-testable); `parseTextToLines` is its private cell-wrapping helper.\n */\n\nimport { SlideObjectType } from '../../enums.js'\nimport { DEF_FONT_SIZE, DEF_SLIDE_MARGIN_IN } from '../../constants-internal.js'\nimport type { PresLayout, TableRowSlide, TableCellProps } from '../../types/index.js'\nimport type {\n\tSlideLayoutInternal,\n\tTableCellInternal,\n\tTableRowInternal,\n\tTableToSlidesPropsInternal,\n} from '../../types/internal.js'\nimport {\n\tautoPageLineHeightEmu,\n\tgetSmartParseNumber,\n\tinch2Emu,\n\tmarginToEmu,\n\tpinnedRowHeightInches,\n\tresolveCellMarginsInches,\n\tresolveSlideMarginsInches,\n\tresolveTableColWidthsEmu,\n\tusableTableWidthEmu,\n} from '../../units-internal.js'\nimport { warn } from '../../diagnostics.js'\nimport { type GridPlacement, tableColCount, walkTableGrid } from './grid.js'\nimport { resolveSpan, withCheckedSpans } from './spans.js'\nimport { EMU_PER_INCH, POINTS_PER_INCH } from '../../units.js'\n\ntype AutoPageCell = TableCellInternal & {\n\t_lineHeight: number\n\t_lines: TableCellInternal[][]\n\toptions: TableCellProps\n\ttext: TableCellInternal[]\n}\n\n/**\n * A cell for the pager's working grid, carrying the source cell's options only when it has some.\n *\n * Every one of these used to be an inline `{ …, options: cell.options }`, which put an `options`\n * key holding `undefined` on a cell whose source had none. Readers cannot see the difference —\n * they all go through `cell.options?.…` — but a `TableCellProps` bag *is* spread in\n * `gen/define/table.ts` (`{ ...colDef, ...headerRow, ...cell.options }`), where the two states\n * are not the same thing. So the model keeps one spelling of absent.\n * @param text - the cell's content, a string or the run list the pager is accumulating\n * @param options - the source cell's options, if it had any\n */\nfunction workingCell(text: string | TableCellInternal[], options: TableCellProps | undefined): TableCellInternal {\n\treturn options === undefined\n\t\t? { _type: SlideObjectType.tablecell, text }\n\t\t: { _type: SlideObjectType.tablecell, text, options }\n}\n\n// ===== Cell text wrapping =====\n\n/**\n * Break cell text into lines based upon table column width (e.g.: Magic Happens Here(tm))\n *\n * `charWeight` arrives as an argument rather than being read off `cell.options` because the\n * caller used to *stamp* it there: the table's weight was written onto the caller's own cell\n * options bag, or `delete`d from it when the table stated none. That mutated caller input --\n * which the chart path has a dedicated guard against -- and it made the option's precedence\n * differ by call site: the row-height probe read the cell's own value while the main loop had\n * just overwritten it with the table's. Both callers now resolve it the same way, and the more\n * specific statement wins, as it does everywhere else in this codebase.\n *\n * `fontSizePt` arrives resolved for the same reason. This read `cell.options.fontSize` or the\n * library default and never the table's `fontSize`, while the row's line height and the emitted\n * `sz` both used the table's. A table of 24pt text was wrapped as if it were 12pt, so the pager\n * counted about half the lines and rows ran off the bottom of each page.\n * @param {TableCellInternal} cell - table cell\n * @param {number} colWidth - table column width (inches)\n * @param {number} fontSizePt - resolved font size: the cell's, else the table's, else the default\n * @param {number} charWeight - resolved `autoPageCharWeight`: the cell's, else the table's, else 0\n * @param {boolean} [verbose] - dump the four wrapping stages; carries `addTable({ verbose })`\n * down, which is the only stage of the pager that flag did not reach\n * @return {TableRowInternal[]} - cell's text objects grouped into lines\n */\nfunction parseTextToLines(\n\tcell: TableCellInternal,\n\tcolWidth: number,\n\tfontSizePt: number,\n\tcharWeight: number,\n\tverbose?: boolean\n): TableCellInternal[][] {\n\t// FYI: CPL = Width / (font-size / font-constant)\n\t// FYI: CHAR:2.3, colWidth:10, fontSize:12 => CPL=138, (actual chars per line in PPT)=145 [14.5 CPI]\n\t// FYI: CHAR:2.3, colWidth:7 , fontSize:12 => CPL= 97, (actual chars per line in PPT)=100 [14.3 CPI]\n\t// FYI: CHAR:2.3, colWidth:9 , fontSize:16 => CPL= 96, (actual chars per line in PPT)=84 [ 9.3 CPI]\n\tconst FOCO = 2.3 + charWeight // Character Constant\n\t// `colWidth` is inches, so the column's width in points is `colWidth * 72`. This used to be\n\t// spelled `(colWidth / EMU_PER_POINT) * EMU_PER_INCH`, which is the same 72 with two EMU\n\t// constants that cancel -- except that the detour through EMU is not exact in binary floating\n\t// point, and `Math.floor` takes the hit. Over the 200,000 widths from 0.001in to 200in the two\n\t// forms disagree on 51, always by one point low: 6.625in is exactly 477 points, and the old\n\t// form floored 476.9999... to 476.\n\tconst CPL = Math.floor(colWidth * POINTS_PER_INCH) / (fontSizePt / FOCO) // Chars-Per-Line\n\n\t// The number the four dumps below exist to explain: every wrap decision in step 4 is\n\t// `strCurrLine.length + word.length > CPL`, so a wrap that looks wrong is almost always\n\t// a CPL that is wrong, and CPL is not recoverable from the lines themselves.\n\tif (verbose) console.log(`[0/4] colWidth=${colWidth}in fontSize=${fontSizePt} FOCO=${FOCO} CPL=${CPL}`)\n\n\tconst parsedLines: TableCellInternal[][] = []\n\tlet inputCells: TableCellInternal[] = []\n\tconst inputLines1: TableCellInternal[][] = []\n\tconst inputLines2: TableCellInternal[][] = []\n\n\t/**\n\t * EX INPUTS: `cell.text`\n\t * - string....: \"Account Name Column\"\n\t * - object....: { text:\"Account Name Column\" }\n\t * - object[]..: [{ text:\"Account Name\", options:{ bold:true } }, { text:\" Column\" }]\n\t * - object[]..: [{ text:\"Account Name\", options:{ breakLine:true } }, { text:\"Input\" }]\n\t */\n\n\t/**\n\t * EX OUTPUTS:\n\t * - string....: [{ text:\"Account Name Column\" }]\n\t * - object....: [{ text:\"Account Name Column\" }]\n\t * - object[]..: [{ text:\"Account Name\", options:{ breakLine:true } }, { text:\"Input\" }]\n\t * - object[]..: [{ text:\"Account Name\", options:{ breakLine:true } }, { text:\"Input\" }]\n\t */\n\n\t// STEP 1: Ensure inputCells is an array of TableCells\n\tif (cell.text && cell.text.toString().trim().length === 0) {\n\t\t// Allow a single space/whitespace as cell text (user-requested feature)\n\t\tinputCells.push({ _type: SlideObjectType.tablecell, text: ' ' })\n\t} else if (typeof cell.text === 'number' || typeof cell.text === 'string') {\n\t\tinputCells.push({ _type: SlideObjectType.tablecell, text: (cell.text || '').toString().trim() })\n\t} else if (Array.isArray(cell.text)) {\n\t\tinputCells = cell.text\n\t}\n\tif (verbose) {\n\t\tconsole.log('[1/4] inputCells')\n\t\tinputCells.forEach((cell, idx) => console.log(`[1/4] [${idx + 1}] cell: ${JSON.stringify(cell)}`))\n\t}\n\n\t// STEP 2: Group table cells into lines based on \"\\n\" or `breakLine` prop\n\t/**\n\t * - EX: `[{ text:\"Input Output\" }, { text:\"Extra\" }]` == 1 line\n\t * - EX: `[{ text:\"Input\" }, { text:\"Output\", options:{ breakLine:true } }]` == 1 line\n\t * - EX: `[{ text:\"Input\\nOutput\" }]` == 2 lines\n\t * - EX: `[{ text:\"Input\", options:{ breakLine:true } }, { text:\"Output\" }]` == 2 lines\n\t */\n\tlet newLine: TableCellInternal[] = []\n\tinputCells.forEach((cell) => {\n\t\tif (typeof cell.text !== 'string') return\n\n\t\tif (cell.text.includes('\\n')) {\n\t\t\t// Each non-last \\n-split part ends with a forced paragraph break; the last\n\t\t\t// part accumulates in newLine so subsequent runs stay on the same paragraph.\n\t\t\tconst parts = cell.text.split('\\n')\n\t\t\tparts.forEach((part, partIdx) => {\n\t\t\t\tconst isLastPart = partIdx === parts.length - 1\n\t\t\t\tif (isLastPart) {\n\t\t\t\t\tnewLine.push(workingCell(part, cell.options))\n\t\t\t\t} else {\n\t\t\t\t\tnewLine.push({\n\t\t\t\t\t\t_type: SlideObjectType.tablecell,\n\t\t\t\t\t\ttext: part,\n\t\t\t\t\t\toptions: { ...cell.options, breakLine: true },\n\t\t\t\t\t})\n\t\t\t\t\tinputLines1.push(newLine)\n\t\t\t\t\tnewLine = []\n\t\t\t\t}\n\t\t\t})\n\t\t} else {\n\t\t\tnewLine.push(workingCell(cell.text.trim(), cell.options))\n\t\t}\n\n\t\tif (cell.options?.breakLine) {\n\t\t\tif (verbose) console.log(`inputCells: new line > ${JSON.stringify(newLine)}`)\n\t\t\tinputLines1.push(newLine)\n\t\t\tnewLine = []\n\t\t}\n\t})\n\t// Flush remaining buffer after all cells are processed\n\tif (newLine.length > 0) {\n\t\tinputLines1.push(newLine)\n\t\tnewLine = []\n\t}\n\tif (verbose) {\n\t\tconsole.log(`[2/4] inputLines1 (${inputLines1.length})`)\n\t\tinputLines1.forEach((line, idx) => console.log(`[2/4] [${idx + 1}] line: ${JSON.stringify(line)}`))\n\t}\n\n\t// STEP 3: Tokenize every text object into words. All runs of one logical paragraph\n\t// are flattened into a single token list so step 4 tracks column position across\n\t// styled-run boundaries (fixes independent-reset bug for rich-text cells).\n\tinputLines1.forEach((line) => {\n\t\tconst lineTokens: TableCellInternal[] = []\n\t\tline.forEach((cell) => {\n\t\t\tconst cellTextStr = String(cell.text) // force convert to string (compiled JS is better with this than a cast)\n\t\t\tconst lineWords = cellTextStr.split(' ')\n\n\t\t\tlineWords.forEach((word, idx) => {\n\t\t\t\tconst cellProps = { ...cell.options }\n\t\t\t\t// IMPORTANT: Handle `breakLine` prop - we cannot apply to each word - only apply to very last word!\n\t\t\t\tif (cellProps?.breakLine) cellProps.breakLine = idx + 1 === lineWords.length\n\t\t\t\tlineTokens.push({\n\t\t\t\t\t_type: SlideObjectType.tablecell,\n\t\t\t\t\ttext: word + (idx + 1 < lineWords.length ? ' ' : ''),\n\t\t\t\t\toptions: cellProps,\n\t\t\t\t})\n\t\t\t})\n\t\t})\n\t\tinputLines2.push(lineTokens)\n\t})\n\tif (verbose) {\n\t\tconsole.log(`[3/4] inputLines2 (${inputLines2.length})`)\n\t\tinputLines2.forEach((line) => console.log(`[3/4] line: ${JSON.stringify(line)}`))\n\t}\n\n\t// STEP 4: Group cells/words into lines based upon space consumed by word letters\n\tinputLines2.forEach((line) => {\n\t\tlet lineCells: TableCellInternal[] = []\n\t\tlet strCurrLine = ''\n\n\t\tline.forEach((word) => {\n\t\t\tconst wordText = String(word.text || '')\n\t\t\t// A: create new line when horizontal space is exhausted.\n\t\t\t// `lineCells.length > 0` is the same guard the flush below carries, and for the same\n\t\t\t// reason: on the first word `strCurrLine` is `''`, so a word wider than the column on\n\t\t\t// its own fires this branch with nothing buffered and used to push an EMPTY line. The\n\t\t\t// cell's text survived -- the pager concatenates lines back together -- but its height\n\t\t\t// did not, because `_lines.length` is what prices the row. Twelve single-word rows in a\n\t\t\t// 0.4in column paged onto two slides when the word was long and one when it was short.\n\t\t\t// The word still overflows its column: nothing here breaks inside a word, which is the\n\t\t\t// stated behaviour rather than a gap (`docs/contributing/design/tables.md`). A hard\n\t\t\t// break would have to land at the `CPL` estimate, which is not where the renderer wraps,\n\t\t\t// and would then have to keep `_lines.length` and the emitted text in step -- the exact\n\t\t\t// pairing the phantom-line bug above got wrong.\n\t\t\tif (strCurrLine.length + wordText.length > CPL) {\n\t\t\t\tif (lineCells.length > 0) parsedLines.push(lineCells)\n\t\t\t\tlineCells = []\n\t\t\t\tstrCurrLine = ''\n\t\t\t}\n\n\t\t\t// B: add current word to line cells\n\t\t\tlineCells.push(word)\n\n\t\t\t// C: add current word to `strCurrLine` which we use to keep track of line's char length\n\t\t\tstrCurrLine += wordText\n\t\t})\n\n\t\t// Flush buffer: Only create a line when there's text to avoid empty row\n\t\tif (lineCells.length > 0) parsedLines.push(lineCells)\n\t})\n\tif (verbose) {\n\t\tconsole.log(`[4/4] parsedLines (${parsedLines.length})`)\n\t\tparsedLines.forEach((line, idx) => console.log(`[4/4] [Line ${idx + 1}]:\\n${JSON.stringify(line)}`))\n\t\tconsole.log('...............................................\\n\\n')\n\t}\n\n\t// Done:\n\treturn parsedLines\n}\n\n/**\n * The font size in points one auto-paged cell is measured at: the cell's own `fontSize`,\n * else the table's, else the library default. Pass `null` for the cell to ask the same\n * question of the table alone.\n */\nfunction resolveCellFontSize(\n\tcellOpts: TableCellProps | undefined | null,\n\ttableOpts: TableToSlidesPropsInternal\n): number {\n\tconst size = cellOpts?.fontSize ?? tableOpts.fontSize\n\treturn typeof size === 'number' ? size : DEF_FONT_SIZE\n}\n\n/**\n * The `autoPageCharWeight` a cell wraps at: its own, else the table's, else none.\n *\n * The sibling of {@link resolveCellFontSize}, and named for the same reason -- the two call\n * sites of {@link parseTextToLines} had resolved this one differently. The row-height probe\n * read the cell's own value; the main loop stamped the table's over it first, and `delete`d the\n * cell's when the table stated none, so a weight set on a cell alone was accepted and dropped.\n * The precedence here is the one every other paired option in this codebase uses.\n * @param cellOpts - the cell's own options, if any\n * @param tableOpts - the table's options\n */\nfunction resolveCellCharWeight(\n\tcellOpts: TableCellProps | undefined | null,\n\ttableOpts: TableToSlidesPropsInternal\n): number {\n\tconst weight = cellOpts?.autoPageCharWeight ?? tableOpts.autoPageCharWeight\n\treturn typeof weight === 'number' ? weight : 0\n}\n\n// ===== Auto-page engine =====\n// The in-memory core (fully Node-testable). Internally signposted by the\n// `// STEP 1..7` markers below: margins → column count → widths → the main\n// row-iteration/overflow loop (STEP 6) → final-slide flush (STEP 7).\n\n/**\n * The largest top and bottom cell margin in one row, in EMU.\n *\n * A cell's own `margin` wins over the table's when it states one, and a stated `0` counts as\n * stating one. Both sites that read this gated on truthiness and on `Array.isArray`, so a cell\n * asking for `margin: [0, …]` fell through to the table's margin instead of taking its own, and\n * a scalar `margin: 0.2` was not seen at all -- while the emitter broadcasts a scalar to four\n * sides. `resolveCellMarginsInches` is the resolver the emitter itself reads.\n * @param row - the row's cells\n * @param tableProps - the table's options, for the fallback margin\n * @returns the row's top and bottom margin allowance in EMU\n */\nfunction rowMarginsEmu(\n\trow: TableRowInternal,\n\ttableProps: TableToSlidesPropsInternal\n): { topEmu: number; btmEmu: number } {\n\tlet topEmu = 0\n\tlet btmEmu = 0\n\trow.forEach((cell) => {\n\t\tconst stated = cell?.options?.margin ?? tableProps.margin\n\t\tif (stated === undefined || stated === null) return\n\t\tconst [top, , btm] = resolveCellMarginsInches(stated)\n\t\tif (marginToEmu(top) > topEmu) topEmu = marginToEmu(top)\n\t\tif (marginToEmu(btm) > btmEmu) btmEmu = marginToEmu(btm)\n\t})\n\treturn { topEmu, btmEmu }\n}\n\n/** One row, measured: each cell's wrapped lines and what the row costs a page. */\ninterface MeasuredRow {\n\t/** One working cell per source cell, in row order, carrying its lines and its line height. */\n\tcells: AutoPageCell[]\n\t/** The row's tallest top margin plus its tallest bottom margin, in EMU. */\n\tmarginsEmu: number\n\t/** The tallest line height among the cells that do not span rows, in EMU. */\n\tlineHeightEmu: number\n\t/** The whole row: its margins plus its tallest cell's line count at `lineHeightEmu`. */\n\theightEmu: number\n}\n\n/**\n * Takes an array of table rows and breaks into an array of slides, which contain the calculated amount of table rows that fit on that slide\n * @param {TableCellInternal[][]} tableRows - table rows\n * @param {TableToSlidesPropsInternal} tableProps - table2slides properties\n * @param {PresLayout} presLayout - presentation layout\n * @param {SlideLayoutInternal} masterSlide - master slide\n * @return {TableRowSlide[]} array of table rows\n */\nexport function getSlidesForTableRows(\n\trows: TableCellInternal[][] = [],\n\ttableProps: TableToSlidesPropsInternal = {},\n\tpresLayout: PresLayout,\n\tmasterSlide?: SlideLayoutInternal | null\n): TableRowSlide[] {\n\t// `MAX_TABLE_SPAN` guards the two allocations a span decides, and its own module says it\n\t// covers both paths -- but `tableToSlides` reaches this function directly, without the\n\t// definer that applies the check, and its own `gridSpan` has no ceiling. So a\n\t// `colspan=\"4000000000\"` in a source table reached the column walk and the per-column depth\n\t// array, which is the allocation that takes the host process down with no exception to catch.\n\t// Checking here rather than at the call site keeps the one entry point guarded whoever calls\n\t// it; a grid whose spans are all fine is passed through by identity.\n\tconst tableRows = withCheckedSpans(rows)\n\tlet arrInchMargins = DEF_SLIDE_MARGIN_IN\n\tlet emuSlideTabW: number\n\tlet colWidthsIn: number[] = []\n\tlet emuSlideTabH = EMU_PER_INCH * 1\n\tlet emuTabCurrH = 0\n\tlet numCols = 0\n\tlet warnedNoTabH = false\n\tconst tableRowSlides: TableRowSlide[] = []\n\tconst tablePropX = getSmartParseNumber(tableProps.x, 'X', presLayout)\n\tconst tablePropY = getSmartParseNumber(tableProps.y, 'Y', presLayout)\n\tconst tablePropW = getSmartParseNumber(tableProps.w, 'X', presLayout)\n\tconst tablePropH = getSmartParseNumber(tableProps.h, 'Y', presLayout)\n\tlet tableCalcW: number = tablePropW\n\n\t/**\n\t * Where this page's table starts, in EMU from the top of the slide.\n\t *\n\t * There used to be three rules for two cases. The first page and \"every page after it\"\n\t * were handled together, then a block gated on `tableRowSlides.length > 1` overrode the\n\t * result -- so despite its own comment it began on the THIRD page, and its first arm\n\t * recomputed exactly what had just been computed. Page 2 therefore got a different usable\n\t * height from pages 3 and up: with `y` above the top margin and an explicit `h`, a\n\t * 60-row table paged 9 / 7 / 9 / 9 / 9 / 9 / 8, which is the same \"pages disagree about\n\t * how many identical rows fit\" symptom the margin-reset note in `calcSlideTabH` records.\n\t *\n\t * It is a function rather than two expressions because the too-small-height fallback in\n\t * `calcSlideTabH` had spelled the continuation arm its own way and drifted the same way\n\t * twice over: `autoPageSlideStartY || margin` discarded an explicit `0` that the main rule\n\t * honoured, and the `Math.min` clause below was missing outright. Two readings of one rule\n\t * is what the paragraph above is about; there is now one.\n\t */\n\tfunction startYEmu(): number {\n\t\t// A stated `y: 0` is the top edge of the slide, not a missing `y`: tested for truthiness, it\n\t\t// was budgeted from the top margin while `addTable` placed the page at 0.\n\t\tconst statedY = tableProps.y !== undefined && tableProps.y !== null\n\t\tif (tableRowSlides.length === 0) return statedY ? tablePropY : inch2Emu(arrInchMargins[0])\n\t\tif (typeof tableProps.autoPageSlideStartY === 'number') return inch2Emu(tableProps.autoPageSlideStartY)\n\t\t// RULE: after the first page the table starts at the top margin rather than at its\n\t\t// own `y` -- unless `y` is ABOVE the margin, in which case paging must not push the\n\t\t// table down and lose the space. Whichever is higher on the slide wins.\n\t\treturn inch2Emu(statedY ? Math.min(tablePropY / EMU_PER_INCH, arrInchMargins[0]) : arrInchMargins[0])\n\t}\n\n\tfunction calcSlideTabH(): void {\n\t\tconst emuStartY = startYEmu()\n\t\temuSlideTabH = (tablePropH || presLayout.height) - emuStartY - inch2Emu(arrInchMargins[2])\n\t\t// EXPLICIT-H FIX: an explicit `h` is the table's height (an extent), not a bottom\n\t\t// coordinate, so -- unlike `presLayout.height` -- the start-Y must not be subtracted from\n\t\t// it. Otherwise a table that begins mid-slide gets a tiny page while the pages that do\n\t\t// clamp to `h` render normally. Applied on every page: the floor used to reach the first\n\t\t// page and pages three and up, leaving page two as the one that could shrink below `h`.\n\t\tif (tablePropH && emuSlideTabH < tablePropH) emuSlideTabH = tablePropH\n\n\t\t// GUARD: a non-positive height, or one too small to fit even a single line of the base font,\n\t\t// means no row ever fits. That previously emitted degenerate empty overflow pages (rows:[]),\n\t\t// which made the recursive addTable throw \"Array expected\", or — with `h` smaller than one\n\t\t// line — placed one row per slide forever. Ignore the unusable height, fall back to the full\n\t\t// slide area between margins, and warn once rather than emit a broken table.\n\t\tconst emuBaseLineH = autoPageLineHeightEmu(\n\t\t\tresolveCellFontSize(null, tableProps),\n\t\t\ttableProps.autoPageLineWeight || 0\n\t\t)\n\t\tif (emuSlideTabH < emuBaseLineH) {\n\t\t\tconst fallbackH = presLayout.height - startYEmu() - inch2Emu(arrInchMargins[2])\n\t\t\tif (!warnedNoTabH) {\n\t\t\t\twarn(\n\t\t\t\t\t'table/autopage-height-too-small',\n\t\t\t\t\t'addTable/autoPage: the table height (`h`) leaves no room to paginate; ignoring it and using the slide height. Increase `h` or decrease `y`.'\n\t\t\t\t)\n\t\t\t\twarnedNoTabH = true\n\t\t\t}\n\t\t\temuSlideTabH = fallbackH > 0 ? fallbackH : presLayout.height\n\t\t}\n\t}\n\n\tif (tableProps.verbose) {\n\t\tconsole.log('[[VERBOSE MODE]]')\n\t\tconsole.log('|-- TABLE PROPS --------------------------------------------------------|')\n\t\tconsole.log(`| presLayout.width ................................ = ${(presLayout.width / EMU_PER_INCH).toFixed(1)}`)\n\t\tconsole.log(\n\t\t\t`| presLayout.height ............................... = ${(presLayout.height / EMU_PER_INCH).toFixed(1)}`\n\t\t)\n\t\tconsole.log(\n\t\t\t`| tableProps.x .................................... = ${typeof tableProps.x === 'number' ? (tableProps.x / EMU_PER_INCH).toFixed(1) : tableProps.x}`\n\t\t)\n\t\tconsole.log(\n\t\t\t`| tableProps.y .................................... = ${typeof tableProps.y === 'number' ? (tableProps.y / EMU_PER_INCH).toFixed(1) : tableProps.y}`\n\t\t)\n\t\tconsole.log(\n\t\t\t`| tableProps.w .................................... = ${typeof tableProps.w === 'number' ? (tableProps.w / EMU_PER_INCH).toFixed(1) : tableProps.w}`\n\t\t)\n\t\tconsole.log(\n\t\t\t`| tableProps.h .................................... = ${typeof tableProps.h === 'number' ? (tableProps.h / EMU_PER_INCH).toFixed(1) : tableProps.h}`\n\t\t)\n\t\tconsole.log(\n\t\t\t`| tableProps.slideMargin .......................... = ${tableProps.slideMargin ? String(tableProps.slideMargin) : ''}`\n\t\t)\n\t\tconsole.log(`| tableProps.margin ............................... = ${String(tableProps.margin)}`)\n\t\tconsole.log(`| tableProps.colW ................................. = ${String(tableProps.colW)}`)\n\t\tconsole.log(`| tableProps.autoPageSlideStartY .................. = ${tableProps.autoPageSlideStartY}`)\n\t\tconsole.log(`| tableProps.autoPageCharWeight ................... = ${tableProps.autoPageCharWeight}`)\n\t\tconsole.log('|-- CALCULATIONS -------------------------------------------------------|')\n\t\tconsole.log(`| tablePropX ...................................... = ${tablePropX / EMU_PER_INCH}`)\n\t\tconsole.log(`| tablePropY ...................................... = ${tablePropY / EMU_PER_INCH}`)\n\t\tconsole.log(`| tablePropW ...................................... = ${tablePropW / EMU_PER_INCH}`)\n\t\tconsole.log(`| tablePropH ...................................... = ${tablePropH / EMU_PER_INCH}`)\n\t\tconsole.log(`| tableCalcW ...................................... = ${tableCalcW / EMU_PER_INCH}`)\n\t}\n\n\t// STEP 1: Calculate margins\n\t{\n\t\t// The caller's value goes through unaltered, including an absent one: `resolveSlideMarginsInches`\n\t\t// owns all three tiers, and defaulting to `DEF_SLIDE_MARGIN_IN[0]` here handed it a stated\n\t\t// caller margin that no caller had stated, which suppressed the master's own `margin`.\n\t\tarrInchMargins = resolveSlideMarginsInches(masterSlide?._margin, tableProps.slideMargin)\n\n\t\tif (tableProps.verbose)\n\t\t\tconsole.log(`| arrInchMargins .................................. = [${arrInchMargins.join(', ')}]`)\n\t}\n\n\t// STEP 2: Calculate number of columns\n\t{\n\t\tnumCols = tableColCount(tableRows)\n\t\tif (tableProps.verbose) console.log(`| numCols ......................................... = ${numCols}`)\n\t}\n\n\t// Where every cell actually lands. The pager asks the grid two questions -- which columns a\n\t// cell spans, so its text is wrapped against the right width, and whether a rowspan opened\n\t// on an earlier row is still open here, so a page break does not split a merged group -- and\n\t// it used to answer both with its own occupancy array, once forwards through the row and\n\t// once again after it. `walkTableGrid` is the traversal the measured-fit pass and the\n\t// emitter's own grid build follow, so the widths this pager wraps against are the widths the\n\t// cells are finally given.\n\tconst placements: GridPlacement[][] = tableRows.map(() => [])\n\t/**\n\t * How many of each row's grid columns are held by a rowspan opened ABOVE it, accumulated as\n\t * the placements arrive rather than searched for afterwards.\n\t *\n\t * The question used to be answered by scanning every placement in the table, once per row,\n\t * which is quadratic in a table of any width. Two columns of short text and no spans at all:\n\t * 1000 rows took 55ms, 2000 took 115ms, 4000 took 333ms and 8000 took 1036ms. The same four\n\t * now take 24ms, 19ms, 40ms and 83ms -- so it was pure overhead, paid in full by the long\n\t * report table that is the whole reason this code exists.\n\t *\n\t * Filling forward instead is bounded by the placement's own `rowSpan`, so the total work is\n\t * the sum of all rowspans. That is safe to expand without a further check because\n\t * `walkTableGrid` has already clamped each `rowSpan` to `rows.length - r`: a span cannot\n\t * reach past the last row however large the caller wrote it, so the sum is bounded by the\n\t * grid rather than by anything the caller states.\n\t *\n\t * The fill starts at `row + 1`. A `rowSpan` of 1 must contribute nothing -- starting at\n\t * `row` would have every ordinary row counting itself as covered, and the\n\t * `coveredFromAbove(iRow) === numCols` reader below would then fire on all of them.\n\t */\n\tconst coveredCols: number[] = Array.from({ length: tableRows.length }, () => 0)\n\tfor (const placement of walkTableGrid(tableRows, numCols)) {\n\t\tplacements[placement.row]?.push(placement)\n\t\tconst last = Math.min(placement.row + placement.rowSpan, coveredCols.length)\n\t\tfor (let r = placement.row + 1; r < last; r++) coveredCols[r] = (coveredCols[r] ?? 0) + placement.colSpan\n\t}\n\t/** How many of `iRow`'s grid columns are held by a rowspan opened above it. */\n\tconst coveredFromAbove = (iRow: number): number => coveredCols[iRow] ?? 0\n\t/** Whether a rowspan opened above `iRow` is still covering it. */\n\tconst spannedFromAbove = (iRow: number): boolean => coveredFromAbove(iRow) > 0\n\n\t// STEP 3: Calculate width using tableProps.colW if possible. Only an array reaches here:\n\t// `addTableDefinition` turns a single `colW` into `w` before paging, and `tableToSlides` always\n\t// passes one width per column.\n\tif (!tablePropW && Array.isArray(tableProps.colW)) {\n\t\t// The `0` seed is what `colW: []` needs: an empty array is truthy, so it reached an\n\t\t// unseeded `reduce` and threw a raw `TypeError` — a failure this library did not raise as\n\t\t// a `TsPptxError`. Seeded, it totals `0`, which falls through to `usableTableWidthEmu`\n\t\t// exactly where `colW: undefined` lands. That is the reading intended: an empty array is a\n\t\t// caller stating no columns, not a table of width zero.\n\t\ttableCalcW = tableProps.colW.reduce((p, n) => p + n, 0) * EMU_PER_INCH\n\t\tif (tableProps.verbose)\n\t\t\tconsole.log(`| tableCalcW ...................................... = ${tableCalcW / EMU_PER_INCH}`)\n\t}\n\n\t// STEP 4: Calculate usable width now that total usable space is known (`emuSlideTabW`)\n\t{\n\t\temuSlideTabW = tableCalcW || usableTableWidthEmu(presLayout, tablePropX, arrInchMargins)\n\t\tif (tableProps.verbose)\n\t\t\tconsole.log(`| emuSlideTabW .................................... = ${(emuSlideTabW / EMU_PER_INCH).toFixed(1)}`)\n\t}\n\n\t// STEP 5: Resolve the column grid. `resolveTableColWidthsEmu` is the same resolver the\n\t// table emitter and the measured-fit pass read, so the widths this pager wraps text\n\t// against are the widths the emitted `<a:gridCol>`s carry. It also normalizes the array\n\t// to `numCols`: a short `colW` used to leave the trailing columns measuring against a\n\t// zero width. Inches, because that is the unit each paged table's `colW` takes; the grid\n\t// rides out on every `TableRowSlide` rather than being written back onto the caller's bag.\n\tcolWidthsIn = resolveTableColWidthsEmu(tableProps.colW, emuSlideTabW, numCols).map(\n\t\t(emu: number) => emu / EMU_PER_INCH\n\t)\n\n\t// Resolve a row's explicit height (inches) from the original `rowH` *array*, keyed by original\n\t// row index. A single-number `rowH` is left to propagate via table options (it applies uniformly,\n\t// so it needs no per-row remapping); only the array form is index-sensitive after pagination.\n\t// Whether a slot pins its row is `pinnedRowHeightInches`, the same rule the writer applies to\n\t// the array this builds — a `0` accepted here and rejected there is how the two readings drift.\n\tconst resolveRowH = (origRowIdx: number): number | undefined =>\n\t\tArray.isArray(tableProps.rowH) ? (pinnedRowHeightInches(tableProps.rowH[origRowIdx]) ?? undefined) : undefined\n\n\t/**\n\t * Wrap each of row `iRow`'s cells against the grid columns it covers, and price the row.\n\t *\n\t * The one row measure. The repeated header rows used to be priced by a second copy of it with its\n\t * own column cursor, which ignored the columns a rowspan holds -- the fault `walkTableGrid`\n\t * fixed for the main loop -- and skipped the line-height exemption for a cell that spans rows,\n\t * so a header row inside a rowspan was measured against the wrong columns.\n\t * @param iRow - the row's index in `tableRows`\n\t * @param verbose - dump the wrapping stages, as `addTable({ verbose })` asks\n\t */\n\tfunction measureRow(iRow: number, verbose?: boolean): MeasuredRow {\n\t\tconst row = tableRows[iRow] ?? []\n\t\tconst { topEmu, btmEmu } = rowMarginsEmu(row, tableProps)\n\t\t// Cells are keyed to grid columns, not to their position in the row: a colspan earlier in\n\t\t// the row shifts every later cell, and a rowspan opened above skips columns entirely.\n\t\t// Measuring a cell against `colW[iCell]` wrapped its text to another column's width.\n\t\tconst rowPlacements = placements[iRow] ?? []\n\t\tconst cells = row.map((cell, iCell): AutoPageCell => {\n\t\t\t// A row longer than the grid runs off the end of it: those cells are placed nowhere\n\t\t\t// and measure against no column, which is what the cursor did by clamping.\n\t\t\tconst placed = rowPlacements[iCell]\n\t\t\tconst colStart = placed ? placed.col : numCols\n\t\t\tconst cellColspan = placed ? placed.colSpan : resolveSpan(cell.options?.colspan, 'colspan')\n\t\t\t// A spanning cell is as wide as the columns it covers; the seed keeps a row longer than\n\t\t\t// the grid from throwing on an empty slice.\n\t\t\tconst totalColW = colWidthsIn.slice(colStart, colStart + cellColspan).reduce((prev, curr) => prev + curr, 0)\n\t\t\tconst fontSizePt = resolveCellFontSize(cell.options, tableProps)\n\t\t\treturn {\n\t\t\t\t_type: SlideObjectType.tablecell,\n\t\t\t\t_lines: parseTextToLines(cell, totalColW, fontSizePt, resolveCellCharWeight(cell.options, tableProps), verbose),\n\t\t\t\t// A cell that spans rows adds no line height to this one (or a page could break where\n\t\t\t\t// nothing needed it to). The grid's clamped span decides, not the option: `rowspan: 1`\n\t\t\t\t// is a valid \"no span\" that `withCheckedSpans` passes through, and testing the option\n\t\t\t\t// priced every such row at its margins alone.\n\t\t\t\t_lineHeight:\n\t\t\t\t\tplaced && placed.rowSpan > 1 ? 0 : autoPageLineHeightEmu(fontSizePt, tableProps.autoPageLineWeight || 0),\n\t\t\t\ttext: [],\n\t\t\t\toptions: cell.options || {},\n\t\t\t}\n\t\t})\n\t\tconst lineHeightEmu = cells.reduce((max, cell) => Math.max(max, cell._lineHeight), 0)\n\t\tconst maxLines = cells.reduce((max, cell) => Math.max(max, cell._lines.length), 0)\n\t\tconst marginsEmu = topEmu + btmEmu\n\t\treturn { cells, marginsEmu, lineHeightEmu, heightEmu: marginsEmu + maxLines * lineHeightEmu }\n\t}\n\n\t// What the repeated header rows cost a continuation page. Computed once: the rows and the\n\t// grid are the same on every page, so re-measuring per page would only be slower. Both callers\n\t// pass the header rows as the leading rows of `tableRows`, so each is measured at its own index,\n\t// against the grid placements the body rows use.\n\tconst repeatHeaderRows =\n\t\ttableProps.autoPageRepeatHeader && tableProps._arrObjTabHeadRows ? tableProps._arrObjTabHeadRows : []\n\tconst repeatHeaderHeightsEmu = repeatHeaderRows.map((_row, headIdx) => measureRow(headIdx).heightEmu)\n\n\t/**\n\t * The last row of the rowspan group that row `iRow` opens: the furthest row any of its spans\n\t * reaches, extended by every span a covered row opens in turn. `walkTableGrid` has clamped each\n\t * span to the table, so the walk ends inside it.\n\t * @param iRow - the row that opens the group\n\t */\n\tfunction rowSpanGroupEnd(iRow: number): number {\n\t\tlet end = iRow\n\t\tfor (let r = iRow; r <= end; r++) {\n\t\t\tfor (const placement of placements[r] ?? []) end = Math.max(end, r + placement.rowSpan - 1)\n\t\t}\n\t\treturn end\n\t}\n\n\t// STEP 6: **MAIN** Iterate over rows, add table content, create new slides as rows overflow\n\tlet newTableRowSlide: TableRowSlide = {\n\t\trows: [] as TableRowInternal[],\n\t\trowH: [] as Array<number | undefined>,\n\t\tcolW: colWidthsIn,\n\t\ty: startYEmu() / EMU_PER_INCH,\n\t}\n\t/** Rows placed on the working page other than its repeated header rows. */\n\tlet bodyRowsOnPage = 0\n\tlet warnedTallRowSpan = false\n\n\t/**\n\t * Close the working page and open the next: push the page when it has rows, re-derive the page\n\t * height, charge `chargedEmu` to the new page, then repeat the header rows onto it.\n\t * @param chargedEmu - what the new page already owes before its header rows: the margins of a\n\t * row that is starting over here, or nothing\n\t */\n\tfunction startNewPage(chargedEmu: number): void {\n\t\t// Never push an empty page: a row that does not fit yet has no content here, and an empty\n\t\t// `rows` slide crashes the recursive addTable.\n\t\tif (newTableRowSlide.rows.length > 0) tableRowSlides.push(newTableRowSlide)\n\t\t// Decided after the push: the page just closed is what makes this one a continuation.\n\t\tnewTableRowSlide = {\n\t\t\trows: [],\n\t\t\trowH: [] as Array<number | undefined>,\n\t\t\tcolW: colWidthsIn,\n\t\t\ty: startYEmu() / EMU_PER_INCH,\n\t\t}\n\t\tbodyRowsOnPage = 0\n\t\t// The page height depends on which page this is, so it is re-derived for the new one.\n\t\tcalcSlideTabH()\n\t\t// ORDER IS LOAD-BEARING. The charge used to be added and then wiped by the reset, so the first\n\t\t// row of every continuation slide was the only row in the table that paid no margin. That let\n\t\t// a continuation slide accept one row more than it had room for, and the extra row hung off\n\t\t// the bottom of the slide (upstream gitbrent/PptxGenJS#1200). The symptom is easy to miss\n\t\t// because the pager is *self*-consistent per slide: it only shows up as the first slide and\n\t\t// the continuation slides disagreeing about how many identical rows fit the identical space,\n\t\t// which is what test/regression/table/table-autopage-continuation-budget.test.js pins.\n\t\temuTabCurrH = chargedEmu\n\t\tif (tableProps.verbose)\n\t\t\tconsole.log(\n\t\t\t\t`| SLIDE [${tableRowSlides.length}]: emuSlideTabH ...... = ${(emuSlideTabH / EMU_PER_INCH).toFixed(1)} `\n\t\t\t)\n\t\trepeatHeaderRows.forEach((headRow, headIdx) => {\n\t\t\tnewTableRowSlide.rows.push([...headRow])\n\t\t\t// Repeated header rows are the original leading rows, so carry their configured height.\n\t\t\tnewTableRowSlide.rowH?.push(resolveRowH(headIdx))\n\t\t\temuTabCurrH += repeatHeaderHeightsEmu[headIdx] ?? 0\n\t\t})\n\t}\n\n\ttableRows.forEach((row, iRow) => {\n\t\t// A: Row variables — detect active rowspan at the start of this row so we can\n\t\t// suppress page breaks that would split a rowspan group across slides.\n\t\tconst hasActiveRowSpan = spannedFromAbove(iRow)\n\t\t// B: Create new row in data model\n\t\tlet currTableRow: TableRowInternal = []\n\t\trow.forEach((cell) => currTableRow.push(workingCell([], cell.options)))\n\n\t\t// C: Calc usable vertical space/table height. Set default value first, adjust below when necessary.\n\t\tcalcSlideTabH()\n\t\tif (tableProps.verbose && iRow === 0)\n\t\t\tconsole.log(\n\t\t\t\t`| SLIDE [${tableRowSlides.length}]: emuSlideTabH ...... = ${(emuSlideTabH / EMU_PER_INCH).toFixed(1)} `\n\t\t\t)\n\n\t\t// C-2: A row that opens a rowspan is kept with the rows the span covers. Breaking a page\n\t\t// partway through it left the partial row as the page's last row still carrying `rowSpan`,\n\t\t// so the emitter wrote a `rowSpan=\"2\"` with no row under it -- the state PowerPoint reports\n\t\t// as corrupt. The whole group is priced before any of its lines is taken: when it does not\n\t\t// fit under rows already on the page, the page breaks before it, and a group taller than a\n\t\t// page is emitted whole on a page of its own.\n\t\tconst startsRowSpan = !hasActiveRowSpan && (placements[iRow] ?? []).some((placement) => placement.rowSpan > 1)\n\t\tif (startsRowSpan) {\n\t\t\tlet groupHeightEmu = 0\n\t\t\tfor (let r = iRow; r <= rowSpanGroupEnd(iRow); r++) groupHeightEmu += measureRow(r).heightEmu\n\t\t\tif (bodyRowsOnPage > 0 && emuTabCurrH + groupHeightEmu > emuSlideTabH) startNewPage(0)\n\t\t\tif (emuTabCurrH + groupHeightEmu > emuSlideTabH && !warnedTallRowSpan) {\n\t\t\t\twarn(\n\t\t\t\t\t'table/autopage-rowspan-too-tall',\n\t\t\t\t\t'addTable/autoPage: a group of rows joined by a rowspan is taller than a page; it is kept on one page and runs past its bottom. Reduce the span or the text in it.'\n\t\t\t\t)\n\t\t\t\twarnedTallRowSpan = true\n\t\t\t}\n\t\t}\n\t\tconst keepRowTogether = hasActiveRowSpan || startsRowSpan\n\n\t\t// D: --==[[ BUILD DATA SET ]]==-- (split each cell's text into lines, set its line height)\n\t\tconst {\n\t\t\tcells: rowCellLines,\n\t\t\tmarginsEmu: rowMarginsTotalEmu,\n\t\t\tlineHeightEmu: emuLineMaxH,\n\t\t} = measureRow(iRow, tableProps.verbose)\n\t\temuTabCurrH += rowMarginsTotalEmu // Start row height with margins\n\n\t\t/** E: --==[[ PAGE DATA SET ]]==--\n\t\t * Add text one-line-a-time to this row's cells until: lines are exhausted OR table height limit is hit\n\t\t *\n\t\t * Design:\n\t\t * - Building cells L-to-R/loop style wont work as one could be 100 lines and another 1 line\n\t\t * - Therefore, build the whole row, one-line-at-a-time, across each table columns\n\t\t * - Then, when the vertical size limit is hit is by any of the cells, make a new slide and continue adding any remaining lines\n\t\t *\n\t\t * Implementation:\n\t\t * - `rowCellLines` is an array of cells, one for each column in the table, with each cell containing an array of lines\n\t\t *\n\t\t * Sample Data:\n\t\t * - `rowCellLines` ..: [ TableCellInternal, TableCellInternal, TableCellInternal ]\n\t\t * - `TableCellInternal` .....: { _type: 'tablecell', _lines: TableCellInternal[], _lineHeight: 10 }\n\t\t * - `_lines` ........: [ {_type: 'tablecell', text: 'cell-1,line-1', options: {…}}, {_type: 'tablecell', text: 'cell-1,line-2', options: {…}} }\n\t\t * - `_lines` is TableCellInternal[] (the 1-N words in the line)\n\t\t * {\n\t\t * _lines: [{ text:'cell-1,line-1' }, { text:'cell-1,line-2' }], // TOTAL-CELL-HEIGHT = 2\n\t\t * _lines: [{ text:'cell-2,line-1' }, { text:'cell-2,line-2' }], // TOTAL-CELL-HEIGHT = 2\n\t\t * _lines: [{ text:'cell-3,line-1' }, { text:'cell-3,line-2' }, { text:'cell-3,line-3' }, { text:'cell-3,line-4' }], // TOTAL-CELL-HEIGHT = 4\n\t\t * }\n\t\t *\n\t\t * Example: 2 rows, with the firstrow overflowing onto a new slide\n\t\t * SLIDE 1:\n\t\t * |--------|--------|--------|--------|\n\t\t * | line-1 | line-1 | line-1 | line-1 |\n\t\t * | | | line-2 | |\n\t\t * | | | line-3 | |\n\t\t * |--------|--------|--------|--------|\n\t\t *\n\t\t * SLIDE 2:\n\t\t * |--------|--------|--------|--------|\n\t\t * | | | line-4 | |\n\t\t * |--------|--------|--------|--------|\n\t\t * | line-1 | line-1 | line-1 | line-1 |\n\t\t * |--------|--------|--------|--------|\n\t\t */\n\t\tif (tableProps.verbose) console.log(`\\n| SLIDE [${tableRowSlides.length}]: ROW [${iRow}]: START...`)\n\t\tlet currCellIdx = 0\n\t\tlet isDone = false\n\t\twhile (!isDone) {\n\t\t\tconst srcCell = rowCellLines[currCellIdx]\n\t\t\tif (!srcCell) break\n\t\t\tlet tgtCell = currTableRow[currCellIdx] // NOTE: may be redefined below (a new row may be created, thus changing this value)\n\n\t\t\t// 2: create a new slide if there is insufficient room for the current row,\n\t\t\t// but never break inside a rowspan group — keep spanned rows together.\n\t\t\tif (emuTabCurrH + emuLineMaxH > emuSlideTabH && !keepRowTogether) {\n\t\t\t\tif (tableProps.verbose) {\n\t\t\t\t\tconsole.log('\\n|-----------------------------------------------------------------------|')\n\t\t\t\t\t// prettier-ignore\n\t\t\t\t\tconsole.log(`|-- NEW SLIDE CREATED (currTabH+currLineH > maxH) => ${(emuTabCurrH / EMU_PER_INCH).toFixed(2)} + ${(srcCell._lineHeight / EMU_PER_INCH).toFixed(2)} > ${emuSlideTabH / EMU_PER_INCH}`)\n\t\t\t\t\tconsole.log('|-----------------------------------------------------------------------|\\n\\n')\n\t\t\t\t}\n\n\t\t\t\t// A: add current row slide or it will be lost (only if it has rows and text)\n\t\t\t\tif (\n\t\t\t\t\tcurrTableRow.length > 0 &&\n\t\t\t\t\tcurrTableRow.map((cell) => (Array.isArray(cell.text) ? cell.text.length : 0)).reduce((p, n) => p + n) > 0\n\t\t\t\t) {\n\t\t\t\t\tnewTableRowSlide.rows.push(currTableRow)\n\t\t\t\t\tnewTableRowSlide.rowH?.push(resolveRowH(iRow))\n\t\t\t\t}\n\n\t\t\t\t// B: open the next page. The row is starting over there, so it owes its cell margins\n\t\t\t\t// again.\n\t\t\t\tstartNewPage(rowMarginsTotalEmu)\n\n\t\t\t\t// C: reset working/curr row\n\t\t\t\tcurrTableRow = []\n\t\t\t\trow.forEach((cell) => currTableRow.push(workingCell([], cell.options)))\n\n\t\t\t\ttgtCell = currTableRow[currCellIdx]\n\t\t\t}\n\n\t\t\t// 3: set array of words that comprise this line\n\t\t\tconst currLine = srcCell._lines.shift()\n\n\t\t\t// 4: create new line by adding all words from curr line (or add empty if there are no words to avoid \"needs repair\" issue triggered when cells have null content)\n\t\t\tif (tgtCell && Array.isArray(tgtCell.text)) {\n\t\t\t\tif (currLine) tgtCell.text = tgtCell.text.concat(currLine)\n\t\t\t\telse if (tgtCell.text.length === 0)\n\t\t\t\t\ttgtCell.text = tgtCell.text.concat({ _type: SlideObjectType.tablecell, text: '' })\n\t\t\t\t// IMPORTANT: ^^^ add empty if there are no words to avoid \"needs repair\" issue triggered when cells have null content\n\t\t\t}\n\n\t\t\t// 5: increase table height by the curr line height (if we're on the last column)\n\t\t\tif (currCellIdx === rowCellLines.length - 1) emuTabCurrH += emuLineMaxH\n\n\t\t\t// 6: advance column/cell index (or circle back to first one to continue adding lines)\n\t\t\tcurrCellIdx = currCellIdx < rowCellLines.length - 1 ? currCellIdx + 1 : 0\n\n\t\t\t// 7: WIP: done?\n\t\t\tconst brent = rowCellLines.map((cell) => cell._lines.length).reduce((prev, next) => prev + next)\n\t\t\tif (brent === 0) isDone = true\n\t\t}\n\n\t\t// F: Flush/capture row buffer before it resets at the top of this loop.\n\t\t//\n\t\t// A row that states no cells is kept only when every one of its grid columns is held by a\n\t\t// rowspan from above. That is a real row -- a source row states only the cells it *starts*,\n\t\t// so one entirely covered from above states none at all, which is what `<tr></tr>` between\n\t\t// two spanned rows means -- and the emitter fills it with `vMerge` continuations. Dropping\n\t\t// it moved every later row up one while the emitter went on synthesizing that grid row's\n\t\t// continuations, so they landed in the next row's `<a:tr>`: a 2-column table came out with\n\t\t// a 4-cell row.\n\t\t//\n\t\t// An empty row NOT covered that way is a different thing and is still dropped: nothing\n\t\t// would fill it, and a `<a:tr>` carrying fewer `<a:tc>` than the grid has columns is the\n\t\t// malformation PowerPoint offers to repair.\n\t\tif (currTableRow.length > 0 || (row.length === 0 && coveredFromAbove(iRow) === numCols)) {\n\t\t\tnewTableRowSlide.rows.push(currTableRow)\n\t\t\tnewTableRowSlide.rowH?.push(resolveRowH(iRow))\n\t\t\tbodyRowsOnPage++\n\t\t}\n\n\t\tif (tableProps.verbose) {\n\t\t\tconsole.log(\n\t\t\t\t`- SLIDE [${tableRowSlides.length}]: ROW [${iRow}]: ...COMPLETE ...... emuTabCurrH = ${(emuTabCurrH / EMU_PER_INCH).toFixed(2)} ( emuSlideTabH = ${(\n\t\t\t\t\temuSlideTabH / EMU_PER_INCH\n\t\t\t\t).toFixed(2)} )`\n\t\t\t)\n\t\t}\n\t})\n\n\t// STEP 7: Flush buffer / add final slide (skip an empty trailing buffer; always keep at least\n\t// one slide so a non-empty table is never reduced to zero pages)\n\tif (newTableRowSlide.rows.length > 0 || tableRowSlides.length === 0) tableRowSlides.push(newTableRowSlide)\n\n\tif (tableProps.verbose) {\n\t\tconsole.log('\\n|================================================|')\n\t\tconsole.log(`| FINAL: tableRowSlides.length = ${tableRowSlides.length}`)\n\t\ttableRowSlides.forEach((slide) => console.log(slide))\n\t\tconsole.log('|================================================|\\n\\n')\n\t}\n\n\t// LAST:\n\treturn tableRowSlides\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAoDA,SAAS,YAAY,MAAoC,SAAwD;CAChH,OAAO,YAAY,KAAA,IAChB;EAAE,OAAA;EAAkC;CAAK,IACzC;EAAE,OAAA;EAAkC;EAAM;CAAQ;AACtD;;;;;;;;;;;;;;;;;;;;;;;;AA2BA,SAAS,iBACR,MACA,UACA,YACA,YACA,SACwB;CAKxB,MAAM,OAAO,MAAM;CAOnB,MAAM,MAAM,KAAK,MAAM,WAAA,EAA0B,KAAK,aAAa;CAKnE,IAAI,SAAS,QAAQ,IAAI,kBAAkB,SAAS,cAAc,WAAW,QAAQ,KAAK,OAAO,KAAK;CAEtG,MAAM,cAAqC,CAAC;CAC5C,IAAI,aAAkC,CAAC;CACvC,MAAM,cAAqC,CAAC;CAC5C,MAAM,cAAqC,CAAC;;;;;;;;;;;;;;;CAmB5C,IAAI,KAAK,QAAQ,KAAK,KAAK,SAAS,CAAC,CAAC,KAAK,CAAC,CAAC,WAAW,GAEvD,WAAW,KAAK;EAAE,OAAA;EAAkC,MAAM;CAAI,CAAC;MACzD,IAAI,OAAO,KAAK,SAAS,YAAY,OAAO,KAAK,SAAS,UAChE,WAAW,KAAK;EAAE,OAAA;EAAkC,OAAO,KAAK,QAAQ,GAAA,CAAI,SAAS,CAAC,CAAC,KAAK;CAAE,CAAC;MACzF,IAAI,MAAM,QAAQ,KAAK,IAAI,GACjC,aAAa,KAAK;CAEnB,IAAI,SAAS;EACZ,QAAQ,IAAI,kBAAkB;EAC9B,WAAW,SAAS,MAAM,QAAQ,QAAQ,IAAI,UAAU,MAAM,EAAE,UAAU,KAAK,UAAU,IAAI,GAAG,CAAC;CAClG;;;;;;;CASA,IAAI,UAA+B,CAAC;CACpC,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es, and what the
4
+ * `zip` entry's `binarystring` output returns as it is.
5
+ *
6
+ * A module of its own, importing nothing, for the reason `ooxml/pptx-content-type.ts` states: the
7
+ * `zip` entry needs this one function, and imported from `base64.ts` it brought that module's other
8
+ * exports along and pushed the entry past its size budget.
9
+ *
10
+ * Chunked because `String.fromCharCode(...spread)` blows the argument-count limit on a payload
11
+ * of any real size — a multi-megabyte video rel would throw rather than encode.
12
+ * @param {Uint8Array} bytes - the payload
13
+ * @returns {string} one character per byte
14
+ */
15
+ function bytesToBinaryString(bytes) {
16
+ const CHUNK = 32768;
17
+ let binary = "";
18
+ for (let i = 0; i < bytes.length; i += CHUNK) binary += String.fromCharCode(...bytes.subarray(i, i + CHUNK));
19
+ return binary;
20
+ }
21
+ //#endregion
22
+ export { bytesToBinaryString as t };
23
+
24
+ //# sourceMappingURL=binary-string-CKVAYI3M.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"binary-string-CKVAYI3M.js","names":[],"sources":["../src/media/binary-string.ts"],"sourcesContent":["/**\n * Raw bytes as a latin1 binary string, one character per byte: what `btoa` takes, and what the\n * `zip` entry's `binarystring` output returns as it is.\n *\n * A module of its own, importing nothing, for the reason `ooxml/pptx-content-type.ts` states: the\n * `zip` entry needs this one function, and imported from `base64.ts` it brought that module's other\n * exports along and pushed the entry past its size budget.\n *\n * Chunked because `String.fromCharCode(...spread)` blows the argument-count limit on a payload\n * of any real size — a multi-megabyte video rel would throw rather than encode.\n * @param {Uint8Array} bytes - the payload\n * @returns {string} one character per byte\n */\nexport function bytesToBinaryString(bytes: Uint8Array): string {\n\tconst CHUNK = 0x8000\n\tlet binary = ''\n\tfor (let i = 0; i < bytes.length; i += CHUNK) binary += String.fromCharCode(...bytes.subarray(i, i + CHUNK))\n\treturn binary\n}\n"],"mappings":";;;;;;;;;;;;;;AAaA,SAAgB,oBAAoB,OAA2B;CAC9D,MAAM,QAAQ;CACd,IAAI,SAAS;CACb,KAAK,IAAI,IAAI,GAAG,IAAI,MAAM,QAAQ,KAAK,OAAO,UAAU,OAAO,aAAa,GAAG,MAAM,SAAS,GAAG,IAAI,KAAK,CAAC;CAC3G,OAAO;AACR"}
@@ -0,0 +1,54 @@
1
+ import { I as EMU_PER_POINT } from "./table-cell-margins-EVg0EwxT.js";
2
+ //#region src/ooxml/body-insets.ts
3
+ /**
4
+ * PowerPoint's default `a:bodyPr` text insets.
5
+ *
6
+ * ECMA-376 §21.1.2.1.1 states them in prose; the XSD leaves `lIns`/`tIns`/`rIns`/`bIns`
7
+ * optional with no schema default, so a reader that wants to know what an omitted side is
8
+ * inset by has to carry the numbers itself. Four places did, in three units and two orders:
9
+ * the script mapper as a points record, the round-trip canonicaliser as an inches tuple in
10
+ * `[top, right, bottom, left]`, `inspect.ts` as two inch scalars, and the measured-fit
11
+ * solver as two EMU scalars — that last one deciding the inner box every `autoFit` is
12
+ * computed against, so a correction here would have left every fit decision on the old
13
+ * numbers.
14
+ *
15
+ * The canonicaliser's tuple in particular has to be exactly `pointsToInches` of the mapper's
16
+ * record, or `isDefaultMargin` stops matching and every text frame that spells its insets
17
+ * reports four spurious differences. Nothing linked them; this module is the link.
18
+ *
19
+ * It is a fact about the schema, so — like `st-enums.ts` — it belongs to neither `gen/` nor
20
+ * `read/` nor `script/`.
21
+ */
22
+ /** The four default insets in points: 7.2pt (0.1in) left and right, 3.6pt (0.05in) top and bottom. */
23
+ const BODY_INSET_DEFAULTS_PT = {
24
+ left: 7.2,
25
+ right: 7.2,
26
+ top: 3.6,
27
+ bottom: 3.6
28
+ };
29
+ /**
30
+ * The same four in inches, in the write API's `margin` order — `[top, right, bottom, left]`.
31
+ *
32
+ * Derived rather than transcribed, so it cannot drift from {@link BODY_INSET_DEFAULTS_PT}.
33
+ */
34
+ const BODY_INSET_DEFAULTS_IN = [
35
+ BODY_INSET_DEFAULTS_PT.top / 72,
36
+ BODY_INSET_DEFAULTS_PT.right / 72,
37
+ BODY_INSET_DEFAULTS_PT.bottom / 72,
38
+ BODY_INSET_DEFAULTS_PT.left / 72
39
+ ];
40
+ /**
41
+ * The same four in EMU, which is the unit the measured-fit solver works in.
42
+ *
43
+ * Derived rather than transcribed, for the same reason {@link BODY_INSET_DEFAULTS_IN} is.
44
+ */
45
+ const BODY_INSET_DEFAULTS_EMU = {
46
+ left: BODY_INSET_DEFAULTS_PT.left * EMU_PER_POINT,
47
+ right: BODY_INSET_DEFAULTS_PT.right * EMU_PER_POINT,
48
+ top: BODY_INSET_DEFAULTS_PT.top * EMU_PER_POINT,
49
+ bottom: BODY_INSET_DEFAULTS_PT.bottom * EMU_PER_POINT
50
+ };
51
+ //#endregion
52
+ export { BODY_INSET_DEFAULTS_IN as n, BODY_INSET_DEFAULTS_PT as r, BODY_INSET_DEFAULTS_EMU as t };
53
+
54
+ //# sourceMappingURL=body-insets-Dw_BeWD_.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"body-insets-Dw_BeWD_.js","names":[],"sources":["../src/ooxml/body-insets.ts"],"sourcesContent":["/**\n * PowerPoint's default `a:bodyPr` text insets.\n *\n * ECMA-376 §21.1.2.1.1 states them in prose; the XSD leaves `lIns`/`tIns`/`rIns`/`bIns`\n * optional with no schema default, so a reader that wants to know what an omitted side is\n * inset by has to carry the numbers itself. Four places did, in three units and two orders:\n * the script mapper as a points record, the round-trip canonicaliser as an inches tuple in\n * `[top, right, bottom, left]`, `inspect.ts` as two inch scalars, and the measured-fit\n * solver as two EMU scalars — that last one deciding the inner box every `autoFit` is\n * computed against, so a correction here would have left every fit decision on the old\n * numbers.\n *\n * The canonicaliser's tuple in particular has to be exactly `pointsToInches` of the mapper's\n * record, or `isDefaultMargin` stops matching and every text frame that spells its insets\n * reports four spurious differences. Nothing linked them; this module is the link.\n *\n * It is a fact about the schema, so — like `st-enums.ts` — it belongs to neither `gen/` nor\n * `read/` nor `script/`.\n */\n\nimport { EMU_PER_POINT, POINTS_PER_INCH } from './emu.js'\n\n/** The four default insets in points: 7.2pt (0.1in) left and right, 3.6pt (0.05in) top and bottom. */\nexport const BODY_INSET_DEFAULTS_PT = { left: 7.2, right: 7.2, top: 3.6, bottom: 3.6 } as const\n\n/**\n * The same four in inches, in the write API's `margin` order — `[top, right, bottom, left]`.\n *\n * Derived rather than transcribed, so it cannot drift from {@link BODY_INSET_DEFAULTS_PT}.\n */\nexport const BODY_INSET_DEFAULTS_IN: readonly number[] = [\n\tBODY_INSET_DEFAULTS_PT.top / POINTS_PER_INCH,\n\tBODY_INSET_DEFAULTS_PT.right / POINTS_PER_INCH,\n\tBODY_INSET_DEFAULTS_PT.bottom / POINTS_PER_INCH,\n\tBODY_INSET_DEFAULTS_PT.left / POINTS_PER_INCH,\n]\n\n/**\n * The same four in EMU, which is the unit the measured-fit solver works in.\n *\n * Derived rather than transcribed, for the same reason {@link BODY_INSET_DEFAULTS_IN} is.\n */\nexport const BODY_INSET_DEFAULTS_EMU = {\n\tleft: BODY_INSET_DEFAULTS_PT.left * EMU_PER_POINT,\n\tright: BODY_INSET_DEFAULTS_PT.right * EMU_PER_POINT,\n\ttop: BODY_INSET_DEFAULTS_PT.top * EMU_PER_POINT,\n\tbottom: BODY_INSET_DEFAULTS_PT.bottom * EMU_PER_POINT,\n} as const\n\n/**\n * A table cell's default text insets in EMU. They happen to equal {@link BODY_INSET_DEFAULTS_EMU}.\n * Declared in `table-cell-margins.ts`, which imports nothing, so the write path's inch defaults can\n * derive from it without bringing this module along.\n */\nexport { TABLE_CELL_MARGIN_DEFAULTS_EMU } from './table-cell-margins.js'\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAuBA,MAAa,yBAAyB;CAAE,MAAM;CAAK,OAAO;CAAK,KAAK;CAAK,QAAQ;AAAI;;;;;;AAOrF,MAAa,yBAA4C;CACxD,uBAAuB,MAAA;CACvB,uBAAuB,QAAA;CACvB,uBAAuB,SAAA;CACvB,uBAAuB,OAAA;AACxB;;;;;;AAOA,MAAa,0BAA0B;CACtC,MAAM,uBAAuB,OAAO;CACpC,OAAO,uBAAuB,QAAQ;CACtC,KAAK,uBAAuB,MAAM;CAClC,QAAQ,uBAAuB,SAAS;AACzC"}
package/dist/browser.d.ts CHANGED
@@ -1,31 +1,51 @@
1
- import { C as isChartExType, S as connectorPresetFor, _ as TextAnchor, a as CONNECTOR_PRESETS, b as ZIP_OUTPUT_TYPE, c as OutputType, d as SCHEME_COLORS, f as SHAPE_NAME, g as TableStyle, h as SlideObjectType, i as CHART_NAME, l as PLACEHOLDER_TYPE, m as ShapeType, n as AlignV, o as CONNECTOR_PRESET_NAME, p as SchemeColor, r as BulletType, s as ChartType, t as AlignH, u as PlaceholderType, v as VALID_SHAPE_PRESETS, w as isChartType, x as asChartType, y as WRITE_OUTPUT_TYPE } from "./enums-CvRYniUA.js";
2
- import { $ as BorderProps, $t as NotesProps, A as TableToSlidesDocument, At as ChartPropsChartHistogram, B as GradientStopProps, Bt as ChartPropsFillLine, C as TableCell, Cn as ShapeConnectionSite, Ct as ChartPropsAxisCat, D as TableProps, Dt as ChartPropsChartBar, E as TableCellProps, Et as ChartPropsBase, F as Coord, Ft as ChartPropsChartStock, G as Margin, Gt as OptsChartData, H as HexColor, Ht as ChartPropsTitle, I as DataOrPathProps, It as ChartPropsChartSurface, J as PositionProps, Jt as ObjectLockProps, K as PatternFillProps, Kt as OptsChartGridLine, L as DataOrPathRequiredProps, Lt as ChartPropsChartWaterfall, M as TableToSlidesProps, Mt as ChartPropsChartPie, N as BackgroundProps, Nt as ChartPropsChartRadar, O as TableRow, Ot as ChartPropsChartBoxWhisker, P as Color, Pt as ChartPropsChartRegionMap, Q as VAlign, Qt as MeasureTextOptions, R as GeometryPoint, Rt as ChartPropsDataLabel, S as TransitionType, Sn as ShapeAdjustValue, St as ChartOpts, T as TableCellDiagonals, Tn as ShapeProps, Tt as ChartPropsAxisVal, U as ImageFillProps, Ut as ChartSeriesOpts, V as HAlign, Vt as ChartPropsLegend, W as LinearGradientFillProps, Wt as LineCap, X as TextVertType, Xt as PlaceholderProps, Y as RadialGradientFillProps, Yt as ObjectNameProps, Z as ThemeColor, Zt as CommentProps, _ as AnimationProps, _n as MediaType, _t as ChartExBinning, a as Slide, an as TableLayoutResult, at as ShapeFillProps, b as TransitionProps, bn as ShapeAdjustHandlePolar, bt as ChartLineDash, c as Model3dPoint, cn as TextGlowProps, d as MasterTextStyleLevel, dn as TextPropsOptions, dt as PresetMaterialType, en as NotesTextOptions, et as ConnectorProps, f as MasterTextStyleProps, fn as textRun, g as SlideNumberProps, gn as MediaProps, gt as ChartErrorBarOptions, h as SlideMasterProps, hn as ImageProps, ht as ChartDataPointStyle, i as ObjectOptions, in as TableCellLayout, it as ShadowProps, j as TableToSlidesElement, jt as ChartPropsChartLine, k as TableRowSlide, kt as ChartPropsChartDoughnut, l as Model3dProps, ln as TextMeasurement, lt as LightRigDirection, m as SlideMasterObject, mn as ImageBaseProps, mt as ChartAxisTickMark, n as GroupChildProps, nn as ResolvedCommentAuthor, nt as HyperlinkActionJump, o as SlideLayout, on as TextBaseProps, ot as ShapeLineProps, p as SlideMasterChartProps, pn as textRuns, pt as ChartAreaProps, q as PatternPreset, qt as CommonObjectDescriptor, r as GroupProps, rn as SlideComment, rt as HyperlinkProps, s as Model3dCameraProps, sn as TextFitShrinkProps, st as BevelPresetType, t as AddSlideProps, tn as OverflowBoxOptions, tt as ConnectorType, u as MasterBulletProps, un as TextProps, ut as LightRigType, v as AnimationTrigger, vn as OleObjectProps, vt as ChartExGeography, w as TableCell3DProps, wn as ShapeGuide, wt as ChartPropsAxisSer, x as TransitionSoundProps, xn as ShapeAdjustHandleXY, xt as ChartMulti, y as PresetEffect, yn as ShapeAdjustHandle, yt as ChartExStatistics, z as GradientFillProps, zt as ChartPropsDataTable } from "./slide-js0QpRV-.js";
3
- import { a as PresentationProps, c as WriteFileProps, d as ThemeProps, i as PresLayout, l as WriteProps, n as PackagePart, o as SectionProps, r as PartsProps, s as WriteBaseProps, t as CustomPropertyValue, u as ThemeColorScheme } from "./pres-C5__xkDh.js";
4
- import { A as ptToHundredths, C as emuToInches, D as percentToEmu, E as inchesToEmu, M as SlideZoomProps, N as SummaryZoomProps, O as pixelsToEmu, P as ZoomBaseProps, S as coordToEmu, T as emuToPoints, _ as PERCENT_SCALE, a as ClipShape, b as StandardLayout, c as clipPath, d as DEFAULT_PX_PER_INCH, f as EMU_PER_INCH, g as HUNDREDTHS_PER_POINT, h as FIXED_PCT_PER_PERCENT, i as setDiagnosticHandler, j as SectionZoomProps, k as pointsToEmu, l as PresentationCore, m as Emu, n as DiagnosticHandler, o as FlatSide, p as EMU_PER_POINT, r as resetDiagnosticState, s as HalfDiscPreset, t as Diagnostic, u as ANGLE_UNITS_PER_DEGREE, v as POINTS_PER_INCH, w as emuToPixels, x as StandardLayoutName, y as STANDARD_LAYOUTS } from "./diagnostics-Du_s75MT.js";
5
- import { a as TsPptxError, c as DiagnosticCode, d as InvalidOptionErrorCode, f as MediaErrorCode, h as UnsupportedFeatureErrorCode, i as PackageReadError, l as ErrorCode, m as TsPptxCode, n as InvalidOptionError, o as TsPptxErrorOptions, p as PackageReadErrorCode, r as MediaError, s as UnsupportedFeatureError, t as InternalError, u as InternalErrorCode } from "./errors-PflMPWBn.js";
1
+ import { C as isChartType, S as isChartExType, _ as VALID_SHAPE_PRESETS, a as CONNECTOR_PRESET_NAME, b as asChartType, c as PLACEHOLDER_TYPE, d as SHAPE_NAME, f as SchemeColor, g as TextAnchor, h as TableStyle, i as CHART_NAME, l as PlaceholderType, m as SlideObjectType, n as AlignV, o as ChartType, p as ShapeType, r as BulletType, s as OutputType, t as AlignH, u as SCHEME_COLORS, v as WRITE_OUTPUT_TYPE, x as connectorPresetFor, y as ZIP_OUTPUT_TYPE } from "./enums-BUKTUB6V.js";
2
+ import { $ as ChartPropsAxisCat, $t as ShapeAdjustValue, A as TextVertType, At as NotesTextOptions, B as ShapeFillProps, Bt as TextMeasurement, C as ImageFillProps, Cn as TimeUnit, Ct as CommonObjectDescriptor, D as PatternPreset, Dt as CommentProps, E as PatternFillProps, Et as PlaceholderProps, F as ConnectorType, Ft as TableLayoutResult, G as ChartDataPointStyle, Gt as ImageBaseProps, H as StrokeProps, Ht as TextPropsOptions, I as FillOption, It as TextBaseProps, J as ChartExGeography, Jt as MediaType, K as ChartErrorBarOptions, Kt as ImageProps, L as HyperlinkActionJump, Lt as TextBulletProps, M as VAlign, Mt as ResolvedCommentAuthor, N as BorderProps, Nt as SlideComment, O as PositionProps, Ot as MeasureTextOptions, P as ConnectorProps, Pt as TableCellLayout, Q as ChartOpts, Qt as ShapeAdjustHandleXY, R as HyperlinkProps, Rt as TextFitShrinkProps, S as HexColor, St as OptsChartGridLine, T as Margin, Tt as ObjectNameProps, U as ChartAreaProps, Ut as textRun, V as ShapeLineProps, Vt as TextProps, W as ChartAxisTickMark, Wt as textRuns, X as ChartLineDash, Xt as ShapeAdjustHandle, Y as ChartExStatistics, Yt as OleObjectProps, Z as ChartMulti, Zt as ShapeAdjustHandlePolar, _ as DataOrPathRequiredProps, _n as RadarStyleAlias, _t as ChartPropsLegend, a as PresentationProps, an as BarGrouping, at as ChartPropsChartDoughnut, b as GradientStopProps, bt as LineCap, c as WriteFileProps, cn as DataLabelPosition, ct as ChartPropsChartPie, d as ThemeProps, dn as LegendPosition, dt as ChartPropsChartStock, en as ShapeConnectionSite, et as ChartPropsAxisSer, f as BackgroundOption, fn as LightRigDirection, ft as ChartPropsChartSurface, g as DataOrPathProps, gn as RadarStyle, gt as ChartPropsFillLine, h as Coord, hn as PresetMaterialType, ht as ChartPropsDataTable, i as PresLayout, in as BarDirection, it as ChartPropsChartBoxWhisker, j as ThemeColor, jt as OverflowBoxOptions, k as RadialGradientFillProps, kt as NotesProps, l as WriteProps, ln as DisplayBlanksAs, lt as ChartPropsChartRadar, m as Color, mn as LineDataSymbol, mt as ChartPropsDataLabel, n as PackagePart, nn as ShapeProps, nt as ChartPropsBase, o as SectionProps, on as BevelPresetType, ot as ChartPropsChartHistogram, p as BackgroundProps, pn as LightRigType, pt as ChartPropsChartWaterfall, q as ChartExBinning, qt as MediaProps, r as PartsProps, rn as Bar3DShape, rt as ChartPropsChartBar, s as WriteBaseProps, st as ChartPropsChartLine, t as CustomPropertyValue, tn as ShapeGuide, tt as ChartPropsAxisVal, u as ThemeColorScheme, ut as ChartPropsChartRegionMap, v as GeometryPoint, vt as ChartPropsTitle, w as LinearGradientFillProps, wt as ObjectLockProps, x as HAlign, xt as OptsChartData, y as GradientFillProps, yt as ChartSeriesOpts, z as ShadowProps, zt as TextGlowProps } from "./pres-C6qgOFAa.js";
3
+ import { A as TableCellDiagonals, C as AnimationTrigger, D as TransitionType, E as TransitionSoundProps, F as TableToSlidesDocument, I as TableToSlidesElement, L as TableToSlidesProps, M as TableProps, N as TableRow, O as TableCell, P as TableRowSlide, S as AnimationProps, T as TransitionProps, _ as MasterTextStyleProps, a as Slide, b as SlideMasterProps, c as SectionZoomProps, d as ZoomBaseProps, f as Model3dCameraProps, g as MasterTextStyleLevel, h as MasterBulletProps, i as ObjectOptions, j as TableCellProps, k as TableCell3DProps, l as SlideZoomProps, m as Model3dProps, n as GroupChildProps, o as SlideLayout, p as Model3dPoint, r as GroupProps, s as SlideObjectInfo, t as AddSlideProps, u as SummaryZoomProps, v as SlideMasterChartProps, w as PresetEffect, x as SlideNumberProps, y as SlideMasterObject } from "./slide-Dx2ZeVZ6.js";
4
+ import { _ as PackageReadErrorCode, a as InternalError, c as PackageReadError, d as UnsupportedFeatureError, f as DiagnosticCode, g as MediaErrorCode, h as InvalidOptionErrorCode, i as setDiagnosticHandler, l as TsPptxError, m as InternalErrorCode, n as DiagnosticHandler, o as InvalidOptionError, p as ErrorCode, r as resetDiagnosticState, s as MediaError, t as Diagnostic, u as TsPptxErrorOptions, v as TsPptxCode, y as UnsupportedFeatureErrorCode } from "./diagnostics-D8ot4Ei7.js";
5
+ import { A as pixelsToEmu, C as StandardLayoutName, D as emuToPoints, E as emuToPixels, M as ptToHundredths, O as inchesToEmu, S as StandardLayout, T as emuToInches, _ as HUNDREDTHS_PER_POINT, b as PERCENT_SCALE, c as ConstructFamily, g as FIXED_PCT_PER_PERCENT, h as Emu, i as ComposedSlide, j as pointsToEmu, k as percentToEmu, m as DEFAULT_PX_PER_INCH, n as Composed, p as ANGLE_UNITS_PER_DEGREE, r as ComposedPresentation, s as PresentationCore, t as ComposeOptions, v as MAX_COORDINATE_EMU, w as coordToEmu, x as STANDARD_LAYOUTS, y as MIN_COORDINATE_EMU } from "./entry-compose-DCnvBZz2.js";
6
+ import { a as EMU_PER_INCH, i as clipPath, n as FlatSide, o as EMU_PER_POINT, r as HalfDiscPreset, s as POINTS_PER_INCH, t as ClipShape } from "./clip-Bl01BPcN.js";
6
7
  //#region src/browser.d.ts
7
8
  /**
8
9
  * The browser entry, reached through the `browser` export condition — a bundler resolving the
9
- * bare `@shbernal/ts-pptx` specifier for the web lands here without naming this subpath.
10
+ * bare `pptx-ts` specifier for the web lands here without naming this subpath.
10
11
  *
11
12
  * Same authoring API as every other entry (see `entry-surface.ts`), plus one method that only
12
13
  * makes sense with a live DOM: {@link TsPptx.tableToSlides}. `writeFile` triggers a download
13
14
  * rather than touching a filesystem.
14
15
  */
15
- declare class TsPptx extends PresentationCore {
16
+ export declare class TsPptx extends PresentationCore {
16
17
  constructor();
17
18
  /**
18
19
  * Reproduces a rendered HTML `<table>` as a PowerPoint table — including column widths,
19
20
  * style, etc. — creating one or more slides as needed. Resolves `eleId` against the global
20
21
  * `document`, so it exists only on the browser/standalone build; the same conversion is
21
- * available anywhere there is a DOM as the free `tableToSlides` on `ts-pptx/html`, which
22
+ * available anywhere there is a DOM as the free `tableToSlides` on `pptx-ts/html`, which
22
23
  * also takes the element directly. The in-memory `slide.addTable(rows, opts)` path remains
23
24
  * the platform-agnostic way to build a table from data you already hold.
25
+ *
26
+ * That global lookup is why this stays rather than folding into the free function: reaching
27
+ * `document` without being handed one is the affordance the browser entry exists to give, and
28
+ * it is the one thing the platform-agnostic form deliberately will not do. The conversion
29
+ * itself lives in one place either way — both spellings call `genTableToSlides`.
24
30
  * @param {string} eleId - table HTML element ID
25
31
  * @param {TableToSlidesProps} options - generation options
26
32
  */
27
33
  tableToSlides(eleId: string, options?: TableToSlidesProps): void;
28
34
  }
35
+ /**
36
+ * Compose a presentation from the construct families it needs, on the browser adapter.
37
+ *
38
+ * The counterpart to {@link TsPptx}, which is composed with every family there is. This one costs
39
+ * what it carries: the core tier (text, shapes, images, groups, speaker notes) plus whatever
40
+ * `use` names, and nothing else reaches the bundle. `tableToSlides` is one of those families
41
+ * (`domTables`), so a deck that wants it composes it.
42
+ * @param {ComposeOptions} opts - the families to compose in, from `pptx-ts/families`
43
+ * @example
44
+ * import { createPresentation } from 'pptx-ts/browser'
45
+ * import { charts, domTables } from 'pptx-ts/families'
46
+ * const pres = createPresentation({ use: [charts, domTables] })
47
+ */
48
+ export declare function createPresentation<const Fs extends readonly ConstructFamily[] = []>(opts?: ComposeOptions<Fs>): Composed<Fs>;
29
49
  //#endregion
30
- export { ANGLE_UNITS_PER_DEGREE, AddSlideProps, AlignH, AlignV, AnimationProps, AnimationTrigger, BackgroundProps, type BevelPresetType, BorderProps, BulletType, CHART_NAME, CONNECTOR_PRESETS, CONNECTOR_PRESET_NAME, ChartAreaProps, ChartAxisTickMark, ChartDataPointStyle, ChartErrorBarOptions, ChartExBinning, ChartExGeography, ChartExStatistics, ChartLineDash, ChartMulti, ChartOpts, ChartPropsAxisCat, ChartPropsAxisSer, ChartPropsAxisVal, ChartPropsBase, ChartPropsChartBar, ChartPropsChartBoxWhisker, ChartPropsChartDoughnut, ChartPropsChartHistogram, ChartPropsChartLine, ChartPropsChartPie, ChartPropsChartRadar, ChartPropsChartRegionMap, ChartPropsChartStock, ChartPropsChartSurface, ChartPropsChartWaterfall, ChartPropsDataLabel, ChartPropsDataTable, ChartPropsFillLine, ChartPropsLegend, ChartPropsTitle, ChartSeriesOpts, ChartType, ClipShape, Color, CommentProps, CommonObjectDescriptor, ConnectorProps, ConnectorType, Coord, CustomPropertyValue, DEFAULT_PX_PER_INCH, DataOrPathProps, DataOrPathRequiredProps, type Diagnostic, type DiagnosticCode, type DiagnosticHandler, EMU_PER_INCH, EMU_PER_POINT, Emu, type ErrorCode, FIXED_PCT_PER_PERCENT, FlatSide, GeometryPoint, GradientFillProps, GradientStopProps, GroupChildProps, GroupProps, HAlign, HUNDREDTHS_PER_POINT, HalfDiscPreset, HexColor, HyperlinkActionJump, HyperlinkProps, ImageBaseProps, ImageFillProps, ImageProps, InternalError, type InternalErrorCode, InvalidOptionError, type InvalidOptionErrorCode, type LightRigDirection, type LightRigType, LineCap, LinearGradientFillProps, Margin, MasterBulletProps, MasterTextStyleLevel, MasterTextStyleProps, MeasureTextOptions, MediaError, type MediaErrorCode, MediaProps, MediaType, Model3dCameraProps, Model3dPoint, Model3dProps, NotesProps, NotesTextOptions, ObjectLockProps, ObjectNameProps, ObjectOptions, OleObjectProps, OptsChartData, OptsChartGridLine, OutputType, OverflowBoxOptions, PERCENT_SCALE, PLACEHOLDER_TYPE, POINTS_PER_INCH, PackagePart, PackageReadError, type PackageReadErrorCode, PartsProps, PatternFillProps, PatternPreset, PlaceholderProps, PlaceholderType, PositionProps, PresLayout, PresentationProps, PresetEffect, type PresetMaterialType, RadialGradientFillProps, ResolvedCommentAuthor, SCHEME_COLORS, SHAPE_NAME, STANDARD_LAYOUTS, SchemeColor, SectionProps, SectionZoomProps, ShadowProps, ShapeAdjustHandle, ShapeAdjustHandlePolar, ShapeAdjustHandleXY, ShapeAdjustValue, ShapeConnectionSite, ShapeFillProps, ShapeGuide, ShapeLineProps, ShapeProps, ShapeType, Slide, SlideComment, SlideLayout, SlideMasterChartProps, SlideMasterObject, SlideMasterProps, SlideNumberProps, SlideObjectType, SlideZoomProps, StandardLayout, StandardLayoutName, SummaryZoomProps, TableCell, TableCell3DProps, TableCellDiagonals, TableCellLayout, TableCellProps, TableLayoutResult, TableProps, TableRow, TableRowSlide, TableStyle, TableToSlidesDocument, TableToSlidesElement, TableToSlidesProps, TextAnchor, TextBaseProps, TextFitShrinkProps, TextGlowProps, TextMeasurement, TextProps, TextPropsOptions, TextVertType, ThemeColor, ThemeColorScheme, ThemeProps, TransitionProps, TransitionSoundProps, TransitionType, TsPptx, TsPptx as default, type TsPptxCode, TsPptxError, type TsPptxErrorOptions, UnsupportedFeatureError, type UnsupportedFeatureErrorCode, VALID_SHAPE_PRESETS, VAlign, WRITE_OUTPUT_TYPE, WriteBaseProps, WriteFileProps, WriteProps, ZIP_OUTPUT_TYPE, ZoomBaseProps, asChartType, clipPath, connectorPresetFor, coordToEmu, emuToInches, emuToPixels, emuToPoints, inchesToEmu, isChartExType, isChartType, percentToEmu, pixelsToEmu, pointsToEmu, ptToHundredths, resetDiagnosticState, setDiagnosticHandler, textRun, textRuns };
50
+ export { ANGLE_UNITS_PER_DEGREE, AddSlideProps, AlignH, AlignV, AnimationProps, AnimationTrigger, BackgroundOption, BackgroundProps, type Bar3DShape, type BarDirection, type BarGrouping, type BevelPresetType, BorderProps, BulletType, CHART_NAME, CONNECTOR_PRESET_NAME, ChartAreaProps, ChartAxisTickMark, ChartDataPointStyle, ChartErrorBarOptions, ChartExBinning, ChartExGeography, ChartExStatistics, ChartLineDash, ChartMulti, ChartOpts, ChartPropsAxisCat, ChartPropsAxisSer, ChartPropsAxisVal, ChartPropsBase, ChartPropsChartBar, ChartPropsChartBoxWhisker, ChartPropsChartDoughnut, ChartPropsChartHistogram, ChartPropsChartLine, ChartPropsChartPie, ChartPropsChartRadar, ChartPropsChartRegionMap, ChartPropsChartStock, ChartPropsChartSurface, ChartPropsChartWaterfall, ChartPropsDataLabel, ChartPropsDataTable, ChartPropsFillLine, ChartPropsLegend, ChartPropsTitle, ChartSeriesOpts, ChartType, ClipShape, Color, CommentProps, CommonObjectDescriptor, type ComposeOptions, type Composed, type ComposedPresentation, type ComposedSlide, ConnectorProps, ConnectorType, type ConstructFamily, Coord, CustomPropertyValue, DEFAULT_PX_PER_INCH, type DataLabelPosition, DataOrPathProps, DataOrPathRequiredProps, type Diagnostic, type DiagnosticCode, type DiagnosticHandler, type DisplayBlanksAs, EMU_PER_INCH, EMU_PER_POINT, Emu, type ErrorCode, FIXED_PCT_PER_PERCENT, FillOption, FlatSide, GeometryPoint, GradientFillProps, GradientStopProps, GroupChildProps, GroupProps, HAlign, HUNDREDTHS_PER_POINT, HalfDiscPreset, HexColor, HyperlinkActionJump, HyperlinkProps, ImageBaseProps, ImageFillProps, ImageProps, InternalError, type InternalErrorCode, InvalidOptionError, type InvalidOptionErrorCode, type LegendPosition, type LightRigDirection, type LightRigType, LineCap, type LineDataSymbol, LinearGradientFillProps, MAX_COORDINATE_EMU, MIN_COORDINATE_EMU, Margin, MasterBulletProps, MasterTextStyleLevel, MasterTextStyleProps, MeasureTextOptions, MediaError, type MediaErrorCode, MediaProps, MediaType, Model3dCameraProps, Model3dPoint, Model3dProps, NotesProps, NotesTextOptions, ObjectLockProps, ObjectNameProps, ObjectOptions, OleObjectProps, OptsChartData, OptsChartGridLine, OutputType, OverflowBoxOptions, PERCENT_SCALE, PLACEHOLDER_TYPE, POINTS_PER_INCH, PackagePart, PackageReadError, type PackageReadErrorCode, PartsProps, PatternFillProps, PatternPreset, PlaceholderProps, PlaceholderType, PositionProps, PresLayout, PresentationProps, PresetEffect, type PresetMaterialType, type RadarStyle, type RadarStyleAlias, RadialGradientFillProps, ResolvedCommentAuthor, SCHEME_COLORS, SHAPE_NAME, STANDARD_LAYOUTS, SchemeColor, SectionProps, SectionZoomProps, ShadowProps, ShapeAdjustHandle, ShapeAdjustHandlePolar, ShapeAdjustHandleXY, ShapeAdjustValue, ShapeConnectionSite, ShapeFillProps, ShapeGuide, ShapeLineProps, ShapeProps, ShapeType, Slide, SlideComment, SlideLayout, SlideMasterChartProps, SlideMasterObject, SlideMasterProps, SlideNumberProps, SlideObjectInfo, SlideObjectType, SlideZoomProps, StandardLayout, StandardLayoutName, StrokeProps, SummaryZoomProps, TableCell, TableCell3DProps, TableCellDiagonals, TableCellLayout, TableCellProps, TableLayoutResult, TableProps, TableRow, TableRowSlide, TableStyle, TableToSlidesDocument, TableToSlidesElement, TableToSlidesProps, TextAnchor, TextBaseProps, TextBulletProps, TextFitShrinkProps, TextGlowProps, TextMeasurement, TextProps, TextPropsOptions, TextVertType, ThemeColor, ThemeColorScheme, ThemeProps, type TimeUnit, TransitionProps, TransitionSoundProps, TransitionType, TsPptx as default, type TsPptxCode, TsPptxError, type TsPptxErrorOptions, UnsupportedFeatureError, type UnsupportedFeatureErrorCode, VALID_SHAPE_PRESETS, VAlign, WRITE_OUTPUT_TYPE, WriteBaseProps, WriteFileProps, WriteProps, ZIP_OUTPUT_TYPE, ZoomBaseProps, asChartType, clipPath, connectorPresetFor, coordToEmu, emuToInches, emuToPixels, emuToPoints, inchesToEmu, isChartExType, isChartType, percentToEmu, pixelsToEmu, pointsToEmu, ptToHundredths, resetDiagnosticState, setDiagnosticHandler, textRun, textRuns };
31
51
  //# sourceMappingURL=browser.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"browser.d.ts","names":[],"sources":["../src/browser.ts"],"mappings":";;;;;;;;;;;;;;cAaa,eAAe;EAC3B;;;;;;;;;;;EAcA,cAAc,eAAe,UAAS"}
1
+ {"version":3,"file":"browser.d.ts","names":[],"sources":["../src/browser.ts"],"mappings":";;;;;;;;;;;;;;;qBAsBa,eAAe;EAC3B;;;;;;;;;;;;;;;;EAqBA,cAAc,eAAe,UAAS;;;;;;;;;;;;;;;wBAkBvB,yBAAyB,oBAAoB,wBAC5D,OAAO,eAAe,MACpB,SAAS"}
package/dist/browser.js CHANGED
@@ -1,8 +1,8 @@
1
- import { _ as pointsToEmu, a as FIXED_PCT_PER_PERCENT, b as setDiagnosticHandler, c as POINTS_PER_INCH, d as emuToInches, f as emuToPixels, g as pixelsToEmu, h as percentToEmu, i as EMU_PER_POINT, l as STANDARD_LAYOUTS, m as inchesToEmu, n as DEFAULT_PX_PER_INCH, o as HUNDREDTHS_PER_POINT, p as emuToPoints, r as EMU_PER_INCH, s as PERCENT_SCALE, t as ANGLE_UNITS_PER_DEGREE, u as coordToEmu, v as ptToHundredths, y as resetDiagnosticState } from "./units-1kRzYShk.js";
2
- import { a as TsPptxError, i as PackageReadError, n as InvalidOptionError, o as UnsupportedFeatureError, r as MediaError, t as InternalError } from "./errors-Bvln0H-7.js";
3
- import { c as PresentationCore, i as fetchFontBytes, l as IMG_SVG_PLACEHOLDER, n as textRuns, r as clipPath, t as textRun } from "./text-CyetbF6p.js";
4
- import { $ as isChartExType, B as BulletType, G as SchemeColor, H as ChartType, J as TableStyle, K as ShapeType, Q as connectorPresetFor, R as AlignH, U as OutputType, V as CONNECTOR_PRESETS, W as PlaceholderType, X as VALID_SHAPE_PRESETS, Y as TextAnchor, Z as asChartType, et as isChartType, q as SlideObjectType, z as AlignV } from "./units-internal-Dg95w_YD.js";
5
- import { t as genTableToSlides } from "./html-dom-B0I0QSbU.js";
1
+ import { a as TsPptxError, c as setDiagnosticHandler, i as PackageReadError, n as InvalidOptionError, o as UnsupportedFeatureError, r as MediaError, s as resetDiagnosticState, t as InternalError } from "./errors-C4oENPcu.js";
2
+ import { A as inchesToEmu, C as MIN_COORDINATE_EMU, D as emuToInches, E as coordToEmu, F as EMU_PER_INCH, I as EMU_PER_POINT, L as POINTS_PER_INCH, M as pixelsToEmu, N as pointsToEmu, O as emuToPixels, P as ptToHundredths, S as MAX_COORDINATE_EMU, T as STANDARD_LAYOUTS, _ as isChartType, a as ChartType, b as FIXED_PCT_PER_PERCENT, c as SchemeColor, d as TableStyle, f as TextAnchor, g as isChartExType, h as connectorPresetFor, i as BulletType, j as percentToEmu, k as emuToPoints, l as ShapeType, m as asChartType, n as AlignH, o as OutputType, p as VALID_SHAPE_PRESETS, r as AlignV, s as PlaceholderType, u as SlideObjectType, v as ANGLE_UNITS_PER_DEGREE, w as PERCENT_SCALE, x as HUNDREDTHS_PER_POINT, y as DEFAULT_PX_PER_INCH } from "./table-cell-margins-EVg0EwxT.js";
3
+ import { c as ALL_CONSTRUCT_FAMILIES, d as IMG_SVG_PLACEHOLDER, i as fetchFontBytes, l as composePresentation, n as textRuns, r as clipPath, t as textRun, u as PresentationCore } from "./text-KnLOtEEu.js";
4
+ import { r as PPTX_CONTENT_TYPE } from "./zip-CKd8ihcf.js";
5
+ import { t as tableDomFamily } from "./table-dom-BTDP3lEP.js";
6
6
  //#region src/runtime/browser.ts
7
7
  function createBrowserRuntime() {
8
8
  return {
@@ -30,11 +30,11 @@ async function loadMedia(rel) {
30
30
  });
31
31
  }
32
32
  async function createSvgPngPreview(rel) {
33
- return await new Promise((resolve, reject) => {
33
+ return await new Promise((resolve) => {
34
34
  const image = new Image();
35
35
  const fail = (reason) => {
36
36
  rel.data = IMG_SVG_PLACEHOLDER;
37
- reject(new MediaError("media/svg-preview-failed", `Unable to load image (image.onerror): ${rel.path}${reason ? ` - ${String(reason)}` : ""}`));
37
+ resolve(new MediaError("media/svg-preview-failed", `Unable to load image (image.onerror): ${rel.path}${reason ? ` - ${String(reason)}` : ""}`));
38
38
  };
39
39
  image.onload = () => {
40
40
  if (image.width + image.height === 0) {
@@ -52,7 +52,7 @@ async function createSvgPngPreview(rel) {
52
52
  ctx.drawImage(image, 0, 0);
53
53
  try {
54
54
  rel.data = canvas.toDataURL(rel.type);
55
- resolve("done");
55
+ resolve(null);
56
56
  } catch (ex) {
57
57
  fail(ex);
58
58
  }
@@ -66,7 +66,7 @@ async function writeFile(fileName, data) {
66
66
  eleLink.setAttribute("style", "display:none;");
67
67
  eleLink.dataset["interception"] = "off";
68
68
  document.body.appendChild(eleLink);
69
- const url = window.URL.createObjectURL(new Blob([data], { type: "application/vnd.openxmlformats-officedocument.presentationml.presentation" }));
69
+ const url = window.URL.createObjectURL(new Blob([data], { type: PPTX_CONTENT_TYPE }));
70
70
  eleLink.href = url;
71
71
  eleLink.download = fileName;
72
72
  eleLink.click();
@@ -79,8 +79,14 @@ async function writeFile(fileName, data) {
79
79
  //#endregion
80
80
  //#region src/browser.ts
81
81
  /**
82
+ * The browser authoring entry, which the bare `pptx-ts` specifier resolves to under the
83
+ * `browser` export condition.
84
+ *
85
+ * @module
86
+ */
87
+ /**
82
88
  * The browser entry, reached through the `browser` export condition — a bundler resolving the
83
- * bare `@shbernal/ts-pptx` specifier for the web lands here without naming this subpath.
89
+ * bare `pptx-ts` specifier for the web lands here without naming this subpath.
84
90
  *
85
91
  * Same authoring API as every other entry (see `entry-surface.ts`), plus one method that only
86
92
  * makes sense with a live DOM: {@link TsPptx.tableToSlides}. `writeFile` triggers a download
@@ -88,23 +94,44 @@ async function writeFile(fileName, data) {
88
94
  */
89
95
  var TsPptx = class extends PresentationCore {
90
96
  constructor() {
91
- super(createBrowserRuntime());
97
+ super(createBrowserRuntime(), [...ALL_CONSTRUCT_FAMILIES, tableDomFamily]);
92
98
  }
93
99
  /**
94
100
  * Reproduces a rendered HTML `<table>` as a PowerPoint table — including column widths,
95
101
  * style, etc. — creating one or more slides as needed. Resolves `eleId` against the global
96
102
  * `document`, so it exists only on the browser/standalone build; the same conversion is
97
- * available anywhere there is a DOM as the free `tableToSlides` on `ts-pptx/html`, which
103
+ * available anywhere there is a DOM as the free `tableToSlides` on `pptx-ts/html`, which
98
104
  * also takes the element directly. The in-memory `slide.addTable(rows, opts)` path remains
99
105
  * the platform-agnostic way to build a table from data you already hold.
106
+ *
107
+ * That global lookup is why this stays rather than folding into the free function: reaching
108
+ * `document` without being handed one is the affordance the browser entry exists to give, and
109
+ * it is the one thing the platform-agnostic form deliberately will not do. The conversion
110
+ * itself lives in one place either way — both spellings call `genTableToSlides`.
100
111
  * @param {string} eleId - table HTML element ID
101
112
  * @param {TableToSlidesProps} options - generation options
102
113
  */
103
114
  tableToSlides(eleId, options = {}) {
104
- genTableToSlides(this, eleId, options);
115
+ this.familyAuthor("tableToSlides")(eleId, options);
105
116
  }
106
117
  };
118
+ /**
119
+ * Compose a presentation from the construct families it needs, on the browser adapter.
120
+ *
121
+ * The counterpart to {@link TsPptx}, which is composed with every family there is. This one costs
122
+ * what it carries: the core tier (text, shapes, images, groups, speaker notes) plus whatever
123
+ * `use` names, and nothing else reaches the bundle. `tableToSlides` is one of those families
124
+ * (`domTables`), so a deck that wants it composes it.
125
+ * @param {ComposeOptions} opts - the families to compose in, from `pptx-ts/families`
126
+ * @example
127
+ * import { createPresentation } from 'pptx-ts/browser'
128
+ * import { charts, domTables } from 'pptx-ts/families'
129
+ * const pres = createPresentation({ use: [charts, domTables] })
130
+ */
131
+ function createPresentation(opts) {
132
+ return composePresentation(createBrowserRuntime(), opts);
133
+ }
107
134
  //#endregion
108
- export { ANGLE_UNITS_PER_DEGREE, AlignH, AlignV, BulletType, CONNECTOR_PRESETS, ChartType, DEFAULT_PX_PER_INCH, EMU_PER_INCH, EMU_PER_POINT, FIXED_PCT_PER_PERCENT, HUNDREDTHS_PER_POINT, InternalError, InvalidOptionError, MediaError, OutputType, PERCENT_SCALE, POINTS_PER_INCH, PackageReadError, PlaceholderType, STANDARD_LAYOUTS, SchemeColor, ShapeType, SlideObjectType, TableStyle, TextAnchor, TsPptx, TsPptx as default, TsPptxError, UnsupportedFeatureError, VALID_SHAPE_PRESETS, asChartType, clipPath, connectorPresetFor, coordToEmu, emuToInches, emuToPixels, emuToPoints, inchesToEmu, isChartExType, isChartType, percentToEmu, pixelsToEmu, pointsToEmu, ptToHundredths, resetDiagnosticState, setDiagnosticHandler, textRun, textRuns };
135
+ export { ANGLE_UNITS_PER_DEGREE, AlignH, AlignV, BulletType, ChartType, DEFAULT_PX_PER_INCH, EMU_PER_INCH, EMU_PER_POINT, FIXED_PCT_PER_PERCENT, HUNDREDTHS_PER_POINT, InternalError, InvalidOptionError, MAX_COORDINATE_EMU, MIN_COORDINATE_EMU, MediaError, OutputType, PERCENT_SCALE, POINTS_PER_INCH, PackageReadError, PlaceholderType, STANDARD_LAYOUTS, SchemeColor, ShapeType, SlideObjectType, TableStyle, TextAnchor, TsPptx, TsPptx as default, TsPptxError, UnsupportedFeatureError, VALID_SHAPE_PRESETS, asChartType, clipPath, connectorPresetFor, coordToEmu, createPresentation, emuToInches, emuToPixels, emuToPoints, inchesToEmu, isChartExType, isChartType, percentToEmu, pixelsToEmu, pointsToEmu, ptToHundredths, resetDiagnosticState, setDiagnosticHandler, textRun, textRuns };
109
136
 
110
137
  //# sourceMappingURL=browser.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"browser.js","names":[],"sources":["../src/runtime/browser.ts","../src/browser.ts"],"sourcesContent":["import { IMG_SVG_PLACEHOLDER } from '../media/placeholders.js'\nimport { MediaError } from '../errors.js'\nimport type { SlideRelMedia } from '../types/internal.js'\nimport type { RuntimeAdapter } from './types.js'\nimport { fetchFontBytes } from './fetch-media.js'\n\nexport function createBrowserRuntime(): RuntimeAdapter {\n\treturn {\n\t\twriteFileOutputType: null,\n\t\tloadMedia,\n\t\tcreateSvgPngPreview,\n\t\twriteFile,\n\t\tloadFontData: fetchFontBytes,\n\t}\n}\n\n/**\n * Returns a `data:` URI, not raw base64 — see {@link RuntimeAdapter.loadMedia}. The `FileReader`\n * is what makes this adapter's own implementation worth keeping: it decodes the blob off the main\n * thread, where the shared `fetchMediaBase64` would encode the whole payload synchronously.\n */\nasync function loadMedia(rel: SlideRelMedia & { path: string }): Promise<string> {\n\tconst response = await fetch(rel.path)\n\tif (!response.ok) throw new MediaError('media/fetch-failed', `Unable to load image (fetch): ${rel.path}`)\n\tconst blob = await response.blob()\n\n\treturn await new Promise<string>((resolve, reject) => {\n\t\tconst reader = new FileReader()\n\t\treader.onloadend = () => resolve(reader.result as string)\n\t\treader.onerror = () =>\n\t\t\treject(new MediaError('media/decode-failed', `Unable to load image (FileReader): ${rel.path}`))\n\t\treader.readAsDataURL(blob)\n\t})\n}\n\nasync function createSvgPngPreview(rel: SlideRelMedia): Promise<string> {\n\treturn await new Promise((resolve, reject) => {\n\t\tconst image = new Image()\n\t\tconst fail = (reason?: unknown) => {\n\t\t\trel.data = IMG_SVG_PLACEHOLDER\n\t\t\treject(\n\t\t\t\tnew MediaError(\n\t\t\t\t\t'media/svg-preview-failed',\n\t\t\t\t\t`Unable to load image (image.onerror): ${rel.path}${reason ? ` - ${String(reason)}` : ''}`\n\t\t\t\t)\n\t\t\t)\n\t\t}\n\n\t\timage.onload = () => {\n\t\t\tif (image.width + image.height === 0) {\n\t\t\t\tfail('h/w=0')\n\t\t\t\treturn\n\t\t\t}\n\t\t\tconst canvas = document.createElement('CANVAS') as HTMLCanvasElement\n\t\t\tconst ctx = canvas.getContext('2d')\n\t\t\tif (!ctx) {\n\t\t\t\tfail('canvas 2d context unavailable')\n\t\t\t\treturn\n\t\t\t}\n\t\t\tcanvas.width = image.width\n\t\t\tcanvas.height = image.height\n\t\t\tctx.drawImage(image, 0, 0)\n\t\t\ttry {\n\t\t\t\t// `rel.type` is `image/png`, not the SVG's type, so this is a valid canvas output\n\t\t\t\t// type and not an `image/svg+xml` that silently falls back to PNG.\n\t\t\t\t// `createSvgPngPreview` is only called on a rel flagged `isSvgPng` — all three\n\t\t\t\t// call sites in `gen/media.ts` filter on it — and the only two places that\n\t\t\t\t// create such a rel (`gen/define/image.ts`, `gen/define/text.ts`) set the\n\t\t\t\t// *fallback's* type, since that is the part this writes. The SVG keeps its own\n\t\t\t\t// rel beside it.\n\t\t\t\trel.data = canvas.toDataURL(rel.type)\n\t\t\t\tresolve('done')\n\t\t\t} catch (ex) {\n\t\t\t\tfail(ex)\n\t\t\t}\n\t\t}\n\t\timage.onerror = () => fail()\n\t\timage.src = typeof rel.data === 'string' ? rel.data : IMG_SVG_PLACEHOLDER\n\t})\n}\n\nasync function writeFile(fileName: string, data: string | ArrayBuffer | Blob | Uint8Array): Promise<string> {\n\tconst eleLink = document.createElement('a')\n\teleLink.setAttribute('style', 'display:none;')\n\teleLink.dataset['interception'] = 'off'\n\tdocument.body.appendChild(eleLink)\n\n\tconst url = window.URL.createObjectURL(\n\t\tnew Blob([data as Blob], { type: 'application/vnd.openxmlformats-officedocument.presentationml.presentation' })\n\t)\n\teleLink.href = url\n\teleLink.download = fileName\n\teleLink.click()\n\n\tsetTimeout(() => {\n\t\twindow.URL.revokeObjectURL(url)\n\t\tdocument.body.removeChild(eleLink)\n\t}, 100)\n\n\treturn fileName\n}\n","import PresentationCore from './presentation.js'\nimport { createBrowserRuntime } from './runtime/browser.js'\nimport { genTableToSlides } from './gen/table/html-dom.js'\nimport type { TableToSlidesProps } from './types/index.js'\n\n/**\n * The browser entry, reached through the `browser` export condition — a bundler resolving the\n * bare `@shbernal/ts-pptx` specifier for the web lands here without naming this subpath.\n *\n * Same authoring API as every other entry (see `entry-surface.ts`), plus one method that only\n * makes sense with a live DOM: {@link TsPptx.tableToSlides}. `writeFile` triggers a download\n * rather than touching a filesystem.\n */\nexport class TsPptx extends PresentationCore {\n\tconstructor() {\n\t\tsuper(createBrowserRuntime())\n\t}\n\n\t/**\n\t * Reproduces a rendered HTML `<table>` as a PowerPoint table — including column widths,\n\t * style, etc. — creating one or more slides as needed. Resolves `eleId` against the global\n\t * `document`, so it exists only on the browser/standalone build; the same conversion is\n\t * available anywhere there is a DOM as the free `tableToSlides` on `ts-pptx/html`, which\n\t * also takes the element directly. The in-memory `slide.addTable(rows, opts)` path remains\n\t * the platform-agnostic way to build a table from data you already hold.\n\t * @param {string} eleId - table HTML element ID\n\t * @param {TableToSlidesProps} options - generation options\n\t */\n\ttableToSlides(eleId: string, options: TableToSlidesProps = {}): void {\n\t\t// @note `options.verbose` (a documented dev-only flag on TableToSlidesProps) is read\n\t\t// inside genTableToSlides to trace the auto-paging layout process.\n\t\tgenTableToSlides(this, eleId, options)\n\t}\n}\n\nexport { TsPptx as default }\nexport * from './entry-surface.js'\n"],"mappings":";;;;;;AAMA,SAAgB,uBAAuC;CACtD,OAAO;EACN,qBAAqB;EACrB;EACA;EACA;EACA,cAAc;CACf;AACD;;;;;;AAOA,eAAe,UAAU,KAAwD;CAChF,MAAM,WAAW,MAAM,MAAM,IAAI,IAAI;CACrC,IAAI,CAAC,SAAS,IAAI,MAAM,IAAI,WAAW,sBAAsB,iCAAiC,IAAI,MAAM;CACxG,MAAM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IAAY,GAAG,EAAE,MAAM,4EAA4E,CAAC,CAC/G;CACA,QAAQ,OAAO;CACf,QAAQ,WAAW;CACnB,QAAQ,MAAM;CAEd,iBAAiB;EAChB,OAAO,IAAI,gBAAgB,GAAG;EAC9B,SAAS,KAAK,YAAY,OAAO;CAClC,GAAG,GAAG;CAEN,OAAO;AACR;;;;;;;;;;;ACvFA,IAAa,SAAb,cAA4B,iBAAiB;CAC5C,cAAc;EACb,MAAM,qBAAqB,CAAC;CAC7B;;;;;;;;;;;CAYA,cAAc,OAAe,UAA8B,CAAC,GAAS;EAGpE,iBAAiB,MAAM,OAAO,OAAO;CACtC;AACD"}
1
+ {"version":3,"file":"browser.js","names":[],"sources":["../src/runtime/browser.ts","../src/browser.ts"],"sourcesContent":["import { IMG_SVG_PLACEHOLDER } from '../media/placeholders.js'\nimport { MediaError } from '../errors.js'\nimport type { SlideRelMedia } from '../types/internal.js'\nimport type { RuntimeAdapter } from './types.js'\nimport { fetchFontBytes } from './fetch-media.js'\nimport { PPTX_CONTENT_TYPE } from '../ooxml/pptx-content-type.js'\n\nexport function createBrowserRuntime(): RuntimeAdapter {\n\treturn {\n\t\twriteFileOutputType: null,\n\t\tloadMedia,\n\t\tcreateSvgPngPreview,\n\t\twriteFile,\n\t\tloadFontData: fetchFontBytes,\n\t}\n}\n\n/**\n * Returns a `data:` URI, not raw base64 — see {@link RuntimeAdapter.loadMedia}. The `FileReader`\n * is what makes this adapter's own implementation worth keeping: it decodes the blob off the main\n * thread, where the shared `fetchMediaBase64` would encode the whole payload synchronously.\n */\nasync function loadMedia(rel: SlideRelMedia & { path: string }): Promise<string> {\n\tconst response = await fetch(rel.path)\n\tif (!response.ok) throw new MediaError('media/fetch-failed', `Unable to load image (fetch): ${rel.path}`)\n\tconst blob = await response.blob()\n\n\treturn await new Promise<string>((resolve, reject) => {\n\t\tconst reader = new FileReader()\n\t\treader.onloadend = () => resolve(reader.result as string)\n\t\treader.onerror = () =>\n\t\t\treject(new MediaError('media/decode-failed', `Unable to load image (FileReader): ${rel.path}`))\n\t\treader.readAsDataURL(blob)\n\t})\n}\n\nasync function createSvgPngPreview(rel: SlideRelMedia): Promise<MediaError | null> {\n\treturn await new Promise((resolve) => {\n\t\tconst image = new Image()\n\t\t// Resolves, as the Node and neutral adapters do. It used to reject, so the same failure\n\t\t// reached the caller three ways depending on runtime and on how the SVG arrived.\n\t\tconst fail = (reason?: unknown) => {\n\t\t\trel.data = IMG_SVG_PLACEHOLDER\n\t\t\tresolve(\n\t\t\t\tnew MediaError(\n\t\t\t\t\t'media/svg-preview-failed',\n\t\t\t\t\t`Unable to load image (image.onerror): ${rel.path}${reason ? ` - ${String(reason)}` : ''}`\n\t\t\t\t)\n\t\t\t)\n\t\t}\n\n\t\timage.onload = () => {\n\t\t\tif (image.width + image.height === 0) {\n\t\t\t\tfail('h/w=0')\n\t\t\t\treturn\n\t\t\t}\n\t\t\tconst canvas = document.createElement('CANVAS') as HTMLCanvasElement\n\t\t\tconst ctx = canvas.getContext('2d')\n\t\t\tif (!ctx) {\n\t\t\t\tfail('canvas 2d context unavailable')\n\t\t\t\treturn\n\t\t\t}\n\t\t\tcanvas.width = image.width\n\t\t\tcanvas.height = image.height\n\t\t\tctx.drawImage(image, 0, 0)\n\t\t\ttry {\n\t\t\t\t// `rel.type` is `image/png`, not the SVG's type, so this is a valid canvas output\n\t\t\t\t// type and not an `image/svg+xml` that silently falls back to PNG.\n\t\t\t\t// `createSvgPngPreview` is only called on a rel flagged `isSvgPng` — all three\n\t\t\t\t// call sites in `gen/media.ts` filter on it — and the only two places that\n\t\t\t\t// create such a rel (`gen/define/image.ts`, `gen/define/text.ts`) set the\n\t\t\t\t// *fallback's* type, since that is the part this writes. The SVG keeps its own\n\t\t\t\t// rel beside it.\n\t\t\t\trel.data = canvas.toDataURL(rel.type)\n\t\t\t\tresolve(null)\n\t\t\t} catch (ex) {\n\t\t\t\tfail(ex)\n\t\t\t}\n\t\t}\n\t\timage.onerror = () => fail()\n\t\timage.src = typeof rel.data === 'string' ? rel.data : IMG_SVG_PLACEHOLDER\n\t})\n}\n\nasync function writeFile(fileName: string, data: string | ArrayBuffer | Blob | Uint8Array): Promise<string> {\n\tconst eleLink = document.createElement('a')\n\teleLink.setAttribute('style', 'display:none;')\n\teleLink.dataset['interception'] = 'off'\n\tdocument.body.appendChild(eleLink)\n\n\tconst url = window.URL.createObjectURL(new Blob([data as Blob], { type: PPTX_CONTENT_TYPE }))\n\teleLink.href = url\n\teleLink.download = fileName\n\teleLink.click()\n\n\tsetTimeout(() => {\n\t\twindow.URL.revokeObjectURL(url)\n\t\tdocument.body.removeChild(eleLink)\n\t}, 100)\n\n\treturn fileName\n}\n","/**\n * The browser authoring entry, which the bare `pptx-ts` specifier resolves to under the\n * `browser` export condition.\n *\n * @module\n */\nimport PresentationCore from './presentation.js'\nimport { composePresentation, type ComposeOptions, type Composed } from './entry-compose.js'\nimport type { ConstructFamily } from './families/shared.js'\nimport { ALL_CONSTRUCT_FAMILIES } from './entry-families.js'\nimport { createBrowserRuntime } from './runtime/browser.js'\nimport { tableDomFamily } from './families/table-dom.js'\nimport type { TableToSlidesProps } from './types/index.js'\n\n/**\n * The browser entry, reached through the `browser` export condition — a bundler resolving the\n * bare `pptx-ts` specifier for the web lands here without naming this subpath.\n *\n * Same authoring API as every other entry (see `entry-surface.ts`), plus one method that only\n * makes sense with a live DOM: {@link TsPptx.tableToSlides}. `writeFile` triggers a download\n * rather than touching a filesystem.\n */\nexport class TsPptx extends PresentationCore {\n\tconstructor() {\n\t\t// The table family's live-DOM half is composed here and nowhere else: it is the one part of\n\t\t// the authoring surface that needs a `document`.\n\t\tsuper(createBrowserRuntime(), [...ALL_CONSTRUCT_FAMILIES, tableDomFamily])\n\t}\n\n\t/**\n\t * Reproduces a rendered HTML `<table>` as a PowerPoint table — including column widths,\n\t * style, etc. — creating one or more slides as needed. Resolves `eleId` against the global\n\t * `document`, so it exists only on the browser/standalone build; the same conversion is\n\t * available anywhere there is a DOM as the free `tableToSlides` on `pptx-ts/html`, which\n\t * also takes the element directly. The in-memory `slide.addTable(rows, opts)` path remains\n\t * the platform-agnostic way to build a table from data you already hold.\n\t *\n\t * That global lookup is why this stays rather than folding into the free function: reaching\n\t * `document` without being handed one is the affordance the browser entry exists to give, and\n\t * it is the one thing the platform-agnostic form deliberately will not do. The conversion\n\t * itself lives in one place either way — both spellings call `genTableToSlides`.\n\t * @param {string} eleId - table HTML element ID\n\t * @param {TableToSlidesProps} options - generation options\n\t */\n\ttableToSlides(eleId: string, options: TableToSlidesProps = {}): void {\n\t\tthis.familyAuthor('tableToSlides')(eleId, options)\n\t}\n}\n\n/**\n * Compose a presentation from the construct families it needs, on the browser adapter.\n *\n * The counterpart to {@link TsPptx}, which is composed with every family there is. This one costs\n * what it carries: the core tier (text, shapes, images, groups, speaker notes) plus whatever\n * `use` names, and nothing else reaches the bundle. `tableToSlides` is one of those families\n * (`domTables`), so a deck that wants it composes it.\n * @param {ComposeOptions} opts - the families to compose in, from `pptx-ts/families`\n * @example\n * import { createPresentation } from 'pptx-ts/browser'\n * import { charts, domTables } from 'pptx-ts/families'\n * const pres = createPresentation({ use: [charts, domTables] })\n */\nexport function createPresentation<const Fs extends readonly ConstructFamily[] = []>(\n\topts?: ComposeOptions<Fs>\n): Composed<Fs> {\n\treturn composePresentation(createBrowserRuntime(), opts)\n}\n\nexport { TsPptx as default }\nexport * from './entry-surface.js'\n"],"mappings":";;;;;;AAOA,SAAgB,uBAAuC;CACtD,OAAO;EACN,qBAAqB;EACrB;EACA;EACA;EACA,cAAc;CACf;AACD;;;;;;AAOA,eAAe,UAAU,KAAwD;CAChF,MAAM,WAAW,MAAM,MAAM,IAAI,IAAI;CACrC,IAAI,CAAC,SAAS,IAAI,MAAM,IAAI,WAAW,sBAAsB,iCAAiC,IAAI,MAAM;CACxG,MAAM,OAAO,MAAM,SAAS,KAAK;CAEjC,OAAO,MAAM,IAAI,SAAiB,SAAS,WAAW;EACrD,MAAM,SAAS,IAAI,WAAW;E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d,iBAAiB;EAChB,OAAO,IAAI,gBAAgB,GAAG;EAC9B,SAAS,KAAK,YAAY,OAAO;CAClC,GAAG,GAAG;CAEN,OAAO;AACR;;;;;;;;;;;;;;;;;AC/EA,IAAa,SAAb,cAA4B,iBAAiB;CAC5C,cAAc;EAGb,MAAM,qBAAqB,GAAG,CAAC,GAAG,wBAAwB,cAAc,CAAC;CAC1E;;;;;;;;;;;;;;;;CAiBA,cAAc,OAAe,UAA8B,CAAC,GAAS;EACpE,KAAK,aAAa,eAAe,CAAC,CAAC,OAAO,OAAO;CAClD;AACD;;;;;;;;;;;;;;AAeA,SAAgB,mBACf,MACe;CACf,OAAO,oBAAoB,qBAAqB,GAAG,IAAI;AACxD"}
@@ -0,0 +1,67 @@
1
+ import { v as GeometryPoint } from "./pres-C6qgOFAa.js";
2
+ //#region src/ooxml/emu.d.ts
3
+ /**
4
+ * The fixed ratios between English Metric Units, points and inches.
5
+ *
6
+ * `units.ts` publishes them, but it also holds the unit converters, which warn and throw, so it
7
+ * imports `diagnostics.ts` and `errors.ts` at run time. A schema fact in `ooxml/` that only needs
8
+ * a ratio (`body-insets.ts`) took both along with it. This module imports nothing, and `units.ts`
9
+ * re-exports it, so the public names are unchanged.
10
+ */
11
+ /** EMU in one inch. */
12
+ declare const EMU_PER_INCH = 914400;
13
+ /** EMU in one point. */
14
+ declare const EMU_PER_POINT = 12700;
15
+ /** Points in one inch. */
16
+ declare const POINTS_PER_INCH = 72;
17
+ //#endregion
18
+ //#region src/clip.d.ts
19
+ /**
20
+ * Which edge of the box is the half-disc's FLAT side; the arc bulges toward the opposite edge.
21
+ * `'right'` = flat right edge, arc bulging left.
22
+ */
23
+ type FlatSide = 'left' | 'right';
24
+ /**
25
+ * Which half-disc proportion to trace. Both are flat-on-one-edge, bulging half-discs whose arc
26
+ * reaches the opposite edge near mid-height; they differ only in how far the arc reaches.
27
+ * - `'deep'` — the arc spans about 32% of the box width, symmetric about mid-height (the default).
28
+ * - `'shallow'` — the arc spans about 13%, slightly asymmetric, with its apex just below mid-height.
29
+ */
30
+ type HalfDiscPreset = 'deep' | 'shallow';
31
+ /** A named clip silhouette, resolved to a `points` path by {@link clipPath}. */
32
+ type ClipShape =
33
+ /**
34
+ * A rectangle with one side replaced by an elliptical arc that bulges toward the opposite
35
+ * edge, reaching it near mid-height — the "D" a picture placeholder cuts on a cover slide.
36
+ */
37
+ {
38
+ kind: 'half-disc';
39
+ flat: FlatSide;
40
+ preset?: HalfDiscPreset;
41
+ };
42
+ /**
43
+ * Resolve a {@link ClipShape} to a freeform `points` path filling a `w × h` box, ready to hand
44
+ * to `addImage({ points })`.
45
+ *
46
+ * `w`/`h` are the image box's size **in inches** and must match the `w`/`h` the picture is drawn
47
+ * at — the path is emitted in the box's own coordinate space, not normalized (see the module
48
+ * note above).
49
+ * @param {ClipShape} shape - the named silhouette and its options
50
+ * @param {number} w - image box width (inches)
51
+ * @param {number} h - image box height (inches)
52
+ * @returns {GeometryPoint[]} the freeform path, for `addImage({ points })`
53
+ * @throws {InvalidOptionError} `clip/invalid-shape` when `kind`, `flat` or `preset` is not one the
54
+ * silhouette names. From JavaScript an unknown preset used to fail reading a field off
55
+ * `undefined`, an unknown kind returned nothing and an unknown flat side traced the right-flat path.
56
+ * @example
57
+ * const w = 5.22, h = 7.5
58
+ * slide.addImage({
59
+ * path: 'cover.jpg', x: 0, y: 0, w, h,
60
+ * points: clipPath({ kind: 'half-disc', flat: 'right' }, w, h),
61
+ * sizing: { type: 'cover' }, // center-crop the photo into the "D"
62
+ * })
63
+ */
64
+ declare function clipPath(shape: ClipShape, w: number, h: number): GeometryPoint[];
65
+ //#endregion
66
+ export { EMU_PER_INCH as a, clipPath as i, FlatSide as n, EMU_PER_POINT as o, HalfDiscPreset as r, POINTS_PER_INCH as s, ClipShape as t };
67
+ //# sourceMappingURL=clip-Bl01BPcN.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"clip-Bl01BPcN.d.ts","names":[],"sources":["../src/ooxml/emu.ts","../src/clip.ts"],"mappings":";;;;;;;;;;;cAUa;;cAEA;;cAEA;;;;;;;KCgBD;;;;;;;KAQA;;KAGA;;;;;;EAKT;EAAmB,MAAM;EAAU,SAAS;;;;;;;;;;;;;;;;;;;;;;;;iBAyH/B,SAAS,OAAO,WAAW,WAAW,YAAY"}