@stll/folio-core 0.37.4 → 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.
- 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/index.d.ts +2 -1
- 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 +38 -16
- 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 +216 -137
- package/dist/compare/content-types.d.ts +36 -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/document-operations.d.ts +5 -3
- package/dist/document-operations.js +112 -5
- package/dist/docx/blockContentParser.js +14 -2
- 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.d.ts +1 -13
- package/dist/docx/numberingParser.js +31 -37
- package/dist/docx/paragraphParser.js +12 -9
- package/dist/docx/paragraphPropertySource.d.ts +8 -5
- package/dist/docx/paragraphPropertySource.js +16 -4
- 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 +16 -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/borderSerializer.d.ts +4 -1
- package/dist/docx/serializer/borderSerializer.js +20 -18
- package/dist/docx/serializer/commentSerializer.js +1 -1
- package/dist/docx/serializer/numberingSerializer.js +1 -1
- package/dist/docx/serializer/paragraphSerializer.js +13 -177
- package/dist/docx/serializer/partNamespaces.d.ts +1 -1
- package/dist/docx/serializer/partNamespaces.js +4 -0
- package/dist/docx/serializer/runSerializer.d.ts +1 -5
- package/dist/docx/serializer/runSerializer.js +4 -130
- package/dist/docx/serializer/sectionPropertiesSerializer.js +5 -2
- package/dist/docx/serializer/stylesSerializer.js +1 -1
- package/dist/docx/serializer/textFormattingSerializer.d.ts +17 -0
- package/dist/docx/serializer/textFormattingSerializer.js +144 -0
- package/dist/docx/tableParser.js +21 -11
- package/dist/docx/xmlParser.d.ts +10 -1
- package/dist/docx/xmlParser.js +23 -1
- 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 +25 -0
- package/dist/internal/paragraphFormattingSerialization.js +164 -0
- 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/markdown/renderRuns.js +1 -0
- package/dist/markdown/renderTable.js +1 -0
- package/dist/prosemirror/attrs/index.js +20 -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 +22 -22
- package/dist/prosemirror/conversion/toProseDoc.js +16 -57
- package/dist/prosemirror/extensions/core/ParagraphExtension.js +2 -0
- package/dist/prosemirror/extensions/marks/RunFormattingOverrideExtension.js +3 -0
- 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 +3 -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 +3 -2
- package/dist/server.js +2 -2
- package/dist/version-comparison.d.ts +2 -0
- package/dist/version-comparison.js +30 -29
- package/package.json +2 -2
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { HIGHLIGHT_COLOR_VALUES } from "../../types/documentEnumValues.js";
|
|
2
1
|
import { isValidHexColor } from "../../utils/colorResolver.js";
|
|
3
|
-
import { roundHorizontalScalePercentForSerialization } from "../../utils/horizontalScale.js";
|
|
4
2
|
import { THEME_COLOR_TO_DRAWING_SCHEME } from "../drawingUtils.js";
|
|
3
|
+
import { canReplayEditableImageRawXml } from "../imageRawXml.js";
|
|
5
4
|
import { requiresXmlSpacePreserve } from "../textWhitespace.js";
|
|
6
5
|
import { serializeParagraph } from "./paragraphSerializer.js";
|
|
7
6
|
import { serializeTable } from "./tableSerializer.js";
|
|
7
|
+
import { serializeTextFormatting } from "./textFormattingSerializer.js";
|
|
8
8
|
import { getSingularRunPropertyChange, serializeTrackedChangeAttributes } from "./trackedChangeAttributes.js";
|
|
9
9
|
import { escapeXml, intAttr } from "./xmlUtils.js";
|
|
10
10
|
import { panic } from "better-result";
|
|
@@ -38,132 +38,6 @@ function getUniqueId(id) {
|
|
|
38
38
|
if (id !== void 0 && id !== "" && id !== 0) return String(id);
|
|
39
39
|
return String(nextAutoId++);
|
|
40
40
|
}
|
|
41
|
-
/** Valid OOXML highlight color names (ECMA-376 §17.18.40) */
|
|
42
|
-
const VALID_HIGHLIGHT_COLORS = new Set(HIGHLIGHT_COLOR_VALUES);
|
|
43
|
-
/**
|
|
44
|
-
* Serialize a color element (w:color)
|
|
45
|
-
*/
|
|
46
|
-
function serializeColorElement(color) {
|
|
47
|
-
if (!color) return "";
|
|
48
|
-
const attrs = [];
|
|
49
|
-
if (color.auto) attrs.push("w:val=\"auto\"");
|
|
50
|
-
else if (color.rgb && isValidHexColor(color.rgb)) attrs.push(`w:val="${escapeXml(color.rgb)}"`);
|
|
51
|
-
if (color.themeColor) attrs.push(`w:themeColor="${escapeXml(color.themeColor)}"`);
|
|
52
|
-
if (color.themeTint) attrs.push(`w:themeTint="${escapeXml(color.themeTint)}"`);
|
|
53
|
-
if (color.themeShade) attrs.push(`w:themeShade="${escapeXml(color.themeShade)}"`);
|
|
54
|
-
if (attrs.length === 0) return "";
|
|
55
|
-
return `<w:color ${attrs.join(" ")}/>`;
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* Serialize shading properties (w:shd)
|
|
59
|
-
*/
|
|
60
|
-
function serializeShading(shading) {
|
|
61
|
-
if (!shading) return "";
|
|
62
|
-
const attrs = [];
|
|
63
|
-
if (shading.pattern) attrs.push(`w:val="${escapeXml(shading.pattern)}"`);
|
|
64
|
-
else attrs.push("w:val=\"clear\"");
|
|
65
|
-
if (shading.color?.rgb && isValidHexColor(shading.color.rgb)) attrs.push(`w:color="${escapeXml(shading.color.rgb)}"`);
|
|
66
|
-
else if (shading.color?.auto) attrs.push("w:color=\"auto\"");
|
|
67
|
-
if (shading.fill?.rgb && isValidHexColor(shading.fill.rgb)) attrs.push(`w:fill="${escapeXml(shading.fill.rgb)}"`);
|
|
68
|
-
else if (shading.fill?.auto) attrs.push("w:fill=\"auto\"");
|
|
69
|
-
if (shading.fill?.themeColor) attrs.push(`w:themeFill="${escapeXml(shading.fill.themeColor)}"`);
|
|
70
|
-
if (shading.fill?.themeTint) attrs.push(`w:themeFillTint="${escapeXml(shading.fill.themeTint)}"`);
|
|
71
|
-
if (shading.fill?.themeShade) attrs.push(`w:themeFillShade="${escapeXml(shading.fill.themeShade)}"`);
|
|
72
|
-
if (attrs.length === 0) return "";
|
|
73
|
-
return `<w:shd ${attrs.join(" ")}/>`;
|
|
74
|
-
}
|
|
75
|
-
/**
|
|
76
|
-
* Serialize text formatting properties to w:rPr XML
|
|
77
|
-
*/
|
|
78
|
-
function serializeTextFormatting(formatting) {
|
|
79
|
-
if (!formatting) return "";
|
|
80
|
-
const parts = [];
|
|
81
|
-
if (formatting.styleId) parts.push(`<w:rStyle w:val="${escapeXml(formatting.styleId)}"/>`);
|
|
82
|
-
if (formatting.fontFamily) {
|
|
83
|
-
const fontAttrs = [];
|
|
84
|
-
if (formatting.fontFamily.ascii) fontAttrs.push(`w:ascii="${escapeXml(formatting.fontFamily.ascii)}"`);
|
|
85
|
-
if (formatting.fontFamily.hAnsi) fontAttrs.push(`w:hAnsi="${escapeXml(formatting.fontFamily.hAnsi)}"`);
|
|
86
|
-
if (formatting.fontFamily.eastAsia) fontAttrs.push(`w:eastAsia="${escapeXml(formatting.fontFamily.eastAsia)}"`);
|
|
87
|
-
if (formatting.fontFamily.cs) fontAttrs.push(`w:cs="${escapeXml(formatting.fontFamily.cs)}"`);
|
|
88
|
-
if (formatting.fontFamily.hint) fontAttrs.push(`w:hint="${escapeXml(formatting.fontFamily.hint)}"`);
|
|
89
|
-
if (formatting.fontFamily.asciiTheme) fontAttrs.push(`w:asciiTheme="${escapeXml(formatting.fontFamily.asciiTheme)}"`);
|
|
90
|
-
if (formatting.fontFamily.hAnsiTheme) fontAttrs.push(`w:hAnsiTheme="${escapeXml(formatting.fontFamily.hAnsiTheme)}"`);
|
|
91
|
-
if (formatting.fontFamily.eastAsiaTheme) fontAttrs.push(`w:eastAsiaTheme="${escapeXml(formatting.fontFamily.eastAsiaTheme)}"`);
|
|
92
|
-
if (formatting.fontFamily.csTheme) fontAttrs.push(`w:cstheme="${escapeXml(formatting.fontFamily.csTheme)}"`);
|
|
93
|
-
if (fontAttrs.length > 0) parts.push(`<w:rFonts ${fontAttrs.join(" ")}/>`);
|
|
94
|
-
}
|
|
95
|
-
if (formatting.bold === true) parts.push("<w:b/>");
|
|
96
|
-
else if (formatting.bold === false) parts.push("<w:b w:val=\"0\"/>");
|
|
97
|
-
if (formatting.boldCs === true) parts.push("<w:bCs/>");
|
|
98
|
-
else if (formatting.boldCs === false) parts.push("<w:bCs w:val=\"0\"/>");
|
|
99
|
-
if (formatting.italic === true) parts.push("<w:i/>");
|
|
100
|
-
else if (formatting.italic === false) parts.push("<w:i w:val=\"0\"/>");
|
|
101
|
-
if (formatting.italicCs === true) parts.push("<w:iCs/>");
|
|
102
|
-
else if (formatting.italicCs === false) parts.push("<w:iCs w:val=\"0\"/>");
|
|
103
|
-
if (formatting.allCaps === true) parts.push("<w:caps/>");
|
|
104
|
-
else if (formatting.allCaps === false) parts.push("<w:caps w:val=\"0\"/>");
|
|
105
|
-
if (formatting.smallCaps === true) parts.push("<w:smallCaps/>");
|
|
106
|
-
else if (formatting.smallCaps === false) parts.push("<w:smallCaps w:val=\"0\"/>");
|
|
107
|
-
if (formatting.strike === true) parts.push("<w:strike/>");
|
|
108
|
-
else if (formatting.strike === false) parts.push("<w:strike w:val=\"0\"/>");
|
|
109
|
-
if (formatting.doubleStrike === true) parts.push("<w:dstrike/>");
|
|
110
|
-
else if (formatting.doubleStrike === false) parts.push("<w:dstrike w:val=\"0\"/>");
|
|
111
|
-
if (formatting.outline === true) parts.push("<w:outline/>");
|
|
112
|
-
else if (formatting.outline === false) parts.push("<w:outline w:val=\"0\"/>");
|
|
113
|
-
if (formatting.shadow === true) parts.push("<w:shadow/>");
|
|
114
|
-
else if (formatting.shadow === false) parts.push("<w:shadow w:val=\"0\"/>");
|
|
115
|
-
if (formatting.emboss === true) parts.push("<w:emboss/>");
|
|
116
|
-
else if (formatting.emboss === false) parts.push("<w:emboss w:val=\"0\"/>");
|
|
117
|
-
if (formatting.imprint === true) parts.push("<w:imprint/>");
|
|
118
|
-
else if (formatting.imprint === false) parts.push("<w:imprint w:val=\"0\"/>");
|
|
119
|
-
if (formatting.hidden === true) parts.push("<w:vanish/>");
|
|
120
|
-
else if (formatting.hidden === false) parts.push("<w:vanish w:val=\"0\"/>");
|
|
121
|
-
const colorXml = serializeColorElement(formatting.color);
|
|
122
|
-
if (colorXml) parts.push(colorXml);
|
|
123
|
-
if (formatting.spacing !== void 0) parts.push(`<w:spacing w:val="${intAttr(formatting.spacing)}"/>`);
|
|
124
|
-
const horizontalScale = roundHorizontalScalePercentForSerialization(formatting.scale);
|
|
125
|
-
if (horizontalScale !== void 0) parts.push(`<w:w w:val="${intAttr(horizontalScale)}"/>`);
|
|
126
|
-
if (formatting.kerning !== void 0) parts.push(`<w:kern w:val="${intAttr(formatting.kerning)}"/>`);
|
|
127
|
-
if (formatting.position !== void 0) parts.push(`<w:position w:val="${intAttr(formatting.position)}"/>`);
|
|
128
|
-
if (formatting.fontSize !== void 0) parts.push(`<w:sz w:val="${intAttr(formatting.fontSize)}"/>`);
|
|
129
|
-
if (formatting.fontSizeCs !== void 0) parts.push(`<w:szCs w:val="${intAttr(formatting.fontSizeCs)}"/>`);
|
|
130
|
-
let customHighlightShadingXml = "";
|
|
131
|
-
if (formatting.highlight) {
|
|
132
|
-
if (VALID_HIGHLIGHT_COLORS.has(formatting.highlight)) parts.push(`<w:highlight w:val="${formatting.highlight}"/>`);
|
|
133
|
-
else if (!formatting.shading) {
|
|
134
|
-
const hex = formatting.highlight.replace(/^#/u, "");
|
|
135
|
-
if (/^[0-9a-fA-F]{6}$/u.test(hex)) customHighlightShadingXml = `<w:shd w:val="clear" w:color="auto" w:fill="${hex}"/>`;
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
if (formatting.underline) {
|
|
139
|
-
const uAttrs = [`w:val="${formatting.underline.style}"`];
|
|
140
|
-
if (formatting.underline.color) {
|
|
141
|
-
if (formatting.underline.color.rgb && isValidHexColor(formatting.underline.color.rgb)) uAttrs.push(`w:color="${escapeXml(formatting.underline.color.rgb)}"`);
|
|
142
|
-
if (formatting.underline.color.themeColor) uAttrs.push(`w:themeColor="${escapeXml(formatting.underline.color.themeColor)}"`);
|
|
143
|
-
if (formatting.underline.color.themeTint) uAttrs.push(`w:themeTint="${escapeXml(formatting.underline.color.themeTint)}"`);
|
|
144
|
-
if (formatting.underline.color.themeShade) uAttrs.push(`w:themeShade="${escapeXml(formatting.underline.color.themeShade)}"`);
|
|
145
|
-
}
|
|
146
|
-
parts.push(`<w:u ${uAttrs.join(" ")}/>`);
|
|
147
|
-
}
|
|
148
|
-
if (formatting.effect) parts.push(`<w:effect w:val="${formatting.effect}"/>`);
|
|
149
|
-
const shadingXml = serializeShading(formatting.shading) || customHighlightShadingXml;
|
|
150
|
-
if (shadingXml) parts.push(shadingXml);
|
|
151
|
-
if (formatting.vertAlign) parts.push(`<w:vertAlign w:val="${formatting.vertAlign}"/>`);
|
|
152
|
-
if (formatting.rtl === true) parts.push("<w:rtl/>");
|
|
153
|
-
else if (formatting.rtl === false) parts.push("<w:rtl w:val=\"0\"/>");
|
|
154
|
-
if (formatting.cs === true) parts.push("<w:cs/>");
|
|
155
|
-
else if (formatting.cs === false) parts.push("<w:cs w:val=\"0\"/>");
|
|
156
|
-
if (formatting.emphasisMark) parts.push(`<w:em w:val="${formatting.emphasisMark}"/>`);
|
|
157
|
-
if (formatting.language) {
|
|
158
|
-
const languageAttrs = [];
|
|
159
|
-
if (formatting.language.val) languageAttrs.push(`w:val="${escapeXml(formatting.language.val)}"`);
|
|
160
|
-
if (formatting.language.eastAsia) languageAttrs.push(`w:eastAsia="${escapeXml(formatting.language.eastAsia)}"`);
|
|
161
|
-
if (formatting.language.bidi) languageAttrs.push(`w:bidi="${escapeXml(formatting.language.bidi)}"`);
|
|
162
|
-
if (languageAttrs.length > 0) parts.push(`<w:lang ${languageAttrs.join(" ")}/>`);
|
|
163
|
-
}
|
|
164
|
-
if (parts.length === 0) return "";
|
|
165
|
-
return `<w:rPr>${parts.join("")}</w:rPr>`;
|
|
166
|
-
}
|
|
167
41
|
function extractRPrInner(rPrXml) {
|
|
168
42
|
if (!rPrXml.startsWith("<w:rPr>") || !rPrXml.endsWith("</w:rPr>")) return "";
|
|
169
43
|
return rPrXml.slice(7, -8);
|
|
@@ -572,7 +446,7 @@ function serializeRunContent(content) {
|
|
|
572
446
|
case "noBreakHyphen": return serializeNoBreakHyphen(content);
|
|
573
447
|
case "renderedPageBreak": return "<w:lastRenderedPageBreak/>";
|
|
574
448
|
case "drawing":
|
|
575
|
-
if (content.rawXml) return content.rawXml;
|
|
449
|
+
if (content.rawXml && canReplayEditableImageRawXml(content)) return content.rawXml;
|
|
576
450
|
return serializeDrawingContent(content);
|
|
577
451
|
case "shape": return serializeShapeContent(content);
|
|
578
452
|
default: return "";
|
|
@@ -667,4 +541,4 @@ function createTabRun(formatting) {
|
|
|
667
541
|
};
|
|
668
542
|
}
|
|
669
543
|
//#endregion
|
|
670
|
-
export { createBreakRun, createEmptyRun, createTabRun, createTextRun, getRunPlainText, hasRunContent, hasRunFormatting, resetAutoIdCounter, serializeRun, serializeRuns
|
|
544
|
+
export { createBreakRun, createEmptyRun, createTabRun, createTextRun, getRunPlainText, hasRunContent, hasRunFormatting, resetAutoIdCounter, serializeRun, serializeRuns };
|
|
@@ -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 "";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { serializeParagraphFormatting } from "./paragraphSerializer.js";
|
|
2
2
|
import { serializePartElement } from "./partNamespaces.js";
|
|
3
|
-
import { serializeTextFormatting } from "./runSerializer.js";
|
|
4
3
|
import { serializeTableCellFormatting, serializeTableFormatting, serializeTableRowFormatting } from "./tableSerializer.js";
|
|
4
|
+
import { serializeTextFormatting } from "./textFormattingSerializer.js";
|
|
5
5
|
import { escapeXml } from "./xmlUtils.js";
|
|
6
6
|
//#region src/docx/serializer/stylesSerializer.ts
|
|
7
7
|
const serializeStylesXml = (definitions) => {
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { document_d_exports } from "../../types/document.js";
|
|
2
|
+
//#region src/docx/serializer/textFormattingSerializer.d.ts
|
|
3
|
+
type ExhaustiveFields<Source, Classified extends keyof Source> = Exclude<keyof Source, Classified> extends never ? Source : never;
|
|
4
|
+
type ClassifiedShadingField = "color" | "fill" | "pattern";
|
|
5
|
+
type ExhaustiveShadingProperties = ExhaustiveFields<document_d_exports.ShadingProperties, ClassifiedShadingField>;
|
|
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
|
+
type ExhaustiveTextFormatting = ExhaustiveFields<document_d_exports.TextFormatting, ClassifiedTextFormattingField>;
|
|
8
|
+
/**
|
|
9
|
+
* Serialize shading properties (w:shd)
|
|
10
|
+
*/
|
|
11
|
+
declare function serializeShading(shading: ExhaustiveShadingProperties | undefined): string;
|
|
12
|
+
/**
|
|
13
|
+
* Serialize text formatting properties to w:rPr XML
|
|
14
|
+
*/
|
|
15
|
+
declare function serializeTextFormatting(input: ExhaustiveTextFormatting | undefined): string;
|
|
16
|
+
//#endregion
|
|
17
|
+
export { serializeShading, serializeTextFormatting };
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import { HIGHLIGHT_COLOR_VALUES } from "../../types/documentEnumValues.js";
|
|
2
|
+
import { isValidHexColor } from "../../utils/colorResolver.js";
|
|
3
|
+
import { roundHorizontalScalePercentForSerialization } from "../../utils/horizontalScale.js";
|
|
4
|
+
import { escapeXml, intAttr } from "./xmlUtils.js";
|
|
5
|
+
//#region src/docx/serializer/textFormattingSerializer.ts
|
|
6
|
+
const VALID_HIGHLIGHT_COLORS = new Set(HIGHLIGHT_COLOR_VALUES);
|
|
7
|
+
/**
|
|
8
|
+
* Serialize a color element (w:color)
|
|
9
|
+
*/
|
|
10
|
+
function serializeColorElement(color) {
|
|
11
|
+
if (!color) return "";
|
|
12
|
+
const { auto, rgb, themeColor, themeTint, themeShade } = color;
|
|
13
|
+
const attrs = [];
|
|
14
|
+
if (auto) attrs.push("w:val=\"auto\"");
|
|
15
|
+
else if (rgb && isValidHexColor(rgb)) attrs.push(`w:val="${escapeXml(rgb)}"`);
|
|
16
|
+
if (themeColor) attrs.push(`w:themeColor="${escapeXml(themeColor)}"`);
|
|
17
|
+
if (themeTint) attrs.push(`w:themeTint="${escapeXml(themeTint)}"`);
|
|
18
|
+
if (themeShade) attrs.push(`w:themeShade="${escapeXml(themeShade)}"`);
|
|
19
|
+
return attrs.length === 0 ? "" : `<w:color ${attrs.join(" ")}/>`;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Serialize shading properties (w:shd)
|
|
23
|
+
*/
|
|
24
|
+
function serializeShading(shading) {
|
|
25
|
+
if (!shading) return "";
|
|
26
|
+
const { pattern, color, fill } = shading;
|
|
27
|
+
const attrs = [];
|
|
28
|
+
if (pattern) attrs.push(`w:val="${escapeXml(pattern)}"`);
|
|
29
|
+
else attrs.push("w:val=\"clear\"");
|
|
30
|
+
if (color) {
|
|
31
|
+
const { rgb, auto, themeColor: _themeColor, themeTint: _themeTint, themeShade: _themeShade } = color;
|
|
32
|
+
if (rgb && isValidHexColor(rgb)) attrs.push(`w:color="${escapeXml(rgb)}"`);
|
|
33
|
+
else if (auto) attrs.push("w:color=\"auto\"");
|
|
34
|
+
}
|
|
35
|
+
if (fill) {
|
|
36
|
+
const { rgb, auto, themeColor, themeTint, themeShade } = fill;
|
|
37
|
+
if (rgb && isValidHexColor(rgb)) attrs.push(`w:fill="${escapeXml(rgb)}"`);
|
|
38
|
+
else if (auto) attrs.push("w:fill=\"auto\"");
|
|
39
|
+
if (themeColor) attrs.push(`w:themeFill="${escapeXml(themeColor)}"`);
|
|
40
|
+
if (themeTint) attrs.push(`w:themeFillTint="${escapeXml(themeTint)}"`);
|
|
41
|
+
if (themeShade) attrs.push(`w:themeFillShade="${escapeXml(themeShade)}"`);
|
|
42
|
+
}
|
|
43
|
+
return attrs.length === 0 ? "" : `<w:shd ${attrs.join(" ")}/>`;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Serialize text formatting properties to w:rPr XML
|
|
47
|
+
*/
|
|
48
|
+
function serializeTextFormatting(input) {
|
|
49
|
+
if (!input) return "";
|
|
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
|
+
const parts = [];
|
|
52
|
+
if (styleId) parts.push(`<w:rStyle w:val="${escapeXml(styleId)}"/>`);
|
|
53
|
+
if (fontFamily) {
|
|
54
|
+
const { ascii, hAnsi, eastAsia, cs: complexScript, hint, asciiTheme, hAnsiTheme, eastAsiaTheme, csTheme } = fontFamily;
|
|
55
|
+
const fontAttrs = [];
|
|
56
|
+
if (ascii) fontAttrs.push(`w:ascii="${escapeXml(ascii)}"`);
|
|
57
|
+
if (hAnsi) fontAttrs.push(`w:hAnsi="${escapeXml(hAnsi)}"`);
|
|
58
|
+
if (eastAsia) fontAttrs.push(`w:eastAsia="${escapeXml(eastAsia)}"`);
|
|
59
|
+
if (complexScript) fontAttrs.push(`w:cs="${escapeXml(complexScript)}"`);
|
|
60
|
+
if (hint) fontAttrs.push(`w:hint="${escapeXml(hint)}"`);
|
|
61
|
+
if (asciiTheme) fontAttrs.push(`w:asciiTheme="${escapeXml(asciiTheme)}"`);
|
|
62
|
+
if (hAnsiTheme) fontAttrs.push(`w:hAnsiTheme="${escapeXml(hAnsiTheme)}"`);
|
|
63
|
+
if (eastAsiaTheme) fontAttrs.push(`w:eastAsiaTheme="${escapeXml(eastAsiaTheme)}"`);
|
|
64
|
+
if (csTheme) fontAttrs.push(`w:cstheme="${escapeXml(csTheme)}"`);
|
|
65
|
+
if (fontAttrs.length > 0) parts.push(`<w:rFonts ${fontAttrs.join(" ")}/>`);
|
|
66
|
+
}
|
|
67
|
+
if (bold === true) parts.push("<w:b/>");
|
|
68
|
+
else if (bold === false) parts.push("<w:b w:val=\"0\"/>");
|
|
69
|
+
if (boldCs === true) parts.push("<w:bCs/>");
|
|
70
|
+
else if (boldCs === false) parts.push("<w:bCs w:val=\"0\"/>");
|
|
71
|
+
if (italic === true) parts.push("<w:i/>");
|
|
72
|
+
else if (italic === false) parts.push("<w:i w:val=\"0\"/>");
|
|
73
|
+
if (italicCs === true) parts.push("<w:iCs/>");
|
|
74
|
+
else if (italicCs === false) parts.push("<w:iCs w:val=\"0\"/>");
|
|
75
|
+
if (allCaps === true) parts.push("<w:caps/>");
|
|
76
|
+
else if (allCaps === false) parts.push("<w:caps w:val=\"0\"/>");
|
|
77
|
+
if (smallCaps === true) parts.push("<w:smallCaps/>");
|
|
78
|
+
else if (smallCaps === false) parts.push("<w:smallCaps w:val=\"0\"/>");
|
|
79
|
+
if (strike === true) parts.push("<w:strike/>");
|
|
80
|
+
else if (strike === false) parts.push("<w:strike w:val=\"0\"/>");
|
|
81
|
+
if (doubleStrike === true) parts.push("<w:dstrike/>");
|
|
82
|
+
else if (doubleStrike === false) parts.push("<w:dstrike w:val=\"0\"/>");
|
|
83
|
+
if (outline === true) parts.push("<w:outline/>");
|
|
84
|
+
else if (outline === false) parts.push("<w:outline w:val=\"0\"/>");
|
|
85
|
+
if (shadow === true) parts.push("<w:shadow/>");
|
|
86
|
+
else if (shadow === false) parts.push("<w:shadow w:val=\"0\"/>");
|
|
87
|
+
if (emboss === true) parts.push("<w:emboss/>");
|
|
88
|
+
else if (emboss === false) parts.push("<w:emboss w:val=\"0\"/>");
|
|
89
|
+
if (imprint === true) parts.push("<w:imprint/>");
|
|
90
|
+
else if (imprint === false) parts.push("<w:imprint w:val=\"0\"/>");
|
|
91
|
+
if (hidden === true) parts.push("<w:vanish/>");
|
|
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\"/>");
|
|
95
|
+
const colorXml = serializeColorElement(color);
|
|
96
|
+
if (colorXml) parts.push(colorXml);
|
|
97
|
+
if (spacing !== void 0) parts.push(`<w:spacing w:val="${intAttr(spacing)}"/>`);
|
|
98
|
+
const horizontalScale = roundHorizontalScalePercentForSerialization(scale);
|
|
99
|
+
if (horizontalScale !== void 0) parts.push(`<w:w w:val="${intAttr(horizontalScale)}"/>`);
|
|
100
|
+
if (kerning !== void 0) parts.push(`<w:kern w:val="${intAttr(kerning)}"/>`);
|
|
101
|
+
if (position !== void 0) parts.push(`<w:position w:val="${intAttr(position)}"/>`);
|
|
102
|
+
if (fontSize !== void 0) parts.push(`<w:sz w:val="${intAttr(fontSize)}"/>`);
|
|
103
|
+
if (fontSizeCs !== void 0) parts.push(`<w:szCs w:val="${intAttr(fontSizeCs)}"/>`);
|
|
104
|
+
let customHighlightShadingXml = "";
|
|
105
|
+
if (highlight) {
|
|
106
|
+
if (VALID_HIGHLIGHT_COLORS.has(highlight)) parts.push(`<w:highlight w:val="${highlight}"/>`);
|
|
107
|
+
else if (!shading) {
|
|
108
|
+
const hex = highlight.replace(/^#/u, "");
|
|
109
|
+
if (/^[0-9a-fA-F]{6}$/u.test(hex)) customHighlightShadingXml = `<w:shd w:val="clear" w:color="auto" w:fill="${hex}"/>`;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
if (underline) {
|
|
113
|
+
const { style, color: underlineColor } = underline;
|
|
114
|
+
const uAttrs = [`w:val="${style}"`];
|
|
115
|
+
if (underlineColor) {
|
|
116
|
+
const { rgb, themeColor, themeTint, themeShade, auto: _auto } = underlineColor;
|
|
117
|
+
if (rgb && isValidHexColor(rgb)) uAttrs.push(`w:color="${escapeXml(rgb)}"`);
|
|
118
|
+
if (themeColor) uAttrs.push(`w:themeColor="${escapeXml(themeColor)}"`);
|
|
119
|
+
if (themeTint) uAttrs.push(`w:themeTint="${escapeXml(themeTint)}"`);
|
|
120
|
+
if (themeShade) uAttrs.push(`w:themeShade="${escapeXml(themeShade)}"`);
|
|
121
|
+
}
|
|
122
|
+
parts.push(`<w:u ${uAttrs.join(" ")}/>`);
|
|
123
|
+
}
|
|
124
|
+
if (effect) parts.push(`<w:effect w:val="${effect}"/>`);
|
|
125
|
+
const shadingXml = serializeShading(shading) || customHighlightShadingXml;
|
|
126
|
+
if (shadingXml) parts.push(shadingXml);
|
|
127
|
+
if (vertAlign) parts.push(`<w:vertAlign w:val="${vertAlign}"/>`);
|
|
128
|
+
if (rtl === true) parts.push("<w:rtl/>");
|
|
129
|
+
else if (rtl === false) parts.push("<w:rtl w:val=\"0\"/>");
|
|
130
|
+
if (cs === true) parts.push("<w:cs/>");
|
|
131
|
+
else if (cs === false) parts.push("<w:cs w:val=\"0\"/>");
|
|
132
|
+
if (emphasisMark) parts.push(`<w:em w:val="${emphasisMark}"/>`);
|
|
133
|
+
if (language) {
|
|
134
|
+
const { val, eastAsia, bidi } = language;
|
|
135
|
+
const languageAttrs = [];
|
|
136
|
+
if (val) languageAttrs.push(`w:val="${escapeXml(val)}"`);
|
|
137
|
+
if (eastAsia) languageAttrs.push(`w:eastAsia="${escapeXml(eastAsia)}"`);
|
|
138
|
+
if (bidi) languageAttrs.push(`w:bidi="${escapeXml(bidi)}"`);
|
|
139
|
+
if (languageAttrs.length > 0) parts.push(`<w:lang ${languageAttrs.join(" ")}/>`);
|
|
140
|
+
}
|
|
141
|
+
return parts.length === 0 ? "" : `<w:rPr>${parts.join("")}</w:rPr>`;
|
|
142
|
+
}
|
|
143
|
+
//#endregion
|
|
144
|
+
export { serializeShading, serializeTextFormatting };
|
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;
|
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/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, 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 };
|