@stll/folio-core 0.25.5 → 0.27.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/blockRange.d.ts +17 -2
- package/dist/ai-edits/blockRange.js +1 -1
- package/dist/compat/eigenpal.d.ts +2 -1
- package/dist/docx/serializer/paragraphSerializer.js +1 -1
- package/dist/docx/serializer/runSerializer.js +1 -1
- package/dist/docx/serializer/sectionPropertiesSerializer.js +3 -3
- package/dist/docx/server/createBilingualDocument.d.ts +10 -5
- package/dist/docx/server/createBilingualDocument.js +39 -9
- package/dist/docx/server/createBilingualDocx.d.ts +3 -2
- package/dist/docx/server/createBilingualDocx.js +13 -4
- package/dist/docx/unzip.js +4 -4
- package/dist/index.d.ts +2 -1
- package/dist/layout-painter/renderPage.js +6 -1
- package/dist/paged-layout/blockGeometry.d.ts +32 -0
- package/dist/paged-layout/blockGeometry.js +115 -0
- package/dist/redline.js +13 -6
- package/dist/redlineOperationLimit.d.ts +8 -0
- package/dist/redlineOperationLimit.js +6 -0
- package/dist/server.d.ts +2 -2
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FolioAIEditSnapshot, FolioAITextRangeHandle } from "./types.js";
|
|
1
|
+
import { FolioAIBlockAnchor, FolioAIEditSnapshot, FolioAITextRangeHandle } from "./types.js";
|
|
2
2
|
import { Node } from "prosemirror-model";
|
|
3
3
|
//#region src/ai-edits/blockRange.d.ts
|
|
4
4
|
type DocPositionRange = {
|
|
@@ -40,6 +40,21 @@ type ResolvePassageRangeOptions = {
|
|
|
40
40
|
* the needle is empty, or the text does not occur in the block.
|
|
41
41
|
*/
|
|
42
42
|
declare const resolvePassageRange: ({ blockId, text, doc, snapshot }: ResolvePassageRangeOptions) => DocPositionRange | null;
|
|
43
|
+
/**
|
|
44
|
+
* Resolve a `seq-NNNN` fallback id by document position.
|
|
45
|
+
*
|
|
46
|
+
* A sequential id is only minted for a paragraph the source DOCX left
|
|
47
|
+
* without a `w14:paraId`. The live editor's `ParaIdAllocator` fills
|
|
48
|
+
* that gap with a fresh random hex paraId, so a snapshot of the live
|
|
49
|
+
* document keys the block by that hex and never reproduces the
|
|
50
|
+
* server's `seq-NNNN`: the direct anchor lookup misses, and a
|
|
51
|
+
* paraId-based live lookup can't match either (no node carries a
|
|
52
|
+
* `seq-` paraId). The seq number is the block's 1-based position in
|
|
53
|
+
* the same non-empty-block walk the server extractor and
|
|
54
|
+
* `createFolioAIEditSnapshot` share, so it indexes the snapshot's
|
|
55
|
+
* ordered `blocks` directly.
|
|
56
|
+
*/
|
|
57
|
+
declare const resolveSequentialBlockAnchor: (blockId: string, snapshot: FolioAIEditSnapshot) => FolioAIBlockAnchor | undefined;
|
|
43
58
|
/**
|
|
44
59
|
* Clamp a `{from, to}` pair so both endpoints fit inside a document of
|
|
45
60
|
* `docSize` (in PM content positions). Block-boundary snapshots and stale
|
|
@@ -54,4 +69,4 @@ declare const resolvePassageRange: ({ blockId, text, doc, snapshot }: ResolvePas
|
|
|
54
69
|
*/
|
|
55
70
|
declare function clampRangeToDocSize(docSize: number, range: DocPositionRange): DocPositionRange;
|
|
56
71
|
//#endregion
|
|
57
|
-
export { DocPositionRange, clampRangeToDocSize, resolveFolioAIBlockRange, resolveFolioAITextRange, resolvePassageRange };
|
|
72
|
+
export { DocPositionRange, clampRangeToDocSize, resolveFolioAIBlockRange, resolveFolioAITextRange, resolvePassageRange, resolveSequentialBlockAnchor };
|
|
@@ -142,4 +142,4 @@ function clampRangeToDocSize(docSize, range) {
|
|
|
142
142
|
};
|
|
143
143
|
}
|
|
144
144
|
//#endregion
|
|
145
|
-
export { clampRangeToDocSize, resolveFolioAIBlockRange, resolveFolioAITextRange, resolvePassageRange };
|
|
145
|
+
export { clampRangeToDocSize, resolveFolioAIBlockRange, resolveFolioAITextRange, resolvePassageRange, resolveSequentialBlockAnchor };
|
|
@@ -16,6 +16,7 @@ import { DocumentStyleCatalog, DocumentStyleCatalogEntry, ExtractDocumentStyleSe
|
|
|
16
16
|
import { STELLA_STYLE_SET_NAME, createStellaStyleDocumentPreset, createStellaStyleSet } from "../style-sets/stellaStyle.js";
|
|
17
17
|
import { createDocx } from "../docx/rezip.js";
|
|
18
18
|
import { DocxCompatibility, DocxCompatibilityContext, DocxCompatibilityIssue, DocxCompatibilityLocation, DocxCompatibilityPart, FolioDocxCompatibilityHost, FolioDocxCompatibilityProfile, InspectDocxCompatibilityOptions, inspectDocxCompatibility } from "../docx/compatibility.js";
|
|
19
|
+
import { BlockRect } from "../paged-layout/blockGeometry.js";
|
|
19
20
|
import { setAISuggestionsMeta, setFocusedSuggestionMeta } from "../prosemirror/plugins/aiSuggestionDecorations.js";
|
|
20
21
|
import { scrollFolioPositionIntoView } from "../paged-layout/scrollToPmPosition.js";
|
|
21
22
|
import { getFolioCaretViewportRect, getFolioSelectionViewportRect } from "../paged-layout/selectionViewportRect.js";
|
|
@@ -33,4 +34,4 @@ import { getGoogleFontsEnabled, setEmbeddedFontFamilyMap, setGoogleFontsEnabled
|
|
|
33
34
|
import { DOCX_CONFORMANCE_CLASSES } from "../index.js";
|
|
34
35
|
type Document = document_d_exports.Document;
|
|
35
36
|
type DocxConformanceClass = document_d_exports.DocxConformanceClass;
|
|
36
|
-
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 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_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, type FolioAIBlock, type FolioAIBlockAnchor, type FolioAIBlockKind, type FolioAIBlockPreviewRun, type FolioAIComment, type FolioAIEditAppliedOperation, type FolioAIEditApplyMode, type FolioAIEditApplyResult, type FolioAIEditOperation, type FolioAIEditPrecondition, type FolioAIEditReviewMeta, type FolioAIEditSeverity, type FolioAIEditSkipReason, type FolioAIEditSkippedOperation, type FolioAIEditSnapshot, type FolioAISignatureParty, type FolioBlockId, type FolioDocumentOperation, type FolioDocumentOperationAffectedTarget, type FolioDocumentOperationBatch, type FolioDocumentOperationCapabilities, type FolioDocumentOperationIssue, type FolioDocumentOperationMode, type FolioDocumentOperationPrecondition, type FolioDocumentOperationReceipt, type FolioDocumentOperationRecovery, type FolioDocumentOperationResult, type FolioDocumentOperationStatus, type FolioDocumentOperationStory, type FolioDocumentOperationType, type FolioDocumentOperationUndoFailureReason, type FolioDocumentOperationUndoHandle, type FolioDocumentOperationUndoResult, type FolioDocxCompatibilityHost, type FolioDocxCompatibilityProfile, type ImageMeta, type ImageRef, type InspectDocxCompatibilityOptions, InvalidFolioDocumentOperationBatchError, type MarkdownOptions, type MarkdownResult, type PositionalText, type ResolvedAnchor, STELLA_STYLE_SET_NAME, type TemplatePreviewSpan, type TemplatePreviewValue, type TemplatePreviewValues, type TemplateSlashMenuKeyAction, type TemplateSlashMenuState, UnsupportedFolioDocumentOperationVersionError, type WordDiffSegment, acceptAutocompleteSuggestion, acceptAutocompleteWord, anonymizationDecorationsKey, appendAutocompleteToken, applyFolioAIEditOperations, applyFolioDocumentOperations, applySuggestions, assertSupportedFolioDocumentOperationVersion, autocompleteSuggestionKey, autocompleteSuggestionPlugin, buildEmbeddedFontFamilyMap, buildPositionalText, clearAutocompleteSuggestion, clearTemplateSlashMenu, consumeTemplateSlashQuery, createAICitationDecorationsPlugin, createDocx, createEmptyDocument, createFolioAIEditSnapshot, createStellaStyleDocumentPreset, createStellaStyleSet, deriveBlockId, diffWordSegments, extractDocumentStyleSet, extractDocumentStyleSetFromDocx, extractEmbeddedFonts, finishAutocompleteSuggestion, fromMarkdown, getAnonymizationMatches, getAutocompleteSuggestion, getEmbeddedFontFaces, getFolioCaretViewportRect, getFolioDocumentOperationCapabilities, getFolioDocumentOperationIssues, getFolioDocumentOperationReceipts, getFolioParaIdFromBlockId, getFolioSelectionViewportRect, getGoogleFontsEnabled, getTemplateDirectives, getTemplateSlashMenu, hashFolioAIBlockText, inspectDocumentStyles, inspectDocumentStylesFromDocx, inspectDocxCompatibility, 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 };
|
|
37
|
+
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, 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_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, type FolioAIBlock, type FolioAIBlockAnchor, type FolioAIBlockKind, type FolioAIBlockPreviewRun, type FolioAIComment, type FolioAIEditAppliedOperation, type FolioAIEditApplyMode, type FolioAIEditApplyResult, type FolioAIEditOperation, type FolioAIEditPrecondition, type FolioAIEditReviewMeta, type FolioAIEditSeverity, type FolioAIEditSkipReason, type FolioAIEditSkippedOperation, type FolioAIEditSnapshot, type FolioAISignatureParty, type FolioBlockId, type FolioDocumentOperation, type FolioDocumentOperationAffectedTarget, type FolioDocumentOperationBatch, type FolioDocumentOperationCapabilities, type FolioDocumentOperationIssue, type FolioDocumentOperationMode, type FolioDocumentOperationPrecondition, type FolioDocumentOperationReceipt, type FolioDocumentOperationRecovery, type FolioDocumentOperationResult, type FolioDocumentOperationStatus, type FolioDocumentOperationStory, type FolioDocumentOperationType, type FolioDocumentOperationUndoFailureReason, type FolioDocumentOperationUndoHandle, type FolioDocumentOperationUndoResult, type FolioDocxCompatibilityHost, type FolioDocxCompatibilityProfile, type ImageMeta, type ImageRef, type InspectDocxCompatibilityOptions, InvalidFolioDocumentOperationBatchError, type MarkdownOptions, type MarkdownResult, type PositionalText, type ResolvedAnchor, STELLA_STYLE_SET_NAME, type TemplatePreviewSpan, type TemplatePreviewValue, type TemplatePreviewValues, type TemplateSlashMenuKeyAction, type TemplateSlashMenuState, UnsupportedFolioDocumentOperationVersionError, type WordDiffSegment, acceptAutocompleteSuggestion, acceptAutocompleteWord, anonymizationDecorationsKey, appendAutocompleteToken, applyFolioAIEditOperations, applyFolioDocumentOperations, applySuggestions, assertSupportedFolioDocumentOperationVersion, autocompleteSuggestionKey, autocompleteSuggestionPlugin, buildEmbeddedFontFamilyMap, buildPositionalText, clearAutocompleteSuggestion, clearTemplateSlashMenu, consumeTemplateSlashQuery, createAICitationDecorationsPlugin, createDocx, createEmptyDocument, createFolioAIEditSnapshot, createStellaStyleDocumentPreset, createStellaStyleSet, deriveBlockId, diffWordSegments, extractDocumentStyleSet, extractDocumentStyleSetFromDocx, extractEmbeddedFonts, finishAutocompleteSuggestion, fromMarkdown, getAnonymizationMatches, getAutocompleteSuggestion, getEmbeddedFontFaces, getFolioCaretViewportRect, getFolioDocumentOperationCapabilities, getFolioDocumentOperationIssues, getFolioDocumentOperationReceipts, getFolioParaIdFromBlockId, getFolioSelectionViewportRect, getGoogleFontsEnabled, getTemplateDirectives, getTemplateSlashMenu, hashFolioAIBlockText, inspectDocumentStyles, inspectDocumentStylesFromDocx, inspectDocxCompatibility, 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 };
|
|
@@ -215,7 +215,7 @@ function serializeParagraphPropertyChange(change) {
|
|
|
215
215
|
*/
|
|
216
216
|
function serializeHyperlink(hyperlink) {
|
|
217
217
|
const attrs = [];
|
|
218
|
-
if (hyperlink.rId) attrs.push(`r:id="${hyperlink.rId}"`);
|
|
218
|
+
if (hyperlink.rId) attrs.push(`r:id="${escapeXml(hyperlink.rId)}"`);
|
|
219
219
|
if (hyperlink.anchor) attrs.push(`w:anchor="${escapeXml(hyperlink.anchor)}"`);
|
|
220
220
|
if (hyperlink.tooltip) attrs.push(`w:tooltip="${escapeXml(hyperlink.tooltip)}"`);
|
|
221
221
|
if (hyperlink.target) attrs.push(`w:tgtFrame="${escapeXml(hyperlink.target)}"`);
|
|
@@ -338,7 +338,7 @@ function serializeWrap(wrap) {
|
|
|
338
338
|
function serializePicGraphic(image, sharedId) {
|
|
339
339
|
const cx = image.size.width;
|
|
340
340
|
const cy = image.size.height;
|
|
341
|
-
const rId = image.rId || "rId1";
|
|
341
|
+
const rId = escapeXml(image.rId || "rId1");
|
|
342
342
|
const id = sharedId;
|
|
343
343
|
const name = image.filename || `image${id}`;
|
|
344
344
|
let xfrmAttrs = "";
|
|
@@ -3,8 +3,8 @@ import { serializeBorder } from "./borderSerializer.js";
|
|
|
3
3
|
import { escapeXml, intAttr } from "./xmlUtils.js";
|
|
4
4
|
import { normalizeRevisionId } from "@stll/docx-core/model";
|
|
5
5
|
//#region src/docx/serializer/sectionPropertiesSerializer.ts
|
|
6
|
-
const serializeHeaderReference = (ref) => `<w:headerReference w:type="${ref.type}" r:id="${ref.rId}"/>`;
|
|
7
|
-
const serializeFooterReference = (ref) => `<w:footerReference w:type="${ref.type}" r:id="${ref.rId}"/>`;
|
|
6
|
+
const serializeHeaderReference = (ref) => `<w:headerReference w:type="${ref.type}" r:id="${escapeXml(ref.rId)}"/>`;
|
|
7
|
+
const serializeFooterReference = (ref) => `<w:footerReference w:type="${ref.type}" r:id="${escapeXml(ref.rId)}"/>`;
|
|
8
8
|
function serializeFootnoteProperties(props) {
|
|
9
9
|
if (!props) return "";
|
|
10
10
|
const parts = [];
|
|
@@ -178,7 +178,7 @@ function serializeSectionProperties(props) {
|
|
|
178
178
|
serializeOnOffElement(props.noEndnote, "noEndnote"),
|
|
179
179
|
serializeOnOffElement(props.rtlGutter, "rtlGutter")
|
|
180
180
|
]) if (xml) parts.push(xml);
|
|
181
|
-
if (props.printerSettingsRelationshipId) parts.push(`<w:printerSettings r:id="${props.printerSettingsRelationshipId}"/>`);
|
|
181
|
+
if (props.printerSettingsRelationshipId) parts.push(`<w:printerSettings r:id="${escapeXml(props.printerSettingsRelationshipId)}"/>`);
|
|
182
182
|
for (const change of props.propertyChanges ?? []) parts.push(serializeSectionPropertyChange(change));
|
|
183
183
|
const unserializedChildNames = getUnserializedSectionPropertyChildNames(props);
|
|
184
184
|
if (unserializedChildNames && unserializedChildNames.length > 0) return "";
|
|
@@ -37,6 +37,11 @@ type CreateBilingualDocumentOptions = {
|
|
|
37
37
|
targetStyleSuffix: string;
|
|
38
38
|
/** Table borders; legal practice is usually `"none"`. Default `"none"`. */
|
|
39
39
|
borders?: BilingualBorders;
|
|
40
|
+
/**
|
|
41
|
+
* Paragraph handles exposed by Folio's canonical AI-edit snapshot for the
|
|
42
|
+
* source DOCX. Only these paragraphs may become translation rows.
|
|
43
|
+
*/
|
|
44
|
+
editableParagraphIds: ReadonlySet<string>;
|
|
40
45
|
};
|
|
41
46
|
type CreateBilingualDocumentResult = {
|
|
42
47
|
document: document_d_exports.Document;
|
|
@@ -52,11 +57,11 @@ declare class InvalidBilingualDocumentOptionsError extends InvalidBilingualDocum
|
|
|
52
57
|
declare function createBilingualDocument(source: document_d_exports.Document, options: CreateBilingualDocumentOptions): CreateBilingualDocumentResult;
|
|
53
58
|
/**
|
|
54
59
|
* Re-derive the row manifest from a document produced by
|
|
55
|
-
* {@link createBilingualDocument}.
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
* right paragraph's `paraId` is the row handle
|
|
60
|
+
* {@link createBilingualDocument}. A dedicated table-style discriminator keeps
|
|
61
|
+
* ordinary two-column source tables from being mistaken for bilingual output;
|
|
62
|
+
* the expected row structure is validated as a second check. Rows are returned
|
|
63
|
+
* in document order; the right paragraph's `paraId` is the row handle.
|
|
59
64
|
*/
|
|
60
|
-
declare function readBilingualDocument(document: document_d_exports.Document): BilingualRow[];
|
|
65
|
+
declare function readBilingualDocument(document: document_d_exports.Document, editableParagraphIds: ReadonlySet<string>): BilingualRow[];
|
|
61
66
|
//#endregion
|
|
62
67
|
export { BilingualBorders, BilingualParagraphRef, BilingualRow, BilingualRowKind, BilingualTableParagraphRef, CreateBilingualDocumentOptions, CreateBilingualDocumentResult, InvalidBilingualDocumentOptionsError, createBilingualDocument, readBilingualDocument };
|
|
@@ -17,13 +17,17 @@ import { TaggedError } from "better-result";
|
|
|
17
17
|
* and the break paragraph stays between the tables. A source table (parties,
|
|
18
18
|
* signature block) is kept once, in a row spanning both columns: it is signed
|
|
19
19
|
* and read once, and its labels are translated inline rather than duplicated.
|
|
20
|
+
* Structural-only paragraphs are also kept once between tables; they have no
|
|
21
|
+
* independently editable text for a translation row to address.
|
|
20
22
|
*/
|
|
21
23
|
const STYLE_SUFFIX_PATTERN = /^[A-Za-z0-9-]+$/u;
|
|
22
24
|
var InvalidBilingualDocumentOptionsError = class extends TaggedError("InvalidBilingualDocumentOptionsError") {};
|
|
25
|
+
var UneditableBilingualManifestError = class extends TaggedError("UneditableBilingualManifestError") {};
|
|
23
26
|
const FULL_WIDTH_PCT = 5e3;
|
|
24
27
|
const HALF_WIDTH_PCT = 2500;
|
|
25
28
|
const A4_TEXT_WIDTH_TWIPS = 9072;
|
|
26
29
|
const ROW_ID_NAMESPACE = "folio-bilingual";
|
|
30
|
+
const BILINGUAL_TABLE_STYLE_ID = "FolioBilingualTranslation";
|
|
27
31
|
const GRID_BORDER = {
|
|
28
32
|
style: "single",
|
|
29
33
|
size: 4,
|
|
@@ -96,6 +100,11 @@ function createBilingualDocument(source, options) {
|
|
|
96
100
|
}
|
|
97
101
|
if (block.type === "paragraph") {
|
|
98
102
|
if (isEmptyParagraph(block)) continue;
|
|
103
|
+
if (block.paraId === void 0 || !options.editableParagraphIds.has(block.paraId)) {
|
|
104
|
+
flushSection();
|
|
105
|
+
content.push(block);
|
|
106
|
+
continue;
|
|
107
|
+
}
|
|
99
108
|
const { copy, ref } = copyParagraph(block);
|
|
100
109
|
rows.push({
|
|
101
110
|
kind: classifyParagraph(block, styleById),
|
|
@@ -105,10 +114,15 @@ function createBilingualDocument(source, options) {
|
|
|
105
114
|
sectionRows.push(buildRow(block, copy));
|
|
106
115
|
continue;
|
|
107
116
|
}
|
|
108
|
-
const paragraphs = collectTableParagraphs(block).map((paragraph) => ({
|
|
117
|
+
const paragraphs = collectTableParagraphs(block).filter((paragraph) => paragraph.paraId !== void 0 && options.editableParagraphIds.has(paragraph.paraId)).map((paragraph) => ({
|
|
109
118
|
paraId: paragraph.paraId,
|
|
110
119
|
sourceText: getParagraphText(paragraph)
|
|
111
120
|
}));
|
|
121
|
+
if (paragraphs.length === 0) {
|
|
122
|
+
flushSection();
|
|
123
|
+
content.push(block);
|
|
124
|
+
continue;
|
|
125
|
+
}
|
|
112
126
|
rows.push({
|
|
113
127
|
kind: "table",
|
|
114
128
|
rowId: paragraphs.at(0)?.paraId ?? tableRowHandle(rows.length),
|
|
@@ -152,7 +166,7 @@ const flattenBlocks = (content) => {
|
|
|
152
166
|
};
|
|
153
167
|
const isEmptyParagraph = (paragraph) => {
|
|
154
168
|
if (getParagraphText(paragraph).trim().length > 0) return false;
|
|
155
|
-
return paragraph.content.every((item) => item.type === "run" && item.content.every((part) => part.type === "text"));
|
|
169
|
+
return paragraph.content.every((item) => item.type === "run" && item.formatting?.hidden !== true && item.content.every((part) => part.type === "text"));
|
|
156
170
|
};
|
|
157
171
|
/** Heading style families across Word UI languages (en, cs/sk, de, fr, pl). */
|
|
158
172
|
const HEADING_STYLE_PATTERN = /heading|nadpis|berschrift|titre|nag[łl]/iu;
|
|
@@ -391,6 +405,7 @@ const buildTable = (rows, borders, textWidth) => ({
|
|
|
391
405
|
value: FULL_WIDTH_PCT,
|
|
392
406
|
type: "pct"
|
|
393
407
|
},
|
|
408
|
+
styleId: BILINGUAL_TABLE_STYLE_ID,
|
|
394
409
|
layout: "fixed",
|
|
395
410
|
borders: TABLE_BORDERS[borders],
|
|
396
411
|
look: {
|
|
@@ -453,21 +468,22 @@ const createParaIdMinter = (taken) => {
|
|
|
453
468
|
};
|
|
454
469
|
/**
|
|
455
470
|
* Re-derive the row manifest from a document produced by
|
|
456
|
-
* {@link createBilingualDocument}.
|
|
457
|
-
*
|
|
458
|
-
*
|
|
459
|
-
* right paragraph's `paraId` is the row handle
|
|
471
|
+
* {@link createBilingualDocument}. A dedicated table-style discriminator keeps
|
|
472
|
+
* ordinary two-column source tables from being mistaken for bilingual output;
|
|
473
|
+
* the expected row structure is validated as a second check. Rows are returned
|
|
474
|
+
* in document order; the right paragraph's `paraId` is the row handle.
|
|
460
475
|
*/
|
|
461
|
-
function readBilingualDocument(document) {
|
|
476
|
+
function readBilingualDocument(document, editableParagraphIds) {
|
|
462
477
|
const styleById = new Map((document.package.styles?.styles ?? []).map((style) => [style.styleId, style]));
|
|
463
478
|
const rows = [];
|
|
479
|
+
let missingHandleCount = 0;
|
|
464
480
|
for (const block of flattenBlocks(document.package.document.content)) {
|
|
465
481
|
if (block.type !== "table" || !isBilingualTable(block)) continue;
|
|
466
482
|
for (const row of block.rows) {
|
|
467
483
|
const [left, right] = row.cells;
|
|
468
484
|
if (!left) continue;
|
|
469
485
|
if (!right) {
|
|
470
|
-
const paragraphs = left.content.filter((item) => item.type === "table").flatMap(collectTableParagraphs).map((paragraph) => ({
|
|
486
|
+
const paragraphs = left.content.filter((item) => item.type === "table").flatMap(collectTableParagraphs).filter((paragraph) => paragraph.paraId !== void 0 && editableParagraphIds.has(paragraph.paraId)).map((paragraph) => ({
|
|
471
487
|
paraId: paragraph.paraId,
|
|
472
488
|
sourceText: getParagraphText(paragraph)
|
|
473
489
|
}));
|
|
@@ -480,7 +496,16 @@ function readBilingualDocument(document) {
|
|
|
480
496
|
}
|
|
481
497
|
const source = left.content.at(0);
|
|
482
498
|
const target = right.content.at(0);
|
|
483
|
-
if (source?.type !== "paragraph" || target?.type !== "paragraph"
|
|
499
|
+
if (source?.type !== "paragraph" || target?.type !== "paragraph") continue;
|
|
500
|
+
if (target.paraId === void 0) {
|
|
501
|
+
missingHandleCount += 1;
|
|
502
|
+
continue;
|
|
503
|
+
}
|
|
504
|
+
const sourceMissing = source.paraId === void 0 || !editableParagraphIds.has(source.paraId);
|
|
505
|
+
const targetMissing = !editableParagraphIds.has(target.paraId);
|
|
506
|
+
if (sourceMissing) missingHandleCount += 1;
|
|
507
|
+
if (targetMissing) missingHandleCount += 1;
|
|
508
|
+
if (sourceMissing || targetMissing) continue;
|
|
484
509
|
rows.push({
|
|
485
510
|
kind: classifyParagraph(source, styleById),
|
|
486
511
|
rowId: target.paraId,
|
|
@@ -490,9 +515,14 @@ function readBilingualDocument(document) {
|
|
|
490
515
|
});
|
|
491
516
|
}
|
|
492
517
|
}
|
|
518
|
+
if (missingHandleCount > 0) throw new UneditableBilingualManifestError({
|
|
519
|
+
message: "Bilingual manifest contains handles absent from the Folio AI-edit snapshot.",
|
|
520
|
+
missingHandleCount
|
|
521
|
+
});
|
|
493
522
|
return rows;
|
|
494
523
|
}
|
|
495
524
|
const isBilingualTable = (table) => {
|
|
525
|
+
if (table.formatting?.styleId !== BILINGUAL_TABLE_STYLE_ID) return false;
|
|
496
526
|
let pairs = 0;
|
|
497
527
|
for (const row of table.rows) {
|
|
498
528
|
const cells = row.cells;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { BilingualRow, CreateBilingualDocumentOptions } from "./createBilingualDocument.js";
|
|
2
2
|
//#region src/docx/server/createBilingualDocx.d.ts
|
|
3
|
+
type CreateBilingualDocxOptions = Omit<CreateBilingualDocumentOptions, "editableParagraphIds">;
|
|
3
4
|
type CreateBilingualDocxResult = {
|
|
4
5
|
buffer: ArrayBuffer;
|
|
5
6
|
rows: BilingualRow[];
|
|
@@ -12,8 +13,8 @@ type CreateBilingualDocxResult = {
|
|
|
12
13
|
* as a two-column table, and repack onto the original package so theme, fonts,
|
|
13
14
|
* media, headers and footers carry over untouched.
|
|
14
15
|
*/
|
|
15
|
-
declare function createBilingualDocx(input: ArrayBuffer | Uint8Array, options:
|
|
16
|
+
declare function createBilingualDocx(input: ArrayBuffer | Uint8Array, options: CreateBilingualDocxOptions): Promise<CreateBilingualDocxResult>;
|
|
16
17
|
/** Bytes-in form of {@link readBilingualDocument}. */
|
|
17
18
|
declare function readBilingualDocx(input: ArrayBuffer | Uint8Array): Promise<BilingualRow[]>;
|
|
18
19
|
//#endregion
|
|
19
|
-
export { CreateBilingualDocxResult, createBilingualDocx, readBilingualDocx };
|
|
20
|
+
export { CreateBilingualDocxOptions, CreateBilingualDocxResult, createBilingualDocx, readBilingualDocx };
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { FolioDocxReviewer } from "../../ai-edits/headless.js";
|
|
2
|
+
import { toArrayBuffer } from "../../utils/docxInput.js";
|
|
1
3
|
import { ensureParaIds } from "../ensureParaIds.js";
|
|
2
4
|
import { parseDocx } from "../parser.js";
|
|
3
5
|
import { createDocx } from "../rezip.js";
|
|
@@ -11,16 +13,23 @@ import { createBilingualDocument, readBilingualDocument } from "./createBilingua
|
|
|
11
13
|
* media, headers and footers carry over untouched.
|
|
12
14
|
*/
|
|
13
15
|
async function createBilingualDocx(input, options) {
|
|
14
|
-
const
|
|
16
|
+
const stampedBuffer = await toArrayBuffer((await ensureParaIds(input)).docx);
|
|
17
|
+
const editableParagraphIds = new Set((await FolioDocxReviewer.fromBuffer(stampedBuffer)).snapshot().blocks.map(({ id }) => id));
|
|
18
|
+
const { document, warnings } = createBilingualDocument(await parseDocx(stampedBuffer, { preloadFonts: false }), {
|
|
19
|
+
...options,
|
|
20
|
+
editableParagraphIds
|
|
21
|
+
});
|
|
22
|
+
const buffer = await createDocx(document);
|
|
15
23
|
return {
|
|
16
|
-
buffer
|
|
17
|
-
rows,
|
|
24
|
+
buffer,
|
|
25
|
+
rows: await readBilingualDocx(buffer),
|
|
18
26
|
warnings
|
|
19
27
|
};
|
|
20
28
|
}
|
|
21
29
|
/** Bytes-in form of {@link readBilingualDocument}. */
|
|
22
30
|
async function readBilingualDocx(input) {
|
|
23
|
-
|
|
31
|
+
const buffer = await toArrayBuffer(input);
|
|
32
|
+
return readBilingualDocument(await parseDocx(buffer, { preloadFonts: false }), new Set((await FolioDocxReviewer.fromBuffer(buffer)).snapshot().blocks.map(({ id }) => id)));
|
|
24
33
|
}
|
|
25
34
|
//#endregion
|
|
26
35
|
export { createBilingualDocx, readBilingualDocx };
|
package/dist/docx/unzip.js
CHANGED
|
@@ -147,7 +147,7 @@ async function unzipDocx(buffer, options = {}) {
|
|
|
147
147
|
if (lowerPath.endsWith(".xml") || lowerPath.endsWith(".rels")) {
|
|
148
148
|
assertEntrySize(path, declaredSize, limits.maxXmlBytes);
|
|
149
149
|
if (options.extractAllXml === false && !shouldExtractXmlPart(lowerPath)) continue;
|
|
150
|
-
extractionTasks.push(file.async("text").then((xmlContent) => {
|
|
150
|
+
extractionTasks.push(() => file.async("text").then((xmlContent) => {
|
|
151
151
|
assertExtractedSize(path, xmlContent.length, limits.maxXmlBytes);
|
|
152
152
|
return {
|
|
153
153
|
type: "xml",
|
|
@@ -163,7 +163,7 @@ async function unzipDocx(buffer, options = {}) {
|
|
|
163
163
|
content.warnings.push(`Skipped oversized media file: ${path}; original entry preserved for round-trip.`);
|
|
164
164
|
continue;
|
|
165
165
|
}
|
|
166
|
-
extractionTasks.push(file.async("arraybuffer").then((binaryContent) => {
|
|
166
|
+
extractionTasks.push(() => file.async("arraybuffer").then((binaryContent) => {
|
|
167
167
|
if (binaryContent.byteLength > limits.maxMediaBytes) {
|
|
168
168
|
content.warnings.push(`Skipped oversized media file: ${path}; original entry preserved for round-trip.`);
|
|
169
169
|
return null;
|
|
@@ -178,7 +178,7 @@ async function unzipDocx(buffer, options = {}) {
|
|
|
178
178
|
}));
|
|
179
179
|
} else if (lowerPath.startsWith("word/fonts/")) {
|
|
180
180
|
if (isEntryTooLarge(declaredSize, limits.maxFontBytes)) continue;
|
|
181
|
-
extractionTasks.push(file.async("arraybuffer").then((binaryContent) => {
|
|
181
|
+
extractionTasks.push(() => file.async("arraybuffer").then((binaryContent) => {
|
|
182
182
|
if (binaryContent.byteLength > limits.maxFontBytes) return null;
|
|
183
183
|
return {
|
|
184
184
|
type: "font",
|
|
@@ -188,7 +188,7 @@ async function unzipDocx(buffer, options = {}) {
|
|
|
188
188
|
}));
|
|
189
189
|
}
|
|
190
190
|
}
|
|
191
|
-
for (const extracted of await Promise.all(extractionTasks)) {
|
|
191
|
+
for (const extracted of await Promise.all(extractionTasks.map((extract) => extract()))) {
|
|
192
192
|
if (!extracted) continue;
|
|
193
193
|
if (extracted.type === "xml") {
|
|
194
194
|
assignXmlContent(content, extracted);
|
package/dist/index.d.ts
CHANGED
|
@@ -17,6 +17,7 @@ import { DocumentStyleCatalog, DocumentStyleCatalogEntry, ExtractDocumentStyleSe
|
|
|
17
17
|
import { STELLA_STYLE_SET_NAME, createStellaStyleDocumentPreset, createStellaStyleSet } from "./style-sets/stellaStyle.js";
|
|
18
18
|
import { createDocx } from "./docx/rezip.js";
|
|
19
19
|
import { DocxCompatibility, DocxCompatibilityContext, DocxCompatibilityIssue, DocxCompatibilityLocation, DocxCompatibilityPart, FolioDocxCompatibilityHost, FolioDocxCompatibilityProfile, InspectDocxCompatibilityOptions, inspectDocxCompatibility } from "./docx/compatibility.js";
|
|
20
|
+
import { BlockRect } from "./paged-layout/blockGeometry.js";
|
|
20
21
|
import { setAISuggestionsMeta, setFocusedSuggestionMeta } from "./prosemirror/plugins/aiSuggestionDecorations.js";
|
|
21
22
|
import { scrollFolioPositionIntoView } from "./paged-layout/scrollToPmPosition.js";
|
|
22
23
|
import { getFolioCaretViewportRect, getFolioSelectionViewportRect } from "./paged-layout/selectionViewportRect.js";
|
|
@@ -34,4 +35,4 @@ import { getGoogleFontsEnabled, setEmbeddedFontFamilyMap, setGoogleFontsEnabled
|
|
|
34
35
|
import { DOCX_CONFORMANCE_CLASSES } from "@stll/docx-core/model";
|
|
35
36
|
type Document = document_d_exports.Document;
|
|
36
37
|
type DocxConformanceClass = document_d_exports.DocxConformanceClass;
|
|
37
|
-
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 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_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, type FolioAIBlock, type FolioAIBlockAnchor, type FolioAIBlockKind, type FolioAIBlockPreviewRun, type FolioAIComment, type FolioAIEditAppliedOperation, type FolioAIEditApplyMode, type FolioAIEditApplyResult, type FolioAIEditOperation, type FolioAIEditPrecondition, type FolioAIEditReviewMeta, type FolioAIEditSeverity, type FolioAIEditSkipReason, type FolioAIEditSkippedOperation, type FolioAIEditSnapshot, type FolioAISignatureParty, type FolioBlockId, type FolioDocumentOperation, type FolioDocumentOperationAffectedTarget, type FolioDocumentOperationBatch, type FolioDocumentOperationCapabilities, type FolioDocumentOperationIssue, type FolioDocumentOperationMode, type FolioDocumentOperationPrecondition, type FolioDocumentOperationReceipt, type FolioDocumentOperationRecovery, type FolioDocumentOperationResult, type FolioDocumentOperationStatus, type FolioDocumentOperationStory, type FolioDocumentOperationType, type FolioDocumentOperationUndoFailureReason, type FolioDocumentOperationUndoHandle, type FolioDocumentOperationUndoResult, type FolioDocxCompatibilityHost, type FolioDocxCompatibilityProfile, type ImageMeta, type ImageRef, type InspectDocxCompatibilityOptions, InvalidFolioDocumentOperationBatchError, type MarkdownOptions, type MarkdownResult, type PositionalText, type ResolvedAnchor, STELLA_STYLE_SET_NAME, type TemplatePreviewSpan, type TemplatePreviewValue, type TemplatePreviewValues, type TemplateSlashMenuKeyAction, type TemplateSlashMenuState, UnsupportedFolioDocumentOperationVersionError, type WordDiffSegment, acceptAutocompleteSuggestion, acceptAutocompleteWord, anonymizationDecorationsKey, appendAutocompleteToken, applyFolioAIEditOperations, applyFolioDocumentOperations, applySuggestions, assertSupportedFolioDocumentOperationVersion, autocompleteSuggestionKey, autocompleteSuggestionPlugin, buildEmbeddedFontFamilyMap, buildPositionalText, clearAutocompleteSuggestion, clearTemplateSlashMenu, consumeTemplateSlashQuery, createAICitationDecorationsPlugin, createDocx, createEmptyDocument, createFolioAIEditSnapshot, createStellaStyleDocumentPreset, createStellaStyleSet, deriveBlockId, diffWordSegments, extractDocumentStyleSet, extractDocumentStyleSetFromDocx, extractEmbeddedFonts, finishAutocompleteSuggestion, fromMarkdown, getAnonymizationMatches, getAutocompleteSuggestion, getEmbeddedFontFaces, getFolioCaretViewportRect, getFolioDocumentOperationCapabilities, getFolioDocumentOperationIssues, getFolioDocumentOperationReceipts, getFolioParaIdFromBlockId, getFolioSelectionViewportRect, getGoogleFontsEnabled, getTemplateDirectives, getTemplateSlashMenu, hashFolioAIBlockText, inspectDocumentStyles, inspectDocumentStylesFromDocx, inspectDocxCompatibility, 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 };
|
|
38
|
+
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, 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_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, type FolioAIBlock, type FolioAIBlockAnchor, type FolioAIBlockKind, type FolioAIBlockPreviewRun, type FolioAIComment, type FolioAIEditAppliedOperation, type FolioAIEditApplyMode, type FolioAIEditApplyResult, type FolioAIEditOperation, type FolioAIEditPrecondition, type FolioAIEditReviewMeta, type FolioAIEditSeverity, type FolioAIEditSkipReason, type FolioAIEditSkippedOperation, type FolioAIEditSnapshot, type FolioAISignatureParty, type FolioBlockId, type FolioDocumentOperation, type FolioDocumentOperationAffectedTarget, type FolioDocumentOperationBatch, type FolioDocumentOperationCapabilities, type FolioDocumentOperationIssue, type FolioDocumentOperationMode, type FolioDocumentOperationPrecondition, type FolioDocumentOperationReceipt, type FolioDocumentOperationRecovery, type FolioDocumentOperationResult, type FolioDocumentOperationStatus, type FolioDocumentOperationStory, type FolioDocumentOperationType, type FolioDocumentOperationUndoFailureReason, type FolioDocumentOperationUndoHandle, type FolioDocumentOperationUndoResult, type FolioDocxCompatibilityHost, type FolioDocxCompatibilityProfile, type ImageMeta, type ImageRef, type InspectDocxCompatibilityOptions, InvalidFolioDocumentOperationBatchError, type MarkdownOptions, type MarkdownResult, type PositionalText, type ResolvedAnchor, STELLA_STYLE_SET_NAME, type TemplatePreviewSpan, type TemplatePreviewValue, type TemplatePreviewValues, type TemplateSlashMenuKeyAction, type TemplateSlashMenuState, UnsupportedFolioDocumentOperationVersionError, type WordDiffSegment, acceptAutocompleteSuggestion, acceptAutocompleteWord, anonymizationDecorationsKey, appendAutocompleteToken, applyFolioAIEditOperations, applyFolioDocumentOperations, applySuggestions, assertSupportedFolioDocumentOperationVersion, autocompleteSuggestionKey, autocompleteSuggestionPlugin, buildEmbeddedFontFamilyMap, buildPositionalText, clearAutocompleteSuggestion, clearTemplateSlashMenu, consumeTemplateSlashQuery, createAICitationDecorationsPlugin, createDocx, createEmptyDocument, createFolioAIEditSnapshot, createStellaStyleDocumentPreset, createStellaStyleSet, deriveBlockId, diffWordSegments, extractDocumentStyleSet, extractDocumentStyleSetFromDocx, extractEmbeddedFonts, finishAutocompleteSuggestion, fromMarkdown, getAnonymizationMatches, getAutocompleteSuggestion, getEmbeddedFontFaces, getFolioCaretViewportRect, getFolioDocumentOperationCapabilities, getFolioDocumentOperationIssues, getFolioDocumentOperationReceipts, getFolioParaIdFromBlockId, getFolioSelectionViewportRect, getGoogleFontsEnabled, getTemplateDirectives, getTemplateSlashMenu, hashFolioAIBlockText, inspectDocumentStyles, inspectDocumentStylesFromDocx, inspectDocxCompatibility, 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 };
|
|
@@ -1597,6 +1597,7 @@ function renderPages(pages, container, options = {}) {
|
|
|
1597
1597
|
const viewportHeight = window.innerHeight;
|
|
1598
1598
|
const nearThreshold = viewportHeight * 3;
|
|
1599
1599
|
const nearIndices = /* @__PURE__ */ new Set();
|
|
1600
|
+
let depopulated = false;
|
|
1600
1601
|
for (const [el, data] of liveDataMap) {
|
|
1601
1602
|
if (!data.rendered) continue;
|
|
1602
1603
|
const rect = el.getBoundingClientRect();
|
|
@@ -1609,8 +1610,12 @@ function renderPages(pages, container, options = {}) {
|
|
|
1609
1610
|
keepRendered = true;
|
|
1610
1611
|
break;
|
|
1611
1612
|
}
|
|
1612
|
-
if (!keepRendered && nearIndices.size > 0)
|
|
1613
|
+
if (!keepRendered && nearIndices.size > 0) {
|
|
1614
|
+
depopulatePageShell(el, liveDataMap);
|
|
1615
|
+
depopulated = true;
|
|
1616
|
+
}
|
|
1613
1617
|
}
|
|
1618
|
+
if (depopulated) emitPainterPainted(container);
|
|
1614
1619
|
}, {
|
|
1615
1620
|
root: null,
|
|
1616
1621
|
rootMargin: `${VIRTUALIZATION_ROOT_MARGIN_PX}px 0px ${VIRTUALIZATION_ROOT_MARGIN_PX}px 0px`
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { FolioAIEditSnapshot } from "../ai-edits/types.js";
|
|
2
|
+
//#region src/paged-layout/blockGeometry.d.ts
|
|
3
|
+
/** Painted geometry for one AI-snapshot block in scroll-content coordinates. */
|
|
4
|
+
type BlockRect = {
|
|
5
|
+
blockId: string;
|
|
6
|
+
/** One-based painted page number. */
|
|
7
|
+
page: number;
|
|
8
|
+
/** Pixels from the scroll root's content origin. */
|
|
9
|
+
top: number;
|
|
10
|
+
/** Pixels from the scroll root's content origin. */
|
|
11
|
+
left: number;
|
|
12
|
+
width: number;
|
|
13
|
+
height: number;
|
|
14
|
+
};
|
|
15
|
+
type ReadBlockRectsOptions = {
|
|
16
|
+
blockIds: readonly string[];
|
|
17
|
+
snapshot: FolioAIEditSnapshot;
|
|
18
|
+
pagesContainer: HTMLElement;
|
|
19
|
+
scrollRoot: HTMLElement;
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* Measure painted snapshot blocks relative to one editor's scroll root.
|
|
23
|
+
*
|
|
24
|
+
* Missing snapshot ids and blocks on unpainted virtual pages are omitted. Each
|
|
25
|
+
* requested block is measured at most once; painted elements are collected in
|
|
26
|
+
* one DOM query per relevant page.
|
|
27
|
+
*/
|
|
28
|
+
declare const readBlockRects: ({ blockIds, snapshot, pagesContainer, scrollRoot }: ReadBlockRectsOptions) => ReadonlyMap<string, BlockRect>;
|
|
29
|
+
/** Subscribe to instance-scoped painted-page changes. */
|
|
30
|
+
declare const onPaintedLayoutChange: (pagesContainer: HTMLElement, listener: () => void) => (() => void);
|
|
31
|
+
//#endregion
|
|
32
|
+
export { BlockRect, ReadBlockRectsOptions, onPaintedLayoutChange, readBlockRects };
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { resolveSequentialBlockAnchor } from "../ai-edits/blockRange.js";
|
|
2
|
+
import { PAINTER_PAINTED_EVENT, findPageShellForPmPos } from "../layout-painter/renderPage.js";
|
|
3
|
+
//#region src/paged-layout/blockGeometry.ts
|
|
4
|
+
const PAINTED_BLOCK_SELECTOR = "[data-block-id][data-pm-start]";
|
|
5
|
+
const PAGE_SELECTOR = "[data-page-number]";
|
|
6
|
+
const pageNumberOf = (page) => {
|
|
7
|
+
const raw = page.dataset["pageNumber"];
|
|
8
|
+
const pageNumber = raw === void 0 ? NaN : Number(raw);
|
|
9
|
+
return Number.isInteger(pageNumber) && pageNumber > 0 ? pageNumber : null;
|
|
10
|
+
};
|
|
11
|
+
const requestedBlocks = (blockIds, snapshot) => {
|
|
12
|
+
const uniqueIds = new Set(blockIds);
|
|
13
|
+
const requested = [];
|
|
14
|
+
for (const blockId of uniqueIds) {
|
|
15
|
+
const anchor = Object.hasOwn(snapshot.anchors, blockId) ? snapshot.anchors[blockId] : resolveSequentialBlockAnchor(blockId, snapshot);
|
|
16
|
+
if (anchor) requested.push({
|
|
17
|
+
blockId,
|
|
18
|
+
pmStart: anchor.from
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
return requested;
|
|
22
|
+
};
|
|
23
|
+
const paintedBlocksByPmStart = (page) => {
|
|
24
|
+
const blocks = /* @__PURE__ */ new Map();
|
|
25
|
+
for (const element of page.querySelectorAll(PAINTED_BLOCK_SELECTOR)) {
|
|
26
|
+
const pmStart = Number(element.dataset["pmStart"]);
|
|
27
|
+
if (Number.isFinite(pmStart) && !blocks.has(pmStart)) blocks.set(pmStart, element);
|
|
28
|
+
}
|
|
29
|
+
return blocks;
|
|
30
|
+
};
|
|
31
|
+
const groupVirtualizedRequestsByPage = (requests, pagesContainer) => {
|
|
32
|
+
const byPage = /* @__PURE__ */ new Map();
|
|
33
|
+
for (const request of requests) {
|
|
34
|
+
const page = findPageShellForPmPos(pagesContainer, request.pmStart)?.element;
|
|
35
|
+
if (!page) return null;
|
|
36
|
+
const pageRequests = byPage.get(page);
|
|
37
|
+
if (pageRequests) pageRequests.push(request);
|
|
38
|
+
else byPage.set(page, [request]);
|
|
39
|
+
}
|
|
40
|
+
return byPage;
|
|
41
|
+
};
|
|
42
|
+
const findPaintedElements = (requests, pagesContainer) => {
|
|
43
|
+
const found = /* @__PURE__ */ new Map();
|
|
44
|
+
const virtualizedRequests = groupVirtualizedRequestsByPage(requests, pagesContainer);
|
|
45
|
+
if (virtualizedRequests) {
|
|
46
|
+
for (const [page, pageRequests] of virtualizedRequests) {
|
|
47
|
+
const pageNumber = pageNumberOf(page);
|
|
48
|
+
if (pageNumber === null) continue;
|
|
49
|
+
const blocks = paintedBlocksByPmStart(page);
|
|
50
|
+
for (const request of pageRequests) {
|
|
51
|
+
const element = blocks.get(request.pmStart);
|
|
52
|
+
if (element) found.set(request.blockId, {
|
|
53
|
+
element,
|
|
54
|
+
page: pageNumber
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
return found;
|
|
59
|
+
}
|
|
60
|
+
const requestsByPmStart = new Map(requests.map((request) => [request.pmStart, request]));
|
|
61
|
+
for (const page of pagesContainer.querySelectorAll(PAGE_SELECTOR)) {
|
|
62
|
+
const pageNumber = pageNumberOf(page);
|
|
63
|
+
if (pageNumber === null) continue;
|
|
64
|
+
const blocks = paintedBlocksByPmStart(page);
|
|
65
|
+
for (const [pmStart, request] of requestsByPmStart) {
|
|
66
|
+
const element = blocks.get(pmStart);
|
|
67
|
+
if (element) {
|
|
68
|
+
found.set(request.blockId, {
|
|
69
|
+
element,
|
|
70
|
+
page: pageNumber
|
|
71
|
+
});
|
|
72
|
+
requestsByPmStart.delete(pmStart);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
if (requestsByPmStart.size === 0) break;
|
|
76
|
+
}
|
|
77
|
+
return found;
|
|
78
|
+
};
|
|
79
|
+
/**
|
|
80
|
+
* Measure painted snapshot blocks relative to one editor's scroll root.
|
|
81
|
+
*
|
|
82
|
+
* Missing snapshot ids and blocks on unpainted virtual pages are omitted. Each
|
|
83
|
+
* requested block is measured at most once; painted elements are collected in
|
|
84
|
+
* one DOM query per relevant page.
|
|
85
|
+
*/
|
|
86
|
+
const readBlockRects = ({ blockIds, snapshot, pagesContainer, scrollRoot }) => {
|
|
87
|
+
const requests = requestedBlocks(blockIds, snapshot);
|
|
88
|
+
const paintedElements = findPaintedElements(requests, pagesContainer);
|
|
89
|
+
if (paintedElements.size === 0) return /* @__PURE__ */ new Map();
|
|
90
|
+
const rootRect = scrollRoot.getBoundingClientRect();
|
|
91
|
+
const rects = /* @__PURE__ */ new Map();
|
|
92
|
+
for (const request of requests) {
|
|
93
|
+
const painted = paintedElements.get(request.blockId);
|
|
94
|
+
if (!painted) continue;
|
|
95
|
+
const rect = painted.element.getBoundingClientRect();
|
|
96
|
+
rects.set(request.blockId, {
|
|
97
|
+
blockId: request.blockId,
|
|
98
|
+
page: painted.page,
|
|
99
|
+
top: rect.top - rootRect.top - scrollRoot.clientTop + scrollRoot.scrollTop,
|
|
100
|
+
left: rect.left - rootRect.left - scrollRoot.clientLeft + scrollRoot.scrollLeft,
|
|
101
|
+
width: rect.width,
|
|
102
|
+
height: rect.height
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
return rects;
|
|
106
|
+
};
|
|
107
|
+
/** Subscribe to instance-scoped painted-page changes. */
|
|
108
|
+
const onPaintedLayoutChange = (pagesContainer, listener) => {
|
|
109
|
+
pagesContainer.addEventListener(PAINTER_PAINTED_EVENT, listener);
|
|
110
|
+
return () => {
|
|
111
|
+
pagesContainer.removeEventListener(PAINTER_PAINTED_EVENT, listener);
|
|
112
|
+
};
|
|
113
|
+
};
|
|
114
|
+
//#endregion
|
|
115
|
+
export { onPaintedLayoutChange, readBlockRects };
|
package/dist/redline.js
CHANGED
|
@@ -3,6 +3,7 @@ import { createFolioAITextRangeHandle } from "./ai-edits/snapshot.js";
|
|
|
3
3
|
import "./document-operations.js";
|
|
4
4
|
import { pairFolioDocumentStories } from "./document-stories.js";
|
|
5
5
|
import { resolveFolioDocumentPrivacyTransforms, rewriteDocxMetadataPrivacy } from "./docx/metadataPrivacy.js";
|
|
6
|
+
import { GenerateRedlineDocxOperationLimitError } from "./redlineOperationLimit.js";
|
|
6
7
|
import { alignFolioBlocks } from "./version-comparison.js";
|
|
7
8
|
import { TaggedError, panic } from "better-result";
|
|
8
9
|
//#region src/redline.ts
|
|
@@ -71,11 +72,14 @@ const formattingSegments = (baseBlock, revisedBlock) => {
|
|
|
71
72
|
if (hasInlineFormatting(formatting)) {
|
|
72
73
|
const previous = segments.at(-1);
|
|
73
74
|
if (previous && previous.endOffset === textOffset && sameInlineFormatting(previous.formatting, formatting)) previous.endOffset += length;
|
|
74
|
-
else
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
75
|
+
else {
|
|
76
|
+
if (segments.length >= 1e4) throw new GenerateRedlineDocxOperationLimitError({ message: "The document comparison exceeds the generated operation limit." });
|
|
77
|
+
segments.push({
|
|
78
|
+
startOffset: textOffset,
|
|
79
|
+
endOffset: textOffset + length,
|
|
80
|
+
formatting
|
|
81
|
+
});
|
|
82
|
+
}
|
|
79
83
|
}
|
|
80
84
|
textOffset += length;
|
|
81
85
|
baseRunOffset += length;
|
|
@@ -199,7 +203,10 @@ const generateRedlineDocx = async (base, revised, options = {}) => {
|
|
|
199
203
|
const skipped = [];
|
|
200
204
|
const unprocessedStories = [];
|
|
201
205
|
let operationSequence = 0;
|
|
202
|
-
const nextOperationId = () =>
|
|
206
|
+
const nextOperationId = () => {
|
|
207
|
+
if (operationSequence >= 1e4) throw new GenerateRedlineDocxOperationLimitError({ message: "The document comparison exceeds the generated operation limit." });
|
|
208
|
+
return `redline-${++operationSequence}`;
|
|
209
|
+
};
|
|
203
210
|
for (const pair of pairFolioDocumentStories(baseStories, revisedStories)) {
|
|
204
211
|
if (!pair.baseStory) {
|
|
205
212
|
unprocessedStories.push({
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
//#region src/redlineOperationLimit.d.ts
|
|
2
|
+
declare const MAX_GENERATED_REDLINE_OPERATIONS = 10000;
|
|
3
|
+
declare const GenerateRedlineDocxOperationLimitError_base: import("better-result").TaggedErrorClass<"GenerateRedlineDocxOperationLimitError">;
|
|
4
|
+
declare class GenerateRedlineDocxOperationLimitError extends GenerateRedlineDocxOperationLimitError_base<{
|
|
5
|
+
message: string;
|
|
6
|
+
}> {}
|
|
7
|
+
//#endregion
|
|
8
|
+
export { GenerateRedlineDocxOperationLimitError, MAX_GENERATED_REDLINE_OPERATIONS };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { TaggedError } from "better-result";
|
|
2
|
+
//#region src/redlineOperationLimit.ts
|
|
3
|
+
const MAX_GENERATED_REDLINE_OPERATIONS = 1e4;
|
|
4
|
+
var GenerateRedlineDocxOperationLimitError = class extends TaggedError("GenerateRedlineDocxOperationLimitError") {};
|
|
5
|
+
//#endregion
|
|
6
|
+
export { GenerateRedlineDocxOperationLimitError, MAX_GENERATED_REDLINE_OPERATIONS };
|
package/dist/server.d.ts
CHANGED
|
@@ -20,10 +20,10 @@ import { FOLIO_DOCX_CONFORMANCE_CHECKS, FOLIO_DOCX_CONFORMANCE_ISSUE_CODES, FOLI
|
|
|
20
20
|
import { ApplyDocxXmlPatchProposalArgs, FOLIO_DOCX_XML_PATCH_APPLICATION_PROFILE, FOLIO_DOCX_XML_PATCH_APPLICATION_VERSION, FolioDocxXmlPatchApplication, FolioDocxXmlPatchApplicationError, FolioDocxXmlPatchApplicationReceipt, UnsupportedFolioDocxXmlPatchApplicationProfileError, applyDocxXmlPatchProposal } from "./docx/server/applyDocxXmlPatchProposal.js";
|
|
21
21
|
import { HEADING_LEVELS, HeadingLevel, InvalidFolioReportBuilderOptionsError, TableCellSpec, bookmark, createTableOfContentsField, endnote, heading, hyperlink, pageBreak, paragraph, run, table } from "./docx/server/build.js";
|
|
22
22
|
import { BilingualBorders, BilingualParagraphRef, BilingualRow, BilingualRowKind, BilingualTableParagraphRef, CreateBilingualDocumentOptions, CreateBilingualDocumentResult, InvalidBilingualDocumentOptionsError, createBilingualDocument, readBilingualDocument } from "./docx/server/createBilingualDocument.js";
|
|
23
|
-
import { CreateBilingualDocxResult, createBilingualDocx, readBilingualDocx } from "./docx/server/createBilingualDocx.js";
|
|
23
|
+
import { CreateBilingualDocxOptions, CreateBilingualDocxResult, createBilingualDocx, readBilingualDocx } from "./docx/server/createBilingualDocx.js";
|
|
24
24
|
import { docxToMarkdown } from "./docx/server/docxToMarkdown.js";
|
|
25
25
|
import { DocxParagraphSource, DocxTableRowKind, DocxTableRowPosition, ExtractedDocxParagraph, ExtractedDocxTableCell, ExtractedDocxTableCellParagraph, ExtractedDocxText, extractDocxText } from "./docx/server/extractDocxText.js";
|
|
26
26
|
import { FOLIO_DOCX_PACKAGE_INSPECTION_DEFAULTS, FOLIO_DOCX_PACKAGE_INSPECTION_ERROR_CODES, FOLIO_DOCX_PACKAGE_INSPECTION_VERSION, FolioDocxInspectedXmlPart, FolioDocxPackageInspection, FolioDocxPackageInspectionError, FolioDocxPackageInspectionErrorCode, FolioDocxPackageInspectionLimits, FolioDocxPackagePart, FolioDocxPackagePartKind, InspectDocxPackageOptions, inspectDocxPackage } from "./docx/server/inspectDocxPackage.js";
|
|
27
27
|
import { GenerateRedlineDocxOptions, GenerateRedlineDocxResult, GenerateRedlineUnprocessedStory, InvalidGenerateRedlineDocxOptionsError, generateRedlineDocx } from "./redline.js";
|
|
28
28
|
import { FOLIO_VERSION_COMPARISON_PRIVACY_TRANSFORMS, FOLIO_VERSION_COMPARISON_SCOPES, FolioBlockDiff, FolioCompareDocxVersionsOptions, FolioDocumentMetadataValue, FolioFormatProperty, FolioMetadataDiff, FolioStoryDiff, FolioVersionBlockHandle, FolioVersionComparisonPrivacyTransform, FolioVersionComparisonScope, FolioVersionDiff, FolioVersionDiffPrivacyOptions, FolioVersionDiffPrivacyReport, FolioVersionDiffSegment, FolioVersionDiffSummaryCounts, InvalidFolioVersionComparisonOptionsError, applyFolioVersionDiffPrivacy, compareDocxVersions, isFolioVersionComparisonPrivacyTransform, isFolioVersionComparisonScope } from "./version-comparison.js";
|
|
29
|
-
export { type ApplyDocxXmlPatchProposalArgs, type ApplyFolioAIEditsToBufferOptions, type ApplyFolioAIEditsToBufferResult, type BilingualBorders, type BilingualParagraphRef, type BilingualRow, type BilingualRowKind, type BilingualTableParagraphRef, type CreateBilingualDocumentOptions, type CreateBilingualDocumentResult, type CreateBilingualDocxResult, type CreateCommentReplyInput, type CreateEmptyDocumentOptions, DOCUMENT_PRESET_VERSION, DOCUMENT_STYLE_SET_VERSION, type DeriveBlockIdInput, type DocumentPreset, type DocumentStyleCatalog, type DocumentStyleCatalogEntry, type DocumentStyleSet, DocxArchiveError, type DocxArchiveOptions, type DocxParagraphSource, type DocxTableRowKind, type DocxTableRowPosition, EnsureParaIdsError, type EnsureParaIdsOptions, type EnsureParaIdsResult, type EvaluateDocxXmlPatchProposalArgs, type ExtractDocumentStyleSetOptions, type ExtractedDocxParagraph, type ExtractedDocxTableCell, type ExtractedDocxTableCellParagraph, type ExtractedDocxText, FOLIO_DOCUMENT_METADATA_PROPERTIES, 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_DOCUMENT_PRIVACY_TRANSFORMS, FOLIO_DOCX_CONFORMANCE_CHECKS, FOLIO_DOCX_CONFORMANCE_ISSUE_CODES, FOLIO_DOCX_CONFORMANCE_PROFILE, FOLIO_DOCX_CONFORMANCE_REPORT_VERSION, FOLIO_DOCX_PACKAGE_INSPECTION_DEFAULTS, FOLIO_DOCX_PACKAGE_INSPECTION_ERROR_CODES, FOLIO_DOCX_PACKAGE_INSPECTION_VERSION, FOLIO_DOCX_XML_PATCH_APPLICATION_PROFILE, FOLIO_DOCX_XML_PATCH_APPLICATION_VERSION, FOLIO_DOCX_XML_PATCH_PROPOSAL_DEFAULTS, FOLIO_DOCX_XML_PATCH_PROPOSAL_ISSUE_CODES, FOLIO_DOCX_XML_PATCH_PROPOSAL_PROFILE, FOLIO_DOCX_XML_PATCH_PROPOSAL_VERSION, FOLIO_RESOLVED_REVIEWED_VIEWS, FOLIO_REVIEWED_VIEWS, FOLIO_VERSION_COMPARISON_PRIVACY_TRANSFORMS, FOLIO_VERSION_COMPARISON_SCOPES, type FolioAIBlock, type FolioAIBlockAnchor, type FolioAIBlockKind, type FolioAIBlockPreviewRun, type FolioAIComment, type FolioAIEditApplyMode, type FolioAIEditApplyResult, type FolioAIEditOperation, type FolioAIEditPrecondition, type FolioAIEditSnapshot, type FolioAIInlineFormatting, type FolioAITextRangeHandle, type FolioApplyDocumentOperationsOptions, type FolioApplyDocumentOperationsToStoryOptions, type FolioApplyOperationsOptions, type FolioBlockDiff, type FolioBlockId, type FolioCompareDocxVersionsOptions, type FolioDocumentMetadataProperty, type FolioDocumentMetadataValue, type FolioDocumentNavigationTarget, type FolioDocumentOperation, type FolioDocumentOperationAffectedTarget, type FolioDocumentOperationBatch, type FolioDocumentOperationCapabilities, type FolioDocumentOperationIssue, type FolioDocumentOperationMode, type FolioDocumentOperationPrecondition, type FolioDocumentOperationReceipt, type FolioDocumentOperationRecovery, type FolioDocumentOperationResult, type FolioDocumentOperationStatus, type FolioDocumentOperationStory, type FolioDocumentOperationType, type FolioDocumentOperationUndoFailureReason, type FolioDocumentOperationUndoHandle, type FolioDocumentOperationUndoResult, type FolioDocumentOutline, type FolioDocumentOutlineEntry, FolioDocumentPrivacyArchiveError, type FolioDocumentPrivacyOptions, type FolioDocumentPrivacyReport, type FolioDocumentPrivacyTransform, type FolioDocumentSection, type FolioDocumentSectionHandle, type FolioDocumentSectionReadResult, type FolioDocumentStory, type FolioDocumentStoryHandle, FolioDocumentStoryNotFoundError, type FolioDocxConformanceCheck, type FolioDocxConformanceCheckId, type FolioDocxConformanceCheckStatus, type FolioDocxConformanceIssue, type FolioDocxConformanceIssueCode, type FolioDocxConformanceReport, type FolioDocxConformanceStatus, type FolioDocxInspectedXmlPart, type FolioDocxPackageInspection, FolioDocxPackageInspectionError, type FolioDocxPackageInspectionErrorCode, type FolioDocxPackageInspectionLimits, type FolioDocxPackagePart, type FolioDocxPackagePartKind, type FolioDocxPreparedXmlReplacement, FolioDocxReviewer, type FolioDocxReviewerOptions, type FolioDocxXmlPatchApplication, FolioDocxXmlPatchApplicationError, type FolioDocxXmlPatchApplicationReceipt, type FolioDocxXmlPatchProposal, type FolioDocxXmlPatchProposalEvaluation, type FolioDocxXmlPatchProposalIssue, type FolioDocxXmlPatchProposalIssueCode, type FolioDocxXmlPatchProposalLimits, type FolioDocxXmlReplacement, type FolioEditableDocumentStoryHandle, type FolioFormatProperty, type FolioMetadataDiff, type FolioReadReviewedStoryOptions, type FolioResolveReviewedStoryOptions, type FolioResolvedReviewedView, type FolioReviewChange, type FolioReviewChangeFilter, type FolioReviewChangeKind, type FolioReviewComment, type FolioReviewCommentFilter, type FolioReviewCommentReply, type FolioReviewReplyInput, type FolioReviewedStory, type FolioReviewedView, type FolioStoryDiff, type FolioVersionBlockHandle, type FolioVersionComparisonPrivacyTransform, type FolioVersionComparisonScope, type FolioVersionDiff, type FolioVersionDiffPrivacyOptions, type FolioVersionDiffPrivacyReport, type FolioVersionDiffSegment, type FolioVersionDiffSummaryCounts, type GenerateRedlineDocxOptions, type GenerateRedlineDocxResult, type GenerateRedlineUnprocessedStory, HEADING_LEVELS, type HeadingLevel, type InspectDocxPackageOptions, InvalidBilingualDocumentOptionsError, InvalidFolioDocumentOperationBatchError, InvalidFolioDocumentPrivacyOptionsError, InvalidFolioDocxXmlPatchProposalError, InvalidFolioDocxXmlPatchProposalOptionsError, InvalidFolioReportBuilderOptionsError, InvalidFolioVersionComparisonOptionsError, InvalidGenerateRedlineDocxOptionsError, type ParseOptions, type RewriteDocxMetadataPrivacyResult, STELLA_STYLE_SET_NAME, type TableCellSpec, UnsupportedFolioDocumentOperationVersionError, UnsupportedFolioDocxXmlPatchApplicationProfileError, UnsupportedFolioReviewedViewError, type ValidateDocxConformanceOptions, applyDocxXmlPatchProposal, applyFolioAIEditsToBuffer, applyFolioVersionDiffPrivacy, assertSupportedFolioDocumentOperationVersion, bookmark, compareDocxVersions, createBilingualDocument, createBilingualDocx, createDocx, createEmptyDocument, createFolioAITextRangeHandle, createStellaStyleDocumentPreset, createStellaStyleSet, createTableOfContentsField, deriveBlockId, docxToMarkdown, endnote, ensureParaIds, evaluateDocxXmlPatchProposal, extractDocumentStyleSet, extractDocumentStyleSetFromDocx, extractDocxText, generateRedlineDocx, getFolioDocumentOperationCapabilities, getFolioDocumentOperationIssues, getFolioDocumentOperationReceipts, getFolioDocumentOutline, getFolioParaIdFromBlockId, hashFolioAIBlockText, heading, hyperlink, inspectDocumentStyles, inspectDocumentStylesFromDocx, inspectDocxPackage, isFolioBlockId, isFolioDocumentOperationModeSupported, isFolioDocumentPrivacyTransform, isFolioResolvedReviewedView, isFolioReviewedView, isFolioVersionComparisonPrivacyTransform, isFolioVersionComparisonScope, isSequentialFolioBlockId, isSupportedFolioDocumentOperationVersion, normalizeFolioAIBlockText, pageBreak, paragraph, parseDocx, parseFolioDocumentOperationBatch, parseFolioDocxXmlPatchProposal, readBilingualDocument, readBilingualDocx, readFolioDocumentSection, replyToComment, rewriteDocxMetadataPrivacy, run, table, validateDocxConformance };
|
|
29
|
+
export { type ApplyDocxXmlPatchProposalArgs, type ApplyFolioAIEditsToBufferOptions, type ApplyFolioAIEditsToBufferResult, type BilingualBorders, type BilingualParagraphRef, type BilingualRow, type BilingualRowKind, type BilingualTableParagraphRef, type CreateBilingualDocumentOptions, type CreateBilingualDocumentResult, type CreateBilingualDocxOptions, type CreateBilingualDocxResult, type CreateCommentReplyInput, type CreateEmptyDocumentOptions, DOCUMENT_PRESET_VERSION, DOCUMENT_STYLE_SET_VERSION, type DeriveBlockIdInput, type DocumentPreset, type DocumentStyleCatalog, type DocumentStyleCatalogEntry, type DocumentStyleSet, DocxArchiveError, type DocxArchiveOptions, type DocxParagraphSource, type DocxTableRowKind, type DocxTableRowPosition, EnsureParaIdsError, type EnsureParaIdsOptions, type EnsureParaIdsResult, type EvaluateDocxXmlPatchProposalArgs, type ExtractDocumentStyleSetOptions, type ExtractedDocxParagraph, type ExtractedDocxTableCell, type ExtractedDocxTableCellParagraph, type ExtractedDocxText, FOLIO_DOCUMENT_METADATA_PROPERTIES, 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_DOCUMENT_PRIVACY_TRANSFORMS, FOLIO_DOCX_CONFORMANCE_CHECKS, FOLIO_DOCX_CONFORMANCE_ISSUE_CODES, FOLIO_DOCX_CONFORMANCE_PROFILE, FOLIO_DOCX_CONFORMANCE_REPORT_VERSION, FOLIO_DOCX_PACKAGE_INSPECTION_DEFAULTS, FOLIO_DOCX_PACKAGE_INSPECTION_ERROR_CODES, FOLIO_DOCX_PACKAGE_INSPECTION_VERSION, FOLIO_DOCX_XML_PATCH_APPLICATION_PROFILE, FOLIO_DOCX_XML_PATCH_APPLICATION_VERSION, FOLIO_DOCX_XML_PATCH_PROPOSAL_DEFAULTS, FOLIO_DOCX_XML_PATCH_PROPOSAL_ISSUE_CODES, FOLIO_DOCX_XML_PATCH_PROPOSAL_PROFILE, FOLIO_DOCX_XML_PATCH_PROPOSAL_VERSION, FOLIO_RESOLVED_REVIEWED_VIEWS, FOLIO_REVIEWED_VIEWS, FOLIO_VERSION_COMPARISON_PRIVACY_TRANSFORMS, FOLIO_VERSION_COMPARISON_SCOPES, type FolioAIBlock, type FolioAIBlockAnchor, type FolioAIBlockKind, type FolioAIBlockPreviewRun, type FolioAIComment, type FolioAIEditApplyMode, type FolioAIEditApplyResult, type FolioAIEditOperation, type FolioAIEditPrecondition, type FolioAIEditSnapshot, type FolioAIInlineFormatting, type FolioAITextRangeHandle, type FolioApplyDocumentOperationsOptions, type FolioApplyDocumentOperationsToStoryOptions, type FolioApplyOperationsOptions, type FolioBlockDiff, type FolioBlockId, type FolioCompareDocxVersionsOptions, type FolioDocumentMetadataProperty, type FolioDocumentMetadataValue, type FolioDocumentNavigationTarget, type FolioDocumentOperation, type FolioDocumentOperationAffectedTarget, type FolioDocumentOperationBatch, type FolioDocumentOperationCapabilities, type FolioDocumentOperationIssue, type FolioDocumentOperationMode, type FolioDocumentOperationPrecondition, type FolioDocumentOperationReceipt, type FolioDocumentOperationRecovery, type FolioDocumentOperationResult, type FolioDocumentOperationStatus, type FolioDocumentOperationStory, type FolioDocumentOperationType, type FolioDocumentOperationUndoFailureReason, type FolioDocumentOperationUndoHandle, type FolioDocumentOperationUndoResult, type FolioDocumentOutline, type FolioDocumentOutlineEntry, FolioDocumentPrivacyArchiveError, type FolioDocumentPrivacyOptions, type FolioDocumentPrivacyReport, type FolioDocumentPrivacyTransform, type FolioDocumentSection, type FolioDocumentSectionHandle, type FolioDocumentSectionReadResult, type FolioDocumentStory, type FolioDocumentStoryHandle, FolioDocumentStoryNotFoundError, type FolioDocxConformanceCheck, type FolioDocxConformanceCheckId, type FolioDocxConformanceCheckStatus, type FolioDocxConformanceIssue, type FolioDocxConformanceIssueCode, type FolioDocxConformanceReport, type FolioDocxConformanceStatus, type FolioDocxInspectedXmlPart, type FolioDocxPackageInspection, FolioDocxPackageInspectionError, type FolioDocxPackageInspectionErrorCode, type FolioDocxPackageInspectionLimits, type FolioDocxPackagePart, type FolioDocxPackagePartKind, type FolioDocxPreparedXmlReplacement, FolioDocxReviewer, type FolioDocxReviewerOptions, type FolioDocxXmlPatchApplication, FolioDocxXmlPatchApplicationError, type FolioDocxXmlPatchApplicationReceipt, type FolioDocxXmlPatchProposal, type FolioDocxXmlPatchProposalEvaluation, type FolioDocxXmlPatchProposalIssue, type FolioDocxXmlPatchProposalIssueCode, type FolioDocxXmlPatchProposalLimits, type FolioDocxXmlReplacement, type FolioEditableDocumentStoryHandle, type FolioFormatProperty, type FolioMetadataDiff, type FolioReadReviewedStoryOptions, type FolioResolveReviewedStoryOptions, type FolioResolvedReviewedView, type FolioReviewChange, type FolioReviewChangeFilter, type FolioReviewChangeKind, type FolioReviewComment, type FolioReviewCommentFilter, type FolioReviewCommentReply, type FolioReviewReplyInput, type FolioReviewedStory, type FolioReviewedView, type FolioStoryDiff, type FolioVersionBlockHandle, type FolioVersionComparisonPrivacyTransform, type FolioVersionComparisonScope, type FolioVersionDiff, type FolioVersionDiffPrivacyOptions, type FolioVersionDiffPrivacyReport, type FolioVersionDiffSegment, type FolioVersionDiffSummaryCounts, type GenerateRedlineDocxOptions, type GenerateRedlineDocxResult, type GenerateRedlineUnprocessedStory, HEADING_LEVELS, type HeadingLevel, type InspectDocxPackageOptions, InvalidBilingualDocumentOptionsError, InvalidFolioDocumentOperationBatchError, InvalidFolioDocumentPrivacyOptionsError, InvalidFolioDocxXmlPatchProposalError, InvalidFolioDocxXmlPatchProposalOptionsError, InvalidFolioReportBuilderOptionsError, InvalidFolioVersionComparisonOptionsError, InvalidGenerateRedlineDocxOptionsError, type ParseOptions, type RewriteDocxMetadataPrivacyResult, STELLA_STYLE_SET_NAME, type TableCellSpec, UnsupportedFolioDocumentOperationVersionError, UnsupportedFolioDocxXmlPatchApplicationProfileError, UnsupportedFolioReviewedViewError, type ValidateDocxConformanceOptions, applyDocxXmlPatchProposal, applyFolioAIEditsToBuffer, applyFolioVersionDiffPrivacy, assertSupportedFolioDocumentOperationVersion, bookmark, compareDocxVersions, createBilingualDocument, createBilingualDocx, createDocx, createEmptyDocument, createFolioAITextRangeHandle, createStellaStyleDocumentPreset, createStellaStyleSet, createTableOfContentsField, deriveBlockId, docxToMarkdown, endnote, ensureParaIds, evaluateDocxXmlPatchProposal, extractDocumentStyleSet, extractDocumentStyleSetFromDocx, extractDocxText, generateRedlineDocx, getFolioDocumentOperationCapabilities, getFolioDocumentOperationIssues, getFolioDocumentOperationReceipts, getFolioDocumentOutline, getFolioParaIdFromBlockId, hashFolioAIBlockText, heading, hyperlink, inspectDocumentStyles, inspectDocumentStylesFromDocx, inspectDocxPackage, isFolioBlockId, isFolioDocumentOperationModeSupported, isFolioDocumentPrivacyTransform, isFolioResolvedReviewedView, isFolioReviewedView, isFolioVersionComparisonPrivacyTransform, isFolioVersionComparisonScope, isSequentialFolioBlockId, isSupportedFolioDocumentOperationVersion, normalizeFolioAIBlockText, pageBreak, paragraph, parseDocx, parseFolioDocumentOperationBatch, parseFolioDocxXmlPatchProposal, readBilingualDocument, readBilingualDocx, readFolioDocumentSection, replyToComment, rewriteDocxMetadataPrivacy, run, table, validateDocxConformance };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stll/folio-core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.27.0",
|
|
4
4
|
"description": "Headless, framework-neutral core of folio: the OOXML (.docx) parser, document model, ProseMirror integration, and page-layout engine. No React.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"document-model",
|