@office-kit/pptx 0.28.0 → 0.29.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/CHANGELOG.md +14 -0
- package/README.md +58 -0
- package/dist/{api-miOxITQn.js → api-5A_ykU4f.js} +570 -81
- package/dist/api-5A_ykU4f.js.map +1 -0
- package/dist/{index-CCMjuQyE.d.ts → index-DNaPdD7w.d.ts} +181 -5
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/node.d.ts +2 -2
- package/dist/node.js +1 -1
- package/package.json +1 -1
- package/dist/api-miOxITQn.js.map +0 -1
|
@@ -139,6 +139,7 @@ const NS = {
|
|
|
139
139
|
chartDrawing: "http://schemas.openxmlformats.org/drawingml/2006/chartDrawing",
|
|
140
140
|
sml: "http://schemas.openxmlformats.org/spreadsheetml/2006/main",
|
|
141
141
|
wml: "http://schemas.openxmlformats.org/wordprocessingml/2006/main",
|
|
142
|
+
math: "http://schemas.openxmlformats.org/officeDocument/2006/math",
|
|
142
143
|
mc: "http://schemas.openxmlformats.org/markup-compatibility/2006",
|
|
143
144
|
a14: "http://schemas.microsoft.com/office/drawing/2010/main",
|
|
144
145
|
a15: "http://schemas.microsoft.com/office/drawing/2012/main",
|
|
@@ -150,7 +151,7 @@ const NS = {
|
|
|
150
151
|
xml: "http://www.w3.org/XML/1998/namespace",
|
|
151
152
|
xmlns: "http://www.w3.org/2000/xmlns/"
|
|
152
153
|
};
|
|
153
|
-
NS.contentTypes, NS.relationships, NS.officeDocRels, NS.pml, NS.dml, NS.diagram, NS.chart, NS.chartDrawing, NS.sml, NS.wml, NS.mc, NS.a14, NS.a15, NS.a16, NS.p14, NS.p15, NS.p16, NS.p159, NS.xml;
|
|
154
|
+
NS.contentTypes, NS.relationships, NS.officeDocRels, NS.pml, NS.dml, NS.diagram, NS.chart, NS.chartDrawing, NS.sml, NS.wml, NS.math, NS.mc, NS.a14, NS.a15, NS.a16, NS.p14, NS.p15, NS.p16, NS.p159, NS.xml;
|
|
154
155
|
//#endregion
|
|
155
156
|
//#region src/internal/xml/parse.ts
|
|
156
157
|
var XmlParseError = class extends Error {
|
|
@@ -787,84 +788,54 @@ const textBodyText = (txBody) => {
|
|
|
787
788
|
/** Iterates over each paragraph (`a:p`) element inside `a:txBody`. */
|
|
788
789
|
const paragraphsOf$1 = (txBody) => allChildElements(txBody, NAME_P$6);
|
|
789
790
|
//#endregion
|
|
790
|
-
//#region src/internal/
|
|
791
|
-
const
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
textMargin: [0, 51206400],
|
|
802
|
-
textIndent: [-51206400, 51206400],
|
|
803
|
-
textPoint: [-4e5, 4e5],
|
|
804
|
-
textSpacingPoint: [0, 158400],
|
|
805
|
-
unsignedInt: [0, 4294967295],
|
|
806
|
-
columnCount: [1, 16],
|
|
807
|
-
overlap: [-100, 100],
|
|
808
|
-
gapAmount: [0, 500],
|
|
809
|
-
holeSize: [1, 90],
|
|
810
|
-
firstSliceAng: [0, 360],
|
|
811
|
-
rotX: [-90, 90],
|
|
812
|
-
rotY: [0, 360],
|
|
813
|
-
perspective: [0, 240],
|
|
814
|
-
depthPercent: [20, 2e3],
|
|
815
|
-
heightPercent: [5, 500],
|
|
816
|
-
secondPieSize: [5, 200],
|
|
817
|
-
bubbleScale: [0, 300],
|
|
818
|
-
percent100000: [0, 1e5]
|
|
819
|
-
};
|
|
820
|
-
const boundedInt = (value, key, field) => {
|
|
821
|
-
if (!Number.isFinite(value)) throw new RangeError(`${field}: expected a finite number, got ${value}`);
|
|
822
|
-
const n = Math.round(value);
|
|
823
|
-
const [min, max] = RANGES[key];
|
|
824
|
-
if (n < min || n > max) throw new RangeError(`${field}: ${value} is out of range for ${key} (${min}..${max})`);
|
|
825
|
-
return n;
|
|
791
|
+
//#region src/internal/drawingml/math-runs.ts
|
|
792
|
+
const NAME_A_RPR$4 = qname("a", "rPr", NS.dml);
|
|
793
|
+
const isMath$1 = (el, localName) => el.name.namespaceURI === NS.math && el.name.localName === localName;
|
|
794
|
+
const runProperties = (run) => {
|
|
795
|
+
const existing = firstChildElement(run, NAME_A_RPR$4);
|
|
796
|
+
if (existing) return existing;
|
|
797
|
+
const rPr = elem(NAME_A_RPR$4);
|
|
798
|
+
const first = run.children[0];
|
|
799
|
+
const afterMathProps = first?.kind === "element" && isMath$1(first, "rPr") ? 1 : 0;
|
|
800
|
+
run.children.splice(afterMathProps, 0, rPr);
|
|
801
|
+
return rPr;
|
|
826
802
|
};
|
|
827
|
-
|
|
828
|
-
const
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
/** Non-negative 32-bit EMU (column gap) — ST_PositiveCoordinate32. */
|
|
834
|
-
const emuPositiveCoordinate32 = (v, field) => boundedInt(v, "positiveCoordinate32", field);
|
|
835
|
-
/** Line width in EMU — ST_LineWidth. */
|
|
836
|
-
const lineWidthEmu = (v, field) => boundedInt(v, "lineWidth", field);
|
|
837
|
-
/** Angle in 1/60000 degree — ST_Angle. */
|
|
838
|
-
const angle60000 = (v, field) => boundedInt(v, "angle", field);
|
|
839
|
-
/** Font size in 1/100 pt — ST_TextFontSize. */
|
|
840
|
-
const fontSizeHundredthPt = (v, field) => boundedInt(v, "fontSize", field);
|
|
841
|
-
/** Character spacing in 1/100 pt — ST_TextPoint. */
|
|
842
|
-
const textPointSpacing = (v, field) => boundedInt(v, "textPoint", field);
|
|
843
|
-
/** Auto-advance / timing duration in ms — xsd:unsignedInt. */
|
|
844
|
-
const unsignedIntMs = (v, field) => boundedInt(v, "unsignedInt", field);
|
|
845
|
-
/** Text column count — ST_TextColumnCount (1..16). */
|
|
846
|
-
const textColumnCount = (v, field) => boundedInt(v, "columnCount", field);
|
|
847
|
-
/** Bar/column series overlap percent — ST_OverlapByte (-100..100). */
|
|
848
|
-
const overlapPercent = (v, field) => boundedInt(v, "overlap", field);
|
|
849
|
-
/** Bar/column gap width percent — ST_GapAmount (0..500). */
|
|
850
|
-
const gapAmountPercent = (v, field) => boundedInt(v, "gapAmount", field);
|
|
851
|
-
/** Doughnut hole size percent — ST_HoleSizeUByte (1..90). */
|
|
852
|
-
const holeSizePercent = (v, field) => boundedInt(v, "holeSize", field);
|
|
853
|
-
/** Pie/doughnut first-slice angle in degrees — ST_FirstSliceAng (0..360). */
|
|
854
|
-
const firstSliceAngle = (v, field) => boundedInt(v, "firstSliceAng", field);
|
|
855
|
-
const GUID_RE = /^\{[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{12}\}$/;
|
|
856
|
-
const normalizeGuid = (value, field) => {
|
|
857
|
-
if (!GUID_RE.test(value)) throw new RangeError(`${field}: ${JSON.stringify(value)} is not a GUID of the form {XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}`);
|
|
858
|
-
return value.toUpperCase();
|
|
803
|
+
const collectMathRuns = (el, out) => {
|
|
804
|
+
for (const child of el.children) {
|
|
805
|
+
if (child.kind !== "element") continue;
|
|
806
|
+
if (isMath$1(child, "r")) out.push(runProperties(child));
|
|
807
|
+
else collectMathRuns(child, out);
|
|
808
|
+
}
|
|
859
809
|
};
|
|
810
|
+
const isZone = (el) => el.name.namespaceURI === NS.a14 && el.name.localName === "m";
|
|
860
811
|
/**
|
|
861
|
-
*
|
|
862
|
-
*
|
|
812
|
+
* The `<a:rPr>` of every run in `paragraph`'s equations: the math runs of
|
|
813
|
+
* each `<a14:m>`, and the text runs of the `mc:Fallback` the library writes
|
|
814
|
+
* beside one. Missing properties are created.
|
|
863
815
|
*/
|
|
864
|
-
const
|
|
865
|
-
const
|
|
866
|
-
|
|
867
|
-
|
|
816
|
+
const equationRunProperties = (paragraph) => {
|
|
817
|
+
const math = [];
|
|
818
|
+
const fallback = [];
|
|
819
|
+
for (const child of paragraph.children) {
|
|
820
|
+
if (child.kind !== "element") continue;
|
|
821
|
+
if (isZone(child)) {
|
|
822
|
+
collectMathRuns(child, math);
|
|
823
|
+
continue;
|
|
824
|
+
}
|
|
825
|
+
if (child.name.namespaceURI !== NS.mc || child.name.localName !== "AlternateContent") continue;
|
|
826
|
+
const branches = child.children.filter((branch) => branch.kind === "element" && branch.name.namespaceURI === NS.mc);
|
|
827
|
+
const choice = branches.find((branch) => branch.name.localName === "Choice" && branch.children.some((zone) => zone.kind === "element" && isZone(zone)));
|
|
828
|
+
if (!choice) continue;
|
|
829
|
+
collectMathRuns(choice, math);
|
|
830
|
+
for (const branch of branches) {
|
|
831
|
+
if (branch.name.localName !== "Fallback") continue;
|
|
832
|
+
for (const run of branch.children) if (run.kind === "element" && run.name.namespaceURI === NS.dml && run.name.localName === "r") fallback.push(runProperties(run));
|
|
833
|
+
}
|
|
834
|
+
}
|
|
835
|
+
return {
|
|
836
|
+
math,
|
|
837
|
+
fallback
|
|
838
|
+
};
|
|
868
839
|
};
|
|
869
840
|
//#endregion
|
|
870
841
|
//#region src/internal/enum-values.ts
|
|
@@ -1305,6 +1276,86 @@ const PRESET_MATERIALS = [
|
|
|
1305
1276
|
"softmetal"
|
|
1306
1277
|
];
|
|
1307
1278
|
//#endregion
|
|
1279
|
+
//#region src/internal/bounds.ts
|
|
1280
|
+
const RANGES = {
|
|
1281
|
+
coordinate: [-27273042329600, 27273042316900],
|
|
1282
|
+
positiveCoordinate: [0, 27273042316900],
|
|
1283
|
+
coordinate32: [-2147483648, 2147483647],
|
|
1284
|
+
positiveCoordinate32: [0, 2147483647],
|
|
1285
|
+
slideSize: [914400, 51206400],
|
|
1286
|
+
lineWidth: [0, 20116800],
|
|
1287
|
+
angle: [-2147483648, 2147483647],
|
|
1288
|
+
fontSize: [100, 4e5],
|
|
1289
|
+
textNonNegativePoint: [0, 4e5],
|
|
1290
|
+
textMargin: [0, 51206400],
|
|
1291
|
+
textIndent: [-51206400, 51206400],
|
|
1292
|
+
textPoint: [-4e5, 4e5],
|
|
1293
|
+
textSpacingPoint: [0, 158400],
|
|
1294
|
+
unsignedInt: [0, 4294967295],
|
|
1295
|
+
columnCount: [1, 16],
|
|
1296
|
+
overlap: [-100, 100],
|
|
1297
|
+
gapAmount: [0, 500],
|
|
1298
|
+
holeSize: [1, 90],
|
|
1299
|
+
firstSliceAng: [0, 360],
|
|
1300
|
+
rotX: [-90, 90],
|
|
1301
|
+
rotY: [0, 360],
|
|
1302
|
+
perspective: [0, 240],
|
|
1303
|
+
depthPercent: [20, 2e3],
|
|
1304
|
+
heightPercent: [5, 500],
|
|
1305
|
+
secondPieSize: [5, 200],
|
|
1306
|
+
bubbleScale: [0, 300],
|
|
1307
|
+
percent100000: [0, 1e5]
|
|
1308
|
+
};
|
|
1309
|
+
const boundedInt = (value, key, field) => {
|
|
1310
|
+
if (!Number.isFinite(value)) throw new RangeError(`${field}: expected a finite number, got ${value}`);
|
|
1311
|
+
const n = Math.round(value);
|
|
1312
|
+
const [min, max] = RANGES[key];
|
|
1313
|
+
if (n < min || n > max) throw new RangeError(`${field}: ${value} is out of range for ${key} (${min}..${max})`);
|
|
1314
|
+
return n;
|
|
1315
|
+
};
|
|
1316
|
+
/** EMU position coordinate (`<a:off>` x/y) — ST_Coordinate. */
|
|
1317
|
+
const emuCoordinate = (v, field) => boundedInt(v, "coordinate", field);
|
|
1318
|
+
/** EMU extent (`<a:ext>` cx/cy, column/table widths, row heights) — ST_PositiveCoordinate. */
|
|
1319
|
+
const emuExtent = (v, field) => boundedInt(v, "positiveCoordinate", field);
|
|
1320
|
+
/** 32-bit EMU (text-body insets, cell margins) — ST_Coordinate32. */
|
|
1321
|
+
const emuCoordinate32 = (v, field) => boundedInt(v, "coordinate32", field);
|
|
1322
|
+
/** Non-negative 32-bit EMU (column gap) — ST_PositiveCoordinate32. */
|
|
1323
|
+
const emuPositiveCoordinate32 = (v, field) => boundedInt(v, "positiveCoordinate32", field);
|
|
1324
|
+
/** Line width in EMU — ST_LineWidth. */
|
|
1325
|
+
const lineWidthEmu = (v, field) => boundedInt(v, "lineWidth", field);
|
|
1326
|
+
/** Angle in 1/60000 degree — ST_Angle. */
|
|
1327
|
+
const angle60000 = (v, field) => boundedInt(v, "angle", field);
|
|
1328
|
+
/** Font size in 1/100 pt — ST_TextFontSize. */
|
|
1329
|
+
const fontSizeHundredthPt = (v, field) => boundedInt(v, "fontSize", field);
|
|
1330
|
+
/** Character spacing in 1/100 pt — ST_TextPoint. */
|
|
1331
|
+
const textPointSpacing = (v, field) => boundedInt(v, "textPoint", field);
|
|
1332
|
+
/** Auto-advance / timing duration in ms — xsd:unsignedInt. */
|
|
1333
|
+
const unsignedIntMs = (v, field) => boundedInt(v, "unsignedInt", field);
|
|
1334
|
+
/** Text column count — ST_TextColumnCount (1..16). */
|
|
1335
|
+
const textColumnCount = (v, field) => boundedInt(v, "columnCount", field);
|
|
1336
|
+
/** Bar/column series overlap percent — ST_OverlapByte (-100..100). */
|
|
1337
|
+
const overlapPercent = (v, field) => boundedInt(v, "overlap", field);
|
|
1338
|
+
/** Bar/column gap width percent — ST_GapAmount (0..500). */
|
|
1339
|
+
const gapAmountPercent = (v, field) => boundedInt(v, "gapAmount", field);
|
|
1340
|
+
/** Doughnut hole size percent — ST_HoleSizeUByte (1..90). */
|
|
1341
|
+
const holeSizePercent = (v, field) => boundedInt(v, "holeSize", field);
|
|
1342
|
+
/** Pie/doughnut first-slice angle in degrees — ST_FirstSliceAng (0..360). */
|
|
1343
|
+
const firstSliceAngle = (v, field) => boundedInt(v, "firstSliceAng", field);
|
|
1344
|
+
const GUID_RE = /^\{[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{12}\}$/;
|
|
1345
|
+
const normalizeGuid = (value, field) => {
|
|
1346
|
+
if (!GUID_RE.test(value)) throw new RangeError(`${field}: ${JSON.stringify(value)} is not a GUID of the form {XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}`);
|
|
1347
|
+
return value.toUpperCase();
|
|
1348
|
+
};
|
|
1349
|
+
/**
|
|
1350
|
+
* A fresh `ST_Guid`. `crypto.randomUUID` is a Web API, available in both
|
|
1351
|
+
* runtimes this library targets, and is the only randomness it uses.
|
|
1352
|
+
*/
|
|
1353
|
+
const newGuid = () => `{${globalThis.crypto.randomUUID().toUpperCase()}}`;
|
|
1354
|
+
const oneOf = (value, allowed, field) => {
|
|
1355
|
+
if (!allowed.includes(value)) throw new RangeError(`${field}: ${JSON.stringify(value)} is not one of: ${allowed.join(", ")}`);
|
|
1356
|
+
return value;
|
|
1357
|
+
};
|
|
1358
|
+
//#endregion
|
|
1308
1359
|
//#region src/internal/drawingml/color.ts
|
|
1309
1360
|
const NAME_SRGB_CLR$4 = qname("a", "srgbClr", NS.dml);
|
|
1310
1361
|
const NAME_SCHEME_CLR$2 = qname("a", "schemeClr", NS.dml);
|
|
@@ -2779,8 +2830,225 @@ const applyValidatedFormatToAllRuns = (txBody, format, reset = false, images) =>
|
|
|
2779
2830
|
}
|
|
2780
2831
|
applyValidatedRunFormat(rPr, format, images);
|
|
2781
2832
|
}
|
|
2833
|
+
const equation = equationRunProperties(p);
|
|
2834
|
+
if (equation.math.length > 0) {
|
|
2835
|
+
const { font: _font, fontEastAsian: _ea, fontComplexScript: _cs, ...mathFormat } = format;
|
|
2836
|
+
for (const rPr of equation.math) applyValidatedRunFormat(rPr, mathFormat, images);
|
|
2837
|
+
for (const rPr of equation.fallback) applyValidatedRunFormat(rPr, format, images);
|
|
2838
|
+
}
|
|
2839
|
+
}
|
|
2840
|
+
};
|
|
2841
|
+
//#endregion
|
|
2842
|
+
//#region src/internal/drawingml/math.ts
|
|
2843
|
+
const MATH_FONT = "Cambria Math";
|
|
2844
|
+
const DEFAULT_ACCENT$1 = "̂";
|
|
2845
|
+
const DEFAULT_NARY_OPERATOR$1 = "∫";
|
|
2846
|
+
const m$1 = (localName) => qname("m", localName, NS.math);
|
|
2847
|
+
const NAME_VAL$2 = m$1("val");
|
|
2848
|
+
const NAME_A_RPR$3 = qname("a", "rPr", NS.dml);
|
|
2849
|
+
const NAME_A_R$1 = qname("a", "r", NS.dml);
|
|
2850
|
+
const NAME_A_T$1 = qname("a", "t", NS.dml);
|
|
2851
|
+
const NAME_A14_M = qname("a14", "m", NS.a14);
|
|
2852
|
+
const NAME_ALTERNATE_CONTENT$1 = qname("mc", "AlternateContent", NS.mc);
|
|
2853
|
+
const NAME_CHOICE$1 = qname("mc", "Choice", NS.mc);
|
|
2854
|
+
const NAME_FALLBACK$1 = qname("mc", "Fallback", NS.mc);
|
|
2855
|
+
const ATTR_REQUIRES$1 = qname("", "Requires", "");
|
|
2856
|
+
const ATTR_XML_SPACE = qname("xml", "space", NS.xml);
|
|
2857
|
+
const STY_BY_STYLE = {
|
|
2858
|
+
plain: "p",
|
|
2859
|
+
bold: "b",
|
|
2860
|
+
italic: "i",
|
|
2861
|
+
boldItalic: "bi"
|
|
2862
|
+
};
|
|
2863
|
+
const FRACTION_TOKEN = {
|
|
2864
|
+
skewed: "skw",
|
|
2865
|
+
linear: "lin",
|
|
2866
|
+
noBar: "noBar"
|
|
2867
|
+
};
|
|
2868
|
+
const valElement = (localName, value) => elem(m$1(localName), { attrs: [attr(NAME_VAL$2, value)] });
|
|
2869
|
+
const textElement = (name, value) => elem(name, {
|
|
2870
|
+
attrs: /^\s|\s$/.test(value) ? [attr(ATTR_XML_SPACE, "preserve")] : [],
|
|
2871
|
+
children: [text(value)]
|
|
2872
|
+
});
|
|
2873
|
+
const runElement = (node, ctx) => {
|
|
2874
|
+
const rPr = elem(NAME_A_RPR$3);
|
|
2875
|
+
applyRunFormat(rPr, {
|
|
2876
|
+
font: MATH_FONT,
|
|
2877
|
+
...ctx.format,
|
|
2878
|
+
...node.format
|
|
2879
|
+
}, ctx.caller, ctx.images);
|
|
2880
|
+
return elem(m$1("r"), { children: [
|
|
2881
|
+
...node.style === void 0 ? [] : [elem(m$1("rPr"), { children: [valElement("sty", STY_BY_STYLE[node.style])] })],
|
|
2882
|
+
rPr,
|
|
2883
|
+
textElement(m$1("t"), node.text)
|
|
2884
|
+
] });
|
|
2885
|
+
};
|
|
2886
|
+
const arg = (localName, nodes, ctx) => elem(m$1(localName), { children: nodes.map((node) => nodeElement(node, ctx)) });
|
|
2887
|
+
const props = (localName, children) => children.length === 0 ? [] : [elem(m$1(localName), { children })];
|
|
2888
|
+
const nodeElement = (node, ctx) => {
|
|
2889
|
+
switch (node.kind) {
|
|
2890
|
+
case "text": return runElement(node, ctx);
|
|
2891
|
+
case "fraction": return elem(m$1("f"), { children: [
|
|
2892
|
+
...props("fPr", node.type === void 0 || node.type === "bar" ? [] : [valElement("type", FRACTION_TOKEN[node.type])]),
|
|
2893
|
+
arg("num", node.numerator, ctx),
|
|
2894
|
+
arg("den", node.denominator, ctx)
|
|
2895
|
+
] });
|
|
2896
|
+
case "subscript": return elem(m$1("sSub"), { children: [arg("e", node.base, ctx), arg("sub", node.sub, ctx)] });
|
|
2897
|
+
case "superscript": return elem(m$1("sSup"), { children: [arg("e", node.base, ctx), arg("sup", node.sup, ctx)] });
|
|
2898
|
+
case "subSuperscript": return elem(m$1("sSubSup"), { children: [
|
|
2899
|
+
arg("e", node.base, ctx),
|
|
2900
|
+
arg("sub", node.sub, ctx),
|
|
2901
|
+
arg("sup", node.sup, ctx)
|
|
2902
|
+
] });
|
|
2903
|
+
case "radical": {
|
|
2904
|
+
const degree = node.degree ?? [];
|
|
2905
|
+
return elem(m$1("rad"), { children: [
|
|
2906
|
+
...props("radPr", degree.length === 0 ? [valElement("degHide", "1")] : []),
|
|
2907
|
+
arg("deg", degree, ctx),
|
|
2908
|
+
arg("e", node.body, ctx)
|
|
2909
|
+
] });
|
|
2910
|
+
}
|
|
2911
|
+
case "nary": {
|
|
2912
|
+
const hiddenSub = node.sub === void 0 || node.sub === null;
|
|
2913
|
+
const hiddenSup = node.sup === void 0 || node.sup === null;
|
|
2914
|
+
return elem(m$1("nary"), { children: [
|
|
2915
|
+
...props("naryPr", [
|
|
2916
|
+
...node.operator === void 0 || node.operator === DEFAULT_NARY_OPERATOR$1 ? [] : [valElement("chr", node.operator)],
|
|
2917
|
+
...node.limitLocation === void 0 ? [] : [valElement("limLoc", node.limitLocation === "underOver" ? "undOvr" : "subSup")],
|
|
2918
|
+
...hiddenSub ? [valElement("subHide", "1")] : [],
|
|
2919
|
+
...hiddenSup ? [valElement("supHide", "1")] : []
|
|
2920
|
+
]),
|
|
2921
|
+
arg("sub", node.sub ?? [], ctx),
|
|
2922
|
+
arg("sup", node.sup ?? [], ctx),
|
|
2923
|
+
arg("e", node.body, ctx)
|
|
2924
|
+
] });
|
|
2925
|
+
}
|
|
2926
|
+
case "delimiter": return elem(m$1("d"), { children: [...props("dPr", [
|
|
2927
|
+
...node.open === void 0 ? [] : [valElement("begChr", node.open)],
|
|
2928
|
+
...node.separator === void 0 ? [] : [valElement("sepChr", node.separator)],
|
|
2929
|
+
...node.close === void 0 ? [] : [valElement("endChr", node.close)]
|
|
2930
|
+
]), ...node.items.map((item) => arg("e", item, ctx))] });
|
|
2931
|
+
case "matrix": {
|
|
2932
|
+
const columns = node.rows[0]?.length ?? 0;
|
|
2933
|
+
return elem(m$1("m"), { children: [elem(m$1("mPr"), { children: [elem(m$1("mcs"), { children: [elem(m$1("mc"), { children: [elem(m$1("mcPr"), { children: [valElement("count", String(columns)), valElement("mcJc", "center")] })] })] })] }), ...node.rows.map((row) => elem(m$1("mr"), { children: row.map((cell) => arg("e", cell, ctx)) }))] });
|
|
2934
|
+
}
|
|
2935
|
+
case "accent": return elem(m$1("acc"), { children: [...props("accPr", node.accent === void 0 || node.accent === DEFAULT_ACCENT$1 ? [] : [valElement("chr", node.accent)]), arg("e", node.body, ctx)] });
|
|
2936
|
+
case "function": return elem(m$1("func"), { children: [arg("fName", node.name, ctx), arg("e", node.body, ctx)] });
|
|
2937
|
+
case "lowerLimit":
|
|
2938
|
+
case "upperLimit": return elem(m$1(node.kind === "lowerLimit" ? "limLow" : "limUpp"), { children: [arg("e", node.base, ctx), arg("lim", node.limit, ctx)] });
|
|
2939
|
+
}
|
|
2940
|
+
};
|
|
2941
|
+
const ATOM = /^(?:[\p{L}\p{M}\p{N}.]+|.)$/u;
|
|
2942
|
+
const group = (s) => ATOM.test(s) ? s : `(${s})`;
|
|
2943
|
+
const linear = (nodes) => nodes.map(linearNode).join("");
|
|
2944
|
+
const linearNode = (node) => {
|
|
2945
|
+
switch (node.kind) {
|
|
2946
|
+
case "text": return node.text;
|
|
2947
|
+
case "fraction": return `${group(linear(node.numerator))}/${group(linear(node.denominator))}`;
|
|
2948
|
+
case "subscript": return `${group(linear(node.base))}_${group(linear(node.sub))}`;
|
|
2949
|
+
case "superscript": return `${group(linear(node.base))}^${group(linear(node.sup))}`;
|
|
2950
|
+
case "subSuperscript": return `${group(linear(node.base))}_${group(linear(node.sub))}^${group(linear(node.sup))}`;
|
|
2951
|
+
case "radical": {
|
|
2952
|
+
const degree = node.degree ? linear(node.degree) : "";
|
|
2953
|
+
return degree === "" ? `√${group(linear(node.body))}` : `√(${degree}&${linear(node.body)})`;
|
|
2954
|
+
}
|
|
2955
|
+
case "nary": {
|
|
2956
|
+
const sub = node.sub ? `_${group(linear(node.sub))}` : "";
|
|
2957
|
+
const sup = node.sup ? `^${group(linear(node.sup))}` : "";
|
|
2958
|
+
return `${node.operator ?? DEFAULT_NARY_OPERATOR$1}${sub}${sup} ${linear(node.body)}`;
|
|
2959
|
+
}
|
|
2960
|
+
case "delimiter": return `${node.open ?? "("}${node.items.map(linear).join(node.separator ?? "|")}${node.close ?? ")"}`;
|
|
2961
|
+
case "matrix": return `[${node.rows.map((row) => row.map(linear).join(", ")).join("; ")}]`;
|
|
2962
|
+
case "accent": return `${group(linear(node.body))}${node.accent ?? DEFAULT_ACCENT$1}`;
|
|
2963
|
+
case "function": return `${linear(node.name)} ${linear(node.body)}`;
|
|
2964
|
+
case "lowerLimit": return `${linear(node.base)}_${group(linear(node.limit))}`;
|
|
2965
|
+
case "upperLimit": return `${linear(node.base)}^${group(linear(node.limit))}`;
|
|
2966
|
+
}
|
|
2967
|
+
};
|
|
2968
|
+
const validate = (nodes, caller) => {
|
|
2969
|
+
for (const node of nodes) switch (node.kind) {
|
|
2970
|
+
case "text": break;
|
|
2971
|
+
case "fraction":
|
|
2972
|
+
validate(node.numerator, caller);
|
|
2973
|
+
validate(node.denominator, caller);
|
|
2974
|
+
break;
|
|
2975
|
+
case "subscript":
|
|
2976
|
+
validate(node.base, caller);
|
|
2977
|
+
validate(node.sub, caller);
|
|
2978
|
+
break;
|
|
2979
|
+
case "superscript":
|
|
2980
|
+
validate(node.base, caller);
|
|
2981
|
+
validate(node.sup, caller);
|
|
2982
|
+
break;
|
|
2983
|
+
case "subSuperscript":
|
|
2984
|
+
validate(node.base, caller);
|
|
2985
|
+
validate(node.sub, caller);
|
|
2986
|
+
validate(node.sup, caller);
|
|
2987
|
+
break;
|
|
2988
|
+
case "radical":
|
|
2989
|
+
validate(node.degree ?? [], caller);
|
|
2990
|
+
validate(node.body, caller);
|
|
2991
|
+
break;
|
|
2992
|
+
case "nary":
|
|
2993
|
+
validate(node.sub ?? [], caller);
|
|
2994
|
+
validate(node.sup ?? [], caller);
|
|
2995
|
+
validate(node.body, caller);
|
|
2996
|
+
break;
|
|
2997
|
+
case "delimiter":
|
|
2998
|
+
if (node.items.length === 0) throw new RangeError(`${caller}: a delimiter needs at least one item`);
|
|
2999
|
+
for (const item of node.items) validate(item, caller);
|
|
3000
|
+
break;
|
|
3001
|
+
case "matrix": {
|
|
3002
|
+
const columns = node.rows[0]?.length ?? 0;
|
|
3003
|
+
if (columns === 0) throw new RangeError(`${caller}: a matrix needs at least one cell`);
|
|
3004
|
+
for (const row of node.rows) {
|
|
3005
|
+
if (row.length !== columns) throw new RangeError(`${caller}: every matrix row needs ${columns} cells`);
|
|
3006
|
+
for (const cell of row) validate(cell, caller);
|
|
3007
|
+
}
|
|
3008
|
+
break;
|
|
3009
|
+
}
|
|
3010
|
+
case "accent":
|
|
3011
|
+
validate(node.body, caller);
|
|
3012
|
+
break;
|
|
3013
|
+
case "function":
|
|
3014
|
+
validate(node.name, caller);
|
|
3015
|
+
validate(node.body, caller);
|
|
3016
|
+
break;
|
|
3017
|
+
case "lowerLimit":
|
|
3018
|
+
case "upperLimit":
|
|
3019
|
+
validate(node.base, caller);
|
|
3020
|
+
validate(node.limit, caller);
|
|
3021
|
+
break;
|
|
3022
|
+
default: throw new TypeError(`${caller}: unknown math node kind ${JSON.stringify(node.kind)}`);
|
|
2782
3023
|
}
|
|
2783
3024
|
};
|
|
3025
|
+
/** Builds the paragraph child that holds `spec`: an equation with its text fallback. */
|
|
3026
|
+
const buildEquation = (spec, caller, images) => {
|
|
3027
|
+
validate(spec.equation, caller);
|
|
3028
|
+
const ctx = {
|
|
3029
|
+
format: spec.format,
|
|
3030
|
+
caller,
|
|
3031
|
+
images
|
|
3032
|
+
};
|
|
3033
|
+
const oMath = elem(m$1("oMath"), { children: spec.equation.map((node) => nodeElement(node, ctx)) });
|
|
3034
|
+
const zone = elem(NAME_A14_M, { children: [spec.display === true ? elem(m$1("oMathPara"), {
|
|
3035
|
+
prefixDecls: new Map([["m", NS.math]]),
|
|
3036
|
+
children: [oMath]
|
|
3037
|
+
}) : {
|
|
3038
|
+
...oMath,
|
|
3039
|
+
prefixDecls: new Map([["m", NS.math]])
|
|
3040
|
+
}] });
|
|
3041
|
+
const fallbackPr = elem(NAME_A_RPR$3);
|
|
3042
|
+
if (spec.format !== void 0) applyRunFormat(fallbackPr, spec.format, caller, images);
|
|
3043
|
+
return elem(NAME_ALTERNATE_CONTENT$1, {
|
|
3044
|
+
prefixDecls: new Map([["mc", NS.mc]]),
|
|
3045
|
+
children: [elem(NAME_CHOICE$1, {
|
|
3046
|
+
attrs: [attr(ATTR_REQUIRES$1, "a14")],
|
|
3047
|
+
prefixDecls: new Map([["a14", NS.a14]]),
|
|
3048
|
+
children: [zone]
|
|
3049
|
+
}), elem(NAME_FALLBACK$1, { children: [elem(NAME_A_R$1, { children: [fallbackPr, textElement(NAME_A_T$1, linear(spec.equation))] })] })]
|
|
3050
|
+
});
|
|
3051
|
+
};
|
|
2784
3052
|
//#endregion
|
|
2785
3053
|
//#region src/internal/drawingml/text-body-mutation.ts
|
|
2786
3054
|
const NAME_BU_CHAR = qname("a", "buChar", NS.dml);
|
|
@@ -3188,6 +3456,10 @@ const buildTextBodyParagraphs = (paragraphs, caller = "setShapeParagraphs", imag
|
|
|
3188
3456
|
const children = [];
|
|
3189
3457
|
if (para.align !== void 0) children.push(elem(NAME_PPR$1, { attrs: [attr(ATTR_ALGN, alignToken(para.align, caller))] }));
|
|
3190
3458
|
for (const run of para.runs) {
|
|
3459
|
+
if ("equation" in run) {
|
|
3460
|
+
children.push(buildEquation(run, caller, embedder));
|
|
3461
|
+
continue;
|
|
3462
|
+
}
|
|
3191
3463
|
const rPr = elem(NAME_RPR$6);
|
|
3192
3464
|
if (run.format !== void 0) applyRunFormat(rPr, run.format, caller, embedder);
|
|
3193
3465
|
const lines = run.text.split(RUN_LINE_BREAK);
|
|
@@ -32990,6 +33262,203 @@ const readBulletStyleLayer = (pPr, resolveColor) => {
|
|
|
32990
33262
|
return out;
|
|
32991
33263
|
};
|
|
32992
33264
|
//#endregion
|
|
33265
|
+
//#region src/api/fn/_omml-read.ts
|
|
33266
|
+
const m = (localName) => qname("m", localName, NS.math);
|
|
33267
|
+
const NAME_VAL$1 = m("val");
|
|
33268
|
+
const NAME_A_RPR$2 = qname("a", "rPr", NS.dml);
|
|
33269
|
+
const STYLE_BY_STY = {
|
|
33270
|
+
p: "plain",
|
|
33271
|
+
b: "bold",
|
|
33272
|
+
i: "italic",
|
|
33273
|
+
bi: "boldItalic"
|
|
33274
|
+
};
|
|
33275
|
+
const FRACTION_TYPES = {
|
|
33276
|
+
bar: "bar",
|
|
33277
|
+
skw: "skewed",
|
|
33278
|
+
lin: "linear",
|
|
33279
|
+
noBar: "noBar"
|
|
33280
|
+
};
|
|
33281
|
+
const DEFAULT_DELIMITER_OPEN = "(";
|
|
33282
|
+
const DEFAULT_DELIMITER_CLOSE = ")";
|
|
33283
|
+
const DEFAULT_DELIMITER_SEPARATOR = "|";
|
|
33284
|
+
const DEFAULT_NARY_OPERATOR = "∫";
|
|
33285
|
+
const DEFAULT_ACCENT = "̂";
|
|
33286
|
+
const isMath = (node) => node.kind === "element" && node.name.namespaceURI === NS.math;
|
|
33287
|
+
const childOf = (parent, localName) => parent === null ? null : firstChildElement(parent, m(localName));
|
|
33288
|
+
const childrenOf = (parent, localName) => parent.children.filter((child) => isMath(child) && child.name.localName === localName);
|
|
33289
|
+
const valOf = (parent, localName) => {
|
|
33290
|
+
const el = childOf(parent, localName);
|
|
33291
|
+
return el === null ? null : getAttrValue(el, NAME_VAL$1);
|
|
33292
|
+
};
|
|
33293
|
+
const flagOf = (parent, localName) => {
|
|
33294
|
+
const el = childOf(parent, localName);
|
|
33295
|
+
if (el === null) return false;
|
|
33296
|
+
const value = getAttrValue(el, NAME_VAL$1);
|
|
33297
|
+
return value === null || value === "on" || value === "1" || value === "true";
|
|
33298
|
+
};
|
|
33299
|
+
const charOf = (props, localName, fallback) => {
|
|
33300
|
+
const el = childOf(props, localName);
|
|
33301
|
+
if (el === null) return fallback;
|
|
33302
|
+
return getAttrValue(el, NAME_VAL$1) ?? "";
|
|
33303
|
+
};
|
|
33304
|
+
const runText = (run) => {
|
|
33305
|
+
let out = "";
|
|
33306
|
+
for (const t of childrenOf(run, "t")) for (const c of t.children) if (c.kind === "text" || c.kind === "cdata") out += c.data;
|
|
33307
|
+
return out;
|
|
33308
|
+
};
|
|
33309
|
+
/** Plain text of every `<m:t>` under `el`, in document order. */
|
|
33310
|
+
const mathPlainText = (el) => {
|
|
33311
|
+
let out = "";
|
|
33312
|
+
for (const child of el.children) {
|
|
33313
|
+
if (child.kind !== "element") continue;
|
|
33314
|
+
if (child.name.namespaceURI === NS.math && child.name.localName === "t") {
|
|
33315
|
+
for (const c of child.children) if (c.kind === "text" || c.kind === "cdata") out += c.data;
|
|
33316
|
+
} else out += mathPlainText(child);
|
|
33317
|
+
}
|
|
33318
|
+
return out;
|
|
33319
|
+
};
|
|
33320
|
+
const readArg = (parent, localName) => {
|
|
33321
|
+
const el = childOf(parent, localName);
|
|
33322
|
+
return el === null ? [] : readMathNodes(el);
|
|
33323
|
+
};
|
|
33324
|
+
const readRun = (run) => {
|
|
33325
|
+
const sty = valOf(childOf(run, "rPr"), "sty");
|
|
33326
|
+
const aRPr = firstChildElement(run, NAME_A_RPR$2);
|
|
33327
|
+
const style = sty === null ? void 0 : STYLE_BY_STY[sty];
|
|
33328
|
+
return {
|
|
33329
|
+
kind: "text",
|
|
33330
|
+
text: runText(run),
|
|
33331
|
+
...style !== void 0 ? { style } : {},
|
|
33332
|
+
format: aRPr === null ? null : parseRPrLikeElement(aRPr)
|
|
33333
|
+
};
|
|
33334
|
+
};
|
|
33335
|
+
const readNode = (el) => {
|
|
33336
|
+
switch (el.name.localName) {
|
|
33337
|
+
case "r": return readRun(el);
|
|
33338
|
+
case "f": return {
|
|
33339
|
+
kind: "fraction",
|
|
33340
|
+
type: FRACTION_TYPES[valOf(childOf(el, "fPr"), "type") ?? "bar"] ?? "bar",
|
|
33341
|
+
numerator: readArg(el, "num"),
|
|
33342
|
+
denominator: readArg(el, "den")
|
|
33343
|
+
};
|
|
33344
|
+
case "sSub": return {
|
|
33345
|
+
kind: "subscript",
|
|
33346
|
+
base: readArg(el, "e"),
|
|
33347
|
+
sub: readArg(el, "sub")
|
|
33348
|
+
};
|
|
33349
|
+
case "sSup": return {
|
|
33350
|
+
kind: "superscript",
|
|
33351
|
+
base: readArg(el, "e"),
|
|
33352
|
+
sup: readArg(el, "sup")
|
|
33353
|
+
};
|
|
33354
|
+
case "sSubSup": return {
|
|
33355
|
+
kind: "subSuperscript",
|
|
33356
|
+
base: readArg(el, "e"),
|
|
33357
|
+
sub: readArg(el, "sub"),
|
|
33358
|
+
sup: readArg(el, "sup")
|
|
33359
|
+
};
|
|
33360
|
+
case "rad": return {
|
|
33361
|
+
kind: "radical",
|
|
33362
|
+
degree: flagOf(childOf(el, "radPr"), "degHide") ? null : readArg(el, "deg"),
|
|
33363
|
+
body: readArg(el, "e")
|
|
33364
|
+
};
|
|
33365
|
+
case "nary": {
|
|
33366
|
+
const props = childOf(el, "naryPr");
|
|
33367
|
+
const limLoc = valOf(props, "limLoc");
|
|
33368
|
+
return {
|
|
33369
|
+
kind: "nary",
|
|
33370
|
+
operator: charOf(props, "chr", DEFAULT_NARY_OPERATOR),
|
|
33371
|
+
...limLoc === "undOvr" ? { limitLocation: "underOver" } : limLoc === "subSup" ? { limitLocation: "subSup" } : {},
|
|
33372
|
+
sub: flagOf(props, "subHide") ? null : readArg(el, "sub"),
|
|
33373
|
+
sup: flagOf(props, "supHide") ? null : readArg(el, "sup"),
|
|
33374
|
+
body: readArg(el, "e")
|
|
33375
|
+
};
|
|
33376
|
+
}
|
|
33377
|
+
case "d": {
|
|
33378
|
+
const props = childOf(el, "dPr");
|
|
33379
|
+
return {
|
|
33380
|
+
kind: "delimiter",
|
|
33381
|
+
open: charOf(props, "begChr", DEFAULT_DELIMITER_OPEN),
|
|
33382
|
+
close: charOf(props, "endChr", DEFAULT_DELIMITER_CLOSE),
|
|
33383
|
+
separator: charOf(props, "sepChr", DEFAULT_DELIMITER_SEPARATOR),
|
|
33384
|
+
items: childrenOf(el, "e").map(readMathNodes)
|
|
33385
|
+
};
|
|
33386
|
+
}
|
|
33387
|
+
case "m": return {
|
|
33388
|
+
kind: "matrix",
|
|
33389
|
+
rows: childrenOf(el, "mr").map((row) => childrenOf(row, "e").map(readMathNodes))
|
|
33390
|
+
};
|
|
33391
|
+
case "acc": return {
|
|
33392
|
+
kind: "accent",
|
|
33393
|
+
accent: charOf(childOf(el, "accPr"), "chr", DEFAULT_ACCENT),
|
|
33394
|
+
body: readArg(el, "e")
|
|
33395
|
+
};
|
|
33396
|
+
case "func": return {
|
|
33397
|
+
kind: "function",
|
|
33398
|
+
name: readArg(el, "fName"),
|
|
33399
|
+
body: readArg(el, "e")
|
|
33400
|
+
};
|
|
33401
|
+
case "limLow":
|
|
33402
|
+
case "limUpp": return {
|
|
33403
|
+
kind: el.name.localName === "limLow" ? "lowerLimit" : "upperLimit",
|
|
33404
|
+
base: readArg(el, "e"),
|
|
33405
|
+
limit: readArg(el, "lim")
|
|
33406
|
+
};
|
|
33407
|
+
case "ctrlPr":
|
|
33408
|
+
case "argPr":
|
|
33409
|
+
case "oMathParaPr": return null;
|
|
33410
|
+
default: return {
|
|
33411
|
+
kind: "unsupported",
|
|
33412
|
+
element: el.name.localName,
|
|
33413
|
+
text: mathPlainText(el)
|
|
33414
|
+
};
|
|
33415
|
+
}
|
|
33416
|
+
};
|
|
33417
|
+
/** Reads the content children of an OMML argument or `<m:oMath>`. */
|
|
33418
|
+
const readMathNodes = (parent) => {
|
|
33419
|
+
const out = [];
|
|
33420
|
+
for (const child of parent.children) {
|
|
33421
|
+
if (!isMath(child)) continue;
|
|
33422
|
+
const node = readNode(child);
|
|
33423
|
+
if (node !== null) out.push(node);
|
|
33424
|
+
}
|
|
33425
|
+
return out;
|
|
33426
|
+
};
|
|
33427
|
+
/**
|
|
33428
|
+
* The equations of one `<a14:m>`: its inline `<m:oMath>`, or each
|
|
33429
|
+
* `<m:oMath>` of its `<m:oMathPara>`.
|
|
33430
|
+
*/
|
|
33431
|
+
const mathZoneEquations = (zone) => {
|
|
33432
|
+
const out = [];
|
|
33433
|
+
for (const child of zone.children) {
|
|
33434
|
+
if (!isMath(child)) continue;
|
|
33435
|
+
if (child.name.localName === "oMath") out.push({
|
|
33436
|
+
display: false,
|
|
33437
|
+
oMath: child
|
|
33438
|
+
});
|
|
33439
|
+
else if (child.name.localName === "oMathPara") for (const oMath of childrenOf(child, "oMath")) out.push({
|
|
33440
|
+
display: true,
|
|
33441
|
+
oMath
|
|
33442
|
+
});
|
|
33443
|
+
}
|
|
33444
|
+
return out;
|
|
33445
|
+
};
|
|
33446
|
+
const isA14Zone = (el) => el.name.namespaceURI === NS.a14 && el.name.localName === "m";
|
|
33447
|
+
/**
|
|
33448
|
+
* The `<a14:m>` a paragraph child holds: the child itself, or the zone in an
|
|
33449
|
+
* `mc:AlternateContent` choice (the form the library writes), else `null`.
|
|
33450
|
+
*/
|
|
33451
|
+
const equationZoneOf = (child) => {
|
|
33452
|
+
if (isA14Zone(child)) return child;
|
|
33453
|
+
if (child.name.namespaceURI !== NS.mc || child.name.localName !== "AlternateContent") return null;
|
|
33454
|
+
for (const choice of child.children) {
|
|
33455
|
+
if (choice.kind !== "element" || choice.name.namespaceURI !== NS.mc) continue;
|
|
33456
|
+
if (choice.name.localName !== "Choice") continue;
|
|
33457
|
+
for (const zone of choice.children) if (zone.kind === "element" && isA14Zone(zone)) return zone;
|
|
33458
|
+
}
|
|
33459
|
+
return null;
|
|
33460
|
+
};
|
|
33461
|
+
//#endregion
|
|
32993
33462
|
//#region src/api/fn/theme.ts
|
|
32994
33463
|
const THEME_CONTENT_TYPE$2 = "application/vnd.openxmlformats-officedocument.theme+xml";
|
|
32995
33464
|
const NAME_THEME_ELEMENTS = qname("a", "themeElements", NS.dml);
|
|
@@ -42701,8 +43170,10 @@ const getTableCellParagraphs = (cell) => {
|
|
|
42701
43170
|
"fld",
|
|
42702
43171
|
"br"
|
|
42703
43172
|
].includes(child.name.localName));
|
|
42704
|
-
|
|
42705
|
-
|
|
43173
|
+
let inlineIndex = 0;
|
|
43174
|
+
const elements = readParagraphElements(p).map((element) => {
|
|
43175
|
+
if (element.kind === "math") return element;
|
|
43176
|
+
const properties = firstChildElement(inline[inlineIndex++], qname("a", "rPr", NS.dml));
|
|
42706
43177
|
const link = properties ? firstChildElement(properties, qname("a", "hlinkClick", NS.dml)) : null;
|
|
42707
43178
|
if (!link) return element;
|
|
42708
43179
|
const clickAction = readClickAction(cell[CELL_TABLE][SHAPE_SLIDE], link);
|
|
@@ -47721,7 +48192,19 @@ const readParagraphElements = (paragraph) => {
|
|
|
47721
48192
|
return parseRPrLikeElement(rPr);
|
|
47722
48193
|
};
|
|
47723
48194
|
for (const child of paragraph.children) {
|
|
47724
|
-
if (child.kind !== "element"
|
|
48195
|
+
if (child.kind !== "element") continue;
|
|
48196
|
+
const zone = equationZoneOf(child);
|
|
48197
|
+
if (zone !== null) {
|
|
48198
|
+
for (const { display, oMath } of mathZoneEquations(zone)) out.push({
|
|
48199
|
+
kind: "math",
|
|
48200
|
+
text: mathPlainText(oMath),
|
|
48201
|
+
display,
|
|
48202
|
+
math: readMathNodes(oMath),
|
|
48203
|
+
format: null
|
|
48204
|
+
});
|
|
48205
|
+
continue;
|
|
48206
|
+
}
|
|
48207
|
+
if (child.name.namespaceURI !== NS.dml) continue;
|
|
47725
48208
|
if (child.name.localName === "r") out.push({
|
|
47726
48209
|
kind: "r",
|
|
47727
48210
|
text: readT(child),
|
|
@@ -55253,7 +55736,13 @@ const getShapeTextLanguage = (shape) => {
|
|
|
55253
55736
|
const getParagraphElementLanguages = (target, paragraphIndex) => {
|
|
55254
55737
|
const languages = [];
|
|
55255
55738
|
for (const child of requireParagraph(target, paragraphIndex).children) {
|
|
55256
|
-
if (child.kind !== "element"
|
|
55739
|
+
if (child.kind !== "element") continue;
|
|
55740
|
+
const zone = equationZoneOf(child);
|
|
55741
|
+
if (zone !== null) {
|
|
55742
|
+
for (const _ of mathZoneEquations(zone)) languages.push(null);
|
|
55743
|
+
continue;
|
|
55744
|
+
}
|
|
55745
|
+
if (child.name.namespaceURI !== NS.dml) continue;
|
|
55257
55746
|
if (!RUN_CONTAINERS.has(child.name.localName)) continue;
|
|
55258
55747
|
const properties = firstChildElement(child, NAME_RPR);
|
|
55259
55748
|
languages.push(properties ? getAttrValue(properties, ATTR_LANG) : null);
|
|
@@ -56245,8 +56734,8 @@ const getShapeImageIntrinsicSize = (shape) => {
|
|
|
56245
56734
|
};
|
|
56246
56735
|
//#endregion
|
|
56247
56736
|
//#region src/api/index.ts
|
|
56248
|
-
const VERSION = "0.
|
|
56737
|
+
const VERSION = "0.29.0";
|
|
56249
56738
|
//#endregion
|
|
56250
56739
|
export { swapSlides as $, findSlidesByLayoutName as $a, getPresentationChartKindCounts as $c, getShapeStroke as $i, getSlideLayoutUsageCounts as $l, clearShapeEffects as $n, getSlideNotesParagraphEndFormat as $o, getShapeName as $r, getTableCellText as $s, isSlideLayoutBackgroundGraphicsHidden as $t, isShapeAspectRatioLocked as A, setParagraphAlignment as Aa, splitTableCell as Ac, setShapeFlip as Ai, getSlideMasterBackgroundImageBytes as Al, getShapeTextAutoFit as An, appendSlideNotes as Ao, getSlideShapes as Ar, getPackageSize as As, findSlidesByNotes as At, getPresentationCommenters as Au, addContentSlide as B, getSlideBody as Ba, setExtendedProperties as Bc, setShapeSlideBackgroundFill as Bi, getShapeGradientFillEffective as Bl, setShapeParagraphs as Bn, getAllImages as Bo, getMaxShapeId as Br, getSlideTables as Bs, getSlideCount as Bt, createPresentation as Bu, groupShapes as C, getShapeParagraphElements as Ca, setTableCellText as Cc, clearShapeStroke as Ci, getSlideLayoutBackgroundGradientFill as Cl, moveSlideAnimation as Cn, setShapeImageRecolor as Co, findSlidePlaceholderByIdx as Cr, getShapeMedia as Cs, setSlideMasterPlaceholderIncluded as Ct, getCommentPosition as Cu, getShapeTextLanguage as D, getShapeRunHyperlinkTooltip as Da, setTableRowHeight as Dc, getShapeStrokeSketch as Di, getSlideLayoutShapes as Dl, getShapeBodyPrEffective as Dn, getPresentationFirstSlideNumber as Do, getShapeXmlString as Dr, compactPackage as Ds, findSlideByPartName as Dt, getCommentsSortedByDate as Du, getParagraphElementLanguages as E, getShapeRunHyperlink as Ea, setTableColumnWidth as Ec, getShapeStrokeDash as Ei, getSlideLayoutBackgroundShapes as El, appendShapeText as En, SLIDE_SIZE_4_3 as Eo, getShapeSlide as Er, _internalPackageOf as Es, setSlideSections as Et, getCommentText as Eu, addSlidePlaceholder as F, setParagraphSpacing as Fa, getExtendedProperties as Fc, setShapePatternFill as Fi, setSlideBackgroundImage as Fl, getShapeTextFlat as Fn, findSlidesWithChartKind as Fo, centerShapeOnSlide as Fr, setMediaPartBytes as Fs, getPresentationText as Ft, setCommentText as Fu, duplicateSlide as G, clearSlideAnimations as Ga, setShapeHyperlink as Gc, setShapeStrokeDash as Gi, findLayoutsWithPlaceholderType as Gl, setShapeTextBodyRotationDeg as Gn, getHiddenSlides as Go, getShapeBounds as Gr, getTableCellAppearanceEffective as Gs, getSlidePartName as Gt, BUILTIN_PICTURE_STYLES as Gu, addSlide as H, setSlideBody as Ha, getParagraphPropertiesEffective as Hc, setShapeStrokeArrow as Hi, setSlideLayoutBackground as Hl, setShapeText3D as Hn, getAllTables as Ho, getPresetGeometry as Hr, getTableCell as Hs, getSlideInfo as Ht, savePresentation as Hu, resetSlideLayout as I, setParagraphTabs as Ia, getPresentationCreated as Ic, setShapePosition as Ii, setSlideBackgroundImageFillLayout as Il, getShapeTextMargins as In, findSlidesWithChartTrendlines as Io, findShapesAtPoint as Ir, slidesUsingMediaPart as Is, getPresentationTextLength as It, getPresentationFonts as Iu, mergePresentations as J, getSlideAnimations as Ja, findChartByKind as Jc, getShapeFill as Ji, findSlideLayoutByType as Jl, setShapeTextField as Jn, getPresentationNotesLengthsBySlide as Jo, getShapeCustomGeometry as Jr, getTableCellMargins as Js, getSlideXmlString as Jt, cm as Ju, duplicateSlideAt as K, findShapesWithAnimation as Ka, setShapeRunFormat as Kc, setShapeStrokeJoin as Ki, findSlideLayout as Kl, setShapeTextColumns as Kn, getPresentationHyperlinkCountsBySlide as Ko, getShapeBoundsResolved as Kr, getTableCellBorders as Ks, getSlideText as Kt, toWritableTextFormat as Ku, resetSlidePlaceholderGeometry as L, setParagraphTypography as La, getPresentationModified as Lc, setShapePreset as Li, setSlideBackgroundImageOpacity as Ll, getShapeTextWrap as Ln, getAllCharts as Lo, findShapesInRect as Lr, validatePresentation as Ls, getPresentationTextLengthsBySlide as Lt, getPresentationTheme as Lu, setShapeAspectRatioLocked as M, setParagraphIndent as Ma, removeThumbnail as Mc, setShapeImageFill as Mi, getSlideMasterShapes as Ml, getShapeTextBodyRotationDeg as Mn, clearAllSlideNotes as Mo, replaceTokensInSlide as Mr, getSlideMediaPartNames as Ms, getAllShapes as Mt, getSlideComments as Mu, setShapeLocked as N, setParagraphLevel as Na, setThumbnail as Nc, setShapeNoFill as Ni, setSlideBackground as Nl, getShapeTextColumns as Nn, clearSlideHyperlinks as No, setSlideLayout as Nr, listPackageParts as Ns, getOutlineText as Nt, removeSlideComment as Nu, setShapeTextLanguage as O, getShapeRunText as Oa, setTableStyleFlags as Oc, setShapeAdjustValues as Oi, getSlideMasterBackground as Ol, getShapeText3D as On, getSlideSize as Oo, getShapesBounds as Or, getMediaParts as Os, findSlideByText as Ot, getPresentationCommentCountsByAuthor as Ou, addMissingSlidePlaceholders as P, setParagraphLineSpacing as Pa, getCoreProperties as Pc, setShapeNoStroke as Pi, setSlideBackgroundGradientFill as Pl, getShapeTextDirection as Pn, findSlidesByHyperlink as Po, translateShapes as Pr, readPackagePart as Ps, getPresentationShapeCountsBySlide as Pt, setCommentStatus as Pu, sortSlides as Q, findShapesOutsideCanvas as Qa, getPresentationChartCountsBySlide as Qc, getShapeFillOpacity as Qi, getSlideLayoutType as Ql, setShapeTextWrap as Qn, getSlideNotesLineBreaks as Qo, getShapeKind as Qr, getTableCellSpan as Qs, isSlideHidden as Qt, pt as Qu, resetSlidePlaceholderTextFormatting as R, setShapeRunHyperlink as Ra, incrementRevision as Rc, setShapeRotation as Ri, setSlideBackgroundPatternFill as Rl, setShapeAlignment as Rn, getAllComments as Ro, getGroupChildren as Rr, clearTableCellFill as Rs, getShapeAt as Rt, setPresentationFonts as Ru, setShapePictureStyle as S, getShapeParagraphCount as Sa, setTableCellParagraphs as Sc, clearShapeFill as Si, getSlideLayoutBackground as Sl, setShapeZIndex as Sn, setShapeImageOpacity as So, findSlidePlaceholder as Sr, findShapesWithMedia as Ss, setSlideMasterName as St, getCommentParent as Su, setShapeStyle as T, getShapeRunCount as Ta, setTableCellTextFormat as Tc, getShapeStrokeArrow as Ti, getSlideLayoutBackgroundPatternFill as Tl, updateSlideAnimation as Tn, SLIDE_SIZE_16_9 as To, getShapeIndex as Tr, setShapeMediaPlayback as Ts, getSlideSections as Tt, getCommentStatus as Tu, addSlideAt as U, setSlidePlaceholders as Ua, getShapeHyperlink as Uc, setShapeStrokeCap as Ui, setSlideLayoutName as Ul, setShapeTextAnchor as Un, getDistinctHyperlinkUrls as Uo, getShapeAdjustValues as Ur, getTableCellAlignment as Us, getSlideLayoutCount as Ut, COMMENT_STATUSES as Uu, addSectionHeaderSlide as V, getSlideTitle as Va, touchModified as Vc, setShapeStroke as Vi, clearSlideLayoutBackground as Vl, setShapeText as Vn, getAllNotes as Vo, getMaxShapeIdInPresentation as Vr, getTableBackgroundEffective as Vs, getSlideIndex as Vt, loadPresentation as Vu, addTitleSlide as W, setSlideTitle as Wa, getShapeRunFormatEffective as Wc, setShapeStrokeCompound as Wi, setSlideLayoutPlaceholderBounds as Wl, setShapeTextAutoFit as Wn, getEmptySlides as Wo, getShapeAltTitle as Wr, getTableCellAnchor as Ws, getSlideOutline as Wt, BUILTIN_TABLE_STYLES as Wu, removeSlide as X, findFlippedShapes as Xa, findChartsWithDataLabels as Xc, getShapeFillColorResolved as Xi, getSlideLayoutPartName$1 as Xl, setShapeTextFormat as Xn, getSlideNotes as Xo, getShapeFlip as Xr, getTableCellPosition as Xs, getSlidesByLayout as Xt, inches as Xu, moveSlide as Y, setShapeAnimation as Ya, findChartsBySeriesName as Yc, getShapeFillColor as Yi, getSlideLayoutName as Yl, setShapeTextFlat as Yn, getPresentationNotesText as Yo, getShapeDescription as Yr, getTableCellParagraphs as Ys, getSlides as Yt, emu as Yu, reverseSlides as Z, findOverlappingShapePairs as Za, findChartsWithTrendlines as Zc, getShapeFillEffective as Zi, getSlideLayoutPlaceholders as Zl, setShapeTextMargins as Zn, getSlideNotesLength as Zo, getShapeId as Zr, getTableCellRunFormatEffective as Zs, isSlideBackgroundGraphicsHidden as Zt, mm as Zu, setSlideMasterBackgroundStyle as _, getParagraphIndent as _a, setTableCellAnchor as _c, setShapeAltTitle as _i, getSlideBackgroundImageFillLayout as _l, copyShape as _n, isShapeImageGrayscale as _o, findShapesByKind as _r, getSlideTransition as _s, removeSlideLayout as _t, findSlidesWithCommentsByAuthor as _u, getPresentationTextReview as a, getShapeStrokeGradient as aa, getTableRowHeights as ac, getShapeSize as ai, getSlideCharts as al, searchSlides as an, getShapeImageBrightness as ao, setShape3D as ar, getSlidesWithNotes as as, setHandoutSlidesPerPage as at, setShapeClickAction as au, getShapePictureStyle as b, getParagraphSpacing as ba, setTableCellFill as bc, setShapeHidden as bi, getSlideBackgroundPatternFill as bl, sendShapeBackward as bn, setShapeImageContrast as bo, findShapesByText as br, setSlideTransitionSound as bs, setSlideLayoutFootersIncluded as bt, getCommentDate as bu, getDrawingGuidesVisible as c, getShapeStrokeWidth as ca, getTableStyleId as cc, getSlideMasterPartName as ci, getEffectiveColorMap as cl, slideHasAnimations as cn, getShapeImageCrop as co, setShapeReflection as cr, getVisibleSlides as cs, getSlideShowProperties as ct, setShapeImage as cu, setDrawingGuides as d, resolveDrawingColorOpacity as da, isChartShape as dc, getUnusedSlideMasters as di, clearSlideBackground as dl, addSlideShape as dn, getShapeImageFormat as do, findEmptyPlaceholders as dr, replaceHyperlink as ds, addSlideLayoutPlaceholder as dt, clearSlideComments as du, getShapeStrokeCap as ea, getTableCellText3D as ec, getShapePlaceholderIdx as ei, getShapeChartCategories as el, replaceTextInNotes as en, findSlidesByLayoutPartName as eo, findShapesByEffect as er, getSlideNotesTextFormats as es, getHandoutMasterPlaceholders as et, getSlideLayoutUsageCountsByType as eu, setDrawingGuidesVisible as f, getParagraphAlignment as fa, isTableShape as fc, isShapeHidden as fi, copySlideBackground as fl, addSlideTable as fn, getShapeImageLinkUrl as fo, findShapeById as fr, resolveSlideNotesTextColor as fs, addSlideMaster as ft, findCommentAuthorByName as fu, getSlideMasterBackgroundStyles as g, getParagraphEndFormat as ga, setTableCellAlignment as gc, renameShape as gi, getSlideBackgroundImageCrop as gl, clearSlideShapes as gn, hasShapeText as go, findShapesByHyperlink as gr, clearSlideTransition as gs, isSlideMasterPreserved as gt, findCommentsByText as gu, setSnapToGrid as h, getParagraphBulletStyle as ha, removeTableRow as hc, pointInShape as hi, getSlideBackgroundImageBytes as hl, bringShapeToFront as hn, hasShapeImage as ho, findShapeInPresentation as hr, transformSlideNotesCase as hs, getSlideMasterPlaceholders as ht, findCommentsByAuthor as hu, setShapeImageFillLayout as i, getShapeStrokeEffective as ia, getTableDimensions as ic, getShapeRotation as ii, getShapeChartSpec as il, replaceTokensInPresentation as in, getShapeImageBiLevelThreshold as io, getShapeEffectsEffective as ir, getSlidesWithImages as is, setHandoutMasterPlaceholderIncluded as it, getShapeClickAction as iu, isShapeLocked as j, setParagraphBullet as ja, getThumbnail as jc, setShapeGradientFill as ji, getSlideMasterBackgroundPatternFill as jl, getShapeTextAutoFitParams as jn, clearAllHyperlinks as jo, getSlidesWithEmptyPlaceholders as jr, getPresentationSummary as js, findSlidesByText as jt, getSlideCommentAuthors as ju, setShapeCustomGeometry as k, isParagraphBulletPicture as ka, setTableStyleId as kc, setShapeFill as ki, getSlideMasterBackgroundGradientFill as kl, getShapeTextAnchor as kn, setSlideSize as ko, getSlideLayout as kr, getOrphanMediaPartNames as ks, findSlideByTitle as kt, getPresentationCommentCountsBySlide as ku, getGridSpacing as l, getShapeRunFormat as la, insertTableColumn as lc, getSlideMasterPartNames as li, resolveDeckBodyTextColor as ll, addSlideImage as ln, getShapeImageDuotone as lo, setShapeShadow as lr, hasSlideNotes as ls, setSlideShowProperties as lt, addSlideComment as lu, setSlideOutlineCollapsed as m, getParagraphBulletImageBytes as ma, removeTableColumn as mc, isShapeTextBox as mi, getSlideBackgroundGradientFill as ml, bringShapeForward as mn, getShapeImagePartName as mo, findShapeByText as mr, setSlideNotesFormat as ms, getSlideMasterName as mt, findCommentsBefore as mu, getShapeImageFillLayout as n, getShapeStrokeColorResolved as na, getTableCells as nc, getShapePosition as ni, getShapeChartSeriesNames as nl, replaceTextInSlide as nn, getPresentationImageCountsBySlide as no, getShapeEffect as nr, getSlidesWithComments as ns, getNotesMasterPlaceholders as nt, getUnusedSlideLayouts as nu, getCollapsedOutlineSlides as o, getShapeStrokeJoin as oa, getTableSize as oc, getShapeText as oi, setChartData as ol, setSlideBackgroundGraphicsHidden as on, getShapeImageBytes as oo, setShapeGlow as or, getSlidesWithOverlap as os, setNotesMasterPlaceholderIncluded as ot, getCustomShows as ou, setGridSpacing as p, getParagraphBullet as pa, mergeTableCells as pc, isShapePlaceholder as pi, getSlideBackground as pl, addSlideTextBox as pn, getShapeImageOpacity as po, findShapeByName as pr, setSlideNotes as ps, getSlideMasterLayouts as pt, findCommentsAfter as pu, importSlide as q, getShapeAnimation as qa, addSlideChart as qc, setShapeStrokeSketch as qi, findSlideLayoutByPartName as ql, setShapeTextDirection as qn, getPresentationNotesLength as qo, getShapeCenter as qr, getTableCellFill as qs, getSlideTextLength as qt, asColor as qu, getShapeImageIntrinsicSize as r, getShapeStrokeCompound as ra, getTableColumnWidths as rc, getShapePreset as ri, getShapeChartSeriesValues as rl, replaceTextInSlideNotes as rn, getShapeImageArtisticEffect as ro, getShapeEffects as rr, getSlidesWithHyperlinks as rs, getNotesPageSize as rt, isChartSpec as ru, getDrawingGuides as s, getShapeStrokeOpacity as sa, getTableStyleFlags as sc, getSlideMasterCount as si, setChartSpec as sl, setSlideHidden as sn, getShapeImageContrast as so, setShapeInnerShadow as sr, getSlidesWithTables as ss, setNotesPageOrientation as st, setCustomShows as su, VERSION as t, getShapeStrokeColor as ta, getTableCellTextDirection as tc, getShapePlaceholderType as ti, getShapeChartKind as tl, replaceTextInPresentation as tn, findSlidesByLayoutType as to, getShape3D as tr, getSlidesWithCharts as ts, getHandoutSlidesPerPage as tt, getSlideLayouts as tu, getSnapToGrid as u, resolveDrawingColor as ua, insertTableRow as uc, getSlideMasterUsageCounts as ui, applySlideBackgroundToAll as ul, addSlideLine as un, getShapeImageFillBytes as uo, setShapeSoftEdge as ur, removeSlideNotes as us, addSlideLayout as ut, clearAllSlideComments as uu, resetShapeVideoFormatting as v, getParagraphLevel as va, setTableCellBorders as vc, setShapeBounds as vi, getSlideBackgroundImageIntrinsicSize as vl, getShapeZIndex as vn, resetShapeImageColorEffects as vo, findShapesByName as vr, getSlideTransitionSound as vs, removeSlideMaster as vt, getCommentAuthor as vu, ungroupShapes as w, getShapeRunClickAction as wa, setTableCellTextDirection as wc, getShapePatternFill as wi, getSlideLayoutBackgroundImageBytes as wl, removeSlideAnimation as wn, SLIDE_SIZE_16_10 as wo, findSlidePlaceholders as wr, getShapeMediaPlayback as ws, setSlideMasterPreserved as wt, getCommentSlide as wu, setShapeImageCompressionState as x, getShapeHyperlinkTooltip as xa, setTableCellMargins as xc, shapesOverlap as xi, getSlideColorMapOverride as xl, sendShapeToBack as xn, setShapeImageCrop as xo, findShapesWithHyperlinks as xr, addSlideMedia as xs, setSlideLayoutTitleIncluded as xt, getCommentFormat as xu, getShapeImageCompressionState as y, getParagraphLineSpacing as ya, setTableCellClickAction as yc, setShapeDescription as yi, getSlideBackgroundImageOpacity as yl, removeShape as yn, setShapeImageBrightness as yo, findShapesByPreset as yr, setSlideTransition as ys, setSlideLayoutBackgroundGraphicsHidden as yt, getCommentAuthors as yu, addBlankSlide as z, setShapeRunText as za, setCoreProperties as zc, setShapeSize as zi, getShapeGradientFill as zl, setShapeBulletStyle as zn, getAllHyperlinks as zo, getGroupTransform as zr, getPresentationTableCountsBySlide as zs, getSlideAt as zt, setPresentationTheme as zu };
|
|
56251
56740
|
|
|
56252
|
-
//# sourceMappingURL=api-
|
|
56741
|
+
//# sourceMappingURL=api-5A_ykU4f.js.map
|