@stll/folio-core 0.37.2 → 0.37.4
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/table-cell-mutations.js +10 -5
- package/dist/ai-edits/table-template.js +19 -5
- package/dist/controller/hiddenEditorManager.js +11 -0
- package/dist/controller/layoutPipeline.js +1 -1
- package/dist/display-list/build/textBoxPrimitives.js +34 -1
- package/dist/display-list/dom/renderDisplayListToDom.js +5 -2
- package/dist/display-list/types.d.ts +8 -4
- package/dist/docx/paragraphPropertySource.d.ts +82 -2
- package/dist/docx/paragraphPropertySource.js +569 -3
- package/dist/docx/parser.js +9 -0
- package/dist/docx/server/materializeYjsDocx.d.ts +1 -1
- package/dist/docx/server/materializeYjsDocx.js +21 -2
- package/dist/headless-layout.js +1 -1
- package/dist/layout-bridge/convert/headerFooterLayout.d.ts +7 -1
- package/dist/layout-bridge/convert/headerFooterLayout.js +20 -3
- package/dist/layout-bridge/convert/toFlowBlocks.js +43 -12
- package/dist/layout-engine/index.js +20 -10
- package/dist/layout-engine/measure/measureBlocks.d.ts +7 -3
- package/dist/layout-engine/measure/measureBlocks.js +10 -7
- package/dist/layout-engine/measure/measureParagraph.d.ts +2 -0
- package/dist/layout-engine/measure/measureParagraph.js +1 -1
- package/dist/layout-engine/paginator.d.ts +1 -1
- package/dist/layout-engine/paginator.js +41 -4
- package/dist/layout-engine/textBoxFlow.d.ts +2 -0
- package/dist/layout-engine/textBoxFlow.js +9 -5
- package/dist/layout-engine/types.d.ts +6 -0
- package/dist/layout-painter/documentColors.d.ts +10 -1
- package/dist/layout-painter/documentColors.js +16 -1
- package/dist/layout-painter/renderParagraph.js +9 -24
- package/dist/layout-painter/renderTable.js +3 -3
- package/dist/layout-painter/renderTextBox.js +2 -1
- package/dist/pdf/pageSpace.d.ts +12 -1
- package/dist/pdf/pageSpace.js +24 -1
- package/dist/pdf/paint.js +2 -2
- package/dist/prosemirror/attrs/index.js +32 -8
- package/dist/prosemirror/commands/comments.js +12 -3
- package/dist/prosemirror/commands/tableCellMergeResolution.js +18 -11
- package/dist/prosemirror/conversion/fromProseDoc.js +114 -25
- package/dist/prosemirror/conversion/toProseDoc.js +101 -8
- package/dist/prosemirror/extensions/core/DocExtension.js +2 -0
- package/dist/prosemirror/extensions/core/ParagraphExtension.js +2 -0
- package/dist/prosemirror/extensions/features/ParaIdAllocatorExtension.d.ts +5 -1
- package/dist/prosemirror/extensions/features/ParaIdAllocatorExtension.js +132 -41
- package/dist/prosemirror/extensions/nodes/TextBoxExtension.d.ts +2 -61
- package/dist/prosemirror/extensions/nodes/TextBoxExtension.js +16 -0
- package/dist/prosemirror/schema/nodes.d.ts +14 -2
- package/dist/prosemirror/schema/nodes.js +7 -0
- package/dist/prosemirror/yjsParagraphSourceContract.d.ts +9 -0
- package/dist/prosemirror/yjsParagraphSourceContract.js +26 -0
- package/dist/utils/rotationBoundingBox.d.ts +5 -1
- package/dist/utils/rotationBoundingBox.js +9 -1
- package/package.json +2 -2
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { decodeTableCellParagraphSourcePayload, restoreTableCellsWithParagraphPropertySources, transportTableCellsWithParagraphPropertySources } from "../docx/paragraphPropertySource.js";
|
|
1
2
|
import { expectTableCellAttrs } from "../prosemirror/attrs/index.js";
|
|
2
3
|
import { standaloneTableCellFromProseMirror } from "../prosemirror/conversion/fromProseDoc.js";
|
|
3
4
|
import { standaloneTableCellToProseMirror } from "../prosemirror/conversion/toProseDoc.js";
|
|
@@ -105,7 +106,7 @@ const mergeTrackedVerticalTableCells = ({ tr, tablePosition, table, rectangle, r
|
|
|
105
106
|
bottom: row + 1
|
|
106
107
|
})) return null;
|
|
107
108
|
const attrs = expectTableCellAttrs(cell);
|
|
108
|
-
if (attrs.colspan !== 1 || attrs.rowspan !== 1 || attrs.cellMarker !== void 0 || attrs._docxVMergeContinuationCells !== void 0 || attrs._preserveVMergeRestart === true || attrs._originalFormatting?.vMerge !== void 0) return null;
|
|
109
|
+
if (attrs.colspan !== 1 || attrs.rowspan !== 1 || attrs.cellMarker !== void 0 || attrs._docxVMergeContinuationCells !== void 0 && attrs._docxVMergeContinuationCells !== null || attrs._preserveVMergeRestart === true || attrs._originalFormatting?.vMerge !== void 0) return null;
|
|
109
110
|
cells.push({
|
|
110
111
|
position,
|
|
111
112
|
cell
|
|
@@ -139,7 +140,7 @@ const mergeTrackedVerticalTableCells = ({ tr, tablePosition, table, rectangle, r
|
|
|
139
140
|
rectangle
|
|
140
141
|
});
|
|
141
142
|
if (!nextTr) return null;
|
|
142
|
-
nextTr.setNodeAttribute(tablePosition + 1 + origin.position, "_docxVMergeContinuationCells", continuationCells);
|
|
143
|
+
nextTr.setNodeAttribute(tablePosition + 1 + origin.position, "_docxVMergeContinuationCells", transportTableCellsWithParagraphPropertySources(continuationCells));
|
|
143
144
|
markStructuralChange(nextTr);
|
|
144
145
|
return nextTr;
|
|
145
146
|
};
|
|
@@ -196,8 +197,10 @@ const splitTrackedVerticalTableCell = ({ tr, tablePosition, table, rectangle, re
|
|
|
196
197
|
if (!cell) return null;
|
|
197
198
|
const attrs = expectTableCellAttrs(cell);
|
|
198
199
|
if (attrs.colspan !== 1 || attrs.rowspan !== rectangle.bottom - rectangle.top || attrs.cellMarker !== void 0) return null;
|
|
199
|
-
const
|
|
200
|
+
const continuationPayload = attrs._docxVMergeContinuationCells === void 0 || attrs._docxVMergeContinuationCells === null ? null : decodeTableCellParagraphSourcePayload(attrs._docxVMergeContinuationCells);
|
|
201
|
+
const continuationCells = continuationPayload?.cells;
|
|
200
202
|
if (continuationCells !== void 0 && continuationCells.length !== rectangle.bottom - rectangle.top - 1) return null;
|
|
203
|
+
const restoredContinuationCells = continuationPayload ? restoreTableCellsWithParagraphPropertySources(continuationPayload) : void 0;
|
|
201
204
|
const marker = {
|
|
202
205
|
kind: "merge",
|
|
203
206
|
info: {
|
|
@@ -211,9 +214,11 @@ const splitTrackedVerticalTableCell = ({ tr, tablePosition, table, rectangle, re
|
|
|
211
214
|
for (let index = 0; index < rectangle.bottom - rectangle.top - 1; index++) {
|
|
212
215
|
const source = continuationCells?.[index];
|
|
213
216
|
if (source?.structuralChange !== void 0) return null;
|
|
214
|
-
const
|
|
217
|
+
const restoredSource = restoredContinuationCells?.[index];
|
|
218
|
+
if (source && !restoredSource) return null;
|
|
219
|
+
const insertedCell = restoredSource ? trackedSplitCellFromStoredSource({
|
|
215
220
|
origin: cell,
|
|
216
|
-
source,
|
|
221
|
+
source: restoredSource,
|
|
217
222
|
marker
|
|
218
223
|
}) : cell.type.createAndFill({
|
|
219
224
|
...cell.attrs,
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { cloneTableCellsWithParagraphPropertyCaptures, decodeTableCellParagraphSourcePayload, recreateProseNodeWithDetachedParagraphPropertySource } from "../docx/paragraphPropertySource.js";
|
|
2
|
+
import { expectTableCellAttrs } from "../prosemirror/attrs/index.js";
|
|
1
3
|
import { stripBlockIdentityAttrs } from "./block-identity.js";
|
|
2
4
|
import { Fragment } from "prosemirror-model";
|
|
3
5
|
//#region src/ai-edits/table-template.ts
|
|
@@ -137,10 +139,18 @@ const copiedAttrs = (node, context) => {
|
|
|
137
139
|
trIns: context.revision
|
|
138
140
|
} : attrs;
|
|
139
141
|
case "cell":
|
|
140
|
-
case "header_cell":
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
142
|
+
case "header_cell": {
|
|
143
|
+
if (context.clampRowSpan) return {
|
|
144
|
+
...attrs,
|
|
145
|
+
rowspan: 1,
|
|
146
|
+
_docxVMergeContinuationCells: null
|
|
147
|
+
};
|
|
148
|
+
const continuationCells = expectTableCellAttrs(node)._docxVMergeContinuationCells;
|
|
149
|
+
return continuationCells !== void 0 && continuationCells !== null ? {
|
|
150
|
+
...attrs,
|
|
151
|
+
_docxVMergeContinuationCells: cloneTableCellsWithParagraphPropertyCaptures(decodeTableCellParagraphSourcePayload(continuationCells))
|
|
152
|
+
} : attrs;
|
|
153
|
+
}
|
|
144
154
|
default: return attrs;
|
|
145
155
|
}
|
|
146
156
|
};
|
|
@@ -162,7 +172,11 @@ const copyNode = (node, context) => {
|
|
|
162
172
|
const copied = copyNode(child, inner);
|
|
163
173
|
if (copied) content.push(copied);
|
|
164
174
|
});
|
|
165
|
-
return
|
|
175
|
+
return recreateProseNodeWithDetachedParagraphPropertySource(node, {
|
|
176
|
+
attrs: copiedAttrs(node, context),
|
|
177
|
+
content: Fragment.fromArray(content),
|
|
178
|
+
marks
|
|
179
|
+
});
|
|
166
180
|
};
|
|
167
181
|
/**
|
|
168
182
|
* The template table, ready to insert: its properties, grid, rows and cells
|
|
@@ -7,6 +7,7 @@ import { ensureParaIdsInDoc, ensureParaIdsInState } from "../prosemirror/extensi
|
|
|
7
7
|
import { createDocumentNumberingPlugin } from "../prosemirror/plugins/documentNumbering.js";
|
|
8
8
|
import { createDocumentStylesPlugin } from "../prosemirror/plugins/documentStyles.js";
|
|
9
9
|
import { schema } from "../prosemirror/schema/index.js";
|
|
10
|
+
import { proseDocumentParagraphSourceContract, readYjsParagraphSourceContract, withParagraphSourceContract, writeYjsParagraphSourceContract } from "../prosemirror/yjsParagraphSourceContract.js";
|
|
10
11
|
import { createHiddenEditorApi } from "./hiddenEditorApi.js";
|
|
11
12
|
import { panic } from "better-result";
|
|
12
13
|
import { EditorState } from "prosemirror-state";
|
|
@@ -125,9 +126,18 @@ function createHiddenEditorState(options) {
|
|
|
125
126
|
plugins
|
|
126
127
|
}));
|
|
127
128
|
collaborationModules.yProseMirror.prosemirrorToYXmlFragment(seedState.doc, collaboration.yXmlFragment);
|
|
129
|
+
const collaborationDocument = collaboration.yXmlFragment.doc;
|
|
130
|
+
if (!collaborationDocument) panic("A collaboration fragment must belong to a Yjs document before seeding.");
|
|
131
|
+
if (proseDocumentParagraphSourceContract(seedState.doc)) writeYjsParagraphSourceContract(collaborationDocument, seedState.doc);
|
|
128
132
|
collaboration.onSeeded?.();
|
|
129
133
|
}
|
|
130
134
|
let { doc } = collaborationModules.yProseMirror.initProseMirrorDoc(collaboration.yXmlFragment, activeSchema);
|
|
135
|
+
const collaborationDocument = collaboration.yXmlFragment.doc;
|
|
136
|
+
if (!collaborationDocument) panic("A collaboration fragment must belong to a Yjs document before loading.");
|
|
137
|
+
const collaborationContract = readYjsParagraphSourceContract(collaborationDocument);
|
|
138
|
+
const localContract = proseDocumentParagraphSourceContract(localDoc);
|
|
139
|
+
if (localContract && collaborationContract !== localContract) panic("The collaboration state belongs to a different paragraph-property source.");
|
|
140
|
+
if (collaborationContract) doc = withParagraphSourceContract(doc, collaborationContract);
|
|
131
141
|
const initializedState = normalizeSeedState(EditorState.create({
|
|
132
142
|
doc,
|
|
133
143
|
schema: activeSchema,
|
|
@@ -136,6 +146,7 @@ function createHiddenEditorState(options) {
|
|
|
136
146
|
if (!initializedState.doc.eq(doc)) {
|
|
137
147
|
collaborationModules.yProseMirror.prosemirrorToYXmlFragment(initializedState.doc, collaboration.yXmlFragment);
|
|
138
148
|
({doc} = collaborationModules.yProseMirror.initProseMirrorDoc(collaboration.yXmlFragment, activeSchema));
|
|
149
|
+
if (collaborationContract) doc = withParagraphSourceContract(doc, collaborationContract);
|
|
139
150
|
}
|
|
140
151
|
const startedAt = performance.now();
|
|
141
152
|
const state = normalizeSeedState(EditorState.create({
|
|
@@ -181,7 +181,7 @@ function runLayoutPipeline(deps, state, options = {}) {
|
|
|
181
181
|
const hfPageCountEstimate = layout?.pages.length ?? 1;
|
|
182
182
|
const hfClock = /* @__PURE__ */ new Date();
|
|
183
183
|
const buildHfOptions = (pageCount, fieldInputs) => {
|
|
184
|
-
const hfMeasureBlocks = (hfBlocks, hfWidth) => measureBlocks(hfBlocks, hfWidth, void 0, void 0, buildHeaderFooterFieldValues(hfBlocks, pageCount, hfClock, fieldInputs));
|
|
184
|
+
const hfMeasureBlocks = (hfBlocks, hfWidth) => measureBlocks(hfBlocks, hfWidth, void 0, void 0, buildHeaderFooterFieldValues(hfBlocks, pageCount, hfClock, fieldInputs), { allowEndTabOverflow: true });
|
|
185
185
|
return {
|
|
186
186
|
...flowOpts.styles ? { styles: flowOpts.styles } : {},
|
|
187
187
|
..._theme !== void 0 ? { theme: _theme } : {},
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { layoutTextBoxContent } from "../../layout-engine/measure/textBoxParagraphLayout.js";
|
|
2
2
|
import { DEFAULT_TEXTBOX_MARGINS } from "../../layout-engine/types.js";
|
|
3
|
+
import { hasHorizontalFlip, hasVerticalFlip, parseRotationDegrees } from "../../utils/rotationBoundingBox.js";
|
|
3
4
|
import { HIT_REGION_KINDS } from "../primitives.js";
|
|
4
5
|
import { parseDisplayColor } from "./colors.js";
|
|
5
6
|
import { paintParagraphFragment } from "./paragraphPrimitives.js";
|
|
6
|
-
import { blockRegion } from "./regions.js";
|
|
7
|
+
import { blockRegion, createPageComposer } from "./regions.js";
|
|
7
8
|
import { resolveBorderStroke } from "./strokes.js";
|
|
8
9
|
import { paintTableBlock } from "./tablePrimitives.js";
|
|
9
10
|
import { UNSUPPORTED_CONSTRUCT } from "./unsupported.js";
|
|
@@ -15,6 +16,38 @@ import { UNSUPPORTED_CONSTRUCT } from "./unsupported.js";
|
|
|
15
16
|
* measurer used, so the paragraphs land where their heights were reserved.
|
|
16
17
|
*/
|
|
17
18
|
const paintTextBoxFragment = ({ composer, fragment, block, measure, context }) => {
|
|
19
|
+
const rotation = parseRotationDegrees(block.transform);
|
|
20
|
+
const flipH = hasHorizontalFlip(block.transform);
|
|
21
|
+
const flipV = hasVerticalFlip(block.transform);
|
|
22
|
+
if (rotation === 0 && !flipH && !flipV) {
|
|
23
|
+
paintUnrotatedTextBoxFragment({
|
|
24
|
+
composer,
|
|
25
|
+
fragment,
|
|
26
|
+
block,
|
|
27
|
+
measure,
|
|
28
|
+
context
|
|
29
|
+
});
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
const inner = createPageComposer();
|
|
33
|
+
paintUnrotatedTextBoxFragment({
|
|
34
|
+
composer: inner,
|
|
35
|
+
fragment,
|
|
36
|
+
block,
|
|
37
|
+
measure,
|
|
38
|
+
context
|
|
39
|
+
});
|
|
40
|
+
composer.push([{
|
|
41
|
+
kind: "rotateGroup",
|
|
42
|
+
degrees: rotation,
|
|
43
|
+
originXPx: fragment.x + fragment.width / 2,
|
|
44
|
+
originYPx: fragment.y + fragment.height / 2,
|
|
45
|
+
...flipH ? { scaleX: -1 } : {},
|
|
46
|
+
...flipV ? { scaleY: -1 } : {},
|
|
47
|
+
children: inner.primitives()
|
|
48
|
+
}]);
|
|
49
|
+
};
|
|
50
|
+
const paintUnrotatedTextBoxFragment = ({ composer, fragment, block, measure, context }) => {
|
|
18
51
|
const primitives = [];
|
|
19
52
|
const box = {
|
|
20
53
|
xPx: fragment.x,
|
|
@@ -434,10 +434,13 @@ const paintClipGroup = ({ rect, children, regions }, context) => {
|
|
|
434
434
|
regions
|
|
435
435
|
}, inner);
|
|
436
436
|
};
|
|
437
|
-
const paintRotateGroup = ({ degrees, originXPx, originYPx, children }, context) => {
|
|
437
|
+
const paintRotateGroup = ({ degrees, originXPx, originYPx, scaleX, scaleY, children }, context) => {
|
|
438
438
|
const element = createTransparentGroupDiv(context);
|
|
439
439
|
element.style.transformOrigin = `${px(originXPx - context.originXPx)} ${px(originYPx - context.originYPx)}`;
|
|
440
|
-
|
|
440
|
+
const transforms = [`rotate(${degrees}deg)`];
|
|
441
|
+
if (scaleX === -1) transforms.push("scaleX(-1)");
|
|
442
|
+
if (scaleY === -1) transforms.push("scaleY(-1)");
|
|
443
|
+
element.style.transform = transforms.join(" ");
|
|
441
444
|
context.parent.append(element);
|
|
442
445
|
const inner = {
|
|
443
446
|
...context,
|
|
@@ -309,16 +309,20 @@ type DisplayClipGroup = {
|
|
|
309
309
|
readonly regions: readonly DisplayHitRegion[];
|
|
310
310
|
};
|
|
311
311
|
/**
|
|
312
|
-
* Rotates its children about `originXPx`/`originYPx`.
|
|
313
|
-
* watermark text and vertical (`w:textDirection`)
|
|
314
|
-
*
|
|
315
|
-
*
|
|
312
|
+
* Rotates and optionally reflects its children about `originXPx`/`originYPx`.
|
|
313
|
+
* Rotated images, text boxes, watermark text and vertical (`w:textDirection`)
|
|
314
|
+
* table text are all this. A scale of `-1` is a DrawingML flip; the scale is
|
|
315
|
+
* applied before the rotation, matching CSS and OOXML transform order.
|
|
316
316
|
*/
|
|
317
317
|
type DisplayRotateGroup = {
|
|
318
318
|
readonly kind: "rotateGroup";
|
|
319
319
|
readonly degrees: number;
|
|
320
320
|
readonly originXPx: number;
|
|
321
321
|
readonly originYPx: number;
|
|
322
|
+
/** Optional horizontal reflection about the transform origin. */
|
|
323
|
+
readonly scaleX?: -1;
|
|
324
|
+
/** Optional vertical reflection about the transform origin. */
|
|
325
|
+
readonly scaleY?: -1;
|
|
322
326
|
readonly children: readonly DisplayPrimitive[];
|
|
323
327
|
};
|
|
324
328
|
/** Uniform alpha over a subtree, for watermark washout and image opacity. */
|
|
@@ -1,14 +1,45 @@
|
|
|
1
1
|
import { document_d_exports } from "../types/document.js";
|
|
2
2
|
import { Transaction } from "prosemirror-state";
|
|
3
|
-
import { Fragment, Mark, Node } from "prosemirror-model";
|
|
3
|
+
import { Fragment, Mark, Node, NodeType } from "prosemirror-model";
|
|
4
4
|
//#region src/docx/paragraphPropertySource.d.ts
|
|
5
5
|
type ParagraphPropertySource = {
|
|
6
6
|
xml: string;
|
|
7
7
|
formattingJson: string;
|
|
8
8
|
};
|
|
9
|
+
declare const PROSE_PARAGRAPH_SOURCE_TOKEN_ATTR = "_docxParagraphSourceToken";
|
|
10
|
+
declare const PROSE_PARAGRAPH_SOURCE_CONTRACT_ATTR = "_docxParagraphSourceContract";
|
|
11
|
+
/** Durable identity nested inside opaque collapsed-cell ProseMirror attrs; stripped on restore. */
|
|
12
|
+
declare const TABLE_CELL_PARAGRAPH_SOURCE_BINDING_ATTR = "_docxParagraphSourceBinding";
|
|
13
|
+
declare const PARAGRAPH_PROPERTY_SOURCE_VALIDATION_CODES: readonly ["contract_mismatch", "duplicate_token", "invalid_token", "unknown_token"];
|
|
14
|
+
type ParagraphPropertySourceValidationCode = (typeof PARAGRAPH_PROPERTY_SOURCE_VALIDATION_CODES)[number];
|
|
15
|
+
declare const TABLE_CELL_PARAGRAPH_SOURCE_PAYLOAD_ERROR_CLASSIFICATIONS: readonly ["complexity_limit", "cyclic_or_aliased_graph", "depth_limit", "expected_array", "expected_block", "expected_cell", "expected_inline_content", "expected_paragraph", "expected_record", "expected_row", "invalid_binding", "invalid_block_type", "invalid_cell_type", "invalid_graph_value", "invalid_inline_content_type", "invalid_paragraph_type", "invalid_row_type", "malformed_source_token"];
|
|
16
|
+
type TableCellParagraphSourcePayloadErrorClassification = (typeof TABLE_CELL_PARAGRAPH_SOURCE_PAYLOAD_ERROR_CLASSIFICATIONS)[number];
|
|
17
|
+
declare const ParagraphPropertySourceValidationError_base: import("better-result").TaggedErrorClass<"ParagraphPropertySourceValidationError">;
|
|
18
|
+
declare class ParagraphPropertySourceValidationError extends ParagraphPropertySourceValidationError_base<{
|
|
19
|
+
code: ParagraphPropertySourceValidationCode;
|
|
20
|
+
classification?: TableCellParagraphSourcePayloadErrorClassification;
|
|
21
|
+
message: string;
|
|
22
|
+
path?: string;
|
|
23
|
+
}> {}
|
|
24
|
+
declare const isParagraphPropertySourceToken: (token: unknown) => token is string;
|
|
25
|
+
/** True only for a body-story token derived from the exact source contract. */
|
|
26
|
+
declare const paragraphPropertySourceTokenMatchesContract: (token: unknown, contract: string) => token is string;
|
|
27
|
+
/** Visit the v1 provenance scope in canonical OOXML body-story order. */
|
|
28
|
+
declare const visitDocumentStoryParagraphs: (content: document_d_exports.Document["package"]["document"]["content"], visit: (paragraph: document_d_exports.Paragraph) => void) => void;
|
|
9
29
|
declare const assignParagraphPropertySource: (paragraph: document_d_exports.Paragraph, source: ParagraphPropertySource) => void;
|
|
10
30
|
declare const getParagraphPropertySource: (paragraph: document_d_exports.Paragraph) => ParagraphPropertySource | undefined;
|
|
31
|
+
/** Copy the captured `w:pPr` without claiming the source paragraph's durable identity. */
|
|
32
|
+
declare const copyParagraphPropertyCapture: (target: document_d_exports.Paragraph, source: document_d_exports.Paragraph) => void;
|
|
11
33
|
declare const copyParagraphPropertySource: (target: document_d_exports.Paragraph, source: document_d_exports.Paragraph) => void;
|
|
34
|
+
/** Bind parsed body paragraphs to one exact source package. */
|
|
35
|
+
declare const assignDocumentParagraphPropertySourceContract: (document: document_d_exports.Document, sourceDigest: string) => void;
|
|
36
|
+
declare const getDocumentParagraphPropertySourceContract: (document: document_d_exports.Document) => string | undefined;
|
|
37
|
+
declare const copyDocumentParagraphPropertySources: (document: document_d_exports.Document) => Map<string, document_d_exports.Paragraph> | undefined;
|
|
38
|
+
declare const paragraphPropertySourceBelongsToDocument: (paragraph: document_d_exports.Paragraph, document: document_d_exports.Document) => boolean;
|
|
39
|
+
declare const getProseDocumentParagraphPropertySourceContract: (document: Node) => string | null;
|
|
40
|
+
declare const getProseParagraphPropertySourceToken: (paragraph: Node) => unknown;
|
|
41
|
+
declare const copyDocumentParagraphPropertySourceContract: (target: document_d_exports.Document, source: document_d_exports.Document) => void;
|
|
42
|
+
declare const getParagraphPropertySourceToken: (paragraph: document_d_exports.Paragraph) => string | undefined;
|
|
12
43
|
type ParagraphCloneOverrides = Omit<Partial<document_d_exports.Paragraph>, "type">;
|
|
13
44
|
/** Clone a paragraph while deliberately retaining its parsed `w:pPr` owner. */
|
|
14
45
|
declare const cloneParagraphWithPropertySource: (paragraph: document_d_exports.Paragraph, overrides: ParagraphCloneOverrides) => document_d_exports.Paragraph;
|
|
@@ -20,7 +51,50 @@ declare const cloneParagraphWithoutPropertySource: (paragraph: document_d_export
|
|
|
20
51
|
* mismatch is an internal invariant failure rather than a position heuristic.
|
|
21
52
|
*/
|
|
22
53
|
declare const cloneDocumentWithParagraphPropertySources: (document: document_d_exports.Document) => document_d_exports.Document;
|
|
54
|
+
type TableCellParagraphPropertySourceBinding = Readonly<{
|
|
55
|
+
type: "authored";
|
|
56
|
+
}> | Readonly<{
|
|
57
|
+
token: string;
|
|
58
|
+
type: "source";
|
|
59
|
+
}>;
|
|
60
|
+
declare const decodedTableCellParagraphSourcePayloadBrand: unique symbol;
|
|
61
|
+
type DecodedTableCellParagraphSourcePayload = Readonly<{
|
|
62
|
+
[decodedTableCellParagraphSourcePayloadBrand]: true;
|
|
63
|
+
cells: readonly document_d_exports.TableCell[];
|
|
64
|
+
}>;
|
|
65
|
+
/** Decode and freeze the opaque collapsed-cell wire payload before typed use. */
|
|
66
|
+
declare const decodeTableCellParagraphSourcePayload: (value: unknown) => DecodedTableCellParagraphSourcePayload;
|
|
67
|
+
/** Prepare opaque continuation cells for ProseMirror and Yjs transport. */
|
|
68
|
+
declare const transportTableCellsWithParagraphPropertySources: (cells: document_d_exports.TableCell[]) => document_d_exports.TableCell[];
|
|
69
|
+
/** Restore decoded identities privately and remove them from the document model. */
|
|
70
|
+
declare const restoreTableCellsWithParagraphPropertySources: (payload: DecodedTableCellParagraphSourcePayload) => document_d_exports.TableCell[];
|
|
71
|
+
/** Visit every transported hidden paragraph in canonical cell-story order. */
|
|
72
|
+
declare const visitTableCellParagraphPropertySourceBindings: (payload: DecodedTableCellParagraphSourcePayload, visit: (binding: TableCellParagraphPropertySourceBinding, path: string) => void) => void;
|
|
73
|
+
/**
|
|
74
|
+
* Clone package-crossing vertical-merge payloads with their captured `w:pPr`,
|
|
75
|
+
* but without the durable paragraph tokens owned by the source package.
|
|
76
|
+
*/
|
|
77
|
+
declare const cloneTableCellsWithParagraphPropertyCaptures: (payload: DecodedTableCellParagraphSourcePayload) => document_d_exports.TableCell[];
|
|
23
78
|
declare const linkProseParagraphPropertySource: (proseParagraph: Node, sourceParagraph: document_d_exports.Paragraph) => void;
|
|
79
|
+
type CreateProseParagraphOptions = {
|
|
80
|
+
attrs?: Node["attrs"];
|
|
81
|
+
content?: Fragment | Node | readonly Node[] | null;
|
|
82
|
+
marks?: readonly Mark[];
|
|
83
|
+
};
|
|
84
|
+
/** Create a parsed paragraph with both its same-process owner and durable body token. */
|
|
85
|
+
declare const createProseParagraphWithPropertySource: (nodeType: NodeType | undefined, sourceParagraph: document_d_exports.Paragraph, options?: CreateProseParagraphOptions) => Node;
|
|
86
|
+
type ParagraphPropertySourceTransfer = {
|
|
87
|
+
displacedToken: string | null;
|
|
88
|
+
selectedToken: string | null;
|
|
89
|
+
};
|
|
90
|
+
type JoinProseParagraphsWithRightPropertySourceOptions = {
|
|
91
|
+
attrs: Node["attrs"];
|
|
92
|
+
pos: number;
|
|
93
|
+
transaction: Transaction;
|
|
94
|
+
};
|
|
95
|
+
/** Join adjacent paragraphs when revision semantics deliberately select the right owner. */
|
|
96
|
+
declare const joinProseParagraphsWithRightPropertySource: ({ attrs, pos, transaction }: JoinProseParagraphsWithRightPropertySourceOptions) => Transaction;
|
|
97
|
+
declare const getExplicitParagraphPropertySourceTransfers: (transaction: Transaction) => readonly ParagraphPropertySourceTransfer[];
|
|
24
98
|
type RecreateProseNodeOptions = {
|
|
25
99
|
attrs?: Node["attrs"];
|
|
26
100
|
content?: Fragment | Node | readonly Node[] | null;
|
|
@@ -28,6 +102,12 @@ type RecreateProseNodeOptions = {
|
|
|
28
102
|
};
|
|
29
103
|
/** Rebuild a PM node and retain paragraph provenance when the node is one. */
|
|
30
104
|
declare const recreateProseNodeWithParagraphPropertySource: (source: Node, options?: RecreateProseNodeOptions) => Node;
|
|
105
|
+
/**
|
|
106
|
+
* Rebuild a PM node that is crossing from another package: retain its
|
|
107
|
+
* same-process paragraph-property capture, but detach the durable token that
|
|
108
|
+
* can only name a paragraph in the package it came from.
|
|
109
|
+
*/
|
|
110
|
+
declare const recreateProseNodeWithDetachedParagraphPropertySource: (source: Node, options?: RecreateProseNodeOptions) => Node;
|
|
31
111
|
type SetProseParagraphMarkupOptions = {
|
|
32
112
|
attrs: Node["attrs"];
|
|
33
113
|
ownership: "preserve" | "transfer-allocated-id";
|
|
@@ -46,4 +126,4 @@ declare const linkParagraphPropertySourceCandidate: (target: document_d_exports.
|
|
|
46
126
|
declare const getParagraphPropertySourceCandidate: (paragraph: document_d_exports.Paragraph) => document_d_exports.Paragraph | undefined;
|
|
47
127
|
declare const getParagraphPropertySourceTransferId: (paragraph: document_d_exports.Paragraph) => string | undefined;
|
|
48
128
|
//#endregion
|
|
49
|
-
export { assignParagraphPropertySource, cloneDocumentWithParagraphPropertySources, cloneParagraphWithPropertySource, cloneParagraphWithoutPropertySource, copyParagraphPropertySource, getParagraphPropertySource, getParagraphPropertySourceCandidate, getParagraphPropertySourceTransferId, linkParagraphPropertySourceCandidate, linkProseParagraphPropertySource, recreateProseNodeWithParagraphPropertySource, setProseParagraphMarkupWithPropertySource, transferProseParagraphPropertySource };
|
|
129
|
+
export { DecodedTableCellParagraphSourcePayload, PARAGRAPH_PROPERTY_SOURCE_VALIDATION_CODES, PROSE_PARAGRAPH_SOURCE_CONTRACT_ATTR, PROSE_PARAGRAPH_SOURCE_TOKEN_ATTR, ParagraphPropertySourceValidationCode, ParagraphPropertySourceValidationError, TABLE_CELL_PARAGRAPH_SOURCE_BINDING_ATTR, TABLE_CELL_PARAGRAPH_SOURCE_PAYLOAD_ERROR_CLASSIFICATIONS, TableCellParagraphPropertySourceBinding, TableCellParagraphSourcePayloadErrorClassification, assignDocumentParagraphPropertySourceContract, assignParagraphPropertySource, cloneDocumentWithParagraphPropertySources, cloneParagraphWithPropertySource, cloneParagraphWithoutPropertySource, cloneTableCellsWithParagraphPropertyCaptures, copyDocumentParagraphPropertySourceContract, copyDocumentParagraphPropertySources, copyParagraphPropertyCapture, copyParagraphPropertySource, createProseParagraphWithPropertySource, decodeTableCellParagraphSourcePayload, getDocumentParagraphPropertySourceContract, getExplicitParagraphPropertySourceTransfers, getParagraphPropertySource, getParagraphPropertySourceCandidate, getParagraphPropertySourceToken, getParagraphPropertySourceTransferId, getProseDocumentParagraphPropertySourceContract, getProseParagraphPropertySourceToken, isParagraphPropertySourceToken, joinProseParagraphsWithRightPropertySource, linkParagraphPropertySourceCandidate, linkProseParagraphPropertySource, paragraphPropertySourceBelongsToDocument, paragraphPropertySourceTokenMatchesContract, recreateProseNodeWithDetachedParagraphPropertySource, recreateProseNodeWithParagraphPropertySource, restoreTableCellsWithParagraphPropertySources, setProseParagraphMarkupWithPropertySource, transferProseParagraphPropertySource, transportTableCellsWithParagraphPropertySources, visitDocumentStoryParagraphs, visitTableCellParagraphPropertySourceBindings };
|