@beyondwork/docx-react-component 1.0.128 → 1.0.130
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/dist/api/public-types.cjs +809 -78
- package/dist/api/public-types.d.cts +2 -2
- package/dist/api/public-types.d.ts +2 -2
- package/dist/api/public-types.js +4 -4
- package/dist/api/v3.cjs +2059 -402
- package/dist/api/v3.d.cts +3 -3
- package/dist/api/v3.d.ts +3 -3
- package/dist/api/v3.js +13 -13
- package/dist/{canonical-document-CXCFCbAz.d.cts → canonical-document-BMtONpgf.d.cts} +6 -0
- package/dist/{canonical-document-CXCFCbAz.d.ts → canonical-document-BMtONpgf.d.ts} +6 -0
- package/dist/{chunk-MWSBGJQO.js → chunk-35RHOE6I.js} +105 -4
- package/dist/{chunk-2QL5DAKF.js → chunk-3YCQM2RV.js} +6 -6
- package/dist/{chunk-ESJ2MES5.js → chunk-4YCWECLZ.js} +1 -1
- package/dist/{chunk-4EENH4FG.js → chunk-6TBLDBCL.js} +1 -1
- package/dist/{chunk-XRACP43Q.js → chunk-7G5GR3VV.js} +469 -32
- package/dist/{chunk-CXSYRB37.js → chunk-A3GSNB4G.js} +183 -55
- package/dist/{chunk-5DGKFNQT.js → chunk-A66ZVUAT.js} +150 -1
- package/dist/{chunk-YIYM4ZAP.js → chunk-CI2TD3T4.js} +1 -1
- package/dist/{chunk-TQDQU2E3.js → chunk-DGA7M77X.js} +2 -2
- package/dist/{chunk-EB6M3GE6.js → chunk-FM4K4XFJ.js} +100 -97
- package/dist/{chunk-D5HYZQTG.js → chunk-HYHCRMR7.js} +1 -1
- package/dist/{chunk-6F5QW44A.js → chunk-KNHMXKC6.js} +2 -2
- package/dist/{chunk-4YJVRIUB.js → chunk-M7YRJX6V.js} +61 -29
- package/dist/{chunk-KFCQYZXR.js → chunk-OVLZQ6FZ.js} +61 -0
- package/dist/{chunk-BYSRJ4FE.js → chunk-PHMWH23E.js} +1 -1
- package/dist/{chunk-ZDOAUP3V.js → chunk-Q7Y57KOK.js} +2 -2
- package/dist/{chunk-LZVBNDGU.js → chunk-QXKQPUOM.js} +3 -3
- package/dist/{chunk-CX42VC67.js → chunk-SYQWQ6FE.js} +1 -1
- package/dist/{chunk-KV435YXO.js → chunk-T5YYFDZB.js} +1 -1
- package/dist/{chunk-YHZHPXDB.js → chunk-THVM6EP5.js} +419 -24
- package/dist/{chunk-V6XVZFFH.js → chunk-VRKK2CSZ.js} +111 -90
- package/dist/{chunk-OL2UEHRP.js → chunk-WUDSNHWF.js} +1 -1
- package/dist/{chunk-LCYYR57Q.js → chunk-WZDKNF37.js} +666 -107
- package/dist/{chunk-6EROGFUF.js → chunk-YLL7MF5C.js} +444 -131
- package/dist/{chunk-YD2JE54B.js → chunk-ZVC23LKV.js} +1 -1
- package/dist/compare.cjs +100 -97
- package/dist/compare.d.cts +1 -1
- package/dist/compare.d.ts +1 -1
- package/dist/compare.js +3 -3
- package/dist/core/commands/formatting-commands.d.cts +2 -2
- package/dist/core/commands/formatting-commands.d.ts +2 -2
- package/dist/core/commands/image-commands.cjs +182 -54
- package/dist/core/commands/image-commands.d.cts +2 -2
- package/dist/core/commands/image-commands.d.ts +2 -2
- package/dist/core/commands/image-commands.js +5 -5
- package/dist/core/commands/section-layout-commands.d.cts +2 -2
- package/dist/core/commands/section-layout-commands.d.ts +2 -2
- package/dist/core/commands/style-commands.d.cts +2 -2
- package/dist/core/commands/style-commands.d.ts +2 -2
- package/dist/core/commands/table-structure-commands.cjs +182 -54
- package/dist/core/commands/table-structure-commands.d.cts +2 -2
- package/dist/core/commands/table-structure-commands.d.ts +2 -2
- package/dist/core/commands/table-structure-commands.js +4 -4
- package/dist/core/commands/text-commands.cjs +182 -54
- package/dist/core/commands/text-commands.d.cts +2 -2
- package/dist/core/commands/text-commands.d.ts +2 -2
- package/dist/core/commands/text-commands.js +5 -5
- package/dist/core/selection/mapping.d.cts +2 -2
- package/dist/core/selection/mapping.d.ts +2 -2
- package/dist/core/state/editor-state.d.cts +2 -2
- package/dist/core/state/editor-state.d.ts +2 -2
- package/dist/index.cjs +2765 -557
- package/dist/index.d.cts +5 -5
- package/dist/index.d.ts +5 -5
- package/dist/index.js +52 -28
- package/dist/io/docx-session.cjs +267 -211
- package/dist/io/docx-session.d.cts +4 -4
- package/dist/io/docx-session.d.ts +4 -4
- package/dist/io/docx-session.js +6 -6
- package/dist/legal.cjs +9 -20
- package/dist/legal.d.cts +1 -1
- package/dist/legal.d.ts +1 -1
- package/dist/legal.js +3 -3
- package/dist/{loader-19ct2Be0.d.ts → loader-B-aL5HGD.d.ts} +3 -3
- package/dist/{loader-CoXQ2wGd.d.cts → loader-DiY_ZgKl.d.cts} +3 -3
- package/dist/{measurement-backend-canvas-Q3MJMEYX.js → measurement-backend-canvas-F7ZYDACK.js} +1 -1
- package/dist/{public-types-B-CskQen.d.cts → public-types-DyqnxxO9.d.ts} +252 -2
- package/dist/{public-types-7KZsNGE2.d.ts → public-types-gvubspUI.d.cts} +252 -2
- package/dist/public-types.cjs +809 -78
- package/dist/public-types.d.cts +2 -2
- package/dist/public-types.d.ts +2 -2
- package/dist/public-types.js +4 -4
- package/dist/runtime/collab.d.cts +3 -3
- package/dist/runtime/collab.d.ts +3 -3
- package/dist/runtime/document-runtime.cjs +1887 -313
- package/dist/runtime/document-runtime.d.cts +2 -2
- package/dist/runtime/document-runtime.d.ts +2 -2
- package/dist/runtime/document-runtime.js +17 -17
- package/dist/{session-B5015J4v.d.cts → session-BUN6B-Vj.d.cts} +3 -3
- package/dist/{session-C2i8-d6v.d.ts → session-CDB0hohT.d.ts} +3 -3
- package/dist/session.cjs +267 -211
- package/dist/session.d.cts +5 -5
- package/dist/session.d.ts +5 -5
- package/dist/session.js +7 -7
- package/dist/tailwind.cjs +809 -78
- package/dist/tailwind.d.cts +2 -2
- package/dist/tailwind.d.ts +2 -2
- package/dist/tailwind.js +8 -8
- package/dist/{types-DNhN0WeN.d.cts → types-C4bz3kDU.d.cts} +2 -2
- package/dist/{types-yvrQuGX9.d.ts → types-VWH6CRvG.d.ts} +2 -2
- package/dist/ui-tailwind/editor-surface/search-plugin.d.cts +3 -3
- package/dist/ui-tailwind/editor-surface/search-plugin.d.ts +3 -3
- package/dist/ui-tailwind/editor-surface/search-plugin.js +5 -5
- package/dist/ui-tailwind.cjs +809 -78
- package/dist/ui-tailwind.d.cts +3 -3
- package/dist/ui-tailwind.d.ts +3 -3
- package/dist/ui-tailwind.js +8 -8
- package/package.json +1 -1
|
@@ -1380,26 +1380,35 @@ function buildParagraphPropertiesXml(paragraph) {
|
|
|
1380
1380
|
if (frameXml) children.push(frameXml);
|
|
1381
1381
|
}
|
|
1382
1382
|
pushOnOffParagraphProperty(children, "widowControl", paragraph.widowControl);
|
|
1383
|
-
if (paragraph.outlineLevel !== void 0) {
|
|
1384
|
-
children.push(`<w:outlineLvl w:val="${paragraph.outlineLevel}"/>`);
|
|
1385
|
-
}
|
|
1386
1383
|
if (paragraph.numbering) {
|
|
1387
1384
|
children.push(serializeParagraphNumberingProperties(paragraph.numbering));
|
|
1388
1385
|
}
|
|
1386
|
+
pushOnOffParagraphProperty(children, "suppressLineNumbers", paragraph.suppressLineNumbers);
|
|
1387
|
+
if (paragraph.borders) {
|
|
1388
|
+
const bordersXml = serializeParagraphBorders(paragraph.borders);
|
|
1389
|
+
if (bordersXml) children.push(bordersXml);
|
|
1390
|
+
}
|
|
1391
|
+
if (paragraph.shading) {
|
|
1392
|
+
const shadingXml = serializeParagraphShading(paragraph.shading);
|
|
1393
|
+
if (shadingXml) children.push(shadingXml);
|
|
1394
|
+
}
|
|
1395
|
+
if (paragraph.tabStops && paragraph.tabStops.length > 0) {
|
|
1396
|
+
const tabsXml = paragraph.tabStops.map((tab) => {
|
|
1397
|
+
const leaderAttr = tab.leader ? ` w:leader="${escapeXmlAttribute2(tab.leader)}"` : "";
|
|
1398
|
+
return `<w:tab w:val="${escapeXmlAttribute2(tab.align)}" w:pos="${twip(tab.position)}"${leaderAttr}/>`;
|
|
1399
|
+
}).join("");
|
|
1400
|
+
children.push(`<w:tabs>${tabsXml}</w:tabs>`);
|
|
1401
|
+
}
|
|
1402
|
+
pushOnOffParagraphProperty(children, "bidi", paragraph.bidi);
|
|
1389
1403
|
if (paragraph.spacing) {
|
|
1390
1404
|
const s = paragraph.spacing;
|
|
1391
1405
|
const attrs = [];
|
|
1392
1406
|
if (s.before !== void 0) attrs.push(`w:before="${twip(s.before)}"`);
|
|
1393
1407
|
if (s.after !== void 0) attrs.push(`w:after="${twip(s.after)}"`);
|
|
1394
1408
|
if (s.line !== void 0) attrs.push(`w:line="${twip(s.line)}"`);
|
|
1395
|
-
if (s.lineRule !== void 0) attrs.push(`w:lineRule="${s.lineRule}"`);
|
|
1409
|
+
if (s.lineRule !== void 0) attrs.push(`w:lineRule="${escapeXmlAttribute2(s.lineRule)}"`);
|
|
1396
1410
|
if (attrs.length > 0) children.push(`<w:spacing ${attrs.join(" ")}/>`);
|
|
1397
1411
|
}
|
|
1398
|
-
if (paragraph.contextualSpacing === true) {
|
|
1399
|
-
children.push("<w:contextualSpacing/>");
|
|
1400
|
-
} else if (paragraph.contextualSpacing === false) {
|
|
1401
|
-
children.push(`<w:contextualSpacing w:val="false"/>`);
|
|
1402
|
-
}
|
|
1403
1412
|
if (paragraph.indentation) {
|
|
1404
1413
|
const ind = paragraph.indentation;
|
|
1405
1414
|
const attrs = [];
|
|
@@ -1409,33 +1418,20 @@ function buildParagraphPropertiesXml(paragraph) {
|
|
|
1409
1418
|
if (ind.hanging !== void 0) attrs.push(`w:hanging="${twip(ind.hanging)}"`);
|
|
1410
1419
|
if (attrs.length > 0) children.push(`<w:ind ${attrs.join(" ")}/>`);
|
|
1411
1420
|
}
|
|
1412
|
-
if (paragraph.
|
|
1413
|
-
children.push(
|
|
1421
|
+
if (paragraph.contextualSpacing === true) {
|
|
1422
|
+
children.push("<w:contextualSpacing/>");
|
|
1423
|
+
} else if (paragraph.contextualSpacing === false) {
|
|
1424
|
+
children.push(`<w:contextualSpacing w:val="false"/>`);
|
|
1414
1425
|
}
|
|
1415
|
-
if (paragraph.
|
|
1416
|
-
|
|
1417
|
-
if (bordersXml) {
|
|
1418
|
-
children.push(bordersXml);
|
|
1419
|
-
}
|
|
1426
|
+
if (paragraph.alignment) {
|
|
1427
|
+
children.push(`<w:jc w:val="${escapeXmlAttribute2(paragraph.alignment)}"/>`);
|
|
1420
1428
|
}
|
|
1421
|
-
if (paragraph.
|
|
1422
|
-
|
|
1423
|
-
if (shadingXml) {
|
|
1424
|
-
children.push(shadingXml);
|
|
1425
|
-
}
|
|
1429
|
+
if (paragraph.outlineLevel !== void 0) {
|
|
1430
|
+
children.push(`<w:outlineLvl w:val="${paragraph.outlineLevel}"/>`);
|
|
1426
1431
|
}
|
|
1427
|
-
pushOnOffParagraphProperty(children, "bidi", paragraph.bidi);
|
|
1428
|
-
pushOnOffParagraphProperty(children, "suppressLineNumbers", paragraph.suppressLineNumbers);
|
|
1429
1432
|
if (paragraph.cnfStyle) {
|
|
1430
1433
|
children.push(`<w:cnfStyle w:val="${escapeXmlAttribute2(paragraph.cnfStyle)}"/>`);
|
|
1431
1434
|
}
|
|
1432
|
-
if (paragraph.tabStops && paragraph.tabStops.length > 0) {
|
|
1433
|
-
const tabsXml = paragraph.tabStops.map((tab) => {
|
|
1434
|
-
const leaderAttr = tab.leader ? ` w:leader="${tab.leader}"` : "";
|
|
1435
|
-
return `<w:tab w:val="${tab.align}" w:pos="${twip(tab.position)}"${leaderAttr}/>`;
|
|
1436
|
-
}).join("");
|
|
1437
|
-
children.push(`<w:tabs>${tabsXml}</w:tabs>`);
|
|
1438
|
-
}
|
|
1439
1435
|
if (children.length === 0) return "";
|
|
1440
1436
|
return `<w:pPr>${children.join("")}</w:pPr>`;
|
|
1441
1437
|
}
|
|
@@ -2000,79 +1996,86 @@ function serializeRunProperties(marks) {
|
|
|
2000
1996
|
if (!marks || marks.length === 0) {
|
|
2001
1997
|
return "";
|
|
2002
1998
|
}
|
|
1999
|
+
const orderedTypes = [
|
|
2000
|
+
"fontFamily",
|
|
2001
|
+
"bold",
|
|
2002
|
+
"italic",
|
|
2003
|
+
"allCaps",
|
|
2004
|
+
"smallCaps",
|
|
2005
|
+
"strikethrough",
|
|
2006
|
+
"doubleStrikethrough",
|
|
2007
|
+
"shadow",
|
|
2008
|
+
"emboss",
|
|
2009
|
+
"imprint",
|
|
2010
|
+
"vanish",
|
|
2011
|
+
"textColor",
|
|
2012
|
+
"charSpacing",
|
|
2013
|
+
"kerning",
|
|
2014
|
+
"position",
|
|
2015
|
+
"fontSize",
|
|
2016
|
+
"highlight",
|
|
2017
|
+
"underline",
|
|
2018
|
+
"backgroundColor",
|
|
2019
|
+
"lang",
|
|
2020
|
+
"textFill"
|
|
2021
|
+
];
|
|
2003
2022
|
const markParts = [];
|
|
2004
|
-
for (const
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
case "italic":
|
|
2010
|
-
markParts.push("<w:i/>");
|
|
2011
|
-
break;
|
|
2012
|
-
case "underline":
|
|
2013
|
-
markParts.push(`<w:u w:val="single"/>`);
|
|
2014
|
-
break;
|
|
2015
|
-
case "strikethrough":
|
|
2016
|
-
markParts.push("<w:strike/>");
|
|
2017
|
-
break;
|
|
2018
|
-
case "doubleStrikethrough":
|
|
2019
|
-
markParts.push("<w:dstrike/>");
|
|
2020
|
-
break;
|
|
2021
|
-
case "vanish":
|
|
2022
|
-
markParts.push("<w:vanish/>");
|
|
2023
|
-
break;
|
|
2024
|
-
case "lang":
|
|
2025
|
-
markParts.push(`<w:lang w:val="${escapeXmlAttribute2(mark.val)}"/>`);
|
|
2026
|
-
break;
|
|
2027
|
-
case "highlight":
|
|
2028
|
-
markParts.push(`<w:highlight w:val="${escapeXmlAttribute2(mark.val)}"/>`);
|
|
2029
|
-
break;
|
|
2030
|
-
case "backgroundColor":
|
|
2031
|
-
markParts.push(
|
|
2032
|
-
`<w:shd w:val="clear" w:color="auto" w:fill="${escapeXmlAttribute2(mark.color)}"/>`
|
|
2033
|
-
);
|
|
2034
|
-
break;
|
|
2035
|
-
case "charSpacing":
|
|
2036
|
-
markParts.push(`<w:spacing w:val="${mark.val}"/>`);
|
|
2037
|
-
break;
|
|
2038
|
-
case "kerning":
|
|
2039
|
-
markParts.push(`<w:kern w:val="${mark.val}"/>`);
|
|
2040
|
-
break;
|
|
2041
|
-
case "emboss":
|
|
2042
|
-
markParts.push("<w:emboss/>");
|
|
2043
|
-
break;
|
|
2044
|
-
case "imprint":
|
|
2045
|
-
markParts.push("<w:imprint/>");
|
|
2046
|
-
break;
|
|
2047
|
-
case "shadow":
|
|
2048
|
-
markParts.push("<w:shadow/>");
|
|
2049
|
-
break;
|
|
2050
|
-
case "position":
|
|
2051
|
-
markParts.push(`<w:position w:val="${mark.val}"/>`);
|
|
2052
|
-
break;
|
|
2053
|
-
case "textFill":
|
|
2054
|
-
markParts.push(mark.xml);
|
|
2055
|
-
break;
|
|
2056
|
-
case "fontFamily":
|
|
2057
|
-
markParts.push(`<w:rFonts w:ascii="${escapeXmlAttribute2(mark.val)}" w:hAnsi="${escapeXmlAttribute2(mark.val)}"/>`);
|
|
2058
|
-
break;
|
|
2059
|
-
case "fontSize":
|
|
2060
|
-
markParts.push(`<w:sz w:val="${mark.val}"/>`);
|
|
2061
|
-
break;
|
|
2062
|
-
case "textColor":
|
|
2063
|
-
markParts.push(`<w:color w:val="${escapeXmlAttribute2(mark.color)}"/>`);
|
|
2064
|
-
break;
|
|
2065
|
-
case "smallCaps":
|
|
2066
|
-
markParts.push("<w:smallCaps/>");
|
|
2067
|
-
break;
|
|
2068
|
-
case "allCaps":
|
|
2069
|
-
markParts.push("<w:caps/>");
|
|
2070
|
-
break;
|
|
2023
|
+
for (const type of orderedTypes) {
|
|
2024
|
+
for (const mark of marks) {
|
|
2025
|
+
if (mark.type !== type) continue;
|
|
2026
|
+
const xml = serializeRunPropertyMark(mark);
|
|
2027
|
+
if (xml) markParts.push(xml);
|
|
2071
2028
|
}
|
|
2072
2029
|
}
|
|
2073
2030
|
const children = markParts.join("");
|
|
2074
2031
|
return children.length > 0 ? `<w:rPr>${children}</w:rPr>` : "";
|
|
2075
2032
|
}
|
|
2033
|
+
function serializeRunPropertyMark(mark) {
|
|
2034
|
+
switch (mark.type) {
|
|
2035
|
+
case "bold":
|
|
2036
|
+
return "<w:b/>";
|
|
2037
|
+
case "italic":
|
|
2038
|
+
return "<w:i/>";
|
|
2039
|
+
case "underline":
|
|
2040
|
+
return `<w:u w:val="single"/>`;
|
|
2041
|
+
case "strikethrough":
|
|
2042
|
+
return "<w:strike/>";
|
|
2043
|
+
case "doubleStrikethrough":
|
|
2044
|
+
return "<w:dstrike/>";
|
|
2045
|
+
case "vanish":
|
|
2046
|
+
return "<w:vanish/>";
|
|
2047
|
+
case "lang":
|
|
2048
|
+
return `<w:lang w:val="${escapeXmlAttribute2(mark.val)}"/>`;
|
|
2049
|
+
case "highlight":
|
|
2050
|
+
return `<w:highlight w:val="${escapeXmlAttribute2(mark.val)}"/>`;
|
|
2051
|
+
case "backgroundColor":
|
|
2052
|
+
return `<w:shd w:val="clear" w:color="auto" w:fill="${escapeXmlAttribute2(mark.color)}"/>`;
|
|
2053
|
+
case "charSpacing":
|
|
2054
|
+
return `<w:spacing w:val="${mark.val}"/>`;
|
|
2055
|
+
case "kerning":
|
|
2056
|
+
return `<w:kern w:val="${mark.val}"/>`;
|
|
2057
|
+
case "emboss":
|
|
2058
|
+
return "<w:emboss/>";
|
|
2059
|
+
case "imprint":
|
|
2060
|
+
return "<w:imprint/>";
|
|
2061
|
+
case "shadow":
|
|
2062
|
+
return "<w:shadow/>";
|
|
2063
|
+
case "position":
|
|
2064
|
+
return `<w:position w:val="${mark.val}"/>`;
|
|
2065
|
+
case "textFill":
|
|
2066
|
+
return mark.xml;
|
|
2067
|
+
case "fontFamily":
|
|
2068
|
+
return `<w:rFonts w:ascii="${escapeXmlAttribute2(mark.val)}" w:hAnsi="${escapeXmlAttribute2(mark.val)}"/>`;
|
|
2069
|
+
case "fontSize":
|
|
2070
|
+
return `<w:sz w:val="${mark.val}"/>`;
|
|
2071
|
+
case "textColor":
|
|
2072
|
+
return `<w:color w:val="${escapeXmlAttribute2(mark.color)}"/>`;
|
|
2073
|
+
case "smallCaps":
|
|
2074
|
+
return "<w:smallCaps/>";
|
|
2075
|
+
case "allCaps":
|
|
2076
|
+
return "<w:caps/>";
|
|
2077
|
+
}
|
|
2078
|
+
}
|
|
2076
2079
|
function requiresPreservedSpace(text) {
|
|
2077
2080
|
return /^\s/.test(text) || /\s$/.test(text) || text.includes(" ");
|
|
2078
2081
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
TextTransactionError
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-T5YYFDZB.js";
|
|
4
4
|
import {
|
|
5
5
|
replaceParagraphScope,
|
|
6
6
|
resolveParagraphScope
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-PHMWH23E.js";
|
|
8
8
|
import {
|
|
9
9
|
cloneParagraphProperties,
|
|
10
10
|
cloneStoryUnit,
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
createHeaderFooterStoryKey,
|
|
7
7
|
createNoteStoryKey,
|
|
8
8
|
sha256TextHex
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-A66ZVUAT.js";
|
|
10
10
|
import {
|
|
11
11
|
SCOPE_MARKER_BOOKMARK_PREFIX,
|
|
12
12
|
buildGrabBagSourceChildFromParsed,
|
|
@@ -1068,7 +1068,7 @@ function parseNumberingXml(xml, context) {
|
|
|
1068
1068
|
abstractDefinitions[abstractNumberingId] = {
|
|
1069
1069
|
abstractNumberingId,
|
|
1070
1070
|
...context?.partPath !== void 0 ? { sourceRef: createNumberingSourceRef(context.partPath, "abstractNum", rawId, childXmlPath) } : {},
|
|
1071
|
-
levels: readLevels(child),
|
|
1071
|
+
levels: readLevels(child, context, childXmlPath, rawId),
|
|
1072
1072
|
...nsid ? { nsid } : {},
|
|
1073
1073
|
...multiLevelType ? { multiLevelType } : {},
|
|
1074
1074
|
...tplc ? { tplc } : {},
|
|
@@ -1089,7 +1089,7 @@ function parseNumberingXml(xml, context) {
|
|
|
1089
1089
|
numberingInstanceId,
|
|
1090
1090
|
...context?.partPath !== void 0 ? { sourceRef: createNumberingSourceRef(context.partPath, "num", rawId, childXmlPath) } : {},
|
|
1091
1091
|
abstractNumberingId: toCanonicalAbstractNumberingId(rawAbstractId),
|
|
1092
|
-
overrides: readOverrides(child)
|
|
1092
|
+
overrides: readOverrides(child, context, childXmlPath, rawId)
|
|
1093
1093
|
};
|
|
1094
1094
|
break;
|
|
1095
1095
|
}
|
|
@@ -1110,6 +1110,16 @@ function createNumberingSourceRef(partPath, element, rawId, xmlPath) {
|
|
|
1110
1110
|
...xmlPath !== void 0 ? { xmlPath } : {}
|
|
1111
1111
|
};
|
|
1112
1112
|
}
|
|
1113
|
+
function createNumberingChildSourceRef(partPath, element, sourceIdSuffix, xmlPath) {
|
|
1114
|
+
if (partPath === void 0) return void 0;
|
|
1115
|
+
return {
|
|
1116
|
+
sourceId: `part:${partPath}#${sourceIdSuffix}`,
|
|
1117
|
+
partPath,
|
|
1118
|
+
storyKind: "numbering",
|
|
1119
|
+
element,
|
|
1120
|
+
...xmlPath !== void 0 ? { xmlPath } : {}
|
|
1121
|
+
};
|
|
1122
|
+
}
|
|
1113
1123
|
function readNumPicBullet(node, numPicBulletId, context, xmlPath) {
|
|
1114
1124
|
let widthEmu;
|
|
1115
1125
|
let heightEmu;
|
|
@@ -1186,18 +1196,29 @@ function toCanonicalAbstractNumberingId(value) {
|
|
|
1186
1196
|
function toCanonicalNumberingInstanceId(value) {
|
|
1187
1197
|
return value.startsWith("num:") ? value : `num:${value}`;
|
|
1188
1198
|
}
|
|
1189
|
-
function readLevels(abstractNode) {
|
|
1199
|
+
function readLevels(abstractNode, context, abstractXmlPath, rawAbstractId) {
|
|
1190
1200
|
const levels = [];
|
|
1201
|
+
let levelOrdinal = 0;
|
|
1191
1202
|
for (const child of abstractNode.children) {
|
|
1192
1203
|
if (child.type !== "element" || localName(child.name) !== "lvl") {
|
|
1193
1204
|
continue;
|
|
1194
1205
|
}
|
|
1206
|
+
levelOrdinal += 1;
|
|
1195
1207
|
const rawLevel = readStringAttr(child, "w:ilvl");
|
|
1196
1208
|
const level = rawLevel === void 0 ? void 0 : parseInteger(rawLevel);
|
|
1197
1209
|
if (level === void 0) {
|
|
1198
1210
|
continue;
|
|
1199
1211
|
}
|
|
1200
|
-
const definition = readLevelDefinition(
|
|
1212
|
+
const definition = readLevelDefinition(
|
|
1213
|
+
child,
|
|
1214
|
+
level,
|
|
1215
|
+
createNumberingChildSourceRef(
|
|
1216
|
+
context?.partPath,
|
|
1217
|
+
"lvl",
|
|
1218
|
+
`abstractNum:${rawAbstractId}:lvl:${level}`,
|
|
1219
|
+
`${abstractXmlPath}/lvl[${levelOrdinal}]`
|
|
1220
|
+
)
|
|
1221
|
+
);
|
|
1201
1222
|
if (!definition) {
|
|
1202
1223
|
continue;
|
|
1203
1224
|
}
|
|
@@ -1205,12 +1226,14 @@ function readLevels(abstractNode) {
|
|
|
1205
1226
|
}
|
|
1206
1227
|
return levels.sort((left, right) => left.level - right.level);
|
|
1207
1228
|
}
|
|
1208
|
-
function readOverrides(numNode) {
|
|
1229
|
+
function readOverrides(numNode, context, numXmlPath, rawNumId) {
|
|
1209
1230
|
const overrides = [];
|
|
1231
|
+
let overrideOrdinal = 0;
|
|
1210
1232
|
for (const child of numNode.children) {
|
|
1211
1233
|
if (child.type !== "element" || localName(child.name) !== "lvlOverride") {
|
|
1212
1234
|
continue;
|
|
1213
1235
|
}
|
|
1236
|
+
overrideOrdinal += 1;
|
|
1214
1237
|
const rawLevel = readStringAttr(child, "w:ilvl");
|
|
1215
1238
|
const level = rawLevel === void 0 ? void 0 : parseInteger(rawLevel);
|
|
1216
1239
|
if (level === void 0) {
|
|
@@ -1220,8 +1243,26 @@ function readOverrides(numNode) {
|
|
|
1220
1243
|
const rawStart = startOverrideNode ? readStringAttr(startOverrideNode, "w:val") : void 0;
|
|
1221
1244
|
const startAt = rawStart === void 0 ? void 0 : parseInteger(rawStart);
|
|
1222
1245
|
const levelDefinitionNode = findChildElementOptional(child, "lvl");
|
|
1223
|
-
const
|
|
1246
|
+
const overrideXmlPath = `${numXmlPath}/lvlOverride[${overrideOrdinal}]`;
|
|
1247
|
+
const levelDefinition = levelDefinitionNode ? readLevelOverrideDefinition(
|
|
1248
|
+
levelDefinitionNode,
|
|
1249
|
+
level,
|
|
1250
|
+
createNumberingChildSourceRef(
|
|
1251
|
+
context?.partPath,
|
|
1252
|
+
"lvl",
|
|
1253
|
+
`num:${rawNumId}:lvlOverride:${level}:lvl`,
|
|
1254
|
+
`${overrideXmlPath}/lvl[1]`
|
|
1255
|
+
)
|
|
1256
|
+
) : void 0;
|
|
1224
1257
|
overrides.push({
|
|
1258
|
+
...context?.partPath !== void 0 ? {
|
|
1259
|
+
sourceRef: createNumberingChildSourceRef(
|
|
1260
|
+
context.partPath,
|
|
1261
|
+
"lvlOverride",
|
|
1262
|
+
`num:${rawNumId}:lvlOverride:${level}`,
|
|
1263
|
+
overrideXmlPath
|
|
1264
|
+
)
|
|
1265
|
+
} : {},
|
|
1225
1266
|
level,
|
|
1226
1267
|
...startAt !== void 0 ? { startAt } : {},
|
|
1227
1268
|
...levelDefinition ? { levelDefinition } : {}
|
|
@@ -1229,7 +1270,7 @@ function readOverrides(numNode) {
|
|
|
1229
1270
|
}
|
|
1230
1271
|
return overrides.sort((left, right) => left.level - right.level);
|
|
1231
1272
|
}
|
|
1232
|
-
function readLevelDefinition(levelNode, fallbackLevel) {
|
|
1273
|
+
function readLevelDefinition(levelNode, fallbackLevel, sourceRef) {
|
|
1233
1274
|
const rawLevel = readStringAttr(levelNode, "w:ilvl");
|
|
1234
1275
|
const level = rawLevel === void 0 ? fallbackLevel : parseInteger(rawLevel);
|
|
1235
1276
|
if (level === void 0) {
|
|
@@ -1259,6 +1300,7 @@ function readLevelDefinition(levelNode, fallbackLevel) {
|
|
|
1259
1300
|
const lvlPicBulletNode = findChildElementOptional(levelNode, "lvlPicBulletId");
|
|
1260
1301
|
const picBulletId = lvlPicBulletNode ? readStringAttr(lvlPicBulletNode, "w:val") : void 0;
|
|
1261
1302
|
return {
|
|
1303
|
+
...sourceRef ? { sourceRef } : {},
|
|
1262
1304
|
level,
|
|
1263
1305
|
format,
|
|
1264
1306
|
text,
|
|
@@ -1272,7 +1314,7 @@ function readLevelDefinition(levelNode, fallbackLevel) {
|
|
|
1272
1314
|
...picBulletId !== void 0 ? { picBulletId } : {}
|
|
1273
1315
|
};
|
|
1274
1316
|
}
|
|
1275
|
-
function readLevelOverrideDefinition(levelNode, fallbackLevel) {
|
|
1317
|
+
function readLevelOverrideDefinition(levelNode, fallbackLevel, sourceRef) {
|
|
1276
1318
|
const rawLevel = readStringAttr(levelNode, "w:ilvl");
|
|
1277
1319
|
const level = rawLevel === void 0 ? fallbackLevel : parseInteger(rawLevel);
|
|
1278
1320
|
if (level === void 0) {
|
|
@@ -1306,6 +1348,7 @@ function readLevelOverrideDefinition(levelNode, fallbackLevel) {
|
|
|
1306
1348
|
return void 0;
|
|
1307
1349
|
}
|
|
1308
1350
|
return {
|
|
1351
|
+
...sourceRef ? { sourceRef } : {},
|
|
1309
1352
|
level,
|
|
1310
1353
|
...startAt !== void 0 ? { startAt } : {},
|
|
1311
1354
|
...format !== void 0 ? { format } : {},
|
|
@@ -1494,8 +1537,7 @@ function parseInteger(value) {
|
|
|
1494
1537
|
// src/io/ooxml/parse-bookmark-references.ts
|
|
1495
1538
|
var HYPERLINK_ANCHOR_RE = /<(?:\w+:)?hyperlink\b[^>]*\bw:anchor\s*=\s*"([^"]*)"/gi;
|
|
1496
1539
|
var INSTR_TEXT_RE = /<(?:\w+:)?instrText\b[^>]*>([\s\S]*?)<\/(?:\w+:)?instrText>/gi;
|
|
1497
|
-
var
|
|
1498
|
-
var FLD_SIMPLE_INSTR_SINGLE_RE = /<(?:\w+:)?fldSimple\b[^>]*?\b(?:w:)?instr\s*=\s*'([^']*)'/gi;
|
|
1540
|
+
var FLD_SIMPLE_INSTR_RE = /<(?:\w+:)?fldSimple\b[^>]*\bw:instr\s*=\s*(["'])([\s\S]*?)\1/gi;
|
|
1499
1541
|
var TOC_FIELD_RE = /\bTOC\b/;
|
|
1500
1542
|
var REFLIKE_FIELD_RE = /\b(?:HYPERLINK|REF|PAGEREF|NOTEREF)\s+([A-Za-z0-9_:.\-]+)/g;
|
|
1501
1543
|
var DATA_BINDING_RE = /<(?:\w+:)?dataBinding\b/i;
|
|
@@ -1514,21 +1556,14 @@ function scanBookmarkReferences(documentXml, callerAllowlist = []) {
|
|
|
1514
1556
|
}
|
|
1515
1557
|
INSTR_TEXT_RE.lastIndex = 0;
|
|
1516
1558
|
while ((m = INSTR_TEXT_RE.exec(documentXml)) !== null) {
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
retainAllToc = true;
|
|
1520
|
-
});
|
|
1521
|
-
}
|
|
1522
|
-
FLD_SIMPLE_INSTR_DOUBLE_RE.lastIndex = 0;
|
|
1523
|
-
while ((m = FLD_SIMPLE_INSTR_DOUBLE_RE.exec(documentXml)) !== null) {
|
|
1524
|
-
scanFieldInstruction(decodeXmlAttribute(m[1] ?? ""), retained, () => {
|
|
1525
|
-
retainAllToc = true;
|
|
1559
|
+
retainInstructionReferences(m[1] ?? "", retained, (value) => {
|
|
1560
|
+
retainAllToc = retainAllToc || value;
|
|
1526
1561
|
});
|
|
1527
1562
|
}
|
|
1528
|
-
|
|
1529
|
-
while ((m =
|
|
1530
|
-
|
|
1531
|
-
retainAllToc =
|
|
1563
|
+
FLD_SIMPLE_INSTR_RE.lastIndex = 0;
|
|
1564
|
+
while ((m = FLD_SIMPLE_INSTR_RE.exec(documentXml)) !== null) {
|
|
1565
|
+
retainInstructionReferences(m[2] ?? "", retained, (value) => {
|
|
1566
|
+
retainAllToc = retainAllToc || value;
|
|
1532
1567
|
});
|
|
1533
1568
|
}
|
|
1534
1569
|
retainRevisionBoundedBookmarks(documentXml, retained);
|
|
@@ -1538,17 +1573,14 @@ function scanBookmarkReferences(documentXml, callerAllowlist = []) {
|
|
|
1538
1573
|
retainAll
|
|
1539
1574
|
};
|
|
1540
1575
|
}
|
|
1541
|
-
function
|
|
1542
|
-
if (TOC_FIELD_RE.test(instrText))
|
|
1576
|
+
function retainInstructionReferences(instrText, retained, setRetainAllToc) {
|
|
1577
|
+
if (TOC_FIELD_RE.test(instrText)) setRetainAllToc(true);
|
|
1543
1578
|
REFLIKE_FIELD_RE.lastIndex = 0;
|
|
1544
1579
|
let r;
|
|
1545
1580
|
while ((r = REFLIKE_FIELD_RE.exec(instrText)) !== null) {
|
|
1546
1581
|
if (r[1]) retained.add(r[1]);
|
|
1547
1582
|
}
|
|
1548
1583
|
}
|
|
1549
|
-
function decodeXmlAttribute(value) {
|
|
1550
|
-
return value.replace(/"/g, '"').replace(/'/g, "'").replace(/</g, "<").replace(/>/g, ">").replace(/&/g, "&");
|
|
1551
|
-
}
|
|
1552
1584
|
function retainRevisionBoundedBookmarks(documentXml, retained) {
|
|
1553
1585
|
const starts = /* @__PURE__ */ new Map();
|
|
1554
1586
|
BOOKMARK_START_RE.lastIndex = 0;
|
|
@@ -24,6 +24,43 @@ var DEFAULT_FONT_AVG_CHAR_WIDTH = 5.5;
|
|
|
24
24
|
var DEFAULT_FONT_SIZE_HALF_POINTS = 24;
|
|
25
25
|
var DEFAULT_LINE_HEIGHT_FACTOR = 1.15;
|
|
26
26
|
var TWIPS_PER_POINT = 20;
|
|
27
|
+
function createLayoutReadyFormattingSnapshot(formatting, runs = /* @__PURE__ */ new Map()) {
|
|
28
|
+
const snapshot = {
|
|
29
|
+
version: 1,
|
|
30
|
+
paragraph: {
|
|
31
|
+
spacingBefore: formatting.spacingBefore,
|
|
32
|
+
spacingAfter: formatting.spacingAfter,
|
|
33
|
+
lineHeight: formatting.lineHeight,
|
|
34
|
+
lineRule: formatting.lineRule,
|
|
35
|
+
indentLeft: formatting.indentLeft,
|
|
36
|
+
indentRight: formatting.indentRight,
|
|
37
|
+
firstLineIndent: formatting.firstLineIndent,
|
|
38
|
+
hangingIndent: formatting.hangingIndent,
|
|
39
|
+
fontSizeHalfPoints: formatting.fontSizeHalfPoints,
|
|
40
|
+
averageCharWidthTwips: formatting.averageCharWidthTwips,
|
|
41
|
+
tabStops: formatting.tabStops.map((tab) => ({ ...tab })),
|
|
42
|
+
defaultTabInterval: formatting.defaultTabInterval,
|
|
43
|
+
keepNext: formatting.keepNext,
|
|
44
|
+
keepLines: formatting.keepLines,
|
|
45
|
+
pageBreakBefore: formatting.pageBreakBefore,
|
|
46
|
+
widowControl: formatting.widowControl,
|
|
47
|
+
contextualSpacing: formatting.contextualSpacing,
|
|
48
|
+
...formatting.numberingMarkerBox ? { numberingMarkerBox: { ...formatting.numberingMarkerBox } } : {}
|
|
49
|
+
},
|
|
50
|
+
runs: Array.from(runs.entries()).map(([runId, run]) => ({
|
|
51
|
+
runId,
|
|
52
|
+
...run.fontFamily ? { fontFamily: run.fontFamily } : {},
|
|
53
|
+
...typeof run.fontSizeHalfPoints === "number" ? { fontSizeHalfPoints: run.fontSizeHalfPoints } : {},
|
|
54
|
+
bold: Boolean(run.bold),
|
|
55
|
+
italic: Boolean(run.italic),
|
|
56
|
+
verticalAlign: run.verticalAlign ?? "baseline"
|
|
57
|
+
})).sort((a, b) => a.runId.localeCompare(b.runId))
|
|
58
|
+
};
|
|
59
|
+
return {
|
|
60
|
+
...snapshot,
|
|
61
|
+
hash: hashStable(snapshot)
|
|
62
|
+
};
|
|
63
|
+
}
|
|
27
64
|
function resolveBlockFormatting(block, defaultTabInterval = 720, themeFonts) {
|
|
28
65
|
if (block.kind !== "paragraph") {
|
|
29
66
|
return null;
|
|
@@ -266,6 +303,29 @@ function buildRunFormattingMap(block) {
|
|
|
266
303
|
}
|
|
267
304
|
return runs;
|
|
268
305
|
}
|
|
306
|
+
function hashStable(value) {
|
|
307
|
+
return fnv1a(stableStringify(value)).toString(36);
|
|
308
|
+
}
|
|
309
|
+
function stableStringify(value) {
|
|
310
|
+
if (value === null || typeof value !== "object") return JSON.stringify(value);
|
|
311
|
+
if (Array.isArray(value)) {
|
|
312
|
+
return `[${value.map((item) => stableStringify(item)).join(",")}]`;
|
|
313
|
+
}
|
|
314
|
+
if (value instanceof Map) {
|
|
315
|
+
return stableStringify(Array.from(value.entries()));
|
|
316
|
+
}
|
|
317
|
+
const object = value;
|
|
318
|
+
const keys = Object.keys(object).filter((key) => object[key] !== void 0 && typeof object[key] !== "function").sort();
|
|
319
|
+
return `{${keys.map((key) => `${JSON.stringify(key)}:${stableStringify(object[key])}`).join(",")}}`;
|
|
320
|
+
}
|
|
321
|
+
function fnv1a(input) {
|
|
322
|
+
let hash = 2166136261;
|
|
323
|
+
for (let i = 0; i < input.length; i += 1) {
|
|
324
|
+
hash ^= input.charCodeAt(i);
|
|
325
|
+
hash = Math.imul(hash, 16777619);
|
|
326
|
+
}
|
|
327
|
+
return hash >>> 0;
|
|
328
|
+
}
|
|
269
329
|
|
|
270
330
|
// src/runtime/layout/measurement-backend-empirical.ts
|
|
271
331
|
var MIN_BLOCK_HEIGHT_TWIPS = 240;
|
|
@@ -682,6 +742,7 @@ function createCanvasBackend(fontLoader) {
|
|
|
682
742
|
}
|
|
683
743
|
|
|
684
744
|
export {
|
|
745
|
+
createLayoutReadyFormattingSnapshot,
|
|
685
746
|
resolveBlockFormatting,
|
|
686
747
|
resolveTextWidth,
|
|
687
748
|
resolveCharsPerLine,
|
|
@@ -3,12 +3,12 @@ import {
|
|
|
3
3
|
createNoopStructuralMutation,
|
|
4
4
|
findTableCellParagraphSelection,
|
|
5
5
|
findTopLevelParagraphSelectionNearBlock
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-PHMWH23E.js";
|
|
7
7
|
import {
|
|
8
8
|
collectEditableTargetRefs,
|
|
9
9
|
collectStoryBlockContexts,
|
|
10
10
|
createHeaderFooterStoryKey
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-A66ZVUAT.js";
|
|
12
12
|
import {
|
|
13
13
|
createDetachedAnchor,
|
|
14
14
|
createNodeAnchor,
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
} from "./chunk-Y4XZCMCS.js";
|
|
4
4
|
import {
|
|
5
5
|
applyTextTransaction
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-T5YYFDZB.js";
|
|
7
7
|
import {
|
|
8
8
|
createInsertedTableBlock,
|
|
9
9
|
createNoopStructuralMutation,
|
|
@@ -11,11 +11,11 @@ import {
|
|
|
11
11
|
replaceParagraphScope,
|
|
12
12
|
resolveInsertedTableStyleId,
|
|
13
13
|
resolveParagraphScope
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-PHMWH23E.js";
|
|
15
15
|
import {
|
|
16
16
|
NO_EDITABLE_TARGETS_INDEX,
|
|
17
17
|
createEditorSurfaceSnapshot
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-A3GSNB4G.js";
|
|
19
19
|
import {
|
|
20
20
|
createSelectionSnapshot
|
|
21
21
|
} from "./chunk-OYGMRRR7.js";
|