@stll/folio-core 0.37.5 → 0.39.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ai-edits/apply.js +275 -88
- package/dist/ai-edits/clean-text.js +12 -1
- package/dist/ai-edits/headless.d.ts +110 -0
- package/dist/ai-edits/headless.js +569 -40
- package/dist/ai-edits/snapshot.d.ts +24 -1
- package/dist/ai-edits/snapshot.js +206 -9
- package/dist/ai-edits/table-geometry.d.ts +7 -7
- package/dist/ai-edits/table-geometry.js +43 -27
- package/dist/ai-edits/table-template.d.ts +2 -1
- package/dist/ai-edits/table-template.js +9 -3
- package/dist/ai-edits/types.d.ts +37 -15
- package/dist/compare/__fixtures__/body-sequence.d.ts +4 -0
- package/dist/compare/__fixtures__/body-sequence.js +5 -3
- package/dist/compare/compare.d.ts +26 -2
- package/dist/compare/compare.js +444 -16
- package/dist/compare/content-alignment.js +3 -2
- package/dist/compare/content-types.d.ts +34 -2
- package/dist/compare/content.d.ts +13 -10
- package/dist/compare/content.js +69 -23
- package/dist/compare/formatting.d.ts +4 -22
- package/dist/compare/formatting.js +8 -112
- package/dist/compare/inline-atom-resources.d.ts +6 -0
- package/dist/compare/inline-atom-resources.js +26 -0
- package/dist/compare/inline-atoms.d.ts +35 -0
- package/dist/compare/inline-atoms.js +383 -0
- package/dist/compare/inline-provenance.d.ts +36 -0
- package/dist/compare/inline-provenance.js +334 -0
- package/dist/compare/plan.d.ts +4 -1
- package/dist/compare/plan.js +32 -4
- package/dist/compare/scenario.d.ts +4 -6
- package/dist/compare/section-boundary-properties.d.ts +63 -0
- package/dist/compare/section-boundary-properties.js +235 -0
- package/dist/compare/style-resources.d.ts +30 -0
- package/dist/compare/style-resources.js +404 -0
- package/dist/compare/types.d.ts +50 -11
- package/dist/compare/types.js +3 -1
- package/dist/compare/verification.d.ts +3 -5
- package/dist/compare/verification.js +8 -39
- package/dist/compat/eigenpal.d.ts +4 -4
- package/dist/compat/eigenpal.js +3 -3
- package/dist/controller/layoutPipeline.js +4 -0
- package/dist/display-list/build/buildContext.d.ts +3 -1
- package/dist/display-list/build/buildDisplayList.d.ts +4 -1
- package/dist/display-list/build/buildDisplayList.js +38 -4
- package/dist/display-list/build/commentAnnotations.d.ts +10 -0
- package/dist/display-list/build/commentAnnotations.js +17 -0
- package/dist/display-list/build/paragraphPrimitives.js +39 -1
- package/dist/display-list/primitives.d.ts +1 -1
- package/dist/display-list/types.d.ts +16 -1
- package/dist/document-operations.d.ts +5 -3
- package/dist/document-operations.js +112 -5
- package/dist/docx/blockContentParser.js +14 -2
- package/dist/docx/diagramPreview.d.ts +7 -0
- package/dist/docx/diagramPreview.js +191 -0
- package/dist/docx/drawingIdNormalization.js +43 -2
- package/dist/docx/drawingRelationships.d.ts +10 -0
- package/dist/docx/drawingRelationships.js +28 -0
- package/dist/docx/fieldParser.js +1 -1
- package/dist/docx/hyperlinkParser.js +3 -5
- package/dist/docx/imageRawXml.d.ts +8 -0
- package/dist/docx/imageRawXml.js +13 -0
- package/dist/docx/newImage.d.ts +2 -2
- package/dist/docx/newImage.js +3 -3
- package/dist/docx/numberingParser.js +30 -27
- package/dist/docx/paragraphParser.js +11 -4
- package/dist/docx/paragraphTextBoxEnrichment.js +2 -1
- package/dist/docx/parser.js +13 -0
- package/dist/docx/removeHeaderFooterParts.d.ts +14 -0
- package/dist/docx/removeHeaderFooterParts.js +87 -0
- package/dist/docx/rezip.d.ts +3 -1
- package/dist/docx/rezip.js +143 -41
- package/dist/docx/runParser.js +24 -5
- package/dist/docx/sectionParser.js +3 -0
- package/dist/docx/sectionReferenceHistory.d.ts +17 -0
- package/dist/docx/sectionReferenceHistory.js +59 -0
- package/dist/docx/selectiveSave.js +11 -31
- package/dist/docx/selectiveXmlPatch.d.ts +8 -1
- package/dist/docx/selectiveXmlPatch.js +62 -2
- package/dist/docx/serializer/paragraphSerializer.js +2 -0
- package/dist/docx/serializer/partNamespaces.d.ts +1 -1
- package/dist/docx/serializer/partNamespaces.js +4 -0
- package/dist/docx/serializer/runSerializer.js +5 -2
- package/dist/docx/serializer/sectionPropertiesSerializer.js +5 -2
- package/dist/docx/serializer/textFormattingSerializer.d.ts +1 -1
- package/dist/docx/serializer/textFormattingSerializer.js +3 -1
- package/dist/docx/tableParser.js +21 -11
- package/dist/docx/textBoxParser.js +25 -5
- package/dist/docx/xmlParser.d.ts +10 -1
- package/dist/docx/xmlParser.js +23 -1
- package/dist/export-pdf.js +2 -0
- package/dist/headless-layout.js +1 -0
- package/dist/index.d.ts +4 -4
- package/dist/index.js +3 -3
- package/dist/internal/compare/inline-presentation.d.ts +20 -0
- package/dist/internal/compare/inline-presentation.js +222 -0
- package/dist/internal/paragraphFormattingSerialization.d.ts +3 -1
- package/dist/internal/paragraphFormattingSerialization.js +8 -1
- package/dist/internal/sectionReferenceResolution.d.ts +21 -0
- package/dist/internal/sectionReferenceResolution.js +72 -0
- package/dist/layout-bridge/convert/toFlowBlocks.js +1 -0
- package/dist/layout-engine/index.js +5 -5
- package/dist/layout-engine/sectionVerticalAlignment.d.ts +7 -0
- package/dist/layout-engine/sectionVerticalAlignment.js +52 -0
- package/dist/layout-engine/types.d.ts +3 -1
- package/dist/markdown/renderRuns.js +1 -0
- package/dist/markdown/renderTable.js +1 -0
- package/dist/pdf/writePdf.js +37 -2
- package/dist/prosemirror/attrs/index.js +55 -1
- package/dist/prosemirror/commands/comments.d.ts +11 -1
- package/dist/prosemirror/commands/comments.js +68 -6
- package/dist/prosemirror/commands/propertyChangeScope.d.ts +9 -3
- package/dist/prosemirror/commands/propertyChangeScope.js +4 -10
- package/dist/prosemirror/conversion/fromProseDoc.js +17 -8
- package/dist/prosemirror/conversion/toProseDoc.js +18 -57
- package/dist/prosemirror/extensions/core/ParagraphExtension.js +2 -0
- package/dist/prosemirror/extensions/marks/RunFormattingOverrideExtension.js +3 -0
- package/dist/prosemirror/extensions/nodes/TextBoxExtension.d.ts +2 -1
- package/dist/prosemirror/extensions/nodes/TextBoxExtension.js +39 -1
- package/dist/prosemirror/imageCommit.js +7 -9
- package/dist/prosemirror/paragraphIndentation.d.ts +21 -0
- package/dist/prosemirror/paragraphIndentation.js +72 -0
- package/dist/prosemirror/plugins/documentNumbering.d.ts +3 -1
- package/dist/prosemirror/plugins/documentNumbering.js +7 -1
- package/dist/prosemirror/plugins/documentStyles.d.ts +3 -1
- package/dist/prosemirror/plugins/documentStyles.js +7 -1
- package/dist/prosemirror/rebaseParagraphRunFormatting.d.ts +3 -1
- package/dist/prosemirror/rebaseParagraphRunFormatting.js +2 -1
- package/dist/prosemirror/runFormattingInlineCarriers.d.ts +15 -2
- package/dist/prosemirror/runFormattingInlineCarriers.js +33 -3
- package/dist/prosemirror/runStyleFormatting.d.ts +15 -2
- package/dist/prosemirror/runStyleFormatting.js +76 -2
- package/dist/prosemirror/schema/marks.d.ts +3 -1
- package/dist/prosemirror/schema/marks.js +2 -0
- package/dist/prosemirror/schema/nodes.d.ts +5 -0
- package/dist/prosemirror/tableCellRevisionVisibility.d.ts +6 -0
- package/dist/prosemirror/tableCellRevisionVisibility.js +14 -0
- package/dist/prosemirror/trackedRunInlineAtoms.d.ts +1 -1
- package/dist/prosemirror/trackedRunInlineAtoms.js +1 -1
- package/dist/redline.js +15 -2
- package/dist/server.d.ts +2 -2
- package/dist/server.js +2 -2
- package/dist/version-comparison.d.ts +2 -0
- package/dist/version-comparison.js +7 -2
- package/package.json +2 -2
|
@@ -2,6 +2,9 @@ import { document_d_exports } from "../types/document.js";
|
|
|
2
2
|
import { FolioTableTemplates } from "./table-template.js";
|
|
3
3
|
import { FolioAIBlock, FolioAIEditApplyMode, FolioAIEditApplyResult, FolioAIEditOperation, FolioAIEditSnapshot } from "./types.js";
|
|
4
4
|
import { FolioRevisionStamp, FolioWordDiffOptions } from "./apply.js";
|
|
5
|
+
import { ImportReferencedStyleDefinitionsResult } from "../compare/style-resources.js";
|
|
6
|
+
import { InlineProvenanceTargetOptions } from "../compare/inline-provenance.js";
|
|
7
|
+
import { MatchInlineAtomsOptions } from "../compare/inline-atoms.js";
|
|
5
8
|
import { FolioDocumentOperationBatch, FolioDocumentOperationResult, FolioDocumentOperationUndoHandle, FolioDocumentOperationUndoResult } from "../document-operations.js";
|
|
6
9
|
import { FolioReviewChange, FolioReviewChangeKind } from "./read.js";
|
|
7
10
|
import { FolioStoryTable } from "./snapshot.js";
|
|
@@ -122,6 +125,9 @@ type FolioApplyDocumentOperationsToStoryOptions = FolioApplyDocumentOperationsOp
|
|
|
122
125
|
*/
|
|
123
126
|
tableTemplates?: FolioTableTemplates;
|
|
124
127
|
};
|
|
128
|
+
type FolioHeaderFooterStoryHandle = Extract<FolioEditableDocumentStoryHandle, {
|
|
129
|
+
type: "header" | "footer";
|
|
130
|
+
}>;
|
|
125
131
|
type FolioDocxComparisonProjectionMode = "with-revision-census" | "without-revision-census";
|
|
126
132
|
type FolioDocxComparisonStoryProjection = {
|
|
127
133
|
handle: FolioDocumentStoryHandle;
|
|
@@ -134,9 +140,86 @@ type FolioDocxComparisonProjection = {
|
|
|
134
140
|
present: boolean;
|
|
135
141
|
};
|
|
136
142
|
};
|
|
143
|
+
type MatchStoryInlineProvenanceOptions = InlineProvenanceTargetOptions & {
|
|
144
|
+
story: FolioEditableDocumentStoryHandle;
|
|
145
|
+
};
|
|
146
|
+
type StoryInlineProvenanceResult = {
|
|
147
|
+
status: "matched";
|
|
148
|
+
nextRevisionId: number;
|
|
149
|
+
changedTargetBlockIds: readonly string[];
|
|
150
|
+
rangeCount: number;
|
|
151
|
+
documentChanged: boolean;
|
|
152
|
+
} | {
|
|
153
|
+
status: "unalignable";
|
|
154
|
+
} | {
|
|
155
|
+
status: "budget-exceeded";
|
|
156
|
+
};
|
|
157
|
+
type MatchStoryInlineAtomsOptions = Omit<MatchInlineAtomsOptions, "state" | "author"> & {
|
|
158
|
+
story: FolioEditableDocumentStoryHandle;
|
|
159
|
+
};
|
|
160
|
+
type StoryInlineAtomsResult = {
|
|
161
|
+
status: "matched";
|
|
162
|
+
nextRevisionId: number;
|
|
163
|
+
changedTargetBlockIds: readonly string[];
|
|
164
|
+
rangeCount: number;
|
|
165
|
+
documentChanged: boolean;
|
|
166
|
+
} | {
|
|
167
|
+
status: "unalignable";
|
|
168
|
+
} | {
|
|
169
|
+
status: "budget-exceeded";
|
|
170
|
+
};
|
|
171
|
+
type StageTargetNumberingResult = "unchanged" | "staged" | "conflict";
|
|
137
172
|
type FolioDocxComparisonAccess = {
|
|
173
|
+
stageTerminalTableReviewCarrier: (target: Node) => boolean;
|
|
174
|
+
stageTargetStyles: (source: FolioDocxReviewer, snapshots: readonly FolioAIEditSnapshot[], importedHeaderFooterSnapshots: readonly FolioAIEditSnapshot[]) => ImportReferencedStyleDefinitionsResult;
|
|
175
|
+
createComparisonHeaderFooter: (source: FolioDocxReviewer, story: FolioHeaderFooterStoryHandle) => Promise<FolioHeaderFooterStoryHandle | null>;
|
|
176
|
+
matchInlineAtoms: (options: MatchStoryInlineAtomsOptions) => StoryInlineAtomsResult;
|
|
177
|
+
matchInlineProvenance: (options: MatchStoryInlineProvenanceOptions) => StoryInlineProvenanceResult;
|
|
138
178
|
projectStories: (mode: FolioDocxComparisonProjectionMode) => FolioDocxComparisonProjection;
|
|
139
179
|
snapshotReviewedStory: (options?: FolioReadReviewedStoryOptions) => FolioAIEditSnapshot | null;
|
|
180
|
+
numberingDefinitions: () => document_d_exports.NumberingDefinitions | null | undefined;
|
|
181
|
+
planTargetNumberingReferences: (target: document_d_exports.NumberingDefinitions | null | undefined, references: readonly {
|
|
182
|
+
numId: number;
|
|
183
|
+
level: number;
|
|
184
|
+
}[]) => ReadonlyMap<number, number> | null;
|
|
185
|
+
stageTargetNumbering: (target: document_d_exports.NumberingDefinitions | null | undefined, references: readonly {
|
|
186
|
+
numId: number;
|
|
187
|
+
level: number;
|
|
188
|
+
}[], remappedNumIds: ReadonlyMap<number, number>) => StageTargetNumberingResult;
|
|
189
|
+
finalSectionProperties: () => document_d_exports.SectionProperties | undefined;
|
|
190
|
+
stageFinalSectionProperties: (options: {
|
|
191
|
+
target: document_d_exports.SectionProperties;
|
|
192
|
+
previous: document_d_exports.SectionProperties;
|
|
193
|
+
revision: FolioRevisionStamp;
|
|
194
|
+
}) => boolean;
|
|
195
|
+
stageMappedSectionBoundaries: (options: {
|
|
196
|
+
target: Node;
|
|
197
|
+
originalRevisionIdSeed: number;
|
|
198
|
+
maxRanges: number;
|
|
199
|
+
revision: FolioRevisionStamp;
|
|
200
|
+
mapTargetProperties: (args: {
|
|
201
|
+
kind: "inserted" | "retained";
|
|
202
|
+
current: document_d_exports.SectionProperties | undefined;
|
|
203
|
+
target: document_d_exports.SectionProperties;
|
|
204
|
+
}) => {
|
|
205
|
+
kind: "inserted";
|
|
206
|
+
target: document_d_exports.SectionProperties;
|
|
207
|
+
} | {
|
|
208
|
+
kind: "retained";
|
|
209
|
+
previous: document_d_exports.SectionProperties;
|
|
210
|
+
target: document_d_exports.SectionProperties;
|
|
211
|
+
} | null;
|
|
212
|
+
}) => {
|
|
213
|
+
status: "matched";
|
|
214
|
+
rangeCount: number;
|
|
215
|
+
nextRevisionId: number;
|
|
216
|
+
documentChanged: boolean;
|
|
217
|
+
} | {
|
|
218
|
+
status: "unalignable";
|
|
219
|
+
detail: string;
|
|
220
|
+
} | {
|
|
221
|
+
status: "budget-exceeded";
|
|
222
|
+
};
|
|
140
223
|
};
|
|
141
224
|
declare const isFolioReviewedView: (value: unknown) => value is FolioReviewedView;
|
|
142
225
|
declare const isFolioResolvedReviewedView: (value: unknown) => value is FolioResolvedReviewedView;
|
|
@@ -198,9 +281,16 @@ declare class FolioDocxReviewer {
|
|
|
198
281
|
/** Default author for tracked changes and comments. */
|
|
199
282
|
readonly author: string;
|
|
200
283
|
private readonly baseDocument;
|
|
284
|
+
private finalSectionPropertiesOverride;
|
|
201
285
|
private readonly originalBuffer;
|
|
202
286
|
private state;
|
|
203
287
|
private readonly secondaryStoryStates;
|
|
288
|
+
private readonly removedHeaderFooterStories;
|
|
289
|
+
private readonly sectionReferenceRemovals;
|
|
290
|
+
private importedStyles;
|
|
291
|
+
private readonly importedMedia;
|
|
292
|
+
private readonly importedHeaders;
|
|
293
|
+
private readonly importedFooters;
|
|
204
294
|
private readonly resolvedStoryExpectations;
|
|
205
295
|
private readonly createdComments;
|
|
206
296
|
private readonly usedCommentIds;
|
|
@@ -215,6 +305,16 @@ declare class FolioDocxReviewer {
|
|
|
215
305
|
*/
|
|
216
306
|
private readonly resolvedOverrides;
|
|
217
307
|
private constructor();
|
|
308
|
+
private stageTargetStyles;
|
|
309
|
+
/**
|
|
310
|
+
* A raw final table has no paragraph mark after it for Word to merge into
|
|
311
|
+
* when the target ends in a paragraph. Folio-exact comparison adds this
|
|
312
|
+
* untracked receiver before planning; its private marker makes resolving in
|
|
313
|
+
* Folio restore the raw source view.
|
|
314
|
+
*/
|
|
315
|
+
private stageTerminalTableReviewCarrier;
|
|
316
|
+
private stageTargetNumbering;
|
|
317
|
+
private planTargetNumberingReferences;
|
|
218
318
|
/** Parse a `.docx` buffer into a reviewer. */
|
|
219
319
|
static fromBuffer(buffer: ArrayBuffer, options?: FolioDocxReviewerOptions): Promise<FolioDocxReviewer>;
|
|
220
320
|
/**
|
|
@@ -354,6 +454,10 @@ declare class FolioDocxReviewer {
|
|
|
354
454
|
resolveComment(commentId: string, options?: {
|
|
355
455
|
resolved?: boolean;
|
|
356
456
|
}): boolean;
|
|
457
|
+
private currentFinalSectionProperties;
|
|
458
|
+
private stageFinalSectionProperties;
|
|
459
|
+
private stageMappedSectionBoundaries;
|
|
460
|
+
private resolveFinalSectionProperties;
|
|
357
461
|
/**
|
|
358
462
|
* Accept an existing tracked change, keeping its text and dropping the
|
|
359
463
|
* redline. Pass a {@link FolioReviewChange} from {@link getChanges} or its
|
|
@@ -362,11 +466,13 @@ declare class FolioDocxReviewer {
|
|
|
362
466
|
* revision is no longer present (already resolved, or never existed).
|
|
363
467
|
*/
|
|
364
468
|
acceptChange(target: FolioReviewChange | number): boolean;
|
|
469
|
+
private acceptChangeInternal;
|
|
365
470
|
/**
|
|
366
471
|
* Reject an existing tracked change: an insertion's text is removed, a
|
|
367
472
|
* deletion's text is restored. See {@link acceptChange} for targeting.
|
|
368
473
|
*/
|
|
369
474
|
rejectChange(target: FolioReviewChange | number): boolean;
|
|
475
|
+
private rejectChangeInternal;
|
|
370
476
|
/**
|
|
371
477
|
* Accept every tracked change in the package. Returns the number of changes
|
|
372
478
|
* present before the sweep.
|
|
@@ -378,6 +484,8 @@ declare class FolioDocxReviewer {
|
|
|
378
484
|
acceptAll(): number;
|
|
379
485
|
/** Reject every tracked change in the package. See {@link acceptAll}. */
|
|
380
486
|
rejectAll(): number;
|
|
487
|
+
private resolveWithSectionReferenceHistory;
|
|
488
|
+
private resolveEveryFinalSectionChange;
|
|
381
489
|
private resolveEveryStory;
|
|
382
490
|
/** The current document model with edits merged back in. */
|
|
383
491
|
toDocument(): document_d_exports.Document;
|
|
@@ -403,6 +511,8 @@ declare class FolioDocxReviewer {
|
|
|
403
511
|
private requireEditableStoryState;
|
|
404
512
|
private setEditableStoryState;
|
|
405
513
|
private getHeaderFooterStory;
|
|
514
|
+
private createComparisonHeaderFooter;
|
|
515
|
+
private canImportHeaderFooterContent;
|
|
406
516
|
private getNoteStory;
|
|
407
517
|
private getHeaderFooterStoryText;
|
|
408
518
|
private getNoteStoryText;
|