@stll/folio-core 0.40.0 → 0.42.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/README.md +16 -0
- package/dist/ai-edits/clean-text.d.ts +28 -6
- package/dist/ai-edits/clean-text.js +28 -13
- package/dist/ai-edits/headless.d.ts +12 -0
- package/dist/ai-edits/headless.js +26 -3
- package/dist/ai-edits/snapshot.d.ts +6 -1
- package/dist/ai-edits/snapshot.js +15 -10
- package/dist/ai-suggestions/text-positions.js +15 -3
- package/dist/compare/inline-atoms.js +2 -2
- package/dist/compat/eigenpal.d.ts +4 -3
- package/dist/compat/eigenpal.js +2 -1
- package/dist/display-list/primitives.d.ts +2 -1
- package/dist/document-operations.d.ts +3 -2
- package/dist/docx/blockPlainText.d.ts +8 -0
- package/dist/docx/blockPlainText.js +40 -0
- package/dist/docx/compatibility.d.ts +16 -2
- package/dist/docx/compatibility.js +30 -9
- package/dist/docx/footnoteParser.js +4 -23
- package/dist/docx/graphicFrameLocks.d.ts +22 -0
- package/dist/docx/graphicFrameLocks.js +55 -0
- package/dist/docx/groupDrawingParser.d.ts +7 -1
- package/dist/docx/groupDrawingParser.js +11 -2
- package/dist/docx/headerFooterParser.d.ts +5 -1
- package/dist/docx/headerFooterParser.js +7 -21
- package/dist/docx/imageParser.js +5 -0
- package/dist/docx/imageRawXml.d.ts +33 -1
- package/dist/docx/imageRawXml.js +56 -1
- package/dist/docx/rezip.d.ts +20 -3
- package/dist/docx/rezip.js +24 -13
- package/dist/docx/runParser.js +43 -21
- package/dist/docx/serializer/runSerializer.js +4 -2
- package/dist/docx/server/createBilingualDocument.js +31 -5
- package/dist/docx/shapeParser.js +32 -6
- package/dist/docx/vmlImageParser.d.ts +11 -1
- package/dist/docx/vmlImageParser.js +29 -2
- package/dist/index.d.ts +4 -3
- package/dist/index.js +2 -1
- package/dist/internal/compare/inline-presentation.d.ts +11 -3
- package/dist/internal/compare/inline-presentation.js +8 -1
- package/dist/prosemirror/attrs/index.js +33 -3
- package/dist/prosemirror/conversion/fromProseDoc.d.ts +13 -2
- package/dist/prosemirror/conversion/fromProseDoc.js +80 -27
- package/dist/prosemirror/conversion/index.d.ts +2 -2
- package/dist/prosemirror/conversion/toProseDoc.js +10 -2
- package/dist/prosemirror/extensions/nodes/ImageExtension.js +6 -0
- package/dist/prosemirror/imageCommit.js +7 -3
- package/dist/prosemirror/runFormattingInlineCarriers.d.ts +16 -1
- package/dist/prosemirror/runFormattingInlineCarriers.js +20 -1
- package/dist/prosemirror/schema/nodes.d.ts +20 -0
- package/dist/server.d.ts +2 -2
- package/package.json +2 -2
|
@@ -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 { serializeGraphicFrameLocks } from "../graphicFrameLocks.js";
|
|
3
4
|
import { canReplayEditableImageRawXml } from "../imageRawXml.js";
|
|
4
5
|
import { requiresXmlSpacePreserve } from "../textWhitespace.js";
|
|
5
6
|
import { serializeParagraph } from "./paragraphSerializer.js";
|
|
@@ -285,6 +286,7 @@ function serializeDrawingContent(content) {
|
|
|
285
286
|
const inlineDocPr = hlinkClick ? `<wp:docPr ${inlineDocPrAttrs}>${hlinkClick}</wp:docPr>` : `<wp:docPr ${inlineDocPrAttrs}/>`;
|
|
286
287
|
const anchorDocPrAttrs = `id="${docPrId}" name="${escapeXml(docPrName)}"${docPrDescription}${docPrTitle}`;
|
|
287
288
|
const anchorDocPr = hlinkClick ? `<wp:docPr ${anchorDocPrAttrs}>${hlinkClick}</wp:docPr>` : `<wp:docPr ${anchorDocPrAttrs}/>`;
|
|
289
|
+
const graphicFramePr = serializeGraphicFrameLocks(image.frameLocks);
|
|
288
290
|
const graphic = serializePicGraphic(image, docPrId);
|
|
289
291
|
if (!isFloating) return [
|
|
290
292
|
"<w:drawing>",
|
|
@@ -292,7 +294,7 @@ function serializeDrawingContent(content) {
|
|
|
292
294
|
`<wp:extent cx="${intAttr(cx)}" cy="${intAttr(cy)}"/>`,
|
|
293
295
|
effectExtentEl,
|
|
294
296
|
inlineDocPr,
|
|
295
|
-
|
|
297
|
+
graphicFramePr,
|
|
296
298
|
graphic,
|
|
297
299
|
"</wp:inline>",
|
|
298
300
|
"</w:drawing>"
|
|
@@ -309,7 +311,7 @@ function serializeDrawingContent(content) {
|
|
|
309
311
|
effectExtentEl,
|
|
310
312
|
wrap,
|
|
311
313
|
anchorDocPr,
|
|
312
|
-
|
|
314
|
+
graphicFramePr,
|
|
313
315
|
graphic,
|
|
314
316
|
"</wp:anchor>",
|
|
315
317
|
"</w:drawing>"
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { deterministicHexId } from "../../utils/hexId.js";
|
|
2
2
|
import { getParagraphText } from "../paragraphParser.js";
|
|
3
3
|
import { cloneParagraphWithoutPropertySource } from "../paragraphPropertySource.js";
|
|
4
|
+
import { getRunText } from "../runParser.js";
|
|
4
5
|
import { TaggedError } from "better-result";
|
|
5
6
|
//#region src/docx/server/createBilingualDocument.ts
|
|
6
7
|
/**
|
|
@@ -115,7 +116,7 @@ function createBilingualDocument(source, options) {
|
|
|
115
116
|
}
|
|
116
117
|
if (block.type === "paragraph") {
|
|
117
118
|
if (isEmptyParagraph(block)) continue;
|
|
118
|
-
if (block
|
|
119
|
+
if (!isTranslatableParagraph(block, options.editableParagraphIds)) {
|
|
119
120
|
flushSection();
|
|
120
121
|
content.push(block);
|
|
121
122
|
continue;
|
|
@@ -129,7 +130,7 @@ function createBilingualDocument(source, options) {
|
|
|
129
130
|
sectionRows.push(buildRow(block, copy, styleById, textWidth));
|
|
130
131
|
continue;
|
|
131
132
|
}
|
|
132
|
-
const paragraphs = collectTableParagraphs(block).filter((paragraph) => paragraph
|
|
133
|
+
const paragraphs = collectTableParagraphs(block).filter((paragraph) => isTranslatableParagraph(paragraph, options.editableParagraphIds)).map((paragraph) => ({
|
|
133
134
|
paraId: paragraph.paraId,
|
|
134
135
|
sourceText: getParagraphText(paragraph)
|
|
135
136
|
}));
|
|
@@ -208,6 +209,31 @@ const isEmptyParagraph = (paragraph) => {
|
|
|
208
209
|
if (getParagraphText(paragraph).trim().length > 0) return false;
|
|
209
210
|
return paragraph.content.every((item) => item.type === "run" && item.formatting?.hidden !== true && item.content.every((part) => part.type === "text"));
|
|
210
211
|
};
|
|
212
|
+
/**
|
|
213
|
+
* A paragraph whose only text is a field result (a table of contents, a page
|
|
214
|
+
* reference). Word recomputes that text, so translating it would be discarded;
|
|
215
|
+
* the paragraph is copied through full width instead of becoming a row.
|
|
216
|
+
*/
|
|
217
|
+
const isFieldOnlyParagraph = (paragraph) => {
|
|
218
|
+
let hasField = false;
|
|
219
|
+
for (const item of paragraph.content) {
|
|
220
|
+
if (item.type === "simpleField" || item.type === "complexField") {
|
|
221
|
+
hasField = true;
|
|
222
|
+
continue;
|
|
223
|
+
}
|
|
224
|
+
if (item.type === "run" && getRunText(item).trim().length === 0) continue;
|
|
225
|
+
return false;
|
|
226
|
+
}
|
|
227
|
+
return hasField;
|
|
228
|
+
};
|
|
229
|
+
/**
|
|
230
|
+
* A paragraph offered as a translation row.
|
|
231
|
+
*
|
|
232
|
+
* Every site that builds or reads a row reads this one predicate: creation and
|
|
233
|
+
* reading derive the manifest independently, so a rule added to only one of
|
|
234
|
+
* them would surface as a missing handle rather than as the rule it is.
|
|
235
|
+
*/
|
|
236
|
+
const isTranslatableParagraph = (paragraph, editableParagraphIds) => paragraph.paraId !== void 0 && editableParagraphIds.has(paragraph.paraId) && !isFieldOnlyParagraph(paragraph);
|
|
211
237
|
/** Heading style families across Word UI languages (en, cs/sk, de, fr, pl). */
|
|
212
238
|
const HEADING_STYLE_PATTERN = /heading|nadpis|berschrift|titre|nag[łl]/iu;
|
|
213
239
|
const classifyParagraph = (paragraph, styleById) => {
|
|
@@ -459,7 +485,7 @@ const cloneTableForTarget = ({ table, editableParagraphIds, paraIds, styleCloner
|
|
|
459
485
|
if (item.type === "table") return cloneTable(item);
|
|
460
486
|
const targetParaId = paraIds.mint(item.paraId);
|
|
461
487
|
const copy = cloneParagraphForTarget(item, targetParaId, styleCloner, cloner, bookmarkIds);
|
|
462
|
-
if (item
|
|
488
|
+
if (isTranslatableParagraph(item, editableParagraphIds)) paragraphs.push({
|
|
463
489
|
sourceParaId: item.paraId,
|
|
464
490
|
targetParaId,
|
|
465
491
|
sourceText: getParagraphText(item)
|
|
@@ -701,7 +727,7 @@ function readBilingualDocument(document, editableParagraphIds) {
|
|
|
701
727
|
}
|
|
702
728
|
const paragraphs = [];
|
|
703
729
|
for (const [index, source] of sourceParagraphs.entries()) {
|
|
704
|
-
if (source
|
|
730
|
+
if (!isTranslatableParagraph(source, editableParagraphIds)) continue;
|
|
705
731
|
const target = targetParagraphs.at(index);
|
|
706
732
|
if (target?.paraId === void 0 || target.paraId === source.paraId || !editableParagraphIds.has(target.paraId)) {
|
|
707
733
|
missingHandleCount += 1;
|
|
@@ -725,7 +751,7 @@ function readBilingualDocument(document, editableParagraphIds) {
|
|
|
725
751
|
missingHandleCount += 1;
|
|
726
752
|
continue;
|
|
727
753
|
}
|
|
728
|
-
const paragraphs = collectTableParagraphs(sourceTable).filter((paragraph) => paragraph
|
|
754
|
+
const paragraphs = collectTableParagraphs(sourceTable).filter((paragraph) => isTranslatableParagraph(paragraph, editableParagraphIds)).map((paragraph) => ({
|
|
729
755
|
paraId: paragraph.paraId,
|
|
730
756
|
sourceText: getParagraphText(paragraph)
|
|
731
757
|
}));
|
package/dist/docx/shapeParser.js
CHANGED
|
@@ -87,6 +87,28 @@ function hasUnsupportedRgbColorModifiers(spPr) {
|
|
|
87
87
|
function hasUnmodeledFill(spPr) {
|
|
88
88
|
return findChildByLocalName(spPr, "pattFill") !== null || findChildByLocalName(spPr, "blipFill") !== null || findChildByLocalName(spPr, "grpFill") !== null;
|
|
89
89
|
}
|
|
90
|
+
/**
|
|
91
|
+
* Shape properties the serializer never emits: `Shape` models geometry, fill,
|
|
92
|
+
* outline and transform only, so a shadow, glow, reflection or 3-D scene would
|
|
93
|
+
* be dropped on save.
|
|
94
|
+
*/
|
|
95
|
+
const UNMODELED_EFFECT_ELEMENTS = [
|
|
96
|
+
"effectLst",
|
|
97
|
+
"effectDag",
|
|
98
|
+
"scene3d",
|
|
99
|
+
"sp3d"
|
|
100
|
+
];
|
|
101
|
+
/**
|
|
102
|
+
* An empty `<a:effectLst/>` is Word's explicit "no effects" marker and models
|
|
103
|
+
* fine; carried attributes (`<a:sp3d extrusionH="…"/>`) or children do not.
|
|
104
|
+
*/
|
|
105
|
+
function hasUnmodeledEffects(spPr) {
|
|
106
|
+
return UNMODELED_EFFECT_ELEMENTS.some((localName) => {
|
|
107
|
+
const element = findChildByLocalName(spPr, localName);
|
|
108
|
+
if (!element) return false;
|
|
109
|
+
return getChildElements(element).length > 0 || Object.keys(element.attributes ?? {}).length > 0;
|
|
110
|
+
});
|
|
111
|
+
}
|
|
90
112
|
function colorNeedsRawPreservation(color) {
|
|
91
113
|
return color !== void 0 && color.rgb === void 0;
|
|
92
114
|
}
|
|
@@ -97,6 +119,14 @@ function fillNeedsRawPreservation(fill) {
|
|
|
97
119
|
return false;
|
|
98
120
|
}
|
|
99
121
|
/**
|
|
122
|
+
* The single answer to "does this `wps:spPr` carry something the editable
|
|
123
|
+
* `Shape` model would lose?". `parseShapeFromDrawing` refuses such a shape and
|
|
124
|
+
* `shouldPreserveRawShapeDrawing` claims it for verbatim preservation, so both
|
|
125
|
+
* must read the same predicate: a reason added to only one of them would
|
|
126
|
+
* either drop the drawing or model it lossily.
|
|
127
|
+
*/
|
|
128
|
+
const shapeNeedsRawPreservation = (spPr) => hasUnsupportedGeometry(spPr) || hasUnsupportedRgbColorModifiers(spPr) || hasUnmodeledFill(spPr) || hasUnmodeledEffects(spPr) || fillNeedsRawPreservation(parseShapeFill(spPr));
|
|
129
|
+
/**
|
|
100
130
|
* Parse a `<wps:wsp>` element into a Shape model. Does NOT pick up the
|
|
101
131
|
* extent / position / wrap fields — those live on the wrapping
|
|
102
132
|
* `<wp:inline>` / `<wp:anchor>` and are handled by `parseShapeFromDrawing`.
|
|
@@ -143,7 +173,7 @@ function parseShapeFromDrawing(drawingEl) {
|
|
|
143
173
|
if (!wsp) return null;
|
|
144
174
|
if (findChildByLocalName(wsp, "txbx") !== null) return null;
|
|
145
175
|
const spPr = findChildByLocalName(wsp, "spPr");
|
|
146
|
-
if (
|
|
176
|
+
if (shapeNeedsRawPreservation(spPr)) return null;
|
|
147
177
|
const shape = parseShape(wsp);
|
|
148
178
|
const extent = findChildByLocalName(container, "extent");
|
|
149
179
|
if (extent) {
|
|
@@ -178,11 +208,7 @@ function shouldPreserveRawShapeDrawing(drawingEl) {
|
|
|
178
208
|
const graphicData = graphic ? findChildByLocalName(graphic, "graphicData") : null;
|
|
179
209
|
const wsp = graphicData ? findChildByLocalName(graphicData, "wsp") : null;
|
|
180
210
|
if (!wsp || findChildByLocalName(wsp, "txbx") !== null) return false;
|
|
181
|
-
|
|
182
|
-
if (hasUnsupportedGeometry(spPr)) return true;
|
|
183
|
-
if (hasUnsupportedRgbColorModifiers(spPr)) return true;
|
|
184
|
-
if (hasUnmodeledFill(spPr)) return true;
|
|
185
|
-
return fillNeedsRawPreservation(parseShapeFill(spPr));
|
|
211
|
+
return shapeNeedsRawPreservation(findChildByLocalName(wsp, "spPr"));
|
|
186
212
|
}
|
|
187
213
|
//#endregion
|
|
188
214
|
export { parseShape, parseShapeFromDrawing, shouldPreserveRawShapeDrawing };
|
|
@@ -1,6 +1,16 @@
|
|
|
1
1
|
import { document_d_exports } from "../types/document.js";
|
|
2
2
|
import { XmlElement } from "./xmlParser.js";
|
|
3
3
|
//#region src/docx/vmlImageParser.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Whether a `w:pict` that resolved to no image must still be kept verbatim.
|
|
6
|
+
*
|
|
7
|
+
* VML has no serializer of its own, so an unresolved `w:pict` is only ever
|
|
8
|
+
* preserved or lost. Two owners are excluded: a `v:textbox` belongs to the
|
|
9
|
+
* text-box enrichment pass, which rebuilds it as an editable shape, and a
|
|
10
|
+
* watermark shape belongs to watermarkParser; preserving either would emit the
|
|
11
|
+
* same artwork twice.
|
|
12
|
+
*/
|
|
13
|
+
declare function shouldPreserveRawVmlPict(pictElement: XmlElement): boolean;
|
|
4
14
|
/**
|
|
5
15
|
* Parse a `w:pict` element into an inline image, or null when it carries no
|
|
6
16
|
* ordinary VML picture (no resolvable `<v:imagedata>`, or a watermark shape).
|
|
@@ -12,4 +22,4 @@ import { XmlElement } from "./xmlParser.js";
|
|
|
12
22
|
*/
|
|
13
23
|
declare function parseVmlImageContent(pictElement: XmlElement, rels: document_d_exports.RelationshipMap | null, media: Map<string, document_d_exports.MediaFile> | null, rootXmlns?: Record<string, string>): document_d_exports.DrawingContent | null;
|
|
14
24
|
//#endregion
|
|
15
|
-
export { parseVmlImageContent };
|
|
25
|
+
export { parseVmlImageContent, shouldPreserveRawVmlPict };
|
|
@@ -4,7 +4,7 @@ import { resolveImageData } from "./imageParser.js";
|
|
|
4
4
|
import { captureVerbatimXml } from "./verbatimCapture.js";
|
|
5
5
|
import { isValidVmlPreviewDimension, parseVmlNumber, parseVmlStyle, renderStandaloneVmlPreview, renderVmlGroupPreview, vmlCssLengthToPx, vmlSvgDataUrl } from "./vmlPreview.js";
|
|
6
6
|
import { isWatermarkShape } from "./watermarkParser.js";
|
|
7
|
-
import { cloneWithXmlnsDeclarations, findAllDeep, findChild, getAttribute, getChildElements, getLocalName } from "./xmlParser.js";
|
|
7
|
+
import { cloneWithXmlnsDeclarations, findAllDeep, findChild, findDeep, getAttribute, getChildElements, getLocalName } from "./xmlParser.js";
|
|
8
8
|
//#region src/docx/vmlImageParser.ts
|
|
9
9
|
const VML_POSITION_ABSOLUTE = "absolute";
|
|
10
10
|
const IMAGE_WRAP_INLINE = "inline";
|
|
@@ -102,6 +102,33 @@ const previewDrawing = (pictElement, preview, rootXmlns) => {
|
|
|
102
102
|
default: return preview;
|
|
103
103
|
}
|
|
104
104
|
};
|
|
105
|
+
/** VML elements that paint something, i.e. content a save must not lose. */
|
|
106
|
+
const VML_DRAWABLE_SHAPES = [
|
|
107
|
+
"shape",
|
|
108
|
+
"group",
|
|
109
|
+
"rect",
|
|
110
|
+
"roundrect",
|
|
111
|
+
"oval",
|
|
112
|
+
"line",
|
|
113
|
+
"polyline",
|
|
114
|
+
"curve",
|
|
115
|
+
"arc",
|
|
116
|
+
"image"
|
|
117
|
+
];
|
|
118
|
+
/**
|
|
119
|
+
* Whether a `w:pict` that resolved to no image must still be kept verbatim.
|
|
120
|
+
*
|
|
121
|
+
* VML has no serializer of its own, so an unresolved `w:pict` is only ever
|
|
122
|
+
* preserved or lost. Two owners are excluded: a `v:textbox` belongs to the
|
|
123
|
+
* text-box enrichment pass, which rebuilds it as an editable shape, and a
|
|
124
|
+
* watermark shape belongs to watermarkParser; preserving either would emit the
|
|
125
|
+
* same artwork twice.
|
|
126
|
+
*/
|
|
127
|
+
function shouldPreserveRawVmlPict(pictElement) {
|
|
128
|
+
if (findDeep(pictElement, "v", "textbox")) return false;
|
|
129
|
+
const shapes = VML_DRAWABLE_SHAPES.flatMap((localName) => findAllDeep(pictElement, "v", localName));
|
|
130
|
+
return shapes.length > 0 && !shapes.some((shape) => isWatermarkShape(shape));
|
|
131
|
+
}
|
|
105
132
|
/**
|
|
106
133
|
* Read the relationship id off a `v:imagedata` element. Word writes `r:id`;
|
|
107
134
|
* some legacy / third-party generators use `r:embed` or the office-namespace
|
|
@@ -173,4 +200,4 @@ function parseVmlImageContent(pictElement, rels, media, rootXmlns = {}) {
|
|
|
173
200
|
return null;
|
|
174
201
|
}
|
|
175
202
|
//#endregion
|
|
176
|
-
export { parseVmlImageContent };
|
|
203
|
+
export { parseVmlImageContent, shouldPreserveRawVmlPict };
|
package/dist/index.d.ts
CHANGED
|
@@ -20,8 +20,9 @@ import { CreateEmptyDocumentOptions, createEmptyDocument } from "./utils/createD
|
|
|
20
20
|
import { mergeDocumentContent } from "./utils/mergeDocumentContent.js";
|
|
21
21
|
import { DocumentStyleCatalog, DocumentStyleCatalogEntry, ExtractDocumentStyleSetOptions, extractDocumentStyleSet, extractDocumentStyleSetFromDocx, inspectDocumentStyles, inspectDocumentStylesFromDocx } from "./style-sets/extract.js";
|
|
22
22
|
import { STELLA_STYLE_SET_NAME, createStellaStyleDocumentPreset, createStellaStyleSet } from "./style-sets/stellaStyle.js";
|
|
23
|
-
import { createDocx } from "./docx/rezip.js";
|
|
24
|
-
import {
|
|
23
|
+
import { DocumentPropertiesOptions, createDocx } from "./docx/rezip.js";
|
|
24
|
+
import { DRAWING_SAFETY_CLASSES, DrawingSafetyClass } from "./docx/imageRawXml.js";
|
|
25
|
+
import { DocxCompatibility, DocxCompatibilityContext, DocxCompatibilityIssue, DocxCompatibilityLocation, DocxCompatibilityPart, DocxDrawingClassification, FolioDocxCompatibilityHost, FolioDocxCompatibilityProfile, InspectDocxCompatibilityOptions, inspectDocxCompatibility } from "./docx/compatibility.js";
|
|
25
26
|
import { BlockRect } from "./paged-layout/blockGeometry.js";
|
|
26
27
|
import { setAISuggestionsMeta, setFocusedSuggestionMeta } from "./prosemirror/plugins/aiSuggestionDecorations.js";
|
|
27
28
|
import { scrollFolioPositionIntoView } from "./paged-layout/scrollToPmPosition.js";
|
|
@@ -40,4 +41,4 @@ import { getGoogleFontsEnabled, setEmbeddedFontFamilyMap, setGoogleFontsEnabled
|
|
|
40
41
|
import { DOCX_CONFORMANCE_CLASSES } from "@stll/docx-core/model";
|
|
41
42
|
type Document = document_d_exports.Document;
|
|
42
43
|
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_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 };
|
|
44
|
+
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, DRAWING_SAFETY_CLASSES, type DeriveBlockIdInput, type DirectiveKind, type DirectiveRange, type Document, type DocumentPreset, type DocumentPropertiesOptions, type DocumentStyleCatalog, type DocumentStyleCatalogEntry, type DocumentStyleSet, type DocxCompatibility, type DocxCompatibilityContext, type DocxCompatibilityIssue, type DocxCompatibilityLocation, type DocxCompatibilityPart, type DocxConformanceClass, type DocxDrawingClassification, type DrawingSafetyClass, 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
|
@@ -11,6 +11,7 @@ import { COMPARE_REVISION_FORMATS, COMPARE_UNSUPPORTED_REASONS, CompareDocxApply
|
|
|
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";
|
|
14
|
+
import { DRAWING_SAFETY_CLASSES } from "./docx/imageRawXml.js";
|
|
14
15
|
import { createDocx } from "./docx/rezip.js";
|
|
15
16
|
import { buildEmbeddedFontFamilyMap, extractEmbeddedFonts, getEmbeddedFontFaces, scopeEmbeddedFontFamily } from "./fonts/embeddedFonts.js";
|
|
16
17
|
import { fromMarkdown } from "./markdown/fromMarkdown.js";
|
|
@@ -32,4 +33,4 @@ import { createEmptyDocument } from "./utils/createDocument.js";
|
|
|
32
33
|
import { getGoogleFontsEnabled, setEmbeddedFontFamilyMap, setGoogleFontsEnabled } from "./utils/fontResolver.js";
|
|
33
34
|
import { mergeDocumentContent } from "./utils/mergeDocumentContent.js";
|
|
34
35
|
import { DOCX_CONFORMANCE_CLASSES } from "@stll/docx-core/model";
|
|
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 };
|
|
36
|
+
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, DRAWING_SAFETY_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 };
|
|
@@ -1,7 +1,15 @@
|
|
|
1
|
-
import { FolioContentBlock, FolioContentInlineComparisonResult } from "../../compare/content-types.js";
|
|
1
|
+
import { FolioContentBlock, FolioContentInlineComparisonResult, FolioContentInlineFormatting } from "../../compare/content-types.js";
|
|
2
2
|
//#region src/internal/compare/inline-presentation.d.ts
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
type InlineFormattingProperty = keyof FolioContentInlineFormatting;
|
|
4
|
+
/**
|
|
5
|
+
* Derived from the descriptor grammar; tests use it to prove full coverage.
|
|
6
|
+
*
|
|
7
|
+
* Annotated, against the usual rule, for the reason given on
|
|
8
|
+
* `DISPLAY_PRIMITIVE_KINDS`: the inferred union's member order is not stable
|
|
9
|
+
* across declaration builds, and naming the alias keeps the emitted `.d.ts`
|
|
10
|
+
* reproducible.
|
|
11
|
+
*/
|
|
12
|
+
declare const CANONICAL_INLINE_PRESENTATION_PROPERTIES: readonly InlineFormattingProperty[];
|
|
5
13
|
type InlinePresentationBlock = Pick<FolioContentBlock, "previewRuns" | "text">;
|
|
6
14
|
type CanonicalInlinePresentationSegmentsOptions = {
|
|
7
15
|
baseBlock: InlinePresentationBlock;
|
|
@@ -28,7 +28,14 @@ const INLINE_PRESENTATION_GRAMMAR = {
|
|
|
28
28
|
color: ["color"]
|
|
29
29
|
};
|
|
30
30
|
const INLINE_PRESENTATION_HOT_PATH_GRAMMAR = INLINE_PRESENTATION_GRAMMAR;
|
|
31
|
-
/**
|
|
31
|
+
/**
|
|
32
|
+
* Derived from the descriptor grammar; tests use it to prove full coverage.
|
|
33
|
+
*
|
|
34
|
+
* Annotated, against the usual rule, for the reason given on
|
|
35
|
+
* `DISPLAY_PRIMITIVE_KINDS`: the inferred union's member order is not stable
|
|
36
|
+
* across declaration builds, and naming the alias keeps the emitted `.d.ts`
|
|
37
|
+
* reproducible.
|
|
38
|
+
*/
|
|
32
39
|
const CANONICAL_INLINE_PRESENTATION_PROPERTIES = Object.freeze([
|
|
33
40
|
...INLINE_PRESENTATION_GRAMMAR.boolean,
|
|
34
41
|
...INLINE_PRESENTATION_GRAMMAR.string,
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { GRAPHIC_FRAME_LOCK_KEYS } from "../../docx/graphicFrameLocks.js";
|
|
2
|
+
import { allowsDirectDrawingEdit, isDrawingRawXmlMode } from "../../docx/imageRawXml.js";
|
|
1
3
|
import { EMPHASIS_MARK_VALUES, FIELD_TYPE_VALUES, FONT_HINT_VALUES, FONT_THEME_VALUES, HIGHLIGHT_COLOR_VALUES, IMAGE_HORIZONTAL_ALIGNMENT_VALUES, IMAGE_HORIZONTAL_RELATIVE_TO_VALUES, IMAGE_VERTICAL_ALIGNMENT_VALUES, IMAGE_VERTICAL_RELATIVE_TO_VALUES, IMAGE_WRAP_TEXT_VALUES, IMAGE_WRAP_TYPE_VALUES, LINE_SPACING_RULE_VALUES, NUMBER_FORMAT_VALUES, OUTLINE_STYLE_ATTR_VALUES, PARAGRAPH_ALIGNMENT_VALUES, POSITIONAL_TAB_ALIGNMENT_VALUES, POSITIONAL_TAB_LEADER_VALUES, POSITIONAL_TAB_RELATIVE_TO_VALUES, SDT_LOCK_VALUES, SDT_TYPE_VALUES, SHADING_PATTERN_VALUES, TABLE_CELL_TEXT_DIRECTION_VALUES, TABLE_CELL_VERTICAL_ALIGNMENT_VALUES, TABLE_JUSTIFICATION_VALUES, TABLE_ROW_HEIGHT_RULE_VALUES, TABLE_WIDTH_TYPE_VALUES, TAB_LEADER_VALUES, TAB_STOP_ALIGNMENT_VALUES, TEXT_EFFECT_VALUES, THEME_COLOR_SLOT_VALUES, UNDERLINE_STYLE_VALUES } from "../../types/documentEnumValues.js";
|
|
2
4
|
import { canonicalJson } from "../../utils/canonicalJson.js";
|
|
3
5
|
import { normalizeHorizontalScalePercent } from "../../utils/horizontalScale.js";
|
|
@@ -395,8 +397,18 @@ const readImageAttrs = (node) => {
|
|
|
395
397
|
optionalNumber(attrs, "distBottom", "image.attrs.distBottom", issues);
|
|
396
398
|
optionalNumber(attrs, "distLeft", "image.attrs.distLeft", issues);
|
|
397
399
|
optionalNumber(attrs, "distRight", "image.attrs.distRight", issues);
|
|
400
|
+
optionalNumber(attrs, "opacity", "image.attrs.opacity", issues);
|
|
401
|
+
optionalNumber(attrs, "cropTop", "image.attrs.cropTop", issues);
|
|
402
|
+
optionalNumber(attrs, "cropRight", "image.attrs.cropRight", issues);
|
|
403
|
+
optionalNumber(attrs, "cropBottom", "image.attrs.cropBottom", issues);
|
|
404
|
+
optionalNumber(attrs, "cropLeft", "image.attrs.cropLeft", issues);
|
|
405
|
+
optionalNumber(attrs, "paddingTop", "image.attrs.paddingTop", issues);
|
|
406
|
+
optionalNumber(attrs, "paddingRight", "image.attrs.paddingRight", issues);
|
|
407
|
+
optionalNumber(attrs, "paddingBottom", "image.attrs.paddingBottom", issues);
|
|
408
|
+
optionalNumber(attrs, "paddingLeft", "image.attrs.paddingLeft", issues);
|
|
398
409
|
optionalImagePosition(attrs, "position", "image.attrs.position", issues);
|
|
399
410
|
optionalBoolean(attrs, "layoutInCell", "image.attrs.layoutInCell", issues);
|
|
411
|
+
optionalImageFrameLocks(attrs, "frameLocks", "image.attrs.frameLocks", issues);
|
|
400
412
|
optionalNumber(attrs, "borderWidth", "image.attrs.borderWidth", issues);
|
|
401
413
|
optionalString(attrs, "borderColor", "image.attrs.borderColor", issues);
|
|
402
414
|
optionalString(attrs, "borderStyle", "image.attrs.borderStyle", issues);
|
|
@@ -405,10 +417,11 @@ const readImageAttrs = (node) => {
|
|
|
405
417
|
optionalString(attrs, "hlinkRId", "image.attrs.hlinkRId", issues);
|
|
406
418
|
optionalString(attrs, "_docxRawXml", "image.attrs._docxRawXml", issues);
|
|
407
419
|
optionalOneOf(attrs, "_docxRawXmlMode", "image.attrs._docxRawXmlMode", issues, Object.values(DRAWING_RAW_XML_MODES));
|
|
420
|
+
optionalString(attrs, "_docxRawImageFingerprint", "image.attrs._docxRawImageFingerprint", issues);
|
|
408
421
|
const rawXml = attrs["_docxRawXml"];
|
|
409
|
-
if (attrs["_docxRawXmlMode"]
|
|
422
|
+
if (isDrawingRawXmlMode(attrs["_docxRawXmlMode"]) && (typeof rawXml !== "string" || rawXml.trim().length === 0)) issues.push({
|
|
410
423
|
path: "image.attrs._docxRawXml",
|
|
411
|
-
message: "
|
|
424
|
+
message: "Classified drawings require raw XML."
|
|
412
425
|
});
|
|
413
426
|
optionalBoolean(attrs, "_docxObjectPreview", "image.attrs._docxObjectPreview", issues);
|
|
414
427
|
return attrsResult(attrs, issues);
|
|
@@ -821,6 +834,7 @@ const IMAGE_RESOURCE_ATTRS = /* @__PURE__ */ new Set([
|
|
|
821
834
|
"rId",
|
|
822
835
|
"_docxRawXml",
|
|
823
836
|
"_docxRawXmlMode",
|
|
837
|
+
"_docxRawImageFingerprint",
|
|
824
838
|
"_docxObjectPreview"
|
|
825
839
|
]);
|
|
826
840
|
const imageAttrValuesEqual = (left, right) => {
|
|
@@ -831,7 +845,11 @@ const imageAttrValuesEqual = (left, right) => {
|
|
|
831
845
|
const mergeImageAttrs = (node, patch) => {
|
|
832
846
|
const current = expectImageAttrs(node);
|
|
833
847
|
const merged = mergeNodeAttrs(node, readImageAttrs, "image attrs", patch);
|
|
834
|
-
if (!Object.entries(patch).some(([key, value]) => !IMAGE_RESOURCE_ATTRS.has(key) && !imageAttrValuesEqual(Reflect.get(current, key), value)) || current._docxRawXml === void 0
|
|
848
|
+
if (!Object.entries(patch).some(([key, value]) => !IMAGE_RESOURCE_ATTRS.has(key) && !imageAttrValuesEqual(Reflect.get(current, key), value)) || current._docxRawXml === void 0) return merged;
|
|
849
|
+
if (!allowsDirectDrawingEdit(current._docxRawXmlMode)) {
|
|
850
|
+
const { _docxRawImageFingerprint: _discardedFingerprint, ...editedAttrs } = merged;
|
|
851
|
+
return editedAttrs;
|
|
852
|
+
}
|
|
835
853
|
const { _docxRawXml: _discardedRawXml, ...editableAttrs } = merged;
|
|
836
854
|
return editableAttrs;
|
|
837
855
|
};
|
|
@@ -1769,6 +1787,18 @@ const validatePropertyChangeInfo = (value, path, issues) => {
|
|
|
1769
1787
|
optionalOneOf(value, "provenance", `${path}.provenance`, issues, TRACKED_CHANGE_PROVENANCE_VALUES);
|
|
1770
1788
|
optionalString(value, "suggestionId", `${path}.suggestionId`, issues);
|
|
1771
1789
|
};
|
|
1790
|
+
const optionalImageFrameLocks = (attrs, key, path, issues) => {
|
|
1791
|
+
const value = attrs[key];
|
|
1792
|
+
if (value === void 0 || value === null) return;
|
|
1793
|
+
if (!isRecord(value)) {
|
|
1794
|
+
issues.push({
|
|
1795
|
+
path,
|
|
1796
|
+
message: "Expected an object."
|
|
1797
|
+
});
|
|
1798
|
+
return;
|
|
1799
|
+
}
|
|
1800
|
+
for (const lock of GRAPHIC_FRAME_LOCK_KEYS) optionalBoolean(value, lock, `${path}.${lock}`, issues);
|
|
1801
|
+
};
|
|
1772
1802
|
const optionalImagePosition = (attrs, key, path, issues) => {
|
|
1773
1803
|
const value = attrs[key];
|
|
1774
1804
|
if (value === void 0 || value === null) return;
|
|
@@ -5,6 +5,14 @@ import { Mark, Node } from "prosemirror-model";
|
|
|
5
5
|
//#region src/prosemirror/conversion/fromProseDoc.d.ts
|
|
6
6
|
/** Convert a ProseMirror document to the document model. */
|
|
7
7
|
declare function fromProseDoc(pmDoc: Node, baseDocument?: document_d_exports.Document): document_d_exports.Document;
|
|
8
|
+
/**
|
|
9
|
+
* What a field carrying no stored result reports.
|
|
10
|
+
*
|
|
11
|
+
* `serializerFallback` writes the visible page number a save has always given a
|
|
12
|
+
* result-less PAGE/NUMPAGES field; `authored` reports the result the document
|
|
13
|
+
* actually holds, so a text read of a story reads the same loaded and unloaded.
|
|
14
|
+
*/
|
|
15
|
+
type EmptyFieldResultMode = "serializerFallback" | "authored";
|
|
8
16
|
/**
|
|
9
17
|
* Convert ProseMirror marks to TextFormatting
|
|
10
18
|
*/
|
|
@@ -28,6 +36,9 @@ declare function tableCellAttrsToFormatting(attrs: TableCellAttrs): document_d_e
|
|
|
28
36
|
* Preserves all non-content parts of the original document
|
|
29
37
|
*/
|
|
30
38
|
declare function updateDocumentContent(originalDocument: document_d_exports.Document, pmDoc: Node): document_d_exports.Document;
|
|
39
|
+
type ProseDocToBlocksOptions = {
|
|
40
|
+
emptyFieldResult?: EmptyFieldResultMode;
|
|
41
|
+
};
|
|
31
42
|
/**
|
|
32
43
|
* Convert a ProseMirror document back to an array of `BlockContent` blocks
|
|
33
44
|
* (paragraphs, tables, and block-level content controls).
|
|
@@ -35,6 +46,6 @@ declare function updateDocumentContent(originalDocument: document_d_exports.Docu
|
|
|
35
46
|
* Used for converting edited header/footer PM content back to the document
|
|
36
47
|
* model.
|
|
37
48
|
*/
|
|
38
|
-
declare function proseDocToBlocks(pmDoc: Node, baseContent?: document_d_exports.BlockContent[], styles?: NonNullable<document_d_exports.Document["package"]>["styles"]): document_d_exports.BlockContent[];
|
|
49
|
+
declare function proseDocToBlocks(pmDoc: Node, baseContent?: document_d_exports.BlockContent[], styles?: NonNullable<document_d_exports.Document["package"]>["styles"], options?: ProseDocToBlocksOptions): document_d_exports.BlockContent[];
|
|
39
50
|
//#endregion
|
|
40
|
-
export { fromProseDoc, marksToTextFormatting, proseDocToBlocks, standaloneTableCellFromProseMirror, tableAttrsToFormatting, tableCellAttrsToFormatting, tableRowAttrsToFormatting, updateDocumentContent };
|
|
51
|
+
export { EmptyFieldResultMode, ProseDocToBlocksOptions, fromProseDoc, marksToTextFormatting, proseDocToBlocks, standaloneTableCellFromProseMirror, tableAttrsToFormatting, tableCellAttrsToFormatting, tableRowAttrsToFormatting, updateDocumentContent };
|