ooxml-core 0.5.0 → 0.6.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 +1 -0
- package/dist/digest/algorithm-names.d.ts +20 -0
- package/dist/digest/algorithm-names.d.ts.map +1 -0
- package/dist/digest/base64.d.ts +8 -0
- package/dist/digest/base64.d.ts.map +1 -0
- package/dist/digest/digest.d.ts +13 -0
- package/dist/digest/digest.d.ts.map +1 -0
- package/dist/digest/index.cjs +594 -0
- package/dist/digest/index.d.ts +8 -0
- package/dist/digest/index.d.ts.map +1 -0
- package/dist/digest/index.mjs +581 -0
- package/dist/digest/password-hash.d.ts +30 -0
- package/dist/digest/password-hash.d.ts.map +1 -0
- package/dist/digest/sha1.d.ts +3 -0
- package/dist/digest/sha1.d.ts.map +1 -0
- package/dist/digest/sha256.d.ts +10 -0
- package/dist/digest/sha256.d.ts.map +1 -0
- package/dist/digest/sha512.d.ts +5 -0
- package/dist/digest/sha512.d.ts.map +1 -0
- package/dist/docx/block-parser.d.ts.map +1 -1
- package/dist/docx/embedded.cjs +131 -54
- package/dist/docx/embedded.mjs +131 -54
- package/dist/docx/equation.d.ts +8 -0
- package/dist/docx/equation.d.ts.map +1 -0
- package/dist/docx/index.cjs +131 -54
- package/dist/docx/index.mjs +131 -54
- package/dist/docx/layout/adapter.d.ts.map +1 -1
- package/dist/docx/layout/index.cjs +3 -1
- package/dist/docx/layout/index.mjs +3 -1
- package/dist/docx/load/index.cjs +133 -56
- package/dist/docx/load/index.mjs +133 -56
- package/dist/docx/model-run.d.ts +5 -0
- package/dist/docx/model-run.d.ts.map +1 -1
- package/dist/docx/parse-revisions.d.ts.map +1 -1
- package/dist/docx/parse-table.d.ts.map +1 -1
- package/dist/docx/write-inline.d.ts.map +1 -1
- package/dist/docx/write-table-margins.d.ts +5 -0
- package/dist/docx/write-table-margins.d.ts.map +1 -0
- package/dist/docx/write-table-properties.d.ts +3 -1
- package/dist/docx/write-table-properties.d.ts.map +1 -1
- package/dist/docx/write-table.d.ts.map +1 -1
- package/dist/index.cjs +598 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +598 -1
- package/dist/xlsx/edit/history.d.ts +1 -1
- package/dist/xlsx/edit/history.d.ts.map +1 -1
- package/dist/xlsx/edit/index.d.ts +1 -1
- package/dist/xlsx/edit/index.d.ts.map +1 -1
- package/dist/xlsx/edit/protection.d.ts +18 -6
- package/dist/xlsx/edit/protection.d.ts.map +1 -1
- package/dist/xlsx/edit/types.d.ts +2 -2
- package/dist/xlsx/index.cjs +671 -28
- package/dist/xlsx/index.mjs +670 -29
- package/dist/xlsx/load/index.cjs +56 -19
- package/dist/xlsx/load/index.mjs +56 -19
- package/dist/xlsx/model.d.ts +21 -0
- package/dist/xlsx/model.d.ts.map +1 -1
- package/dist/xlsx/read/load.d.ts.map +1 -1
- package/dist/xlsx/read/password-hash.d.ts +15 -0
- package/dist/xlsx/read/password-hash.d.ts.map +1 -0
- package/dist/xlsx/read/sheet-props.d.ts.map +1 -1
- package/dist/xlsx/read/workbook-part.d.ts +3 -1
- package/dist/xlsx/read/workbook-part.d.ts.map +1 -1
- package/dist/xlsx/write/password-hash.d.ts +8 -0
- package/dist/xlsx/write/password-hash.d.ts.map +1 -0
- package/dist/xlsx/write/sheet-props.d.ts.map +1 -1
- package/dist/xlsx/write/workbook-part.d.ts.map +1 -1
- package/package.json +6 -1
package/dist/docx/load/index.mjs
CHANGED
|
@@ -899,6 +899,46 @@ function orderSectionProperties(sectPr) {
|
|
|
899
899
|
orderChildren(sectPr, SECTPR_ORDER);
|
|
900
900
|
}
|
|
901
901
|
|
|
902
|
+
// src/docx/write-table-margins.ts
|
|
903
|
+
var SIDES = ["top", "left", "bottom", "right"];
|
|
904
|
+
var ORDER = ["top", "start", "left", "bottom", "end", "right"];
|
|
905
|
+
function patchMarginProperties(doc, host, propertiesTag, marginTag, propertiesOrder, next, base) {
|
|
906
|
+
const changed = SIDES.filter((side) => next?.[side] !== base?.[side]);
|
|
907
|
+
if (!changed.length) return;
|
|
908
|
+
for (const side of changed) {
|
|
909
|
+
const value = next?.[side];
|
|
910
|
+
if (value !== void 0 && (!Number.isSafeInteger(value) || value < 0))
|
|
911
|
+
throw new Error("Table cell margins must be nonnegative whole twips.");
|
|
912
|
+
}
|
|
913
|
+
let properties = first2(host, propertiesTag);
|
|
914
|
+
if (!properties) {
|
|
915
|
+
properties = makeW(doc, propertiesTag);
|
|
916
|
+
host.insertBefore(properties, host.firstChild);
|
|
917
|
+
}
|
|
918
|
+
let margins = first2(properties, marginTag);
|
|
919
|
+
if (!margins) {
|
|
920
|
+
margins = makeW(doc, marginTag);
|
|
921
|
+
properties.appendChild(margins);
|
|
922
|
+
}
|
|
923
|
+
for (const side of changed) {
|
|
924
|
+
const logical = side === "left" ? "start" : side === "right" ? "end" : side;
|
|
925
|
+
const edge = first2(margins, logical) ?? first2(margins, side) ?? makeW(doc, side);
|
|
926
|
+
for (const alias of /* @__PURE__ */ new Set([side, logical]))
|
|
927
|
+
for (const old of children2(margins, alias)) margins.removeChild(old);
|
|
928
|
+
const value = next?.[side];
|
|
929
|
+
if (value === void 0) continue;
|
|
930
|
+
edge.setAttributeNS(WORD_NS, "w:w", String(value));
|
|
931
|
+
edge.setAttributeNS(WORD_NS, "w:type", "dxa");
|
|
932
|
+
margins.appendChild(edge);
|
|
933
|
+
}
|
|
934
|
+
if (!Array.from(margins.childNodes).some((node) => node.nodeType === 1) && !margins.attributes.length)
|
|
935
|
+
properties.removeChild(margins);
|
|
936
|
+
else orderChildren(margins, ORDER);
|
|
937
|
+
orderChildren(properties, propertiesOrder);
|
|
938
|
+
if (!Array.from(properties.childNodes).some((node) => node.nodeType === 1) && !properties.attributes.length)
|
|
939
|
+
host.removeChild(properties);
|
|
940
|
+
}
|
|
941
|
+
|
|
902
942
|
// src/docx/write-table-properties.ts
|
|
903
943
|
var ROW_ORDER = [
|
|
904
944
|
"cnfStyle",
|
|
@@ -958,26 +998,15 @@ function patchRowProperties(doc, tr, next, base) {
|
|
|
958
998
|
orderChildren(props, ROW_ORDER);
|
|
959
999
|
}
|
|
960
1000
|
function patchTableMargins(doc, table, node, base) {
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
props.appendChild(margins);
|
|
971
|
-
}
|
|
972
|
-
const built = buildMargins(doc, table.cellMargins ?? {}, "tblCellMar");
|
|
973
|
-
for (const side of ["top", "left", "bottom", "right"]) {
|
|
974
|
-
if (table.cellMargins?.[side] === base?.cellMargins?.[side]) continue;
|
|
975
|
-
for (const old of children2(margins, side)) margins.removeChild(old);
|
|
976
|
-
const replacement = first2(built, side);
|
|
977
|
-
if (replacement) margins.appendChild(replacement);
|
|
978
|
-
}
|
|
979
|
-
orderChildren(margins, ["top", "left", "start", "bottom", "right", "end"]);
|
|
980
|
-
orderChildren(props, TABLE_ORDER);
|
|
1001
|
+
patchMarginProperties(
|
|
1002
|
+
doc,
|
|
1003
|
+
node,
|
|
1004
|
+
"tblPr",
|
|
1005
|
+
"tblCellMar",
|
|
1006
|
+
TABLE_ORDER,
|
|
1007
|
+
table.cellMargins,
|
|
1008
|
+
base?.cellMargins
|
|
1009
|
+
);
|
|
981
1010
|
}
|
|
982
1011
|
var CELL_ORDER = [
|
|
983
1012
|
"cnfStyle",
|
|
@@ -1001,6 +1030,9 @@ var CELL_ORDER = [
|
|
|
1001
1030
|
];
|
|
1002
1031
|
var CELL_BORDER_ORDER = ["top", "start", "left", "bottom", "end", "right", "insideH", "insideV"];
|
|
1003
1032
|
var CELL_SIDES = ["top", "left", "bottom", "right"];
|
|
1033
|
+
function patchCellMargins(doc, tc, next, base) {
|
|
1034
|
+
patchMarginProperties(doc, tc, "tcPr", "tcMar", CELL_ORDER, next, base);
|
|
1035
|
+
}
|
|
1004
1036
|
function patchCellBorders(doc, tc, next, base) {
|
|
1005
1037
|
const changed = CELL_SIDES.filter(
|
|
1006
1038
|
(side) => JSON.stringify(next?.[side]) !== JSON.stringify(base?.[side])
|
|
@@ -1088,13 +1120,7 @@ var TABLE_DESCRIPTOR_KEYS = [
|
|
|
1088
1120
|
"style",
|
|
1089
1121
|
"look"
|
|
1090
1122
|
];
|
|
1091
|
-
var CELL_DESCRIPTOR_KEYS = [
|
|
1092
|
-
"gridSpan",
|
|
1093
|
-
"verticalMerge",
|
|
1094
|
-
"widthTwips",
|
|
1095
|
-
"verticalAlign",
|
|
1096
|
-
"margins"
|
|
1097
|
-
];
|
|
1123
|
+
var CELL_DESCRIPTOR_KEYS = ["gridSpan", "verticalMerge", "widthTwips", "verticalAlign"];
|
|
1098
1124
|
function pick(source, keys) {
|
|
1099
1125
|
const record = source;
|
|
1100
1126
|
const result = {};
|
|
@@ -1120,7 +1146,7 @@ function assertNoDescriptorEdits(table, base) {
|
|
|
1120
1146
|
if (!source) continue;
|
|
1121
1147
|
if (JSON.stringify(pick(cell, CELL_DESCRIPTOR_KEYS)) !== JSON.stringify(pick(source, CELL_DESCRIPTOR_KEYS)))
|
|
1122
1148
|
throw new Error(
|
|
1123
|
-
"Cannot edit table cell width, merge
|
|
1149
|
+
"Cannot edit table cell width, merge or vertical alignment on an existing cell; only cell text, borders, shading and margins are supported. The original DOCX package remains unchanged."
|
|
1124
1150
|
);
|
|
1125
1151
|
}
|
|
1126
1152
|
}
|
|
@@ -1190,6 +1216,7 @@ function writeTable(doc, table, node, base, writeParagraph, replaceSlots2) {
|
|
|
1190
1216
|
const tc = source?.cell ?? makeW(doc, "tc");
|
|
1191
1217
|
patchCellBorders(doc, tc, cell.borders, source?.model.borders);
|
|
1192
1218
|
patchCellShading(doc, tc, cell, source?.model);
|
|
1219
|
+
patchCellMargins(doc, tc, cell.margins, source?.model.margins);
|
|
1193
1220
|
const oldParagraphs = children2(tc, "p");
|
|
1194
1221
|
const nextParagraphs = cell.paragraphs.map((paragraph) => {
|
|
1195
1222
|
const index = source?.paragraphs.findIndex((p) => p.id === paragraph.id) ?? -1;
|
|
@@ -1332,7 +1359,7 @@ function parseTintShade(value) {
|
|
|
1332
1359
|
}
|
|
1333
1360
|
|
|
1334
1361
|
// src/docx/table-borders.ts
|
|
1335
|
-
var
|
|
1362
|
+
var SIDES2 = [
|
|
1336
1363
|
"top",
|
|
1337
1364
|
"bottom",
|
|
1338
1365
|
"left",
|
|
@@ -1358,7 +1385,7 @@ function parseTableBorders(bordersElement) {
|
|
|
1358
1385
|
if (!bordersElement) return void 0;
|
|
1359
1386
|
const result = {};
|
|
1360
1387
|
const alias = { left: "start", right: "end" };
|
|
1361
|
-
for (const side of
|
|
1388
|
+
for (const side of SIDES2) {
|
|
1362
1389
|
const aliasName = alias[side];
|
|
1363
1390
|
const value = borderSide(
|
|
1364
1391
|
first2(bordersElement, side) ?? (aliasName ? first2(bordersElement, aliasName) : void 0)
|
|
@@ -1395,13 +1422,13 @@ function parseParagraphBorders(pBdr) {
|
|
|
1395
1422
|
}
|
|
1396
1423
|
|
|
1397
1424
|
// src/docx/page-borders.ts
|
|
1398
|
-
var
|
|
1425
|
+
var SIDES3 = ["top", "left", "bottom", "right"];
|
|
1399
1426
|
var ATTRIBUTES = ["offsetFrom", "display", "zOrder"];
|
|
1400
1427
|
var setW4 = (element, name, value) => element.setAttributeNS(WORD_NS, `w:${name}`, value);
|
|
1401
1428
|
function parsePageBorders(element) {
|
|
1402
1429
|
if (!element) return void 0;
|
|
1403
1430
|
const result = {};
|
|
1404
|
-
for (const side of
|
|
1431
|
+
for (const side of SIDES3) {
|
|
1405
1432
|
const source = first2(element, side);
|
|
1406
1433
|
const value = borderSide(source);
|
|
1407
1434
|
const art = getW(source, "art");
|
|
@@ -1439,7 +1466,7 @@ function patchPageBorders(doc, sectPr, next, base, create) {
|
|
|
1439
1466
|
return;
|
|
1440
1467
|
}
|
|
1441
1468
|
const element = create(doc, sectPr, "pgBorders");
|
|
1442
|
-
for (const side of
|
|
1469
|
+
for (const side of SIDES3) {
|
|
1443
1470
|
if (JSON.stringify(next[side]) === JSON.stringify(base?.[side])) continue;
|
|
1444
1471
|
for (const old of children2(element, side)) element.removeChild(old);
|
|
1445
1472
|
const value = next[side];
|
|
@@ -1764,7 +1791,7 @@ function applySectionEdits(doc, body, blocks, sections, base, references = /* @_
|
|
|
1764
1791
|
}
|
|
1765
1792
|
|
|
1766
1793
|
// src/docx/write-paragraph-decoration.ts
|
|
1767
|
-
var
|
|
1794
|
+
var SIDES4 = ["top", "left", "bottom", "right", "between"];
|
|
1768
1795
|
function wordColor(color) {
|
|
1769
1796
|
const hex = /^#?([0-9a-f]{6})$/i.exec(color ?? "")?.[1];
|
|
1770
1797
|
return hex ? hex.toUpperCase() : "auto";
|
|
@@ -1798,7 +1825,7 @@ function updateBorders(doc, props, paragraph, base) {
|
|
|
1798
1825
|
const borders = paragraph.borders;
|
|
1799
1826
|
if (!borders) return;
|
|
1800
1827
|
const pBdr = makeW(doc, "pBdr");
|
|
1801
|
-
for (const side of
|
|
1828
|
+
for (const side of SIDES4) {
|
|
1802
1829
|
const value = borders[side];
|
|
1803
1830
|
if (value) pBdr.appendChild(borderElement(doc, side, value));
|
|
1804
1831
|
}
|
|
@@ -4229,6 +4256,30 @@ function createRun(doc, run, base, old, allocator) {
|
|
|
4229
4256
|
if (!run.text) node.appendChild(makeW(doc, "t"));
|
|
4230
4257
|
return node;
|
|
4231
4258
|
}
|
|
4259
|
+
var MATH_NAMESPACES = /* @__PURE__ */ new Set([
|
|
4260
|
+
"http://schemas.openxmlformats.org/officeDocument/2006/math",
|
|
4261
|
+
"http://purl.oclc.org/ooxml/officeDocument/math"
|
|
4262
|
+
]);
|
|
4263
|
+
function isEquationElement(element) {
|
|
4264
|
+
return MATH_NAMESPACES.has(element.namespaceURI ?? "") && (element.localName === "oMath" || element.localName === "oMathPara");
|
|
4265
|
+
}
|
|
4266
|
+
function parseEquation(element) {
|
|
4267
|
+
if (!isEquationElement(element)) return void 0;
|
|
4268
|
+
return {
|
|
4269
|
+
text: "",
|
|
4270
|
+
equation: {
|
|
4271
|
+
omml: new XMLSerializer().serializeToString(element),
|
|
4272
|
+
display: element.localName === "oMathPara"
|
|
4273
|
+
}
|
|
4274
|
+
};
|
|
4275
|
+
}
|
|
4276
|
+
function preserveEquation(run, base, old) {
|
|
4277
|
+
if (!old || !isEquationElement(old) || !base?.equation || run.text !== "" || run.equation?.omml !== base.equation.omml || run.equation?.display !== base.equation.display)
|
|
4278
|
+
throw new Error(
|
|
4279
|
+
"Equation editing or insertion is unsupported; imported OMML must remain unchanged."
|
|
4280
|
+
);
|
|
4281
|
+
return old.cloneNode(true);
|
|
4282
|
+
}
|
|
4232
4283
|
|
|
4233
4284
|
// src/docx/breaks.ts
|
|
4234
4285
|
function hasSpecialBreak(element) {
|
|
@@ -4327,10 +4378,11 @@ function collectParagraphRuns(node, parseRun3, parseOther, resolveLink, active =
|
|
|
4327
4378
|
if (!isCommentReferenceRun(item)) push(parseRun3(item));
|
|
4328
4379
|
} else if (named2(item, "hyperlink")) {
|
|
4329
4380
|
const link = resolveLink?.(item);
|
|
4330
|
-
for (const
|
|
4331
|
-
const parsed
|
|
4332
|
-
|
|
4333
|
-
|
|
4381
|
+
for (const child3 of Array.from(item.childNodes).filter(isElement)) {
|
|
4382
|
+
for (const parsed of named2(child3, "r") ? [parseRun3(child3)] : parseOther?.(child3) ?? []) {
|
|
4383
|
+
if (link) parsed.link = link;
|
|
4384
|
+
push(parsed);
|
|
4385
|
+
}
|
|
4334
4386
|
}
|
|
4335
4387
|
} else if ((!item.namespaceURI || item.namespaceURI === WORD_NS) && Object.hasOwn(REVISION_WRAPPERS, item.localName)) {
|
|
4336
4388
|
const kind = expectDefined(
|
|
@@ -4341,7 +4393,12 @@ function collectParagraphRuns(node, parseRun3, parseOther, resolveLink, active =
|
|
|
4341
4393
|
const revision = revisionFrom(item, kind);
|
|
4342
4394
|
const range = kind === "moveFrom" || kind === "moveTo" ? moves[kind].at(-1) : void 0;
|
|
4343
4395
|
if (range) revision.move = { name: range.name, rangeId: range.id };
|
|
4344
|
-
for (const
|
|
4396
|
+
for (const child3 of Array.from(item.childNodes).filter(isElement)) {
|
|
4397
|
+
for (const parsed of named2(child3, "r") ? [parseRun3(child3, revision)] : parseOther?.(child3) ?? []) {
|
|
4398
|
+
parsed.revision = revision;
|
|
4399
|
+
push(parsed);
|
|
4400
|
+
}
|
|
4401
|
+
}
|
|
4345
4402
|
} else if (trackMoveRange(item, moves)) {
|
|
4346
4403
|
continue;
|
|
4347
4404
|
} else if (named2(item, "commentRangeStart")) {
|
|
@@ -4388,7 +4445,9 @@ function runsOf(parent, container, slots) {
|
|
|
4388
4445
|
if (child3.nodeType === 3 && child3.textContent?.trim()) return false;
|
|
4389
4446
|
continue;
|
|
4390
4447
|
}
|
|
4391
|
-
if (
|
|
4448
|
+
if (isEquationElement(child3)) {
|
|
4449
|
+
slots.push({ element: child3, ...container && { container } });
|
|
4450
|
+
} else if (named2(child3, "r")) {
|
|
4392
4451
|
if (isCommentReferenceRun(child3)) continue;
|
|
4393
4452
|
if (!runIsSafe(child3)) return false;
|
|
4394
4453
|
slots.push({ element: child3, ...container && { container } });
|
|
@@ -4412,7 +4471,9 @@ function collectInlineSlots(paragraph) {
|
|
|
4412
4471
|
if (child3.nodeType === 3 && child3.textContent?.trim()) return void 0;
|
|
4413
4472
|
continue;
|
|
4414
4473
|
}
|
|
4415
|
-
if (
|
|
4474
|
+
if (isEquationElement(child3)) {
|
|
4475
|
+
slots.push({ element: child3 });
|
|
4476
|
+
} else if (named2(child3, "r")) {
|
|
4416
4477
|
if (isCommentReferenceRun(child3)) continue;
|
|
4417
4478
|
if (!runIsSafe(child3)) return void 0;
|
|
4418
4479
|
slots.push({ element: child3 });
|
|
@@ -4428,7 +4489,7 @@ function collectInlineSlots(paragraph) {
|
|
|
4428
4489
|
}
|
|
4429
4490
|
function replaceableInlineChildren(paragraph) {
|
|
4430
4491
|
return Array.from(paragraph.childNodes).filter(
|
|
4431
|
-
(child3) => isElement(child3) && (named2(child3, "r") || named2(child3, "hyperlink") || named2(child3, "fldSimple") || isRevisionWrapperElement(child3) || isCommentAnchorElement(child3))
|
|
4492
|
+
(child3) => isElement(child3) && (isEquationElement(child3) || named2(child3, "r") || named2(child3, "hyperlink") || named2(child3, "fldSimple") || isRevisionWrapperElement(child3) || isCommentAnchorElement(child3))
|
|
4432
4493
|
);
|
|
4433
4494
|
}
|
|
4434
4495
|
function sameLink(a, b) {
|
|
@@ -4453,7 +4514,7 @@ function newHyperlink(doc, link, allocator) {
|
|
|
4453
4514
|
}
|
|
4454
4515
|
function runNodes(doc, run, base, old, opens, closes, allocator) {
|
|
4455
4516
|
const nodes = opens.flatMap((edge) => rangeStartNodes(doc, edge));
|
|
4456
|
-
const node = createRun(doc, run, base, old, allocator);
|
|
4517
|
+
const node = run.equation ? preserveEquation(run, base, old) : createRun(doc, run, base, old, allocator);
|
|
4457
4518
|
const revision = run.revision;
|
|
4458
4519
|
if (revision && ["insert", "delete", "moveFrom", "moveTo"].includes(revision.kind)) {
|
|
4459
4520
|
if (revision.kind === "delete" || revision.kind === "moveFrom") convertToDeleteText(doc, node);
|
|
@@ -4465,15 +4526,23 @@ function runNodes(doc, run, base, old, opens, closes, allocator) {
|
|
|
4465
4526
|
function buildInlineContent(doc, runs, base, slots, allocator, ranges) {
|
|
4466
4527
|
const { opens, closes } = rangeEdges(runs, ranges);
|
|
4467
4528
|
const runAt = (at) => expectDefined(runs[at], `run ${at}`);
|
|
4468
|
-
const nodesFor = (index2) =>
|
|
4469
|
-
|
|
4470
|
-
|
|
4471
|
-
|
|
4472
|
-
|
|
4473
|
-
|
|
4474
|
-
|
|
4475
|
-
|
|
4476
|
-
|
|
4529
|
+
const nodesFor = (index2) => {
|
|
4530
|
+
const run = runAt(index2);
|
|
4531
|
+
const sourceIndex = run.equation ? base?.findIndex(
|
|
4532
|
+
(source2) => source2.equation?.omml === run.equation?.omml && source2.equation?.display === run.equation?.display
|
|
4533
|
+
) : index2;
|
|
4534
|
+
const source = sourceIndex === void 0 ? void 0 : base?.[sourceIndex];
|
|
4535
|
+
const old = sourceIndex === void 0 ? void 0 : slots[sourceIndex]?.element;
|
|
4536
|
+
return runNodes(
|
|
4537
|
+
doc,
|
|
4538
|
+
run,
|
|
4539
|
+
!run.equation && source?.equation ? void 0 : source,
|
|
4540
|
+
!run.equation && old && isEquationElement(old) ? void 0 : old,
|
|
4541
|
+
opens.get(index2) ?? [],
|
|
4542
|
+
closes.get(index2) ?? [],
|
|
4543
|
+
allocator
|
|
4544
|
+
);
|
|
4545
|
+
};
|
|
4477
4546
|
const output = [];
|
|
4478
4547
|
let index = 0;
|
|
4479
4548
|
while (index < runs.length) {
|
|
@@ -6520,7 +6589,9 @@ function parseMargins(element) {
|
|
|
6520
6589
|
["left", "start"],
|
|
6521
6590
|
["right", "end"]
|
|
6522
6591
|
]) {
|
|
6523
|
-
const
|
|
6592
|
+
const edge = first2(element, logical) ?? first2(element, side);
|
|
6593
|
+
const type = getW(edge, "type") ?? "dxa";
|
|
6594
|
+
const value = type === "nil" ? parseSignedTwips("0") : type === "dxa" ? parseSignedTwips(getW(edge, "w")) : void 0;
|
|
6524
6595
|
if (value !== void 0) parsed[side] = value;
|
|
6525
6596
|
}
|
|
6526
6597
|
return Object.keys(parsed).length ? parsed : void 0;
|
|
@@ -6725,13 +6796,19 @@ function parseParagraph2(node, id) {
|
|
|
6725
6796
|
node,
|
|
6726
6797
|
(element, revision) => trackField(element, parseRun2(element, revision)),
|
|
6727
6798
|
(item) => {
|
|
6799
|
+
const equation = parseEquation(item);
|
|
6800
|
+
if (equation) return [equation];
|
|
6728
6801
|
if (!named2(item, "fldSimple")) return void 0;
|
|
6729
6802
|
const instr = getW(item, "instr") ?? "";
|
|
6730
6803
|
const link = parseSimpleHyperlinkField(instr);
|
|
6731
|
-
const results =
|
|
6804
|
+
const results = Array.from(item.childNodes).filter(isElement).flatMap((child3) => {
|
|
6805
|
+
const equation2 = parseEquation(child3);
|
|
6806
|
+
return equation2 ? [equation2] : named2(child3, "r") ? [parseRun2(child3)] : [];
|
|
6807
|
+
});
|
|
6732
6808
|
if (link) return results.map((run) => ({ ...run, link }));
|
|
6733
6809
|
const field = { instr: instr.trim(), simple: true };
|
|
6734
|
-
if (!results.some((run) => run.text
|
|
6810
|
+
if (!results.some((run) => run.text || run.equation))
|
|
6811
|
+
return [{ text: fieldPlaceholderText(instr), field }];
|
|
6735
6812
|
return results.map((run) => ({ ...run, field }));
|
|
6736
6813
|
},
|
|
6737
6814
|
(hyperlink) => {
|
package/dist/docx/model-run.d.ts
CHANGED
|
@@ -20,6 +20,11 @@ export interface Revision {
|
|
|
20
20
|
}
|
|
21
21
|
export interface TextRun {
|
|
22
22
|
text: string;
|
|
23
|
+
/** Imported, display-only equation. Source OMML is preserved; equation editing is unsupported. */
|
|
24
|
+
equation?: {
|
|
25
|
+
omml: string;
|
|
26
|
+
display: boolean;
|
|
27
|
+
};
|
|
23
28
|
bold?: boolean;
|
|
24
29
|
italic?: boolean;
|
|
25
30
|
underline?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model-run.d.ts","sourceRoot":"","sources":["../../src/docx/model-run.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AACxE,OAAO,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACpE,OAAO,KAAK,EACX,mBAAmB,EACnB,aAAa,EACb,eAAe,EACf,kBAAkB,EAClB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE1D,qEAAqE;AACrE,MAAM,WAAW,QAAQ;IACxB,IAAI,EAAE,QAAQ,GAAG,QAAQ,GAAG,UAAU,GAAG,QAAQ,GAAG,cAAc,GAAG,iBAAiB,CAAC;IACvF;;;OAGG;IACH,IAAI,CAAC,EAAE;QAA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CAAC,EAAE,WAAW,CAAC;IACpC,iGAAiG;IACjG,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,mEAAmE;IACnE,SAAS,CAAC,EAAE,OAAO,gBAAgB,EAAE,SAAS,CAAC;IAC/C,2FAA2F;IAC3F,iBAAiB,CAAC,EAAE,UAAU,CAAC;IAC/B,mGAAmG;IACnG,kBAAkB,CAAC,EAAE,UAAU,CAAC;IAChC,0CAA0C;IAC1C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,kFAAkF;IAClF,gBAAgB,CAAC,EAAE,mBAAmB,CAAC;IACvC,4FAA4F;IAC5F,SAAS,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,eAAe,EAAE,aAAa,CAAC,CAAC,CAAC;IAC5D,mFAAmF;IACnF,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,yFAAyF;IACzF,IAAI,CAAC,EAAE,aAAa,CAAC;CACrB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parse-revisions.d.ts","sourceRoot":"","sources":["../../src/docx/parse-revisions.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACpD,OAAO,
|
|
1
|
+
{"version":3,"file":"parse-revisions.d.ts","sourceRoot":"","sources":["../../src/docx/parse-revisions.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACpD,OAAO,EAAiC,KAAK,UAAU,EAAW,MAAM,UAAU,CAAC;AASnF,sGAAsG;AACtG,eAAO,MAAM,sBAAsB,UAAiC,CAAC;AACrE,eAAO,MAAM,oBAAoB,UAA+D,CAAC;AAEjG,iGAAiG;AACjG,MAAM,WAAW,SAAS;IACzB,QAAQ,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,EAAE,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IACzC,MAAM,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,EAAE,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;CACvC;AAsBD,iGAAiG;AACjG,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,UAAU,GAAG,OAAO,CAK9D;AAaD,gFAAgF;AAChF,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,UAAU,GAAG,SAAS,GAAG,QAAQ,GAAG,SAAS,CAOvF;AAED,oGAAoG;AACpG,wBAAgB,uBAAuB,CAAC,GAAG,EAAE,UAAU,GAAG,SAAS,GAAG,QAAQ,GAAG,SAAS,CAGzF;AAED,8FAA8F;AAC9F,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,UAAU,GAAG,SAAS,GAAG,QAAQ,GAAG,SAAS,CAGnF;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CACnC,IAAI,EAAE,UAAU,EAChB,QAAQ,EAAE,CAAC,GAAG,EAAE,UAAU,EAAE,QAAQ,CAAC,EAAE,QAAQ,KAAK,OAAO,EAC3D,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,UAAU,KAAK,OAAO,EAAE,GAAG,SAAS,EACxD,WAAW,CAAC,EAAE,CAAC,SAAS,EAAE,UAAU,KAAK,OAAO,CAAC,MAAM,CAAC,EACxD,MAAM,GAAE,MAAM,EAAO,EACrB,KAAK,GAAE,SAAwC,GAC7C;IAAE,IAAI,EAAE,OAAO,EAAE,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAE,CAoDvC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parse-table.d.ts","sourceRoot":"","sources":["../../src/docx/parse-table.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnD,OAAO,EAAyB,KAAK,UAAU,EAAW,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"parse-table.d.ts","sourceRoot":"","sources":["../../src/docx/parse-table.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnD,OAAO,EAAyB,KAAK,UAAU,EAAW,MAAM,UAAU,CAAC;AAyH3E,8FAA8F;AAC9F,wBAAgB,UAAU,CACzB,IAAI,EAAE,UAAU,EAChB,EAAE,EAAE,MAAM,EACV,cAAc,EAAE,CAAC,CAAC,EAAE,UAAU,EAAE,EAAE,EAAE,MAAM,KAAK,SAAS,GACtD,KAAK,CA8CP"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"write-inline.d.ts","sourceRoot":"","sources":["../../src/docx/write-inline.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAiB,OAAO,EAAE,MAAM,YAAY,CAAC;AACzD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AACzE,OAAO,EAIN,KAAK,eAAe,EAEpB,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"write-inline.d.ts","sourceRoot":"","sources":["../../src/docx/write-inline.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAiB,OAAO,EAAE,MAAM,YAAY,CAAC;AACzD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AACzE,OAAO,EAIN,KAAK,eAAe,EAEpB,MAAM,mBAAmB,CAAC;AAY3B,OAAO,EAON,KAAK,WAAW,EAChB,KAAK,UAAU,EACf,MAAM,UAAU,CAAC;AAElB;;;GAGG;AACH,MAAM,WAAW,UAAU;IAC1B,OAAO,CAAC,EAAE,UAAU,CAAC;IACrB,SAAS,CAAC,EAAE,UAAU,CAAC;CACvB;AA8DD;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,UAAU,GAAG,UAAU,EAAE,GAAG,SAAS,CA2BlF;AAED,8EAA8E;AAC9E,wBAAgB,yBAAyB,CAAC,SAAS,EAAE,UAAU,GAAG,UAAU,EAAE,CAW7E;AAqDD,4FAA4F;AAC5F,wBAAgB,kBAAkB,CACjC,GAAG,EAAE,WAAW,EAChB,IAAI,EAAE,OAAO,EAAE,EACf,IAAI,EAAE,OAAO,EAAE,GAAG,SAAS,EAC3B,KAAK,EAAE,UAAU,EAAE,EACnB,SAAS,CAAC,EAAE,qBAAqB,EACjC,MAAM,CAAC,EAAE,eAAe,GACtB,UAAU,EAAE,CA2Dd"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { TableCellMargins } from './table-model.js';
|
|
2
|
+
import { type XmlDocument, type XmlElement } from './xml.js';
|
|
3
|
+
/** Patch only changed margin sides, retaining logical edge names and unrelated XML. */
|
|
4
|
+
export declare function patchMarginProperties(doc: XmlDocument, host: XmlElement, propertiesTag: 'tblPr' | 'tcPr', marginTag: 'tblCellMar' | 'tcMar', propertiesOrder: readonly string[], next: TableCellMargins | undefined, base: TableCellMargins | undefined): void;
|
|
5
|
+
//# sourceMappingURL=write-table-margins.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"write-table-margins.d.ts","sourceRoot":"","sources":["../../src/docx/write-table-margins.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAEzD,OAAO,EAAmC,KAAK,WAAW,EAAE,KAAK,UAAU,EAAE,MAAM,UAAU,CAAC;AAK9F,uFAAuF;AACvF,wBAAgB,qBAAqB,CACpC,GAAG,EAAE,WAAW,EAChB,IAAI,EAAE,UAAU,EAChB,aAAa,EAAE,OAAO,GAAG,MAAM,EAC/B,SAAS,EAAE,YAAY,GAAG,OAAO,EACjC,eAAe,EAAE,SAAS,MAAM,EAAE,EAClC,IAAI,EAAE,gBAAgB,GAAG,SAAS,EAClC,IAAI,EAAE,gBAAgB,GAAG,SAAS,GAChC,IAAI,CAyCN"}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import type { Table, TableCell } from './model.js';
|
|
2
|
-
import type { TableBorders, TableRowProperties } from './table-model.js';
|
|
2
|
+
import type { TableBorders, TableCellMargins, TableRowProperties } from './table-model.js';
|
|
3
3
|
import { type XmlDocument, type XmlElement } from './xml.js';
|
|
4
4
|
/** Changes only modeled row fields, preserving unmodeled trPr children and attributes. */
|
|
5
5
|
export declare function patchRowProperties(doc: XmlDocument, tr: XmlElement, next: TableRowProperties | undefined, base: TableRowProperties | undefined): void;
|
|
6
6
|
/** Updates table defaults without replacing borders, style, look or extension XML. */
|
|
7
7
|
export declare function patchTableMargins(doc: XmlDocument, table: Table, node: XmlElement, base?: Table): void;
|
|
8
|
+
/** Changes individual cell overrides; deleting an override restores table/default inheritance. */
|
|
9
|
+
export declare function patchCellMargins(doc: XmlDocument, tc: XmlElement, next: TableCellMargins | undefined, base: TableCellMargins | undefined): void;
|
|
8
10
|
/**
|
|
9
11
|
* Changes only the cell border sides that differ from `base`, keeping every other `tcPr` child
|
|
10
12
|
* (width, shading, margins, extensions) and untouched sides exactly as they were.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"write-table-properties.d.ts","sourceRoot":"","sources":["../../src/docx/write-table-properties.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACnD,OAAO,KAAK,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"write-table-properties.d.ts","sourceRoot":"","sources":["../../src/docx/write-table-properties.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACnD,OAAO,KAAK,EAAE,YAAY,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAK3F,OAAO,EAA0B,KAAK,WAAW,EAAE,KAAK,UAAU,EAAE,MAAM,UAAU,CAAC;AAwCrF,0FAA0F;AAC1F,wBAAgB,kBAAkB,CACjC,GAAG,EAAE,WAAW,EAChB,EAAE,EAAE,UAAU,EACd,IAAI,EAAE,kBAAkB,GAAG,SAAS,EACpC,IAAI,EAAE,kBAAkB,GAAG,SAAS,GAClC,IAAI,CAmBN;AAED,sFAAsF;AACtF,wBAAgB,iBAAiB,CAChC,GAAG,EAAE,WAAW,EAChB,KAAK,EAAE,KAAK,EACZ,IAAI,EAAE,UAAU,EAChB,IAAI,CAAC,EAAE,KAAK,GACV,IAAI,CAUN;AAyBD,kGAAkG;AAClG,wBAAgB,gBAAgB,CAC/B,GAAG,EAAE,WAAW,EAChB,EAAE,EAAE,UAAU,EACd,IAAI,EAAE,gBAAgB,GAAG,SAAS,EAClC,IAAI,EAAE,gBAAgB,GAAG,SAAS,GAChC,IAAI,CAEN;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAC/B,GAAG,EAAE,WAAW,EAChB,EAAE,EAAE,UAAU,EACd,IAAI,EAAE,YAAY,GAAG,SAAS,EAC9B,IAAI,EAAE,YAAY,GAAG,SAAS,GAC5B,IAAI,CA0BN;AAED,iGAAiG;AACjG,wBAAgB,gBAAgB,CAC/B,GAAG,EAAE,WAAW,EAChB,EAAE,EAAE,UAAU,EACd,IAAI,EAAE,SAAS,EACf,IAAI,CAAC,EAAE,SAAS,GACd,IAAI,CAmBN"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"write-table.d.ts","sourceRoot":"","sources":["../../src/docx/write-table.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,KAAK,EAAa,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"write-table.d.ts","sourceRoot":"","sources":["../../src/docx/write-table.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,KAAK,EAAa,MAAM,YAAY,CAAC;AAQ9D,OAAO,EAMN,KAAK,WAAW,EAChB,KAAK,UAAU,EACf,MAAM,UAAU,CAAC;AAElB,KAAK,eAAe,GAAG,CACtB,GAAG,EAAE,WAAW,EAChB,SAAS,EAAE,SAAS,EACpB,IAAI,EAAE,UAAU,EAChB,IAAI,CAAC,EAAE,SAAS,KACZ,UAAU,CAAC;AAChB,KAAK,WAAW,GAAG,CAClB,GAAG,EAAE,WAAW,EAChB,MAAM,EAAE,UAAU,EAClB,GAAG,EAAE,UAAU,EAAE,EACjB,IAAI,EAAE,UAAU,EAAE,KACd,IAAI,CAAC;AAEV,iGAAiG;AACjG,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,UAAU,GAAG,OAAO,CAiChE;AAwDD,wBAAgB,UAAU,CACzB,GAAG,EAAE,WAAW,EAChB,KAAK,EAAE,KAAK,EACZ,IAAI,EAAE,UAAU,EAChB,IAAI,EAAE,KAAK,GAAG,SAAS,EACvB,cAAc,EAAE,eAAe,EAC/B,YAAY,EAAE,WAAW,GACvB,UAAU,CAuHZ"}
|