@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
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Raw OOXML helpers shared by the template plan modules: element tests by
|
|
3
|
+
* namespace and local name, source-range splicing, and the prefixes a part
|
|
4
|
+
* binds, so generated markup uses the spelling the part already declares.
|
|
5
|
+
*/
|
|
6
|
+
import { XmlSplice, spliceXml } from "../../selectiveXmlPatch.js";
|
|
7
|
+
import { XmlElement } from "../../xmlParser.js";
|
|
8
|
+
import { escapeXmlAttribute, escapeXmlText } from "@stll/docx-core";
|
|
9
|
+
export declare const MARKUP_COMPATIBILITY_NAMESPACE: string;
|
|
10
|
+
export declare const MATH_NAMESPACE: string;
|
|
11
|
+
/** Whether `element` is the WordprocessingML element `localName`. */
|
|
12
|
+
export declare const isW: (element: XmlElement, localName: string) => boolean;
|
|
13
|
+
/** The WordprocessingML local name of `element`, or null for anything else. */
|
|
14
|
+
export declare const wName: (element: XmlElement) => string | null;
|
|
15
|
+
export declare const elementChildren: (element: XmlElement | null | undefined) => XmlElement[];
|
|
16
|
+
export declare const wChild: (element: XmlElement | null | undefined, localName: string) => XmlElement | null;
|
|
17
|
+
export declare const wChildren: (element: XmlElement | null | undefined, localName: string) => XmlElement[];
|
|
18
|
+
/** A WordprocessingML attribute, whatever prefix the part spells it with. */
|
|
19
|
+
export declare const wAttr: (element: XmlElement | null | undefined, localName: string) => string | null;
|
|
20
|
+
/** `w:val` of the child `localName`, or null when the child is absent. */
|
|
21
|
+
export declare const wChildVal: (element: XmlElement | null | undefined, localName: string) => string | null;
|
|
22
|
+
export declare const integerOrNull: (value: string | null) => number | null;
|
|
23
|
+
/** The largest of `values`, or `floor` when none is larger. */
|
|
24
|
+
export declare const maxOf: (values: Iterable<number>, floor: number) => number;
|
|
25
|
+
/** A relationship attribute (`r:id`, `r:embed`, ...) by local name. */
|
|
26
|
+
export declare const relationshipAttr: (element: XmlElement, localName: string) => string | null;
|
|
27
|
+
export type XmlRange = {
|
|
28
|
+
start: number;
|
|
29
|
+
end: number;
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* The slice `[start, end)` of `xml` with the splices that lie inside it
|
|
33
|
+
* applied; null when the owner of part splices refuses the result.
|
|
34
|
+
*/
|
|
35
|
+
export declare const sliceWithSplices: (xml: string, { start, end }: XmlRange, splices: readonly XmlSplice[]) => string | null;
|
|
36
|
+
export type RawPart = {
|
|
37
|
+
path: string;
|
|
38
|
+
xml: string;
|
|
39
|
+
/** The root element, parsed with source ranges. */
|
|
40
|
+
root: XmlElement;
|
|
41
|
+
};
|
|
42
|
+
/** Parse a part keeping every element's source range, or null when it is not XML. */
|
|
43
|
+
export declare const readRawPart: (path: string, xml: string) => RawPart | null;
|
|
44
|
+
export declare const rangeOf: (element: XmlElement) => XmlRange | null;
|
|
45
|
+
/**
|
|
46
|
+
* Where the content of `element` sits in its source: after the opening tag
|
|
47
|
+
* and before the closing one. Null for an element written self-closed.
|
|
48
|
+
*/
|
|
49
|
+
export declare const innerRangeOf: (xml: string, element: XmlElement) => XmlRange | null;
|
|
50
|
+
/** The prefix `root` binds to one of `uris`, or null when it binds none. */
|
|
51
|
+
export declare const prefixFor: (root: XmlElement, uris: ReadonlySet<string>) => {
|
|
52
|
+
prefix: string;
|
|
53
|
+
uri: string;
|
|
54
|
+
} | null;
|
|
55
|
+
/** The prefixes generated markup uses inside one part. */
|
|
56
|
+
export type PartPrefixes = {
|
|
57
|
+
/** WordprocessingML prefix, e.g. `w`. */
|
|
58
|
+
w: string;
|
|
59
|
+
/** WordprocessingML namespace URI of the part. */
|
|
60
|
+
wUri: string;
|
|
61
|
+
/** Relationship attribute prefix and the declaration it needs, when the root has none. */
|
|
62
|
+
r: string;
|
|
63
|
+
rDeclaration: string;
|
|
64
|
+
};
|
|
65
|
+
/** Null when the part's root binds no prefix to WordprocessingML. */
|
|
66
|
+
export declare const partPrefixes: (root: XmlElement) => PartPrefixes | null;
|
|
67
|
+
/** Visit every element under `root` in document order, `root` included. */
|
|
68
|
+
export declare const walkElements: (root: XmlElement, visit: (element: XmlElement) => void) => void;
|
|
69
|
+
export { type XmlSplice, escapeXmlAttribute, escapeXmlText, spliceXml };
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { spliceXml } from "../../selectiveXmlPatch.js";
|
|
2
|
+
import { NAMESPACES, OFFICE_RELATIONSHIP_NAMESPACE_URIS, WORDPROCESSINGML_NAMESPACE_URIS, getAttributeByNamespaceUri, getLocalName } from "../../xmlParser.js";
|
|
3
|
+
import { escapeXmlAttribute, escapeXmlText } from "@stll/docx-core";
|
|
4
|
+
import { getXmlSourceRange, parseStreamingXmlWithSourceRanges } from "@stll/docx-core/xml";
|
|
5
|
+
// src/docx/server/templatePlan/xml.ts
|
|
6
|
+
/**
|
|
7
|
+
* Raw OOXML helpers shared by the template plan modules: element tests by
|
|
8
|
+
* namespace and local name, source-range splicing, and the prefixes a part
|
|
9
|
+
* binds, so generated markup uses the spelling the part already declares.
|
|
10
|
+
*/
|
|
11
|
+
const MARKUP_COMPATIBILITY_NAMESPACE = NAMESPACES.mc;
|
|
12
|
+
const MATH_NAMESPACE = NAMESPACES.m;
|
|
13
|
+
/** Whether `element` is the WordprocessingML element `localName`. */
|
|
14
|
+
const isW = (element, localName) => element.type === "element" && getLocalName(element.name) === localName && WORDPROCESSINGML_NAMESPACE_URIS.has(element.namespaceUri ?? "");
|
|
15
|
+
/** The WordprocessingML local name of `element`, or null for anything else. */
|
|
16
|
+
const wName = (element) => element.type === "element" && WORDPROCESSINGML_NAMESPACE_URIS.has(element.namespaceUri ?? "") ? getLocalName(element.name) : null;
|
|
17
|
+
const elementChildren = (element) => (element?.elements ?? []).filter((child) => child.type === "element");
|
|
18
|
+
const wChild = (element, localName) => elementChildren(element).find((child) => isW(child, localName)) ?? null;
|
|
19
|
+
const wChildren = (element, localName) => elementChildren(element).filter((child) => isW(child, localName));
|
|
20
|
+
/** A WordprocessingML attribute, whatever prefix the part spells it with. */
|
|
21
|
+
const wAttr = (element, localName) => getAttributeByNamespaceUri(element, WORDPROCESSINGML_NAMESPACE_URIS, localName);
|
|
22
|
+
/** `w:val` of the child `localName`, or null when the child is absent. */
|
|
23
|
+
const wChildVal = (element, localName) => wAttr(wChild(element, localName), "val");
|
|
24
|
+
const integerOrNull = (value) => {
|
|
25
|
+
if (value === null || !/^-?\d+$/u.test(value.trim())) return null;
|
|
26
|
+
const parsed = Number.parseInt(value, 10);
|
|
27
|
+
return Number.isSafeInteger(parsed) ? parsed : null;
|
|
28
|
+
};
|
|
29
|
+
/** The largest of `values`, or `floor` when none is larger. */
|
|
30
|
+
const maxOf = (values, floor) => {
|
|
31
|
+
let max = floor;
|
|
32
|
+
for (const value of values) if (value > max) max = value;
|
|
33
|
+
return max;
|
|
34
|
+
};
|
|
35
|
+
/** A relationship attribute (`r:id`, `r:embed`, ...) by local name. */
|
|
36
|
+
const relationshipAttr = (element, localName) => getAttributeByNamespaceUri(element, OFFICE_RELATIONSHIP_NAMESPACE_URIS, localName);
|
|
37
|
+
/**
|
|
38
|
+
* The slice `[start, end)` of `xml` with the splices that lie inside it
|
|
39
|
+
* applied; null when the owner of part splices refuses the result.
|
|
40
|
+
*/
|
|
41
|
+
const sliceWithSplices = (xml, { start, end }, splices) => spliceXml(xml.slice(start, end), splices.filter((splice) => splice.start >= start && splice.end <= end).map((splice) => ({
|
|
42
|
+
start: splice.start - start,
|
|
43
|
+
end: splice.end - start,
|
|
44
|
+
newXml: splice.newXml
|
|
45
|
+
})));
|
|
46
|
+
/** Parse a part keeping every element's source range, or null when it is not XML. */
|
|
47
|
+
const readRawPart = (path, xml) => {
|
|
48
|
+
const parsed = parseStreamingXmlWithSourceRanges(xml);
|
|
49
|
+
if (parsed.status !== "parsed") return null;
|
|
50
|
+
const root = elementChildren(parsed.value).at(0);
|
|
51
|
+
return root === void 0 ? null : {
|
|
52
|
+
path,
|
|
53
|
+
xml,
|
|
54
|
+
root
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
const rangeOf = (element) => getXmlSourceRange(element) ?? null;
|
|
58
|
+
/**
|
|
59
|
+
* Where the content of `element` sits in its source: after the opening tag
|
|
60
|
+
* and before the closing one. Null for an element written self-closed.
|
|
61
|
+
*/
|
|
62
|
+
const innerRangeOf = (xml, element) => {
|
|
63
|
+
const range = rangeOf(element);
|
|
64
|
+
if (range === null) return null;
|
|
65
|
+
if (xml.slice(range.end - 2, range.end) === "/>") return null;
|
|
66
|
+
const close = xml.lastIndexOf("</", range.end - 1);
|
|
67
|
+
let open = -1;
|
|
68
|
+
let quote = "";
|
|
69
|
+
for (let index = range.start; index < range.end; index += 1) {
|
|
70
|
+
const char = xml[index];
|
|
71
|
+
if (quote !== "") {
|
|
72
|
+
if (char === quote) quote = "";
|
|
73
|
+
} else if (char === "\"" || char === "'") quote = char;
|
|
74
|
+
else if (char === ">") {
|
|
75
|
+
open = index + 1;
|
|
76
|
+
break;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
return open === -1 || close < open ? null : {
|
|
80
|
+
start: open,
|
|
81
|
+
end: close
|
|
82
|
+
};
|
|
83
|
+
};
|
|
84
|
+
/** The prefix `root` binds to one of `uris`, or null when it binds none. */
|
|
85
|
+
const prefixFor = (root, uris) => {
|
|
86
|
+
for (const [name, value] of Object.entries(root.attributes ?? {})) if (name.startsWith("xmlns:") && value !== void 0 && uris.has(String(value))) return {
|
|
87
|
+
prefix: name.slice(6),
|
|
88
|
+
uri: String(value)
|
|
89
|
+
};
|
|
90
|
+
return null;
|
|
91
|
+
};
|
|
92
|
+
const FALLBACK_RELATIONSHIP_PREFIX = "folioR";
|
|
93
|
+
/** Null when the part's root binds no prefix to WordprocessingML. */
|
|
94
|
+
const partPrefixes = (root) => {
|
|
95
|
+
const w = prefixFor(root, WORDPROCESSINGML_NAMESPACE_URIS);
|
|
96
|
+
if (w === null) return null;
|
|
97
|
+
const r = prefixFor(root, OFFICE_RELATIONSHIP_NAMESPACE_URIS);
|
|
98
|
+
return {
|
|
99
|
+
w: w.prefix,
|
|
100
|
+
wUri: w.uri,
|
|
101
|
+
r: r?.prefix ?? FALLBACK_RELATIONSHIP_PREFIX,
|
|
102
|
+
rDeclaration: r === null ? ` xmlns:${FALLBACK_RELATIONSHIP_PREFIX}="${NAMESPACES.r}"` : ""
|
|
103
|
+
};
|
|
104
|
+
};
|
|
105
|
+
/** Visit every element under `root` in document order, `root` included. */
|
|
106
|
+
const walkElements = (root, visit) => {
|
|
107
|
+
const stack = [root];
|
|
108
|
+
while (stack.length > 0) {
|
|
109
|
+
const element = stack.pop();
|
|
110
|
+
if (element === void 0 || element.type !== "element") continue;
|
|
111
|
+
visit(element);
|
|
112
|
+
const children = element.elements ?? [];
|
|
113
|
+
for (let index = children.length - 1; index >= 0; index -= 1) {
|
|
114
|
+
const child = children[index];
|
|
115
|
+
if (child !== void 0) stack.push(child);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
export { MARKUP_COMPATIBILITY_NAMESPACE, MATH_NAMESPACE, elementChildren, escapeXmlAttribute, escapeXmlText, innerRangeOf, integerOrNull, isW, maxOf, partPrefixes, prefixFor, rangeOf, readRawPart, relationshipAttr, sliceWithSplices, spliceXml, wAttr, wChild, wChildVal, wChildren, wName, walkElements };
|
|
@@ -1,2 +1,11 @@
|
|
|
1
|
+
/** The on/off children of `w:settings` a caller may set without re-serializing the part. */
|
|
2
|
+
export type SettingsOnOffChild = "evenAndOddHeaders" | "updateFields";
|
|
3
|
+
/**
|
|
4
|
+
* Set (`true`), clear (`false`) or remove (`undefined`) one on/off child of
|
|
5
|
+
* `w:settings`, at its place in the schema's child order; the rest of the part
|
|
6
|
+
* keeps its bytes. Null means the source is malformed or outside the supported
|
|
7
|
+
* namespace profiles.
|
|
8
|
+
*/
|
|
9
|
+
export declare const updateSettingsOnOffChild: (xml: string, localName: SettingsOnOffChild, enabled: boolean | undefined) => string | null;
|
|
1
10
|
/** Null means the source is malformed or outside the supported namespace profiles. */
|
|
2
11
|
export declare const updateEvenAndOddHeaders: (xml: string, enabled: boolean | undefined) => string | null;
|
|
@@ -1,14 +1,45 @@
|
|
|
1
1
|
import { spliceXml } from "./selectiveXmlPatch.js";
|
|
2
|
-
import { WORDPROCESSINGML_NAMESPACE_URIS, getChildElements, getLocalName, getNamespaceUri, parseXmlDocument } from "./xmlParser.js";
|
|
2
|
+
import { NAMESPACES, WORDPROCESSINGML_NAMESPACE_URIS, getChildElements, getLocalName, getNamespaceUri, parseXmlDocument } from "./xmlParser.js";
|
|
3
3
|
import { panic } from "better-result";
|
|
4
4
|
import { SETTINGS_CHILDREN } from "@stll/docx-core/schema";
|
|
5
5
|
// src/docx/settingsHeaderFooterUpdate.ts
|
|
6
6
|
/** Preserve producer settings while updating the document-wide header/footer switch. */
|
|
7
7
|
const XML_TOKEN = /<!--[\s\S]*?-->|<!\[CDATA\[[\s\S]*?\]\]>|<\?[\s\S]*?\?>|<(?:"[^"]*"|'[^']*'|[^'">])*>/gu;
|
|
8
8
|
const SETTINGS_CHILD_ORDINALS = new Map(SETTINGS_CHILDREN.map((name, index) => [name, index]));
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
const
|
|
9
|
+
/** The schema ordinals of the settings a compatibility wrapper may stand for. */
|
|
10
|
+
const wrappedOrdinals = (wrapper) => {
|
|
11
|
+
const ordinals = [];
|
|
12
|
+
for (const branch of getChildElements(wrapper)) for (const child of getChildElements(branch)) {
|
|
13
|
+
const ordinal = WORDPROCESSINGML_NAMESPACE_URIS.has(getNamespaceUri(child) ?? "") ? SETTINGS_CHILD_ORDINALS.get(getLocalName(child.name)) : void 0;
|
|
14
|
+
if (ordinal !== void 0) ordinals.push(ordinal);
|
|
15
|
+
}
|
|
16
|
+
return ordinals;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Where a child of `w:settings` sits relative to the flag at `childOrder`.
|
|
20
|
+
* A child of another namespace (the math properties, the schema library,
|
|
21
|
+
* later extensions) follows every on/off child. A compatibility wrapper sits
|
|
22
|
+
* where the settings it stands for sit; one that holds the flag itself, or
|
|
23
|
+
* settings on both sides of it, leaves the flag no place.
|
|
24
|
+
*/
|
|
25
|
+
const placeOf = (child, childOrder) => {
|
|
26
|
+
const namespaceUri = getNamespaceUri(child) ?? "";
|
|
27
|
+
if (WORDPROCESSINGML_NAMESPACE_URIS.has(namespaceUri)) return (SETTINGS_CHILD_ORDINALS.get(getLocalName(child.name)) ?? -1) > childOrder ? "following" : "preceding";
|
|
28
|
+
if (namespaceUri !== NAMESPACES.mc) return "following";
|
|
29
|
+
const ordinals = wrappedOrdinals(child);
|
|
30
|
+
const before = ordinals.some((ordinal) => ordinal < childOrder);
|
|
31
|
+
const after = ordinals.some((ordinal) => ordinal > childOrder);
|
|
32
|
+
if (ordinals.includes(childOrder) || before && after) return "unplaceable";
|
|
33
|
+
return after ? "following" : "preceding";
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* Set (`true`), clear (`false`) or remove (`undefined`) one on/off child of
|
|
37
|
+
* `w:settings`, at its place in the schema's child order; the rest of the part
|
|
38
|
+
* keeps its bytes. Null means the source is malformed or outside the supported
|
|
39
|
+
* namespace profiles.
|
|
40
|
+
*/
|
|
41
|
+
const updateSettingsOnOffChild = (xml, localName, enabled) => {
|
|
42
|
+
const childOrder = SETTINGS_CHILD_ORDINALS.get(localName);
|
|
12
43
|
const root = parseXmlDocument(xml);
|
|
13
44
|
if (!root || getLocalName(root.name) !== "settings" || !WORDPROCESSINGML_NAMESPACE_URIS.has(getNamespaceUri(root) ?? "")) return null;
|
|
14
45
|
const children = getChildElements(root);
|
|
@@ -20,7 +51,7 @@ const updateEvenAndOddHeaders = (xml, enabled) => {
|
|
|
20
51
|
let rootOpenEnd = -1;
|
|
21
52
|
let selfClosingRootStart = -1;
|
|
22
53
|
let firstFollowingChildStart = -1;
|
|
23
|
-
if (
|
|
54
|
+
if (childOrder === void 0) return panic(`Generated CT_Settings schema does not define ${localName}`);
|
|
24
55
|
for (const token of xml.matchAll(XML_TOKEN)) {
|
|
25
56
|
const tag = token[0];
|
|
26
57
|
if (tag.startsWith("<!") || tag.startsWith("<?")) continue;
|
|
@@ -32,7 +63,7 @@ const updateEvenAndOddHeaders = (xml, enabled) => {
|
|
|
32
63
|
if (stack.length === 1) {
|
|
33
64
|
const child = children[childIndex++];
|
|
34
65
|
if (!child || childStart < 0) return null;
|
|
35
|
-
if (getLocalName(child.name) ===
|
|
66
|
+
if (getLocalName(child.name) === localName && WORDPROCESSINGML_NAMESPACE_URIS.has(getNamespaceUri(child) ?? "")) spans.push({
|
|
36
67
|
start: childStart,
|
|
37
68
|
end: token.index + tag.length,
|
|
38
69
|
newXml: ""
|
|
@@ -49,11 +80,13 @@ const updateEvenAndOddHeaders = (xml, enabled) => {
|
|
|
49
80
|
if (stack.length === 1) {
|
|
50
81
|
const child = children[childIndex];
|
|
51
82
|
if (child?.name !== name) return null;
|
|
52
|
-
|
|
83
|
+
const place = placeOf(child, childOrder);
|
|
84
|
+
if (place === "unplaceable") return null;
|
|
85
|
+
if (firstFollowingChildStart < 0 && place === "following") firstFollowingChildStart = token.index;
|
|
53
86
|
childStart = token.index;
|
|
54
87
|
if (tag.endsWith("/>")) {
|
|
55
88
|
childIndex += 1;
|
|
56
|
-
if (getLocalName(child.name) ===
|
|
89
|
+
if (getLocalName(child.name) === localName && WORDPROCESSINGML_NAMESPACE_URIS.has(getNamespaceUri(child) ?? "")) spans.push({
|
|
57
90
|
start: token.index,
|
|
58
91
|
end: token.index + tag.length,
|
|
59
92
|
newXml: ""
|
|
@@ -64,7 +97,7 @@ const updateEvenAndOddHeaders = (xml, enabled) => {
|
|
|
64
97
|
if (!tag.endsWith("/>")) stack.push(name);
|
|
65
98
|
}
|
|
66
99
|
if (stack.length !== 0 || childIndex !== children.length) return null;
|
|
67
|
-
const flag = enabled === void 0 ? "" : `<folioW
|
|
100
|
+
const flag = enabled === void 0 ? "" : `<folioW:${localName} xmlns:folioW="${getNamespaceUri(root)}"${enabled ? "" : " folioW:val=\"0\""}/>`;
|
|
68
101
|
if (selfClosingRootStart >= 0) {
|
|
69
102
|
if (!flag) return xml;
|
|
70
103
|
return spliceXml(xml, [{
|
|
@@ -86,4 +119,6 @@ const updateEvenAndOddHeaders = (xml, enabled) => {
|
|
|
86
119
|
}
|
|
87
120
|
return spliceXml(xml, spans);
|
|
88
121
|
};
|
|
89
|
-
|
|
122
|
+
/** Null means the source is malformed or outside the supported namespace profiles. */
|
|
123
|
+
const updateEvenAndOddHeaders = (xml, enabled) => updateSettingsOnOffChild(xml, "evenAndOddHeaders", enabled);
|
|
124
|
+
export { updateEvenAndOddHeaders, updateSettingsOnOffChild };
|
|
@@ -3,8 +3,8 @@ import { spliceXml } from "./selectiveXmlPatch.js";
|
|
|
3
3
|
import { TRANSITIONAL_NAMESPACE_BY_STRICT_URI } from "./strictValueEncodings.gen.js";
|
|
4
4
|
import { captureSourceProfileXml, hasReplayOpeningDeclarations, isSafeCapturedXmlDocument, isSafeCompactReplayFragment, prepareCompactReplaySuffix } from "./verbatimCapture.js";
|
|
5
5
|
import { WORDPROCESSINGML_NAMESPACE_URIS, getAttributeByNamespaceUri, getChildElements, getLocalName, getNamespaceUri } from "./xmlParser.js";
|
|
6
|
-
import { escapeXmlAttribute } from "@stll/docx-core";
|
|
7
6
|
import { DOCX_CONFORMANCE_CLASSES } from "@stll/docx-core/model";
|
|
7
|
+
import { escapeXmlAttribute } from "@stll/docx-core";
|
|
8
8
|
import { getXmlSourceRange, parseStreamingXml, parseStreamingXmlWithSourceRanges } from "@stll/docx-core/xml";
|
|
9
9
|
// src/docx/storyBlockReplay.ts
|
|
10
10
|
/**
|
|
@@ -170,6 +170,14 @@ const rangeMarkers = (blocks) => [...indexBlocks(blocks)].map(([key, { element }
|
|
|
170
170
|
for (const child of descendants(element)) if (WORDPROCESSINGML_NAMESPACE_URIS.has(getNamespaceUri(child) ?? "") && RANGE_MARKERS.has(getLocalName(child.name))) markers.push(rangeMarker(child));
|
|
171
171
|
return markers;
|
|
172
172
|
});
|
|
173
|
+
/** Verbatim captures: they keep the source's own spelling, not its meaning. */
|
|
174
|
+
const CAPTURE_KEYS = /* @__PURE__ */ new Set(["sourceXml", "gridSourceXml"]);
|
|
175
|
+
/** `value` without its verbatim captures, so a respelled source compares equal. */
|
|
176
|
+
const withoutCaptures = (value) => {
|
|
177
|
+
if (Array.isArray(value)) return value.map(withoutCaptures);
|
|
178
|
+
if (typeof value !== "object" || value === null) return value;
|
|
179
|
+
return Object.fromEntries(Object.entries(value).filter(([key]) => !CAPTURE_KEYS.has(key)).map(([key, field]) => [key, withoutCaptures(field)]));
|
|
180
|
+
};
|
|
173
181
|
const decline = (reason) => ({
|
|
174
182
|
type: "declined",
|
|
175
183
|
reason
|
|
@@ -249,7 +257,7 @@ const buildStructuralDocumentPatch = ({ originalXml, serializedXml, changedIds,
|
|
|
249
257
|
const changedTables = /* @__PURE__ */ new Set();
|
|
250
258
|
for (const [index, block] of sourceBarriers.entries()) {
|
|
251
259
|
const next = currentBarriers[index];
|
|
252
|
-
if (canonicalJson(block) === canonicalJson(next)) continue;
|
|
260
|
+
if (canonicalJson(withoutCaptures(block)) === canonicalJson(withoutCaptures(next))) continue;
|
|
253
261
|
if (block.type !== "table" || next?.type !== "table") return decline("structuralBarrierChanged");
|
|
254
262
|
changedTables.add(index);
|
|
255
263
|
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `w:tblGrid` a table's model writes when no capture stands in for it.
|
|
3
|
+
* The serializer writes it; the parser keeps a capture only when the source
|
|
4
|
+
* grid differs from it, so a table without one reads back as it was written.
|
|
5
|
+
*/
|
|
6
|
+
import { document_d_exports } from "../types/document.js";
|
|
7
|
+
/**
|
|
8
|
+
* The most grid columns a table declares. Far above what any editor lays out,
|
|
9
|
+
* it bounds a grid built from a source's skipped-column
|
|
10
|
+
* and span counts, which a file can state at any size.
|
|
11
|
+
*/
|
|
12
|
+
export declare const MAX_GRID_COLUMNS = 4096;
|
|
13
|
+
/**
|
|
14
|
+
* Columns the grid has to declare: the widest row's total of skipped columns
|
|
15
|
+
* and spans, because a grid narrower than a row leaves cells with no column
|
|
16
|
+
* to sit in. At most {@link MAX_GRID_COLUMNS}.
|
|
17
|
+
*/
|
|
18
|
+
export declare const gridColumnCount: (table: document_d_exports.Table) => number;
|
|
19
|
+
/**
|
|
20
|
+
* `w:tblGrid` from the model.
|
|
21
|
+
*
|
|
22
|
+
* `w:tblGrid` is required on every `w:tbl` and `w:w` is optional on a
|
|
23
|
+
* `w:gridCol`, so a table whose column widths were never measured (one the
|
|
24
|
+
* comparison creates, say) still declares a grid, just without widths.
|
|
25
|
+
* `w:tblGridChange` records the grid a reviewer replaced. It is history, so
|
|
26
|
+
* no width in the model derives it, and a rebuilt grid that leaves it out
|
|
27
|
+
* accepts the reviewer's change without saying so. The schema declares it
|
|
28
|
+
* after every `w:gridCol`, so it is appended.
|
|
29
|
+
*/
|
|
30
|
+
export declare const modelTableGrid: (table: document_d_exports.Table) => string;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { intAttr } from "./serializer/xmlUtils.js";
|
|
2
|
+
// src/docx/tableGridXml.ts
|
|
3
|
+
/**
|
|
4
|
+
* The most grid columns a table declares. Far above what any editor lays out,
|
|
5
|
+
* it bounds a grid built from a source's skipped-column
|
|
6
|
+
* and span counts, which a file can state at any size.
|
|
7
|
+
*/
|
|
8
|
+
const MAX_GRID_COLUMNS = 4096;
|
|
9
|
+
/**
|
|
10
|
+
* Columns the grid has to declare: the widest row's total of skipped columns
|
|
11
|
+
* and spans, because a grid narrower than a row leaves cells with no column
|
|
12
|
+
* to sit in. At most {@link MAX_GRID_COLUMNS}.
|
|
13
|
+
*/
|
|
14
|
+
const gridColumnCount = (table) => {
|
|
15
|
+
let widest = 0;
|
|
16
|
+
for (const row of table.rows) {
|
|
17
|
+
let columns = (row.formatting?.gridBefore ?? 0) + (row.formatting?.gridAfter ?? 0);
|
|
18
|
+
for (const cell of row.cells) columns += cell.formatting?.gridSpan ?? 1;
|
|
19
|
+
widest = Math.max(widest, columns);
|
|
20
|
+
}
|
|
21
|
+
return Math.min(widest, MAX_GRID_COLUMNS);
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* Serialize `w:tblGridChange`: the grid a reviewer replaced, from the change's
|
|
25
|
+
* own record rather than from the bytes it arrived as.
|
|
26
|
+
*
|
|
27
|
+
* `w:w` is optional on a `w:gridCol`, so a column the snapshot recorded no
|
|
28
|
+
* measure for is written back without one; spelling it as a zero would claim a
|
|
29
|
+
* width the source never stated.
|
|
30
|
+
*/
|
|
31
|
+
const serializeTableGridChange = ({ id, columnWidths }) => {
|
|
32
|
+
const columns = columnWidths.map((width) => width === void 0 ? "<w:gridCol/>" : `<w:gridCol w:w="${intAttr(width)}"/>`).join("");
|
|
33
|
+
return `<w:tblGridChange w:id="${intAttr(id)}"><w:tblGrid>${columns}</w:tblGrid></w:tblGridChange>`;
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* `w:tblGrid` from the model.
|
|
37
|
+
*
|
|
38
|
+
* `w:tblGrid` is required on every `w:tbl` and `w:w` is optional on a
|
|
39
|
+
* `w:gridCol`, so a table whose column widths were never measured (one the
|
|
40
|
+
* comparison creates, say) still declares a grid, just without widths.
|
|
41
|
+
* `w:tblGridChange` records the grid a reviewer replaced. It is history, so
|
|
42
|
+
* no width in the model derives it, and a rebuilt grid that leaves it out
|
|
43
|
+
* accepts the reviewer's change without saying so. The schema declares it
|
|
44
|
+
* after every `w:gridCol`, so it is appended.
|
|
45
|
+
*/
|
|
46
|
+
const modelTableGrid = (table) => {
|
|
47
|
+
const change = table.formatting?.gridChange;
|
|
48
|
+
const gridChange = change === void 0 ? "" : serializeTableGridChange(change);
|
|
49
|
+
const columnWidths = table.columnWidths;
|
|
50
|
+
if (columnWidths && columnWidths.length > 0) return `<w:tblGrid>${columnWidths.map((w) => `<w:gridCol w:w="${intAttr(w)}"/>`).join("")}${gridChange}</w:tblGrid>`;
|
|
51
|
+
const columns = gridColumnCount(table);
|
|
52
|
+
return columns === 0 && gridChange === "" ? "<w:tblGrid/>" : `<w:tblGrid>${"<w:gridCol/>".repeat(columns)}${gridChange}</w:tblGrid>`;
|
|
53
|
+
};
|
|
54
|
+
export { MAX_GRID_COLUMNS, gridColumnCount, modelTableGrid };
|
package/dist/docx/tableParser.js
CHANGED
|
@@ -11,6 +11,7 @@ import { standalonePreviewLedger } from "./previewBudget.js";
|
|
|
11
11
|
import { captureSdtSiblingMarkers, parseSdtProperties } from "./sdtProperties.js";
|
|
12
12
|
import { parseShading } from "./shadingParser.js";
|
|
13
13
|
import { findChildAnySpelling } from "./strictNames.js";
|
|
14
|
+
import { modelTableGrid } from "./tableGridXml.js";
|
|
14
15
|
import { TABLE_LOOK_FLAGS } from "./tableLook.js";
|
|
15
16
|
import { isEmptyRowPropertiesAttribute, retainsEmptyRowProperties } from "./tableRowPropertyPresence.js";
|
|
16
17
|
import { parsePropertyChangeInfo, parseTrackedChangeInfo } from "./trackedChangeInfo.js";
|
|
@@ -1359,6 +1360,12 @@ function parseTable(tblElement, styles, theme, numbering, rels, media, options)
|
|
|
1359
1360
|
if (preservedChildren.length > 0) table.preserved = { children: preservedChildren };
|
|
1360
1361
|
if (bookmarks.length > 0) table.bookmarks = bookmarks;
|
|
1361
1362
|
inferImplicitSingleCellRowSpans(table, rowsWithGridOffsets);
|
|
1363
|
+
const captured = table.formatting;
|
|
1364
|
+
if (captured?.gridSourceXml !== void 0 && captured.gridSourceXml === modelTableGrid(table)) {
|
|
1365
|
+
const { gridSourceXml: _modelGrid, ...rest } = captured;
|
|
1366
|
+
if (Object.keys(rest).length > 0) table.formatting = rest;
|
|
1367
|
+
else delete table.formatting;
|
|
1368
|
+
}
|
|
1362
1369
|
return table;
|
|
1363
1370
|
}
|
|
1364
1371
|
/**
|
package/dist/docx/xmlParser.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { NUMBERS_PER_PERCENT, percentageSpelling, transitionalSlotEncoding } from "./transitionalSpelling.js";
|
|
2
2
|
import { universalMeasureAs } from "./universalMeasure.js";
|
|
3
|
-
import { escapeXmlAttribute, escapeXmlText } from "@stll/docx-core";
|
|
4
3
|
import { PARSE_WARNING_CODES } from "@stll/docx-core/model";
|
|
4
|
+
import { escapeXmlAttribute, escapeXmlText } from "@stll/docx-core";
|
|
5
5
|
import { EMPTY_NAMESPACE_SCOPE, OOXML_NAMESPACE_SCOPE, OOXML_NS, attachXmlNamespaceContext, resolveNamespaceUri } from "@stll/docx-core/xml/namespaces";
|
|
6
6
|
import { XmlReadError, readXml } from "@stll/docx-core/xml";
|
|
7
7
|
// src/docx/xmlParser.ts
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FolioAIEditApplyOutcome, FolioRevisionStamp, FolioWordDiffOptions
|
|
1
|
+
import { FolioAIEditApplyOutcome, FolioRevisionStamp, FolioWordDiffOptions } from "./ai-edits/applyTypes.js";
|
|
2
2
|
import "./ai-edits/index.js";
|
|
3
3
|
import { createFolioAIEditSnapshot, hashFolioAIBlockText, isFolioAIContentBlock, normalizeFolioAIBlockText } from "./ai-edits/snapshot.js";
|
|
4
4
|
import { FolioAIBlock, FolioAIBlockAnchor, FolioAIBlockKind, FolioAIBlockPreviewRun, FolioAIBlockStructuralBoundary, FolioAIBlockTableLocation, FolioAIComment, FolioAIDiagnosticBlock, FolioAIEditAppliedOperation, FolioAIEditApplyMode, FolioAIEditApplyResult, FolioAIEditNormalization, FolioAIEditNormalizationCode, FolioAIEditOperation, FolioAIEditParagraphIdentity, FolioAIEditPrecondition, FolioAIEditReviewMeta, FolioAIEditSeverity, FolioAIEditSkipReason, FolioAIEditSkippedOperation, FolioAIEditSnapshot, FolioAIInlineBooleanProperty, FolioAIInlineFormatting, FolioAIInlineFormattingPatch, FolioAIParagraphBlock, FolioAIParagraphSpacing, FolioAISignatureParty } from "./ai-edits/types.js";
|
|
@@ -13,7 +13,7 @@ import { FolioContentBlock, FolioContentContainerPathEntry, FolioContentFormatRa
|
|
|
13
13
|
import { CompareContentOptions, FOLIO_CONTENT_COMPARISON_LIMITS, FolioContentBlockProperty, FolioContentComparison, FolioContentComparisonError, FolioContentComparisonEvent, FolioContentComparisonLimit, FolioContentComparisonLimitError, FolioContentFormattingChange, FolioContentInlinePresentationProjectionError, FolioContentParagraphFormattingPatch, FolioContentStructuralChange, FolioContentTextSegment, InvalidFolioContentComparisonError, compareContent } from "./compare/content.js";
|
|
14
14
|
import { COMPARE_REVISION_FORMATS, COMPARE_UNSUPPORTED_REASONS, CompareChange, CompareChangeLocation, CompareCompatibility, CompareDocxApplyError, CompareDocxError, CompareDocxFinalParagraphMarkError, CompareDocxOperationLimitError, CompareDocxOptions, CompareDocxParseError, CompareDocxRoundTripError, CompareDocxSerializeError, CompareFolioRequirement, CompareResult, CompareRevisionFormat, CompareUnsupportedPart, CompareUnsupportedReason, InvalidCompareDocxOptionsError } from "./compare/types.js";
|
|
15
15
|
import { COMPARE_VERIFICATION_CAUSES, COMPARE_VERIFICATION_INVARIANTS, CompareVerification, CompareVerificationCause, CompareVerificationFailure, CompareVerificationInvariant, FinalParagraphMarkRevision } from "./compare/verification.js";
|
|
16
|
-
import {
|
|
16
|
+
import { FOLIO_DOCUMENT_OPERATION_BATCH_MODES, FOLIO_DOCUMENT_OPERATION_CONTRACT_VERSION, FOLIO_DOCUMENT_OPERATION_MODES, FOLIO_DOCUMENT_OPERATION_MODES_BY_TYPE, FOLIO_DOCUMENT_OPERATION_PRECONDITIONS, FOLIO_DOCUMENT_OPERATION_STORIES, FOLIO_DOCUMENT_OPERATION_TYPES, FOLIO_HIGHLIGHT_COLOR_VALUES, FOLIO_LINE_SPACING_RULE_VALUES, FOLIO_PARAGRAPH_ALIGNMENT_VALUES, FolioDocumentOperation, FolioDocumentOperationAffectedTarget, FolioDocumentOperationBatch, FolioDocumentOperationBatchInput, FolioDocumentOperationCapabilities, FolioDocumentOperationIssue, FolioDocumentOperationMode, FolioDocumentOperationPrecondition, FolioDocumentOperationReceipt, FolioDocumentOperationRecovery, FolioDocumentOperationResult, FolioDocumentOperationResultBase, FolioDocumentOperationStatus, FolioDocumentOperationStory, FolioDocumentOperationType, FolioDocumentOperationUndoFailureReason, FolioDocumentOperationUndoHandle, FolioDocumentOperationUndoResult, InvalidFolioDocumentOperationBatchError, UnsupportedFolioDocumentOperationVersionError, assertSupportedFolioDocumentOperationVersion, getFolioDocumentOperationCapabilities, getFolioDocumentOperationIssues, getFolioDocumentOperationReceipts, isFolioDocumentOperationModeSupported, isSupportedFolioDocumentOperationVersion, parseFolioDocumentOperationBatch } from "./document-operations.js";
|
|
17
17
|
import { DocxCompatibility, DocxCompatibilityContext, DocxCompatibilityIssue, DocxCompatibilityLocation, DocxCompatibilityPart, DocxDrawingClassification, FolioDocxCompatibilityHost, FolioDocxCompatibilityProfile, InspectDocxCompatibilityOptions, inspectDocxCompatibility } from "./docx/compatibility.js";
|
|
18
18
|
import { DRAWING_SAFETY_CLASSES, DrawingSafetyClass } from "./docx/imageRawXml.js";
|
|
19
19
|
import { DocumentPropertiesOptions, createDocx } from "./docx/rezip.js";
|
|
@@ -47,4 +47,4 @@ import { DOCX_CONFORMANCE_CLASSES } from "@stll/docx-core/model";
|
|
|
47
47
|
import { OP_STORIES, OpStory, TextPosition } from "@stll/docx-core/ops";
|
|
48
48
|
type Document = document_d_exports.Document;
|
|
49
49
|
type DocxConformanceClass = document_d_exports.DocxConformanceClass;
|
|
50
|
-
export { type AIBarStatus, type AIChatMode, type AICitation, type AICitationRange, type AICitationSource, type AIGenerateInput, type AISuggestion, type AISuggestionApplyMode, type AISuggestionPreset, type AISuggestionSeverity, type AISuggestionStatus, type
|
|
50
|
+
export { type AIBarStatus, type AIChatMode, type AICitation, type AICitationRange, type AICitationSource, type AIGenerateInput, type AISuggestion, type AISuggestionApplyMode, type AISuggestionPreset, type AISuggestionSeverity, type AISuggestionStatus, type ApplyResult, type BlockRect, COMPARE_REVISION_FORMATS, COMPARE_UNSUPPORTED_REASONS, COMPARE_VERIFICATION_CAUSES, COMPARE_VERIFICATION_INVARIANTS, type CompareChange, type CompareChangeLocation, type CompareCompatibility, type CompareContentOptions, CompareDocxApplyError, type CompareDocxError, CompareDocxFinalParagraphMarkError, CompareDocxOperationLimitError, type CompareDocxOptions, CompareDocxParseError, CompareDocxRoundTripError, CompareDocxSerializeError, type CompareFolioRequirement, type CompareResult, type CompareRevisionFormat, type CompareUnsupportedPart, type CompareUnsupportedReason, type CompareVerification, type CompareVerificationCause, type CompareVerificationFailure, type CompareVerificationInvariant, type CreateEmptyDocumentOptions, DEFAULT_AI_SUGGESTION_PRESETS, DEFAULT_OUTLINE_DEPTH, DOCUMENT_PRESET_VERSION, DOCUMENT_STYLE_SET_VERSION, DOCX_CONFORMANCE_CLASSES, DRAWING_SAFETY_CLASSES, type DeriveBlockIdInput, type DirectiveKind, type DirectiveRange, type Document, type DocumentPreset, type DocumentPropertiesOptions, type DocumentStyleCatalog, type DocumentStyleCatalogEntry, type DocumentStyleSet, type DocxCompatibility, type DocxCompatibilityContext, type DocxCompatibilityIssue, type DocxCompatibilityLocation, type DocxCompatibilityPart, type DocxConformanceClass, type DocxDrawingClassification, type DrawingSafetyClass, type EditorReadOnlyReason, type EmbeddedFont, type EmbeddedFontParts, type ExtractDocumentStyleSetOptions, FOLIO_CONTENT_COMPARISON_LIMITS, FOLIO_DOCUMENT_OPERATION_BATCH_MODES, FOLIO_DOCUMENT_OPERATION_CONTRACT_VERSION, FOLIO_DOCUMENT_OPERATION_MODES, FOLIO_DOCUMENT_OPERATION_MODES_BY_TYPE, FOLIO_DOCUMENT_OPERATION_PRECONDITIONS, FOLIO_DOCUMENT_OPERATION_STORIES, FOLIO_DOCUMENT_OPERATION_TYPES, FOLIO_HIGHLIGHT_COLOR_VALUES, FOLIO_LINE_SPACING_RULE_VALUES, FOLIO_PARAGRAPH_ALIGNMENT_VALUES, type FinalParagraphMarkRevision, type FolioAIBlock, type FolioAIBlockAnchor, type FolioAIBlockKind, type FolioAIBlockPreviewRun, type FolioAIBlockStructuralBoundary, type FolioAIBlockTableLocation, type FolioAIComment, type FolioAIDiagnosticBlock, type FolioAIEditAppliedOperation, type FolioAIEditApplyMode, type FolioAIEditApplyOutcome, type FolioAIEditApplyResult, type FolioAIEditNormalization, type FolioAIEditNormalizationCode, type FolioAIEditOperation, type FolioAIEditParagraphIdentity, type FolioAIEditPrecondition, type FolioAIEditReviewMeta, type FolioAIEditSeverity, type FolioAIEditSkipReason, type FolioAIEditSkippedOperation, type FolioAIEditSnapshot, type FolioAIInlineBooleanProperty, type FolioAIInlineFormatting, type FolioAIInlineFormattingPatch, type FolioAIParagraphBlock, type FolioAIParagraphSpacing, type FolioAISignatureParty, type FolioAnonymizationMatch, type FolioAnonymizationTerm, type FolioAutocompleteApi, type FolioAutocompleteState, type FolioBlockId, type FolioContentBlock, type FolioContentBlockProperty, type FolioContentComparison, type FolioContentComparisonError, type FolioContentComparisonEvent, type FolioContentComparisonLimit, FolioContentComparisonLimitError, type FolioContentContainerPathEntry, type FolioContentFormatRange, type FolioContentFormattingChange, type FolioContentIdStability, type FolioContentInlineBooleanProperty, type FolioContentInlineComparisonResult, type FolioContentInlineFormatting, type FolioContentInlineFormattingPatch, FolioContentInlinePresentationProjectionError, type FolioContentLineSpacingRule, type FolioContentParagraphAlignment, type FolioContentParagraphFormattingPatch, type FolioContentParagraphKind, type FolioContentParagraphSpacing, type FolioContentRun, type FolioContentSnapshot, type FolioContentStatedNumbering, type FolioContentStructuralChange, type FolioContentTableLocation, type FolioContentTextSegment, type FolioDerivedFields, type FolioDocumentOperation, type FolioDocumentOperationAffectedTarget, type FolioDocumentOperationBatch, type FolioDocumentOperationBatchInput, type FolioDocumentOperationCapabilities, type FolioDocumentOperationIssue, type FolioDocumentOperationMode, type FolioDocumentOperationPrecondition, type FolioDocumentOperationReceipt, type FolioDocumentOperationRecovery, type FolioDocumentOperationResult, type FolioDocumentOperationResultBase, type FolioDocumentOperationStatus, type FolioDocumentOperationStory, type FolioDocumentOperationType, type FolioDocumentOperationUndoFailureReason, type FolioDocumentOperationUndoHandle, type FolioDocumentOperationUndoResult, type FolioDocxCompatibilityHost, type FolioDocxCompatibilityProfile, type FolioFieldInsertion, type FolioRevisionStamp, type FolioUndefinedReferencePolicy, type FolioWordDiffOptions, type ImageMeta, type ImageRef, type InspectDocxCompatibilityOptions, InvalidCompareDocxOptionsError, InvalidFolioContentComparisonError, InvalidFolioDocumentOperationBatchError, MAX_COMPARE_OPERATIONS, type MarkdownOptions, type MarkdownResult, OP_STORIES, type OpStory, type OutlineDepth, type PositionalText, type ResolvedAnchor, type ReviewDisplayMode, STELLA_STYLE_SET_NAME, type TemplatePreviewHiddenRange, type TemplatePreviewSpan, type TemplatePreviewValue, type TemplatePreviewValues, type TemplateSlashMenuKeyAction, type TemplateSlashMenuState, type TextPosition, UnsupportedFolioDocumentOperationVersionError, WORD_DIFF_GRANULARITIES, type WordDiffGranularity, type WordDiffNormalization, type WordDiffOptions, type WordDiffSegment, applySuggestions, assertSupportedFolioDocumentOperationVersion, buildEmbeddedFontFamilyMap, buildPositionalText, clearTemplateSlashMenu, compareContent, compareDocx, consumeTemplateSlashQuery, createAICitationDecorationsPlugin, createDocx, createEmptyDocument, createFolioAIEditSnapshot, createStellaStyleDocumentPreset, createStellaStyleSet, currentFolioBlockId, deriveBlockId, diffWordSegments, extractDocumentStyleSet, extractDocumentStyleSetFromDocx, extractEmbeddedFonts, filterHeadingsByDepth, fromMarkdown, getEmbeddedFontFaces, getFolioCaretViewportRect, getFolioDocumentOperationCapabilities, getFolioDocumentOperationIssues, getFolioDocumentOperationReceipts, getFolioParaIdFromBlockId, getFolioSelectionViewportRect, getGoogleFontsEnabled, getTemplateDirectives, getTemplateSlashMenu, hashFolioAIBlockText, inspectDocumentStyles, inspectDocumentStylesFromDocx, inspectDocxCompatibility, isFolioAIContentBlock, isFolioBlockId, isFolioDocumentOperationModeSupported, isSequentialFolioBlockId, isSuggestionStale, isSupportedFolioDocumentOperationVersion, mergeDocumentContent, normalizeFolioAIBlockText, parseFolioDocumentOperationBatch, resetTemplateSlashQuery, resolveSuggestionAnchor, scanDirectives, scopeEmbeddedFontFamily, scrollFolioPositionIntoView, setAICitationsMeta, setAISuggestionsMeta, setActiveCitationMeta, setFocusedSuggestionMeta, setGoogleFontsEnabled, setTemplatePreviewValues, templateSlashMenuKey, toMarkdown, toMarkdownResult };
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { applyFolioAIEditOperations } from "./ai-edits/apply.js";
|
|
2
1
|
import { createFolioAIEditSnapshot, hashFolioAIBlockText, isFolioAIContentBlock, normalizeFolioAIBlockText } from "./ai-edits/snapshot.js";
|
|
3
2
|
import { WORD_DIFF_GRANULARITIES, diffWordSegments } from "./ai-edits/word-diff.js";
|
|
4
3
|
import { applySuggestions } from "./ai-suggestions/apply.js";
|
|
@@ -9,7 +8,7 @@ import { MAX_COMPARE_OPERATIONS, compareDocx } from "./compare/compare.js";
|
|
|
9
8
|
import { FOLIO_CONTENT_COMPARISON_LIMITS, FolioContentComparisonLimitError, FolioContentInlinePresentationProjectionError, InvalidFolioContentComparisonError, compareContent } from "./compare/content.js";
|
|
10
9
|
import { COMPARE_REVISION_FORMATS, COMPARE_UNSUPPORTED_REASONS, CompareDocxApplyError, CompareDocxFinalParagraphMarkError, CompareDocxOperationLimitError, CompareDocxParseError, CompareDocxRoundTripError, CompareDocxSerializeError, InvalidCompareDocxOptionsError } from "./compare/types.js";
|
|
11
10
|
import { COMPARE_VERIFICATION_CAUSES, COMPARE_VERIFICATION_INVARIANTS } from "./compare/verification.js";
|
|
12
|
-
import { FOLIO_DOCUMENT_OPERATION_BATCH_MODES, FOLIO_DOCUMENT_OPERATION_CONTRACT_VERSION, FOLIO_DOCUMENT_OPERATION_MODES, FOLIO_DOCUMENT_OPERATION_MODES_BY_TYPE, FOLIO_DOCUMENT_OPERATION_PRECONDITIONS, FOLIO_DOCUMENT_OPERATION_STORIES, FOLIO_DOCUMENT_OPERATION_TYPES, FOLIO_HIGHLIGHT_COLOR_VALUES, FOLIO_LINE_SPACING_RULE_VALUES, FOLIO_PARAGRAPH_ALIGNMENT_VALUES, InvalidFolioDocumentOperationBatchError, UnsupportedFolioDocumentOperationVersionError,
|
|
11
|
+
import { FOLIO_DOCUMENT_OPERATION_BATCH_MODES, FOLIO_DOCUMENT_OPERATION_CONTRACT_VERSION, FOLIO_DOCUMENT_OPERATION_MODES, FOLIO_DOCUMENT_OPERATION_MODES_BY_TYPE, FOLIO_DOCUMENT_OPERATION_PRECONDITIONS, FOLIO_DOCUMENT_OPERATION_STORIES, FOLIO_DOCUMENT_OPERATION_TYPES, FOLIO_HIGHLIGHT_COLOR_VALUES, FOLIO_LINE_SPACING_RULE_VALUES, FOLIO_PARAGRAPH_ALIGNMENT_VALUES, InvalidFolioDocumentOperationBatchError, UnsupportedFolioDocumentOperationVersionError, assertSupportedFolioDocumentOperationVersion, getFolioDocumentOperationCapabilities, getFolioDocumentOperationIssues, getFolioDocumentOperationReceipts, isFolioDocumentOperationModeSupported, isSupportedFolioDocumentOperationVersion, parseFolioDocumentOperationBatch } from "./document-operations.js";
|
|
13
12
|
import { inspectDocxCompatibility } from "./docx/compatibility.js";
|
|
14
13
|
import { DRAWING_SAFETY_CLASSES } from "./docx/imageRawXml.js";
|
|
15
14
|
import { createDocx } from "./docx/rezip.js";
|
|
@@ -33,4 +32,4 @@ import { mergeDocumentContent } from "./utils/mergeDocumentContent.js";
|
|
|
33
32
|
import { DEFAULT_OUTLINE_DEPTH, filterHeadingsByDepth } from "./utils/outlineDepth.js";
|
|
34
33
|
import { DOCX_CONFORMANCE_CLASSES } from "@stll/docx-core/model";
|
|
35
34
|
import { OP_STORIES } from "@stll/docx-core/ops";
|
|
36
|
-
export { COMPARE_REVISION_FORMATS, COMPARE_UNSUPPORTED_REASONS, COMPARE_VERIFICATION_CAUSES, COMPARE_VERIFICATION_INVARIANTS, CompareDocxApplyError, CompareDocxFinalParagraphMarkError, CompareDocxOperationLimitError, CompareDocxParseError, CompareDocxRoundTripError, CompareDocxSerializeError, DEFAULT_AI_SUGGESTION_PRESETS, DEFAULT_OUTLINE_DEPTH, DOCUMENT_PRESET_VERSION, DOCUMENT_STYLE_SET_VERSION, DOCX_CONFORMANCE_CLASSES, DRAWING_SAFETY_CLASSES, FOLIO_CONTENT_COMPARISON_LIMITS, FOLIO_DOCUMENT_OPERATION_BATCH_MODES, FOLIO_DOCUMENT_OPERATION_CONTRACT_VERSION, FOLIO_DOCUMENT_OPERATION_MODES, FOLIO_DOCUMENT_OPERATION_MODES_BY_TYPE, FOLIO_DOCUMENT_OPERATION_PRECONDITIONS, FOLIO_DOCUMENT_OPERATION_STORIES, FOLIO_DOCUMENT_OPERATION_TYPES, FOLIO_HIGHLIGHT_COLOR_VALUES, FOLIO_LINE_SPACING_RULE_VALUES, FOLIO_PARAGRAPH_ALIGNMENT_VALUES, FolioContentComparisonLimitError, FolioContentInlinePresentationProjectionError, InvalidCompareDocxOptionsError, InvalidFolioContentComparisonError, InvalidFolioDocumentOperationBatchError, MAX_COMPARE_OPERATIONS, OP_STORIES, STELLA_STYLE_SET_NAME, UnsupportedFolioDocumentOperationVersionError, WORD_DIFF_GRANULARITIES,
|
|
35
|
+
export { COMPARE_REVISION_FORMATS, COMPARE_UNSUPPORTED_REASONS, COMPARE_VERIFICATION_CAUSES, COMPARE_VERIFICATION_INVARIANTS, CompareDocxApplyError, CompareDocxFinalParagraphMarkError, CompareDocxOperationLimitError, CompareDocxParseError, CompareDocxRoundTripError, CompareDocxSerializeError, DEFAULT_AI_SUGGESTION_PRESETS, DEFAULT_OUTLINE_DEPTH, DOCUMENT_PRESET_VERSION, DOCUMENT_STYLE_SET_VERSION, DOCX_CONFORMANCE_CLASSES, DRAWING_SAFETY_CLASSES, FOLIO_CONTENT_COMPARISON_LIMITS, FOLIO_DOCUMENT_OPERATION_BATCH_MODES, FOLIO_DOCUMENT_OPERATION_CONTRACT_VERSION, FOLIO_DOCUMENT_OPERATION_MODES, FOLIO_DOCUMENT_OPERATION_MODES_BY_TYPE, FOLIO_DOCUMENT_OPERATION_PRECONDITIONS, FOLIO_DOCUMENT_OPERATION_STORIES, FOLIO_DOCUMENT_OPERATION_TYPES, FOLIO_HIGHLIGHT_COLOR_VALUES, FOLIO_LINE_SPACING_RULE_VALUES, FOLIO_PARAGRAPH_ALIGNMENT_VALUES, FolioContentComparisonLimitError, FolioContentInlinePresentationProjectionError, InvalidCompareDocxOptionsError, InvalidFolioContentComparisonError, InvalidFolioDocumentOperationBatchError, MAX_COMPARE_OPERATIONS, OP_STORIES, STELLA_STYLE_SET_NAME, UnsupportedFolioDocumentOperationVersionError, WORD_DIFF_GRANULARITIES, applySuggestions, assertSupportedFolioDocumentOperationVersion, buildEmbeddedFontFamilyMap, buildPositionalText, clearTemplateSlashMenu, compareContent, compareDocx, consumeTemplateSlashQuery, createAICitationDecorationsPlugin, createDocx, createEmptyDocument, createFolioAIEditSnapshot, createStellaStyleDocumentPreset, createStellaStyleSet, currentFolioBlockId, deriveBlockId, diffWordSegments, extractDocumentStyleSet, extractDocumentStyleSetFromDocx, extractEmbeddedFonts, filterHeadingsByDepth, fromMarkdown, getEmbeddedFontFaces, getFolioCaretViewportRect, getFolioDocumentOperationCapabilities, getFolioDocumentOperationIssues, getFolioDocumentOperationReceipts, getFolioParaIdFromBlockId, getFolioSelectionViewportRect, getGoogleFontsEnabled, getTemplateDirectives, getTemplateSlashMenu, hashFolioAIBlockText, inspectDocumentStyles, inspectDocumentStylesFromDocx, inspectDocxCompatibility, isFolioAIContentBlock, isFolioBlockId, isFolioDocumentOperationModeSupported, isSequentialFolioBlockId, isSuggestionStale, isSupportedFolioDocumentOperationVersion, mergeDocumentContent, normalizeFolioAIBlockText, parseFolioDocumentOperationBatch, resetTemplateSlashQuery, resolveSuggestionAnchor, scanDirectives, scopeEmbeddedFontFamily, scrollFolioPositionIntoView, setAICitationsMeta, setAISuggestionsMeta, setActiveCitationMeta, setFocusedSuggestionMeta, setGoogleFontsEnabled, setTemplatePreviewValues, templateSlashMenuKey, toMarkdown, toMarkdownResult };
|
|
@@ -5,8 +5,8 @@ import { intAttr } from "../docx/serializer/xmlUtils.js";
|
|
|
5
5
|
import { TRANSITIONAL_NAME_BY_STRICT_NAME } from "../docx/strictNames.gen.js";
|
|
6
6
|
import { createCapturedXmlSanitizer } from "../docx/verbatimCapture.js";
|
|
7
7
|
import { NAMESPACES, OOXML_NAMESPACE_SCOPE } from "../docx/xmlParser.js";
|
|
8
|
-
import { escapeXmlAttribute, serializeOnOffElement } from "@stll/docx-core";
|
|
9
8
|
import { outlineLevelStatedValue, paragraphNumberingSlots } from "@stll/docx-core/model";
|
|
9
|
+
import { escapeXmlAttribute, serializeOnOffElement } from "@stll/docx-core";
|
|
10
10
|
import { serializeSequenceChildren } from "@stll/docx-core/schema";
|
|
11
11
|
// src/internal/paragraphFormattingSerialization.ts
|
|
12
12
|
/** Only an absent paragraph override leaves numbering wholly to its style. */
|
|
@@ -19,9 +19,9 @@ import { paragraphContentOf } from "../prosemirror/zeroWidthAnchors.js";
|
|
|
19
19
|
import { recordNodeResolution } from "./revisionResolutionEdits.js";
|
|
20
20
|
import { resolveInlineRevisions } from "./revisionResolutionInline.js";
|
|
21
21
|
import { composeRevisionResolutionMaps } from "./revisionResolutionStep.js";
|
|
22
|
-
import { REVIEW_CARRIERS } from "@stll/docx-core/model";
|
|
23
22
|
import { Fragment, Slice } from "prosemirror-model";
|
|
24
23
|
import { Mapping, ReplaceStep, StepMap, Transform } from "prosemirror-transform";
|
|
24
|
+
import { REVIEW_CARRIERS } from "@stll/docx-core/model";
|
|
25
25
|
import { paragraphMarkOutcome } from "@stll/docx-core/ops";
|
|
26
26
|
// src/internal/wholeStoryRevisionResolution.ts
|
|
27
27
|
const resolveProperties = ({ doc, mode, styleResolver, numbering, steps, changedRanges }) => {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { isInTable as isInTableCell } from "../prosemirror/extensions/nodes/TableExtension.js";
|
|
2
2
|
import { NO_LIST_NUMBERING_MENU, listNumberingMenuState } from "../prosemirror/listNumbering.js";
|
|
3
|
+
import { selectionBounds } from "../prosemirror/selectionBounds.js";
|
|
3
4
|
import { Subscribable } from "./Subscribable.js";
|
|
4
5
|
// src/managers/ContextMenuManager.ts
|
|
5
6
|
const CLOSED_STATE = {
|
|
@@ -23,7 +24,7 @@ var ContextMenuManager = class extends Subscribable {
|
|
|
23
24
|
}
|
|
24
25
|
/** Open the menu at `anchor`, deriving menu flags from the editor state. */
|
|
25
26
|
openMenu(anchor, { state, hasSelectionOverride, trackedChange }) {
|
|
26
|
-
const selection = state
|
|
27
|
+
const selection = state ? selectionBounds(state.selection) : {
|
|
27
28
|
from: 0,
|
|
28
29
|
to: 0
|
|
29
30
|
};
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* whole-table deletion check against ProseMirror state. The adapter keeps only
|
|
11
11
|
* the listener lifecycle and the host-callback dispatch.
|
|
12
12
|
*/
|
|
13
|
-
import { HistoryShortcutOwner } from "../prosemirror/extensions/core/
|
|
13
|
+
import { HistoryShortcutOwner } from "../prosemirror/extensions/core/historyCommands.js";
|
|
14
14
|
import { EditorView } from "prosemirror-view";
|
|
15
15
|
export declare const DEFAULT_KEYBOARD_SHORTCUT_SCOPE = "editor";
|
|
16
16
|
export declare function isMacPlatform(): boolean;
|
|
@@ -18,8 +18,8 @@
|
|
|
18
18
|
* Only a box placed `inlineWithPrevious` has an anchor: a `standalone` one
|
|
19
19
|
* stands in for a paragraph that held nothing else.
|
|
20
20
|
*/
|
|
21
|
-
import { Node } from "prosemirror-model";
|
|
22
21
|
import { Transaction } from "prosemirror-state";
|
|
22
|
+
import { Node } from "prosemirror-model";
|
|
23
23
|
import { Transform } from "prosemirror-transform";
|
|
24
24
|
/** The id a text box anchor names, or `undefined` for anything else. */
|
|
25
25
|
export declare const textBoxAnchorIdOf: (node: Node) => string | undefined;
|
|
@@ -2,8 +2,8 @@ import "../content-controls/index.js";
|
|
|
2
2
|
import { SetContentControlValueInput } from "../content-controls/mutateContentControls.js";
|
|
3
3
|
import { document_d_exports } from "../types/document.js";
|
|
4
4
|
import { TableCellFormatting, TableFormatting, TableRowFormatting } from "../types/formatting.js";
|
|
5
|
-
import { Node } from "prosemirror-model";
|
|
6
5
|
import { Command, EditorState } from "prosemirror-state";
|
|
6
|
+
import { Node } from "prosemirror-model";
|
|
7
7
|
import { FormattingPatch, ParagraphPropsPatch, RunPropsPatch, TableBlockIntentOperation, TableIntentOperation, TableRowIntentOperation } from "@stll/docx-core/ops";
|
|
8
8
|
/** One table, row or cell, addressed by a position inside its first paragraph. */
|
|
9
9
|
export type CanonicalTableFormatTarget = {
|