@docx-editor.dev/core 2.27.0 → 2.29.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/automation.cjs +1 -1
- package/dist/automation.d.ts +76 -16
- package/dist/automation.js +1 -1
- package/dist/binding.cjs +1 -1
- package/dist/binding.d.ts +31 -12
- package/dist/binding.js +1 -1
- package/dist/{index-CkQVRJtJ.d.ts → chrome-print-CAs51cpq.d.ts} +248 -115
- package/dist/chunk-236O4YQW.js +2 -0
- package/dist/chunk-4HENIAFG.js +1 -0
- package/dist/chunk-6JPL6ZAS.cjs +5 -0
- package/dist/chunk-6ZQP4HQ7.js +3 -0
- package/dist/{chunk-2GK7YQB2.cjs → chunk-7WQ7AAHW.cjs} +1 -1
- package/dist/chunk-BCXH4BXB.js +5 -0
- package/dist/chunk-BY2ACZZ6.cjs +1 -0
- package/dist/chunk-CAJEXXVG.cjs +4 -0
- package/dist/chunk-CPWLFPWC.js +30 -0
- package/dist/chunk-D7ZMDMPX.cjs +3 -0
- package/dist/chunk-DOHF6FA7.cjs +30 -0
- package/dist/chunk-DVX32P2P.js +27 -0
- package/dist/chunk-E4LOMDNL.js +1 -0
- package/dist/chunk-EKLM7NWB.cjs +7 -0
- package/dist/chunk-G3K63G7P.cjs +27 -0
- package/dist/chunk-G4HOFIKJ.js +1 -0
- package/dist/chunk-JLVBDYVQ.cjs +2 -0
- package/dist/chunk-LQX36Z5P.js +7 -0
- package/dist/chunk-LSZ6KPKK.js +1 -0
- package/dist/chunk-MM5QBMTE.cjs +1 -0
- package/dist/chunk-OMCG63ZF.js +1 -0
- package/dist/chunk-OSFOJTHU.cjs +18 -0
- package/dist/chunk-RCLZXP3B.js +2 -0
- package/dist/chunk-T6K2QYNZ.cjs +2 -0
- package/dist/chunk-TRGAVV2Y.js +4 -0
- package/dist/chunk-U4JZVSOE.js +2 -0
- package/dist/chunk-UHHYFIDT.cjs +1 -0
- package/dist/chunk-V3N4SOAK.cjs +1 -0
- package/dist/chunk-W35WTWAO.cjs +1 -0
- package/dist/chunk-YQ5G6LC7.js +18 -0
- package/dist/collaboration/replication.cjs +1 -1
- package/dist/collaboration/replication.d.ts +42 -6
- package/dist/collaboration/replication.js +1 -1
- package/dist/collaboration.cjs +1 -1
- package/dist/collaboration.d.ts +99 -7
- package/dist/collaboration.js +1 -1
- package/dist/contracts/document.d.ts +18 -3
- package/dist/contracts/editor.d.ts +19 -10
- package/dist/contracts/interaction.d.ts +31 -2
- package/dist/contracts/modules.cjs +1 -1
- package/dist/contracts/modules.d.ts +56 -8
- package/dist/contracts/modules.js +1 -1
- package/dist/contracts/types.d.ts +11 -2
- package/dist/{custom-node-writes-Vzpq9I8_.d.ts → custom-node-writes-Bn6uciLb.d.ts} +2 -2
- package/dist/diagnostic-context-B8M79cfK.d.ts +30 -0
- package/dist/diagnostic-hints-BeVjfNOv.d.ts +113 -0
- package/dist/{document-protection-9zpIHWTE.d.ts → document-protection-CUb55pl_.d.ts} +2 -2
- package/dist/{editor-B3OBYNrF.d.ts → editor-CZQZmTIU.d.ts} +770 -141
- package/dist/{editor-scope-OHPwVQ5l.d.ts → editor-scope-7o9xweiJ.d.ts} +1 -1
- package/dist/editor.cjs +1 -1
- package/dist/editor.css +5 -5
- package/dist/editor.d.ts +439 -33
- package/dist/editor.js +1 -1
- package/dist/export.cjs +2 -2
- package/dist/export.d.ts +23 -14
- package/dist/export.js +2 -2
- package/dist/failure-NS2lsya4.d.ts +115 -0
- package/dist/{font-resolver-DN0xNOf_.d.ts → font-resolver-lSBLirLR.d.ts} +3 -3
- package/dist/{headless-document-view-ICYqNkQ1.d.ts → headless-document-view-pp3q7wIh.d.ts} +2 -2
- package/dist/{image-resources-BDFxcu7W.d.ts → image-resources-tXLQShoC.d.ts} +10 -10
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +92 -20
- package/dist/index.js +1 -1
- package/dist/{layout-shaping-BvZD_VKP.d.ts → layout-shaping-BD-dF_rn.d.ts} +1 -1
- package/dist/layout.cjs +1 -1
- package/dist/layout.d.ts +168 -79
- package/dist/layout.js +1 -1
- package/dist/{note-properties-CkAk7g-n.d.ts → note-properties-qQUjO1GQ.d.ts} +3 -3
- package/dist/{omml-equation-DuczgG5o.d.ts → omml-equation-BUbU0utM.d.ts} +1 -1
- package/dist/output.cjs +1 -1
- package/dist/output.d.ts +18 -9
- package/dist/output.js +1 -1
- package/dist/{protocol-aKYr8r3u.d.ts → protocol-DYzzz2ej.d.ts} +44 -4
- package/dist/{review-paragraph-order-Ddj5d6rp.d.ts → review-paragraph-order-CN_0l2Cb.d.ts} +5 -2
- package/dist/{semantic-cell-selection-DoqYCz_F.d.ts → semantic-cell-selection-eYag3P47.d.ts} +8 -213
- package/dist/{semantic-interaction-G0bjmmmk.d.ts → semantic-interaction-kR_QB845.d.ts} +25 -34
- package/dist/{semantic-paint-CsMzF8-O.d.ts → semantic-paint-ZayFF3tD.d.ts} +17 -5
- package/dist/{semantic-record-queries-1du6lQqS.d.ts → semantic-record-queries-Bsgth6lv.d.ts} +1 -1
- package/dist/{semantic-records-B9OolWGN.d.ts → semantic-records-DQmumPgL.d.ts} +1367 -884
- package/dist/store.cjs +1 -1
- package/dist/store.d.ts +1611 -1586
- package/dist/store.js +1 -1
- package/dist/{tree-package-fragment-DYZIk1rY.d.ts → tree-package-store-CovjNARF.d.ts} +157 -137
- package/dist/{tree-session-contract-DQVJOOkv.d.ts → tree-session-contract-CZVAGl51.d.ts} +8 -6
- package/dist/{types-barrel-BFKR8Pzp.d.ts → types-barrel-DuC5QBNC.d.ts} +352 -231
- package/package.json +3 -3
- package/dist/chunk-4KZ6L5YF.cjs +0 -15
- package/dist/chunk-55AT3MOU.cjs +0 -25
- package/dist/chunk-6ZQMII6V.js +0 -1
- package/dist/chunk-7IGCWG4H.js +0 -2
- package/dist/chunk-7MYITTAH.js +0 -5
- package/dist/chunk-AVKVRU7Z.cjs +0 -5
- package/dist/chunk-CWRBFNK5.cjs +0 -5
- package/dist/chunk-DGPA3TST.cjs +0 -27
- package/dist/chunk-DNXVNQEO.js +0 -1
- package/dist/chunk-FQN4KSFL.cjs +0 -7
- package/dist/chunk-GVUOWHTO.cjs +0 -1
- package/dist/chunk-GWQJ5774.js +0 -5
- package/dist/chunk-HAQ72KD7.js +0 -1
- package/dist/chunk-HO5XFO32.cjs +0 -3
- package/dist/chunk-IGR23DV2.js +0 -1
- package/dist/chunk-JSIX2EOH.js +0 -3
- package/dist/chunk-K246T47S.cjs +0 -1
- package/dist/chunk-KAXOGCGA.js +0 -1
- package/dist/chunk-LZLTN5A3.cjs +0 -1
- package/dist/chunk-NBCVVZOM.cjs +0 -1
- package/dist/chunk-O5INAWZQ.js +0 -1
- package/dist/chunk-OHAXVTWG.cjs +0 -1
- package/dist/chunk-S74GRBNE.js +0 -7
- package/dist/chunk-UBLUVNZR.js +0 -27
- package/dist/chunk-UMRSBLO7.js +0 -15
- package/dist/chunk-VIPMGGUT.js +0 -25
- package/dist/chunk-WG4KMSX2.cjs +0 -2
- package/dist/chunk-WRLKVNNR.cjs +0 -1
- package/dist/chunk-ZU7IVN6G.js +0 -2
- package/dist/failure-BIPVQbRm.d.ts +0 -65
- package/dist/revision-projection-CSNFudZY.d.ts +0 -242
package/dist/store.d.ts
CHANGED
|
@@ -1,18 +1,32 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
import './
|
|
1
|
+
/**
|
|
2
|
+
* `@docx-editor.dev/core/store` — the canonical OOXML tree and the only write path into it.
|
|
3
|
+
*
|
|
4
|
+
* Bytes become a typed-where-layout-needs-it, generic-everywhere-else tree. Every mutation is a
|
|
5
|
+
* `TreeDocOp` addressed by node id plus UTF-16 offset, applied in one transaction, so a batch
|
|
6
|
+
* refused halfway leaves the document exactly as it was.
|
|
7
|
+
*
|
|
8
|
+
* This is also the trust boundary: zip and XML limits, entity-free parsing, OPC name validation,
|
|
9
|
+
* and inert executable content all live here, because everything downstream assumes a sanitized
|
|
10
|
+
* projection.
|
|
11
|
+
*
|
|
12
|
+
* @packageDocumentation
|
|
13
|
+
* @public
|
|
14
|
+
*/
|
|
15
|
+
import { e as ResourceLimits } from './image-resources-tXLQShoC.js';
|
|
16
|
+
export { C as CreateImageResourceCacheOptions, D as DEFAULT_IMAGE_RESOURCE_LIMITS, f as DEFAULT_LIMITS, H as HARD_CEILINGS, g as IMAGE_RESOURCE_HARD_CEILINGS, c as ImageDecodePort, b as ImageResourceLimits, h as ImageResourceLookup, I as ImageResourceState, M as MAX_SVG_SNIFF_BYTES, P as PreservedImageMime, R as RenderableImageMime, S as SupportedImageMime, V as ValidatedImageBytesHandle, i as ValidatedRasterHeader, j as createImageResourceCache, k as hasBoundedSvgRoot, l as imageResourceLookupFor, m as liveDrawingReferenceCount, r as resolveImageResourceLimits, n as resolveLimits, s as sniffImageMime, o as validateGifHeader, p as validateJpegHeader, q as validatePngHeader, v as validateRasterHeader } from './image-resources-tXLQShoC.js';
|
|
17
|
+
import { O as OoxmlPart, N as OoxmlNode, aU as OoxmlInvariantResult, aV as OoxmlInvariantIssue, ak as OoxmlElement, az as OoxmlParagraphNode, aW as OoxmlFldCharNode, aX as OoxmlFldSimpleNode, aY as OoxmlInstrTextNode, ag as TreeDocOp, av as TreeOpRejection, aZ as TreeOpResult, Q as OoxmlPackage, a_ as RelationshipRecord, V as OoxmlGenericElementNode, a$ as OoxmlHardBreakNode, b0 as OoxmlAttribute, ah as OoxmlProperty, au as RevisionSiteRefusal, f as ReviewRange, R as ReviewModelInput, a as ReviewItem, C as CommentRecord, e as ReviewPosition, b1 as CommentThreadState, c as ReviewCommentItem, b as ReviewRevisionItem, ay as DrawingTreeDocOp, aH as ImpactClass, a1 as ImageWrapTarget } from './types-barrel-DuC5QBNC.js';
|
|
18
|
+
export { b2 as ACCEPTED_PARAGRAPH_PROPERTIES, b3 as ACCEPTED_RUN_PROPERTIES, b4 as CONTENT_CONTROL_ID_MAX, b5 as CONTENT_CONTROL_PROPERTY_ORDER, b6 as CommentAnchor, b7 as CommentPosition, b8 as CommitTextFormFieldOp, b9 as ContentControlCheckbox, ba as ContentControlCheckboxState, bb as ContentControlDataBinding, bc as ContentControlDateFormat, bd as ContentControlEntry, be as ContentControlKind, bf as ContentControlLevel, bg as ContentControlListItem, bh as ContentControlLock, bi as ContentControlProperties, bj as ContentTypeError, bk as ContentTypeIndex, bl as ContentTypeRecords, bm as DEFAULT_OOXML_PACKAGE_LIMITS, bn as DEFAULT_ZIP_LIMITS, bo as DefaultRecord, bp as DeleteTextOp, aO as DrawingImageEffects, Y as DrawingKind, Z as DrawingLocks, _ as DrawingPositionInput, bq as HYPERLINK_RELATIONSHIP_TYPE, br as HyperlinkKind, bs as HyperlinkTarget, bt as IMAGE_RELATIONSHIP_TYPE, aK as IMAGE_WRAP_TARGETS, bu as ImageRelationshipResolution, bv as IndexResult, bw as InsertBuildingBlockOp, bx as InsertTextOp, by as LegacyCheckboxFieldRange, bz as MAX_CONTENT_CONTROLS_PER_PART, bA as MAX_CONTENT_CONTROL_NESTING, bB as NameRejection, bC as NameResult, bD as OFFICE_RELATIONSHIP_NAMESPACE_URI, bE as OOXML_NODE_IDENTITY_RULES, bF as OoxmlBodyNode, bG as OoxmlBookmarkEndNode, bH as OoxmlBookmarkStartNode, bI as OoxmlContentControlCalendarNode, bJ as OoxmlContentControlCheckboxNode, bK as OoxmlContentControlCheckedNode, bL as OoxmlContentControlCheckedStateNode, bM as OoxmlContentControlComboBoxNode, am as OoxmlContentControlContentNode, bN as OoxmlContentControlDataBindingNode, bO as OoxmlContentControlDateFormatNode, bP as OoxmlContentControlDateNode, bQ as OoxmlContentControlDropDownListNode, bR as OoxmlContentControlEndPropertiesNode, bS as OoxmlContentControlLidNode, bT as OoxmlContentControlListItemNode, al as OoxmlContentControlNode, bU as OoxmlContentControlPropertiesNode, bV as OoxmlContentControlStoreMappedDataAsNode, bW as OoxmlContentControlTextNode, bX as OoxmlContentControlUncheckedStateNode, aB as OoxmlContinuationSeparatorNode, bY as OoxmlDocumentNode, aC as OoxmlEndnotesNode, bZ as OoxmlExternalTarget, aD as OoxmlFootnotesNode, b_ as OoxmlGenericExtensionAttribute, b$ as OoxmlHyperlinkNode, c0 as OoxmlInvariantIssueCode, c1 as OoxmlKnownNodeAttribute, c2 as OoxmlNamespaceBinding, U as OoxmlNodeId, c3 as OoxmlNodeIdentityRules, aA as OoxmlNoteNode, aE as OoxmlNoteRefNode, aF as OoxmlNoteReferenceNode, ao as OoxmlPackageLimits, aj as OoxmlPackageRejection, ai as OoxmlPackageResult, c4 as OoxmlParagraphPropertiesNode, c5 as OoxmlPartMetadata, c6 as OoxmlReadRejection, c7 as OoxmlReadResult, c8 as OoxmlRunNode, c9 as OoxmlRunPropertiesNode, aG as OoxmlSeparatorNode, ca as OoxmlTabNode, cb as OoxmlTextElementNode, cc as OoxmlTextNode, cd as OoxmlWmlValAttribute, ce as OoxmlXmlSpaceAttribute, cf as OverrideRecord, cg as RelationshipError, ch as RelationshipSetResult, ci as RelationshipTargetResolver, cj as ResolveResult, ck as ResolvedRelationship, d as ReviewCustomItem, g as ReviewRevisionKind, h as RevisionAddress, ap as RevisionAuthorEntry, a8 as RevisionAuthorResult, aq as RevisionAuthorSkipReason, ar as RevisionBatchEntry, a9 as RevisionBatchResult, as as RevisionBatchSkipDetail, at as RevisionBatchSkipReason, cl as SetLegacyCheckboxOp, cm as SetLegacyDropdownOp, cn as SetTextFormFieldDefaultOp, aI as SourceCrop, co as TABLE_BORDER_STYLES, cp as TabStopWrite, aM as TableBorderStyle, cq as TargetMode, aT as TextFormFieldOptions, aS as TextFormFieldRange, cr as TextFormFieldType, cs as TreeDocOpKind, ct as TreeOpEffect, cu as W15_NAMESPACE_URI, cv as WML_NAMESPACE_URI, cw as XMLNS_NAMESPACE_URI, cx as XML_NAMESPACE_URI, cy as XmlLimits, cz as XmlNode, cA as XmlRejection, cB as XmlResult, cC as ZipLimits, cD as ZipReadResult, cE as ZipRejection, cF as allocateContentControlId, cG as asciiFold, cH as buildContentTypeIndex, cI as buildRelationshipSet, cJ as childElements, cK as commentAnchorsOfStory, cL as commentsOfPart, cM as contentControlContentChildren, cN as contentControlContentNodeOf, cO as contentControlEndPropertiesNodeOf, cP as contentControlLevelOf, cQ as contentControlPropertiesNodeOf, cR as contentControlPropertiesOf, cS as contentControlTextOf, cT as contentControlsIn, cU as detectDuplicateNames, cV as extensionKey, cW as findContentControl, cX as findElement, cY as firstReviewRange, cZ as flattenContentControls, c_ as hasAnyComment, c$ as hyperlinkAnchorOf, d0 as hyperlinkRelationshipIdOf, d1 as hyperlinkTargetOf, d2 as isContentControlContentNode, d3 as isContentControlNode, d4 as isContentControlWrapper, d5 as isContentRevisionKind, d6 as isHyperlinkNode, d7 as isRangeMarkerKind, d8 as isValidMime, d9 as legacyCheckboxFieldsOf, da as lockForbidsEdit, db as lockForbidsRemoval, dc as normalizePartName, dd as orderedContentControlProperties, de as parseContentControlId, df as partNameKey, dg as planRevisionAuthorChange, dh as planRevisionBatch, di as projectDrawing, dj as readOnOffChild, dk as readOoxmlPackage, dl as readOoxmlPart, dm as readXml, dn as readZip, dp as resolveContentControlLock, dq as resolveContentType, dr as resolveImageRelationship, ds as resolveInternalTarget, dt as resolveRelationship, du as reviewItemKey, dv as reviewItemRanges, dw as textContent, dx as textFormFieldsOf, dy as threadStateOfPart, dz as validateExternalTarget, dA as withPart, dB as writeOoxmlPackage, dC as writeZip } from './types-barrel-DuC5QBNC.js';
|
|
19
|
+
import { F as FieldResultsMode, e as TreeModelChange, f as TreeDocumentStore, T as TreePackageStore, S as StoryScope } from './tree-package-store-CovjNARF.js';
|
|
20
|
+
export { l as AtomicNoteSpan, C as CascadeDeletedNoteReferencesOptions, D as DEFAULT_MAX_EDITABLE_STORY_PARTS, m as DrawingPropertyIdResult, j as FragmentPasteInput, k as FragmentPasteResult, n as HeaderFooterKind, o as HeaderFooterLifecycleImpact, p as HeaderFooterLifecycleOp, q as HeaderFooterLifecycleRejection, s as HeaderFooterLifecycleResult, H as HeaderFooterParts, b as HeaderFooterSectionResolution, t as HeaderFooterSlotMeta, c as HeaderFooterVariant, u as HistoryCaptureKind, d as HistoryGroup, M as MAX_FRAGMENT_DECODED_BYTES, v as MAX_NOTES_PER_PART, w as MAX_NOTE_REFERENCE_PARTS, x as MAX_NOTE_REFERENCE_SCAN, y as NOTE_ATOM_CHAR, z as NOTE_CONTINUATION_SEPARATOR_ID, B as NOTE_ID_MAX, E as NOTE_ID_MIN, G as NOTE_SEPARATOR_ID, J as NoteDiagnostic, K as NoteDiagnosticCode, N as NoteKind, L as NoteLifecycleImpact, O as NoteLifecycleOp, P as NoteLifecycleOptions, Q as NoteLifecycleRejection, U as NoteLifecycleResult, V as NoteReferenceHit, W as NoteReferenceScanBudget, X as NoteType, Y as PackageTransactResult, Z as RemotePackageAttribution, g as SelectionMark, _ as StoryResolveResult, a as StoryTargetRejection, $ as TreeDocumentStoreOptions, a0 as TreePackageStoreOptions, a1 as TreeStoryRef, h as TreeTransactOptions, a2 as TreeTransactResult, a3 as TreeTransactionContext, a4 as allocateDrawingPropertyId, a5 as allocateNoteId, a6 as applyFragmentPaste, a7 as applyHeaderFooterLifecycleOp, a8 as applyNoteLifecycleOp, a9 as atomicNoteSpansOf, aa as cascadeDeletedNoteReferences, ab as collectNoteReferences, ac as collectPackageNoteReferences, ad as collectSectionPropertyNodes, ae as createNoteReferenceScanBudget, af as customMarkFollows, ag as diagnoseNoteReferences, ah as findNoteById, ai as formatNoteScopeId, aj as isContinuationSeparatorNode, ak as isEndnotesNode, al as isFootnotesNode, am as isHeaderFooterLifecycleOp, an as isNormalNote, ao as isNoteAtomNode, ap as isNoteLifecycleOp, aq as isNoteNode, ar as isNoteRefNode, as as isNoteReferenceNode, at as isSeparatorNode, au as normalNoteIds, av as noteAtomText, aw as noteIdOf, ax as noteKindOf, ay as noteRefKindOf, az as noteReferenceKindOf, aA as noteTypeOf, aB as notesOf, aC as notesPartHasId, aD as observeHistoryGroup, aE as parseNoteId, aF as parseNoteScopeId, r as reportHistoryGroup, aG as resolveHeaderFooterParts, aH as resolveHeaderFooterPartsBySection, aI as resolveHeaderFooterResolutionBySection, aJ as resolveNotesPart, aK as withBinaryPart, aL as withEmbeddedImage, aM as withoutUnreferencedImagePart } from './tree-package-store-CovjNARF.js';
|
|
21
|
+
import { O as OmmlEquationProjection } from './omml-equation-BUbU0utM.js';
|
|
22
|
+
export { D as DEFAULT_OMML_LIMITS, E as EquationExpression, L as LinearMathOmmlResult, a as LinearMathParseResult, b as LinearMathRejection, c as OFFICE_MATH_NAMESPACE_URI, d as OmmlLimits, e as equationExpressionToLinearMath, l as linearMathToOmml, p as parseLinearMath, f as projectOmmlEquation } from './omml-equation-BUbU0utM.js';
|
|
23
|
+
import { I as InsertCustomNodeWrite, C as CustomNodeWriteResult } from './custom-node-writes-Bn6uciLb.js';
|
|
24
|
+
export { b as BookmarkAnchor, B as BookmarkIndex, c as CustomNodePayloadRead, d as CustomNodePayloadWrite, a as CustomNodeSweepOutcome, e as CustomNodeSweepResult, f as CustomNodeWriteRejection, D as DocumentTrackingSettings, E as EmbeddedFont, F as FontStyleKey, L as ListKind, M as MAX_CUSTOM_NODE_LABEL_LENGTH, g as MAX_CUSTOM_NODE_PAYLOAD_LENGTH, N as NO_TRACKING_SETTINGS, R as ReadEmbeddedFontsOptions, h as buildBookmarkIndex, i as customNodePayloadsByControl, j as customNodePayloadsOf, k as deobfuscateFont, l as ensureListDefinition, m as ensureNumberingLevel, n as insertCustomNodeWrite, r as readEmbeddedFonts, o as readTrackingSettings, p as removeCustomNodeWrite, s as sweepCustomNodePayloads } from './custom-node-writes-Bn6uciLb.js';
|
|
25
|
+
export { c as collectFlowBlocks, a as commentBodyText, b as commentInitials, d as contentControlContentOf, e as deepParagraphOrderOfPart, i as isContentControl, f as isContentControlContent, p as paragraphOrderOfPart, w as walkAllStoryParagraphs, g as walkParagraphInline, h as walkStoryBlocks } from './review-paragraph-order-CN_0l2Cb.js';
|
|
26
|
+
export { D as DocumentProperties, E as EnsuredHyperlinkRelationship, a as HeadlessDocumentRejection, H as HeadlessDocumentView, b as HeadlessThemeFonts, O as OpenHeadlessDocumentResult, c as authorableHyperlinkTarget, e as ensureHyperlinkRelationship, h as headlessViewOfStore, o as openHeadlessDocument, r as relationshipTargetIn } from './headless-document-view-pp3q7wIh.js';
|
|
27
|
+
export { A as AuthoredNoteProperties, D as DEFAULT_ENDNOTE_PROPERTIES, b as DEFAULT_FOOTNOTE_PROPERTIES, E as EndnotePosition, F as FootnotePosition, N as NoteNumRestart, a as ResolvedEndnoteProperties, R as ResolvedFootnoteProperties, c as authoredDocumentEndnoteProperties, d as authoredDocumentFootnoteProperties, e as authoredEndnotePropertiesFromSectPr, f as authoredFootnotePropertiesFromSectPr, i as isLegalEndnotePosition, g as isLegalFootnotePosition, h as isLegalNumRestart, p as parseAuthoredNoteProperties, r as resolveEndnoteProperties, j as resolveFootnoteProperties, s as settingsPartOf } from './note-properties-qQUjO1GQ.js';
|
|
28
|
+
export { D as DocumentProtectionEdit, a as DocumentProtectionState, N as NO_DOCUMENT_PROTECTION, r as readDocumentProtection } from './document-protection-CUb55pl_.js';
|
|
29
|
+
import './editor-scope-7o9xweiJ.js';
|
|
16
30
|
|
|
17
31
|
/**
|
|
18
32
|
* Serialize normalized XML from a canonical part using repository-controlled
|
|
@@ -37,6 +51,119 @@ declare function ooxmlTreesEqual(left: OoxmlPart | OoxmlNode, right: OoxmlPart |
|
|
|
37
51
|
*/
|
|
38
52
|
declare function validateOoxmlPart(part: OoxmlPart): OoxmlInvariantResult;
|
|
39
53
|
|
|
54
|
+
/** An edited part, or the invariant violations that rejected the edit. */
|
|
55
|
+
type OoxmlEditResult = {
|
|
56
|
+
readonly ok: true;
|
|
57
|
+
readonly part: OoxmlPart;
|
|
58
|
+
} | {
|
|
59
|
+
readonly ok: false;
|
|
60
|
+
readonly issues: readonly OoxmlInvariantIssue[];
|
|
61
|
+
};
|
|
62
|
+
/**
|
|
63
|
+
* How an edit primitive validates its result.
|
|
64
|
+
*
|
|
65
|
+
* By default every primitive runs the full-part invariant validation before handing its
|
|
66
|
+
* result back — the safe reading for an isolated call. A TRANSACTION applying many ops pays
|
|
67
|
+
* that full-tree walk once per primitive, which is what made a hundred-paragraph paste
|
|
68
|
+
* quadratic; it defers instead, and runs the same validation ONCE on the final tree before
|
|
69
|
+
* anything is published. Deferring is only sound for a caller that owns a commit boundary:
|
|
70
|
+
* nothing may escape between the unvalidated intermediate and the validated result.
|
|
71
|
+
*/
|
|
72
|
+
interface EditOptions {
|
|
73
|
+
readonly deferValidation?: boolean;
|
|
74
|
+
/**
|
|
75
|
+
* A shared minter for `@w:id` on a NEW revision, for the ops of one transaction.
|
|
76
|
+
*
|
|
77
|
+
* `nextRevisionId` walks the whole part to find the highest id in use, and a formatting
|
|
78
|
+
* write emits one op per run — so a Select All + Bold in suggesting mode paid a
|
|
79
|
+
* document-wide walk thousands of times over. The transaction hands its ops one minter
|
|
80
|
+
* instead, and it is DROPPED the moment an op that can import foreign revision ids runs
|
|
81
|
+
* (a paste carries its own), because a stale minter would hand out an id the document had
|
|
82
|
+
* just started using — and two revisions sharing an address are one card in the pane.
|
|
83
|
+
*
|
|
84
|
+
* Absent means "mint your own": every applier falls back to its own walk, which is what a
|
|
85
|
+
* caller outside a transaction gets.
|
|
86
|
+
*/
|
|
87
|
+
readonly revisionIds?: () => string;
|
|
88
|
+
/**
|
|
89
|
+
* The transaction's revision-id bookkeeping for the tracked TEXT ops, where `revisionIds`
|
|
90
|
+
* above hands the property ops one shared id for their whole group.
|
|
91
|
+
*
|
|
92
|
+
* Absent means "mint your own and remember nothing", which is what a caller outside a
|
|
93
|
+
* transaction gets: every applier falls back to its own walk of the part.
|
|
94
|
+
*/
|
|
95
|
+
readonly trackedRevisionIds?: TransactionRevisionIds;
|
|
96
|
+
/**
|
|
97
|
+
* How the op addresses saved field results (`field-result-mode.ts`). Absent keeps the mode
|
|
98
|
+
* of the enclosing store call, which is `atomic` outside any editable transaction.
|
|
99
|
+
*/
|
|
100
|
+
readonly fieldResults?: FieldResultsMode;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* What one transaction knows about the revision ids its tracked text ops write.
|
|
104
|
+
*
|
|
105
|
+
* TWO questions, and they are the same bookkeeping. `nextRevisionId` walks the whole part, so
|
|
106
|
+
* a replacement — a `deleteText` and an `insertText` in one transaction — walked it twice, and
|
|
107
|
+
* on a five-hundred-page document that doubled the cost of every one. And an insertion aimed
|
|
108
|
+
* at the front edge of a deletion relocates past it only when that deletion is THIS
|
|
109
|
+
* transaction's own: typing over a selection. Backspace, then a keystroke, is two
|
|
110
|
+
* transactions, and there the typed text belongs in FRONT of the struck character, as Word
|
|
111
|
+
* writes it. Adjacency alone cannot tell the two apart; the ids can.
|
|
112
|
+
*/
|
|
113
|
+
interface TransactionRevisionIds {
|
|
114
|
+
/** A fresh `@w:id`, from this transaction's one walk of the part. */
|
|
115
|
+
mint(): string;
|
|
116
|
+
/**
|
|
117
|
+
* Record a wrapper this transaction wrote, by its FULL `CT_TrackChange` identity — id,
|
|
118
|
+
* author and date, as `revisionKey` spells it. Not by the id alone: that number comes out
|
|
119
|
+
* of the file, nothing makes it unique, and a strike joining `w:id="3"` in one paragraph
|
|
120
|
+
* would otherwise claim an unrelated `w:id="3"` elsewhere as this edit's own.
|
|
121
|
+
*/
|
|
122
|
+
wrote(key: string): void;
|
|
123
|
+
/** Whether this transaction wrote a wrapper with that identity. */
|
|
124
|
+
wroteUnder(key: string): boolean;
|
|
125
|
+
}
|
|
126
|
+
/** Every node id currently present in the part. */
|
|
127
|
+
declare function collectNodeIds(part: OoxmlPart): Set<string>;
|
|
128
|
+
/**
|
|
129
|
+
* Mint ids for nodes an edit introduces.
|
|
130
|
+
*
|
|
131
|
+
* Deterministic and collision-checked against the whole part: a structural-path id from the
|
|
132
|
+
* original parse (`/word/document.xml#0.1.2`) and a minted one (`/word/document.xml#new:3`)
|
|
133
|
+
* can never coincide, and the counter skips anything already taken so repeated edits in one
|
|
134
|
+
* session stay unique.
|
|
135
|
+
*
|
|
136
|
+
* Allocators share reservations across edited roots and restored roots. Preview edits,
|
|
137
|
+
* detached nodes, and undo branches must not reuse an identity that collaboration retains.
|
|
138
|
+
*
|
|
139
|
+
* Checks the part's node index directly rather than copying every id into a fresh set: the
|
|
140
|
+
* copy was O(document) per op, and an allocator is created for every op.
|
|
141
|
+
*/
|
|
142
|
+
declare function createNodeIdAllocator(part: OoxmlPart, family?: 'new' | 'paste'): () => string;
|
|
143
|
+
/** Whether a node id exists in the part. */
|
|
144
|
+
declare function hasNode(part: OoxmlPart, nodeId: string): boolean;
|
|
145
|
+
/** Read a node back out of a part by id. */
|
|
146
|
+
declare function findNode(part: OoxmlPart, nodeId: string): OoxmlNode | null;
|
|
147
|
+
/** The element that holds a node, or null for the root and for unknown ids. */
|
|
148
|
+
declare function parentNodeOf(part: OoxmlPart, nodeId: string): OoxmlElement | null;
|
|
149
|
+
/** Replace one node's children wholesale. */
|
|
150
|
+
declare function replaceChildren(part: OoxmlPart, nodeId: string, children: readonly OoxmlNode[], options?: EditOptions): OoxmlEditResult;
|
|
151
|
+
/** Insert children into a node at `index` (clamped to the child list). */
|
|
152
|
+
declare function insertChildren(part: OoxmlPart, nodeId: string, index: number, children: readonly OoxmlNode[], options?: EditOptions): OoxmlEditResult;
|
|
153
|
+
/** Replace one node with another, keeping its position among its siblings. */
|
|
154
|
+
declare function replaceNode(part: OoxmlPart, nodeId: string, replacement: OoxmlNode, options?: EditOptions): OoxmlEditResult;
|
|
155
|
+
/** Remove a node and its subtree. */
|
|
156
|
+
declare function removeNode(part: OoxmlPart, nodeId: string, options?: EditOptions): OoxmlEditResult;
|
|
157
|
+
/**
|
|
158
|
+
* Apply several primitives as ONE atomic step.
|
|
159
|
+
*
|
|
160
|
+
* Each edit runs against the result of the previous one, and the whole sequence is
|
|
161
|
+
* validated once at the end. If any step fails, the ORIGINAL part is what the caller keeps
|
|
162
|
+
* — there is no partially-edited intermediate to publish. This is the shape a multi-`DocOp`
|
|
163
|
+
* store transaction needs.
|
|
164
|
+
*/
|
|
165
|
+
declare function applyEdits(part: OoxmlPart, edits: readonly ((current: OoxmlPart) => OoxmlEditResult)[], options?: EditOptions): OoxmlEditResult;
|
|
166
|
+
|
|
40
167
|
/** UTF-16 placeholder for one atomic field unit in `paragraphTextOf` / segments. */
|
|
41
168
|
declare const FIELD_ATOM_CHAR = "\uFFFC";
|
|
42
169
|
/**
|
|
@@ -130,6 +257,7 @@ interface AtomicFieldSpan {
|
|
|
130
257
|
declare function atomicFieldSpansOf(paragraph: OoxmlParagraphNode, options?: {
|
|
131
258
|
readonly maxNesting?: number;
|
|
132
259
|
readonly maxInstructionChars?: number;
|
|
260
|
+
readonly fieldResults?: FieldResultsMode;
|
|
133
261
|
}): readonly AtomicFieldSpan[];
|
|
134
262
|
/** Whether `fldCharType` is a legal ST_FldCharType value (used by tests / guards). */
|
|
135
263
|
declare function isLegalFldCharType(value: string): boolean;
|
|
@@ -226,1843 +354,1738 @@ declare function inlineControlEndingAt(paragraph: OoxmlParagraphNode, offset: nu
|
|
|
226
354
|
/** The forward-delete mirror: the control whose content STARTS exactly at `offset`. */
|
|
227
355
|
declare function inlineControlStartingAt(paragraph: OoxmlParagraphNode, offset: number): InlineControlSpan | null;
|
|
228
356
|
|
|
229
|
-
/**
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
readonly part: OoxmlPart;
|
|
233
|
-
} | {
|
|
234
|
-
readonly ok: false;
|
|
235
|
-
readonly issues: readonly OoxmlInvariantIssue[];
|
|
236
|
-
};
|
|
357
|
+
/** Structural validation, run before any tree work so a rejection changes nothing. */
|
|
358
|
+
declare function validateTreeOp(part: OoxmlPart, op: TreeDocOp): TreeOpRejection | null;
|
|
359
|
+
|
|
237
360
|
/**
|
|
238
|
-
*
|
|
361
|
+
* Paragraph text as the ops address it, for tests and callers computing offsets.
|
|
239
362
|
*
|
|
240
|
-
*
|
|
241
|
-
*
|
|
242
|
-
*
|
|
243
|
-
*
|
|
244
|
-
* anything is published. Deferring is only sound for a caller that owns a commit boundary:
|
|
245
|
-
* nothing may escape between the unvalidated intermediate and the validated result.
|
|
363
|
+
* `fieldResults` defaults to the mode of the store call in progress, which is `atomic` outside
|
|
364
|
+
* any editable transaction: every field is one unit, the raw text collaboration and
|
|
365
|
+
* automation read. `editable` reads saved field results as text, as an editor in that mode
|
|
366
|
+
* addresses them.
|
|
246
367
|
*/
|
|
247
|
-
|
|
248
|
-
readonly
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
*
|
|
252
|
-
* `nextRevisionId` walks the whole part to find the highest id in use, and a formatting
|
|
253
|
-
* write emits one op per run — so a Select All + Bold in suggesting mode paid a
|
|
254
|
-
* document-wide walk thousands of times over. The transaction hands its ops one minter
|
|
255
|
-
* instead, and it is DROPPED the moment an op that can import foreign revision ids runs
|
|
256
|
-
* (a paste carries its own), because a stale minter would hand out an id the document had
|
|
257
|
-
* just started using — and two revisions sharing an address are one card in the pane.
|
|
258
|
-
*
|
|
259
|
-
* Absent means "mint your own": every applier falls back to its own walk, which is what a
|
|
260
|
-
* caller outside a transaction gets.
|
|
261
|
-
*/
|
|
262
|
-
readonly revisionIds?: () => string;
|
|
263
|
-
/**
|
|
264
|
-
* The transaction's revision-id bookkeeping for the tracked TEXT ops, where `revisionIds`
|
|
265
|
-
* above hands the property ops one shared id for their whole group.
|
|
266
|
-
*
|
|
267
|
-
* Absent means "mint your own and remember nothing", which is what a caller outside a
|
|
268
|
-
* transaction gets: every applier falls back to its own walk of the part.
|
|
269
|
-
*/
|
|
270
|
-
readonly trackedRevisionIds?: TransactionRevisionIds;
|
|
271
|
-
}
|
|
368
|
+
declare function paragraphTextOf(part: OoxmlPart, paragraphId: string, options?: {
|
|
369
|
+
readonly fieldResults?: FieldResultsMode;
|
|
370
|
+
}): string | null;
|
|
371
|
+
|
|
272
372
|
/**
|
|
273
|
-
*
|
|
274
|
-
*
|
|
275
|
-
* TWO questions, and they are the same bookkeeping. `nextRevisionId` walks the whole part, so
|
|
276
|
-
* a replacement — a `deleteText` and an `insertText` in one transaction — walked it twice, and
|
|
277
|
-
* on a five-hundred-page document that doubled the cost of every one. And an insertion aimed
|
|
278
|
-
* at the front edge of a deletion relocates past it only when that deletion is THIS
|
|
279
|
-
* transaction's own: typing over a selection. Backspace, then a keystroke, is two
|
|
280
|
-
* transactions, and there the typed text belongs in FRONT of the struck character, as Word
|
|
281
|
-
* writes it. Adjacency alone cannot tell the two apart; the ids can.
|
|
373
|
+
* Apply one op. `options.fieldResults` installs the field-result addressing mode for the
|
|
374
|
+
* op's whole run (`field-result-mode.ts`); absent keeps the enclosing mode.
|
|
282
375
|
*/
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
mint(): string;
|
|
286
|
-
/**
|
|
287
|
-
* Record a wrapper this transaction wrote, by its FULL `CT_TrackChange` identity — id,
|
|
288
|
-
* author and date, as `revisionKey` spells it. Not by the id alone: that number comes out
|
|
289
|
-
* of the file, nothing makes it unique, and a strike joining `w:id="3"` in one paragraph
|
|
290
|
-
* would otherwise claim an unrelated `w:id="3"` elsewhere as this edit's own.
|
|
291
|
-
*/
|
|
292
|
-
wrote(key: string): void;
|
|
293
|
-
/** Whether this transaction wrote a wrapper with that identity. */
|
|
294
|
-
wroteUnder(key: string): boolean;
|
|
295
|
-
}
|
|
296
|
-
/** Every node id currently present in the part. */
|
|
297
|
-
declare function collectNodeIds(part: OoxmlPart): Set<string>;
|
|
376
|
+
declare function applyTreeOp(part: OoxmlPart, op: TreeDocOp, options?: EditOptions): TreeOpResult;
|
|
377
|
+
|
|
298
378
|
/**
|
|
299
|
-
*
|
|
300
|
-
*
|
|
301
|
-
* Deterministic and collision-checked against the whole part: a structural-path id from the
|
|
302
|
-
* original parse (`/word/document.xml#0.1.2`) and a minted one (`/word/document.xml#new:3`)
|
|
303
|
-
* can never coincide, and the counter skips anything already taken so repeated edits in one
|
|
304
|
-
* session stay unique.
|
|
305
|
-
*
|
|
306
|
-
* Allocators share reservations across edited roots and restored roots. Preview edits,
|
|
307
|
-
* detached nodes, and undo branches must not reuse an identity that collaboration retains.
|
|
379
|
+
* Keys that must never be assigned from file data.
|
|
308
380
|
*
|
|
309
|
-
*
|
|
310
|
-
*
|
|
381
|
+
* XML attribute names become object keys, and a document controls those names — assigning
|
|
382
|
+
* `__proto__` into an ordinary object is the prototype-pollution hazard this engine audits for.
|
|
311
383
|
*/
|
|
312
|
-
declare
|
|
313
|
-
/**
|
|
314
|
-
declare
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
/**
|
|
320
|
-
declare function
|
|
321
|
-
/**
|
|
322
|
-
declare function
|
|
323
|
-
/** Replace one node with another, keeping its position among its siblings. */
|
|
324
|
-
declare function replaceNode(part: OoxmlPart, nodeId: string, replacement: OoxmlNode, options?: EditOptions): OoxmlEditResult;
|
|
325
|
-
/** Remove a node and its subtree. */
|
|
326
|
-
declare function removeNode(part: OoxmlPart, nodeId: string, options?: EditOptions): OoxmlEditResult;
|
|
384
|
+
declare const DANGEROUS_KEYS: readonly string[];
|
|
385
|
+
/** A file-derived key that would pollute a prototype. Refused, never sanitized-and-accepted. */
|
|
386
|
+
declare class DangerousKeyError extends Error {
|
|
387
|
+
readonly key: string;
|
|
388
|
+
readonly path: string;
|
|
389
|
+
constructor(key: string, path: string);
|
|
390
|
+
}
|
|
391
|
+
/** Whether a key is one of {@link DANGEROUS_KEYS}. */
|
|
392
|
+
declare function isDangerousKey(key: string): boolean;
|
|
393
|
+
/** A fresh null-prototype record — the only object shape parser intermediates use. */
|
|
394
|
+
declare function nullRecord<T = unknown>(): Record<string, T>;
|
|
327
395
|
/**
|
|
328
|
-
*
|
|
329
|
-
*
|
|
330
|
-
*
|
|
331
|
-
*
|
|
332
|
-
* — there is no partially-edited intermediate to publish. This is the shape a multi-`DocOp`
|
|
333
|
-
* store transaction needs.
|
|
396
|
+
* Recursively convert `value` into null-prototype records, rejecting any
|
|
397
|
+
* dangerous object key. Arrays and primitives pass through (arrays rebuilt so no
|
|
398
|
+
* inherited prototype pollution survives). Throws DangerousKeyError on the first
|
|
399
|
+
* unsafe key, naming its path. Cyclic inputs are rejected.
|
|
334
400
|
*/
|
|
335
|
-
declare function
|
|
336
|
-
|
|
337
|
-
/** Structural validation, run before any tree work so a rejection changes nothing. */
|
|
338
|
-
declare function validateTreeOp(part: OoxmlPart, op: TreeDocOp): TreeOpRejection | null;
|
|
401
|
+
declare function toSafeRecord(value: unknown, path?: string): unknown;
|
|
339
402
|
|
|
403
|
+
/** Locate `[Content_Types].xml` bytes regardless of zip key spelling. */
|
|
404
|
+
declare function contentTypesPartBytes(pkg: OoxmlPackage): {
|
|
405
|
+
readonly storageKey: string;
|
|
406
|
+
readonly bytes: Uint8Array;
|
|
407
|
+
} | null;
|
|
340
408
|
/**
|
|
341
|
-
*
|
|
342
|
-
*
|
|
343
|
-
* Validation runs first and returns before any tree work, so a rejected op is a true no-op:
|
|
344
|
-
* the caller keeps the part it passed in, unchanged and still frozen.
|
|
409
|
+
* What a package-level invariant walk found wrong.
|
|
345
410
|
*
|
|
346
|
-
*
|
|
347
|
-
*
|
|
348
|
-
* primitive, which is the difference between a paste that is linear and one that is
|
|
349
|
-
* quadratic in document size.
|
|
411
|
+
* Package invariants are cross-PART: a relationship pointing at a part that does not exist, or a
|
|
412
|
+
* part no content-type record covers. Neither is visible from inside a single part's tree.
|
|
350
413
|
*/
|
|
351
|
-
|
|
352
|
-
/**
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
414
|
+
type PackageInvariantCode = 'dangling-relationship' | 'missing-content-type'
|
|
415
|
+
/** A part occupies a name OPC reserves for package infrastructure. */
|
|
416
|
+
| 'reserved-part-name'
|
|
417
|
+
/** Two parts whose names differ only by case, which OPC treats as one part. */
|
|
418
|
+
| 'duplicate-part-name'
|
|
419
|
+
/** A part name the OPC screens refuse; `writeZip` would throw on save. */
|
|
420
|
+
| 'unsafe-part-name';
|
|
421
|
+
/** One package invariant violation, located by part name and relationship id. */
|
|
422
|
+
interface PackageInvariantIssue {
|
|
423
|
+
readonly code: PackageInvariantCode;
|
|
424
|
+
/** The part the issue is about: the missing target, or the part with no type. */
|
|
425
|
+
readonly partName: string;
|
|
426
|
+
/** For a dangling relationship, the owner that points at nothing. */
|
|
427
|
+
readonly ownerPart?: string;
|
|
428
|
+
}
|
|
429
|
+
/** Whether a package satisfies its cross-part invariants, listing every violation otherwise. */
|
|
430
|
+
type PackageInvariantResult = {
|
|
431
|
+
readonly ok: true;
|
|
432
|
+
} | {
|
|
433
|
+
readonly ok: false;
|
|
434
|
+
readonly issues: readonly PackageInvariantIssue[];
|
|
435
|
+
};
|
|
436
|
+
/** Relationship records owned by one part, in authored order. */
|
|
437
|
+
declare function relationshipsOf(pkg: OoxmlPackage, ownerPart: string): readonly RelationshipRecord[];
|
|
438
|
+
/** The content type that resolves for a part name, or null when nothing declares one. */
|
|
439
|
+
declare function resolveContentTypeOf(pkg: OoxmlPackage, partName: string): string | null;
|
|
440
|
+
/** The `.rels` part that owns a part's relationships, by OPC convention. */
|
|
441
|
+
declare function relsPartNameFor(partName: string): string;
|
|
442
|
+
/**
|
|
443
|
+
* Declare a content type for a part, by upserting an `<Override>` in the content-types tree.
|
|
444
|
+
*
|
|
445
|
+
* A no-op when the part already resolves to the same type, so repeating a write does not append
|
|
446
|
+
* a duplicate entry. Resolving to a DIFFERENT type replaces the existing Override in place.
|
|
447
|
+
* `forceOverride` writes an explicit Override even when a Default already matches.
|
|
360
448
|
*/
|
|
361
|
-
declare
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
449
|
+
declare function withContentTypeOverride(pkg: OoxmlPackage, partName: string, contentType: string, options?: {
|
|
450
|
+
readonly forceOverride?: boolean;
|
|
451
|
+
}): OoxmlPackage;
|
|
452
|
+
/** What {@link withoutPart} answers: `ok: false` leaves the package exactly as it was. */
|
|
453
|
+
interface WithoutPartResult {
|
|
454
|
+
readonly pkg: OoxmlPackage;
|
|
455
|
+
readonly ok: boolean;
|
|
456
|
+
}
|
|
457
|
+
/** Add or replace one relationship on a part, returning a new package. */
|
|
458
|
+
declare function withRelationship(pkg: OoxmlPackage, ownerPart: string, type: string, rawTarget: string): {
|
|
459
|
+
readonly pkg: OoxmlPackage;
|
|
460
|
+
readonly relationshipId: string;
|
|
461
|
+
readonly ok: boolean;
|
|
462
|
+
};
|
|
365
463
|
/**
|
|
366
|
-
*
|
|
464
|
+
* Add a part that does not exist yet, with the content-type override it needs to be openable.
|
|
367
465
|
*
|
|
368
|
-
*
|
|
369
|
-
*
|
|
466
|
+
* Deliberately does NOT create a relationship: a part is reachable because something points at
|
|
467
|
+
* it, and which part points at it is the caller's decision. Creating one here would guess.
|
|
370
468
|
*/
|
|
371
|
-
declare function
|
|
469
|
+
declare function withNewPart(pkg: OoxmlPackage, partName: string, root: OoxmlElement, contentType: string): OoxmlPackage;
|
|
372
470
|
/**
|
|
373
|
-
*
|
|
471
|
+
* The two invariants a package must satisfy before it is published.
|
|
374
472
|
*
|
|
375
|
-
*
|
|
376
|
-
*
|
|
473
|
+
* Both describe the half-written state that splitting a multi-part write across transactions
|
|
474
|
+
* produces, and both make a package Word refuses to open:
|
|
475
|
+
*
|
|
476
|
+
* - a relationship pointing at a part nobody created;
|
|
477
|
+
* - a part with no content type, which is unopenable even though the XML is well formed.
|
|
478
|
+
*
|
|
479
|
+
* Checked at the commit boundary rather than inside each primitive, for the same reason part
|
|
480
|
+
* validation moved there: a transaction is allowed to pass through an inconsistent intermediate
|
|
481
|
+
* as long as nothing can observe it.
|
|
377
482
|
*/
|
|
378
|
-
declare function
|
|
379
|
-
/** A validated (kind, id, version) triple — the registry's unit of identity. */
|
|
380
|
-
interface CapabilityId {
|
|
381
|
-
readonly kind: IdKind;
|
|
382
|
-
readonly id: string;
|
|
383
|
-
readonly version: string;
|
|
384
|
-
}
|
|
483
|
+
declare function validatePackageInvariants(pkg: OoxmlPackage): PackageInvariantResult;
|
|
385
484
|
|
|
386
|
-
/** A parsed semantic version. Only the three numeric components — no pre-release or build. */
|
|
387
|
-
interface SemVer {
|
|
388
|
-
readonly major: number;
|
|
389
|
-
readonly minor: number;
|
|
390
|
-
readonly patch: number;
|
|
391
|
-
}
|
|
392
485
|
/**
|
|
393
|
-
*
|
|
486
|
+
* Whether a string is a valid XML NCName in the strict ASCII profile — a name with no colon.
|
|
394
487
|
*
|
|
395
|
-
*
|
|
396
|
-
*
|
|
488
|
+
* This is the rule for names the engine itself writes or accepts from a caller. Names read
|
|
489
|
+
* from a document use {@link isXmlNCName}, which admits every XML 1.0 name.
|
|
397
490
|
*/
|
|
398
|
-
declare function
|
|
399
|
-
/**
|
|
400
|
-
declare function
|
|
491
|
+
declare function isValidNCName(name: string): boolean;
|
|
492
|
+
/** A QName is an optional `prefix:` (both NCNames) — never attacker-derived. */
|
|
493
|
+
declare function isValidQName(name: string): boolean;
|
|
401
494
|
/**
|
|
402
|
-
*
|
|
403
|
-
*
|
|
404
|
-
*
|
|
405
|
-
*
|
|
406
|
-
* - `>=1.2.3 <2.0.0` a single lower (inclusive) + upper (exclusive) bound pair
|
|
407
|
-
* Any other shape throws — an unparseable range is a registration error, not a pass.
|
|
495
|
+
* Validate a qualified name, throwing when it is malformed.
|
|
496
|
+
*
|
|
497
|
+
* Guards the serializer: an invalid QName written into XML produces a file Word cannot open, so
|
|
498
|
+
* it fails here rather than at save.
|
|
408
499
|
*/
|
|
409
|
-
declare function
|
|
410
|
-
|
|
500
|
+
declare function assertValidQName(name: string): void;
|
|
411
501
|
/**
|
|
412
|
-
*
|
|
413
|
-
*
|
|
414
|
-
*
|
|
415
|
-
* unsatisfied version range, a duplicate contribution with no replacement policy.
|
|
502
|
+
* Controlled namespace-prefix allocation: deterministic, collision-free prefixes
|
|
503
|
+
* for namespace URIs. A known URI always yields the same registered prefix; new
|
|
504
|
+
* URIs get a generated `ns{n}` prefix, never one derived from file content.
|
|
416
505
|
*/
|
|
417
|
-
|
|
506
|
+
declare class PrefixAllocator {
|
|
507
|
+
private readonly byUri;
|
|
508
|
+
private readonly usedPrefixes;
|
|
509
|
+
private counter;
|
|
510
|
+
constructor(known?: Readonly<Record<string, string>>);
|
|
511
|
+
prefixFor(namespaceUri: string): string;
|
|
512
|
+
/** The declared bindings, for emitting xmlns declarations. */
|
|
513
|
+
bindings(): {
|
|
514
|
+
prefix: string;
|
|
515
|
+
uri: string;
|
|
516
|
+
}[];
|
|
517
|
+
}
|
|
518
|
+
|
|
418
519
|
/**
|
|
419
|
-
* A
|
|
520
|
+
* A hyperlink target projected for a RUNTIME sink, or the reason it was withheld.
|
|
420
521
|
*
|
|
421
|
-
*
|
|
422
|
-
*
|
|
423
|
-
*
|
|
522
|
+
* The authored target stays authored — the record layer keeps it verbatim and escapes it into
|
|
523
|
+
* owned OOXML, which is not a runtime sink. Only this allowlist-sanitized projection reaches DOM,
|
|
524
|
+
* CSS, navigation or fetch, so `javascript:`, `data:` and `vbscript:` never leave the boundary.
|
|
424
525
|
*/
|
|
425
|
-
|
|
426
|
-
readonly
|
|
427
|
-
|
|
428
|
-
readonly responsible: readonly string[];
|
|
429
|
-
constructor(code: RegistryErrorCode, message: string,
|
|
430
|
-
/** Stable identities responsible for the failure (extensions, ids). */
|
|
431
|
-
responsible?: readonly string[]);
|
|
432
|
-
}
|
|
433
|
-
/** How a base contribution permits replacement by other bundles. */
|
|
434
|
-
type ReplacementPolicy = {
|
|
435
|
-
readonly kind: 'none';
|
|
436
|
-
} | {
|
|
437
|
-
readonly kind: 'single';
|
|
526
|
+
type HrefProjection = {
|
|
527
|
+
readonly ok: true;
|
|
528
|
+
readonly href: string;
|
|
438
529
|
} | {
|
|
439
|
-
readonly
|
|
530
|
+
readonly ok: false;
|
|
531
|
+
readonly inert: true;
|
|
440
532
|
};
|
|
441
|
-
/** One thing a bundle contributes: a command, a query, a schema, a port, keyed by `(kind, id)`. */
|
|
442
|
-
interface Contribution {
|
|
443
|
-
readonly kind: Exclude<IdKind, 'extension' | 'origin' | 'result'>;
|
|
444
|
-
readonly id: string;
|
|
445
|
-
readonly version: string;
|
|
446
|
-
/** If set, this contribution replaces an existing base contribution. */
|
|
447
|
-
readonly replaces?: {
|
|
448
|
-
readonly targetId: string;
|
|
449
|
-
readonly targetRange: string;
|
|
450
|
-
readonly priority?: number;
|
|
451
|
-
};
|
|
452
|
-
/** Policy this contribution exposes to would-be replacers (default `none`). */
|
|
453
|
-
readonly replaceable?: ReplacementPolicy;
|
|
454
|
-
readonly payload?: unknown;
|
|
455
|
-
}
|
|
456
533
|
/**
|
|
457
|
-
*
|
|
458
|
-
* and
|
|
534
|
+
* Project a file-derived URL for a DOM/navigation sink. Strips embedded
|
|
535
|
+
* tab/LF/CR (used to smuggle `java\nscript:`), allows relative URLs and the
|
|
536
|
+
* scheme allowlist, and renders everything else inert. Never fetches.
|
|
537
|
+
*/
|
|
538
|
+
declare function sanitizeHref(raw: string): HrefProjection;
|
|
539
|
+
/** XML-escape a value for validated serialization back into owned OOXML. */
|
|
540
|
+
declare function escapeXml(value: string): string;
|
|
541
|
+
/**
|
|
542
|
+
* CSS string-escape a file-derived value (e.g. an `@font-face` family name or an
|
|
543
|
+
* inline style value). Emits `\<hex> ` escapes for quotes, backslash, and
|
|
544
|
+
* controls so the value cannot break out of its CSS string.
|
|
545
|
+
*/
|
|
546
|
+
declare function escapeCssString(value: string): string;
|
|
547
|
+
/** Whether a file-derived CSS fragment contains a `url()` or `@import` (must be rejected). */
|
|
548
|
+
declare function containsCssFetch(value: string): boolean;
|
|
549
|
+
/**
|
|
550
|
+
* Content that must never execute or auto-resolve: OLE objects, macros, DDE and `INCLUDE*` field
|
|
551
|
+
* instructions.
|
|
459
552
|
*
|
|
460
|
-
*
|
|
461
|
-
*
|
|
553
|
+
* Rendered INERT by default rather than stripped — removing it would be a lossless-preservation
|
|
554
|
+
* failure, so it is carried and never acted on.
|
|
462
555
|
*/
|
|
463
|
-
|
|
556
|
+
declare const INERT_EXECUTABLE_KINDS: readonly ['field-dde', 'field-include', 'macro', 'activex', 'ole', 'embedded-object', 'executable-relationship'];
|
|
557
|
+
/** One of {@link INERT_EXECUTABLE_KINDS}. */
|
|
558
|
+
/** One of {@link INERT_EXECUTABLE_KINDS} — content carried but never executed. */
|
|
559
|
+
type InertExecutableKind = (typeof INERT_EXECUTABLE_KINDS)[number];
|
|
560
|
+
/** Whether a content kind is one this engine refuses to execute or auto-resolve. */
|
|
561
|
+
declare function isInertExecutable(kind: string): boolean;
|
|
562
|
+
/** Whether a field instruction's leading keyword is safe to evaluate. */
|
|
563
|
+
declare function isEvaluableField(instruction: string): boolean;
|
|
564
|
+
/** One item a scrub pass considers: its kind, and where in the package it sits. */
|
|
565
|
+
interface ContentItem {
|
|
464
566
|
readonly id: string;
|
|
465
|
-
readonly
|
|
466
|
-
readonly dependencies?: readonly string[];
|
|
467
|
-
readonly conflicts?: readonly string[];
|
|
468
|
-
readonly requiredPorts?: readonly string[];
|
|
469
|
-
readonly contributions: readonly Contribution[];
|
|
470
|
-
}
|
|
471
|
-
/** The resolved result: every contribution selected, indexed by `(kind, id)`. */
|
|
472
|
-
interface ResolvedRegistry {
|
|
473
|
-
readonly extensions: ReadonlyMap<string, FeatureBundle>;
|
|
474
|
-
readonly contributions: ReadonlyMap<string, Contribution>;
|
|
475
|
-
get(kind: Contribution['kind'], id: string): Contribution | undefined;
|
|
476
|
-
}
|
|
477
|
-
/** How resolution treats optional bundles and replacement policies. */
|
|
478
|
-
interface ResolveOptions {
|
|
479
|
-
/** Runtime port ids available in this environment (design D9 / task 0.3). */
|
|
480
|
-
readonly availablePorts?: readonly string[];
|
|
567
|
+
readonly kind: string;
|
|
481
568
|
}
|
|
482
569
|
/**
|
|
483
|
-
*
|
|
484
|
-
*
|
|
485
|
-
* Deterministic and registration-order independent: selection is by `(kind, id)` plus version,
|
|
486
|
-
* and ties break only on declared policy. Array order never decides anything.
|
|
570
|
+
* What an explicit scrub removed.
|
|
487
571
|
*
|
|
488
|
-
*
|
|
572
|
+
* A scrub DECLARES ITSELF non-lossless: removing executable content changes the file, which is a
|
|
573
|
+
* choice a caller makes deliberately rather than a default the engine applies.
|
|
489
574
|
*/
|
|
490
|
-
|
|
575
|
+
interface ScrubResult {
|
|
576
|
+
readonly kept: readonly ContentItem[];
|
|
577
|
+
readonly removed: readonly ContentItem[];
|
|
578
|
+
/** A scrub that removes anything is non-lossless by definition. */
|
|
579
|
+
readonly nonLossless: boolean;
|
|
580
|
+
}
|
|
581
|
+
/** Explicit scrub export: remove inert executable classes, report removals. */
|
|
582
|
+
declare function scrubExport(items: readonly ContentItem[]): ScrubResult;
|
|
491
583
|
|
|
584
|
+
/** True for an `m:oMathPara` display equation. */
|
|
585
|
+
declare function isOmmlDisplay(node: OoxmlNode): node is OoxmlGenericElementNode;
|
|
586
|
+
/** True for a paragraph-level equation atom: `m:oMath` or `m:oMathPara`. */
|
|
587
|
+
declare function isOmmlEquationAtom(node: OoxmlNode): node is OoxmlGenericElementNode;
|
|
588
|
+
/** The `m:oMath` equations of a display, or the equation itself for an inline `m:oMath`. */
|
|
589
|
+
declare function equationsOfAtom(node: OoxmlNode): readonly OoxmlGenericElementNode[];
|
|
492
590
|
/**
|
|
493
|
-
*
|
|
494
|
-
*
|
|
495
|
-
*
|
|
496
|
-
*/
|
|
497
|
-
declare
|
|
498
|
-
readonly mutationHuman: "dev.docx-editor.core.origin.mutation.human";
|
|
499
|
-
readonly mutationAgent: "dev.docx-editor.core.origin.mutation.agent";
|
|
500
|
-
readonly mutationRemote: "dev.docx-editor.core.origin.mutation.remote";
|
|
501
|
-
readonly mutationUndo: "dev.docx-editor.core.origin.mutation.undo";
|
|
502
|
-
readonly mutationRedo: "dev.docx-editor.core.origin.mutation.redo";
|
|
503
|
-
readonly mutationMigration: "dev.docx-editor.core.origin.mutation.migration";
|
|
504
|
-
readonly mutationRepair: "dev.docx-editor.core.origin.mutation.repair";
|
|
505
|
-
readonly mutationServer: "dev.docx-editor.core.origin.mutation.server";
|
|
506
|
-
readonly projection: "dev.docx-editor.core.origin.projection";
|
|
507
|
-
readonly awareness: "dev.docx-editor.core.origin.awareness";
|
|
508
|
-
};
|
|
509
|
-
/** Canonical writes carry a mutation origin; these are the undoable-eligibility inputs. */
|
|
510
|
-
declare const CANONICAL_MUTATION_ORIGINS: readonly string[];
|
|
511
|
-
/** Origins that never enter authored state / history / audit / snapshot / replication. */
|
|
512
|
-
declare const NON_CANONICAL_ORIGINS: readonly string[];
|
|
591
|
+
* Project a display equation as one layout atom. A display with one equation keeps that
|
|
592
|
+
* equation's projection, so the painted atom names the editable `m:oMath`. Several equations
|
|
593
|
+
* share one row, separated by an em space.
|
|
594
|
+
*/
|
|
595
|
+
declare function projectOmmlDisplay(node: OoxmlNode): OmmlEquationProjection | null;
|
|
513
596
|
/**
|
|
514
|
-
*
|
|
515
|
-
*
|
|
597
|
+
* The physical justification of a paragraph whose only visible content is display math.
|
|
598
|
+
* `m:oMathParaPr/m:jc` sets it; the default `centerGroup` centers the display. Returns null
|
|
599
|
+
* when the paragraph also holds text or other content, which keeps the paragraph `w:jc`.
|
|
516
600
|
*/
|
|
517
|
-
declare
|
|
518
|
-
readonly
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
/**
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
readonly audit: "dev.docx-editor.core.port.audit";
|
|
536
|
-
readonly authorization: "dev.docx-editor.core.port.authorization";
|
|
537
|
-
readonly resourceAccounting: "dev.docx-editor.core.port.resource-accounting";
|
|
538
|
-
readonly cancellation: "dev.docx-editor.core.port.cancellation";
|
|
539
|
-
readonly externalResourceConsent: "dev.docx-editor.core.port.external-resource-consent";
|
|
540
|
-
};
|
|
541
|
-
/** Layout dependency keys (design D6 / task 8.2). */
|
|
542
|
-
declare const DEPENDENCY_KEY_IDS: {
|
|
543
|
-
readonly style: "dev.docx-editor.core.dep.style";
|
|
544
|
-
readonly numbering: "dev.docx-editor.core.dep.numbering";
|
|
545
|
-
readonly section: "dev.docx-editor.core.dep.section";
|
|
546
|
-
readonly story: "dev.docx-editor.core.dep.story";
|
|
547
|
-
readonly font: "dev.docx-editor.core.dep.font";
|
|
548
|
-
readonly image: "dev.docx-editor.core.dep.image";
|
|
549
|
-
readonly table: "dev.docx-editor.core.dep.table";
|
|
550
|
-
readonly field: "dev.docx-editor.core.dep.field";
|
|
551
|
-
readonly note: "dev.docx-editor.core.dep.note";
|
|
552
|
-
readonly headerFooter: "dev.docx-editor.core.dep.header-footer";
|
|
553
|
-
readonly annotation: "dev.docx-editor.core.dep.annotation";
|
|
554
|
-
};
|
|
555
|
-
/** Every frozen id as a flat list, for the immutability / uniqueness gate. */
|
|
556
|
-
declare const ALL_FROZEN_IDS: readonly string[];
|
|
601
|
+
declare function displayMathAlignment(paragraph: {
|
|
602
|
+
readonly children: readonly OoxmlNode[];
|
|
603
|
+
}): 'left' | 'center' | 'right' | null;
|
|
604
|
+
/** Project a paragraph-level equation atom: inline `m:oMath` or display `m:oMathPara`. */
|
|
605
|
+
declare function projectOmmlAtom(node: OoxmlNode): OmmlEquationProjection | null;
|
|
606
|
+
|
|
607
|
+
/** UTF-16 placeholder for a page break in paragraph text projections. */
|
|
608
|
+
declare const PAGE_BREAK_CHAR = "\f";
|
|
609
|
+
/** What a `w:br` breaks. `other` covers values this engine does not model, kept losslessly. */
|
|
610
|
+
type HardBreakKind = 'line' | 'page' | 'column' | 'other';
|
|
611
|
+
/** Read the semantic break kind from a typed `w:br` node. */
|
|
612
|
+
declare function hardBreakKind(node: OoxmlHardBreakNode): HardBreakKind;
|
|
613
|
+
/** Whether a node is a `w:br` with `w:type="page"`. */
|
|
614
|
+
declare function isPageBreakNode(node: OoxmlNode): node is OoxmlHardBreakNode;
|
|
615
|
+
/** Text projection for a `w:br` node — one UTF-16 code unit per break. */
|
|
616
|
+
declare function hardBreakText(node: OoxmlHardBreakNode): string;
|
|
617
|
+
/** Attributes for a newly authored `w:br`. */
|
|
618
|
+
declare function hardBreakAttributes(kind: 'line' | 'page'): OoxmlHardBreakNode['attributes'];
|
|
557
619
|
|
|
620
|
+
/** Parsed TOC instruction. Unknown switches are ignored for generation but left on the wire. */
|
|
621
|
+
interface TocInstruction {
|
|
622
|
+
readonly keyword: 'TOC';
|
|
623
|
+
/** Include hyperlinks (`\\h`). */
|
|
624
|
+
readonly hyperlink: boolean;
|
|
625
|
+
/** Omit page numbers (`\\n`). */
|
|
626
|
+
readonly omitPageNumbers: boolean;
|
|
627
|
+
/** Inclusive 1-based outline levels from `\\o "n-m"`. Defaults 1–9. */
|
|
628
|
+
readonly outlineStart: number;
|
|
629
|
+
readonly outlineEnd: number;
|
|
630
|
+
readonly raw: string;
|
|
631
|
+
}
|
|
632
|
+
/** Longest TOC field instruction read. Instructions come from a file; the parse is bounded. */
|
|
633
|
+
declare const TOC_MAX_INSTRUCTION_CHARS = 256;
|
|
634
|
+
/** Most entries one generated table of contents may hold. */
|
|
635
|
+
declare const TOC_MAX_ENTRIES = 512;
|
|
636
|
+
/** Most bookmarks minted during one TOC refresh. */
|
|
637
|
+
declare const TOC_MAX_BOOKMARKS_PER_REFRESH = 512;
|
|
638
|
+
/** Deepest nested field instruction followed. Caps recursion on file-supplied structure. */
|
|
639
|
+
declare const TOC_MAX_FIELD_NESTING = 4;
|
|
558
640
|
/**
|
|
559
|
-
*
|
|
641
|
+
* Most layout passes a TOC refresh runs before settling.
|
|
560
642
|
*
|
|
561
|
-
*
|
|
562
|
-
*
|
|
643
|
+
* Page numbers change the TOC's own height, which changes page numbers — bounded so a
|
|
644
|
+
* non-converging document stops rather than looping.
|
|
563
645
|
*/
|
|
564
|
-
declare
|
|
565
|
-
readonly label: string;
|
|
566
|
-
readonly limit: number;
|
|
567
|
-
readonly attempted: number;
|
|
568
|
-
constructor(label: string, limit: number, attempted: number);
|
|
569
|
-
}
|
|
646
|
+
declare const TOC_MAX_PAGE_PASSES = 3;
|
|
570
647
|
/**
|
|
571
|
-
*
|
|
648
|
+
* Parse a TOC field instruction string.
|
|
572
649
|
*
|
|
573
|
-
*
|
|
574
|
-
*
|
|
575
|
-
* count must never be trusted into an allocation, and a wrapped counter reads as small.
|
|
650
|
+
* Returns null when the leading keyword is not TOC, the string is over-long, or the
|
|
651
|
+
* outline range is hostile. Does not evaluate or fetch anything.
|
|
576
652
|
*/
|
|
577
|
-
declare
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
/** Whether adding `n` would be accepted, without mutating. */
|
|
592
|
-
canAdd(n?: number): boolean;
|
|
593
|
-
release(n: number): void;
|
|
653
|
+
declare function parseTocInstruction(raw: string): TocInstruction | null;
|
|
654
|
+
|
|
655
|
+
/** A table of contents found in a document, whether wrapped in an SDT or a bare field. */
|
|
656
|
+
interface DetectedToc {
|
|
657
|
+
/** Enclosing control id when it identifies one TOC, otherwise the begin fldChar id. */
|
|
658
|
+
readonly id: string;
|
|
659
|
+
readonly beginNodeId: string;
|
|
660
|
+
readonly beginParagraphId: string;
|
|
661
|
+
readonly endParagraphId: string;
|
|
662
|
+
readonly resultParagraphIds: readonly string[];
|
|
663
|
+
/** Direct parent whose paragraph children delimit the cached result. */
|
|
664
|
+
readonly containerId: string;
|
|
665
|
+
readonly contentControlId?: string;
|
|
666
|
+
readonly instruction: TocInstruction;
|
|
594
667
|
}
|
|
668
|
+
/** Discover refreshable body TOCs without evaluating any field instruction. */
|
|
669
|
+
declare function detectBodyTocs(part: OoxmlPart): readonly DetectedToc[];
|
|
670
|
+
/** Locate the table of contents containing a position, or null. */
|
|
671
|
+
declare function findDetectedToc(tocs: readonly DetectedToc[], tocId: string): DetectedToc | null;
|
|
595
672
|
|
|
596
|
-
/**
|
|
597
|
-
|
|
598
|
-
|
|
673
|
+
/** One heading symbol: its `w:font` and `w:char`, as the file wrote them. */
|
|
674
|
+
interface TocSymbol {
|
|
675
|
+
readonly font: string | null;
|
|
676
|
+
readonly char: string;
|
|
599
677
|
}
|
|
678
|
+
|
|
679
|
+
declare const TWIPS: unique symbol;
|
|
680
|
+
declare const POINTS: unique symbol;
|
|
600
681
|
/**
|
|
601
|
-
*
|
|
682
|
+
* A length in twentieths of a point — OOXML's `ST_TwipsMeasure` / `ST_SignedTwipsMeasure`.
|
|
602
683
|
*
|
|
603
|
-
*
|
|
604
|
-
*
|
|
684
|
+
* The brand is intersection-typed onto `number`, so a `Twips` value still decays to `number`
|
|
685
|
+
* wherever arithmetic consumes it; only the reverse direction — passing a raw number where
|
|
686
|
+
* `Twips` is declared — is refused.
|
|
687
|
+
*
|
|
688
|
+
* @public
|
|
605
689
|
*/
|
|
606
|
-
|
|
607
|
-
readonly
|
|
608
|
-
|
|
609
|
-
release(): void;
|
|
610
|
-
}
|
|
690
|
+
type Twips = number & {
|
|
691
|
+
readonly [TWIPS]: true;
|
|
692
|
+
};
|
|
611
693
|
/**
|
|
612
|
-
*
|
|
694
|
+
* A length in typographic points, the unit layout and paint compute in.
|
|
613
695
|
*
|
|
614
|
-
*
|
|
615
|
-
|
|
696
|
+
* @public
|
|
697
|
+
*/
|
|
698
|
+
type Points = number & {
|
|
699
|
+
readonly [POINTS]: true;
|
|
700
|
+
};
|
|
701
|
+
/**
|
|
702
|
+
* Twentieths of a point per point.
|
|
616
703
|
*
|
|
617
|
-
*
|
|
618
|
-
* cleanups LIFO — spill files, worker termination — even if one throws. A leaked child budget is a
|
|
619
|
-
* leaked worker, so the refusal is the diagnostic.
|
|
704
|
+
* @public
|
|
620
705
|
*/
|
|
621
|
-
declare
|
|
622
|
-
readonly label: string;
|
|
623
|
-
readonly capacity: number;
|
|
624
|
-
private readonly used;
|
|
625
|
-
private readonly children;
|
|
626
|
-
private activeReservations;
|
|
627
|
-
private readonly cleanups;
|
|
628
|
-
private disposed;
|
|
629
|
-
private carveAmount;
|
|
630
|
-
private parent?;
|
|
631
|
-
constructor(label: string, capacity: number);
|
|
632
|
-
get inUse(): number;
|
|
633
|
-
get available(): number;
|
|
634
|
-
get isDisposed(): boolean;
|
|
635
|
-
/** Reserve `amount` from this budget. Throws if it would exceed capacity. */
|
|
636
|
-
reserve(amount: number): Reservation;
|
|
637
|
-
/** Carve a child budget of `capacity` out of this budget's headroom. */
|
|
638
|
-
child(label: string, capacity: number): Budget;
|
|
639
|
-
/** Register cleanup for a spill file, worker, or queue tied to this budget. */
|
|
640
|
-
onRelease(cleanup: () => void): void;
|
|
641
|
-
/**
|
|
642
|
-
* Release this budget. Refuses while any child budget or reservation is
|
|
643
|
-
* outstanding (children must finish first). Runs cleanups LIFO, returns the
|
|
644
|
-
* carve-out to the parent, and marks disposed. Cleanup errors are collected and
|
|
645
|
-
* rethrown after every cleanup has run.
|
|
646
|
-
*/
|
|
647
|
-
dispose(): void;
|
|
648
|
-
private assertLive;
|
|
649
|
-
}
|
|
650
|
-
|
|
706
|
+
declare const TWIPS_PER_POINT = 20;
|
|
651
707
|
/**
|
|
652
|
-
*
|
|
708
|
+
* Assert that a number is a twips measurement.
|
|
653
709
|
*
|
|
654
|
-
*
|
|
655
|
-
*
|
|
656
|
-
*
|
|
710
|
+
* A compile-time cast, not a validator: bounds, integrality and finiteness stay at the parse
|
|
711
|
+
* boundary that produced the number, exactly where they are enforced today. The cast is the
|
|
712
|
+
* caller's claim about the UNIT, nothing more.
|
|
713
|
+
*
|
|
714
|
+
* @public
|
|
657
715
|
*/
|
|
658
|
-
|
|
659
|
-
/** Thrown from a `checkpoint()` when the operation has been cancelled. */
|
|
660
|
-
declare class CancellationError extends Error {
|
|
661
|
-
/** True when the commit is already published and only derived work is cancelled. */
|
|
662
|
-
readonly derivedOnly: boolean;
|
|
663
|
-
constructor(
|
|
664
|
-
/** True when the commit is already published and only derived work is cancelled. */
|
|
665
|
-
derivedOnly: boolean, reason?: string);
|
|
666
|
-
}
|
|
716
|
+
declare const twips: (value: number) => Twips;
|
|
667
717
|
/**
|
|
668
|
-
*
|
|
718
|
+
* Assert that a number is a points measurement. A compile-time cast; see {@link twips}.
|
|
669
719
|
*
|
|
670
|
-
*
|
|
671
|
-
* is what lets an operation unwind promptly without the engine having to interrupt it mid-mutation.
|
|
720
|
+
* @public
|
|
672
721
|
*/
|
|
673
|
-
|
|
674
|
-
readonly isCancelled: boolean;
|
|
675
|
-
readonly phase: CancellationPhase;
|
|
676
|
-
/** True only when cancelled AND the commit is already published. */
|
|
677
|
-
readonly derivedOnly: boolean;
|
|
678
|
-
/** Throws CancellationError if cancelled; call at declared checkpoint intervals. */
|
|
679
|
-
checkpoint(): void;
|
|
680
|
-
}
|
|
722
|
+
declare const points: (value: number) => Points;
|
|
681
723
|
/**
|
|
682
|
-
* The
|
|
724
|
+
* The one twips-to-points conversion. Exact division; twips are the finer unit.
|
|
683
725
|
*
|
|
684
|
-
*
|
|
726
|
+
* @public
|
|
685
727
|
*/
|
|
686
|
-
declare
|
|
687
|
-
private _cancelled;
|
|
688
|
-
private _phase;
|
|
689
|
-
private _reason?;
|
|
690
|
-
cancel(reason?: string): void;
|
|
691
|
-
/** Mark canonical publication — the point of no return. */
|
|
692
|
-
markPublished(): void;
|
|
693
|
-
get isCancelled(): boolean;
|
|
694
|
-
get phase(): CancellationPhase;
|
|
695
|
-
get isPublished(): boolean;
|
|
696
|
-
/** Cancelled after publication -> full rollback is no longer possible. */
|
|
697
|
-
get derivedOnly(): boolean;
|
|
698
|
-
get token(): CancellationToken;
|
|
699
|
-
}
|
|
700
|
-
|
|
701
|
-
/** Injectable time source — the engine never calls Date.now directly (determinism). */
|
|
702
|
-
interface ClockPort {
|
|
703
|
-
now(): number;
|
|
704
|
-
}
|
|
705
|
-
/** Stable id minting for sessions, commits, and allocator seeds. */
|
|
706
|
-
interface IdentityPort {
|
|
707
|
-
newId(): string;
|
|
708
|
-
}
|
|
709
|
-
/** Cooperative scheduling of deferred work. */
|
|
710
|
-
interface SchedulingPort {
|
|
711
|
-
schedule(task: () => void): void;
|
|
712
|
-
}
|
|
713
|
-
/** Redacted observability sink (raw text never enters here — design D5). */
|
|
714
|
-
interface AuditPort {
|
|
715
|
-
record(entry: {
|
|
716
|
-
readonly kind: string;
|
|
717
|
-
readonly at: number;
|
|
718
|
-
readonly meta?: Record<string, unknown>;
|
|
719
|
-
}): void;
|
|
720
|
-
}
|
|
721
|
-
/** Read/write/export authorization decisions. */
|
|
722
|
-
interface AuthorizationPort {
|
|
723
|
-
authorize(action: string, subject?: string): boolean;
|
|
724
|
-
}
|
|
725
|
-
/** Explicit consent gate for any remote/external resource (no zero-click fetch). */
|
|
726
|
-
interface ExternalResourceConsentPort {
|
|
727
|
-
requestConsent(target: string): boolean;
|
|
728
|
-
}
|
|
729
|
-
/** Cancellation source for the current operation. */
|
|
730
|
-
interface CancellationPort {
|
|
731
|
-
readonly token: CancellationToken;
|
|
732
|
-
}
|
|
733
|
-
/** Where documents are stored and retrieved. Opaque marker until its milestone. */
|
|
734
|
-
interface PersistencePort {
|
|
735
|
-
readonly kind: 'persistence';
|
|
736
|
-
}
|
|
737
|
-
/** How the engine talks to a remote peer. Opaque marker until its milestone. */
|
|
738
|
-
interface TransportPort {
|
|
739
|
-
readonly kind: 'transport';
|
|
740
|
-
}
|
|
741
|
-
/** Where font bytes come from. Opaque marker until its milestone. */
|
|
742
|
-
interface FontPort {
|
|
743
|
-
readonly kind: 'font';
|
|
744
|
-
}
|
|
745
|
-
/** Which shaping backend measures text. Opaque marker until its milestone. */
|
|
746
|
-
interface ShapingPort {
|
|
747
|
-
readonly kind: 'shaping';
|
|
748
|
-
}
|
|
749
|
-
/** How image bytes are decoded. Opaque marker until its milestone. */
|
|
750
|
-
interface ImagePort {
|
|
751
|
-
readonly kind: 'image';
|
|
752
|
-
}
|
|
753
|
-
/** Where resource consumption is reported. Opaque marker until its milestone. */
|
|
754
|
-
interface ResourceAccountingPort {
|
|
755
|
-
readonly kind: 'resource-accounting';
|
|
756
|
-
}
|
|
728
|
+
declare const twipsToPoints: (value: Twips) => Points;
|
|
757
729
|
/**
|
|
758
|
-
*
|
|
730
|
+
* The one points-to-twips conversion.
|
|
759
731
|
*
|
|
760
|
-
*
|
|
761
|
-
*
|
|
732
|
+
* Rounds to the nearest twip: every OOXML twips measurement is integral, and emitting a
|
|
733
|
+
* fractional twip would write a value no consumer of the file can represent.
|
|
734
|
+
*
|
|
735
|
+
* @public
|
|
762
736
|
*/
|
|
763
|
-
declare
|
|
764
|
-
readonly portId: string;
|
|
765
|
-
constructor(portId: string);
|
|
766
|
-
}
|
|
737
|
+
declare const pointsToTwips: (value: Points) => Twips;
|
|
767
738
|
/**
|
|
768
|
-
*
|
|
739
|
+
* Read a twips attribute (`ST_TwipsMeasure`, `ST_SignedTwipsMeasure`, or a `dxa` table width)
|
|
740
|
+
* as a whole, signed number of twips, or `null` when the value is not a measurement.
|
|
769
741
|
*
|
|
770
|
-
*
|
|
771
|
-
*
|
|
772
|
-
*
|
|
742
|
+
* The schema allows an integer or a universal measure, but files also carry decimal twips
|
|
743
|
+
* (`4743.74`, `708.0`, `707.9999999999998`). The accepted forms read as follows:
|
|
744
|
+
*
|
|
745
|
+
* - A decimal truncates toward zero: `1443.74` is 1443 and `-720.6` is -720. A leading `+`,
|
|
746
|
+
* leading zeros, a bare fraction (`.5`) and a trailing point (`1440.`) are accepted.
|
|
747
|
+
* - A universal measure (`mm`, `cm`, `in`, `pt`, `pc`, `pi`) converts exactly and then
|
|
748
|
+
* truncates: `1.27cm` is 720 and `0.333in` is 479. Its sign is ignored, so `-0.5in` is 720.
|
|
749
|
+
* - Whitespace, exponents, hexadecimal, uppercase units, and an integer part longer than nine
|
|
750
|
+
* digits are not measurements.
|
|
751
|
+
*
|
|
752
|
+
* The result is NOT bounded. Callers apply their own sign rule and range clamp, because each
|
|
753
|
+
* attribute has a different valid range and a different fallback.
|
|
754
|
+
*
|
|
755
|
+
* @internal
|
|
773
756
|
*/
|
|
774
|
-
declare
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
missing(portIds: readonly string[]): string[];
|
|
782
|
-
/** The provided port ids (for bridging to registry.resolve availablePorts). */
|
|
783
|
-
availablePorts(): string[];
|
|
784
|
-
clock(): ClockPort;
|
|
785
|
-
identity(): IdentityPort;
|
|
786
|
-
}
|
|
787
|
-
/** Deterministic clock: starts at `start` and advances by `step` each call. */
|
|
788
|
-
declare class DeterministicClock implements ClockPort {
|
|
789
|
-
private readonly step;
|
|
790
|
-
private t;
|
|
791
|
-
constructor(start?: number, step?: number);
|
|
792
|
-
now(): number;
|
|
793
|
-
}
|
|
794
|
-
/** Sequential identity for tests and deterministic fixtures. */
|
|
795
|
-
declare class SequentialIdentity implements IdentityPort {
|
|
796
|
-
private readonly prefix;
|
|
797
|
-
private n;
|
|
798
|
-
constructor(prefix?: string);
|
|
799
|
-
newId(): string;
|
|
757
|
+
declare function readTwipsMeasure(raw: string | undefined): number | null;
|
|
758
|
+
|
|
759
|
+
/** Outline heading shape consumed by TOC planning (mirrors DocumentOutlineEntry). */
|
|
760
|
+
interface TocOutlineHeading {
|
|
761
|
+
readonly text: string;
|
|
762
|
+
readonly level: number;
|
|
763
|
+
readonly blockId: string;
|
|
800
764
|
}
|
|
801
765
|
|
|
802
|
-
/**
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
readonly
|
|
809
|
-
|
|
810
|
-
readonly
|
|
766
|
+
/** Left-indent step between TOC levels, in twips (matches `scripts/demo-doc/toc-block.xml`). */
|
|
767
|
+
declare const TOC_LEVEL_INDENT_TWIPS: Twips;
|
|
768
|
+
/** Bounded left-indent twips for a TOC entry level (0-based heading depth). */
|
|
769
|
+
declare function tocLeftIndentTwips(level: number): Twips;
|
|
770
|
+
/** One planned TOC entry: its level, its text, and the heading it points at. */
|
|
771
|
+
interface TocEntryPlan {
|
|
772
|
+
readonly level: number;
|
|
773
|
+
readonly text: string;
|
|
774
|
+
readonly headingParagraphId: string;
|
|
775
|
+
readonly bookmarkName: string;
|
|
776
|
+
readonly pageNumberText: string;
|
|
777
|
+
/** The heading's symbols, one per {@link TOC_SYMBOL_MARK} in `text`, in order. */
|
|
778
|
+
readonly symbols?: readonly TocSymbol[];
|
|
811
779
|
}
|
|
780
|
+
/** Build one TOC entry paragraph node. */
|
|
781
|
+
declare function buildTocEntryParagraph(mint: () => string, entry: TocEntryPlan, instruction: TocInstruction, paragraphPropertiesTemplate?: OoxmlNode): OoxmlNode;
|
|
782
|
+
/** Build an SDT-wrapped complex TOC field with an already planned cached result. */
|
|
783
|
+
declare function buildTocContentControl(mint: () => string, entries: readonly TocEntryPlan[], instruction: TocInstruction, alias: string): OoxmlNode;
|
|
812
784
|
/**
|
|
813
|
-
*
|
|
814
|
-
*
|
|
815
|
-
*
|
|
816
|
-
* IMMUTABLE for the operation's lifetime, which is what lets cache reuse and replica agreement
|
|
817
|
-
* key on it. A new operation always gets a fresh snapshot rather than observing a mutated one.
|
|
785
|
+
* Word flattens manual line/tab breaks from a heading into spaces in its TOC cache.
|
|
786
|
+
* Carrying them verbatim makes a short title wrap even when the row has ample room, and the
|
|
787
|
+
* same normalization is what lets a cached row be matched back to the heading it came from.
|
|
818
788
|
*/
|
|
819
|
-
|
|
820
|
-
readonly id: string;
|
|
821
|
-
readonly limits: ResourceLimits;
|
|
822
|
-
readonly config: Readonly<Record<string, unknown>>;
|
|
823
|
-
readonly ports: PortRegistry;
|
|
824
|
-
readonly budget: Budget;
|
|
825
|
-
readonly cancellation: CancellationController;
|
|
826
|
-
}
|
|
789
|
+
declare function tocEntryText(text: string): string;
|
|
827
790
|
/**
|
|
828
|
-
*
|
|
791
|
+
* Plan TOC entries from the outline and existing bookmarks.
|
|
829
792
|
*
|
|
830
|
-
*
|
|
831
|
-
*
|
|
793
|
+
* `actorId` is explicit because this planner runs BEFORE the store transaction, so the
|
|
794
|
+
* ambient transaction actor is not bound. Callers that already have the collaboration
|
|
795
|
+
* identity pass it here. `resolveAllocationActor` still honours a
|
|
796
|
+
* `runWithTransactionActor` wrap when the caller prefers that seam.
|
|
832
797
|
*/
|
|
833
|
-
declare function
|
|
834
|
-
|
|
835
|
-
|
|
798
|
+
declare function planTocEntries(part: OoxmlPart, outline: readonly TocOutlineHeading[], instruction: TocInstruction, pageNumberByParagraphId: ReadonlyMap<string, string>, excludeParagraphIds: ReadonlySet<string>, actorId?: string): {
|
|
799
|
+
readonly entries: readonly TocEntryPlan[];
|
|
800
|
+
readonly bookmarksToCreate: readonly {
|
|
801
|
+
paragraphId: string;
|
|
802
|
+
name: string;
|
|
803
|
+
}[];
|
|
804
|
+
};
|
|
805
|
+
/** Create bookmarkStart/End pair nodes for insertion at the start of a paragraph. */
|
|
806
|
+
declare function bookmarkPairNodes(mint: () => string, name: string, id: string): {
|
|
807
|
+
readonly start: OoxmlNode;
|
|
808
|
+
readonly end: OoxmlNode;
|
|
809
|
+
};
|
|
836
810
|
|
|
837
|
-
/** What a limit counts. Typed so a byte cap and a depth cap cannot be compared by accident. */
|
|
838
|
-
type LimitUnit = 'bytes' | 'count' | 'depth' | 'ratio' | 'passes';
|
|
839
811
|
/**
|
|
840
|
-
*
|
|
812
|
+
* The heading each cached result row stands for, aligned with `toc.resultParagraphIds`.
|
|
841
813
|
*
|
|
842
|
-
*
|
|
843
|
-
*
|
|
814
|
+
* `null` for a row that names no heading this document still has — a stale row, or the
|
|
815
|
+
* chrome/blank paragraphs a cached result can carry. Callers leave those alone rather than
|
|
816
|
+
* writing another row's number into them.
|
|
844
817
|
*/
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
818
|
+
declare function resolveTocRowHeadings(part: OoxmlPart, toc: DetectedToc, outline: readonly TocOutlineHeading[], excludeParagraphIds: ReadonlySet<string>): readonly (string | null)[];
|
|
819
|
+
|
|
820
|
+
/** One paragraph in the index: its node id, its story, and its position. */
|
|
821
|
+
interface ParagraphIndexEntry {
|
|
822
|
+
/** Canonical tree node id — the stable identity operations address. */
|
|
823
|
+
readonly nodeId: string;
|
|
824
|
+
/** Position among the story's paragraphs, in document order. */
|
|
825
|
+
readonly ordinal: number;
|
|
826
|
+
/** Concatenated text content, with tabs and breaks mapped as the model reads them. */
|
|
827
|
+
readonly text: string;
|
|
828
|
+
/** Node ids of the paragraph's runs, in order. */
|
|
829
|
+
readonly runIds: readonly string[];
|
|
850
830
|
}
|
|
851
|
-
/**
|
|
852
|
-
|
|
853
|
-
/**
|
|
854
|
-
|
|
855
|
-
/**
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
* Deterministic memory substitute. Tracks current and peak "allocated" units
|
|
859
|
-
* against a hard byte ceiling; `allocate` fails closed (LimitExceededError) past
|
|
860
|
-
* the limit. Used in place of process RSS so memory-limit tests are reproducible
|
|
861
|
-
* and cancellation/cleanup can be asserted without a real allocator.
|
|
862
|
-
*/
|
|
863
|
-
declare class DeterministicMemoryMeter {
|
|
864
|
-
private readonly counter;
|
|
865
|
-
private current;
|
|
866
|
-
private peak;
|
|
867
|
-
constructor(limitBytes: number);
|
|
868
|
-
allocate(bytes: number): void;
|
|
869
|
-
free(bytes: number): void;
|
|
870
|
-
get currentBytes(): number;
|
|
871
|
-
get peakBytes(): number;
|
|
872
|
-
/** Release everything (cancellation/cleanup path). */
|
|
873
|
-
reset(): void;
|
|
874
|
-
}
|
|
875
|
-
/** Assert the finite-default / hard-ceiling invariant holds for every limit. */
|
|
876
|
-
declare function assertLimitInvariants(): void;
|
|
877
|
-
|
|
878
|
-
/** Any JSON value. The domain canonicalization and stable hashing operate over. */
|
|
879
|
-
type Json = null | boolean | number | string | Json[] | {
|
|
880
|
-
[k: string]: Json;
|
|
881
|
-
};
|
|
882
|
-
/**
|
|
883
|
-
* Produce a canonical string for `value`, dropping any object key whose name is
|
|
884
|
-
* in `ephemera` at any depth. Numbers are emitted losslessly; -0 normalizes to 0;
|
|
885
|
-
* non-finite numbers are rejected (they must never enter a comparator input).
|
|
886
|
-
*/
|
|
887
|
-
declare function canonicalize(value: unknown, ephemera?: ReadonlySet<string>): string;
|
|
888
|
-
/** 64-bit FNV-1a over the canonical form, returned as a 16-char hex string. */
|
|
889
|
-
declare function stableHash(value: unknown, ephemera?: ReadonlySet<string>): string;
|
|
890
|
-
|
|
891
|
-
/**
|
|
892
|
-
* How one artifact class is compared.
|
|
893
|
-
*
|
|
894
|
-
* Frozen per artifact: nothing here invents a tolerance for an artifact the spec requires to
|
|
895
|
-
* match exactly.
|
|
896
|
-
*/
|
|
897
|
-
type ComparatorMode = 'canonical-exact' | 'exact' | 'tolerance' | 'sync-optimization-only';
|
|
898
|
-
/** One artifact class's comparison mode and its declared ephemera — fields excluded from equality. */
|
|
899
|
-
interface ComparatorDescriptor {
|
|
900
|
-
readonly id: string;
|
|
901
|
-
readonly mode: ComparatorMode;
|
|
902
|
-
/** Object keys excluded from canonical-exact comparison (declared ephemera). */
|
|
903
|
-
readonly ephemera: readonly string[];
|
|
904
|
-
readonly note: string;
|
|
905
|
-
}
|
|
906
|
-
/** The frozen artifact comparator set. */
|
|
907
|
-
declare const COMPARATORS: {
|
|
908
|
-
readonly authoredState: {
|
|
909
|
-
readonly id: "dev.docx-editor.core.comparator.authored-state";
|
|
910
|
-
readonly mode: 'canonical-exact';
|
|
911
|
-
readonly ephemera: readonly ["revision", "provenance", "producedAt", "commitId"];
|
|
912
|
-
readonly note: 'canonical normalized authored records; ephemera excluded';
|
|
913
|
-
};
|
|
914
|
-
readonly anchor: {
|
|
915
|
-
readonly id: "dev.docx-editor.core.comparator.anchor";
|
|
916
|
-
readonly mode: 'exact';
|
|
917
|
-
readonly ephemera: readonly [];
|
|
918
|
-
readonly note: 'internal anchor identity/affinity compares exactly';
|
|
919
|
-
};
|
|
920
|
-
readonly yjsStateVector: {
|
|
921
|
-
readonly id: "dev.docx-editor.core.comparator.yjs-state-vector";
|
|
922
|
-
readonly mode: 'sync-optimization-only';
|
|
923
|
-
readonly ephemera: readonly [];
|
|
924
|
-
readonly note: 'exchange optimization only; never proves update or delete-set coverage';
|
|
925
|
-
};
|
|
926
|
-
readonly shapedRun: {
|
|
927
|
-
readonly id: "dev.docx-editor.core.comparator.shaped-run";
|
|
928
|
-
readonly mode: 'exact';
|
|
929
|
-
readonly ephemera: readonly [];
|
|
930
|
-
readonly note: 'glyph ids, clusters, and fixed-point advances compare exactly';
|
|
931
|
-
};
|
|
932
|
-
readonly paginationFingerprint: {
|
|
933
|
-
readonly id: "dev.docx-editor.core.comparator.pagination-fingerprint";
|
|
934
|
-
readonly mode: 'exact';
|
|
935
|
-
readonly ephemera: readonly [];
|
|
936
|
-
readonly note: 'page/column boundaries, break causes, fixed-point geometry compare exactly';
|
|
937
|
-
};
|
|
938
|
-
readonly semanticTree: {
|
|
939
|
-
readonly id: "dev.docx-editor.core.comparator.semantic-tree";
|
|
940
|
-
readonly mode: 'exact';
|
|
941
|
-
readonly ephemera: readonly [];
|
|
942
|
-
readonly note: 'reading order, roles, headings, alt text compare exactly';
|
|
943
|
-
};
|
|
944
|
-
readonly hitTest: {
|
|
945
|
-
readonly id: "dev.docx-editor.core.comparator.hit-test";
|
|
946
|
-
readonly mode: 'exact';
|
|
947
|
-
readonly ephemera: readonly [];
|
|
948
|
-
readonly note: 'resolved hit target and cluster affinity compare exactly';
|
|
949
|
-
};
|
|
950
|
-
readonly pdfSemantics: {
|
|
951
|
-
readonly id: "dev.docx-editor.core.comparator.pdf-semantics";
|
|
952
|
-
readonly mode: 'canonical-exact';
|
|
953
|
-
readonly ephemera: readonly ["objectNumber", "producer", "creationDate", "modDate", "subsetTag"];
|
|
954
|
-
readonly note: 'canonical semantic PDF objects; container ephemera excluded';
|
|
955
|
-
};
|
|
956
|
-
readonly rasterCheckpoint: {
|
|
957
|
-
readonly id: "dev.docx-editor.core.comparator.raster-checkpoint";
|
|
958
|
-
readonly mode: 'tolerance';
|
|
959
|
-
readonly ephemera: readonly [];
|
|
960
|
-
readonly note: 'documented unavoidable raster comparison; explicit tolerance only';
|
|
961
|
-
};
|
|
962
|
-
readonly benchmarkEvidence: {
|
|
963
|
-
readonly id: "dev.docx-editor.core.comparator.benchmark-evidence";
|
|
964
|
-
readonly mode: 'sync-optimization-only';
|
|
965
|
-
readonly ephemera: readonly [];
|
|
966
|
-
readonly note: 'diagnostic evidence, not an equivalence basis';
|
|
967
|
-
};
|
|
968
|
-
};
|
|
969
|
-
/** Which frozen comparator to use. */
|
|
970
|
-
type ComparatorName = keyof typeof COMPARATORS;
|
|
971
|
-
/** Whether two artifacts matched, and where they diverged when they did not. */
|
|
972
|
-
interface ComparisonResult {
|
|
973
|
-
readonly equal: boolean;
|
|
974
|
-
/** Canonical forms when unequal (diagnostic). */
|
|
975
|
-
readonly left?: string;
|
|
976
|
-
readonly right?: string;
|
|
977
|
-
}
|
|
978
|
-
/**
|
|
979
|
-
* Compare two artifacts under a named comparator. `canonical-exact` and `exact`
|
|
980
|
-
* compare canonical forms (exact drops no ephemera). `tolerance` requires an
|
|
981
|
-
* epsilon and compares finite numbers structurally. `sync-optimization-only`
|
|
982
|
-
* throws — such artifacts are never an equivalence basis.
|
|
983
|
-
*/
|
|
984
|
-
declare function compareArtifacts(name: ComparatorName, left: unknown, right: unknown, opts?: {
|
|
985
|
-
epsilon?: number;
|
|
986
|
-
}): ComparisonResult;
|
|
987
|
-
/** Fingerprint an artifact under a named comparator's canonicalization policy. */
|
|
988
|
-
declare function fingerprint(name: ComparatorName, value: unknown): string;
|
|
989
|
-
|
|
990
|
-
/** Whether a recorded conformance step was expected to commit or be refused. */
|
|
991
|
-
type FixtureOutcome = 'applied' | 'aborted' | 'validation' | 'conflict' | 'resource' | 'authorization';
|
|
992
|
-
/** The change one step produced, summarized to what a fixture can compare across runtimes. */
|
|
993
|
-
interface ModelChangeSummary {
|
|
994
|
-
readonly fromRevision: number;
|
|
995
|
-
readonly toRevision: number;
|
|
996
|
-
readonly origin: string;
|
|
997
|
-
readonly dirty: readonly string[];
|
|
998
|
-
readonly dependencyKeys: readonly string[];
|
|
999
|
-
}
|
|
1000
|
-
/** Where anchors sat after a step — how a fixture proves positions survived an edit. */
|
|
1001
|
-
interface AnchorSnapshot {
|
|
1002
|
-
readonly anchorId: string;
|
|
1003
|
-
readonly story: string;
|
|
1004
|
-
readonly block: string;
|
|
1005
|
-
readonly affinity: 'before' | 'after';
|
|
1006
|
-
}
|
|
1007
|
-
/** What one step must produce: its outcome, its change summary, and its authored-state hash. */
|
|
1008
|
-
interface FixtureExpectation {
|
|
1009
|
-
readonly outcome: FixtureOutcome;
|
|
1010
|
-
/** Present iff outcome === 'applied'; MUST be > baseRevision. */
|
|
1011
|
-
readonly committedRevision?: number;
|
|
1012
|
-
readonly modelChange?: ModelChangeSummary;
|
|
1013
|
-
/** 16-hex authored-state fingerprint (comparator 0.4). */
|
|
1014
|
-
readonly authoredStateHash?: string;
|
|
1015
|
-
readonly outputHash?: string;
|
|
1016
|
-
readonly anchors?: readonly AnchorSnapshot[];
|
|
1017
|
-
}
|
|
1018
|
-
/** One recorded operation and what it was expected to do. */
|
|
1019
|
-
interface FixtureStep {
|
|
1020
|
-
readonly baseRevision: number;
|
|
1021
|
-
readonly origin: string;
|
|
1022
|
-
/** Opaque DocOp payloads (schema owned by section 4). */
|
|
1023
|
-
readonly ops: readonly unknown[];
|
|
1024
|
-
readonly expect: FixtureExpectation;
|
|
831
|
+
/** One story root — body, a header/footer variant, or a note part. */
|
|
832
|
+
interface StoryIndexEntry {
|
|
833
|
+
/** The part the story lives in. */
|
|
834
|
+
readonly partName: string;
|
|
835
|
+
/** The `w:body` (or story root) node id. */
|
|
836
|
+
readonly rootId: string;
|
|
837
|
+
readonly paragraphs: readonly ParagraphIndexEntry[];
|
|
1025
838
|
}
|
|
1026
|
-
/**
|
|
1027
|
-
interface
|
|
1028
|
-
readonly
|
|
1029
|
-
readonly
|
|
1030
|
-
readonly
|
|
1031
|
-
readonly
|
|
1032
|
-
readonly
|
|
1033
|
-
/**
|
|
1034
|
-
readonly
|
|
839
|
+
/** One style definition, indexed by the id content references it under. */
|
|
840
|
+
interface StyleIndexEntry {
|
|
841
|
+
readonly styleId: string;
|
|
842
|
+
readonly type: string;
|
|
843
|
+
readonly nodeId: string;
|
|
844
|
+
readonly name: string | null;
|
|
845
|
+
readonly basedOn: string | null;
|
|
846
|
+
/** Whether the part marks this the default style for its type (`w:default="1"`). */
|
|
847
|
+
readonly isDefault: boolean;
|
|
1035
848
|
}
|
|
1036
|
-
/** Which implementation recorded a fixture — local store, Yjs, or a binding. */
|
|
1037
|
-
type FixtureSource = {
|
|
1038
|
-
readonly kind: 'create';
|
|
1039
|
-
} | {
|
|
1040
|
-
readonly kind: 'docx';
|
|
1041
|
-
readonly sha256: string;
|
|
1042
|
-
readonly bytesRef: string;
|
|
1043
|
-
};
|
|
1044
849
|
/**
|
|
1045
|
-
* The
|
|
1046
|
-
* hashes.
|
|
850
|
+
* The derived lookups over a part: paragraphs, stories and styles by id.
|
|
1047
851
|
*
|
|
1048
|
-
*
|
|
1049
|
-
*
|
|
1050
|
-
* invalidating every recorded fixture.
|
|
852
|
+
* Diff-patched on commit rather than rebuilt — rebuilding every index per keystroke is what made
|
|
853
|
+
* typing scale with document length.
|
|
1051
854
|
*/
|
|
1052
|
-
interface
|
|
1053
|
-
|
|
1054
|
-
readonly
|
|
1055
|
-
|
|
1056
|
-
readonly
|
|
1057
|
-
|
|
1058
|
-
readonly
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
interface ValidationResult {
|
|
1062
|
-
readonly valid: boolean;
|
|
1063
|
-
readonly errors: readonly string[];
|
|
1064
|
-
}
|
|
1065
|
-
/** Structurally validate a fixture against the frozen format rules. */
|
|
1066
|
-
declare function validateFixture(fixture: ConformanceFixture): ValidationResult;
|
|
1067
|
-
|
|
1068
|
-
/** The outcome a store reports for one replayed step. */
|
|
1069
|
-
interface ReplayOutcome {
|
|
1070
|
-
readonly outcome: FixtureOutcome;
|
|
1071
|
-
readonly committedRevision?: number;
|
|
1072
|
-
/** Canonical authored-state value AFTER the step (hashed via comparator 0.4). */
|
|
1073
|
-
readonly authoredState?: unknown;
|
|
1074
|
-
}
|
|
1075
|
-
/** The interface a conformance runtime implements so one fixture can drive every backend. */
|
|
1076
|
-
interface ReplayStore {
|
|
1077
|
-
/** Initialize from the fixture source; return the initial revision (0 for create). */
|
|
1078
|
-
init(fixture: ConformanceFixture): number;
|
|
1079
|
-
/** Apply one step and report what happened. */
|
|
1080
|
-
applyStep(step: FixtureStep): ReplayOutcome;
|
|
1081
|
-
}
|
|
1082
|
-
/** What replaying a fixture produced: per-step outcomes and where they diverged. */
|
|
1083
|
-
interface ReplayReport {
|
|
1084
|
-
readonly ok: boolean;
|
|
1085
|
-
readonly mismatches: readonly string[];
|
|
855
|
+
interface OoxmlIndexes {
|
|
856
|
+
/** The tree revision these projections were derived from. */
|
|
857
|
+
readonly revision: number;
|
|
858
|
+
/** Body story first, then any other story parts, keyed by part name. */
|
|
859
|
+
readonly stories: ReadonlyMap<string, StoryIndexEntry>;
|
|
860
|
+
/** Every paragraph across every story, keyed by node id. */
|
|
861
|
+
readonly paragraphs: ReadonlyMap<string, ParagraphIndexEntry>;
|
|
862
|
+
readonly relationships: ReadonlyMap<string, readonly RelationshipRecord[]>;
|
|
863
|
+
readonly styles: ReadonlyMap<string, StyleIndexEntry>;
|
|
1086
864
|
}
|
|
865
|
+
/** Style definitions, read out of the generic `w:styles` tree. */
|
|
866
|
+
declare function indexStyles(part: OoxmlPart | undefined): Map<string, StyleIndexEntry>;
|
|
867
|
+
/** The package's style definitions part, if it has one. */
|
|
868
|
+
declare function stylesPartOf(pkg: OoxmlPackage): OoxmlPart | undefined;
|
|
1087
869
|
/**
|
|
1088
|
-
*
|
|
1089
|
-
* revision, and authored-state fingerprint against the fixture's expectations.
|
|
1090
|
-
*/
|
|
1091
|
-
declare function replayFixture(fixture: ConformanceFixture, store: ReplayStore): ReplayReport;
|
|
1092
|
-
/** Hash a store's authored state, so two runtimes replaying one fixture can be compared. */
|
|
1093
|
-
declare function hashAuthored(authoredState: unknown): string;
|
|
1094
|
-
|
|
1095
|
-
/**
|
|
1096
|
-
* Keys that must never be assigned from file data.
|
|
870
|
+
* Derive every index from one canonical package revision.
|
|
1097
871
|
*
|
|
1098
|
-
*
|
|
1099
|
-
*
|
|
1100
|
-
*/
|
|
1101
|
-
declare const DANGEROUS_KEYS: readonly string[];
|
|
1102
|
-
/** A file-derived key that would pollute a prototype. Refused, never sanitized-and-accepted. */
|
|
1103
|
-
declare class DangerousKeyError extends Error {
|
|
1104
|
-
readonly key: string;
|
|
1105
|
-
readonly path: string;
|
|
1106
|
-
constructor(key: string, path: string);
|
|
1107
|
-
}
|
|
1108
|
-
/** Whether a key is one of {@link DANGEROUS_KEYS}. */
|
|
1109
|
-
declare function isDangerousKey(key: string): boolean;
|
|
1110
|
-
/** A fresh null-prototype record — the only object shape parser intermediates use. */
|
|
1111
|
-
declare function nullRecord<T = unknown>(): Record<string, T>;
|
|
1112
|
-
/**
|
|
1113
|
-
* Recursively convert `value` into null-prototype records, rejecting any
|
|
1114
|
-
* dangerous object key. Arrays and primitives pass through (arrays rebuilt so no
|
|
1115
|
-
* inherited prototype pollution survives). Throws DangerousKeyError on the first
|
|
1116
|
-
* unsafe key, naming its path. Cyclic inputs are rejected.
|
|
872
|
+
* Pure: the same package and revision always produce the same index, which is what makes
|
|
873
|
+
* "rebuild rather than mutate" a safe invalidation strategy.
|
|
1117
874
|
*/
|
|
1118
|
-
declare function
|
|
875
|
+
declare function deriveOoxmlIndexes(pkg: OoxmlPackage, revision: number): OoxmlIndexes;
|
|
1119
876
|
|
|
1120
|
-
/**
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
877
|
+
/** One paragraph's meaning, independent of how it was spelled in XML. */
|
|
878
|
+
interface ParagraphDigest {
|
|
879
|
+
/** Ordinal identity within its story. Node ids are NOT used: a reopened package
|
|
880
|
+
* legitimately re-derives them, and requiring them to match would test the id scheme
|
|
881
|
+
* rather than the content. */
|
|
882
|
+
readonly ordinal: number;
|
|
883
|
+
/**
|
|
884
|
+
* Where the paragraph SITS: the element path from the story root, so a paragraph that
|
|
885
|
+
* moves out of the table cell it was written in is a difference rather than a paragraph
|
|
886
|
+
* with the same ordinal and the same text.
|
|
887
|
+
*/
|
|
888
|
+
readonly path: string;
|
|
889
|
+
/**
|
|
890
|
+
* `w14:paraId`, uppercase-normalized (matching is case-insensitive), or null. This is
|
|
891
|
+
* MANAGED identity — the agent contract anchors on it and comment threading references
|
|
892
|
+
* it — so a serializer silently dropping it must be a digest difference. Other paragraph
|
|
893
|
+
* attributes (`w:rsidR` …) stay deliberately undigested: they are revision noise.
|
|
894
|
+
*/
|
|
895
|
+
readonly paraId: string | null;
|
|
896
|
+
/** Text content, including tabs and hard breaks as their characters. */
|
|
897
|
+
readonly text: string;
|
|
898
|
+
/** Accepted paragraph properties, as sorted tokens including nested children. */
|
|
899
|
+
readonly paragraphProperties: readonly string[];
|
|
900
|
+
/** Per-run accepted properties, in run order. */
|
|
901
|
+
readonly runProperties: readonly (readonly string[])[];
|
|
902
|
+
/** Fingerprints of every generic (unknown) subtree, in document order. */
|
|
903
|
+
readonly genericStructure: readonly string[];
|
|
904
|
+
}
|
|
905
|
+
/** One story reduced to its semantic content, ignoring everything a normalized re-emit changes. */
|
|
906
|
+
interface StoryDigest {
|
|
907
|
+
readonly partName: string;
|
|
908
|
+
readonly paragraphs: readonly ParagraphDigest[];
|
|
909
|
+
/**
|
|
910
|
+
* Every block-level element of the part OUTSIDE a paragraph, in document order, as
|
|
911
|
+
* `path name(attributes)` — the tables, rows, cells, sections, content controls and
|
|
912
|
+
* their property children, each at the position that says what contains it.
|
|
913
|
+
*
|
|
914
|
+
* A paragraph's own internals are not here (they are its `ParagraphDigest`), which keeps
|
|
915
|
+
* this list proportional to a document's STRUCTURE rather than its text.
|
|
916
|
+
*/
|
|
917
|
+
readonly structure: readonly string[];
|
|
918
|
+
}
|
|
1125
919
|
/**
|
|
1126
|
-
*
|
|
920
|
+
* The whole document's semantic content — one of the D9 losslessness oracles.
|
|
1127
921
|
*
|
|
1128
|
-
*
|
|
1129
|
-
*
|
|
922
|
+
* What a save/reopen round-trip is compared on. Byte identity applies only to non-XML parts;
|
|
923
|
+
* modelled parts re-emit normalized, so equality is asserted HERE rather than on bytes.
|
|
1130
924
|
*/
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
| 'reserved-part-name'
|
|
1134
|
-
/** Two parts whose names differ only by case, which OPC treats as one part. */
|
|
1135
|
-
| 'duplicate-part-name'
|
|
1136
|
-
/** A part name the OPC screens refuse; `writeZip` would throw on save. */
|
|
1137
|
-
| 'unsafe-part-name';
|
|
1138
|
-
/** One package invariant violation, located by part name and relationship id. */
|
|
1139
|
-
interface PackageInvariantIssue {
|
|
1140
|
-
readonly code: PackageInvariantCode;
|
|
1141
|
-
/** The part the issue is about: the missing target, or the part with no type. */
|
|
1142
|
-
readonly partName: string;
|
|
1143
|
-
/** For a dangling relationship, the owner that points at nothing. */
|
|
1144
|
-
readonly ownerPart?: string;
|
|
925
|
+
interface SemanticDigest {
|
|
926
|
+
readonly stories: readonly StoryDigest[];
|
|
1145
927
|
}
|
|
1146
|
-
/**
|
|
1147
|
-
type
|
|
1148
|
-
readonly
|
|
1149
|
-
|
|
1150
|
-
readonly
|
|
1151
|
-
readonly issues: readonly PackageInvariantIssue[];
|
|
928
|
+
/** Where two digests diverge — the diagnostic when a round-trip loses something. */
|
|
929
|
+
type DigestDifference = {
|
|
930
|
+
readonly path: string;
|
|
931
|
+
readonly before: string;
|
|
932
|
+
readonly after: string;
|
|
1152
933
|
};
|
|
1153
|
-
/**
|
|
1154
|
-
declare function
|
|
1155
|
-
/**
|
|
1156
|
-
declare function
|
|
1157
|
-
/** The `.rels` part that owns a part's relationships, by OPC convention. */
|
|
1158
|
-
declare function relsPartNameFor(partName: string): string;
|
|
934
|
+
/** Digest one part: its paragraphs, and the structure that holds them. */
|
|
935
|
+
declare function digestPart(part: OoxmlPart): StoryDigest | null;
|
|
936
|
+
/** Digest every part, in the given order. */
|
|
937
|
+
declare function semanticDigest(parts: Iterable<OoxmlPart>): SemanticDigest;
|
|
1159
938
|
/**
|
|
1160
|
-
*
|
|
939
|
+
* Every way two digests differ, as readable paths.
|
|
1161
940
|
*
|
|
1162
|
-
*
|
|
1163
|
-
*
|
|
1164
|
-
*
|
|
941
|
+
* Returns the differences rather than a boolean because "the round trip lost something" is
|
|
942
|
+
* useless without saying what — the failure this oracle exists to catch is a silent drop,
|
|
943
|
+
* and a bare `false` reproduces the silence.
|
|
1165
944
|
*/
|
|
1166
|
-
declare function
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
/** Add or replace one relationship on a part, returning a new package. */
|
|
1175
|
-
declare function withRelationship(pkg: OoxmlPackage, ownerPart: string, type: string, rawTarget: string): {
|
|
1176
|
-
readonly pkg: OoxmlPackage;
|
|
1177
|
-
readonly relationshipId: string;
|
|
1178
|
-
readonly ok: boolean;
|
|
1179
|
-
};
|
|
945
|
+
declare function diffSemanticDigests(before: SemanticDigest, after: SemanticDigest): DigestDifference[];
|
|
946
|
+
|
|
947
|
+
/** Valid per MS-DOCX: 8 hex digits, non-zero, below 0x80000000. */
|
|
948
|
+
declare function isValidParaId(value: string): boolean;
|
|
949
|
+
/** The authored `w14:paraId` value of an element, verbatim, or null. */
|
|
950
|
+
declare function paraIdOf(node: OoxmlNode): string | null;
|
|
951
|
+
/** FNV-1a over UTF-16 code units — the deterministic mint every id derivation shares. */
|
|
952
|
+
declare function fnv1a32(value: string): number;
|
|
1180
953
|
/**
|
|
1181
|
-
*
|
|
954
|
+
* Deterministic 8-hex mint in (0x00000000, 0x80000000), collision-free against
|
|
955
|
+
* `used` (uppercase hex). Same seed + same used-set → same value, which is what
|
|
956
|
+
* keeps `splitParagraphMany` byte-identical to its equivalent single splits and
|
|
957
|
+
* a reopened save identical to the session that produced it.
|
|
958
|
+
*/
|
|
959
|
+
declare function mintParaId(seed: string, used: ReadonlySet<string>): string;
|
|
960
|
+
/** Every valid `w14:paraId` in the tree, uppercased. Memoized per root object. */
|
|
961
|
+
declare function usedParaIds(root: OoxmlElement): ReadonlySet<string>;
|
|
962
|
+
/**
|
|
963
|
+
* The non-empty prefix the part ROOT binds to the w14 namespace, or null.
|
|
1182
964
|
*
|
|
1183
|
-
*
|
|
1184
|
-
*
|
|
965
|
+
* Minted attributes require an in-scope binding (the invariant validator reports
|
|
966
|
+
* `invalid-qname` otherwise, and the serializer would allocate an `nsN` alias).
|
|
967
|
+
* Only the root binding counts: a binding authored on some descendant does not
|
|
968
|
+
* cover paragraphs elsewhere in the tree.
|
|
1185
969
|
*/
|
|
1186
|
-
declare function
|
|
970
|
+
declare function w14RootPrefix(root: OoxmlElement): string | null;
|
|
971
|
+
/** The minted `[w14:paraId, w14:textId]` pair. `textId` mirrors `paraId`: it has no uniqueness requirement, no consumer reads it, and one allocator is simpler than two — but Word writes both, so we write both. */
|
|
972
|
+
declare function mintedParagraphIdentityAttributes(prefix: string, value: string): readonly OoxmlAttribute[];
|
|
1187
973
|
/**
|
|
1188
|
-
*
|
|
974
|
+
* Load-time paragraph-identity normalization for a session's main part.
|
|
1189
975
|
*
|
|
1190
|
-
*
|
|
1191
|
-
*
|
|
976
|
+
* Keeps every valid, first-seen paraId verbatim; mints (deterministically, seeded
|
|
977
|
+
* by the paragraph's structural node id) for paragraphs whose id is missing,
|
|
978
|
+
* malformed, zero, out of range, or a duplicate. Adds the root `xmlns` binding
|
|
979
|
+
* the minted attributes need. Returns the INPUT PART REFERENCE when there is
|
|
980
|
+
* nothing to do — a document Word saved yesterday re-serializes byte-identical.
|
|
1192
981
|
*
|
|
1193
|
-
*
|
|
1194
|
-
*
|
|
982
|
+
* Attribute-only rebuilds move no child, so every node keeps its structural-path
|
|
983
|
+
* id; the copy respreads only the ancestors of changed paragraphs.
|
|
1195
984
|
*
|
|
1196
|
-
*
|
|
1197
|
-
*
|
|
1198
|
-
*
|
|
985
|
+
* Fail-open: if the rebuilt part does not validate (a bug, or a pathology the
|
|
986
|
+
* prefix choice could not defuse), the original part is returned — a document
|
|
987
|
+
* must never become unopenable over an identity enhancement.
|
|
1199
988
|
*/
|
|
1200
|
-
declare function
|
|
989
|
+
declare function normalizeParagraphIdentity(part: OoxmlPart): OoxmlPart;
|
|
990
|
+
|
|
991
|
+
/** One `w:docPart` of the glossary, with the blocks its body holds. */
|
|
992
|
+
interface BuildingBlock {
|
|
993
|
+
/** `w:docPartPr/w:name`, the identity a control's placeholder and a pick refer to. */
|
|
994
|
+
readonly name: string;
|
|
995
|
+
/** `w:category/w:gallery`, an `ST_DocPartGallery` value such as `docParts`. */
|
|
996
|
+
readonly gallery: string;
|
|
997
|
+
/** `w:category/w:name`; `General` when the block declares none. */
|
|
998
|
+
readonly category: string;
|
|
999
|
+
/** The `w:docPartBody` children: paragraphs, tables and block controls, in order. */
|
|
1000
|
+
readonly blocks: readonly OoxmlNode[];
|
|
1001
|
+
}
|
|
1002
|
+
/** The gallery and category a `w:docPartList` control lists. */
|
|
1003
|
+
interface BuildingBlockGalleryFilter {
|
|
1004
|
+
readonly gallery: string;
|
|
1005
|
+
readonly category: string | null;
|
|
1006
|
+
}
|
|
1007
|
+
/** The glossary part, through the main part's relationship or the conventional name. */
|
|
1008
|
+
declare function glossaryPartOf(pkg: OoxmlPackage): OoxmlPart | null;
|
|
1009
|
+
/** Every named building block of the glossary, in authored order. Empty without a glossary. */
|
|
1010
|
+
declare function buildingBlocksOf(pkg: OoxmlPackage): readonly BuildingBlock[];
|
|
1011
|
+
/** The gallery a `w:docPartList` control lists, or null for any other control. */
|
|
1012
|
+
declare function buildingBlockGalleryOf(control: OoxmlNode): BuildingBlockGalleryFilter | null;
|
|
1013
|
+
/**
|
|
1014
|
+
* The blocks a gallery control offers: same gallery, and the control's category when it names
|
|
1015
|
+
* one. Sorted by category, then name, as Word groups its list.
|
|
1016
|
+
*/
|
|
1017
|
+
declare function buildingBlocksForControl(pkg: OoxmlPackage, control: OoxmlNode): readonly BuildingBlock[];
|
|
1201
1018
|
|
|
1202
1019
|
/**
|
|
1203
|
-
*
|
|
1020
|
+
* Which story a comment deletion or resolution may read markers from.
|
|
1204
1021
|
*
|
|
1205
|
-
*
|
|
1206
|
-
* from a document use {@link isXmlNCName}, which admits every XML 1.0 name.
|
|
1022
|
+
* `w:id` is not unique across stories: a header and the body can both hold comment 1.
|
|
1207
1023
|
*/
|
|
1208
|
-
|
|
1209
|
-
/**
|
|
1210
|
-
|
|
1024
|
+
interface CommentDeletionOwner {
|
|
1025
|
+
/** Canonical name of the part holding the story's markers. */
|
|
1026
|
+
readonly storyPartName: string;
|
|
1027
|
+
/**
|
|
1028
|
+
* When the story is one note inside a shared notes part, that note's `w:id`.
|
|
1029
|
+
* Absent means the whole part is the story (body, header, footer).
|
|
1030
|
+
*/
|
|
1031
|
+
readonly noteId?: number;
|
|
1032
|
+
}
|
|
1033
|
+
|
|
1211
1034
|
/**
|
|
1212
|
-
*
|
|
1035
|
+
* Delete a comment thread: that story's markers, and metadata no other story still names.
|
|
1213
1036
|
*
|
|
1214
|
-
*
|
|
1215
|
-
*
|
|
1037
|
+
* `owner` names the story whose markers may be stripped. Omitted, it is the main document
|
|
1038
|
+
* body — never every XML part. A header or note that reused the same `w:id` is a different
|
|
1039
|
+
* remark; pass its part (and `noteId` when the story is one note) to delete that one.
|
|
1040
|
+
*
|
|
1041
|
+
* Returns the package unchanged when the id names no comment, and null when a removal was
|
|
1042
|
+
* refused — a caller inside a transaction rolls back rather than committing a package whose
|
|
1043
|
+
* comment is half gone.
|
|
1216
1044
|
*/
|
|
1217
|
-
declare function
|
|
1045
|
+
declare function deleteCommentThread(pkg: OoxmlPackage, commentId: string, owner?: CommentDeletionOwner): OoxmlPackage | null;
|
|
1218
1046
|
/**
|
|
1219
|
-
*
|
|
1220
|
-
*
|
|
1221
|
-
*
|
|
1047
|
+
* Delete every comment the edit between `before` and `after` emptied in `owner`'s story.
|
|
1048
|
+
*
|
|
1049
|
+
* `owner` omitted is the main document body, matching {@link deleteCommentThread}.
|
|
1050
|
+
*
|
|
1051
|
+
* THE TEST, exactly, and per story. A comment dies when the words it covered in that story are
|
|
1052
|
+
* gone and nothing in that story still places it. A neighbour that reused the same `w:id` is
|
|
1053
|
+
* judged under its own owner. Notes that vanished (reference cascade) are reaped as their own
|
|
1054
|
+
* stories so a unique id still loses its `comments.xml` body. Remaining-marker overflow
|
|
1055
|
+
* preserves comments/commentEx/commentId metadata rather than deleting records the scan could
|
|
1056
|
+
* not prove unused. Null is reserved for a removal that actually failed.
|
|
1222
1057
|
*/
|
|
1223
|
-
declare
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1058
|
+
declare function cascadeEmptiedComments(before: OoxmlPackage, after: OoxmlPackage, owner?: CommentDeletionOwner): OoxmlPackage | null;
|
|
1059
|
+
|
|
1060
|
+
/** Presentation settings the document itself states. Absence is the answer, never an error. */
|
|
1061
|
+
interface DocumentViewSettings {
|
|
1062
|
+
/**
|
|
1063
|
+
* `w:doNotShadeFormData` (§17.15.1.49) — do NOT shade legacy form fields.
|
|
1064
|
+
*
|
|
1065
|
+
* Word draws a grey block behind every `w:ffData` field so a reader can find the blanks in a
|
|
1066
|
+
* form. It is on by DEFAULT, and this element is how a document turns it off, so the absent
|
|
1067
|
+
* case means shading. Reading the name as "shade form data" inverts it and blanks the shading
|
|
1068
|
+
* on exactly the documents that asked for it loudest.
|
|
1069
|
+
*
|
|
1070
|
+
* Never printed, by Word or by us: it marks where to type, and a printed form has no blanks
|
|
1071
|
+
* to find.
|
|
1072
|
+
*/
|
|
1073
|
+
readonly doNotShadeFormData: boolean;
|
|
1234
1074
|
}
|
|
1075
|
+
/** The defaults a document with no `settings.xml` gets: everything Word would shade, shaded. */
|
|
1076
|
+
declare const DEFAULT_VIEW_SETTINGS: DocumentViewSettings;
|
|
1077
|
+
/** Read the view settings from a `settings.xml` root, or the defaults when it has none. */
|
|
1078
|
+
declare function readViewSettings(settingsRoot: OoxmlNode | null | undefined): DocumentViewSettings;
|
|
1235
1079
|
|
|
1080
|
+
/** How deep transparent block wrappers may nest before the walk stops descending. */
|
|
1081
|
+
declare const MAX_STORY_SDT_NESTING = 32;
|
|
1082
|
+
/** Which kind of story a root is. Layout walks all four the same way. */
|
|
1083
|
+
type OoxmlStoryKind = 'body' | 'header' | 'footer' | 'note';
|
|
1084
|
+
/** One story root and the blocks under it, with transparent block wrappers already flattened. */
|
|
1085
|
+
interface OoxmlStoryRoot {
|
|
1086
|
+
readonly kind: OoxmlStoryKind;
|
|
1087
|
+
/** The `w:body` / `w:hdr` / `w:ftr` / `w:footnote` element that holds the blocks. */
|
|
1088
|
+
readonly root: OoxmlNode;
|
|
1089
|
+
}
|
|
1236
1090
|
/**
|
|
1237
|
-
*
|
|
1091
|
+
* Every story root in a part, in document order.
|
|
1238
1092
|
*
|
|
1239
|
-
*
|
|
1240
|
-
*
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
type HrefProjection = {
|
|
1244
|
-
readonly ok: true;
|
|
1245
|
-
readonly href: string;
|
|
1246
|
-
} | {
|
|
1247
|
-
readonly ok: false;
|
|
1248
|
-
readonly inert: true;
|
|
1249
|
-
};
|
|
1093
|
+
* Does not descend INTO a story: a story's blocks are the walk below, and a story root never
|
|
1094
|
+
* contains another story root.
|
|
1095
|
+
*/
|
|
1096
|
+
declare function storyRootsOf(part: OoxmlPart): readonly OoxmlStoryRoot[];
|
|
1250
1097
|
/**
|
|
1251
|
-
*
|
|
1252
|
-
*
|
|
1253
|
-
*
|
|
1098
|
+
* Whether a part is SHAPED to hold stories — a body, a header, a footer, or a notes part.
|
|
1099
|
+
*
|
|
1100
|
+
* A shape test, deliberately not `storyRootsOf(part).length > 0`. That counts EDITABLE stories,
|
|
1101
|
+
* and a notes part holding nothing but `w:separator` and `w:continuationSeparator` has none —
|
|
1102
|
+
* which is the footnotes part Word writes into every document that ever held a footnote. A
|
|
1103
|
+
* caller asking "should I walk this part at all" that used the editable count skipped it
|
|
1104
|
+
* entirely, and the two callers that ask are a payload sweep and an export strip: both DELETE
|
|
1105
|
+
* what they conclude nothing names.
|
|
1254
1106
|
*/
|
|
1255
|
-
declare function
|
|
1256
|
-
/**
|
|
1257
|
-
declare function
|
|
1107
|
+
declare function isStoryPart(part: OoxmlPart): boolean;
|
|
1108
|
+
/** The main body story of a part, or null when the part holds none. */
|
|
1109
|
+
declare function bodyStoryRoot(part: OoxmlPart): OoxmlNode | null;
|
|
1258
1110
|
/**
|
|
1259
|
-
*
|
|
1260
|
-
*
|
|
1261
|
-
*
|
|
1111
|
+
* Every paragraph of one story, in reading order.
|
|
1112
|
+
*
|
|
1113
|
+
* Descends through tables (rows, cells, nested tables), block controls and block custom XML.
|
|
1114
|
+
* The returned nodes are paragraph elements; a caller addresses them by `id`.
|
|
1262
1115
|
*/
|
|
1263
|
-
declare function
|
|
1264
|
-
/** Whether a file-derived CSS fragment contains a `url()` or `@import` (must be rejected). */
|
|
1265
|
-
declare function containsCssFetch(value: string): boolean;
|
|
1116
|
+
declare function storyParagraphs(root: OoxmlNode): readonly OoxmlNode[];
|
|
1266
1117
|
/**
|
|
1267
|
-
*
|
|
1268
|
-
* instructions.
|
|
1118
|
+
* The block walk itself, appending into `out`.
|
|
1269
1119
|
*
|
|
1270
|
-
*
|
|
1271
|
-
*
|
|
1120
|
+
* Exported so `allParagraphs` in the binding lane is the same traversal rather than a second
|
|
1121
|
+
* copy of it.
|
|
1272
1122
|
*/
|
|
1273
|
-
declare
|
|
1274
|
-
|
|
1275
|
-
/** One
|
|
1276
|
-
|
|
1277
|
-
/**
|
|
1278
|
-
|
|
1279
|
-
/**
|
|
1280
|
-
|
|
1281
|
-
/**
|
|
1282
|
-
|
|
1283
|
-
readonly id: string;
|
|
1284
|
-
readonly kind: string;
|
|
1123
|
+
declare function collectStoryParagraphs(children: readonly OoxmlNode[], out: OoxmlNode[], sdtDepth: number): void;
|
|
1124
|
+
|
|
1125
|
+
/** One searchable text-box story and the drawing location that can reveal it. */
|
|
1126
|
+
interface TextboxStoryRoot {
|
|
1127
|
+
/** The `w:txbxContent` story root. */
|
|
1128
|
+
readonly root: OoxmlElement;
|
|
1129
|
+
/** Layout atom id used to select the drawing, including an MC wrapper when present. */
|
|
1130
|
+
readonly drawingNodeId: string;
|
|
1131
|
+
/** Canonical node id of the paragraph that anchors the drawing. */
|
|
1132
|
+
readonly hostParagraphId: string;
|
|
1285
1133
|
}
|
|
1286
1134
|
/**
|
|
1287
|
-
*
|
|
1135
|
+
* List the text-box stories in one part, in document order.
|
|
1288
1136
|
*
|
|
1289
|
-
*
|
|
1290
|
-
*
|
|
1137
|
+
* The bounded walk stops at drawings. It does not project pictures, shape geometry, or story
|
|
1138
|
+
* content. Results are memoized by immutable part-root identity.
|
|
1291
1139
|
*/
|
|
1292
|
-
|
|
1293
|
-
readonly kept: readonly ContentItem[];
|
|
1294
|
-
readonly removed: readonly ContentItem[];
|
|
1295
|
-
/** A scrub that removes anything is non-lossless by definition. */
|
|
1296
|
-
readonly nonLossless: boolean;
|
|
1297
|
-
}
|
|
1298
|
-
/** Explicit scrub export: remove inert executable classes, report removals. */
|
|
1299
|
-
declare function scrubExport(items: readonly ContentItem[]): ScrubResult;
|
|
1140
|
+
declare function textboxStoriesInPart(part: OoxmlPart): readonly TextboxStoryRoot[];
|
|
1300
1141
|
|
|
1301
|
-
/**
|
|
1302
|
-
declare
|
|
1303
|
-
/**
|
|
1304
|
-
declare
|
|
1305
|
-
/**
|
|
1306
|
-
declare
|
|
1142
|
+
/** Relationship from the story to one data part. */
|
|
1143
|
+
declare const CUSTOM_XML_REL = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXml";
|
|
1144
|
+
/** Relationship from a data part to the properties that carry its `ds:itemID`. */
|
|
1145
|
+
declare const CUSTOM_XML_PROPS_REL = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXmlProps";
|
|
1146
|
+
/** `itemPropsN.xml` needs an Override; `itemN.xml` rides the package's `xml` default. */
|
|
1147
|
+
declare const CUSTOM_XML_PROPS_TYPE = "application/vnd.openxmlformats-officedocument.customXmlProperties+xml";
|
|
1148
|
+
/** The datastore namespace `ds:datastoreItem` lives in. */
|
|
1149
|
+
declare const DATASTORE_NAMESPACE_URI = "http://schemas.openxmlformats.org/officeDocument/2006/customXml";
|
|
1150
|
+
/** A data part located in a package: where it lives, and the GUID an SDT binds to. */
|
|
1151
|
+
interface CustomXmlDataPart {
|
|
1152
|
+
/** Canonical part name, e.g. `/customXml/item1.xml`. */
|
|
1153
|
+
readonly partName: string;
|
|
1154
|
+
/** Part name of its properties, e.g. `/customXml/itemProps1.xml`. */
|
|
1155
|
+
readonly propsPartName: string;
|
|
1156
|
+
/** `ds:itemID`, braced and upper-case, as `w:storeItemID` must spell it. */
|
|
1157
|
+
readonly itemId: string;
|
|
1158
|
+
/** Namespace URI of the payload root, which is what identifies one store among several. */
|
|
1159
|
+
readonly namespaceUri: string;
|
|
1160
|
+
}
|
|
1307
1161
|
/**
|
|
1308
|
-
*
|
|
1309
|
-
*
|
|
1310
|
-
*
|
|
1162
|
+
* A `ds:itemID` derived from the seed rather than drawn at random.
|
|
1163
|
+
*
|
|
1164
|
+
* Exported so a caller that authors a store OUTSIDE a package — a template engine splicing
|
|
1165
|
+
* markup it will assemble into a `.docx` later — mints the id the same way this does, rather
|
|
1166
|
+
* than inventing a second GUID shape Word has to be tolerant of.
|
|
1167
|
+
*
|
|
1168
|
+
* The store is a pure function of what it is asked to write: the same document written twice
|
|
1169
|
+
* has to produce the same bytes, or a save/reopen/save round trip stops being a fixed point
|
|
1170
|
+
* and every digest taken over saved bytes moves. A GUID's job here is uniqueness within one
|
|
1171
|
+
* package, not unguessability, so four FNV-1a passes over a salted seed carry it.
|
|
1311
1172
|
*/
|
|
1312
|
-
declare function
|
|
1173
|
+
declare function datastoreItemIdFor(seed: string): string;
|
|
1313
1174
|
/**
|
|
1314
|
-
* The
|
|
1315
|
-
*
|
|
1316
|
-
*
|
|
1175
|
+
* The data parts a story relates to, in relationship order.
|
|
1176
|
+
*
|
|
1177
|
+
* Reads the relationships rather than scanning `/customXml/` by name: a part nothing relates
|
|
1178
|
+
* to is not part of the document, and a package from a hostile sender can hold as many
|
|
1179
|
+
* plausibly-named files as it likes.
|
|
1317
1180
|
*/
|
|
1318
|
-
declare function
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
/**
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
/**
|
|
1325
|
-
|
|
1326
|
-
/** What a `w:br` breaks. `other` covers values this engine does not model, kept losslessly. */
|
|
1327
|
-
type HardBreakKind = 'line' | 'page' | 'column' | 'other';
|
|
1328
|
-
/** Read the semantic break kind from a typed `w:br` node. */
|
|
1329
|
-
declare function hardBreakKind(node: OoxmlHardBreakNode): HardBreakKind;
|
|
1330
|
-
/** Whether a node is a `w:br` with `w:type="page"`. */
|
|
1331
|
-
declare function isPageBreakNode(node: OoxmlNode): node is OoxmlHardBreakNode;
|
|
1332
|
-
/** Text projection for a `w:br` node — one UTF-16 code unit per break. */
|
|
1333
|
-
declare function hardBreakText(node: OoxmlHardBreakNode): string;
|
|
1334
|
-
/** Attributes for a newly authored `w:br`. */
|
|
1335
|
-
declare function hardBreakAttributes(kind: 'line' | 'page'): OoxmlHardBreakNode['attributes'];
|
|
1336
|
-
|
|
1337
|
-
/** Parsed TOC instruction. Unknown switches are ignored for generation but left on the wire. */
|
|
1338
|
-
interface TocInstruction {
|
|
1339
|
-
readonly keyword: 'TOC';
|
|
1340
|
-
/** Include hyperlinks (`\\h`). */
|
|
1341
|
-
readonly hyperlink: boolean;
|
|
1342
|
-
/** Omit page numbers (`\\n`). */
|
|
1343
|
-
readonly omitPageNumbers: boolean;
|
|
1344
|
-
/** Inclusive 1-based outline levels from `\\o "n-m"`. Defaults 1–9. */
|
|
1345
|
-
readonly outlineStart: number;
|
|
1346
|
-
readonly outlineEnd: number;
|
|
1347
|
-
readonly raw: string;
|
|
1181
|
+
declare function customXmlDataParts(pkg: OoxmlPackage, storyPartName: string): CustomXmlDataPart[];
|
|
1182
|
+
/** The data part carrying this namespace, or null when the document has none yet. */
|
|
1183
|
+
declare function findCustomXmlDataPart(pkg: OoxmlPackage, storyPartName: string, namespaceUri: string): CustomXmlDataPart | null;
|
|
1184
|
+
/** What {@link withCustomXmlDataPart} answers. */
|
|
1185
|
+
interface CustomXmlDataPartResult {
|
|
1186
|
+
readonly pkg: OoxmlPackage;
|
|
1187
|
+
/** Null when the part could not be authored; the package then comes back unchanged. */
|
|
1188
|
+
readonly part: CustomXmlDataPart | null;
|
|
1348
1189
|
}
|
|
1349
|
-
/** Longest TOC field instruction read. Instructions come from a file; the parse is bounded. */
|
|
1350
|
-
declare const TOC_MAX_INSTRUCTION_CHARS = 256;
|
|
1351
|
-
/** Most entries one generated table of contents may hold. */
|
|
1352
|
-
declare const TOC_MAX_ENTRIES = 512;
|
|
1353
|
-
/** Most bookmarks minted during one TOC refresh. */
|
|
1354
|
-
declare const TOC_MAX_BOOKMARKS_PER_REFRESH = 512;
|
|
1355
|
-
/** Deepest nested field instruction followed. Caps recursion on file-supplied structure. */
|
|
1356
|
-
declare const TOC_MAX_FIELD_NESTING = 4;
|
|
1357
1190
|
/**
|
|
1358
|
-
*
|
|
1191
|
+
* Ensure the document carries a data part for this namespace, creating it and everything it
|
|
1192
|
+
* needs — properties, both relationships, the properties content type — when it does not.
|
|
1359
1193
|
*
|
|
1360
|
-
*
|
|
1361
|
-
*
|
|
1194
|
+
* Idempotent: a package that already has one for the namespace comes back untouched, so a
|
|
1195
|
+
* second node added to the same store does not author a second store.
|
|
1196
|
+
*
|
|
1197
|
+
* @param storyPartName - Whose relationships the store hangs off. Word enumerates its data
|
|
1198
|
+
* store from the MAIN DOCUMENT part, so a store authored off a header or footer is one Word
|
|
1199
|
+
* never sees.
|
|
1362
1200
|
*/
|
|
1363
|
-
declare
|
|
1201
|
+
declare function withCustomXmlDataPart(pkg: OoxmlPackage, storyPartName: string, namespaceUri: string, rootLocalName: string): CustomXmlDataPartResult;
|
|
1364
1202
|
/**
|
|
1365
|
-
*
|
|
1203
|
+
* Remove a store from a document: both parts, both relationships, the Override.
|
|
1366
1204
|
*
|
|
1367
|
-
*
|
|
1368
|
-
*
|
|
1205
|
+
* PACKAGE ONLY. It does not touch the body, so a `w:sdt` bound to the store keeps its
|
|
1206
|
+
* `w:dataBinding`, its `w:storeItemID` and its `w:tag`, and Word then opens a control bound to
|
|
1207
|
+
* a store that is not there. Stripping those is the export path's job and is not built; this
|
|
1208
|
+
* is the half that removes the payload, which is the half a caller can rely on.
|
|
1209
|
+
*
|
|
1210
|
+
* `ok: false` means nothing was removed and the package is unchanged — most often because an
|
|
1211
|
+
* owner's `.rels` was never parsed into a tree, which {@link withoutPart} refuses to work
|
|
1212
|
+
* around. A caller exporting a document has to treat that as a failure to export rather than
|
|
1213
|
+
* as a document with nothing to strip, or it ships the payload it meant to remove.
|
|
1369
1214
|
*/
|
|
1370
|
-
declare function
|
|
1215
|
+
declare function withoutCustomXmlDataPart(pkg: OoxmlPackage, storyPartName: string, namespaceUri: string): WithoutPartResult;
|
|
1371
1216
|
|
|
1372
|
-
/**
|
|
1373
|
-
interface
|
|
1374
|
-
/** Enclosing control id when it identifies one TOC, otherwise the begin fldChar id. */
|
|
1217
|
+
/** One node in a store: its id, the bound text, and the payload beside it. */
|
|
1218
|
+
interface CustomXmlNode {
|
|
1375
1219
|
readonly id: string;
|
|
1376
|
-
|
|
1377
|
-
readonly
|
|
1378
|
-
|
|
1379
|
-
readonly
|
|
1380
|
-
/** Direct parent whose paragraph children delimit the cached result. */
|
|
1381
|
-
readonly containerId: string;
|
|
1382
|
-
readonly contentControlId?: string;
|
|
1383
|
-
readonly instruction: TocInstruction;
|
|
1384
|
-
}
|
|
1385
|
-
/** Discover refreshable body TOCs without evaluating any field instruction. */
|
|
1386
|
-
declare function detectBodyTocs(part: OoxmlPart): readonly DetectedToc[];
|
|
1387
|
-
/** Locate the table of contents containing a position, or null. */
|
|
1388
|
-
declare function findDetectedToc(tocs: readonly DetectedToc[], tocId: string): DetectedToc | null;
|
|
1389
|
-
|
|
1390
|
-
/** One heading symbol: its `w:font` and `w:char`, as the file wrote them. */
|
|
1391
|
-
interface TocSymbol {
|
|
1392
|
-
readonly font: string | null;
|
|
1393
|
-
readonly char: string;
|
|
1220
|
+
/** Text a `w:dataBinding` resolves to. Untrusted file input. */
|
|
1221
|
+
readonly label: string;
|
|
1222
|
+
/** Payload as authored, JSON by convention and unparsed here. Untrusted file input. */
|
|
1223
|
+
readonly data: string;
|
|
1394
1224
|
}
|
|
1395
|
-
|
|
1396
|
-
declare
|
|
1397
|
-
|
|
1225
|
+
/** Every node a store holds, in document order. */
|
|
1226
|
+
declare function customXmlNodes(pkg: OoxmlPackage, partName: string): CustomXmlNode[];
|
|
1227
|
+
/** One node by id, or null. */
|
|
1228
|
+
declare function readCustomXmlNode(pkg: OoxmlPackage, partName: string, nodeId: string): CustomXmlNode | null;
|
|
1229
|
+
/**
|
|
1230
|
+
* Write a node, replacing one that already has the id.
|
|
1231
|
+
*
|
|
1232
|
+
* Replace rather than append: a second node with the same id makes the binding xpath ambiguous,
|
|
1233
|
+
* and Word resolves an ambiguous xpath to the first match — so an "update" that appended would
|
|
1234
|
+
* leave the control showing its old text forever.
|
|
1235
|
+
*/
|
|
1236
|
+
declare function withCustomXmlNode(pkg: OoxmlPackage, partName: string, node: CustomXmlNode): OoxmlPackage;
|
|
1237
|
+
/** Drop one node by id. A store that never held it comes back unchanged. */
|
|
1238
|
+
declare function withoutCustomXmlNode(pkg: OoxmlPackage, partName: string, nodeId: string): OoxmlPackage;
|
|
1239
|
+
/**
|
|
1240
|
+
* Drop every node no longer referenced, given the ids the document still binds.
|
|
1241
|
+
*
|
|
1242
|
+
* This is the whole deletion story. Deleting a control in THIS editor can remove its node
|
|
1243
|
+
* directly, but a control deleted in Word leaves the node behind — Word has no lifecycle link
|
|
1244
|
+
* between the two and no way to run our code. Reconciling against what the story actually binds
|
|
1245
|
+
* collects both, and is the only thing that can collect the second.
|
|
1246
|
+
*
|
|
1247
|
+
* Takes the referenced ids rather than reading the story itself: the caller already walked it,
|
|
1248
|
+
* and a sweep that guessed at which controls exist would delete a payload on a mistake.
|
|
1249
|
+
*/
|
|
1250
|
+
declare function withoutOrphanCustomXmlNodes(pkg: OoxmlPackage, partName: string, referencedIds: ReadonlySet<string>): {
|
|
1251
|
+
readonly pkg: OoxmlPackage;
|
|
1252
|
+
readonly removed: readonly string[];
|
|
1253
|
+
};
|
|
1398
1254
|
/**
|
|
1399
|
-
*
|
|
1400
|
-
*
|
|
1401
|
-
* The brand is intersection-typed onto `number`, so a `Twips` value still decays to `number`
|
|
1402
|
-
* wherever arithmetic consumes it; only the reverse direction — passing a raw number where
|
|
1403
|
-
* `Twips` is declared — is refused.
|
|
1255
|
+
* The `w:xpath` a binding uses to reach a node's label, or null when the id cannot be addressed.
|
|
1404
1256
|
*
|
|
1405
|
-
*
|
|
1257
|
+
* Word needs a prefix for the payload namespace even when the store declares it as a default —
|
|
1258
|
+
* an unprefixed step in an XPath means "no namespace", so `/docxEditor/node` would match
|
|
1259
|
+
* nothing in a namespaced store. The prefix is declared in `w:prefixMappings` beside it.
|
|
1406
1260
|
*/
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1261
|
+
declare function customXmlLabelXPath(prefix: string, rootLocalName: string, nodeId: string): string | null;
|
|
1262
|
+
/** The `w:prefixMappings` value declaring that prefix, or null when it cannot be written.
|
|
1263
|
+
* The namespace sits inside single quotes inside a double-quoted attribute, so a namespace
|
|
1264
|
+
* carrying either quote character has no representation here. */
|
|
1265
|
+
declare function customXmlPrefixMappings(prefix: string, namespaceUri: string): string | null;
|
|
1266
|
+
|
|
1267
|
+
/** The prefix every binding this library authors declares and quotes. */
|
|
1268
|
+
declare const CUSTOM_NODE_XPATH_PREFIX = "ns0";
|
|
1269
|
+
/** The three attributes a `w:dataBinding` carries. */
|
|
1270
|
+
interface CustomNodeBinding {
|
|
1271
|
+
readonly prefixMappings: string;
|
|
1272
|
+
readonly xpath: string;
|
|
1273
|
+
readonly storeItemId: string;
|
|
1274
|
+
}
|
|
1410
1275
|
/**
|
|
1411
|
-
*
|
|
1276
|
+
* The binding for one node in one store, or null when the id cannot be addressed by an XPath.
|
|
1412
1277
|
*
|
|
1413
|
-
*
|
|
1278
|
+
* Refuses rather than escapes: XPath 1.0 has no escape for a quote inside a literal, so an id
|
|
1279
|
+
* carrying one could close the predicate and append an expression of the sender's choosing.
|
|
1280
|
+
* The ids are minted by a host, so refusing is honest — see `ADDRESSABLE_ID`.
|
|
1414
1281
|
*/
|
|
1415
|
-
|
|
1416
|
-
readonly [POINTS]: true;
|
|
1417
|
-
};
|
|
1282
|
+
declare function customNodeBinding(part: CustomXmlDataPart, rootLocalName: string, nodeId: string): CustomNodeBinding | null;
|
|
1418
1283
|
/**
|
|
1419
|
-
*
|
|
1284
|
+
* Every node id the story's controls bind to in one store, in document order.
|
|
1420
1285
|
*
|
|
1421
|
-
*
|
|
1286
|
+
* This is the input the orphan sweep takes: a node whose id is not in here is one no control
|
|
1287
|
+
* names, whether it was deleted in this editor or in Word. Reading it from the STORY rather than
|
|
1288
|
+
* from a host's bookkeeping is what makes the two cases one mechanism.
|
|
1422
1289
|
*/
|
|
1423
|
-
declare
|
|
1290
|
+
declare function boundCustomXmlNodeIds(part: OoxmlPart, storeItemId: string): Set<string>;
|
|
1424
1291
|
/**
|
|
1425
|
-
*
|
|
1292
|
+
* Every node id ANY story in the package binds, in one store.
|
|
1426
1293
|
*
|
|
1427
|
-
*
|
|
1428
|
-
*
|
|
1429
|
-
*
|
|
1294
|
+
* THE WHOLE PACKAGE, not one story. A payload is reachable from a header as easily as from the
|
|
1295
|
+
* body — Word enumerates its data store from the main part, but nothing stops a control
|
|
1296
|
+
* elsewhere quoting the same `w:storeItemID` — and the two callers that decide what is an orphan
|
|
1297
|
+
* both destroy data when they are wrong. The sweep would collect a payload a header still paints;
|
|
1298
|
+
* the export would strip a store a header still names, which is a document Word offers to repair.
|
|
1430
1299
|
*
|
|
1431
|
-
*
|
|
1300
|
+
* Costs one walk per story per store, on open and on export. Neither is a keystroke.
|
|
1432
1301
|
*/
|
|
1433
|
-
declare
|
|
1302
|
+
declare function boundCustomXmlNodeIdsInPackage(pkg: OoxmlPackage, storeItemId: string): Set<string>;
|
|
1303
|
+
/** The node id one control binds to in the named store, or null when it binds to nothing there. */
|
|
1304
|
+
declare function boundCustomXmlNodeIdOf(control: OoxmlNode, storeItemId: string): string | null;
|
|
1305
|
+
|
|
1306
|
+
/** What happens to one control when the document is exported. */
|
|
1307
|
+
type CustomNodeExportPolicy = 'keep' | 'text' | 'remove';
|
|
1308
|
+
/** How {@link withExportedCustomNodes} decides, and which stores it may tidy afterwards. */
|
|
1309
|
+
interface CustomNodeExportRequest {
|
|
1310
|
+
/** The story whose controls are policed, and whose relationships the stores hang off. */
|
|
1311
|
+
readonly storyPartName: string;
|
|
1312
|
+
/**
|
|
1313
|
+
* Payload namespaces the caller CLAIMS.
|
|
1314
|
+
*
|
|
1315
|
+
* The store cleanup runs only over these. Word's own Cover Page Properties store rides in most
|
|
1316
|
+
* templates, and an export that tidied every customXml part would be deleting from documents it
|
|
1317
|
+
* was only asked to strip its own markup from.
|
|
1318
|
+
*/
|
|
1319
|
+
readonly namespaces: readonly string[];
|
|
1320
|
+
/** The fate of a control carrying this `w:tag`. A control with no tag is never touched. */
|
|
1321
|
+
readonly decide: (tag: string) => CustomNodeExportPolicy;
|
|
1322
|
+
}
|
|
1434
1323
|
/**
|
|
1435
|
-
*
|
|
1324
|
+
* The export, or the reason there is no export.
|
|
1436
1325
|
*
|
|
1437
|
-
*
|
|
1326
|
+
* A refusal answers no package on purpose. "Stripping failed, here is the document anyway" is the
|
|
1327
|
+
* one outcome that must not be possible: a caller would ship the markup it asked to remove and
|
|
1328
|
+
* have been told the export succeeded.
|
|
1438
1329
|
*/
|
|
1439
|
-
|
|
1330
|
+
type CustomNodeExportResult = {
|
|
1331
|
+
readonly ok: true;
|
|
1332
|
+
readonly pkg: OoxmlPackage;
|
|
1333
|
+
/** Controls unwrapped (`text`) and controls removed (`remove`). */
|
|
1334
|
+
readonly unwrapped: number;
|
|
1335
|
+
readonly removed: number;
|
|
1336
|
+
} | {
|
|
1337
|
+
readonly ok: false;
|
|
1338
|
+
readonly reason: string;
|
|
1339
|
+
};
|
|
1440
1340
|
/**
|
|
1441
|
-
*
|
|
1341
|
+
* Apply the policy, then take the payloads and the stores the policy orphaned.
|
|
1442
1342
|
*
|
|
1443
|
-
*
|
|
1343
|
+
* Order matters and is the reverse of the write's. The BODY goes first, so the sweep that follows
|
|
1344
|
+
* sees the controls that actually survive; the stores go last, once nothing binds them. Doing it
|
|
1345
|
+
* the other way would strip a store while a control still quoted its `w:storeItemID`, which is a
|
|
1346
|
+
* document Word opens and offers to repair.
|
|
1444
1347
|
*/
|
|
1445
|
-
declare
|
|
1348
|
+
declare function withExportedCustomNodes(pkg: OoxmlPackage, request: CustomNodeExportRequest): CustomNodeExportResult;
|
|
1349
|
+
|
|
1446
1350
|
/**
|
|
1447
|
-
*
|
|
1448
|
-
*
|
|
1449
|
-
* Rounds to the nearest twip: every OOXML twips measurement is integral, and emitting a
|
|
1450
|
-
* fractional twip would write a value no consumer of the file can represent.
|
|
1351
|
+
* Every kind of thing the registry gives a stable identity to.
|
|
1451
1352
|
*
|
|
1452
|
-
*
|
|
1353
|
+
* Identity is `(kind, id)` plus version and NEVER registration order, so two bundles contributing
|
|
1354
|
+
* the same command resolve deterministically regardless of which loaded first.
|
|
1453
1355
|
*/
|
|
1454
|
-
declare const
|
|
1356
|
+
declare const ID_KINDS: readonly ['extension', 'capability', 'command', 'query', 'schema', 'dependencyKey', 'runtimePort', 'result', 'origin'];
|
|
1357
|
+
/** One of {@link ID_KINDS}. */
|
|
1358
|
+
/** One of {@link ID_KINDS} — which sort of thing an identifier names. */
|
|
1359
|
+
type IdKind = (typeof ID_KINDS)[number];
|
|
1455
1360
|
/**
|
|
1456
|
-
*
|
|
1457
|
-
* as a whole, signed number of twips, or `null` when the value is not a measurement.
|
|
1458
|
-
*
|
|
1459
|
-
* The schema allows an integer or a universal measure, but files also carry decimal twips
|
|
1460
|
-
* (`4743.74`, `708.0`, `707.9999999999998`). The accepted forms read as follows:
|
|
1461
|
-
*
|
|
1462
|
-
* - A decimal truncates toward zero: `1443.74` is 1443 and `-720.6` is -720. A leading `+`,
|
|
1463
|
-
* leading zeros, a bare fraction (`.5`) and a trailing point (`1440.`) are accepted.
|
|
1464
|
-
* - A universal measure (`mm`, `cm`, `in`, `pt`, `pc`, `pi`) converts exactly and then
|
|
1465
|
-
* truncates: `1.27cm` is 720 and `0.333in` is 479. Its sign is ignored, so `-0.5in` is 720.
|
|
1466
|
-
* - Whitespace, exponents, hexadecimal, uppercase units, and an integer part longer than nine
|
|
1467
|
-
* digits are not measurements.
|
|
1361
|
+
* Whether a string is a well-formed identifier in either accepted grammar.
|
|
1468
1362
|
*
|
|
1469
|
-
*
|
|
1470
|
-
*
|
|
1363
|
+
* Reverse-domain (`dev.docx-editor.core.command.insert-text`) or package-owned
|
|
1364
|
+
* (`@docx-editor.dev/engine-core#command/insert-text`). Ids are opaque once validated.
|
|
1365
|
+
*/
|
|
1366
|
+
declare function isValidId(id: string): boolean;
|
|
1367
|
+
/**
|
|
1368
|
+
* Validate an identifier, throwing when it is malformed.
|
|
1471
1369
|
*
|
|
1472
|
-
*
|
|
1370
|
+
* Throws rather than returning: a bad id is an author mistake at registration time, not file
|
|
1371
|
+
* input, and accepting it would produce a registry whose identities silently collide.
|
|
1473
1372
|
*/
|
|
1474
|
-
declare function
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
readonly
|
|
1479
|
-
readonly
|
|
1480
|
-
readonly blockId: string;
|
|
1373
|
+
declare function assertValidId(id: string, kind?: IdKind): void;
|
|
1374
|
+
/** A validated (kind, id, version) triple — the registry's unit of identity. */
|
|
1375
|
+
interface CapabilityId {
|
|
1376
|
+
readonly kind: IdKind;
|
|
1377
|
+
readonly id: string;
|
|
1378
|
+
readonly version: string;
|
|
1481
1379
|
}
|
|
1482
1380
|
|
|
1483
|
-
/**
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
interface TocEntryPlan {
|
|
1489
|
-
readonly level: number;
|
|
1490
|
-
readonly text: string;
|
|
1491
|
-
readonly headingParagraphId: string;
|
|
1492
|
-
readonly bookmarkName: string;
|
|
1493
|
-
readonly pageNumberText: string;
|
|
1494
|
-
/** The heading's symbols, one per {@link TOC_SYMBOL_MARK} in `text`, in order. */
|
|
1495
|
-
readonly symbols?: readonly TocSymbol[];
|
|
1381
|
+
/** A parsed semantic version. Only the three numeric components — no pre-release or build. */
|
|
1382
|
+
interface SemVer {
|
|
1383
|
+
readonly major: number;
|
|
1384
|
+
readonly minor: number;
|
|
1385
|
+
readonly patch: number;
|
|
1496
1386
|
}
|
|
1497
|
-
/** Build one TOC entry paragraph node. */
|
|
1498
|
-
declare function buildTocEntryParagraph(mint: () => string, entry: TocEntryPlan, instruction: TocInstruction, paragraphPropertiesTemplate?: OoxmlNode): OoxmlNode;
|
|
1499
|
-
/** Build an SDT-wrapped complex TOC field with an already planned cached result. */
|
|
1500
|
-
declare function buildTocContentControl(mint: () => string, entries: readonly TocEntryPlan[], instruction: TocInstruction, alias: string): OoxmlNode;
|
|
1501
1387
|
/**
|
|
1502
|
-
*
|
|
1503
|
-
*
|
|
1504
|
-
*
|
|
1388
|
+
* Parse a semantic version, rejecting anything the registry's rules do not need.
|
|
1389
|
+
*
|
|
1390
|
+
* Deliberately narrow: an unsupported range form is refused rather than accepted, so a malformed
|
|
1391
|
+
* range can never masquerade as "compatible".
|
|
1505
1392
|
*/
|
|
1506
|
-
declare function
|
|
1393
|
+
declare function parseSemVer(input: string): SemVer;
|
|
1394
|
+
/** Order two versions: negative, zero or positive, by major then minor then patch. */
|
|
1395
|
+
declare function compareSemVer(a: SemVer, b: SemVer): -1 | 0 | 1;
|
|
1507
1396
|
/**
|
|
1508
|
-
*
|
|
1397
|
+
* Whether `version` satisfies `range`. Supported range grammar:
|
|
1398
|
+
* - `*` any version
|
|
1399
|
+
* - `1.2.3` exact
|
|
1400
|
+
* - `^1.2.3` caret: same major, and >= the floor (major 0 pins the minor)
|
|
1401
|
+
* - `>=1.2.3 <2.0.0` a single lower (inclusive) + upper (exclusive) bound pair
|
|
1402
|
+
* Any other shape throws — an unparseable range is a registration error, not a pass.
|
|
1403
|
+
*/
|
|
1404
|
+
declare function satisfies(version: string, range: string): boolean;
|
|
1405
|
+
|
|
1406
|
+
/**
|
|
1407
|
+
* Why registry resolution failed.
|
|
1509
1408
|
*
|
|
1510
|
-
*
|
|
1511
|
-
*
|
|
1512
|
-
* identity pass it here. `resolveAllocationActor` still honours a
|
|
1513
|
-
* `runWithTransactionActor` wrap when the caller prefers that seam.
|
|
1409
|
+
* Every code names a declaration conflict a bundle author can fix — a missing dependency, an
|
|
1410
|
+
* unsatisfied version range, a duplicate contribution with no replacement policy.
|
|
1514
1411
|
*/
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
declare
|
|
1524
|
-
readonly
|
|
1525
|
-
|
|
1412
|
+
type RegistryErrorCode = 'invalid-id' | 'invalid-version' | 'duplicate-extension' | 'id-collision' | 'replacement-target-missing' | 'unauthorized-replacement' | 'replacement-version-mismatch' | 'ambiguous-replacement' | 'missing-dependency' | 'dependency-cycle' | 'conflict' | 'missing-port';
|
|
1413
|
+
/**
|
|
1414
|
+
* A resolution failure naming every responsible party.
|
|
1415
|
+
*
|
|
1416
|
+
* Thrown rather than returned: an unresolvable registry is a build-time composition mistake, and
|
|
1417
|
+
* an engine running with a half-resolved registry would fail later in ways that do not point back
|
|
1418
|
+
* to the bundle that caused it.
|
|
1419
|
+
*/
|
|
1420
|
+
declare class RegistryError extends Error {
|
|
1421
|
+
readonly code: RegistryErrorCode;
|
|
1422
|
+
/** Stable identities responsible for the failure (extensions, ids). */
|
|
1423
|
+
readonly responsible: readonly string[];
|
|
1424
|
+
constructor(code: RegistryErrorCode, message: string,
|
|
1425
|
+
/** Stable identities responsible for the failure (extensions, ids). */
|
|
1426
|
+
responsible?: readonly string[]);
|
|
1427
|
+
}
|
|
1428
|
+
/** How a base contribution permits replacement by other bundles. */
|
|
1429
|
+
type ReplacementPolicy = {
|
|
1430
|
+
readonly kind: 'none';
|
|
1431
|
+
} | {
|
|
1432
|
+
readonly kind: 'single';
|
|
1433
|
+
} | {
|
|
1434
|
+
readonly kind: 'priority';
|
|
1526
1435
|
};
|
|
1527
|
-
|
|
1436
|
+
/** One thing a bundle contributes: a command, a query, a schema, a port, keyed by `(kind, id)`. */
|
|
1437
|
+
interface Contribution {
|
|
1438
|
+
readonly kind: Exclude<IdKind, 'extension' | 'origin' | 'result'>;
|
|
1439
|
+
readonly id: string;
|
|
1440
|
+
readonly version: string;
|
|
1441
|
+
/** If set, this contribution replaces an existing base contribution. */
|
|
1442
|
+
readonly replaces?: {
|
|
1443
|
+
readonly targetId: string;
|
|
1444
|
+
readonly targetRange: string;
|
|
1445
|
+
readonly priority?: number;
|
|
1446
|
+
};
|
|
1447
|
+
/** Policy this contribution exposes to would-be replacers (default `none`). */
|
|
1448
|
+
readonly replaceable?: ReplacementPolicy;
|
|
1449
|
+
readonly payload?: unknown;
|
|
1450
|
+
}
|
|
1528
1451
|
/**
|
|
1529
|
-
*
|
|
1452
|
+
* A unit of engine functionality: its identity, version, dependencies, conflicts, required ports,
|
|
1453
|
+
* and contributions.
|
|
1530
1454
|
*
|
|
1531
|
-
*
|
|
1532
|
-
*
|
|
1533
|
-
* writing another row's number into them.
|
|
1455
|
+
* The registry's whole input. Everything a bundle needs and everything it offers is DECLARED, so
|
|
1456
|
+
* resolution can be deterministic and order-independent.
|
|
1534
1457
|
*/
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
readonly
|
|
1541
|
-
|
|
1542
|
-
readonly ordinal: number;
|
|
1543
|
-
/** Concatenated text content, with tabs and breaks mapped as the model reads them. */
|
|
1544
|
-
readonly text: string;
|
|
1545
|
-
/** Node ids of the paragraph's runs, in order. */
|
|
1546
|
-
readonly runIds: readonly string[];
|
|
1458
|
+
interface FeatureBundle {
|
|
1459
|
+
readonly id: string;
|
|
1460
|
+
readonly version: string;
|
|
1461
|
+
readonly dependencies?: readonly string[];
|
|
1462
|
+
readonly conflicts?: readonly string[];
|
|
1463
|
+
readonly requiredPorts?: readonly string[];
|
|
1464
|
+
readonly contributions: readonly Contribution[];
|
|
1547
1465
|
}
|
|
1548
|
-
/**
|
|
1549
|
-
interface
|
|
1550
|
-
|
|
1551
|
-
readonly
|
|
1552
|
-
|
|
1553
|
-
readonly rootId: string;
|
|
1554
|
-
readonly paragraphs: readonly ParagraphIndexEntry[];
|
|
1466
|
+
/** The resolved result: every contribution selected, indexed by `(kind, id)`. */
|
|
1467
|
+
interface ResolvedRegistry {
|
|
1468
|
+
readonly extensions: ReadonlyMap<string, FeatureBundle>;
|
|
1469
|
+
readonly contributions: ReadonlyMap<string, Contribution>;
|
|
1470
|
+
get(kind: Contribution['kind'], id: string): Contribution | undefined;
|
|
1555
1471
|
}
|
|
1556
|
-
/**
|
|
1557
|
-
interface
|
|
1558
|
-
|
|
1559
|
-
readonly
|
|
1560
|
-
readonly nodeId: string;
|
|
1561
|
-
readonly name: string | null;
|
|
1562
|
-
readonly basedOn: string | null;
|
|
1563
|
-
/** Whether the part marks this the default style for its type (`w:default="1"`). */
|
|
1564
|
-
readonly isDefault: boolean;
|
|
1472
|
+
/** How resolution treats optional bundles and replacement policies. */
|
|
1473
|
+
interface ResolveOptions {
|
|
1474
|
+
/** Runtime port ids available in this environment (design D9 / task 0.3). */
|
|
1475
|
+
readonly availablePorts?: readonly string[];
|
|
1565
1476
|
}
|
|
1566
1477
|
/**
|
|
1567
|
-
*
|
|
1478
|
+
* Resolve a set of bundles into one registry, or throw.
|
|
1568
1479
|
*
|
|
1569
|
-
*
|
|
1570
|
-
*
|
|
1480
|
+
* Deterministic and registration-order independent: selection is by `(kind, id)` plus version,
|
|
1481
|
+
* and ties break only on declared policy. Array order never decides anything.
|
|
1482
|
+
*
|
|
1483
|
+
* @throws RegistryError naming every bundle responsible for the failure.
|
|
1571
1484
|
*/
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
readonly revision: number;
|
|
1575
|
-
/** Body story first, then any other story parts, keyed by part name. */
|
|
1576
|
-
readonly stories: ReadonlyMap<string, StoryIndexEntry>;
|
|
1577
|
-
/** Every paragraph across every story, keyed by node id. */
|
|
1578
|
-
readonly paragraphs: ReadonlyMap<string, ParagraphIndexEntry>;
|
|
1579
|
-
readonly relationships: ReadonlyMap<string, readonly RelationshipRecord[]>;
|
|
1580
|
-
readonly styles: ReadonlyMap<string, StyleIndexEntry>;
|
|
1581
|
-
}
|
|
1582
|
-
/** Style definitions, read out of the generic `w:styles` tree. */
|
|
1583
|
-
declare function indexStyles(part: OoxmlPart | undefined): Map<string, StyleIndexEntry>;
|
|
1584
|
-
/** The package's style definitions part, if it has one. */
|
|
1585
|
-
declare function stylesPartOf(pkg: OoxmlPackage): OoxmlPart | undefined;
|
|
1485
|
+
declare function resolve(bundles: readonly FeatureBundle[], options?: ResolveOptions): ResolvedRegistry;
|
|
1486
|
+
|
|
1586
1487
|
/**
|
|
1587
|
-
*
|
|
1588
|
-
*
|
|
1589
|
-
*
|
|
1590
|
-
* "rebuild rather than mutate" a safe invalidation strategy.
|
|
1488
|
+
* Typed-origin domains (design D5 / ADR-S5). `mutation.*` are the canonical
|
|
1489
|
+
* write origins; `projection` and `awareness` MUST NOT enter history, audit,
|
|
1490
|
+
* snapshots, or replication.
|
|
1591
1491
|
*/
|
|
1592
|
-
declare
|
|
1492
|
+
declare const ORIGIN_IDS: {
|
|
1493
|
+
readonly mutationHuman: "dev.docx-editor.core.origin.mutation.human";
|
|
1494
|
+
readonly mutationAgent: "dev.docx-editor.core.origin.mutation.agent";
|
|
1495
|
+
readonly mutationRemote: "dev.docx-editor.core.origin.mutation.remote";
|
|
1496
|
+
readonly mutationUndo: "dev.docx-editor.core.origin.mutation.undo";
|
|
1497
|
+
readonly mutationRedo: "dev.docx-editor.core.origin.mutation.redo";
|
|
1498
|
+
readonly mutationMigration: "dev.docx-editor.core.origin.mutation.migration";
|
|
1499
|
+
readonly mutationRepair: "dev.docx-editor.core.origin.mutation.repair";
|
|
1500
|
+
readonly mutationServer: "dev.docx-editor.core.origin.mutation.server";
|
|
1501
|
+
readonly projection: "dev.docx-editor.core.origin.projection";
|
|
1502
|
+
readonly awareness: "dev.docx-editor.core.origin.awareness";
|
|
1503
|
+
};
|
|
1504
|
+
/** Canonical writes carry a mutation origin; these are the undoable-eligibility inputs. */
|
|
1505
|
+
declare const CANONICAL_MUTATION_ORIGINS: readonly string[];
|
|
1506
|
+
/** Origins that never enter authored state / history / audit / snapshot / replication. */
|
|
1507
|
+
declare const NON_CANONICAL_ORIGINS: readonly string[];
|
|
1508
|
+
/**
|
|
1509
|
+
* Result taxonomy (design D8 / task 7.8). A transport/protocol failure that
|
|
1510
|
+
* prevents a valid envelope is a typed exception, not a member here.
|
|
1511
|
+
*/
|
|
1512
|
+
declare const RESULT_IDS: {
|
|
1513
|
+
readonly applied: "dev.docx-editor.core.result.applied";
|
|
1514
|
+
readonly validation: "dev.docx-editor.core.result.validation";
|
|
1515
|
+
readonly conflict: "dev.docx-editor.core.result.conflict";
|
|
1516
|
+
readonly resource: "dev.docx-editor.core.result.resource";
|
|
1517
|
+
readonly authorization: "dev.docx-editor.core.result.authorization";
|
|
1518
|
+
readonly aborted: "dev.docx-editor.core.result.aborted";
|
|
1519
|
+
};
|
|
1520
|
+
/** Runtime ports (extensions-and-runtime-ports spec; design D9). */
|
|
1521
|
+
declare const RUNTIME_PORT_IDS: {
|
|
1522
|
+
readonly fonts: "dev.docx-editor.core.port.fonts";
|
|
1523
|
+
readonly shaping: "dev.docx-editor.core.port.shaping";
|
|
1524
|
+
readonly images: "dev.docx-editor.core.port.images";
|
|
1525
|
+
readonly clock: "dev.docx-editor.core.port.clock";
|
|
1526
|
+
readonly identity: "dev.docx-editor.core.port.identity";
|
|
1527
|
+
readonly persistence: "dev.docx-editor.core.port.persistence";
|
|
1528
|
+
readonly transport: "dev.docx-editor.core.port.transport";
|
|
1529
|
+
readonly scheduling: "dev.docx-editor.core.port.scheduling";
|
|
1530
|
+
readonly audit: "dev.docx-editor.core.port.audit";
|
|
1531
|
+
readonly authorization: "dev.docx-editor.core.port.authorization";
|
|
1532
|
+
readonly resourceAccounting: "dev.docx-editor.core.port.resource-accounting";
|
|
1533
|
+
readonly cancellation: "dev.docx-editor.core.port.cancellation";
|
|
1534
|
+
readonly externalResourceConsent: "dev.docx-editor.core.port.external-resource-consent";
|
|
1535
|
+
};
|
|
1536
|
+
/** Layout dependency keys (design D6 / task 8.2). */
|
|
1537
|
+
declare const DEPENDENCY_KEY_IDS: {
|
|
1538
|
+
readonly style: "dev.docx-editor.core.dep.style";
|
|
1539
|
+
readonly numbering: "dev.docx-editor.core.dep.numbering";
|
|
1540
|
+
readonly section: "dev.docx-editor.core.dep.section";
|
|
1541
|
+
readonly story: "dev.docx-editor.core.dep.story";
|
|
1542
|
+
readonly font: "dev.docx-editor.core.dep.font";
|
|
1543
|
+
readonly image: "dev.docx-editor.core.dep.image";
|
|
1544
|
+
readonly table: "dev.docx-editor.core.dep.table";
|
|
1545
|
+
readonly field: "dev.docx-editor.core.dep.field";
|
|
1546
|
+
readonly note: "dev.docx-editor.core.dep.note";
|
|
1547
|
+
readonly headerFooter: "dev.docx-editor.core.dep.header-footer";
|
|
1548
|
+
readonly annotation: "dev.docx-editor.core.dep.annotation";
|
|
1549
|
+
};
|
|
1550
|
+
/** Every frozen id as a flat list, for the immutability / uniqueness gate. */
|
|
1551
|
+
declare const ALL_FROZEN_IDS: readonly string[];
|
|
1593
1552
|
|
|
1594
|
-
/** One paragraph's meaning, independent of how it was spelled in XML. */
|
|
1595
|
-
interface ParagraphDigest {
|
|
1596
|
-
/** Ordinal identity within its story. Node ids are NOT used: a reopened package
|
|
1597
|
-
* legitimately re-derives them, and requiring them to match would test the id scheme
|
|
1598
|
-
* rather than the content. */
|
|
1599
|
-
readonly ordinal: number;
|
|
1600
|
-
/**
|
|
1601
|
-
* Where the paragraph SITS: the element path from the story root, so a paragraph that
|
|
1602
|
-
* moves out of the table cell it was written in is a difference rather than a paragraph
|
|
1603
|
-
* with the same ordinal and the same text.
|
|
1604
|
-
*/
|
|
1605
|
-
readonly path: string;
|
|
1606
|
-
/**
|
|
1607
|
-
* `w14:paraId`, uppercase-normalized (matching is case-insensitive), or null. This is
|
|
1608
|
-
* MANAGED identity — the agent contract anchors on it and comment threading references
|
|
1609
|
-
* it — so a serializer silently dropping it must be a digest difference. Other paragraph
|
|
1610
|
-
* attributes (`w:rsidR` …) stay deliberately undigested: they are revision noise.
|
|
1611
|
-
*/
|
|
1612
|
-
readonly paraId: string | null;
|
|
1613
|
-
/** Text content, including tabs and hard breaks as their characters. */
|
|
1614
|
-
readonly text: string;
|
|
1615
|
-
/** Accepted paragraph properties, as sorted tokens including nested children. */
|
|
1616
|
-
readonly paragraphProperties: readonly string[];
|
|
1617
|
-
/** Per-run accepted properties, in run order. */
|
|
1618
|
-
readonly runProperties: readonly (readonly string[])[];
|
|
1619
|
-
/** Fingerprints of every generic (unknown) subtree, in document order. */
|
|
1620
|
-
readonly genericStructure: readonly string[];
|
|
1621
|
-
}
|
|
1622
|
-
/** One story reduced to its semantic content, ignoring everything a normalized re-emit changes. */
|
|
1623
|
-
interface StoryDigest {
|
|
1624
|
-
readonly partName: string;
|
|
1625
|
-
readonly paragraphs: readonly ParagraphDigest[];
|
|
1626
|
-
/**
|
|
1627
|
-
* Every block-level element of the part OUTSIDE a paragraph, in document order, as
|
|
1628
|
-
* `path name(attributes)` — the tables, rows, cells, sections, content controls and
|
|
1629
|
-
* their property children, each at the position that says what contains it.
|
|
1630
|
-
*
|
|
1631
|
-
* A paragraph's own internals are not here (they are its `ParagraphDigest`), which keeps
|
|
1632
|
-
* this list proportional to a document's STRUCTURE rather than its text.
|
|
1633
|
-
*/
|
|
1634
|
-
readonly structure: readonly string[];
|
|
1635
|
-
}
|
|
1636
1553
|
/**
|
|
1637
|
-
*
|
|
1554
|
+
* A counter's limit was reached. Carries the label, the limit, and what was attempted.
|
|
1638
1555
|
*
|
|
1639
|
-
*
|
|
1640
|
-
*
|
|
1556
|
+
* Thrown at the N → N+1 boundary, so the increment that would have crossed the limit never
|
|
1557
|
+
* happens rather than being detected afterwards.
|
|
1641
1558
|
*/
|
|
1642
|
-
|
|
1643
|
-
readonly
|
|
1559
|
+
declare class LimitExceededError extends Error {
|
|
1560
|
+
readonly label: string;
|
|
1561
|
+
readonly limit: number;
|
|
1562
|
+
readonly attempted: number;
|
|
1563
|
+
constructor(label: string, limit: number, attempted: number);
|
|
1644
1564
|
}
|
|
1645
|
-
/** Where two digests diverge — the diagnostic when a round-trip loses something. */
|
|
1646
|
-
type DigestDifference = {
|
|
1647
|
-
readonly path: string;
|
|
1648
|
-
readonly before: string;
|
|
1649
|
-
readonly after: string;
|
|
1650
|
-
};
|
|
1651
|
-
/** Digest one part: its paragraphs, and the structure that holds them. */
|
|
1652
|
-
declare function digestPart(part: OoxmlPart): StoryDigest | null;
|
|
1653
|
-
/** Digest every part, in the given order. */
|
|
1654
|
-
declare function semanticDigest(parts: Iterable<OoxmlPart>): SemanticDigest;
|
|
1655
1565
|
/**
|
|
1656
|
-
*
|
|
1566
|
+
* Overflow-safe counting against a fixed limit.
|
|
1657
1567
|
*
|
|
1658
|
-
*
|
|
1659
|
-
*
|
|
1660
|
-
* and a
|
|
1568
|
+
* Never silently wraps: it rejects the increment that would cross its limit AND any arithmetic
|
|
1569
|
+
* that would exceed `Number.MAX_SAFE_INTEGER`. That second guard is the point — a file-supplied
|
|
1570
|
+
* count must never be trusted into an allocation, and a wrapped counter reads as small.
|
|
1661
1571
|
*/
|
|
1662
|
-
declare
|
|
1572
|
+
declare class BoundedCounter {
|
|
1573
|
+
readonly label: string;
|
|
1574
|
+
readonly limit: number;
|
|
1575
|
+
private value;
|
|
1576
|
+
constructor(label: string, limit: number);
|
|
1577
|
+
get current(): number;
|
|
1578
|
+
/** Remaining headroom before the limit. */
|
|
1579
|
+
get remaining(): number;
|
|
1580
|
+
/**
|
|
1581
|
+
* Add `n` (default 1). Throws LimitExceededError if the result would exceed the
|
|
1582
|
+
* limit (so `limit` itself is reachable but `limit + 1` is not) or overflow the
|
|
1583
|
+
* safe-integer range. On rejection the counter is unchanged.
|
|
1584
|
+
*/
|
|
1585
|
+
add(n?: number): number;
|
|
1586
|
+
/** Whether adding `n` would be accepted, without mutating. */
|
|
1587
|
+
canAdd(n?: number): boolean;
|
|
1588
|
+
release(n: number): void;
|
|
1589
|
+
}
|
|
1663
1590
|
|
|
1664
|
-
/**
|
|
1665
|
-
declare
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
/** FNV-1a over UTF-16 code units — the deterministic mint every id derivation shares. */
|
|
1669
|
-
declare function fnv1a32(value: string): number;
|
|
1670
|
-
/**
|
|
1671
|
-
* Deterministic 8-hex mint in (0x00000000, 0x80000000), collision-free against
|
|
1672
|
-
* `used` (uppercase hex). Same seed + same used-set → same value, which is what
|
|
1673
|
-
* keeps `splitParagraphMany` byte-identical to its equivalent single splits and
|
|
1674
|
-
* a reopened save identical to the session that produced it.
|
|
1675
|
-
*/
|
|
1676
|
-
declare function mintParaId(seed: string, used: ReadonlySet<string>): string;
|
|
1677
|
-
/** Every valid `w14:paraId` in the tree, uppercased. Memoized per root object. */
|
|
1678
|
-
declare function usedParaIds(root: OoxmlElement): ReadonlySet<string>;
|
|
1591
|
+
/** A budget was misused: over-carved, over-reserved, or disposed with children outstanding. */
|
|
1592
|
+
declare class BudgetError extends Error {
|
|
1593
|
+
constructor(message: string);
|
|
1594
|
+
}
|
|
1679
1595
|
/**
|
|
1680
|
-
*
|
|
1596
|
+
* Capacity claimed BEFORE it is allocated.
|
|
1681
1597
|
*
|
|
1682
|
-
*
|
|
1683
|
-
*
|
|
1684
|
-
* Only the root binding counts: a binding authored on some descendant does not
|
|
1685
|
-
* cover paragraphs elsewhere in the tree.
|
|
1598
|
+
* Reserve-then-allocate rather than allocate-then-check: discovering the overrun after the
|
|
1599
|
+
* allocation has already happened defeats the point of having a budget.
|
|
1686
1600
|
*/
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1601
|
+
interface Reservation {
|
|
1602
|
+
readonly amount: number;
|
|
1603
|
+
readonly released: boolean;
|
|
1604
|
+
release(): void;
|
|
1605
|
+
}
|
|
1690
1606
|
/**
|
|
1691
|
-
*
|
|
1692
|
-
*
|
|
1693
|
-
* Keeps every valid, first-seen paraId verbatim; mints (deterministically, seeded
|
|
1694
|
-
* by the paragraph's structural node id) for paragraphs whose id is missing,
|
|
1695
|
-
* malformed, zero, out of range, or a duplicate. Adds the root `xmlns` binding
|
|
1696
|
-
* the minted attributes need. Returns the INPUT PART REFERENCE when there is
|
|
1697
|
-
* nothing to do — a document Word saved yesterday re-serializes byte-identical.
|
|
1607
|
+
* One node in the hierarchical resource budget tree.
|
|
1698
1608
|
*
|
|
1699
|
-
*
|
|
1700
|
-
*
|
|
1609
|
+
* An operation owns a root budget; parsers, extensions, workers, layout, transport and output
|
|
1610
|
+
* carve children from it, so no subsystem can consume more than the operation as a whole allows.
|
|
1701
1611
|
*
|
|
1702
|
-
*
|
|
1703
|
-
*
|
|
1704
|
-
*
|
|
1612
|
+
* `dispose()` REFUSES while children or reservations are outstanding, then runs registered
|
|
1613
|
+
* cleanups LIFO — spill files, worker termination — even if one throws. A leaked child budget is a
|
|
1614
|
+
* leaked worker, so the refusal is the diagnostic.
|
|
1705
1615
|
*/
|
|
1706
|
-
declare
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1616
|
+
declare class Budget {
|
|
1617
|
+
readonly label: string;
|
|
1618
|
+
readonly capacity: number;
|
|
1619
|
+
private readonly used;
|
|
1620
|
+
private readonly children;
|
|
1621
|
+
private activeReservations;
|
|
1622
|
+
private readonly cleanups;
|
|
1623
|
+
private disposed;
|
|
1624
|
+
private carveAmount;
|
|
1625
|
+
private parent?;
|
|
1626
|
+
constructor(label: string, capacity: number);
|
|
1627
|
+
get inUse(): number;
|
|
1628
|
+
get available(): number;
|
|
1629
|
+
get isDisposed(): boolean;
|
|
1630
|
+
/** Reserve `amount` from this budget. Throws if it would exceed capacity. */
|
|
1631
|
+
reserve(amount: number): Reservation;
|
|
1632
|
+
/** Carve a child budget of `capacity` out of this budget's headroom. */
|
|
1633
|
+
child(label: string, capacity: number): Budget;
|
|
1634
|
+
/** Register cleanup for a spill file, worker, or queue tied to this budget. */
|
|
1635
|
+
onRelease(cleanup: () => void): void;
|
|
1636
|
+
/**
|
|
1637
|
+
* Release this budget. Refuses while any child budget or reservation is
|
|
1638
|
+
* outstanding (children must finish first). Runs cleanups LIFO, returns the
|
|
1639
|
+
* carve-out to the parent, and marks disposed. Cleanup errors are collected and
|
|
1640
|
+
* rethrown after every cleanup has run.
|
|
1641
|
+
*/
|
|
1642
|
+
dispose(): void;
|
|
1643
|
+
private assertLive;
|
|
1718
1644
|
}
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1645
|
+
|
|
1646
|
+
/**
|
|
1647
|
+
* Which side of the point of no return an operation is on.
|
|
1648
|
+
*
|
|
1649
|
+
* Canonical publication is that point. Cancelling BEFORE it rolls the whole operation back;
|
|
1650
|
+
* cancelling after it leaves the commit standing and cancels only derived work — layout, export,
|
|
1651
|
+
* caches.
|
|
1652
|
+
*/
|
|
1653
|
+
type CancellationPhase = 'pre-publication' | 'post-publication';
|
|
1654
|
+
/** Thrown from a `checkpoint()` when the operation has been cancelled. */
|
|
1655
|
+
declare class CancellationError extends Error {
|
|
1656
|
+
/** True when the commit is already published and only derived work is cancelled. */
|
|
1657
|
+
readonly derivedOnly: boolean;
|
|
1658
|
+
constructor(
|
|
1659
|
+
/** True when the commit is already published and only derived work is cancelled. */
|
|
1660
|
+
derivedOnly: boolean, reason?: string);
|
|
1723
1661
|
}
|
|
1724
|
-
/** The glossary part, through the main part's relationship or the conventional name. */
|
|
1725
|
-
declare function glossaryPartOf(pkg: OoxmlPackage): OoxmlPart | null;
|
|
1726
|
-
/** Every named building block of the glossary, in authored order. Empty without a glossary. */
|
|
1727
|
-
declare function buildingBlocksOf(pkg: OoxmlPackage): readonly BuildingBlock[];
|
|
1728
|
-
/** The gallery a `w:docPartList` control lists, or null for any other control. */
|
|
1729
|
-
declare function buildingBlockGalleryOf(control: OoxmlNode): BuildingBlockGalleryFilter | null;
|
|
1730
1662
|
/**
|
|
1731
|
-
* The
|
|
1732
|
-
*
|
|
1663
|
+
* The read side of cancellation, handed to cooperative work.
|
|
1664
|
+
*
|
|
1665
|
+
* Cooperative rather than pre-emptive: long work calls `checkpoint()` at declared intervals, which
|
|
1666
|
+
* is what lets an operation unwind promptly without the engine having to interrupt it mid-mutation.
|
|
1733
1667
|
*/
|
|
1734
|
-
|
|
1735
|
-
|
|
1668
|
+
interface CancellationToken {
|
|
1669
|
+
readonly isCancelled: boolean;
|
|
1670
|
+
readonly phase: CancellationPhase;
|
|
1671
|
+
/** True only when cancelled AND the commit is already published. */
|
|
1672
|
+
readonly derivedOnly: boolean;
|
|
1673
|
+
/** Throws CancellationError if cancelled; call at declared checkpoint intervals. */
|
|
1674
|
+
checkpoint(): void;
|
|
1675
|
+
}
|
|
1736
1676
|
/**
|
|
1737
|
-
*
|
|
1677
|
+
* The write side of cancellation, and the owner of the phase.
|
|
1738
1678
|
*
|
|
1739
|
-
*
|
|
1679
|
+
* Whoever starts an operation holds this; everything it calls gets only the token.
|
|
1740
1680
|
*/
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1681
|
+
declare class CancellationController {
|
|
1682
|
+
private _cancelled;
|
|
1683
|
+
private _phase;
|
|
1684
|
+
private _reason?;
|
|
1685
|
+
cancel(reason?: string): void;
|
|
1686
|
+
/** Mark canonical publication — the point of no return. */
|
|
1687
|
+
markPublished(): void;
|
|
1688
|
+
get isCancelled(): boolean;
|
|
1689
|
+
get phase(): CancellationPhase;
|
|
1690
|
+
get isPublished(): boolean;
|
|
1691
|
+
/** Cancelled after publication -> full rollback is no longer possible. */
|
|
1692
|
+
get derivedOnly(): boolean;
|
|
1693
|
+
get token(): CancellationToken;
|
|
1749
1694
|
}
|
|
1750
1695
|
|
|
1696
|
+
/** Injectable time source — the engine never calls Date.now directly (determinism). */
|
|
1697
|
+
interface ClockPort {
|
|
1698
|
+
now(): number;
|
|
1699
|
+
}
|
|
1700
|
+
/** Stable id minting for sessions, commits, and allocator seeds. */
|
|
1701
|
+
interface IdentityPort {
|
|
1702
|
+
newId(): string;
|
|
1703
|
+
}
|
|
1704
|
+
/** Cooperative scheduling of deferred work. */
|
|
1705
|
+
interface SchedulingPort {
|
|
1706
|
+
schedule(task: () => void): void;
|
|
1707
|
+
}
|
|
1708
|
+
/** Redacted observability sink (raw text never enters here — design D5). */
|
|
1709
|
+
interface AuditPort {
|
|
1710
|
+
record(entry: {
|
|
1711
|
+
readonly kind: string;
|
|
1712
|
+
readonly at: number;
|
|
1713
|
+
readonly meta?: Record<string, unknown>;
|
|
1714
|
+
}): void;
|
|
1715
|
+
}
|
|
1716
|
+
/** Read/write/export authorization decisions. */
|
|
1717
|
+
interface AuthorizationPort {
|
|
1718
|
+
authorize(action: string, subject?: string): boolean;
|
|
1719
|
+
}
|
|
1720
|
+
/** Explicit consent gate for any remote/external resource (no zero-click fetch). */
|
|
1721
|
+
interface ExternalResourceConsentPort {
|
|
1722
|
+
requestConsent(target: string): boolean;
|
|
1723
|
+
}
|
|
1724
|
+
/** Cancellation source for the current operation. */
|
|
1725
|
+
interface CancellationPort {
|
|
1726
|
+
readonly token: CancellationToken;
|
|
1727
|
+
}
|
|
1728
|
+
/** Where documents are stored and retrieved. Opaque marker until its milestone. */
|
|
1729
|
+
interface PersistencePort {
|
|
1730
|
+
readonly kind: 'persistence';
|
|
1731
|
+
}
|
|
1732
|
+
/** How the engine talks to a remote peer. Opaque marker until its milestone. */
|
|
1733
|
+
interface TransportPort {
|
|
1734
|
+
readonly kind: 'transport';
|
|
1735
|
+
}
|
|
1736
|
+
/** Where font bytes come from. Opaque marker until its milestone. */
|
|
1737
|
+
interface FontPort {
|
|
1738
|
+
readonly kind: 'font';
|
|
1739
|
+
}
|
|
1740
|
+
/** Which shaping backend measures text. Opaque marker until its milestone. */
|
|
1741
|
+
interface ShapingPort {
|
|
1742
|
+
readonly kind: 'shaping';
|
|
1743
|
+
}
|
|
1744
|
+
/** How image bytes are decoded. Opaque marker until its milestone. */
|
|
1745
|
+
interface ImagePort {
|
|
1746
|
+
readonly kind: 'image';
|
|
1747
|
+
}
|
|
1748
|
+
/** Where resource consumption is reported. Opaque marker until its milestone. */
|
|
1749
|
+
interface ResourceAccountingPort {
|
|
1750
|
+
readonly kind: 'resource-accounting';
|
|
1751
|
+
}
|
|
1751
1752
|
/**
|
|
1752
|
-
*
|
|
1753
|
-
*
|
|
1754
|
-
* `owner` names the story whose markers may be stripped. Omitted, it is the main document
|
|
1755
|
-
* body — never every XML part. A header or note that reused the same `w:id` is a different
|
|
1756
|
-
* remark; pass its part (and `noteId` when the story is one note) to delete that one.
|
|
1753
|
+
* A required port the runtime did not provide.
|
|
1757
1754
|
*
|
|
1758
|
-
*
|
|
1759
|
-
*
|
|
1760
|
-
* comment is half gone.
|
|
1755
|
+
* Thrown rather than falling back: silently reaching for a browser global when a worker or server
|
|
1756
|
+
* adapter did not supply a port is exactly the coupling ports exist to prevent.
|
|
1761
1757
|
*/
|
|
1762
|
-
declare
|
|
1758
|
+
declare class PortResolutionError extends Error {
|
|
1759
|
+
readonly portId: string;
|
|
1760
|
+
constructor(portId: string);
|
|
1761
|
+
}
|
|
1763
1762
|
/**
|
|
1764
|
-
*
|
|
1765
|
-
*
|
|
1766
|
-
* `owner` omitted is the main document body, matching {@link deleteCommentThread}.
|
|
1763
|
+
* The environment-dependent services an engine instance may reach.
|
|
1767
1764
|
*
|
|
1768
|
-
*
|
|
1769
|
-
*
|
|
1770
|
-
*
|
|
1771
|
-
* stories so a unique id still loses its `comments.xml` body. Remaining-marker overflow
|
|
1772
|
-
* preserves comments/commentEx/commentId metadata rather than deleting records the scan could
|
|
1773
|
-
* not prove unused. Null is reserved for a removal that actually failed.
|
|
1765
|
+
* Everything outside pure computation — the clock, identity minting, scheduling, fonts, images —
|
|
1766
|
+
* is reached only through here, which is what lets browser, worker and server adapters supply
|
|
1767
|
+
* only what their runtime actually offers.
|
|
1774
1768
|
*/
|
|
1775
|
-
declare
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
/**
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
readonly
|
|
1769
|
+
declare class PortRegistry {
|
|
1770
|
+
private readonly ports;
|
|
1771
|
+
provide(portId: string, port: unknown): this;
|
|
1772
|
+
has(portId: string): boolean;
|
|
1773
|
+
/** Resolve a port by id or throw. */
|
|
1774
|
+
resolve<T>(portId: string): T;
|
|
1775
|
+
/** Assert every id in `portIds` is present; returns the missing ones (empty if all present). */
|
|
1776
|
+
missing(portIds: readonly string[]): string[];
|
|
1777
|
+
/** The provided port ids (for bridging to registry.resolve availablePorts). */
|
|
1778
|
+
availablePorts(): string[];
|
|
1779
|
+
clock(): ClockPort;
|
|
1780
|
+
identity(): IdentityPort;
|
|
1781
|
+
}
|
|
1782
|
+
/** Deterministic clock: starts at `start` and advances by `step` each call. */
|
|
1783
|
+
declare class DeterministicClock implements ClockPort {
|
|
1784
|
+
private readonly step;
|
|
1785
|
+
private t;
|
|
1786
|
+
constructor(start?: number, step?: number);
|
|
1787
|
+
now(): number;
|
|
1788
|
+
}
|
|
1789
|
+
/** Sequential identity for tests and deterministic fixtures. */
|
|
1790
|
+
declare class SequentialIdentity implements IdentityPort {
|
|
1791
|
+
private readonly prefix;
|
|
1792
|
+
private n;
|
|
1793
|
+
constructor(prefix?: string);
|
|
1794
|
+
newId(): string;
|
|
1791
1795
|
}
|
|
1792
|
-
/** The defaults a document with no `settings.xml` gets: everything Word would shade, shaded. */
|
|
1793
|
-
declare const DEFAULT_VIEW_SETTINGS: DocumentViewSettings;
|
|
1794
|
-
/** Read the view settings from a `settings.xml` root, or the defaults when it has none. */
|
|
1795
|
-
declare function readViewSettings(settingsRoot: OoxmlNode | null | undefined): DocumentViewSettings;
|
|
1796
1796
|
|
|
1797
|
-
/**
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
readonly
|
|
1804
|
-
/**
|
|
1805
|
-
readonly
|
|
1797
|
+
/** What one operation is started with. Only `ports` is required. */
|
|
1798
|
+
interface OperationInit {
|
|
1799
|
+
readonly ports: PortRegistry;
|
|
1800
|
+
readonly limits?: Partial<ResourceLimits>;
|
|
1801
|
+
readonly config?: Readonly<Record<string, unknown>>;
|
|
1802
|
+
/** Root budget capacity in abstract units (default: the byte decompression limit). */
|
|
1803
|
+
readonly capacity?: number;
|
|
1804
|
+
/** Operation identity (from IdentityPort in production); defaulted for tests. */
|
|
1805
|
+
readonly id?: string;
|
|
1806
1806
|
}
|
|
1807
1807
|
/**
|
|
1808
|
-
*
|
|
1809
|
-
*
|
|
1810
|
-
* Does not descend INTO a story: a story's blocks are the walk below, and a story root never
|
|
1811
|
-
* contains another story root.
|
|
1812
|
-
*/
|
|
1813
|
-
declare function storyRootsOf(part: OoxmlPart): readonly OoxmlStoryRoot[];
|
|
1814
|
-
/**
|
|
1815
|
-
* Whether a part is SHAPED to hold stories — a body, a header, a footer, or a notes part.
|
|
1808
|
+
* The frozen environment of one operation: its limits, config, ports, root budget and
|
|
1809
|
+
* cancellation controller.
|
|
1816
1810
|
*
|
|
1817
|
-
*
|
|
1818
|
-
*
|
|
1819
|
-
* which is the footnotes part Word writes into every document that ever held a footnote. A
|
|
1820
|
-
* caller asking "should I walk this part at all" that used the editable count skipped it
|
|
1821
|
-
* entirely, and the two callers that ask are a payload sweep and an export strip: both DELETE
|
|
1822
|
-
* what they conclude nothing names.
|
|
1811
|
+
* IMMUTABLE for the operation's lifetime, which is what lets cache reuse and replica agreement
|
|
1812
|
+
* key on it. A new operation always gets a fresh snapshot rather than observing a mutated one.
|
|
1823
1813
|
*/
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1814
|
+
interface OperationContext {
|
|
1815
|
+
readonly id: string;
|
|
1816
|
+
readonly limits: ResourceLimits;
|
|
1817
|
+
readonly config: Readonly<Record<string, unknown>>;
|
|
1818
|
+
readonly ports: PortRegistry;
|
|
1819
|
+
readonly budget: Budget;
|
|
1820
|
+
readonly cancellation: CancellationController;
|
|
1821
|
+
}
|
|
1827
1822
|
/**
|
|
1828
|
-
*
|
|
1823
|
+
* Begin an operation, capturing its immutable environment snapshot.
|
|
1829
1824
|
*
|
|
1830
|
-
*
|
|
1831
|
-
*
|
|
1825
|
+
* Resolves and freezes limits and configuration, carves the root budget, and creates the
|
|
1826
|
+
* cancellation controller — everything downstream work needs, fixed for the operation's duration.
|
|
1832
1827
|
*/
|
|
1833
|
-
declare function
|
|
1828
|
+
declare function beginOperation(init: OperationInit): OperationContext;
|
|
1829
|
+
/** Release the operation's root budget (requires every child/reservation released). */
|
|
1830
|
+
declare function endOperation(ctx: OperationContext): void;
|
|
1831
|
+
|
|
1832
|
+
/** What a limit counts. Typed so a byte cap and a depth cap cannot be compared by accident. */
|
|
1833
|
+
type LimitUnit = 'bytes' | 'count' | 'depth' | 'ratio' | 'passes';
|
|
1834
1834
|
/**
|
|
1835
|
-
*
|
|
1835
|
+
* Where a limit is enforced.
|
|
1836
1836
|
*
|
|
1837
|
-
*
|
|
1838
|
-
*
|
|
1837
|
+
* Declared per limit so enforcement happens at the boundary that can still refuse cheaply — a zip
|
|
1838
|
+
* cap checked during layout has already let the bomb decompress.
|
|
1839
1839
|
*/
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
readonly root: OoxmlElement;
|
|
1846
|
-
/** Layout atom id used to select the drawing, including an MC wrapper when present. */
|
|
1847
|
-
readonly drawingNodeId: string;
|
|
1848
|
-
/** Canonical node id of the paragraph that anchors the drawing. */
|
|
1849
|
-
readonly hostParagraphId: string;
|
|
1840
|
+
type EnforcementPhase = 'package-read' | 'xml-parse' | 'layout' | 'output';
|
|
1841
|
+
/** One limit's unit and enforcement phase — the metadata that makes limits testable uniformly. */
|
|
1842
|
+
interface LimitSpec {
|
|
1843
|
+
readonly unit: LimitUnit;
|
|
1844
|
+
readonly phase: EnforcementPhase;
|
|
1850
1845
|
}
|
|
1846
|
+
/** Unit + enforcement phase for every resource limit. */
|
|
1847
|
+
declare const LIMIT_SPECS: Readonly<Record<keyof ResourceLimits, LimitSpec>>;
|
|
1848
|
+
/** Every limit name, for iterating the specs and asserting each has a unit and phase. */
|
|
1849
|
+
declare const LIMIT_KEYS: (keyof ResourceLimits)[];
|
|
1850
|
+
/** A phase-scoped overflow-safe counter for one limit. */
|
|
1851
|
+
declare function makeLimitCounter(limits: ResourceLimits, key: keyof ResourceLimits): BoundedCounter;
|
|
1851
1852
|
/**
|
|
1852
|
-
*
|
|
1853
|
-
*
|
|
1854
|
-
*
|
|
1855
|
-
*
|
|
1853
|
+
* Deterministic memory substitute. Tracks current and peak "allocated" units
|
|
1854
|
+
* against a hard byte ceiling; `allocate` fails closed (LimitExceededError) past
|
|
1855
|
+
* the limit. Used in place of process RSS so memory-limit tests are reproducible
|
|
1856
|
+
* and cancellation/cleanup can be asserted without a real allocator.
|
|
1856
1857
|
*/
|
|
1857
|
-
declare
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
interface CustomXmlDataPart {
|
|
1869
|
-
/** Canonical part name, e.g. `/customXml/item1.xml`. */
|
|
1870
|
-
readonly partName: string;
|
|
1871
|
-
/** Part name of its properties, e.g. `/customXml/itemProps1.xml`. */
|
|
1872
|
-
readonly propsPartName: string;
|
|
1873
|
-
/** `ds:itemID`, braced and upper-case, as `w:storeItemID` must spell it. */
|
|
1874
|
-
readonly itemId: string;
|
|
1875
|
-
/** Namespace URI of the payload root, which is what identifies one store among several. */
|
|
1876
|
-
readonly namespaceUri: string;
|
|
1858
|
+
declare class DeterministicMemoryMeter {
|
|
1859
|
+
private readonly counter;
|
|
1860
|
+
private current;
|
|
1861
|
+
private peak;
|
|
1862
|
+
constructor(limitBytes: number);
|
|
1863
|
+
allocate(bytes: number): void;
|
|
1864
|
+
free(bytes: number): void;
|
|
1865
|
+
get currentBytes(): number;
|
|
1866
|
+
get peakBytes(): number;
|
|
1867
|
+
/** Release everything (cancellation/cleanup path). */
|
|
1868
|
+
reset(): void;
|
|
1877
1869
|
}
|
|
1870
|
+
/** Assert the finite-default / hard-ceiling invariant holds for every limit. */
|
|
1871
|
+
declare function assertLimitInvariants(): void;
|
|
1872
|
+
|
|
1873
|
+
/** Any JSON value. The domain canonicalization and stable hashing operate over. */
|
|
1874
|
+
type Json = null | boolean | number | string | Json[] | {
|
|
1875
|
+
[k: string]: Json;
|
|
1876
|
+
};
|
|
1878
1877
|
/**
|
|
1879
|
-
*
|
|
1880
|
-
*
|
|
1881
|
-
*
|
|
1882
|
-
* markup it will assemble into a `.docx` later — mints the id the same way this does, rather
|
|
1883
|
-
* than inventing a second GUID shape Word has to be tolerant of.
|
|
1884
|
-
*
|
|
1885
|
-
* The store is a pure function of what it is asked to write: the same document written twice
|
|
1886
|
-
* has to produce the same bytes, or a save/reopen/save round trip stops being a fixed point
|
|
1887
|
-
* and every digest taken over saved bytes moves. A GUID's job here is uniqueness within one
|
|
1888
|
-
* package, not unguessability, so four FNV-1a passes over a salted seed carry it.
|
|
1878
|
+
* Produce a canonical string for `value`, dropping any object key whose name is
|
|
1879
|
+
* in `ephemera` at any depth. Numbers are emitted losslessly; -0 normalizes to 0;
|
|
1880
|
+
* non-finite numbers are rejected (they must never enter a comparator input).
|
|
1889
1881
|
*/
|
|
1890
|
-
declare function
|
|
1882
|
+
declare function canonicalize(value: unknown, ephemera?: ReadonlySet<string>): string;
|
|
1883
|
+
/** 64-bit FNV-1a over the canonical form, returned as a 16-char hex string. */
|
|
1884
|
+
declare function stableHash(value: unknown, ephemera?: ReadonlySet<string>): string;
|
|
1885
|
+
|
|
1891
1886
|
/**
|
|
1892
|
-
*
|
|
1887
|
+
* How one artifact class is compared.
|
|
1893
1888
|
*
|
|
1894
|
-
*
|
|
1895
|
-
*
|
|
1896
|
-
* plausibly-named files as it likes.
|
|
1889
|
+
* Frozen per artifact: nothing here invents a tolerance for an artifact the spec requires to
|
|
1890
|
+
* match exactly.
|
|
1897
1891
|
*/
|
|
1898
|
-
|
|
1899
|
-
/**
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
readonly
|
|
1892
|
+
type ComparatorMode = 'canonical-exact' | 'exact' | 'tolerance' | 'sync-optimization-only';
|
|
1893
|
+
/** One artifact class's comparison mode and its declared ephemera — fields excluded from equality. */
|
|
1894
|
+
interface ComparatorDescriptor {
|
|
1895
|
+
readonly id: string;
|
|
1896
|
+
readonly mode: ComparatorMode;
|
|
1897
|
+
/** Object keys excluded from canonical-exact comparison (declared ephemera). */
|
|
1898
|
+
readonly ephemera: readonly string[];
|
|
1899
|
+
readonly note: string;
|
|
1900
|
+
}
|
|
1901
|
+
/** The frozen artifact comparator set. */
|
|
1902
|
+
declare const COMPARATORS: {
|
|
1903
|
+
readonly authoredState: {
|
|
1904
|
+
readonly id: "dev.docx-editor.core.comparator.authored-state";
|
|
1905
|
+
readonly mode: 'canonical-exact';
|
|
1906
|
+
readonly ephemera: readonly ["revision", "provenance", "producedAt", "commitId"];
|
|
1907
|
+
readonly note: 'canonical normalized authored records; ephemera excluded';
|
|
1908
|
+
};
|
|
1909
|
+
readonly anchor: {
|
|
1910
|
+
readonly id: "dev.docx-editor.core.comparator.anchor";
|
|
1911
|
+
readonly mode: 'exact';
|
|
1912
|
+
readonly ephemera: readonly [];
|
|
1913
|
+
readonly note: 'internal anchor identity/affinity compares exactly';
|
|
1914
|
+
};
|
|
1915
|
+
readonly yjsStateVector: {
|
|
1916
|
+
readonly id: "dev.docx-editor.core.comparator.yjs-state-vector";
|
|
1917
|
+
readonly mode: 'sync-optimization-only';
|
|
1918
|
+
readonly ephemera: readonly [];
|
|
1919
|
+
readonly note: 'exchange optimization only; never proves update or delete-set coverage';
|
|
1920
|
+
};
|
|
1921
|
+
readonly shapedRun: {
|
|
1922
|
+
readonly id: "dev.docx-editor.core.comparator.shaped-run";
|
|
1923
|
+
readonly mode: 'exact';
|
|
1924
|
+
readonly ephemera: readonly [];
|
|
1925
|
+
readonly note: 'glyph ids, clusters, and fixed-point advances compare exactly';
|
|
1926
|
+
};
|
|
1927
|
+
readonly paginationFingerprint: {
|
|
1928
|
+
readonly id: "dev.docx-editor.core.comparator.pagination-fingerprint";
|
|
1929
|
+
readonly mode: 'exact';
|
|
1930
|
+
readonly ephemera: readonly [];
|
|
1931
|
+
readonly note: 'page/column boundaries, break causes, fixed-point geometry compare exactly';
|
|
1932
|
+
};
|
|
1933
|
+
readonly semanticTree: {
|
|
1934
|
+
readonly id: "dev.docx-editor.core.comparator.semantic-tree";
|
|
1935
|
+
readonly mode: 'exact';
|
|
1936
|
+
readonly ephemera: readonly [];
|
|
1937
|
+
readonly note: 'reading order, roles, headings, alt text compare exactly';
|
|
1938
|
+
};
|
|
1939
|
+
readonly hitTest: {
|
|
1940
|
+
readonly id: "dev.docx-editor.core.comparator.hit-test";
|
|
1941
|
+
readonly mode: 'exact';
|
|
1942
|
+
readonly ephemera: readonly [];
|
|
1943
|
+
readonly note: 'resolved hit target and cluster affinity compare exactly';
|
|
1944
|
+
};
|
|
1945
|
+
readonly pdfSemantics: {
|
|
1946
|
+
readonly id: "dev.docx-editor.core.comparator.pdf-semantics";
|
|
1947
|
+
readonly mode: 'canonical-exact';
|
|
1948
|
+
readonly ephemera: readonly ["objectNumber", "producer", "creationDate", "modDate", "subsetTag"];
|
|
1949
|
+
readonly note: 'canonical semantic PDF objects; container ephemera excluded';
|
|
1950
|
+
};
|
|
1951
|
+
readonly rasterCheckpoint: {
|
|
1952
|
+
readonly id: "dev.docx-editor.core.comparator.raster-checkpoint";
|
|
1953
|
+
readonly mode: 'tolerance';
|
|
1954
|
+
readonly ephemera: readonly [];
|
|
1955
|
+
readonly note: 'documented unavoidable raster comparison; explicit tolerance only';
|
|
1956
|
+
};
|
|
1957
|
+
readonly benchmarkEvidence: {
|
|
1958
|
+
readonly id: "dev.docx-editor.core.comparator.benchmark-evidence";
|
|
1959
|
+
readonly mode: 'sync-optimization-only';
|
|
1960
|
+
readonly ephemera: readonly [];
|
|
1961
|
+
readonly note: 'diagnostic evidence, not an equivalence basis';
|
|
1962
|
+
};
|
|
1963
|
+
};
|
|
1964
|
+
/** Which frozen comparator to use. */
|
|
1965
|
+
type ComparatorName = keyof typeof COMPARATORS;
|
|
1966
|
+
/** Whether two artifacts matched, and where they diverged when they did not. */
|
|
1967
|
+
interface ComparisonResult {
|
|
1968
|
+
readonly equal: boolean;
|
|
1969
|
+
/** Canonical forms when unequal (diagnostic). */
|
|
1970
|
+
readonly left?: string;
|
|
1971
|
+
readonly right?: string;
|
|
1906
1972
|
}
|
|
1907
1973
|
/**
|
|
1908
|
-
*
|
|
1909
|
-
*
|
|
1910
|
-
*
|
|
1911
|
-
*
|
|
1912
|
-
* second node added to the same store does not author a second store.
|
|
1913
|
-
*
|
|
1914
|
-
* @param storyPartName - Whose relationships the store hangs off. Word enumerates its data
|
|
1915
|
-
* store from the MAIN DOCUMENT part, so a store authored off a header or footer is one Word
|
|
1916
|
-
* never sees.
|
|
1917
|
-
*/
|
|
1918
|
-
declare function withCustomXmlDataPart(pkg: OoxmlPackage, storyPartName: string, namespaceUri: string, rootLocalName: string): CustomXmlDataPartResult;
|
|
1919
|
-
/**
|
|
1920
|
-
* Remove a store from a document: both parts, both relationships, the Override.
|
|
1921
|
-
*
|
|
1922
|
-
* PACKAGE ONLY. It does not touch the body, so a `w:sdt` bound to the store keeps its
|
|
1923
|
-
* `w:dataBinding`, its `w:storeItemID` and its `w:tag`, and Word then opens a control bound to
|
|
1924
|
-
* a store that is not there. Stripping those is the export path's job and is not built; this
|
|
1925
|
-
* is the half that removes the payload, which is the half a caller can rely on.
|
|
1926
|
-
*
|
|
1927
|
-
* `ok: false` means nothing was removed and the package is unchanged — most often because an
|
|
1928
|
-
* owner's `.rels` was never parsed into a tree, which {@link withoutPart} refuses to work
|
|
1929
|
-
* around. A caller exporting a document has to treat that as a failure to export rather than
|
|
1930
|
-
* as a document with nothing to strip, or it ships the payload it meant to remove.
|
|
1974
|
+
* Compare two artifacts under a named comparator. `canonical-exact` and `exact`
|
|
1975
|
+
* compare canonical forms (exact drops no ephemera). `tolerance` requires an
|
|
1976
|
+
* epsilon and compares finite numbers structurally. `sync-optimization-only`
|
|
1977
|
+
* throws — such artifacts are never an equivalence basis.
|
|
1931
1978
|
*/
|
|
1932
|
-
declare function
|
|
1979
|
+
declare function compareArtifacts(name: ComparatorName, left: unknown, right: unknown, opts?: {
|
|
1980
|
+
epsilon?: number;
|
|
1981
|
+
}): ComparisonResult;
|
|
1982
|
+
/** Fingerprint an artifact under a named comparator's canonicalization policy. */
|
|
1983
|
+
declare function fingerprint(name: ComparatorName, value: unknown): string;
|
|
1933
1984
|
|
|
1934
|
-
/**
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
readonly
|
|
1939
|
-
|
|
1940
|
-
readonly
|
|
1985
|
+
/** Whether a recorded conformance step was expected to commit or be refused. */
|
|
1986
|
+
type FixtureOutcome = 'applied' | 'aborted' | 'validation' | 'conflict' | 'resource' | 'authorization';
|
|
1987
|
+
/** The change one step produced, summarized to what a fixture can compare across runtimes. */
|
|
1988
|
+
interface ModelChangeSummary {
|
|
1989
|
+
readonly fromRevision: number;
|
|
1990
|
+
readonly toRevision: number;
|
|
1991
|
+
readonly origin: string;
|
|
1992
|
+
readonly dirty: readonly string[];
|
|
1993
|
+
readonly dependencyKeys: readonly string[];
|
|
1941
1994
|
}
|
|
1942
|
-
/**
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
*/
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1995
|
+
/** Where anchors sat after a step — how a fixture proves positions survived an edit. */
|
|
1996
|
+
interface AnchorSnapshot {
|
|
1997
|
+
readonly anchorId: string;
|
|
1998
|
+
readonly story: string;
|
|
1999
|
+
readonly block: string;
|
|
2000
|
+
readonly affinity: 'before' | 'after';
|
|
2001
|
+
}
|
|
2002
|
+
/** What one step must produce: its outcome, its change summary, and its authored-state hash. */
|
|
2003
|
+
interface FixtureExpectation {
|
|
2004
|
+
readonly outcome: FixtureOutcome;
|
|
2005
|
+
/** Present iff outcome === 'applied'; MUST be > baseRevision. */
|
|
2006
|
+
readonly committedRevision?: number;
|
|
2007
|
+
readonly modelChange?: ModelChangeSummary;
|
|
2008
|
+
/** 16-hex authored-state fingerprint (comparator 0.4). */
|
|
2009
|
+
readonly authoredStateHash?: string;
|
|
2010
|
+
readonly outputHash?: string;
|
|
2011
|
+
readonly anchors?: readonly AnchorSnapshot[];
|
|
2012
|
+
}
|
|
2013
|
+
/** One recorded operation and what it was expected to do. */
|
|
2014
|
+
interface FixtureStep {
|
|
2015
|
+
readonly baseRevision: number;
|
|
2016
|
+
readonly origin: string;
|
|
2017
|
+
/** Opaque DocOp payloads (schema owned by section 4). */
|
|
2018
|
+
readonly ops: readonly unknown[];
|
|
2019
|
+
readonly expect: FixtureExpectation;
|
|
2020
|
+
}
|
|
2021
|
+
/** Opaque encoded backend bytes (snapshot or replication update). */
|
|
2022
|
+
interface EncodedEnvelope {
|
|
2023
|
+
readonly kind: 'snapshot' | 'update';
|
|
2024
|
+
readonly protocolVersion: number;
|
|
2025
|
+
readonly schemaVersion: number;
|
|
2026
|
+
readonly documentId: string;
|
|
2027
|
+
readonly byteLength: number;
|
|
2028
|
+
/** Hex-encoded opaque bytes; length MUST equal byteLength. */
|
|
2029
|
+
readonly bytesHex: string;
|
|
2030
|
+
}
|
|
2031
|
+
/** Which implementation recorded a fixture — local store, Yjs, or a binding. */
|
|
2032
|
+
type FixtureSource = {
|
|
2033
|
+
readonly kind: 'create';
|
|
2034
|
+
} | {
|
|
2035
|
+
readonly kind: 'docx';
|
|
2036
|
+
readonly sha256: string;
|
|
2037
|
+
readonly bytesRef: string;
|
|
1970
2038
|
};
|
|
1971
2039
|
/**
|
|
1972
|
-
* The
|
|
2040
|
+
* The frozen conformance container: revisions, origins, operations, changes, snapshots and
|
|
2041
|
+
* hashes.
|
|
1973
2042
|
*
|
|
1974
|
-
*
|
|
1975
|
-
*
|
|
1976
|
-
*
|
|
2043
|
+
* The CONTAINER is what is frozen — field names, origin membership, revision monotonicity, hash
|
|
2044
|
+
* format. The op and change payloads travel opaquely, so their schemas can evolve without
|
|
2045
|
+
* invalidating every recorded fixture.
|
|
1977
2046
|
*/
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
declare const CUSTOM_NODE_XPATH_PREFIX = "ns0";
|
|
1986
|
-
/** The three attributes a `w:dataBinding` carries. */
|
|
1987
|
-
interface CustomNodeBinding {
|
|
1988
|
-
readonly prefixMappings: string;
|
|
1989
|
-
readonly xpath: string;
|
|
1990
|
-
readonly storeItemId: string;
|
|
2047
|
+
interface ConformanceFixture {
|
|
2048
|
+
readonly formatVersion: 1;
|
|
2049
|
+
readonly documentId: string;
|
|
2050
|
+
readonly source: FixtureSource;
|
|
2051
|
+
readonly steps: readonly FixtureStep[];
|
|
2052
|
+
readonly snapshots?: readonly EncodedEnvelope[];
|
|
2053
|
+
readonly updates?: readonly EncodedEnvelope[];
|
|
1991
2054
|
}
|
|
1992
|
-
/**
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
declare function customNodeBinding(part: CustomXmlDataPart, rootLocalName: string, nodeId: string): CustomNodeBinding | null;
|
|
2000
|
-
/**
|
|
2001
|
-
* Every node id the story's controls bind to in one store, in document order.
|
|
2002
|
-
*
|
|
2003
|
-
* This is the input the orphan sweep takes: a node whose id is not in here is one no control
|
|
2004
|
-
* names, whether it was deleted in this editor or in Word. Reading it from the STORY rather than
|
|
2005
|
-
* from a host's bookkeeping is what makes the two cases one mechanism.
|
|
2006
|
-
*/
|
|
2007
|
-
declare function boundCustomXmlNodeIds(part: OoxmlPart, storeItemId: string): Set<string>;
|
|
2008
|
-
/**
|
|
2009
|
-
* Every node id ANY story in the package binds, in one store.
|
|
2010
|
-
*
|
|
2011
|
-
* THE WHOLE PACKAGE, not one story. A payload is reachable from a header as easily as from the
|
|
2012
|
-
* body — Word enumerates its data store from the main part, but nothing stops a control
|
|
2013
|
-
* elsewhere quoting the same `w:storeItemID` — and the two callers that decide what is an orphan
|
|
2014
|
-
* both destroy data when they are wrong. The sweep would collect a payload a header still paints;
|
|
2015
|
-
* the export would strip a store a header still names, which is a document Word offers to repair.
|
|
2016
|
-
*
|
|
2017
|
-
* Costs one walk per story per store, on open and on export. Neither is a keystroke.
|
|
2018
|
-
*/
|
|
2019
|
-
declare function boundCustomXmlNodeIdsInPackage(pkg: OoxmlPackage, storeItemId: string): Set<string>;
|
|
2020
|
-
/** The node id one control binds to in the named store, or null when it binds to nothing there. */
|
|
2021
|
-
declare function boundCustomXmlNodeIdOf(control: OoxmlNode, storeItemId: string): string | null;
|
|
2055
|
+
/** Whether a fixture is well-formed, listing every structural violation. */
|
|
2056
|
+
interface ValidationResult {
|
|
2057
|
+
readonly valid: boolean;
|
|
2058
|
+
readonly errors: readonly string[];
|
|
2059
|
+
}
|
|
2060
|
+
/** Structurally validate a fixture against the frozen format rules. */
|
|
2061
|
+
declare function validateFixture(fixture: ConformanceFixture): ValidationResult;
|
|
2022
2062
|
|
|
2023
|
-
/**
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
/**
|
|
2028
|
-
readonly
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
|
-
|
|
2036
|
-
|
|
2037
|
-
|
|
2038
|
-
|
|
2063
|
+
/** The outcome a store reports for one replayed step. */
|
|
2064
|
+
interface ReplayOutcome {
|
|
2065
|
+
readonly outcome: FixtureOutcome;
|
|
2066
|
+
readonly committedRevision?: number;
|
|
2067
|
+
/** Canonical authored-state value AFTER the step (hashed via comparator 0.4). */
|
|
2068
|
+
readonly authoredState?: unknown;
|
|
2069
|
+
}
|
|
2070
|
+
/** The interface a conformance runtime implements so one fixture can drive every backend. */
|
|
2071
|
+
interface ReplayStore {
|
|
2072
|
+
/** Initialize from the fixture source; return the initial revision (0 for create). */
|
|
2073
|
+
init(fixture: ConformanceFixture): number;
|
|
2074
|
+
/** Apply one step and report what happened. */
|
|
2075
|
+
applyStep(step: FixtureStep): ReplayOutcome;
|
|
2076
|
+
}
|
|
2077
|
+
/** What replaying a fixture produced: per-step outcomes and where they diverged. */
|
|
2078
|
+
interface ReplayReport {
|
|
2079
|
+
readonly ok: boolean;
|
|
2080
|
+
readonly mismatches: readonly string[];
|
|
2039
2081
|
}
|
|
2040
2082
|
/**
|
|
2041
|
-
*
|
|
2042
|
-
*
|
|
2043
|
-
* A refusal answers no package on purpose. "Stripping failed, here is the document anyway" is the
|
|
2044
|
-
* one outcome that must not be possible: a caller would ship the markup it asked to remove and
|
|
2045
|
-
* have been told the export succeeded.
|
|
2046
|
-
*/
|
|
2047
|
-
type CustomNodeExportResult = {
|
|
2048
|
-
readonly ok: true;
|
|
2049
|
-
readonly pkg: OoxmlPackage;
|
|
2050
|
-
/** Controls unwrapped (`text`) and controls removed (`remove`). */
|
|
2051
|
-
readonly unwrapped: number;
|
|
2052
|
-
readonly removed: number;
|
|
2053
|
-
} | {
|
|
2054
|
-
readonly ok: false;
|
|
2055
|
-
readonly reason: string;
|
|
2056
|
-
};
|
|
2057
|
-
/**
|
|
2058
|
-
* Apply the policy, then take the payloads and the stores the policy orphaned.
|
|
2059
|
-
*
|
|
2060
|
-
* Order matters and is the reverse of the write's. The BODY goes first, so the sweep that follows
|
|
2061
|
-
* sees the controls that actually survive; the stores go last, once nothing binds them. Doing it
|
|
2062
|
-
* the other way would strip a store while a control still quoted its `w:storeItemID`, which is a
|
|
2063
|
-
* document Word opens and offers to repair.
|
|
2083
|
+
* Replay a fixture against a store and check every step's outcome, committed
|
|
2084
|
+
* revision, and authored-state fingerprint against the fixture's expectations.
|
|
2064
2085
|
*/
|
|
2065
|
-
declare function
|
|
2086
|
+
declare function replayFixture(fixture: ConformanceFixture, store: ReplayStore): ReplayReport;
|
|
2087
|
+
/** Hash a store's authored state, so two runtimes replaying one fixture can be compared. */
|
|
2088
|
+
declare function hashAuthored(authoredState: unknown): string;
|
|
2066
2089
|
|
|
2067
2090
|
/**
|
|
2068
2091
|
* WHERE a copy reaches, computed by the editing surface against the published layout with
|
|
@@ -2461,6 +2484,8 @@ interface RevisionSite {
|
|
|
2461
2484
|
readonly parent: OoxmlElement | null;
|
|
2462
2485
|
/** True when this site cannot be resolved and the whole op must refuse. */
|
|
2463
2486
|
readonly refused: boolean;
|
|
2487
|
+
/** Why, when `refused` is true. */
|
|
2488
|
+
readonly refusal?: RevisionSiteRefusal;
|
|
2464
2489
|
/** True for `w:pPr/w:rPr/w:ins|w:del` — the paragraph MARK, not content. */
|
|
2465
2490
|
readonly paragraphMark: boolean;
|
|
2466
2491
|
/** True for a supported property-history wrapper. */
|
|
@@ -2677,7 +2702,7 @@ declare function formsProtectionEnabled(root: OoxmlNode | null | undefined): boo
|
|
|
2677
2702
|
declare function sectionProtectsForms(part: OoxmlPart, nodeId: string): boolean;
|
|
2678
2703
|
|
|
2679
2704
|
/** Every {@link TreeDocOpKind}, for validation and exhaustiveness checks. */
|
|
2680
|
-
declare const TREE_DOC_OP_KINDS: readonly ["replaceStoryBlocks", "insertText", "deleteText", "setParagraphMarkRevision", "proposeParagraphMerge", "insertCommentMarker", "acceptRevision", "rejectRevision", "acceptAllRevisions", "rejectAllRevisions", "insertTab", "insertHardBreak", "insertPageBreak", "insertPageField", "setFieldCode", "setListLevel", "setListNumbering", "setParagraphTabStops", "setParagraphMarkProperties", "splitParagraph", "splitParagraphMany", "joinParagraphs", "setRunProperties", "setParagraphProperties", "setSectionProperties", "setSectionMark", "insertHyperlink", "setHyperlinkTarget", "removeHyperlink", "setMathEquation", "removeMathEquation", "setContentControlValue", "removeContentControl", "insertInlineContentControl", "addRepeatingSectionItem", "removeRepeatingSectionItem", "deleteBlock", "insertTable", "insertTableRow", "deleteTableRow", "insertTableColumn", "deleteTableColumn", "setTableColumnWidths", "setTableRightEdgeWidth", "setTableRowHeight", "setTableProperties", "authorTable", "setTableCellBorders", "setTableCellFill", "setTableCellVerticalAlignment", "createHeaderFooter", "deleteHeaderFooter", "linkToPrevious", "unlinkFromPrevious", "setSectionFurnitureOptions", "setDocumentProtection", "insertNote", "deleteNote", "convertNote", "convertAllNotes", "setNoteProperties", "setContentControlProperties", "insertContentControl", "insertFragment", "insertDrawing", "replaceDrawingResource", "deleteDrawing", "resizeDrawing", "cropDrawing", "positionDrawing", "setDrawingWrap", "setDrawingMetadata", "setDrawingLocks", "transformDrawing", "insertToc", "replaceTocResult", "rewriteTocPageNumbers", "refreshFieldResults", "setTextFormFieldDefault", "commitTextFormField", "setLegacyCheckbox", "setLegacyDropdown", "insertBuildingBlock"];
|
|
2705
|
+
declare const TREE_DOC_OP_KINDS: readonly ["replaceStoryBlocks", "insertText", "deleteText", "setParagraphMarkRevision", "proposeParagraphMerge", "insertCommentMarker", "acceptRevision", "rejectRevision", "acceptAllRevisions", "rejectAllRevisions", "setRevisionAttribution", "insertTab", "insertHardBreak", "insertPageBreak", "insertPageField", "setFieldCode", "setListLevel", "setListNumbering", "setParagraphTabStops", "setParagraphMarkProperties", "splitParagraph", "splitParagraphMany", "joinParagraphs", "setRunProperties", "setParagraphProperties", "setSectionProperties", "setSectionMark", "insertHyperlink", "setHyperlinkTarget", "removeHyperlink", "setMathEquation", "removeMathEquation", "setContentControlValue", "removeContentControl", "insertInlineContentControl", "addRepeatingSectionItem", "removeRepeatingSectionItem", "deleteBlock", "insertTable", "insertTableRow", "deleteTableRow", "insertTableColumn", "deleteTableColumn", "setTableColumnWidths", "setTableRightEdgeWidth", "setTableRowHeight", "setTableProperties", "authorTable", "setTableCellBorders", "setTableCellFill", "setTableCellVerticalAlignment", "createHeaderFooter", "deleteHeaderFooter", "linkToPrevious", "unlinkFromPrevious", "setSectionFurnitureOptions", "setDocumentProtection", "insertNote", "deleteNote", "convertNote", "convertAllNotes", "setNoteProperties", "setContentControlProperties", "insertContentControl", "insertFragment", "insertDrawing", "replaceDrawingResource", "deleteDrawing", "resizeDrawing", "cropDrawing", "positionDrawing", "setDrawingWrap", "setDrawingMetadata", "setDrawingLocks", "transformDrawing", "insertToc", "replaceTocResult", "rewriteTocPageNumbers", "refreshFieldResults", "setTextFormFieldDefault", "commitTextFormField", "setLegacyCheckbox", "setLegacyDropdown", "insertBuildingBlock"];
|
|
2681
2706
|
|
|
2682
|
-
export { ALL_FROZEN_IDS, AUTHORABLE_PARAGRAPH_PROPERTIES, AUTHORABLE_RUN_PROPERTIES, BoundedCounter, Budget, BudgetError, CANONICAL_MUTATION_ORIGINS, COMPARATORS, CUSTOM_NODE_XPATH_PREFIX, CUSTOM_XML_PROPS_REL, CUSTOM_XML_PROPS_TYPE, CUSTOM_XML_REL, CancellationController, CancellationError, CommentRecord, CommentThreadState, CustomNodeWriteResult, DANGEROUS_KEYS, DATASTORE_NAMESPACE_URI, DEFAULT_FORMATTING_DISPLAY_MODE, DEFAULT_VIEW_SETTINGS, DEPENDENCY_KEY_IDS, DangerousKeyError, DeterministicClock, DeterministicMemoryMeter, DrawingTreeDocOp, FIELD_ATOM_CHAR, ID_KINDS, INERT_EXECUTABLE_KINDS, ImageWrapTarget, ImpactClass, InsertCustomNodeWrite, LIMIT_KEYS, LIMIT_SPECS, LimitExceededError, MAX_STORY_SDT_NESTING, NON_CANONICAL_ORIGINS, ORIGIN_IDS, OmmlEquationProjection, OoxmlAttribute, OoxmlElement, OoxmlFldCharNode, OoxmlFldSimpleNode, OoxmlGenericElementNode, OoxmlHardBreakNode, OoxmlInstrTextNode, OoxmlInvariantIssue, OoxmlInvariantResult, OoxmlNode, OoxmlPackage, OoxmlParagraphNode, OoxmlPart, OoxmlProperty, PAGE_BREAK_CHAR, PortRegistry, PortResolutionError, PrefixAllocator, RESULT_IDS, RUNTIME_PORT_IDS, RegistryError, RelationshipRecord, ResourceLimits, ReviewCommentItem, ReviewItem, ReviewModelInput, ReviewPosition, ReviewRange, ReviewRevisionItem, SEARCH_MATCH_LIMIT, SEARCH_QUERY_MAX, SequentialIdentity, StoryScope, TOC_LEVEL_INDENT_TWIPS, TOC_MAX_BOOKMARKS_PER_REFRESH, TOC_MAX_ENTRIES, TOC_MAX_FIELD_NESTING, TOC_MAX_INSTRUCTION_CHARS, TOC_MAX_PAGE_PASSES, TREE_DOC_OP_KINDS, TWIPS_PER_POINT, TreeDocOp, TreeDocumentStore, TreeModelChange, TreeOpRejection, TreeOpResult, TreePackageStore, addComment, addPackageComment, applyEdits, applyTreeOp, assertLimitInvariants, assertValidId, assertValidQName, atomicFieldSpansOf, authoredProperties, beginOperation, bodyStoryRoot, bookmarkPairNodes, boundCustomXmlNodeIdOf, boundCustomXmlNodeIds, boundCustomXmlNodeIdsInPackage, buildTocContentControl, buildTocEntryParagraph, buildingBlockGalleryOf, buildingBlocksForControl, buildingBlocksOf, canonicalOoxmlFingerprint, canonicalize, cascadeEmptiedComments, collectNodeIds, collectReviewItems, collectRevisionSites, collectStoryParagraphs, commentItemsOf, commentPartNameOf, commentsExtendedPartNameOf, compareArtifacts, compareSemVer, containsCssFetch, contentTypesPartBytes, createNodeIdAllocator, customNodeBinding, customXmlDataParts, customXmlLabelXPath, customXmlNodes, customXmlPrefixMappings, datastoreItemIdFor, deleteCommentThread, deletePackageComments, deriveOoxmlIndexes, detectBodyTocs, diffSemanticDigests, digestPart, directParagraphMarkProperties, directParagraphProperties, displayMathAlignment, drawingOpImpact, endOperation, equationsOfAtom, escapeCssString, escapeXml, extractFragmentPackage, fieldAtomText, fieldOnOffAttribute, findCustomXmlDataPart, findDetectedToc, findNode, findOccurrences, fingerprint, fldCharType, fldSimpleInstr, fnv1a32, foldCase, formatOwnedRunIds, formattableRanges, formsProtectionEnabled, glossaryPartOf, hardBreakAttributes, hardBreakKind, hardBreakText, hasCommentPart, hasLegacyFormFieldData, hasNode, hashAuthored, indexStyles, inlineControlEndingAt, inlineControlStartingAt, insertChildren, insertPackageCustomNode, instrTextValue, isAuthorableRunProperty, isDangerousKey, isDrawingTreeDocOp, isEvaluableField, isFieldChrome, isFldChar, isFldCharNode, isFldSimple, isFldSimpleNode, isInertExecutable, isInstrText, isInstrTextNode, isLegalFldCharType, isOmmlDisplay, isOmmlEquationAtom, isPageBreakNode, isSearchableQuery, isStoryPart, isValidId, isValidNCName, isValidParaId, isValidQName, isWholeWord, linkRevisionReplies, locateSites, makeLimitCounter, materializeGlossaryPlaceholders, mergeFragmentIntoPackage, mergedFontProperty, mergedMultiSettingProperty, mergedParagraphMarkProperties, mergedProperties, mintParaId, mintedParagraphIdentityAttributes, nextCommentId, normalizeParagraphIdentity, nullRecord, ooxmlTreesEqual, paraIdOf, paragraphOffsetIndex, paragraphTextOf, parentNodeOf, parseSemVer, parseTocInstruction, planTocEntries, points, pointsToTwips, projectOmmlAtom, projectOmmlDisplay, propertyContainer, readCustomXmlNode, readTwipsMeasure, readViewSettings, relationshipsOf, relsPartNameFor, removeNode, removePackageCustomNode, replaceChildren, replaceNode, replayFixture, resolve, resolveContentTypeOf, resolveTocRowHeadings, revisionItemsOf, runAddressRanges, runPropertyEdits, runsCovering, sanitizeHref, satisfies, scrubExport, sectionProtectsForms, segmentsOf, semanticDigest, serializeOoxmlPart, setCommentResolved, setPackageCommentResolved, stableHash, storyParagraphs, storyRootsOf, stylesPartOf, textboxStoriesInPart, toSafeRecord, tocEntryText, tocLeftIndentTwips, twips, twipsToPoints, usedParaIds, validateDrawingOp, validateFixture, validateOoxmlPart, validatePackageInvariants, validateTreeOp, w14RootPrefix, withContentTypeOverride, withCustomXmlDataPart, withCustomXmlNode, withExportedCustomNodes, withNewPart, withRelationship, withoutCustomXmlDataPart, withoutCustomXmlNode, withoutOrphanCustomXmlNodes, wrapTargetToAnchorSpec };
|
|
2707
|
+
export { ALL_FROZEN_IDS, AUTHORABLE_PARAGRAPH_PROPERTIES, AUTHORABLE_RUN_PROPERTIES, BoundedCounter, Budget, BudgetError, CANONICAL_MUTATION_ORIGINS, COMPARATORS, CUSTOM_NODE_XPATH_PREFIX, CUSTOM_XML_PROPS_REL, CUSTOM_XML_PROPS_TYPE, CUSTOM_XML_REL, CancellationController, CancellationError, CommentRecord, CommentThreadState, CustomNodeWriteResult, DANGEROUS_KEYS, DATASTORE_NAMESPACE_URI, DEFAULT_FORMATTING_DISPLAY_MODE, DEFAULT_VIEW_SETTINGS, DEPENDENCY_KEY_IDS, DangerousKeyError, DeterministicClock, DeterministicMemoryMeter, DrawingTreeDocOp, FIELD_ATOM_CHAR, FieldResultsMode, ID_KINDS, INERT_EXECUTABLE_KINDS, ImageWrapTarget, ImpactClass, InsertCustomNodeWrite, LIMIT_KEYS, LIMIT_SPECS, LimitExceededError, MAX_STORY_SDT_NESTING, NON_CANONICAL_ORIGINS, ORIGIN_IDS, OmmlEquationProjection, OoxmlAttribute, OoxmlElement, OoxmlFldCharNode, OoxmlFldSimpleNode, OoxmlGenericElementNode, OoxmlHardBreakNode, OoxmlInstrTextNode, OoxmlInvariantIssue, OoxmlInvariantResult, OoxmlNode, OoxmlPackage, OoxmlParagraphNode, OoxmlPart, OoxmlProperty, PAGE_BREAK_CHAR, PortRegistry, PortResolutionError, PrefixAllocator, RESULT_IDS, RUNTIME_PORT_IDS, RegistryError, RelationshipRecord, ResourceLimits, ReviewCommentItem, ReviewItem, ReviewModelInput, ReviewPosition, ReviewRange, ReviewRevisionItem, RevisionSiteRefusal, SEARCH_MATCH_LIMIT, SEARCH_QUERY_MAX, SequentialIdentity, StoryScope, TOC_LEVEL_INDENT_TWIPS, TOC_MAX_BOOKMARKS_PER_REFRESH, TOC_MAX_ENTRIES, TOC_MAX_FIELD_NESTING, TOC_MAX_INSTRUCTION_CHARS, TOC_MAX_PAGE_PASSES, TREE_DOC_OP_KINDS, TWIPS_PER_POINT, TreeDocOp, TreeDocumentStore, TreeModelChange, TreeOpRejection, TreeOpResult, TreePackageStore, addComment, addPackageComment, applyEdits, applyTreeOp, assertLimitInvariants, assertValidId, assertValidQName, atomicFieldSpansOf, authoredProperties, beginOperation, bodyStoryRoot, bookmarkPairNodes, boundCustomXmlNodeIdOf, boundCustomXmlNodeIds, boundCustomXmlNodeIdsInPackage, buildTocContentControl, buildTocEntryParagraph, buildingBlockGalleryOf, buildingBlocksForControl, buildingBlocksOf, canonicalOoxmlFingerprint, canonicalize, cascadeEmptiedComments, collectNodeIds, collectReviewItems, collectRevisionSites, collectStoryParagraphs, commentItemsOf, commentPartNameOf, commentsExtendedPartNameOf, compareArtifacts, compareSemVer, containsCssFetch, contentTypesPartBytes, createNodeIdAllocator, customNodeBinding, customXmlDataParts, customXmlLabelXPath, customXmlNodes, customXmlPrefixMappings, datastoreItemIdFor, deleteCommentThread, deletePackageComments, deriveOoxmlIndexes, detectBodyTocs, diffSemanticDigests, digestPart, directParagraphMarkProperties, directParagraphProperties, displayMathAlignment, drawingOpImpact, endOperation, equationsOfAtom, escapeCssString, escapeXml, extractFragmentPackage, fieldAtomText, fieldOnOffAttribute, findCustomXmlDataPart, findDetectedToc, findNode, findOccurrences, fingerprint, fldCharType, fldSimpleInstr, fnv1a32, foldCase, formatOwnedRunIds, formattableRanges, formsProtectionEnabled, glossaryPartOf, hardBreakAttributes, hardBreakKind, hardBreakText, hasCommentPart, hasLegacyFormFieldData, hasNode, hashAuthored, indexStyles, inlineControlEndingAt, inlineControlStartingAt, insertChildren, insertPackageCustomNode, instrTextValue, isAuthorableRunProperty, isDangerousKey, isDrawingTreeDocOp, isEvaluableField, isFieldChrome, isFldChar, isFldCharNode, isFldSimple, isFldSimpleNode, isInertExecutable, isInstrText, isInstrTextNode, isLegalFldCharType, isOmmlDisplay, isOmmlEquationAtom, isPageBreakNode, isSearchableQuery, isStoryPart, isValidId, isValidNCName, isValidParaId, isValidQName, isWholeWord, linkRevisionReplies, locateSites, makeLimitCounter, materializeGlossaryPlaceholders, mergeFragmentIntoPackage, mergedFontProperty, mergedMultiSettingProperty, mergedParagraphMarkProperties, mergedProperties, mintParaId, mintedParagraphIdentityAttributes, nextCommentId, normalizeParagraphIdentity, nullRecord, ooxmlTreesEqual, paraIdOf, paragraphOffsetIndex, paragraphTextOf, parentNodeOf, parseSemVer, parseTocInstruction, planTocEntries, points, pointsToTwips, projectOmmlAtom, projectOmmlDisplay, propertyContainer, readCustomXmlNode, readTwipsMeasure, readViewSettings, relationshipsOf, relsPartNameFor, removeNode, removePackageCustomNode, replaceChildren, replaceNode, replayFixture, resolve, resolveContentTypeOf, resolveTocRowHeadings, revisionItemsOf, runAddressRanges, runPropertyEdits, runsCovering, sanitizeHref, satisfies, scrubExport, sectionProtectsForms, segmentsOf, semanticDigest, serializeOoxmlPart, setCommentResolved, setPackageCommentResolved, stableHash, storyParagraphs, storyRootsOf, stylesPartOf, textboxStoriesInPart, toSafeRecord, tocEntryText, tocLeftIndentTwips, twips, twipsToPoints, usedParaIds, validateDrawingOp, validateFixture, validateOoxmlPart, validatePackageInvariants, validateTreeOp, w14RootPrefix, withContentTypeOverride, withCustomXmlDataPart, withCustomXmlNode, withExportedCustomNodes, withNewPart, withRelationship, withoutCustomXmlDataPart, withoutCustomXmlNode, withoutOrphanCustomXmlNodes, wrapTargetToAnchorSpec };
|
|
2683
2708
|
export type { AddCommentRequest, AddCommentResult, AnchorSnapshot, AtomicFieldSpan, AuditPort, AuthorizationPort, BuildingBlock, BuildingBlockGalleryFilter, CancellationPhase, CancellationPort, CancellationToken, CapabilityId, ClockPort, CommentAnchorRequest, CommentDeletionOwner, ComparatorDescriptor, ComparatorMode, ComparatorName, ComparisonResult, ConformanceFixture, ContentItem, Contribution, CustomNodeBinding, CustomNodeExportPolicy, CustomNodeExportRequest, CustomNodeExportResult, CustomXmlDataPart, CustomXmlDataPartResult, CustomXmlNode, DetectedToc, DigestDifference, DocumentViewSettings, EditOptions, EncodedEnvelope, EnforcementPhase, ExternalResourceConsentPort, FeatureBundle, FixtureExpectation, FixtureOutcome, FixtureSource, FixtureStep, FldCharType, FontPort, FormattingDisplayMode, FormattingRevisionAuthorFilter, FragmentCoverage, FragmentExtractRejection, FragmentExtractResult, FragmentMergeRejection, FragmentMergeResult, HardBreakKind, HrefProjection, IdKind, IdentityPort, ImagePort, InertExecutableKind, InlineControlSpan, Json, LimitSpec, LimitUnit, LinkableReviewItem, ModelChangeSummary, OffsetSpan, OoxmlEditResult, OoxmlIndexes, OoxmlStoryKind, OoxmlStoryRoot, OperationContext, OperationInit, PackageCommentDelete, PackageInvariantCode, PackageInvariantIssue, PackageInvariantResult, ParagraphDigest, ParagraphIndexEntry, ParagraphOffsetIndex, PersistencePort, Points, RegistryErrorCode, ReplacementPolicy, ReplayOutcome, ReplayReport, ReplayStore, Reservation, ResolveOptions, ResolvedRegistry, ResourceAccountingPort, RunPropertyEdit, SchedulingPort, ScrubResult, Segment, SemVer, SemanticDigest, SetCommentResolvedResult, ShapingPort, StoryDigest, StoryIndexEntry, StyleIndexEntry, TextMatchOptions, TextOccurrence, TextOccurrences, TextboxStoryRoot, TocEntryPlan, TocInstruction, TocOutlineHeading, TransactionRevisionIds, TransportPort, Twips, ValidationResult };
|