@stll/folio-core 0.55.0 → 0.56.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ai-edits/apply.js +169 -38
- package/dist/ai-edits/headless.js +2 -2
- package/dist/ai-edits/types.d.ts +7 -1
- package/dist/compare/compare.js +1 -0
- package/dist/compare/reproducible-package.d.ts +0 -17
- package/dist/compare/reproducible-package.js +12 -18
- package/dist/controller/canonicalClipboard.d.ts +23 -0
- package/dist/controller/canonicalClipboard.js +476 -0
- package/dist/controller/canonicalClipboardResources.d.ts +21 -0
- package/dist/controller/canonicalClipboardResources.js +382 -0
- package/dist/controller/canonicalComposition.d.ts +20 -3
- package/dist/controller/canonicalComposition.js +166 -38
- package/dist/controller/canonicalInlineProjection.d.ts +113 -0
- package/dist/controller/canonicalInlineProjection.js +393 -0
- package/dist/controller/canonicalInput.d.ts +13 -4
- package/dist/controller/canonicalInput.js +52 -13
- package/dist/controller/canonicalInputTimer.d.ts +7 -0
- package/dist/controller/canonicalInputTimer.js +11 -0
- package/dist/controller/canonicalPublicOperations.d.ts +48 -0
- package/dist/controller/canonicalPublicOperations.js +556 -0
- package/dist/controller/canonicalSession.d.ts +24 -6
- package/dist/controller/canonicalSession.js +259 -111
- package/dist/controller/canonicalStoryEditor.d.ts +5 -3
- package/dist/controller/canonicalStoryEditor.js +7 -2
- package/dist/controller/canonicalStructure.js +57 -4
- package/dist/controller/canonicalTocSelection.d.ts +11 -0
- package/dist/controller/canonicalTocSelection.js +43 -0
- package/dist/controller/folioEditor.d.ts +2 -9
- package/dist/controller/folioEditor.js +5 -4
- package/dist/controller/headerFooterEditorManager.d.ts +2 -1
- package/dist/controller/headerFooterEditorManager.js +8 -7
- package/dist/controller/hiddenEditorApi.d.ts +12 -2
- package/dist/controller/hiddenEditorApi.js +4 -0
- package/dist/controller/hiddenEditorManager.d.ts +3 -1
- package/dist/controller/hiddenEditorManager.js +216 -34
- package/dist/controller/noteEditorManager.d.ts +2 -1
- package/dist/controller/noteEditorManager.js +8 -7
- package/dist/document-operations.d.ts +8 -1
- package/dist/document-operations.js +6 -4
- package/dist/docx/blockPlainText.d.ts +1 -1
- package/dist/docx/blockPlainText.js +11 -3
- package/dist/docx/canonicalResourceSave.d.ts +16 -0
- package/dist/docx/canonicalResourceSave.js +27 -0
- package/dist/docx/canonicalSave.d.ts +29 -0
- package/dist/docx/canonicalSave.js +101 -0
- package/dist/docx/canonicalStoryRepack.d.ts +1 -1
- package/dist/docx/canonicalStoryRepack.js +38 -5
- package/dist/docx/documentParser.d.ts +1 -13
- package/dist/docx/documentParser.js +1 -47
- package/dist/docx/ensureParaIds.js +10 -4
- package/dist/docx/footnoteParser.d.ts +1 -11
- package/dist/docx/footnoteParser.js +1 -16
- package/dist/docx/headerFooterParser.d.ts +1 -9
- package/dist/docx/headerFooterParser.js +1 -12
- package/dist/docx/headerFooterVerbatim.d.ts +26 -1
- package/dist/docx/headerFooterVerbatim.js +81 -3
- package/dist/docx/imageParser.d.ts +13 -1
- package/dist/docx/imageParser.js +20 -11
- package/dist/docx/metadataPrivacy.js +6 -1
- package/dist/docx/packageParts.js +9 -3
- package/dist/docx/paragraphPropertySource.js +2 -1
- package/dist/docx/parser.js +2 -1
- package/dist/docx/removeHeaderFooterParts.js +17 -6
- package/dist/docx/rezip.d.ts +49 -5
- package/dist/docx/rezip.js +745 -229
- package/dist/docx/saveDiagnostics.d.ts +11 -0
- package/dist/docx/selectiveSave.d.ts +2 -1
- package/dist/docx/selectiveSave.js +32 -3
- package/dist/docx/selectiveXmlPatch.js +7 -5
- package/dist/docx/serializer/documentSerializer.d.ts +9 -2
- package/dist/docx/serializer/documentSerializer.js +29 -10
- package/dist/docx/server/applyDocxXmlPatchProposal.js +14 -9
- package/dist/docx/storyBlockReplay.d.ts +21 -1
- package/dist/docx/storyBlockReplay.js +113 -9
- package/dist/docx/storyPlainText.d.ts +20 -0
- package/dist/docx/storyPlainText.js +23 -0
- package/dist/docx/structuralXmlPatch.js +10 -22
- package/dist/docx/styleParser.d.ts +5 -1
- package/dist/docx/styleParser.js +1 -1
- package/dist/docx/tableParser.d.ts +1 -8
- package/dist/docx/tableParser.js +1 -28
- package/dist/docx/textBoxParser.d.ts +1 -5
- package/dist/docx/textBoxParser.js +1 -20
- package/dist/docx/unzip.js +6 -1
- package/dist/internal/acceptedBlockProjection.d.ts +12 -0
- package/dist/internal/acceptedBlockProjection.js +45 -0
- package/dist/managers/DocumentLoaderManager.js +2 -1
- package/dist/markdown/escape.d.ts +3 -1
- package/dist/markdown/escape.js +9 -2
- package/dist/markdown/renderBlock.js +5 -120
- package/dist/markdown/renderParagraph.js +4 -2
- package/dist/markdown/renderRuns.d.ts +7 -1
- package/dist/markdown/renderRuns.js +32 -13
- package/dist/prosemirror/canonicalCommands.d.ts +28 -4
- package/dist/prosemirror/canonicalCommands.js +11 -4
- package/dist/prosemirror/canonicalSelectionRange.d.ts +9 -0
- package/dist/prosemirror/canonicalSelectionRange.js +15 -0
- package/dist/prosemirror/clipboardIntent.d.ts +7 -0
- package/dist/prosemirror/clipboardIntent.js +9 -0
- package/dist/prosemirror/commands/pageBreak.js +2 -2
- package/dist/prosemirror/commands/pastePlainText.js +2 -1
- package/dist/prosemirror/conversion/hyphenTextCarriers.d.ts +8 -0
- package/dist/prosemirror/conversion/hyphenTextCarriers.js +8 -0
- package/dist/prosemirror/conversion/toProseDoc.d.ts +7 -1
- package/dist/prosemirror/conversion/toProseDoc.js +5 -4
- package/dist/prosemirror/extensions/core/ParagraphExtension.js +39 -30
- package/dist/prosemirror/extensions/marks/HyperlinkExtension.js +56 -28
- package/dist/prosemirror/extensions/marks/markUtils.js +3 -1
- package/dist/prosemirror/insertOperations.js +2 -1
- package/dist/prosemirror/paragraphPropertyCarry.d.ts +7 -1
- package/dist/prosemirror/paragraphPropertyCarry.js +8 -3
- package/dist/prosemirror/plugins/suggestionMode.js +7 -5
- package/dist/types/canonicalCapabilities.d.ts +215 -0
- package/dist/types/canonicalCapabilities.js +212 -0
- package/dist/types/canonicalSave.d.ts +11 -0
- package/dist/types/canonicalSave.js +0 -0
- package/dist/types/docxSerialization.d.ts +14 -0
- package/dist/types/docxSerialization.js +7 -0
- package/package.json +4 -4
|
@@ -1,35 +1,53 @@
|
|
|
1
1
|
import { splitsSurrogatePair } from "../ai-edits/character-boundaries.js";
|
|
2
|
+
import { CANONICAL_GAP } from "../types/canonicalCapabilities.js";
|
|
3
|
+
import { setCanonicalInputTimer } from "./canonicalInputTimer.js";
|
|
2
4
|
import { CanonicalSessionError } from "./canonicalSession.js";
|
|
3
5
|
import { Result } from "better-result";
|
|
6
|
+
import { EditorState, TextSelection } from "prosemirror-state";
|
|
4
7
|
//#region src/controller/canonicalComposition.ts
|
|
5
8
|
const COMPOSITION_FLUSH_DELAY_MS = 25;
|
|
6
9
|
/** Native IME owns the provisional view; the captured canonical projection stays unchanged. */
|
|
7
10
|
const createCanonicalComposition = (options) => {
|
|
8
11
|
let state = { type: "committed" };
|
|
9
12
|
let authorizedNativeState = null;
|
|
13
|
+
let completed = { type: "idle" };
|
|
10
14
|
let timer;
|
|
11
15
|
const clearTimer = () => {
|
|
12
16
|
if (timer !== void 0) clearTimeout(timer);
|
|
13
17
|
timer = void 0;
|
|
14
18
|
};
|
|
19
|
+
const selectedText = (baseline, proposed) => {
|
|
20
|
+
const { from, to } = baseline.selection;
|
|
21
|
+
const size = proposed.doc.content.size - baseline.doc.content.size + to - from;
|
|
22
|
+
if (size < 0 || from + size > proposed.doc.content.size) return null;
|
|
23
|
+
const text = proposed.doc.textBetween(from, from + size, "", "");
|
|
24
|
+
return text.length === size ? text : null;
|
|
25
|
+
};
|
|
26
|
+
const selectedReplacement = (baseline, proposed) => {
|
|
27
|
+
const { from, to } = baseline.selection;
|
|
28
|
+
const text = selectedText(baseline, proposed);
|
|
29
|
+
if (text === null || !baseline.tr.insertText(text, from, to).doc.eq(proposed.doc)) return null;
|
|
30
|
+
return {
|
|
31
|
+
from,
|
|
32
|
+
to,
|
|
33
|
+
text,
|
|
34
|
+
semantic: "composition"
|
|
35
|
+
};
|
|
36
|
+
};
|
|
15
37
|
const replacement = (baseline, proposed) => {
|
|
16
38
|
const { $from, $to } = baseline.selection;
|
|
17
39
|
if (!$from.parent.isTextblock || !$to.parent.isTextblock) return null;
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
if (text.length !== insertedSize) return null;
|
|
25
|
-
if (!baseline.tr.insertText(text, from, to).doc.eq(proposed.doc)) return null;
|
|
26
|
-
return {
|
|
27
|
-
from,
|
|
28
|
-
to,
|
|
29
|
-
text,
|
|
40
|
+
const selected = selectedReplacement(baseline, proposed);
|
|
41
|
+
if (selected) {
|
|
42
|
+
if ($from.sameParent($to) && selected.text === baseline.doc.textBetween(selected.from, selected.to, "", "")) return {
|
|
43
|
+
from: selected.from,
|
|
44
|
+
to: selected.from,
|
|
45
|
+
text: "",
|
|
30
46
|
semantic: "composition"
|
|
31
47
|
};
|
|
48
|
+
return selected;
|
|
32
49
|
}
|
|
50
|
+
if (!$from.sameParent($to)) return null;
|
|
33
51
|
const start = $from.start();
|
|
34
52
|
const next = proposed.doc.nodeAt(start - 1);
|
|
35
53
|
if (!next || next.type !== $from.parent.type || next.content.size !== next.textContent.length) return null;
|
|
@@ -57,26 +75,62 @@ const createCanonicalComposition = (options) => {
|
|
|
57
75
|
semantic: "composition"
|
|
58
76
|
};
|
|
59
77
|
};
|
|
78
|
+
const applyNative = (view, transaction) => Result.try({
|
|
79
|
+
try: () => view.state.applyTransaction(transaction),
|
|
80
|
+
catch: (cause) => new CanonicalSessionError({
|
|
81
|
+
gap: CANONICAL_GAP.dispatch,
|
|
82
|
+
reason: "refused",
|
|
83
|
+
message: `Composition projection failed: ${String(cause)}`
|
|
84
|
+
})
|
|
85
|
+
});
|
|
60
86
|
const finish = (view, commit) => {
|
|
61
87
|
clearTimer();
|
|
62
88
|
authorizedNativeState = null;
|
|
63
89
|
const pending = state;
|
|
64
|
-
if (pending.type === "committed") return;
|
|
90
|
+
if (pending.type === "committed") return { type: "idle" };
|
|
65
91
|
const input = commit && pending.type === "provisional" ? replacement(pending.baseline, view.state) : null;
|
|
92
|
+
const committedText = selectedText(pending.baseline, view.state);
|
|
93
|
+
const proposed = view.state;
|
|
94
|
+
const from = pending.baseline.selection.from;
|
|
95
|
+
completed = { type: "idle" };
|
|
66
96
|
state = { type: "committed" };
|
|
67
|
-
if (!view.isDestroyed)
|
|
97
|
+
if (!view.isDestroyed) {
|
|
98
|
+
if (view.composing) view.dom.dispatchEvent(new Event("compositionend", { bubbles: true }));
|
|
99
|
+
view.updateState(pending.baseline);
|
|
100
|
+
}
|
|
68
101
|
options.end();
|
|
69
|
-
if (!commit || view.isDestroyed
|
|
70
|
-
if (
|
|
102
|
+
if (!commit || view.isDestroyed) return { type: "cancelled" };
|
|
103
|
+
if (pending.type === "refused") return {
|
|
104
|
+
type: "refused",
|
|
105
|
+
text: pending.text
|
|
106
|
+
};
|
|
71
107
|
if (!input) {
|
|
72
108
|
options.refuse("Composition changed unsupported content; the canonical document was restored.");
|
|
73
|
-
return
|
|
109
|
+
return {
|
|
110
|
+
type: "refused",
|
|
111
|
+
text: committedText
|
|
112
|
+
};
|
|
74
113
|
}
|
|
75
|
-
options.replace(input);
|
|
114
|
+
if (input.from !== input.to || input.text !== "") options.replace(input);
|
|
115
|
+
if (committedText !== null && !view.isDestroyed && view.state.doc.textContent === proposed.doc.textContent && from + committedText.length <= view.state.doc.content.size && view.state.doc.textBetween(from, from + committedText.length, "", "") === committedText) completed = {
|
|
116
|
+
type: "completed",
|
|
117
|
+
receipt: {
|
|
118
|
+
view,
|
|
119
|
+
state: view.state,
|
|
120
|
+
from,
|
|
121
|
+
to: from + committedText.length,
|
|
122
|
+
text: committedText,
|
|
123
|
+
marks: pending.baseline.storedMarks ?? pending.baseline.selection.$from.marksAcross(pending.baseline.selection.$to)
|
|
124
|
+
}
|
|
125
|
+
};
|
|
126
|
+
return {
|
|
127
|
+
type: "committed",
|
|
128
|
+
text: committedText
|
|
129
|
+
};
|
|
76
130
|
};
|
|
77
131
|
const schedule = (view) => {
|
|
78
132
|
clearTimer();
|
|
79
|
-
timer =
|
|
133
|
+
timer = setCanonicalInputTimer(() => finish(view, true), COMPOSITION_FLUSH_DELAY_MS);
|
|
80
134
|
};
|
|
81
135
|
return {
|
|
82
136
|
get status() {
|
|
@@ -91,18 +145,54 @@ const createCanonicalComposition = (options) => {
|
|
|
91
145
|
state = {
|
|
92
146
|
type: "provisional",
|
|
93
147
|
baseline: view.state,
|
|
148
|
+
view,
|
|
94
149
|
phase: "active"
|
|
95
150
|
};
|
|
96
151
|
},
|
|
97
152
|
ended: (view) => {
|
|
98
153
|
if (state.type === "committed") return;
|
|
99
|
-
state
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
154
|
+
switch (state.type) {
|
|
155
|
+
case "provisional":
|
|
156
|
+
state = {
|
|
157
|
+
type: "provisional",
|
|
158
|
+
baseline: state.baseline,
|
|
159
|
+
view: state.view,
|
|
160
|
+
phase: "ended"
|
|
161
|
+
};
|
|
162
|
+
break;
|
|
163
|
+
case "refused":
|
|
164
|
+
state = {
|
|
165
|
+
type: "refused",
|
|
166
|
+
baseline: state.baseline,
|
|
167
|
+
view: state.view,
|
|
168
|
+
phase: "ended",
|
|
169
|
+
text: state.text
|
|
170
|
+
};
|
|
171
|
+
break;
|
|
172
|
+
default:
|
|
173
|
+
}
|
|
104
174
|
schedule(view);
|
|
105
175
|
},
|
|
176
|
+
forgetCompleted: () => {
|
|
177
|
+
completed = { type: "idle" };
|
|
178
|
+
},
|
|
179
|
+
get pendingFinal() {
|
|
180
|
+
return completed.type === "authorized";
|
|
181
|
+
},
|
|
182
|
+
authorizeLateFinal: (view, text) => {
|
|
183
|
+
if (completed.type === "idle") return false;
|
|
184
|
+
const { receipt } = completed;
|
|
185
|
+
if (view.isDestroyed || receipt.view !== view || receipt.state !== view.state || text === null) {
|
|
186
|
+
completed = { type: "idle" };
|
|
187
|
+
return false;
|
|
188
|
+
}
|
|
189
|
+
completed = {
|
|
190
|
+
type: "authorized",
|
|
191
|
+
receipt,
|
|
192
|
+
text
|
|
193
|
+
};
|
|
194
|
+
return true;
|
|
195
|
+
},
|
|
106
196
|
authorizeNative: (view) => {
|
|
107
197
|
authorizedNativeState = view.state;
|
|
108
198
|
},
|
|
@@ -116,13 +206,53 @@ const createCanonicalComposition = (options) => {
|
|
|
116
206
|
recover: (view) => finish(view, true),
|
|
117
207
|
cancel: (view) => finish(view, false),
|
|
118
208
|
reset: () => {
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
209
|
+
completed = { type: "idle" };
|
|
210
|
+
if (state.type !== "committed") finish(state.view, false);
|
|
211
|
+
else {
|
|
212
|
+
clearTimer();
|
|
213
|
+
authorizedNativeState = null;
|
|
214
|
+
}
|
|
123
215
|
},
|
|
124
216
|
accept: (view, transaction) => {
|
|
125
|
-
if (state.type === "committed")
|
|
217
|
+
if (state.type === "committed") {
|
|
218
|
+
const final = completed;
|
|
219
|
+
if (final.type !== "authorized" || final.receipt.view !== view) return false;
|
|
220
|
+
completed = { type: "idle" };
|
|
221
|
+
if (view.isDestroyed || final.receipt.state !== view.state) return false;
|
|
222
|
+
const applied = applyNative(view, transaction);
|
|
223
|
+
const baseline = EditorState.create({
|
|
224
|
+
schema: final.receipt.state.schema,
|
|
225
|
+
doc: final.receipt.state.doc,
|
|
226
|
+
selection: TextSelection.create(final.receipt.state.doc, final.receipt.from, final.receipt.to),
|
|
227
|
+
storedMarks: final.receipt.marks
|
|
228
|
+
});
|
|
229
|
+
const input = applied.isOk() ? replacement(baseline, applied.value.state) : null;
|
|
230
|
+
if (applied.isErr() || !input || input.from < final.receipt.from || input.to > final.receipt.to || selectedText(baseline, applied.value.state) !== final.text) {
|
|
231
|
+
view.updateState(final.receipt.state);
|
|
232
|
+
options.refuse(applied.isErr() ? applied.error.message : "Final composition changed unsupported content; the canonical document was restored.");
|
|
233
|
+
return true;
|
|
234
|
+
}
|
|
235
|
+
if (final.receipt.text !== final.text) options.replace({
|
|
236
|
+
from: final.receipt.from,
|
|
237
|
+
to: final.receipt.to,
|
|
238
|
+
text: final.text,
|
|
239
|
+
semantic: "composition",
|
|
240
|
+
compositionPhase: "correction"
|
|
241
|
+
});
|
|
242
|
+
if (!view.isDestroyed) view.updateState(view.state);
|
|
243
|
+
if (!view.isDestroyed && view.state.doc.textContent === applied.value.state.doc.textContent && final.receipt.from + final.text.length <= view.state.doc.content.size && view.state.doc.textBetween(final.receipt.from, final.receipt.from + final.text.length, "", "") === final.text) completed = {
|
|
244
|
+
type: "completed",
|
|
245
|
+
receipt: {
|
|
246
|
+
view,
|
|
247
|
+
state: view.state,
|
|
248
|
+
from: final.receipt.from,
|
|
249
|
+
to: final.receipt.from + final.text.length,
|
|
250
|
+
text: final.text,
|
|
251
|
+
marks: final.receipt.marks
|
|
252
|
+
}
|
|
253
|
+
};
|
|
254
|
+
return true;
|
|
255
|
+
}
|
|
126
256
|
if (state.type === "refused") {
|
|
127
257
|
view.updateState(state.baseline);
|
|
128
258
|
return true;
|
|
@@ -132,19 +262,15 @@ const createCanonicalComposition = (options) => {
|
|
|
132
262
|
return true;
|
|
133
263
|
}
|
|
134
264
|
authorizedNativeState = null;
|
|
135
|
-
const applied =
|
|
136
|
-
try: () => view.state.applyTransaction(transaction),
|
|
137
|
-
catch: (cause) => new CanonicalSessionError({
|
|
138
|
-
reason: "refused",
|
|
139
|
-
message: `Composition projection failed: ${String(cause)}`
|
|
140
|
-
})
|
|
141
|
-
});
|
|
265
|
+
const applied = applyNative(view, transaction);
|
|
142
266
|
if (applied.isErr()) {
|
|
143
267
|
view.updateState(state.baseline);
|
|
144
268
|
state = {
|
|
145
269
|
type: "refused",
|
|
146
270
|
baseline: state.baseline,
|
|
147
|
-
|
|
271
|
+
view: state.view,
|
|
272
|
+
phase: state.phase,
|
|
273
|
+
text: selectedText(state.baseline, transaction)
|
|
148
274
|
};
|
|
149
275
|
options.refuse(applied.error.message);
|
|
150
276
|
return true;
|
|
@@ -154,7 +280,9 @@ const createCanonicalComposition = (options) => {
|
|
|
154
280
|
state = {
|
|
155
281
|
type: "refused",
|
|
156
282
|
baseline: state.baseline,
|
|
157
|
-
|
|
283
|
+
view: state.view,
|
|
284
|
+
phase: state.phase,
|
|
285
|
+
text: selectedText(state.baseline, applied.value.state)
|
|
158
286
|
};
|
|
159
287
|
options.refuse("Composition changed unsupported content; the canonical document was restored.");
|
|
160
288
|
return true;
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { document_d_exports } from "../types/document.js";
|
|
2
|
+
import { Node } from "prosemirror-model";
|
|
3
|
+
import { Result } from "better-result";
|
|
4
|
+
//#region src/controller/canonicalInlineProjection.d.ts
|
|
5
|
+
declare const CANONICAL_SOURCE_INLINE_POLICIES: {
|
|
6
|
+
readonly run: "container";
|
|
7
|
+
readonly hyperlink: "container";
|
|
8
|
+
readonly insertion: "container";
|
|
9
|
+
readonly deletion: "container";
|
|
10
|
+
readonly moveFrom: "container";
|
|
11
|
+
readonly moveTo: "container";
|
|
12
|
+
readonly inlineWrapper: "container";
|
|
13
|
+
readonly inlineSdt: "control";
|
|
14
|
+
readonly simpleField: "leaf";
|
|
15
|
+
readonly complexField: "leaf";
|
|
16
|
+
readonly mathEquation: "leaf";
|
|
17
|
+
readonly preservedInline: "leaf";
|
|
18
|
+
readonly bookmarkStart: "leaf";
|
|
19
|
+
readonly bookmarkEnd: "leaf";
|
|
20
|
+
readonly commentRangeStart: "leaf";
|
|
21
|
+
readonly commentRangeEnd: "leaf";
|
|
22
|
+
readonly commentReference: "leaf";
|
|
23
|
+
readonly moveFromRangeStart: "leaf";
|
|
24
|
+
readonly moveFromRangeEnd: "leaf";
|
|
25
|
+
readonly moveToRangeStart: "leaf";
|
|
26
|
+
readonly moveToRangeEnd: "leaf";
|
|
27
|
+
readonly text: "text";
|
|
28
|
+
readonly tab: "leaf";
|
|
29
|
+
readonly break: "leaf";
|
|
30
|
+
readonly symbol: "leaf";
|
|
31
|
+
readonly footnoteRef: "leaf";
|
|
32
|
+
readonly endnoteRef: "leaf";
|
|
33
|
+
readonly noteMarker: "leaf";
|
|
34
|
+
readonly fieldChar: "rawField";
|
|
35
|
+
readonly instrText: "rawField";
|
|
36
|
+
readonly softHyphen: "leaf";
|
|
37
|
+
readonly noBreakHyphen: "leaf";
|
|
38
|
+
readonly renderedPageBreak: "layout";
|
|
39
|
+
readonly preservedXml: "leaf";
|
|
40
|
+
readonly drawing: "leaf";
|
|
41
|
+
readonly shape: "leaf";
|
|
42
|
+
};
|
|
43
|
+
declare const CANONICAL_NATIVE_INLINE_POLICIES: {
|
|
44
|
+
readonly text: "text";
|
|
45
|
+
readonly bookmarkBoundary: "markers";
|
|
46
|
+
readonly moveRangeBoundary: "markers";
|
|
47
|
+
readonly rangeAnchor: "markers";
|
|
48
|
+
readonly noteMarker: "noteMarker";
|
|
49
|
+
readonly preservedXml: "capture";
|
|
50
|
+
readonly field: "unit";
|
|
51
|
+
readonly structuredField: "unit";
|
|
52
|
+
readonly hardBreak: "unit";
|
|
53
|
+
readonly image: "unit";
|
|
54
|
+
readonly math: "unit";
|
|
55
|
+
readonly pageBreakRun: "unit";
|
|
56
|
+
readonly shape: "unit";
|
|
57
|
+
readonly symbol: "unit";
|
|
58
|
+
readonly tab: "unit";
|
|
59
|
+
readonly textBoxAnchor: "unit";
|
|
60
|
+
readonly commentReference: "unit";
|
|
61
|
+
readonly renderedPageBreak: "refused";
|
|
62
|
+
readonly sdt: "refused";
|
|
63
|
+
};
|
|
64
|
+
declare const InlineProjectionError_base: import("better-result").TaggedErrorClass<"InlineProjectionError">;
|
|
65
|
+
declare class InlineProjectionError extends InlineProjectionError_base<{
|
|
66
|
+
message: string;
|
|
67
|
+
}> {}
|
|
68
|
+
/** Every source variant makes a decision before conversion can discard its positions. */
|
|
69
|
+
declare const canonicalInlineSourceIssue: (items: readonly (document_d_exports.ParagraphContent | document_d_exports.RunContent)[], context?: "paragraph" | "fieldPayload") => string | null;
|
|
70
|
+
type NativeCell = {
|
|
71
|
+
type: "text";
|
|
72
|
+
text: string;
|
|
73
|
+
from: number;
|
|
74
|
+
to: number;
|
|
75
|
+
node: Node;
|
|
76
|
+
} | {
|
|
77
|
+
type: "unit";
|
|
78
|
+
from: number;
|
|
79
|
+
to: number;
|
|
80
|
+
node: Node;
|
|
81
|
+
} | {
|
|
82
|
+
type: "markedUnit";
|
|
83
|
+
sourceType: document_d_exports.NoteReferenceContent["type"];
|
|
84
|
+
label: string;
|
|
85
|
+
from: number;
|
|
86
|
+
to: number;
|
|
87
|
+
node: Node;
|
|
88
|
+
} | {
|
|
89
|
+
type: "zeroWidth";
|
|
90
|
+
sources: readonly (document_d_exports.ParagraphContent | document_d_exports.RunContent)[];
|
|
91
|
+
from: number;
|
|
92
|
+
to: number;
|
|
93
|
+
node: Node;
|
|
94
|
+
};
|
|
95
|
+
/** Native positions and deletion geometry read the same inline-cell classification. */
|
|
96
|
+
declare const canonicalNativeCells: (paragraph: Node) => Result<NativeCell[], InlineProjectionError>;
|
|
97
|
+
type CanonicalInlineGap = {
|
|
98
|
+
position: number;
|
|
99
|
+
zeroWidthBefore: number;
|
|
100
|
+
};
|
|
101
|
+
type InlineProjection = {
|
|
102
|
+
text: string;
|
|
103
|
+
boundaries: CanonicalInlineGap[][];
|
|
104
|
+
};
|
|
105
|
+
type CanonicalInlineProjectionArgs = {
|
|
106
|
+
source: document_d_exports.Paragraph;
|
|
107
|
+
paragraph: Node;
|
|
108
|
+
pairedBookmarkIds: ReadonlySet<number>;
|
|
109
|
+
};
|
|
110
|
+
/** Bind rendered gaps to the operation owner's source leaf ordinals, including collapsed pairs. */
|
|
111
|
+
declare const projectCanonicalInline: ({ source, paragraph, pairedBookmarkIds }: CanonicalInlineProjectionArgs) => Result<InlineProjection, InlineProjectionError>;
|
|
112
|
+
//#endregion
|
|
113
|
+
export { CANONICAL_NATIVE_INLINE_POLICIES, CANONICAL_SOURCE_INLINE_POLICIES, CanonicalInlineGap, canonicalInlineSourceIssue, canonicalNativeCells, projectCanonicalInline };
|