@shbernal/ts-pptx 3.0.0 → 3.1.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.
- package/README.md +24 -0
- package/dist/{autopage-MxulehqQ.js → autopage-QQyfRtoK.js} +3 -3
- package/dist/{autopage-MxulehqQ.js.map → autopage-QQyfRtoK.js.map} +1 -1
- package/dist/browser.d.ts +5 -5
- package/dist/browser.d.ts.map +1 -1
- package/dist/browser.js +5 -5
- package/dist/{diagnostics-BqBTmA3a.d.ts → diagnostics-PMINsVP6.d.ts} +7 -7
- package/dist/{diagnostics-BqBTmA3a.d.ts.map → diagnostics-PMINsVP6.d.ts.map} +1 -1
- package/dist/{enums-oLLeaSW3.d.ts → enums-CoXnxiCI.d.ts} +5 -5
- package/dist/{enums-oLLeaSW3.d.ts.map → enums-CoXnxiCI.d.ts.map} +1 -1
- package/dist/{errors-BENA-Xuw.d.ts → errors-BeUEkNWL.d.ts} +24 -2
- package/dist/errors-BeUEkNWL.d.ts.map +1 -0
- package/dist/{errors-DGE9zh3U.js → errors-Bvln0H-7.js} +21 -2
- package/dist/errors-Bvln0H-7.js.map +1 -0
- package/dist/{fit-DGSwMMNs.js → fit-DhMbQG5O.js} +0 -0
- package/dist/fit-DhMbQG5O.js.map +1 -0
- package/dist/{html-dom--J-Xuucf.js → html-dom-DajBuobe.js} +5 -5
- package/dist/html-dom-DajBuobe.js.map +1 -0
- package/dist/html.d.ts +3 -3
- package/dist/html.js +2 -2
- package/dist/index.d.ts +5 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -5
- package/dist/inspect.d.ts +1 -1
- package/dist/inspect.js +4 -4
- package/dist/math.d.ts +1 -1
- package/dist/math.d.ts.map +1 -1
- package/dist/math.js +98 -2
- package/dist/math.js.map +1 -1
- package/dist/measure.d.ts +3 -3
- package/dist/measure.js +2 -2
- package/dist/node.d.ts +5 -5
- package/dist/node.d.ts.map +1 -1
- package/dist/node.js +4 -4
- package/dist/package-CaOLXSNi.d.ts.map +1 -1
- package/dist/{pres-2WsBGimU.d.ts → pres-BgvxhQ_m.d.ts} +3 -3
- package/dist/{pres-2WsBGimU.d.ts.map → pres-BgvxhQ_m.d.ts.map} +1 -1
- package/dist/{presentation-DAcOfzsP.js → presentation-BP1B8PCF.js} +5 -5
- package/dist/presentation-BP1B8PCF.js.map +1 -0
- package/dist/{presentation-CTVPpiwP.d.ts → presentation-DyIRDKkp.d.ts} +35 -17
- package/dist/presentation-DyIRDKkp.d.ts.map +1 -0
- package/dist/{presentation-types-BVw0EknS.d.ts → presentation-types-Dj4riuDs.d.ts} +2 -2
- package/dist/{presentation-types-BVw0EknS.d.ts.map → presentation-types-Dj4riuDs.d.ts.map} +1 -1
- package/dist/read.d.ts +4 -4
- package/dist/read.js +3 -3
- package/dist/script.d.ts +2 -2
- package/dist/script.js +0 -0
- package/dist/script.js.map +1 -1
- package/dist/{shapes-BWifcHDV.js → shapes-DMThLsZN.js} +26 -5
- package/dist/shapes-DMThLsZN.js.map +1 -0
- package/dist/{slide-YuSCGa45.d.ts → slide-BRAtT8Dl.d.ts} +8 -8
- package/dist/{slide-YuSCGa45.d.ts.map → slide-BRAtT8Dl.d.ts.map} +1 -1
- package/dist/{st-enums-CgadEyPM.js → st-enums-evQG2A7Z.js} +2 -2
- package/dist/{st-enums-CgadEyPM.js.map → st-enums-evQG2A7Z.js.map} +1 -1
- package/dist/{text-120VFSDm.js → text-B6PbMFih.js} +14 -11
- package/dist/text-B6PbMFih.js.map +1 -0
- package/dist/{units-B-JUKwCS.js → units-C7QM1KgH.js} +2 -2
- package/dist/{units-B-JUKwCS.js.map → units-C7QM1KgH.js.map} +1 -1
- package/dist/{units-internal-CiFWZWk4.js → units-internal-CR8s8YQa.js} +3 -3
- package/dist/{units-internal-CiFWZWk4.js.map → units-internal-CR8s8YQa.js.map} +1 -1
- package/dist/zip.d.ts +2 -2
- package/dist/zip.js +1 -1
- package/package.json +14 -16
- package/skills/ts-pptx-upstream/SKILL.md +247 -0
- package/dist/errors-BENA-Xuw.d.ts.map +0 -1
- package/dist/errors-DGE9zh3U.js.map +0 -1
- package/dist/fit-DGSwMMNs.js.map +0 -1
- package/dist/html-dom--J-Xuucf.js.map +0 -1
- package/dist/presentation-CTVPpiwP.d.ts.map +0 -1
- package/dist/presentation-DAcOfzsP.js.map +0 -1
- package/dist/shapes-BWifcHDV.js.map +0 -1
- package/dist/text-120VFSDm.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fit-DhMbQG5O.js","names":[],"sources":["../src/measure/font-metrics.ts","../src/measure/text-fit.ts","../src/measure/paragraphs.ts","../src/measure/table-fit.ts","../src/measure/fit.ts"],"sourcesContent":["/**\n * PptxGenJS: Write-side font metrics\n *\n * Provides per-glyph advance widths for measured text fit (see `text-fit.ts`).\n * The library has no write-side font registration otherwise; consumers register\n * a face's font file via `pptx.registerFontMetrics(...)` and the measured-fit\n * pass uses these advances to compute a baked `fontScale` for `fit: 'shrink'`.\n *\n * Width is summed from **raw `hmtx` advances with no kerning/shaping** (GPOS/GSUB\n * are deliberately ignored): kerning almost always narrows a line, so raw advances\n * over-estimate width — the conservative direction (shrink a touch too much, never\n * overflow). See `PLAN-measured-text-fit.md` §1.\n */\n\nimport { UnsupportedFeatureError } from '../errors.js'\nimport type { MetricsResolver } from './text-fit.js'\n\n/** Per-(face,bold,italic) advance-width source backed by a parsed font file. */\nexport interface FontMetrics {\n\t/** Font design units per em (advances are in these units). */\n\treadonly unitsPerEm: number\n\t/**\n\t * Advance width of `text` at `sizePt`, in points. Sums raw glyph advances\n\t * (no kerning) and adds `charSpacingPt` after every character, matching how\n\t * PowerPoint widens runs with character spacing.\n\t */\n\tadvanceWidthPt: (text: string, sizePt: number, charSpacingPt?: number) => number\n\t/**\n\t * True if this face's cmap maps code point `cp` to a real glyph (not the\n\t * `.notdef` fallback). Use it to flag source code points the face cannot\n\t * render. Authoritative only for file-backed metrics; the unregistered-font\n\t * heuristic has no cmap and reports every code point as covered.\n\t */\n\thasCodepoint: (cp: number) => boolean\n}\n\n/** Minimal slice of an opentype.js `Font` that `OpentypeFontMetrics` relies on. */\ninterface OpentypeFontLike {\n\tunitsPerEm: number\n\tcharToGlyph: (ch: string) => { advanceWidth?: number } | undefined\n\thasChar: (ch: string) => boolean\n}\n\nclass OpentypeFontMetrics implements FontMetrics {\n\tprivate readonly font: OpentypeFontLike\n\tconstructor(font: OpentypeFontLike) {\n\t\tthis.font = font\n\t}\n\n\tget unitsPerEm(): number {\n\t\treturn this.font.unitsPerEm\n\t}\n\n\tadvanceWidthPt(text: string, sizePt: number, charSpacingPt = 0): number {\n\t\tif (!text) return 0\n\t\t// Sum raw per-glyph `hmtx` advances via cmap (charToGlyph) — deliberately\n\t\t// NOT getAdvanceWidth(), which runs GPOS/GSUB shaping (kerning narrows lines,\n\t\t// and some lookups even throw). Raw advances over-estimate width, the\n\t\t// conservative direction. `for..of` iterates code points (astral-safe).\n\t\tconst scale = sizePt / this.font.unitsPerEm\n\t\tlet width = 0\n\t\tlet count = 0\n\t\tfor (const ch of text) {\n\t\t\tconst glyph = this.font.charToGlyph(ch)\n\t\t\twidth += (glyph?.advanceWidth ?? 0) * scale\n\t\t\tcount++\n\t\t}\n\t\tif (charSpacingPt) width += charSpacingPt * count\n\t\treturn width\n\t}\n\n\thasCodepoint(cp: number): boolean {\n\t\t// opentype's charToGlyph() falls back to .notdef for uncovered code points,\n\t\t// so it can't answer coverage; hasChar() keys on the cmap (glyph index > 0).\n\t\treturn this.font.hasChar(String.fromCodePoint(cp))\n\t}\n}\n\nconst HEURISTIC_UNITS_PER_EM = 1000\n\n/**\n * Advance width of an ASCII/Unicode code point as a fraction of em, for the\n * unregistered-font fallback. Values are biased to **over-estimate** a typical\n * proportional Latin face: over-estimating width is the conservative direction for\n * both solvers (shrink a touch too much / grow a touch too tall, never overflow).\n * Non-Latin code points are treated as full-em (safe for CJK, which is otherwise\n * out of scope; slightly over-wide for accented Latin, which is harmless).\n */\nfunction heuristicCharRatio(ch: string): number {\n\tconst cp = ch.codePointAt(0) ?? 0\n\tif (cp > 0x2e7f) return 1.0 // CJK / full-width and beyond\n\tif (cp > 0xff) return 0.62 // Latin-Extended / accented / misc symbols\n\tif (ch === ' ' || ch === '\\t') return 0.3\n\tif (\"ijl.,'`!|:;\".includes(ch)) return 0.3\n\tif ('ftr()[]{}/\\\\I'.includes(ch)) return 0.4\n\tif (ch === 'm' || ch === 'w') return 0.9\n\tif (ch === 'M' || ch === 'W') return 0.98\n\tif (ch === '@' || ch === '%') return 1.0\n\tif (ch >= 'A' && ch <= 'Z') return 0.72\n\treturn 0.58 // lowercase, digits, default punctuation\n}\n\nclass HeuristicFontMetrics implements FontMetrics {\n\treadonly unitsPerEm = HEURISTIC_UNITS_PER_EM\n\tadvanceWidthPt(text: string, sizePt: number, charSpacingPt = 0): number {\n\t\tif (!text) return 0\n\t\tlet width = 0\n\t\tlet count = 0\n\t\tfor (const ch of text) {\n\t\t\twidth += heuristicCharRatio(ch) * sizePt\n\t\t\tcount++\n\t\t}\n\t\tif (charSpacingPt) width += charSpacingPt * count\n\t\treturn width\n\t}\n\n\thasCodepoint(): boolean {\n\t\treturn true // no cmap to consult; never fabricate a 'missing' glyph\n\t}\n}\n\nlet heuristicSingleton: FontMetrics | undefined\n\n/**\n * Shared, font-independent `FontMetrics` used when a named face has no registered\n * metrics but the deck has opted into measured fit (some other face is registered).\n * Approximate but conservative — see {@link heuristicCharRatio}. A deck with no\n * registered metrics at all does not engage measured fit, so this never fires there.\n */\nexport function getHeuristicFontMetrics(): FontMetrics {\n\tif (!heuristicSingleton) heuristicSingleton = new HeuristicFontMetrics()\n\treturn heuristicSingleton\n}\n\n/** Parse a font file (TTF/OTF) into a `FontMetrics`. Lazily imports opentype.js. */\nexport async function parseFontMetrics(data: Uint8Array): Promise<FontMetrics> {\n\t// Dynamic import keeps opentype.js off the critical/browser path until a\n\t// consumer actually registers metrics.\n\tconst mod = (await import('opentype.js')) as unknown as {\n\t\tparse?: (buf: ArrayBuffer) => OpentypeFontLike\n\t\tdefault?: { parse: (buf: ArrayBuffer) => OpentypeFontLike }\n\t}\n\tconst parse = mod.parse ?? mod.default?.parse\n\tif (typeof parse !== 'function')\n\t\tthrow new UnsupportedFeatureError('font/opentype-unavailable', 'opentype.js: parse() not found in module exports')\n\t// opentype.parse needs a standalone ArrayBuffer view of exactly the font bytes.\n\tconst buf = data.buffer.slice(data.byteOffset, data.byteOffset + data.byteLength) as ArrayBuffer\n\treturn new OpentypeFontMetrics(parse(buf))\n}\n\n/**\n * Registry of `FontMetrics` keyed by `(face, bold, italic)`. Variant advances\n * differ, so bold/italic are stored separately; lookup falls back to the regular\n * variant (then any registered variant of the face) so a deck that only registers\n * the regular weight still measures bold runs approximately rather than not at all.\n */\nexport class FontMetricsRegistry {\n\tprivate readonly map = new Map<string, FontMetrics>()\n\n\tprivate key(face: string, bold: boolean, italic: boolean): string {\n\t\treturn `${face.toLowerCase()}\u0000${bold ? 1 : 0}\u0000${italic ? 1 : 0}`\n\t}\n\n\tset(face: string, metrics: FontMetrics, opts?: { bold?: boolean; italic?: boolean }): void {\n\t\tthis.map.set(this.key(face, !!opts?.bold, !!opts?.italic), metrics)\n\t}\n\n\t/** True if any variant of `face` has registered metrics. */\n\thasFace(face: string): boolean {\n\t\tconst prefix = `${face.toLowerCase()}\u0000`\n\t\tfor (const k of this.map.keys()) if (k.startsWith(prefix)) return true\n\t\treturn false\n\t}\n\n\t/**\n\t * Coverage of code point `cp` for `face`, read from the registered font's cmap:\n\t * `true`/`false` when a variant of `face` is registered (see {@link get} for the\n\t * exact→regular→any-variant fallback), or `undefined` when the face has **no**\n\t * registered metrics — \"unknown\", deliberately distinct from a `false`\n\t * \"registered but not covered\". A coverage audit must not treat an unregistered\n\t * face as fully covered, so callers get `undefined` here rather than the per-face\n\t * {@link FontMetrics.hasCodepoint} boolean (which, for the heuristic fallback,\n\t * always reports covered). Register the face via {@link parseFontMetrics} +\n\t * {@link set} first.\n\t */\n\thasCodepoint(\n\t\tface: string | undefined | null,\n\t\tcp: number,\n\t\topts?: { bold?: boolean; italic?: boolean }\n\t): boolean | undefined {\n\t\treturn this.get(face, opts?.bold, opts?.italic)?.hasCodepoint(cp)\n\t}\n\n\t/** Resolve metrics for a run, falling back from exact variant → regular → any variant. */\n\tget(face: string | undefined | null, bold = false, italic = false): FontMetrics | undefined {\n\t\t// A run with no explicit face inherits the theme font, which we cannot resolve\n\t\t// reliably here — treat as unregistered so measured fit degrades gracefully.\n\t\tif (typeof face !== 'string' || face.length === 0) return undefined\n\t\tconst exact = this.map.get(this.key(face, bold, italic))\n\t\tif (exact) return exact\n\t\tconst regular = this.map.get(this.key(face, false, false))\n\t\tif (regular) return regular\n\t\tconst prefix = `${face.toLowerCase()}\u0000`\n\t\tfor (const [k, v] of this.map) if (k.startsWith(prefix)) return v\n\t\treturn undefined\n\t}\n\n\tget size(): number {\n\t\treturn this.map.size\n\t}\n}\n\n/**\n * A {@link MetricsResolver} backed by a registry: exact metrics for a registered face, otherwise\n * the shared heuristic fallback (with `onHeuristic` told which face it stood in for). A run with\n * no `fontFace` at all resolves to `undefined`, which the callers treat as unmeasurable.\n */\nexport function makeRegistryResolver(\n\tregistry: FontMetricsRegistry,\n\tonHeuristic?: (face: string) => void\n): MetricsResolver {\n\treturn (run) => {\n\t\tconst exact = registry.get(run.fontFace, run.bold, run.italic)\n\t\tif (exact) return exact\n\t\tif (typeof run.fontFace === 'string' && run.fontFace.length > 0) {\n\t\t\tonHeuristic?.(run.fontFace)\n\t\t\treturn getHeuristicFontMetrics()\n\t\t}\n\t\treturn undefined\n\t}\n}\n","/**\n * ts-pptx: Measured text fit (line-break simulator + shrink solver)\n *\n * Computes a baked `fontScale` for `fit: 'shrink'` so overflowing text renders\n * pre-shrunk in headless renderers (and on plain file-open) without a manual\n * edit/resize. See `docs/measured-text-fit.md`.\n *\n * Calibration: every constant here is pinned against PowerPoint-authored fixtures\n * (`test/read/fixtures/autofit-calibration.json`). The model errs **conservative**\n * — it over-estimates width (raw advances, no kerning) and uses the calibrated\n * line pitch — so the computed `fontScale` is ≤ PowerPoint's and the text never\n * overflows in either PowerPoint or LibreOffice.\n */\n\nimport type { FontMetrics } from './font-metrics.js'\n\n/**\n * PowerPoint single-spacing line pitch as a multiple of font size.\n *\n * Calibrated from `autofit-calibration.json` (Deck 1, `autofit-line-metrics`):\n * the per-line `cy` delta is a **font-independent** 1.2117× at 12/18/32 pt across\n * {Aptos, Aptos SemiBold, Calibri, Tahoma, Arial}, and PowerPoint vs LibreOffice\n * agree to ≤ 0.041 pt. See `test/read/fixtures/README.md` → \"Findings\" #1–#2.\n */\nexport const SINGLE_LINE_PITCH = 1.2117\n\n/** PowerPoint's `fontScale` search grid: discrete 2.5% steps (Findings #3). */\nexport const FONT_SCALE_STEP_PCT = 2.5\n\n/** Floor for the shrink search (see `docs/measured-text-fit.md` → Solvers). */\nexport const MIN_FONT_SCALE_PCT = 25\n\n/**\n * Conservative safety factors applied by the shrink solver (not by the pure\n * `measureHeightPt`). Raw `hmtx` advances summed without shaping still pack a line\n * a little tighter than PowerPoint, which lays text out at a device DPI and rounds\n * each glyph advance up — so PowerPoint wraps marginally earlier and its fitted\n * box is marginally taller. Inflating measured width and height by these factors\n * makes the computed `fontScale` ≤ PowerPoint's across the calibration oracle\n * (`test/read/autofit-calibration-oracle.test.js`: 0 violations over the Aptos\n * cases). They err on the side of shrinking slightly too much, never overflowing.\n */\nexport const WIDTH_SAFETY_FACTOR = 1.03\nexport const HEIGHT_SAFETY_FACTOR = 1.04\n\n/** One text run with the inputs measurement needs. */\nexport interface FitRun {\n\ttext: string\n\tsizePt: number\n\tbold?: boolean\n\titalic?: boolean\n\tfontFace?: string\n\t/** Character spacing in points (PowerPoint `spc`/1200). */\n\tcharSpacingPt?: number\n}\n\n/** One paragraph: its runs plus vertical-rhythm options. */\nexport interface FitParagraph {\n\truns: FitRun[]\n\t/** Line spacing as a percent of single (100 = single). Ignored if `lineSpacingPts` set. */\n\tlineSpacingPct?: number\n\t/** Exact line spacing in points (overrides `lineSpacingPct`). */\n\tlineSpacingPts?: number\n\tspaceBeforePts?: number\n\tspaceAfterPts?: number\n}\n\n/** Inner box (shape minus insets) the text must fit, in points. */\nexport interface FitBox {\n\tinnerWidthPt: number\n\tinnerHeightPt: number\n\t/**\n\t * `false` when the frame does not wrap (`wrap:false` / `wrap=\"none\"`): text lays\n\t * out as one line per paragraph (no width-wrapping), and the shrink solver must\n\t * additionally keep the widest line within `innerWidthPt`. A too-wide line\n\t * overflows HORIZONTALLY — `normAutofit`'s vertical shrink never catches it, so\n\t * without this check a non-wrapping line is never shrunk and spills out of the box\n\t * in PowerPoint. Defaults to wrapping (`true`), so table cells and `measureText`\n\t * are unaffected.\n\t */\n\twrap?: boolean\n}\n\n/** Resolve the metrics for a run, or `undefined` if the face is not registered. */\nexport type MetricsResolver = (run: FitRun) => FontMetrics | undefined\n\nexport interface ShrinkResult {\n\tfontScalePct: number\n\tlnSpcReductionPct: number\n}\n\nexport type ShrinkOutcome =\n\t| { kind: 'fits' } // already fits at 100% — no shrink needed\n\t| { kind: 'unmeasurable' } // a run's face has no registered metrics — caller degrades\n\t| { kind: 'shrink'; result: ShrinkResult }\n\ninterface WordToken {\n\tkind: 'word'\n\tw: number\n\tcharWidths: number[]\n}\ntype Token = WordToken | { kind: 'space'; w: number } | { kind: 'newline'; w: 0 }\n\nconst isWhitespace = (ch: string): boolean => ch === ' ' || ch === '\\t' || ch === ' ' || /\\s/.test(ch)\n\n/**\n * Tokenize one paragraph at a given `fontScalePct`. Words can span run boundaries\n * (a break is only allowed at whitespace). Returns `null` if any run's face has no\n * registered metrics (the paragraph cannot be measured).\n */\nfunction tokenizeParagraph(\n\tpara: FitParagraph,\n\tresolve: MetricsResolver,\n\tfontScalePct: number,\n\twidthSafety: number\n): Token[] | null {\n\tconst tokens: Token[] = []\n\tlet curWord: WordToken | null = null\n\tconst flushWord = (): void => {\n\t\tif (curWord) {\n\t\t\ttokens.push(curWord)\n\t\t\tcurWord = null\n\t\t}\n\t}\n\tfor (const run of para.runs) {\n\t\tconst metrics = resolve(run)\n\t\tif (!metrics) return null\n\t\tconst scaledSize = run.sizePt * (fontScalePct / 100)\n\t\tconst charSpacingPt = run.charSpacingPt ?? 0\n\t\tfor (const ch of run.text ?? '') {\n\t\t\tif (ch === '\\n') {\n\t\t\t\tflushWord()\n\t\t\t\ttokens.push({ kind: 'newline', w: 0 })\n\t\t\t} else if (isWhitespace(ch)) {\n\t\t\t\tflushWord()\n\t\t\t\t// Tabs are approximated as a single space-width gap (documented P1 gap).\n\t\t\t\tconst w = metrics.advanceWidthPt(ch === '\\t' ? ' ' : ch, scaledSize, charSpacingPt) * widthSafety\n\t\t\t\ttokens.push({ kind: 'space', w })\n\t\t\t} else {\n\t\t\t\tconst w = metrics.advanceWidthPt(ch, scaledSize, charSpacingPt) * widthSafety\n\t\t\t\tif (!curWord) curWord = { kind: 'word', w: 0, charWidths: [] }\n\t\t\t\tcurWord.w += w\n\t\t\t\tcurWord.charWidths.push(w)\n\t\t\t}\n\t\t}\n\t}\n\tflushWord()\n\treturn tokens\n}\n\n/** Greedy `wrap=square` line layout for a tokenized paragraph. */\ninterface LineLayout {\n\tlines: number\n\t/** Width (points) of the widest laid-out line — for natural/widest-line measurement. */\n\tmaxLineWidthPt: number\n}\n\n/**\n * Greedy `wrap=square` line layout: the wrapped line count plus the widest\n * laid-out line width. `maxLineWidthPt` tracks the running line width and records\n * it whenever a line completes (a wrap or the final line), so callers can measure\n * the actual text extent, not just the box width. Trailing whitespace counts\n * toward width (Findings #7), which slightly over-reports — the conservative\n * direction, consistent with the wrap model erring wide.\n */\nfunction countLines(tokens: Token[], innerWidthPt: number): LineLayout {\n\tlet lines = 1\n\tlet lineW = 0\n\tlet maxLineWidthPt = 0\n\tconst finishLine = (): void => {\n\t\tif (lineW > maxLineWidthPt) maxLineWidthPt = lineW\n\t}\n\tfor (const tok of tokens) {\n\t\tif (tok.kind === 'newline') {\n\t\t\tfinishLine()\n\t\t\tlines++\n\t\t\tlineW = 0\n\t\t} else if (tok.kind === 'space') {\n\t\t\t// Trailing whitespace counts toward line width (Findings #7); if it\n\t\t\t// overflows, the line wraps and the space is consumed at the break.\n\t\t\tif (lineW + tok.w > innerWidthPt && lineW > 0) {\n\t\t\t\tfinishLine()\n\t\t\t\tlines++\n\t\t\t\tlineW = 0\n\t\t\t} else {\n\t\t\t\tlineW += tok.w\n\t\t\t}\n\t\t} else if (tok.w <= innerWidthPt) {\n\t\t\tif (lineW + tok.w > innerWidthPt && lineW > 0) {\n\t\t\t\tfinishLine()\n\t\t\t\tlines++\n\t\t\t\tlineW = tok.w\n\t\t\t} else {\n\t\t\t\tlineW += tok.w\n\t\t\t}\n\t\t} else {\n\t\t\t// Over-long unbreakable word → character-wrap (Findings #7).\n\t\t\tif (lineW > 0) {\n\t\t\t\tfinishLine()\n\t\t\t\tlines++\n\t\t\t\tlineW = 0\n\t\t\t}\n\t\t\tfor (const cw of tok.charWidths) {\n\t\t\t\tif (lineW + cw > innerWidthPt && lineW > 0) {\n\t\t\t\t\tfinishLine()\n\t\t\t\t\tlines++\n\t\t\t\t\tlineW = cw\n\t\t\t\t} else {\n\t\t\t\t\tlineW += cw\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tfinishLine()\n\treturn { lines, maxLineWidthPt }\n}\n\n/** Max run size in a paragraph (line height follows the tallest run — Findings #7). */\nfunction maxRunSizePt(para: FitParagraph): number {\n\tlet max = 0\n\tfor (const run of para.runs) if (run.sizePt > max) max = run.sizePt\n\treturn max\n}\n\n/** Laid-out result of {@link measureLayout}: total height (points) + wrapped line count. */\nexport interface LayoutResult {\n\theightPt: number\n\tlineCount: number\n\t/**\n\t * Width (points) of the widest laid-out line across all paragraphs. Useful for\n\t * tightening a box to the actual text extent or measuring a natural (single-line)\n\t * width. Carries the same `widthSafety` inflation as the wrap decision, so a box\n\t * set to this width will not re-wrap. Conservative (slightly wide).\n\t */\n\twidestLineWidthPt: number\n}\n\n/**\n * Lay out `paragraphs` at a given scale/reduction and return the total height\n * (points) and wrapped line count, or `null` if any paragraph is unmeasurable.\n * Errs tall (conservative): includes space-before/after and the calibrated line\n * pitch. The single source of truth for both {@link measureHeightPt} (the solvers)\n * and the public layout-time measure API.\n */\nexport function measureLayout(\n\tparagraphs: FitParagraph[],\n\tinnerWidthPt: number,\n\tresolve: MetricsResolver,\n\tfontScalePct: number,\n\tlnSpcReductionPct: number,\n\twidthSafety = 1\n): LayoutResult | null {\n\tif (innerWidthPt <= 0) return null\n\tlet total = 0\n\tlet lineCount = 0\n\tlet widestLineWidthPt = 0\n\tfor (const para of paragraphs) {\n\t\tconst tokens = tokenizeParagraph(para, resolve, fontScalePct, widthSafety)\n\t\tif (tokens === null) return null\n\t\tconst { lines, maxLineWidthPt } = countLines(tokens, innerWidthPt)\n\t\tlineCount += lines\n\t\tif (maxLineWidthPt > widestLineWidthPt) widestLineWidthPt = maxLineWidthPt\n\t\tconst scaledMax = maxRunSizePt(para) * (fontScalePct / 100)\n\t\tlet lineHeight =\n\t\t\tpara.lineSpacingPts != null && para.lineSpacingPts > 0\n\t\t\t\t? para.lineSpacingPts\n\t\t\t\t: SINGLE_LINE_PITCH * scaledMax * ((para.lineSpacingPct ?? 100) / 100)\n\t\tlineHeight *= 1 - lnSpcReductionPct / 100\n\t\ttotal += lines * lineHeight + (para.spaceBeforePts ?? 0) + (para.spaceAfterPts ?? 0)\n\t}\n\treturn { heightPt: total, lineCount, widestLineWidthPt }\n}\n\n/**\n * Total laid-out height (points) at a given scale/reduction, or `null` if any\n * paragraph is unmeasurable. Thin wrapper over {@link measureLayout}.\n */\nexport function measureHeightPt(\n\tparagraphs: FitParagraph[],\n\tinnerWidthPt: number,\n\tresolve: MetricsResolver,\n\tfontScalePct: number,\n\tlnSpcReductionPct: number,\n\twidthSafety = 1\n): number | null {\n\tconst result = measureLayout(paragraphs, innerWidthPt, resolve, fontScalePct, lnSpcReductionPct, widthSafety)\n\treturn result === null ? null : result.heightPt\n}\n\n/**\n * Largest `fontScale` (on PowerPoint's 2.5% grid) at which the text fits the box.\n * Width and height both re-measured per scale. Conservative: because the model\n * over-estimates, the returned scale is ≤ PowerPoint's and the text never overflows.\n *\n * `lnSpcReduction` is left at 0 in P1 — dropping `fontScale` alone is provably\n * conservative (PowerPoint trades line-spacing reduction to keep the font *larger*,\n * so a reduction-free fit is always ≤ PowerPoint's scale). The calibration data for\n * the reduction ramp (Findings #4) is recorded for a future refinement.\n */\nexport type ResizeOutcome =\n\t| { kind: 'unmeasurable' } // a run's face has no registered metrics — caller degrades\n\t| { kind: 'resize'; neededInnerHeightPt: number }\n\n/**\n * Inner height (points) the text needs at full size — the value to bake into the\n * shape's `a:ext/@cy` for `fit: 'resize'` (`spAutoFit`). Unlike shrink, resize has\n * **no safety net**: an under-estimate overflows (there is no text scaling\n * fallback), so this errs **tall** — width is inflated (earlier wrap ⇒ more lines)\n * and the laid-out height by the calibrated height factor, so the computed `cy` is\n * ≥ PowerPoint's and ≥ the LibreOffice-rendered height across the resize oracle.\n */\n/**\n * Width used for wrap layout: the inner box width when wrapping, or unbounded for a\n * non-wrapping frame (`wrap:false`) so each paragraph lays out as a single line. A\n * non-wrapping frame's width constraint is enforced separately, against the widest\n * laid-out line — see {@link solveShrink}.\n */\nfunction layoutWidthPt(box: FitBox): number {\n\treturn box.wrap === false ? Infinity : box.innerWidthPt\n}\n\nexport function solveResize(paragraphs: FitParagraph[], box: FitBox, resolve: MetricsResolver): ResizeOutcome {\n\tconst h = measureHeightPt(paragraphs, layoutWidthPt(box), resolve, 100, 0, WIDTH_SAFETY_FACTOR)\n\tif (h === null) return { kind: 'unmeasurable' }\n\treturn { kind: 'resize', neededInnerHeightPt: h * HEIGHT_SAFETY_FACTOR }\n}\n\nexport function solveShrink(paragraphs: FitParagraph[], box: FitBox, resolve: MetricsResolver): ShrinkOutcome {\n\tconst width = layoutWidthPt(box)\n\tconst noWrap = box.wrap === false\n\t// Inflate measured width (earlier wrap) and height by the calibrated safety\n\t// factors so the fit threshold is conservative against PowerPoint. For a\n\t// non-wrapping frame the single line always fits the box HEIGHT, so height alone\n\t// never triggers a shrink: also require the widest (unwrapped) line to fit the box\n\t// WIDTH. `widestLineWidthPt` already carries the WIDTH_SAFETY_FACTOR inflation, so\n\t// comparing it straight to `innerWidthPt` stays on the conservative (shrink-more) side.\n\tconst fits = (scale: number): boolean | null => {\n\t\tconst layout = measureLayout(paragraphs, width, resolve, scale, 0, WIDTH_SAFETY_FACTOR)\n\t\tif (layout === null) return null\n\t\tif (layout.heightPt * HEIGHT_SAFETY_FACTOR > box.innerHeightPt) return false\n\t\tif (noWrap && layout.widestLineWidthPt > box.innerWidthPt) return false\n\t\treturn true\n\t}\n\n\tconst at100 = fits(100)\n\tif (at100 === null) return { kind: 'unmeasurable' }\n\tif (at100) return { kind: 'fits' }\n\n\tfor (let scale = 100 - FONT_SCALE_STEP_PCT; scale >= MIN_FONT_SCALE_PCT; scale -= FONT_SCALE_STEP_PCT) {\n\t\tif (fits(scale)) return { kind: 'shrink', result: { fontScalePct: scale, lnSpcReductionPct: 0 } }\n\t}\n\t// Even at the floor it overflows our conservative model — bake the floor as best effort.\n\treturn { kind: 'shrink', result: { fontScalePct: MIN_FONT_SCALE_PCT, lnSpcReductionPct: 0 } }\n}\n","/**\n * ts-pptx: turning a slide text object into the simulator's inputs\n *\n * The lower half of the measured-fit pass: normalize a text object's runs into `FitParagraph`s,\n * resolve its body insets and box, and work out how a height change is shared between `off.y` and\n * `ext.cy` for a given anchor. Everything here is about *reading* an authored object; the solving\n * and the rewriting live in the siblings (`table-fit.ts`, `fit.ts`).\n */\n\nimport { DEF_FONT_SIZE } from '../constants-internal.js'\nimport { EMU_PER_POINT } from '../units.js'\nimport { getSmartParseNumber, marginToEmu } from '../units-internal.js'\nimport type { FitBox, FitParagraph, FitRun } from './text-fit.js'\nimport { TextAnchor } from '../enums.js'\nimport type { ObjectOptions, TextProps, TextPropsOptions } from '../types/index.js'\nimport type { SlideObject, PresSlideInternal } from '../types/internal.js'\n\n// PowerPoint's default text-frame insets (EMU): l/r = 0.1in, t/b = 0.05in.\nconst DEF_INS_LR_EMU = 91440\nconst DEF_INS_TB_EMU = 45720\n\nconst CRLF_RE = /\\r*\\n/g\n\nexport type RunOpts = TextPropsOptions & ObjectOptions\n\n/** Normalize `slideObj.text` (string | TextProps | TextProps[]) to a run list. */\nexport function normalizeRuns(obj: SlideObject): TextProps[] {\n\tconst opts = obj.options ?? {}\n\tconst text = obj.text as unknown\n\tif (text == null) return []\n\tif (typeof text === 'string' || typeof text === 'number') return [{ text: String(text), options: opts }]\n\tif (!Array.isArray(text) && typeof text === 'object' && 'text' in text) {\n\t\tconst t = text as TextProps\n\t\treturn [{ text: t.text, options: t.options ?? opts }]\n\t}\n\tif (Array.isArray(text)) return (text as TextProps[]).map((t) => ({ text: t.text, options: t.options ?? opts }))\n\treturn []\n}\n\n/** Build a measurable `FitParagraph[]` from a text object, or null if not measurable. */\nexport function extractParagraphs(obj: SlideObject): FitParagraph[] | null {\n\tconst opts = (obj.options ?? {}) as RunOpts\n\tconst runs = normalizeRuns(obj)\n\tif (runs.length === 0) return null\n\treturn buildFitParagraphs(runs, opts)\n}\n\n/**\n * Convert a run list (+ box-level default options) into a measurable\n * `FitParagraph[]`, or null if empty. The single converter shared by the\n * export-time pass ({@link extractParagraphs}) and the public layout-time\n * `measureText` API, so a layout-time prediction and the baked export never drift.\n */\nexport function buildFitParagraphs(runs: TextProps[], opts: RunOpts): FitParagraph[] | null {\n\tif (runs.length === 0) return null\n\n\t// Expand \"\\n\" inside a run into separate pieces, flagging the paragraph break\n\t// after each (mirrors `gen/slide/objects/table.ts` STEP 4). `breakLine` ends a paragraph too.\n\tinterface Piece {\n\t\ttext: string\n\t\toptions: RunOpts\n\t\tbreakAfter: boolean\n\t}\n\tconst pieces: Piece[] = []\n\tfor (const run of runs) {\n\t\tconst ro = (run.options ?? opts) as RunOpts\n\t\tconst raw = String(run.text ?? '').replace(CRLF_RE, '\\n')\n\t\tif (raw.includes('\\n')) {\n\t\t\tconst lines = raw.split('\\n')\n\t\t\tlines.forEach((line, i) => {\n\t\t\t\tconst isLast = i === lines.length - 1\n\t\t\t\tpieces.push({ text: line, options: ro, breakAfter: isLast ? !!ro.breakLine : true })\n\t\t\t})\n\t\t} else {\n\t\t\tpieces.push({ text: raw, options: ro, breakAfter: !!ro.breakLine })\n\t\t}\n\t}\n\n\tconst toRun = (p: Piece): FitRun => {\n\t\tconst ro = p.options\n\t\tconst sizePt = Number(ro.fontSize ?? opts.fontSize ?? DEF_FONT_SIZE)\n\t\treturn {\n\t\t\ttext: p.text,\n\t\t\tsizePt: Number.isFinite(sizePt) && sizePt > 0 ? sizePt : DEF_FONT_SIZE,\n\t\t\tbold: !!(ro.bold ?? opts.bold),\n\t\t\titalic: !!(ro.italic ?? opts.italic),\n\t\t\tfontFace: ro.fontFace ?? opts.fontFace,\n\t\t\tcharSpacingPt: (ro.charSpacing ?? opts.charSpacing) || undefined,\n\t\t}\n\t}\n\tconst toPara = (runsForPara: FitRun[], paraOpts: RunOpts): FitParagraph => {\n\t\tconst lineSpacing = paraOpts.lineSpacing ?? opts.lineSpacing\n\t\tconst lineSpacingMultiple = paraOpts.lineSpacingMultiple ?? opts.lineSpacingMultiple\n\t\treturn {\n\t\t\truns: runsForPara,\n\t\t\tlineSpacingPts: typeof lineSpacing === 'number' && lineSpacing > 0 ? lineSpacing : undefined,\n\t\t\tlineSpacingPct:\n\t\t\t\ttypeof lineSpacingMultiple === 'number' && lineSpacingMultiple > 0 ? lineSpacingMultiple * 100 : 100,\n\t\t\tspaceBeforePts: Number(paraOpts.paraSpaceBefore ?? opts.paraSpaceBefore ?? 0) || 0,\n\t\t\tspaceAfterPts: Number(paraOpts.paraSpaceAfter ?? opts.paraSpaceAfter ?? 0) || 0,\n\t\t}\n\t}\n\n\tconst paras: FitParagraph[] = []\n\tlet cur: FitRun[] = []\n\tlet curParaOpts: RunOpts = opts\n\tfor (const piece of pieces) {\n\t\tcur.push(toRun(piece))\n\t\tcurParaOpts = piece.options\n\t\tif (piece.breakAfter) {\n\t\t\tparas.push(toPara(cur, curParaOpts))\n\t\t\tcur = []\n\t\t}\n\t}\n\tif (cur.length > 0) paras.push(toPara(cur, curParaOpts))\n\treturn paras.length > 0 ? paras : null\n}\n\ninterface InsetsEmu {\n\tlIns: number\n\trIns: number\n\ttIns: number\n\tbIns: number\n}\n\n/** Resolve text-frame insets (EMU): explicit `_bodyProp` (from `inset`) → `margin` → PowerPoint defaults. */\nexport function resolveInsetsEmu(opts: RunOpts): InsetsEmu {\n\tconst bp = opts._bodyProp ?? {}\n\tconst margin = opts.margin\n\tlet lIns = bp.lIns\n\tlet rIns = bp.rIns\n\tlet tIns = bp.tIns\n\tlet bIns = bp.bIns\n\tif (lIns == null && rIns == null && tIns == null && bIns == null && margin != null) {\n\t\tif (Array.isArray(margin)) {\n\t\t\ttIns = marginToEmu(margin[0] ?? 0)\n\t\t\trIns = marginToEmu(margin[1] ?? 0)\n\t\t\tbIns = marginToEmu(margin[2] ?? 0)\n\t\t\tlIns = marginToEmu(margin[3] ?? 0)\n\t\t} else if (typeof margin === 'number') {\n\t\t\tlIns = rIns = tIns = bIns = marginToEmu(margin)\n\t\t}\n\t}\n\treturn {\n\t\tlIns: lIns ?? DEF_INS_LR_EMU,\n\t\trIns: rIns ?? DEF_INS_LR_EMU,\n\t\ttIns: tIns ?? DEF_INS_TB_EMU,\n\t\tbIns: bIns ?? DEF_INS_TB_EMU,\n\t}\n}\n\n/**\n * Resolve the inner box (shape minus insets) in points; null if degenerate.\n *\n * Reads the object's own `opts.w/h` with no ancestor walk — correct only because a group keeps an\n * identity child coordinate space (`chOff/chExt == off/ext`, see the `gen/slide/object.ts` group renderer and\n * `docs/groups.md`), so a group never scales its children and a grouped text box's authored w/h is its\n * true rendered size. `applyMeasuredFit` reaches here for grouped text via its explicit group descent\n * (`measureObject`). If `addGroup` ever authored a scaled group (non-identity `chExt`), this would need\n * the same ancestor-scale composition `Shape.absoluteFrame` performs on the read path.\n */\nexport function computeBox(obj: SlideObject, presLayout: PresSlideInternal['_presLayout']): FitBox | null {\n\tconst opts = (obj.options ?? {}) as RunOpts\n\tconst wEmu = getSmartParseNumber(opts.w, 'X', presLayout)\n\tconst hEmu = getSmartParseNumber(opts.h, 'Y', presLayout)\n\tif (!(wEmu > 0) || !(hEmu > 0)) return null\n\n\tconst { lIns, rIns, tIns, bIns } = resolveInsetsEmu(opts)\n\n\t// wrap=none lays text out one line per paragraph (no width-wrapping, handled by\n\t// the solver via the wrap flag), but the box width is still a real constraint:\n\t// solveShrink enforces it against the widest line so an over-wide non-wrapping\n\t// line shrinks to fit horizontally instead of spilling out of the box.\n\tconst wrap = (opts._bodyProp ?? {}).wrap !== false\n\tconst innerWidthPt = (wEmu - lIns - rIns) / EMU_PER_POINT\n\tconst innerHeightPt = (hEmu - tIns - bIns) / EMU_PER_POINT\n\tif (!(innerHeightPt > 0)) return null\n\tif (!(innerWidthPt > 0)) return null\n\treturn { innerWidthPt, innerHeightPt, wrap }\n}\n\n/** Vertical-anchor share of a height change that moves the box top up (`off.y` shift). */\nexport function anchorTopShareOfDelta(opts: RunOpts): number {\n\t// `_bodyProp.anchor` is the resolved valign ('t' | 'ctr' | 'b'); default 'ctr'.\n\tconst anchor = (opts._bodyProp ?? {}).anchor\n\tif (anchor === TextAnchor.t) return 0 // grow downward — top fixed\n\tif (anchor === TextAnchor.b) return 1 // grow upward — bottom fixed\n\treturn 0.5 // centered growth (default)\n}\n\n// --- Table cells -----------------------------------------------------------\n// PowerPoint has no text-autofit for table cells (`a:tcPr` carries no autofit and\n// the app ignores `normAutofit` inside a cell — rows auto-grow instead). So a cell's\n// `fit:'shrink'` is honored by baking a *reduced literal font size* onto its runs,\n// which both PowerPoint and LibreOffice render identically with no edit/resize.\n\n/** Text/format options that a cell inherits from the table when it sets none itself (mirrors `gen/slide/objects/table.ts`). */\n","/**\n * ts-pptx: measuring a table's row heights and cell fits\n *\n * A table is measured cell by cell against its resolved grid: each cell inherits the table's text\n * options where it sets none, gets its own margins resolved to EMU insets, and is laid out inside\n * the column span it actually occupies. A merged region is measured once, at its origin, across\n * the columns it covers — which is what `walkTableGrid` exists to hand out.\n */\n\nimport { DEF_CELL_MARGIN_IN, DEF_FONT_SIZE, LINEH_MODIFIER } from '../constants-internal.js'\nimport { EMU_PER_POINT, emuToInches } from '../units.js'\nimport { getSmartParseNumber, inch2Emu, marginToEmu, resolveTableColWidthsEmu } from '../units-internal.js'\nimport { measureLayout, WIDTH_SAFETY_FACTOR, HEIGHT_SAFETY_FACTOR } from './text-fit.js'\nimport { makeRegistryResolver, type FontMetricsRegistry } from './font-metrics.js'\nimport { extractParagraphs, type RunOpts } from './paragraphs.js'\nimport type {\n\tMargin,\n\tPresLayout,\n\tTableCell,\n\tTableCellLayout,\n\tTableCellProps,\n\tTableLayoutResult,\n\tTableProps,\n} from '../types/index.js'\nimport type { SlideObject } from '../types/internal.js'\n\nconst CELL_INHERIT_KEYS = [\n\t'fontFace',\n\t'fontSize',\n\t'bold',\n\t'italic',\n\t'charSpacing',\n\t'align',\n\t'lineSpacing',\n\t'lineSpacingMultiple',\n\t'valign',\n\t'margin',\n] as const\n\n/** Effective cell options: the cell's own values, with table-level values filled in where unset. */\nexport function effectiveCellOpts(cellOpts: TableCellProps, tableOpts: RunOpts): RunOpts {\n\tconst merged = { ...cellOpts } as RunOpts\n\tfor (const k of CELL_INHERIT_KEYS) {\n\t\tif (merged[k] === undefined && tableOpts[k] !== undefined) (merged as Record<string, unknown>)[k] = tableOpts[k]\n\t}\n\treturn merged\n}\n\ninterface CellInsetsEmu {\n\tmarL: number\n\tmarR: number\n\tmarT: number\n\tmarB: number\n}\n\n/** Resolve a cell's margins to EMU insets, mirroring `gen/slide/objects/table.ts` (array is `[T,R,B,L]`, inches; see `marginToEmu`). */\nexport function resolveCellInsetsEmu(margin: Margin | undefined): CellInsetsEmu {\n\tlet m: Margin = margin === 0 || margin ? margin : DEF_CELL_MARGIN_IN\n\tif (typeof m === 'number') m = [m, m, m, m]\n\tif (!Array.isArray(m) || m.length !== 4 || m.some((v) => typeof v !== 'number' || !isFinite(v)))\n\t\tm = DEF_CELL_MARGIN_IN\n\tconst arr = m\n\treturn {\n\t\tmarT: marginToEmu(arr[0]),\n\t\tmarR: marginToEmu(arr[1]),\n\t\tmarB: marginToEmu(arr[2]),\n\t\tmarL: marginToEmu(arr[3]),\n\t}\n}\n\n/**\n * Bake a reduced font size onto a cell's runs by factor `f` (< 1). Clones every\n * options object before mutating: a plain-string cell shares the table's `opt`\n * object (`gen/define/`), so in-place mutation would corrupt every other such cell.\n */\nexport function scaleCellFontSizes(cell: TableCell, eff: RunOpts, f: number): void {\n\tconst shrink = (sizePt: number): number => Math.floor(sizePt * f * 10) / 10 // floor: stay on the conservative (smaller) side\n\tconst baseSize = Number(eff.fontSize ?? DEF_FONT_SIZE)\n\tcell.options = { ...cell.options, fontSize: shrink(baseSize) }\n\tif (Array.isArray(cell.text)) {\n\t\tcell.text = cell.text.map((run) =>\n\t\t\trun && typeof run === 'object' && typeof run.options?.fontSize === 'number'\n\t\t\t\t? { ...run, options: { ...run.options, fontSize: shrink(run.options.fontSize) } }\n\t\t\t\t: run\n\t\t)\n\t}\n}\n\n/** Grid column count of a table (sums the first row's colspans), mirroring `gen/slide/objects/table.ts`. */\nexport function tableColCount(rows: TableCell[][]): number {\n\tconst first = rows[0]\n\treturn first ? first.reduce((n, c) => n + (Number(c?.options?.colspan) || 1), 0) : 0\n}\n\n/** A placed (non-merged origin) cell yielded by {@link walkTableGrid}. */\ninterface GridPlacement {\n\tcell: TableCell\n\t/** Zero-based grid row of the cell's top-left origin. */\n\trow: number\n\t/** Zero-based grid column of the cell's top-left origin. */\n\tcol: number\n\t/** Rows spanned, clamped to the available rows. */\n\trowSpan: number\n\t/** Columns spanned, clamped to the grid width. */\n\tcolSpan: number\n}\n\n/**\n * Walk a table's cell grid in row-major order, resolving each authored cell to its\n * grid origin (`row`/`col`) and clamped colspan/rowspan. Tracks rowspan occupancy so\n * a cell never lands beneath one spanned from above (grid build). This is\n * the single traversal shared by the measured-fit shrink pass and\n * {@link computeTableLayout}, so cell placement cannot drift between them.\n */\nexport function* walkTableGrid(rows: TableCell[][], numCols: number): Generator<GridPlacement> {\n\t// occupied[c] = rows still covered by a rowspan started above (incl. current row).\n\tconst occupied = new Array<number>(numCols).fill(0)\n\tfor (let r = 0; r < rows.length; r++) {\n\t\tconst row = rows[r]\n\t\tif (!row) continue\n\t\tlet col = 0\n\t\tfor (const cell of row) {\n\t\t\twhile (col < numCols && (occupied[col] ?? 0) > 0) col++\n\t\t\tif (col >= numCols) break\n\t\t\tconst colspan = Math.max(1, Number(cell?.options?.colspan) || 1)\n\t\t\tconst rowspan = Math.min(Math.max(1, Number(cell?.options?.rowspan) || 1), rows.length - r)\n\t\t\tconst colStart = col\n\t\t\tconst colEnd = Math.min(colStart + colspan, numCols)\n\t\t\tfor (let c = colStart; c < colEnd; c++) occupied[c] = rowspan\n\t\t\tcol = colEnd\n\t\t\tyield { cell, row: r, col: colStart, rowSpan: rowspan, colSpan: colEnd - colStart }\n\t\t}\n\t\tfor (let c = 0; c < numCols; c++) {\n\t\t\tconst cur = occupied[c] ?? 0\n\t\t\tif (cur > 0) occupied[c] = cur - 1\n\t\t}\n\t}\n}\n\n/**\n * Compute per-cell geometry (inches) for a table laid out at `opts.x`/`y`/`w` — the\n * engine behind `pptx.tableLayout()`. Column widths come from the same\n * {@link resolveTableColWidthsEmu} the writer uses, so cell x/width are exact. Row\n * heights are exact when pinned by `rowH` (array or scalar) or table `h`; otherwise\n * each auto-height row is estimated with the same conservative (tall) text model as\n * {@link measureText} and flagged `heightExact: false`. Single-slide only —\n * `autoPage` paging across slides is not modeled. Rowspan cells do not drive a row's\n * estimated height (mirrors `gen/table/autopage.ts`, which exempts them from line-height growth).\n */\nexport function computeTableLayout(\n\trows: TableCell[][],\n\topts: TableProps,\n\tpresLayout: PresLayout,\n\tregistry: FontMetricsRegistry\n): TableLayoutResult {\n\tconst empty: TableLayoutResult = { cells: [], widthIn: 0, heightIn: 0, heightExact: true }\n\tif (!rows || rows.length === 0 || !rows[0]) return empty\n\tconst numRows = rows.length\n\tconst numCols = tableColCount(rows)\n\tif (!(numCols > 0)) return empty\n\t// Reuse TableProps as a bag of inheritable text props; only CELL_INHERIT_KEYS are\n\t// read from it. Route through `unknown` because TableProps.columns (per-column cell\n\t// styling, TableCellProps[]) collides by name with TextPropsOptions.columns (text\n\t// column count, number) — the two never overlap here since `columns` isn't inherited.\n\tconst o = opts as unknown as RunOpts\n\n\tconst tableXEmu = opts.x != null ? getSmartParseNumber(opts.x, 'X', presLayout) : 0\n\tconst tableYEmu = opts.y != null ? getSmartParseNumber(opts.y, 'Y', presLayout) : 0\n\tconst cxEmu =\n\t\topts.w != null ? getSmartParseNumber(opts.w, 'X', presLayout) : getSmartParseNumber('75%', 'X', presLayout)\n\tconst colWidthsEmu = resolveTableColWidthsEmu(opts.colW, cxEmu, numCols)\n\n\t// Prefix-sum column x offsets (length numCols+1): colXEmu[c] = left edge of column c.\n\tconst colXEmu = new Array<number>(numCols + 1).fill(0)\n\tfor (let c = 0; c < numCols; c++) colXEmu[c + 1] = (colXEmu[c] ?? 0) + (colWidthsEmu[c] ?? 0)\n\n\tconst tableHeightEmu = opts.h != null ? getSmartParseNumber(opts.h, 'Y', presLayout) : 0\n\t// Explicit row height (EMU) or null when the row is auto-height. An array `rowH`\n\t// slot that is missing/NaN falls back to an even split of table `h` if one is set.\n\tconst explicitRowHEmu = (r: number): number | null => {\n\t\tif (Array.isArray(opts.rowH)) {\n\t\t\tconst v = opts.rowH[r]\n\t\t\tif (typeof v === 'number' && isFinite(v)) return inch2Emu(v)\n\t\t\treturn tableHeightEmu > 0 ? Math.round(tableHeightEmu / numRows) : null\n\t\t}\n\t\tif (opts.rowH != null && !isNaN(Number(opts.rowH))) return inch2Emu(Number(opts.rowH))\n\t\tif (tableHeightEmu > 0) return Math.round(tableHeightEmu / numRows)\n\t\treturn null\n\t}\n\tconst resolve = makeRegistryResolver(registry)\n\tconst defLineEmu = inch2Emu((DEF_FONT_SIZE * LINEH_MODIFIER) / 100)\n\n\t// Estimate a cell's content height (EMU) at its authored size, conservative/tall,\n\t// with a one-line floor. Mirrors measureText's inflated wrap + height safety.\n\tconst estimateContentHeightEmu = (cell: TableCell, eff: RunOpts, innerWidthPt: number): number => {\n\t\tconst fontSizePt = Number(eff.fontSize ?? DEF_FONT_SIZE) || DEF_FONT_SIZE\n\t\tconst oneLineEmu = inch2Emu((fontSizePt * LINEH_MODIFIER) / 100)\n\t\tif (!(innerWidthPt > 0)) return oneLineEmu\n\t\tconst paragraphs = extractParagraphs({ text: cell.text, options: eff } as unknown as SlideObject)\n\t\tif (!paragraphs) return oneLineEmu\n\t\tconst layout = measureLayout(paragraphs, innerWidthPt, resolve, 100, 0, WIDTH_SAFETY_FACTOR)\n\t\tif (layout === null) return oneLineEmu\n\t\treturn Math.max(Math.round(layout.heightPt * HEIGHT_SAFETY_FACTOR * EMU_PER_POINT), oneLineEmu)\n\t}\n\n\t// PASS 1: place every origin cell and resolve each row's height.\n\tinterface Placed {\n\t\tp: GridPlacement\n\t\tcolStart: number\n\t\tcolEnd: number\n\t}\n\tconst placed: Placed[] = []\n\tconst rowHeightsEmu = new Array<number>(numRows).fill(0)\n\tconst rowExact = new Array<boolean>(numRows).fill(false)\n\tfor (let r = 0; r < numRows; r++) {\n\t\tconst ex = explicitRowHEmu(r)\n\t\tif (ex != null) {\n\t\t\trowHeightsEmu[r] = ex\n\t\t\trowExact[r] = true\n\t\t}\n\t}\n\n\tfor (const p of walkTableGrid(rows, numCols)) {\n\t\tconst colStart = p.col\n\t\tconst colEnd = p.col + p.colSpan\n\t\tplaced.push({ p, colStart, colEnd })\n\n\t\t// Only single-row, auto-height cells drive a row's estimated height.\n\t\tif (p.rowSpan === 1 && !rowExact[p.row]) {\n\t\t\tlet widthEmu = 0\n\t\t\tfor (let c = colStart; c < colEnd; c++) widthEmu += colWidthsEmu[c] ?? 0\n\t\t\tconst eff = effectiveCellOpts(p.cell?.options ?? {}, o)\n\t\t\tconst ins = resolveCellInsetsEmu(eff.margin)\n\t\t\tconst innerWidthPt = (widthEmu - ins.marL - ins.marR) / EMU_PER_POINT\n\t\t\tconst contentEmu = estimateContentHeightEmu(p.cell, eff, innerWidthPt) + ins.marT + ins.marB\n\t\t\tif (contentEmu > (rowHeightsEmu[p.row] ?? 0)) rowHeightsEmu[p.row] = contentEmu\n\t\t}\n\t}\n\n\t// A row touched only by rowspans (no single-row cell, no explicit height) still\n\t// needs a non-zero height: give it one default line.\n\tfor (let r = 0; r < numRows; r++) if ((rowHeightsEmu[r] ?? 0) <= 0) rowHeightsEmu[r] = defLineEmu\n\n\t// Prefix-sum row y offsets.\n\tconst rowYEmu = new Array<number>(numRows + 1).fill(0)\n\tfor (let r = 0; r < numRows; r++) rowYEmu[r + 1] = (rowYEmu[r] ?? 0) + (rowHeightsEmu[r] ?? 0)\n\n\t// PASS 2: emit one rect per origin cell.\n\tconst cells: TableCellLayout[] = placed.map(({ p, colStart, colEnd }) => {\n\t\tconst rowEnd = p.row + p.rowSpan\n\t\tlet heightExact = true\n\t\tfor (let rr = p.row; rr < rowEnd; rr++) if (!rowExact[rr]) heightExact = false\n\t\treturn {\n\t\t\trow: p.row,\n\t\t\tcol: p.col,\n\t\t\trowSpan: p.rowSpan,\n\t\t\tcolSpan: p.colSpan,\n\t\t\txIn: emuToInches(tableXEmu + (colXEmu[colStart] ?? 0)),\n\t\t\tyIn: emuToInches(tableYEmu + (rowYEmu[p.row] ?? 0)),\n\t\t\twIn: emuToInches((colXEmu[colEnd] ?? 0) - (colXEmu[colStart] ?? 0)),\n\t\t\thIn: emuToInches((rowYEmu[rowEnd] ?? 0) - (rowYEmu[p.row] ?? 0)),\n\t\t\theightExact,\n\t\t}\n\t})\n\n\treturn {\n\t\tcells,\n\t\twidthIn: emuToInches(colXEmu[numCols] ?? 0),\n\t\theightIn: emuToInches(rowYEmu[numRows] ?? 0),\n\t\theightExact: rowExact.every(Boolean),\n\t}\n}\n\n/**\n * Build the `MetricsResolver` both the export pass and `measureText` use, so they\n * agree run-for-run: exact registered metrics → conservative heuristic for any\n * **named** face without exact metrics → `undefined` only for an unnamed\n * (theme-default) face that cannot be guessed. `onHeuristic` is called with each\n * named face that fell back to the heuristic (for the export pass's warn-once).\n */\n","/**\n * ts-pptx: Measured-fit serialization pass\n *\n * Bridges slide text objects to the line-break simulator / shrink solver\n * (`text-fit.ts`). Runs during async export, BEFORE the `gen/` emitter builds the body:\n * for each text box with `fit: 'shrink'` and a registered font, it computes the\n * `fontScale` PowerPoint would have baked and rewrites `options.fit` to the\n * explicit object form (`{ type:'shrink', fontScale }`) so `genXmlNormAutofit`\n * emits `<a:normAutofit fontScale=…/>`. Without metrics it leaves the bare flag\n * untouched (current behavior) and warns once. See `docs/measured-text-fit.md`.\n */\n\nimport { SlideObjectType } from '../enums.js'\nimport { EMU_PER_POINT, POINTS_PER_INCH } from '../units.js'\nimport { getSmartParseNumber, inch2Emu, resolveTableColWidthsEmu } from '../units-internal.js'\nimport { warn } from '../diagnostics.js'\nimport { makeRegistryResolver, type FontMetricsRegistry } from './font-metrics.js'\nimport {\n\tsolveShrink,\n\tsolveResize,\n\tmeasureLayout,\n\tWIDTH_SAFETY_FACTOR,\n\tHEIGHT_SAFETY_FACTOR,\n\ttype FitBox,\n\ttype FitParagraph,\n} from './text-fit.js'\nimport {\n\tanchorTopShareOfDelta,\n\tbuildFitParagraphs,\n\tcomputeBox,\n\textractParagraphs,\n\tresolveInsetsEmu,\n\ttype RunOpts,\n} from './paragraphs.js'\nimport {\n\teffectiveCellOpts,\n\tresolveCellInsetsEmu,\n\tscaleCellFontSizes,\n\ttableColCount,\n\twalkTableGrid,\n} from './table-fit.js'\nimport type { MeasureTextOptions, TextMeasurement, TextProps } from '../types/index.js'\nimport type { SlideObject, PresSlideInternal } from '../types/internal.js'\n\n/** Map the public {@link MeasureTextOptions} onto the internal run-option shape. */\nfunction measureOptsToRunOpts(opts: MeasureTextOptions): RunOpts {\n\treturn {\n\t\tfontSize: opts.fontSize,\n\t\tfontFace: opts.fontFace,\n\t\tbold: opts.bold,\n\t\titalic: opts.italic,\n\t\tcharSpacing: opts.charSpacing,\n\t\tlineSpacing: opts.lineSpacing,\n\t\tlineSpacingMultiple: opts.lineSpacingMultiple,\n\t\tparaSpaceBefore: opts.paraSpaceBefore,\n\t\tparaSpaceAfter: opts.paraSpaceAfter,\n\t}\n}\n\n/** A fresh result each call: `approximatedFaces` is caller-owned, so it cannot be shared. */\nconst unmeasurable = (): TextMeasurement => ({\n\theightIn: 0,\n\tlineCount: 0,\n\twidestLineIn: 0,\n\tmeasurable: false,\n\tapproximatedFaces: [],\n\tfitsBox: () => false,\n\tshrinkScaleFor: () => 100,\n})\n\n/**\n * Layout-time text measurement against registered metrics — the public engine\n * behind `pptx.measureText()`. Uses the **same** calibrated wrap model, resolver\n * semantics, and conservative safety factors as the export-time bake\n * ({@link applyMeasuredFit} / {@link solveResize} / {@link solveShrink}), so a\n * layout-time prediction matches the value the export would bake **for any deck\n * that opted into measured fit (i.e. registered at least one face)**.\n *\n * With an **empty** registry the two intentionally diverge: {@link applyMeasuredFit}\n * treats \"no metrics\" as \"not opted in\" and bakes nothing, while this returns\n * heuristic numbers so the API is useful with zero setup. Check\n * `approximatedFaces` if that distinction matters.\n *\n * Synchronous: assumes metrics are pre-registered (lookup is sync). A named face\n * with no exact metrics silently uses the conservative heuristic (same as export)\n * and is reported in `approximatedFaces`; an unnamed theme-default face returns\n * `measurable: false`.\n */\nexport function measureText(\n\tregistry: FontMetricsRegistry,\n\ttext: string | TextProps[],\n\topts: MeasureTextOptions\n): TextMeasurement {\n\tconst runs: TextProps[] =\n\t\ttypeof text === 'string' || typeof text === 'number' ? [{ text: String(text) }] : Array.isArray(text) ? text : []\n\tconst paragraphs = buildFitParagraphs(runs, measureOptsToRunOpts(opts))\n\tif (!paragraphs) return unmeasurable()\n\n\tconst inset = opts.insetIn ?? 0\n\tconst innerWidthPt = (opts.wIn - 2 * inset) * POINTS_PER_INCH\n\tconst heuristicFaces = new Set<string>()\n\tconst resolve = makeRegistryResolver(registry, (face) => heuristicFaces.add(face))\n\n\t// Conservative (tall) layout at full size, mirroring solveResize: inflate width\n\t// (earlier wrap) by WIDTH_SAFETY and the height by HEIGHT_SAFETY. The resolver runs\n\t// during layout, so `heuristicFaces` is only populated once this returns.\n\tconst layout = measureLayout(paragraphs, innerWidthPt, resolve, 100, 0, WIDTH_SAFETY_FACTOR)\n\tif (layout === null) return unmeasurable()\n\tconst heightPt = layout.heightPt * HEIGHT_SAFETY_FACTOR\n\tconst heightIn = heightPt / POINTS_PER_INCH\n\n\treturn {\n\t\theightIn,\n\t\tlineCount: layout.lineCount,\n\t\twidestLineIn: layout.widestLineWidthPt / POINTS_PER_INCH,\n\t\tmeasurable: true,\n\t\t// Snapshot: shrinkScaleFor() re-enters the same resolver, so the live set must not leak.\n\t\tapproximatedFaces: [...heuristicFaces],\n\t\t// Mirrors solveShrink's fit check at scale 100 (height already inflated).\n\t\tfitsBox: (hIn: number) => heightPt <= hIn * POINTS_PER_INCH,\n\t\tshrinkScaleFor: (hIn: number) => {\n\t\t\tconst box: FitBox = { innerWidthPt, innerHeightPt: hIn * POINTS_PER_INCH }\n\t\t\tconst outcome = solveShrink(paragraphs, box, resolve)\n\t\t\tif (outcome.kind === 'shrink') return outcome.result.fontScalePct\n\t\t\treturn 100 // 'fits' (or, defensively, 'unmeasurable') → no shrink\n\t\t},\n\t}\n}\n\n/**\n * Apply measured fit across every slide. For each text box that opts in via\n * `fit:'shrink'` or `fit:'resize'` and whose font has registered metrics, this\n * bakes the computed result before the sync XML pass reads it:\n * - `'shrink'` → rewrites `options.fit` to the object form so `<a:normAutofit\n * fontScale=…/>` is emitted (text renders pre-shrunk).\n * - `'resize'` → rewrites `options.h` (and `options.y` per vertical anchor) so the\n * shape's `a:ext/@cy` is the height the text needs; the `<a:spAutoFit/>` marker is\n * left in place (the renderer draws the baked `cy`).\n *\n * Safe to call with an empty registry (no-op). Warns once if any opted-in box could\n * not be measured (missing metrics) so overflow is not silently ignored.\n */\nexport function applyMeasuredFit(slides: PresSlideInternal[], registry: FontMetricsRegistry): void {\n\tif (registry.size === 0) return\n\n\t// A deck that registered *some* metrics has opted into measured fit, so a named\n\t// face we have no exact metrics for falls back to the conservative heuristic rather\n\t// than degrading to the bare flag — overflow still self-corrects, just less precisely.\n\t// An unnamed (theme-default) face stays unmeasurable: we cannot guess which face it is.\n\tconst heuristicFaces = new Set<string>()\n\tconst resolve = makeRegistryResolver(registry, (face) => heuristicFaces.add(face))\n\tconst unmeasuredShrink = new Set<string>()\n\tconst unmeasuredResize = new Set<string>()\n\n\tconst collectUnmeasured = (paragraphs: FitParagraph[], into: Set<string>): void => {\n\t\tfor (const para of paragraphs)\n\t\t\tfor (const run of para.runs) if (!resolve(run)) into.add(run.fontFace ?? '(theme default)')\n\t}\n\n\t/**\n\t * Bake measured shrink into a table's cells. Walks the cell grid (accounting for\n\t * colspan/rowspan) to size each cell's box from its column widths and row heights,\n\t * then lowers the run font sizes of any `fit:'shrink'` cell that overflows. Cells\n\t * in auto-height rows (no fixed `rowH`/table `h`) are skipped — the row grows instead.\n\t */\n\tconst measureTableCells = (tableObj: SlideObject, layout: PresSlideInternal['_presLayout']): void => {\n\t\tconst rows = tableObj.arrTabRows\n\t\tif (!rows || rows.length === 0 || !rows[0]) return\n\t\tconst tableOpts = (tableObj.options ?? {}) as RunOpts\n\t\tconst numRows = rows.length\n\t\tconst numCols = tableColCount(rows)\n\t\tif (!(numCols > 0)) return\n\n\t\tconst cxEmu =\n\t\t\ttableOpts.w != null ? getSmartParseNumber(tableOpts.w, 'X', layout) : getSmartParseNumber('75%', 'X', layout)\n\t\tconst colWidthsEmu = resolveTableColWidthsEmu(tableOpts.colW, cxEmu, numCols)\n\t\tconst tableHeightEmu =\n\t\t\ttableOpts.h != null\n\t\t\t\t? getSmartParseNumber(tableOpts.h, 'Y', layout)\n\t\t\t\t: typeof tableOpts.cy === 'number'\n\t\t\t\t\t? tableOpts.cy\n\t\t\t\t\t: 0\n\t\tconst rowHeightEmu = (rIdx: number): number => {\n\t\t\tif (Array.isArray(tableOpts.rowH) && tableOpts.rowH[rIdx]) return inch2Emu(Number(tableOpts.rowH[rIdx]))\n\t\t\tif (tableOpts.rowH != null && !Array.isArray(tableOpts.rowH) && !isNaN(Number(tableOpts.rowH)))\n\t\t\t\treturn inch2Emu(Number(tableOpts.rowH))\n\t\t\tif (tableHeightEmu > 0) return Math.round(tableHeightEmu / numRows)\n\t\t\treturn 0 // auto-height row → grows to fit, no shrink\n\t\t}\n\n\t\tfor (const { cell, row: r, col: colStart, colSpan, rowSpan } of walkTableGrid(rows, numCols)) {\n\t\t\tconst colEnd = colStart + colSpan\n\t\t\tconst cellOpts = cell?.options ?? {}\n\t\t\tconst fit = cellOpts.fit ?? (tableOpts.fit === 'shrink' ? 'shrink' : undefined)\n\t\t\tif (fit !== 'shrink') continue\n\n\t\t\tlet widthEmu = 0\n\t\t\tfor (let c = colStart; c < colEnd; c++) widthEmu += colWidthsEmu[c] ?? 0\n\t\t\tlet heightEmu = 0\n\t\t\tlet autoHeight = false\n\t\t\tfor (let rr = r; rr < r + rowSpan; rr++) {\n\t\t\t\tconst h = rowHeightEmu(rr)\n\t\t\t\tif (h <= 0) {\n\t\t\t\t\tautoHeight = true\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\theightEmu += h\n\t\t\t}\n\t\t\tif (autoHeight) continue\n\n\t\t\tconst eff = effectiveCellOpts(cellOpts, tableOpts)\n\t\t\tconst ins = resolveCellInsetsEmu(eff.margin)\n\t\t\tconst innerWidthPt = (widthEmu - ins.marL - ins.marR) / EMU_PER_POINT\n\t\t\tconst innerHeightPt = (heightEmu - ins.marT - ins.marB) / EMU_PER_POINT\n\t\t\tif (!(innerWidthPt > 0) || !(innerHeightPt > 0)) continue\n\n\t\t\tconst paragraphs = extractParagraphs({ text: cell.text, options: eff } as unknown as SlideObject)\n\t\t\tif (!paragraphs) continue\n\t\t\tconst box: FitBox = { innerWidthPt, innerHeightPt }\n\t\t\tconst outcome = solveShrink(paragraphs, box, resolve)\n\t\t\tif (outcome.kind === 'shrink') {\n\t\t\t\tconst f = outcome.result.fontScalePct / 100\n\t\t\t\tif (f < 1) scaleCellFontSizes(cell, eff, f)\n\t\t\t} else if (outcome.kind === 'unmeasurable') {\n\t\t\t\tcollectUnmeasured(paragraphs, unmeasuredShrink)\n\t\t\t}\n\t\t\t// 'fits' → leave the authored size; the text already fits.\n\t\t}\n\t}\n\n\tconst measureObject = (obj: SlideObject, layout: PresSlideInternal['_presLayout']): void => {\n\t\t// Groups keep their children outside slide._slideObjects. Descend through every\n\t\t// nesting level so grouping remains a visual/editability operation and does not\n\t\t// disable the export-time fit pass for contained text.\n\t\tif (obj._type === SlideObjectType.group) {\n\t\t\tfor (const child of obj._groupObjects ?? []) measureObject(child, layout)\n\t\t\treturn\n\t\t}\n\t\tif (obj._type === SlideObjectType.table) {\n\t\t\tmeasureTableCells(obj, layout)\n\t\t\treturn\n\t\t}\n\t\tif (obj._type !== SlideObjectType.text) return\n\t\t// Only the bare string forms opt into measurement; an explicit object form is\n\t\t// already baked by the caller, and 'none' is a no-op.\n\t\tconst options = obj.options\n\t\tif (!options) return\n\t\tconst fit = options.fit\n\t\tif (fit !== 'shrink' && fit !== 'resize') return\n\n\t\tconst paragraphs = extractParagraphs(obj)\n\t\tif (!paragraphs) return\n\t\tconst box = computeBox(obj, layout)\n\t\tif (!box) return\n\n\t\tif (fit === 'shrink') {\n\t\t\tconst outcome = solveShrink(paragraphs, box, resolve)\n\t\t\tif (outcome.kind === 'shrink') {\n\t\t\t\tconst { fontScalePct, lnSpcReductionPct } = outcome.result\n\t\t\t\toptions.fit = {\n\t\t\t\t\ttype: 'shrink',\n\t\t\t\t\tfontScale: fontScalePct,\n\t\t\t\t\tlnSpcReduction: lnSpcReductionPct || undefined,\n\t\t\t\t}\n\t\t\t} else if (outcome.kind === 'unmeasurable') {\n\t\t\t\tcollectUnmeasured(paragraphs, unmeasuredShrink)\n\t\t\t}\n\t\t\t// 'fits' → leave the bare flag; the text already fits, so no scale is needed.\n\t\t} else {\n\t\t\tconst outcome = solveResize(paragraphs, box, resolve)\n\t\t\tif (outcome.kind === 'resize') {\n\t\t\t\tconst opts = obj.options as RunOpts\n\t\t\t\tconst { tIns, bIns } = resolveInsetsEmu(opts)\n\t\t\t\tconst oldHeightEmu = getSmartParseNumber(opts.h, 'Y', layout)\n\t\t\t\tconst newHeightEmu = Math.round(outcome.neededInnerHeightPt * EMU_PER_POINT) + tIns + bIns\n\t\t\t\t// Shift the box origin so growth/shrink honors the vertical anchor; `off.y`\n\t\t\t\t// moves up by the anchor's share of the height delta (0 / half / full for t / ctr / b).\n\t\t\t\tconst oldYEmu = getSmartParseNumber(opts.y, 'Y', layout)\n\t\t\t\tconst shiftEmu = Math.round((newHeightEmu - oldHeightEmu) * anchorTopShareOfDelta(opts))\n\t\t\t\topts.h = `${newHeightEmu}emu`\n\t\t\t\tif (shiftEmu !== 0) opts.y = `${oldYEmu - shiftEmu}emu`\n\t\t\t} else {\n\t\t\t\tcollectUnmeasured(paragraphs, unmeasuredResize)\n\t\t\t}\n\t\t}\n\t}\n\n\tfor (const slide of slides) {\n\t\tfor (const obj of slide._slideObjects ?? []) measureObject(obj, slide._presLayout)\n\t}\n\n\tif (unmeasuredShrink.size > 0) {\n\t\twarn(\n\t\t\t'measure/shrink-unmeasured',\n\t\t\t`fit:'shrink' could not be measured for font(s) [${[...unmeasuredShrink].join(', ')}] — ` +\n\t\t\t\t'no registered metrics. Emitting bare <a:normAutofit/> (text will not pre-shrink in headless renders). ' +\n\t\t\t\t'Call pptx.registerFontMetrics(face, fontFilePathOrBytes) to enable measured fit.'\n\t\t)\n\t}\n\tif (unmeasuredResize.size > 0) {\n\t\twarn(\n\t\t\t'measure/resize-unmeasured',\n\t\t\t`fit:'resize' could not be measured for font(s) [${[...unmeasuredResize].join(', ')}] — ` +\n\t\t\t\t'no registered metrics. Emitting bare <a:spAutoFit/> with the authored height (box will not auto-grow in headless renders). ' +\n\t\t\t\t'Call pptx.registerFontMetrics(face, fontFilePathOrBytes) to enable measured fit.'\n\t\t)\n\t}\n\tif (heuristicFaces.size > 0) {\n\t\twarn(\n\t\t\t'measure/heuristic-metrics',\n\t\t\t`Note: measured fit used a conservative average-advance estimate for font(s) [${[...heuristicFaces].join(', ')}] — ` +\n\t\t\t\t'no exact metrics registered. Fit is approximate (may shrink/grow more than necessary). ' +\n\t\t\t\t'Call pptx.registerFontMetrics(face, fontFilePathOrBytes) for an exact fit.'\n\t\t)\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AA2CA,IAAM,sBAAN,MAAiD;CAChD;CACA,YAAY,MAAwB;EACnC,KAAK,OAAO;CACb;CAEA,IAAI,aAAqB;EACxB,OAAO,KAAK,KAAK;CAClB;CAEA,eAAe,MAAc,QAAgB,gBAAgB,GAAW;EACvE,IAAI,CAAC,MAAM,OAAO;EAKlB,MAAM,QAAQ,SAAS,KAAK,KAAK;EACjC,IAAI,QAAQ;EACZ,IAAI,QAAQ;EACZ,KAAK,MAAM,MAAM,MAAM;GACtB,MAAM,QAAQ,KAAK,KAAK,YAAY,EAAE;GACtC,UAAU,OAAO,gBAAgB,KAAK;GACtC;EACD;EACA,IAAI,eAAe,SAAS,gBAAgB;EAC5C,OAAO;CACR;CAEA,aAAa,IAAqB;EAGjC,OAAO,KAAK,KAAK,QAAQ,OAAO,cAAc,EAAE,CAAC;CAClD;AACD;AAEA,MAAM,yBAAyB;;;;;;;;;AAU/B,SAAS,mBAAmB,IAAoB;CAC/C,MAAM,KAAK,GAAG,YAAY,CAAC,KAAK;CAChC,IAAI,KAAK,OAAQ,OAAO;CACxB,IAAI,KAAK,KAAM,OAAO;CACtB,IAAI,OAAO,OAAO,OAAO,KAAM,OAAO;CACtC,IAAI,c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B,KACC,6BACA,mDAAmD,CAAC,GAAG,gBAAgB,CAAC,CAAC,KAAK,IAAI,EAAE,gNAGrF;CAED,IAAI,eAAe,OAAO,GACzB,KACC,6BACA,gFAAgF,CAAC,GAAG,cAAc,CAAC,CAAC,KAAK,IAAI,EAAE,sKAGhH;AAEF"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { n as warn } from "./diagnostics-DYQC7xLV.js";
|
|
2
|
-
import { n as InvalidOptionError } from "./errors-
|
|
3
|
-
import { r as EMU_PER_INCH } from "./units-
|
|
4
|
-
import { i as inch2Emu } from "./units-internal-
|
|
5
|
-
import { t as getSlidesForTableRows } from "./autopage-
|
|
2
|
+
import { n as InvalidOptionError } from "./errors-Bvln0H-7.js";
|
|
3
|
+
import { r as EMU_PER_INCH } from "./units-C7QM1KgH.js";
|
|
4
|
+
import { i as inch2Emu } from "./units-internal-CR8s8YQa.js";
|
|
5
|
+
import { t as getSlidesForTableRows } from "./autopage-QQyfRtoK.js";
|
|
6
6
|
//#region src/gen/table/html-dom.ts
|
|
7
7
|
/**
|
|
8
8
|
* Stand-in for `getComputedStyle` on a document that has no view — a document produced by
|
|
@@ -677,4 +677,4 @@ function genTableToSlides(pptx, target, options = {}) {
|
|
|
677
677
|
//#endregion
|
|
678
678
|
export { genTableToSlides as t };
|
|
679
679
|
|
|
680
|
-
//# sourceMappingURL=html-dom
|
|
680
|
+
//# sourceMappingURL=html-dom-DajBuobe.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"html-dom-DajBuobe.js","names":[],"sources":["../src/gen/table/html-dom.ts"],"sourcesContent":["/**\n * ts-pptx: HTML-table → slides (browser DOM path)\n *\n * The tableToSlides() flow: reproduce an HTML table as a PowerPoint table across as many\n * slides as needed. The DOM-independent parts are factored into pure helpers\n * (`resolveHtmlColWidth`, `pickColWidthBasis`, `htmlBorderToProps`, `cssColorToHex`) that\n * are unit-tested directly, and the whole flow runs anywhere there is a DOM.\n *\n * Only real *measurement* is out of active scope (see AGENTS.md): without a layout engine\n * `offsetWidth` is `0`, so widths fall back to computed CSS then to an equal split. A fallback\n * rather than a degradation, and the distinction is load-bearing — see {@link pickColWidthBasis},\n * whose two bases measure different boxes.\n *\n * **Coverage.** This file used to be excluded from the report, on the grounds that only the\n * browser entry imported it and the `dist/browser*.js` globs therefore swallowed it. Both\n * halves of that are stale: `ts-pptx/html` imports it too, so tsdown emits it as its own\n * `dist/html-dom-*.js` chunk, and those globs are gone from `vitest.config.ts` entirely. It\n * is covered code now — against happy-dom by the Node suite\n * (test/regression/html-to-slides-node.test.js) and, for the measured width basis that no\n * Node DOM can produce, in a real Chromium (test/browser/table-widths.spec.mjs).\n */\n\nimport { SlideObjectType } from '../../enums.js'\nimport type {\n\tAddSlideProps,\n\tBorderProps,\n\tPresLayout,\n\tTableCell,\n\tTableToSlidesDocument,\n\tTableToSlidesElement,\n\tTableToSlidesProps,\n\tTableCellProps,\n} from '../../types/index.js'\nimport type { Slide } from '../../types/slide.js'\nimport type { SlideLayoutInternal } from '../../types/internal.js'\nimport { inch2Emu } from '../../units-internal.js'\nimport { warn } from '../../diagnostics.js'\nimport { DEFAULT_PX_PER_INCH, EMU_PER_INCH } from '../../units.js'\nimport { getSlidesForTableRows } from './autopage.js'\nimport { InvalidOptionError } from '../../errors.js'\n\ntype MarginTuple = [number, number, number, number]\ntype BorderTuple = [BorderProps, BorderProps, BorderProps, BorderProps]\n/**\n * What `tableToSlides` needs a presentation to be: somewhere to put slides, and a layout to\n * size them against. Structural on purpose — stating the two members rather than naming the\n * class is what lets the free function on `ts-pptx/html` take any presentation instance\n * (Node, browser, or standalone) without the entry importing one.\n */\nexport type TableToSlidesHost = {\n\taddSlide: (options?: AddSlideProps) => Slide\n\tpresLayout: PresLayout\n}\n\n/**\n * The whole DOM surface `genTableToSlides` needs: the table element, and a way to read a\n * cell's computed style.\n *\n * Resolving this once up front is what decouples the flow from `window`/`document`. Given the\n * element itself, both halves come from the element's own `ownerDocument`/`defaultView`, so no\n * global is read at all — which is what lets the same implementation run outside a browser.\n */\ntype DomContext = {\n\ttable: Element\n\tgetComputedStyle: (el: Element) => CSSStyleDeclaration\n}\n\n/**\n * Stand-in for `getComputedStyle` on a document that has no view — a document produced by\n * parsing rather than by a browsing context has a `null` `defaultView` and therefore no\n * cascade to compute against. Every property reads as `''`, which every consumer below\n * already treats as \"not set\", so styling degrades to defaults instead of throwing.\n */\nconst NO_COMPUTED_STYLE = {\n\tgetPropertyValue: () => '',\n} as unknown as CSSStyleDeclaration\n\n/**\n * Bind a style reader to the document's own view, falling back to {@link NO_COMPUTED_STYLE}.\n * @param {Document | null} doc - the table's owner document\n * @returns {(el: Element) => CSSStyleDeclaration} computed-style reader\n */\nfunction resolveStyleReader(doc: Document | null): (el: Element) => CSSStyleDeclaration {\n\tconst view = doc?.defaultView\n\treturn view ? view.getComputedStyle.bind(view) : () => NO_COMPUTED_STYLE\n}\n\n/**\n * Resolve the table element and its style reader from whatever the caller passed.\n *\n * An **element** needs no ambient DOM: the document and its view are reached through\n * `ownerDocument`/`defaultView`. A **string id** does need one, taken from `options.document`\n * when supplied and otherwise from `globalThis.document`; with neither, the error names both\n * remedies rather than surfacing a bare `document is not defined`.\n *\n * This is the one place the public structural element type ({@link TableToSlidesElement},\n * which any DOM satisfies) is narrowed to `lib.dom`'s `Element`, so the rest of the flow can\n * be written against ordinary DOM types. The cast is safe in the only sense that matters here:\n * everything downstream reads standard members and tolerates them being absent — that is what\n * makes the conversion portable in the first place.\n * @param {TableToSlidesElement | string} target - the table element, or the id of one\n * @param {TableToSlidesProps} options - generation options (may carry an explicit `document`)\n * @returns {DomContext} resolved DOM context\n */\nfunction resolveDomContext(target: TableToSlidesElement | string, options: TableToSlidesProps): DomContext {\n\tconst asElement = (element: TableToSlidesElement): Element => element as unknown as Element\n\n\tif (typeof target !== 'string') {\n\t\tconst table = asElement(target)\n\t\treturn { table, getComputedStyle: resolveStyleReader(table.ownerDocument) }\n\t}\n\n\tconst doc = options.document ?? (globalThis as { document?: TableToSlidesDocument }).document\n\tif (!doc) {\n\t\tthrow new InvalidOptionError(\n\t\t\t'html/no-document',\n\t\t\t'tableToSlides: no DOM available to resolve the table id \"' +\n\t\t\t\ttarget +\n\t\t\t\t'\" — pass the <table> element itself, or supply a document via `options.document`.'\n\t\t)\n\t}\n\tconst found = doc.getElementById(target)\n\tif (!found)\n\t\tthrow new InvalidOptionError('html/table-not-found', 'tableToSlides: Table ID \"' + target + '\" does not exist!')\n\tconst table = asElement(found)\n\treturn { table, getComputedStyle: resolveStyleReader(table.ownerDocument) }\n}\n\n// ===== DOM-table helpers (browser path) =====\n// DOM-independent helpers factored out of the browser-only tableToSlides() flow\n// so they can be unit-tested without a rendered page (see AGENTS.md scope note).\n\n/**\n * Convert one 0-255 RGB component to its two-digit hex form.\n *\n * Lives here rather than beside the other color code in `gen/drawingml/color.ts` because\n * `getComputedStyle` colors are the only thing in the package that arrives as RGB\n * components — nothing else in the library calls this.\n * @param {number} c - component color\n * @returns {string} hex string\n */\nfunction componentToHex(c: number): string {\n\tconst hex = c.toString(16)\n\treturn hex.length === 1 ? '0' + hex : hex\n}\n\n/**\n * Converts RGB colors from css selectors to Hex for Presentation colors\n * @param {number} r - red value\n * @param {number} g - green value\n * @param {number} b - blue value\n * @returns {string} XML string\n */\nfunction rgbToHex(r: number, g: number, b: number): string {\n\treturn (componentToHex(r) + componentToHex(g) + componentToHex(b)).toUpperCase()\n}\n\n/**\n * Convert a computed CSS border (width string + color string) from `getComputedStyle` into a\n * pptx `BorderProps`.\n *\n * Preserves *fractional* widths: a hairline CSS border such as `0.5px` must not be rounded to\n * `0pt` and silently vanish — the table serializer (`valToPts`) emits fractional points just\n * fine, so there is no reason to integer-round here. A\n * computed width of `0` (or a non-finite value) yields `{ type: 'none' }` so we never emit a\n * zero-width line.\n * @param {string} widthStr - computed `border-<side>-width`, e.g. `\"0.5px\"`\n * @param {string} colorStr - computed `border-<side>-color`, e.g. `\"rgb(102, 102, 102)\"`\n * @returns {BorderProps} border props for the cell side\n */\nexport function htmlBorderToProps(widthStr: string, colorStr: string): BorderProps {\n\tconst pt = Number(String(widthStr).replace('px', ''))\n\tif (!isFinite(pt) || pt <= 0) return { type: 'none' }\n\treturn { width: pt, color: cssColorToHex(colorStr) ?? '000000' }\n}\n\n/**\n * Convert a computed CSS color to a pptx hex color, or report that it has none.\n *\n * A browser normalizes every computed color to `rgb()`/`rgba()`, which is why the flow below\n * originally only parsed that form. Outside a browser there is no normalization step, so a\n * computed color comes back however the stylesheet wrote it — `#ff0000` is what happy-dom\n * returns. Feeding that to the `rgb()` parser produced `Number('#ff0000')` → `NaN` → the\n * literal color string `\"NANNANNAN\"`, an invalid value emitted without complaint.\n *\n * Handles `rgb()`/`rgba()` and `#rgb`/`#rrggbb`. Everything else — a named color, a `color()`\n * function, an empty string — returns `undefined` rather than a guess, so the caller can\n * apply its own default instead of emitting nonsense.\n *\n * A fully transparent color (`alpha === 0`) also returns `undefined`: it states the absence of\n * a color, and pptx has no way to say \"transparent\" in a solid fill.\n * @param {string} value - computed CSS color, e.g. `\"rgb(255, 0, 0)\"` or `\"#ff0000\"`\n * @returns {string | undefined} six-digit uppercase hex, or `undefined` when unparseable\n */\nexport function cssColorToHex(value: string): string | undefined {\n\tconst raw = String(value ?? '').trim()\n\n\tconst rgbMatch = /^rgba?\\(([^)]*)\\)$/i.exec(raw)\n\tif (rgbMatch) {\n\t\tconst parts = (rgbMatch[1] ?? '').split(/[,/\\s]+/).filter((part) => part.length > 0)\n\t\tif (parts.length < 3) return undefined\n\t\tconst channels = parts.slice(0, 3).map((part) => Number(part.replace('%', '')))\n\t\tif (channels.some((channel) => !isFinite(channel))) return undefined\n\t\tif (parts.length > 3 && Number(parts[3]) === 0) return undefined\n\t\t// Clamp and round before hex conversion: a browser always computes whole 0-255\n\t\t// channels, but nothing guarantees another DOM does, and `(255.5).toString(16)`\n\t\t// is `\"ff.8\"` — a malformed color rather than a wrong one.\n\t\tconst [r = 0, g = 0, b = 0] = channels.map((channel) => Math.max(0, Math.min(255, Math.round(channel))))\n\t\treturn rgbToHex(r, g, b)\n\t}\n\n\tconst hexMatch = /^#([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(raw)\n\tif (hexMatch) {\n\t\tconst digits = hexMatch[1] ?? ''\n\t\tconst full =\n\t\t\tdigits.length === 3\n\t\t\t\t? digits\n\t\t\t\t\t\t.split('')\n\t\t\t\t\t\t.map((digit) => digit + digit)\n\t\t\t\t\t\t.join('')\n\t\t\t\t: digits\n\t\treturn full.toUpperCase()\n\t}\n\n\treturn undefined\n}\n\n/**\n * Resolve a single HTML-table column width for `tableToSlides`.\n *\n * Precedence: an explicit `data-pptx-width` wins outright; otherwise the proportional width\n * derived from the live table is used, raised to `data-pptx-min-width` when that floor is larger.\n *\n * Hidden tables report `offsetWidth` 0 for every cell, which makes `calcWidth` non-finite (a 0/0\n * proportional calc). Fall back to `0` there so an explicit `data-pptx-width` / `data-pptx-min-width`\n * override still drives the column instead of emitting a `NaN` width.\n * @param {number} calcWidth - proportional width derived from `offsetWidth` (may be `NaN` for hidden tables)\n * @param {number} setWidth - `data-pptx-width` override (`0`/`NaN` when absent or invalid)\n * @param {number} minWidth - `data-pptx-min-width` floor (`0`/`NaN` when absent or invalid)\n * @returns {number} resolved column width\n */\nexport function resolveHtmlColWidth(calcWidth: number, setWidth: number, minWidth: number): number {\n\tconst safeCalc = isFinite(calcWidth) ? calcWidth : 0\n\tif (isFinite(setWidth) && setWidth > 0) return setWidth\n\treturn isFinite(minWidth) && minWidth > safeCalc ? minWidth : safeCalc\n}\n\n/** A CSS value that is a bare number, or a number with a `px`/`%` unit. Nothing else parses. */\nconst CSS_LENGTH = /^\\s*(-?(?:\\d+\\.?\\d*|\\.\\d+))\\s*(px|%)?\\s*$/i\n\n/**\n * Parse a single computed CSS length in **px** to its numeric magnitude.\n *\n * A bare number is read as px (computed styles do not emit one, but an inline `style` read\n * back by a non-browser DOM can). Everything else — `''`, `auto`, `3em`, and deliberately\n * `30%` — is `NaN`: a percentage is meaningful only relative to something, so it cannot be\n * turned into an absolute length here. (Percentages *are* usable as a proportional column\n * basis; that is {@link parseCssWidthBasis}'s job, not this one's.) Callers decide what a\n * `NaN` means for them.\n * @param {string} value - computed CSS value, e.g. `\"1.5px\"`\n * @returns {number} magnitude in px, or `NaN` when the value is not an absolute px length\n */\nexport function parseCssPx(value: string): number {\n\tconst match = CSS_LENGTH.exec(String(value ?? ''))\n\tif (!match || match[2] === '%') return NaN\n\treturn Number(match[1])\n}\n\n/**\n * Parse a whole row of computed CSS widths into a column basis, or reject the set.\n *\n * The result is only ever used *proportionally* (each column's share of the total), so the\n * unit does not have to be absolute — it only has to be the same for every column. Hence:\n *\n * - all `px` (or bare numbers) → their magnitudes\n * - all `%` → their magnitudes; `[25%, 25%, 50%]` is a perfectly good 1:1:2 basis\n * - anything else, or a **mix** of units, or a single unparseable entry (`auto`, `''`,\n * `3em`) → `[]`, meaning \"no usable basis\"\n *\n * Rejecting the whole set on one bad entry is deliberate: a partial basis would silently\n * give the unparseable columns zero width, which is worse than falling back to an equal\n * split. Negative magnitudes reject for the same reason.\n * @param {readonly string[]} values - computed `width` per column, in column order\n * @returns {number[]} per-column basis, or `[]` when the set is not usable\n */\nexport function parseCssWidthBasis(values: readonly string[]): number[] {\n\tconst basis: number[] = []\n\tlet unit = ''\n\tfor (const value of values) {\n\t\tconst match = CSS_LENGTH.exec(String(value ?? ''))\n\t\tif (!match) return []\n\t\tconst magnitude = Number(match[1])\n\t\tif (!isFinite(magnitude) || magnitude < 0) return []\n\t\tconst valueUnit = (match[2] ?? 'px').toLowerCase()\n\t\tif (!unit) unit = valueUnit\n\t\telse if (unit !== valueUnit) return []\n\t\tbasis.push(magnitude)\n\t}\n\treturn basis\n}\n\n/**\n * Choose which vector the proportional column math runs on, falling back as bases run out.\n *\n * `offsetWidth` is the ideal basis — it is the width the table actually rendered at — but it\n * requires a layout engine, and reports `0` for every cell both in a hidden table and on any\n * DOM outside a browser. So:\n *\n * 1. **measured** (`offsetWidth`) when it carries any width at all — the browser path, unchanged\n * 2. **CSS widths** when the stylesheet states them (see {@link parseCssWidthBasis})\n * 3. **equal split** otherwise — a basis of all-ones, which the existing proportional math\n * turns into equal columns for free\n *\n * Only the basis changes; `data-pptx-width` / `data-pptx-min-width` overrides still apply\n * downstream via {@link resolveHtmlColWidth} and still win outright.\n *\n * **The first two bases do not measure the same box, and the docs used to imply they did.**\n * `offsetWidth` is the border box; a computed `width` is the content box. Padding alone\n * separates them — `test/browser/harness/table.html` is built so it does, giving 1:1 measured\n * against 2:1 from CSS on one table — so choosing arm 2 over arm 1 can change a table's column\n * *proportions*, not just their precision. That is why the fixture discriminates at all, and why\n * \"degrades to computed CSS\" was the wrong word for it everywhere it appeared.\n *\n * Left as-is rather than reconciled. Normalizing arm 2 to the border box would need the computed\n * padding and border widths, which the DOMs that reach arm 2 need not resolve either (a `%`\n * padding computes to nothing usable without layout), so it would converge the two only\n * sometimes — and it would collapse the one discriminator the browser lane has, turning\n * `table-widths.spec.mjs` back into a test that passes whether or not the measured arm ran.\n * A caller who needs both runtimes to agree on a column states it with `data-pptx-width`.\n * @param {readonly number[]} measured - per-column `offsetWidth`\n * @param {readonly number[]} cssWidths - per-column CSS width basis (`[]` when unusable)\n * @returns {number[]} the basis vector to run the proportional calc on\n */\nexport function pickColWidthBasis(measured: readonly number[], cssWidths: readonly number[]): number[] {\n\tconst sum = (arr: readonly number[]): number => arr.reduce((acc, n) => acc + (isFinite(n) ? n : 0), 0)\n\tif (sum(measured) > 0) return [...measured]\n\tif (cssWidths.length === measured.length && sum(cssWidths) > 0) return [...cssWidths]\n\treturn measured.map(() => 1)\n}\n\n/** One cell's span attributes, as far as the grid walk cares. */\ntype GridCellSpans = { colspan?: number; rowspan?: number }\n\n/**\n * Read a `colspan`/`rowspan` as the number of grid tracks it covers.\n *\n * Lenient on purpose: `0`, a negative, a fraction, an unparseable attribute and an absent one all\n * mean `1`. A bad span attribute should cost its own cell nothing and the rest of the grid nothing\n * — the alternative, propagating a `NaN` or a negative into the column walk, shifts every\n * subsequent column.\n * @param {unknown} value - the raw attribute value\n * @returns {number} tracks covered, at least 1\n */\nfunction gridSpan(value: unknown): number {\n\tconst num = Math.floor(Number(value))\n\treturn isFinite(num) && num > 1 ? num : 1\n}\n\n/**\n * Measure the column grid a set of table rows actually occupies.\n *\n * An HTML table is not a rectangle of cells — a row states only the cells it *starts*, so its\n * length says nothing about how many grid columns it fills: a `colspan` fills several, and a\n * `rowspan` started higher up fills one without the row mentioning it. The pptx side has no such\n * model: `<a:tblGrid>` declares N columns and every `<a:tr>` must carry N `<a:tc>`. Something has\n * to translate, and that is a walk of the standard HTML table model — cells pack left to right,\n * skipping columns still held by a rowspan above.\n *\n * Returns the grid width and, per row, how many columns that row reaches. The difference between\n * the two is exactly the padding a ragged row needs; the merge cells for `colspan`/`rowspan` are\n * *not* padding — the table emitter synthesizes those itself, so they are counted as filled here.\n *\n * Spans are read through {@link gridSpan}, so a bad attribute cannot shift the whole grid.\n * @param {readonly (readonly GridCellSpans[])[]} rows - per-row cell spans, in emission order\n * @returns {{ columns: number, filled: number[] }} grid width, and columns reached per row\n */\nexport function measureGridColumns(rows: readonly (readonly GridCellSpans[])[]): { columns: number; filled: number[] } {\n\t// carry[c] = how many further rows column c is still held by a rowspan started above.\n\tconst carry: number[] = []\n\tconst filled: number[] = []\n\n\tfor (const row of rows) {\n\t\tlet col = 0\n\t\tfor (const cell of row) {\n\t\t\twhile ((carry[col] ?? 0) > 0) col++\n\t\t\tconst colspan = gridSpan(cell?.colspan)\n\t\t\t// Written now, decremented at the end of this row, so it leaves `rowspan - 1` behind.\n\t\t\tfor (let idx = 0; idx < colspan; idx++) carry[col + idx] = gridSpan(cell?.rowspan)\n\t\t\tcol += colspan\n\t\t}\n\t\t// Trailing columns held from above count too: a row whose last cells are all rowspan\n\t\t// continuations reaches past its own final cell.\n\t\twhile ((carry[col] ?? 0) > 0) col++\n\t\tfilled.push(col)\n\t\tfor (let idx = 0; idx < carry.length; idx++) {\n\t\t\tconst held = carry[idx] ?? 0\n\t\t\tif (held > 0) carry[idx] = held - 1\n\t\t}\n\t}\n\n\treturn { columns: filled.reduce((max, reached) => (reached > max ? reached : max), 0), filled }\n}\n\n/**\n * Widen a column-width basis to cover a grid wider than the row it was derived from.\n *\n * The basis comes from one row — the first with cells — but the grid is as wide as the *widest*\n * row, and those need not agree (a single spanning header over a wider body is the common shape).\n * The columns the source row never described get the average of the ones it did, so they read as\n * ordinary columns rather than as a zero-width sliver; with no usable basis at all they get `1`,\n * which the proportional calc downstream turns into an equal split.\n * @param {readonly number[]} basis - per-column basis derived from the width-source row\n * @param {number} columns - the full grid width\n * @returns {number[]} basis covering every grid column\n */\nexport function extendColBasis(basis: readonly number[], columns: number): number[] {\n\tconst extended = [...basis]\n\tconst total = extended.reduce((acc, width) => acc + (isFinite(width) ? width : 0), 0)\n\tconst share = extended.length > 0 && total > 0 ? total / extended.length : 1\n\twhile (extended.length < columns) extended.push(share)\n\treturn extended\n}\n\n/**\n * The minimum a cell has to look like for {@link readCellText}. Any DOM's element satisfies it;\n * stating it structurally is what lets the fallback walk be unit-tested without a DOM at all.\n */\ntype TextCell = {\n\tinnerText?: string\n\tnodeType?: number\n\tnodeValue?: string | null\n\tnodeName?: string\n\tchildNodes?: ArrayLike<TextCell>\n}\n\n/**\n * Read a cell's text, with `<br>` surviving as a newline.\n *\n * `innerText` is the right answer in a browser — it is the *rendered* text, so it already\n * collapses whitespace, honors `display: none`, and turns `<br>` into `\"\\n\"`. But it is an\n * HTML-spec extra tied to rendering, and outside a browser it is either absent (jsdom does not\n * implement it, so every cell would come out empty) or present but not actually rendered\n * (happy-dom returns `\"ab\"` for `a<br>b`, so every cell would come out on one line).\n *\n * So both are computed and the better one wins: a `childNodes` walk that maps `<br>` to a line\n * break and collapses whitespace per line, and `innerText`. `innerText` is preferred unless it\n * dropped a line break the walk found — the one thing that provably makes it not the rendered\n * text. Neither can know about `text-transform` without a browser.\n * @param {TextCell} cell - the table cell element\n * @returns {string} cell text, `<br>`-separated lines joined by `\"\\n\"`\n */\nexport function readCellText(cell: TextCell): string {\n\t// Accumulate one bucket per line rather than one string with \"\\n\" separators: the source's\n\t// own indentation contains newlines, and only a `<br>` may actually start a new line. A\n\t// separator character could not tell those two apart; separate buckets never have to.\n\tconst lines: string[] = ['']\n\tconst append = (text: string): void => {\n\t\tlines[lines.length - 1] = (lines[lines.length - 1] ?? '') + text\n\t}\n\tconst walk = (node: TextCell): void => {\n\t\tif (node.nodeType === 3) {\n\t\t\tappend(node.nodeValue ?? '')\n\t\t\treturn\n\t\t}\n\t\tif (node.nodeType !== 1) return\n\t\tif ((node.nodeName ?? '').toUpperCase() === 'BR') {\n\t\t\tlines.push('')\n\t\t\treturn\n\t\t}\n\t\tconst children = node.childNodes\n\t\tfor (let idx = 0; idx < (children?.length ?? 0); idx++) {\n\t\t\tconst child = children?.[idx]\n\t\t\tif (child) walk(child)\n\t\t}\n\t}\n\n\t// Walk from the cell's children: the cell itself is an element, and can never be a BR.\n\tconst children = cell.childNodes\n\tfor (let idx = 0; idx < (children?.length ?? 0); idx++) {\n\t\tconst child = children?.[idx]\n\t\tif (child) walk(child)\n\t}\n\tconst walked = lines.map((line) => line.replace(/\\s+/g, ' ').trim()).join('\\n')\n\n\t// Prefer `innerText` — except when the walk found line breaks it dropped. A DOM that does\n\t// not render can still expose an `innerText` property that is really just `textContent`\n\t// (happy-dom returns `\"ab\"` for `a<br>b`), and that one is not the rendered text this\n\t// wants: it has silently lost the cell's line structure. Where it kept the breaks, it is\n\t// the better answer, because it also knows about `display:none` and `text-transform`.\n\tconst rendered = cell.innerText\n\tif (typeof rendered !== 'string') return walked\n\treturn walked.includes('\\n') && !rendered.includes('\\n') ? walked : rendered\n}\n\n// ===== Live-DOM tableToSlides() flow =====\n// Browser-only entry (reads a rendered table via getComputedStyle/offsetWidth);\n// out of active scope — see AGENTS.md. Internally signposted by `// STEP 1..5`.\n\n/**\n * Resolve `options.masterTitle` to the slide layout it names, so the auto-pager can take that\n * master's margins.\n *\n * The layout registry is a presentation *internal* — it is not on {@link TableToSlidesHost},\n * and the public `slideLayouts` getter deliberately hides the `_name` this matches on. Rather\n * than widen either, read it defensively: a host that has no registry simply resolves no\n * master, which is what a caller passing a bare `{ addSlide, presLayout }` object should get.\n * The alternative — dropping the lookup on the free-function path — would make `masterTitle`\n * silently do nothing there, which is a trap.\n * @param {TableToSlidesHost} pptx - the presentation the slides are being added to\n * @param {string} masterTitle - the `title` passed to `defineSlideMaster`\n * @returns {SlideLayoutInternal | undefined} the named layout, if this host has one\n */\nfunction resolveMasterSlide(pptx: TableToSlidesHost, masterTitle?: string): SlideLayoutInternal | undefined {\n\tif (!masterTitle) return undefined\n\tconst layouts = (pptx as { _slideLayouts?: SlideLayoutInternal[] })._slideLayouts\n\tif (!Array.isArray(layouts)) return undefined\n\treturn layouts.find((layout) => layout._name === masterTitle)\n}\n\n/** Which of the three logical sections a row belongs to. A section-less row counts as body. */\ntype TablePart = 'thead' | 'tbody' | 'tfoot'\n\n/**\n * A row's cells, via `HTMLTableRowElement.cells`.\n *\n * Read off the structural shape rather than the `lib.dom` type so a DOM that does not implement\n * the collection degrades to \"this row has no cells\" instead of throwing — the same tolerance\n * every other DOM read in this file has.\n * @param {Element} row - a `<tr>`\n * @returns {HTMLTableCellElement[]} the row's cells, in document order\n */\nfunction rowCells(row: Element): HTMLTableCellElement[] {\n\tconst cells = (row as { cells?: ArrayLike<Element> }).cells\n\treturn cells ? (Array.from(cells) as HTMLTableCellElement[]) : []\n}\n\n/**\n * Collect every row of the table, bucketed head → body → foot.\n *\n * `HTMLTableElement.rows` is the right source and a `thead tr`/`tbody tr`/`tfoot tr` query is not,\n * for two reasons the query cannot fix:\n *\n * - **A row need not be in a section.** `<table><tr>…` is valid authored markup, and a table built\n * with `createElement`/`appendChild` has no `<tbody>` at all — the HTML *parser* inserts one, the\n * DOM API does not. Those rows matched none of the three selectors and were silently dropped,\n * which is how a perfectly good table reached `addTable` with zero rows and threw\n * `addTable: Array expected!` (upstream gitbrent/PptxGenJS#1005).\n * - **A descendant query reaches into nested tables.** `tbody tr` matches the rows of a table\n * inside a cell of this one, folding them into the outer table as extra rows.\n *\n * Each row's own parentage settles both questions: it names the section the row belongs to (the\n * head/body/foot split still matters downstream, for repeating header rows on auto-paged slides),\n * and it says whether the row is this table's at all. The ownership check is not redundant with\n * using `rows` — happy-dom's `rows` is itself a descendant walk, so a nested table's rows arrive\n * there too. Checking is what makes the answer the same on every DOM.\n * @param {Element} table - the `<table>` being converted\n * @returns {Array<{ row: Element, part: TablePart }>} rows in emission order\n */\nfunction collectTableRows(table: Element): Array<{ row: Element; part: TablePart }> {\n\tconst head: Array<{ row: Element; part: TablePart }> = []\n\tconst body: Array<{ row: Element; part: TablePart }> = []\n\tconst foot: Array<{ row: Element; part: TablePart }> = []\n\tconst place = (row: Element): void => {\n\t\tconst parent = row.parentElement\n\t\tconst section = (parent?.nodeName ?? '').toUpperCase()\n\t\tconst sectioned = section === 'THEAD' || section === 'TBODY' || section === 'TFOOT'\n\t\tif ((sectioned ? parent?.parentElement : parent) !== table) return\n\t\tif (section === 'THEAD') head.push({ row, part: 'thead' })\n\t\telse if (section === 'TFOOT') foot.push({ row, part: 'tfoot' })\n\t\telse body.push({ row, part: 'tbody' })\n\t}\n\n\tconst rows = (table as { rows?: ArrayLike<Element> }).rows\n\tif (rows) {\n\t\tfor (let idx = 0; idx < rows.length; idx++) {\n\t\t\tconst row = rows[idx]\n\t\t\tif (row) place(row)\n\t\t}\n\t} else {\n\t\t// A DOM without `rows` is not one this library has ever run on, but the section query is\n\t\t// still a truthful fallback for the sectioned tables it can see.\n\t\tfor (const part of ['thead', 'tbody', 'tfoot']) {\n\t\t\ttable.querySelectorAll(`${part} tr`).forEach(place)\n\t\t}\n\t}\n\n\treturn [...head, ...body, ...foot]\n}\n\n/**\n * Reproduces an HTML table as a PowerPoint table - including column widths, style, etc. - creates 1 or more slides as needed\n * @param {TableToSlidesHost} pptx - ts-pptx instance\n * @param {TableToSlidesElement | string} target - the table element, or the HTMLElementID of the table\n * @param {TableToSlidesProps} options - array of options (e.g.: tabsize)\n */\nexport function genTableToSlides(\n\tpptx: TableToSlidesHost,\n\ttarget: TableToSlidesElement | string,\n\toptions: TableToSlidesProps = {}\n): void {\n\tconst opts = options || {}\n\tconst masterSlide = resolveMasterSlide(pptx, opts.masterTitle)\n\topts.slideMargin = opts.slideMargin || opts.slideMargin === 0 ? opts.slideMargin : 0.5\n\tlet emuSlideTabW = opts.w || pptx.presLayout.width\n\tconst arrObjTabHeadRows: TableCell[][] = []\n\tconst arrObjTabBodyRows: TableCell[][] = []\n\tconst arrObjTabFootRows: TableCell[][] = []\n\tconst arrColW: number[] = []\n\tconst arrTabColW: number[] = []\n\tconst arrTabColCssW: string[] = []\n\tlet arrInchMargins: [number, number, number, number] = [0.5, 0.5, 0.5, 0.5] // TRBL-style\n\tlet intTabW = 0\n\n\t// REALITY-CHECK: resolve the table (and its style reader) before anything else — this is\n\t// also where a missing/unresolvable table id fails.\n\tconst ctx = resolveDomContext(target, opts)\n\n\t// STEP 1: Set margins\n\tif (masterSlide?._margin) {\n\t\tif (Array.isArray(masterSlide._margin)) arrInchMargins = masterSlide._margin\n\t\telse if (!isNaN(masterSlide._margin))\n\t\t\tarrInchMargins = [masterSlide._margin, masterSlide._margin, masterSlide._margin, masterSlide._margin]\n\t\topts.slideMargin = arrInchMargins\n\t} else if (opts?.slideMargin) {\n\t\tif (Array.isArray(opts.slideMargin)) arrInchMargins = opts.slideMargin\n\t\telse if (!isNaN(opts.slideMargin))\n\t\t\tarrInchMargins = [opts.slideMargin, opts.slideMargin, opts.slideMargin, opts.slideMargin]\n\t}\n\temuSlideTabW = (opts.w ? inch2Emu(opts.w) : pptx.presLayout.width) - inch2Emu(arrInchMargins[1] + arrInchMargins[3])\n\n\tif (opts.verbose) {\n\t\tconsole.log('[[VERBOSE MODE]]')\n\t\tconsole.log('|-- `tableToSlides` ----------------------------------------------------|')\n\t\tconsole.log(`| tableProps.h .................................... = ${opts.h}`)\n\t\tconsole.log(`| tableProps.w .................................... = ${opts.w}`)\n\t\tconsole.log(\n\t\t\t`| pptx.presLayout.width ........................... = ${(pptx.presLayout.width / EMU_PER_INCH).toFixed(1)}`\n\t\t)\n\t\tconsole.log(\n\t\t\t`| pptx.presLayout.height .......................... = ${(pptx.presLayout.height / EMU_PER_INCH).toFixed(1)}`\n\t\t)\n\t\tconsole.log(`| emuSlideTabW .................................... = ${(emuSlideTabW / EMU_PER_INCH).toFixed(1)}`)\n\t}\n\n\t// STEP 2: Resolve the rows and the grid they occupy, then take the column widths from the\n\t// first row that has any cells (others may have colspans, who cares, we only need col widths from 1).\n\t// Two bases are collected in the same pass: the rendered `offsetWidth` (what a browser\n\t// reports) and the computed CSS `width` (the only width statement available where nothing\n\t// laid the table out). `pickColWidthBasis` decides which one STEP 3 runs on.\n\tconst domRows = collectTableRows(ctx.table)\n\tconst { columns: intColCnt, filled: arrRowFilled } = measureGridColumns(\n\t\tdomRows.map(({ row }) =>\n\t\t\trowCells(row).map((cell) => ({\n\t\t\t\tcolspan: Number(cell.getAttribute('colspan')),\n\t\t\t\trowspan: Number(cell.getAttribute('rowspan')),\n\t\t\t}))\n\t\t)\n\t)\n\t// A table with no rows — or only empty ones — has nothing to convert. Say so here: the failure\n\t// used to surface far downstream as `Reduce of empty array with no initial value` out of the\n\t// auto-pager, or as `addTable: Array expected!`, neither of which names the table.\n\tconst srcRow = domRows.find(({ row }) => rowCells(row).length > 0)\n\tif (!srcRow) {\n\t\tthrow new InvalidOptionError(\n\t\t\t'html/table-has-no-cells',\n\t\t\t'tableToSlides: the table has no cells to convert - expected at least one <tr> with a <td>/<th>.'\n\t\t)\n\t}\n\n\t// Per grid column, the width-source cell it came from and that cell's colspan. Built here so\n\t// STEP 3 can read a column's overrides off the *right* cell: with a colspan in play, column\n\t// index and cell index part ways, and indexing the row by column silently applied one cell's\n\t// `data-pptx-width` to the next column along (upstream gitbrent/PptxGenJS#1244).\n\tconst arrColSrc: Array<{ cell: HTMLTableCellElement; span: number }> = []\n\tconst arrCellSpans: number[] = []\n\trowCells(srcRow.row).forEach((cell) => {\n\t\tconst offsetW = Number(cell.offsetWidth)\n\t\tconst measured = isFinite(offsetW) ? offsetW : 0\n\t\tarrTabColCssW.push(ctx.getComputedStyle(cell).getPropertyValue('width'))\n\t\t// Guesstimate (divide evenly) col widths across a spanned cell.\n\t\t// NOTE: both j$query and vanilla selectors return {0} when table is not visible)\n\t\tconst span = gridSpan(cell.getAttribute('colspan'))\n\t\tarrCellSpans.push(span)\n\t\tfor (let idxc = 0; idxc < span; idxc++) {\n\t\t\tarrTabColW.push(Math.round(measured / span))\n\t\t\tarrColSrc.push({ cell, span })\n\t\t}\n\t})\n\n\t// The CSS basis is parsed per *cell* (unit uniformity is a property of the row as authored),\n\t// then expanded across each cell's colspan the same way `offsetWidth` is.\n\tconst parsedCellCssW = parseCssWidthBasis(arrTabColCssW)\n\tconst arrCssColW: number[] = []\n\tif (parsedCellCssW.length === arrCellSpans.length) {\n\t\tparsedCellCssW.forEach((cssW, idxC) => {\n\t\t\tconst span = arrCellSpans[idxC] ?? 1\n\t\t\tfor (let idxc = 0; idxc < span; idxc++) arrCssColW.push(cssW / span)\n\t\t})\n\t}\n\n\t// The width-source row can be narrower than the grid (one spanning header over a wider body),\n\t// so widen the basis to the full grid before the proportional calc — that way the calc still\n\t// divides the slide across *every* column instead of overflowing it by the missing ones.\n\tconst arrBasisColW = extendColBasis(pickColWidthBasis(arrTabColW, arrCssColW), intColCnt)\n\tarrBasisColW.forEach((colW) => {\n\t\tintTabW += colW\n\t})\n\n\t// STEP 3: Calc/Set column widths by using same column width percent from HTML table\n\tarrBasisColW.forEach((colW, idxW) => {\n\t\tconst intCalcWidth = Number(((Number(emuSlideTabW) * ((colW / intTabW) * 100)) / 100 / EMU_PER_INCH).toFixed(2))\n\t\t// A `data-pptx-width` on a spanning cell states that *cell's* width, so it divides across\n\t\t// the columns the cell covers — exactly as its `offsetWidth` and its CSS width do above.\n\t\t// A column past the source row's reach has no cell to be overridden by.\n\t\tconst src = arrColSrc[idxW]\n\t\tconst intSetWidth = src ? Number(src.cell.getAttribute('data-pptx-width')) / src.span : 0\n\t\tconst intMinWidth = src ? Number(src.cell.getAttribute('data-pptx-min-width')) / src.span : 0\n\t\tarrColW.push(resolveHtmlColWidth(intCalcWidth, intSetWidth, intMinWidth))\n\t})\n\tif (opts.verbose) {\n\t\tconsole.log(`| arrColW ......................................... = [${arrColW.join(', ')}]`)\n\t}\n\n\t// STEP 4: Iterate over each table element and create data arrays (text and opts)\n\t// NOTE: We create 3 arrays instead of one so we can loop over body then show header/footer rows on first and last page\n\tdomRows.forEach(({ row, part }, idxRow) => {\n\t\tconst arrObjTabCells: TableCell[] = []\n\t\trowCells(row).forEach((cell) => {\n\t\t\t// The computed style is read a dozen times below; resolve it once per cell.\n\t\t\tconst style = ctx.getComputedStyle(cell)\n\n\t\t\t// A: Get text/bkgd colors\n\t\t\t// NOTE: an unparseable or fully transparent background is the default for an\n\t\t\t// unstyled table; pptx has no \"transparent\" solid fill, so use white instead.\n\t\t\tconst textColor = cssColorToHex(style.getPropertyValue('color')) ?? '000000'\n\t\t\tconst fillColor = cssColorToHex(style.getPropertyValue('background-color')) ?? 'FFFFFF'\n\n\t\t\t// B: Create option object\n\t\t\tconst cellOpts: TableCellProps = {\n\t\t\t\tbold: !!(\n\t\t\t\t\tstyle.getPropertyValue('font-weight') === 'bold' || Number(style.getPropertyValue('font-weight')) >= 500\n\t\t\t\t),\n\t\t\t\tcolor: textColor,\n\t\t\t\tfill: { color: fillColor },\n\t\t\t\tfontSize: Number(style.getPropertyValue('font-size').replace(/[a-z]/gi, '')),\n\t\t\t}\n\t\t\tconst fontFace = ((style.getPropertyValue('font-family') || '').split(',')[0] ?? '')\n\t\t\t\t.replace(/\"/g, '')\n\t\t\t\t.replace('inherit', '')\n\t\t\t\t.replace('initial', '')\n\t\t\t// Read through the same `gridSpan` the grid walk used, so what is emitted and what\n\t\t\t// was measured cannot disagree: a `colspan=\"-2\"` counted as one column above must\n\t\t\t// not reach the table definition as `-2` and corrupt its own column count.\n\t\t\tconst colspan = gridSpan(cell.getAttribute('colspan'))\n\t\t\tconst rowspan = gridSpan(cell.getAttribute('rowspan'))\n\t\t\tif (fontFace) cellOpts.fontFace = fontFace\n\t\t\tif (colspan > 1) cellOpts.colspan = colspan\n\t\t\tif (rowspan > 1) cellOpts.rowspan = rowspan\n\n\t\t\tif (['left', 'center', 'right', 'start', 'end'].includes(style.getPropertyValue('text-align'))) {\n\t\t\t\tconst align = style.getPropertyValue('text-align').replace('start', 'left').replace('end', 'right')\n\t\t\t\tcellOpts.align =\n\t\t\t\t\talign === 'center' ? 'center' : align === 'left' ? 'left' : align === 'right' ? 'right' : undefined\n\t\t\t}\n\t\t\tif (['top', 'middle', 'bottom'].includes(style.getPropertyValue('vertical-align'))) {\n\t\t\t\tconst valign = style.getPropertyValue('vertical-align')\n\t\t\t\tcellOpts.valign =\n\t\t\t\t\tvalign === 'top' ? 'top' : valign === 'middle' ? 'middle' : valign === 'bottom' ? 'bottom' : undefined\n\t\t\t}\n\n\t\t\t// C: Add padding [margin] (if any)\n\t\t\t// NOTE: `TableCellProps.margin` is INCHES, so computed px must be converted, not copied.\n\t\t\t// CSS defines the reference pixel as 1/96in, and mirroring what the browser rendered is\n\t\t\t// this conversion's whole job — so resolve at `DEFAULT_PX_PER_INCH`, the same density the\n\t\t\t// `\"<n>px\"` coordinate unit uses. (Until 2026-07-31 the px magnitude was assigned straight\n\t\t\t// through under a stale \"px->pt 1:1\" note left from when cell margin was points; that made\n\t\t\t// a 4px pad a *4 inch* inset and tripped the legacy-points warning on any pad >= 1px.)\n\t\t\t// No rounding to whole px: the browser's computed value can be fractional, and `inch2Emu`\n\t\t\t// already does the one rounding that matters, at EMU precision.\n\t\t\tif (style.getPropertyValue('padding-left')) {\n\t\t\t\tconst cellMargin: MarginTuple = [0, 0, 0, 0]\n\t\t\t\tconst sidesPad = ['padding-top', 'padding-right', 'padding-bottom', 'padding-left']\n\t\t\t\tsidesPad.forEach((val, idxs) => {\n\t\t\t\t\t// Anything that is not an absolute px length (a `%` padding, a keyword) has no\n\t\t\t\t\t// meaning as a fixed inset, so it insets by nothing rather than by its digits.\n\t\t\t\t\tconst pad = parseCssPx(style.getPropertyValue(val))\n\t\t\t\t\tcellMargin[idxs] = isFinite(pad) ? pad / DEFAULT_PX_PER_INCH : 0\n\t\t\t\t})\n\t\t\t\tcellOpts.margin = cellMargin\n\t\t\t}\n\n\t\t\t// D: Add border (if any)\n\t\t\tif (\n\t\t\t\tstyle.getPropertyValue('border-top-width') ||\n\t\t\t\tstyle.getPropertyValue('border-right-width') ||\n\t\t\t\tstyle.getPropertyValue('border-bottom-width') ||\n\t\t\t\tstyle.getPropertyValue('border-left-width')\n\t\t\t) {\n\t\t\t\tconst cellBorder: BorderTuple = [{ type: 'none' }, { type: 'none' }, { type: 'none' }, { type: 'none' }]\n\t\t\t\tconst sidesBor = ['top', 'right', 'bottom', 'left']\n\t\t\t\tsidesBor.forEach((val, idxb) => {\n\t\t\t\t\tcellBorder[idxb] = htmlBorderToProps(\n\t\t\t\t\t\tstyle.getPropertyValue('border-' + val + '-width'),\n\t\t\t\t\t\tstyle.getPropertyValue('border-' + val + '-color')\n\t\t\t\t\t)\n\t\t\t\t})\n\t\t\t\tcellOpts.border = cellBorder\n\t\t\t}\n\n\t\t\t// LAST: Add cell\n\t\t\tarrObjTabCells.push({\n\t\t\t\t_type: SlideObjectType.tablecell,\n\t\t\t\ttext: readCellText(cell), // <br> must survive as \"\\n\", so linebreak etc. work later!\n\t\t\t\toptions: cellOpts,\n\t\t\t})\n\t\t})\n\n\t\t// Normalize a ragged row up to the grid width. HTML tolerates a short row and just leaves\n\t\t// the tail of the grid empty; pptx does not — `<a:tblGrid>` declares the column count and a\n\t\t// row with fewer `<a:tc>` is a malformed table PowerPoint has to repair. The missing cells\n\t\t// are blank rather than a copy of a neighbour: the source table never stated them, so there\n\t\t// is nothing to carry over. Columns held by a `rowspan` from above are already counted as\n\t\t// filled — the table emitter synthesizes those merge cells itself.\n\t\tfor (let idxPad = arrRowFilled[idxRow] ?? 0; idxPad < intColCnt; idxPad++) {\n\t\t\tarrObjTabCells.push({ _type: SlideObjectType.tablecell, text: '', options: {} })\n\t\t}\n\n\t\tif (part === 'thead') arrObjTabHeadRows.push(arrObjTabCells)\n\t\telse if (part === 'tfoot') arrObjTabFootRows.push(arrObjTabCells)\n\t\telse arrObjTabBodyRows.push(arrObjTabCells)\n\t})\n\n\t// STEP 5: Break table into Slides as needed\n\t// Pass head-rows as there is an option to add to each table and the parse func needs this data to fulfill that option\n\topts._arrObjTabHeadRows = arrObjTabHeadRows\n\topts.colW = arrColW\n\tgetSlidesForTableRows(\n\t\t[...arrObjTabHeadRows, ...arrObjTabBodyRows, ...arrObjTabFootRows],\n\t\topts,\n\t\tpptx.presLayout,\n\t\tmasterSlide\n\t).forEach((slide, idxTr) => {\n\t\t// A: Create new Slide\n\t\tconst newSlide = pptx.addSlide({ masterTitle: opts.masterTitle || undefined })\n\n\t\t// B: DESIGN: Reset `y` to startY or margin after first Slide\n\t\tif (idxTr === 0) opts.y = opts.y || arrInchMargins[0]\n\t\tif (idxTr > 0) opts.y = opts.autoPageSlideStartY || arrInchMargins[0]\n\t\tif (opts.verbose)\n\t\t\tconsole.log(\n\t\t\t\t`| opts.autoPageSlideStartY: ${opts.autoPageSlideStartY} / arrInchMargins[0]: ${arrInchMargins[0]} => opts.y = ${opts.y}`\n\t\t\t)\n\n\t\t// C: Add table to Slide\n\t\tnewSlide.addTable(slide.rows, {\n\t\t\tx: opts.x || arrInchMargins[3],\n\t\t\ty: opts.y,\n\t\t\tw: Number(emuSlideTabW) / EMU_PER_INCH,\n\t\t\tcolW: arrColW,\n\t\t\tautoPage: false,\n\t\t})\n\n\t\t// D: Add any additional objects\n\t\tif (opts.addImage) {\n\t\t\topts.addImage.options = opts.addImage.options || {}\n\t\t\tif (!opts.addImage.image || (!opts.addImage.image.path && !opts.addImage.image.data)) {\n\t\t\t\twarn('html/image-missing-source', 'tableToSlides.addImage requires either `path` or `data`')\n\t\t\t} else {\n\t\t\t\tconst imageProps = opts.addImage.image.path\n\t\t\t\t\t? { path: opts.addImage.image.path }\n\t\t\t\t\t: { data: opts.addImage.image.data as string }\n\t\t\t\tnewSlide.addImage({\n\t\t\t\t\t...imageProps,\n\t\t\t\t\tx: opts.addImage.options.x,\n\t\t\t\t\ty: opts.addImage.options.y,\n\t\t\t\t\tw: opts.addImage.options.w,\n\t\t\t\t\th: opts.addImage.options.h,\n\t\t\t\t})\n\t\t\t}\n\t\t}\n\t\tif (opts.addShape) newSlide.addShape(opts.addShape.shapeName, opts.addShape.options || {})\n\t\tif (opts.addTable) newSlide.addTable(opts.addTable.rows, opts.addTable.options || {})\n\t\tif (opts.addText) newSlide.addText(opts.addText.text, opts.addText.options || {})\n\t})\n}\n"],"mappings":";;;;;;;;;;;;AAyEA,MAAM,oBAAoB,EACzB,wBAAwB,GACzB;;;;;;AAOA,SAAS,mBAAmB,KAA4D;CACvF,MAAM,OAAO,KAAK;CAClB,OAAO,OAAO,KAAK,iBAAiB,KAAK,IAAI,UAAU;AACxD;;;;;;;;;;;;;;;;;;AAmBA,SAAS,kBAAkB,QAAuC,SAAyC;CAC1G,MAAM,aAAa,YAA2C;CAE9D,IAAI,OAAO,WAAW,UAAU;EAC/B,MAAM,QAAQ,UAAU,MAAM;EAC9B,OAAO;GAAE;GAAO,kBAAkB,mBAAmB,MAAM,aAAa;EAAE;CAC3E;CAEA,MAAM,MAAM,QAAQ,YAAa,WAAoD;CACrF,IAAI,CAAC,KACJ,MAAM,IAAI,mBACT,oBACA,+DACC,SACA,oFACF;CAED,MAAM,QAAQ,IAAI,eAAe,MAAM;CACvC,IAAI,CAAC,OACJ,MAAM,IAAI,mBAAmB,wBAAwB,+BAA8B,SAAS,oBAAmB;CAChH,MAAM,QAAQ,UAA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AS,MAAM,MAC9E,KAAK,6BAA6B,yDAAyD;QACrF;IACN,MAAM,aAAa,KAAK,SAAS,MAAM,OACpC,EAAE,MAAM,KAAK,SAAS,MAAM,KAAK,IACjC,EAAE,MAAM,KAAK,SAAS,MAAM,KAAe;IAC9C,SAAS,SAAS;KACjB,GAAG;KACH,GAAG,KAAK,SAAS,QAAQ;KACzB,GAAG,KAAK,SAAS,QAAQ;KACzB,GAAG,KAAK,SAAS,QAAQ;KACzB,GAAG,KAAK,SAAS,QAAQ;IAC1B,CAAC;GACF;EACD;EACA,IAAI,KAAK,UAAU,SAAS,SAAS,KAAK,SAAS,WAAW,KAAK,SAAS,WAAW,CAAC,CAAC;EACzF,IAAI,KAAK,UAAU,SAAS,SAAS,KAAK,SAAS,MAAM,KAAK,SAAS,WAAW,CAAC,CAAC;EACpF,IAAI,KAAK,SAAS,SAAS,QAAQ,KAAK,QAAQ,MAAM,KAAK,QAAQ,WAAW,CAAC,CAAC;CACjF,CAAC;AACF"}
|
package/dist/html.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { A as TableToSlidesDocument, M as TableToSlidesProps, a as Slide, j as TableToSlidesElement, t as AddSlideProps } from "./slide-
|
|
2
|
-
import { i as PresLayout } from "./pres-
|
|
3
|
-
import { a as TsPptxError, 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-
|
|
1
|
+
import { A as TableToSlidesDocument, M as TableToSlidesProps, a as Slide, j as TableToSlidesElement, t as AddSlideProps } from "./slide-BRAtT8Dl.js";
|
|
2
|
+
import { i as PresLayout } from "./pres-BgvxhQ_m.js";
|
|
3
|
+
import { a as TsPptxError, 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-BeUEkNWL.js";
|
|
4
4
|
//#region src/gen/table/html-dom.d.ts
|
|
5
5
|
/**
|
|
6
6
|
* What `tableToSlides` needs a presentation to be: somewhere to put slides, and a layout to
|
package/dist/html.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as TsPptxError, i as PackageReadError, n as InvalidOptionError, o as UnsupportedFeatureError, r as MediaError, t as InternalError } from "./errors-
|
|
2
|
-
import { t as genTableToSlides } from "./html-dom
|
|
1
|
+
import { a as TsPptxError, i as PackageReadError, n as InvalidOptionError, o as UnsupportedFeatureError, r as MediaError, t as InternalError } from "./errors-Bvln0H-7.js";
|
|
2
|
+
import { t as genTableToSlides } from "./html-dom-DajBuobe.js";
|
|
3
3
|
//#region src/html.ts
|
|
4
4
|
/**
|
|
5
5
|
* `ts-pptx/html` — reproduce an existing HTML `<table>` as a PowerPoint table, as a free
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
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, x as asChartType, y as WRITE_OUTPUT_TYPE } from "./enums-
|
|
2
|
-
import { $ as HAlign, $t as ChartSeriesOpts, A as TableToSlidesDocument, At as ChartLineDash, B as ShapeAdjustHandleXY, Bt as ChartPropsChartHistogram, C as TableCell, Ct as ChartAreaProps, D as TableProps, Dt as ChartExBinning, E as TableCellProps, Et as ChartErrorBarOptions, F as MediaProps, Ft as ChartPropsAxisVal, G as BackgroundProps, Gt as ChartPropsChartStock, H as ShapeConnectionSite, Ht as ChartPropsChartPie, I as MediaType, It as ChartPropsBase, J as DataOrPathProps, Jt as ChartPropsDataLabel, K as Color, Kt as ChartPropsChartSurface, L as OleObjectProps, Lt as ChartPropsChartBar, M as TableToSlidesProps, Mt as ChartOpts, N as ImageBaseProps, Nt as ChartPropsAxisCat, O as TableRow, Ot as ChartExGeography, P as ImageProps, Pt as ChartPropsAxisSer, Q as GradientStopProps, Qt as ChartPropsTitle, R as ShapeAdjustHandle, Rt as ChartPropsChartBoxWhisker, S as TransitionType, Sn as textRuns, St as PresetMaterialType, T as TableCellDiagonals, Tt as ChartDataPointStyle, U as ShapeGuide, Ut as ChartPropsChartRadar, V as ShapeAdjustValue, Vt as ChartPropsChartLine, W as ShapeProps, Wt as ChartPropsChartRegionMap, X as GeometryPoint, Xt as ChartPropsFillLine, Y as DataOrPathRequiredProps, Yt as ChartPropsDataTable, Z as GradientFillProps, Zt as ChartPropsLegend, _ as AnimationProps, _n as TextGlowProps, _t as ShapeFillProps, a as Slide, an as PlaceholderProps, at as PatternPreset, b as TransitionProps, bn as TextPropsOptions, bt as LightRigDirection, c as Model3dPoint, cn as NotesProps, ct as TextVertType, d as MasterTextStyleLevel, dn as ResolvedCommentAuthor, dt as BorderProps, en as LineCap, et as HexColor, f as MasterTextStyleProps, fn as SlideComment, ft as ConnectorProps, g as SlideNumberProps, gn as TextFitShrinkProps, gt as ShadowProps, h as SlideMasterProps, hn as TextBaseProps, ht as HyperlinkProps, i as ObjectOptions, in as ObjectNameProps, it as PatternFillProps, j as TableToSlidesElement, jt as ChartMulti, k as TableRowSlide, kt as ChartExStatistics, l as Model3dProps, ln as NotesTextOptions, lt as ThemeColor, m as SlideMasterObject, mn as TableLayoutResult, mt as HyperlinkActionJump, n as GroupChildProps, nn as OptsChartGridLine, nt as LinearGradientFillProps, o as SlideLayout, on as CommentProps, ot as PositionProps, p as SlideMasterChartProps, pn as TableCellLayout, pt as ConnectorType, q as Coord, qt as ChartPropsChartWaterfall, r as GroupProps, rn as ObjectLockProps, rt as Margin, s as Model3dCameraProps, sn as MeasureTextOptions, st as RadialGradientFillProps, t as AddSlideProps, tn as OptsChartData, tt as ImageFillProps, u as MasterBulletProps, un as OverflowBoxOptions, ut as VAlign, v as AnimationTrigger, vn as TextMeasurement, vt as ShapeLineProps, w as TableCell3DProps, wt as ChartAxisTickMark, x as TransitionSoundProps, xn as textRun, xt as LightRigType, y as PresetEffect, yn as TextProps, yt as BevelPresetType, z as ShapeAdjustHandlePolar, zt as ChartPropsChartDoughnut } from "./slide-
|
|
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-
|
|
4
|
-
import { A as SectionZoomProps, C as emuToPixels, D as pixelsToEmu, E as percentToEmu, M as SummaryZoomProps, N as ZoomBaseProps, O as pointsToEmu, S as emuToInches, T as inchesToEmu, _ as POINTS_PER_INCH, a as FlatSide, b as StandardLayoutName, c as PresentationCore, d as EMU_PER_INCH, f as EMU_PER_POINT, g as PERCENT_SCALE, h as HUNDREDTHS_PER_POINT, i as ClipShape, j as SlideZoomProps, k as ptToHundredths, l as ANGLE_UNITS_PER_DEGREE, m as FIXED_PCT_PER_PERCENT, n as DiagnosticHandler, o as HalfDiscPreset, p as Emu, r as setDiagnosticHandler, s as clipPath, t as Diagnostic, u as DEFAULT_PX_PER_INCH, v as STANDARD_LAYOUTS, w as emuToPoints, x as coordToEmu, y as StandardLayout } from "./diagnostics-
|
|
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-
|
|
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, x as asChartType, y as WRITE_OUTPUT_TYPE } from "./enums-CoXnxiCI.js";
|
|
2
|
+
import { $ as HAlign, $t as ChartSeriesOpts, A as TableToSlidesDocument, At as ChartLineDash, B as ShapeAdjustHandleXY, Bt as ChartPropsChartHistogram, C as TableCell, Ct as ChartAreaProps, D as TableProps, Dt as ChartExBinning, E as TableCellProps, Et as ChartErrorBarOptions, F as MediaProps, Ft as ChartPropsAxisVal, G as BackgroundProps, Gt as ChartPropsChartStock, H as ShapeConnectionSite, Ht as ChartPropsChartPie, I as MediaType, It as ChartPropsBase, J as DataOrPathProps, Jt as ChartPropsDataLabel, K as Color, Kt as ChartPropsChartSurface, L as OleObjectProps, Lt as ChartPropsChartBar, M as TableToSlidesProps, Mt as ChartOpts, N as ImageBaseProps, Nt as ChartPropsAxisCat, O as TableRow, Ot as ChartExGeography, P as ImageProps, Pt as ChartPropsAxisSer, Q as GradientStopProps, Qt as ChartPropsTitle, R as ShapeAdjustHandle, Rt as ChartPropsChartBoxWhisker, S as TransitionType, Sn as textRuns, St as PresetMaterialType, T as TableCellDiagonals, Tt as ChartDataPointStyle, U as ShapeGuide, Ut as ChartPropsChartRadar, V as ShapeAdjustValue, Vt as ChartPropsChartLine, W as ShapeProps, Wt as ChartPropsChartRegionMap, X as GeometryPoint, Xt as ChartPropsFillLine, Y as DataOrPathRequiredProps, Yt as ChartPropsDataTable, Z as GradientFillProps, Zt as ChartPropsLegend, _ as AnimationProps, _n as TextGlowProps, _t as ShapeFillProps, a as Slide, an as PlaceholderProps, at as PatternPreset, b as TransitionProps, bn as TextPropsOptions, bt as LightRigDirection, c as Model3dPoint, cn as NotesProps, ct as TextVertType, d as MasterTextStyleLevel, dn as ResolvedCommentAuthor, dt as BorderProps, en as LineCap, et as HexColor, f as MasterTextStyleProps, fn as SlideComment, ft as ConnectorProps, g as SlideNumberProps, gn as TextFitShrinkProps, gt as ShadowProps, h as SlideMasterProps, hn as TextBaseProps, ht as HyperlinkProps, i as ObjectOptions, in as ObjectNameProps, it as PatternFillProps, j as TableToSlidesElement, jt as ChartMulti, k as TableRowSlide, kt as ChartExStatistics, l as Model3dProps, ln as NotesTextOptions, lt as ThemeColor, m as SlideMasterObject, mn as TableLayoutResult, mt as HyperlinkActionJump, n as GroupChildProps, nn as OptsChartGridLine, nt as LinearGradientFillProps, o as SlideLayout, on as CommentProps, ot as PositionProps, p as SlideMasterChartProps, pn as TableCellLayout, pt as ConnectorType, q as Coord, qt as ChartPropsChartWaterfall, r as GroupProps, rn as ObjectLockProps, rt as Margin, s as Model3dCameraProps, sn as MeasureTextOptions, st as RadialGradientFillProps, t as AddSlideProps, tn as OptsChartData, tt as ImageFillProps, u as MasterBulletProps, un as OverflowBoxOptions, ut as VAlign, v as AnimationTrigger, vn as TextMeasurement, vt as ShapeLineProps, w as TableCell3DProps, wt as ChartAxisTickMark, x as TransitionSoundProps, xn as textRun, xt as LightRigType, y as PresetEffect, yn as TextProps, yt as BevelPresetType, z as ShapeAdjustHandlePolar, zt as ChartPropsChartDoughnut } from "./slide-BRAtT8Dl.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-BgvxhQ_m.js";
|
|
4
|
+
import { A as SectionZoomProps, C as emuToPixels, D as pixelsToEmu, E as percentToEmu, M as SummaryZoomProps, N as ZoomBaseProps, O as pointsToEmu, S as emuToInches, T as inchesToEmu, _ as POINTS_PER_INCH, a as FlatSide, b as StandardLayoutName, c as PresentationCore, d as EMU_PER_INCH, f as EMU_PER_POINT, g as PERCENT_SCALE, h as HUNDREDTHS_PER_POINT, i as ClipShape, j as SlideZoomProps, k as ptToHundredths, l as ANGLE_UNITS_PER_DEGREE, m as FIXED_PCT_PER_PERCENT, n as DiagnosticHandler, o as HalfDiscPreset, p as Emu, r as setDiagnosticHandler, s as clipPath, t as Diagnostic, u as DEFAULT_PX_PER_INCH, v as STANDARD_LAYOUTS, w as emuToPoints, x as coordToEmu, y as StandardLayout } from "./diagnostics-PMINsVP6.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-BeUEkNWL.js";
|
|
6
6
|
//#region src/index.d.ts
|
|
7
7
|
/**
|
|
8
8
|
* The runtime-agnostic entry: what a consumer gets from the bare `@shbernal/ts-pptx` specifier
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/index.ts"],"mappings":";;;;;;;;;;;;;;;;;;cAea,eAAe;
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/index.ts"],"mappings":";;;;;;;;;;;;;;;;;;cAea,eAAe;EAC3B"}
|
package/dist/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { t as setDiagnosticHandler } from "./diagnostics-DYQC7xLV.js";
|
|
2
|
-
import { a as TsPptxError, i as PackageReadError, n as InvalidOptionError, o as UnsupportedFeatureError, r as MediaError, t as InternalError } from "./errors-
|
|
3
|
-
import { _ as pointsToEmu, a as FIXED_PCT_PER_PERCENT, 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 } from "./units-
|
|
4
|
-
import { i as PresentationCore, n as textRuns, r as clipPath, t as textRun } from "./text-
|
|
5
|
-
import { $ as connectorPresetFor, B as AlignV, G as PlaceholderType, H as CONNECTOR_PRESETS, J as SlideObjectType, K as SchemeColor, Q as asChartType, U as ChartType, V as BulletType, W as OutputType, X as TextAnchor, Y as TableStyle, Z as VALID_SHAPE_PRESETS, et as isChartExType, j as IMG_SVG_PLACEHOLDER, q as ShapeType, z as AlignH } from "./units-internal-
|
|
6
|
-
import { w as bytesToBase64 } from "./st-enums-
|
|
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 { _ as pointsToEmu, a as FIXED_PCT_PER_PERCENT, 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 } from "./units-C7QM1KgH.js";
|
|
4
|
+
import { i as PresentationCore, n as textRuns, r as clipPath, t as textRun } from "./text-B6PbMFih.js";
|
|
5
|
+
import { $ as connectorPresetFor, B as AlignV, G as PlaceholderType, H as CONNECTOR_PRESETS, J as SlideObjectType, K as SchemeColor, Q as asChartType, U as ChartType, V as BulletType, W as OutputType, X as TextAnchor, Y as TableStyle, Z as VALID_SHAPE_PRESETS, et as isChartExType, j as IMG_SVG_PLACEHOLDER, q as ShapeType, z as AlignH } from "./units-internal-CR8s8YQa.js";
|
|
6
|
+
import { w as bytesToBase64 } from "./st-enums-evQG2A7Z.js";
|
|
7
7
|
//#region src/runtime/neutral.ts
|
|
8
8
|
/**
|
|
9
9
|
* The adapter for a runtime that is neither Node nor a browser — Deno, Bun, an edge worker,
|
package/dist/inspect.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as TsPptxError, 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-
|
|
1
|
+
import { a as TsPptxError, 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-BeUEkNWL.js";
|
|
2
2
|
import { n as OpcPackage } from "./package-CaOLXSNi.js";
|
|
3
3
|
//#region src/inspect.d.ts
|
|
4
4
|
/**
|
package/dist/inspect.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { n as warn } from "./diagnostics-DYQC7xLV.js";
|
|
2
|
-
import { a as TsPptxError, i as PackageReadError, n as InvalidOptionError, o as UnsupportedFeatureError, r as MediaError, t as InternalError } from "./errors-
|
|
3
|
-
import { d as emuToInches, l as STANDARD_LAYOUTS } from "./units-
|
|
4
|
-
import { Dt as firstChild, Mt as intValue, bt as OOXML_NS, xt as attr } from "./shapes-
|
|
5
|
-
import { f as OpcPackage, t as Presentation } from "./presentation-
|
|
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 { d as emuToInches, l as STANDARD_LAYOUTS } from "./units-C7QM1KgH.js";
|
|
4
|
+
import { Dt as firstChild, Mt as intValue, bt as OOXML_NS, xt as attr } from "./shapes-DMThLsZN.js";
|
|
5
|
+
import { f as OpcPackage, t as Presentation } from "./presentation-BP1B8PCF.js";
|
|
6
6
|
//#region src/inspect.ts
|
|
7
7
|
/**
|
|
8
8
|
* A cheap, flat snapshot of what a `.pptx` contains: every element on every
|
package/dist/math.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as TsPptxError, 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-
|
|
1
|
+
import { a as TsPptxError, 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-BeUEkNWL.js";
|
|
2
2
|
//#region src/math.d.ts
|
|
3
3
|
/**
|
|
4
4
|
* Convert a MathML string to OMML for the `math:` option on `addText`.
|
package/dist/math.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"math.d.ts","names":[],"sources":["../src/math.ts"],"mappings":";;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"math.d.ts","names":[],"sources":["../src/math.ts"],"mappings":";;;;;;;;;;;iBAwMgB,aAAa;UAKZ;;;;;;EAMhB;;;;;;;;;;;;;;;iBAgBe,YAAY,eAAe,OAAM"}
|
package/dist/math.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as TsPptxError, i as PackageReadError, n as InvalidOptionError, o as UnsupportedFeatureError, r as MediaError, t as InternalError } from "./errors-
|
|
1
|
+
import { a as TsPptxError, i as PackageReadError, n as InvalidOptionError, o as UnsupportedFeatureError, r as MediaError, t as InternalError } from "./errors-Bvln0H-7.js";
|
|
2
2
|
import { createRequire } from "node:module";
|
|
3
3
|
//#region src/math.ts
|
|
4
4
|
/**
|
|
@@ -60,6 +60,102 @@ function stripOMathNamespaces(omml) {
|
|
|
60
60
|
/** Centered-display paragraph props, matching what the `math:` emitter/oracle author. */
|
|
61
61
|
const DISPLAY_PARA_PR = "<m:oMathParaPr><m:jc m:val=\"centerGroup\"/></m:oMathParaPr>";
|
|
62
62
|
/**
|
|
63
|
+
* The operator-dictionary subset this module has to carry, keyed by the character temml
|
|
64
|
+
* puts in the `<mo>` of an accent and valued by the combining mark OMML wants in `m:chr`.
|
|
65
|
+
*
|
|
66
|
+
* Two halves of one problem. **Which** `<mover>`s are accents: temml renders every accent
|
|
67
|
+
* command as a bare `<mover>` with no `accent="true"`, which is correct for a browser —
|
|
68
|
+
* MathML renderers derive accent positioning from the operator dictionary, so the attribute
|
|
69
|
+
* is redundant there — but mathml2omml has no dictionary and keys strictly off the
|
|
70
|
+
* attribute, mapping a bare `<mover>` to `<m:limUpp>` (an over-*limit*, with limit spacing)
|
|
71
|
+
* instead of `<m:acc>`. Membership in this table is the dictionary lookup that is otherwise
|
|
72
|
+
* missing. **Which character** to attach: mathml2omml passes the `<mo>` text straight
|
|
73
|
+
* through to `m:chr`, and temml emits the *spacing* modifiers (U+02C6 MODIFIER LETTER
|
|
74
|
+
* CIRCUMFLEX, U+2192 RIGHTWARDS ARROW) while ECMA-376 §22.1.2.20 says an `accPr` character
|
|
75
|
+
* "should be within the range of (U+0300–U+036F) or (U+20D0–U+20EF)" — the combining marks,
|
|
76
|
+
* which is also what Word itself writes. Left alone, `\vec{v}` would hang a full-size arrow
|
|
77
|
+
* over the base instead of an arrow accent.
|
|
78
|
+
*
|
|
79
|
+
* Keyed by character rather than by LaTeX command because that is all that survives into
|
|
80
|
+
* the MathML. Derived by rendering every accent command temml documents and reading back
|
|
81
|
+
* the `<mo>` it produced; the commands each entry serves are named in the comments.
|
|
82
|
+
*/
|
|
83
|
+
const ACCENT_CHARS = /* @__PURE__ */ new Map([
|
|
84
|
+
["ˆ", "̂"],
|
|
85
|
+
["~", "̃"],
|
|
86
|
+
["´", "́"],
|
|
87
|
+
["ˊ", "́"],
|
|
88
|
+
["`", "̀"],
|
|
89
|
+
["ˋ", "̀"],
|
|
90
|
+
["¨", "̈"],
|
|
91
|
+
["˙", "̇"],
|
|
92
|
+
["‾", "̄"],
|
|
93
|
+
["ˉ", "̄"],
|
|
94
|
+
["˘", "̆"],
|
|
95
|
+
["ˇ", "̌"],
|
|
96
|
+
["˚", "̊"],
|
|
97
|
+
["˝", "̋"],
|
|
98
|
+
["→", "⃗"],
|
|
99
|
+
["…", "⃛"]
|
|
100
|
+
]);
|
|
101
|
+
/** An `<mover>`'s last child, when that child is an `<mo>`: `[, attributes, text]`. */
|
|
102
|
+
const TRAILING_MO = /<mo\b([^>]*)>([^<]*)<\/mo>\s*$/;
|
|
103
|
+
/**
|
|
104
|
+
* Stamp `accent="true"` on the `<mover>`s that are accents, and swap their operator for the
|
|
105
|
+
* combining mark OMML wants. See {@link ACCENT_CHARS} for why both are needed.
|
|
106
|
+
*
|
|
107
|
+
* Scoped as narrowly as the defect. Only `<mo stretchy="false">` qualifies, which is how
|
|
108
|
+
* temml distinguishes a true accent from a *wide* one (`\widehat`, `\overrightarrow`) or a
|
|
109
|
+
* group character (`\overbrace`, `\overgroup`) — those already reach `m:groupChr`, which is
|
|
110
|
+
* a reasonable rendering, so they are left alone rather than churned. `\stackrel` is an
|
|
111
|
+
* over-relation whose character comes from the caller, so it stays `m:limUpp` unless the
|
|
112
|
+
* caller happened to stack a diacritic. An `<mover>` that already states `accent` is the
|
|
113
|
+
* author's call and is never rewritten.
|
|
114
|
+
*
|
|
115
|
+
* `<munder>` is deliberately **not** touched. The symmetric-looking fix — stamping
|
|
116
|
+
* `accentunder="true"` — makes mathml2omml emit `<m:acc>`, which is an *over*-accent: it
|
|
117
|
+
* would move `\utilde`'s tilde above the base. OMML has no under-accent object, so the
|
|
118
|
+
* `m:limLow` an under-accent already produces is the closest thing available.
|
|
119
|
+
*
|
|
120
|
+
* Implemented against the tag text rather than through a DOM. temml's output is
|
|
121
|
+
* machine-generated and well-formed, so pairing `<mover>` with `</mover>` on a stack is
|
|
122
|
+
* exact, and this subpath otherwise carries no XML parser — the read path's is a different
|
|
123
|
+
* dependency and pulling it in here would grow the module for one rewrite.
|
|
124
|
+
*/
|
|
125
|
+
function markAccentedMovers(mathml) {
|
|
126
|
+
const edits = [];
|
|
127
|
+
const open = [];
|
|
128
|
+
const tags = /<(\/?)mover\b[^>]*>/g;
|
|
129
|
+
for (let tag = tags.exec(mathml); tag !== null; tag = tags.exec(mathml)) {
|
|
130
|
+
if (tag[1] === "") {
|
|
131
|
+
open.push(tag[0].includes("accent=") ? -1 : tag.index);
|
|
132
|
+
continue;
|
|
133
|
+
}
|
|
134
|
+
const openAt = open.pop();
|
|
135
|
+
if (openAt === void 0 || openAt === -1) continue;
|
|
136
|
+
const openEnd = mathml.indexOf(">", openAt) + 1;
|
|
137
|
+
const mo = TRAILING_MO.exec(mathml.slice(openEnd, tag.index));
|
|
138
|
+
if (!mo) continue;
|
|
139
|
+
const [whole, attrs = "", operator = ""] = mo;
|
|
140
|
+
if (!attrs.includes("stretchy=\"false\"")) continue;
|
|
141
|
+
const combining = ACCENT_CHARS.get(operator);
|
|
142
|
+
if (combining === void 0) continue;
|
|
143
|
+
edits.push({
|
|
144
|
+
at: openEnd + mo.index + whole.length - `${operator}</mo>`.length,
|
|
145
|
+
length: operator.length,
|
|
146
|
+
text: combining
|
|
147
|
+
});
|
|
148
|
+
edits.push({
|
|
149
|
+
at: openAt + 6,
|
|
150
|
+
length: 0,
|
|
151
|
+
text: " accent=\"true\""
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
let out = mathml;
|
|
155
|
+
for (const edit of edits.sort((a, b) => b.at - a.at)) out = out.slice(0, edit.at) + edit.text + out.slice(edit.at + edit.length);
|
|
156
|
+
return out;
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
63
159
|
* Convert a MathML string to OMML for the `math:` option on `addText`.
|
|
64
160
|
*
|
|
65
161
|
* Canonical output form: a bare `<m:oMath>…</m:oMath>` in the `m:` namespace, with no
|
|
@@ -98,7 +194,7 @@ function latexToOmml(latex, opts = {}) {
|
|
|
98
194
|
const pos = typeof pe.position === "number" ? ` (position ${pe.position})` : "";
|
|
99
195
|
throw new InvalidOptionError("math/invalid-latex", `Invalid LaTeX${pos}: ${pe.message}`, { cause: err });
|
|
100
196
|
}
|
|
101
|
-
const oMath = mathmlToOmml(mathml);
|
|
197
|
+
const oMath = mathmlToOmml(markAccentedMovers(mathml));
|
|
102
198
|
return display ? `<m:oMathPara>${DISPLAY_PARA_PR}${oMath}</m:oMathPara>` : oMath;
|
|
103
199
|
}
|
|
104
200
|
//#endregion
|