@stll/folio-core 0.72.0 → 0.73.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +12 -6
- package/dist/ai-edits/apply.d.ts +6 -114
- package/dist/ai-edits/apply.js +9 -131
- package/dist/ai-edits/applyTypes.d.ts +85 -0
- package/dist/ai-edits/applyTypes.js +24 -0
- package/dist/ai-edits/clean-text.d.ts +7 -1
- package/dist/ai-edits/clean-text.js +23 -2
- package/dist/ai-edits/finalSectionReview.d.ts +1 -1
- package/dist/ai-edits/headless.d.ts +29 -147
- package/dist/ai-edits/headless.js +213 -1634
- package/dist/ai-edits/index.d.ts +3 -3
- package/dist/ai-edits/index.js +2 -3
- package/dist/ai-edits/pending-suggestions.d.ts +14 -4
- package/dist/ai-edits/pending-suggestions.js +183 -90
- package/dist/ai-edits/result-validation.js +1 -1
- package/dist/ai-edits/retired-comment-receipts.d.ts +1 -1
- package/dist/ai-edits/snapshot.js +8 -3
- package/dist/ai-edits/table-cell-mutations.d.ts +1 -1
- package/dist/ai-edits/table-cell-mutations.js +1 -1
- package/dist/ai-edits/table-geometry.d.ts +1 -1
- package/dist/ai-edits/table-geometry.js +1 -1
- package/dist/ai-edits/table-row-column-mutations.d.ts +1 -1
- package/dist/ai-edits/table-row-column-mutations.js +1 -1
- package/dist/ai-edits/tableNodes.d.ts +38 -0
- package/dist/ai-edits/tableNodes.js +86 -0
- package/dist/ai-edits/tracked-batch-fidelity.d.ts +1 -1
- package/dist/ai-edits/undefinedReferences.d.ts +7 -0
- package/dist/canonical/batchCommentReferences.js +1 -0
- package/dist/canonical/canonicalInlineProjection.js +1 -1
- package/dist/canonical/canonicalPublicOperations.js +228 -64
- package/dist/canonical/canonicalSession.d.ts +9 -1
- package/dist/canonical/canonicalSession.js +95 -15
- package/dist/compare/compare.d.ts +1 -1
- package/dist/compare/inline-atoms-model.d.ts +1 -1
- package/dist/compare/inline-atoms.d.ts +2 -2
- package/dist/compare/inline-provenance-model.d.ts +1 -1
- package/dist/compare/inline-provenance.d.ts +2 -2
- package/dist/compat/eigenpal.d.ts +3 -3
- package/dist/compat/eigenpal.js +2 -3
- package/dist/controller/canonicalClipboard.d.ts +13 -3
- package/dist/controller/canonicalClipboard.js +185 -49
- package/dist/controller/canonicalClipboardResources.d.ts +9 -1
- package/dist/controller/canonicalClipboardResources.js +22 -2
- package/dist/controller/canonicalReview.d.ts +1 -1
- package/dist/controller/canonicalReview.js +1 -1
- package/dist/controller/canonicalStructure.js +1 -1
- package/dist/controller/canonicalWatermark.d.ts +10 -0
- package/dist/controller/canonicalWatermark.js +37 -0
- package/dist/controller/hiddenEditorApi.d.ts +1 -1
- package/dist/controller/hiddenEditorManager.d.ts +4 -3
- package/dist/controller/hiddenEditorManager.js +75 -15
- package/dist/document-operations-apply.d.ts +15 -0
- package/dist/document-operations-apply.js +280 -0
- package/dist/document-operations.d.ts +1 -14
- package/dist/document-operations.js +2 -279
- package/dist/docx/modelValidation.js +1 -1
- package/dist/docx/paragraphParser.js +2 -2
- package/dist/docx/paragraphPropertySource.d.ts +1 -1
- package/dist/docx/reviewResolutionProvenance.d.ts +3 -2
- package/dist/docx/reviewResolutionProvenance.js +32 -9
- package/dist/docx/revisionIdNormalization.js +30 -7
- package/dist/docx/rezip.js +1 -1
- package/dist/docx/serializer/borderSerializer.js +1 -1
- package/dist/docx/serializer/commentSerializer.js +1 -1
- package/dist/docx/serializer/documentSerializer.js +1 -1
- package/dist/docx/serializer/paragraphSerializer.js +3 -3
- package/dist/docx/serializer/runSerializer.js +1 -1
- package/dist/docx/serializer/sectionPropertiesSerializer.js +1 -1
- package/dist/docx/serializer/tableSerializer.js +5 -37
- package/dist/docx/serializer/textFormattingSerializer.js +1 -1
- package/dist/docx/serializer/trackedChangeAttributes.js +1 -1
- package/dist/docx/server/templatePlan/apply.d.ts +15 -0
- package/dist/docx/server/templatePlan/apply.js +600 -0
- package/dist/docx/server/templatePlan/blocks.d.ts +97 -0
- package/dist/docx/server/templatePlan/blocks.js +355 -0
- package/dist/docx/server/templatePlan/builders.d.ts +72 -0
- package/dist/docx/server/templatePlan/builders.js +237 -0
- package/dist/docx/server/templatePlan/emit.d.ts +118 -0
- package/dist/docx/server/templatePlan/emit.js +466 -0
- package/dist/docx/server/templatePlan/emphasis.d.ts +62 -0
- package/dist/docx/server/templatePlan/emphasis.js +173 -0
- package/dist/docx/server/templatePlan/inspect.d.ts +22 -0
- package/dist/docx/server/templatePlan/inspect.js +177 -0
- package/dist/docx/server/templatePlan/labels.d.ts +36 -0
- package/dist/docx/server/templatePlan/labels.js +126 -0
- package/dist/docx/server/templatePlan/package.d.ts +34 -0
- package/dist/docx/server/templatePlan/package.js +99 -0
- package/dist/docx/server/templatePlan/plan.d.ts +143 -0
- package/dist/docx/server/templatePlan/plan.js +841 -0
- package/dist/docx/server/templatePlan/planShape.d.ts +9 -0
- package/dist/docx/server/templatePlan/planShape.js +161 -0
- package/dist/docx/server/templatePlan/resources.d.ts +41 -0
- package/dist/docx/server/templatePlan/resources.js +136 -0
- package/dist/docx/server/templatePlan/story.d.ts +128 -0
- package/dist/docx/server/templatePlan/story.js +440 -0
- package/dist/docx/server/templatePlan/types.d.ts +406 -0
- package/dist/docx/server/templatePlan/types.js +28 -0
- package/dist/docx/server/templatePlan/verify.d.ts +40 -0
- package/dist/docx/server/templatePlan/verify.js +968 -0
- package/dist/docx/server/templatePlan/xml.d.ts +69 -0
- package/dist/docx/server/templatePlan/xml.js +119 -0
- package/dist/docx/settingsHeaderFooterUpdate.d.ts +9 -0
- package/dist/docx/settingsHeaderFooterUpdate.js +45 -10
- package/dist/docx/storyBlockReplay.js +1 -1
- package/dist/docx/structuralXmlPatch.js +9 -1
- package/dist/docx/tableGridXml.d.ts +30 -0
- package/dist/docx/tableGridXml.js +54 -0
- package/dist/docx/tableParser.js +7 -0
- package/dist/docx/xmlParser.js +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +2 -3
- package/dist/internal/paragraphFormattingSerialization.js +1 -1
- package/dist/internal/wholeStoryRevisionResolution.js +1 -1
- package/dist/managers/ContextMenuManager.js +2 -1
- package/dist/managers/editorShortcuts.d.ts +1 -1
- package/dist/prosemirror/anchoredTextBoxes.d.ts +1 -1
- package/dist/prosemirror/canonicalCommands.d.ts +1 -1
- package/dist/prosemirror/canonicalSelectionRange.d.ts +1 -1
- package/dist/prosemirror/canonicalTableCommands.js +2 -2
- package/dist/prosemirror/commands/comments.js +3 -3
- package/dist/prosemirror/commands/contentControls.d.ts +1 -1
- package/dist/prosemirror/commands/formatPainter.d.ts +1 -1
- package/dist/prosemirror/commands/formatting.d.ts +1 -1
- package/dist/prosemirror/commands/pastePlainText.d.ts +1 -1
- package/dist/prosemirror/commands/sectionBreak.js +1 -1
- package/dist/prosemirror/commands/tableCellMergeResolution.d.ts +1 -1
- package/dist/prosemirror/commands/tableMergeFoldDecisions.d.ts +1 -1
- package/dist/prosemirror/commentRecords.d.ts +1 -1
- package/dist/prosemirror/contentControlRevisions.d.ts +1 -1
- package/dist/prosemirror/conversion/fromProseDoc.js +1 -1
- package/dist/prosemirror/documentStructureCounts.d.ts +24 -0
- package/dist/prosemirror/documentStructureCounts.js +76 -0
- package/dist/prosemirror/extensions/ExtensionManager.d.ts +1 -1
- package/dist/prosemirror/extensions/StarterKit.d.ts +1 -1
- package/dist/prosemirror/extensions/core/HistoryExtension.d.ts +1 -7
- package/dist/prosemirror/extensions/core/HistoryExtension.js +5 -13
- package/dist/prosemirror/extensions/core/ParagraphExtension.js +1 -1
- package/dist/prosemirror/extensions/core/historyCommands.d.ts +16 -0
- package/dist/prosemirror/extensions/core/historyCommands.js +19 -0
- package/dist/prosemirror/extensions/features/AutoBidiDetectionExtension.js +1 -1
- package/dist/prosemirror/extensions/features/ParaIdAllocatorExtension.d.ts +2 -35
- package/dist/prosemirror/extensions/features/ParaIdAllocatorExtension.js +4 -142
- package/dist/prosemirror/extensions/features/ParagraphChangeTrackerExtension.d.ts +3 -87
- package/dist/prosemirror/extensions/features/ParagraphChangeTrackerExtension.js +7 -162
- package/dist/prosemirror/extensions/features/pastedCellSections.d.ts +1 -1
- package/dist/prosemirror/extensions/features/pastedHeadingStyles.js +1 -1
- package/dist/prosemirror/extensions/marks/markUtils.d.ts +1 -1
- package/dist/prosemirror/extensions/nodes/TableExtension.d.ts +1 -1
- package/dist/prosemirror/extensions/nodes/TableExtension.js +2 -2
- package/dist/prosemirror/extensions/types.d.ts +1 -1
- package/dist/prosemirror/findReplaceSelection.d.ts +1 -1
- package/dist/prosemirror/hyperlinkRemoval.d.ts +1 -1
- package/dist/prosemirror/index.d.ts +1 -1
- package/dist/prosemirror/index.js +1 -1
- package/dist/prosemirror/insertionGaps.d.ts +1 -1
- package/dist/prosemirror/keptRangeBoundaries.d.ts +1 -1
- package/dist/prosemirror/listNumbering.d.ts +1 -1
- package/dist/prosemirror/lockedControls.d.ts +1 -1
- package/dist/prosemirror/markupViewProjection.d.ts +1 -1
- package/dist/prosemirror/noteReferenceOccurrences.d.ts +1 -1
- package/dist/prosemirror/noteReferenceReview.js +1 -1
- package/dist/prosemirror/paraIds.d.ts +46 -0
- package/dist/prosemirror/paraIds.js +152 -0
- package/dist/prosemirror/paragraphChangeTrackerMeta.d.ts +97 -0
- package/dist/prosemirror/paragraphChangeTrackerMeta.js +87 -0
- package/dist/prosemirror/paragraphMarkJoin.d.ts +1 -1
- package/dist/prosemirror/paragraphPropertyCarry.d.ts +1 -1
- package/dist/prosemirror/pastedCommentCopies.d.ts +1 -1
- package/dist/prosemirror/pastedCommentCopies.js +1 -1
- package/dist/prosemirror/plugins/createDocScanPlugin.d.ts +1 -1
- package/dist/prosemirror/plugins/documentNumbering.d.ts +1 -1
- package/dist/prosemirror/plugins/suggestionMode.d.ts +1 -1
- package/dist/prosemirror/plugins/templateDirectives.d.ts +1 -1
- package/dist/prosemirror/rebaseParagraphRunFormatting.d.ts +1 -1
- package/dist/prosemirror/rebaseParagraphRuns.d.ts +1 -1
- package/dist/prosemirror/rejoinRunCarriers.d.ts +1 -1
- package/dist/prosemirror/replacedAnnotations.d.ts +1 -1
- package/dist/prosemirror/replacedAnnotations.js +16 -1
- package/dist/prosemirror/revisionCarriers.d.ts +1 -1
- package/dist/prosemirror/runFormattingInlineCarriers.d.ts +1 -1
- package/dist/prosemirror/sectionMarkEdits.d.ts +1 -1
- package/dist/prosemirror/selectionBounds.d.ts +10 -0
- package/dist/prosemirror/selectionBounds.js +22 -0
- package/dist/prosemirror/storyListNumbering.d.ts +1 -1
- package/dist/prosemirror/tableCellPaste.d.ts +1 -1
- package/dist/prosemirror/tableGridMutation.d.ts +1 -1
- package/dist/prosemirror/textInput.d.ts +1 -1
- package/dist/server.d.ts +7 -2
- package/dist/server.js +6 -1
- package/dist/types/canonicalCapabilities.d.ts +8 -41
- package/dist/types/canonicalCapabilities.js +6 -34
- package/package.json +4 -4
|
@@ -3,6 +3,7 @@ import { isValidHexColor } from "../../utils/colorResolver.js";
|
|
|
3
3
|
import { serializePreservedAttributes } from "../attributeRemainder.js";
|
|
4
4
|
import { withPreservedChildren } from "../containerChildren.js";
|
|
5
5
|
import { TRANSITIONAL_NAME_BY_STRICT_NAME } from "../strictNames.gen.js";
|
|
6
|
+
import { gridColumnCount, modelTableGrid } from "../tableGridXml.js";
|
|
6
7
|
import { TABLE_LOOK_FLAGS } from "../tableLook.js";
|
|
7
8
|
import { parseTableCellProperties, parseTableGrid, parseTableGridChange, parseTableProperties, parseTablePropertyExceptions, parseTableRowProperties } from "../tableParser.js";
|
|
8
9
|
import { serializeEmptyRowProperties } from "../tableRowPropertyPresence.js";
|
|
@@ -14,8 +15,8 @@ import { serializeBookmarkMarker, serializeCommentRangeMarker, serializeMoveRang
|
|
|
14
15
|
import { serializeSdtWrapper } from "./sdtPropertiesSerializer.js";
|
|
15
16
|
import { serializeTrackedChangeAttributes } from "./trackedChangeAttributes.js";
|
|
16
17
|
import { intAttr } from "./xmlUtils.js";
|
|
17
|
-
import { escapeXmlAttribute, serializeOnOffElement } from "@stll/docx-core";
|
|
18
18
|
import { themeColorToken } from "@stll/docx-core/model";
|
|
19
|
+
import { escapeXmlAttribute, serializeOnOffElement } from "@stll/docx-core";
|
|
19
20
|
import { serializeSequenceChildren } from "@stll/docx-core/schema";
|
|
20
21
|
// src/docx/serializer/tableSerializer.ts
|
|
21
22
|
/**
|
|
@@ -430,25 +431,8 @@ function serializeTableCellPropertyChange(change) {
|
|
|
430
431
|
return `<w:tcPrChange ${attrs}>${previousTcPrInner.length > 0 ? `<w:tcPr>${previousTcPrInner}</w:tcPr>` : "<w:tcPr/>"}</w:tcPrChange>`;
|
|
431
432
|
}
|
|
432
433
|
/**
|
|
433
|
-
*
|
|
434
|
-
*
|
|
435
|
-
* to sit in.
|
|
436
|
-
*/
|
|
437
|
-
function gridColumnCount(table) {
|
|
438
|
-
let widest = 0;
|
|
439
|
-
for (const row of table.rows) {
|
|
440
|
-
let columns = (row.formatting?.gridBefore ?? 0) + (row.formatting?.gridAfter ?? 0);
|
|
441
|
-
for (const cell of row.cells) columns += cell.formatting?.gridSpan ?? 1;
|
|
442
|
-
widest = Math.max(widest, columns);
|
|
443
|
-
}
|
|
444
|
-
return widest;
|
|
445
|
-
}
|
|
446
|
-
/**
|
|
447
|
-
* Serialize table grid (w:tblGrid).
|
|
448
|
-
*
|
|
449
|
-
* `w:tblGrid` is required on every `w:tbl` and `w:w` is optional on a
|
|
450
|
-
* `w:gridCol`, so a table whose column widths were never measured — one the
|
|
451
|
-
* comparison creates, say — still declares a grid, just without widths.
|
|
434
|
+
* Serialize table grid (w:tblGrid): the grid as it arrived, while it still
|
|
435
|
+
* states the widths the model holds, otherwise the model's grid.
|
|
452
436
|
*/
|
|
453
437
|
function serializeTableGrid(table) {
|
|
454
438
|
const columnWidths = table.columnWidths;
|
|
@@ -458,24 +442,8 @@ function serializeTableGrid(table) {
|
|
|
458
442
|
const declared = element === null ? 0 : findChildren(element, "w", "gridCol").length;
|
|
459
443
|
if (canonicalJson(parseTableGrid(element)) === canonicalJson(columnWidths) && declared === (columnWidths?.length || gridColumnCount(table)) && canonicalJson(element === null ? void 0 : parseTableGridChange(element)) === canonicalJson(table.formatting?.gridChange)) return gridSourceXml;
|
|
460
444
|
}
|
|
461
|
-
|
|
462
|
-
const gridChange = change === void 0 ? "" : serializeTableGridChange(change);
|
|
463
|
-
if (columnWidths && columnWidths.length > 0) return `<w:tblGrid>${columnWidths.map((w) => `<w:gridCol w:w="${intAttr(w)}"/>`).join("")}${gridChange}</w:tblGrid>`;
|
|
464
|
-
const columns = gridColumnCount(table);
|
|
465
|
-
return columns === 0 && gridChange === "" ? "<w:tblGrid/>" : `<w:tblGrid>${"<w:gridCol/>".repeat(columns)}${gridChange}</w:tblGrid>`;
|
|
445
|
+
return modelTableGrid(table);
|
|
466
446
|
}
|
|
467
|
-
/**
|
|
468
|
-
* Serialize `w:tblGridChange`: the grid a reviewer replaced, from the change's
|
|
469
|
-
* own record rather than from the bytes it arrived as.
|
|
470
|
-
*
|
|
471
|
-
* `w:w` is optional on a `w:gridCol`, so a column the snapshot recorded no
|
|
472
|
-
* measure for is written back without one; spelling it as a zero would claim a
|
|
473
|
-
* width the source never stated.
|
|
474
|
-
*/
|
|
475
|
-
const serializeTableGridChange = ({ id, columnWidths }) => {
|
|
476
|
-
const columns = columnWidths.map((width) => width === void 0 ? "<w:gridCol/>" : `<w:gridCol w:w="${intAttr(width)}"/>`).join("");
|
|
477
|
-
return `<w:tblGridChange w:id="${intAttr(id)}"><w:tblGrid>${columns}</w:tblGrid></w:tblGridChange>`;
|
|
478
|
-
};
|
|
479
447
|
const tableCarrierKey = (carrier) => carrier.type === "customXml" ? `customXml:${String(carrier.wrapper.id)}` : `sdt:${canonicalJson(carrier.properties)}`;
|
|
480
448
|
const serializeTableCarriers = (children, depth = 0) => {
|
|
481
449
|
const parts = [];
|
|
@@ -3,8 +3,8 @@ import { isValidHexColor } from "../../utils/colorResolver.js";
|
|
|
3
3
|
import { roundHorizontalScalePercentForSerialization } from "../../utils/horizontalScale.js";
|
|
4
4
|
import { serializePreservedAttributes } from "../attributeRemainder.js";
|
|
5
5
|
import { intAttr } from "./xmlUtils.js";
|
|
6
|
-
import { escapeXmlAttribute, serializeOnOffElement } from "@stll/docx-core";
|
|
7
6
|
import { themeColorToken } from "@stll/docx-core/model";
|
|
7
|
+
import { escapeXmlAttribute, serializeOnOffElement } from "@stll/docx-core";
|
|
8
8
|
import { serializeSequenceChildren } from "@stll/docx-core/schema";
|
|
9
9
|
// src/docx/serializer/textFormattingSerializer.ts
|
|
10
10
|
const VALID_HIGHLIGHT_COLORS = new Set(HIGHLIGHT_COLOR_VALUES);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DATE_UTC_ATTRIBUTE } from "../trackedChangeInfo.js";
|
|
2
|
-
import { assertValidOoxmlNumericId, escapeXmlAttribute } from "@stll/docx-core";
|
|
3
2
|
import { normalizeRevisionId } from "@stll/docx-core/model";
|
|
3
|
+
import { assertValidOoxmlNumericId, escapeXmlAttribute } from "@stll/docx-core";
|
|
4
4
|
// src/docx/serializer/trackedChangeAttributes.ts
|
|
5
5
|
/** Normalized, unescaped attributes in schema order for an XML element or string serializer. */
|
|
6
6
|
const trackedChangeAttributeEntries = (info) => {
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Apply a source document onto a template from a plan: the output is the
|
|
3
|
+
* template's own package with a new main story. Parts the plan does not
|
|
4
|
+
* touch keep their bytes; the ones it does are spliced, not re-serialized.
|
|
5
|
+
*/
|
|
6
|
+
import { ApplyTemplatePlanArgs, ApplyTemplatePlanResult, TemplatePlanError } from "./types.js";
|
|
7
|
+
import { Result } from "better-result";
|
|
8
|
+
/**
|
|
9
|
+
* Apply `source` onto `template` as `plan` says and verify the result.
|
|
10
|
+
*
|
|
11
|
+
* The plan names blocks by id and pins them by hash; the text itself always
|
|
12
|
+
* comes from the source. The output is refused, with the report attached,
|
|
13
|
+
* unless every placed block reads back identical.
|
|
14
|
+
*/
|
|
15
|
+
export declare const applyTemplatePlan: (input: ApplyTemplatePlanArgs) => Promise<Result<ApplyTemplatePlanResult, TemplatePlanError>>;
|