@stll/folio-core 0.37.5 → 0.39.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ai-edits/apply.js +275 -88
- package/dist/ai-edits/clean-text.js +12 -1
- package/dist/ai-edits/headless.d.ts +110 -0
- package/dist/ai-edits/headless.js +569 -40
- package/dist/ai-edits/snapshot.d.ts +24 -1
- package/dist/ai-edits/snapshot.js +206 -9
- package/dist/ai-edits/table-geometry.d.ts +7 -7
- package/dist/ai-edits/table-geometry.js +43 -27
- package/dist/ai-edits/table-template.d.ts +2 -1
- package/dist/ai-edits/table-template.js +9 -3
- package/dist/ai-edits/types.d.ts +37 -15
- package/dist/compare/__fixtures__/body-sequence.d.ts +4 -0
- package/dist/compare/__fixtures__/body-sequence.js +5 -3
- package/dist/compare/compare.d.ts +26 -2
- package/dist/compare/compare.js +444 -16
- package/dist/compare/content-alignment.js +3 -2
- package/dist/compare/content-types.d.ts +34 -2
- package/dist/compare/content.d.ts +13 -10
- package/dist/compare/content.js +69 -23
- package/dist/compare/formatting.d.ts +4 -22
- package/dist/compare/formatting.js +8 -112
- package/dist/compare/inline-atom-resources.d.ts +6 -0
- package/dist/compare/inline-atom-resources.js +26 -0
- package/dist/compare/inline-atoms.d.ts +35 -0
- package/dist/compare/inline-atoms.js +383 -0
- package/dist/compare/inline-provenance.d.ts +36 -0
- package/dist/compare/inline-provenance.js +334 -0
- package/dist/compare/plan.d.ts +4 -1
- package/dist/compare/plan.js +32 -4
- package/dist/compare/scenario.d.ts +4 -6
- package/dist/compare/section-boundary-properties.d.ts +63 -0
- package/dist/compare/section-boundary-properties.js +235 -0
- package/dist/compare/style-resources.d.ts +30 -0
- package/dist/compare/style-resources.js +404 -0
- package/dist/compare/types.d.ts +50 -11
- package/dist/compare/types.js +3 -1
- package/dist/compare/verification.d.ts +3 -5
- package/dist/compare/verification.js +8 -39
- package/dist/compat/eigenpal.d.ts +4 -4
- package/dist/compat/eigenpal.js +3 -3
- package/dist/controller/layoutPipeline.js +4 -0
- package/dist/display-list/build/buildContext.d.ts +3 -1
- package/dist/display-list/build/buildDisplayList.d.ts +4 -1
- package/dist/display-list/build/buildDisplayList.js +38 -4
- package/dist/display-list/build/commentAnnotations.d.ts +10 -0
- package/dist/display-list/build/commentAnnotations.js +17 -0
- package/dist/display-list/build/paragraphPrimitives.js +39 -1
- package/dist/display-list/primitives.d.ts +1 -1
- package/dist/display-list/types.d.ts +16 -1
- package/dist/document-operations.d.ts +5 -3
- package/dist/document-operations.js +112 -5
- package/dist/docx/blockContentParser.js +14 -2
- package/dist/docx/diagramPreview.d.ts +7 -0
- package/dist/docx/diagramPreview.js +191 -0
- package/dist/docx/drawingIdNormalization.js +43 -2
- package/dist/docx/drawingRelationships.d.ts +10 -0
- package/dist/docx/drawingRelationships.js +28 -0
- package/dist/docx/fieldParser.js +1 -1
- package/dist/docx/hyperlinkParser.js +3 -5
- package/dist/docx/imageRawXml.d.ts +8 -0
- package/dist/docx/imageRawXml.js +13 -0
- package/dist/docx/newImage.d.ts +2 -2
- package/dist/docx/newImage.js +3 -3
- package/dist/docx/numberingParser.js +30 -27
- package/dist/docx/paragraphParser.js +11 -4
- package/dist/docx/paragraphTextBoxEnrichment.js +2 -1
- package/dist/docx/parser.js +13 -0
- package/dist/docx/removeHeaderFooterParts.d.ts +14 -0
- package/dist/docx/removeHeaderFooterParts.js +87 -0
- package/dist/docx/rezip.d.ts +3 -1
- package/dist/docx/rezip.js +143 -41
- package/dist/docx/runParser.js +24 -5
- package/dist/docx/sectionParser.js +3 -0
- package/dist/docx/sectionReferenceHistory.d.ts +17 -0
- package/dist/docx/sectionReferenceHistory.js +59 -0
- package/dist/docx/selectiveSave.js +11 -31
- package/dist/docx/selectiveXmlPatch.d.ts +8 -1
- package/dist/docx/selectiveXmlPatch.js +62 -2
- package/dist/docx/serializer/paragraphSerializer.js +2 -0
- package/dist/docx/serializer/partNamespaces.d.ts +1 -1
- package/dist/docx/serializer/partNamespaces.js +4 -0
- package/dist/docx/serializer/runSerializer.js +5 -2
- package/dist/docx/serializer/sectionPropertiesSerializer.js +5 -2
- package/dist/docx/serializer/textFormattingSerializer.d.ts +1 -1
- package/dist/docx/serializer/textFormattingSerializer.js +3 -1
- package/dist/docx/tableParser.js +21 -11
- package/dist/docx/textBoxParser.js +25 -5
- package/dist/docx/xmlParser.d.ts +10 -1
- package/dist/docx/xmlParser.js +23 -1
- package/dist/export-pdf.js +2 -0
- package/dist/headless-layout.js +1 -0
- package/dist/index.d.ts +4 -4
- package/dist/index.js +3 -3
- package/dist/internal/compare/inline-presentation.d.ts +20 -0
- package/dist/internal/compare/inline-presentation.js +222 -0
- package/dist/internal/paragraphFormattingSerialization.d.ts +3 -1
- package/dist/internal/paragraphFormattingSerialization.js +8 -1
- package/dist/internal/sectionReferenceResolution.d.ts +21 -0
- package/dist/internal/sectionReferenceResolution.js +72 -0
- package/dist/layout-bridge/convert/toFlowBlocks.js +1 -0
- package/dist/layout-engine/index.js +5 -5
- package/dist/layout-engine/sectionVerticalAlignment.d.ts +7 -0
- package/dist/layout-engine/sectionVerticalAlignment.js +52 -0
- package/dist/layout-engine/types.d.ts +3 -1
- package/dist/markdown/renderRuns.js +1 -0
- package/dist/markdown/renderTable.js +1 -0
- package/dist/pdf/writePdf.js +37 -2
- package/dist/prosemirror/attrs/index.js +55 -1
- package/dist/prosemirror/commands/comments.d.ts +11 -1
- package/dist/prosemirror/commands/comments.js +68 -6
- package/dist/prosemirror/commands/propertyChangeScope.d.ts +9 -3
- package/dist/prosemirror/commands/propertyChangeScope.js +4 -10
- package/dist/prosemirror/conversion/fromProseDoc.js +17 -8
- package/dist/prosemirror/conversion/toProseDoc.js +18 -57
- package/dist/prosemirror/extensions/core/ParagraphExtension.js +2 -0
- package/dist/prosemirror/extensions/marks/RunFormattingOverrideExtension.js +3 -0
- package/dist/prosemirror/extensions/nodes/TextBoxExtension.d.ts +2 -1
- package/dist/prosemirror/extensions/nodes/TextBoxExtension.js +39 -1
- package/dist/prosemirror/imageCommit.js +7 -9
- package/dist/prosemirror/paragraphIndentation.d.ts +21 -0
- package/dist/prosemirror/paragraphIndentation.js +72 -0
- package/dist/prosemirror/plugins/documentNumbering.d.ts +3 -1
- package/dist/prosemirror/plugins/documentNumbering.js +7 -1
- package/dist/prosemirror/plugins/documentStyles.d.ts +3 -1
- package/dist/prosemirror/plugins/documentStyles.js +7 -1
- package/dist/prosemirror/rebaseParagraphRunFormatting.d.ts +3 -1
- package/dist/prosemirror/rebaseParagraphRunFormatting.js +2 -1
- package/dist/prosemirror/runFormattingInlineCarriers.d.ts +15 -2
- package/dist/prosemirror/runFormattingInlineCarriers.js +33 -3
- package/dist/prosemirror/runStyleFormatting.d.ts +15 -2
- package/dist/prosemirror/runStyleFormatting.js +76 -2
- package/dist/prosemirror/schema/marks.d.ts +3 -1
- package/dist/prosemirror/schema/marks.js +2 -0
- package/dist/prosemirror/schema/nodes.d.ts +5 -0
- package/dist/prosemirror/tableCellRevisionVisibility.d.ts +6 -0
- package/dist/prosemirror/tableCellRevisionVisibility.js +14 -0
- package/dist/prosemirror/trackedRunInlineAtoms.d.ts +1 -1
- package/dist/prosemirror/trackedRunInlineAtoms.js +1 -1
- package/dist/redline.js +15 -2
- package/dist/server.d.ts +2 -2
- package/dist/server.js +2 -2
- package/dist/version-comparison.d.ts +2 -0
- package/dist/version-comparison.js +7 -2
- package/package.json +2 -2
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { captureVerbatimXml } from "./verbatimCapture.js";
|
|
2
|
+
import { WORDPROCESSINGML_NAMESPACE_URIS, cloneElement, findAttributeByNamespaceUri, getAttributeByNamespaceUri, getChildElements, getLocalName, getNamespacePrefix, getNamespaceUri, parseXmlDocument } from "./xmlParser.js";
|
|
2
3
|
//#region src/docx/selectiveXmlPatch.ts
|
|
3
4
|
/**
|
|
4
5
|
* Selective XML Patch Module
|
|
@@ -757,6 +758,65 @@ function collectAddedNumberingDefs(baselineXml, currentXml) {
|
|
|
757
758
|
};
|
|
758
759
|
}
|
|
759
760
|
const NUMBERING_CLOSE_ROOT = "</w:numbering>";
|
|
761
|
+
const numberingDefinitionIdentity = (element) => {
|
|
762
|
+
if (!WORDPROCESSINGML_NAMESPACE_URIS.has(getNamespaceUri(element) ?? "")) return null;
|
|
763
|
+
const kind = getLocalName(element.name);
|
|
764
|
+
if (kind !== "abstractNum" && kind !== "num") return null;
|
|
765
|
+
const id = getAttributeByNamespaceUri(element, WORDPROCESSINGML_NAMESPACE_URIS, kind === "num" ? "numId" : "abstractNumId");
|
|
766
|
+
return id === null ? null : {
|
|
767
|
+
kind,
|
|
768
|
+
id
|
|
769
|
+
};
|
|
770
|
+
};
|
|
771
|
+
const patchNumberingByNamespace = ({ original, currentXml, changed, added }) => {
|
|
772
|
+
const current = parseXmlDocument(currentXml);
|
|
773
|
+
if (!current) return null;
|
|
774
|
+
const replacements = /* @__PURE__ */ new Map();
|
|
775
|
+
const namespaceDeclarations = Object.fromEntries(Object.entries(current.attributes ?? {}).filter(([name]) => name === "xmlns" || name.startsWith("xmlns:")));
|
|
776
|
+
for (const child of getChildElements(current)) {
|
|
777
|
+
const identity = numberingDefinitionIdentity(child);
|
|
778
|
+
if (!identity) continue;
|
|
779
|
+
const detached = parseXmlDocument(captureVerbatimXml(cloneElement(child, { attributes: {
|
|
780
|
+
...namespaceDeclarations,
|
|
781
|
+
...child.attributes
|
|
782
|
+
} })));
|
|
783
|
+
if (!detached) return null;
|
|
784
|
+
replacements.set(`${identity.kind}:${identity.id}`, detached);
|
|
785
|
+
}
|
|
786
|
+
const elements = [];
|
|
787
|
+
for (const child of original.elements ?? []) {
|
|
788
|
+
const identity = numberingDefinitionIdentity(child);
|
|
789
|
+
if (!identity || !changed[identity.kind === "num" ? "nums" : "abstractNums"].has(identity.id)) {
|
|
790
|
+
elements.push(child);
|
|
791
|
+
continue;
|
|
792
|
+
}
|
|
793
|
+
const replacement = replacements.get(`${identity.kind}:${identity.id}`);
|
|
794
|
+
if (!replacement) return null;
|
|
795
|
+
elements.push(replacement);
|
|
796
|
+
}
|
|
797
|
+
for (const [kind, ids] of [["abstractNum", added.abstractNums], ["num", added.nums]]) for (const id of ids) {
|
|
798
|
+
const replacement = replacements.get(`${kind}:${id}`);
|
|
799
|
+
if (!replacement) return null;
|
|
800
|
+
const firstNum = kind === "abstractNum" ? elements.findIndex((child) => numberingDefinitionIdentity(child)?.kind === "num") : -1;
|
|
801
|
+
elements.splice(firstNum < 0 ? elements.length : firstNum, 0, replacement);
|
|
802
|
+
}
|
|
803
|
+
return captureVerbatimXml(cloneElement(original, { elements }));
|
|
804
|
+
};
|
|
805
|
+
/** Both save paths must write changed definitions and newly referenced instances together. */
|
|
806
|
+
const patchNumberingDefinitions = ({ originalXml, baselineXml, currentXml }) => {
|
|
807
|
+
const changed = collectChangedNumberingDefs(baselineXml, currentXml);
|
|
808
|
+
const added = collectAddedNumberingDefs(baselineXml, currentXml);
|
|
809
|
+
const original = parseXmlDocument(originalXml);
|
|
810
|
+
if (!original || getLocalName(original.name) !== "numbering" || !WORDPROCESSINGML_NAMESPACE_URIS.has(getNamespaceUri(original) ?? "")) return null;
|
|
811
|
+
if (getNamespacePrefix(original.name ?? "") !== "w") return patchNumberingByNamespace({
|
|
812
|
+
original,
|
|
813
|
+
currentXml,
|
|
814
|
+
changed,
|
|
815
|
+
added
|
|
816
|
+
});
|
|
817
|
+
const spliced = buildPatchedNumberingXml(originalXml, currentXml, changed);
|
|
818
|
+
return spliced === null ? null : appendNumberingDefs(spliced, currentXml, added);
|
|
819
|
+
};
|
|
760
820
|
/**
|
|
761
821
|
* Append added `w:abstractNum` / `w:num` definitions from `currentXml` to
|
|
762
822
|
* `xml`. ECMA-376 §17.9 orders every `w:abstractNum` before the first `w:num`,
|
|
@@ -812,4 +872,4 @@ function escapeRegExp(str) {
|
|
|
812
872
|
return str.replace(/[.*+?^${}()|[\]\\]/gu, "\\$&");
|
|
813
873
|
}
|
|
814
874
|
//#endregion
|
|
815
|
-
export { appendNumberingDefs, buildParagraphOffsetIndex, buildPatchedDocumentXml, buildPatchedNotePartXml, buildPatchedNoteXml, buildPatchedNumberingXml, collectAddedNumberingDefs, collectChangedNoteParaIds, collectChangedNumberingDefs, collectParaIds, countParagraphElements, extractParagraphXml, findParagraphOffsets, isXmlNameBoundary, validatePatchSafety };
|
|
875
|
+
export { appendNumberingDefs, buildParagraphOffsetIndex, buildPatchedDocumentXml, buildPatchedNotePartXml, buildPatchedNoteXml, buildPatchedNumberingXml, collectAddedNumberingDefs, collectChangedNoteParaIds, collectChangedNumberingDefs, collectParaIds, countParagraphElements, extractParagraphXml, findParagraphOffsets, isXmlNameBoundary, patchNumberingDefinitions, validatePatchSafety };
|
|
@@ -509,6 +509,7 @@ function serializeTrackedChange(tag, change) {
|
|
|
509
509
|
const xml = item.type === "simpleField" ? serializeSimpleField(item) : serializeComplexField(item);
|
|
510
510
|
return tag === "del" || tag === "moveFrom" ? rewriteRunTextAsDeleted(xml) : xml;
|
|
511
511
|
}
|
|
512
|
+
if (item.type === "mathEquation") return item.ommlXml;
|
|
512
513
|
if (item.type === "insertion" || item.type === "deletion" || item.type === "moveFrom" || item.type === "moveTo") return serializeTrackedChange(trackedChangeTag(item), item);
|
|
513
514
|
return item.type === "bookmarkStart" ? serializeBookmarkStart(item) : serializeBookmarkEnd(item);
|
|
514
515
|
};
|
|
@@ -585,6 +586,7 @@ function serializeParagraph(paragraph) {
|
|
|
585
586
|
const attrs = [];
|
|
586
587
|
if (paragraph.paraId) attrs.push(`w14:paraId="${escapeXml(paragraph.paraId)}"`);
|
|
587
588
|
if (paragraph.textId) attrs.push(`w14:textId="${escapeXml(paragraph.textId)}"`);
|
|
589
|
+
if (paragraph.reviewCarrier) attrs.push(`folio:reviewCarrier="${paragraph.reviewCarrier}"`);
|
|
588
590
|
const attrsStr = attrs.length > 0 ? ` ${attrs.join(" ")}` : "";
|
|
589
591
|
parts.push(serializeParagraphFormattingWithOptions(paragraph.formatting, {
|
|
590
592
|
propertyChanges: paragraph.propertyChanges,
|
|
@@ -25,7 +25,7 @@ type PackagingPrefix = "ct" | "pr";
|
|
|
25
25
|
* over the union: a member with no entry, or an entry with no member, does not
|
|
26
26
|
* compile.
|
|
27
27
|
*/
|
|
28
|
-
type OoxmlNamespacePrefix = Exclude<OoxmlPrefix, PackagingPrefix> | "cx" | "cx1" | "cx2" | "cx3" | "cx4" | "cx5" | "cx6" | "cx7" | "cx8" | "aink" | "am3d" | "oel" | "w10" | "w16" | "w16cex" | "w16cid" | "w16du" | "w16sdtdh" | "w16se" | "wpi" | "wne";
|
|
28
|
+
type OoxmlNamespacePrefix = Exclude<OoxmlPrefix, PackagingPrefix> | "cx" | "cx1" | "cx2" | "cx3" | "cx4" | "cx5" | "cx6" | "cx7" | "cx8" | "aink" | "am3d" | "oel" | "w10" | "w16" | "w16cex" | "w16cid" | "w16du" | "w16sdtdh" | "w16se" | "folio" | "wpi" | "wne";
|
|
29
29
|
/**
|
|
30
30
|
* Every namespace a rebuilt part can declare, in the order producers write them.
|
|
31
31
|
*
|
|
@@ -143,6 +143,10 @@ const OOXML_NAMESPACES = {
|
|
|
143
143
|
uri: "http://schemas.microsoft.com/office/word/2015/wordml/symex",
|
|
144
144
|
ignorable: true
|
|
145
145
|
},
|
|
146
|
+
folio: {
|
|
147
|
+
uri: "urn:stella:folio:review-history:1",
|
|
148
|
+
ignorable: true
|
|
149
|
+
},
|
|
146
150
|
wpg: {
|
|
147
151
|
uri: OOXML_NS.wpg,
|
|
148
152
|
ignorable: false
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { isValidHexColor } from "../../utils/colorResolver.js";
|
|
2
2
|
import { THEME_COLOR_TO_DRAWING_SCHEME } from "../drawingUtils.js";
|
|
3
|
+
import { canReplayEditableImageRawXml } from "../imageRawXml.js";
|
|
3
4
|
import { requiresXmlSpacePreserve } from "../textWhitespace.js";
|
|
4
5
|
import { serializeParagraph } from "./paragraphSerializer.js";
|
|
5
6
|
import { serializeTable } from "./tableSerializer.js";
|
|
@@ -363,6 +364,7 @@ function serializeShapeContent(content) {
|
|
|
363
364
|
if (shape.textBody) {
|
|
364
365
|
const tb = shape.textBody;
|
|
365
366
|
const bpAttrs = ["rot=\"0\"", "vert=\"horz\""];
|
|
367
|
+
if (tb.wordArt?.fromWordArt !== void 0) bpAttrs.push(`fromWordArt="${tb.wordArt.fromWordArt ? "1" : "0"}"`);
|
|
366
368
|
if (tb.textWrap) bpAttrs.push(`wrap="${tb.textWrap}"`);
|
|
367
369
|
if (tb.anchor) bpAttrs.push(`anchor="${serializeTextBodyAnchor(tb.anchor)}"`);
|
|
368
370
|
if (tb.anchorCenter) bpAttrs.push("anchorCtr=\"1\"");
|
|
@@ -376,7 +378,8 @@ function serializeShapeContent(content) {
|
|
|
376
378
|
if (tb.autoFit === "shape") autoFitXml = "<a:spAutoFit/>";
|
|
377
379
|
else if (tb.autoFit === "normal") autoFitXml = "<a:normAutofit/>";
|
|
378
380
|
else if (tb.autoFit === "none") autoFitXml = "<a:noAutofit/>";
|
|
379
|
-
const
|
|
381
|
+
const bodyPrChildren = `${tb.wordArt?.preset ? `<a:prstTxWarp prst="${escapeXml(tb.wordArt.preset)}">${tb.wordArt.adjustments && tb.wordArt.adjustments.length > 0 ? `<a:avLst>${tb.wordArt.adjustments.map(({ name, formula }) => `<a:gd name="${escapeXml(name)}" fmla="${escapeXml(formula)}"/>`).join("")}</a:avLst>` : "<a:avLst/>"}</a:prstTxWarp>` : ""}${autoFitXml}`;
|
|
382
|
+
const bodyPrXml = bodyPrChildren ? `<wps:bodyPr ${bpAttrs.join(" ")}>${bodyPrChildren}</wps:bodyPr>` : `<wps:bodyPr ${bpAttrs.join(" ")}/>`;
|
|
380
383
|
if (isTextBox) textBody = [
|
|
381
384
|
"<wps:txbx><w:txbxContent>",
|
|
382
385
|
serializeShapeTextBody(tb.content),
|
|
@@ -445,7 +448,7 @@ function serializeRunContent(content) {
|
|
|
445
448
|
case "noBreakHyphen": return serializeNoBreakHyphen(content);
|
|
446
449
|
case "renderedPageBreak": return "<w:lastRenderedPageBreak/>";
|
|
447
450
|
case "drawing":
|
|
448
|
-
if (content.rawXml) return content.rawXml;
|
|
451
|
+
if (content.rawXml && canReplayEditableImageRawXml(content)) return content.rawXml;
|
|
449
452
|
return serializeDrawingContent(content);
|
|
450
453
|
case "shape": return serializeShapeContent(content);
|
|
451
454
|
default: return "";
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { getUnserializedSectionPropertyChildNames } from "../sectionParser.js";
|
|
2
|
+
import { serializeSectionReferenceHistory } from "../sectionReferenceHistory.js";
|
|
2
3
|
import { serializeBorder } from "./borderSerializer.js";
|
|
3
4
|
import { serializeTrackedChangeAttributes } from "./trackedChangeAttributes.js";
|
|
4
5
|
import { escapeXml, intAttr } from "./xmlUtils.js";
|
|
@@ -133,8 +134,10 @@ function serializeOnOffElement(value, name) {
|
|
|
133
134
|
return value ? `<w:${name}/>` : `<w:${name} w:val="0"/>`;
|
|
134
135
|
}
|
|
135
136
|
function serializeSectionPropertyChange(change) {
|
|
136
|
-
const
|
|
137
|
-
|
|
137
|
+
const { headerReferences: _headers, footerReferences: _footers, ...previous } = change.previousProperties ?? {};
|
|
138
|
+
const previousSectPrXml = serializeSectionProperties(previous) || "<w:sectPr/>";
|
|
139
|
+
const history = serializeSectionReferenceHistory(change.previousReferences);
|
|
140
|
+
return `<w:sectPrChange ${serializeTrackedChangeAttributes(change.info)}>${previousSectPrXml}${history}</w:sectPrChange>`;
|
|
138
141
|
}
|
|
139
142
|
function serializeSectionProperties(props) {
|
|
140
143
|
if (!props) return "";
|
|
@@ -3,7 +3,7 @@ import { document_d_exports } from "../../types/document.js";
|
|
|
3
3
|
type ExhaustiveFields<Source, Classified extends keyof Source> = Exclude<keyof Source, Classified> extends never ? Source : never;
|
|
4
4
|
type ClassifiedShadingField = "color" | "fill" | "pattern";
|
|
5
5
|
type ExhaustiveShadingProperties = ExhaustiveFields<document_d_exports.ShadingProperties, ClassifiedShadingField>;
|
|
6
|
-
type ClassifiedTextFormattingField = "bold" | "boldCs" | "italic" | "italicCs" | "underline" | "strike" | "doubleStrike" | "vertAlign" | "smallCaps" | "allCaps" | "hidden" | "color" | "highlight" | "shading" | "fontSize" | "fontSizeCs" | "fontFamily" | "language" | "spacing" | "position" | "scale" | "kerning" | "effect" | "emphasisMark" | "emboss" | "imprint" | "outline" | "shadow" | "rtl" | "cs" | "styleId";
|
|
6
|
+
type ClassifiedTextFormattingField = "bold" | "boldCs" | "italic" | "italicCs" | "underline" | "strike" | "doubleStrike" | "vertAlign" | "smallCaps" | "allCaps" | "hidden" | "noProof" | "color" | "highlight" | "shading" | "fontSize" | "fontSizeCs" | "fontFamily" | "language" | "spacing" | "position" | "scale" | "kerning" | "effect" | "emphasisMark" | "emboss" | "imprint" | "outline" | "shadow" | "rtl" | "cs" | "styleId";
|
|
7
7
|
type ExhaustiveTextFormatting = ExhaustiveFields<document_d_exports.TextFormatting, ClassifiedTextFormattingField>;
|
|
8
8
|
/**
|
|
9
9
|
* Serialize shading properties (w:shd)
|
|
@@ -47,7 +47,7 @@ function serializeShading(shading) {
|
|
|
47
47
|
*/
|
|
48
48
|
function serializeTextFormatting(input) {
|
|
49
49
|
if (!input) return "";
|
|
50
|
-
const { bold, boldCs, italic, italicCs, underline, strike, doubleStrike, vertAlign, smallCaps, allCaps, hidden, color, highlight, shading, fontSize, fontSizeCs, fontFamily, language, spacing, position, scale, kerning, effect, emphasisMark, emboss, imprint, outline, shadow, rtl, cs, styleId } = input;
|
|
50
|
+
const { bold, boldCs, italic, italicCs, underline, strike, doubleStrike, vertAlign, smallCaps, allCaps, hidden, noProof, color, highlight, shading, fontSize, fontSizeCs, fontFamily, language, spacing, position, scale, kerning, effect, emphasisMark, emboss, imprint, outline, shadow, rtl, cs, styleId } = input;
|
|
51
51
|
const parts = [];
|
|
52
52
|
if (styleId) parts.push(`<w:rStyle w:val="${escapeXml(styleId)}"/>`);
|
|
53
53
|
if (fontFamily) {
|
|
@@ -90,6 +90,8 @@ function serializeTextFormatting(input) {
|
|
|
90
90
|
else if (imprint === false) parts.push("<w:imprint w:val=\"0\"/>");
|
|
91
91
|
if (hidden === true) parts.push("<w:vanish/>");
|
|
92
92
|
else if (hidden === false) parts.push("<w:vanish w:val=\"0\"/>");
|
|
93
|
+
if (noProof === true) parts.push("<w:noProof/>");
|
|
94
|
+
else if (noProof === false) parts.push("<w:noProof w:val=\"0\"/>");
|
|
93
95
|
const colorXml = serializeColorElement(color);
|
|
94
96
|
if (colorXml) parts.push(colorXml);
|
|
95
97
|
if (spacing !== void 0) parts.push(`<w:spacing w:val="${intAttr(spacing)}"/>`);
|
package/dist/docx/tableParser.js
CHANGED
|
@@ -5,7 +5,7 @@ import { enrichParagraphTextBoxes } from "./paragraphTextBoxEnrichment.js";
|
|
|
5
5
|
import { BorderStyleSchema, FloatingTableXSpecSchema, FloatingTableYSpecSchema, ShadingPatternSchema, TableCellTextDirectionSchema, ThemeColorSlotSchema, narrowEnum } from "./parserEnums.js";
|
|
6
6
|
import { parsePropertyChangeInfo, parseTrackedChangeInfo } from "./trackedChangeInfo.js";
|
|
7
7
|
import { captureVerbatimXml } from "./verbatimCapture.js";
|
|
8
|
-
import { cloneElement, findChild, findChildByLocalName, findChildren, getAttribute, getChildElements, getLocalName, mergeXmlnsDeclarations, parseBooleanElement, parseNumericAttribute, parseTableMeasurementValue } from "./xmlParser.js";
|
|
8
|
+
import { cloneElement, findChild, findChildByLocalName, findChildren, getAttribute, getChildElements, getLocalName, mergeXmlnsDeclarations, parseBooleanElement, parseNumericAttribute, parseTableMeasurementValue, selectAlternateContentBranch } from "./xmlParser.js";
|
|
9
9
|
//#region src/docx/tableParser.ts
|
|
10
10
|
/**
|
|
11
11
|
* Sanity cap on `w:gridSpan` (and the derived table column count). Word's
|
|
@@ -531,27 +531,35 @@ function parseCellContent(tcElement, styles, theme, numbering, rels, media, opti
|
|
|
531
531
|
const content = [];
|
|
532
532
|
const pendingBookmarkMarkers = [];
|
|
533
533
|
const elements = getChildElements(tcElement);
|
|
534
|
-
const parseCellChild = (child) => {
|
|
534
|
+
const parseCellChild = (child, childOptions = options) => {
|
|
535
535
|
if (!child.name) return;
|
|
536
536
|
const localName = getLocalName(child.name);
|
|
537
537
|
if (localName === "p") {
|
|
538
|
-
const para = parseParagraph(child, styles, theme, numbering, rels, media,
|
|
538
|
+
const para = parseParagraph(child, styles, theme, numbering, rels, media, childOptions);
|
|
539
539
|
enrichParagraphTextBoxes(para, child, styles, theme, numbering, rels, media, parseTable);
|
|
540
540
|
prependPendingBookmarkMarkers(para, pendingBookmarkMarkers);
|
|
541
541
|
content.push(para);
|
|
542
542
|
return;
|
|
543
543
|
}
|
|
544
544
|
if (localName === "tbl") {
|
|
545
|
-
const table = parseTable(child, styles, theme, numbering, rels, media,
|
|
545
|
+
const table = parseTable(child, styles, theme, numbering, rels, media, childOptions);
|
|
546
546
|
if (!table) return;
|
|
547
547
|
if (prependBookmarkMarkersToFirstParagraphInBlocks([table], pendingBookmarkMarkers)) pendingBookmarkMarkers.length = 0;
|
|
548
548
|
content.push(table);
|
|
549
549
|
return;
|
|
550
550
|
}
|
|
551
|
+
if (localName === "AlternateContent") {
|
|
552
|
+
const selectedBranch = selectAlternateContentBranch(child);
|
|
553
|
+
if (!selectedBranch) return;
|
|
554
|
+
const branchOptions = withContainerXmlns(withContainerXmlns(childOptions, child), selectedBranch);
|
|
555
|
+
for (const selectedChild of getChildElements(selectedBranch)) parseCellChild(selectedChild, branchOptions);
|
|
556
|
+
return;
|
|
557
|
+
}
|
|
551
558
|
if (localName === "sdt") {
|
|
552
559
|
const sdtContent = findChildByLocalName(child, "sdtContent");
|
|
553
560
|
if (!sdtContent) return;
|
|
554
|
-
|
|
561
|
+
const sdtContentOptions = withContainerXmlns(withContainerXmlns(childOptions, child), sdtContent);
|
|
562
|
+
for (const sdtChild of getChildElements(sdtContent)) parseCellChild(sdtChild, sdtContentOptions);
|
|
555
563
|
return;
|
|
556
564
|
}
|
|
557
565
|
if (localName === "bookmarkStart" || localName === "bookmarkEnd") {
|
|
@@ -618,10 +626,10 @@ function parseTableRow(trElement, styles, theme, numbering, rels, media, options
|
|
|
618
626
|
if (rowStructChange !== void 0) row.structuralChange = rowStructChange;
|
|
619
627
|
const rowOptions = withContainerXmlns(options, trElement);
|
|
620
628
|
const pendingBookmarkMarkers = [];
|
|
621
|
-
const parseRowChild = (child) => {
|
|
629
|
+
const parseRowChild = (child, childOptions = rowOptions) => {
|
|
622
630
|
const localName = getLocalName(child.name);
|
|
623
631
|
if (localName === "tc") {
|
|
624
|
-
const cell = parseTableCell(child, styles, theme, numbering, rels, media,
|
|
632
|
+
const cell = parseTableCell(child, styles, theme, numbering, rels, media, childOptions);
|
|
625
633
|
if (pendingBookmarkMarkers.length > 0) {
|
|
626
634
|
prependBookmarkMarkersToFirstParagraphInCell(cell, pendingBookmarkMarkers);
|
|
627
635
|
pendingBookmarkMarkers.length = 0;
|
|
@@ -632,7 +640,8 @@ function parseTableRow(trElement, styles, theme, numbering, rels, media, options
|
|
|
632
640
|
if (localName === "sdt") {
|
|
633
641
|
const sdtContent = findChildByLocalName(child, "sdtContent");
|
|
634
642
|
if (!sdtContent) return;
|
|
635
|
-
|
|
643
|
+
const sdtContentOptions = withContainerXmlns(withContainerXmlns(childOptions, child), sdtContent);
|
|
644
|
+
for (const sdtChild of getChildElements(sdtContent)) parseRowChild(sdtChild, sdtContentOptions);
|
|
636
645
|
return;
|
|
637
646
|
}
|
|
638
647
|
if (localName !== "bookmarkStart" && localName !== "bookmarkEnd") return;
|
|
@@ -744,11 +753,11 @@ function parseTable(tblElement, styles, theme, numbering, rels, media, options)
|
|
|
744
753
|
};
|
|
745
754
|
const tableOptions = withContainerXmlns(options, tblElement);
|
|
746
755
|
const rowsWithGridOffsets = /* @__PURE__ */ new Set();
|
|
747
|
-
const parseTableChild = (child) => {
|
|
756
|
+
const parseTableChild = (child, childOptions = tableOptions) => {
|
|
748
757
|
const localName = getLocalName(child.name);
|
|
749
758
|
if (localName === "tr") {
|
|
750
759
|
const rowIndex = table.rows.length;
|
|
751
|
-
const row = parseTableRow(child, styles, theme, numbering, rels, media,
|
|
760
|
+
const row = parseTableRow(child, styles, theme, numbering, rels, media, childOptions);
|
|
752
761
|
table.rows.push(row);
|
|
753
762
|
if (hasRowGridOffsets(child)) rowsWithGridOffsets.add(rowIndex);
|
|
754
763
|
return;
|
|
@@ -756,7 +765,8 @@ function parseTable(tblElement, styles, theme, numbering, rels, media, options)
|
|
|
756
765
|
if (localName !== "sdt") return;
|
|
757
766
|
const sdtContent = findChildByLocalName(child, "sdtContent");
|
|
758
767
|
if (!sdtContent) return;
|
|
759
|
-
|
|
768
|
+
const sdtContentOptions = withContainerXmlns(withContainerXmlns(childOptions, child), sdtContent);
|
|
769
|
+
for (const sdtChild of getChildElements(sdtContent)) parseTableChild(sdtChild, sdtContentOptions);
|
|
760
770
|
};
|
|
761
771
|
for (const child of getChildElements(tblElement)) parseTableChild(child);
|
|
762
772
|
if (table.rows.length === 0) return;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { emuToPixels } from "../utils/units.js";
|
|
2
2
|
import { parseAnchorPosition, parseAnchorWrap, parseFill, parseOutline, resolveColorValueToHex } from "./drawingUtils.js";
|
|
3
|
-
import { findByFullName, findChildByLocalName, findChildrenByLocalName, getAttribute, getChildElements, parseNumericAttribute } from "./xmlParser.js";
|
|
3
|
+
import { findByFullName, findChildByLocalName, findChildByNamespaceUri, findChildrenByLocalName, findChildrenByNamespaceUri, getAttribute, getChildElements, parseNumericAttribute } from "./xmlParser.js";
|
|
4
4
|
//#region src/docx/textBoxParser.ts
|
|
5
|
+
const DRAWINGML_MAIN_NAMESPACE_URIS = /* @__PURE__ */ new Set(["http://schemas.openxmlformats.org/drawingml/2006/main", "http://purl.oclc.org/ooxml/drawingml/main"]);
|
|
6
|
+
const WORDPROCESSING_SHAPE_NAMESPACE_URIS = /* @__PURE__ */ new Set(["http://schemas.microsoft.com/office/word/2010/wordprocessingShape"]);
|
|
5
7
|
/** Default text box margins in EMUs (0.1 inch) */
|
|
6
8
|
const DEFAULT_MARGIN_EMU = 91440;
|
|
7
9
|
const parseTextBoxVerticalAlign = (value) => {
|
|
@@ -28,6 +30,24 @@ function parseBodyProperties(bodyPr) {
|
|
|
28
30
|
else if (findChildByLocalName(bodyPr, "noAutofit")) result.autoFit = "none";
|
|
29
31
|
const verticalAlign = parseTextBoxVerticalAlign(getAttribute(bodyPr, null, "anchor"));
|
|
30
32
|
if (verticalAlign) result.verticalAlign = verticalAlign;
|
|
33
|
+
const fromWordArt = getAttribute(bodyPr, null, "fromWordArt");
|
|
34
|
+
const warp = findChildByNamespaceUri(bodyPr, DRAWINGML_MAIN_NAMESPACE_URIS, "prstTxWarp");
|
|
35
|
+
if (fromWordArt !== null || warp) {
|
|
36
|
+
const adjustments = warp ? findChildrenByNamespaceUri(findChildByNamespaceUri(warp, DRAWINGML_MAIN_NAMESPACE_URIS, "avLst"), DRAWINGML_MAIN_NAMESPACE_URIS, "gd").map((adjustment) => {
|
|
37
|
+
const name = getAttribute(adjustment, null, "name");
|
|
38
|
+
const formula = getAttribute(adjustment, null, "fmla");
|
|
39
|
+
return name !== null && formula !== null ? {
|
|
40
|
+
name,
|
|
41
|
+
formula
|
|
42
|
+
} : void 0;
|
|
43
|
+
}).filter((adjustment) => adjustment !== void 0) : [];
|
|
44
|
+
const preset = warp ? getAttribute(warp, null, "prst") : null;
|
|
45
|
+
result.wordArt = {
|
|
46
|
+
...fromWordArt !== null ? { fromWordArt: fromWordArt === "1" || fromWordArt === "true" || fromWordArt === "on" } : {},
|
|
47
|
+
...preset !== null ? { preset } : {},
|
|
48
|
+
...adjustments.length > 0 ? { adjustments } : {}
|
|
49
|
+
};
|
|
50
|
+
}
|
|
31
51
|
const lIns = parseNumericAttribute(bodyPr, null, "lIns");
|
|
32
52
|
const rIns = parseNumericAttribute(bodyPr, null, "rIns");
|
|
33
53
|
const tIns = parseNumericAttribute(bodyPr, null, "tIns");
|
|
@@ -119,9 +139,8 @@ function parseTextBox(drawingEl) {
|
|
|
119
139
|
const wsp = findByFullName(graphicData, "wps:wsp");
|
|
120
140
|
if (!wsp) return null;
|
|
121
141
|
if (!findByFullName(wsp, "wps:txbx")) return null;
|
|
122
|
-
const
|
|
123
|
-
const
|
|
124
|
-
const bodyPr = wspChildren.find((el) => el.name === "wps:bodyPr");
|
|
142
|
+
const spPr = getChildElements(wsp).find((el) => el.name === "wps:spPr");
|
|
143
|
+
const bodyPr = findChildByNamespaceUri(wsp, WORDPROCESSING_SHAPE_NAMESPACE_URIS, "bodyPr");
|
|
125
144
|
const extent = findByFullName(container, "wp:extent");
|
|
126
145
|
const size = {
|
|
127
146
|
width: parseNumericAttribute(extent, null, "cx") ?? 0,
|
|
@@ -144,6 +163,7 @@ function parseTextBox(drawingEl) {
|
|
|
144
163
|
if (bodyProps.autoFit) textBox.autoFit = bodyProps.autoFit;
|
|
145
164
|
if (bodyProps.textWrap) textBox.textWrap = bodyProps.textWrap;
|
|
146
165
|
if (bodyProps.verticalAlign) textBox.verticalAlign = bodyProps.verticalAlign;
|
|
166
|
+
if (bodyProps.wordArt) textBox.wordArt = bodyProps.wordArt;
|
|
147
167
|
if (isAnchor) {
|
|
148
168
|
const position = parseAnchorPosition(container);
|
|
149
169
|
if (position) textBox.position = position;
|
|
@@ -170,7 +190,7 @@ function parseTextBoxFromShape(wsp, size, position, wrap) {
|
|
|
170
190
|
if (!findByFullName(wsp, "wps:txbx")) return null;
|
|
171
191
|
const wspChildren = getChildElements(wsp);
|
|
172
192
|
const spPr = wspChildren.find((el) => el.name === "wps:spPr");
|
|
173
|
-
const bodyPr =
|
|
193
|
+
const bodyPr = findChildByNamespaceUri(wsp, WORDPROCESSING_SHAPE_NAMESPACE_URIS, "bodyPr");
|
|
174
194
|
const cNvPr = wspChildren.find((el) => el.name === "wps:cNvPr");
|
|
175
195
|
const id = cNvPr ? getAttribute(cNvPr, null, "id") ?? void 0 : void 0;
|
|
176
196
|
const fill = parseFill(spPr ?? null);
|
package/dist/docx/xmlParser.d.ts
CHANGED
|
@@ -111,6 +111,8 @@ declare function getNamespacePrefix(name: string): string | null;
|
|
|
111
111
|
declare const getNamespaceUri: (element: XmlElement) => string | undefined;
|
|
112
112
|
/** WordprocessingML main namespace, Transitional and Strict (ECMA-376 Parts 1 and 4). */
|
|
113
113
|
declare const WORDPROCESSINGML_NAMESPACE_URIS: ReadonlySet<string>;
|
|
114
|
+
/** Office document relationship attributes, Transitional and Strict. */
|
|
115
|
+
declare const OFFICE_RELATIONSHIP_NAMESPACE_URIS: ReadonlySet<string>;
|
|
114
116
|
/**
|
|
115
117
|
* First child whose local name matches AND whose resolved namespace URI is
|
|
116
118
|
* one of `namespaceUris`. Unlike {@link findChild}, a same-named element
|
|
@@ -184,6 +186,13 @@ declare function findByFullName(parent: XmlElement | null | undefined, fullName:
|
|
|
184
186
|
* @returns Array of child elements
|
|
185
187
|
*/
|
|
186
188
|
declare function getChildElements(parent: XmlElement | null | undefined): XmlElement[];
|
|
189
|
+
/**
|
|
190
|
+
* Folio's normalized Markup Compatibility policy: use the first Choice, which
|
|
191
|
+
* is the established parser behavior when `mc:Requires` cannot be evaluated;
|
|
192
|
+
* use Fallback only when there is no Choice. Callers serialize that selected
|
|
193
|
+
* branch as ordinary WordprocessingML rather than concatenating alternatives.
|
|
194
|
+
*/
|
|
195
|
+
declare function selectAlternateContentBranch(alternateContent: XmlElement): XmlElement | undefined;
|
|
187
196
|
/**
|
|
188
197
|
* Get an attribute value from an element
|
|
189
198
|
*
|
|
@@ -369,4 +378,4 @@ declare function cloneWithXmlnsDeclarations(element: XmlElement, xmlnsDecls: Rec
|
|
|
369
378
|
*/
|
|
370
379
|
declare function cloneElement(element: XmlElement, overrides: Partial<XmlElement>): XmlElement;
|
|
371
380
|
//#endregion
|
|
372
|
-
export { NAMESPACES, OOXML_NAMESPACE_SCOPE, WORDPROCESSINGML_NAMESPACE_URIS, XmlAttributeMatch, XmlElement, XmlNamespaceScope, attachXmlNamespaceContext, cloneElement, cloneWithXmlnsDeclarations, collectXmlnsDeclarations, elementToXml, findAllDeep, findAttributeByNamespaceUri, findByFullName, findChild, findChildByLocalName, findChildByNamespaceUri, findChildren, findChildrenByLocalName, findChildrenByNamespaceUri, findDeep, getAttribute, getAttributeAny, getAttributeAnyPrefix, getAttributeByNamespaceUri, getAttributes, getChildElements, getLocalName, getNamespacePrefix, getNamespaceUri, getTextContent, hasChild, hasFlag, matchesName, mergeXmlnsDeclarations, parseBooleanElement, parseColorElement, parseNumberingLevelAttribute, parseNumericAttribute, parseOnOffValue, parseTableMeasurementValue, parseXml, parseXmlDocument };
|
|
381
|
+
export { NAMESPACES, OFFICE_RELATIONSHIP_NAMESPACE_URIS, OOXML_NAMESPACE_SCOPE, WORDPROCESSINGML_NAMESPACE_URIS, XmlAttributeMatch, XmlElement, XmlNamespaceScope, attachXmlNamespaceContext, cloneElement, cloneWithXmlnsDeclarations, collectXmlnsDeclarations, elementToXml, findAllDeep, findAttributeByNamespaceUri, findByFullName, findChild, findChildByLocalName, findChildByNamespaceUri, findChildren, findChildrenByLocalName, findChildrenByNamespaceUri, findDeep, getAttribute, getAttributeAny, getAttributeAnyPrefix, getAttributeByNamespaceUri, getAttributes, getChildElements, getLocalName, getNamespacePrefix, getNamespaceUri, getTextContent, hasChild, hasFlag, matchesName, mergeXmlnsDeclarations, parseBooleanElement, parseColorElement, parseNumberingLevelAttribute, parseNumericAttribute, parseOnOffValue, parseTableMeasurementValue, parseXml, parseXmlDocument, selectAlternateContentBranch };
|
package/dist/docx/xmlParser.js
CHANGED
|
@@ -217,6 +217,8 @@ function getNamespacePrefix(name) {
|
|
|
217
217
|
const getNamespaceUri = (element) => element.namespaceUri;
|
|
218
218
|
/** WordprocessingML main namespace, Transitional and Strict (ECMA-376 Parts 1 and 4). */
|
|
219
219
|
const WORDPROCESSINGML_NAMESPACE_URIS = /* @__PURE__ */ new Set([NAMESPACES.w, "http://purl.oclc.org/ooxml/wordprocessingml/main"]);
|
|
220
|
+
/** Office document relationship attributes, Transitional and Strict. */
|
|
221
|
+
const OFFICE_RELATIONSHIP_NAMESPACE_URIS = /* @__PURE__ */ new Set([NAMESPACES.r, "http://purl.oclc.org/ooxml/officeDocument/relationships"]);
|
|
220
222
|
/**
|
|
221
223
|
* First child whose local name matches AND whose resolved namespace URI is
|
|
222
224
|
* one of `namespaceUris`. Unlike {@link findChild}, a same-named element
|
|
@@ -355,6 +357,26 @@ function getChildElements(parent) {
|
|
|
355
357
|
return results;
|
|
356
358
|
}
|
|
357
359
|
/**
|
|
360
|
+
* Folio's normalized Markup Compatibility policy: use the first Choice, which
|
|
361
|
+
* is the established parser behavior when `mc:Requires` cannot be evaluated;
|
|
362
|
+
* use Fallback only when there is no Choice. Callers serialize that selected
|
|
363
|
+
* branch as ordinary WordprocessingML rather than concatenating alternatives.
|
|
364
|
+
*/
|
|
365
|
+
function selectAlternateContentBranch(alternateContent) {
|
|
366
|
+
let fallback;
|
|
367
|
+
for (const child of getChildElements(alternateContent)) {
|
|
368
|
+
if (getNamespaceUri(child) !== NAMESPACES.mc) continue;
|
|
369
|
+
switch (getLocalName(child.name)) {
|
|
370
|
+
case "Choice": return child;
|
|
371
|
+
case "Fallback":
|
|
372
|
+
fallback ??= child;
|
|
373
|
+
break;
|
|
374
|
+
default: break;
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
return fallback;
|
|
378
|
+
}
|
|
379
|
+
/**
|
|
358
380
|
* Get an attribute value from an element
|
|
359
381
|
*
|
|
360
382
|
* @param element - Element to get attribute from
|
|
@@ -788,4 +810,4 @@ function cloneElement(element, overrides) {
|
|
|
788
810
|
return clone;
|
|
789
811
|
}
|
|
790
812
|
//#endregion
|
|
791
|
-
export { NAMESPACES, OOXML_NAMESPACE_SCOPE, WORDPROCESSINGML_NAMESPACE_URIS, attachXmlNamespaceContext, cloneElement, cloneWithXmlnsDeclarations, collectXmlnsDeclarations, elementToXml, findAllDeep, findAttributeByNamespaceUri, findByFullName, findChild, findChildByLocalName, findChildByNamespaceUri, findChildren, findChildrenByLocalName, findChildrenByNamespaceUri, findDeep, getAttribute, getAttributeAny, getAttributeAnyPrefix, getAttributeByNamespaceUri, getAttributes, getChildElements, getLocalName, getNamespacePrefix, getNamespaceUri, getTextContent, hasChild, hasFlag, matchesName, mergeXmlnsDeclarations, parseBooleanElement, parseColorElement, parseNumberingLevelAttribute, parseNumericAttribute, parseOnOffValue, parseTableMeasurementValue, parseXml, parseXmlDocument };
|
|
813
|
+
export { NAMESPACES, OFFICE_RELATIONSHIP_NAMESPACE_URIS, OOXML_NAMESPACE_SCOPE, WORDPROCESSINGML_NAMESPACE_URIS, attachXmlNamespaceContext, cloneElement, cloneWithXmlnsDeclarations, collectXmlnsDeclarations, elementToXml, findAllDeep, findAttributeByNamespaceUri, findByFullName, findChild, findChildByLocalName, findChildByNamespaceUri, findChildren, findChildrenByLocalName, findChildrenByNamespaceUri, findDeep, getAttribute, getAttributeAny, getAttributeAnyPrefix, getAttributeByNamespaceUri, getAttributes, getChildElements, getLocalName, getNamespacePrefix, getNamespaceUri, getTextContent, hasChild, hasFlag, matchesName, mergeXmlnsDeclarations, parseBooleanElement, parseColorElement, parseNumberingLevelAttribute, parseNumericAttribute, parseOnOffValue, parseTableMeasurementValue, parseXml, parseXmlDocument, selectAlternateContentBranch };
|
package/dist/export-pdf.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { buildDisplayList } from "./display-list/build/buildDisplayList.js";
|
|
2
|
+
import { displayCommentsFrom } from "./display-list/build/commentAnnotations.js";
|
|
2
3
|
import { installHeadlessMeasureProvider } from "./fonts/headlessMeasure.js";
|
|
3
4
|
import { layoutDocxHeadless } from "./headless-layout.js";
|
|
4
5
|
import { getMeasureProvider, setMeasureProvider } from "./layout-engine/measure/measureProvider.js";
|
|
@@ -73,6 +74,7 @@ const exportWithHeadlessProvider = async (input, options) => {
|
|
|
73
74
|
documentFeatures: laidOut.value.documentFeatures,
|
|
74
75
|
...laidOut.value.furniture,
|
|
75
76
|
embeddedFonts: laidOut.value.embeddedFonts,
|
|
77
|
+
...laidOut.value.document.package.document.comments === void 0 ? {} : { comments: displayCommentsFrom(laidOut.value.document.package.document.comments) },
|
|
76
78
|
...options.metadata === void 0 ? {} : { metadata: options.metadata }
|
|
77
79
|
});
|
|
78
80
|
const written = await writePdf(list, {
|
package/dist/headless-layout.js
CHANGED
|
@@ -272,6 +272,7 @@ const layoutDocxHeadless = async (input, options = {}) => {
|
|
|
272
272
|
finalPageSize,
|
|
273
273
|
finalMargins,
|
|
274
274
|
finalPageNumbering: getPageNumbering(finalSection),
|
|
275
|
+
sectionVerticalAlignments: sections.map(({ properties }) => properties.verticalAlign),
|
|
275
276
|
pageGap: options.pageGap ?? 0,
|
|
276
277
|
titlePage: firstSection?.titlePg === true,
|
|
277
278
|
evenAndOddHeaders: document.package.settings?.evenAndOddHeaders === true,
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { document_d_exports } from "./types/document.js";
|
|
2
|
-
import { FolioContentBlock, FolioContentContainerPathEntry, FolioContentIdStability, FolioContentInlineBooleanProperty, FolioContentInlineFormatting, FolioContentInlineFormattingPatch, FolioContentLineSpacingRule, FolioContentParagraphAlignment, FolioContentParagraphKind, FolioContentParagraphSpacing, FolioContentRun, FolioContentSnapshot, FolioContentTableLocation } from "./compare/content-types.js";
|
|
2
|
+
import { FolioContentBlock, FolioContentContainerPathEntry, FolioContentFormatRange, FolioContentIdStability, FolioContentInlineBooleanProperty, FolioContentInlineComparisonResult, FolioContentInlineFormatting, FolioContentInlineFormattingPatch, FolioContentLineSpacingRule, FolioContentParagraphAlignment, FolioContentParagraphKind, FolioContentParagraphSpacing, FolioContentRun, FolioContentSnapshot, FolioContentTableLocation } from "./compare/content-types.js";
|
|
3
3
|
import { FolioAIBlock, FolioAIBlockAnchor, FolioAIBlockKind, FolioAIBlockPreviewRun, FolioAIBlockStructuralBoundary, FolioAIBlockTableLocation, FolioAIComment, FolioAIEditAppliedOperation, FolioAIEditApplyMode, FolioAIEditApplyResult, FolioAIEditNormalization, FolioAIEditNormalizationCode, FolioAIEditOperation, FolioAIEditPrecondition, FolioAIEditReviewMeta, FolioAIEditSeverity, FolioAIEditSkipReason, FolioAIEditSkippedOperation, FolioAIEditSnapshot, FolioAIInlineBooleanProperty, FolioAIInlineFormatting, FolioAIInlineFormattingPatch, FolioAIParagraphSpacing, FolioAISignatureParty } from "./ai-edits/types.js";
|
|
4
4
|
import { WORD_DIFF_GRANULARITIES, WordDiffGranularity, WordDiffNormalization, WordDiffOptions, WordDiffSegment, diffWordSegments } from "./ai-edits/word-diff.js";
|
|
5
5
|
import { FolioAIEditApplyOutcome, FolioRevisionStamp, FolioWordDiffOptions, applyFolioAIEditOperations } from "./ai-edits/apply.js";
|
|
@@ -11,9 +11,9 @@ import { AIBarStatus, AIChatMode, AICitation, AICitationSource, AIGenerateInput,
|
|
|
11
11
|
import { ApplyResult, applySuggestions } from "./ai-suggestions/apply.js";
|
|
12
12
|
import { ResolvedAnchor, isSuggestionStale, resolveSuggestionAnchor } from "./ai-suggestions/conflict.js";
|
|
13
13
|
import { PositionalText, buildPositionalText } from "./ai-suggestions/text-positions.js";
|
|
14
|
-
import { CompareContentOptions, FOLIO_CONTENT_COMPARISON_LIMITS, FolioContentBlockProperty, FolioContentComparison, FolioContentComparisonError, FolioContentComparisonEvent, FolioContentComparisonLimit, FolioContentComparisonLimitError, FolioContentFormatRange, FolioContentFormattingChange, FolioContentParagraphFormattingPatch, FolioContentStructuralChange, FolioContentTextSegment, InvalidFolioContentComparisonError, compareContent } from "./compare/content.js";
|
|
15
14
|
import { COMPARE_VERIFICATION_CAUSES, COMPARE_VERIFICATION_INVARIANTS, CompareVerification, CompareVerificationCause, CompareVerificationFailure, CompareVerificationInvariant, FinalParagraphMarkRevision } from "./compare/verification.js";
|
|
16
|
-
import { COMPARE_UNSUPPORTED_REASONS, CompareChange, CompareChangeLocation, CompareDocxApplyError, CompareDocxError, CompareDocxFinalParagraphMarkError, CompareDocxOperationLimitError, CompareDocxOptions, CompareDocxParseError, CompareDocxRoundTripError, CompareDocxSerializeError,
|
|
15
|
+
import { COMPARE_REVISION_FORMATS, COMPARE_UNSUPPORTED_REASONS, CompareChange, CompareChangeLocation, CompareCompatibility, CompareDocxApplyError, CompareDocxError, CompareDocxFinalParagraphMarkError, CompareDocxOperationLimitError, CompareDocxOptions, CompareDocxParseError, CompareDocxRoundTripError, CompareDocxSerializeError, CompareFolioRequirement, CompareResult, CompareRevisionFormat, CompareUnsupportedPart, CompareUnsupportedReason, InvalidCompareDocxOptionsError } from "./compare/types.js";
|
|
16
|
+
import { CompareContentOptions, FOLIO_CONTENT_COMPARISON_LIMITS, FolioContentBlockProperty, FolioContentComparison, FolioContentComparisonError, FolioContentComparisonEvent, FolioContentComparisonLimit, FolioContentComparisonLimitError, FolioContentFormattingChange, FolioContentInlinePresentationProjectionError, FolioContentParagraphFormattingPatch, FolioContentStructuralChange, FolioContentTextSegment, InvalidFolioContentComparisonError, compareContent } from "./compare/content.js";
|
|
17
17
|
import { MAX_COMPARE_OPERATIONS, compareDocx } from "./compare/compare.js";
|
|
18
18
|
import { DOCUMENT_PRESET_VERSION, DOCUMENT_STYLE_SET_VERSION, DocumentPreset, DocumentStyleSet } from "./style-sets/types.js";
|
|
19
19
|
import { CreateEmptyDocumentOptions, createEmptyDocument } from "./utils/createDocument.js";
|
|
@@ -40,4 +40,4 @@ import { getGoogleFontsEnabled, setEmbeddedFontFamilyMap, setGoogleFontsEnabled
|
|
|
40
40
|
import { DOCX_CONFORMANCE_CLASSES } from "@stll/docx-core/model";
|
|
41
41
|
type Document = document_d_exports.Document;
|
|
42
42
|
type DocxConformanceClass = document_d_exports.DocxConformanceClass;
|
|
43
|
-
export { type AIBarStatus, type AIChatMode, type AICitation, type AICitationRange, type AICitationSource, type AIGenerateInput, type AISuggestion, type AISuggestionApplyMode, type AISuggestionPreset, type AISuggestionSeverity, type AISuggestionStatus, type AcceptAutocompleteResult, type AnonymizationMatch, type AnonymizationTerm, type ApplyFolioDocumentOperationsOptions, type ApplyResult, type AutocompleteSuggestionPluginOptions, type AutocompleteSuggestionState, type AutocompleteSuggestionStatus, type AutocompleteTriggerCheck, type AutocompleteTriggerOptions, type AutocompleteTriggerSkipReason, type BlockRect, COMPARE_UNSUPPORTED_REASONS, COMPARE_VERIFICATION_CAUSES, COMPARE_VERIFICATION_INVARIANTS, type CompareChange, type CompareChangeLocation, type CompareContentOptions, CompareDocxApplyError, type CompareDocxError, CompareDocxFinalParagraphMarkError, CompareDocxOperationLimitError, type CompareDocxOptions, CompareDocxParseError, CompareDocxRoundTripError, CompareDocxSerializeError, type
|
|
43
|
+
export { type AIBarStatus, type AIChatMode, type AICitation, type AICitationRange, type AICitationSource, type AIGenerateInput, type AISuggestion, type AISuggestionApplyMode, type AISuggestionPreset, type AISuggestionSeverity, type AISuggestionStatus, type AcceptAutocompleteResult, type AnonymizationMatch, type AnonymizationTerm, type ApplyFolioDocumentOperationsOptions, type ApplyResult, type AutocompleteSuggestionPluginOptions, type AutocompleteSuggestionState, type AutocompleteSuggestionStatus, type AutocompleteTriggerCheck, type AutocompleteTriggerOptions, type AutocompleteTriggerSkipReason, type BlockRect, COMPARE_REVISION_FORMATS, COMPARE_UNSUPPORTED_REASONS, COMPARE_VERIFICATION_CAUSES, COMPARE_VERIFICATION_INVARIANTS, type CompareChange, type CompareChangeLocation, type CompareCompatibility, type CompareContentOptions, CompareDocxApplyError, type CompareDocxError, CompareDocxFinalParagraphMarkError, CompareDocxOperationLimitError, type CompareDocxOptions, CompareDocxParseError, CompareDocxRoundTripError, CompareDocxSerializeError, type CompareFolioRequirement, type CompareResult, type CompareRevisionFormat, type CompareUnsupportedPart, type CompareUnsupportedReason, type CompareVerification, type CompareVerificationCause, type CompareVerificationFailure, type CompareVerificationInvariant, type CreateEmptyDocumentOptions, DEFAULT_AI_SUGGESTION_PRESETS, DEFAULT_AUTOCOMPLETE_DEAD_ZONE_NODES, DOCUMENT_PRESET_VERSION, DOCUMENT_STYLE_SET_VERSION, DOCX_CONFORMANCE_CLASSES, type DeriveBlockIdInput, type DirectiveKind, type DirectiveRange, type Document, type DocumentPreset, type DocumentStyleCatalog, type DocumentStyleCatalogEntry, type DocumentStyleSet, type DocxCompatibility, type DocxCompatibilityContext, type DocxCompatibilityIssue, type DocxCompatibilityLocation, type DocxCompatibilityPart, type DocxConformanceClass, type EmbeddedFont, type EmbeddedFontParts, type ExtractDocumentStyleSetOptions, FOLIO_CONTENT_COMPARISON_LIMITS, FOLIO_DOCUMENT_OPERATION_BATCH_MODES, FOLIO_DOCUMENT_OPERATION_CONTRACT_VERSION, FOLIO_DOCUMENT_OPERATION_MODES, FOLIO_DOCUMENT_OPERATION_MODES_BY_TYPE, FOLIO_DOCUMENT_OPERATION_PRECONDITIONS, FOLIO_DOCUMENT_OPERATION_STORIES, FOLIO_DOCUMENT_OPERATION_TYPES, FOLIO_LINE_SPACING_RULE_VALUES, FOLIO_PARAGRAPH_ALIGNMENT_VALUES, type FinalParagraphMarkRevision, type FolioAIBlock, type FolioAIBlockAnchor, type FolioAIBlockKind, type FolioAIBlockPreviewRun, type FolioAIBlockStructuralBoundary, type FolioAIBlockTableLocation, type FolioAIComment, type FolioAIEditAppliedOperation, type FolioAIEditApplyMode, type FolioAIEditApplyOutcome, type FolioAIEditApplyResult, type FolioAIEditNormalization, type FolioAIEditNormalizationCode, type FolioAIEditOperation, type FolioAIEditPrecondition, type FolioAIEditReviewMeta, type FolioAIEditSeverity, type FolioAIEditSkipReason, type FolioAIEditSkippedOperation, type FolioAIEditSnapshot, type FolioAIInlineBooleanProperty, type FolioAIInlineFormatting, type FolioAIInlineFormattingPatch, type FolioAIParagraphSpacing, type FolioAISignatureParty, type FolioBlockId, type FolioContentBlock, type FolioContentBlockProperty, type FolioContentComparison, type FolioContentComparisonError, type FolioContentComparisonEvent, type FolioContentComparisonLimit, FolioContentComparisonLimitError, type FolioContentContainerPathEntry, type FolioContentFormatRange, type FolioContentFormattingChange, type FolioContentIdStability, type FolioContentInlineBooleanProperty, type FolioContentInlineComparisonResult, type FolioContentInlineFormatting, type FolioContentInlineFormattingPatch, FolioContentInlinePresentationProjectionError, type FolioContentLineSpacingRule, type FolioContentParagraphAlignment, type FolioContentParagraphFormattingPatch, type FolioContentParagraphKind, type FolioContentParagraphSpacing, type FolioContentRun, type FolioContentSnapshot, type FolioContentStructuralChange, type FolioContentTableLocation, type FolioContentTextSegment, type FolioDocumentOperation, type FolioDocumentOperationAffectedTarget, type FolioDocumentOperationBatch, type FolioDocumentOperationCapabilities, type FolioDocumentOperationIssue, type FolioDocumentOperationMode, type FolioDocumentOperationPrecondition, type FolioDocumentOperationReceipt, type FolioDocumentOperationRecovery, type FolioDocumentOperationResult, type FolioDocumentOperationResultBase, type FolioDocumentOperationStatus, type FolioDocumentOperationStory, type FolioDocumentOperationType, type FolioDocumentOperationUndoFailureReason, type FolioDocumentOperationUndoHandle, type FolioDocumentOperationUndoResult, type FolioDocxCompatibilityHost, type FolioDocxCompatibilityProfile, type FolioRevisionStamp, type FolioWordDiffOptions, type ImageMeta, type ImageRef, type InspectDocxCompatibilityOptions, InvalidCompareDocxOptionsError, InvalidFolioContentComparisonError, InvalidFolioDocumentOperationBatchError, MAX_COMPARE_OPERATIONS, type MarkdownOptions, type MarkdownResult, type PositionalText, type ResolvedAnchor, STELLA_STYLE_SET_NAME, type TemplatePreviewSpan, type TemplatePreviewValue, type TemplatePreviewValues, type TemplateSlashMenuKeyAction, type TemplateSlashMenuState, UnsupportedFolioDocumentOperationVersionError, WORD_DIFF_GRANULARITIES, type WordDiffGranularity, type WordDiffNormalization, type WordDiffOptions, type WordDiffSegment, acceptAutocompleteSuggestion, acceptAutocompleteWord, anonymizationDecorationsKey, appendAutocompleteToken, applyFolioAIEditOperations, applyFolioDocumentOperations, applySuggestions, assertSupportedFolioDocumentOperationVersion, autocompleteSuggestionKey, autocompleteSuggestionPlugin, buildEmbeddedFontFamilyMap, buildPositionalText, clearAutocompleteSuggestion, clearTemplateSlashMenu, compareContent, compareDocx, consumeTemplateSlashQuery, createAICitationDecorationsPlugin, createDocx, createEmptyDocument, createFolioAIEditSnapshot, createStellaStyleDocumentPreset, createStellaStyleSet, currentFolioBlockId, deriveBlockId, diffWordSegments, extractDocumentStyleSet, extractDocumentStyleSetFromDocx, extractEmbeddedFonts, finishAutocompleteSuggestion, fromMarkdown, getAnonymizationMatches, getAutocompleteSuggestion, getEmbeddedFontFaces, getFolioCaretViewportRect, getFolioDocumentOperationCapabilities, getFolioDocumentOperationIssues, getFolioDocumentOperationReceipts, getFolioParaIdFromBlockId, getFolioSelectionViewportRect, getGoogleFontsEnabled, getTemplateDirectives, getTemplateSlashMenu, hashFolioAIBlockText, inspectDocumentStyles, inspectDocumentStylesFromDocx, inspectDocxCompatibility, isFolioAIContentBlock, isFolioBlockId, isFolioDocumentOperationModeSupported, isSequentialFolioBlockId, isSuggestionStale, isSupportedFolioDocumentOperationVersion, mergeDocumentContent, normalizeFolioAIBlockText, parseFolioDocumentOperationBatch, resetTemplateSlashQuery, resolveSuggestionAnchor, scanDirectives, scopeEmbeddedFontFamily, scrollFolioPositionIntoView, setAICitationsMeta, setAISuggestionsMeta, setActiveCitationMeta, setAnonymizationTermsMeta, setEmbeddedFontFamilyMap, setFocusedSuggestionMeta, setGoogleFontsEnabled, setTemplatePreviewValues, shouldTriggerAutocomplete, startAutocompleteSuggestion, templateSlashMenuKey, toMarkdown, toMarkdownResult };
|
package/dist/index.js
CHANGED
|
@@ -6,8 +6,8 @@ import { isSuggestionStale, resolveSuggestionAnchor } from "./ai-suggestions/con
|
|
|
6
6
|
import { buildPositionalText } from "./ai-suggestions/text-positions.js";
|
|
7
7
|
import { DEFAULT_AI_SUGGESTION_PRESETS } from "./ai-suggestions/types.js";
|
|
8
8
|
import { MAX_COMPARE_OPERATIONS, compareDocx } from "./compare/compare.js";
|
|
9
|
-
import { FOLIO_CONTENT_COMPARISON_LIMITS, FolioContentComparisonLimitError, InvalidFolioContentComparisonError, compareContent } from "./compare/content.js";
|
|
10
|
-
import { COMPARE_UNSUPPORTED_REASONS, CompareDocxApplyError, CompareDocxFinalParagraphMarkError, CompareDocxOperationLimitError, CompareDocxParseError, CompareDocxRoundTripError, CompareDocxSerializeError, InvalidCompareDocxOptionsError } from "./compare/types.js";
|
|
9
|
+
import { FOLIO_CONTENT_COMPARISON_LIMITS, FolioContentComparisonLimitError, FolioContentInlinePresentationProjectionError, InvalidFolioContentComparisonError, compareContent } from "./compare/content.js";
|
|
10
|
+
import { COMPARE_REVISION_FORMATS, COMPARE_UNSUPPORTED_REASONS, CompareDocxApplyError, CompareDocxFinalParagraphMarkError, CompareDocxOperationLimitError, CompareDocxParseError, CompareDocxRoundTripError, CompareDocxSerializeError, InvalidCompareDocxOptionsError } from "./compare/types.js";
|
|
11
11
|
import { COMPARE_VERIFICATION_CAUSES, COMPARE_VERIFICATION_INVARIANTS } from "./compare/verification.js";
|
|
12
12
|
import { FOLIO_DOCUMENT_OPERATION_BATCH_MODES, FOLIO_DOCUMENT_OPERATION_CONTRACT_VERSION, FOLIO_DOCUMENT_OPERATION_MODES, FOLIO_DOCUMENT_OPERATION_MODES_BY_TYPE, FOLIO_DOCUMENT_OPERATION_PRECONDITIONS, FOLIO_DOCUMENT_OPERATION_STORIES, FOLIO_DOCUMENT_OPERATION_TYPES, FOLIO_LINE_SPACING_RULE_VALUES, FOLIO_PARAGRAPH_ALIGNMENT_VALUES, InvalidFolioDocumentOperationBatchError, UnsupportedFolioDocumentOperationVersionError, applyFolioDocumentOperations, assertSupportedFolioDocumentOperationVersion, getFolioDocumentOperationCapabilities, getFolioDocumentOperationIssues, getFolioDocumentOperationReceipts, isFolioDocumentOperationModeSupported, isSupportedFolioDocumentOperationVersion, parseFolioDocumentOperationBatch } from "./document-operations.js";
|
|
13
13
|
import { inspectDocxCompatibility } from "./docx/compatibility.js";
|
|
@@ -32,4 +32,4 @@ import { createEmptyDocument } from "./utils/createDocument.js";
|
|
|
32
32
|
import { getGoogleFontsEnabled, setEmbeddedFontFamilyMap, setGoogleFontsEnabled } from "./utils/fontResolver.js";
|
|
33
33
|
import { mergeDocumentContent } from "./utils/mergeDocumentContent.js";
|
|
34
34
|
import { DOCX_CONFORMANCE_CLASSES } from "@stll/docx-core/model";
|
|
35
|
-
export { COMPARE_UNSUPPORTED_REASONS, COMPARE_VERIFICATION_CAUSES, COMPARE_VERIFICATION_INVARIANTS, CompareDocxApplyError, CompareDocxFinalParagraphMarkError, CompareDocxOperationLimitError, CompareDocxParseError, CompareDocxRoundTripError, CompareDocxSerializeError, DEFAULT_AI_SUGGESTION_PRESETS, DEFAULT_AUTOCOMPLETE_DEAD_ZONE_NODES, DOCUMENT_PRESET_VERSION, DOCUMENT_STYLE_SET_VERSION, DOCX_CONFORMANCE_CLASSES, FOLIO_CONTENT_COMPARISON_LIMITS, FOLIO_DOCUMENT_OPERATION_BATCH_MODES, FOLIO_DOCUMENT_OPERATION_CONTRACT_VERSION, FOLIO_DOCUMENT_OPERATION_MODES, FOLIO_DOCUMENT_OPERATION_MODES_BY_TYPE, FOLIO_DOCUMENT_OPERATION_PRECONDITIONS, FOLIO_DOCUMENT_OPERATION_STORIES, FOLIO_DOCUMENT_OPERATION_TYPES, FOLIO_LINE_SPACING_RULE_VALUES, FOLIO_PARAGRAPH_ALIGNMENT_VALUES, FolioContentComparisonLimitError, InvalidCompareDocxOptionsError, InvalidFolioContentComparisonError, InvalidFolioDocumentOperationBatchError, MAX_COMPARE_OPERATIONS, STELLA_STYLE_SET_NAME, UnsupportedFolioDocumentOperationVersionError, WORD_DIFF_GRANULARITIES, acceptAutocompleteSuggestion, acceptAutocompleteWord, anonymizationDecorationsKey, appendAutocompleteToken, applyFolioAIEditOperations, applyFolioDocumentOperations, applySuggestions, assertSupportedFolioDocumentOperationVersion, autocompleteSuggestionKey, autocompleteSuggestionPlugin, buildEmbeddedFontFamilyMap, buildPositionalText, clearAutocompleteSuggestion, clearTemplateSlashMenu, compareContent, compareDocx, consumeTemplateSlashQuery, createAICitationDecorationsPlugin, createDocx, createEmptyDocument, createFolioAIEditSnapshot, createStellaStyleDocumentPreset, createStellaStyleSet, currentFolioBlockId, deriveBlockId, diffWordSegments, extractDocumentStyleSet, extractDocumentStyleSetFromDocx, extractEmbeddedFonts, finishAutocompleteSuggestion, fromMarkdown, getAnonymizationMatches, getAutocompleteSuggestion, getEmbeddedFontFaces, getFolioCaretViewportRect, getFolioDocumentOperationCapabilities, getFolioDocumentOperationIssues, getFolioDocumentOperationReceipts, getFolioParaIdFromBlockId, getFolioSelectionViewportRect, getGoogleFontsEnabled, getTemplateDirectives, getTemplateSlashMenu, hashFolioAIBlockText, inspectDocumentStyles, inspectDocumentStylesFromDocx, inspectDocxCompatibility, isFolioAIContentBlock, isFolioBlockId, isFolioDocumentOperationModeSupported, isSequentialFolioBlockId, isSuggestionStale, isSupportedFolioDocumentOperationVersion, mergeDocumentContent, normalizeFolioAIBlockText, parseFolioDocumentOperationBatch, resetTemplateSlashQuery, resolveSuggestionAnchor, scanDirectives, scopeEmbeddedFontFamily, scrollFolioPositionIntoView, setAICitationsMeta, setAISuggestionsMeta, setActiveCitationMeta, setAnonymizationTermsMeta, setEmbeddedFontFamilyMap, setFocusedSuggestionMeta, setGoogleFontsEnabled, setTemplatePreviewValues, shouldTriggerAutocomplete, startAutocompleteSuggestion, templateSlashMenuKey, toMarkdown, toMarkdownResult };
|
|
35
|
+
export { COMPARE_REVISION_FORMATS, COMPARE_UNSUPPORTED_REASONS, COMPARE_VERIFICATION_CAUSES, COMPARE_VERIFICATION_INVARIANTS, CompareDocxApplyError, CompareDocxFinalParagraphMarkError, CompareDocxOperationLimitError, CompareDocxParseError, CompareDocxRoundTripError, CompareDocxSerializeError, DEFAULT_AI_SUGGESTION_PRESETS, DEFAULT_AUTOCOMPLETE_DEAD_ZONE_NODES, DOCUMENT_PRESET_VERSION, DOCUMENT_STYLE_SET_VERSION, DOCX_CONFORMANCE_CLASSES, FOLIO_CONTENT_COMPARISON_LIMITS, FOLIO_DOCUMENT_OPERATION_BATCH_MODES, FOLIO_DOCUMENT_OPERATION_CONTRACT_VERSION, FOLIO_DOCUMENT_OPERATION_MODES, FOLIO_DOCUMENT_OPERATION_MODES_BY_TYPE, FOLIO_DOCUMENT_OPERATION_PRECONDITIONS, FOLIO_DOCUMENT_OPERATION_STORIES, FOLIO_DOCUMENT_OPERATION_TYPES, FOLIO_LINE_SPACING_RULE_VALUES, FOLIO_PARAGRAPH_ALIGNMENT_VALUES, FolioContentComparisonLimitError, FolioContentInlinePresentationProjectionError, InvalidCompareDocxOptionsError, InvalidFolioContentComparisonError, InvalidFolioDocumentOperationBatchError, MAX_COMPARE_OPERATIONS, STELLA_STYLE_SET_NAME, UnsupportedFolioDocumentOperationVersionError, WORD_DIFF_GRANULARITIES, acceptAutocompleteSuggestion, acceptAutocompleteWord, anonymizationDecorationsKey, appendAutocompleteToken, applyFolioAIEditOperations, applyFolioDocumentOperations, applySuggestions, assertSupportedFolioDocumentOperationVersion, autocompleteSuggestionKey, autocompleteSuggestionPlugin, buildEmbeddedFontFamilyMap, buildPositionalText, clearAutocompleteSuggestion, clearTemplateSlashMenu, compareContent, compareDocx, consumeTemplateSlashQuery, createAICitationDecorationsPlugin, createDocx, createEmptyDocument, createFolioAIEditSnapshot, createStellaStyleDocumentPreset, createStellaStyleSet, currentFolioBlockId, deriveBlockId, diffWordSegments, extractDocumentStyleSet, extractDocumentStyleSetFromDocx, extractEmbeddedFonts, finishAutocompleteSuggestion, fromMarkdown, getAnonymizationMatches, getAutocompleteSuggestion, getEmbeddedFontFaces, getFolioCaretViewportRect, getFolioDocumentOperationCapabilities, getFolioDocumentOperationIssues, getFolioDocumentOperationReceipts, getFolioParaIdFromBlockId, getFolioSelectionViewportRect, getGoogleFontsEnabled, getTemplateDirectives, getTemplateSlashMenu, hashFolioAIBlockText, inspectDocumentStyles, inspectDocumentStylesFromDocx, inspectDocxCompatibility, isFolioAIContentBlock, isFolioBlockId, isFolioDocumentOperationModeSupported, isSequentialFolioBlockId, isSuggestionStale, isSupportedFolioDocumentOperationVersion, mergeDocumentContent, normalizeFolioAIBlockText, parseFolioDocumentOperationBatch, resetTemplateSlashQuery, resolveSuggestionAnchor, scanDirectives, scopeEmbeddedFontFamily, scrollFolioPositionIntoView, setAICitationsMeta, setAISuggestionsMeta, setActiveCitationMeta, setAnonymizationTermsMeta, setEmbeddedFontFamilyMap, setFocusedSuggestionMeta, setGoogleFontsEnabled, setTemplatePreviewValues, shouldTriggerAutocomplete, startAutocompleteSuggestion, templateSlashMenuKey, toMarkdown, toMarkdownResult };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { FolioContentBlock, FolioContentInlineComparisonResult } from "../../compare/content-types.js";
|
|
2
|
+
//#region src/internal/compare/inline-presentation.d.ts
|
|
3
|
+
/** Derived from the descriptor grammar; tests use it to prove full coverage. */
|
|
4
|
+
declare const CANONICAL_INLINE_PRESENTATION_PROPERTIES: readonly ("bold" | "italic" | "underline" | "strike" | "fontFamily" | "fontSizePt" | "color")[];
|
|
5
|
+
type InlinePresentationBlock = Pick<FolioContentBlock, "previewRuns" | "text">;
|
|
6
|
+
type CanonicalInlinePresentationSegmentsOptions = {
|
|
7
|
+
baseBlock: InlinePresentationBlock;
|
|
8
|
+
revisedBlock: InlinePresentationBlock;
|
|
9
|
+
maxSegments: number;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Collect coalesced canonical presentation differences in character order.
|
|
13
|
+
* Invalid run streams take precedence over the segment budget, so malformed
|
|
14
|
+
* content cannot change meaning as the caller's remaining budget changes.
|
|
15
|
+
*/
|
|
16
|
+
declare const canonicalInlinePresentationSegments: ({ baseBlock, revisedBlock, maxSegments }: CanonicalInlinePresentationSegmentsOptions) => FolioContentInlineComparisonResult;
|
|
17
|
+
/** Effective and authored presentation equality, independent of run splits. */
|
|
18
|
+
declare const sameCanonicalInlinePresentation: (baseBlock: InlinePresentationBlock, revisedBlock: InlinePresentationBlock) => boolean;
|
|
19
|
+
//#endregion
|
|
20
|
+
export { CANONICAL_INLINE_PRESENTATION_PROPERTIES, canonicalInlinePresentationSegments, sameCanonicalInlinePresentation };
|