@stll/folio-core 0.32.2 → 0.33.1
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/__fixtures__/paragraphs.d.ts +17 -0
- package/dist/ai-edits/__fixtures__/paragraphs.js +33 -0
- package/dist/ai-edits/apply.d.ts +49 -3
- package/dist/ai-edits/apply.js +652 -86
- package/dist/ai-edits/blockRange.d.ts +7 -3
- package/dist/ai-edits/blockRange.js +14 -6
- package/dist/ai-edits/headless.d.ts +39 -5
- package/dist/ai-edits/headless.js +76 -17
- package/dist/ai-edits/index.d.ts +6 -6
- package/dist/ai-edits/index.js +3 -3
- package/dist/ai-edits/read.d.ts +4 -0
- package/dist/ai-edits/read.js +30 -6
- package/dist/ai-edits/scoped-reading.js +4 -3
- package/dist/ai-edits/snapshot.d.ts +42 -2
- package/dist/ai-edits/snapshot.js +127 -62
- package/dist/ai-edits/table-row-column-mutations.d.ts +24 -1
- package/dist/ai-edits/table-row-column-mutations.js +98 -6
- package/dist/ai-edits/table-targets.d.ts +12 -3
- package/dist/ai-edits/table-targets.js +15 -5
- package/dist/ai-edits/types.d.ts +219 -15
- package/dist/ai-edits/word-diff.d.ts +54 -11
- package/dist/ai-edits/word-diff.js +221 -61
- package/dist/compare/__fixtures__/body-sequence.d.ts +56 -0
- package/dist/compare/__fixtures__/body-sequence.js +136 -0
- package/dist/compare/__fixtures__/nested-table.d.ts +16 -0
- package/dist/compare/__fixtures__/nested-table.js +50 -0
- package/dist/compare/__fixtures__/numbered-list.d.ts +34 -0
- package/dist/compare/__fixtures__/numbered-list.js +85 -0
- package/dist/compare/column-alignment.d.ts +27 -0
- package/dist/compare/column-alignment.js +162 -0
- package/dist/compare/compare.d.ts +107 -0
- package/dist/compare/compare.js +412 -0
- package/dist/compare/formatting.d.ts +29 -0
- package/dist/compare/formatting.js +84 -0
- package/dist/compare/plan.d.ts +22 -0
- package/dist/compare/plan.js +1141 -0
- package/dist/compare/reproducible-package.d.ts +21 -0
- package/dist/compare/reproducible-package.js +47 -0
- package/dist/compare/scenario.d.ts +77 -0
- package/dist/compare/scenario.js +263 -0
- package/dist/compare/types.d.ts +297 -0
- package/dist/compare/types.js +42 -0
- package/dist/compare/verification.d.ts +83 -0
- package/dist/compare/verification.js +189 -0
- package/dist/compat/eigenpal.d.ts +9 -6
- package/dist/compat/eigenpal.js +6 -3
- package/dist/controller/layoutPipeline.d.ts +13 -0
- package/dist/controller/layoutPipeline.js +15 -1
- package/dist/display-list/build/buildContext.d.ts +39 -0
- package/dist/display-list/build/buildContext.js +31 -0
- package/dist/display-list/build/buildDisplayList.d.ts +79 -0
- package/dist/display-list/build/buildDisplayList.js +283 -0
- package/dist/display-list/build/colors.d.ts +20 -0
- package/dist/display-list/build/colors.js +136 -0
- package/dist/display-list/build/floatingImages.d.ts +24 -0
- package/dist/display-list/build/floatingImages.js +41 -0
- package/dist/display-list/build/fontTable.d.ts +31 -0
- package/dist/display-list/build/fontTable.js +97 -0
- package/dist/display-list/build/furniture.d.ts +86 -0
- package/dist/display-list/build/furniture.js +98 -0
- package/dist/display-list/build/glyphs.d.ts +55 -0
- package/dist/display-list/build/glyphs.js +103 -0
- package/dist/display-list/build/headerFooterPrimitives.d.ts +17 -0
- package/dist/display-list/build/headerFooterPrimitives.js +40 -0
- package/dist/display-list/build/imagePrimitives.d.ts +35 -0
- package/dist/display-list/build/imagePrimitives.js +264 -0
- package/dist/display-list/build/pageBorderPrimitives.d.ts +23 -0
- package/dist/display-list/build/pageBorderPrimitives.js +111 -0
- package/dist/display-list/build/pageFurniture.d.ts +35 -0
- package/dist/display-list/build/pageFurniture.js +141 -0
- package/dist/display-list/build/paragraphPrimitives.d.ts +19 -0
- package/dist/display-list/build/paragraphPrimitives.js +819 -0
- package/dist/display-list/build/regions.d.ts +46 -0
- package/dist/display-list/build/regions.js +56 -0
- package/dist/display-list/build/storyPrimitives.d.ts +29 -0
- package/dist/display-list/build/storyPrimitives.js +279 -0
- package/dist/display-list/build/strokes.d.ts +19 -0
- package/dist/display-list/build/strokes.js +78 -0
- package/dist/display-list/build/tablePrimitives.d.ts +38 -0
- package/dist/display-list/build/tablePrimitives.js +409 -0
- package/dist/display-list/build/textBoxPrimitives.d.ts +14 -0
- package/dist/display-list/build/textBoxPrimitives.js +129 -0
- package/dist/display-list/build/textDecorations.d.ts +29 -0
- package/dist/display-list/build/textDecorations.js +29 -0
- package/dist/display-list/build/unsupported.d.ts +57 -0
- package/dist/display-list/build/unsupported.js +0 -0
- package/dist/display-list/build/watermarkPrimitives.d.ts +15 -0
- package/dist/display-list/build/watermarkPrimitives.js +128 -0
- package/dist/display-list/dom/renderDisplayListToDom.d.ts +26 -0
- package/dist/display-list/dom/renderDisplayListToDom.js +620 -0
- package/dist/display-list/editor/displayListPagePainter.d.ts +22 -0
- package/dist/display-list/editor/displayListPagePainter.js +63 -0
- package/dist/display-list/editor/pageRenderer.d.ts +24 -0
- package/dist/display-list/editor/pageRenderer.js +36 -0
- package/dist/display-list/primitives.d.ts +95 -0
- package/dist/display-list/primitives.js +127 -0
- package/dist/display-list/types.d.ts +472 -0
- package/dist/display-list/types.js +0 -0
- package/dist/document-operations.d.ts +39 -8
- package/dist/document-operations.js +169 -16
- package/dist/document-stories.d.ts +16 -0
- package/dist/document-stories.js +48 -4
- package/dist/docx/hyperlinkParser.d.ts +9 -1
- package/dist/docx/hyperlinkParser.js +19 -13
- package/dist/docx/packageParts.d.ts +35 -0
- package/dist/docx/packageParts.js +120 -0
- package/dist/docx/paraIdRangeNormalization.d.ts +40 -0
- package/dist/docx/paraIdRangeNormalization.js +64 -0
- package/dist/docx/paragraphParser.js +101 -26
- package/dist/docx/paragraphTraversal.js +1 -1
- package/dist/docx/renderedPageBreakNormalization.js +3 -1
- package/dist/docx/revisionIdNormalization.d.ts +27 -0
- package/dist/docx/revisionIdNormalization.js +121 -0
- package/dist/docx/rezip.d.ts +6 -0
- package/dist/docx/rezip.js +51 -19
- package/dist/docx/selectiveSave.js +2 -2
- package/dist/docx/serializer/commentSerializer.js +6 -1
- package/dist/docx/serializer/paragraphSerializer.js +73 -20
- package/dist/docx/serializer/runSerializer.js +11 -10
- package/dist/docx/serializer/tableSerializer.js +26 -10
- package/dist/docx/server/applyDocxXmlPatchProposal.js +1 -1
- package/dist/docx/server/createBilingualDocx.js +3 -2
- package/dist/docx/streamingXmlParser.d.ts +13 -1
- package/dist/docx/streamingXmlParser.js +49 -11
- package/dist/docx/unzip.d.ts +1 -2
- package/dist/docx/unzip.js +25 -6
- package/dist/docx/xmlParser.d.ts +3 -1
- package/dist/docx/xmlParser.js +33 -27
- package/dist/export-pdf.d.ts +43 -0
- package/dist/export-pdf.js +98 -0
- package/dist/fonts/headlessMeasure.d.ts +76 -0
- package/dist/fonts/headlessMeasure.js +0 -0
- package/dist/fonts/sfnt/parse.d.ts +51 -0
- package/dist/fonts/sfnt/parse.js +525 -0
- package/dist/fonts/sfnt/subset.d.ts +20 -0
- package/dist/fonts/sfnt/subset.js +350 -0
- package/dist/fonts/sfnt/tables.d.ts +88 -0
- package/dist/fonts/sfnt/tables.js +131 -0
- package/dist/fonts/sfnt/woff.d.ts +14 -0
- package/dist/fonts/sfnt/woff.js +163 -0
- package/dist/generated/text_shaper.js +324 -0
- package/dist/generated/text_shaper_bg.wasm +0 -0
- package/dist/headless-layout.d.ts +75 -0
- package/dist/headless-layout.js +350 -0
- package/dist/index.d.ts +9 -6
- package/dist/index.js +6 -3
- package/dist/layout-bridge/convert/footnoteLayout.d.ts +1 -0
- package/dist/layout-bridge/convert/footnoteLayout.js +1 -0
- package/dist/layout-bridge/convert/headerFooterLayout.d.ts +1 -0
- package/dist/layout-bridge/convert/headerFooterLayout.js +2 -0
- package/dist/layout-bridge/convert/toFlowBlocks.d.ts +3 -1
- package/dist/layout-bridge/convert/toFlowBlocks.js +2 -0
- package/dist/layout-engine/measure/advanceComposition.d.ts +62 -0
- package/dist/layout-engine/measure/advanceComposition.js +148 -0
- package/dist/layout-engine/measure/cache.d.ts +2 -0
- package/dist/layout-engine/measure/measureContainer.js +13 -0
- package/dist/layout-engine/measure/measureParagraph.js +1 -2
- package/dist/layout-engine/measure/measureTypes.d.ts +12 -0
- package/dist/layout-engine/measure/tableInlinePlacement.d.ts +3 -2
- package/dist/layout-engine/measure/tableInlinePlacement.js +14 -1
- package/dist/layout-engine/tableIndentCompatibility.d.ts +5 -0
- package/dist/layout-engine/tableIndentCompatibility.js +15 -0
- package/dist/layout-engine/types.d.ts +8 -0
- package/dist/layout-painter/renderPage.d.ts +29 -1
- package/dist/layout-painter/renderPage.js +47 -19
- package/dist/layout-painter/renderParagraph.d.ts +21 -2
- package/dist/layout-painter/renderParagraph.js +1 -1
- package/dist/layout-painter/renderTable.js +37 -4
- package/dist/managers/editorShortcuts.d.ts +33 -1
- package/dist/managers/editorShortcuts.js +20 -1
- package/dist/markdown/renderRuns.js +7 -2
- package/dist/markdown/renderTable.js +5 -1
- package/dist/model.d.ts +3 -3
- package/dist/model.js +2 -2
- package/dist/pdf/contentStream.d.ts +73 -0
- package/dist/pdf/contentStream.js +143 -0
- package/dist/pdf/fonts.d.ts +96 -0
- package/dist/pdf/fonts.js +593 -0
- package/dist/pdf/images.d.ts +28 -0
- package/dist/pdf/images.js +439 -0
- package/dist/pdf/objects.d.ts +93 -0
- package/dist/pdf/objects.js +237 -0
- package/dist/pdf/pageSpace.d.ts +43 -0
- package/dist/pdf/pageSpace.js +57 -0
- package/dist/pdf/paint.d.ts +32 -0
- package/dist/pdf/paint.js +442 -0
- package/dist/pdf/writePdf.d.ts +56 -0
- package/dist/pdf/writePdf.js +345 -0
- package/dist/prosemirror/commands/comments.js +96 -6
- package/dist/prosemirror/conversion/fromProseDoc.js +41 -7
- package/dist/prosemirror/conversion/toProseDoc.js +41 -4
- package/dist/prosemirror/extensions/features/ParaIdAllocatorExtension.d.ts +15 -2
- package/dist/prosemirror/extensions/features/ParaIdAllocatorExtension.js +35 -6
- package/dist/prosemirror/extensions/features/ParagraphChangeTrackerExtension.js +2 -2
- package/dist/prosemirror/extensions/features/pasteCleanup.js +4 -3
- package/dist/prosemirror/extensions/nodes/BookmarkBoundaryExtension.d.ts +3 -1
- package/dist/prosemirror/extensions/nodes/BookmarkBoundaryExtension.js +5 -3
- package/dist/prosemirror/extensions/nodes/RenderedPageBreakExtension.d.ts +7 -1
- package/dist/prosemirror/extensions/nodes/RenderedPageBreakExtension.js +9 -3
- package/dist/prosemirror/extensions/nodes/TableExtension.js +56 -39
- package/dist/prosemirror/extensions/nodes/TextBoxAnchorExtension.d.ts +3 -1
- package/dist/prosemirror/extensions/nodes/TextBoxAnchorExtension.js +5 -3
- package/dist/prosemirror/plugins/suggestionMode.js +1 -0
- package/dist/prosemirror/revisionCarriers.js +19 -2
- package/dist/prosemirror/utils/extractTrackedChanges.d.ts +2 -2
- package/dist/prosemirror/utils/extractTrackedChanges.js +59 -23
- package/dist/prosemirror/validation.js +55 -27
- package/dist/prosemirror/zeroWidthAnchors.d.ts +10 -0
- package/dist/prosemirror/zeroWidthAnchors.js +23 -0
- package/dist/redline.js +12 -79
- package/dist/server.d.ts +3 -3
- package/dist/server.js +2 -2
- package/dist/shaping/placeRun.d.ts +51 -0
- package/dist/shaping/placeRun.js +84 -0
- package/dist/shaping/shaper.d.ts +92 -0
- package/dist/shaping/shaper.js +102 -0
- package/dist/types/block-id.d.ts +18 -2
- package/dist/types/block-id.js +49 -5
- package/dist/types/content.d.ts +2 -2
- package/dist/utils/clipboard.js +4 -3
- package/dist/utils/fontResolver.js +183 -0
- package/dist/utils/htmlComments.d.ts +17 -0
- package/dist/utils/htmlComments.js +22 -0
- package/dist/utils/scriptSegments.d.ts +12 -1
- package/dist/utils/scriptSegments.js +17 -1
- package/dist/version-comparison.d.ts +1 -1
- package/package.json +7 -3
|
@@ -0,0 +1,472 @@
|
|
|
1
|
+
//#region src/display-list/types.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* The display list: folio's painter-neutral paint IR.
|
|
4
|
+
*
|
|
5
|
+
* This is seam 4 of `docs/seam-architecture.md` made explicit. The layout
|
|
6
|
+
* engine decides *where* things go; this module states *what is drawn* in
|
|
7
|
+
* terms no backend can look behind. A DOM backend and a PDF backend both
|
|
8
|
+
* consume it, so the two cannot drift: a backend that wants a fact the
|
|
9
|
+
* display list does not carry has to add it here, where both backends see it.
|
|
10
|
+
*
|
|
11
|
+
* ## Invariants
|
|
12
|
+
*
|
|
13
|
+
* - Pure data. No behaviour, no DOM, no font binaries, no layout types. The
|
|
14
|
+
* whole structure survives `JSON.parse(JSON.stringify(...))`.
|
|
15
|
+
* - Units are CSS pixels at 96 dpi, matching the layout engine
|
|
16
|
+
* (`measureHelpers.ts`). Backends convert at emit time; a PDF backend
|
|
17
|
+
* multiplies by 0.75 for points.
|
|
18
|
+
* - Coordinates are page-absolute with the origin at the page's top-left and
|
|
19
|
+
* y growing downwards, again matching the layout engine. A backend whose
|
|
20
|
+
* device space differs (PDF's origin is bottom-left) flips once, at its own
|
|
21
|
+
* edge.
|
|
22
|
+
* - `primitives` is painted in order, back to front. There is no z-index:
|
|
23
|
+
* the producer has already resolved stacking, because two backends sorting
|
|
24
|
+
* independently is exactly the divergence this module exists to prevent.
|
|
25
|
+
* - Colours are resolved. CSS custom properties (`--doc-canvas-text`) and
|
|
26
|
+
* `currentColor` are producer concerns; a backend never resolves a colour.
|
|
27
|
+
*
|
|
28
|
+
* ## What is deliberately absent
|
|
29
|
+
*
|
|
30
|
+
* Glyph ids. The display list carries code points and the *advances layout
|
|
31
|
+
* actually used*, so a backend positions text on the measurer's numbers
|
|
32
|
+
* rather than on its own idea of the font's metrics. Mapping code points to
|
|
33
|
+
* glyphs needs the font binary, which only the PDF backend has.
|
|
34
|
+
*/
|
|
35
|
+
/**
|
|
36
|
+
* Straight sRGB. `r`, `g` and `b` are integers in 0..255 and `a` is a fraction
|
|
37
|
+
* in 0..1; a producer that emits a fractional channel produces CSS a backend
|
|
38
|
+
* cannot serialize.
|
|
39
|
+
*/
|
|
40
|
+
type DisplayColor = {
|
|
41
|
+
readonly r: number;
|
|
42
|
+
readonly g: number;
|
|
43
|
+
readonly b: number;
|
|
44
|
+
readonly a: number;
|
|
45
|
+
};
|
|
46
|
+
/** A rectangle in page coordinates. */
|
|
47
|
+
type DisplayRect = {
|
|
48
|
+
readonly xPx: number;
|
|
49
|
+
readonly yPx: number;
|
|
50
|
+
readonly widthPx: number;
|
|
51
|
+
readonly heightPx: number;
|
|
52
|
+
};
|
|
53
|
+
/**
|
|
54
|
+
* Stroke patterns folio paints. `double` and `wavy` are patterns rather than
|
|
55
|
+
* widths: both backends draw them from `thicknessPx`, so neither has to guess
|
|
56
|
+
* what the other did. Dash and gap lengths live in `primitives.ts` and are
|
|
57
|
+
* imported by both backends, so neither invents a period of its own.
|
|
58
|
+
*/
|
|
59
|
+
type DisplayStrokePattern = "solid" | "dashed" | "dotted" | "double" | "wavy";
|
|
60
|
+
/**
|
|
61
|
+
* A stroke is centred on its path: half the thickness falls on each side.
|
|
62
|
+
* Stated because the backends default differently (a CSS border sits inside
|
|
63
|
+
* its box, a PDF stroke is centred), and an unstated default is a divergence
|
|
64
|
+
* that a reader finds rather than a test.
|
|
65
|
+
*/
|
|
66
|
+
type DisplayStroke = {
|
|
67
|
+
readonly color: DisplayColor;
|
|
68
|
+
readonly thicknessPx: number;
|
|
69
|
+
readonly pattern: DisplayStrokePattern;
|
|
70
|
+
};
|
|
71
|
+
/**
|
|
72
|
+
* A face embedded in the source package (`fonts/embeddedFonts.ts`). Its bytes
|
|
73
|
+
* travel with the display list because they exist nowhere else: a backend
|
|
74
|
+
* cannot resolve them from a host font list, and a face the measurer used but
|
|
75
|
+
* a backend cannot obtain is exactly the divergence this carries bytes to
|
|
76
|
+
* prevent.
|
|
77
|
+
*/
|
|
78
|
+
type DisplayEmbeddedFont = {
|
|
79
|
+
readonly id: string;
|
|
80
|
+
/** Deobfuscated sfnt or WOFF bytes. */
|
|
81
|
+
readonly bytes: Uint8Array;
|
|
82
|
+
};
|
|
83
|
+
/**
|
|
84
|
+
* A font face as the *measurer* resolved it. `family` is the resolved family
|
|
85
|
+
* the measurement was taken against, not the authored OOXML name, so a
|
|
86
|
+
* backend embedding a face embeds the face the widths came from.
|
|
87
|
+
*/
|
|
88
|
+
type DisplayFontFace = {
|
|
89
|
+
readonly family: string;
|
|
90
|
+
/** CSS weight; folio paints 400 and 700 only. */
|
|
91
|
+
readonly weight: number;
|
|
92
|
+
readonly italic: boolean;
|
|
93
|
+
/** Category to fall back on when the family itself is unavailable. */
|
|
94
|
+
readonly generic: "serif" | "sans-serif" | "monospace" | "cursive" | "fantasy";
|
|
95
|
+
/**
|
|
96
|
+
* The concrete families between `family` and `generic`, in the order the
|
|
97
|
+
* measurer would fall through them.
|
|
98
|
+
*
|
|
99
|
+
* A face is a stack, not a name: the measurer resolves one and measures with
|
|
100
|
+
* whichever entry the host actually has. A backend handed only the first
|
|
101
|
+
* entry falls straight to the generic when that entry is missing, and paints
|
|
102
|
+
* a different face from the one the page was laid out in. Empty when the
|
|
103
|
+
* resolved stack is one family and a generic.
|
|
104
|
+
*/
|
|
105
|
+
readonly fallbacks: readonly string[];
|
|
106
|
+
/**
|
|
107
|
+
* The face's own box, above and below the baseline, as fractions of the font
|
|
108
|
+
* size, exactly as the measurer reported it (`FontMetrics.fontBox*`).
|
|
109
|
+
*
|
|
110
|
+
* These are the font-box metrics, not the ink extents, because a DOM backend
|
|
111
|
+
* places a text box and a browser builds that box from the font box: given
|
|
112
|
+
* ink extents it would put every baseline out by half the difference between
|
|
113
|
+
* the two, per face, with nothing to attribute the error to. A backend
|
|
114
|
+
* holding the font binary ignores them and positions glyphs directly.
|
|
115
|
+
*/
|
|
116
|
+
readonly fontBoxAscentRatio: number;
|
|
117
|
+
readonly fontBoxDescentRatio: number;
|
|
118
|
+
/** Present only for a face embedded in the source package. */
|
|
119
|
+
readonly embedded?: DisplayEmbeddedFont;
|
|
120
|
+
};
|
|
121
|
+
/** Index into {@link DisplayList.fonts}. */
|
|
122
|
+
type DisplayFontRef = number;
|
|
123
|
+
/** Index into {@link DisplayList.images}. */
|
|
124
|
+
type DisplayImageRef = number;
|
|
125
|
+
/**
|
|
126
|
+
* Raw image bytes plus the format they are already in. `png` and `jpeg`
|
|
127
|
+
* pass through to PDF unchanged; every other source format is transcoded by
|
|
128
|
+
* the producer, so a backend never owns a codec.
|
|
129
|
+
*/
|
|
130
|
+
type DisplayImageSource = {
|
|
131
|
+
readonly format: "png" | "jpeg";
|
|
132
|
+
readonly bytes: Uint8Array;
|
|
133
|
+
readonly pixelWidth: number;
|
|
134
|
+
readonly pixelHeight: number;
|
|
135
|
+
};
|
|
136
|
+
/**
|
|
137
|
+
* Which document a run's model positions address.
|
|
138
|
+
*
|
|
139
|
+
* A page is not one document. Its body, each header and footer part, and each
|
|
140
|
+
* note are separate stories with separate position spaces, and the same number
|
|
141
|
+
* means a different character in each. A range that did not say which one it
|
|
142
|
+
* belonged to could only be used for the body, which is why the producer used
|
|
143
|
+
* to drop the others and the painter used to strip them; naming the story is
|
|
144
|
+
* what lets an editing surface route a click into the story it landed in.
|
|
145
|
+
*/
|
|
146
|
+
type DisplayStoryRef = {
|
|
147
|
+
readonly kind: "body";
|
|
148
|
+
} |
|
|
149
|
+
/** `rId` is the relationship that names the part, as the section selects it. */
|
|
150
|
+
{
|
|
151
|
+
readonly kind: "header" | "footer";
|
|
152
|
+
readonly rId: string | null;
|
|
153
|
+
} |
|
|
154
|
+
/** `id` is the note's own `w:footnote`/`w:endnote` id. */
|
|
155
|
+
{
|
|
156
|
+
readonly kind: "footnote" | "endnote";
|
|
157
|
+
readonly id: number;
|
|
158
|
+
};
|
|
159
|
+
type DisplayModelRange = {
|
|
160
|
+
readonly start: number;
|
|
161
|
+
readonly end: number;
|
|
162
|
+
readonly story: DisplayStoryRef;
|
|
163
|
+
};
|
|
164
|
+
/**
|
|
165
|
+
* Text drawn from one face at one size in one colour.
|
|
166
|
+
*
|
|
167
|
+
* `advancesPx` holds one advance per code point of `text` (not per UTF-16
|
|
168
|
+
* unit) and sums to the run's painted width. These are the numbers line
|
|
169
|
+
* breaking and pagination were decided on: a backend that positions glyphs any
|
|
170
|
+
* other way paints a page the engine did not lay out.
|
|
171
|
+
*
|
|
172
|
+
* ## Ordering, stated so two backends cannot read it differently
|
|
173
|
+
*
|
|
174
|
+
* `text` is in logical order and `advancesPx` matches it index for index. The
|
|
175
|
+
* run occupies `[xPx, xPx + sum(advancesPx)]` whatever its direction. Under
|
|
176
|
+
* `ltr`, code point `i` starts at `xPx + sum(advancesPx[0..i))`; under `rtl`
|
|
177
|
+
* it *ends* at `xPx + sum(advancesPx) - sum(advancesPx[0..i))`. A producer
|
|
178
|
+
* never emits a run that spans a direction change, so no backend runs the bidi
|
|
179
|
+
* algorithm and no two backends can disagree about its result.
|
|
180
|
+
*/
|
|
181
|
+
/**
|
|
182
|
+
* What the measurer added on top of the glyphs' own advances.
|
|
183
|
+
*
|
|
184
|
+
* `advancesPx` already carries all three, because that is what line breaking
|
|
185
|
+
* decided the page on. They are named again here because a backend that hands
|
|
186
|
+
* the text to a shaper cannot recover them from it: a shaper advances glyphs by
|
|
187
|
+
* what the font says, and letter spacing, a horizontal scale and the space
|
|
188
|
+
* compression a justified line was fitted with are not in the font. Such a
|
|
189
|
+
* backend reapplies them and lands on the same extent; one that positions every
|
|
190
|
+
* glyph itself ignores this and reads `advancesPx`.
|
|
191
|
+
*
|
|
192
|
+
* Absent means none of the three applies, which is the common run.
|
|
193
|
+
*
|
|
194
|
+
* Every number is in the same painted pixels as `advancesPx`: `letterSpacingPx`
|
|
195
|
+
* and `wordSpacingPx` are what a code point actually gained on the page, after
|
|
196
|
+
* `horizontalScale`. A backend that applies the scale as a transform divides by
|
|
197
|
+
* it first, because a transform scales the spacing it is given.
|
|
198
|
+
*/
|
|
199
|
+
type DisplayRunAdjustments = {
|
|
200
|
+
/** Added after every code point of the run but the last. */
|
|
201
|
+
readonly letterSpacingPx: number;
|
|
202
|
+
/** Multiplies every advance. 1 when the run carries no `w:w`. */
|
|
203
|
+
readonly horizontalScale: number;
|
|
204
|
+
/** Added to each compressible space, negative on a contracted line. */
|
|
205
|
+
readonly wordSpacingPx: number;
|
|
206
|
+
};
|
|
207
|
+
type DisplayGlyphRun = {
|
|
208
|
+
readonly kind: "glyphRun";
|
|
209
|
+
readonly font: DisplayFontRef;
|
|
210
|
+
readonly fontSizePx: number;
|
|
211
|
+
readonly color: DisplayColor;
|
|
212
|
+
/** Left edge of the run, before any horizontal scale. */
|
|
213
|
+
readonly xPx: number;
|
|
214
|
+
readonly baselineYPx: number;
|
|
215
|
+
readonly text: string;
|
|
216
|
+
readonly advancesPx: readonly number[];
|
|
217
|
+
readonly direction: "ltr" | "rtl";
|
|
218
|
+
/**
|
|
219
|
+
* Whether the glyphs kern.
|
|
220
|
+
*
|
|
221
|
+
* Stated rather than left to the backend's default, because the two defaults
|
|
222
|
+
* disagree: OOXML kerns only above the `w:kern` size and a run without it
|
|
223
|
+
* does not kern at all, while a browser asked nothing kerns whenever the face
|
|
224
|
+
* has the table. A run measured unkerned and painted kerned is narrower on
|
|
225
|
+
* the page than the line it was fitted into.
|
|
226
|
+
*/
|
|
227
|
+
readonly kerning: boolean;
|
|
228
|
+
/**
|
|
229
|
+
* Whether the run's lowercase letters are drawn as small capitals.
|
|
230
|
+
*
|
|
231
|
+
* Carried because it changes every advance in the run: a backend that paints
|
|
232
|
+
* the text at full size occupies a different width from the one the line was
|
|
233
|
+
* fitted to. Which glyphs a face uses for them, real `smcp` forms or scaled
|
|
234
|
+
* capitals, is the backend's business.
|
|
235
|
+
*/
|
|
236
|
+
readonly smallCaps: boolean;
|
|
237
|
+
/** What the measurer added to the advances; absent when it added nothing. */
|
|
238
|
+
readonly adjustments?: DisplayRunAdjustments;
|
|
239
|
+
/**
|
|
240
|
+
* A run of spaces at a line edge that the line was fitted without.
|
|
241
|
+
*
|
|
242
|
+
* Word keeps such spaces addressable and paints them at no width, so the
|
|
243
|
+
* caret can sit among them while the line breaks as though they were not
|
|
244
|
+
* there. The advances are therefore all zero, and `spaceAdvancePx` is what
|
|
245
|
+
* one of those spaces would have been worth: an editing surface steps the
|
|
246
|
+
* caret by it, because there is nothing painted to step over.
|
|
247
|
+
*/
|
|
248
|
+
readonly collapsedEdge?: {
|
|
249
|
+
readonly side: "leading" | "trailing";
|
|
250
|
+
readonly spaceAdvancePx: number;
|
|
251
|
+
};
|
|
252
|
+
/**
|
|
253
|
+
* Glyph outline stroke, for `w:outline` and the emboss/imprint effects.
|
|
254
|
+
* Absent means fill only.
|
|
255
|
+
*/
|
|
256
|
+
readonly stroke?: DisplayStroke;
|
|
257
|
+
/**
|
|
258
|
+
* Editable-model range this run's text occupies, when the producer knows it.
|
|
259
|
+
*
|
|
260
|
+
* Not paint, and a backend that only draws ignores it, the way a rasterizer
|
|
261
|
+
* ignores `links`. It is here because an editing surface has to map a click
|
|
262
|
+
* and a selection back to a position in the document, and the only structure
|
|
263
|
+
* that knows which glyphs came from which characters is the one that placed
|
|
264
|
+
* them. Absent when a run has no counterpart in the model: a list marker, a
|
|
265
|
+
* substituted field value, a tab leader.
|
|
266
|
+
*/
|
|
267
|
+
readonly pmRange?: DisplayModelRange;
|
|
268
|
+
};
|
|
269
|
+
/** An axis-aligned rectangle, filled and/or stroked. At least one is set. */
|
|
270
|
+
type DisplayRectPrimitive = {
|
|
271
|
+
readonly kind: "rect";
|
|
272
|
+
readonly rect: DisplayRect;
|
|
273
|
+
readonly fill?: DisplayColor;
|
|
274
|
+
readonly stroke?: DisplayStroke;
|
|
275
|
+
};
|
|
276
|
+
/**
|
|
277
|
+
* A stroked segment. Borders, rules, column separators, table diagonals and
|
|
278
|
+
* text decorations are all this one primitive, so a dashed underline and a
|
|
279
|
+
* dashed cell border cannot be drawn by two different rules.
|
|
280
|
+
*/
|
|
281
|
+
type DisplayLine = {
|
|
282
|
+
readonly kind: "line";
|
|
283
|
+
readonly x1Px: number;
|
|
284
|
+
readonly y1Px: number;
|
|
285
|
+
readonly x2Px: number;
|
|
286
|
+
readonly y2Px: number;
|
|
287
|
+
readonly stroke: DisplayStroke;
|
|
288
|
+
};
|
|
289
|
+
type DisplayImagePrimitive = {
|
|
290
|
+
readonly kind: "image";
|
|
291
|
+
readonly image: DisplayImageRef;
|
|
292
|
+
/** Destination box, after cropping and rotation have been resolved. */
|
|
293
|
+
readonly rect: DisplayRect;
|
|
294
|
+
/** Source crop as 0..1 fractions of the decoded image, if any. */
|
|
295
|
+
readonly crop?: {
|
|
296
|
+
readonly l: number;
|
|
297
|
+
readonly t: number;
|
|
298
|
+
readonly r: number;
|
|
299
|
+
readonly b: number;
|
|
300
|
+
};
|
|
301
|
+
readonly opacity: number;
|
|
302
|
+
};
|
|
303
|
+
/** Clips its children to `rect`. Used for cropped images and cell overflow. */
|
|
304
|
+
type DisplayClipGroup = {
|
|
305
|
+
readonly kind: "clipGroup";
|
|
306
|
+
readonly rect: DisplayRect;
|
|
307
|
+
readonly children: readonly DisplayPrimitive[];
|
|
308
|
+
/** Hit regions over `children`, in the group's page-coordinate space. */
|
|
309
|
+
readonly regions: readonly DisplayHitRegion[];
|
|
310
|
+
};
|
|
311
|
+
/**
|
|
312
|
+
* Rotates its children about `originXPx`/`originYPx`. Rotated images,
|
|
313
|
+
* watermark text and vertical (`w:textDirection`) table text are all this.
|
|
314
|
+
* Rotation is the only transform folio paints; scale is resolved into
|
|
315
|
+
* geometry by the producer.
|
|
316
|
+
*/
|
|
317
|
+
type DisplayRotateGroup = {
|
|
318
|
+
readonly kind: "rotateGroup";
|
|
319
|
+
readonly degrees: number;
|
|
320
|
+
readonly originXPx: number;
|
|
321
|
+
readonly originYPx: number;
|
|
322
|
+
readonly children: readonly DisplayPrimitive[];
|
|
323
|
+
};
|
|
324
|
+
/** Uniform alpha over a subtree, for watermark washout and image opacity. */
|
|
325
|
+
type DisplayOpacityGroup = {
|
|
326
|
+
readonly kind: "opacityGroup";
|
|
327
|
+
readonly opacity: number;
|
|
328
|
+
readonly children: readonly DisplayPrimitive[];
|
|
329
|
+
};
|
|
330
|
+
type DisplayPrimitive = DisplayGlyphRun | DisplayRectPrimitive | DisplayLine | DisplayImagePrimitive | DisplayClipGroup | DisplayRotateGroup | DisplayOpacityGroup;
|
|
331
|
+
/**
|
|
332
|
+
* A clickable region. Annotations are not paint: they sit beside the
|
|
333
|
+
* primitive list so a backend that cannot express them (a raster) drops them
|
|
334
|
+
* without silently losing a drawing instruction.
|
|
335
|
+
*/
|
|
336
|
+
type DisplayLink = {
|
|
337
|
+
readonly rect: DisplayRect;
|
|
338
|
+
readonly target: DisplayLinkTarget;
|
|
339
|
+
readonly tooltip?: string;
|
|
340
|
+
};
|
|
341
|
+
type DisplayLinkTarget = {
|
|
342
|
+
readonly kind: "external";
|
|
343
|
+
readonly href: string;
|
|
344
|
+
} |
|
|
345
|
+
/**
|
|
346
|
+
* `pageIndex` indexes {@link DisplayList.pages}. It is not
|
|
347
|
+
* {@link DisplayPage.pageNumber}, which is the engine's physical number and
|
|
348
|
+
* may restart or skip, so a backend rendering one page in isolation cannot
|
|
349
|
+
* resolve an internal target and must be handed the whole list.
|
|
350
|
+
*/
|
|
351
|
+
{
|
|
352
|
+
readonly kind: "page";
|
|
353
|
+
readonly pageIndex: number;
|
|
354
|
+
readonly yPx: number;
|
|
355
|
+
};
|
|
356
|
+
/**
|
|
357
|
+
* What kind of thing a click landed in.
|
|
358
|
+
*
|
|
359
|
+
* A surface that edits a page has to answer more than "which character": which
|
|
360
|
+
* story, which paragraph, which cell, whether it hit a picture or the space
|
|
361
|
+
* after a line. The painter answered those from its own element structure, and
|
|
362
|
+
* every reader learned that structure; naming them here makes the answer a
|
|
363
|
+
* property of the page rather than of the markup that happened to paint it.
|
|
364
|
+
*/
|
|
365
|
+
type DisplayHitRegionKind =
|
|
366
|
+
/** The page's content area, inside its margins. */
|
|
367
|
+
"pageContent" | "headerSlot" | "footerSlot" |
|
|
368
|
+
/** One note's body in the band at the foot of the page. */
|
|
369
|
+
"note" | "paragraph" |
|
|
370
|
+
/** One laid-out line of a paragraph, full content width. */
|
|
371
|
+
"line" |
|
|
372
|
+
/** A line with no runs: the caret still has to land somewhere. */
|
|
373
|
+
"emptyRun" |
|
|
374
|
+
/** A tab's advance, which is space rather than characters. */
|
|
375
|
+
"tab" | "image" | "table" | "tableRow" | "tableCell" | "textBox";
|
|
376
|
+
/**
|
|
377
|
+
* What a region resolves to besides its box.
|
|
378
|
+
*
|
|
379
|
+
* Every field is something a reader of the painted markup used to get from an
|
|
380
|
+
* attribute the painter wrote. They are optional because they are properties of
|
|
381
|
+
* particular kinds: a cell has a column index and a paragraph does not.
|
|
382
|
+
*/
|
|
383
|
+
type DisplayHitRegionModel = {
|
|
384
|
+
/** Model range and story, for a region a caret can land in. */
|
|
385
|
+
readonly pmRange?: DisplayModelRange;
|
|
386
|
+
/** The story a slot or note region *is*, whether or not it has a range. */
|
|
387
|
+
readonly story?: DisplayStoryRef;
|
|
388
|
+
/** Durable block identity, for scrolling to and highlighting a block. */
|
|
389
|
+
readonly blockId?: string;
|
|
390
|
+
/** Comment threads anchored on this region's text. */
|
|
391
|
+
readonly commentIds?: readonly number[];
|
|
392
|
+
/** Row and column, for a cell; row only, for a row. */
|
|
393
|
+
readonly rowIndex?: number;
|
|
394
|
+
readonly columnIndex?: number;
|
|
395
|
+
};
|
|
396
|
+
/**
|
|
397
|
+
* A box a click can land in, and what it means.
|
|
398
|
+
*
|
|
399
|
+
* Regions form a tree over the page's primitives rather than a copy of them:
|
|
400
|
+
* `from` and `to` are a half-open range into `DisplayPage.primitives`, and a
|
|
401
|
+
* child's range lies inside its parent's. The producer emits a line's
|
|
402
|
+
* primitives together, so every region owns a contiguous slice; a backend that
|
|
403
|
+
* paints structure walks the tree and a backend that only draws ignores it.
|
|
404
|
+
*
|
|
405
|
+
* Primitives no region claims are the page's own furniture: its background, its
|
|
406
|
+
* borders, a watermark. Nothing about them is editable, so nothing has to
|
|
407
|
+
* resolve them.
|
|
408
|
+
*/
|
|
409
|
+
type DisplayHitRegion = {
|
|
410
|
+
readonly kind: DisplayHitRegionKind;
|
|
411
|
+
readonly rect: DisplayRect;
|
|
412
|
+
/** First primitive of this region, as an index into the page's list. */
|
|
413
|
+
readonly from: number;
|
|
414
|
+
/** One past its last. */
|
|
415
|
+
readonly to: number;
|
|
416
|
+
readonly children: readonly DisplayHitRegion[];
|
|
417
|
+
readonly model?: DisplayHitRegionModel;
|
|
418
|
+
};
|
|
419
|
+
type DisplayPage = {
|
|
420
|
+
/** Physical 1-based page number, as the layout engine numbered it. */
|
|
421
|
+
readonly pageNumber: number;
|
|
422
|
+
readonly widthPx: number;
|
|
423
|
+
readonly heightPx: number;
|
|
424
|
+
readonly orientation: "portrait" | "landscape";
|
|
425
|
+
/** Painted back to front. */
|
|
426
|
+
readonly primitives: readonly DisplayPrimitive[];
|
|
427
|
+
/**
|
|
428
|
+
* Where a click can land on this page, over the same primitives.
|
|
429
|
+
*
|
|
430
|
+
* Not paint: a rasterizer ignores it, as it ignores `links`. It is here
|
|
431
|
+
* because the surface that edits a page and the backend that paints it must
|
|
432
|
+
* agree about what is where, and they can only do that from one structure.
|
|
433
|
+
*/
|
|
434
|
+
readonly regions: readonly DisplayHitRegion[];
|
|
435
|
+
readonly links: readonly DisplayLink[];
|
|
436
|
+
};
|
|
437
|
+
/** One heading, for a document outline. `pageIndex` is 0-based. */
|
|
438
|
+
type DisplayOutlineEntry = {
|
|
439
|
+
readonly title: string;
|
|
440
|
+
/** OOXML outline level, 0 for Heading 1. */
|
|
441
|
+
readonly level: number;
|
|
442
|
+
readonly pageIndex: number;
|
|
443
|
+
readonly yPx: number;
|
|
444
|
+
};
|
|
445
|
+
type DisplayMetadata = {
|
|
446
|
+
readonly title?: string;
|
|
447
|
+
readonly author?: string;
|
|
448
|
+
readonly subject?: string;
|
|
449
|
+
readonly keywords?: string;
|
|
450
|
+
};
|
|
451
|
+
/**
|
|
452
|
+
* One construct the producer could not turn into primitives.
|
|
453
|
+
*
|
|
454
|
+
* Reported rather than dropped, on the same principle as `compareDocx`'s
|
|
455
|
+
* `unsupported`: a page that is missing paint must say so, because a backend
|
|
456
|
+
* cannot tell an empty region from an unimplemented one.
|
|
457
|
+
*/
|
|
458
|
+
type DisplayUnsupported = {
|
|
459
|
+
readonly construct: string;
|
|
460
|
+
readonly pageIndex: number;
|
|
461
|
+
readonly detail: string;
|
|
462
|
+
};
|
|
463
|
+
type DisplayList = {
|
|
464
|
+
readonly pages: readonly DisplayPage[];
|
|
465
|
+
readonly fonts: readonly DisplayFontFace[];
|
|
466
|
+
readonly images: readonly DisplayImageSource[];
|
|
467
|
+
readonly outline: readonly DisplayOutlineEntry[];
|
|
468
|
+
readonly metadata: DisplayMetadata;
|
|
469
|
+
readonly unsupported: readonly DisplayUnsupported[];
|
|
470
|
+
};
|
|
471
|
+
//#endregion
|
|
472
|
+
export { DisplayClipGroup, DisplayColor, DisplayEmbeddedFont, DisplayFontFace, DisplayFontRef, DisplayGlyphRun, DisplayHitRegion, DisplayHitRegionKind, DisplayHitRegionModel, DisplayImagePrimitive, DisplayImageRef, DisplayImageSource, DisplayLine, DisplayLink, DisplayLinkTarget, DisplayList, DisplayMetadata, DisplayModelRange, DisplayOpacityGroup, DisplayOutlineEntry, DisplayPage, DisplayPrimitive, DisplayRect, DisplayRectPrimitive, DisplayRotateGroup, DisplayRunAdjustments, DisplayStoryRef, DisplayStroke, DisplayStrokePattern, DisplayUnsupported };
|
|
File without changes
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { FolioAIEditAppliedOperation, FolioAIEditApplyMode, FolioAIEditNormalization, FolioAIEditOperation, FolioAIEditPrecondition, FolioAIEditSkippedOperation, FolioAIEditSnapshot, FolioAITextRangeHandle } from "./ai-edits/types.js";
|
|
2
|
-
import { FolioAIEditView } from "./ai-edits/apply.js";
|
|
2
|
+
import { FolioAIEditView, FolioRevisionStamp, FolioWordDiffOptions } from "./ai-edits/apply.js";
|
|
3
3
|
//#region src/document-operations.d.ts
|
|
4
4
|
declare const FOLIO_DOCUMENT_OPERATION_CONTRACT_VERSION: 1;
|
|
5
|
-
declare const FOLIO_DOCUMENT_OPERATION_TYPES: readonly ["replaceInBlock", "replaceRange", "commentOnRange", "formatRange", "insertAfterBlock", "insertBeforeBlock", "replaceBlock", "deleteBlock", "commentOnBlock", "insertSignatureTable", "insertTableRow", "deleteTableRow", "insertTableColumn", "deleteTableColumn", "mergeTableCells", "splitTableCell"];
|
|
5
|
+
declare const FOLIO_DOCUMENT_OPERATION_TYPES: readonly ["replaceInBlock", "replaceRange", "commentOnRange", "formatRange", "insertAfterBlock", "insertBeforeBlock", "replaceBlock", "deleteBlock", "splitBlock", "mergeBlockWithNext", "setBlockParagraphProperties", "insertTable", "deleteTable", "commentOnBlock", "insertSignatureTable", "insertTableRow", "deleteTableRow", "insertTableColumn", "deleteTableColumn", "mergeTableCells", "splitTableCell"];
|
|
6
6
|
declare const FOLIO_DOCUMENT_OPERATION_MODES: readonly ["direct", "tracked-changes", "suggested"];
|
|
7
7
|
declare const FOLIO_DOCUMENT_OPERATION_STORIES: readonly ["main", "header", "footer", "footnote", "endnote"];
|
|
8
8
|
declare const FOLIO_DOCUMENT_OPERATION_PRECONDITIONS: readonly ["blockTextHash"];
|
|
@@ -29,6 +29,11 @@ declare const FOLIO_DOCUMENT_OPERATION_MODES_BY_TYPE: Readonly<{
|
|
|
29
29
|
readonly insertBeforeBlock: readonly ["direct", "tracked-changes", "suggested"];
|
|
30
30
|
readonly replaceBlock: readonly ["direct", "tracked-changes", "suggested"];
|
|
31
31
|
readonly deleteBlock: readonly ["direct", "tracked-changes", "suggested"];
|
|
32
|
+
readonly splitBlock: readonly ["direct", "tracked-changes"];
|
|
33
|
+
readonly mergeBlockWithNext: readonly ["direct", "tracked-changes"];
|
|
34
|
+
readonly setBlockParagraphProperties: readonly ["direct", "tracked-changes"];
|
|
35
|
+
readonly insertTable: readonly ["direct", "tracked-changes"];
|
|
36
|
+
readonly deleteTable: readonly ["direct", "tracked-changes"];
|
|
32
37
|
readonly commentOnBlock: readonly ["direct", "tracked-changes"];
|
|
33
38
|
readonly insertSignatureTable: readonly ["direct", "suggested"];
|
|
34
39
|
readonly insertTableRow: readonly ["direct", "tracked-changes", "suggested"];
|
|
@@ -87,10 +92,15 @@ declare const FOLIO_DOCUMENT_OPERATION_KEYS_BY_TYPE: Readonly<{
|
|
|
87
92
|
readonly replaceRange: readonly ["id", "type", "range", "severity", "area", "precondition", "suggestionId", "replace", "comment"];
|
|
88
93
|
readonly commentOnRange: readonly ["id", "type", "range", "severity", "area", "precondition", "comment"];
|
|
89
94
|
readonly formatRange: readonly ["id", "type", "range", "severity", "area", "precondition", "suggestionId", "formatting"];
|
|
90
|
-
readonly insertAfterBlock: readonly ["id", "type", "blockId", "severity", "area", "precondition", "suggestionId", "text", "inheritFormatting", "pageBreakBefore", "styleId", "comment"];
|
|
91
|
-
readonly insertBeforeBlock: readonly ["id", "type", "blockId", "severity", "area", "precondition", "suggestionId", "text", "inheritFormatting", "pageBreakBefore", "styleId", "comment"];
|
|
95
|
+
readonly insertAfterBlock: readonly ["id", "type", "blockId", "severity", "area", "precondition", "suggestionId", "text", "inheritFormatting", "listLevel", "moveId", "pageBreakBefore", "styleId", "comment"];
|
|
96
|
+
readonly insertBeforeBlock: readonly ["id", "type", "blockId", "severity", "area", "precondition", "suggestionId", "text", "inheritFormatting", "listLevel", "moveId", "pageBreakBefore", "styleId", "comment"];
|
|
92
97
|
readonly replaceBlock: readonly ["id", "type", "blockId", "severity", "area", "precondition", "suggestionId", "text", "preserveFormatting", "styleId", "comment"];
|
|
93
|
-
readonly deleteBlock: readonly ["id", "type", "blockId", "severity", "area", "precondition", "suggestionId", "comment"];
|
|
98
|
+
readonly deleteBlock: readonly ["id", "type", "blockId", "severity", "area", "precondition", "suggestionId", "moveId", "comment"];
|
|
99
|
+
readonly splitBlock: readonly ["id", "type", "blockId", "severity", "area", "precondition", "suggestionId", "offset", "separator"];
|
|
100
|
+
readonly mergeBlockWithNext: readonly ["id", "type", "blockId", "severity", "area", "precondition", "suggestionId", "separator"];
|
|
101
|
+
readonly setBlockParagraphProperties: readonly ["id", "type", "blockId", "severity", "area", "precondition", "suggestionId", "properties"];
|
|
102
|
+
readonly insertTable: readonly ["id", "type", "blockId", "severity", "area", "precondition", "suggestionId", "position", "rows"];
|
|
103
|
+
readonly deleteTable: readonly ["id", "type", "blockId", "severity", "area", "precondition", "suggestionId"];
|
|
94
104
|
readonly commentOnBlock: readonly ["id", "type", "blockId", "severity", "area", "precondition", "suggestionId", "quote", "comment"];
|
|
95
105
|
readonly insertSignatureTable: readonly ["id", "type", "blockId", "severity", "area", "precondition", "suggestionId", "position", "parties", "comment"];
|
|
96
106
|
readonly insertTableRow: readonly ["id", "type", "blockId", "severity", "area", "precondition", "suggestionId", "position", "cellTexts"];
|
|
@@ -144,7 +154,7 @@ type FolioDocumentOperationAffectedTarget = {
|
|
|
144
154
|
story: FolioDocumentOperationStory;
|
|
145
155
|
anchorBlockId: string;
|
|
146
156
|
position: "before" | "after";
|
|
147
|
-
content: "block" | "signatureTable" | "tableRow" | "tableColumn";
|
|
157
|
+
content: "block" | "signatureTable" | "table" | "tableRow" | "tableColumn";
|
|
148
158
|
} | {
|
|
149
159
|
type: "comment";
|
|
150
160
|
commentId: number;
|
|
@@ -199,6 +209,11 @@ type FolioDocumentOperationUndoResult = {
|
|
|
199
209
|
type FolioDocumentOperationQueuedOperation = {
|
|
200
210
|
id: string;
|
|
201
211
|
};
|
|
212
|
+
/**
|
|
213
|
+
* What every operation result carries, whichever status it reports. Exported
|
|
214
|
+
* so the public API report shows these fields rather than a name it cannot
|
|
215
|
+
* resolve.
|
|
216
|
+
*/
|
|
202
217
|
type FolioDocumentOperationResultBase = {
|
|
203
218
|
version: typeof FOLIO_DOCUMENT_OPERATION_CONTRACT_VERSION;
|
|
204
219
|
applied: FolioAIEditAppliedOperation[];
|
|
@@ -210,6 +225,18 @@ type FolioDocumentOperationResultBase = {
|
|
|
210
225
|
normalizations?: FolioAIEditNormalization[];
|
|
211
226
|
/** Present when the execution surface can undo this committed batch. */
|
|
212
227
|
undoHandle: FolioDocumentOperationUndoHandle | null;
|
|
228
|
+
/**
|
|
229
|
+
* First revision id a following batch may allocate against this document:
|
|
230
|
+
* one past the last id this batch used, or the seed it started from when it
|
|
231
|
+
* allocated none. A caller writing several batches into one package — one
|
|
232
|
+
* per document story — must seed each from the previous batch's value, or
|
|
233
|
+
* two stories claim the same `w:id`.
|
|
234
|
+
*
|
|
235
|
+
* The in-process applier always reports it. A host bridge that delegates to
|
|
236
|
+
* an editor it does not control omits it rather than guessing a number a
|
|
237
|
+
* caller would seed the next batch from.
|
|
238
|
+
*/
|
|
239
|
+
nextRevisionId?: number;
|
|
213
240
|
};
|
|
214
241
|
/**
|
|
215
242
|
* Discriminated on `status`: only a host review-queue surface reports
|
|
@@ -235,7 +262,11 @@ type ApplyFolioDocumentOperationsOptions = {
|
|
|
235
262
|
author?: string;
|
|
236
263
|
createCommentId?: (text: string) => number;
|
|
237
264
|
createUndoHandle?: () => FolioDocumentOperationUndoHandle;
|
|
265
|
+
/** Omit to stamp revisions from the wall clock and the shared id cursor. */
|
|
266
|
+
revisionStamp?: FolioRevisionStamp;
|
|
267
|
+
/** Token size a replacement's redline is cut at. Word-level by default. */
|
|
268
|
+
wordDiff?: FolioWordDiffOptions;
|
|
238
269
|
};
|
|
239
|
-
declare const applyFolioDocumentOperations: ({ view, snapshot, batch, story, author, createCommentId, createUndoHandle }: ApplyFolioDocumentOperationsOptions) => FolioDocumentOperationResult;
|
|
270
|
+
declare const applyFolioDocumentOperations: ({ view, snapshot, batch, story, author, createCommentId, createUndoHandle, revisionStamp, wordDiff }: ApplyFolioDocumentOperationsOptions) => FolioDocumentOperationResult;
|
|
240
271
|
//#endregion
|
|
241
|
-
export { ApplyFolioDocumentOperationsOptions, FOLIO_DOCUMENT_OPERATION_BATCH_MODES, FOLIO_DOCUMENT_OPERATION_BATCH_PRECONDITIONS, FOLIO_DOCUMENT_OPERATION_CONTRACT_VERSION, FOLIO_DOCUMENT_OPERATION_KEYS_BY_TYPE, FOLIO_DOCUMENT_OPERATION_MODES, FOLIO_DOCUMENT_OPERATION_MODES_BY_TYPE, FOLIO_DOCUMENT_OPERATION_PRECONDITIONS, FOLIO_DOCUMENT_OPERATION_STORIES, FOLIO_DOCUMENT_OPERATION_TYPES, FolioDocumentOperation, FolioDocumentOperationAffectedTarget, FolioDocumentOperationBatch, FolioDocumentOperationBatchPrecondition, FolioDocumentOperationCapabilities, FolioDocumentOperationIssue, FolioDocumentOperationMode, FolioDocumentOperationPrecondition, FolioDocumentOperationQueuedOperation, FolioDocumentOperationReceipt, FolioDocumentOperationRecovery, FolioDocumentOperationResult, FolioDocumentOperationStatus, FolioDocumentOperationStory, FolioDocumentOperationType, FolioDocumentOperationUndoFailureReason, FolioDocumentOperationUndoHandle, FolioDocumentOperationUndoResult, InvalidFolioDocumentOperationBatchError, UnsupportedFolioDocumentOperationVersionError, applyFolioDocumentOperations, assertSupportedFolioDocumentOperationVersion, getFolioDocumentOperationCapabilities, getFolioDocumentOperationIssues, getFolioDocumentOperationReceipts, isFolioDocumentOperationModeSupported, isSupportedFolioDocumentOperationVersion, parseFolioDocumentOperationBatch };
|
|
272
|
+
export { ApplyFolioDocumentOperationsOptions, FOLIO_DOCUMENT_OPERATION_BATCH_MODES, FOLIO_DOCUMENT_OPERATION_BATCH_PRECONDITIONS, FOLIO_DOCUMENT_OPERATION_CONTRACT_VERSION, FOLIO_DOCUMENT_OPERATION_KEYS_BY_TYPE, FOLIO_DOCUMENT_OPERATION_MODES, FOLIO_DOCUMENT_OPERATION_MODES_BY_TYPE, FOLIO_DOCUMENT_OPERATION_PRECONDITIONS, FOLIO_DOCUMENT_OPERATION_STORIES, FOLIO_DOCUMENT_OPERATION_TYPES, FolioDocumentOperation, FolioDocumentOperationAffectedTarget, FolioDocumentOperationBatch, FolioDocumentOperationBatchPrecondition, FolioDocumentOperationCapabilities, FolioDocumentOperationIssue, FolioDocumentOperationMode, FolioDocumentOperationPrecondition, FolioDocumentOperationQueuedOperation, FolioDocumentOperationReceipt, FolioDocumentOperationRecovery, FolioDocumentOperationResult, FolioDocumentOperationResultBase, FolioDocumentOperationStatus, FolioDocumentOperationStory, FolioDocumentOperationType, FolioDocumentOperationUndoFailureReason, FolioDocumentOperationUndoHandle, FolioDocumentOperationUndoResult, InvalidFolioDocumentOperationBatchError, UnsupportedFolioDocumentOperationVersionError, applyFolioDocumentOperations, assertSupportedFolioDocumentOperationVersion, getFolioDocumentOperationCapabilities, getFolioDocumentOperationIssues, getFolioDocumentOperationReceipts, isFolioDocumentOperationModeSupported, isSupportedFolioDocumentOperationVersion, parseFolioDocumentOperationBatch };
|