@stll/folio-core 0.37.5 → 0.38.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (121) hide show
  1. package/dist/ai-edits/apply.js +275 -88
  2. package/dist/ai-edits/clean-text.js +12 -1
  3. package/dist/ai-edits/headless.d.ts +110 -0
  4. package/dist/ai-edits/headless.js +569 -40
  5. package/dist/ai-edits/snapshot.d.ts +24 -1
  6. package/dist/ai-edits/snapshot.js +206 -9
  7. package/dist/ai-edits/table-geometry.d.ts +7 -7
  8. package/dist/ai-edits/table-geometry.js +43 -27
  9. package/dist/ai-edits/table-template.d.ts +2 -1
  10. package/dist/ai-edits/table-template.js +9 -3
  11. package/dist/ai-edits/types.d.ts +37 -15
  12. package/dist/compare/__fixtures__/body-sequence.d.ts +4 -0
  13. package/dist/compare/__fixtures__/body-sequence.js +5 -3
  14. package/dist/compare/compare.d.ts +26 -2
  15. package/dist/compare/compare.js +444 -16
  16. package/dist/compare/content-alignment.js +3 -2
  17. package/dist/compare/content-types.d.ts +34 -2
  18. package/dist/compare/content.d.ts +13 -10
  19. package/dist/compare/content.js +69 -23
  20. package/dist/compare/formatting.d.ts +4 -22
  21. package/dist/compare/formatting.js +8 -112
  22. package/dist/compare/inline-atom-resources.d.ts +6 -0
  23. package/dist/compare/inline-atom-resources.js +26 -0
  24. package/dist/compare/inline-atoms.d.ts +35 -0
  25. package/dist/compare/inline-atoms.js +383 -0
  26. package/dist/compare/inline-provenance.d.ts +36 -0
  27. package/dist/compare/inline-provenance.js +334 -0
  28. package/dist/compare/plan.d.ts +4 -1
  29. package/dist/compare/plan.js +32 -4
  30. package/dist/compare/scenario.d.ts +4 -6
  31. package/dist/compare/section-boundary-properties.d.ts +63 -0
  32. package/dist/compare/section-boundary-properties.js +235 -0
  33. package/dist/compare/style-resources.d.ts +30 -0
  34. package/dist/compare/style-resources.js +404 -0
  35. package/dist/compare/types.d.ts +50 -11
  36. package/dist/compare/types.js +3 -1
  37. package/dist/compare/verification.d.ts +3 -5
  38. package/dist/compare/verification.js +8 -39
  39. package/dist/compat/eigenpal.d.ts +4 -4
  40. package/dist/compat/eigenpal.js +3 -3
  41. package/dist/document-operations.d.ts +5 -3
  42. package/dist/document-operations.js +112 -5
  43. package/dist/docx/blockContentParser.js +14 -2
  44. package/dist/docx/drawingIdNormalization.js +43 -2
  45. package/dist/docx/drawingRelationships.d.ts +10 -0
  46. package/dist/docx/drawingRelationships.js +28 -0
  47. package/dist/docx/fieldParser.js +1 -1
  48. package/dist/docx/hyperlinkParser.js +3 -5
  49. package/dist/docx/imageRawXml.d.ts +8 -0
  50. package/dist/docx/imageRawXml.js +13 -0
  51. package/dist/docx/newImage.d.ts +2 -2
  52. package/dist/docx/newImage.js +3 -3
  53. package/dist/docx/numberingParser.js +30 -27
  54. package/dist/docx/paragraphParser.js +11 -4
  55. package/dist/docx/removeHeaderFooterParts.d.ts +14 -0
  56. package/dist/docx/removeHeaderFooterParts.js +87 -0
  57. package/dist/docx/rezip.d.ts +3 -1
  58. package/dist/docx/rezip.js +143 -41
  59. package/dist/docx/runParser.js +16 -5
  60. package/dist/docx/sectionParser.js +3 -0
  61. package/dist/docx/sectionReferenceHistory.d.ts +17 -0
  62. package/dist/docx/sectionReferenceHistory.js +59 -0
  63. package/dist/docx/selectiveSave.js +11 -31
  64. package/dist/docx/selectiveXmlPatch.d.ts +8 -1
  65. package/dist/docx/selectiveXmlPatch.js +62 -2
  66. package/dist/docx/serializer/paragraphSerializer.js +2 -0
  67. package/dist/docx/serializer/partNamespaces.d.ts +1 -1
  68. package/dist/docx/serializer/partNamespaces.js +4 -0
  69. package/dist/docx/serializer/runSerializer.js +2 -1
  70. package/dist/docx/serializer/sectionPropertiesSerializer.js +5 -2
  71. package/dist/docx/serializer/textFormattingSerializer.d.ts +1 -1
  72. package/dist/docx/serializer/textFormattingSerializer.js +3 -1
  73. package/dist/docx/tableParser.js +21 -11
  74. package/dist/docx/xmlParser.d.ts +10 -1
  75. package/dist/docx/xmlParser.js +23 -1
  76. package/dist/index.d.ts +4 -4
  77. package/dist/index.js +3 -3
  78. package/dist/internal/compare/inline-presentation.d.ts +20 -0
  79. package/dist/internal/compare/inline-presentation.js +222 -0
  80. package/dist/internal/paragraphFormattingSerialization.d.ts +3 -1
  81. package/dist/internal/paragraphFormattingSerialization.js +8 -1
  82. package/dist/internal/sectionReferenceResolution.d.ts +21 -0
  83. package/dist/internal/sectionReferenceResolution.js +72 -0
  84. package/dist/layout-bridge/convert/toFlowBlocks.js +1 -0
  85. package/dist/markdown/renderRuns.js +1 -0
  86. package/dist/markdown/renderTable.js +1 -0
  87. package/dist/prosemirror/attrs/index.js +20 -1
  88. package/dist/prosemirror/commands/comments.d.ts +11 -1
  89. package/dist/prosemirror/commands/comments.js +68 -6
  90. package/dist/prosemirror/commands/propertyChangeScope.d.ts +9 -3
  91. package/dist/prosemirror/commands/propertyChangeScope.js +4 -10
  92. package/dist/prosemirror/conversion/fromProseDoc.js +16 -8
  93. package/dist/prosemirror/conversion/toProseDoc.js +16 -57
  94. package/dist/prosemirror/extensions/core/ParagraphExtension.js +2 -0
  95. package/dist/prosemirror/extensions/marks/RunFormattingOverrideExtension.js +3 -0
  96. package/dist/prosemirror/imageCommit.js +7 -9
  97. package/dist/prosemirror/paragraphIndentation.d.ts +21 -0
  98. package/dist/prosemirror/paragraphIndentation.js +72 -0
  99. package/dist/prosemirror/plugins/documentNumbering.d.ts +3 -1
  100. package/dist/prosemirror/plugins/documentNumbering.js +7 -1
  101. package/dist/prosemirror/plugins/documentStyles.d.ts +3 -1
  102. package/dist/prosemirror/plugins/documentStyles.js +7 -1
  103. package/dist/prosemirror/rebaseParagraphRunFormatting.d.ts +3 -1
  104. package/dist/prosemirror/rebaseParagraphRunFormatting.js +2 -1
  105. package/dist/prosemirror/runFormattingInlineCarriers.d.ts +15 -2
  106. package/dist/prosemirror/runFormattingInlineCarriers.js +33 -3
  107. package/dist/prosemirror/runStyleFormatting.d.ts +15 -2
  108. package/dist/prosemirror/runStyleFormatting.js +76 -2
  109. package/dist/prosemirror/schema/marks.d.ts +3 -1
  110. package/dist/prosemirror/schema/marks.js +2 -0
  111. package/dist/prosemirror/schema/nodes.d.ts +3 -0
  112. package/dist/prosemirror/tableCellRevisionVisibility.d.ts +6 -0
  113. package/dist/prosemirror/tableCellRevisionVisibility.js +14 -0
  114. package/dist/prosemirror/trackedRunInlineAtoms.d.ts +1 -1
  115. package/dist/prosemirror/trackedRunInlineAtoms.js +1 -1
  116. package/dist/redline.js +15 -2
  117. package/dist/server.d.ts +2 -2
  118. package/dist/server.js +2 -2
  119. package/dist/version-comparison.d.ts +2 -0
  120. package/dist/version-comparison.js +7 -2
  121. package/package.json +2 -2
@@ -1,8 +1,9 @@
1
+ import { imageRawXmlFingerprint } from "../../docx/imageRawXml.js";
1
2
  import { PROSE_PARAGRAPH_SOURCE_CONTRACT_ATTR, ParagraphPropertySourceValidationError, copyDocumentParagraphPropertySourceContract, copyDocumentParagraphPropertySources, copyParagraphPropertyCapture, copyParagraphPropertySource, decodeTableCellParagraphSourcePayload, getDocumentParagraphPropertySourceContract, getParagraphPropertySource, getParagraphPropertySourceCandidate, getParagraphPropertySourceToken, getParagraphPropertySourceTransferId, getProseDocumentParagraphPropertySourceContract, getProseParagraphPropertySourceToken, isParagraphPropertySourceToken, linkParagraphPropertySourceCandidate, paragraphPropertySourceBelongsToDocument, paragraphPropertySourceTokenMatchesContract, recreateProseNodeWithParagraphPropertySource, restoreTableCellsWithParagraphPropertySources, visitDocumentStoryParagraphs, visitTableCellParagraphPropertySourceBindings } from "../../docx/paragraphPropertySource.js";
2
3
  import { visitDocxParagraphs } from "../../docx/paragraphTraversal.js";
3
4
  import { ShapeOutlineStyleSchema, narrowEnum } from "../../docx/parserEnums.js";
4
5
  import { DATE_UTC_ATTRIBUTE } from "../../docx/trackedChangeInfo.js";
5
- import { isStyleSourcedParagraphNumbering, modelParagraphFormattingEmission, paragraphNumberingReferencesEqual } from "../../internal/paragraphFormattingSerialization.js";
6
+ import { isStyleSourcedParagraphNumbering, modelParagraphFormattingEmission, sameAuthoredParagraphNumberingReference } from "../../internal/paragraphFormattingSerialization.js";
6
7
  import { createStyleEngine } from "../../style-engine/styleEngine.js";
7
8
  import { OUTLINE_STYLE_CSS_ALIASES, normalizeShapeTextAnchor } from "../../types/documentEnumValues.js";
8
9
  import { canonicalJson } from "../../utils/canonicalJson.js";
@@ -742,6 +743,7 @@ function convertPMParagraph(node, documentCounts, textBoxAnchorMarkers, styleRes
742
743
  };
743
744
  if (attrs.paraId) paragraph.paraId = attrs.paraId;
744
745
  if (attrs.textId) paragraph.textId = attrs.textId;
746
+ if (attrs.reviewCarrier) paragraph.reviewCarrier = attrs.reviewCarrier;
745
747
  const pFormatting = paragraphAttrsToFormatting(attrs);
746
748
  if (pFormatting) paragraph.formatting = pFormatting;
747
749
  const listRendering = listRenderingFromAttrs(attrs);
@@ -829,7 +831,7 @@ function paragraphAttrsToFormatting(attrs) {
829
831
  if (isStyleSourcedParagraphNumbering(attrs.numPr, attrs.numPrFromStyle)) {
830
832
  delete result.numPr;
831
833
  delete result.numPrFromStyle;
832
- } else if (attrs.numPr !== orig.numPr && !paragraphNumberingReferencesEqual(attrs.numPr, orig.numPr)) {
834
+ } else if (attrs.numPr !== orig.numPr && !sameAuthoredParagraphNumberingReference(attrs.numPr, orig.numPr)) {
833
835
  if (attrs.numPr) result.numPr = attrs.numPr;
834
836
  else delete result.numPr;
835
837
  delete result.numPrFromStyle;
@@ -1137,6 +1139,10 @@ function extractParagraphContent(paragraph, _documentCounts, emptyHyperlinks, te
1137
1139
  }));
1138
1140
  return;
1139
1141
  }
1142
+ if (node.type.name === "math") {
1143
+ currentTrackedChange.wrapper.content.push(createMathFromNode(node));
1144
+ return;
1145
+ }
1140
1146
  const run = createTrackedChangeRun({
1141
1147
  ...formattingContext,
1142
1148
  marks: otherMarks,
@@ -1710,9 +1716,6 @@ function createFieldFromNode(node, { baseParagraphFormatting, inheritedFormattin
1710
1716
  case "NUMPAGES":
1711
1717
  displayText = "1";
1712
1718
  break;
1713
- default:
1714
- displayText = " ";
1715
- break;
1716
1719
  }
1717
1720
  const displayRun = {
1718
1721
  type: "run",
@@ -1724,13 +1727,14 @@ function createFieldFromNode(node, { baseParagraphFormatting, inheritedFormattin
1724
1727
  };
1725
1728
  if (marks && node.type.name === "field") restoreRunPropertyChanges(displayRun, marks);
1726
1729
  const fieldContent = extractedContent.length > 0 ? synchronizeFieldDisplayText(extractedContent, displayText, displayRun) : [];
1730
+ const fallbackFieldContent = displayText ? [displayRun] : [];
1727
1731
  if (attrs.fieldKind === "complex") {
1728
1732
  const complex = {
1729
1733
  type: "complexField",
1730
1734
  instruction: attrs.instruction,
1731
1735
  fieldType: attrs.fieldType,
1732
1736
  fieldCode: [],
1733
- fieldResult: fieldContent.length > 0 ? fieldContent.filter((content) => content.type === "run") : [displayRun]
1737
+ fieldResult: fieldContent.length > 0 ? fieldContent.filter((content) => content.type === "run") : fallbackFieldContent
1734
1738
  };
1735
1739
  if (attrs.fldLock) complex.fldLock = true;
1736
1740
  if (attrs.dirty) complex.dirty = true;
@@ -1740,7 +1744,7 @@ function createFieldFromNode(node, { baseParagraphFormatting, inheritedFormattin
1740
1744
  type: "simpleField",
1741
1745
  instruction: attrs.instruction,
1742
1746
  fieldType: attrs.fieldType,
1743
- content: fieldContent.length > 0 ? fieldContent : [displayRun]
1747
+ content: fieldContent.length > 0 ? fieldContent : fallbackFieldContent
1744
1748
  };
1745
1749
  if (attrs.fldLock) simple.fldLock = true;
1746
1750
  if (attrs.dirty) simple.dirty = true;
@@ -1873,7 +1877,8 @@ function createImageRun(node) {
1873
1877
  } : {
1874
1878
  type: "drawing",
1875
1879
  image,
1876
- ...attrs._docxRawXml ? { rawXml: attrs._docxRawXml } : {}
1880
+ ...attrs._docxRawXml ? { rawXml: attrs._docxRawXml } : {},
1881
+ ...attrs._docxRawXml ? { rawImageFingerprint: imageRawXmlFingerprint(image) } : {}
1877
1882
  }]
1878
1883
  };
1879
1884
  }
@@ -1959,6 +1964,7 @@ const RUN_FORMATTING_VISUAL_GROUPS = {
1959
1964
  smallCaps: "smallCaps",
1960
1965
  allCaps: "allCaps",
1961
1966
  hidden: "hidden",
1967
+ noProof: null,
1962
1968
  color: "color",
1963
1969
  highlight: "highlight",
1964
1970
  shading: "shading",
@@ -1992,6 +1998,7 @@ const RUN_FORMATTING_FAST_PATH_DISPOSITION = {
1992
1998
  smallCaps: "visual",
1993
1999
  allCaps: "visual",
1994
2000
  hidden: "visual",
2001
+ noProof: "structural",
1995
2002
  color: "visual",
1996
2003
  highlight: "visual",
1997
2004
  shading: "visual",
@@ -2181,6 +2188,7 @@ const DIRECT_OVERRIDE_FORMATTING_PROPERTIES = [
2181
2188
  "emboss",
2182
2189
  "fontSizeCs",
2183
2190
  "hidden",
2191
+ "noProof",
2184
2192
  "imprint",
2185
2193
  "italic",
2186
2194
  "italicCs",
@@ -13,7 +13,7 @@ import { stampNumberedRefFieldBaselines } from "../numberedRefFields.js";
13
13
  import { pageBreakRunParagraphProjectionDispositionForFeatures } from "../pageBreakRunProjection.js";
14
14
  import { directionFromBidi } from "../paragraphDirection.js";
15
15
  import { lineSpacingProvenanceFromSpacing } from "../paragraphSpacing.js";
16
- import { getParagraphMarkSuppressionOverrides, hasDirectRunFormatting, stripParagraphMarkFormattingForBodyRuns, stripParagraphMarkOnlyFormatting, suppressParagraphMarkFormatting } from "../runStyleFormatting.js";
16
+ import { getParagraphMarkSuppressionOverrides, hasDirectRunFormatting, resolveParagraphBodyRunFormatting, stripParagraphMarkFormattingForBodyRuns, stripParagraphMarkOnlyFormatting, suppressParagraphMarkFormatting } from "../runStyleFormatting.js";
17
17
  import { schema } from "../schema/index.js";
18
18
  import { COMPLEX_SCRIPT_RUN_PROPERTY_KEYS } from "../schema/marks.js";
19
19
  import { cascadeStyleTextFormatting } from "../styles/styleToggleCascade.js";
@@ -202,45 +202,14 @@ function convertParagraph(paragraph, styleResolver, context, activeCommentIds, e
202
202
  if (!node) return;
203
203
  emitInlineNodes([node]);
204
204
  };
205
- let styleRunFormatting;
206
- let paragraphStyleRunFormatting;
207
- let paragraphStyleFontFamily;
208
- if (styleResolver) {
209
- const resolved = styleResolver.resolveParagraphStyle(paragraph.formatting?.styleId);
210
- styleRunFormatting = extraRunFormatting === void 0 ? resolved.runFormatting : withoutFontFamily(resolved.runFormatting);
211
- const paragraphStyle = paragraph.formatting?.styleId ? styleResolver.getStyle(paragraph.formatting.styleId) ?? styleResolver.getDefaultParagraphStyle() : styleResolver.getDefaultParagraphStyle();
212
- paragraphStyleRunFormatting = paragraphStyle?.type === "paragraph" ? paragraphStyle.rPr : void 0;
213
- paragraphStyleFontFamily = resolveParagraphStyleFontFamily(paragraph.formatting?.styleId, styleResolver);
214
- }
215
205
  const paragraphRunFormatting = resolveRunFormattingWithoutDefaults(paragraph.formatting?.runProperties, styleResolver);
216
206
  let inheritableParagraphRunFormatting;
217
207
  if (paragraphRunFormatting && !isTocParagraph && paragraph.formatting?.styleId === void 0) inheritableParagraphRunFormatting = stripParagraphMarkFormattingForBodyRuns(paragraphRunFormatting);
218
- const ordinaryStyleFormatting = paragraph.formatting?.styleId === void 0 ? mergeTextFormatting(styleRunFormatting, extraRunFormatting) : mergeTextFormatting(extraRunFormatting, styleRunFormatting);
219
- const orderedToggleFormatting = cascadeStyleTextFormatting([
220
- {
221
- formatting: styleResolver?.getDocDefaults()?.rPr,
222
- type: "defaults"
223
- },
224
- {
225
- formatting: extraRunFormatting,
226
- type: "style"
227
- },
228
- {
229
- formatting: paragraphStyleRunFormatting,
230
- type: "style"
231
- }
232
- ], { ordinaryFormatting: ordinaryStyleFormatting });
233
- let baseRunFormatting = orderedToggleFormatting.formatting;
234
- if (paragraphStyleFontFamily) baseRunFormatting = mergeTextFormatting(baseRunFormatting, { fontFamily: paragraphStyleFontFamily });
235
- const defaultCharacterFormatting = styleResolver?.getDefaultCharacterStyle()?.rPr;
236
- const ordinaryBaseWithDefaultCharacter = mergeTextFormatting(defaultCharacterFormatting, baseRunFormatting);
237
- const defaultCharacterStyleCascade = cascadeStyleTextFormatting([{
238
- cascade: orderedToggleFormatting,
239
- type: "carried"
240
- }, {
241
- formatting: defaultCharacterFormatting,
242
- type: "style"
243
- }], { ordinaryFormatting: ordinaryBaseWithDefaultCharacter });
208
+ const { baseFormatting: baseRunFormatting, baseToggleCascade: orderedToggleFormatting, defaultFormatting: ordinaryBaseWithDefaultCharacter, defaultToggleCascade: defaultCharacterStyleCascade } = resolveParagraphBodyRunFormatting({
209
+ styleId: paragraph.formatting?.styleId,
210
+ tableRunFormatting: extraRunFormatting,
211
+ styleResolver
212
+ });
244
213
  const ordinaryDefaultRunFormatting = mergeTextFormatting(ordinaryBaseWithDefaultCharacter, inheritableParagraphRunFormatting);
245
214
  const defaultToggleCascade = cascadeStyleTextFormatting([{
246
215
  cascade: defaultCharacterStyleCascade,
@@ -250,8 +219,11 @@ function convertParagraph(paragraph, styleResolver, context, activeCommentIds, e
250
219
  type: "direct"
251
220
  }], { ordinaryFormatting: ordinaryDefaultRunFormatting });
252
221
  const defaultRunFormatting = defaultToggleCascade.formatting;
253
- if (extraRunFormatting !== void 0) if (defaultRunFormatting) attrs.defaultTextFormatting = defaultRunFormatting;
254
- else delete attrs.defaultTextFormatting;
222
+ if (extraRunFormatting !== void 0) {
223
+ attrs._tableRunFormatting = extraRunFormatting;
224
+ if (defaultRunFormatting) attrs.defaultTextFormatting = defaultRunFormatting;
225
+ else delete attrs.defaultTextFormatting;
226
+ }
255
227
  const getInheritedRunFormatting = (formatting, fieldType) => {
256
228
  const hasCharacterStyle = formatting?.styleId !== void 0;
257
229
  const inheritedBaseFormatting = hasCharacterStyle ? baseRunFormatting : ordinaryBaseWithDefaultCharacter;
@@ -350,24 +322,6 @@ function convertParagraph(paragraph, styleResolver, context, activeCommentIds, e
350
322
  content: inlineNodes
351
323
  });
352
324
  }
353
- const withoutFontFamily = (formatting) => {
354
- if (!formatting?.fontFamily) return formatting;
355
- const { fontFamily: _fontFamily, ...withoutFont } = formatting;
356
- return Object.keys(withoutFont).length > 0 ? withoutFont : void 0;
357
- };
358
- const resolveParagraphStyleFontFamily = (styleId, styleResolver) => {
359
- let style = styleId ? styleResolver.getStyle(styleId) : styleResolver.getDefaultParagraphStyle();
360
- const visited = /* @__PURE__ */ new Set();
361
- const styleChain = [];
362
- while (style?.type === "paragraph" && !visited.has(style.styleId)) {
363
- visited.add(style.styleId);
364
- if (style.rPr?.fontFamily) styleChain.push({ fontFamily: style.rPr.fontFamily });
365
- style = style.basedOn ? styleResolver.getStyle(style.basedOn) : void 0;
366
- }
367
- let formatting;
368
- for (const styleFormatting of styleChain.toReversed()) formatting = mergeTextFormatting(formatting, styleFormatting);
369
- return formatting?.fontFamily;
370
- };
371
325
  /**
372
326
  * Apply comment marks to PM nodes within a comment range.
373
327
  */
@@ -418,6 +372,9 @@ function convertTrackedChange(change, markType, nextHyperlinkInstanceIndex, next
418
372
  textBoxAnchors
419
373
  });
420
374
  if (fieldNode) nodes.push(fieldNode);
375
+ } else if (item.type === "mathEquation") {
376
+ const mathNode = convertMathEquation(item);
377
+ if (mathNode) nodes.push(mathNode);
421
378
  } else if (item.type === "insertion" || item.type === "deletion" || item.type === "moveFrom" || item.type === "moveTo") {
422
379
  const nestedMarkType = item.type === "insertion" || item.type === "moveTo" ? "insertion" : "deletion";
423
380
  const nestedMoveKind = item.type === "moveFrom" || item.type === "moveTo" ? item.type : null;
@@ -460,6 +417,7 @@ function paragraphFormattingToAttrs(paragraph, styleResolver, tableParagraphOver
460
417
  const attrs = {};
461
418
  if (paragraph.paraId) attrs.paraId = paragraph.paraId;
462
419
  if (paragraph.textId) attrs.textId = paragraph.textId;
420
+ if (paragraph.reviewCarrier) attrs.reviewCarrier = paragraph.reviewCarrier;
463
421
  if (styleId) attrs.styleId = styleId;
464
422
  if (tableOfContentsLevel !== void 0) attrs._tableOfContentsLevel = tableOfContentsLevel;
465
423
  if (formatting?.numPr) attrs.numPr = formatting.numPr;
@@ -1415,6 +1373,7 @@ const RUN_FORMATTING_INFERENCE = {
1415
1373
  smallCaps: "visible-boolean",
1416
1374
  allCaps: "visible-boolean",
1417
1375
  hidden: "visible-boolean",
1376
+ noProof: "structural",
1418
1377
  color: "color",
1419
1378
  highlight: "visible-value",
1420
1379
  shading: "preserve",
@@ -188,6 +188,7 @@ const paragraphNodeSpec = {
188
188
  [PROSE_PARAGRAPH_SOURCE_TOKEN_ATTR]: { default: null },
189
189
  idStability: { default: void 0 },
190
190
  textId: { default: null },
191
+ reviewCarrier: { default: void 0 },
191
192
  alignment: { default: null },
192
193
  alignmentFromStyle: { default: void 0 },
193
194
  kinsoku: { default: null },
@@ -240,6 +241,7 @@ const paragraphNodeSpec = {
240
241
  contextualSpacing: { default: null },
241
242
  runInWithNext: { default: null },
242
243
  defaultTextFormatting: { default: null },
244
+ _tableRunFormatting: { default: void 0 },
243
245
  sectionBreakType: { default: null },
244
246
  direction: { default: null },
245
247
  outlineLevel: { default: null },
@@ -19,6 +19,7 @@ function buildRunFormattingOverrideAttrs(formatting, options) {
19
19
  if (formatting?.allCaps !== void 0) attrs.allCaps = formatting.allCaps;
20
20
  if (formatting?.smallCaps !== void 0) attrs.smallCaps = formatting.smallCaps;
21
21
  if (formatting?.hidden !== void 0) attrs.hidden = formatting.hidden;
22
+ if (formatting?.noProof !== void 0) attrs.noProof = formatting.noProof;
22
23
  if (formatting?.emboss !== void 0) attrs.emboss = formatting.emboss;
23
24
  if (formatting?.imprint !== void 0) attrs.imprint = formatting.imprint;
24
25
  if (formatting?.shadow !== void 0) attrs.shadow = formatting.shadow;
@@ -58,6 +59,7 @@ function applyRunFormattingOverrideAttrs(formatting, attrs) {
58
59
  if (attrs.allCaps !== void 0) formatting.allCaps = attrs.allCaps;
59
60
  if (attrs.smallCaps !== void 0) formatting.smallCaps = attrs.smallCaps;
60
61
  if (attrs.hidden !== void 0) formatting.hidden = attrs.hidden;
62
+ if (attrs.noProof !== void 0) formatting.noProof = attrs.noProof;
61
63
  if (attrs.emboss !== void 0) formatting.emboss = attrs.emboss;
62
64
  if (attrs.imprint !== void 0) formatting.imprint = attrs.imprint;
63
65
  if (attrs.shadow !== void 0) formatting.shadow = attrs.shadow;
@@ -101,6 +103,7 @@ const RunFormattingOverrideExtension = createMarkExtension({
101
103
  allCaps: { default: null },
102
104
  smallCaps: { default: null },
103
105
  hidden: { default: null },
106
+ noProof: { default: null },
104
107
  emboss: { default: null },
105
108
  imprint: { default: null },
106
109
  shadow: { default: null },
@@ -1,3 +1,5 @@
1
+ import { expectImageAttrs, mergeImageAttrs } from "./attrs/index.js";
2
+ import { DRAWING_RAW_XML_MODES } from "@stll/docx-core/model";
1
3
  //#region src/prosemirror/imageCommit.ts
2
4
  const MIN_IMAGE_PX = 20;
3
5
  const MAX_IMAGE_PX = 2e3;
@@ -40,6 +42,7 @@ function isFloatingImage(node) {
40
42
  function imageNodeAt(view, pmPos) {
41
43
  const node = view.state.doc.nodeAt(pmPos);
42
44
  if (!node || node.type.name !== "image") return null;
45
+ if (expectImageAttrs(node)._docxRawXmlMode === DRAWING_RAW_XML_MODES.PRESERVE_ONLY) return null;
43
46
  return node;
44
47
  }
45
48
  /**
@@ -50,11 +53,10 @@ function commitImageResize(view, pmPos, newWidth, newHeight) {
50
53
  try {
51
54
  const node = imageNodeAt(view, pmPos);
52
55
  if (!node) return null;
53
- view.dispatch(view.state.tr.setNodeMarkup(pmPos, void 0, {
54
- ...node.attrs,
56
+ view.dispatch(view.state.tr.setNodeMarkup(pmPos, void 0, mergeImageAttrs(node, {
55
57
  width: newWidth,
56
58
  height: newHeight
57
- }));
59
+ })));
58
60
  return pmPos;
59
61
  } catch {
60
62
  return null;
@@ -69,7 +71,7 @@ function commitImageFloatMove(view, pmPos, hOffsetEmu, vOffsetEmu) {
69
71
  try {
70
72
  const node = imageNodeAt(view, pmPos);
71
73
  if (!node) return null;
72
- const newPosition = {
74
+ view.dispatch(view.state.tr.setNodeMarkup(pmPos, void 0, mergeImageAttrs(node, { position: {
73
75
  horizontal: {
74
76
  posOffset: hOffsetEmu,
75
77
  relativeTo: "margin"
@@ -78,11 +80,7 @@ function commitImageFloatMove(view, pmPos, hOffsetEmu, vOffsetEmu) {
78
80
  posOffset: vOffsetEmu,
79
81
  relativeTo: "margin"
80
82
  }
81
- };
82
- view.dispatch(view.state.tr.setNodeMarkup(pmPos, void 0, {
83
- ...node.attrs,
84
- position: newPosition
85
- }));
83
+ } })));
86
84
  return pmPos;
87
85
  } catch {
88
86
  return null;
@@ -0,0 +1,21 @@
1
+ import { document_d_exports } from "../types/document.js";
2
+ import { FolioContentParagraphIndentation } from "../compare/content-types.js";
3
+ import { ParagraphAttrs } from "./schema/nodes.js";
4
+ //#region src/prosemirror/paragraphIndentation.d.ts
5
+ /** The authored `w:ind` attribute cluster. */
6
+ type DirectParagraphIndentation = FolioContentParagraphIndentation;
7
+ /** Project only authored `w:ind` attributes, preserving zero and false. */
8
+ declare const paragraphIndentationFromFormatting: (formatting: document_d_exports.ParagraphFormatting | null | undefined) => DirectParagraphIndentation | undefined;
9
+ /** Read direct indentation without materializing values inherited from a style. */
10
+ declare const directParagraphIndentation: (attrs: ParagraphAttrs) => DirectParagraphIndentation | undefined;
11
+ declare const paragraphIndentationEqual: (left: DirectParagraphIndentation | null | undefined, right: DirectParagraphIndentation | null | undefined) => boolean;
12
+ /** Replace the complete direct `w:ind` cluster in canonical formatting. */
13
+ declare const withDirectParagraphIndentation: (formatting: document_d_exports.ParagraphFormatting | null | undefined, indentation: DirectParagraphIndentation | null | undefined) => document_d_exports.ParagraphFormatting | undefined;
14
+ type ParagraphIndentationAttrPatchOptions = {
15
+ direct: DirectParagraphIndentation | null | undefined;
16
+ inherited: DirectParagraphIndentation | null | undefined;
17
+ };
18
+ /** Project direct-over-inherited indentation into paragraph attrs. */
19
+ declare const paragraphIndentationAttrPatch: ({ direct, inherited }: ParagraphIndentationAttrPatchOptions) => Record<string, unknown>;
20
+ //#endregion
21
+ export { DirectParagraphIndentation, directParagraphIndentation, paragraphIndentationAttrPatch, paragraphIndentationEqual, paragraphIndentationFromFormatting, withDirectParagraphIndentation };
@@ -0,0 +1,72 @@
1
+ import { panic } from "better-result";
2
+ //#region src/prosemirror/paragraphIndentation.ts
3
+ const DIRECT_PARAGRAPH_INDENTATION_KEYS = [
4
+ "indentLeft",
5
+ "indentRight",
6
+ "indentFirstLine",
7
+ "hangingIndent"
8
+ ];
9
+ const copyIndentationValue = ({ target, key, value }) => {
10
+ switch (key) {
11
+ case "hangingIndent":
12
+ if (typeof value === "boolean") target.hangingIndent = value;
13
+ return;
14
+ case "indentLeft":
15
+ case "indentRight":
16
+ case "indentFirstLine":
17
+ if (typeof value === "number") target[key] = value;
18
+ return;
19
+ default: return panic("Unhandled paragraph indentation property", { key });
20
+ }
21
+ };
22
+ /** Project only authored `w:ind` attributes, preserving zero and false. */
23
+ const paragraphIndentationFromFormatting = (formatting) => {
24
+ if (!formatting) return;
25
+ const indentation = {};
26
+ for (const key of DIRECT_PARAGRAPH_INDENTATION_KEYS) copyIndentationValue({
27
+ target: indentation,
28
+ key,
29
+ value: formatting[key]
30
+ });
31
+ if (indentation.indentFirstLine !== void 0 && indentation.hangingIndent === void 0) indentation.hangingIndent = false;
32
+ return Object.keys(indentation).length > 0 ? indentation : void 0;
33
+ };
34
+ /** Read direct indentation without materializing values inherited from a style. */
35
+ const directParagraphIndentation = (attrs) => {
36
+ const original = paragraphIndentationFromFormatting(attrs._originalFormatting);
37
+ if (!original) return;
38
+ const indentation = {};
39
+ for (const key of DIRECT_PARAGRAPH_INDENTATION_KEYS) {
40
+ if (original[key] === void 0) continue;
41
+ copyIndentationValue({
42
+ target: indentation,
43
+ key,
44
+ value: attrs[key]
45
+ });
46
+ }
47
+ return Object.keys(indentation).length > 0 ? indentation : void 0;
48
+ };
49
+ const paragraphIndentationEqual = (left, right) => DIRECT_PARAGRAPH_INDENTATION_KEYS.every((key) => left?.[key] === right?.[key]);
50
+ /** Replace the complete direct `w:ind` cluster in canonical formatting. */
51
+ const withDirectParagraphIndentation = (formatting, indentation) => {
52
+ const result = { ...formatting };
53
+ for (const key of DIRECT_PARAGRAPH_INDENTATION_KEYS) Reflect.deleteProperty(result, key);
54
+ if (indentation) Object.assign(result, indentation);
55
+ return Object.keys(result).length > 0 ? result : void 0;
56
+ };
57
+ /** Project direct-over-inherited indentation into paragraph attrs. */
58
+ const paragraphIndentationAttrPatch = ({ direct, inherited }) => {
59
+ const effective = {
60
+ ...inherited,
61
+ ...direct
62
+ };
63
+ const hangingIndent = direct?.indentFirstLine === void 0 ? effective.hangingIndent ?? false : direct.hangingIndent === true;
64
+ return {
65
+ indentLeft: effective.indentLeft ?? null,
66
+ indentRight: effective.indentRight ?? null,
67
+ indentFirstLine: effective.indentFirstLine ?? null,
68
+ hangingIndent
69
+ };
70
+ };
71
+ //#endregion
72
+ export { directParagraphIndentation, paragraphIndentationAttrPatch, paragraphIndentationEqual, paragraphIndentationFromFormatting, withDirectParagraphIndentation };
@@ -4,5 +4,7 @@ import { EditorState, Plugin } from "prosemirror-state";
4
4
  //#region src/prosemirror/plugins/documentNumbering.d.ts
5
5
  declare const createDocumentNumberingPlugin: (definitions: document_d_exports.NumberingDefinitions | null | undefined) => Plugin;
6
6
  declare const getDocumentNumbering: (state: EditorState) => NumberingMap | null;
7
+ /** Replace numbering state while retaining every unrelated plugin state. */
8
+ declare const withDocumentNumbering: (state: EditorState, definitions: document_d_exports.NumberingDefinitions) => EditorState;
7
9
  //#endregion
8
- export { createDocumentNumberingPlugin, getDocumentNumbering };
10
+ export { createDocumentNumberingPlugin, getDocumentNumbering, withDocumentNumbering };
@@ -14,5 +14,11 @@ const createDocumentNumberingPlugin = (definitions) => {
14
14
  });
15
15
  };
16
16
  const getDocumentNumbering = (state) => documentNumberingKey.getState(state) ?? null;
17
+ /** Replace numbering state while retaining every unrelated plugin state. */
18
+ const withDocumentNumbering = (state, definitions) => {
19
+ const previous = documentNumberingKey.get(state);
20
+ const retained = state.plugins.filter((plugin) => plugin !== previous);
21
+ return state.reconfigure({ plugins: retained }).reconfigure({ plugins: [...retained, createDocumentNumberingPlugin(definitions)] });
22
+ };
17
23
  //#endregion
18
- export { createDocumentNumberingPlugin, getDocumentNumbering };
24
+ export { createDocumentNumberingPlugin, getDocumentNumbering, withDocumentNumbering };
@@ -13,5 +13,7 @@ declare const documentStylesKey: PluginKey<StyleResolver | null>;
13
13
  declare function createDocumentStylesPlugin(styles: document_d_exports.StyleDefinitions | StyleResolver | null | undefined): Plugin;
14
14
  /** Read the document's StyleResolver, or null when the plugin isn't installed. */
15
15
  declare function getDocumentStyleResolver(state: EditorState): StyleResolver | null;
16
+ /** Reconfigure so ProseMirror replaces the keyed plugin's resolver state. */
17
+ declare const withDocumentStyles: (state: EditorState, styles: document_d_exports.StyleDefinitions | StyleResolver | null | undefined) => EditorState;
16
18
  //#endregion
17
- export { createDocumentStylesPlugin, documentStylesKey, getDocumentStyleResolver };
19
+ export { createDocumentStylesPlugin, documentStylesKey, getDocumentStyleResolver, withDocumentStyles };
@@ -42,5 +42,11 @@ function createDocumentStylesPlugin(styles) {
42
42
  function getDocumentStyleResolver(state) {
43
43
  return documentStylesKey.getState(state) ?? null;
44
44
  }
45
+ /** Reconfigure so ProseMirror replaces the keyed plugin's resolver state. */
46
+ const withDocumentStyles = (state, styles) => {
47
+ const previous = documentStylesKey.get(state);
48
+ const retained = state.plugins.filter((plugin) => plugin !== previous);
49
+ return state.reconfigure({ plugins: retained }).reconfigure({ plugins: [...retained, createDocumentStylesPlugin(styles)] });
50
+ };
45
51
  //#endregion
46
- export { createDocumentStylesPlugin, documentStylesKey, getDocumentStyleResolver };
52
+ export { createDocumentStylesPlugin, documentStylesKey, getDocumentStyleResolver, withDocumentStyles };
@@ -1,9 +1,11 @@
1
1
  import { RunStyleResolver } from "./runStyleFormatting.js";
2
2
  import { Transaction } from "prosemirror-state";
3
+ import { Node } from "prosemirror-model";
3
4
  //#region src/prosemirror/rebaseParagraphRunFormatting.d.ts
4
5
  type RebaseParagraphRunFormattingOptions = {
5
6
  nextAttrs: Record<string, unknown>;
6
7
  paragraphPosition: number;
8
+ shouldRebase?: (node: Node) => boolean;
7
9
  styleResolver: RunStyleResolver;
8
10
  tr: Transaction;
9
11
  };
@@ -11,6 +13,6 @@ type RebaseParagraphRunFormattingOptions = {
11
13
  * Change paragraph attrs and re-resolve inherited run marks in the new style
12
14
  * context without turning the old rendered style into direct run formatting.
13
15
  */
14
- declare const setParagraphAttrsWithRebasedRunFormatting: ({ nextAttrs, paragraphPosition, styleResolver, tr }: RebaseParagraphRunFormattingOptions) => Transaction;
16
+ declare const setParagraphAttrsWithRebasedRunFormatting: ({ nextAttrs, paragraphPosition, shouldRebase, styleResolver, tr }: RebaseParagraphRunFormattingOptions) => Transaction;
15
17
  //#endregion
16
18
  export { setParagraphAttrsWithRebasedRunFormatting };
@@ -9,7 +9,7 @@ import { Mark } from "prosemirror-model";
9
9
  * Change paragraph attrs and re-resolve inherited run marks in the new style
10
10
  * context without turning the old rendered style into direct run formatting.
11
11
  */
12
- const setParagraphAttrsWithRebasedRunFormatting = ({ nextAttrs, paragraphPosition, styleResolver, tr }) => {
12
+ const setParagraphAttrsWithRebasedRunFormatting = ({ nextAttrs, paragraphPosition, shouldRebase, styleResolver, tr }) => {
13
13
  const paragraph = tr.doc.nodeAt(paragraphPosition);
14
14
  if (!paragraph || paragraph.type.name !== "paragraph") return panic("Cannot rebase run formatting outside a paragraph", {
15
15
  nodeType: paragraph?.type.name,
@@ -19,6 +19,7 @@ const setParagraphAttrsWithRebasedRunFormatting = ({ nextAttrs, paragraphPositio
19
19
  const nextContext = paragraphRunStyleContext(paragraph.type.create(nextAttrs, paragraph.content, paragraph.marks), styleResolver);
20
20
  const changes = [];
21
21
  const collectRebasedRepresentation = ({ node, position }) => {
22
+ if (shouldRebase && !shouldRebase(node)) return;
22
23
  const nextMarks = reconcileRunFormattingMarks({
23
24
  authoredFormatting: readAuthoredRunFormatting({
24
25
  context: previousContext,
@@ -1,4 +1,5 @@
1
- import { Node } from "prosemirror-model";
1
+ import { Transaction } from "prosemirror-state";
2
+ import { Mark, Node } from "prosemirror-model";
2
3
  //#region src/prosemirror/runFormattingInlineCarriers.d.ts
3
4
  type RunFormattingInlineAtomDisposition = "break-run" | "field-run" | "not-a-run" | "page-break-carrier" | "structured-field" | "symbol-run" | "tab-run" | "text-run";
4
5
  /**
@@ -24,6 +25,8 @@ declare const RUN_FORMATTING_INLINE_ATOM_DISPOSITIONS: Readonly<{
24
25
  readonly text: "text-run";
25
26
  readonly textBoxAnchor: "not-a-run";
26
27
  }>;
28
+ declare const runFormattingInlineControlCharacter: (node: Node) => string | null;
29
+ declare const runFormattingInlineControlNodeName: (character: string) => string | null;
27
30
  declare const runFormattingInlineAtomDisposition: (node: Node) => RunFormattingInlineAtomDisposition | null;
28
31
  type RunFormattingCarrierRepresentation = {
29
32
  node: Node;
@@ -41,6 +44,16 @@ type SelectedRunFormattingCarrierRepresentation = RunFormattingCarrierRepresenta
41
44
  from: number;
42
45
  to: number;
43
46
  };
47
+ type ApplyMarksToRunFormattingRepresentationOptions = {
48
+ tr: Transaction;
49
+ representation: RunFormattingCarrierRepresentation & {
50
+ from: number;
51
+ to: number;
52
+ };
53
+ marks: readonly Mark[];
54
+ };
55
+ /** Apply a mark set without changing a carrier's text or serialized ownership. */
56
+ declare const applyMarksToRunFormattingRepresentation: ({ tr, representation, marks }: ApplyMarksToRunFormattingRepresentationOptions) => void;
44
57
  /**
45
58
  * Expand one logical carrier into every editor node that materializes its run
46
59
  * properties. A structured field is owned by its outer atom, while its result
@@ -61,4 +74,4 @@ declare const selectRunFormattingCarrierRepresentations: ({ doc, from, to }: Sel
61
74
  /** Deterministic visible text for one logical formatting revision carrier. */
62
75
  declare const runFormattingCarrierReviewText: (carrier: RunFormattingCarrier) => string;
63
76
  //#endregion
64
- export { RUN_FORMATTING_INLINE_ATOM_DISPOSITIONS, RunFormattingCarrier, RunFormattingCarrierRepresentation, RunFormattingInlineAtomDisposition, SelectedRunFormattingCarrierRepresentation, expandRunFormattingCarrier, runFormattingCarrierReviewText, runFormattingInlineAtomDisposition, selectRunFormattingCarrierRepresentations };
77
+ export { RUN_FORMATTING_INLINE_ATOM_DISPOSITIONS, RunFormattingCarrier, RunFormattingCarrierRepresentation, RunFormattingInlineAtomDisposition, SelectedRunFormattingCarrierRepresentation, applyMarksToRunFormattingRepresentation, expandRunFormattingCarrier, runFormattingCarrierReviewText, runFormattingInlineAtomDisposition, runFormattingInlineControlCharacter, runFormattingInlineControlNodeName, selectRunFormattingCarrierRepresentations };
@@ -1,6 +1,7 @@
1
1
  import { decodeOoxmlSymbolCharacter } from "../utils/ooxmlSymbol.js";
2
2
  import { expectFieldAttrs, expectSymbolAttrs } from "./attrs/index.js";
3
3
  import { panic } from "better-result";
4
+ import { Mark } from "prosemirror-model";
4
5
  //#region src/prosemirror/runFormattingInlineCarriers.ts
5
6
  /**
6
7
  * How every inline atom maps to a serialized run-formatting carrier.
@@ -26,12 +27,41 @@ const RUN_FORMATTING_INLINE_ATOM_DISPOSITIONS = Object.freeze({
26
27
  textBoxAnchor: "not-a-run"
27
28
  });
28
29
  const dispositionsByName = new Map(Object.entries(RUN_FORMATTING_INLINE_ATOM_DISPOSITIONS));
30
+ const CONTROL_CHARACTER_BY_DISPOSITION = Object.freeze({
31
+ "break-run": "\n",
32
+ "field-run": null,
33
+ "not-a-run": null,
34
+ "page-break-carrier": null,
35
+ "structured-field": null,
36
+ "symbol-run": null,
37
+ "tab-run": " ",
38
+ "text-run": null
39
+ });
40
+ const runFormattingInlineControlCharacter = (node) => {
41
+ const disposition = runFormattingInlineAtomDisposition(node);
42
+ if (disposition === null) return null;
43
+ return CONTROL_CHARACTER_BY_DISPOSITION[disposition] ?? null;
44
+ };
45
+ const runFormattingInlineControlNodeName = (character) => {
46
+ return Object.entries(RUN_FORMATTING_INLINE_ATOM_DISPOSITIONS).find(([, disposition]) => CONTROL_CHARACTER_BY_DISPOSITION[disposition] === character)?.[0] ?? null;
47
+ };
29
48
  const runFormattingInlineAtomDisposition = (node) => {
30
49
  if (!node.isInline || !node.isAtom) return null;
31
50
  const disposition = dispositionsByName.get(node.type.name);
32
51
  if (!disposition) return panic(`Inline atom ${JSON.stringify(node.type.name)} has no run-formatting disposition`);
33
52
  return disposition;
34
53
  };
54
+ /** Apply a mark set without changing a carrier's text or serialized ownership. */
55
+ const applyMarksToRunFormattingRepresentation = ({ tr, representation, marks }) => {
56
+ const { node, position, from, to } = representation;
57
+ if (Mark.sameSet(node.marks, marks)) return;
58
+ if (!node.isText) {
59
+ tr.setNodeMarkup(position, void 0, node.attrs, marks);
60
+ return;
61
+ }
62
+ for (const current of node.marks) if (!marks.some((candidate) => candidate.eq(current))) tr.removeMark(from, to, current.type);
63
+ for (const next of marks) if (!node.marks.some((candidate) => candidate.eq(next))) tr.addMark(from, to, next);
64
+ };
35
65
  /**
36
66
  * Expand one logical carrier into every editor node that materializes its run
37
67
  * properties. A structured field is owned by its outer atom, while its result
@@ -105,9 +135,9 @@ const selectRunFormattingCarrierRepresentations = ({ doc, from, to }) => {
105
135
  /** Deterministic visible text for one logical formatting revision carrier. */
106
136
  const runFormattingCarrierReviewText = (carrier) => {
107
137
  switch (carrier.disposition) {
138
+ case "tab-run":
139
+ case "break-run": return CONTROL_CHARACTER_BY_DISPOSITION[carrier.disposition];
108
140
  case "text-run": return carrier.node.text ?? "";
109
- case "tab-run": return " ";
110
- case "break-run": return "\n";
111
141
  case "page-break-carrier": return "";
112
142
  case "symbol-run": {
113
143
  const { char } = expectSymbolAttrs(carrier.node);
@@ -118,4 +148,4 @@ const runFormattingCarrierReviewText = (carrier) => {
118
148
  }
119
149
  };
120
150
  //#endregion
121
- export { RUN_FORMATTING_INLINE_ATOM_DISPOSITIONS, expandRunFormattingCarrier, runFormattingCarrierReviewText, runFormattingInlineAtomDisposition, selectRunFormattingCarrierRepresentations };
151
+ export { RUN_FORMATTING_INLINE_ATOM_DISPOSITIONS, applyMarksToRunFormattingRepresentation, expandRunFormattingCarrier, runFormattingCarrierReviewText, runFormattingInlineAtomDisposition, runFormattingInlineControlCharacter, runFormattingInlineControlNodeName, selectRunFormattingCarrierRepresentations };
@@ -1,6 +1,7 @@
1
1
  import { document_d_exports } from "../types/document.js";
2
2
  import { StyleEngine } from "../style-engine/styleEngine.js";
3
3
  import "../style-engine/index.js";
4
+ import { cascadeStyleTextFormatting } from "./styles/styleToggleCascade.js";
4
5
  import { Mark, Node } from "prosemirror-model";
5
6
  //#region src/prosemirror/runStyleFormatting.d.ts
6
7
  declare const hasDirectRunFormatting: (formatting: document_d_exports.TextFormatting | undefined) => boolean;
@@ -25,7 +26,19 @@ type ParagraphRunStyleContext = {
25
26
  paragraphMarkFormatting: document_d_exports.TextFormatting | undefined;
26
27
  paragraphMarkPrecedesStyle: boolean;
27
28
  };
28
- type RunStyleResolver = Pick<StyleEngine, "getDefaultCharacterStyle" | "getDocDefaults" | "getRunStyleOwnProperties" | "resolveParagraphStyle">;
29
+ type RunStyleResolver = Pick<StyleEngine, "getDefaultCharacterStyle" | "getDefaultParagraphStyle" | "getDocDefaults" | "getRunStyleOwnProperties" | "getStyle" | "resolveParagraphStyle">;
30
+ type ResolveParagraphBodyRunFormattingOptions = {
31
+ styleId: string | undefined;
32
+ styleResolver?: RunStyleResolver | null | undefined;
33
+ tableRunFormatting?: document_d_exports.TextFormatting | undefined;
34
+ };
35
+ /** Resolve the table, paragraph, and character style cascade before paragraph-mark properties. */
36
+ declare const resolveParagraphBodyRunFormatting: ({ styleId, styleResolver, tableRunFormatting }: ResolveParagraphBodyRunFormattingOptions) => {
37
+ baseFormatting: document_d_exports.TextFormatting | undefined;
38
+ baseToggleCascade: ReturnType<typeof cascadeStyleTextFormatting>;
39
+ defaultFormatting: document_d_exports.TextFormatting | undefined;
40
+ defaultToggleCascade: ReturnType<typeof cascadeStyleTextFormatting>;
41
+ };
29
42
  declare const paragraphRunStyleContext: (paragraph: Node, styleResolver?: RunStyleResolver | null) => ParagraphRunStyleContext;
30
43
  type ParagraphFormattingForRunOptions = {
31
44
  context: ParagraphRunStyleContext;
@@ -47,4 +60,4 @@ type ResolveEffectiveRunStyleFormattingOptions = {
47
60
  /** Resolve the non-direct run cascade from shared document styles and the current paragraph. */
48
61
  declare const resolveEffectiveRunStyleFormatting: ({ marks, paragraphFormatting, styleResolver }: ResolveEffectiveRunStyleFormattingOptions) => document_d_exports.TextFormatting | undefined;
49
62
  //#endregion
50
- export { ParagraphRunStyleContext, RunStyleResolver, getParagraphMarkSuppressionOverrides, hasDirectRunFormatting, paragraphFormattingForRun, paragraphRunStyleContext, paragraphRunStyleContextAt, resolveEffectiveRunStyleFormatting, stripParagraphMarkFormattingForBodyRuns, stripParagraphMarkOnlyFormatting, suppressParagraphMarkFormatting };
63
+ export { ParagraphRunStyleContext, RunStyleResolver, getParagraphMarkSuppressionOverrides, hasDirectRunFormatting, paragraphFormattingForRun, paragraphRunStyleContext, paragraphRunStyleContextAt, resolveEffectiveRunStyleFormatting, resolveParagraphBodyRunFormatting, stripParagraphMarkFormattingForBodyRuns, stripParagraphMarkOnlyFormatting, suppressParagraphMarkFormatting };