@stll/folio-core 0.72.0 → 0.74.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 +12 -6
- package/dist/ai-edits/applyTypes.d.ts +85 -0
- package/dist/ai-edits/applyTypes.js +24 -0
- package/dist/ai-edits/clean-text.d.ts +7 -1
- package/dist/ai-edits/clean-text.js +23 -2
- package/dist/ai-edits/finalSectionReview.d.ts +1 -1
- package/dist/ai-edits/headless.d.ts +29 -147
- package/dist/ai-edits/headless.js +215 -1639
- package/dist/ai-edits/index.d.ts +3 -3
- package/dist/ai-edits/index.js +2 -3
- package/dist/ai-edits/pending-suggestions.d.ts +14 -4
- package/dist/ai-edits/pending-suggestions.js +183 -90
- package/dist/ai-edits/pendingJoin.js +6 -1
- package/dist/ai-edits/retired-comment-receipts.d.ts +1 -1
- package/dist/ai-edits/snapshot.js +9 -4
- package/dist/ai-edits/table-cell-mutations.d.ts +1 -1
- package/dist/ai-edits/table-cell-mutations.js +2 -2
- package/dist/ai-edits/table-geometry.d.ts +1 -1
- package/dist/ai-edits/table-geometry.js +1 -1
- package/dist/ai-edits/table-row-column-mutations.d.ts +1 -1
- package/dist/ai-edits/table-row-column-mutations.js +1 -1
- package/dist/ai-edits/tableNodes.d.ts +38 -0
- package/dist/ai-edits/tableNodes.js +86 -0
- package/dist/ai-edits/tracked-batch-fidelity.d.ts +1 -1
- package/dist/ai-edits/tracked-batch-fidelity.js +1 -1
- package/dist/ai-edits/undefinedReferences.d.ts +7 -0
- package/dist/canonical/batchCommentReferences.js +1 -0
- package/dist/canonical/canonicalInlineGaps.d.ts +56 -0
- package/dist/canonical/canonicalInlineGaps.js +118 -0
- package/dist/canonical/canonicalInlineProjection.d.ts +4 -13
- package/dist/canonical/canonicalInlineProjection.js +5 -27
- package/dist/canonical/canonicalProjectionBlocks.d.ts +4 -4
- package/dist/canonical/canonicalPublicOperations.js +282 -75
- package/dist/canonical/canonicalSelection.js +1 -1
- package/dist/canonical/canonicalSession.d.ts +9 -1
- package/dist/canonical/canonicalSession.js +106 -33
- package/dist/compare/compare.d.ts +1 -1
- package/dist/compare/inline-atoms-model.d.ts +1 -1
- package/dist/compare/inline-atoms.d.ts +2 -2
- package/dist/compare/inline-provenance-model.d.ts +1 -1
- package/dist/compare/inline-provenance.d.ts +2 -2
- package/dist/compat/eigenpal.d.ts +3 -3
- package/dist/compat/eigenpal.js +2 -3
- package/dist/controller/autocompleteSuggestion.js +1 -1
- package/dist/controller/canonicalClipboard.d.ts +13 -3
- package/dist/controller/canonicalClipboard.js +186 -50
- package/dist/controller/canonicalClipboardResources.d.ts +9 -1
- package/dist/controller/canonicalClipboardResources.js +22 -2
- package/dist/controller/canonicalComposition.js +1 -1
- package/dist/controller/canonicalInput.js +1 -1
- package/dist/controller/canonicalPresence.js +1 -1
- package/dist/controller/canonicalReview.d.ts +1 -1
- package/dist/controller/canonicalReview.js +1 -1
- package/dist/controller/canonicalRoomAuthority.js +1 -1
- package/dist/controller/canonicalRoomWire.js +1 -1
- package/dist/controller/canonicalStructure.js +1 -1
- package/dist/controller/canonicalTabRoom.js +1 -1
- package/dist/controller/canonicalWatermark.d.ts +10 -0
- package/dist/controller/canonicalWatermark.js +37 -0
- package/dist/controller/canonicalYjsRoom.js +1 -1
- package/dist/controller/hiddenEditorApi.d.ts +1 -1
- package/dist/controller/hiddenEditorApi.js +2 -17
- package/dist/controller/hiddenEditorManager.d.ts +4 -3
- package/dist/controller/hiddenEditorManager.js +79 -23
- package/dist/document-operations.d.ts +1 -14
- package/dist/document-operations.js +1 -278
- package/dist/docx/canonicalSave.d.ts +1 -1
- package/dist/docx/canonicalSave.js +1 -1
- package/dist/docx/canonicalSessionInput.js +1 -1
- package/dist/docx/containerChildren.js +1 -1
- package/dist/docx/createDocx.d.ts +4 -0
- package/dist/docx/createDocx.js +6 -0
- package/dist/docx/paragraphParser.js +2 -2
- package/dist/docx/paragraphPropertySource.d.ts +1 -1
- package/dist/docx/parser.js +1 -1
- package/dist/docx/reviewResolutionProvenance.d.ts +3 -2
- package/dist/docx/reviewResolutionProvenance.js +31 -8
- package/dist/docx/revisionIdNormalization.js +30 -7
- package/dist/docx/rezip.d.ts +1 -1
- package/dist/docx/rezip.js +1 -1
- package/dist/docx/serializer/tableSerializer.js +4 -36
- package/dist/docx/server/templatePlan/apply.d.ts +15 -0
- package/dist/docx/server/templatePlan/apply.js +658 -0
- package/dist/docx/server/templatePlan/blocks.d.ts +97 -0
- package/dist/docx/server/templatePlan/blocks.js +355 -0
- package/dist/docx/server/templatePlan/builders.d.ts +72 -0
- package/dist/docx/server/templatePlan/builders.js +237 -0
- package/dist/docx/server/templatePlan/emit.d.ts +118 -0
- package/dist/docx/server/templatePlan/emit.js +466 -0
- package/dist/docx/server/templatePlan/emphasis.d.ts +62 -0
- package/dist/docx/server/templatePlan/emphasis.js +173 -0
- package/dist/docx/server/templatePlan/inspect.d.ts +22 -0
- package/dist/docx/server/templatePlan/inspect.js +230 -0
- package/dist/docx/server/templatePlan/labels.d.ts +45 -0
- package/dist/docx/server/templatePlan/labels.js +155 -0
- package/dist/docx/server/templatePlan/package.d.ts +34 -0
- package/dist/docx/server/templatePlan/package.js +99 -0
- package/dist/docx/server/templatePlan/plan.d.ts +145 -0
- package/dist/docx/server/templatePlan/plan.js +875 -0
- package/dist/docx/server/templatePlan/planShape.d.ts +9 -0
- package/dist/docx/server/templatePlan/planShape.js +180 -0
- package/dist/docx/server/templatePlan/resources.d.ts +41 -0
- package/dist/docx/server/templatePlan/resources.js +136 -0
- package/dist/docx/server/templatePlan/story.d.ts +128 -0
- package/dist/docx/server/templatePlan/story.js +440 -0
- package/dist/docx/server/templatePlan/types.d.ts +442 -0
- package/dist/docx/server/templatePlan/types.js +29 -0
- package/dist/docx/server/templatePlan/verify.d.ts +40 -0
- package/dist/docx/server/templatePlan/verify.js +976 -0
- package/dist/docx/server/templatePlan/xml.d.ts +74 -0
- package/dist/docx/server/templatePlan/xml.js +125 -0
- package/dist/docx/settingsHeaderFooterUpdate.d.ts +9 -0
- package/dist/docx/settingsHeaderFooterUpdate.js +45 -10
- package/dist/docx/structuralXmlPatch.js +9 -1
- package/dist/docx/tableGridXml.d.ts +30 -0
- package/dist/docx/tableGridXml.js +54 -0
- package/dist/docx/tableParser.js +7 -0
- package/dist/i18n/loadMessages.d.ts +5 -0
- package/dist/i18n/loadMessages.js +46 -0
- package/dist/i18n/locales.d.ts +3 -0
- package/dist/i18n/locales.js +17 -0
- package/dist/i18n/messages.d.ts +3 -2
- package/dist/i18n/messages.js +4 -16
- package/dist/index.d.ts +3 -3
- package/dist/index.js +2 -3
- package/dist/internal/clipboardTransformPlugin.d.ts +3 -0
- package/dist/internal/clipboardTransformPlugin.js +13 -0
- package/dist/internal/extensionRuntime.d.ts +7 -0
- package/dist/internal/extensionRuntime.js +28 -0
- package/dist/internal/starterKitExtensions.d.ts +20 -0
- package/dist/internal/starterKitExtensions.js +123 -0
- package/dist/internal/wholeStoryRevisionResolution.js +1 -1
- package/dist/managers/ContextMenuManager.js +2 -1
- package/dist/managers/editorShortcuts.d.ts +1 -1
- package/dist/prosemirror/anchoredTextBoxes.d.ts +1 -1
- package/dist/prosemirror/attrs/index.js +1 -1
- package/dist/prosemirror/canonicalCommands.d.ts +1 -1
- package/dist/prosemirror/canonicalSelectionRange.d.ts +1 -1
- package/dist/prosemirror/canonicalSelectionRange.js +1 -1
- package/dist/prosemirror/canonicalTableCommands.js +3 -3
- package/dist/prosemirror/commands/comments.js +4 -4
- package/dist/prosemirror/commands/contentControls.d.ts +1 -1
- package/dist/prosemirror/commands/contentControls.js +1 -1
- package/dist/prosemirror/commands/formatPainter.d.ts +1 -1
- package/dist/prosemirror/commands/formatting.d.ts +1 -1
- package/dist/prosemirror/commands/pastePlainText.d.ts +1 -1
- package/dist/prosemirror/commands/pastePlainText.js +2 -3
- package/dist/prosemirror/commands/replaceRangeText.js +1 -1
- package/dist/prosemirror/commands/sectionBreak.js +1 -1
- package/dist/prosemirror/commands/tableCellMergeResolution.d.ts +1 -1
- package/dist/prosemirror/commands/tableMergeFoldDecisions.d.ts +1 -1
- package/dist/prosemirror/commentRecords.d.ts +1 -1
- package/dist/prosemirror/commentRecords.js +2 -2
- package/dist/prosemirror/contentControlRevisions.d.ts +1 -1
- package/dist/prosemirror/conversion/fromProseDoc.d.ts +0 -5
- package/dist/prosemirror/conversion/fromProseDoc.js +2 -9
- package/dist/prosemirror/conversion/index.d.ts +2 -2
- package/dist/prosemirror/conversion/index.js +2 -2
- package/dist/prosemirror/documentStructureCounts.d.ts +24 -0
- package/dist/prosemirror/documentStructureCounts.js +76 -0
- package/dist/prosemirror/extensions/ExtensionManager.d.ts +1 -1
- package/dist/prosemirror/extensions/ExtensionManager.js +4 -22
- package/dist/prosemirror/extensions/StarterKit.d.ts +4 -27
- package/dist/prosemirror/extensions/StarterKit.js +29 -115
- package/dist/prosemirror/extensions/core/ParagraphExtension.js +1 -1
- package/dist/prosemirror/extensions/core/historyCommands.d.ts +16 -0
- package/dist/prosemirror/extensions/core/historyCommands.js +19 -0
- package/dist/prosemirror/extensions/features/AutoBidiDetectionExtension.js +1 -1
- package/dist/prosemirror/extensions/features/BaseKeymapExtension.js +1 -1
- package/dist/prosemirror/extensions/features/ListExtension.js +7 -2
- package/dist/prosemirror/extensions/features/pastedCellSections.d.ts +1 -1
- package/dist/prosemirror/extensions/index.d.ts +2 -1
- package/dist/prosemirror/extensions/marks/FootnoteRefExtension.js +8 -3
- package/dist/prosemirror/extensions/marks/markUtils.d.ts +1 -1
- package/dist/prosemirror/extensions/nodes/TableExtension.d.ts +1 -1
- package/dist/prosemirror/extensions/nodes/TableExtension.js +8 -41
- package/dist/prosemirror/extensions/types.d.ts +1 -1
- package/dist/prosemirror/findReplaceSelection.d.ts +1 -1
- package/dist/prosemirror/hyperlinkRemoval.d.ts +1 -1
- package/dist/prosemirror/hyperlinkRemoval.js +7 -2
- package/dist/prosemirror/index.d.ts +3 -3
- package/dist/prosemirror/index.js +3 -3
- package/dist/prosemirror/insertionGaps.d.ts +1 -1
- package/dist/prosemirror/keptRangeBoundaries.d.ts +1 -1
- package/dist/prosemirror/keptRangeBoundaries.js +1 -1
- package/dist/prosemirror/listNumbering.d.ts +1 -1
- package/dist/prosemirror/listNumbering.js +1 -1
- package/dist/prosemirror/lockedControls.d.ts +1 -1
- package/dist/prosemirror/markupViewProjection.d.ts +1 -1
- package/dist/prosemirror/noteReferenceOccurrences.d.ts +1 -1
- package/dist/prosemirror/noteReferenceOccurrences.js +1 -1
- package/dist/prosemirror/noteReferenceReview.d.ts +2 -56
- package/dist/prosemirror/noteReferenceReview.js +2 -243
- package/dist/prosemirror/{extensions/features/ParaIdAllocatorExtension.d.ts → paraIds.d.ts} +13 -23
- package/dist/prosemirror/paraIds.js +152 -0
- package/dist/prosemirror/paragraphChangeTrackerMeta.d.ts +97 -0
- package/dist/prosemirror/paragraphChangeTrackerMeta.js +87 -0
- package/dist/prosemirror/paragraphMarkJoin.d.ts +1 -1
- package/dist/prosemirror/paragraphPropertyCarry.d.ts +1 -1
- package/dist/prosemirror/pastedCommentCopies.d.ts +1 -1
- package/dist/prosemirror/plugins/createDocScanPlugin.d.ts +1 -1
- package/dist/prosemirror/plugins/documentNumbering.d.ts +1 -1
- package/dist/prosemirror/plugins/documentNumbering.js +1 -1
- package/dist/prosemirror/plugins/documentStyles.js +1 -1
- package/dist/prosemirror/plugins/templateDirectives.d.ts +1 -1
- package/dist/prosemirror/rebaseParagraphRunFormatting.d.ts +1 -1
- package/dist/prosemirror/rebaseParagraphRuns.d.ts +1 -1
- package/dist/prosemirror/rejoinRunCarriers.d.ts +1 -1
- package/dist/prosemirror/replacedAnnotations.d.ts +1 -1
- package/dist/prosemirror/replacedAnnotations.js +17 -2
- package/dist/prosemirror/revisionCarriers.d.ts +1 -1
- package/dist/prosemirror/runFormattingInlineCarriers.d.ts +1 -1
- package/dist/prosemirror/sectionMarkEdits.d.ts +1 -1
- package/dist/prosemirror/selectionBounds.d.ts +10 -0
- package/dist/prosemirror/selectionBounds.js +22 -0
- package/dist/prosemirror/storyListNumbering.d.ts +1 -1
- package/dist/prosemirror/suggestionCommands.d.ts +47 -0
- package/dist/prosemirror/suggestionCommands.js +31 -0
- package/dist/prosemirror/tableCellPaste.d.ts +1 -1
- package/dist/prosemirror/tableCellPaste.js +1 -1
- package/dist/prosemirror/tableGridMutation.d.ts +1 -1
- package/dist/prosemirror/tableRunIn.js +1 -1
- package/dist/prosemirror/textInput.d.ts +1 -1
- package/dist/prosemirror/textInput.js +1 -1
- package/dist/server.d.ts +7 -2
- package/dist/server.js +6 -1
- package/dist/types/canonicalCapabilities.d.ts +13 -92
- package/dist/types/canonicalCapabilities.js +11 -85
- package/package.json +4 -4
- package/dist/ai-edits/apply.d.ts +0 -202
- package/dist/ai-edits/apply.js +0 -6759
- package/dist/ai-edits/note-story-inventory.d.ts +0 -5
- package/dist/ai-edits/note-story-inventory.js +0 -10
- package/dist/ai-edits/revisionStretches.d.ts +0 -32
- package/dist/ai-edits/revisionStretches.js +0 -147
- package/dist/prosemirror/extensions/core/HistoryExtension.d.ts +0 -18
- package/dist/prosemirror/extensions/core/HistoryExtension.js +0 -122
- package/dist/prosemirror/extensions/features/ParaIdAllocatorExtension.js +0 -408
- package/dist/prosemirror/extensions/features/ParagraphChangeTrackerExtension.d.ts +0 -135
- package/dist/prosemirror/extensions/features/ParagraphChangeTrackerExtension.js +0 -566
- package/dist/prosemirror/plugins/suggestionMode.d.ts +0 -92
- package/dist/prosemirror/plugins/suggestionMode.js +0 -1515
- package/dist/prosemirror/tablePositionedBookmarks.d.ts +0 -8
- package/dist/prosemirror/tablePositionedBookmarks.js +0 -80
package/README.md
CHANGED
|
@@ -4,11 +4,17 @@
|
|
|
4
4
|
|
|
5
5
|
# @stll/folio-core
|
|
6
6
|
|
|
7
|
-
The headless
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
7
|
+
The headless DOCX engine behind [folio](https://github.com/stella/folio). It
|
|
8
|
+
reads a `.docx` into a typed OOXML model, applies every edit as a validated
|
|
9
|
+
operation on that model, paginates it, and writes a valid `.docx` back. Parts
|
|
10
|
+
of the package that no edit touched are written back byte for byte.
|
|
11
|
+
|
|
12
|
+
Typing in the editor, tracked changes, comments, AI suggestions, collaborative
|
|
13
|
+
edits and server-side review all go through the same operations, so the same
|
|
14
|
+
edit gives the same document wherever it runs. An edit the engine cannot make
|
|
15
|
+
is refused whole, never half-applied. In the browser editors, ProseMirror
|
|
16
|
+
handles keyboard input and selection; the document model is the source of
|
|
17
|
+
truth, and folio lays out and paints the pages itself.
|
|
12
18
|
|
|
13
19
|
There is **no React** in the import graph, so the core runs on a server or under
|
|
14
20
|
any framework. The React editor lives in
|
|
@@ -36,7 +42,7 @@ the same runtime. The command above includes the complete editor peer closure.
|
|
|
36
42
|
|
|
37
43
|
| Import | What it is |
|
|
38
44
|
| --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
39
|
-
| `@stll/folio-core` | the headless public API — document creation, representation-neutral comparison, the document model, AI-suggestion primitives, and
|
|
45
|
+
| `@stll/folio-core` | the headless public API — document creation, representation-neutral comparison, the document model, AI-suggestion primitives, and editor decoration plugins |
|
|
40
46
|
| `@stll/folio-core/markdown` | DOCX ↔ Markdown conversion |
|
|
41
47
|
| `@stll/folio-core/server` | DOM-free document review, explicit tracked edits, comparison, creation, and package helpers |
|
|
42
48
|
| `@stll/folio-core/redline` | Compare two `.docx` buffers and generate a native Word redline |
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The public option and result types of the AI edit applier, and the
|
|
3
|
+
* operation types it applies in suggested mode.
|
|
4
|
+
*/
|
|
5
|
+
import { FolioAIEditApplyResult, FolioAIResolvedEditOperation } from "./types.js";
|
|
6
|
+
import { WordDiffGranularity } from "./word-diff.js";
|
|
7
|
+
import { EditorState, Transaction } from "prosemirror-state";
|
|
8
|
+
/**
|
|
9
|
+
* The only editor surface the apply logic touches: a current `state`
|
|
10
|
+
* and a `dispatch` that swaps in the next one. A live `EditorView`
|
|
11
|
+
* satisfies this structurally, and so does a headless seam
|
|
12
|
+
* (`{ state, dispatch: (tr) => { state = state.apply(tr); } }`) — the
|
|
13
|
+
* apply path never reaches for anything DOM-bound on the view, which is
|
|
14
|
+
* what lets the same operation applier drive both the React editor and
|
|
15
|
+
* the server-side reviewer in `./headless`.
|
|
16
|
+
*/
|
|
17
|
+
export type FolioAIEditView = {
|
|
18
|
+
state: EditorState;
|
|
19
|
+
dispatch: (transaction: Transaction) => void;
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* Fixed revision provenance, for callers whose output must be reproducible.
|
|
23
|
+
* Both halves of the stamp travel together because either one left to the
|
|
24
|
+
* ambient clock (`new Date()` for the date, the shared bounded allocator for
|
|
25
|
+
* the ids) makes the produced package differ between two runs over the same
|
|
26
|
+
* inputs. `idSeed` starts a contiguous range the batch allocates from, so it
|
|
27
|
+
* must sit above every revision id the target document already carries.
|
|
28
|
+
*/
|
|
29
|
+
export type FolioRevisionStamp = {
|
|
30
|
+
/** ISO-8601 date stamped on every `w:ins` / `w:del` this batch produces. */
|
|
31
|
+
date: string;
|
|
32
|
+
/** First revision id the batch may allocate. */
|
|
33
|
+
idSeed: number;
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* How an apply batch cuts the redline for a replacement. Word-level by
|
|
37
|
+
* default; character granularity marks the changed letters inside a token,
|
|
38
|
+
* which reads well for a reference or a date. Normalization is deliberately
|
|
39
|
+
* absent: a batch that leaves a difference unmarked does not accept back to
|
|
40
|
+
* the text the caller asked for.
|
|
41
|
+
*/
|
|
42
|
+
export type FolioWordDiffOptions = {
|
|
43
|
+
granularity?: WordDiffGranularity;
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* What a replacement does with a highlight or `w:shd` the text it replaces
|
|
47
|
+
* carries.
|
|
48
|
+
*
|
|
49
|
+
* `clear` is the authoring default: text typed over a highlighted placeholder
|
|
50
|
+
* is new text, and keeping the marker that said "fill this in" would carry it
|
|
51
|
+
* into the finished document. `keep` is for a caller that states the
|
|
52
|
+
* replacement's own run properties rather than letting it inherit them — a
|
|
53
|
+
* comparison reproducing a revised document holds the properties that document
|
|
54
|
+
* has, and clearing them first records a run-property change it takes straight
|
|
55
|
+
* back, which reaches the reader as a revision whose before and after are the
|
|
56
|
+
* same.
|
|
57
|
+
*/
|
|
58
|
+
export type FolioReplacementBackground = "clear" | "keep";
|
|
59
|
+
/**
|
|
60
|
+
* An apply result plus where the batch left the revision-id counter.
|
|
61
|
+
*
|
|
62
|
+
* A caller writing several batches into one package — a comparison walking
|
|
63
|
+
* the main story, then each header, footer and note — has to give every batch
|
|
64
|
+
* a seed above the last id the previous one used, or two stories claim the
|
|
65
|
+
* same `w:id` and a consumer resolving one revision resolves the other with
|
|
66
|
+
* it. The batch is the only thing that knows how many ids it took, so it says
|
|
67
|
+
* so rather than making the caller guess a stride.
|
|
68
|
+
*/
|
|
69
|
+
export type FolioAIEditApplyOutcome = FolioAIEditApplyResult & {
|
|
70
|
+
/** The held transaction was refused when its final geometry exposed a protected break. */
|
|
71
|
+
heldRevisionConflict?: true;
|
|
72
|
+
/**
|
|
73
|
+
* First revision id a following batch may allocate: one past the last id
|
|
74
|
+
* this batch used, or the seed it started from when it allocated none.
|
|
75
|
+
*/
|
|
76
|
+
nextRevisionId: number;
|
|
77
|
+
};
|
|
78
|
+
/**
|
|
79
|
+
* Operation types applied in `"suggested"` mode. Every produced revision — an
|
|
80
|
+
* inline mark, a whole-node `_suggestedInsert` marker, or a suggested
|
|
81
|
+
* `trIns`/`trDel`/`cellMarker` — is stripped from serialized DOCX until
|
|
82
|
+
* accepted. Cell merge/split (not row/column ops) and comment ops stay
|
|
83
|
+
* `unsupportedMode`.
|
|
84
|
+
*/
|
|
85
|
+
export declare const SUGGESTED_SUPPORTED_OPERATION_TYPES: ReadonlySet<FolioAIResolvedEditOperation["type"]>;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// src/ai-edits/applyTypes.ts
|
|
2
|
+
/**
|
|
3
|
+
* Operation types applied in `"suggested"` mode. Every produced revision — an
|
|
4
|
+
* inline mark, a whole-node `_suggestedInsert` marker, or a suggested
|
|
5
|
+
* `trIns`/`trDel`/`cellMarker` — is stripped from serialized DOCX until
|
|
6
|
+
* accepted. Cell merge/split (not row/column ops) and comment ops stay
|
|
7
|
+
* `unsupportedMode`.
|
|
8
|
+
*/
|
|
9
|
+
const SUGGESTED_SUPPORTED_OPERATION_TYPES = /* @__PURE__ */ new Set([
|
|
10
|
+
"replaceInBlock",
|
|
11
|
+
"replaceRange",
|
|
12
|
+
"formatRange",
|
|
13
|
+
"setBlockParagraphProperties",
|
|
14
|
+
"replaceBlock",
|
|
15
|
+
"deleteBlock",
|
|
16
|
+
"insertAfterBlock",
|
|
17
|
+
"insertBeforeBlock",
|
|
18
|
+
"insertSignatureTable",
|
|
19
|
+
"insertTableRow",
|
|
20
|
+
"deleteTableRow",
|
|
21
|
+
"insertTableColumn",
|
|
22
|
+
"deleteTableColumn"
|
|
23
|
+
]);
|
|
24
|
+
export { SUGGESTED_SUPPORTED_OPERATION_TYPES };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { PageBreakRunAttrs } from "../prosemirror/schema/nodes.js";
|
|
2
2
|
import { NoteReferenceKind } from "../utils/noteReferenceLabels.js";
|
|
3
3
|
import { NoteReferenceLabels } from "./note-references.js";
|
|
4
|
-
import { Node } from "prosemirror-model";
|
|
4
|
+
import { Mark, Node, Schema } from "prosemirror-model";
|
|
5
5
|
/**
|
|
6
6
|
* "Post-tracked-changes" view of a textblock: the string the user
|
|
7
7
|
* would see if every existing tracked change were accepted.
|
|
@@ -135,4 +135,10 @@ export declare const buildAnnotatedBlockText: (blockNode: Node) => string;
|
|
|
135
135
|
* reference reads as the marker every other reader of the story shows.
|
|
136
136
|
*/
|
|
137
137
|
export declare const buildAnnotatedBlockTextWithNoteReferences: (blockNode: Node, noteReferences: NoteReferenceLabels | undefined) => string;
|
|
138
|
+
type CleanTextInlineNodesOptions = {
|
|
139
|
+
schema: Schema;
|
|
140
|
+
text: string;
|
|
141
|
+
marks?: readonly Mark[] | undefined;
|
|
142
|
+
};
|
|
143
|
+
export declare const cleanTextInlineNodes: ({ schema, text, marks }: CleanTextInlineNodesOptions) => Node[];
|
|
138
144
|
export {};
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { expectPageBreakRunAttrs } from "../prosemirror/attrs/index.js";
|
|
2
|
-
import { runFormattingInlineAtomCleanText, runFormattingInlineControlCharacter } from "../prosemirror/runFormattingInlineCarriers.js";
|
|
2
|
+
import { runFormattingInlineAtomCleanText, runFormattingInlineControlCharacter, runFormattingInlineControlNodeName } from "../prosemirror/runFormattingInlineCarriers.js";
|
|
3
3
|
import { createNoteReferenceNumbering, noteReferenceMarker } from "../utils/noteReferenceLabels.js";
|
|
4
4
|
import { noteReferenceOf } from "./note-references.js";
|
|
5
|
+
import { panic } from "better-result";
|
|
5
6
|
// src/ai-edits/clean-text.ts
|
|
6
7
|
const EMPTY_CLEAN_TEXT_STRUCTURAL_BOUNDARIES = Object.freeze([]);
|
|
7
8
|
const cutsIntoSpan = ({ offset, length }, boundaryOffset) => boundaryOffset > offset && boundaryOffset < offset + length;
|
|
@@ -214,4 +215,24 @@ const renderAnnotatedSegment = ({ annotation, text }) => {
|
|
|
214
215
|
if (annotation.commentId !== null) inner = `<comment id="${annotation.commentId}">${inner}</comment>`;
|
|
215
216
|
return inner;
|
|
216
217
|
};
|
|
217
|
-
|
|
218
|
+
const CLEAN_TEXT_CONTROL_PATTERN = /[\t\n]/gu;
|
|
219
|
+
const cleanTextInlineNodes = ({ schema, text, marks = [] }) => {
|
|
220
|
+
const nodes = [];
|
|
221
|
+
let offset = 0;
|
|
222
|
+
for (const match of text.matchAll(CLEAN_TEXT_CONTROL_PATTERN)) {
|
|
223
|
+
const index = match.index;
|
|
224
|
+
const preceding = text.slice(offset, index);
|
|
225
|
+
if (preceding.length > 0) nodes.push(schema.text(preceding, marks));
|
|
226
|
+
const control = match[0];
|
|
227
|
+
const nodeName = runFormattingInlineControlNodeName(control);
|
|
228
|
+
if (nodeName === null) panic("A clean-text control pattern matched an unrepresentable character", { control });
|
|
229
|
+
const type = schema.nodes[nodeName];
|
|
230
|
+
if (!type) panic("The editor schema cannot represent a clean-text control character", { control });
|
|
231
|
+
nodes.push(type.create(null, null, marks));
|
|
232
|
+
offset = index + control.length;
|
|
233
|
+
}
|
|
234
|
+
const trailing = text.slice(offset);
|
|
235
|
+
if (trailing.length > 0) nodes.push(schema.text(trailing, marks));
|
|
236
|
+
return nodes;
|
|
237
|
+
};
|
|
238
|
+
export { buildAnnotatedBlockText, buildAnnotatedBlockTextWithNoteReferences, buildCleanBlockText, cleanTextInlineNodes, isOmittedFromCleanView, resolveCleanTextRange };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { document_d_exports } from "../types/document.js";
|
|
2
|
-
import { FolioRevisionStamp } from "./
|
|
2
|
+
import { FolioRevisionStamp } from "./applyTypes.js";
|
|
3
3
|
type StageFinalSectionPropertiesOptions = {
|
|
4
4
|
target: document_d_exports.SectionProperties;
|
|
5
5
|
previous: document_d_exports.SectionProperties;
|
|
@@ -5,7 +5,7 @@ import { ImportReferencedStyleDefinitionsResult } from "../compare/style-resourc
|
|
|
5
5
|
import { FolioDocumentOperationBatchInput, FolioDocumentOperationResult, FolioDocumentOperationUndoHandle, FolioDocumentOperationUndoResult } from "../document-operations.js";
|
|
6
6
|
import { HeadlessReviewerSession } from "../types/canonicalCapabilities.js";
|
|
7
7
|
import { document_d_exports } from "../types/document.js";
|
|
8
|
-
import { FolioReplacementBackground, FolioRevisionStamp, FolioWordDiffOptions } from "./
|
|
8
|
+
import { FolioReplacementBackground, FolioRevisionStamp, FolioWordDiffOptions } from "./applyTypes.js";
|
|
9
9
|
import { FolioPendingSuggestionLoadResult, FolioPendingSuggestionRecord } from "./pending-suggestions.js";
|
|
10
10
|
import { FolioAbsorbedBlock, FolioReviewChange, FolioReviewChangeKind, FolioReviewResolution, FolioReviewResolutionSkip } from "./read.js";
|
|
11
11
|
import { FolioStoryTable } from "./snapshot.js";
|
|
@@ -29,20 +29,9 @@ export type FolioDocxReviewerOptions = {
|
|
|
29
29
|
/** Password for Agile-encrypted .docx files (Office 2010+). */
|
|
30
30
|
password?: string | undefined;
|
|
31
31
|
/**
|
|
32
|
-
* The engine the document is held in
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
* canonical mode runs. Every read comes from it, and operations in every
|
|
36
|
-
* story, their undo, comment replies and resolution, the resolution of
|
|
37
|
-
* tracked changes and the save run on it as the canonical editor runs
|
|
38
|
-
* them, and resolved views are read from a second session resolved to
|
|
39
|
-
* the view; suggested batches stage on it and its suggestions resolve
|
|
40
|
-
* through its suggestion intent across all stories. Comparison
|
|
41
|
-
* inline-provenance matching throws a `CanonicalSessionError` under
|
|
42
|
-
* `publicOps.headlessSession`.
|
|
43
|
-
* Resolving one story to a view also refuses while it holds staged
|
|
44
|
-
* suggestions. Locks that prevent a complete view refuse rather than
|
|
45
|
-
* returning a partial view. These paths never fall back to the legacy engine.
|
|
32
|
+
* The engine the document is held in: the canonical session the editors
|
|
33
|
+
* run. Every read, operation, undo, resolution, resolved view and save runs
|
|
34
|
+
* on it; what the session cannot express throws a `CanonicalSessionError`.
|
|
46
35
|
*/
|
|
47
36
|
session?: HeadlessReviewerSession;
|
|
48
37
|
};
|
|
@@ -168,13 +157,12 @@ export declare class UnsupportedFolioReviewedViewError extends UnsupportedFolioR
|
|
|
168
157
|
}> {}
|
|
169
158
|
declare const FolioRoomJournalErrorBase: TaggedErrorClass<"FolioRoomJournalError">;
|
|
170
159
|
/**
|
|
171
|
-
* Why a reviewer could not replay a room's journal. `
|
|
172
|
-
*
|
|
173
|
-
* after the last the reviewer applied.
|
|
160
|
+
* Why a reviewer could not replay a room's journal. `revisionGap`: a batch is
|
|
161
|
+
* not the one after the last the reviewer applied.
|
|
174
162
|
*/
|
|
175
163
|
export declare class FolioRoomJournalError extends FolioRoomJournalErrorBase<{
|
|
176
164
|
message: string;
|
|
177
|
-
reason: "
|
|
165
|
+
reason: "revisionGap";
|
|
178
166
|
expectedRevision: number;
|
|
179
167
|
receivedRevision: number | undefined;
|
|
180
168
|
}> {}
|
|
@@ -387,23 +375,10 @@ export declare class FolioDocxReviewer {
|
|
|
387
375
|
private snapshotOf;
|
|
388
376
|
/** Default author for tracked changes and comments. */
|
|
389
377
|
readonly author: string;
|
|
390
|
-
/** The
|
|
378
|
+
/** The model the reviewer was opened on; the readers follow the session's. */
|
|
391
379
|
private readonly loadedDocument;
|
|
392
|
-
private finalSectionPropertiesOverride;
|
|
393
380
|
private readonly originalBuffer;
|
|
394
381
|
private state;
|
|
395
|
-
private readonly secondaryStoryStates;
|
|
396
|
-
private readonly removedHeaderFooterStories;
|
|
397
|
-
/** Notes whose reference a resolution removed: a note exists only through its reference. */
|
|
398
|
-
private readonly removedNoteStories;
|
|
399
|
-
private readonly sectionReferenceRemovals;
|
|
400
|
-
private importedStyles;
|
|
401
|
-
private readonly importedMedia;
|
|
402
|
-
private readonly importedHeaders;
|
|
403
|
-
private readonly importedFooters;
|
|
404
|
-
private readonly resolvedStoryExpectations;
|
|
405
|
-
private readonly createdComments;
|
|
406
|
-
private deletedCommentIds;
|
|
407
382
|
/** Comments the body anchored when it was loaded, read as the editor projects it. */
|
|
408
383
|
private readonly loadedMainCommentIds;
|
|
409
384
|
/**
|
|
@@ -412,17 +387,7 @@ export declare class FolioDocxReviewer {
|
|
|
412
387
|
* pairs two documents' paragraphs by them.
|
|
413
388
|
*/
|
|
414
389
|
private readonly positionalParaIds;
|
|
415
|
-
private readonly documentOperationUndoEntries;
|
|
416
390
|
private pendingSuggestions;
|
|
417
|
-
/**
|
|
418
|
-
* Resolved-state overrides recorded by {@link resolveComment}, keyed by
|
|
419
|
-
* comment id. Applied on read ({@link getComments}) and on write
|
|
420
|
-
* ({@link toDocument}) rather than mutating the parsed `Comment` objects in
|
|
421
|
-
* place, matching how the parser/serializer treat `Comment` as immutable
|
|
422
|
-
* (`commentParser.ts` replaces array slots via spread; the serializer
|
|
423
|
-
* types its inputs `readonly Comment[]`).
|
|
424
|
-
*/
|
|
425
|
-
private readonly resolvedOverrides;
|
|
426
391
|
/** The last room revision {@link applyRoomJournal} applied. */
|
|
427
392
|
private roomRevision;
|
|
428
393
|
/** The resolved copies {@link resolvedSessionReader} last read, by view. */
|
|
@@ -433,14 +398,6 @@ export declare class FolioDocxReviewer {
|
|
|
433
398
|
private constructor();
|
|
434
399
|
private registerComparisonAccess;
|
|
435
400
|
private stageTargetStyles;
|
|
436
|
-
private installImportedStyles;
|
|
437
|
-
/**
|
|
438
|
-
* A raw final table has no paragraph mark after it for Word to merge into
|
|
439
|
-
* when the target ends in a paragraph. Folio-exact comparison adds this
|
|
440
|
-
* untracked receiver before planning; its private marker makes resolving in
|
|
441
|
-
* Folio restore the raw source view.
|
|
442
|
-
*/
|
|
443
|
-
private stageTerminalTableReviewCarrier;
|
|
444
401
|
private stageTargetNumbering;
|
|
445
402
|
private planTargetNumberingReferences;
|
|
446
403
|
/**
|
|
@@ -451,11 +408,6 @@ export declare class FolioDocxReviewer {
|
|
|
451
408
|
static openRoomBase(buffer: ArrayBuffer): Promise<CanonicalRoomBase>;
|
|
452
409
|
/** Parse a `.docx` buffer into a reviewer. */
|
|
453
410
|
static fromBuffer(buffer: ArrayBuffer, options?: FolioDocxReviewerOptions): Promise<FolioDocxReviewer>;
|
|
454
|
-
/**
|
|
455
|
-
* A legacy reviewer over a parsed or resolved document. A resolved one names
|
|
456
|
-
* the ids its source read as positional, which its model now spells as ids.
|
|
457
|
-
*/
|
|
458
|
-
private static legacyOver;
|
|
459
411
|
/**
|
|
460
412
|
* Load as a canonical editor does: the same input normalization (paragraph
|
|
461
413
|
* and content control ids minted in the package), then the session over the
|
|
@@ -479,8 +431,6 @@ export declare class FolioDocxReviewer {
|
|
|
479
431
|
* either leave the other as it is. The copy's undo history starts empty.
|
|
480
432
|
*/
|
|
481
433
|
fork(): FolioDocxReviewer;
|
|
482
|
-
/** A constructor-backed copy over the legacy snapshot owner. */
|
|
483
|
-
private forkLegacy;
|
|
484
434
|
private canonicalComparisonAccess;
|
|
485
435
|
private stageFinalSectionPropertiesOnSession;
|
|
486
436
|
/** Resolve on an independent fork, then publish only the complete semantic projection. */
|
|
@@ -494,12 +444,7 @@ export declare class FolioDocxReviewer {
|
|
|
494
444
|
applyRoomJournal(journal: readonly SequencedBatch[]): void;
|
|
495
445
|
private commitOpsOnSession;
|
|
496
446
|
private stageMappedSectionBoundariesOnSession;
|
|
497
|
-
/**
|
|
498
|
-
private restoreReviewerState;
|
|
499
|
-
/**
|
|
500
|
-
* The model the readers read: the parsed package on the legacy engine, the
|
|
501
|
-
* session's document, as it is after every commit, on the canonical one.
|
|
502
|
-
*/
|
|
447
|
+
/** The model the readers read: the session's document after every commit. */
|
|
503
448
|
private get baseDocument();
|
|
504
449
|
/**
|
|
505
450
|
* Publish a commit the session prepared on the reviewer's main state. The
|
|
@@ -530,21 +475,15 @@ export declare class FolioDocxReviewer {
|
|
|
530
475
|
* the anchor map the apply layer resolves operations against.
|
|
531
476
|
*/
|
|
532
477
|
snapshot(): FolioAIEditSnapshot;
|
|
533
|
-
/**
|
|
534
|
-
* The numbering ids every story but `story` defines: the package's and the
|
|
535
|
-
* lists each story started. Numbering ids are package-wide, while a story's
|
|
536
|
-
* state completes its numbering from its own paragraphs only.
|
|
537
|
-
*/
|
|
538
|
-
private numberingIdsOutside;
|
|
539
478
|
/** Every suggestion id the document's stories still carry. */
|
|
540
479
|
private activeSuggestionIds;
|
|
541
480
|
/** Export staged AI operations for storage by the host, outside the DOCX. */
|
|
542
481
|
exportPendingSuggestions(): FolioPendingSuggestionRecord[];
|
|
543
482
|
/**
|
|
544
483
|
* A story as a save writes it, every pending suggestion rejected: what a
|
|
545
|
-
* suggestion record's fingerprint describes.
|
|
546
|
-
*
|
|
547
|
-
*
|
|
484
|
+
* suggestion record's fingerprint describes. It is read from a session over
|
|
485
|
+
* the document the save writes, so a reviewer reopened on the saved package
|
|
486
|
+
* reads the same story.
|
|
548
487
|
*/
|
|
549
488
|
private pendingSuggestionSource;
|
|
550
489
|
/** Validate saved proposals against this document before restaging them. */
|
|
@@ -572,7 +511,6 @@ export declare class FolioDocxReviewer {
|
|
|
572
511
|
/** Snapshot one editable story into stable, operation-ready blocks. */
|
|
573
512
|
snapshotStory(story: FolioEditableDocumentStoryHandle): FolioAIEditSnapshot | null;
|
|
574
513
|
private snapshotReviewedStoryInternal;
|
|
575
|
-
private projectComparisonStoriesInternal;
|
|
576
514
|
/**
|
|
577
515
|
* One story's tables, in the document order {@link snapshotStory} numbers
|
|
578
516
|
* them with, read through a reviewed view.
|
|
@@ -602,13 +540,12 @@ export declare class FolioDocxReviewer {
|
|
|
602
540
|
*/
|
|
603
541
|
readReviewedStory(options?: FolioReadReviewedStoryOptions): FolioReviewedStory | null;
|
|
604
542
|
/**
|
|
605
|
-
* Resolve one editable story to its original or final state
|
|
606
|
-
*
|
|
607
|
-
* the suggestion methods
|
|
608
|
-
* from resolving refuses before mutation.
|
|
543
|
+
* Resolve one editable story to its original or final state, its staged
|
|
544
|
+
* suggestions with its other changes. A suggestion that reaches another
|
|
545
|
+
* story resolves only whole, through the suggestion methods. A lock that
|
|
546
|
+
* prevents any target change from resolving refuses before mutation.
|
|
609
547
|
*/
|
|
610
548
|
resolveReviewedStory({ story, view }: FolioResolveReviewedStoryOptions): boolean;
|
|
611
|
-
private resolveReviewedStorySnapshotInternal;
|
|
612
549
|
/**
|
|
613
550
|
* Apply operations against the current state. Reuses the live-editor applier
|
|
614
551
|
* verbatim via a headless `{ state, dispatch }` seam; the resulting state
|
|
@@ -624,9 +561,6 @@ export declare class FolioDocxReviewer {
|
|
|
624
561
|
applyDocumentOperations(batch: FolioDocumentOperationBatchInput, options: FolioApplyDocumentOperationsOptions): FolioDocumentOperationResult;
|
|
625
562
|
/** Apply a versioned operation batch to one editable document story. */
|
|
626
563
|
applyDocumentOperationsToStory({ story, batch, snapshot, revisionStamp, wordDiff, tableTemplates, replacementBackground, undefinedReferences }: FolioApplyDocumentOperationsToStoryOptions): FolioDocumentOperationResult;
|
|
627
|
-
/** Apply a batch; the notes whose references it deletes or removes follow them. */
|
|
628
|
-
private applyDocumentOperationsInternal;
|
|
629
|
-
private applyDocumentOperationsToStoryState;
|
|
630
564
|
/**
|
|
631
565
|
* Undo the latest unchanged document-operation batch and its created
|
|
632
566
|
* comments. Only the last {@link FOLIO_DOCUMENT_OPERATION_UNDO_LIMIT}
|
|
@@ -695,7 +629,6 @@ export declare class FolioDocxReviewer {
|
|
|
695
629
|
deleted: number[];
|
|
696
630
|
};
|
|
697
631
|
private currentCommentDefinitions;
|
|
698
|
-
private deleteCommentAnchors;
|
|
699
632
|
/**
|
|
700
633
|
* Add a reply to a comment thread. Pass a {@link FolioReviewComment} from
|
|
701
634
|
* {@link getComments} or its id; the reply threads under that comment's root
|
|
@@ -706,7 +639,6 @@ export declare class FolioDocxReviewer {
|
|
|
706
639
|
* the created reply, or `null` when the target comment is absent.
|
|
707
640
|
*/
|
|
708
641
|
replyTo(target: FolioReviewComment | number, input: FolioReviewReplyInput): FolioReviewCommentReply | null;
|
|
709
|
-
private anchorReplyInEditor;
|
|
710
642
|
/**
|
|
711
643
|
* Mark a comment thread resolved, or reopen a previously resolved one. Pass
|
|
712
644
|
* the id from {@link getComments} / {@link FolioReviewComment.id}. Applies
|
|
@@ -740,9 +672,6 @@ export declare class FolioDocxReviewer {
|
|
|
740
672
|
*/
|
|
741
673
|
private headerFooterPlacements;
|
|
742
674
|
private currentFinalSectionProperties;
|
|
743
|
-
private stageFinalSectionProperties;
|
|
744
|
-
private stageMappedSectionBoundaries;
|
|
745
|
-
private resolveFinalSectionProperties;
|
|
746
675
|
/**
|
|
747
676
|
* Accept an existing tracked change, keeping its text and dropping the
|
|
748
677
|
* redline. Pass a {@link FolioReviewChange} from {@link getChanges} or its
|
|
@@ -754,13 +683,11 @@ export declare class FolioDocxReviewer {
|
|
|
754
683
|
* removal. A held change stays pending as it is.
|
|
755
684
|
*/
|
|
756
685
|
acceptChange(target: FolioReviewChange | number): boolean;
|
|
757
|
-
private acceptChangeInternal;
|
|
758
686
|
/**
|
|
759
687
|
* Reject an existing tracked change: an insertion's text is removed, a
|
|
760
688
|
* deletion's text is restored. See {@link acceptChange} for targeting.
|
|
761
689
|
*/
|
|
762
690
|
rejectChange(target: FolioReviewChange | number): boolean;
|
|
763
|
-
private rejectChangeInternal;
|
|
764
691
|
/** Convert one pending suggestion into an ordinary tracked change. */
|
|
765
692
|
acceptSuggestion(suggestionId: string, options?: {
|
|
766
693
|
author?: string;
|
|
@@ -801,33 +728,6 @@ export declare class FolioDocxReviewer {
|
|
|
801
728
|
* `skipped`, as on the legacy engine.
|
|
802
729
|
*/
|
|
803
730
|
private resolveAllOnSession;
|
|
804
|
-
private resolveAll;
|
|
805
|
-
private resolveWithSectionReferenceHistory;
|
|
806
|
-
private resolveEveryFinalSectionChange;
|
|
807
|
-
private resolveEveryStory;
|
|
808
|
-
/**
|
|
809
|
-
* Change the body the way a note follows its reference: a note whose
|
|
810
|
-
* reference goes, goes too, as a note no text refers to does; a note whose
|
|
811
|
-
* reference an edit deletes as a tracked change has its text deleted with
|
|
812
|
-
* it; a note whose reference's deletion is rejected gets back the text that
|
|
813
|
-
* deletion took.
|
|
814
|
-
*/
|
|
815
|
-
private withNotesFollowingReferences;
|
|
816
|
-
/** Delete the text of each note whose reference went from live to a tracked deletion. */
|
|
817
|
-
private deleteNotesWithTheirReferences;
|
|
818
|
-
/**
|
|
819
|
-
* The notes a story other than the body refers to (a header, a footer, a
|
|
820
|
-
* comment, another note), leaving out references inside the `skipped` notes.
|
|
821
|
-
*/
|
|
822
|
-
private noteKeysReferencedOutsideBody;
|
|
823
|
-
private resolveEveryStoryOnce;
|
|
824
|
-
/**
|
|
825
|
-
* Resolve each change of a story a content control's lock does not hold, on
|
|
826
|
-
* its own: the one-pass resolver takes the whole story or nothing. The held
|
|
827
|
-
* changes stay pending as they are and are reported in `skipped`.
|
|
828
|
-
*/
|
|
829
|
-
private resolveStoryAroundHeldChanges;
|
|
830
|
-
private acceptOrdinaryChangesWithSuggestions;
|
|
831
731
|
/** Resolve ordinary revisions on a detached in-memory document. */
|
|
832
732
|
toResolvedDocument(decision: "accept" | "reject"): document_d_exports.Document;
|
|
833
733
|
/**
|
|
@@ -845,11 +745,6 @@ export declare class FolioDocxReviewer {
|
|
|
845
745
|
* weakly, so a reviewer does not keep the copy's session alive.
|
|
846
746
|
*/
|
|
847
747
|
private resolvedSessionReader;
|
|
848
|
-
/**
|
|
849
|
-
* The paragraph ids this reviewer's stories read as positional: ids it
|
|
850
|
-
* minted where the package named none, which `toDocument` writes as ids.
|
|
851
|
-
*/
|
|
852
|
-
private storyPositionalParaIds;
|
|
853
748
|
/**
|
|
854
749
|
* A reviewer on a second session over the current document, as a reviewer
|
|
855
750
|
* reopened on it would hold it, with every change resolved to `view`. This
|
|
@@ -857,6 +752,19 @@ export declare class FolioDocxReviewer {
|
|
|
857
752
|
* cannot resolve yet refuses as `acceptAll` and `rejectAll` do.
|
|
858
753
|
*/
|
|
859
754
|
private resolvedSessionCopy;
|
|
755
|
+
/**
|
|
756
|
+
* Turn every staged suggestion into an ordinary tracked change, so that
|
|
757
|
+
* accepting every change accepts the suggestions too.
|
|
758
|
+
*/
|
|
759
|
+
private promoteSuggestionsOnSession;
|
|
760
|
+
/**
|
|
761
|
+
* A story holding staged suggestions resolved to `view`: its suggestions
|
|
762
|
+
* resolve with its other changes, on a fork, and the fork's operations
|
|
763
|
+
* land here as one commit, so a refusal leaves this reviewer as it was. A
|
|
764
|
+
* suggestion that reaches another story resolves only whole, so resolving
|
|
765
|
+
* one of its stories refuses.
|
|
766
|
+
*/
|
|
767
|
+
private resolveStoryWithSuggestions;
|
|
860
768
|
/**
|
|
861
769
|
* Resolve one story's changes to `view` in one session commit: the body's
|
|
862
770
|
* through the review intent, another story's as its resolution operation.
|
|
@@ -864,9 +772,6 @@ export declare class FolioDocxReviewer {
|
|
|
864
772
|
private resolveStoryOnSession;
|
|
865
773
|
/** The current document model with edits merged back in. */
|
|
866
774
|
toDocument(): document_d_exports.Document;
|
|
867
|
-
private captureReviewerState;
|
|
868
|
-
private documentFromStateSnapshot;
|
|
869
|
-
private captureSaveSnapshot;
|
|
870
775
|
/**
|
|
871
776
|
* Serialise the reviewed document to a new `.docx` buffer. Tries a selective
|
|
872
777
|
* patch first (only changed paragraphs are rewritten; every other byte of the
|
|
@@ -887,14 +792,6 @@ export declare class FolioDocxReviewer {
|
|
|
887
792
|
* writes them.
|
|
888
793
|
*/
|
|
889
794
|
private saveOnSession;
|
|
890
|
-
private assertResolvedStoriesSerialized;
|
|
891
|
-
/**
|
|
892
|
-
* Attempt the selective patch, treating a throw the same as a decline. Odd
|
|
893
|
-
* source XML can make the paragraph diff throw rather than return `null`; a
|
|
894
|
-
* full repack is the correct lossless fallback in both cases, so the fallback
|
|
895
|
-
* is the graceful handling — no separate error surface is needed here.
|
|
896
|
-
*/
|
|
897
|
-
private trySelectiveSave;
|
|
898
795
|
private getEditableStoryState;
|
|
899
796
|
/**
|
|
900
797
|
* A secondary story as its editable state holds it: the loaded state's
|
|
@@ -911,8 +808,6 @@ export declare class FolioDocxReviewer {
|
|
|
911
808
|
* session's story projections yet.
|
|
912
809
|
*/
|
|
913
810
|
private secondaryStoryDoc;
|
|
914
|
-
private requireEditableStoryState;
|
|
915
|
-
private setEditableStoryState;
|
|
916
811
|
private getHeaderFooterStory;
|
|
917
812
|
private createComparisonHeaderFooter;
|
|
918
813
|
private canImportHeaderFooterContent;
|
|
@@ -928,13 +823,9 @@ export declare class FolioDocxReviewer {
|
|
|
928
823
|
* another after. This is the conversion the save path already performs on the
|
|
929
824
|
* same states, so the text now describes exactly what a save would write.
|
|
930
825
|
*/
|
|
931
|
-
private storyBlocks;
|
|
932
826
|
private getHeaderFooterStoryText;
|
|
933
827
|
private getNoteStoryText;
|
|
934
828
|
private getStoryText;
|
|
935
|
-
private mergeEditedSecondaryStories;
|
|
936
|
-
/** Apply any {@link resolveComment} overrides recorded for these comments. */
|
|
937
|
-
private withResolvedOverrides;
|
|
938
829
|
/**
|
|
939
830
|
* `comments` without the threads an edit left anchored nowhere: anchored in
|
|
940
831
|
* a story when it was loaded (or created anchored by this reviewer), and
|
|
@@ -947,15 +838,6 @@ export declare class FolioDocxReviewer {
|
|
|
947
838
|
* story is read, not only the body.
|
|
948
839
|
*/
|
|
949
840
|
private commentAnchors;
|
|
950
|
-
/** Allocate outside every parsed or newly-created comment and reply id. */
|
|
951
|
-
private nextCommentId;
|
|
952
|
-
/**
|
|
953
|
-
* Drive a ProseMirror command against the reviewer's headless state via the
|
|
954
|
-
* same `{ state, dispatch }` seam {@link applyOperations} uses, retaining the
|
|
955
|
-
* resulting state for {@link toBuffer}.
|
|
956
|
-
*/
|
|
957
|
-
private runCommand;
|
|
958
|
-
private runStoryCommand;
|
|
959
841
|
}
|
|
960
842
|
/** @internal Comparison-only access to atomic and fresh reviewer projections. */
|
|
961
843
|
export declare const getFolioDocxComparisonAccess: (reviewer: FolioDocxReviewer) => FolioDocxComparisonAccess;
|