@beyondwork/docx-react-component 1.0.129 → 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.
Files changed (102) hide show
  1. package/dist/api/public-types.cjs +595 -18
  2. package/dist/api/public-types.d.cts +1 -1
  3. package/dist/api/public-types.d.ts +1 -1
  4. package/dist/api/public-types.js +4 -4
  5. package/dist/api/v3.cjs +1164 -332
  6. package/dist/api/v3.d.cts +2 -2
  7. package/dist/api/v3.d.ts +2 -2
  8. package/dist/api/v3.js +13 -13
  9. package/dist/{chunk-OTQIW2TC.js → chunk-35RHOE6I.js} +105 -4
  10. package/dist/{chunk-PGKUJZXV.js → chunk-3YCQM2RV.js} +6 -6
  11. package/dist/{chunk-JJGVE5J7.js → chunk-4YCWECLZ.js} +1 -1
  12. package/dist/{chunk-EZKJXIPH.js → chunk-6TBLDBCL.js} +1 -1
  13. package/dist/{chunk-SKPTKQHF.js → chunk-7G5GR3VV.js} +122 -23
  14. package/dist/{chunk-HUIHBBAQ.js → chunk-A3GSNB4G.js} +17 -6
  15. package/dist/{chunk-5DGKFNQT.js → chunk-A66ZVUAT.js} +150 -1
  16. package/dist/{chunk-YIYM4ZAP.js → chunk-CI2TD3T4.js} +1 -1
  17. package/dist/{chunk-63FYIGCT.js → chunk-DGA7M77X.js} +2 -2
  18. package/dist/{chunk-EB6M3GE6.js → chunk-FM4K4XFJ.js} +100 -97
  19. package/dist/{chunk-VNLDQJ47.js → chunk-HYHCRMR7.js} +1 -1
  20. package/dist/{chunk-DJU2W4E4.js → chunk-KNHMXKC6.js} +2 -2
  21. package/dist/{chunk-Q3QYGKFE.js → chunk-M7YRJX6V.js} +10 -21
  22. package/dist/{chunk-KFCQYZXR.js → chunk-OVLZQ6FZ.js} +61 -0
  23. package/dist/{chunk-W34X3KBR.js → chunk-PHMWH23E.js} +1 -1
  24. package/dist/{chunk-DDN2AIGE.js → chunk-Q7Y57KOK.js} +2 -2
  25. package/dist/{chunk-LJH64PV3.js → chunk-QXKQPUOM.js} +3 -3
  26. package/dist/{chunk-CX42VC67.js → chunk-SYQWQ6FE.js} +1 -1
  27. package/dist/{chunk-5DSHUYSY.js → chunk-T5YYFDZB.js} +1 -1
  28. package/dist/{chunk-RMRTQGW3.js → chunk-THVM6EP5.js} +371 -13
  29. package/dist/{chunk-XMHSGPLN.js → chunk-VRKK2CSZ.js} +111 -90
  30. package/dist/{chunk-OL2UEHRP.js → chunk-WUDSNHWF.js} +1 -1
  31. package/dist/{chunk-XQCAMKIQ.js → chunk-WZDKNF37.js} +250 -106
  32. package/dist/{chunk-PRAZBHNF.js → chunk-YLL7MF5C.js} +15 -15
  33. package/dist/{chunk-YZDZ4FGR.js → chunk-ZVC23LKV.js} +1 -1
  34. package/dist/compare.cjs +100 -97
  35. package/dist/compare.js +3 -3
  36. package/dist/core/commands/formatting-commands.d.cts +1 -1
  37. package/dist/core/commands/formatting-commands.d.ts +1 -1
  38. package/dist/core/commands/image-commands.cjs +16 -5
  39. package/dist/core/commands/image-commands.d.cts +1 -1
  40. package/dist/core/commands/image-commands.d.ts +1 -1
  41. package/dist/core/commands/image-commands.js +5 -5
  42. package/dist/core/commands/section-layout-commands.d.cts +1 -1
  43. package/dist/core/commands/section-layout-commands.d.ts +1 -1
  44. package/dist/core/commands/style-commands.d.cts +1 -1
  45. package/dist/core/commands/style-commands.d.ts +1 -1
  46. package/dist/core/commands/table-structure-commands.cjs +16 -5
  47. package/dist/core/commands/table-structure-commands.d.cts +1 -1
  48. package/dist/core/commands/table-structure-commands.d.ts +1 -1
  49. package/dist/core/commands/table-structure-commands.js +4 -4
  50. package/dist/core/commands/text-commands.cjs +16 -5
  51. package/dist/core/commands/text-commands.d.cts +1 -1
  52. package/dist/core/commands/text-commands.d.ts +1 -1
  53. package/dist/core/commands/text-commands.js +5 -5
  54. package/dist/core/selection/mapping.d.cts +1 -1
  55. package/dist/core/selection/mapping.d.ts +1 -1
  56. package/dist/core/state/editor-state.d.cts +1 -1
  57. package/dist/core/state/editor-state.d.ts +1 -1
  58. package/dist/index.cjs +1280 -347
  59. package/dist/index.d.cts +4 -4
  60. package/dist/index.d.ts +4 -4
  61. package/dist/index.js +24 -24
  62. package/dist/io/docx-session.cjs +216 -203
  63. package/dist/io/docx-session.d.cts +3 -3
  64. package/dist/io/docx-session.d.ts +3 -3
  65. package/dist/io/docx-session.js +6 -6
  66. package/dist/legal.cjs +9 -20
  67. package/dist/legal.js +3 -3
  68. package/dist/{loader-4qsw4eIU.d.ts → loader-B-aL5HGD.d.ts} +2 -2
  69. package/dist/{loader-B8TKhmQi.d.cts → loader-DiY_ZgKl.d.cts} +2 -2
  70. package/dist/{measurement-backend-canvas-Q3MJMEYX.js → measurement-backend-canvas-F7ZYDACK.js} +1 -1
  71. package/dist/{public-types-p9b8rfy8.d.ts → public-types-DyqnxxO9.d.ts} +124 -1
  72. package/dist/{public-types-B5CRoR6f.d.cts → public-types-gvubspUI.d.cts} +124 -1
  73. package/dist/public-types.cjs +595 -18
  74. package/dist/public-types.d.cts +1 -1
  75. package/dist/public-types.d.ts +1 -1
  76. package/dist/public-types.js +4 -4
  77. package/dist/runtime/collab.d.cts +2 -2
  78. package/dist/runtime/collab.d.ts +2 -2
  79. package/dist/runtime/document-runtime.cjs +908 -129
  80. package/dist/runtime/document-runtime.d.cts +1 -1
  81. package/dist/runtime/document-runtime.d.ts +1 -1
  82. package/dist/runtime/document-runtime.js +17 -17
  83. package/dist/{session-BnGIjaex.d.cts → session-BUN6B-Vj.d.cts} +2 -2
  84. package/dist/{session-vEYKf-w3.d.ts → session-CDB0hohT.d.ts} +2 -2
  85. package/dist/session.cjs +216 -203
  86. package/dist/session.d.cts +4 -4
  87. package/dist/session.d.ts +4 -4
  88. package/dist/session.js +7 -7
  89. package/dist/tailwind.cjs +595 -18
  90. package/dist/tailwind.d.cts +1 -1
  91. package/dist/tailwind.d.ts +1 -1
  92. package/dist/tailwind.js +8 -8
  93. package/dist/{types-BLuvZ6cQ.d.cts → types-C4bz3kDU.d.cts} +1 -1
  94. package/dist/{types-Dutlyj0T.d.ts → types-VWH6CRvG.d.ts} +1 -1
  95. package/dist/ui-tailwind/editor-surface/search-plugin.d.cts +2 -2
  96. package/dist/ui-tailwind/editor-surface/search-plugin.d.ts +2 -2
  97. package/dist/ui-tailwind/editor-surface/search-plugin.js +5 -5
  98. package/dist/ui-tailwind.cjs +595 -18
  99. package/dist/ui-tailwind.d.cts +2 -2
  100. package/dist/ui-tailwind.d.ts +2 -2
  101. package/dist/ui-tailwind.js +8 -8
  102. package/package.json +1 -1
@@ -2107,26 +2107,35 @@ function buildParagraphPropertiesXml(paragraph) {
2107
2107
  if (frameXml) children.push(frameXml);
2108
2108
  }
2109
2109
  pushOnOffParagraphProperty(children, "widowControl", paragraph.widowControl);
2110
- if (paragraph.outlineLevel !== void 0) {
2111
- children.push(`<w:outlineLvl w:val="${paragraph.outlineLevel}"/>`);
2112
- }
2113
2110
  if (paragraph.numbering) {
2114
2111
  children.push(serializeParagraphNumberingProperties(paragraph.numbering));
2115
2112
  }
2113
+ pushOnOffParagraphProperty(children, "suppressLineNumbers", paragraph.suppressLineNumbers);
2114
+ if (paragraph.borders) {
2115
+ const bordersXml = serializeParagraphBorders(paragraph.borders);
2116
+ if (bordersXml) children.push(bordersXml);
2117
+ }
2118
+ if (paragraph.shading) {
2119
+ const shadingXml = serializeParagraphShading(paragraph.shading);
2120
+ if (shadingXml) children.push(shadingXml);
2121
+ }
2122
+ if (paragraph.tabStops && paragraph.tabStops.length > 0) {
2123
+ const tabsXml = paragraph.tabStops.map((tab) => {
2124
+ const leaderAttr = tab.leader ? ` w:leader="${escapeXmlAttribute2(tab.leader)}"` : "";
2125
+ return `<w:tab w:val="${escapeXmlAttribute2(tab.align)}" w:pos="${twip(tab.position)}"${leaderAttr}/>`;
2126
+ }).join("");
2127
+ children.push(`<w:tabs>${tabsXml}</w:tabs>`);
2128
+ }
2129
+ pushOnOffParagraphProperty(children, "bidi", paragraph.bidi);
2116
2130
  if (paragraph.spacing) {
2117
2131
  const s = paragraph.spacing;
2118
2132
  const attrs = [];
2119
2133
  if (s.before !== void 0) attrs.push(`w:before="${twip(s.before)}"`);
2120
2134
  if (s.after !== void 0) attrs.push(`w:after="${twip(s.after)}"`);
2121
2135
  if (s.line !== void 0) attrs.push(`w:line="${twip(s.line)}"`);
2122
- if (s.lineRule !== void 0) attrs.push(`w:lineRule="${s.lineRule}"`);
2136
+ if (s.lineRule !== void 0) attrs.push(`w:lineRule="${escapeXmlAttribute2(s.lineRule)}"`);
2123
2137
  if (attrs.length > 0) children.push(`<w:spacing ${attrs.join(" ")}/>`);
2124
2138
  }
2125
- if (paragraph.contextualSpacing === true) {
2126
- children.push("<w:contextualSpacing/>");
2127
- } else if (paragraph.contextualSpacing === false) {
2128
- children.push(`<w:contextualSpacing w:val="false"/>`);
2129
- }
2130
2139
  if (paragraph.indentation) {
2131
2140
  const ind = paragraph.indentation;
2132
2141
  const attrs = [];
@@ -2136,33 +2145,20 @@ function buildParagraphPropertiesXml(paragraph) {
2136
2145
  if (ind.hanging !== void 0) attrs.push(`w:hanging="${twip(ind.hanging)}"`);
2137
2146
  if (attrs.length > 0) children.push(`<w:ind ${attrs.join(" ")}/>`);
2138
2147
  }
2139
- if (paragraph.alignment) {
2140
- children.push(`<w:jc w:val="${paragraph.alignment}"/>`);
2148
+ if (paragraph.contextualSpacing === true) {
2149
+ children.push("<w:contextualSpacing/>");
2150
+ } else if (paragraph.contextualSpacing === false) {
2151
+ children.push(`<w:contextualSpacing w:val="false"/>`);
2141
2152
  }
2142
- if (paragraph.borders) {
2143
- const bordersXml = serializeParagraphBorders(paragraph.borders);
2144
- if (bordersXml) {
2145
- children.push(bordersXml);
2146
- }
2153
+ if (paragraph.alignment) {
2154
+ children.push(`<w:jc w:val="${escapeXmlAttribute2(paragraph.alignment)}"/>`);
2147
2155
  }
2148
- if (paragraph.shading) {
2149
- const shadingXml = serializeParagraphShading(paragraph.shading);
2150
- if (shadingXml) {
2151
- children.push(shadingXml);
2152
- }
2156
+ if (paragraph.outlineLevel !== void 0) {
2157
+ children.push(`<w:outlineLvl w:val="${paragraph.outlineLevel}"/>`);
2153
2158
  }
2154
- pushOnOffParagraphProperty(children, "bidi", paragraph.bidi);
2155
- pushOnOffParagraphProperty(children, "suppressLineNumbers", paragraph.suppressLineNumbers);
2156
2159
  if (paragraph.cnfStyle) {
2157
2160
  children.push(`<w:cnfStyle w:val="${escapeXmlAttribute2(paragraph.cnfStyle)}"/>`);
2158
2161
  }
2159
- if (paragraph.tabStops && paragraph.tabStops.length > 0) {
2160
- const tabsXml = paragraph.tabStops.map((tab) => {
2161
- const leaderAttr = tab.leader ? ` w:leader="${tab.leader}"` : "";
2162
- return `<w:tab w:val="${tab.align}" w:pos="${twip(tab.position)}"${leaderAttr}/>`;
2163
- }).join("");
2164
- children.push(`<w:tabs>${tabsXml}</w:tabs>`);
2165
- }
2166
2162
  if (children.length === 0) return "";
2167
2163
  return `<w:pPr>${children.join("")}</w:pPr>`;
2168
2164
  }
@@ -2727,79 +2723,86 @@ function serializeRunProperties(marks) {
2727
2723
  if (!marks || marks.length === 0) {
2728
2724
  return "";
2729
2725
  }
2726
+ const orderedTypes = [
2727
+ "fontFamily",
2728
+ "bold",
2729
+ "italic",
2730
+ "allCaps",
2731
+ "smallCaps",
2732
+ "strikethrough",
2733
+ "doubleStrikethrough",
2734
+ "shadow",
2735
+ "emboss",
2736
+ "imprint",
2737
+ "vanish",
2738
+ "textColor",
2739
+ "charSpacing",
2740
+ "kerning",
2741
+ "position",
2742
+ "fontSize",
2743
+ "highlight",
2744
+ "underline",
2745
+ "backgroundColor",
2746
+ "lang",
2747
+ "textFill"
2748
+ ];
2730
2749
  const markParts = [];
2731
- for (const mark of marks) {
2732
- switch (mark.type) {
2733
- case "bold":
2734
- markParts.push("<w:b/>");
2735
- break;
2736
- case "italic":
2737
- markParts.push("<w:i/>");
2738
- break;
2739
- case "underline":
2740
- markParts.push(`<w:u w:val="single"/>`);
2741
- break;
2742
- case "strikethrough":
2743
- markParts.push("<w:strike/>");
2744
- break;
2745
- case "doubleStrikethrough":
2746
- markParts.push("<w:dstrike/>");
2747
- break;
2748
- case "vanish":
2749
- markParts.push("<w:vanish/>");
2750
- break;
2751
- case "lang":
2752
- markParts.push(`<w:lang w:val="${escapeXmlAttribute2(mark.val)}"/>`);
2753
- break;
2754
- case "highlight":
2755
- markParts.push(`<w:highlight w:val="${escapeXmlAttribute2(mark.val)}"/>`);
2756
- break;
2757
- case "backgroundColor":
2758
- markParts.push(
2759
- `<w:shd w:val="clear" w:color="auto" w:fill="${escapeXmlAttribute2(mark.color)}"/>`
2760
- );
2761
- break;
2762
- case "charSpacing":
2763
- markParts.push(`<w:spacing w:val="${mark.val}"/>`);
2764
- break;
2765
- case "kerning":
2766
- markParts.push(`<w:kern w:val="${mark.val}"/>`);
2767
- break;
2768
- case "emboss":
2769
- markParts.push("<w:emboss/>");
2770
- break;
2771
- case "imprint":
2772
- markParts.push("<w:imprint/>");
2773
- break;
2774
- case "shadow":
2775
- markParts.push("<w:shadow/>");
2776
- break;
2777
- case "position":
2778
- markParts.push(`<w:position w:val="${mark.val}"/>`);
2779
- break;
2780
- case "textFill":
2781
- markParts.push(mark.xml);
2782
- break;
2783
- case "fontFamily":
2784
- markParts.push(`<w:rFonts w:ascii="${escapeXmlAttribute2(mark.val)}" w:hAnsi="${escapeXmlAttribute2(mark.val)}"/>`);
2785
- break;
2786
- case "fontSize":
2787
- markParts.push(`<w:sz w:val="${mark.val}"/>`);
2788
- break;
2789
- case "textColor":
2790
- markParts.push(`<w:color w:val="${escapeXmlAttribute2(mark.color)}"/>`);
2791
- break;
2792
- case "smallCaps":
2793
- markParts.push("<w:smallCaps/>");
2794
- break;
2795
- case "allCaps":
2796
- markParts.push("<w:caps/>");
2797
- break;
2750
+ for (const type of orderedTypes) {
2751
+ for (const mark of marks) {
2752
+ if (mark.type !== type) continue;
2753
+ const xml = serializeRunPropertyMark(mark);
2754
+ if (xml) markParts.push(xml);
2798
2755
  }
2799
2756
  }
2800
2757
  const children = markParts.join("");
2801
2758
  return children.length > 0 ? `<w:rPr>${children}</w:rPr>` : "";
2802
2759
  }
2760
+ function serializeRunPropertyMark(mark) {
2761
+ switch (mark.type) {
2762
+ case "bold":
2763
+ return "<w:b/>";
2764
+ case "italic":
2765
+ return "<w:i/>";
2766
+ case "underline":
2767
+ return `<w:u w:val="single"/>`;
2768
+ case "strikethrough":
2769
+ return "<w:strike/>";
2770
+ case "doubleStrikethrough":
2771
+ return "<w:dstrike/>";
2772
+ case "vanish":
2773
+ return "<w:vanish/>";
2774
+ case "lang":
2775
+ return `<w:lang w:val="${escapeXmlAttribute2(mark.val)}"/>`;
2776
+ case "highlight":
2777
+ return `<w:highlight w:val="${escapeXmlAttribute2(mark.val)}"/>`;
2778
+ case "backgroundColor":
2779
+ return `<w:shd w:val="clear" w:color="auto" w:fill="${escapeXmlAttribute2(mark.color)}"/>`;
2780
+ case "charSpacing":
2781
+ return `<w:spacing w:val="${mark.val}"/>`;
2782
+ case "kerning":
2783
+ return `<w:kern w:val="${mark.val}"/>`;
2784
+ case "emboss":
2785
+ return "<w:emboss/>";
2786
+ case "imprint":
2787
+ return "<w:imprint/>";
2788
+ case "shadow":
2789
+ return "<w:shadow/>";
2790
+ case "position":
2791
+ return `<w:position w:val="${mark.val}"/>`;
2792
+ case "textFill":
2793
+ return mark.xml;
2794
+ case "fontFamily":
2795
+ return `<w:rFonts w:ascii="${escapeXmlAttribute2(mark.val)}" w:hAnsi="${escapeXmlAttribute2(mark.val)}"/>`;
2796
+ case "fontSize":
2797
+ return `<w:sz w:val="${mark.val}"/>`;
2798
+ case "textColor":
2799
+ return `<w:color w:val="${escapeXmlAttribute2(mark.color)}"/>`;
2800
+ case "smallCaps":
2801
+ return "<w:smallCaps/>";
2802
+ case "allCaps":
2803
+ return "<w:caps/>";
2804
+ }
2805
+ }
2803
2806
  function requiresPreservedSpace(text) {
2804
2807
  return /^\s/.test(text) || /\s$/.test(text) || text.includes(" ");
2805
2808
  }
@@ -5907,6 +5910,13 @@ function buildParagraphPropertiesXml2(paragraph) {
5907
5910
  const frameXml = buildFrameXml(paragraph.frameProperties);
5908
5911
  if (frameXml) parts.push(frameXml);
5909
5912
  }
5913
+ if (paragraph.tabStops && paragraph.tabStops.length > 0) {
5914
+ const tabsXml = paragraph.tabStops.map((tab) => {
5915
+ const leaderAttr = tab.leader ? ` w:leader="${escapeXmlAttribute2(tab.leader)}"` : "";
5916
+ return `<w:tab w:val="${escapeXmlAttribute2(tab.align)}" w:pos="${twip(tab.position)}"${leaderAttr}/>`;
5917
+ }).join("");
5918
+ parts.push(`<w:tabs>${tabsXml}</w:tabs>`);
5919
+ }
5910
5920
  if (paragraph.spacing) {
5911
5921
  const s = paragraph.spacing;
5912
5922
  const attrs = [];
@@ -5928,13 +5938,6 @@ function buildParagraphPropertiesXml2(paragraph) {
5928
5938
  if (paragraph.alignment) {
5929
5939
  parts.push(`<w:jc w:val="${escapeXmlAttribute2(paragraph.alignment)}"/>`);
5930
5940
  }
5931
- if (paragraph.tabStops && paragraph.tabStops.length > 0) {
5932
- const tabsXml = paragraph.tabStops.map((tab) => {
5933
- const leaderAttr = tab.leader ? ` w:leader="${escapeXmlAttribute2(tab.leader)}"` : "";
5934
- return `<w:tab w:val="${tab.align}" w:pos="${twip(tab.position)}"${leaderAttr}/>`;
5935
- }).join("");
5936
- parts.push(`<w:tabs>${tabsXml}</w:tabs>`);
5937
- }
5938
5941
  return parts.length > 0 ? `<w:pPr>${parts.join("")}</w:pPr>` : "";
5939
5942
  }
5940
5943
  function serializeInlineNode2(node) {
@@ -6003,51 +6006,60 @@ function buildRunPropertiesXml2(marks) {
6003
6006
  if (!marks || marks.length === 0) {
6004
6007
  return "";
6005
6008
  }
6009
+ const orderedTypes = [
6010
+ "fontFamily",
6011
+ "bold",
6012
+ "italic",
6013
+ "allCaps",
6014
+ "smallCaps",
6015
+ "strikethrough",
6016
+ "doubleStrikethrough",
6017
+ "textColor",
6018
+ "fontSize",
6019
+ "highlight",
6020
+ "underline",
6021
+ "backgroundColor"
6022
+ ];
6006
6023
  const parts = [];
6007
- for (const mark of marks) {
6008
- switch (mark.type) {
6009
- case "bold":
6010
- parts.push("<w:b/>");
6011
- break;
6012
- case "italic":
6013
- parts.push("<w:i/>");
6014
- break;
6015
- case "underline":
6016
- parts.push('<w:u w:val="single"/>');
6017
- break;
6018
- case "strikethrough":
6019
- parts.push("<w:strike/>");
6020
- break;
6021
- case "doubleStrikethrough":
6022
- parts.push("<w:dstrike/>");
6023
- break;
6024
- case "fontFamily":
6025
- parts.push(`<w:rFonts w:ascii="${escapeXmlAttribute2(mark.val)}" w:hAnsi="${escapeXmlAttribute2(mark.val)}"/>`);
6026
- break;
6027
- case "fontSize":
6028
- parts.push(`<w:sz w:val="${twip(mark.val)}"/>`);
6029
- break;
6030
- case "textColor":
6031
- parts.push(`<w:color w:val="${escapeXmlAttribute2(mark.color)}"/>`);
6032
- break;
6033
- case "highlight":
6034
- parts.push(`<w:highlight w:val="${escapeXmlAttribute2(mark.val)}"/>`);
6035
- break;
6036
- case "backgroundColor":
6037
- parts.push(`<w:shd w:val="clear" w:color="auto" w:fill="${escapeXmlAttribute2(mark.color)}"/>`);
6038
- break;
6039
- case "smallCaps":
6040
- parts.push("<w:smallCaps/>");
6041
- break;
6042
- case "allCaps":
6043
- parts.push("<w:caps/>");
6044
- break;
6045
- default:
6046
- break;
6024
+ for (const type of orderedTypes) {
6025
+ for (const mark of marks) {
6026
+ if (mark.type !== type) continue;
6027
+ const xml = serializeRunPropertyMark2(mark);
6028
+ if (xml) parts.push(xml);
6047
6029
  }
6048
6030
  }
6049
6031
  return parts.length > 0 ? `<w:rPr>${parts.join("")}</w:rPr>` : "";
6050
6032
  }
6033
+ function serializeRunPropertyMark2(mark) {
6034
+ switch (mark.type) {
6035
+ case "bold":
6036
+ return "<w:b/>";
6037
+ case "italic":
6038
+ return "<w:i/>";
6039
+ case "underline":
6040
+ return `<w:u w:val="single"/>`;
6041
+ case "strikethrough":
6042
+ return "<w:strike/>";
6043
+ case "doubleStrikethrough":
6044
+ return "<w:dstrike/>";
6045
+ case "fontFamily":
6046
+ return `<w:rFonts w:ascii="${escapeXmlAttribute2(mark.val)}" w:hAnsi="${escapeXmlAttribute2(mark.val)}"/>`;
6047
+ case "fontSize":
6048
+ return `<w:sz w:val="${twip(mark.val)}"/>`;
6049
+ case "textColor":
6050
+ return `<w:color w:val="${escapeXmlAttribute2(mark.color)}"/>`;
6051
+ case "highlight":
6052
+ return `<w:highlight w:val="${escapeXmlAttribute2(mark.val)}"/>`;
6053
+ case "backgroundColor":
6054
+ return `<w:shd w:val="clear" w:color="auto" w:fill="${escapeXmlAttribute2(mark.color)}"/>`;
6055
+ case "smallCaps":
6056
+ return "<w:smallCaps/>";
6057
+ case "allCaps":
6058
+ return "<w:caps/>";
6059
+ default:
6060
+ return "";
6061
+ }
6062
+ }
6051
6063
  function requiresPreservedSpace3(text) {
6052
6064
  return text.length > 0 && (text[0] === " " || text[text.length - 1] === " " || text.includes(" "));
6053
6065
  }
@@ -6221,9 +6233,6 @@ function buildParagraphPropertiesXml3(paragraph) {
6221
6233
  const frameXml = buildFrameXml(paragraph.frameProperties);
6222
6234
  if (frameXml) parts.push(frameXml);
6223
6235
  }
6224
- if (paragraph.alignment) {
6225
- parts.push(`<w:jc w:val="${escapeXmlAttribute2(paragraph.alignment)}"/>`);
6226
- }
6227
6236
  if (paragraph.spacing) {
6228
6237
  const attrs = [];
6229
6238
  if (paragraph.spacing.before !== void 0) attrs.push(`w:before="${twip(paragraph.spacing.before)}"`);
@@ -6244,6 +6253,9 @@ function buildParagraphPropertiesXml3(paragraph) {
6244
6253
  parts.push(`<w:ind ${attrs.join(" ")}/>`);
6245
6254
  }
6246
6255
  }
6256
+ if (paragraph.alignment) {
6257
+ parts.push(`<w:jc w:val="${escapeXmlAttribute2(paragraph.alignment)}"/>`);
6258
+ }
6247
6259
  return parts.length > 0 ? `<w:pPr>${parts.join("")}</w:pPr>` : "";
6248
6260
  }
6249
6261
  function serializeInlineNode3(node) {
@@ -6304,47 +6316,59 @@ function buildRunPropertiesXml3(marks) {
6304
6316
  if (!marks || marks.length === 0) {
6305
6317
  return "";
6306
6318
  }
6307
- const parts = [];
6319
+ const orderedTypes = [
6320
+ "fontFamily",
6321
+ "bold",
6322
+ "italic",
6323
+ "allCaps",
6324
+ "smallCaps",
6325
+ "strikethrough",
6326
+ "doubleStrikethrough",
6327
+ "textColor",
6328
+ "fontSize",
6329
+ "underline"
6330
+ ];
6331
+ const supportedTypes = new Set(orderedTypes);
6308
6332
  for (const mark of marks) {
6309
- switch (mark.type) {
6310
- case "bold":
6311
- parts.push("<w:b/>");
6312
- break;
6313
- case "italic":
6314
- parts.push("<w:i/>");
6315
- break;
6316
- case "underline":
6317
- parts.push('<w:u w:val="single"/>');
6318
- break;
6319
- case "strikethrough":
6320
- parts.push("<w:strike/>");
6321
- break;
6322
- case "doubleStrikethrough":
6323
- parts.push("<w:dstrike/>");
6324
- break;
6325
- case "fontFamily":
6326
- parts.push(
6327
- `<w:rFonts w:ascii="${escapeXmlAttribute2(mark.val)}" w:hAnsi="${escapeXmlAttribute2(mark.val)}"/>`
6328
- );
6329
- break;
6330
- case "fontSize":
6331
- parts.push(`<w:sz w:val="${twip(mark.val)}"/>`);
6332
- break;
6333
- case "textColor":
6334
- parts.push(`<w:color w:val="${escapeXmlAttribute2(mark.color)}"/>`);
6335
- break;
6336
- case "smallCaps":
6337
- parts.push("<w:smallCaps/>");
6338
- break;
6339
- case "allCaps":
6340
- parts.push("<w:caps/>");
6341
- break;
6342
- default:
6343
- throw new Error(`Cannot safely serialize ${mark.type} marks in note sub-parts.`);
6333
+ if (!supportedTypes.has(mark.type)) {
6334
+ throw new Error(`Cannot safely serialize ${mark.type} marks in note sub-parts.`);
6335
+ }
6336
+ }
6337
+ const parts = [];
6338
+ for (const type of orderedTypes) {
6339
+ for (const mark of marks) {
6340
+ if (mark.type !== type) continue;
6341
+ parts.push(serializeRunPropertyMark3(mark));
6344
6342
  }
6345
6343
  }
6346
6344
  return parts.length > 0 ? `<w:rPr>${parts.join("")}</w:rPr>` : "";
6347
6345
  }
6346
+ function serializeRunPropertyMark3(mark) {
6347
+ switch (mark.type) {
6348
+ case "bold":
6349
+ return "<w:b/>";
6350
+ case "italic":
6351
+ return "<w:i/>";
6352
+ case "underline":
6353
+ return `<w:u w:val="single"/>`;
6354
+ case "strikethrough":
6355
+ return "<w:strike/>";
6356
+ case "doubleStrikethrough":
6357
+ return "<w:dstrike/>";
6358
+ case "fontFamily":
6359
+ return `<w:rFonts w:ascii="${escapeXmlAttribute2(mark.val)}" w:hAnsi="${escapeXmlAttribute2(mark.val)}"/>`;
6360
+ case "fontSize":
6361
+ return `<w:sz w:val="${twip(mark.val)}"/>`;
6362
+ case "textColor":
6363
+ return `<w:color w:val="${escapeXmlAttribute2(mark.color)}"/>`;
6364
+ case "smallCaps":
6365
+ return "<w:smallCaps/>";
6366
+ case "allCaps":
6367
+ return "<w:caps/>";
6368
+ default:
6369
+ throw new Error(`Cannot safely serialize ${mark.type} marks in note sub-parts.`);
6370
+ }
6371
+ }
6348
6372
  function compareNoteIds(left, right) {
6349
6373
  return Number.parseInt(left.noteId, 10) - Number.parseInt(right.noteId, 10);
6350
6374
  }
@@ -14149,8 +14173,7 @@ function resolveContentType(path, contentTypes) {
14149
14173
  // src/io/ooxml/parse-bookmark-references.ts
14150
14174
  var HYPERLINK_ANCHOR_RE = /<(?:\w+:)?hyperlink\b[^>]*\bw:anchor\s*=\s*"([^"]*)"/gi;
14151
14175
  var INSTR_TEXT_RE = /<(?:\w+:)?instrText\b[^>]*>([\s\S]*?)<\/(?:\w+:)?instrText>/gi;
14152
- var FLD_SIMPLE_INSTR_DOUBLE_RE = /<(?:\w+:)?fldSimple\b[^>]*?\b(?:w:)?instr\s*=\s*"([^"]*)"/gi;
14153
- var FLD_SIMPLE_INSTR_SINGLE_RE = /<(?:\w+:)?fldSimple\b[^>]*?\b(?:w:)?instr\s*=\s*'([^']*)'/gi;
14176
+ var FLD_SIMPLE_INSTR_RE = /<(?:\w+:)?fldSimple\b[^>]*\bw:instr\s*=\s*(["'])([\s\S]*?)\1/gi;
14154
14177
  var TOC_FIELD_RE = /\bTOC\b/;
14155
14178
  var REFLIKE_FIELD_RE = /\b(?:HYPERLINK|REF|PAGEREF|NOTEREF)\s+([A-Za-z0-9_:.\-]+)/g;
14156
14179
  var DATA_BINDING_RE = /<(?:\w+:)?dataBinding\b/i;
@@ -14169,21 +14192,14 @@ function scanBookmarkReferences(documentXml, callerAllowlist = []) {
14169
14192
  }
14170
14193
  INSTR_TEXT_RE.lastIndex = 0;
14171
14194
  while ((m = INSTR_TEXT_RE.exec(documentXml)) !== null) {
14172
- const instrText = m[1] ?? "";
14173
- scanFieldInstruction(instrText, retained, () => {
14174
- retainAllToc = true;
14195
+ retainInstructionReferences(m[1] ?? "", retained, (value) => {
14196
+ retainAllToc = retainAllToc || value;
14175
14197
  });
14176
14198
  }
14177
- FLD_SIMPLE_INSTR_DOUBLE_RE.lastIndex = 0;
14178
- while ((m = FLD_SIMPLE_INSTR_DOUBLE_RE.exec(documentXml)) !== null) {
14179
- scanFieldInstruction(decodeXmlAttribute(m[1] ?? ""), retained, () => {
14180
- retainAllToc = true;
14181
- });
14182
- }
14183
- FLD_SIMPLE_INSTR_SINGLE_RE.lastIndex = 0;
14184
- while ((m = FLD_SIMPLE_INSTR_SINGLE_RE.exec(documentXml)) !== null) {
14185
- scanFieldInstruction(decodeXmlAttribute(m[1] ?? ""), retained, () => {
14186
- retainAllToc = true;
14199
+ FLD_SIMPLE_INSTR_RE.lastIndex = 0;
14200
+ while ((m = FLD_SIMPLE_INSTR_RE.exec(documentXml)) !== null) {
14201
+ retainInstructionReferences(m[2] ?? "", retained, (value) => {
14202
+ retainAllToc = retainAllToc || value;
14187
14203
  });
14188
14204
  }
14189
14205
  retainRevisionBoundedBookmarks(documentXml, retained);
@@ -14193,17 +14209,14 @@ function scanBookmarkReferences(documentXml, callerAllowlist = []) {
14193
14209
  retainAll
14194
14210
  };
14195
14211
  }
14196
- function scanFieldInstruction(instrText, retained, retainToc) {
14197
- if (TOC_FIELD_RE.test(instrText)) retainToc();
14212
+ function retainInstructionReferences(instrText, retained, setRetainAllToc) {
14213
+ if (TOC_FIELD_RE.test(instrText)) setRetainAllToc(true);
14198
14214
  REFLIKE_FIELD_RE.lastIndex = 0;
14199
14215
  let r;
14200
14216
  while ((r = REFLIKE_FIELD_RE.exec(instrText)) !== null) {
14201
14217
  if (r[1]) retained.add(r[1]);
14202
14218
  }
14203
14219
  }
14204
- function decodeXmlAttribute(value) {
14205
- return value.replace(/&quot;/g, '"').replace(/&apos;/g, "'").replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&amp;/g, "&");
14206
- }
14207
14220
  function retainRevisionBoundedBookmarks(documentXml, retained) {
14208
14221
  const starts = /* @__PURE__ */ new Map();
14209
14222
  BOOKMARK_START_RE.lastIndex = 0;
@@ -1,7 +1,7 @@
1
- export { a as LoadDocxEditorSessionAsyncOptions, b as LoadDocxEditorSessionOptions, L as LoadedDocxEditorSession, l as loadDocxEditorSessionAsync } from '../loader-B8TKhmQi.cjs';
1
+ export { a as LoadDocxEditorSessionAsyncOptions, b as LoadDocxEditorSessionOptions, L as LoadedDocxEditorSession, l as loadDocxEditorSessionAsync } from '../loader-DiY_ZgKl.cjs';
2
2
  import { R as RevisionStoryTargetRecord, O as OpaqueFragmentRecord } from '../canonical-document-BMtONpgf.cjs';
3
- import { a$ as EditorAnchorProjection } from '../public-types-B5CRoR6f.cjs';
4
- import '../types-BLuvZ6cQ.cjs';
3
+ import { a$ as EditorAnchorProjection } from '../public-types-gvubspUI.cjs';
4
+ import '../types-C4bz3kDU.cjs';
5
5
  import 'react';
6
6
  import 'yjs';
7
7
  import 'y-protocols/awareness';
@@ -1,7 +1,7 @@
1
- export { a as LoadDocxEditorSessionAsyncOptions, b as LoadDocxEditorSessionOptions, L as LoadedDocxEditorSession, l as loadDocxEditorSessionAsync } from '../loader-4qsw4eIU.js';
1
+ export { a as LoadDocxEditorSessionAsyncOptions, b as LoadDocxEditorSessionOptions, L as LoadedDocxEditorSession, l as loadDocxEditorSessionAsync } from '../loader-B-aL5HGD.js';
2
2
  import { R as RevisionStoryTargetRecord, O as OpaqueFragmentRecord } from '../canonical-document-BMtONpgf.js';
3
- import { a$ as EditorAnchorProjection } from '../public-types-p9b8rfy8.js';
4
- import '../types-Dutlyj0T.js';
3
+ import { a$ as EditorAnchorProjection } from '../public-types-DyqnxxO9.js';
4
+ import '../types-VWH6CRvG.js';
5
5
  import 'react';
6
6
  import 'yjs';
7
7
  import 'y-protocols/awareness';
@@ -2,13 +2,13 @@ import {
2
2
  loadDocxSessionAsync,
3
3
  normalizeImportedCommentThreads,
4
4
  stripCommentMarkup
5
- } from "../chunk-XMHSGPLN.js";
6
- import "../chunk-JJGVE5J7.js";
7
- import "../chunk-Q3QYGKFE.js";
5
+ } from "../chunk-VRKK2CSZ.js";
6
+ import "../chunk-4YCWECLZ.js";
7
+ import "../chunk-M7YRJX6V.js";
8
8
  import "../chunk-4BJ6K26R.js";
9
- import "../chunk-5DGKFNQT.js";
10
- import "../chunk-OL2UEHRP.js";
11
- import "../chunk-EB6M3GE6.js";
9
+ import "../chunk-A66ZVUAT.js";
10
+ import "../chunk-WUDSNHWF.js";
11
+ import "../chunk-FM4K4XFJ.js";
12
12
  import "../chunk-IHE7YOAY.js";
13
13
  import "../chunk-MT37IIGN.js";
14
14
  import "../chunk-UTL65BUI.js";
package/dist/legal.cjs CHANGED
@@ -1017,8 +1017,7 @@ var SCOPE_MARKER_BOOKMARK_PREFIX = "bw:scope:";
1017
1017
  // src/io/ooxml/parse-bookmark-references.ts
1018
1018
  var HYPERLINK_ANCHOR_RE = /<(?:\w+:)?hyperlink\b[^>]*\bw:anchor\s*=\s*"([^"]*)"/gi;
1019
1019
  var INSTR_TEXT_RE = /<(?:\w+:)?instrText\b[^>]*>([\s\S]*?)<\/(?:\w+:)?instrText>/gi;
1020
- var FLD_SIMPLE_INSTR_DOUBLE_RE = /<(?:\w+:)?fldSimple\b[^>]*?\b(?:w:)?instr\s*=\s*"([^"]*)"/gi;
1021
- var FLD_SIMPLE_INSTR_SINGLE_RE = /<(?:\w+:)?fldSimple\b[^>]*?\b(?:w:)?instr\s*=\s*'([^']*)'/gi;
1020
+ var FLD_SIMPLE_INSTR_RE = /<(?:\w+:)?fldSimple\b[^>]*\bw:instr\s*=\s*(["'])([\s\S]*?)\1/gi;
1022
1021
  var TOC_FIELD_RE = /\bTOC\b/;
1023
1022
  var REFLIKE_FIELD_RE = /\b(?:HYPERLINK|REF|PAGEREF|NOTEREF)\s+([A-Za-z0-9_:.\-]+)/g;
1024
1023
  var DATA_BINDING_RE = /<(?:\w+:)?dataBinding\b/i;
@@ -1037,21 +1036,14 @@ function scanBookmarkReferences(documentXml, callerAllowlist = []) {
1037
1036
  }
1038
1037
  INSTR_TEXT_RE.lastIndex = 0;
1039
1038
  while ((m = INSTR_TEXT_RE.exec(documentXml)) !== null) {
1040
- const instrText = m[1] ?? "";
1041
- scanFieldInstruction(instrText, retained, () => {
1042
- retainAllToc = true;
1039
+ retainInstructionReferences(m[1] ?? "", retained, (value) => {
1040
+ retainAllToc = retainAllToc || value;
1043
1041
  });
1044
1042
  }
1045
- FLD_SIMPLE_INSTR_DOUBLE_RE.lastIndex = 0;
1046
- while ((m = FLD_SIMPLE_INSTR_DOUBLE_RE.exec(documentXml)) !== null) {
1047
- scanFieldInstruction(decodeXmlAttribute(m[1] ?? ""), retained, () => {
1048
- retainAllToc = true;
1049
- });
1050
- }
1051
- FLD_SIMPLE_INSTR_SINGLE_RE.lastIndex = 0;
1052
- while ((m = FLD_SIMPLE_INSTR_SINGLE_RE.exec(documentXml)) !== null) {
1053
- scanFieldInstruction(decodeXmlAttribute(m[1] ?? ""), retained, () => {
1054
- retainAllToc = true;
1043
+ FLD_SIMPLE_INSTR_RE.lastIndex = 0;
1044
+ while ((m = FLD_SIMPLE_INSTR_RE.exec(documentXml)) !== null) {
1045
+ retainInstructionReferences(m[2] ?? "", retained, (value) => {
1046
+ retainAllToc = retainAllToc || value;
1055
1047
  });
1056
1048
  }
1057
1049
  retainRevisionBoundedBookmarks(documentXml, retained);
@@ -1061,17 +1053,14 @@ function scanBookmarkReferences(documentXml, callerAllowlist = []) {
1061
1053
  retainAll
1062
1054
  };
1063
1055
  }
1064
- function scanFieldInstruction(instrText, retained, retainToc) {
1065
- if (TOC_FIELD_RE.test(instrText)) retainToc();
1056
+ function retainInstructionReferences(instrText, retained, setRetainAllToc) {
1057
+ if (TOC_FIELD_RE.test(instrText)) setRetainAllToc(true);
1066
1058
  REFLIKE_FIELD_RE.lastIndex = 0;
1067
1059
  let r;
1068
1060
  while ((r = REFLIKE_FIELD_RE.exec(instrText)) !== null) {
1069
1061
  if (r[1]) retained.add(r[1]);
1070
1062
  }
1071
1063
  }
1072
- function decodeXmlAttribute(value) {
1073
- return value.replace(/&quot;/g, '"').replace(/&apos;/g, "'").replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&amp;/g, "&");
1074
- }
1075
1064
  function retainRevisionBoundedBookmarks(documentXml, retained) {
1076
1065
  const starts = /* @__PURE__ */ new Map();
1077
1066
  BOOKMARK_START_RE.lastIndex = 0;
package/dist/legal.js CHANGED
@@ -4,13 +4,13 @@ import {
4
4
  isHiddenBookmarkName,
5
5
  parseBookmarksFromDocumentXml,
6
6
  resolveWalkableRoot
7
- } from "./chunk-YZDZ4FGR.js";
7
+ } from "./chunk-ZVC23LKV.js";
8
8
  import {
9
9
  extractComplexFieldsFromBodyXml,
10
10
  parseFieldsFromParagraphXml,
11
11
  parseMainDocumentXml
12
- } from "./chunk-Q3QYGKFE.js";
13
- import "./chunk-5DGKFNQT.js";
12
+ } from "./chunk-M7YRJX6V.js";
13
+ import "./chunk-A66ZVUAT.js";
14
14
  import "./chunk-IHE7YOAY.js";
15
15
  import "./chunk-UTL65BUI.js";
16
16
  import "./chunk-DNXYUIIS.js";
@@ -1,6 +1,6 @@
1
1
  import { C as CanonicalDocument } from './canonical-document-BMtONpgf.js';
2
- import { ar as EditorStateNamespace, as as EditorStateLocation, a as EditorSessionState, P as PersistedEditorSnapshot, r as EditorError, t as ProtectionSnapshot, b as ExportDocxOptions, c as ExportResult, L as LoadStage, E as EditorHostAdapter, at as LoadScheduler, o as EditorSurfaceSnapshot } from './public-types-p9b8rfy8.js';
3
- import { E as EmbeddedDocumentManifest, e as ProgressiveSurfaceProjector } from './types-Dutlyj0T.js';
2
+ import { ar as EditorStateNamespace, as as EditorStateLocation, a as EditorSessionState, P as PersistedEditorSnapshot, r as EditorError, t as ProtectionSnapshot, b as ExportDocxOptions, c as ExportResult, L as LoadStage, E as EditorHostAdapter, at as LoadScheduler, o as EditorSurfaceSnapshot } from './public-types-DyqnxxO9.js';
3
+ import { E as EmbeddedDocumentManifest, e as ProgressiveSurfaceProjector } from './types-VWH6CRvG.js';
4
4
 
5
5
  interface EditorStatePayloadNamespaceEntry {
6
6
  namespace: EditorStateNamespace;