@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
@@ -1,4 +1,4 @@
1
- export { gz as ActiveStoryTextCommand, gA as CommandAppliedMeta, gB as CreateDocumentRuntimeOptions, gC as DocumentRuntime, gD as DocumentRuntimeEvent, gE as RemoteCommandEnvelope, gF as Unsubscribe, gG as __buildTocInlineNodes, gH as __collectFontLoaderInputUncached, gI as __fontFamiliesEqual, gJ as createDocumentRuntime, gK as getThemeColorResolver } from '../public-types-B5CRoR6f.cjs';
1
+ export { gz as ActiveStoryTextCommand, gA as CommandAppliedMeta, gB as CreateDocumentRuntimeOptions, gC as DocumentRuntime, gD as DocumentRuntimeEvent, gE as RemoteCommandEnvelope, gF as Unsubscribe, gG as __buildTocInlineNodes, gH as __collectFontLoaderInputUncached, gI as __fontFamiliesEqual, gJ as createDocumentRuntime, gK as getThemeColorResolver } from '../public-types-gvubspUI.cjs';
2
2
  import '../canonical-document-BMtONpgf.cjs';
3
3
  import 'react';
4
4
  import 'yjs';
@@ -1,4 +1,4 @@
1
- export { gz as ActiveStoryTextCommand, gA as CommandAppliedMeta, gB as CreateDocumentRuntimeOptions, gC as DocumentRuntime, gD as DocumentRuntimeEvent, gE as RemoteCommandEnvelope, gF as Unsubscribe, gG as __buildTocInlineNodes, gH as __collectFontLoaderInputUncached, gI as __fontFamiliesEqual, gJ as createDocumentRuntime, gK as getThemeColorResolver } from '../public-types-p9b8rfy8.js';
1
+ export { gz as ActiveStoryTextCommand, gA as CommandAppliedMeta, gB as CreateDocumentRuntimeOptions, gC as DocumentRuntime, gD as DocumentRuntimeEvent, gE as RemoteCommandEnvelope, gF as Unsubscribe, gG as __buildTocInlineNodes, gH as __collectFontLoaderInputUncached, gI as __fontFamiliesEqual, gJ as createDocumentRuntime, gK as getThemeColorResolver } from '../public-types-DyqnxxO9.js';
2
2
  import '../canonical-document-BMtONpgf.js';
3
3
  import 'react';
4
4
  import 'yjs';
@@ -4,28 +4,28 @@ import {
4
4
  __fontFamiliesEqual,
5
5
  createDocumentRuntime,
6
6
  getThemeColorResolver
7
- } from "../chunk-PRAZBHNF.js";
7
+ } from "../chunk-YLL7MF5C.js";
8
8
  import "../chunk-6EXNNAO6.js";
9
9
  import "../chunk-M6XR534O.js";
10
- import "../chunk-YZDZ4FGR.js";
11
- import "../chunk-LJH64PV3.js";
10
+ import "../chunk-ZVC23LKV.js";
11
+ import "../chunk-QXKQPUOM.js";
12
12
  import "../chunk-Y4XZCMCS.js";
13
- import "../chunk-DJU2W4E4.js";
14
- import "../chunk-5DSHUYSY.js";
15
- import "../chunk-DDN2AIGE.js";
16
- import "../chunk-W34X3KBR.js";
17
- import "../chunk-OTQIW2TC.js";
18
- import "../chunk-SKPTKQHF.js";
19
- import "../chunk-RMRTQGW3.js";
20
- import "../chunk-KFCQYZXR.js";
13
+ import "../chunk-KNHMXKC6.js";
14
+ import "../chunk-T5YYFDZB.js";
15
+ import "../chunk-Q7Y57KOK.js";
16
+ import "../chunk-PHMWH23E.js";
17
+ import "../chunk-35RHOE6I.js";
18
+ import "../chunk-7G5GR3VV.js";
19
+ import "../chunk-THVM6EP5.js";
20
+ import "../chunk-OVLZQ6FZ.js";
21
21
  import "../chunk-QIO6V46H.js";
22
- import "../chunk-HUIHBBAQ.js";
23
- import "../chunk-CX42VC67.js";
22
+ import "../chunk-A3GSNB4G.js";
23
+ import "../chunk-SYQWQ6FE.js";
24
24
  import "../chunk-OYGMRRR7.js";
25
- import "../chunk-JJGVE5J7.js";
26
- import "../chunk-Q3QYGKFE.js";
27
- import "../chunk-5DGKFNQT.js";
28
- import "../chunk-EB6M3GE6.js";
25
+ import "../chunk-4YCWECLZ.js";
26
+ import "../chunk-M7YRJX6V.js";
27
+ import "../chunk-A66ZVUAT.js";
28
+ import "../chunk-FM4K4XFJ.js";
29
29
  import "../chunk-IHE7YOAY.js";
30
30
  import "../chunk-UTL65BUI.js";
31
31
  import "../chunk-UFVDIR2C.js";
@@ -1,6 +1,6 @@
1
1
  import { C as CanonicalDocument } from './canonical-document-BMtONpgf.cjs';
2
- import { a as EditorSessionState, c as ExportResult, P as PersistedEditorSnapshot } from './public-types-B5CRoR6f.cjs';
3
- import { O as OpenOptions, b as OpenResult, a as ExportOptions, R as ReopenBarrier, V as ValidateOptions, d as ValidationReport } from './types-BLuvZ6cQ.cjs';
2
+ import { a as EditorSessionState, c as ExportResult, P as PersistedEditorSnapshot } from './public-types-gvubspUI.cjs';
3
+ import { O as OpenOptions, b as OpenResult, a as ExportOptions, R as ReopenBarrier, V as ValidateOptions, d as ValidationReport } from './types-C4bz3kDU.cjs';
4
4
 
5
5
  /**
6
6
  * `DocxSession` — the Layer-01 package/session public entry class.
@@ -1,6 +1,6 @@
1
1
  import { C as CanonicalDocument } from './canonical-document-BMtONpgf.js';
2
- import { a as EditorSessionState, c as ExportResult, P as PersistedEditorSnapshot } from './public-types-p9b8rfy8.js';
3
- import { O as OpenOptions, b as OpenResult, a as ExportOptions, R as ReopenBarrier, V as ValidateOptions, d as ValidationReport } from './types-Dutlyj0T.js';
2
+ import { a as EditorSessionState, c as ExportResult, P as PersistedEditorSnapshot } from './public-types-DyqnxxO9.js';
3
+ import { O as OpenOptions, b as OpenResult, a as ExportOptions, R as ReopenBarrier, V as ValidateOptions, d as ValidationReport } from './types-VWH6CRvG.js';
4
4
 
5
5
  /**
6
6
  * `DocxSession` — the Layer-01 package/session public entry class.
package/dist/session.cjs CHANGED
@@ -2793,26 +2793,35 @@ function buildParagraphPropertiesXml(paragraph) {
2793
2793
  if (frameXml) children.push(frameXml);
2794
2794
  }
2795
2795
  pushOnOffParagraphProperty(children, "widowControl", paragraph.widowControl);
2796
- if (paragraph.outlineLevel !== void 0) {
2797
- children.push(`<w:outlineLvl w:val="${paragraph.outlineLevel}"/>`);
2798
- }
2799
2796
  if (paragraph.numbering) {
2800
2797
  children.push(serializeParagraphNumberingProperties(paragraph.numbering));
2801
2798
  }
2799
+ pushOnOffParagraphProperty(children, "suppressLineNumbers", paragraph.suppressLineNumbers);
2800
+ if (paragraph.borders) {
2801
+ const bordersXml = serializeParagraphBorders(paragraph.borders);
2802
+ if (bordersXml) children.push(bordersXml);
2803
+ }
2804
+ if (paragraph.shading) {
2805
+ const shadingXml = serializeParagraphShading(paragraph.shading);
2806
+ if (shadingXml) children.push(shadingXml);
2807
+ }
2808
+ if (paragraph.tabStops && paragraph.tabStops.length > 0) {
2809
+ const tabsXml = paragraph.tabStops.map((tab) => {
2810
+ const leaderAttr = tab.leader ? ` w:leader="${escapeXmlAttribute2(tab.leader)}"` : "";
2811
+ return `<w:tab w:val="${escapeXmlAttribute2(tab.align)}" w:pos="${twip(tab.position)}"${leaderAttr}/>`;
2812
+ }).join("");
2813
+ children.push(`<w:tabs>${tabsXml}</w:tabs>`);
2814
+ }
2815
+ pushOnOffParagraphProperty(children, "bidi", paragraph.bidi);
2802
2816
  if (paragraph.spacing) {
2803
2817
  const s = paragraph.spacing;
2804
2818
  const attrs = [];
2805
2819
  if (s.before !== void 0) attrs.push(`w:before="${twip(s.before)}"`);
2806
2820
  if (s.after !== void 0) attrs.push(`w:after="${twip(s.after)}"`);
2807
2821
  if (s.line !== void 0) attrs.push(`w:line="${twip(s.line)}"`);
2808
- if (s.lineRule !== void 0) attrs.push(`w:lineRule="${s.lineRule}"`);
2822
+ if (s.lineRule !== void 0) attrs.push(`w:lineRule="${escapeXmlAttribute2(s.lineRule)}"`);
2809
2823
  if (attrs.length > 0) children.push(`<w:spacing ${attrs.join(" ")}/>`);
2810
2824
  }
2811
- if (paragraph.contextualSpacing === true) {
2812
- children.push("<w:contextualSpacing/>");
2813
- } else if (paragraph.contextualSpacing === false) {
2814
- children.push(`<w:contextualSpacing w:val="false"/>`);
2815
- }
2816
2825
  if (paragraph.indentation) {
2817
2826
  const ind = paragraph.indentation;
2818
2827
  const attrs = [];
@@ -2822,33 +2831,20 @@ function buildParagraphPropertiesXml(paragraph) {
2822
2831
  if (ind.hanging !== void 0) attrs.push(`w:hanging="${twip(ind.hanging)}"`);
2823
2832
  if (attrs.length > 0) children.push(`<w:ind ${attrs.join(" ")}/>`);
2824
2833
  }
2825
- if (paragraph.alignment) {
2826
- children.push(`<w:jc w:val="${paragraph.alignment}"/>`);
2834
+ if (paragraph.contextualSpacing === true) {
2835
+ children.push("<w:contextualSpacing/>");
2836
+ } else if (paragraph.contextualSpacing === false) {
2837
+ children.push(`<w:contextualSpacing w:val="false"/>`);
2827
2838
  }
2828
- if (paragraph.borders) {
2829
- const bordersXml = serializeParagraphBorders(paragraph.borders);
2830
- if (bordersXml) {
2831
- children.push(bordersXml);
2832
- }
2839
+ if (paragraph.alignment) {
2840
+ children.push(`<w:jc w:val="${escapeXmlAttribute2(paragraph.alignment)}"/>`);
2833
2841
  }
2834
- if (paragraph.shading) {
2835
- const shadingXml = serializeParagraphShading(paragraph.shading);
2836
- if (shadingXml) {
2837
- children.push(shadingXml);
2838
- }
2842
+ if (paragraph.outlineLevel !== void 0) {
2843
+ children.push(`<w:outlineLvl w:val="${paragraph.outlineLevel}"/>`);
2839
2844
  }
2840
- pushOnOffParagraphProperty(children, "bidi", paragraph.bidi);
2841
- pushOnOffParagraphProperty(children, "suppressLineNumbers", paragraph.suppressLineNumbers);
2842
2845
  if (paragraph.cnfStyle) {
2843
2846
  children.push(`<w:cnfStyle w:val="${escapeXmlAttribute2(paragraph.cnfStyle)}"/>`);
2844
2847
  }
2845
- if (paragraph.tabStops && paragraph.tabStops.length > 0) {
2846
- const tabsXml = paragraph.tabStops.map((tab) => {
2847
- const leaderAttr = tab.leader ? ` w:leader="${tab.leader}"` : "";
2848
- return `<w:tab w:val="${tab.align}" w:pos="${twip(tab.position)}"${leaderAttr}/>`;
2849
- }).join("");
2850
- children.push(`<w:tabs>${tabsXml}</w:tabs>`);
2851
- }
2852
2848
  if (children.length === 0) return "";
2853
2849
  return `<w:pPr>${children.join("")}</w:pPr>`;
2854
2850
  }
@@ -3413,79 +3409,86 @@ function serializeRunProperties(marks) {
3413
3409
  if (!marks || marks.length === 0) {
3414
3410
  return "";
3415
3411
  }
3412
+ const orderedTypes = [
3413
+ "fontFamily",
3414
+ "bold",
3415
+ "italic",
3416
+ "allCaps",
3417
+ "smallCaps",
3418
+ "strikethrough",
3419
+ "doubleStrikethrough",
3420
+ "shadow",
3421
+ "emboss",
3422
+ "imprint",
3423
+ "vanish",
3424
+ "textColor",
3425
+ "charSpacing",
3426
+ "kerning",
3427
+ "position",
3428
+ "fontSize",
3429
+ "highlight",
3430
+ "underline",
3431
+ "backgroundColor",
3432
+ "lang",
3433
+ "textFill"
3434
+ ];
3416
3435
  const markParts = [];
3417
- for (const mark of marks) {
3418
- switch (mark.type) {
3419
- case "bold":
3420
- markParts.push("<w:b/>");
3421
- break;
3422
- case "italic":
3423
- markParts.push("<w:i/>");
3424
- break;
3425
- case "underline":
3426
- markParts.push(`<w:u w:val="single"/>`);
3427
- break;
3428
- case "strikethrough":
3429
- markParts.push("<w:strike/>");
3430
- break;
3431
- case "doubleStrikethrough":
3432
- markParts.push("<w:dstrike/>");
3433
- break;
3434
- case "vanish":
3435
- markParts.push("<w:vanish/>");
3436
- break;
3437
- case "lang":
3438
- markParts.push(`<w:lang w:val="${escapeXmlAttribute2(mark.val)}"/>`);
3439
- break;
3440
- case "highlight":
3441
- markParts.push(`<w:highlight w:val="${escapeXmlAttribute2(mark.val)}"/>`);
3442
- break;
3443
- case "backgroundColor":
3444
- markParts.push(
3445
- `<w:shd w:val="clear" w:color="auto" w:fill="${escapeXmlAttribute2(mark.color)}"/>`
3446
- );
3447
- break;
3448
- case "charSpacing":
3449
- markParts.push(`<w:spacing w:val="${mark.val}"/>`);
3450
- break;
3451
- case "kerning":
3452
- markParts.push(`<w:kern w:val="${mark.val}"/>`);
3453
- break;
3454
- case "emboss":
3455
- markParts.push("<w:emboss/>");
3456
- break;
3457
- case "imprint":
3458
- markParts.push("<w:imprint/>");
3459
- break;
3460
- case "shadow":
3461
- markParts.push("<w:shadow/>");
3462
- break;
3463
- case "position":
3464
- markParts.push(`<w:position w:val="${mark.val}"/>`);
3465
- break;
3466
- case "textFill":
3467
- markParts.push(mark.xml);
3468
- break;
3469
- case "fontFamily":
3470
- markParts.push(`<w:rFonts w:ascii="${escapeXmlAttribute2(mark.val)}" w:hAnsi="${escapeXmlAttribute2(mark.val)}"/>`);
3471
- break;
3472
- case "fontSize":
3473
- markParts.push(`<w:sz w:val="${mark.val}"/>`);
3474
- break;
3475
- case "textColor":
3476
- markParts.push(`<w:color w:val="${escapeXmlAttribute2(mark.color)}"/>`);
3477
- break;
3478
- case "smallCaps":
3479
- markParts.push("<w:smallCaps/>");
3480
- break;
3481
- case "allCaps":
3482
- markParts.push("<w:caps/>");
3483
- break;
3436
+ for (const type of orderedTypes) {
3437
+ for (const mark of marks) {
3438
+ if (mark.type !== type) continue;
3439
+ const xml = serializeRunPropertyMark(mark);
3440
+ if (xml) markParts.push(xml);
3484
3441
  }
3485
3442
  }
3486
3443
  const children = markParts.join("");
3487
3444
  return children.length > 0 ? `<w:rPr>${children}</w:rPr>` : "";
3488
3445
  }
3446
+ function serializeRunPropertyMark(mark) {
3447
+ switch (mark.type) {
3448
+ case "bold":
3449
+ return "<w:b/>";
3450
+ case "italic":
3451
+ return "<w:i/>";
3452
+ case "underline":
3453
+ return `<w:u w:val="single"/>`;
3454
+ case "strikethrough":
3455
+ return "<w:strike/>";
3456
+ case "doubleStrikethrough":
3457
+ return "<w:dstrike/>";
3458
+ case "vanish":
3459
+ return "<w:vanish/>";
3460
+ case "lang":
3461
+ return `<w:lang w:val="${escapeXmlAttribute2(mark.val)}"/>`;
3462
+ case "highlight":
3463
+ return `<w:highlight w:val="${escapeXmlAttribute2(mark.val)}"/>`;
3464
+ case "backgroundColor":
3465
+ return `<w:shd w:val="clear" w:color="auto" w:fill="${escapeXmlAttribute2(mark.color)}"/>`;
3466
+ case "charSpacing":
3467
+ return `<w:spacing w:val="${mark.val}"/>`;
3468
+ case "kerning":
3469
+ return `<w:kern w:val="${mark.val}"/>`;
3470
+ case "emboss":
3471
+ return "<w:emboss/>";
3472
+ case "imprint":
3473
+ return "<w:imprint/>";
3474
+ case "shadow":
3475
+ return "<w:shadow/>";
3476
+ case "position":
3477
+ return `<w:position w:val="${mark.val}"/>`;
3478
+ case "textFill":
3479
+ return mark.xml;
3480
+ case "fontFamily":
3481
+ return `<w:rFonts w:ascii="${escapeXmlAttribute2(mark.val)}" w:hAnsi="${escapeXmlAttribute2(mark.val)}"/>`;
3482
+ case "fontSize":
3483
+ return `<w:sz w:val="${mark.val}"/>`;
3484
+ case "textColor":
3485
+ return `<w:color w:val="${escapeXmlAttribute2(mark.color)}"/>`;
3486
+ case "smallCaps":
3487
+ return "<w:smallCaps/>";
3488
+ case "allCaps":
3489
+ return "<w:caps/>";
3490
+ }
3491
+ }
3489
3492
  function requiresPreservedSpace(text) {
3490
3493
  return /^\s/.test(text) || /\s$/.test(text) || text.includes(" ");
3491
3494
  }
@@ -6593,6 +6596,13 @@ function buildParagraphPropertiesXml2(paragraph) {
6593
6596
  const frameXml = buildFrameXml(paragraph.frameProperties);
6594
6597
  if (frameXml) parts.push(frameXml);
6595
6598
  }
6599
+ if (paragraph.tabStops && paragraph.tabStops.length > 0) {
6600
+ const tabsXml = paragraph.tabStops.map((tab) => {
6601
+ const leaderAttr = tab.leader ? ` w:leader="${escapeXmlAttribute2(tab.leader)}"` : "";
6602
+ return `<w:tab w:val="${escapeXmlAttribute2(tab.align)}" w:pos="${twip(tab.position)}"${leaderAttr}/>`;
6603
+ }).join("");
6604
+ parts.push(`<w:tabs>${tabsXml}</w:tabs>`);
6605
+ }
6596
6606
  if (paragraph.spacing) {
6597
6607
  const s = paragraph.spacing;
6598
6608
  const attrs = [];
@@ -6614,13 +6624,6 @@ function buildParagraphPropertiesXml2(paragraph) {
6614
6624
  if (paragraph.alignment) {
6615
6625
  parts.push(`<w:jc w:val="${escapeXmlAttribute2(paragraph.alignment)}"/>`);
6616
6626
  }
6617
- if (paragraph.tabStops && paragraph.tabStops.length > 0) {
6618
- const tabsXml = paragraph.tabStops.map((tab) => {
6619
- const leaderAttr = tab.leader ? ` w:leader="${escapeXmlAttribute2(tab.leader)}"` : "";
6620
- return `<w:tab w:val="${tab.align}" w:pos="${twip(tab.position)}"${leaderAttr}/>`;
6621
- }).join("");
6622
- parts.push(`<w:tabs>${tabsXml}</w:tabs>`);
6623
- }
6624
6627
  return parts.length > 0 ? `<w:pPr>${parts.join("")}</w:pPr>` : "";
6625
6628
  }
6626
6629
  function serializeInlineNode2(node) {
@@ -6689,51 +6692,60 @@ function buildRunPropertiesXml2(marks) {
6689
6692
  if (!marks || marks.length === 0) {
6690
6693
  return "";
6691
6694
  }
6695
+ const orderedTypes = [
6696
+ "fontFamily",
6697
+ "bold",
6698
+ "italic",
6699
+ "allCaps",
6700
+ "smallCaps",
6701
+ "strikethrough",
6702
+ "doubleStrikethrough",
6703
+ "textColor",
6704
+ "fontSize",
6705
+ "highlight",
6706
+ "underline",
6707
+ "backgroundColor"
6708
+ ];
6692
6709
  const parts = [];
6693
- for (const mark of marks) {
6694
- switch (mark.type) {
6695
- case "bold":
6696
- parts.push("<w:b/>");
6697
- break;
6698
- case "italic":
6699
- parts.push("<w:i/>");
6700
- break;
6701
- case "underline":
6702
- parts.push('<w:u w:val="single"/>');
6703
- break;
6704
- case "strikethrough":
6705
- parts.push("<w:strike/>");
6706
- break;
6707
- case "doubleStrikethrough":
6708
- parts.push("<w:dstrike/>");
6709
- break;
6710
- case "fontFamily":
6711
- parts.push(`<w:rFonts w:ascii="${escapeXmlAttribute2(mark.val)}" w:hAnsi="${escapeXmlAttribute2(mark.val)}"/>`);
6712
- break;
6713
- case "fontSize":
6714
- parts.push(`<w:sz w:val="${twip(mark.val)}"/>`);
6715
- break;
6716
- case "textColor":
6717
- parts.push(`<w:color w:val="${escapeXmlAttribute2(mark.color)}"/>`);
6718
- break;
6719
- case "highlight":
6720
- parts.push(`<w:highlight w:val="${escapeXmlAttribute2(mark.val)}"/>`);
6721
- break;
6722
- case "backgroundColor":
6723
- parts.push(`<w:shd w:val="clear" w:color="auto" w:fill="${escapeXmlAttribute2(mark.color)}"/>`);
6724
- break;
6725
- case "smallCaps":
6726
- parts.push("<w:smallCaps/>");
6727
- break;
6728
- case "allCaps":
6729
- parts.push("<w:caps/>");
6730
- break;
6731
- default:
6732
- break;
6710
+ for (const type of orderedTypes) {
6711
+ for (const mark of marks) {
6712
+ if (mark.type !== type) continue;
6713
+ const xml = serializeRunPropertyMark2(mark);
6714
+ if (xml) parts.push(xml);
6733
6715
  }
6734
6716
  }
6735
6717
  return parts.length > 0 ? `<w:rPr>${parts.join("")}</w:rPr>` : "";
6736
6718
  }
6719
+ function serializeRunPropertyMark2(mark) {
6720
+ switch (mark.type) {
6721
+ case "bold":
6722
+ return "<w:b/>";
6723
+ case "italic":
6724
+ return "<w:i/>";
6725
+ case "underline":
6726
+ return `<w:u w:val="single"/>`;
6727
+ case "strikethrough":
6728
+ return "<w:strike/>";
6729
+ case "doubleStrikethrough":
6730
+ return "<w:dstrike/>";
6731
+ case "fontFamily":
6732
+ return `<w:rFonts w:ascii="${escapeXmlAttribute2(mark.val)}" w:hAnsi="${escapeXmlAttribute2(mark.val)}"/>`;
6733
+ case "fontSize":
6734
+ return `<w:sz w:val="${twip(mark.val)}"/>`;
6735
+ case "textColor":
6736
+ return `<w:color w:val="${escapeXmlAttribute2(mark.color)}"/>`;
6737
+ case "highlight":
6738
+ return `<w:highlight w:val="${escapeXmlAttribute2(mark.val)}"/>`;
6739
+ case "backgroundColor":
6740
+ return `<w:shd w:val="clear" w:color="auto" w:fill="${escapeXmlAttribute2(mark.color)}"/>`;
6741
+ case "smallCaps":
6742
+ return "<w:smallCaps/>";
6743
+ case "allCaps":
6744
+ return "<w:caps/>";
6745
+ default:
6746
+ return "";
6747
+ }
6748
+ }
6737
6749
  function requiresPreservedSpace3(text) {
6738
6750
  return text.length > 0 && (text[0] === " " || text[text.length - 1] === " " || text.includes(" "));
6739
6751
  }
@@ -6907,9 +6919,6 @@ function buildParagraphPropertiesXml3(paragraph) {
6907
6919
  const frameXml = buildFrameXml(paragraph.frameProperties);
6908
6920
  if (frameXml) parts.push(frameXml);
6909
6921
  }
6910
- if (paragraph.alignment) {
6911
- parts.push(`<w:jc w:val="${escapeXmlAttribute2(paragraph.alignment)}"/>`);
6912
- }
6913
6922
  if (paragraph.spacing) {
6914
6923
  const attrs = [];
6915
6924
  if (paragraph.spacing.before !== void 0) attrs.push(`w:before="${twip(paragraph.spacing.before)}"`);
@@ -6930,6 +6939,9 @@ function buildParagraphPropertiesXml3(paragraph) {
6930
6939
  parts.push(`<w:ind ${attrs.join(" ")}/>`);
6931
6940
  }
6932
6941
  }
6942
+ if (paragraph.alignment) {
6943
+ parts.push(`<w:jc w:val="${escapeXmlAttribute2(paragraph.alignment)}"/>`);
6944
+ }
6933
6945
  return parts.length > 0 ? `<w:pPr>${parts.join("")}</w:pPr>` : "";
6934
6946
  }
6935
6947
  function serializeInlineNode3(node) {
@@ -6990,47 +7002,59 @@ function buildRunPropertiesXml3(marks) {
6990
7002
  if (!marks || marks.length === 0) {
6991
7003
  return "";
6992
7004
  }
6993
- const parts = [];
7005
+ const orderedTypes = [
7006
+ "fontFamily",
7007
+ "bold",
7008
+ "italic",
7009
+ "allCaps",
7010
+ "smallCaps",
7011
+ "strikethrough",
7012
+ "doubleStrikethrough",
7013
+ "textColor",
7014
+ "fontSize",
7015
+ "underline"
7016
+ ];
7017
+ const supportedTypes = new Set(orderedTypes);
6994
7018
  for (const mark of marks) {
6995
- switch (mark.type) {
6996
- case "bold":
6997
- parts.push("<w:b/>");
6998
- break;
6999
- case "italic":
7000
- parts.push("<w:i/>");
7001
- break;
7002
- case "underline":
7003
- parts.push('<w:u w:val="single"/>');
7004
- break;
7005
- case "strikethrough":
7006
- parts.push("<w:strike/>");
7007
- break;
7008
- case "doubleStrikethrough":
7009
- parts.push("<w:dstrike/>");
7010
- break;
7011
- case "fontFamily":
7012
- parts.push(
7013
- `<w:rFonts w:ascii="${escapeXmlAttribute2(mark.val)}" w:hAnsi="${escapeXmlAttribute2(mark.val)}"/>`
7014
- );
7015
- break;
7016
- case "fontSize":
7017
- parts.push(`<w:sz w:val="${twip(mark.val)}"/>`);
7018
- break;
7019
- case "textColor":
7020
- parts.push(`<w:color w:val="${escapeXmlAttribute2(mark.color)}"/>`);
7021
- break;
7022
- case "smallCaps":
7023
- parts.push("<w:smallCaps/>");
7024
- break;
7025
- case "allCaps":
7026
- parts.push("<w:caps/>");
7027
- break;
7028
- default:
7029
- throw new Error(`Cannot safely serialize ${mark.type} marks in note sub-parts.`);
7019
+ if (!supportedTypes.has(mark.type)) {
7020
+ throw new Error(`Cannot safely serialize ${mark.type} marks in note sub-parts.`);
7021
+ }
7022
+ }
7023
+ const parts = [];
7024
+ for (const type of orderedTypes) {
7025
+ for (const mark of marks) {
7026
+ if (mark.type !== type) continue;
7027
+ parts.push(serializeRunPropertyMark3(mark));
7030
7028
  }
7031
7029
  }
7032
7030
  return parts.length > 0 ? `<w:rPr>${parts.join("")}</w:rPr>` : "";
7033
7031
  }
7032
+ function serializeRunPropertyMark3(mark) {
7033
+ switch (mark.type) {
7034
+ case "bold":
7035
+ return "<w:b/>";
7036
+ case "italic":
7037
+ return "<w:i/>";
7038
+ case "underline":
7039
+ return `<w:u w:val="single"/>`;
7040
+ case "strikethrough":
7041
+ return "<w:strike/>";
7042
+ case "doubleStrikethrough":
7043
+ return "<w:dstrike/>";
7044
+ case "fontFamily":
7045
+ return `<w:rFonts w:ascii="${escapeXmlAttribute2(mark.val)}" w:hAnsi="${escapeXmlAttribute2(mark.val)}"/>`;
7046
+ case "fontSize":
7047
+ return `<w:sz w:val="${twip(mark.val)}"/>`;
7048
+ case "textColor":
7049
+ return `<w:color w:val="${escapeXmlAttribute2(mark.color)}"/>`;
7050
+ case "smallCaps":
7051
+ return "<w:smallCaps/>";
7052
+ case "allCaps":
7053
+ return "<w:caps/>";
7054
+ default:
7055
+ throw new Error(`Cannot safely serialize ${mark.type} marks in note sub-parts.`);
7056
+ }
7057
+ }
7034
7058
  function compareNoteIds(left, right) {
7035
7059
  return Number.parseInt(left.noteId, 10) - Number.parseInt(right.noteId, 10);
7036
7060
  }
@@ -14825,8 +14849,7 @@ function resolveContentType(path, contentTypes) {
14825
14849
  // src/io/ooxml/parse-bookmark-references.ts
14826
14850
  var HYPERLINK_ANCHOR_RE = /<(?:\w+:)?hyperlink\b[^>]*\bw:anchor\s*=\s*"([^"]*)"/gi;
14827
14851
  var INSTR_TEXT_RE = /<(?:\w+:)?instrText\b[^>]*>([\s\S]*?)<\/(?:\w+:)?instrText>/gi;
14828
- var FLD_SIMPLE_INSTR_DOUBLE_RE = /<(?:\w+:)?fldSimple\b[^>]*?\b(?:w:)?instr\s*=\s*"([^"]*)"/gi;
14829
- var FLD_SIMPLE_INSTR_SINGLE_RE = /<(?:\w+:)?fldSimple\b[^>]*?\b(?:w:)?instr\s*=\s*'([^']*)'/gi;
14852
+ var FLD_SIMPLE_INSTR_RE = /<(?:\w+:)?fldSimple\b[^>]*\bw:instr\s*=\s*(["'])([\s\S]*?)\1/gi;
14830
14853
  var TOC_FIELD_RE = /\bTOC\b/;
14831
14854
  var REFLIKE_FIELD_RE = /\b(?:HYPERLINK|REF|PAGEREF|NOTEREF)\s+([A-Za-z0-9_:.\-]+)/g;
14832
14855
  var DATA_BINDING_RE = /<(?:\w+:)?dataBinding\b/i;
@@ -14845,21 +14868,14 @@ function scanBookmarkReferences(documentXml, callerAllowlist = []) {
14845
14868
  }
14846
14869
  INSTR_TEXT_RE.lastIndex = 0;
14847
14870
  while ((m = INSTR_TEXT_RE.exec(documentXml)) !== null) {
14848
- const instrText = m[1] ?? "";
14849
- scanFieldInstruction(instrText, retained, () => {
14850
- retainAllToc = true;
14871
+ retainInstructionReferences(m[1] ?? "", retained, (value) => {
14872
+ retainAllToc = retainAllToc || value;
14851
14873
  });
14852
14874
  }
14853
- FLD_SIMPLE_INSTR_DOUBLE_RE.lastIndex = 0;
14854
- while ((m = FLD_SIMPLE_INSTR_DOUBLE_RE.exec(documentXml)) !== null) {
14855
- scanFieldInstruction(decodeXmlAttribute(m[1] ?? ""), retained, () => {
14856
- retainAllToc = true;
14857
- });
14858
- }
14859
- FLD_SIMPLE_INSTR_SINGLE_RE.lastIndex = 0;
14860
- while ((m = FLD_SIMPLE_INSTR_SINGLE_RE.exec(documentXml)) !== null) {
14861
- scanFieldInstruction(decodeXmlAttribute(m[1] ?? ""), retained, () => {
14862
- retainAllToc = true;
14875
+ FLD_SIMPLE_INSTR_RE.lastIndex = 0;
14876
+ while ((m = FLD_SIMPLE_INSTR_RE.exec(documentXml)) !== null) {
14877
+ retainInstructionReferences(m[2] ?? "", retained, (value) => {
14878
+ retainAllToc = retainAllToc || value;
14863
14879
  });
14864
14880
  }
14865
14881
  retainRevisionBoundedBookmarks(documentXml, retained);
@@ -14869,17 +14885,14 @@ function scanBookmarkReferences(documentXml, callerAllowlist = []) {
14869
14885
  retainAll
14870
14886
  };
14871
14887
  }
14872
- function scanFieldInstruction(instrText, retained, retainToc) {
14873
- if (TOC_FIELD_RE.test(instrText)) retainToc();
14888
+ function retainInstructionReferences(instrText, retained, setRetainAllToc) {
14889
+ if (TOC_FIELD_RE.test(instrText)) setRetainAllToc(true);
14874
14890
  REFLIKE_FIELD_RE.lastIndex = 0;
14875
14891
  let r;
14876
14892
  while ((r = REFLIKE_FIELD_RE.exec(instrText)) !== null) {
14877
14893
  if (r[1]) retained.add(r[1]);
14878
14894
  }
14879
14895
  }
14880
- function decodeXmlAttribute(value) {
14881
- return value.replace(/&quot;/g, '"').replace(/&apos;/g, "'").replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&amp;/g, "&");
14882
- }
14883
14896
  function retainRevisionBoundedBookmarks(documentXml, retained) {
14884
14897
  const starts = /* @__PURE__ */ new Map();
14885
14898
  BOOKMARK_START_RE.lastIndex = 0;
@@ -1,7 +1,7 @@
1
- export { D as DocxSession, S as SessionNotOpenError, a as SessionNotWiredError } from './session-BnGIjaex.cjs';
2
- export { L as LoadedDocxEditorSession, l as loadDocxSessionAsync } from './loader-B8TKhmQi.cjs';
3
- export { E as EmbeddedDocumentManifest, a as ExportOptions, O as OpenOptions, b as OpenResult, P as PreservationSnapshot, R as ReopenBarrier, V as ValidateOptions, c as ValidationFinding, d as ValidationReport, i as isReopenBarrier } from './types-BLuvZ6cQ.cjs';
4
- export { E as EditorHostAdapter, a as EditorSessionState, b as ExportDocxOptions, c as ExportResult, L as LoadStage, P as PersistedEditorSnapshot } from './public-types-B5CRoR6f.cjs';
1
+ export { D as DocxSession, S as SessionNotOpenError, a as SessionNotWiredError } from './session-BUN6B-Vj.cjs';
2
+ export { L as LoadedDocxEditorSession, l as loadDocxSessionAsync } from './loader-DiY_ZgKl.cjs';
3
+ export { E as EmbeddedDocumentManifest, a as ExportOptions, O as OpenOptions, b as OpenResult, P as PreservationSnapshot, R as ReopenBarrier, V as ValidateOptions, c as ValidationFinding, d as ValidationReport, i as isReopenBarrier } from './types-C4bz3kDU.cjs';
4
+ export { E as EditorHostAdapter, a as EditorSessionState, b as ExportDocxOptions, c as ExportResult, L as LoadStage, P as PersistedEditorSnapshot } from './public-types-gvubspUI.cjs';
5
5
  import './canonical-document-BMtONpgf.cjs';
6
6
  import 'react';
7
7
  import 'yjs';
package/dist/session.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- export { D as DocxSession, S as SessionNotOpenError, a as SessionNotWiredError } from './session-vEYKf-w3.js';
2
- export { L as LoadedDocxEditorSession, l as loadDocxSessionAsync } from './loader-4qsw4eIU.js';
3
- export { E as EmbeddedDocumentManifest, a as ExportOptions, O as OpenOptions, b as OpenResult, P as PreservationSnapshot, R as ReopenBarrier, V as ValidateOptions, c as ValidationFinding, d as ValidationReport, i as isReopenBarrier } from './types-Dutlyj0T.js';
4
- export { E as EditorHostAdapter, a as EditorSessionState, b as ExportDocxOptions, c as ExportResult, L as LoadStage, P as PersistedEditorSnapshot } from './public-types-p9b8rfy8.js';
1
+ export { D as DocxSession, S as SessionNotOpenError, a as SessionNotWiredError } from './session-CDB0hohT.js';
2
+ export { L as LoadedDocxEditorSession, l as loadDocxSessionAsync } from './loader-B-aL5HGD.js';
3
+ export { E as EmbeddedDocumentManifest, a as ExportOptions, O as OpenOptions, b as OpenResult, P as PreservationSnapshot, R as ReopenBarrier, V as ValidateOptions, c as ValidationFinding, d as ValidationReport, i as isReopenBarrier } from './types-VWH6CRvG.js';
4
+ export { E as EditorHostAdapter, a as EditorSessionState, b as ExportDocxOptions, c as ExportResult, L as LoadStage, P as PersistedEditorSnapshot } from './public-types-DyqnxxO9.js';
5
5
  import './canonical-document-BMtONpgf.js';
6
6
  import 'react';
7
7
  import 'yjs';