@shbernal/ts-pptx 3.0.0 → 3.2.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 +60 -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-Chjz_4_Q.d.ts} +7 -7
- package/dist/{diagnostics-BqBTmA3a.d.ts.map → diagnostics-Chjz_4_Q.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-BVLCFr-t.d.ts} +25 -3
- package/dist/errors-BVLCFr-t.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-C-EU3SkN.d.ts} +3 -3
- package/dist/{pres-2WsBGimU.d.ts.map → pres-C-EU3SkN.d.ts.map} +1 -1
- package/dist/{presentation-DAcOfzsP.js → presentation-CxnUVhK9.js} +103 -27
- package/dist/presentation-CxnUVhK9.js.map +1 -0
- package/dist/{presentation-CTVPpiwP.d.ts → presentation-Osx1cDdJ.d.ts} +161 -46
- package/dist/presentation-Osx1cDdJ.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 +5 -5
- package/dist/read.js +3 -3
- package/dist/script.d.ts +32 -4
- package/dist/script.d.ts.map +1 -1
- package/dist/script.js +0 -0
- package/dist/script.js.map +1 -1
- package/dist/{shapes-BWifcHDV.js → shapes-DoJBPrwN.js} +104 -65
- package/dist/shapes-DoJBPrwN.js.map +1 -0
- package/dist/{slide-YuSCGa45.d.ts → slide-BTfn1Pyp.d.ts} +99 -16
- package/dist/slide-BTfn1Pyp.d.ts.map +1 -0
- 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-C4P9MNdf.js} +168 -85
- package/dist/text-C4P9MNdf.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 +18 -17
- package/skills/ts-pptx-upstream/SKILL.md +340 -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/slide-YuSCGa45.d.ts.map +0 -1
- package/dist/text-120VFSDm.js.map +0 -1
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
|
package/dist/math.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"math.js","names":[],"sources":["../src/math.ts"],"sourcesContent":["/**\n * `@shbernal/ts-pptx/math` — author display equations in LaTeX or MathML and get\n * OMML for the `math:` option on `addText` (see {@link TextProps.math}).\n *\n * Pipeline: LaTeX --temml--> MathML --mathml2omml--> OMML.\n *\n * Both converters are **optional peer dependencies** (temml is MIT, mathml2omml is\n * LGPL-3.0-or-later); install them to use this subpath:\n *\n * ```sh\n * npm install temml mathml2omml\n * ```\n *\n * This subpath is **Node-only**: it loads the converters synchronously via\n * `node:module`'s `createRequire`, so `latexToOmml()` / `mathmlToOmml()` stay\n * synchronous. Both display and inline (in-sentence) equations are supported: a\n * default `latexToOmml()` returns a centered display `<m:oMathPara>`, while\n * `latexToOmml(tex, { display: false })` (and `mathmlToOmml()`) return the bare\n * `<m:oMath>` form you pass to a text item with `inline: true` to flow it\n * mid-paragraph (see {@link TextProps.inline}).\n *\n * @module\n */\nimport { createRequire } from 'node:module'\nimport { InvalidOptionError, UnsupportedFeatureError } from './errors.js'\n\nconst nodeRequire = createRequire(import.meta.url)\n\n/** Minimal shape of the temml API we depend on. */\ninterface TemmlModule {\n\trenderToString(latex: string, options?: { displayMode?: boolean; throwOnError?: boolean }): string\n}\n/** temml's `ParseError` carries a `position` (character offset into the source). */\ninterface TemmlParseError extends Error {\n\tposition?: number\n}\n\nconst MISSING_DEPS_MESSAGE =\n\t\"@shbernal/ts-pptx/math requires the optional peer dependencies 'temml' and \" +\n\t\"'mathml2omml'. Install them with: npm install temml mathml2omml\"\n\n/** Require an optional peer, remapping a not-found error to the install hint. */\nfunction requirePeer<T>(id: string): T {\n\ttry {\n\t\treturn nodeRequire(id) as T\n\t} catch (err) {\n\t\tif ((err as NodeJS.ErrnoException | undefined)?.code === 'MODULE_NOT_FOUND') {\n\t\t\tthrow new UnsupportedFeatureError('math/missing-optional-peer', MISSING_DEPS_MESSAGE, { cause: err })\n\t\t}\n\t\tthrow err\n\t}\n}\n\nlet temmlModule: TemmlModule | undefined\nlet mml2ommlFn: ((mathml: string) => string) | undefined\n\nfunction loadTemml(): TemmlModule {\n\tif (!temmlModule) {\n\t\tconst mod = requirePeer<TemmlModule | { default: TemmlModule }>('temml')\n\t\ttemmlModule = 'renderToString' in mod ? mod : mod.default\n\t}\n\treturn temmlModule\n}\n\nfunction loadMml2omml(): (mathml: string) => string {\n\tif (!mml2ommlFn) {\n\t\tconst mod = requirePeer<{ mml2omml: (mathml: string) => string }>('mathml2omml')\n\t\tmml2ommlFn = mod.mml2omml\n\t}\n\treturn mml2ommlFn\n}\n\n/**\n * mathml2omml puts namespace declarations on the `<m:oMath>` opening tag: `xmlns:m`\n * (redundant — the `<a14:m>` envelope the `math:` option authors already declares it)\n * and `xmlns:w` (unused in the output it produces). Strip them so the result is a bare\n * `<m:oMath>` that drops into the `math:` option cleanly.\n */\nfunction stripOMathNamespaces(omml: string): string {\n\treturn omml.replace(/^(\\s*<m:oMath)\\b[^>]*>/, '$1>')\n}\n\n/** Centered-display paragraph props, matching what the `math:` emitter/oracle author. */\nconst DISPLAY_PARA_PR = '<m:oMathParaPr><m:jc m:val=\"centerGroup\"/></m:oMathParaPr>'\n\n/**\n * Convert a MathML string to OMML for the `math:` option on `addText`.\n *\n * Canonical output form: a bare `<m:oMath>…</m:oMath>` in the `m:` namespace, with no\n * namespace declarations (the `math:` option's envelope supplies the `m` prefix).\n *\n * @param mathml - a MathML string (e.g. `<math>…</math>`)\n * @returns OMML `<m:oMath>…</m:oMath>`\n */\nexport function mathmlToOmml(mathml: string): string {\n\tconst mml2omml = loadMml2omml()\n\treturn stripOMathNamespaces(mml2omml(mathml).trim())\n}\n\nexport interface LatexToOmmlOptions {\n\t/**\n\t * Display (block) math: render in `displayMode` and wrap the result in\n\t * `<m:oMathPara>` (a centered display-math paragraph). Default `true`. When `false`,\n\t * temml renders in inline mode and the result is a bare `<m:oMath>`.\n\t */\n\tdisplay?: boolean\n}\n\n/**\n * Convert a LaTeX string to OMML for the `math:` option on `addText`.\n *\n * Display math (the default) is returned as a full `<m:oMathPara>` centered display\n * paragraph; with `{ display: false }` a bare `<m:oMath>` is returned (both forms are\n * accepted by the `math:` option). Throws on invalid LaTeX, surfacing temml's parse\n * position.\n *\n * @param latex - a LaTeX math expression, e.g. `x = \\frac{-b \\pm \\sqrt{b^2-4ac}}{2a}`\n * @param opts - see {@link LatexToOmmlOptions}\n * @returns OMML `<m:oMathPara>…</m:oMathPara>` (display) or `<m:oMath>…</m:oMath>` (inline)\n * @throws {Error} if the LaTeX cannot be parsed\n */\nexport function latexToOmml(latex: string, opts: LatexToOmmlOptions = {}): string {\n\tconst display = opts.display ?? true\n\tconst temml = loadTemml()\n\tlet mathml: string\n\ttry {\n\t\tmathml = temml.renderToString(latex, { displayMode: display, throwOnError: true })\n\t} catch (err) {\n\t\tconst pe = err as TemmlParseError\n\t\tconst pos = typeof pe.position === 'number' ? ` (position ${pe.position})` : ''\n\t\tthrow new InvalidOptionError('math/invalid-latex', `Invalid LaTeX${pos}: ${pe.message}`, { cause: err })\n\t}\n\tconst oMath = mathmlToOmml(mathml)\n\treturn display ? `<m:oMathPara>${DISPLAY_PARA_PR}${oMath}</m:oMathPara>` : oMath\n}\n\n// Error taxonomy — see `entry-errors.ts`. Re-exported from every entry so `instanceof`\n// works whichever subpath a consumer imports.\nexport * from './entry-errors.js'\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AA0BA,MAAM,cAAc,cAAc,YAAY,GAAG;AAWjD,MAAM,uBACL;;AAID,SAAS,YAAe,IAAe;CACtC,IAAI;EACH,OAAO,YAAY,EAAE;CACtB,SAAS,KAAK;EACb,IAAK,KAA2C,SAAS,oBACxD,MAAM,IAAI,wBAAwB,8BAA8B,sBAAsB,EAAE,OAAO,IAAI,CAAC;EAErG,MAAM;CACP;AACD;AAEA,IAAI;AACJ,IAAI;AAEJ,SAAS,YAAyB;CACjC,IAAI,CAAC,aAAa;EACjB,MAAM,MAAM,YAAoD,OAAO;EACvE,cAAc,oBAAoB,MAAM,MAAM,IAAI;CACnD;CACA,OAAO;AACR;AAEA,SAAS,eAA2C;CACnD,IAAI,CAAC,YAEJ,aADY,YAAsD,aACnD,CAAC,CAAC;CAElB,OAAO;AACR;;;;;;;AAQA,SAAS,qBAAqB,MAAsB;CACnD,OAAO,KAAK,QAAQ,0BAA0B,KAAK;AACpD;;AAGA,MAAM,kBAAkB;;;;;;;;;;AAWxB,SAAgB,aAAa,QAAwB;CAEpD,OAAO,qBADU,aACkB,CAAC,CAAC,MAAM,CAAC,CAAC,KAAK,CAAC;AACpD;;;;;;;;;;;;;;AAwBA,SAAgB,YAAY,OAAe,OAA2B,CAAC,GAAW;CACjF,MAAM,UAAU,KAAK,WAAW;CAChC,MAAM,QAAQ,UAAU;CACxB,IAAI;CACJ,IAAI;EACH,SAAS,MAAM,eAAe,OAAO;GAAE,aAAa;GAAS,cAAc;EAAK,CAAC;CAClF,SAAS,KAAK;EACb,MAAM,KAAK;EACX,MAAM,MAAM,OAAO,GAAG,aAAa,WAAW,cAAc,GAAG,SAAS,KAAK;EAC7E,MAAM,IAAI,mBAAmB,sBAAsB,gBAAgB,IAAI,IAAI,GAAG,WAAW,EAAE,OAAO,IAAI,CAAC;CACxG;CACA,MAAM,QAAQ,aAAa,MAAM;CACjC,OAAO,UAAU,gBAAgB,kBAAkB,MAAM,kBAAkB;AAC5E"}
|
|
1
|
+
{"version":3,"file":"math.js","names":[],"sources":["../src/math.ts"],"sourcesContent":["/**\n * `@shbernal/ts-pptx/math` — author display equations in LaTeX or MathML and get\n * OMML for the `math:` option on `addText` (see {@link TextProps.math}).\n *\n * Pipeline: LaTeX --temml--> MathML --mathml2omml--> OMML.\n *\n * Both converters are **optional peer dependencies** (temml is MIT, mathml2omml is\n * LGPL-3.0-or-later); install them to use this subpath:\n *\n * ```sh\n * npm install temml mathml2omml\n * ```\n *\n * This subpath is **Node-only**: it loads the converters synchronously via\n * `node:module`'s `createRequire`, so `latexToOmml()` / `mathmlToOmml()` stay\n * synchronous. Both display and inline (in-sentence) equations are supported: a\n * default `latexToOmml()` returns a centered display `<m:oMathPara>`, while\n * `latexToOmml(tex, { display: false })` (and `mathmlToOmml()`) return the bare\n * `<m:oMath>` form you pass to a text item with `inline: true` to flow it\n * mid-paragraph (see {@link TextProps.inline}).\n *\n * @module\n */\nimport { createRequire } from 'node:module'\nimport { InvalidOptionError, UnsupportedFeatureError } from './errors.js'\n\nconst nodeRequire = createRequire(import.meta.url)\n\n/** Minimal shape of the temml API we depend on. */\ninterface TemmlModule {\n\trenderToString(latex: string, options?: { displayMode?: boolean; throwOnError?: boolean }): string\n}\n/** temml's `ParseError` carries a `position` (character offset into the source). */\ninterface TemmlParseError extends Error {\n\tposition?: number\n}\n\nconst MISSING_DEPS_MESSAGE =\n\t\"@shbernal/ts-pptx/math requires the optional peer dependencies 'temml' and \" +\n\t\"'mathml2omml'. Install them with: npm install temml mathml2omml\"\n\n/** Require an optional peer, remapping a not-found error to the install hint. */\nfunction requirePeer<T>(id: string): T {\n\ttry {\n\t\treturn nodeRequire(id) as T\n\t} catch (err) {\n\t\tif ((err as NodeJS.ErrnoException | undefined)?.code === 'MODULE_NOT_FOUND') {\n\t\t\tthrow new UnsupportedFeatureError('math/missing-optional-peer', MISSING_DEPS_MESSAGE, { cause: err })\n\t\t}\n\t\tthrow err\n\t}\n}\n\nlet temmlModule: TemmlModule | undefined\nlet mml2ommlFn: ((mathml: string) => string) | undefined\n\nfunction loadTemml(): TemmlModule {\n\tif (!temmlModule) {\n\t\tconst mod = requirePeer<TemmlModule | { default: TemmlModule }>('temml')\n\t\ttemmlModule = 'renderToString' in mod ? mod : mod.default\n\t}\n\treturn temmlModule\n}\n\nfunction loadMml2omml(): (mathml: string) => string {\n\tif (!mml2ommlFn) {\n\t\tconst mod = requirePeer<{ mml2omml: (mathml: string) => string }>('mathml2omml')\n\t\tmml2ommlFn = mod.mml2omml\n\t}\n\treturn mml2ommlFn\n}\n\n/**\n * mathml2omml puts namespace declarations on the `<m:oMath>` opening tag: `xmlns:m`\n * (redundant — the `<a14:m>` envelope the `math:` option authors already declares it)\n * and `xmlns:w` (unused in the output it produces). Strip them so the result is a bare\n * `<m:oMath>` that drops into the `math:` option cleanly.\n */\nfunction stripOMathNamespaces(omml: string): string {\n\treturn omml.replace(/^(\\s*<m:oMath)\\b[^>]*>/, '$1>')\n}\n\n/** Centered-display paragraph props, matching what the `math:` emitter/oracle author. */\nconst DISPLAY_PARA_PR = '<m:oMathParaPr><m:jc m:val=\"centerGroup\"/></m:oMathParaPr>'\n\n/**\n * The operator-dictionary subset this module has to carry, keyed by the character temml\n * puts in the `<mo>` of an accent and valued by the combining mark OMML wants in `m:chr`.\n *\n * Two halves of one problem. **Which** `<mover>`s are accents: temml renders every accent\n * command as a bare `<mover>` with no `accent=\"true\"`, which is correct for a browser —\n * MathML renderers derive accent positioning from the operator dictionary, so the attribute\n * is redundant there — but mathml2omml has no dictionary and keys strictly off the\n * attribute, mapping a bare `<mover>` to `<m:limUpp>` (an over-*limit*, with limit spacing)\n * instead of `<m:acc>`. Membership in this table is the dictionary lookup that is otherwise\n * missing. **Which character** to attach: mathml2omml passes the `<mo>` text straight\n * through to `m:chr`, and temml emits the *spacing* modifiers (U+02C6 MODIFIER LETTER\n * CIRCUMFLEX, U+2192 RIGHTWARDS ARROW) while ECMA-376 §22.1.2.20 says an `accPr` character\n * \"should be within the range of (U+0300–U+036F) or (U+20D0–U+20EF)\" — the combining marks,\n * which is also what Word itself writes. Left alone, `\\vec{v}` would hang a full-size arrow\n * over the base instead of an arrow accent.\n *\n * Keyed by character rather than by LaTeX command because that is all that survives into\n * the MathML. Derived by rendering every accent command temml documents and reading back\n * the `<mo>` it produced; the commands each entry serves are named in the comments.\n */\nconst ACCENT_CHARS = new Map<string, string>([\n\t['ˆ', '̂'], // ˆ \\hat, \\^ → COMBINING CIRCUMFLEX ACCENT\n\t['~', '̃'], // ~ \\tilde, \\~ → COMBINING TILDE\n\t['´', '́'], // ´ \\acute → COMBINING ACUTE ACCENT\n\t['ˊ', '́'], // ˊ \\' → COMBINING ACUTE ACCENT\n\t['`', '̀'], // ` \\grave → COMBINING GRAVE ACCENT\n\t['ˋ', '̀'], // ˋ \\` → COMBINING GRAVE ACCENT\n\t['¨', '̈'], // ¨ \\ddot, \\\" → COMBINING DIAERESIS\n\t['˙', '̇'], // ˙ \\dot, \\. → COMBINING DOT ABOVE\n\t['‾', '̄'], // ‾ \\bar → COMBINING MACRON\n\t['ˉ', '̄'], // ˉ \\= → COMBINING MACRON\n\t['˘', '̆'], // ˘ \\breve, \\u → COMBINING BREVE\n\t['ˇ', '̌'], // ˇ \\check, \\v → COMBINING CARON\n\t['˚', '̊'], // ˚ \\mathring, \\r → COMBINING RING ABOVE\n\t['˝', '̋'], // ˝ \\H → COMBINING DOUBLE ACUTE ACCENT\n\t['→', '⃗'], // → \\vec → COMBINING RIGHT ARROW ABOVE\n\t['…', '⃛'], // … \\dddot → COMBINING THREE DOTS ABOVE\n])\n\n/** An `<mover>`'s last child, when that child is an `<mo>`: `[, attributes, text]`. */\nconst TRAILING_MO = /<mo\\b([^>]*)>([^<]*)<\\/mo>\\s*$/\n\n/**\n * Stamp `accent=\"true\"` on the `<mover>`s that are accents, and swap their operator for the\n * combining mark OMML wants. See {@link ACCENT_CHARS} for why both are needed.\n *\n * Scoped as narrowly as the defect. Only `<mo stretchy=\"false\">` qualifies, which is how\n * temml distinguishes a true accent from a *wide* one (`\\widehat`, `\\overrightarrow`) or a\n * group character (`\\overbrace`, `\\overgroup`) — those already reach `m:groupChr`, which is\n * a reasonable rendering, so they are left alone rather than churned. `\\stackrel` is an\n * over-relation whose character comes from the caller, so it stays `m:limUpp` unless the\n * caller happened to stack a diacritic. An `<mover>` that already states `accent` is the\n * author's call and is never rewritten.\n *\n * `<munder>` is deliberately **not** touched. The symmetric-looking fix — stamping\n * `accentunder=\"true\"` — makes mathml2omml emit `<m:acc>`, which is an *over*-accent: it\n * would move `\\utilde`'s tilde above the base. OMML has no under-accent object, so the\n * `m:limLow` an under-accent already produces is the closest thing available.\n *\n * Implemented against the tag text rather than through a DOM. temml's output is\n * machine-generated and well-formed, so pairing `<mover>` with `</mover>` on a stack is\n * exact, and this subpath otherwise carries no XML parser — the read path's is a different\n * dependency and pulling it in here would grow the module for one rewrite.\n */\nfunction markAccentedMovers(mathml: string): string {\n\tconst edits: { at: number; length: number; text: string }[] = []\n\tconst open: number[] = []\n\tconst tags = /<(\\/?)mover\\b[^>]*>/g\n\tfor (let tag = tags.exec(mathml); tag !== null; tag = tags.exec(mathml)) {\n\t\tif (tag[1] === '') {\n\t\t\t// `accent` already stated: the author has answered the question this asks.\n\t\t\topen.push(tag[0].includes('accent=') ? -1 : tag.index)\n\t\t\tcontinue\n\t\t}\n\t\tconst openAt = open.pop()\n\t\tif (openAt === undefined || openAt === -1) continue\n\n\t\tconst openEnd = mathml.indexOf('>', openAt) + 1\n\t\tconst mo = TRAILING_MO.exec(mathml.slice(openEnd, tag.index))\n\t\tif (!mo) continue\n\t\tconst [whole, attrs = '', operator = ''] = mo\n\t\t// `stretchy=\"false\"` is how temml separates a true accent from a wide one\n\t\t// (`\\widehat`) or a group character (`\\overbrace`); those already map well.\n\t\tif (!attrs.includes('stretchy=\"false\"')) continue\n\t\tconst combining = ACCENT_CHARS.get(operator)\n\t\t// A multi-character operator (`\\ddddot` renders as \"….\") has no single `m:chr`, so it\n\t\t// is not in the table and keeps the limit form rather than producing an invalid one.\n\t\tif (combining === undefined) continue\n\n\t\t// Applied right-to-left below, so earlier offsets stay valid.\n\t\tedits.push({\n\t\t\tat: openEnd + mo.index + whole.length - `${operator}</mo>`.length,\n\t\t\tlength: operator.length,\n\t\t\ttext: combining,\n\t\t})\n\t\tedits.push({ at: openAt + '<mover'.length, length: 0, text: ' accent=\"true\"' })\n\t}\n\n\tlet out = mathml\n\tfor (const edit of edits.sort((a, b) => b.at - a.at)) {\n\t\tout = out.slice(0, edit.at) + edit.text + out.slice(edit.at + edit.length)\n\t}\n\treturn out\n}\n\n/**\n * Convert a MathML string to OMML for the `math:` option on `addText`.\n *\n * Canonical output form: a bare `<m:oMath>…</m:oMath>` in the `m:` namespace, with no\n * namespace declarations (the `math:` option's envelope supplies the `m` prefix).\n *\n * @param mathml - a MathML string (e.g. `<math>…</math>`)\n * @returns OMML `<m:oMath>…</m:oMath>`\n */\nexport function mathmlToOmml(mathml: string): string {\n\tconst mml2omml = loadMml2omml()\n\treturn stripOMathNamespaces(mml2omml(mathml).trim())\n}\n\nexport interface LatexToOmmlOptions {\n\t/**\n\t * Display (block) math: render in `displayMode` and wrap the result in\n\t * `<m:oMathPara>` (a centered display-math paragraph). Default `true`. When `false`,\n\t * temml renders in inline mode and the result is a bare `<m:oMath>`.\n\t */\n\tdisplay?: boolean\n}\n\n/**\n * Convert a LaTeX string to OMML for the `math:` option on `addText`.\n *\n * Display math (the default) is returned as a full `<m:oMathPara>` centered display\n * paragraph; with `{ display: false }` a bare `<m:oMath>` is returned (both forms are\n * accepted by the `math:` option). Throws on invalid LaTeX, surfacing temml's parse\n * position.\n *\n * @param latex - a LaTeX math expression, e.g. `x = \\frac{-b \\pm \\sqrt{b^2-4ac}}{2a}`\n * @param opts - see {@link LatexToOmmlOptions}\n * @returns OMML `<m:oMathPara>…</m:oMathPara>` (display) or `<m:oMath>…</m:oMath>` (inline)\n * @throws {Error} if the LaTeX cannot be parsed\n */\nexport function latexToOmml(latex: string, opts: LatexToOmmlOptions = {}): string {\n\tconst display = opts.display ?? true\n\tconst temml = loadTemml()\n\tlet mathml: string\n\ttry {\n\t\tmathml = temml.renderToString(latex, { displayMode: display, throwOnError: true })\n\t} catch (err) {\n\t\tconst pe = err as TemmlParseError\n\t\tconst pos = typeof pe.position === 'number' ? ` (position ${pe.position})` : ''\n\t\tthrow new InvalidOptionError('math/invalid-latex', `Invalid LaTeX${pos}: ${pe.message}`, { cause: err })\n\t}\n\t// Applied here rather than in `mathmlToOmml`, because it compensates for something temml\n\t// does: a caller handing in their own MathML states `accent` themselves, and rewriting it\n\t// under them would be the module second-guessing an attribute the MathML spec gives them.\n\tconst oMath = mathmlToOmml(markAccentedMovers(mathml))\n\treturn display ? `<m:oMathPara>${DISPLAY_PARA_PR}${oMath}</m:oMathPara>` : oMath\n}\n\n// Error taxonomy — see `entry-errors.ts`. Re-exported from every entry so `instanceof`\n// works whichever subpath a consumer imports.\nexport * from './entry-errors.js'\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AA0BA,MAAM,cAAc,cAAc,YAAY,GAAG;AAWjD,MAAM,uBACL;;AAID,SAAS,YAAe,IAAe;CACtC,IAAI;EACH,OAAO,YAAY,EAAE;CACtB,SAAS,KAAK;EACb,IAAK,KAA2C,SAAS,oBACxD,MAAM,IAAI,wBAAwB,8BAA8B,sBAAsB,EAAE,OAAO,IAAI,CAAC;EAErG,MAAM;CACP;AACD;AAEA,IAAI;AACJ,IAAI;AAEJ,SAAS,YAAyB;CACjC,IAAI,CAAC,aAAa;EACjB,MAAM,MAAM,YAAoD,OAAO;EACvE,cAAc,oBAAoB,MAAM,MAAM,IAAI;CACnD;CACA,OAAO;AACR;AAEA,SAAS,eAA2C;CACnD,IAAI,CAAC,YAEJ,aADY,YAAsD,aACnD,CAAC,CAAC;CAElB,OAAO;AACR;;;;;;;AAQA,SAAS,qBAAqB,MAAsB;CACnD,OAAO,KAAK,QAAQ,0BAA0B,KAAK;AACpD;;AAGA,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;AAuBxB,MAAM,+BAAe,IAAI,IAAoB;CAC5C,CAAC,KAAK,GAAG;CACT,CAAC,KAAK,GAAG;CACT,CAAC,KAAK,GAAG;CACT,CAAC,KAAK,GAAG;CACT,CAAC,KAAK,GAAG;CACT,CAAC,KAAK,GAAG;CACT,CAAC,KAAK,GAAG;CACT,CAAC,KAAK,GAAG;CACT,CAAC,KAAK,GAAG;CACT,CAAC,KAAK,GAAG;CACT,CAAC,KAAK,GAAG;CACT,CAAC,KAAK,GAAG;CACT,CAAC,KAAK,GAAG;CACT,CAAC,KAAK,GAAG;CACT,CAAC,KAAK,GAAG;CACT,CAAC,KAAK,GAAG;AACV,CAAC;;AAGD,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;AAwBpB,SAAS,mBAAmB,QAAwB;CACnD,MAAM,QAAwD,CAAC;CAC/D,MAAM,OAAiB,CAAC;CACxB,MAAM,OAAO;CACb,KAAK,IAAI,MAAM,KAAK,KAAK,MAAM,GAAG,QAAQ,MAAM,MAAM,KAAK,KAAK,MAAM,GAAG;EACxE,IAAI,IAAI,OAAO,IAAI;GAElB,KAAK,KAAK,IAAI,EAAE,CAAC,SAAS,SAAS,IAAI,KAAK,IAAI,KAAK;GACrD;EACD;EACA,MAAM,SAAS,KAAK,IAAI;EACxB,IAAI,WAAW,KAAA,KAAa,WAAW,IAAI;EAE3C,MAAM,UAAU,OAAO,QAAQ,KAAK,MAAM,IAAI;EAC9C,MAAM,KAAK,YAAY,KAAK,OAAO,MAAM,SAAS,IAAI,KAAK,CAAC;EAC5D,IAAI,CAAC,IAAI;EACT,MAAM,CAAC,OAAO,QAAQ,IAAI,WAAW,MAAM;EAG3C,IAAI,CAAC,MAAM,SAAS,oBAAkB,GAAG;EACzC,MAAM,YAAY,aAAa,IAAI,QAAQ;EAG3C,IAAI,cAAc,KAAA,GAAW;EAG7B,MAAM,KAAK;GACV,IAAI,UAAU,GAAG,QAAQ,MAAM,SAAS,GAAG,SAAS,OAAO;GAC3D,QAAQ,SAAS;GACjB,MAAM;EACP,CAAC;EACD,MAAM,KAAK;GAAE,IAAI,SAAS;GAAiB,QAAQ;GAAG,MAAM;EAAiB,CAAC;CAC/E;CAEA,IAAI,MAAM;CACV,KAAK,MAAM,QAAQ,MAAM,MAAM,GAAG,MAAM,EAAE,KAAK,EAAE,EAAE,GAClD,MAAM,IAAI,MAAM,GAAG,KAAK,EAAE,IAAI,KAAK,OAAO,IAAI,MAAM,KAAK,KAAK,KAAK,MAAM;CAE1E,OAAO;AACR;;;;;;;;;;AAWA,SAAgB,aAAa,QAAwB;CAEpD,OAAO,qBADU,aACkB,CAAC,CAAC,MAAM,CAAC,CAAC,KAAK,CAAC;AACpD;;;;;;;;;;;;;;AAwBA,SAAgB,YAAY,OAAe,OAA2B,CAAC,GAAW;CACjF,MAAM,UAAU,KAAK,WAAW;CAChC,MAAM,QAAQ,UAAU;CACxB,IAAI;CACJ,IAAI;EACH,SAAS,MAAM,eAAe,OAAO;GAAE,aAAa;GAAS,cAAc;EAAK,CAAC;CAClF,SAAS,KAAK;EACb,MAAM,KAAK;EACX,MAAM,MAAM,OAAO,GAAG,aAAa,WAAW,cAAc,GAAG,SAAS,KAAK;EAC7E,MAAM,IAAI,mBAAmB,sBAAsB,gBAAgB,IAAI,IAAI,GAAG,WAAW,EAAE,OAAO,IAAI,CAAC;CACxG;CAIA,MAAM,QAAQ,aAAa,mBAAmB,MAAM,CAAC;CACrD,OAAO,UAAU,gBAAgB,kBAAkB,MAAM,kBAAkB;AAC5E"}
|
package/dist/measure.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { bn as TextPropsOptions, i as ObjectOptions, sn as MeasureTextOptions, un as OverflowBoxOptions, vn as TextMeasurement, yn as TextProps } from "./slide-
|
|
2
|
-
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 { bn as TextPropsOptions, i as ObjectOptions, sn as MeasureTextOptions, un as OverflowBoxOptions, vn as TextMeasurement, yn as TextProps } from "./slide-BTfn1Pyp.js";
|
|
2
|
+
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-BVLCFr-t.js";
|
|
3
3
|
//#region src/measure/font-metrics.d.ts
|
|
4
4
|
/** Per-(face,bold,italic) advance-width source backed by a parsed font file. */
|
|
5
5
|
interface FontMetrics {
|
|
@@ -90,7 +90,7 @@ declare const MIN_FONT_SCALE_PCT = 25;
|
|
|
90
90
|
* each glyph advance up — so PowerPoint wraps marginally earlier and its fitted
|
|
91
91
|
* box is marginally taller. Inflating measured width and height by these factors
|
|
92
92
|
* makes the computed `fontScale` ≤ PowerPoint's across the calibration oracle
|
|
93
|
-
* (`test/read/autofit-calibration-oracle.test.
|
|
93
|
+
* (`test/read/autofit-calibration-oracle.test.js`: 0 violations over the Aptos
|
|
94
94
|
* cases). They err on the side of shrinking slightly too much, never overflowing.
|
|
95
95
|
*/
|
|
96
96
|
declare const WIDTH_SAFETY_FACTOR = 1.03;
|
package/dist/measure.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { a as TsPptxError, i as PackageReadError, n as InvalidOptionError, o as UnsupportedFeatureError, r as MediaError, t as InternalError } from "./errors-
|
|
2
|
-
import { _ as parseFontMetrics, a as FONT_SCALE_STEP_PCT, c as SINGLE_LINE_PITCH, d as measureLayout, f as solveResize, g as makeRegistryResolver, h as getHeuristicFontMetrics, i as buildFitParagraphs, l as WIDTH_SAFETY_FACTOR, m as FontMetricsRegistry, n as measureText, o as HEIGHT_SAFETY_FACTOR, p as solveShrink, s as MIN_FONT_SCALE_PCT, u as measureHeightPt } from "./fit-
|
|
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 { _ as parseFontMetrics, a as FONT_SCALE_STEP_PCT, c as SINGLE_LINE_PITCH, d as measureLayout, f as solveResize, g as makeRegistryResolver, h as getHeuristicFontMetrics, i as buildFitParagraphs, l as WIDTH_SAFETY_FACTOR, m as FontMetricsRegistry, n as measureText, o as HEIGHT_SAFETY_FACTOR, p as solveShrink, s as MIN_FONT_SCALE_PCT, u as measureHeightPt } from "./fit-DhMbQG5O.js";
|
|
3
3
|
export { FONT_SCALE_STEP_PCT, FontMetricsRegistry, HEIGHT_SAFETY_FACTOR, InternalError, InvalidOptionError, MIN_FONT_SCALE_PCT, MediaError, PackageReadError, SINGLE_LINE_PITCH, TsPptxError, UnsupportedFeatureError, WIDTH_SAFETY_FACTOR, buildFitParagraphs, getHeuristicFontMetrics, makeRegistryResolver, measureHeightPt, measureLayout, measureText, parseFontMetrics, solveResize, solveShrink };
|
package/dist/node.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-BTfn1Pyp.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-C-EU3SkN.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-Chjz_4_Q.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-BVLCFr-t.js";
|
|
6
6
|
//#region src/node.d.ts
|
|
7
7
|
/**
|
|
8
8
|
* The Node entry, reached through the `node` export condition — a consumer importing the bare
|
package/dist/node.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node.d.ts","names":[],"sources":["../src/node.ts"],"mappings":";;;;;;;;;;;;;;cAWa,eAAe;
|
|
1
|
+
{"version":3,"file":"node.d.ts","names":[],"sources":["../src/node.ts"],"mappings":";;;;;;;;;;;;;;cAWa,eAAe;EAC3B"}
|
package/dist/node.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
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-
|
|
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-C4P9MNdf.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
6
|
import { Buffer } from "node:buffer";
|
|
7
7
|
import fs from "node:fs/promises";
|
|
8
8
|
//#region src/runtime/node.ts
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"package-CaOLXSNi.d.ts","names":[],"sources":["../src/read/opc/content-types.ts","../src/read/opc/part.ts","../src/read/opc/relationships.ts","../src/read/opc/package.ts"],"mappings":";;;;;;;;cAUa;;SAKL,MAAM,cAAc;;EAgC3B,eAAe;;MAKX;;;;;;;EAUJ,iBAAiB,kBAAkB;;;;;;EAWnC,eAAe;;EAKf,cAAc,mBAAmB;EAOjC;;;;;;;;;;;cCtEY;;WACH;WACA;
|
|
1
|
+
{"version":3,"file":"package-CaOLXSNi.d.ts","names":[],"sources":["../src/read/opc/content-types.ts","../src/read/opc/part.ts","../src/read/opc/relationships.ts","../src/read/opc/package.ts"],"mappings":";;;;;;;;cAUa;;SAKL,MAAM,cAAc;;EAgC3B,eAAe;;MAKX;;;;;;;EAUJ,iBAAiB,kBAAkB;;;;;;EAWnC,eAAe;;EAKf,cAAc,mBAAmB;EAOjC;;;;;;;;;;;cCtEY;;WACH;WACA;EAKT,YAAY,kBAAkB,qBAAqB,OAAO;;MAOtD;;MAOA;;MAKA,SAAS;;;;;MAQT,OAAO;;EAWX;MASI;;;;;EAQJ,aAAa;;;;UCzEG;EAChB;EACA;EACA;EACA;;;;;;;;cASY;;;WAEH;UAIF;;;;;SAQA,MAAM,aAAa,yBAAyB;;SAuC5C,MAAM,yBAAyB;MAIlC;;MAKA;;;;;;;EAUJ,IAAI,cAAc,gBAAgB,uCAAuC;;;;;;;;EAqBzE,UAAU,YAAY,cAAc,gBAAgB,uCAAuC;;;;;;EAkB3F,OAAO;EAMP,IAAI,aAAa;EAIjB,OAAO,eAAe;GAIrB,OAAO,aAAa,iBAAiB;;EAKtC,cAAc;EAgBd;;;;;;;;;KCvJW,+BAA+B,aAAa,cAAc;;;;;;;;;cAgBzD;;;WAIH,cAAc;UAIhB;;MAOH,SAAS,oBAAoB;SAIpB,KAAK,OAAO,WAAW,QAAQ;EA4B5C,KAAK,mBAAmB;EAIxB,mBAAmB,sBAAsB;;;;;EAQzC,iBAAiB,0BAAuB;;;;;EAexC,QAAQ,kBAAkB,qBAAqB,OAAO,aAAa;;;;;;;;;EAoBnE,WAAW;;;;;EAYX,qBAAqB,mBAAmB;;;;;;;;;;EAoBxC,oBAAoB;;;;;;EAuBd,QAAQ,QAAQ"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { y as WRITE_OUTPUT_TYPE } from "./enums-
|
|
2
|
-
import { a as Slide, et as HexColor } from "./slide-
|
|
1
|
+
import { y as WRITE_OUTPUT_TYPE } from "./enums-CoXnxiCI.js";
|
|
2
|
+
import { a as Slide, et as HexColor } from "./slide-BTfn1Pyp.js";
|
|
3
3
|
//#region src/types/theme.d.ts
|
|
4
4
|
/**
|
|
5
5
|
* Theme color scheme overrides. Each slot maps to one `<a:clrScheme>` entry in `theme1.xml`;
|
|
@@ -199,4 +199,4 @@ interface PresentationProps {
|
|
|
199
199
|
}
|
|
200
200
|
//#endregion
|
|
201
201
|
export { PresentationProps as a, WriteFileProps as c, ThemeProps as d, PresLayout as i, WriteProps as l, PackagePart as n, SectionProps as o, PartsProps as r, WriteBaseProps as s, CustomPropertyValue as t, ThemeColorScheme as u };
|
|
202
|
-
//# sourceMappingURL=pres-
|
|
202
|
+
//# sourceMappingURL=pres-C-EU3SkN.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pres-
|
|
1
|
+
{"version":3,"file":"pres-C-EU3SkN.d.ts","names":[],"sources":["../src/types/theme.ts","../src/types/pres.ts"],"mappings":";;;;;;;;;;;;UAgBiB;;EAEhB,MAAM;;EAEN,MAAM;;EAEN,MAAM;;EAEN,MAAM;;EAEN,UAAU;;EAEV,UAAU;;EAEV,UAAU;;EAEV,UAAU;;EAEV,UAAU;;EAEV,UAAU;;EAEV,QAAQ;;EAER,WAAW;;UAEK;;;;;;EAMhB;;;;;;EAMA;;;;;;;EAOA;;;;;;;EAOA;;;;;;;EAOA;;;;;;;EAOA;;;;;;;EAOA,cAAc;;;;UC/EE;;;;;;EAMhB;;;;;;;;;;;;EAYA;;UAEgB,mBAAmB;;;;;;EAMnC,aAAa;;UAEG,uBAAuB;;;;;EAKvC;;;;;;;;;;UAUgB;;WAEP;;WAEA,MAAM;;;;;;;UAOC;;;;;;EAMhB;;UAEgB;;;;EAIhB;;;;;EAKA;;UAEgB;EAChB;EACA;;;;;EAMA;EACA;EACA;;KAEW,kDAAkD;UAE7C;EAChB;EACA;EACA;EACA,aAAa;;;;;EAKb,YAAY;EACZ;;;;;EAKA;;;;;EAKA;EACA;EACA,OAAO;EACP"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { i as PackageReadError, n as InvalidOptionError, o as UnsupportedFeatureError, t as InternalError } from "./errors-
|
|
2
|
-
import { d as emuToInches } from "./units-
|
|
3
|
-
import { _ as SLIDE_LAYOUT_REL, b as THEME_REL, d as IMAGE_REL, f as NOTES_MASTER_REL, m as OFFICE_DOCUMENT_REL, p as NOTES_SLIDE_REL, v as SLIDE_MASTER_REL, y as SLIDE_REL } from "./st-enums-
|
|
1
|
+
import { i as PackageReadError, n as InvalidOptionError, o as UnsupportedFeatureError, t as InternalError } from "./errors-Bvln0H-7.js";
|
|
2
|
+
import { d as emuToInches } from "./units-C7QM1KgH.js";
|
|
3
|
+
import { _ as SLIDE_LAYOUT_REL, b as THEME_REL, d as IMAGE_REL, f as NOTES_MASTER_REL, m as OFFICE_DOCUMENT_REL, p as NOTES_SLIDE_REL, v as SLIDE_MASTER_REL, y as SLIDE_REL } from "./st-enums-evQG2A7Z.js";
|
|
4
4
|
import { i as FONT_REL_TYPE, n as FONT_DATA_CONTENT_TYPE, r as FONT_DATA_EXTENSION, t as EMBEDDED_FONT_SLOTS } from "./embedded-fonts-MaynAHa9.js";
|
|
5
5
|
import { ZipWriter, readZip } from "./zip.js";
|
|
6
|
-
import { $ as
|
|
6
|
+
import { $ as parseClrScheme, A as readGradientFill, At as getElements, B as placeholderInheritedAnchor, Bt as setAttr, Ct as boolValue, D as spPrXfrmEmu, Dt as escapeXmlAttribute, E as TextFrame, Et as descendantsByTag, F as resolveSlideColorContext, Ft as parseXml, G as placeholderOf, H as placeholderInheritedListStyles, I as resolveSlideThemeParts, It as removeAttr, J as SCHEME_SLOTS, K as slideDefinesColor, Lt as removeChildrenByQName, M as resolveLayoutColorContext, Mt as insertInOrder, N as resolveMasterColorContext, Nt as intValue, O as readPatternFill, Ot as firstChild, P as resolveNotesColorContext, Pt as ownerDocumentOf, Q as parseClrMap, R as LST_STYLE_LEVELS, Rt as replaceInParent, S as AutoShape, St as attr, Tt as createElement, U as placeholderInheritedRunProps, V as placeholderInheritedColor, W as placeholderInheritedXfrm, X as intAttr, Y as fmtEntry, Z as isA, _t as relsPartNameFor, at as FILL_CHOICES, bt as zipPathToPartName, ct as SPPR_AFTER_XFRM, dt as SPPR_LN_AFTER, et as resolveColor, ft as SPPR_SCENE3D_AFTER, gt as relativePartName, ht as partNameToZipPath, it as substitutePhClr, j as resolveColorElement, jt as getOrAddChild, k as readPictureFill, kt as firstChildElement, l as wrapShapeElement, lt as SPPR_EFFECT_AFTER, mt as partNameExtension, n as buildShapes, nt as styleRefFill, ot as RPR_FILL_AFTER, pt as SPPR_SP3D_AFTER, q as slideDefinesProp, r as findShapeByIdDeep, rt as styleRefLine, st as SHAPE_AFTER_SPPR, t as GroupShape, tt as resolveSchemeToken, u as GraphicFrame, ut as SPPR_FILL_AFTER, vt as resolveRelativePartName, wt as childElements, x as Picture, xt as OOXML_NS, yt as resolveSingleRel, z as RUN_PROP_NAMES, zt as serializeXml } from "./shapes-DoJBPrwN.js";
|
|
7
7
|
//#region src/read/opc/content-types.ts
|
|
8
8
|
/**
|
|
9
9
|
* Overlay over `[Content_Types].xml`, used to resolve part content types at
|
|
@@ -1440,6 +1440,13 @@ function placeholderShapes(spTree) {
|
|
|
1440
1440
|
* and text style from. Geometry getters read the placeholder's *own* `a:xfrm`,
|
|
1441
1441
|
* which a master/layout placeholder carries explicitly (so it round-trips, unlike a
|
|
1442
1442
|
* notes placeholder's inherited geometry).
|
|
1443
|
+
*
|
|
1444
|
+
* This is the identity-and-geometry view. The same `p:sp` also appears in
|
|
1445
|
+
* {@link SlideMaster.shapes} / {@link SlideLayout.shapes} as an `AutoShape`, which
|
|
1446
|
+
* additionally carries the paint surface (`resolvedFill`, `resolvedLine`,
|
|
1447
|
+
* `presetGeometry`, `rotation`, `absoluteFrame`) and reports its `p:ph` through
|
|
1448
|
+
* `AutoShape.placeholder`. Read a placeholder here to *place* it; read it there to
|
|
1449
|
+
* *draw* it.
|
|
1443
1450
|
*/
|
|
1444
1451
|
var Placeholder = class {
|
|
1445
1452
|
sp;
|
|
@@ -1513,9 +1520,9 @@ var Placeholder = class {
|
|
|
1513
1520
|
/**
|
|
1514
1521
|
* A deck's slide master (`slideMasterN.xml`) as a modeled object. Exposes the
|
|
1515
1522
|
* property tiers a bound slide inherits: the {@link colorMap} (token → theme slot),
|
|
1516
|
-
* its {@link theme}, its {@link placeholders}
|
|
1517
|
-
* {@link background}, and the {@link layouts} that build on it. Reachable
|
|
1518
|
-
* {@link SlideLayout.master} and `Slide.master`.
|
|
1523
|
+
* its {@link theme}, its {@link shapes} and the {@link placeholders} subset of them,
|
|
1524
|
+
* its own {@link background}, and the {@link layouts} that build on it. Reachable
|
|
1525
|
+
* from {@link SlideLayout.master} and `Slide.master`.
|
|
1519
1526
|
*/
|
|
1520
1527
|
var SlideMaster = class {
|
|
1521
1528
|
opc;
|
|
@@ -1529,6 +1536,10 @@ var SlideMaster = class {
|
|
|
1529
1536
|
get partName() {
|
|
1530
1537
|
return this.part.partName;
|
|
1531
1538
|
}
|
|
1539
|
+
/** This master part's relationships (its layouts, its theme, image embeds, …). */
|
|
1540
|
+
get relationships() {
|
|
1541
|
+
return this.opc.relationshipsFor(this.partName);
|
|
1542
|
+
}
|
|
1532
1543
|
/** The master's authoring name (`p:cSld/@name`), or `''` when unnamed (the writer's default). */
|
|
1533
1544
|
get name() {
|
|
1534
1545
|
const cSld = this.#cSld();
|
|
@@ -1552,10 +1563,27 @@ var SlideMaster = class {
|
|
|
1552
1563
|
for (const token of COLOR_MAP_TOKENS) out[token] = parsed.get(token) ?? null;
|
|
1553
1564
|
return out;
|
|
1554
1565
|
}
|
|
1566
|
+
/**
|
|
1567
|
+
* Every shape in the master's `p:cSld/p:spTree`, in document order — the same
|
|
1568
|
+
* `AnyShape` union `Slide.shapes` returns, so shape-walking code applies
|
|
1569
|
+
* unchanged. This is where a template's non-placeholder furniture lives: the
|
|
1570
|
+
* header band, the rule under the title, the logo. Whether a given slide draws
|
|
1571
|
+
* them is `Slide.showMasterSp` (and, for a layout, {@link SlideLayout.showMasterSp}).
|
|
1572
|
+
*
|
|
1573
|
+
* {@link placeholders} is the filtered view of the same tree.
|
|
1574
|
+
*/
|
|
1575
|
+
get shapes() {
|
|
1576
|
+
const spTree = this.#spTree();
|
|
1577
|
+
return spTree ? buildShapes(spTree, this) : [];
|
|
1578
|
+
}
|
|
1579
|
+
/** The shape anywhere in the master's tree with the given drawing id, or `undefined`. */
|
|
1580
|
+
shapeByIdDeep(id) {
|
|
1581
|
+
return findShapeByIdDeep(this.shapes, id);
|
|
1582
|
+
}
|
|
1555
1583
|
/** The master's placeholder shapes (`p:sp` carrying a `p:ph`), in document order. */
|
|
1556
1584
|
get placeholders() {
|
|
1557
1585
|
const ctx = this.themeContext();
|
|
1558
|
-
const rels = this.
|
|
1586
|
+
const rels = this.relationships;
|
|
1559
1587
|
return placeholderShapes(this.#spTree()).map((sp) => new Placeholder(sp, this.part, ctx, rels));
|
|
1560
1588
|
}
|
|
1561
1589
|
/** The layouts built on this master (via `p:sldLayoutIdLst` → its relationships), in list order. */
|
|
@@ -1563,7 +1591,7 @@ var SlideMaster = class {
|
|
|
1563
1591
|
const root = this.part.dom.documentElement;
|
|
1564
1592
|
const lst = root && firstChild(root, "p:sldLayoutIdLst");
|
|
1565
1593
|
if (!lst) return [];
|
|
1566
|
-
const rels = this.
|
|
1594
|
+
const rels = this.relationships;
|
|
1567
1595
|
const out = [];
|
|
1568
1596
|
for (const entry of getElements(lst, "p:sldLayoutId")) {
|
|
1569
1597
|
const relId = attr(entry, "r:id");
|
|
@@ -1581,7 +1609,7 @@ var SlideMaster = class {
|
|
|
1581
1609
|
const bg = backgroundElementOf(this.part.dom.documentElement);
|
|
1582
1610
|
if (!bg) return null;
|
|
1583
1611
|
const themePart = this.#relTarget(THEME_REL);
|
|
1584
|
-
return readSlideBackground(bg, "master", this.themeContext(), this.
|
|
1612
|
+
return readSlideBackground(bg, "master", this.themeContext(), this.relationships, themePart ? this.opc.relationshipsFor(themePart.partName) : null);
|
|
1585
1613
|
}
|
|
1586
1614
|
/**
|
|
1587
1615
|
* The master's colour/font context (its `p:clrMap` + theme), resolved once and
|
|
@@ -1591,7 +1619,7 @@ var SlideMaster = class {
|
|
|
1591
1619
|
return this.#themeContext ??= resolveMasterColorContext(this.opc, this.partName);
|
|
1592
1620
|
}
|
|
1593
1621
|
#relTarget(type) {
|
|
1594
|
-
const rels = this.
|
|
1622
|
+
const rels = this.relationships;
|
|
1595
1623
|
const rel = rels.byType(type)[0];
|
|
1596
1624
|
return rel ? this.opc.part(rels.resolveTarget(rel.id)) ?? null : null;
|
|
1597
1625
|
}
|
|
@@ -1608,8 +1636,8 @@ var SlideMaster = class {
|
|
|
1608
1636
|
* A deck's slide layout (`slideLayoutN.xml`) as a modeled object — the gallery entry
|
|
1609
1637
|
* a slide binds to. Exposes its {@link name}, its {@link type} (import-only; the
|
|
1610
1638
|
* writer authors none), its {@link master} (and, through it, the {@link theme}), its
|
|
1611
|
-
* {@link placeholders}
|
|
1612
|
-
* from `Slide.layout` and {@link SlideMaster.layouts}.
|
|
1639
|
+
* {@link shapes} and the {@link placeholders} subset of them, and its own
|
|
1640
|
+
* {@link background}. Reachable from `Slide.layout` and {@link SlideMaster.layouts}.
|
|
1613
1641
|
*/
|
|
1614
1642
|
var SlideLayout = class {
|
|
1615
1643
|
opc;
|
|
@@ -1623,6 +1651,10 @@ var SlideLayout = class {
|
|
|
1623
1651
|
get partName() {
|
|
1624
1652
|
return this.part.partName;
|
|
1625
1653
|
}
|
|
1654
|
+
/** This layout part's relationships (its master, image embeds, hyperlinks, …). */
|
|
1655
|
+
get relationships() {
|
|
1656
|
+
return this.opc.relationshipsFor(this.partName);
|
|
1657
|
+
}
|
|
1626
1658
|
/** The layout's authoring name (`p:cSld/@name`, e.g. `Title and Content`), or `''` when unnamed. */
|
|
1627
1659
|
get name() {
|
|
1628
1660
|
const cSld = this.#cSld();
|
|
@@ -1637,9 +1669,21 @@ var SlideLayout = class {
|
|
|
1637
1669
|
const root = this.part.dom.documentElement;
|
|
1638
1670
|
return root ? attr(root, "type") : null;
|
|
1639
1671
|
}
|
|
1672
|
+
/**
|
|
1673
|
+
* Whether this layout draws the master's non-placeholder shapes
|
|
1674
|
+
* (`p:sldLayout/@showMasterSp`). `xsd:boolean` defaulting to `true`, so an absent
|
|
1675
|
+
* attribute means shown — the layout-tier counterpart of `Slide.showMasterSp`,
|
|
1676
|
+
* and the one PowerPoint actually writes on a section-divider or full-bleed
|
|
1677
|
+
* layout. A renderer resolving what to paint under a slide's own shapes has to
|
|
1678
|
+
* consult both: the slide's flag, then its layout's.
|
|
1679
|
+
*/
|
|
1680
|
+
get showMasterSp() {
|
|
1681
|
+
const root = this.part.dom.documentElement;
|
|
1682
|
+
return boolValue(root && attr(root, "showMasterSp")) !== false;
|
|
1683
|
+
}
|
|
1640
1684
|
/** The master this layout is built on (via its `slideMaster` relationship), or `null` when absent. */
|
|
1641
1685
|
get master() {
|
|
1642
|
-
const rels = this.
|
|
1686
|
+
const rels = this.relationships;
|
|
1643
1687
|
const rel = rels.byType(SLIDE_MASTER_REL)[0];
|
|
1644
1688
|
const part = rel ? this.opc.part(rels.resolveTarget(rel.id)) : null;
|
|
1645
1689
|
return part ? new SlideMaster(this.opc, part) : null;
|
|
@@ -1648,10 +1692,27 @@ var SlideLayout = class {
|
|
|
1648
1692
|
get theme() {
|
|
1649
1693
|
return this.master?.theme ?? null;
|
|
1650
1694
|
}
|
|
1695
|
+
/**
|
|
1696
|
+
* Every shape in the layout's `p:cSld/p:spTree`, in document order — the same
|
|
1697
|
+
* `AnyShape` union `Slide.shapes` returns, so shape-walking code applies
|
|
1698
|
+
* unchanged. The write API authors non-placeholder shapes here: every
|
|
1699
|
+
* `defineSlideMaster({ objects })` member that is not a `placeholder` (a `rect`,
|
|
1700
|
+
* a `line`, an `image`, a `chart`, a `text` box) lands in this tree.
|
|
1701
|
+
*
|
|
1702
|
+
* {@link placeholders} is the filtered view of the same tree.
|
|
1703
|
+
*/
|
|
1704
|
+
get shapes() {
|
|
1705
|
+
const spTree = this.#spTree();
|
|
1706
|
+
return spTree ? buildShapes(spTree, this) : [];
|
|
1707
|
+
}
|
|
1708
|
+
/** The shape anywhere in the layout's tree with the given drawing id, or `undefined`. */
|
|
1709
|
+
shapeByIdDeep(id) {
|
|
1710
|
+
return findShapeByIdDeep(this.shapes, id);
|
|
1711
|
+
}
|
|
1651
1712
|
/** The layout's placeholder shapes (`p:sp` carrying a `p:ph`), in document order. */
|
|
1652
1713
|
get placeholders() {
|
|
1653
1714
|
const ctx = this.themeContext();
|
|
1654
|
-
const rels = this.
|
|
1715
|
+
const rels = this.relationships;
|
|
1655
1716
|
return placeholderShapes(this.#spTree()).map((sp) => new Placeholder(sp, this.part, ctx, rels));
|
|
1656
1717
|
}
|
|
1657
1718
|
/**
|
|
@@ -1664,7 +1725,7 @@ var SlideLayout = class {
|
|
|
1664
1725
|
const bg = backgroundElementOf(this.part.dom.documentElement);
|
|
1665
1726
|
if (!bg) return null;
|
|
1666
1727
|
const themePart = this.master?.theme?.part ?? null;
|
|
1667
|
-
return readSlideBackground(bg, "layout", this.themeContext(), this.
|
|
1728
|
+
return readSlideBackground(bg, "layout", this.themeContext(), this.relationships, themePart ? this.opc.relationshipsFor(themePart.partName) : null);
|
|
1668
1729
|
}
|
|
1669
1730
|
/**
|
|
1670
1731
|
* The layout's colour/font context (walked layout → master → theme), resolved once
|
|
@@ -2178,6 +2239,14 @@ var Slide = class {
|
|
|
2178
2239
|
get relationships() {
|
|
2179
2240
|
return this.presentation.opc.relationshipsFor(this.partName);
|
|
2180
2241
|
}
|
|
2242
|
+
/**
|
|
2243
|
+
* The deck's OPC package. Convenience for `presentation.opc`, and the member
|
|
2244
|
+
* {@link ShapeHost} names so a shape can reach a referenced part (an image, a
|
|
2245
|
+
* chart) the same way whether it lives on a slide, a layout, or a master.
|
|
2246
|
+
*/
|
|
2247
|
+
get opc() {
|
|
2248
|
+
return this.presentation.opc;
|
|
2249
|
+
}
|
|
2181
2250
|
#themeColors;
|
|
2182
2251
|
/**
|
|
2183
2252
|
* The slide's resolved theme context (`clrMap` + `clrScheme` + the theme
|
|
@@ -2223,6 +2292,22 @@ var Slide = class {
|
|
|
2223
2292
|
this.part.markDirty();
|
|
2224
2293
|
}
|
|
2225
2294
|
/**
|
|
2295
|
+
* Whether this slide draws the master's non-placeholder shapes
|
|
2296
|
+
* (`p:sld/@showMasterSp`). `xsd:boolean` defaulting to `true`, so an absent
|
|
2297
|
+
* attribute means shown — the same shape as {@link hidden}.
|
|
2298
|
+
*
|
|
2299
|
+
* This is the switch that decides whether {@link SlideMaster.shapes} belongs on
|
|
2300
|
+
* *this* slide. A slide the author gave a full-bleed image or a section divider
|
|
2301
|
+
* usually sets it to `0`, and a renderer that paints the master's band and logo
|
|
2302
|
+
* anyway puts the template's furniture on top of a slide that deliberately hid
|
|
2303
|
+
* it. Placeholders are unaffected: the flag suppresses only the master's
|
|
2304
|
+
* decorative shapes.
|
|
2305
|
+
*/
|
|
2306
|
+
get showMasterSp() {
|
|
2307
|
+
const root = this.part.dom.documentElement;
|
|
2308
|
+
return boolValue(root && attr(root, "showMasterSp")) !== false;
|
|
2309
|
+
}
|
|
2310
|
+
/**
|
|
2226
2311
|
* The slide's show transition (`p:transition`), decoded into a typed model, or
|
|
2227
2312
|
* `null` when the slide has none. Handles both PowerPoint forms: the bare
|
|
2228
2313
|
* `<p:transition>` and the `mc:AlternateContent` wrapper that carries the exact
|
|
@@ -2530,16 +2615,7 @@ var Slide = class {
|
|
|
2530
2615
|
* resolve a binding into a group that top-level {@link shapeById} cannot see.
|
|
2531
2616
|
*/
|
|
2532
2617
|
shapeByIdDeep(id) {
|
|
2533
|
-
|
|
2534
|
-
for (const shape of shapes) {
|
|
2535
|
-
if (shape.id === id) return shape;
|
|
2536
|
-
if (shape instanceof GroupShape) {
|
|
2537
|
-
const found = walk(shape.shapes);
|
|
2538
|
-
if (found) return found;
|
|
2539
|
-
}
|
|
2540
|
-
}
|
|
2541
|
-
};
|
|
2542
|
-
return walk(this.shapes);
|
|
2618
|
+
return findShapeByIdDeep(this.shapes, id);
|
|
2543
2619
|
}
|
|
2544
2620
|
/** The first top-level shape with the given name (`p:cNvPr/@name`), or `undefined`. */
|
|
2545
2621
|
shapeByName(name) {
|
|
@@ -4797,4 +4873,4 @@ var Presentation = class Presentation {
|
|
|
4797
4873
|
//#endregion
|
|
4798
4874
|
export { Placeholder as a, Theme as c, NotesSlide as d, OpcPackage as f, ContentTypes as h, Slide as i, readTagsForPart as l, Part as m, readCoreProperties as n, SlideLayout as o, Relationships as p, readCustomProperties as r, SlideMaster as s, Presentation as t, NotesPlaceholder as u };
|
|
4799
4875
|
|
|
4800
|
-
//# sourceMappingURL=presentation-
|
|
4876
|
+
//# sourceMappingURL=presentation-CxnUVhK9.js.map
|