@stll/folio-core 0.35.1 → 0.37.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 +59 -1
- package/dist/ai-edits/apply.js +878 -377
- package/dist/ai-edits/block-identity.d.ts +4 -1
- package/dist/ai-edits/block-identity.js +4 -1
- package/dist/ai-edits/blockRange.js +14 -14
- package/dist/ai-edits/clean-text.d.ts +40 -1
- package/dist/ai-edits/clean-text.js +52 -2
- package/dist/ai-edits/headless.d.ts +3 -1
- package/dist/ai-edits/headless.js +141 -73
- package/dist/ai-edits/index.d.ts +3 -3
- package/dist/ai-edits/index.js +2 -2
- package/dist/ai-edits/read.js +38 -20
- package/dist/ai-edits/snapshot.d.ts +14 -6
- package/dist/ai-edits/snapshot.js +105 -20
- package/dist/ai-edits/table-cell-mutations.js +1 -1
- package/dist/ai-edits/table-row-column-mutations.js +7 -0
- package/dist/ai-edits/table-template.d.ts +11 -1
- package/dist/ai-edits/table-template.js +49 -17
- package/dist/ai-edits/types.d.ts +62 -61
- package/dist/ai-edits/word-diff.d.ts +18 -3
- package/dist/ai-edits/word-diff.js +556 -67
- package/dist/ai-suggestions/conflict.js +1 -4
- package/dist/ai-suggestions/text-positions.d.ts +8 -0
- package/dist/ai-suggestions/text-positions.js +27 -5
- package/dist/compare/__fixtures__/body-sequence.js +3 -4
- package/dist/compare/column-alignment.d.ts +13 -13
- package/dist/compare/column-alignment.js +78 -39
- package/dist/compare/compare.d.ts +4 -3
- package/dist/compare/compare.js +48 -21
- package/dist/compare/content-alignment.d.ts +95 -0
- package/dist/compare/content-alignment.js +1450 -0
- package/dist/compare/content-types.d.ts +100 -0
- package/dist/compare/content-types.js +0 -0
- package/dist/compare/content.d.ts +209 -0
- package/dist/compare/content.js +885 -0
- package/dist/compare/formatting.d.ts +5 -5
- package/dist/compare/formatting.js +6 -4
- package/dist/compare/plan.d.ts +6 -1
- package/dist/compare/plan.js +171 -566
- package/dist/compare/scenario.d.ts +2 -2
- package/dist/compare/types.d.ts +3 -3
- package/dist/compare/verification.d.ts +8 -9
- package/dist/compare/verification.js +72 -50
- package/dist/compat/eigenpal.d.ts +5 -3
- package/dist/compat/eigenpal.js +3 -2
- package/dist/controller/headerFooterEditorManager.js +18 -10
- package/dist/controller/hiddenEditorApi.js +1 -1
- package/dist/controller/hiddenEditorManager.d.ts +7 -2
- package/dist/controller/hiddenEditorManager.js +15 -6
- package/dist/controller/layoutPipeline.js +5 -3
- package/dist/controller/noteEditorManager.js +12 -7
- package/dist/display-list/build/headerFooterPrimitives.js +1 -0
- package/dist/display-list/build/storyPrimitives.d.ts +5 -2
- package/dist/display-list/build/storyPrimitives.js +60 -3
- package/dist/display-list/build/tablePrimitives.js +30 -0
- package/dist/display-list/primitives.d.ts +1 -1
- package/dist/document-operations.d.ts +8 -4
- package/dist/document-operations.js +104 -12
- package/dist/docx/blockContentParser.js +6 -27
- package/dist/docx/commentParser.js +2 -4
- package/dist/docx/commentRangeIntegrity.js +2 -4
- package/dist/docx/documentClone.d.ts +2 -0
- package/dist/docx/documentClone.js +2 -0
- package/dist/docx/ensureParaIds.js +9 -4
- package/dist/docx/headerFooterParser.js +2 -4
- package/dist/docx/normalizeBaseDirection.js +5 -7
- package/dist/docx/numberingParser.d.ts +3 -1
- package/dist/docx/numberingParser.js +4 -1
- package/dist/docx/paragraphParser.js +34 -35
- package/dist/docx/paragraphPropertySource.d.ts +49 -0
- package/dist/docx/paragraphPropertySource.js +113 -0
- package/dist/docx/paragraphTraversal.js +30 -34
- package/dist/docx/rezip.d.ts +0 -8
- package/dist/docx/rezip.js +41 -16
- package/dist/docx/runConsolidator.js +2 -4
- package/dist/docx/runParser.js +6 -17
- package/dist/docx/sectionParser.js +1 -15
- package/dist/docx/serializer/paragraphSerializer.js +289 -30
- package/dist/docx/serializer/runSerializer.js +6 -12
- package/dist/docx/serializer/sectionPropertiesSerializer.js +2 -10
- package/dist/docx/serializer/tableSerializer.js +4 -23
- package/dist/docx/serializer/trackedChangeAttributes.d.ts +11 -0
- package/dist/docx/serializer/trackedChangeAttributes.js +31 -0
- package/dist/docx/server/build.d.ts +1 -1
- package/dist/docx/server/createBilingualDocument.js +8 -10
- package/dist/docx/server/evaluateDocxXmlPatchProposal.js +22 -13
- package/dist/docx/server/validateDocxConformance.js +17 -13
- package/dist/docx/tableParser.js +1 -37
- package/dist/docx/trackedChangeInfo.d.ts +11 -0
- package/dist/docx/trackedChangeInfo.js +38 -0
- package/dist/docx/verbatimCapture.d.ts +20 -9
- package/dist/docx/verbatimCapture.js +208 -8
- package/dist/docx/xmlParser.d.ts +3 -1
- package/dist/docx/xmlParser.js +6 -1
- package/dist/docx/xmlSafety.d.ts +1 -1
- package/dist/docx/xmlSafety.js +157 -0
- package/dist/headless-layout.js +5 -4
- package/dist/index.d.ts +5 -3
- package/dist/index.js +3 -2
- package/dist/internal/headlessRevisionResolution.d.ts +23 -0
- package/dist/internal/headlessRevisionResolution.js +155 -0
- package/dist/internal/headlessRevisionResolutionGuard.d.ts +12 -0
- package/dist/internal/headlessRevisionResolutionGuard.js +28 -0
- package/dist/internal/pageBreakRunDescendantIndex.d.ts +9 -0
- package/dist/internal/pageBreakRunDescendantIndex.js +27 -0
- package/dist/internal/pageBreakRunPartition.d.ts +26 -0
- package/dist/internal/pageBreakRunPartition.js +35 -0
- package/dist/internal/pageBreakRunSourceDescendantIndex.d.ts +15 -0
- package/dist/internal/pageBreakRunSourceDescendantIndex.js +126 -0
- package/dist/internal/sectionEndpointResolution.d.ts +32 -0
- package/dist/internal/sectionEndpointResolution.js +38 -0
- package/dist/layout-bridge/convert/footnoteLayout.js +1 -0
- package/dist/layout-bridge/convert/headerFooterLayout.d.ts +16 -4
- package/dist/layout-bridge/convert/headerFooterLayout.js +52 -9
- package/dist/layout-bridge/convert/toFlowBlocks.d.ts +4 -0
- package/dist/layout-bridge/convert/toFlowBlocks.js +391 -82
- package/dist/layout-bridge/dom/clickToPositionDom.d.ts +8 -1
- package/dist/layout-bridge/dom/clickToPositionDom.js +114 -40
- package/dist/layout-bridge/dom/textStreamDom.d.ts +24 -0
- package/dist/layout-bridge/dom/textStreamDom.js +75 -0
- package/dist/layout-bridge/headerFooterLayout.js +16 -30
- package/dist/layout-engine/index.js +12 -3
- package/dist/layout-engine/measure/tableFragmentBorderGeometry.d.ts +17 -0
- package/dist/layout-engine/measure/tableFragmentBorderGeometry.js +24 -0
- package/dist/layout-engine/renderedBreakReconciliation.js +1 -1
- package/dist/layout-engine/types.d.ts +7 -0
- package/dist/layout-painter/imageLayout.d.ts +1 -1
- package/dist/layout-painter/renderTable.js +20 -0
- package/dist/markdown/renderBlock.js +7 -10
- package/dist/model.d.ts +1 -1
- package/dist/paged-layout/rangeProjection.js +6 -9
- package/dist/paged-layout/transactionDirtyRange.d.ts +3 -1
- package/dist/paged-layout/transactionDirtyRange.js +23 -1
- package/dist/prosemirror/attrs/index.d.ts +7 -3
- package/dist/prosemirror/attrs/index.js +128 -7
- package/dist/prosemirror/bookmarkBoundaryIntegrity.d.ts +9 -0
- package/dist/prosemirror/bookmarkBoundaryIntegrity.js +22 -0
- package/dist/prosemirror/commands/comments.d.ts +10 -1
- package/dist/prosemirror/commands/comments.js +551 -87
- package/dist/prosemirror/commands/formatPainter.d.ts +45 -10
- package/dist/prosemirror/commands/formatPainter.js +319 -63
- package/dist/prosemirror/commands/index.d.ts +2 -2
- package/dist/prosemirror/commands/pageBreak.d.ts +5 -2
- package/dist/prosemirror/commands/pageBreak.js +18 -36
- package/dist/prosemirror/commands/propertyChangeScope.d.ts +27 -3
- package/dist/prosemirror/commands/propertyChangeScope.js +85 -14
- package/dist/prosemirror/conversion/fromProseDoc.d.ts +8 -5
- package/dist/prosemirror/conversion/fromProseDoc.js +935 -223
- package/dist/prosemirror/conversion/runShadingMark.js +2 -2
- package/dist/prosemirror/conversion/toProseDoc.d.ts +26 -1
- package/dist/prosemirror/conversion/toProseDoc.js +439 -291
- package/dist/prosemirror/extensions/StarterKit.js +4 -0
- package/dist/prosemirror/extensions/core/ParagraphExtension.js +54 -6
- package/dist/prosemirror/extensions/features/AutoBidiDetectionExtension.js +7 -1
- package/dist/prosemirror/extensions/features/ListExtension.js +95 -123
- package/dist/prosemirror/extensions/features/ParaIdAllocatorExtension.js +19 -6
- package/dist/prosemirror/extensions/features/ParagraphChangeTrackerExtension.d.ts +27 -1
- package/dist/prosemirror/extensions/features/ParagraphChangeTrackerExtension.js +134 -30
- package/dist/prosemirror/extensions/features/pasteCleanup.js +9 -15
- package/dist/prosemirror/extensions/marks/BoldExtension.js +4 -3
- package/dist/prosemirror/extensions/marks/CharacterStyleExtension.d.ts +4 -7
- package/dist/prosemirror/extensions/marks/CharacterStyleExtension.js +5 -11
- package/dist/prosemirror/extensions/marks/FontSizeExtension.js +3 -3
- package/dist/prosemirror/extensions/marks/ItalicExtension.js +4 -3
- package/dist/prosemirror/extensions/marks/PageBreakRunOwnerExtension.d.ts +13 -0
- package/dist/prosemirror/extensions/marks/PageBreakRunOwnerExtension.js +39 -0
- package/dist/prosemirror/extensions/marks/RunFormattingOverrideExtension.d.ts +7 -1
- package/dist/prosemirror/extensions/marks/RunFormattingOverrideExtension.js +67 -21
- package/dist/prosemirror/extensions/marks/TrackedChangeExtensions.js +2 -0
- package/dist/prosemirror/extensions/marks/markUtils.d.ts +8 -1
- package/dist/prosemirror/extensions/marks/markUtils.js +88 -2
- package/dist/prosemirror/extensions/nodes/BookmarkBoundaryExtension.js +44 -3
- package/dist/prosemirror/extensions/nodes/FieldExtension.js +1 -1
- package/dist/prosemirror/extensions/nodes/HardBreakExtension.js +15 -4
- package/dist/prosemirror/extensions/nodes/PageBreakExtension.d.ts +6 -0
- package/dist/prosemirror/extensions/nodes/PageBreakExtension.js +6 -0
- package/dist/prosemirror/extensions/nodes/PageBreakRunExtension.d.ts +6 -0
- package/dist/prosemirror/extensions/nodes/PageBreakRunExtension.js +36 -0
- package/dist/prosemirror/findReplaceSelection.js +8 -3
- package/dist/prosemirror/index.d.ts +3 -3
- package/dist/prosemirror/listMarker.d.ts +26 -1
- package/dist/prosemirror/listMarker.js +108 -14
- package/dist/prosemirror/pageBreakRunProjection.d.ts +28 -0
- package/dist/prosemirror/pageBreakRunProjection.js +47 -0
- package/dist/prosemirror/paraText.js +6 -0
- package/dist/prosemirror/paragraphAlignment.d.ts +12 -0
- package/dist/prosemirror/paragraphAlignment.js +13 -0
- package/dist/prosemirror/paragraphSpacing.d.ts +29 -0
- package/dist/prosemirror/paragraphSpacing.js +125 -0
- package/dist/prosemirror/plugins/documentNumbering.d.ts +8 -0
- package/dist/prosemirror/plugins/documentNumbering.js +18 -0
- package/dist/prosemirror/plugins/pmTextScan.d.ts +3 -2
- package/dist/prosemirror/plugins/pmTextScan.js +14 -4
- package/dist/prosemirror/plugins/suggestionMode.js +9 -11
- package/dist/prosemirror/rebaseParagraphRunFormatting.d.ts +16 -0
- package/dist/prosemirror/rebaseParagraphRunFormatting.js +61 -0
- package/dist/prosemirror/runFormattingInlineCarriers.d.ts +64 -0
- package/dist/prosemirror/runFormattingInlineCarriers.js +121 -0
- package/dist/prosemirror/runFormattingProvenance.d.ts +12 -0
- package/dist/prosemirror/runFormattingProvenance.js +48 -0
- package/dist/prosemirror/runFormattingReconciliation.d.ts +25 -0
- package/dist/prosemirror/runFormattingReconciliation.js +54 -0
- package/dist/prosemirror/runPropertyChangeResolution.d.ts +18 -0
- package/dist/prosemirror/runPropertyChangeResolution.js +18 -0
- package/dist/prosemirror/runStyleFormatting.d.ts +50 -0
- package/dist/prosemirror/runStyleFormatting.js +105 -0
- package/dist/prosemirror/schema/index.d.ts +3 -3
- package/dist/prosemirror/schema/marks.d.ts +84 -9
- package/dist/prosemirror/schema/marks.js +73 -1
- package/dist/prosemirror/schema/nodes.d.ts +30 -6
- package/dist/prosemirror/styles/resolvedStyleAttrs.d.ts +14 -2
- package/dist/prosemirror/styles/resolvedStyleAttrs.js +45 -23
- package/dist/prosemirror/styles/styleResolver.d.ts +10 -13
- package/dist/prosemirror/styles/styleResolver.js +3 -3
- package/dist/prosemirror/styles/styleToggleCascade.d.ts +8 -1
- package/dist/prosemirror/styles/styleToggleCascade.js +24 -1
- package/dist/prosemirror/tableGridMutation.d.ts +20 -0
- package/dist/prosemirror/tableGridMutation.js +30 -0
- package/dist/prosemirror/trackedRunInlineAtoms.d.ts +31 -0
- package/dist/prosemirror/trackedRunInlineAtoms.js +39 -0
- package/dist/prosemirror/utils/visualLineNavigation.js +27 -31
- package/dist/prosemirror/validation.js +23 -4
- package/dist/redline.js +4 -1
- package/dist/render-dom/HeaderFooterSelectionOverlay.js +20 -20
- package/dist/render-dom/RenderedDomContext.js +17 -34
- package/dist/server.d.ts +4 -4
- package/dist/server.js +2 -2
- package/dist/style-engine/styleEngine.d.ts +1 -1
- package/dist/utils/clipboard.js +1 -1
- package/dist/utils/findReplace.js +38 -21
- package/dist/utils/mergeDocumentContent.js +3 -3
- package/dist/utils/replaceText.js +2 -1
- package/dist/version-comparison.d.ts +38 -44
- package/dist/version-comparison.js +270 -399
- package/dist/watermark/index.js +2 -4
- package/package.json +8 -2
package/dist/ai-edits/types.d.ts
CHANGED
|
@@ -1,20 +1,26 @@
|
|
|
1
|
+
import { document_d_exports } from "../types/document.js";
|
|
2
|
+
import { FolioContentBlock, FolioContentInlineBooleanProperty, FolioContentInlineFormatting, FolioContentInlineFormattingPatch, FolioContentParagraphSpacing, FolioContentRun, FolioContentSnapshot, FolioContentTableLocation } from "../compare/content-types.js";
|
|
1
3
|
//#region src/ai-edits/types.d.ts
|
|
2
4
|
type FolioAIBlockKind = "heading" | "listItem" | "paragraph";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
5
|
+
/** Boolean run properties supported by snapshots and range-formatting mutations. */
|
|
6
|
+
type FolioAIInlineBooleanProperty = FolioContentInlineBooleanProperty;
|
|
7
|
+
type FolioAIInlineFormatting = FolioContentInlineFormatting;
|
|
8
|
+
/**
|
|
9
|
+
* A run-formatting mutation: `false` authors an explicit off value, while
|
|
10
|
+
* `null` removes the direct property so its inherited value becomes effective.
|
|
11
|
+
*/
|
|
12
|
+
type FolioAIInlineFormattingPatch = FolioContentInlineFormattingPatch;
|
|
13
|
+
type FolioAIBlockPreviewRun = FolioContentRun;
|
|
14
|
+
/**
|
|
15
|
+
* A zero-width inline structure at one clean-text boundary. `pageBreak`
|
|
16
|
+
* always represents an authored `<w:br w:type="page"/>`; an omitted `clear`
|
|
17
|
+
* remains distinct from any explicit value even though it does not affect
|
|
18
|
+
* layout for this break type.
|
|
19
|
+
*/
|
|
20
|
+
type FolioAIBlockStructuralBoundary = {
|
|
21
|
+
type: "pageBreak";
|
|
22
|
+
offset: number;
|
|
23
|
+
clear?: document_d_exports.BreakContent["clear"];
|
|
18
24
|
};
|
|
19
25
|
/**
|
|
20
26
|
* Where a block sits inside its innermost enclosing table. Every index is
|
|
@@ -24,47 +30,20 @@ type FolioAIBlockPreviewRun = {
|
|
|
24
30
|
* not a grid column), and `paragraphIndex` orders the block among the cell's
|
|
25
31
|
* own blocks. Absent on a block that is not inside a table.
|
|
26
32
|
*/
|
|
27
|
-
type FolioAIBlockTableLocation =
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
* as `tableIndex` unless tables nest. A comparison aligns on this: a table
|
|
31
|
-
* inside a cell is part of its parent, not a structure of its own that can
|
|
32
|
-
* be paired against one somewhere else.
|
|
33
|
-
*/
|
|
34
|
-
outerTableIndex: number;
|
|
35
|
-
tableIndex: number;
|
|
36
|
-
rowIndex: number;
|
|
37
|
-
cellIndex: number;
|
|
38
|
-
/** Grid column occupied by the cell's left edge, derived from `TableMap`. */
|
|
39
|
-
gridColumnIndex: number;
|
|
40
|
-
/** Number of grid columns occupied by this physical cell. */
|
|
41
|
-
columnSpan: number;
|
|
42
|
-
/** Number of grid rows occupied by this physical cell. */
|
|
43
|
-
rowSpan: number;
|
|
44
|
-
paragraphIndex: number;
|
|
45
|
-
};
|
|
46
|
-
type FolioAIBlock = {
|
|
47
|
-
id: string;
|
|
48
|
-
kind: FolioAIBlockKind;
|
|
49
|
-
text: string;
|
|
50
|
-
/** One-based heading depth when the block has outline semantics. */
|
|
51
|
-
headingLevel?: number;
|
|
52
|
-
displayLabel?: string;
|
|
53
|
-
styleId?: string;
|
|
54
|
-
/**
|
|
55
|
-
* `w:numPr/w:ilvl`: the block's list indent level. Present only on a block
|
|
56
|
-
* that carries numbering, and the only pPr property a redline can move
|
|
57
|
-
* without touching a word — a demoted list item reads as unchanged text and
|
|
58
|
-
* is not.
|
|
59
|
-
*/
|
|
60
|
-
listLevel?: number;
|
|
61
|
-
previewRuns?: FolioAIBlockPreviewRun[];
|
|
62
|
-
table?: FolioAIBlockTableLocation;
|
|
33
|
+
type FolioAIBlockTableLocation = FolioContentTableLocation;
|
|
34
|
+
type FolioAIBlock = FolioContentBlock<FolioAIBlockKind> & {
|
|
35
|
+
structuralBoundaries?: readonly FolioAIBlockStructuralBoundary[];
|
|
63
36
|
};
|
|
37
|
+
/**
|
|
38
|
+
* The complete modeled attribute set of one direct `w:pPr/w:spacing` child.
|
|
39
|
+
* Optional fields preserve the distinction between an absent attribute and
|
|
40
|
+
* an explicit zero or false value.
|
|
41
|
+
*/
|
|
42
|
+
type FolioAIParagraphSpacing = FolioContentParagraphSpacing;
|
|
64
43
|
/**
|
|
65
44
|
* The paragraph properties an operation may set. A subset of `w:pPrChange`'s
|
|
66
|
-
* scope:
|
|
67
|
-
*
|
|
45
|
+
* scope: properties a comparison can see in a block projection and an agent
|
|
46
|
+
* has a reason to change.
|
|
68
47
|
*/
|
|
69
48
|
type FolioAIBlockParagraphProperties = {
|
|
70
49
|
/** `w:pStyle`. `null` clears the style back to the default. */
|
|
@@ -74,6 +53,10 @@ type FolioAIBlockParagraphProperties = {
|
|
|
74
53
|
* paragraph stops being a list item rather than moving to another level.
|
|
75
54
|
*/
|
|
76
55
|
listLevel?: number | null;
|
|
56
|
+
/** Direct `w:jc`. `null` clears the override and restores style inheritance. */
|
|
57
|
+
alignment?: document_d_exports.ParagraphAlignment | null;
|
|
58
|
+
/** Direct `w:spacing` attributes. `null` removes the whole direct child. */
|
|
59
|
+
spacing?: FolioAIParagraphSpacing | null;
|
|
77
60
|
};
|
|
78
61
|
/**
|
|
79
62
|
* Every paragraph of one story, blank ones included.
|
|
@@ -84,8 +67,7 @@ type FolioAIBlockParagraphProperties = {
|
|
|
84
67
|
* document for a person or a model wants only the paragraphs that carry text,
|
|
85
68
|
* and says so with `isFolioAIContentBlock`.
|
|
86
69
|
*/
|
|
87
|
-
type FolioAIEditSnapshot = {
|
|
88
|
-
blocks: FolioAIBlock[];
|
|
70
|
+
type FolioAIEditSnapshot = FolioContentSnapshot<FolioAIBlock> & {
|
|
89
71
|
anchors: Record<string, FolioAIBlockAnchor>;
|
|
90
72
|
};
|
|
91
73
|
type FolioAIBlockAnchor = {
|
|
@@ -95,6 +77,8 @@ type FolioAIBlockAnchor = {
|
|
|
95
77
|
text: string;
|
|
96
78
|
normalizedText: string;
|
|
97
79
|
textHash: string;
|
|
80
|
+
/** Hash of zero-width structural boundaries in the clean block view. */
|
|
81
|
+
structuralBoundaryHash: string;
|
|
98
82
|
hashOccurrenceCount: number;
|
|
99
83
|
};
|
|
100
84
|
type FolioAIComment = {
|
|
@@ -213,7 +197,7 @@ type FolioAIEditOperation = FolioAIEditReviewMeta & {
|
|
|
213
197
|
id: string;
|
|
214
198
|
type: "formatRange";
|
|
215
199
|
range: FolioAITextRangeHandle;
|
|
216
|
-
formatting:
|
|
200
|
+
formatting: FolioAIInlineFormattingPatch;
|
|
217
201
|
} | {
|
|
218
202
|
id: string;
|
|
219
203
|
type: "insertAfterBlock" | "insertBeforeBlock";
|
|
@@ -222,7 +206,7 @@ type FolioAIEditOperation = FolioAIEditReviewMeta & {
|
|
|
222
206
|
* The paragraph text to insert. A line break splits `text` into
|
|
223
207
|
* consecutive paragraphs at the same anchor instead of becoming
|
|
224
208
|
* literal newlines inside one paragraph: only the first paragraph
|
|
225
|
-
* gets `styleId` / `inheritFormatting`, later ones use body
|
|
209
|
+
* gets `styleId` / `alignment` / `inheritFormatting`, later ones use body
|
|
226
210
|
* formatting. Blank lines are dropped. Reported as a
|
|
227
211
|
* `splitMultilineText` normalization when it happens.
|
|
228
212
|
*
|
|
@@ -262,6 +246,16 @@ type FolioAIEditOperation = FolioAIEditReviewMeta & {
|
|
|
262
246
|
* inheritance alone cannot say.
|
|
263
247
|
*/
|
|
264
248
|
listLevel?: number | null;
|
|
249
|
+
/**
|
|
250
|
+
* Direct `w:jc` for the inserted block. `null` clears alignment copied
|
|
251
|
+
* from the anchor and lets the inserted paragraph's style decide.
|
|
252
|
+
*/
|
|
253
|
+
alignment?: document_d_exports.ParagraphAlignment | null;
|
|
254
|
+
/**
|
|
255
|
+
* Direct `w:spacing` for the inserted block. `null` clears spacing
|
|
256
|
+
* copied from the anchor and lets the inserted paragraph's style decide.
|
|
257
|
+
*/
|
|
258
|
+
spacing?: FolioAIParagraphSpacing | null;
|
|
265
259
|
comment?: FolioAIComment;
|
|
266
260
|
} | {
|
|
267
261
|
id: string;
|
|
@@ -269,7 +263,8 @@ type FolioAIEditOperation = FolioAIEditReviewMeta & {
|
|
|
269
263
|
blockId: string;
|
|
270
264
|
text: string;
|
|
271
265
|
preserveFormatting?: boolean;
|
|
272
|
-
|
|
266
|
+
/** Paragraph style to apply; `null` clears the direct style. */
|
|
267
|
+
styleId?: string | null;
|
|
273
268
|
comment?: FolioAIComment;
|
|
274
269
|
} |
|
|
275
270
|
/**
|
|
@@ -464,14 +459,18 @@ type FolioAIEditOperation = FolioAIEditReviewMeta & {
|
|
|
464
459
|
* provenance: rendered with the tracked-change grammar but stripped from
|
|
465
460
|
* serialized DOCX until a human accepts them. Behaves like `"tracked-changes"`
|
|
466
461
|
* and covers the inline text/format operations (replaceInBlock, replaceRange,
|
|
467
|
-
* formatRange) plus the block and table row/column structural
|
|
468
|
-
* (insertAfterBlock, insertBeforeBlock, replaceBlock, deleteBlock,
|
|
462
|
+
* formatRange), paragraph properties, plus the block and table row/column structural
|
|
463
|
+
* operations (insertAfterBlock, insertBeforeBlock, replaceBlock, deleteBlock,
|
|
469
464
|
* insertSignatureTable, insertTableRow, deleteTableRow, insertTableColumn,
|
|
470
465
|
* deleteTableColumn). Only comment operations and cell merge/split report
|
|
471
466
|
* `unsupportedMode`.
|
|
472
467
|
*/
|
|
473
468
|
type FolioAIEditApplyMode = "direct" | "tracked-changes" | "suggested";
|
|
474
469
|
type FolioAIEditSkipReason = "missingBlock" | "changedBlock" | "ambiguousFind" | "missingFind" | "unsupportedBlock" | "unsupportedMode" | "atomicBatchRejected" | "preconditionFailed" | "staleRange" | "emptyOperation" |
|
|
470
|
+
/** The paragraph already owns the one `w:pPrChange` OOXML permits. */
|
|
471
|
+
"pendingParagraphPropertyChange" |
|
|
472
|
+
/** The affected run already owns the one `w:rPrChange` OOXML permits. */
|
|
473
|
+
"pendingRunPropertyChange" |
|
|
475
474
|
/**
|
|
476
475
|
* The operation would not change the document — find equals
|
|
477
476
|
* replace, or replaceBlock's `text` matches the live block.
|
|
@@ -506,6 +505,8 @@ type FolioAIEditAppliedOperation = {
|
|
|
506
505
|
* fromProseDoc serialises a single id carrying both as a Word
|
|
507
506
|
* "moveTo/moveFrom" pair, not an ins/del — so the two sides must
|
|
508
507
|
* be distinct ids in the doc but conceptually one operation here.
|
|
508
|
+
* The list also includes a paragraph-property revision synthesized
|
|
509
|
+
* when an inserted final paragraph mark rotates to its carrier.
|
|
509
510
|
* Use this list when you need to accept or reject every mark
|
|
510
511
|
* belonging to this op.
|
|
511
512
|
*/
|
|
@@ -558,4 +559,4 @@ type FolioAIEditApplyResult = {
|
|
|
558
559
|
normalizations?: FolioAIEditNormalization[];
|
|
559
560
|
};
|
|
560
561
|
//#endregion
|
|
561
|
-
export { FolioAIBlock, FolioAIBlockAnchor, FolioAIBlockKind, FolioAIBlockParagraphProperties, FolioAIBlockPreviewRun, FolioAIBlockTableLocation, FolioAIComment, FolioAIEditAppliedOperation, FolioAIEditApplyMode, FolioAIEditApplyResult, FolioAIEditNormalization, FolioAIEditNormalizationCode, FolioAIEditOperation, FolioAIEditPrecondition, FolioAIEditReviewMeta, FolioAIEditSeverity, FolioAIEditSkipReason, FolioAIEditSkippedOperation, FolioAIEditSnapshot, FolioAIInlineFormatting, FolioAISignatureParty, FolioAITextRangeHandle, FolioDocumentNavigationTarget, FolioDocumentOutline, FolioDocumentOutlineEntry, FolioDocumentSection, FolioDocumentSectionHandle, FolioDocumentSectionReadResult };
|
|
562
|
+
export { FolioAIBlock, FolioAIBlockAnchor, FolioAIBlockKind, FolioAIBlockParagraphProperties, FolioAIBlockPreviewRun, FolioAIBlockStructuralBoundary, FolioAIBlockTableLocation, FolioAIComment, FolioAIEditAppliedOperation, FolioAIEditApplyMode, FolioAIEditApplyResult, FolioAIEditNormalization, FolioAIEditNormalizationCode, FolioAIEditOperation, FolioAIEditPrecondition, FolioAIEditReviewMeta, FolioAIEditSeverity, FolioAIEditSkipReason, FolioAIEditSkippedOperation, FolioAIEditSnapshot, FolioAIInlineBooleanProperty, FolioAIInlineFormatting, FolioAIInlineFormattingPatch, FolioAIParagraphSpacing, FolioAISignatureParty, FolioAITextRangeHandle, FolioDocumentNavigationTarget, FolioDocumentOutline, FolioDocumentOutlineEntry, FolioDocumentSection, FolioDocumentSectionHandle, FolioDocumentSectionReadResult };
|
|
@@ -23,8 +23,11 @@
|
|
|
23
23
|
* 3. When what survives is still too fragmented for its length, the whole
|
|
24
24
|
* paragraph is one replacement ({@link isTooFragmented}).
|
|
25
25
|
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
26
|
+
* Common affixes and unique-token anchors split the input into independent
|
|
27
|
+
* gaps before any quadratic work. The residual gaps share one
|
|
28
|
+
* {@link MAX_WORD_DIFF_CELLS} allowance per comparison or apply scope; once it
|
|
29
|
+
* is spent, a gap is a single `del` + `ins` pair. A standalone call owns one
|
|
30
|
+
* fresh scope.
|
|
28
31
|
*/
|
|
29
32
|
type WordDiffSegment = {
|
|
30
33
|
type: "equal" | "del" | "ins";
|
|
@@ -58,6 +61,18 @@ type WordDiffOptions = {
|
|
|
58
61
|
/** Default: nothing normalized, so both strings reconstruct exactly. */
|
|
59
62
|
normalization?: WordDiffNormalization;
|
|
60
63
|
};
|
|
64
|
+
/**
|
|
65
|
+
* One internal comparison/apply scope. Every diff shares the same quadratic
|
|
66
|
+
* allowance; public standalone calls below still receive a fresh allowance.
|
|
67
|
+
* Not re-exported from a package entry point.
|
|
68
|
+
*/
|
|
69
|
+
declare const createWordDiffSession: (options?: WordDiffOptions) => {
|
|
70
|
+
diff: (before: string, after: string) => WordDiffSegment[];
|
|
71
|
+
};
|
|
72
|
+
/** Attach one internal work scope without widening a caller-facing option type. */
|
|
73
|
+
declare const createScopedWordDiffOptions: <Options extends WordDiffOptions>(options: Options) => Options;
|
|
74
|
+
/** Reuse an internal scope when present; ordinary public callers get a fresh one. */
|
|
75
|
+
declare const wordDiffSessionFromOptions: (options: WordDiffOptions | undefined) => ReturnType<typeof createWordDiffSession>;
|
|
61
76
|
declare const diffWordSegments: (before: string, after: string, options?: WordDiffOptions) => WordDiffSegment[];
|
|
62
77
|
//#endregion
|
|
63
|
-
export { WORD_DIFF_GRANULARITIES, WordDiffGranularity, WordDiffNormalization, WordDiffOptions, WordDiffSegment, diffWordSegments };
|
|
78
|
+
export { WORD_DIFF_GRANULARITIES, WordDiffGranularity, WordDiffNormalization, WordDiffOptions, WordDiffSegment, createScopedWordDiffOptions, createWordDiffSession, diffWordSegments, wordDiffSessionFromOptions };
|