@arbidocs/blocks 0.4.101 → 0.4.103
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/chunk-6MG62I5B.cjs +272 -0
- package/dist/chunk-6MG62I5B.cjs.map +1 -0
- package/dist/{chunk-MYALCKDR.js → chunk-CVYY4X5R.js} +306 -75
- package/dist/chunk-CVYY4X5R.js.map +1 -0
- package/dist/chunk-EQB3WELX.js +269 -0
- package/dist/chunk-EQB3WELX.js.map +1 -0
- package/dist/{chunk-G5JH2YMQ.js → chunk-GQTIAATM.js} +3 -3
- package/dist/{chunk-G5JH2YMQ.js.map → chunk-GQTIAATM.js.map} +1 -1
- package/dist/{chunk-YGREW5TZ.js → chunk-H6DFXG5N.js} +3 -3
- package/dist/{chunk-YGREW5TZ.js.map → chunk-H6DFXG5N.js.map} +1 -1
- package/dist/{chunk-ZT2EBBSC.cjs → chunk-N36PWG7A.cjs} +5 -5
- package/dist/{chunk-ZT2EBBSC.cjs.map → chunk-N36PWG7A.cjs.map} +1 -1
- package/dist/{chunk-FAGQTB3D.cjs → chunk-O33EBMIX.cjs} +305 -74
- package/dist/chunk-O33EBMIX.cjs.map +1 -0
- package/dist/{chunk-Y5XW57U4.cjs → chunk-TFDU2KGS.cjs} +5 -5
- package/dist/{chunk-Y5XW57U4.cjs.map → chunk-TFDU2KGS.cjs.map} +1 -1
- package/dist/connect/docx.cjs +6 -6
- package/dist/connect/docx.js +4 -4
- package/dist/connect/index.cjs +3 -3
- package/dist/connect/index.js +2 -2
- package/dist/document-tools/AdoptSignatureDialog.d.ts +25 -0
- package/dist/document-tools/DocumentToolButtons.d.ts +2 -0
- package/dist/document-tools/SignatureRequestBanner.d.ts +18 -0
- package/dist/document-tools/index.cjs +175 -0
- package/dist/document-tools/index.cjs.map +1 -1
- package/dist/document-tools/index.d.ts +3 -1
- package/dist/document-tools/index.js +168 -3
- package/dist/document-tools/index.js.map +1 -1
- package/dist/document-tools/viewer/GuidedSigningViewer.d.ts +26 -0
- package/dist/document-tools/viewer/SignatureFieldsOverlay.d.ts +41 -0
- package/dist/document-tools/viewer/SignatureRequestEditor.d.ts +26 -0
- package/dist/document-tools/viewer/index.cjs +983 -0
- package/dist/document-tools/viewer/index.cjs.map +1 -1
- package/dist/document-tools/viewer/index.d.ts +3 -0
- package/dist/document-tools/viewer/index.js +983 -5
- package/dist/document-tools/viewer/index.js.map +1 -1
- package/dist/docx/RibbonMenu.d.ts +4 -1
- package/dist/docx/RibbonOverflow.d.ts +27 -0
- package/dist/docx/WordReferences.d.ts +3 -2
- package/dist/docx/index.cjs +35 -35
- package/dist/docx/index.js +3 -3
- package/dist/docx/noteStyles.d.ts +46 -0
- package/dist/docx/overflowPlan.d.ts +15 -0
- package/dist/index.cjs +5 -5
- package/dist/index.js +1 -1
- package/node_modules/@arbidocs/coedit/LICENSE +21 -0
- package/node_modules/@arbidocs/coedit/dist/encoding.cjs +751 -0
- package/node_modules/@arbidocs/coedit/dist/encoding.cjs.map +1 -0
- package/node_modules/@arbidocs/coedit/dist/encoding.d.cts +192 -0
- package/node_modules/@arbidocs/coedit/dist/encoding.d.ts +192 -0
- package/node_modules/@arbidocs/coedit/dist/encoding.js +716 -0
- package/node_modules/@arbidocs/coedit/dist/encoding.js.map +1 -0
- package/node_modules/@arbidocs/coedit/dist/hocuspocus.cjs +1759 -0
- package/node_modules/@arbidocs/coedit/dist/hocuspocus.cjs.map +1 -0
- package/node_modules/@arbidocs/coedit/dist/hocuspocus.d.cts +39 -0
- package/node_modules/@arbidocs/coedit/dist/hocuspocus.d.ts +39 -0
- package/node_modules/@arbidocs/coedit/dist/hocuspocus.js +1736 -0
- package/node_modules/@arbidocs/coedit/dist/hocuspocus.js.map +1 -0
- package/node_modules/@arbidocs/coedit/dist/index.cjs +1692 -0
- package/node_modules/@arbidocs/coedit/dist/index.cjs.map +1 -0
- package/node_modules/@arbidocs/coedit/dist/index.d.cts +16 -0
- package/node_modules/@arbidocs/coedit/dist/index.d.ts +16 -0
- package/node_modules/@arbidocs/coedit/dist/index.js +1664 -0
- package/node_modules/@arbidocs/coedit/dist/index.js.map +1 -0
- package/node_modules/@arbidocs/coedit/dist/server.cjs +1852 -0
- package/node_modules/@arbidocs/coedit/dist/server.cjs.map +1 -0
- package/node_modules/@arbidocs/coedit/dist/server.d.cts +43 -0
- package/node_modules/@arbidocs/coedit/dist/server.d.ts +43 -0
- package/node_modules/@arbidocs/coedit/dist/server.js +1822 -0
- package/node_modules/@arbidocs/coedit/dist/server.js.map +1 -0
- package/node_modules/@arbidocs/coedit/dist/session-Cf9iu1Vt.d.cts +82 -0
- package/node_modules/@arbidocs/coedit/dist/session-Cf9iu1Vt.d.ts +82 -0
- package/node_modules/@arbidocs/coedit/dist/template.cjs +1627 -0
- package/node_modules/@arbidocs/coedit/dist/template.cjs.map +1 -0
- package/node_modules/@arbidocs/coedit/dist/template.d.cts +125 -0
- package/node_modules/@arbidocs/coedit/dist/template.d.ts +125 -0
- package/node_modules/@arbidocs/coedit/dist/template.js +1612 -0
- package/node_modules/@arbidocs/coedit/dist/template.js.map +1 -0
- package/node_modules/@arbidocs/coedit/dist/versions-DXiFQMA6.d.cts +8 -0
- package/node_modules/@arbidocs/coedit/dist/versions-DXiFQMA6.d.ts +8 -0
- package/node_modules/@arbidocs/coedit/package.json +68 -0
- package/node_modules/@docx-editor.dev/core/LICENSE +201 -0
- package/node_modules/@docx-editor.dev/core/README.md +125 -0
- package/node_modules/@docx-editor.dev/core/THIRD_PARTY_NOTICES.md +56 -0
- package/node_modules/@docx-editor.dev/core/dist/automation.cjs +1 -0
- package/node_modules/@docx-editor.dev/core/dist/automation.d.ts +162 -0
- package/node_modules/@docx-editor.dev/core/dist/automation.js +1 -0
- package/node_modules/@docx-editor.dev/core/dist/binding.cjs +1 -0
- package/node_modules/@docx-editor.dev/core/dist/binding.d.ts +164 -0
- package/node_modules/@docx-editor.dev/core/dist/binding.js +1 -0
- package/node_modules/@docx-editor.dev/core/dist/chunk-2GO5T2JU.cjs +1 -0
- package/node_modules/@docx-editor.dev/core/dist/chunk-2RC2EPND.js +3 -0
- package/node_modules/@docx-editor.dev/core/dist/chunk-4GBTELJV.cjs +28 -0
- package/node_modules/@docx-editor.dev/core/dist/chunk-4R3TEXMN.js +18 -0
- package/node_modules/@docx-editor.dev/core/dist/chunk-5CSUYANV.js +1 -0
- package/node_modules/@docx-editor.dev/core/dist/chunk-6APGXLBB.cjs +3 -0
- package/node_modules/@docx-editor.dev/core/dist/chunk-6AWEKBLB.cjs +1 -0
- package/node_modules/@docx-editor.dev/core/dist/chunk-6EYYL7FL.js +1 -0
- package/node_modules/@docx-editor.dev/core/dist/chunk-6JIJOZDW.js +1 -0
- package/node_modules/@docx-editor.dev/core/dist/chunk-BTQKU64Q.cjs +1 -0
- package/node_modules/@docx-editor.dev/core/dist/chunk-E7BQA6UP.js +2 -0
- package/node_modules/@docx-editor.dev/core/dist/chunk-EO4C5QJW.cjs +2 -0
- package/node_modules/@docx-editor.dev/core/dist/chunk-ETTO6GK3.js +1 -0
- package/node_modules/@docx-editor.dev/core/dist/chunk-FIJZIQXA.cjs +18 -0
- package/node_modules/@docx-editor.dev/core/dist/chunk-FRXAOVTB.js +28 -0
- package/node_modules/@docx-editor.dev/core/dist/chunk-J6BVWIDB.js +2 -0
- package/node_modules/@docx-editor.dev/core/dist/chunk-JGNVNT2A.cjs +2 -0
- package/node_modules/@docx-editor.dev/core/dist/chunk-K5U2PLDP.cjs +2 -0
- package/node_modules/@docx-editor.dev/core/dist/chunk-KKIJG3C6.js +2 -0
- package/node_modules/@docx-editor.dev/core/dist/chunk-LWDSDCMO.js +27 -0
- package/node_modules/@docx-editor.dev/core/dist/chunk-NBCVVZOM.cjs +1 -0
- package/node_modules/@docx-editor.dev/core/dist/chunk-O2AL2HSJ.cjs +1 -0
- package/node_modules/@docx-editor.dev/core/dist/chunk-O5INAWZQ.js +1 -0
- package/node_modules/@docx-editor.dev/core/dist/chunk-QMLCVPCD.cjs +1 -0
- package/node_modules/@docx-editor.dev/core/dist/chunk-RCHS4ZEH.cjs +27 -0
- package/node_modules/@docx-editor.dev/core/dist/chunk-RIYSCEFQ.js +2 -0
- package/node_modules/@docx-editor.dev/core/dist/chunk-S6J4O5XP.js +1 -0
- package/node_modules/@docx-editor.dev/core/dist/chunk-SRPILEWV.cjs +5 -0
- package/node_modules/@docx-editor.dev/core/dist/chunk-TSLBZ26X.js +1 -0
- package/node_modules/@docx-editor.dev/core/dist/chunk-UKVVUHZL.cjs +1 -0
- package/node_modules/@docx-editor.dev/core/dist/chunk-VDNNLG6X.js +2 -0
- package/node_modules/@docx-editor.dev/core/dist/chunk-VHAVHCQY.js +7 -0
- package/node_modules/@docx-editor.dev/core/dist/chunk-VX43VBAX.cjs +7 -0
- package/node_modules/@docx-editor.dev/core/dist/chunk-Z6WBFXJU.js +5 -0
- package/node_modules/@docx-editor.dev/core/dist/chunk-ZUHOMK52.cjs +2 -0
- package/node_modules/@docx-editor.dev/core/dist/collaboration/replication.cjs +1 -0
- package/node_modules/@docx-editor.dev/core/dist/collaboration/replication.d.ts +270 -0
- package/node_modules/@docx-editor.dev/core/dist/collaboration/replication.js +1 -0
- package/node_modules/@docx-editor.dev/core/dist/collaboration.cjs +1 -0
- package/node_modules/@docx-editor.dev/core/dist/collaboration.d.ts +269 -0
- package/node_modules/@docx-editor.dev/core/dist/collaboration.js +1 -0
- package/node_modules/@docx-editor.dev/core/dist/contracts/document.cjs +1 -0
- package/node_modules/@docx-editor.dev/core/dist/contracts/document.d.ts +290 -0
- package/node_modules/@docx-editor.dev/core/dist/contracts/document.js +0 -0
- package/node_modules/@docx-editor.dev/core/dist/contracts/editor.cjs +1 -0
- package/node_modules/@docx-editor.dev/core/dist/contracts/editor.d.ts +22 -0
- package/node_modules/@docx-editor.dev/core/dist/contracts/editor.js +1 -0
- package/node_modules/@docx-editor.dev/core/dist/contracts/interaction.cjs +1 -0
- package/node_modules/@docx-editor.dev/core/dist/contracts/interaction.d.ts +103 -0
- package/node_modules/@docx-editor.dev/core/dist/contracts/interaction.js +0 -0
- package/node_modules/@docx-editor.dev/core/dist/contracts/modules.cjs +1 -0
- package/node_modules/@docx-editor.dev/core/dist/contracts/modules.d.ts +143 -0
- package/node_modules/@docx-editor.dev/core/dist/contracts/modules.js +1 -0
- package/node_modules/@docx-editor.dev/core/dist/contracts/types.cjs +1 -0
- package/node_modules/@docx-editor.dev/core/dist/contracts/types.d.ts +11 -0
- package/node_modules/@docx-editor.dev/core/dist/contracts/types.js +0 -0
- package/node_modules/@docx-editor.dev/core/dist/custom-node-writes-cvL5rhcD.d.ts +323 -0
- package/node_modules/@docx-editor.dev/core/dist/dist-PKZR6RSH.js +2 -0
- package/node_modules/@docx-editor.dev/core/dist/document-protection-BAGVGqaP.d.ts +20 -0
- package/node_modules/@docx-editor.dev/core/dist/editor-Ci7IZGmG.d.ts +2448 -0
- package/node_modules/@docx-editor.dev/core/dist/editor-scope-OHPwVQ5l.d.ts +84 -0
- package/node_modules/@docx-editor.dev/core/dist/editor.cjs +1 -0
- package/node_modules/@docx-editor.dev/core/dist/editor.css +15 -0
- package/node_modules/@docx-editor.dev/core/dist/editor.d.ts +1394 -0
- package/node_modules/@docx-editor.dev/core/dist/editor.js +1 -0
- package/node_modules/@docx-editor.dev/core/dist/export.cjs +2 -0
- package/node_modules/@docx-editor.dev/core/dist/export.d.ts +391 -0
- package/node_modules/@docx-editor.dev/core/dist/export.js +2 -0
- package/node_modules/@docx-editor.dev/core/dist/failure-NS2lsya4.d.ts +115 -0
- package/node_modules/@docx-editor.dev/core/dist/font-resolver-BVQB14qT.d.ts +256 -0
- package/node_modules/@docx-editor.dev/core/dist/harfbuzz.wasm +0 -0
- package/node_modules/@docx-editor.dev/core/dist/headless-document-view-qH331moE.d.ts +143 -0
- package/node_modules/@docx-editor.dev/core/dist/image-resources-BN-hUgCn.d.ts +211 -0
- package/node_modules/@docx-editor.dev/core/dist/index-Bsg7oIKP.d.ts +3869 -0
- package/node_modules/@docx-editor.dev/core/dist/index.cjs +1 -0
- package/node_modules/@docx-editor.dev/core/dist/index.d.ts +53 -0
- package/node_modules/@docx-editor.dev/core/dist/index.js +1 -0
- package/node_modules/@docx-editor.dev/core/dist/layout-shaping-BEyuiQOk.d.ts +246 -0
- package/node_modules/@docx-editor.dev/core/dist/layout.cjs +1 -0
- package/node_modules/@docx-editor.dev/core/dist/layout.d.ts +3151 -0
- package/node_modules/@docx-editor.dev/core/dist/layout.js +1 -0
- package/node_modules/@docx-editor.dev/core/dist/node-module-shim-TTKTT66I.js +1 -0
- package/node_modules/@docx-editor.dev/core/dist/note-properties-4Y9o6Gyk.d.ts +68 -0
- package/node_modules/@docx-editor.dev/core/dist/omml-equation-CuzBL5DD.d.ts +85 -0
- package/node_modules/@docx-editor.dev/core/dist/output.cjs +1 -0
- package/node_modules/@docx-editor.dev/core/dist/output.d.ts +97 -0
- package/node_modules/@docx-editor.dev/core/dist/output.js +1 -0
- package/node_modules/@docx-editor.dev/core/dist/protocol-Bqk4Izjc.d.ts +1651 -0
- package/node_modules/@docx-editor.dev/core/dist/review-pane-D9jm8DcY.d.ts +128 -0
- package/node_modules/@docx-editor.dev/core/dist/review-paragraph-order-DT-n6ouC.d.ts +85 -0
- package/node_modules/@docx-editor.dev/core/dist/revision-projection-DZ4kKVev.d.ts +242 -0
- package/node_modules/@docx-editor.dev/core/dist/semantic-cell-selection-D9D1KSXq.d.ts +464 -0
- package/node_modules/@docx-editor.dev/core/dist/semantic-interaction-CIC-PooQ.d.ts +135 -0
- package/node_modules/@docx-editor.dev/core/dist/semantic-paint-BME37OMv.d.ts +326 -0
- package/node_modules/@docx-editor.dev/core/dist/semantic-record-queries-CBlZqZNa.d.ts +177 -0
- package/node_modules/@docx-editor.dev/core/dist/semantic-records-4B3WwFAi.d.ts +3532 -0
- package/node_modules/@docx-editor.dev/core/dist/store.cjs +1 -0
- package/node_modules/@docx-editor.dev/core/dist/store.d.ts +2706 -0
- package/node_modules/@docx-editor.dev/core/dist/store.js +1 -0
- package/node_modules/@docx-editor.dev/core/dist/tree-package-fragment-BeeKxDw8.d.ts +1201 -0
- package/node_modules/@docx-editor.dev/core/dist/tree-session-contract-CVbmlMlq.d.ts +664 -0
- package/node_modules/@docx-editor.dev/core/dist/types-barrel-D3xCgQX6.d.ts +4269 -0
- package/node_modules/@docx-editor.dev/core/licenses/HarfBuzz-COPYING.txt +42 -0
- package/node_modules/@docx-editor.dev/core/package.json +140 -0
- package/node_modules/@docx-editor.dev/react/LICENSE +201 -0
- package/node_modules/@docx-editor.dev/react/README.md +141 -0
- package/node_modules/@docx-editor.dev/react/THIRD_PARTY_NOTICES.md +18 -0
- package/node_modules/@docx-editor.dev/react/dist/index.d.mts +4928 -0
- package/node_modules/@docx-editor.dev/react/dist/index.d.ts +4928 -0
- package/node_modules/@docx-editor.dev/react/dist/index.js +4 -0
- package/node_modules/@docx-editor.dev/react/dist/index.mjs +4 -0
- package/node_modules/@docx-editor.dev/react/package.json +74 -0
- package/node_modules/@docx-editor.dev/react/src/styles/editor.css +6 -0
- package/node_modules/@docx-editor.dev/react/src/styles/zIndex.ts +28 -0
- package/package.json +26 -15
- package/src/docx/README.md +10 -0
- package/src/docx/styles.css +73 -5
- package/dist/chunk-FAGQTB3D.cjs.map +0 -1
- package/dist/chunk-MYALCKDR.js.map +0 -1
|
@@ -0,0 +1,2706 @@
|
|
|
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-BN-hUgCn.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, a as ImageDecodePort, I as ImageResourceLimits, h as ImageResourceLookup, b 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-BN-hUgCn.js';
|
|
17
|
+
import { O as OoxmlPart, N as OoxmlNode, aP as OoxmlInvariantResult, aQ as OoxmlInvariantIssue, Z as OoxmlElement, ab as OoxmlParagraphNode, aR as OoxmlFldCharNode, aS as OoxmlFldSimpleNode, aT as OoxmlInstrTextNode, W as TreeDocOp, a8 as TreeOpRejection, aU as TreeOpResult, Q as OoxmlPackage, aV as RelationshipRecord, V as OoxmlGenericElementNode, aW as OoxmlHardBreakNode, aX as OoxmlAttribute, X as OoxmlProperty, f as ReviewRange, R as ReviewModelInput, a as ReviewItem, C as CommentRecord, e as ReviewPosition, aY as CommentThreadState, c as ReviewCommentItem, b as ReviewRevisionItem, aj as DrawingTreeDocOp, ak as ImpactClass, an as ImageWrapTarget } from './types-barrel-D3xCgQX6.js';
|
|
18
|
+
export { aZ as ACCEPTED_PARAGRAPH_PROPERTIES, a_ as ACCEPTED_RUN_PROPERTIES, a$ as CONTENT_CONTROL_ID_MAX, b0 as CONTENT_CONTROL_PROPERTY_ORDER, b1 as CommentAnchor, b2 as CommentPosition, b3 as CommitTextFormFieldOp, b4 as ContentControlCheckbox, b5 as ContentControlCheckboxState, b6 as ContentControlDataBinding, b7 as ContentControlDateFormat, b8 as ContentControlEntry, b9 as ContentControlKind, ba as ContentControlLevel, bb as ContentControlListItem, bc as ContentControlLock, bd as ContentControlProperties, be as ContentTypeError, bf as ContentTypeIndex, bg as ContentTypeRecords, bh as DEFAULT_OOXML_PACKAGE_LIMITS, bi as DEFAULT_ZIP_LIMITS, bj as DefaultRecord, bk as DeleteTextOp, aL as DrawingImageEffects, am as DrawingKind, ap as DrawingLocks, ao as DrawingPositionInput, bl as HYPERLINK_RELATIONSHIP_TYPE, bm as HyperlinkKind, bn as HyperlinkTarget, bo as IMAGE_RELATIONSHIP_TYPE, aH as IMAGE_WRAP_TARGETS, bp as ImageRelationshipResolution, bq as IndexResult, br as InsertBuildingBlockOp, bs as InsertTextOp, bt as LegacyCheckboxFieldRange, bu as MAX_CONTENT_CONTROLS_PER_PART, bv as MAX_CONTENT_CONTROL_NESTING, bw as NameRejection, bx as NameResult, by as OFFICE_RELATIONSHIP_NAMESPACE_URI, bz as OOXML_NODE_IDENTITY_RULES, bA as OoxmlBodyNode, bB as OoxmlBookmarkEndNode, bC as OoxmlBookmarkStartNode, bD as OoxmlContentControlCalendarNode, bE as OoxmlContentControlCheckboxNode, bF as OoxmlContentControlCheckedNode, bG as OoxmlContentControlCheckedStateNode, bH as OoxmlContentControlComboBoxNode, $ as OoxmlContentControlContentNode, bI as OoxmlContentControlDataBindingNode, bJ as OoxmlContentControlDateFormatNode, bK as OoxmlContentControlDateNode, bL as OoxmlContentControlDropDownListNode, bM as OoxmlContentControlEndPropertiesNode, bN as OoxmlContentControlLidNode, bO as OoxmlContentControlListItemNode, _ as OoxmlContentControlNode, bP as OoxmlContentControlPropertiesNode, bQ as OoxmlContentControlStoreMappedDataAsNode, bR as OoxmlContentControlTextNode, bS as OoxmlContentControlUncheckedStateNode, ad as OoxmlContinuationSeparatorNode, bT as OoxmlDocumentNode, ae as OoxmlEndnotesNode, bU as OoxmlExternalTarget, af as OoxmlFootnotesNode, bV as OoxmlGenericExtensionAttribute, bW as OoxmlHyperlinkNode, bX as OoxmlInvariantIssueCode, bY as OoxmlKnownNodeAttribute, bZ as OoxmlNamespaceBinding, U as OoxmlNodeId, b_ as OoxmlNodeIdentityRules, ac as OoxmlNoteNode, ag as OoxmlNoteRefNode, ah as OoxmlNoteReferenceNode, a1 as OoxmlPackageLimits, Y as OoxmlPackageRejection, b$ as OoxmlPackageResult, c0 as OoxmlParagraphPropertiesNode, c1 as OoxmlPartMetadata, c2 as OoxmlReadRejection, c3 as OoxmlReadResult, c4 as OoxmlRunNode, c5 as OoxmlRunPropertiesNode, ai as OoxmlSeparatorNode, c6 as OoxmlTabNode, c7 as OoxmlTextElementNode, c8 as OoxmlTextNode, c9 as OoxmlWmlValAttribute, ca as OoxmlXmlSpaceAttribute, cb as OverrideRecord, cc as RelationshipError, cd as RelationshipSetResult, ce as RelationshipTargetResolver, cf as ResolveResult, cg as ResolvedRelationship, d as ReviewCustomItem, g as ReviewRevisionKind, h as RevisionAddress, a2 as RevisionAuthorEntry, a3 as RevisionAuthorResult, a4 as RevisionAuthorSkipReason, a5 as RevisionBatchEntry, a6 as RevisionBatchResult, a7 as RevisionBatchSkipReason, ch as SetLegacyCheckboxOp, ci as SetLegacyDropdownOp, cj as SetTextFormFieldDefaultOp, al as SourceCrop, ck as TABLE_BORDER_STYLES, cl as TabStopWrite, aJ as TableBorderStyle, cm as TargetMode, cn as TextFormFieldOptions, co as TextFormFieldRange, cp as TextFormFieldType, cq as TreeDocOpKind, cr as TreeOpEffect, cs as W15_NAMESPACE_URI, ct as WML_NAMESPACE_URI, cu as XMLNS_NAMESPACE_URI, cv as XML_NAMESPACE_URI, cw as XmlLimits, cx as XmlNode, cy as XmlRejection, cz as XmlResult, cA as ZipLimits, cB as ZipReadResult, cC as ZipRejection, cD as allocateContentControlId, cE as asciiFold, cF as buildContentTypeIndex, cG as buildRelationshipSet, cH as childElements, cI as commentAnchorsOfStory, cJ as commentsOfPart, cK as contentControlContentChildren, cL as contentControlContentNodeOf, cM as contentControlEndPropertiesNodeOf, cN as contentControlLevelOf, cO as contentControlPropertiesNodeOf, cP as contentControlPropertiesOf, cQ as contentControlTextOf, cR as contentControlsIn, cS as detectDuplicateNames, cT as extensionKey, cU as findContentControl, cV as findElement, cW as firstReviewRange, cX as flattenContentControls, cY as hasAnyComment, cZ as hyperlinkAnchorOf, c_ as hyperlinkRelationshipIdOf, c$ as hyperlinkTargetOf, d0 as isContentControlContentNode, d1 as isContentControlNode, d2 as isContentControlWrapper, d3 as isContentRevisionKind, d4 as isHyperlinkNode, d5 as isRangeMarkerKind, d6 as isValidMime, d7 as legacyCheckboxFieldsOf, d8 as lockForbidsEdit, d9 as lockForbidsRemoval, da as normalizePartName, db as orderedContentControlProperties, dc as parseContentControlId, dd as partNameKey, de as planRevisionAuthorChange, df as planRevisionBatch, dg as projectDrawing, dh as readOnOffChild, di as readOoxmlPackage, dj as readOoxmlPart, dk as readXml, dl as readZip, dm as resolveContentControlLock, dn as resolveContentType, dp as resolveImageRelationship, dq as resolveInternalTarget, dr as resolveRelationship, ds as reviewItemKey, dt as reviewItemRanges, du as textContent, dv as textFormFieldsOf, dw as threadStateOfPart, dx as validateExternalTarget, dy as withPart, dz as writeOoxmlPackage, dA as writeZip } from './types-barrel-D3xCgQX6.js';
|
|
19
|
+
import { k as FieldResultsMode, e as TreeModelChange, f as TreeDocumentStore, T as TreePackageStore, S as StoryScope } from './tree-package-fragment-BeeKxDw8.js';
|
|
20
|
+
export { l as AtomicNoteSpan, C as CascadeDeletedNoteReferencesOptions, D as DEFAULT_MAX_EDITABLE_STORY_PARTS, m as DrawingPropertyIdResult, F as FragmentPasteInput, j 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-fragment-BeeKxDw8.js';
|
|
21
|
+
import { O as OmmlEquationProjection } from './omml-equation-CuzBL5DD.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-CuzBL5DD.js';
|
|
23
|
+
import { I as InsertCustomNodeWrite, C as CustomNodeWriteResult } from './custom-node-writes-cvL5rhcD.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-cvL5rhcD.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-DT-n6ouC.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-qH331moE.js';
|
|
27
|
+
export { A as AuthoredNoteProperties, D as DEFAULT_ENDNOTE_PROPERTIES, a as DEFAULT_FOOTNOTE_PROPERTIES, E as EndnotePosition, F as FootnotePosition, N as NoteNumRestart, R as ResolvedEndnoteProperties, b 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-4Y9o6Gyk.js';
|
|
28
|
+
export { a as DocumentProtectionEdit, D as DocumentProtectionState, N as NO_DOCUMENT_PROTECTION, r as readDocumentProtection } from './document-protection-BAGVGqaP.js';
|
|
29
|
+
import './editor-scope-OHPwVQ5l.js';
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Serialize normalized XML from a canonical part using repository-controlled
|
|
33
|
+
* prefixes and validated, escaped names and values. This does not yet replace
|
|
34
|
+
* writeDocx; package integration belongs to the subsequent migration pass.
|
|
35
|
+
*/
|
|
36
|
+
declare function serializeOoxmlPart(part: OoxmlPart): string;
|
|
37
|
+
/** Repository-owned namespace-aware semantic XML oracle. */
|
|
38
|
+
declare function canonicalOoxmlFingerprint(value: OoxmlPart | OoxmlNode): string;
|
|
39
|
+
/**
|
|
40
|
+
* Structural equality of two canonical trees, ignoring node ids.
|
|
41
|
+
*
|
|
42
|
+
* Ids differ between two parses of the same bytes, so comparing them would report every reopen as
|
|
43
|
+
* a change. This compares what the document SAYS.
|
|
44
|
+
*/
|
|
45
|
+
declare function ooxmlTreesEqual(left: OoxmlPart | OoxmlNode, right: OoxmlPart | OoxmlNode): boolean;
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Validate a parser-created or copy-modified immutable part before publication.
|
|
49
|
+
* Future tree-edit primitives can retain shared nodes and their IDs, while any
|
|
50
|
+
* replacement chooses explicitly whether to retain or allocate identity.
|
|
51
|
+
*/
|
|
52
|
+
declare function validateOoxmlPart(part: OoxmlPart): OoxmlInvariantResult;
|
|
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
|
+
|
|
167
|
+
/** UTF-16 placeholder for one atomic field unit in `paragraphTextOf` / segments. */
|
|
168
|
+
declare const FIELD_ATOM_CHAR = "\uFFFC";
|
|
169
|
+
/**
|
|
170
|
+
* Which part of a complex field a `w:fldChar` marks.
|
|
171
|
+
*
|
|
172
|
+
* A complex field spans many runs: `begin`, the instruction, `separate`, the cached result, then
|
|
173
|
+
* `end` — which is why a field is one logical unit across several nodes.
|
|
174
|
+
*/
|
|
175
|
+
type FldCharType = 'begin' | 'separate' | 'end';
|
|
176
|
+
/** Read `@w:fldCharType` when present and schema-legal. */
|
|
177
|
+
declare function fldCharType(node: OoxmlNode): FldCharType | null;
|
|
178
|
+
/** Whether a node is a `w:fldChar` field boundary marker. */
|
|
179
|
+
declare function isFldCharNode(node: OoxmlNode): node is OoxmlFldCharNode;
|
|
180
|
+
/**
|
|
181
|
+
* Whether a node is `w:instrText` — a field's instruction.
|
|
182
|
+
*
|
|
183
|
+
* Instructions are never EXECUTED or auto-resolved: `DDE` and `INCLUDE*` render inert.
|
|
184
|
+
*/
|
|
185
|
+
declare function isInstrTextNode(node: OoxmlNode): node is OoxmlInstrTextNode;
|
|
186
|
+
/** Whether a node is `w:fldSimple` — a field whose instruction and result are one element. */
|
|
187
|
+
declare function isFldSimpleNode(node: OoxmlNode): node is OoxmlFldSimpleNode;
|
|
188
|
+
/** Typed or generic `w:fldChar` with the given type. */
|
|
189
|
+
declare function isFldChar(node: OoxmlNode, type: FldCharType): boolean;
|
|
190
|
+
/**
|
|
191
|
+
* Typed or generic `w:instrText`, and `w:delInstrText` — the form a tracked deletion gives
|
|
192
|
+
* the instruction (§17.16.13), always generic in the canonical tree.
|
|
193
|
+
*
|
|
194
|
+
* One predicate for both on purpose: everything that consumes instruction text (the offset
|
|
195
|
+
* authority, the layout field machine, span collection) must treat a deleted field's
|
|
196
|
+
* instruction exactly like a live one — ingested per phase, never painted. Excluding the
|
|
197
|
+
* deleted form let its `w:delInstrText` fall through those walks as ordinary run content.
|
|
198
|
+
*/
|
|
199
|
+
declare function isInstrText(node: OoxmlNode): boolean;
|
|
200
|
+
/** Typed or generic `w:fldSimple`. */
|
|
201
|
+
declare function isFldSimple(node: OoxmlNode): boolean;
|
|
202
|
+
/** Concatenated text descendants of `w:instrText` (instruction only — never executed). */
|
|
203
|
+
declare function instrTextValue(node: OoxmlNode): string;
|
|
204
|
+
/** `@w:instr` on `w:fldSimple`, or undefined when absent. */
|
|
205
|
+
declare function fldSimpleInstr(node: OoxmlNode): string | undefined;
|
|
206
|
+
/**
|
|
207
|
+
* Read an on/off WML attribute (`dirty` / `fldLock`).
|
|
208
|
+
*
|
|
209
|
+
* Returns `undefined` when absent, otherwise the OOXML on/off interpretation
|
|
210
|
+
* (present without val, or val not explicitly off → true).
|
|
211
|
+
*/
|
|
212
|
+
declare function fieldOnOffAttribute(node: OoxmlNode, localName: 'dirty' | 'fldLock'): boolean | undefined;
|
|
213
|
+
/** Model text contributed by one atomic field unit. */
|
|
214
|
+
declare function fieldAtomText(): typeof FIELD_ATOM_CHAR;
|
|
215
|
+
/**
|
|
216
|
+
* True when a node is field chrome that never contributes its own model text outside
|
|
217
|
+
* an atomic span (markers + instruction). Cached result `w:t` is separate.
|
|
218
|
+
*/
|
|
219
|
+
declare function isFieldChrome(node: OoxmlNode): boolean;
|
|
220
|
+
/**
|
|
221
|
+
* True when a `w:fldChar` carries `w:ffData` — a LEGACY FORM FIELD (§17.16.17).
|
|
222
|
+
*
|
|
223
|
+
* FORMTEXT, FORMCHECKBOX and FORMDROPDOWN are what a fillable Word form is made of, and Word
|
|
224
|
+
* shades them on sight so a reader can find the blanks. That is a presentation question,
|
|
225
|
+
* answered by the element's presence alone — this predicate never looks inside.
|
|
226
|
+
*
|
|
227
|
+
* Rendering STATE (a checkbox's checked bit, a dropdown's entries and selection) is different:
|
|
228
|
+
* {@link legacyFormFieldDataOf} reads exactly that, bounded, and nothing else. The contract
|
|
229
|
+
* stands: `w:ffData` macro references (`w:entryMacro` / `w:exitMacro`), `w:name`, help/status
|
|
230
|
+
* text and behavior flags are attacker-supplied script references and are NEVER read, returned
|
|
231
|
+
* or resolved by anything in this module.
|
|
232
|
+
*/
|
|
233
|
+
declare function hasLegacyFormFieldData(node: OoxmlNode): boolean;
|
|
234
|
+
/**
|
|
235
|
+
* One atomic field span inside a paragraph for caret / delete / selection.
|
|
236
|
+
*
|
|
237
|
+
* `removeNodeIds` lists every node that must leave with the unit (begin…end chrome and
|
|
238
|
+
* cached-result content for complex fields; the `fldSimple` element for simple fields).
|
|
239
|
+
*
|
|
240
|
+
* `formatRunIds` lists the runs whose `w:rPr` owns displayed result formatting — result-phase
|
|
241
|
+
* runs with measurable cache text for complex fields, child `w:r`s for `fldSimple`, or the
|
|
242
|
+
* separate/begin run when the result is empty. Delete / caret addressing still uses `runId`
|
|
243
|
+
* (the begin / simple node); formatting must not rewrite chrome-only begin runs when the
|
|
244
|
+
* painted glyphs come from a different result run.
|
|
245
|
+
*/
|
|
246
|
+
interface AtomicFieldSpan {
|
|
247
|
+
readonly kind: 'complex' | 'simple';
|
|
248
|
+
/** Addressable segment node (begin `fldChar` or `fldSimple`). */
|
|
249
|
+
readonly node: OoxmlNode;
|
|
250
|
+
/** Run that owns the begin marker; empty string for paragraph-level `fldSimple`. */
|
|
251
|
+
readonly runId: string;
|
|
252
|
+
readonly removeNodeIds: readonly string[];
|
|
253
|
+
/** Runs that own displayed result formatting (may differ from `runId`). */
|
|
254
|
+
readonly formatRunIds: readonly string[];
|
|
255
|
+
}
|
|
256
|
+
/** Collect only fields whose cached result is one atomic model unit. */
|
|
257
|
+
declare function atomicFieldSpansOf(paragraph: OoxmlParagraphNode, options?: {
|
|
258
|
+
readonly maxNesting?: number;
|
|
259
|
+
readonly maxInstructionChars?: number;
|
|
260
|
+
readonly fieldResults?: FieldResultsMode;
|
|
261
|
+
}): readonly AtomicFieldSpan[];
|
|
262
|
+
/** Whether `fldCharType` is a legal ST_FldCharType value (used by tests / guards). */
|
|
263
|
+
declare function isLegalFldCharType(value: string): boolean;
|
|
264
|
+
|
|
265
|
+
/** One addressable unit of paragraph text: text, tab, hard break, or atomic field. */
|
|
266
|
+
interface Segment {
|
|
267
|
+
readonly runId: string;
|
|
268
|
+
readonly node: OoxmlNode;
|
|
269
|
+
readonly start: number;
|
|
270
|
+
readonly end: number;
|
|
271
|
+
/**
|
|
272
|
+
* When set, deleting this segment removes every listed node id in one step (atomic
|
|
273
|
+
* field begin→end or `fldSimple`). Absent for ordinary text/tab/break segments.
|
|
274
|
+
*/
|
|
275
|
+
readonly removeNodeIds?: readonly string[];
|
|
276
|
+
/**
|
|
277
|
+
* When set, run formatting for this atom targets these runs (field result ownership),
|
|
278
|
+
* not necessarily `runId`. Absent for ordinary text/tab/break segments.
|
|
279
|
+
*/
|
|
280
|
+
readonly formatRunIds?: readonly string[];
|
|
281
|
+
}
|
|
282
|
+
/**
|
|
283
|
+
* Flatten a paragraph into UTF-16 addressable segments, in document order.
|
|
284
|
+
*
|
|
285
|
+
* A HYPERLINK's runs are addressed too. `w:hyperlink` is a run container, not a leaf, and
|
|
286
|
+
* the characters inside a link are ordinary paragraph text: the user selects them, types
|
|
287
|
+
* over them and deletes them like any other. Skipping the container — which is what
|
|
288
|
+
* iterating only direct `w:r` children did — left every link's text with no offsets at all,
|
|
289
|
+
* so `paragraphTextOf` read "Visit or ." for a sentence that says "Visit Example.com or
|
|
290
|
+
* Anthropic's website." and layout, selection and the ops all agreed on the wrong string.
|
|
291
|
+
*
|
|
292
|
+
* Inline CONTENT CONTROLS are the same class of wrapper: their `w:sdtContent` runs join the
|
|
293
|
+
* paragraph's offset stream with no break opportunity at the boundary. Nesting is bounded
|
|
294
|
+
* (`MAX_INLINE_CONTAINER_DEPTH`); beyond the bound the wrapper is opaque so recursion
|
|
295
|
+
* cannot exhaust the stack.
|
|
296
|
+
*
|
|
297
|
+
* `runId` stays the id of the run the content actually lives in, at whatever depth: the
|
|
298
|
+
* appliers resolve it with `findNode` and rebuild that run's children, so nesting costs them
|
|
299
|
+
* nothing.
|
|
300
|
+
*/
|
|
301
|
+
declare function segmentsOf(paragraph: OoxmlParagraphNode): Segment[];
|
|
302
|
+
/** Half-open `[start, end)` of one node in its paragraph's model offset space. */
|
|
303
|
+
interface OffsetSpan {
|
|
304
|
+
readonly start: number;
|
|
305
|
+
readonly end: number;
|
|
306
|
+
}
|
|
307
|
+
/**
|
|
308
|
+
* Every node's place in the paragraph's model offset space, from the SAME walk `segmentsOf`
|
|
309
|
+
* uses.
|
|
310
|
+
*
|
|
311
|
+
* The offset model has exactly one authority, and this is how a caller borrows it. Three
|
|
312
|
+
* private walkers used to re-derive it — one in the tracked-change writer, one in the comment
|
|
313
|
+
* anchor reader, one in the review queue — and all three disagreed with `segmentsOf` and with
|
|
314
|
+
* each other: none gave a note reference or an atomic field its length of one, one counted a
|
|
315
|
+
* field's instruction text as visible characters, and one never descended into `w:hyperlink`
|
|
316
|
+
* at all. The consequences were an anchor short by a link's length, two unrelated comments
|
|
317
|
+
* threaded onto one zero-width offset, and a tracked insert landing a character out in any
|
|
318
|
+
* paragraph carrying a footnote. Patching each walker only resets the clock on the next drift.
|
|
319
|
+
*
|
|
320
|
+
* A node the walk never reaches — content under a `generic` container, or past the nesting cap
|
|
321
|
+
* — has NO span, and {@link ParagraphOffsetIndex.lengthOf} reports zero for it. That is the
|
|
322
|
+
* same answer `segmentsOf` gives: it contributes no addressable characters.
|
|
323
|
+
*/
|
|
324
|
+
interface ParagraphOffsetIndex {
|
|
325
|
+
/** The paragraph's own length, identical to {@link paragraphLength}. */
|
|
326
|
+
readonly length: number;
|
|
327
|
+
readonly segments: readonly Segment[];
|
|
328
|
+
/** Where a node sits, or null when the offset walk never reached it. */
|
|
329
|
+
spanOf(node: OoxmlNode | string): OffsetSpan | null;
|
|
330
|
+
/** A node's model length: `end - start` of its span, and 0 when it has none. */
|
|
331
|
+
lengthOf(node: OoxmlNode | string): number;
|
|
332
|
+
}
|
|
333
|
+
/**
|
|
334
|
+
* THE paragraph offset authority: maps a paragraph's UTF-16 offsets to the nodes holding them.
|
|
335
|
+
*
|
|
336
|
+
* One authority on purpose. An atomic field spans many nodes but is ONE unit to an offset, and a
|
|
337
|
+
* second implementation that disagreed would place edits inside content that cannot be split.
|
|
338
|
+
*/
|
|
339
|
+
declare function paragraphOffsetIndex(paragraph: OoxmlParagraphNode): ParagraphOffsetIndex;
|
|
340
|
+
/** One inline content control's identity and the UTF-16 span its content covers. */
|
|
341
|
+
interface InlineControlSpan {
|
|
342
|
+
readonly controlId: string;
|
|
343
|
+
readonly start: number;
|
|
344
|
+
readonly end: number;
|
|
345
|
+
}
|
|
346
|
+
/**
|
|
347
|
+
* The innermost inline content control whose content ends exactly at `offset` — the caret
|
|
348
|
+
* at its right outer edge. What Backspace consults to delete the node as ONE unit
|
|
349
|
+
* (pro-review-and-custom-nodes 4.6): deleting its last character from outside would either
|
|
350
|
+
* strip one letter from a content-locked label (refused, so the key looks dead) or leave a
|
|
351
|
+
* half-deleted chip whose tag still claims the full payload.
|
|
352
|
+
*/
|
|
353
|
+
declare function inlineControlEndingAt(paragraph: OoxmlParagraphNode, offset: number): InlineControlSpan | null;
|
|
354
|
+
/** The forward-delete mirror: the control whose content STARTS exactly at `offset`. */
|
|
355
|
+
declare function inlineControlStartingAt(paragraph: OoxmlParagraphNode, offset: number): InlineControlSpan | null;
|
|
356
|
+
|
|
357
|
+
/** Structural validation, run before any tree work so a rejection changes nothing. */
|
|
358
|
+
declare function validateTreeOp(part: OoxmlPart, op: TreeDocOp): TreeOpRejection | null;
|
|
359
|
+
|
|
360
|
+
/**
|
|
361
|
+
* Paragraph text as the ops address it, for tests and callers computing offsets.
|
|
362
|
+
*
|
|
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.
|
|
367
|
+
*/
|
|
368
|
+
declare function paragraphTextOf(part: OoxmlPart, paragraphId: string, options?: {
|
|
369
|
+
readonly fieldResults?: FieldResultsMode;
|
|
370
|
+
}): string | null;
|
|
371
|
+
|
|
372
|
+
/**
|
|
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.
|
|
375
|
+
*/
|
|
376
|
+
declare function applyTreeOp(part: OoxmlPart, op: TreeDocOp, options?: EditOptions): TreeOpResult;
|
|
377
|
+
|
|
378
|
+
/**
|
|
379
|
+
* Every kind of thing the registry gives a stable identity to.
|
|
380
|
+
*
|
|
381
|
+
* Identity is `(kind, id)` plus version and NEVER registration order, so two bundles contributing
|
|
382
|
+
* the same command resolve deterministically regardless of which loaded first.
|
|
383
|
+
*/
|
|
384
|
+
declare const ID_KINDS: readonly ['extension', 'capability', 'command', 'query', 'schema', 'dependencyKey', 'runtimePort', 'result', 'origin'];
|
|
385
|
+
/** One of {@link ID_KINDS}. */
|
|
386
|
+
/** One of {@link ID_KINDS} — which sort of thing an identifier names. */
|
|
387
|
+
type IdKind = (typeof ID_KINDS)[number];
|
|
388
|
+
/**
|
|
389
|
+
* Whether a string is a well-formed identifier in either accepted grammar.
|
|
390
|
+
*
|
|
391
|
+
* Reverse-domain (`dev.docx-editor.core.command.insert-text`) or package-owned
|
|
392
|
+
* (`@docx-editor.dev/engine-core#command/insert-text`). Ids are opaque once validated.
|
|
393
|
+
*/
|
|
394
|
+
declare function isValidId(id: string): boolean;
|
|
395
|
+
/**
|
|
396
|
+
* Validate an identifier, throwing when it is malformed.
|
|
397
|
+
*
|
|
398
|
+
* Throws rather than returning: a bad id is an author mistake at registration time, not file
|
|
399
|
+
* input, and accepting it would produce a registry whose identities silently collide.
|
|
400
|
+
*/
|
|
401
|
+
declare function assertValidId(id: string, kind?: IdKind): void;
|
|
402
|
+
/** A validated (kind, id, version) triple — the registry's unit of identity. */
|
|
403
|
+
interface CapabilityId {
|
|
404
|
+
readonly kind: IdKind;
|
|
405
|
+
readonly id: string;
|
|
406
|
+
readonly version: string;
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
/** A parsed semantic version. Only the three numeric components — no pre-release or build. */
|
|
410
|
+
interface SemVer {
|
|
411
|
+
readonly major: number;
|
|
412
|
+
readonly minor: number;
|
|
413
|
+
readonly patch: number;
|
|
414
|
+
}
|
|
415
|
+
/**
|
|
416
|
+
* Parse a semantic version, rejecting anything the registry's rules do not need.
|
|
417
|
+
*
|
|
418
|
+
* Deliberately narrow: an unsupported range form is refused rather than accepted, so a malformed
|
|
419
|
+
* range can never masquerade as "compatible".
|
|
420
|
+
*/
|
|
421
|
+
declare function parseSemVer(input: string): SemVer;
|
|
422
|
+
/** Order two versions: negative, zero or positive, by major then minor then patch. */
|
|
423
|
+
declare function compareSemVer(a: SemVer, b: SemVer): -1 | 0 | 1;
|
|
424
|
+
/**
|
|
425
|
+
* Whether `version` satisfies `range`. Supported range grammar:
|
|
426
|
+
* - `*` any version
|
|
427
|
+
* - `1.2.3` exact
|
|
428
|
+
* - `^1.2.3` caret: same major, and >= the floor (major 0 pins the minor)
|
|
429
|
+
* - `>=1.2.3 <2.0.0` a single lower (inclusive) + upper (exclusive) bound pair
|
|
430
|
+
* Any other shape throws — an unparseable range is a registration error, not a pass.
|
|
431
|
+
*/
|
|
432
|
+
declare function satisfies(version: string, range: string): boolean;
|
|
433
|
+
|
|
434
|
+
/**
|
|
435
|
+
* Why registry resolution failed.
|
|
436
|
+
*
|
|
437
|
+
* Every code names a declaration conflict a bundle author can fix — a missing dependency, an
|
|
438
|
+
* unsatisfied version range, a duplicate contribution with no replacement policy.
|
|
439
|
+
*/
|
|
440
|
+
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';
|
|
441
|
+
/**
|
|
442
|
+
* A resolution failure naming every responsible party.
|
|
443
|
+
*
|
|
444
|
+
* Thrown rather than returned: an unresolvable registry is a build-time composition mistake, and
|
|
445
|
+
* an engine running with a half-resolved registry would fail later in ways that do not point back
|
|
446
|
+
* to the bundle that caused it.
|
|
447
|
+
*/
|
|
448
|
+
declare class RegistryError extends Error {
|
|
449
|
+
readonly code: RegistryErrorCode;
|
|
450
|
+
/** Stable identities responsible for the failure (extensions, ids). */
|
|
451
|
+
readonly responsible: readonly string[];
|
|
452
|
+
constructor(code: RegistryErrorCode, message: string,
|
|
453
|
+
/** Stable identities responsible for the failure (extensions, ids). */
|
|
454
|
+
responsible?: readonly string[]);
|
|
455
|
+
}
|
|
456
|
+
/** How a base contribution permits replacement by other bundles. */
|
|
457
|
+
type ReplacementPolicy = {
|
|
458
|
+
readonly kind: 'none';
|
|
459
|
+
} | {
|
|
460
|
+
readonly kind: 'single';
|
|
461
|
+
} | {
|
|
462
|
+
readonly kind: 'priority';
|
|
463
|
+
};
|
|
464
|
+
/** One thing a bundle contributes: a command, a query, a schema, a port, keyed by `(kind, id)`. */
|
|
465
|
+
interface Contribution {
|
|
466
|
+
readonly kind: Exclude<IdKind, 'extension' | 'origin' | 'result'>;
|
|
467
|
+
readonly id: string;
|
|
468
|
+
readonly version: string;
|
|
469
|
+
/** If set, this contribution replaces an existing base contribution. */
|
|
470
|
+
readonly replaces?: {
|
|
471
|
+
readonly targetId: string;
|
|
472
|
+
readonly targetRange: string;
|
|
473
|
+
readonly priority?: number;
|
|
474
|
+
};
|
|
475
|
+
/** Policy this contribution exposes to would-be replacers (default `none`). */
|
|
476
|
+
readonly replaceable?: ReplacementPolicy;
|
|
477
|
+
readonly payload?: unknown;
|
|
478
|
+
}
|
|
479
|
+
/**
|
|
480
|
+
* A unit of engine functionality: its identity, version, dependencies, conflicts, required ports,
|
|
481
|
+
* and contributions.
|
|
482
|
+
*
|
|
483
|
+
* The registry's whole input. Everything a bundle needs and everything it offers is DECLARED, so
|
|
484
|
+
* resolution can be deterministic and order-independent.
|
|
485
|
+
*/
|
|
486
|
+
interface FeatureBundle {
|
|
487
|
+
readonly id: string;
|
|
488
|
+
readonly version: string;
|
|
489
|
+
readonly dependencies?: readonly string[];
|
|
490
|
+
readonly conflicts?: readonly string[];
|
|
491
|
+
readonly requiredPorts?: readonly string[];
|
|
492
|
+
readonly contributions: readonly Contribution[];
|
|
493
|
+
}
|
|
494
|
+
/** The resolved result: every contribution selected, indexed by `(kind, id)`. */
|
|
495
|
+
interface ResolvedRegistry {
|
|
496
|
+
readonly extensions: ReadonlyMap<string, FeatureBundle>;
|
|
497
|
+
readonly contributions: ReadonlyMap<string, Contribution>;
|
|
498
|
+
get(kind: Contribution['kind'], id: string): Contribution | undefined;
|
|
499
|
+
}
|
|
500
|
+
/** How resolution treats optional bundles and replacement policies. */
|
|
501
|
+
interface ResolveOptions {
|
|
502
|
+
/** Runtime port ids available in this environment (design D9 / task 0.3). */
|
|
503
|
+
readonly availablePorts?: readonly string[];
|
|
504
|
+
}
|
|
505
|
+
/**
|
|
506
|
+
* Resolve a set of bundles into one registry, or throw.
|
|
507
|
+
*
|
|
508
|
+
* Deterministic and registration-order independent: selection is by `(kind, id)` plus version,
|
|
509
|
+
* and ties break only on declared policy. Array order never decides anything.
|
|
510
|
+
*
|
|
511
|
+
* @throws RegistryError naming every bundle responsible for the failure.
|
|
512
|
+
*/
|
|
513
|
+
declare function resolve(bundles: readonly FeatureBundle[], options?: ResolveOptions): ResolvedRegistry;
|
|
514
|
+
|
|
515
|
+
/**
|
|
516
|
+
* Typed-origin domains (design D5 / ADR-S5). `mutation.*` are the canonical
|
|
517
|
+
* write origins; `projection` and `awareness` MUST NOT enter history, audit,
|
|
518
|
+
* snapshots, or replication.
|
|
519
|
+
*/
|
|
520
|
+
declare const ORIGIN_IDS: {
|
|
521
|
+
readonly mutationHuman: "dev.docx-editor.core.origin.mutation.human";
|
|
522
|
+
readonly mutationAgent: "dev.docx-editor.core.origin.mutation.agent";
|
|
523
|
+
readonly mutationRemote: "dev.docx-editor.core.origin.mutation.remote";
|
|
524
|
+
readonly mutationUndo: "dev.docx-editor.core.origin.mutation.undo";
|
|
525
|
+
readonly mutationRedo: "dev.docx-editor.core.origin.mutation.redo";
|
|
526
|
+
readonly mutationMigration: "dev.docx-editor.core.origin.mutation.migration";
|
|
527
|
+
readonly mutationRepair: "dev.docx-editor.core.origin.mutation.repair";
|
|
528
|
+
readonly mutationServer: "dev.docx-editor.core.origin.mutation.server";
|
|
529
|
+
readonly projection: "dev.docx-editor.core.origin.projection";
|
|
530
|
+
readonly awareness: "dev.docx-editor.core.origin.awareness";
|
|
531
|
+
};
|
|
532
|
+
/** Canonical writes carry a mutation origin; these are the undoable-eligibility inputs. */
|
|
533
|
+
declare const CANONICAL_MUTATION_ORIGINS: readonly string[];
|
|
534
|
+
/** Origins that never enter authored state / history / audit / snapshot / replication. */
|
|
535
|
+
declare const NON_CANONICAL_ORIGINS: readonly string[];
|
|
536
|
+
/**
|
|
537
|
+
* Result taxonomy (design D8 / task 7.8). A transport/protocol failure that
|
|
538
|
+
* prevents a valid envelope is a typed exception, not a member here.
|
|
539
|
+
*/
|
|
540
|
+
declare const RESULT_IDS: {
|
|
541
|
+
readonly applied: "dev.docx-editor.core.result.applied";
|
|
542
|
+
readonly validation: "dev.docx-editor.core.result.validation";
|
|
543
|
+
readonly conflict: "dev.docx-editor.core.result.conflict";
|
|
544
|
+
readonly resource: "dev.docx-editor.core.result.resource";
|
|
545
|
+
readonly authorization: "dev.docx-editor.core.result.authorization";
|
|
546
|
+
readonly aborted: "dev.docx-editor.core.result.aborted";
|
|
547
|
+
};
|
|
548
|
+
/** Runtime ports (extensions-and-runtime-ports spec; design D9). */
|
|
549
|
+
declare const RUNTIME_PORT_IDS: {
|
|
550
|
+
readonly fonts: "dev.docx-editor.core.port.fonts";
|
|
551
|
+
readonly shaping: "dev.docx-editor.core.port.shaping";
|
|
552
|
+
readonly images: "dev.docx-editor.core.port.images";
|
|
553
|
+
readonly clock: "dev.docx-editor.core.port.clock";
|
|
554
|
+
readonly identity: "dev.docx-editor.core.port.identity";
|
|
555
|
+
readonly persistence: "dev.docx-editor.core.port.persistence";
|
|
556
|
+
readonly transport: "dev.docx-editor.core.port.transport";
|
|
557
|
+
readonly scheduling: "dev.docx-editor.core.port.scheduling";
|
|
558
|
+
readonly audit: "dev.docx-editor.core.port.audit";
|
|
559
|
+
readonly authorization: "dev.docx-editor.core.port.authorization";
|
|
560
|
+
readonly resourceAccounting: "dev.docx-editor.core.port.resource-accounting";
|
|
561
|
+
readonly cancellation: "dev.docx-editor.core.port.cancellation";
|
|
562
|
+
readonly externalResourceConsent: "dev.docx-editor.core.port.external-resource-consent";
|
|
563
|
+
};
|
|
564
|
+
/** Layout dependency keys (design D6 / task 8.2). */
|
|
565
|
+
declare const DEPENDENCY_KEY_IDS: {
|
|
566
|
+
readonly style: "dev.docx-editor.core.dep.style";
|
|
567
|
+
readonly numbering: "dev.docx-editor.core.dep.numbering";
|
|
568
|
+
readonly section: "dev.docx-editor.core.dep.section";
|
|
569
|
+
readonly story: "dev.docx-editor.core.dep.story";
|
|
570
|
+
readonly font: "dev.docx-editor.core.dep.font";
|
|
571
|
+
readonly image: "dev.docx-editor.core.dep.image";
|
|
572
|
+
readonly table: "dev.docx-editor.core.dep.table";
|
|
573
|
+
readonly field: "dev.docx-editor.core.dep.field";
|
|
574
|
+
readonly note: "dev.docx-editor.core.dep.note";
|
|
575
|
+
readonly headerFooter: "dev.docx-editor.core.dep.header-footer";
|
|
576
|
+
readonly annotation: "dev.docx-editor.core.dep.annotation";
|
|
577
|
+
};
|
|
578
|
+
/** Every frozen id as a flat list, for the immutability / uniqueness gate. */
|
|
579
|
+
declare const ALL_FROZEN_IDS: readonly string[];
|
|
580
|
+
|
|
581
|
+
/**
|
|
582
|
+
* A counter's limit was reached. Carries the label, the limit, and what was attempted.
|
|
583
|
+
*
|
|
584
|
+
* Thrown at the N → N+1 boundary, so the increment that would have crossed the limit never
|
|
585
|
+
* happens rather than being detected afterwards.
|
|
586
|
+
*/
|
|
587
|
+
declare class LimitExceededError extends Error {
|
|
588
|
+
readonly label: string;
|
|
589
|
+
readonly limit: number;
|
|
590
|
+
readonly attempted: number;
|
|
591
|
+
constructor(label: string, limit: number, attempted: number);
|
|
592
|
+
}
|
|
593
|
+
/**
|
|
594
|
+
* Overflow-safe counting against a fixed limit.
|
|
595
|
+
*
|
|
596
|
+
* Never silently wraps: it rejects the increment that would cross its limit AND any arithmetic
|
|
597
|
+
* that would exceed `Number.MAX_SAFE_INTEGER`. That second guard is the point — a file-supplied
|
|
598
|
+
* count must never be trusted into an allocation, and a wrapped counter reads as small.
|
|
599
|
+
*/
|
|
600
|
+
declare class BoundedCounter {
|
|
601
|
+
readonly label: string;
|
|
602
|
+
readonly limit: number;
|
|
603
|
+
private value;
|
|
604
|
+
constructor(label: string, limit: number);
|
|
605
|
+
get current(): number;
|
|
606
|
+
/** Remaining headroom before the limit. */
|
|
607
|
+
get remaining(): number;
|
|
608
|
+
/**
|
|
609
|
+
* Add `n` (default 1). Throws LimitExceededError if the result would exceed the
|
|
610
|
+
* limit (so `limit` itself is reachable but `limit + 1` is not) or overflow the
|
|
611
|
+
* safe-integer range. On rejection the counter is unchanged.
|
|
612
|
+
*/
|
|
613
|
+
add(n?: number): number;
|
|
614
|
+
/** Whether adding `n` would be accepted, without mutating. */
|
|
615
|
+
canAdd(n?: number): boolean;
|
|
616
|
+
release(n: number): void;
|
|
617
|
+
}
|
|
618
|
+
|
|
619
|
+
/** A budget was misused: over-carved, over-reserved, or disposed with children outstanding. */
|
|
620
|
+
declare class BudgetError extends Error {
|
|
621
|
+
constructor(message: string);
|
|
622
|
+
}
|
|
623
|
+
/**
|
|
624
|
+
* Capacity claimed BEFORE it is allocated.
|
|
625
|
+
*
|
|
626
|
+
* Reserve-then-allocate rather than allocate-then-check: discovering the overrun after the
|
|
627
|
+
* allocation has already happened defeats the point of having a budget.
|
|
628
|
+
*/
|
|
629
|
+
interface Reservation {
|
|
630
|
+
readonly amount: number;
|
|
631
|
+
readonly released: boolean;
|
|
632
|
+
release(): void;
|
|
633
|
+
}
|
|
634
|
+
/**
|
|
635
|
+
* One node in the hierarchical resource budget tree.
|
|
636
|
+
*
|
|
637
|
+
* An operation owns a root budget; parsers, extensions, workers, layout, transport and output
|
|
638
|
+
* carve children from it, so no subsystem can consume more than the operation as a whole allows.
|
|
639
|
+
*
|
|
640
|
+
* `dispose()` REFUSES while children or reservations are outstanding, then runs registered
|
|
641
|
+
* cleanups LIFO — spill files, worker termination — even if one throws. A leaked child budget is a
|
|
642
|
+
* leaked worker, so the refusal is the diagnostic.
|
|
643
|
+
*/
|
|
644
|
+
declare class Budget {
|
|
645
|
+
readonly label: string;
|
|
646
|
+
readonly capacity: number;
|
|
647
|
+
private readonly used;
|
|
648
|
+
private readonly children;
|
|
649
|
+
private activeReservations;
|
|
650
|
+
private readonly cleanups;
|
|
651
|
+
private disposed;
|
|
652
|
+
private carveAmount;
|
|
653
|
+
private parent?;
|
|
654
|
+
constructor(label: string, capacity: number);
|
|
655
|
+
get inUse(): number;
|
|
656
|
+
get available(): number;
|
|
657
|
+
get isDisposed(): boolean;
|
|
658
|
+
/** Reserve `amount` from this budget. Throws if it would exceed capacity. */
|
|
659
|
+
reserve(amount: number): Reservation;
|
|
660
|
+
/** Carve a child budget of `capacity` out of this budget's headroom. */
|
|
661
|
+
child(label: string, capacity: number): Budget;
|
|
662
|
+
/** Register cleanup for a spill file, worker, or queue tied to this budget. */
|
|
663
|
+
onRelease(cleanup: () => void): void;
|
|
664
|
+
/**
|
|
665
|
+
* Release this budget. Refuses while any child budget or reservation is
|
|
666
|
+
* outstanding (children must finish first). Runs cleanups LIFO, returns the
|
|
667
|
+
* carve-out to the parent, and marks disposed. Cleanup errors are collected and
|
|
668
|
+
* rethrown after every cleanup has run.
|
|
669
|
+
*/
|
|
670
|
+
dispose(): void;
|
|
671
|
+
private assertLive;
|
|
672
|
+
}
|
|
673
|
+
|
|
674
|
+
/**
|
|
675
|
+
* Which side of the point of no return an operation is on.
|
|
676
|
+
*
|
|
677
|
+
* Canonical publication is that point. Cancelling BEFORE it rolls the whole operation back;
|
|
678
|
+
* cancelling after it leaves the commit standing and cancels only derived work — layout, export,
|
|
679
|
+
* caches.
|
|
680
|
+
*/
|
|
681
|
+
type CancellationPhase = 'pre-publication' | 'post-publication';
|
|
682
|
+
/** Thrown from a `checkpoint()` when the operation has been cancelled. */
|
|
683
|
+
declare class CancellationError extends Error {
|
|
684
|
+
/** True when the commit is already published and only derived work is cancelled. */
|
|
685
|
+
readonly derivedOnly: boolean;
|
|
686
|
+
constructor(
|
|
687
|
+
/** True when the commit is already published and only derived work is cancelled. */
|
|
688
|
+
derivedOnly: boolean, reason?: string);
|
|
689
|
+
}
|
|
690
|
+
/**
|
|
691
|
+
* The read side of cancellation, handed to cooperative work.
|
|
692
|
+
*
|
|
693
|
+
* Cooperative rather than pre-emptive: long work calls `checkpoint()` at declared intervals, which
|
|
694
|
+
* is what lets an operation unwind promptly without the engine having to interrupt it mid-mutation.
|
|
695
|
+
*/
|
|
696
|
+
interface CancellationToken {
|
|
697
|
+
readonly isCancelled: boolean;
|
|
698
|
+
readonly phase: CancellationPhase;
|
|
699
|
+
/** True only when cancelled AND the commit is already published. */
|
|
700
|
+
readonly derivedOnly: boolean;
|
|
701
|
+
/** Throws CancellationError if cancelled; call at declared checkpoint intervals. */
|
|
702
|
+
checkpoint(): void;
|
|
703
|
+
}
|
|
704
|
+
/**
|
|
705
|
+
* The write side of cancellation, and the owner of the phase.
|
|
706
|
+
*
|
|
707
|
+
* Whoever starts an operation holds this; everything it calls gets only the token.
|
|
708
|
+
*/
|
|
709
|
+
declare class CancellationController {
|
|
710
|
+
private _cancelled;
|
|
711
|
+
private _phase;
|
|
712
|
+
private _reason?;
|
|
713
|
+
cancel(reason?: string): void;
|
|
714
|
+
/** Mark canonical publication — the point of no return. */
|
|
715
|
+
markPublished(): void;
|
|
716
|
+
get isCancelled(): boolean;
|
|
717
|
+
get phase(): CancellationPhase;
|
|
718
|
+
get isPublished(): boolean;
|
|
719
|
+
/** Cancelled after publication -> full rollback is no longer possible. */
|
|
720
|
+
get derivedOnly(): boolean;
|
|
721
|
+
get token(): CancellationToken;
|
|
722
|
+
}
|
|
723
|
+
|
|
724
|
+
/** Injectable time source — the engine never calls Date.now directly (determinism). */
|
|
725
|
+
interface ClockPort {
|
|
726
|
+
now(): number;
|
|
727
|
+
}
|
|
728
|
+
/** Stable id minting for sessions, commits, and allocator seeds. */
|
|
729
|
+
interface IdentityPort {
|
|
730
|
+
newId(): string;
|
|
731
|
+
}
|
|
732
|
+
/** Cooperative scheduling of deferred work. */
|
|
733
|
+
interface SchedulingPort {
|
|
734
|
+
schedule(task: () => void): void;
|
|
735
|
+
}
|
|
736
|
+
/** Redacted observability sink (raw text never enters here — design D5). */
|
|
737
|
+
interface AuditPort {
|
|
738
|
+
record(entry: {
|
|
739
|
+
readonly kind: string;
|
|
740
|
+
readonly at: number;
|
|
741
|
+
readonly meta?: Record<string, unknown>;
|
|
742
|
+
}): void;
|
|
743
|
+
}
|
|
744
|
+
/** Read/write/export authorization decisions. */
|
|
745
|
+
interface AuthorizationPort {
|
|
746
|
+
authorize(action: string, subject?: string): boolean;
|
|
747
|
+
}
|
|
748
|
+
/** Explicit consent gate for any remote/external resource (no zero-click fetch). */
|
|
749
|
+
interface ExternalResourceConsentPort {
|
|
750
|
+
requestConsent(target: string): boolean;
|
|
751
|
+
}
|
|
752
|
+
/** Cancellation source for the current operation. */
|
|
753
|
+
interface CancellationPort {
|
|
754
|
+
readonly token: CancellationToken;
|
|
755
|
+
}
|
|
756
|
+
/** Where documents are stored and retrieved. Opaque marker until its milestone. */
|
|
757
|
+
interface PersistencePort {
|
|
758
|
+
readonly kind: 'persistence';
|
|
759
|
+
}
|
|
760
|
+
/** How the engine talks to a remote peer. Opaque marker until its milestone. */
|
|
761
|
+
interface TransportPort {
|
|
762
|
+
readonly kind: 'transport';
|
|
763
|
+
}
|
|
764
|
+
/** Where font bytes come from. Opaque marker until its milestone. */
|
|
765
|
+
interface FontPort {
|
|
766
|
+
readonly kind: 'font';
|
|
767
|
+
}
|
|
768
|
+
/** Which shaping backend measures text. Opaque marker until its milestone. */
|
|
769
|
+
interface ShapingPort {
|
|
770
|
+
readonly kind: 'shaping';
|
|
771
|
+
}
|
|
772
|
+
/** How image bytes are decoded. Opaque marker until its milestone. */
|
|
773
|
+
interface ImagePort {
|
|
774
|
+
readonly kind: 'image';
|
|
775
|
+
}
|
|
776
|
+
/** Where resource consumption is reported. Opaque marker until its milestone. */
|
|
777
|
+
interface ResourceAccountingPort {
|
|
778
|
+
readonly kind: 'resource-accounting';
|
|
779
|
+
}
|
|
780
|
+
/**
|
|
781
|
+
* A required port the runtime did not provide.
|
|
782
|
+
*
|
|
783
|
+
* Thrown rather than falling back: silently reaching for a browser global when a worker or server
|
|
784
|
+
* adapter did not supply a port is exactly the coupling ports exist to prevent.
|
|
785
|
+
*/
|
|
786
|
+
declare class PortResolutionError extends Error {
|
|
787
|
+
readonly portId: string;
|
|
788
|
+
constructor(portId: string);
|
|
789
|
+
}
|
|
790
|
+
/**
|
|
791
|
+
* The environment-dependent services an engine instance may reach.
|
|
792
|
+
*
|
|
793
|
+
* Everything outside pure computation — the clock, identity minting, scheduling, fonts, images —
|
|
794
|
+
* is reached only through here, which is what lets browser, worker and server adapters supply
|
|
795
|
+
* only what their runtime actually offers.
|
|
796
|
+
*/
|
|
797
|
+
declare class PortRegistry {
|
|
798
|
+
private readonly ports;
|
|
799
|
+
provide(portId: string, port: unknown): this;
|
|
800
|
+
has(portId: string): boolean;
|
|
801
|
+
/** Resolve a port by id or throw. */
|
|
802
|
+
resolve<T>(portId: string): T;
|
|
803
|
+
/** Assert every id in `portIds` is present; returns the missing ones (empty if all present). */
|
|
804
|
+
missing(portIds: readonly string[]): string[];
|
|
805
|
+
/** The provided port ids (for bridging to registry.resolve availablePorts). */
|
|
806
|
+
availablePorts(): string[];
|
|
807
|
+
clock(): ClockPort;
|
|
808
|
+
identity(): IdentityPort;
|
|
809
|
+
}
|
|
810
|
+
/** Deterministic clock: starts at `start` and advances by `step` each call. */
|
|
811
|
+
declare class DeterministicClock implements ClockPort {
|
|
812
|
+
private readonly step;
|
|
813
|
+
private t;
|
|
814
|
+
constructor(start?: number, step?: number);
|
|
815
|
+
now(): number;
|
|
816
|
+
}
|
|
817
|
+
/** Sequential identity for tests and deterministic fixtures. */
|
|
818
|
+
declare class SequentialIdentity implements IdentityPort {
|
|
819
|
+
private readonly prefix;
|
|
820
|
+
private n;
|
|
821
|
+
constructor(prefix?: string);
|
|
822
|
+
newId(): string;
|
|
823
|
+
}
|
|
824
|
+
|
|
825
|
+
/** What one operation is started with. Only `ports` is required. */
|
|
826
|
+
interface OperationInit {
|
|
827
|
+
readonly ports: PortRegistry;
|
|
828
|
+
readonly limits?: Partial<ResourceLimits>;
|
|
829
|
+
readonly config?: Readonly<Record<string, unknown>>;
|
|
830
|
+
/** Root budget capacity in abstract units (default: the byte decompression limit). */
|
|
831
|
+
readonly capacity?: number;
|
|
832
|
+
/** Operation identity (from IdentityPort in production); defaulted for tests. */
|
|
833
|
+
readonly id?: string;
|
|
834
|
+
}
|
|
835
|
+
/**
|
|
836
|
+
* The frozen environment of one operation: its limits, config, ports, root budget and
|
|
837
|
+
* cancellation controller.
|
|
838
|
+
*
|
|
839
|
+
* IMMUTABLE for the operation's lifetime, which is what lets cache reuse and replica agreement
|
|
840
|
+
* key on it. A new operation always gets a fresh snapshot rather than observing a mutated one.
|
|
841
|
+
*/
|
|
842
|
+
interface OperationContext {
|
|
843
|
+
readonly id: string;
|
|
844
|
+
readonly limits: ResourceLimits;
|
|
845
|
+
readonly config: Readonly<Record<string, unknown>>;
|
|
846
|
+
readonly ports: PortRegistry;
|
|
847
|
+
readonly budget: Budget;
|
|
848
|
+
readonly cancellation: CancellationController;
|
|
849
|
+
}
|
|
850
|
+
/**
|
|
851
|
+
* Begin an operation, capturing its immutable environment snapshot.
|
|
852
|
+
*
|
|
853
|
+
* Resolves and freezes limits and configuration, carves the root budget, and creates the
|
|
854
|
+
* cancellation controller — everything downstream work needs, fixed for the operation's duration.
|
|
855
|
+
*/
|
|
856
|
+
declare function beginOperation(init: OperationInit): OperationContext;
|
|
857
|
+
/** Release the operation's root budget (requires every child/reservation released). */
|
|
858
|
+
declare function endOperation(ctx: OperationContext): void;
|
|
859
|
+
|
|
860
|
+
/** What a limit counts. Typed so a byte cap and a depth cap cannot be compared by accident. */
|
|
861
|
+
type LimitUnit = 'bytes' | 'count' | 'depth' | 'ratio' | 'passes';
|
|
862
|
+
/**
|
|
863
|
+
* Where a limit is enforced.
|
|
864
|
+
*
|
|
865
|
+
* Declared per limit so enforcement happens at the boundary that can still refuse cheaply — a zip
|
|
866
|
+
* cap checked during layout has already let the bomb decompress.
|
|
867
|
+
*/
|
|
868
|
+
type EnforcementPhase = 'package-read' | 'xml-parse' | 'layout' | 'output';
|
|
869
|
+
/** One limit's unit and enforcement phase — the metadata that makes limits testable uniformly. */
|
|
870
|
+
interface LimitSpec {
|
|
871
|
+
readonly unit: LimitUnit;
|
|
872
|
+
readonly phase: EnforcementPhase;
|
|
873
|
+
}
|
|
874
|
+
/** Unit + enforcement phase for every resource limit. */
|
|
875
|
+
declare const LIMIT_SPECS: Readonly<Record<keyof ResourceLimits, LimitSpec>>;
|
|
876
|
+
/** Every limit name, for iterating the specs and asserting each has a unit and phase. */
|
|
877
|
+
declare const LIMIT_KEYS: (keyof ResourceLimits)[];
|
|
878
|
+
/** A phase-scoped overflow-safe counter for one limit. */
|
|
879
|
+
declare function makeLimitCounter(limits: ResourceLimits, key: keyof ResourceLimits): BoundedCounter;
|
|
880
|
+
/**
|
|
881
|
+
* Deterministic memory substitute. Tracks current and peak "allocated" units
|
|
882
|
+
* against a hard byte ceiling; `allocate` fails closed (LimitExceededError) past
|
|
883
|
+
* the limit. Used in place of process RSS so memory-limit tests are reproducible
|
|
884
|
+
* and cancellation/cleanup can be asserted without a real allocator.
|
|
885
|
+
*/
|
|
886
|
+
declare class DeterministicMemoryMeter {
|
|
887
|
+
private readonly counter;
|
|
888
|
+
private current;
|
|
889
|
+
private peak;
|
|
890
|
+
constructor(limitBytes: number);
|
|
891
|
+
allocate(bytes: number): void;
|
|
892
|
+
free(bytes: number): void;
|
|
893
|
+
get currentBytes(): number;
|
|
894
|
+
get peakBytes(): number;
|
|
895
|
+
/** Release everything (cancellation/cleanup path). */
|
|
896
|
+
reset(): void;
|
|
897
|
+
}
|
|
898
|
+
/** Assert the finite-default / hard-ceiling invariant holds for every limit. */
|
|
899
|
+
declare function assertLimitInvariants(): void;
|
|
900
|
+
|
|
901
|
+
/** Any JSON value. The domain canonicalization and stable hashing operate over. */
|
|
902
|
+
type Json = null | boolean | number | string | Json[] | {
|
|
903
|
+
[k: string]: Json;
|
|
904
|
+
};
|
|
905
|
+
/**
|
|
906
|
+
* Produce a canonical string for `value`, dropping any object key whose name is
|
|
907
|
+
* in `ephemera` at any depth. Numbers are emitted losslessly; -0 normalizes to 0;
|
|
908
|
+
* non-finite numbers are rejected (they must never enter a comparator input).
|
|
909
|
+
*/
|
|
910
|
+
declare function canonicalize(value: unknown, ephemera?: ReadonlySet<string>): string;
|
|
911
|
+
/** 64-bit FNV-1a over the canonical form, returned as a 16-char hex string. */
|
|
912
|
+
declare function stableHash(value: unknown, ephemera?: ReadonlySet<string>): string;
|
|
913
|
+
|
|
914
|
+
/**
|
|
915
|
+
* How one artifact class is compared.
|
|
916
|
+
*
|
|
917
|
+
* Frozen per artifact: nothing here invents a tolerance for an artifact the spec requires to
|
|
918
|
+
* match exactly.
|
|
919
|
+
*/
|
|
920
|
+
type ComparatorMode = 'canonical-exact' | 'exact' | 'tolerance' | 'sync-optimization-only';
|
|
921
|
+
/** One artifact class's comparison mode and its declared ephemera — fields excluded from equality. */
|
|
922
|
+
interface ComparatorDescriptor {
|
|
923
|
+
readonly id: string;
|
|
924
|
+
readonly mode: ComparatorMode;
|
|
925
|
+
/** Object keys excluded from canonical-exact comparison (declared ephemera). */
|
|
926
|
+
readonly ephemera: readonly string[];
|
|
927
|
+
readonly note: string;
|
|
928
|
+
}
|
|
929
|
+
/** The frozen artifact comparator set. */
|
|
930
|
+
declare const COMPARATORS: {
|
|
931
|
+
readonly authoredState: {
|
|
932
|
+
readonly id: "dev.docx-editor.core.comparator.authored-state";
|
|
933
|
+
readonly mode: 'canonical-exact';
|
|
934
|
+
readonly ephemera: readonly ["revision", "provenance", "producedAt", "commitId"];
|
|
935
|
+
readonly note: 'canonical normalized authored records; ephemera excluded';
|
|
936
|
+
};
|
|
937
|
+
readonly anchor: {
|
|
938
|
+
readonly id: "dev.docx-editor.core.comparator.anchor";
|
|
939
|
+
readonly mode: 'exact';
|
|
940
|
+
readonly ephemera: readonly [];
|
|
941
|
+
readonly note: 'internal anchor identity/affinity compares exactly';
|
|
942
|
+
};
|
|
943
|
+
readonly yjsStateVector: {
|
|
944
|
+
readonly id: "dev.docx-editor.core.comparator.yjs-state-vector";
|
|
945
|
+
readonly mode: 'sync-optimization-only';
|
|
946
|
+
readonly ephemera: readonly [];
|
|
947
|
+
readonly note: 'exchange optimization only; never proves update or delete-set coverage';
|
|
948
|
+
};
|
|
949
|
+
readonly shapedRun: {
|
|
950
|
+
readonly id: "dev.docx-editor.core.comparator.shaped-run";
|
|
951
|
+
readonly mode: 'exact';
|
|
952
|
+
readonly ephemera: readonly [];
|
|
953
|
+
readonly note: 'glyph ids, clusters, and fixed-point advances compare exactly';
|
|
954
|
+
};
|
|
955
|
+
readonly paginationFingerprint: {
|
|
956
|
+
readonly id: "dev.docx-editor.core.comparator.pagination-fingerprint";
|
|
957
|
+
readonly mode: 'exact';
|
|
958
|
+
readonly ephemera: readonly [];
|
|
959
|
+
readonly note: 'page/column boundaries, break causes, fixed-point geometry compare exactly';
|
|
960
|
+
};
|
|
961
|
+
readonly semanticTree: {
|
|
962
|
+
readonly id: "dev.docx-editor.core.comparator.semantic-tree";
|
|
963
|
+
readonly mode: 'exact';
|
|
964
|
+
readonly ephemera: readonly [];
|
|
965
|
+
readonly note: 'reading order, roles, headings, alt text compare exactly';
|
|
966
|
+
};
|
|
967
|
+
readonly hitTest: {
|
|
968
|
+
readonly id: "dev.docx-editor.core.comparator.hit-test";
|
|
969
|
+
readonly mode: 'exact';
|
|
970
|
+
readonly ephemera: readonly [];
|
|
971
|
+
readonly note: 'resolved hit target and cluster affinity compare exactly';
|
|
972
|
+
};
|
|
973
|
+
readonly pdfSemantics: {
|
|
974
|
+
readonly id: "dev.docx-editor.core.comparator.pdf-semantics";
|
|
975
|
+
readonly mode: 'canonical-exact';
|
|
976
|
+
readonly ephemera: readonly ["objectNumber", "producer", "creationDate", "modDate", "subsetTag"];
|
|
977
|
+
readonly note: 'canonical semantic PDF objects; container ephemera excluded';
|
|
978
|
+
};
|
|
979
|
+
readonly rasterCheckpoint: {
|
|
980
|
+
readonly id: "dev.docx-editor.core.comparator.raster-checkpoint";
|
|
981
|
+
readonly mode: 'tolerance';
|
|
982
|
+
readonly ephemera: readonly [];
|
|
983
|
+
readonly note: 'documented unavoidable raster comparison; explicit tolerance only';
|
|
984
|
+
};
|
|
985
|
+
readonly benchmarkEvidence: {
|
|
986
|
+
readonly id: "dev.docx-editor.core.comparator.benchmark-evidence";
|
|
987
|
+
readonly mode: 'sync-optimization-only';
|
|
988
|
+
readonly ephemera: readonly [];
|
|
989
|
+
readonly note: 'diagnostic evidence, not an equivalence basis';
|
|
990
|
+
};
|
|
991
|
+
};
|
|
992
|
+
/** Which frozen comparator to use. */
|
|
993
|
+
type ComparatorName = keyof typeof COMPARATORS;
|
|
994
|
+
/** Whether two artifacts matched, and where they diverged when they did not. */
|
|
995
|
+
interface ComparisonResult {
|
|
996
|
+
readonly equal: boolean;
|
|
997
|
+
/** Canonical forms when unequal (diagnostic). */
|
|
998
|
+
readonly left?: string;
|
|
999
|
+
readonly right?: string;
|
|
1000
|
+
}
|
|
1001
|
+
/**
|
|
1002
|
+
* Compare two artifacts under a named comparator. `canonical-exact` and `exact`
|
|
1003
|
+
* compare canonical forms (exact drops no ephemera). `tolerance` requires an
|
|
1004
|
+
* epsilon and compares finite numbers structurally. `sync-optimization-only`
|
|
1005
|
+
* throws — such artifacts are never an equivalence basis.
|
|
1006
|
+
*/
|
|
1007
|
+
declare function compareArtifacts(name: ComparatorName, left: unknown, right: unknown, opts?: {
|
|
1008
|
+
epsilon?: number;
|
|
1009
|
+
}): ComparisonResult;
|
|
1010
|
+
/** Fingerprint an artifact under a named comparator's canonicalization policy. */
|
|
1011
|
+
declare function fingerprint(name: ComparatorName, value: unknown): string;
|
|
1012
|
+
|
|
1013
|
+
/** Whether a recorded conformance step was expected to commit or be refused. */
|
|
1014
|
+
type FixtureOutcome = 'applied' | 'aborted' | 'validation' | 'conflict' | 'resource' | 'authorization';
|
|
1015
|
+
/** The change one step produced, summarized to what a fixture can compare across runtimes. */
|
|
1016
|
+
interface ModelChangeSummary {
|
|
1017
|
+
readonly fromRevision: number;
|
|
1018
|
+
readonly toRevision: number;
|
|
1019
|
+
readonly origin: string;
|
|
1020
|
+
readonly dirty: readonly string[];
|
|
1021
|
+
readonly dependencyKeys: readonly string[];
|
|
1022
|
+
}
|
|
1023
|
+
/** Where anchors sat after a step — how a fixture proves positions survived an edit. */
|
|
1024
|
+
interface AnchorSnapshot {
|
|
1025
|
+
readonly anchorId: string;
|
|
1026
|
+
readonly story: string;
|
|
1027
|
+
readonly block: string;
|
|
1028
|
+
readonly affinity: 'before' | 'after';
|
|
1029
|
+
}
|
|
1030
|
+
/** What one step must produce: its outcome, its change summary, and its authored-state hash. */
|
|
1031
|
+
interface FixtureExpectation {
|
|
1032
|
+
readonly outcome: FixtureOutcome;
|
|
1033
|
+
/** Present iff outcome === 'applied'; MUST be > baseRevision. */
|
|
1034
|
+
readonly committedRevision?: number;
|
|
1035
|
+
readonly modelChange?: ModelChangeSummary;
|
|
1036
|
+
/** 16-hex authored-state fingerprint (comparator 0.4). */
|
|
1037
|
+
readonly authoredStateHash?: string;
|
|
1038
|
+
readonly outputHash?: string;
|
|
1039
|
+
readonly anchors?: readonly AnchorSnapshot[];
|
|
1040
|
+
}
|
|
1041
|
+
/** One recorded operation and what it was expected to do. */
|
|
1042
|
+
interface FixtureStep {
|
|
1043
|
+
readonly baseRevision: number;
|
|
1044
|
+
readonly origin: string;
|
|
1045
|
+
/** Opaque DocOp payloads (schema owned by section 4). */
|
|
1046
|
+
readonly ops: readonly unknown[];
|
|
1047
|
+
readonly expect: FixtureExpectation;
|
|
1048
|
+
}
|
|
1049
|
+
/** Opaque encoded backend bytes (snapshot or replication update). */
|
|
1050
|
+
interface EncodedEnvelope {
|
|
1051
|
+
readonly kind: 'snapshot' | 'update';
|
|
1052
|
+
readonly protocolVersion: number;
|
|
1053
|
+
readonly schemaVersion: number;
|
|
1054
|
+
readonly documentId: string;
|
|
1055
|
+
readonly byteLength: number;
|
|
1056
|
+
/** Hex-encoded opaque bytes; length MUST equal byteLength. */
|
|
1057
|
+
readonly bytesHex: string;
|
|
1058
|
+
}
|
|
1059
|
+
/** Which implementation recorded a fixture — local store, Yjs, or a binding. */
|
|
1060
|
+
type FixtureSource = {
|
|
1061
|
+
readonly kind: 'create';
|
|
1062
|
+
} | {
|
|
1063
|
+
readonly kind: 'docx';
|
|
1064
|
+
readonly sha256: string;
|
|
1065
|
+
readonly bytesRef: string;
|
|
1066
|
+
};
|
|
1067
|
+
/**
|
|
1068
|
+
* The frozen conformance container: revisions, origins, operations, changes, snapshots and
|
|
1069
|
+
* hashes.
|
|
1070
|
+
*
|
|
1071
|
+
* The CONTAINER is what is frozen — field names, origin membership, revision monotonicity, hash
|
|
1072
|
+
* format. The op and change payloads travel opaquely, so their schemas can evolve without
|
|
1073
|
+
* invalidating every recorded fixture.
|
|
1074
|
+
*/
|
|
1075
|
+
interface ConformanceFixture {
|
|
1076
|
+
readonly formatVersion: 1;
|
|
1077
|
+
readonly documentId: string;
|
|
1078
|
+
readonly source: FixtureSource;
|
|
1079
|
+
readonly steps: readonly FixtureStep[];
|
|
1080
|
+
readonly snapshots?: readonly EncodedEnvelope[];
|
|
1081
|
+
readonly updates?: readonly EncodedEnvelope[];
|
|
1082
|
+
}
|
|
1083
|
+
/** Whether a fixture is well-formed, listing every structural violation. */
|
|
1084
|
+
interface ValidationResult {
|
|
1085
|
+
readonly valid: boolean;
|
|
1086
|
+
readonly errors: readonly string[];
|
|
1087
|
+
}
|
|
1088
|
+
/** Structurally validate a fixture against the frozen format rules. */
|
|
1089
|
+
declare function validateFixture(fixture: ConformanceFixture): ValidationResult;
|
|
1090
|
+
|
|
1091
|
+
/** The outcome a store reports for one replayed step. */
|
|
1092
|
+
interface ReplayOutcome {
|
|
1093
|
+
readonly outcome: FixtureOutcome;
|
|
1094
|
+
readonly committedRevision?: number;
|
|
1095
|
+
/** Canonical authored-state value AFTER the step (hashed via comparator 0.4). */
|
|
1096
|
+
readonly authoredState?: unknown;
|
|
1097
|
+
}
|
|
1098
|
+
/** The interface a conformance runtime implements so one fixture can drive every backend. */
|
|
1099
|
+
interface ReplayStore {
|
|
1100
|
+
/** Initialize from the fixture source; return the initial revision (0 for create). */
|
|
1101
|
+
init(fixture: ConformanceFixture): number;
|
|
1102
|
+
/** Apply one step and report what happened. */
|
|
1103
|
+
applyStep(step: FixtureStep): ReplayOutcome;
|
|
1104
|
+
}
|
|
1105
|
+
/** What replaying a fixture produced: per-step outcomes and where they diverged. */
|
|
1106
|
+
interface ReplayReport {
|
|
1107
|
+
readonly ok: boolean;
|
|
1108
|
+
readonly mismatches: readonly string[];
|
|
1109
|
+
}
|
|
1110
|
+
/**
|
|
1111
|
+
* Replay a fixture against a store and check every step's outcome, committed
|
|
1112
|
+
* revision, and authored-state fingerprint against the fixture's expectations.
|
|
1113
|
+
*/
|
|
1114
|
+
declare function replayFixture(fixture: ConformanceFixture, store: ReplayStore): ReplayReport;
|
|
1115
|
+
/** Hash a store's authored state, so two runtimes replaying one fixture can be compared. */
|
|
1116
|
+
declare function hashAuthored(authoredState: unknown): string;
|
|
1117
|
+
|
|
1118
|
+
/**
|
|
1119
|
+
* Keys that must never be assigned from file data.
|
|
1120
|
+
*
|
|
1121
|
+
* XML attribute names become object keys, and a document controls those names — assigning
|
|
1122
|
+
* `__proto__` into an ordinary object is the prototype-pollution hazard this engine audits for.
|
|
1123
|
+
*/
|
|
1124
|
+
declare const DANGEROUS_KEYS: readonly string[];
|
|
1125
|
+
/** A file-derived key that would pollute a prototype. Refused, never sanitized-and-accepted. */
|
|
1126
|
+
declare class DangerousKeyError extends Error {
|
|
1127
|
+
readonly key: string;
|
|
1128
|
+
readonly path: string;
|
|
1129
|
+
constructor(key: string, path: string);
|
|
1130
|
+
}
|
|
1131
|
+
/** Whether a key is one of {@link DANGEROUS_KEYS}. */
|
|
1132
|
+
declare function isDangerousKey(key: string): boolean;
|
|
1133
|
+
/** A fresh null-prototype record — the only object shape parser intermediates use. */
|
|
1134
|
+
declare function nullRecord<T = unknown>(): Record<string, T>;
|
|
1135
|
+
/**
|
|
1136
|
+
* Recursively convert `value` into null-prototype records, rejecting any
|
|
1137
|
+
* dangerous object key. Arrays and primitives pass through (arrays rebuilt so no
|
|
1138
|
+
* inherited prototype pollution survives). Throws DangerousKeyError on the first
|
|
1139
|
+
* unsafe key, naming its path. Cyclic inputs are rejected.
|
|
1140
|
+
*/
|
|
1141
|
+
declare function toSafeRecord(value: unknown, path?: string): unknown;
|
|
1142
|
+
|
|
1143
|
+
/** Locate `[Content_Types].xml` bytes regardless of zip key spelling. */
|
|
1144
|
+
declare function contentTypesPartBytes(pkg: OoxmlPackage): {
|
|
1145
|
+
readonly storageKey: string;
|
|
1146
|
+
readonly bytes: Uint8Array;
|
|
1147
|
+
} | null;
|
|
1148
|
+
/**
|
|
1149
|
+
* What a package-level invariant walk found wrong.
|
|
1150
|
+
*
|
|
1151
|
+
* Package invariants are cross-PART: a relationship pointing at a part that does not exist, or a
|
|
1152
|
+
* part no content-type record covers. Neither is visible from inside a single part's tree.
|
|
1153
|
+
*/
|
|
1154
|
+
type PackageInvariantCode = 'dangling-relationship' | 'missing-content-type'
|
|
1155
|
+
/** A part occupies a name OPC reserves for package infrastructure. */
|
|
1156
|
+
| 'reserved-part-name'
|
|
1157
|
+
/** Two parts whose names differ only by case, which OPC treats as one part. */
|
|
1158
|
+
| 'duplicate-part-name'
|
|
1159
|
+
/** A part name the OPC screens refuse; `writeZip` would throw on save. */
|
|
1160
|
+
| 'unsafe-part-name';
|
|
1161
|
+
/** One package invariant violation, located by part name and relationship id. */
|
|
1162
|
+
interface PackageInvariantIssue {
|
|
1163
|
+
readonly code: PackageInvariantCode;
|
|
1164
|
+
/** The part the issue is about: the missing target, or the part with no type. */
|
|
1165
|
+
readonly partName: string;
|
|
1166
|
+
/** For a dangling relationship, the owner that points at nothing. */
|
|
1167
|
+
readonly ownerPart?: string;
|
|
1168
|
+
}
|
|
1169
|
+
/** Whether a package satisfies its cross-part invariants, listing every violation otherwise. */
|
|
1170
|
+
type PackageInvariantResult = {
|
|
1171
|
+
readonly ok: true;
|
|
1172
|
+
} | {
|
|
1173
|
+
readonly ok: false;
|
|
1174
|
+
readonly issues: readonly PackageInvariantIssue[];
|
|
1175
|
+
};
|
|
1176
|
+
/** Relationship records owned by one part, in authored order. */
|
|
1177
|
+
declare function relationshipsOf(pkg: OoxmlPackage, ownerPart: string): readonly RelationshipRecord[];
|
|
1178
|
+
/** The content type that resolves for a part name, or null when nothing declares one. */
|
|
1179
|
+
declare function resolveContentTypeOf(pkg: OoxmlPackage, partName: string): string | null;
|
|
1180
|
+
/** The `.rels` part that owns a part's relationships, by OPC convention. */
|
|
1181
|
+
declare function relsPartNameFor(partName: string): string;
|
|
1182
|
+
/**
|
|
1183
|
+
* Declare a content type for a part, by upserting an `<Override>` in the content-types tree.
|
|
1184
|
+
*
|
|
1185
|
+
* A no-op when the part already resolves to the same type, so repeating a write does not append
|
|
1186
|
+
* a duplicate entry. Resolving to a DIFFERENT type replaces the existing Override in place.
|
|
1187
|
+
* `forceOverride` writes an explicit Override even when a Default already matches.
|
|
1188
|
+
*/
|
|
1189
|
+
declare function withContentTypeOverride(pkg: OoxmlPackage, partName: string, contentType: string, options?: {
|
|
1190
|
+
readonly forceOverride?: boolean;
|
|
1191
|
+
}): OoxmlPackage;
|
|
1192
|
+
/** What {@link withoutPart} answers: `ok: false` leaves the package exactly as it was. */
|
|
1193
|
+
interface WithoutPartResult {
|
|
1194
|
+
readonly pkg: OoxmlPackage;
|
|
1195
|
+
readonly ok: boolean;
|
|
1196
|
+
}
|
|
1197
|
+
/** Add or replace one relationship on a part, returning a new package. */
|
|
1198
|
+
declare function withRelationship(pkg: OoxmlPackage, ownerPart: string, type: string, rawTarget: string): {
|
|
1199
|
+
readonly pkg: OoxmlPackage;
|
|
1200
|
+
readonly relationshipId: string;
|
|
1201
|
+
readonly ok: boolean;
|
|
1202
|
+
};
|
|
1203
|
+
/**
|
|
1204
|
+
* Add a part that does not exist yet, with the content-type override it needs to be openable.
|
|
1205
|
+
*
|
|
1206
|
+
* Deliberately does NOT create a relationship: a part is reachable because something points at
|
|
1207
|
+
* it, and which part points at it is the caller's decision. Creating one here would guess.
|
|
1208
|
+
*/
|
|
1209
|
+
declare function withNewPart(pkg: OoxmlPackage, partName: string, root: OoxmlElement, contentType: string): OoxmlPackage;
|
|
1210
|
+
/**
|
|
1211
|
+
* The two invariants a package must satisfy before it is published.
|
|
1212
|
+
*
|
|
1213
|
+
* Both describe the half-written state that splitting a multi-part write across transactions
|
|
1214
|
+
* produces, and both make a package Word refuses to open:
|
|
1215
|
+
*
|
|
1216
|
+
* - a relationship pointing at a part nobody created;
|
|
1217
|
+
* - a part with no content type, which is unopenable even though the XML is well formed.
|
|
1218
|
+
*
|
|
1219
|
+
* Checked at the commit boundary rather than inside each primitive, for the same reason part
|
|
1220
|
+
* validation moved there: a transaction is allowed to pass through an inconsistent intermediate
|
|
1221
|
+
* as long as nothing can observe it.
|
|
1222
|
+
*/
|
|
1223
|
+
declare function validatePackageInvariants(pkg: OoxmlPackage): PackageInvariantResult;
|
|
1224
|
+
|
|
1225
|
+
/**
|
|
1226
|
+
* Whether a string is a valid XML NCName in the strict ASCII profile — a name with no colon.
|
|
1227
|
+
*
|
|
1228
|
+
* This is the rule for names the engine itself writes or accepts from a caller. Names read
|
|
1229
|
+
* from a document use {@link isXmlNCName}, which admits every XML 1.0 name.
|
|
1230
|
+
*/
|
|
1231
|
+
declare function isValidNCName(name: string): boolean;
|
|
1232
|
+
/** A QName is an optional `prefix:` (both NCNames) — never attacker-derived. */
|
|
1233
|
+
declare function isValidQName(name: string): boolean;
|
|
1234
|
+
/**
|
|
1235
|
+
* Validate a qualified name, throwing when it is malformed.
|
|
1236
|
+
*
|
|
1237
|
+
* Guards the serializer: an invalid QName written into XML produces a file Word cannot open, so
|
|
1238
|
+
* it fails here rather than at save.
|
|
1239
|
+
*/
|
|
1240
|
+
declare function assertValidQName(name: string): void;
|
|
1241
|
+
/**
|
|
1242
|
+
* Controlled namespace-prefix allocation: deterministic, collision-free prefixes
|
|
1243
|
+
* for namespace URIs. A known URI always yields the same registered prefix; new
|
|
1244
|
+
* URIs get a generated `ns{n}` prefix, never one derived from file content.
|
|
1245
|
+
*/
|
|
1246
|
+
declare class PrefixAllocator {
|
|
1247
|
+
private readonly byUri;
|
|
1248
|
+
private readonly usedPrefixes;
|
|
1249
|
+
private counter;
|
|
1250
|
+
constructor(known?: Readonly<Record<string, string>>);
|
|
1251
|
+
prefixFor(namespaceUri: string): string;
|
|
1252
|
+
/** The declared bindings, for emitting xmlns declarations. */
|
|
1253
|
+
bindings(): {
|
|
1254
|
+
prefix: string;
|
|
1255
|
+
uri: string;
|
|
1256
|
+
}[];
|
|
1257
|
+
}
|
|
1258
|
+
|
|
1259
|
+
/**
|
|
1260
|
+
* A hyperlink target projected for a RUNTIME sink, or the reason it was withheld.
|
|
1261
|
+
*
|
|
1262
|
+
* The authored target stays authored — the record layer keeps it verbatim and escapes it into
|
|
1263
|
+
* owned OOXML, which is not a runtime sink. Only this allowlist-sanitized projection reaches DOM,
|
|
1264
|
+
* CSS, navigation or fetch, so `javascript:`, `data:` and `vbscript:` never leave the boundary.
|
|
1265
|
+
*/
|
|
1266
|
+
type HrefProjection = {
|
|
1267
|
+
readonly ok: true;
|
|
1268
|
+
readonly href: string;
|
|
1269
|
+
} | {
|
|
1270
|
+
readonly ok: false;
|
|
1271
|
+
readonly inert: true;
|
|
1272
|
+
};
|
|
1273
|
+
/**
|
|
1274
|
+
* Project a file-derived URL for a DOM/navigation sink. Strips embedded
|
|
1275
|
+
* tab/LF/CR (used to smuggle `java\nscript:`), allows relative URLs and the
|
|
1276
|
+
* scheme allowlist, and renders everything else inert. Never fetches.
|
|
1277
|
+
*/
|
|
1278
|
+
declare function sanitizeHref(raw: string): HrefProjection;
|
|
1279
|
+
/** XML-escape a value for validated serialization back into owned OOXML. */
|
|
1280
|
+
declare function escapeXml(value: string): string;
|
|
1281
|
+
/**
|
|
1282
|
+
* CSS string-escape a file-derived value (e.g. an `@font-face` family name or an
|
|
1283
|
+
* inline style value). Emits `\<hex> ` escapes for quotes, backslash, and
|
|
1284
|
+
* controls so the value cannot break out of its CSS string.
|
|
1285
|
+
*/
|
|
1286
|
+
declare function escapeCssString(value: string): string;
|
|
1287
|
+
/** Whether a file-derived CSS fragment contains a `url()` or `@import` (must be rejected). */
|
|
1288
|
+
declare function containsCssFetch(value: string): boolean;
|
|
1289
|
+
/**
|
|
1290
|
+
* Content that must never execute or auto-resolve: OLE objects, macros, DDE and `INCLUDE*` field
|
|
1291
|
+
* instructions.
|
|
1292
|
+
*
|
|
1293
|
+
* Rendered INERT by default rather than stripped — removing it would be a lossless-preservation
|
|
1294
|
+
* failure, so it is carried and never acted on.
|
|
1295
|
+
*/
|
|
1296
|
+
declare const INERT_EXECUTABLE_KINDS: readonly ['field-dde', 'field-include', 'macro', 'activex', 'ole', 'embedded-object', 'executable-relationship'];
|
|
1297
|
+
/** One of {@link INERT_EXECUTABLE_KINDS}. */
|
|
1298
|
+
/** One of {@link INERT_EXECUTABLE_KINDS} — content carried but never executed. */
|
|
1299
|
+
type InertExecutableKind = (typeof INERT_EXECUTABLE_KINDS)[number];
|
|
1300
|
+
/** Whether a content kind is one this engine refuses to execute or auto-resolve. */
|
|
1301
|
+
declare function isInertExecutable(kind: string): boolean;
|
|
1302
|
+
/** Whether a field instruction's leading keyword is safe to evaluate. */
|
|
1303
|
+
declare function isEvaluableField(instruction: string): boolean;
|
|
1304
|
+
/** One item a scrub pass considers: its kind, and where in the package it sits. */
|
|
1305
|
+
interface ContentItem {
|
|
1306
|
+
readonly id: string;
|
|
1307
|
+
readonly kind: string;
|
|
1308
|
+
}
|
|
1309
|
+
/**
|
|
1310
|
+
* What an explicit scrub removed.
|
|
1311
|
+
*
|
|
1312
|
+
* A scrub DECLARES ITSELF non-lossless: removing executable content changes the file, which is a
|
|
1313
|
+
* choice a caller makes deliberately rather than a default the engine applies.
|
|
1314
|
+
*/
|
|
1315
|
+
interface ScrubResult {
|
|
1316
|
+
readonly kept: readonly ContentItem[];
|
|
1317
|
+
readonly removed: readonly ContentItem[];
|
|
1318
|
+
/** A scrub that removes anything is non-lossless by definition. */
|
|
1319
|
+
readonly nonLossless: boolean;
|
|
1320
|
+
}
|
|
1321
|
+
/** Explicit scrub export: remove inert executable classes, report removals. */
|
|
1322
|
+
declare function scrubExport(items: readonly ContentItem[]): ScrubResult;
|
|
1323
|
+
|
|
1324
|
+
/** True for an `m:oMathPara` display equation. */
|
|
1325
|
+
declare function isOmmlDisplay(node: OoxmlNode): node is OoxmlGenericElementNode;
|
|
1326
|
+
/** True for a paragraph-level equation atom: `m:oMath` or `m:oMathPara`. */
|
|
1327
|
+
declare function isOmmlEquationAtom(node: OoxmlNode): node is OoxmlGenericElementNode;
|
|
1328
|
+
/** The `m:oMath` equations of a display, or the equation itself for an inline `m:oMath`. */
|
|
1329
|
+
declare function equationsOfAtom(node: OoxmlNode): readonly OoxmlGenericElementNode[];
|
|
1330
|
+
/**
|
|
1331
|
+
* Project a display equation as one layout atom. A display with one equation keeps that
|
|
1332
|
+
* equation's projection, so the painted atom names the editable `m:oMath`. Several equations
|
|
1333
|
+
* share one row, separated by an em space.
|
|
1334
|
+
*/
|
|
1335
|
+
declare function projectOmmlDisplay(node: OoxmlNode): OmmlEquationProjection | null;
|
|
1336
|
+
/**
|
|
1337
|
+
* The physical justification of a paragraph whose only visible content is display math.
|
|
1338
|
+
* `m:oMathParaPr/m:jc` sets it; the default `centerGroup` centers the display. Returns null
|
|
1339
|
+
* when the paragraph also holds text or other content, which keeps the paragraph `w:jc`.
|
|
1340
|
+
*/
|
|
1341
|
+
declare function displayMathAlignment(paragraph: {
|
|
1342
|
+
readonly children: readonly OoxmlNode[];
|
|
1343
|
+
}): 'left' | 'center' | 'right' | null;
|
|
1344
|
+
/** Project a paragraph-level equation atom: inline `m:oMath` or display `m:oMathPara`. */
|
|
1345
|
+
declare function projectOmmlAtom(node: OoxmlNode): OmmlEquationProjection | null;
|
|
1346
|
+
|
|
1347
|
+
/** UTF-16 placeholder for a page break in paragraph text projections. */
|
|
1348
|
+
declare const PAGE_BREAK_CHAR = "\f";
|
|
1349
|
+
/** What a `w:br` breaks. `other` covers values this engine does not model, kept losslessly. */
|
|
1350
|
+
type HardBreakKind = 'line' | 'page' | 'column' | 'other';
|
|
1351
|
+
/** Read the semantic break kind from a typed `w:br` node. */
|
|
1352
|
+
declare function hardBreakKind(node: OoxmlHardBreakNode): HardBreakKind;
|
|
1353
|
+
/** Whether a node is a `w:br` with `w:type="page"`. */
|
|
1354
|
+
declare function isPageBreakNode(node: OoxmlNode): node is OoxmlHardBreakNode;
|
|
1355
|
+
/** Text projection for a `w:br` node — one UTF-16 code unit per break. */
|
|
1356
|
+
declare function hardBreakText(node: OoxmlHardBreakNode): string;
|
|
1357
|
+
/** Attributes for a newly authored `w:br`. */
|
|
1358
|
+
declare function hardBreakAttributes(kind: 'line' | 'page'): OoxmlHardBreakNode['attributes'];
|
|
1359
|
+
|
|
1360
|
+
/** Parsed TOC instruction. Unknown switches are ignored for generation but left on the wire. */
|
|
1361
|
+
interface TocInstruction {
|
|
1362
|
+
readonly keyword: 'TOC';
|
|
1363
|
+
/** Include hyperlinks (`\\h`). */
|
|
1364
|
+
readonly hyperlink: boolean;
|
|
1365
|
+
/** Omit page numbers (`\\n`). */
|
|
1366
|
+
readonly omitPageNumbers: boolean;
|
|
1367
|
+
/** Inclusive 1-based outline levels from `\\o "n-m"`. Defaults 1–9. */
|
|
1368
|
+
readonly outlineStart: number;
|
|
1369
|
+
readonly outlineEnd: number;
|
|
1370
|
+
readonly raw: string;
|
|
1371
|
+
}
|
|
1372
|
+
/** Longest TOC field instruction read. Instructions come from a file; the parse is bounded. */
|
|
1373
|
+
declare const TOC_MAX_INSTRUCTION_CHARS = 256;
|
|
1374
|
+
/** Most entries one generated table of contents may hold. */
|
|
1375
|
+
declare const TOC_MAX_ENTRIES = 512;
|
|
1376
|
+
/** Most bookmarks minted during one TOC refresh. */
|
|
1377
|
+
declare const TOC_MAX_BOOKMARKS_PER_REFRESH = 512;
|
|
1378
|
+
/** Deepest nested field instruction followed. Caps recursion on file-supplied structure. */
|
|
1379
|
+
declare const TOC_MAX_FIELD_NESTING = 4;
|
|
1380
|
+
/**
|
|
1381
|
+
* Most layout passes a TOC refresh runs before settling.
|
|
1382
|
+
*
|
|
1383
|
+
* Page numbers change the TOC's own height, which changes page numbers — bounded so a
|
|
1384
|
+
* non-converging document stops rather than looping.
|
|
1385
|
+
*/
|
|
1386
|
+
declare const TOC_MAX_PAGE_PASSES = 3;
|
|
1387
|
+
/**
|
|
1388
|
+
* Parse a TOC field instruction string.
|
|
1389
|
+
*
|
|
1390
|
+
* Returns null when the leading keyword is not TOC, the string is over-long, or the
|
|
1391
|
+
* outline range is hostile. Does not evaluate or fetch anything.
|
|
1392
|
+
*/
|
|
1393
|
+
declare function parseTocInstruction(raw: string): TocInstruction | null;
|
|
1394
|
+
|
|
1395
|
+
/** A table of contents found in a document, whether wrapped in an SDT or a bare field. */
|
|
1396
|
+
interface DetectedToc {
|
|
1397
|
+
/** Enclosing control id when it identifies one TOC, otherwise the begin fldChar id. */
|
|
1398
|
+
readonly id: string;
|
|
1399
|
+
readonly beginNodeId: string;
|
|
1400
|
+
readonly beginParagraphId: string;
|
|
1401
|
+
readonly endParagraphId: string;
|
|
1402
|
+
readonly resultParagraphIds: readonly string[];
|
|
1403
|
+
/** Direct parent whose paragraph children delimit the cached result. */
|
|
1404
|
+
readonly containerId: string;
|
|
1405
|
+
readonly contentControlId?: string;
|
|
1406
|
+
readonly instruction: TocInstruction;
|
|
1407
|
+
}
|
|
1408
|
+
/** Discover refreshable body TOCs without evaluating any field instruction. */
|
|
1409
|
+
declare function detectBodyTocs(part: OoxmlPart): readonly DetectedToc[];
|
|
1410
|
+
/** Locate the table of contents containing a position, or null. */
|
|
1411
|
+
declare function findDetectedToc(tocs: readonly DetectedToc[], tocId: string): DetectedToc | null;
|
|
1412
|
+
|
|
1413
|
+
/** One heading symbol: its `w:font` and `w:char`, as the file wrote them. */
|
|
1414
|
+
interface TocSymbol {
|
|
1415
|
+
readonly font: string | null;
|
|
1416
|
+
readonly char: string;
|
|
1417
|
+
}
|
|
1418
|
+
|
|
1419
|
+
declare const TWIPS: unique symbol;
|
|
1420
|
+
declare const POINTS: unique symbol;
|
|
1421
|
+
/**
|
|
1422
|
+
* A length in twentieths of a point — OOXML's `ST_TwipsMeasure` / `ST_SignedTwipsMeasure`.
|
|
1423
|
+
*
|
|
1424
|
+
* The brand is intersection-typed onto `number`, so a `Twips` value still decays to `number`
|
|
1425
|
+
* wherever arithmetic consumes it; only the reverse direction — passing a raw number where
|
|
1426
|
+
* `Twips` is declared — is refused.
|
|
1427
|
+
*
|
|
1428
|
+
* @public
|
|
1429
|
+
*/
|
|
1430
|
+
type Twips = number & {
|
|
1431
|
+
readonly [TWIPS]: true;
|
|
1432
|
+
};
|
|
1433
|
+
/**
|
|
1434
|
+
* A length in typographic points, the unit layout and paint compute in.
|
|
1435
|
+
*
|
|
1436
|
+
* @public
|
|
1437
|
+
*/
|
|
1438
|
+
type Points = number & {
|
|
1439
|
+
readonly [POINTS]: true;
|
|
1440
|
+
};
|
|
1441
|
+
/**
|
|
1442
|
+
* Twentieths of a point per point.
|
|
1443
|
+
*
|
|
1444
|
+
* @public
|
|
1445
|
+
*/
|
|
1446
|
+
declare const TWIPS_PER_POINT = 20;
|
|
1447
|
+
/**
|
|
1448
|
+
* Assert that a number is a twips measurement.
|
|
1449
|
+
*
|
|
1450
|
+
* A compile-time cast, not a validator: bounds, integrality and finiteness stay at the parse
|
|
1451
|
+
* boundary that produced the number, exactly where they are enforced today. The cast is the
|
|
1452
|
+
* caller's claim about the UNIT, nothing more.
|
|
1453
|
+
*
|
|
1454
|
+
* @public
|
|
1455
|
+
*/
|
|
1456
|
+
declare const twips: (value: number) => Twips;
|
|
1457
|
+
/**
|
|
1458
|
+
* Assert that a number is a points measurement. A compile-time cast; see {@link twips}.
|
|
1459
|
+
*
|
|
1460
|
+
* @public
|
|
1461
|
+
*/
|
|
1462
|
+
declare const points: (value: number) => Points;
|
|
1463
|
+
/**
|
|
1464
|
+
* The one twips-to-points conversion. Exact division; twips are the finer unit.
|
|
1465
|
+
*
|
|
1466
|
+
* @public
|
|
1467
|
+
*/
|
|
1468
|
+
declare const twipsToPoints: (value: Twips) => Points;
|
|
1469
|
+
/**
|
|
1470
|
+
* The one points-to-twips conversion.
|
|
1471
|
+
*
|
|
1472
|
+
* Rounds to the nearest twip: every OOXML twips measurement is integral, and emitting a
|
|
1473
|
+
* fractional twip would write a value no consumer of the file can represent.
|
|
1474
|
+
*
|
|
1475
|
+
* @public
|
|
1476
|
+
*/
|
|
1477
|
+
declare const pointsToTwips: (value: Points) => Twips;
|
|
1478
|
+
/**
|
|
1479
|
+
* Read a twips attribute (`ST_TwipsMeasure`, `ST_SignedTwipsMeasure`, or a `dxa` table width)
|
|
1480
|
+
* as a whole, signed number of twips, or `null` when the value is not a measurement.
|
|
1481
|
+
*
|
|
1482
|
+
* The schema allows an integer or a universal measure, but files also carry decimal twips
|
|
1483
|
+
* (`4743.74`, `708.0`, `707.9999999999998`). The accepted forms read as follows:
|
|
1484
|
+
*
|
|
1485
|
+
* - A decimal truncates toward zero: `1443.74` is 1443 and `-720.6` is -720. A leading `+`,
|
|
1486
|
+
* leading zeros, a bare fraction (`.5`) and a trailing point (`1440.`) are accepted.
|
|
1487
|
+
* - A universal measure (`mm`, `cm`, `in`, `pt`, `pc`, `pi`) converts exactly and then
|
|
1488
|
+
* truncates: `1.27cm` is 720 and `0.333in` is 479. Its sign is ignored, so `-0.5in` is 720.
|
|
1489
|
+
* - Whitespace, exponents, hexadecimal, uppercase units, and an integer part longer than nine
|
|
1490
|
+
* digits are not measurements.
|
|
1491
|
+
*
|
|
1492
|
+
* The result is NOT bounded. Callers apply their own sign rule and range clamp, because each
|
|
1493
|
+
* attribute has a different valid range and a different fallback.
|
|
1494
|
+
*
|
|
1495
|
+
* @internal
|
|
1496
|
+
*/
|
|
1497
|
+
declare function readTwipsMeasure(raw: string | undefined): number | null;
|
|
1498
|
+
|
|
1499
|
+
/** Outline heading shape consumed by TOC planning (mirrors DocumentOutlineEntry). */
|
|
1500
|
+
interface TocOutlineHeading {
|
|
1501
|
+
readonly text: string;
|
|
1502
|
+
readonly level: number;
|
|
1503
|
+
readonly blockId: string;
|
|
1504
|
+
}
|
|
1505
|
+
|
|
1506
|
+
/** Left-indent step between TOC levels, in twips (matches `scripts/demo-doc/toc-block.xml`). */
|
|
1507
|
+
declare const TOC_LEVEL_INDENT_TWIPS: Twips;
|
|
1508
|
+
/** Bounded left-indent twips for a TOC entry level (0-based heading depth). */
|
|
1509
|
+
declare function tocLeftIndentTwips(level: number): Twips;
|
|
1510
|
+
/** One planned TOC entry: its level, its text, and the heading it points at. */
|
|
1511
|
+
interface TocEntryPlan {
|
|
1512
|
+
readonly level: number;
|
|
1513
|
+
readonly text: string;
|
|
1514
|
+
readonly headingParagraphId: string;
|
|
1515
|
+
readonly bookmarkName: string;
|
|
1516
|
+
readonly pageNumberText: string;
|
|
1517
|
+
/** The heading's symbols, one per {@link TOC_SYMBOL_MARK} in `text`, in order. */
|
|
1518
|
+
readonly symbols?: readonly TocSymbol[];
|
|
1519
|
+
}
|
|
1520
|
+
/** Build one TOC entry paragraph node. */
|
|
1521
|
+
declare function buildTocEntryParagraph(mint: () => string, entry: TocEntryPlan, instruction: TocInstruction, paragraphPropertiesTemplate?: OoxmlNode): OoxmlNode;
|
|
1522
|
+
/** Build an SDT-wrapped complex TOC field with an already planned cached result. */
|
|
1523
|
+
declare function buildTocContentControl(mint: () => string, entries: readonly TocEntryPlan[], instruction: TocInstruction, alias: string): OoxmlNode;
|
|
1524
|
+
/**
|
|
1525
|
+
* Word flattens manual line/tab breaks from a heading into spaces in its TOC cache.
|
|
1526
|
+
* Carrying them verbatim makes a short title wrap even when the row has ample room, and the
|
|
1527
|
+
* same normalization is what lets a cached row be matched back to the heading it came from.
|
|
1528
|
+
*/
|
|
1529
|
+
declare function tocEntryText(text: string): string;
|
|
1530
|
+
/**
|
|
1531
|
+
* Plan TOC entries from the outline and existing bookmarks.
|
|
1532
|
+
*
|
|
1533
|
+
* `actorId` is explicit because this planner runs BEFORE the store transaction, so the
|
|
1534
|
+
* ambient transaction actor is not bound. Callers that already have the collaboration
|
|
1535
|
+
* identity pass it here. `resolveAllocationActor` still honours a
|
|
1536
|
+
* `runWithTransactionActor` wrap when the caller prefers that seam.
|
|
1537
|
+
*/
|
|
1538
|
+
declare function planTocEntries(part: OoxmlPart, outline: readonly TocOutlineHeading[], instruction: TocInstruction, pageNumberByParagraphId: ReadonlyMap<string, string>, excludeParagraphIds: ReadonlySet<string>, actorId?: string): {
|
|
1539
|
+
readonly entries: readonly TocEntryPlan[];
|
|
1540
|
+
readonly bookmarksToCreate: readonly {
|
|
1541
|
+
paragraphId: string;
|
|
1542
|
+
name: string;
|
|
1543
|
+
}[];
|
|
1544
|
+
};
|
|
1545
|
+
/** Create bookmarkStart/End pair nodes for insertion at the start of a paragraph. */
|
|
1546
|
+
declare function bookmarkPairNodes(mint: () => string, name: string, id: string): {
|
|
1547
|
+
readonly start: OoxmlNode;
|
|
1548
|
+
readonly end: OoxmlNode;
|
|
1549
|
+
};
|
|
1550
|
+
|
|
1551
|
+
/**
|
|
1552
|
+
* The heading each cached result row stands for, aligned with `toc.resultParagraphIds`.
|
|
1553
|
+
*
|
|
1554
|
+
* `null` for a row that names no heading this document still has — a stale row, or the
|
|
1555
|
+
* chrome/blank paragraphs a cached result can carry. Callers leave those alone rather than
|
|
1556
|
+
* writing another row's number into them.
|
|
1557
|
+
*/
|
|
1558
|
+
declare function resolveTocRowHeadings(part: OoxmlPart, toc: DetectedToc, outline: readonly TocOutlineHeading[], excludeParagraphIds: ReadonlySet<string>): readonly (string | null)[];
|
|
1559
|
+
|
|
1560
|
+
/** One paragraph in the index: its node id, its story, and its position. */
|
|
1561
|
+
interface ParagraphIndexEntry {
|
|
1562
|
+
/** Canonical tree node id — the stable identity operations address. */
|
|
1563
|
+
readonly nodeId: string;
|
|
1564
|
+
/** Position among the story's paragraphs, in document order. */
|
|
1565
|
+
readonly ordinal: number;
|
|
1566
|
+
/** Concatenated text content, with tabs and breaks mapped as the model reads them. */
|
|
1567
|
+
readonly text: string;
|
|
1568
|
+
/** Node ids of the paragraph's runs, in order. */
|
|
1569
|
+
readonly runIds: readonly string[];
|
|
1570
|
+
}
|
|
1571
|
+
/** One story root — body, a header/footer variant, or a note part. */
|
|
1572
|
+
interface StoryIndexEntry {
|
|
1573
|
+
/** The part the story lives in. */
|
|
1574
|
+
readonly partName: string;
|
|
1575
|
+
/** The `w:body` (or story root) node id. */
|
|
1576
|
+
readonly rootId: string;
|
|
1577
|
+
readonly paragraphs: readonly ParagraphIndexEntry[];
|
|
1578
|
+
}
|
|
1579
|
+
/** One style definition, indexed by the id content references it under. */
|
|
1580
|
+
interface StyleIndexEntry {
|
|
1581
|
+
readonly styleId: string;
|
|
1582
|
+
readonly type: string;
|
|
1583
|
+
readonly nodeId: string;
|
|
1584
|
+
readonly name: string | null;
|
|
1585
|
+
readonly basedOn: string | null;
|
|
1586
|
+
/** Whether the part marks this the default style for its type (`w:default="1"`). */
|
|
1587
|
+
readonly isDefault: boolean;
|
|
1588
|
+
}
|
|
1589
|
+
/**
|
|
1590
|
+
* The derived lookups over a part: paragraphs, stories and styles by id.
|
|
1591
|
+
*
|
|
1592
|
+
* Diff-patched on commit rather than rebuilt — rebuilding every index per keystroke is what made
|
|
1593
|
+
* typing scale with document length.
|
|
1594
|
+
*/
|
|
1595
|
+
interface OoxmlIndexes {
|
|
1596
|
+
/** The tree revision these projections were derived from. */
|
|
1597
|
+
readonly revision: number;
|
|
1598
|
+
/** Body story first, then any other story parts, keyed by part name. */
|
|
1599
|
+
readonly stories: ReadonlyMap<string, StoryIndexEntry>;
|
|
1600
|
+
/** Every paragraph across every story, keyed by node id. */
|
|
1601
|
+
readonly paragraphs: ReadonlyMap<string, ParagraphIndexEntry>;
|
|
1602
|
+
readonly relationships: ReadonlyMap<string, readonly RelationshipRecord[]>;
|
|
1603
|
+
readonly styles: ReadonlyMap<string, StyleIndexEntry>;
|
|
1604
|
+
}
|
|
1605
|
+
/** Style definitions, read out of the generic `w:styles` tree. */
|
|
1606
|
+
declare function indexStyles(part: OoxmlPart | undefined): Map<string, StyleIndexEntry>;
|
|
1607
|
+
/** The package's style definitions part, if it has one. */
|
|
1608
|
+
declare function stylesPartOf(pkg: OoxmlPackage): OoxmlPart | undefined;
|
|
1609
|
+
/**
|
|
1610
|
+
* Derive every index from one canonical package revision.
|
|
1611
|
+
*
|
|
1612
|
+
* Pure: the same package and revision always produce the same index, which is what makes
|
|
1613
|
+
* "rebuild rather than mutate" a safe invalidation strategy.
|
|
1614
|
+
*/
|
|
1615
|
+
declare function deriveOoxmlIndexes(pkg: OoxmlPackage, revision: number): OoxmlIndexes;
|
|
1616
|
+
|
|
1617
|
+
/** One paragraph's meaning, independent of how it was spelled in XML. */
|
|
1618
|
+
interface ParagraphDigest {
|
|
1619
|
+
/** Ordinal identity within its story. Node ids are NOT used: a reopened package
|
|
1620
|
+
* legitimately re-derives them, and requiring them to match would test the id scheme
|
|
1621
|
+
* rather than the content. */
|
|
1622
|
+
readonly ordinal: number;
|
|
1623
|
+
/**
|
|
1624
|
+
* Where the paragraph SITS: the element path from the story root, so a paragraph that
|
|
1625
|
+
* moves out of the table cell it was written in is a difference rather than a paragraph
|
|
1626
|
+
* with the same ordinal and the same text.
|
|
1627
|
+
*/
|
|
1628
|
+
readonly path: string;
|
|
1629
|
+
/**
|
|
1630
|
+
* `w14:paraId`, uppercase-normalized (matching is case-insensitive), or null. This is
|
|
1631
|
+
* MANAGED identity — the agent contract anchors on it and comment threading references
|
|
1632
|
+
* it — so a serializer silently dropping it must be a digest difference. Other paragraph
|
|
1633
|
+
* attributes (`w:rsidR` …) stay deliberately undigested: they are revision noise.
|
|
1634
|
+
*/
|
|
1635
|
+
readonly paraId: string | null;
|
|
1636
|
+
/** Text content, including tabs and hard breaks as their characters. */
|
|
1637
|
+
readonly text: string;
|
|
1638
|
+
/** Accepted paragraph properties, as sorted tokens including nested children. */
|
|
1639
|
+
readonly paragraphProperties: readonly string[];
|
|
1640
|
+
/** Per-run accepted properties, in run order. */
|
|
1641
|
+
readonly runProperties: readonly (readonly string[])[];
|
|
1642
|
+
/** Fingerprints of every generic (unknown) subtree, in document order. */
|
|
1643
|
+
readonly genericStructure: readonly string[];
|
|
1644
|
+
}
|
|
1645
|
+
/** One story reduced to its semantic content, ignoring everything a normalized re-emit changes. */
|
|
1646
|
+
interface StoryDigest {
|
|
1647
|
+
readonly partName: string;
|
|
1648
|
+
readonly paragraphs: readonly ParagraphDigest[];
|
|
1649
|
+
/**
|
|
1650
|
+
* Every block-level element of the part OUTSIDE a paragraph, in document order, as
|
|
1651
|
+
* `path name(attributes)` — the tables, rows, cells, sections, content controls and
|
|
1652
|
+
* their property children, each at the position that says what contains it.
|
|
1653
|
+
*
|
|
1654
|
+
* A paragraph's own internals are not here (they are its `ParagraphDigest`), which keeps
|
|
1655
|
+
* this list proportional to a document's STRUCTURE rather than its text.
|
|
1656
|
+
*/
|
|
1657
|
+
readonly structure: readonly string[];
|
|
1658
|
+
}
|
|
1659
|
+
/**
|
|
1660
|
+
* The whole document's semantic content — one of the D9 losslessness oracles.
|
|
1661
|
+
*
|
|
1662
|
+
* What a save/reopen round-trip is compared on. Byte identity applies only to non-XML parts;
|
|
1663
|
+
* modelled parts re-emit normalized, so equality is asserted HERE rather than on bytes.
|
|
1664
|
+
*/
|
|
1665
|
+
interface SemanticDigest {
|
|
1666
|
+
readonly stories: readonly StoryDigest[];
|
|
1667
|
+
}
|
|
1668
|
+
/** Where two digests diverge — the diagnostic when a round-trip loses something. */
|
|
1669
|
+
type DigestDifference = {
|
|
1670
|
+
readonly path: string;
|
|
1671
|
+
readonly before: string;
|
|
1672
|
+
readonly after: string;
|
|
1673
|
+
};
|
|
1674
|
+
/** Digest one part: its paragraphs, and the structure that holds them. */
|
|
1675
|
+
declare function digestPart(part: OoxmlPart): StoryDigest | null;
|
|
1676
|
+
/** Digest every part, in the given order. */
|
|
1677
|
+
declare function semanticDigest(parts: Iterable<OoxmlPart>): SemanticDigest;
|
|
1678
|
+
/**
|
|
1679
|
+
* Every way two digests differ, as readable paths.
|
|
1680
|
+
*
|
|
1681
|
+
* Returns the differences rather than a boolean because "the round trip lost something" is
|
|
1682
|
+
* useless without saying what — the failure this oracle exists to catch is a silent drop,
|
|
1683
|
+
* and a bare `false` reproduces the silence.
|
|
1684
|
+
*/
|
|
1685
|
+
declare function diffSemanticDigests(before: SemanticDigest, after: SemanticDigest): DigestDifference[];
|
|
1686
|
+
|
|
1687
|
+
/** Valid per MS-DOCX: 8 hex digits, non-zero, below 0x80000000. */
|
|
1688
|
+
declare function isValidParaId(value: string): boolean;
|
|
1689
|
+
/** The authored `w14:paraId` value of an element, verbatim, or null. */
|
|
1690
|
+
declare function paraIdOf(node: OoxmlNode): string | null;
|
|
1691
|
+
/** FNV-1a over UTF-16 code units — the deterministic mint every id derivation shares. */
|
|
1692
|
+
declare function fnv1a32(value: string): number;
|
|
1693
|
+
/**
|
|
1694
|
+
* Deterministic 8-hex mint in (0x00000000, 0x80000000), collision-free against
|
|
1695
|
+
* `used` (uppercase hex). Same seed + same used-set → same value, which is what
|
|
1696
|
+
* keeps `splitParagraphMany` byte-identical to its equivalent single splits and
|
|
1697
|
+
* a reopened save identical to the session that produced it.
|
|
1698
|
+
*/
|
|
1699
|
+
declare function mintParaId(seed: string, used: ReadonlySet<string>): string;
|
|
1700
|
+
/** Every valid `w14:paraId` in the tree, uppercased. Memoized per root object. */
|
|
1701
|
+
declare function usedParaIds(root: OoxmlElement): ReadonlySet<string>;
|
|
1702
|
+
/**
|
|
1703
|
+
* The non-empty prefix the part ROOT binds to the w14 namespace, or null.
|
|
1704
|
+
*
|
|
1705
|
+
* Minted attributes require an in-scope binding (the invariant validator reports
|
|
1706
|
+
* `invalid-qname` otherwise, and the serializer would allocate an `nsN` alias).
|
|
1707
|
+
* Only the root binding counts: a binding authored on some descendant does not
|
|
1708
|
+
* cover paragraphs elsewhere in the tree.
|
|
1709
|
+
*/
|
|
1710
|
+
declare function w14RootPrefix(root: OoxmlElement): string | null;
|
|
1711
|
+
/** 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. */
|
|
1712
|
+
declare function mintedParagraphIdentityAttributes(prefix: string, value: string): readonly OoxmlAttribute[];
|
|
1713
|
+
/**
|
|
1714
|
+
* Load-time paragraph-identity normalization for a session's main part.
|
|
1715
|
+
*
|
|
1716
|
+
* Keeps every valid, first-seen paraId verbatim; mints (deterministically, seeded
|
|
1717
|
+
* by the paragraph's structural node id) for paragraphs whose id is missing,
|
|
1718
|
+
* malformed, zero, out of range, or a duplicate. Adds the root `xmlns` binding
|
|
1719
|
+
* the minted attributes need. Returns the INPUT PART REFERENCE when there is
|
|
1720
|
+
* nothing to do — a document Word saved yesterday re-serializes byte-identical.
|
|
1721
|
+
*
|
|
1722
|
+
* Attribute-only rebuilds move no child, so every node keeps its structural-path
|
|
1723
|
+
* id; the copy respreads only the ancestors of changed paragraphs.
|
|
1724
|
+
*
|
|
1725
|
+
* Fail-open: if the rebuilt part does not validate (a bug, or a pathology the
|
|
1726
|
+
* prefix choice could not defuse), the original part is returned — a document
|
|
1727
|
+
* must never become unopenable over an identity enhancement.
|
|
1728
|
+
*/
|
|
1729
|
+
declare function normalizeParagraphIdentity(part: OoxmlPart): OoxmlPart;
|
|
1730
|
+
|
|
1731
|
+
/** One `w:docPart` of the glossary, with the blocks its body holds. */
|
|
1732
|
+
interface BuildingBlock {
|
|
1733
|
+
/** `w:docPartPr/w:name`, the identity a control's placeholder and a pick refer to. */
|
|
1734
|
+
readonly name: string;
|
|
1735
|
+
/** `w:category/w:gallery`, an `ST_DocPartGallery` value such as `docParts`. */
|
|
1736
|
+
readonly gallery: string;
|
|
1737
|
+
/** `w:category/w:name`; `General` when the block declares none. */
|
|
1738
|
+
readonly category: string;
|
|
1739
|
+
/** The `w:docPartBody` children: paragraphs, tables and block controls, in order. */
|
|
1740
|
+
readonly blocks: readonly OoxmlNode[];
|
|
1741
|
+
}
|
|
1742
|
+
/** The gallery and category a `w:docPartList` control lists. */
|
|
1743
|
+
interface BuildingBlockGalleryFilter {
|
|
1744
|
+
readonly gallery: string;
|
|
1745
|
+
readonly category: string | null;
|
|
1746
|
+
}
|
|
1747
|
+
/** The glossary part, through the main part's relationship or the conventional name. */
|
|
1748
|
+
declare function glossaryPartOf(pkg: OoxmlPackage): OoxmlPart | null;
|
|
1749
|
+
/** Every named building block of the glossary, in authored order. Empty without a glossary. */
|
|
1750
|
+
declare function buildingBlocksOf(pkg: OoxmlPackage): readonly BuildingBlock[];
|
|
1751
|
+
/** The gallery a `w:docPartList` control lists, or null for any other control. */
|
|
1752
|
+
declare function buildingBlockGalleryOf(control: OoxmlNode): BuildingBlockGalleryFilter | null;
|
|
1753
|
+
/**
|
|
1754
|
+
* The blocks a gallery control offers: same gallery, and the control's category when it names
|
|
1755
|
+
* one. Sorted by category, then name, as Word groups its list.
|
|
1756
|
+
*/
|
|
1757
|
+
declare function buildingBlocksForControl(pkg: OoxmlPackage, control: OoxmlNode): readonly BuildingBlock[];
|
|
1758
|
+
|
|
1759
|
+
/**
|
|
1760
|
+
* Which story a comment deletion or resolution may read markers from.
|
|
1761
|
+
*
|
|
1762
|
+
* `w:id` is not unique across stories: a header and the body can both hold comment 1.
|
|
1763
|
+
*/
|
|
1764
|
+
interface CommentDeletionOwner {
|
|
1765
|
+
/** Canonical name of the part holding the story's markers. */
|
|
1766
|
+
readonly storyPartName: string;
|
|
1767
|
+
/**
|
|
1768
|
+
* When the story is one note inside a shared notes part, that note's `w:id`.
|
|
1769
|
+
* Absent means the whole part is the story (body, header, footer).
|
|
1770
|
+
*/
|
|
1771
|
+
readonly noteId?: number;
|
|
1772
|
+
}
|
|
1773
|
+
|
|
1774
|
+
/**
|
|
1775
|
+
* Delete a comment thread: that story's markers, and metadata no other story still names.
|
|
1776
|
+
*
|
|
1777
|
+
* `owner` names the story whose markers may be stripped. Omitted, it is the main document
|
|
1778
|
+
* body — never every XML part. A header or note that reused the same `w:id` is a different
|
|
1779
|
+
* remark; pass its part (and `noteId` when the story is one note) to delete that one.
|
|
1780
|
+
*
|
|
1781
|
+
* Returns the package unchanged when the id names no comment, and null when a removal was
|
|
1782
|
+
* refused — a caller inside a transaction rolls back rather than committing a package whose
|
|
1783
|
+
* comment is half gone.
|
|
1784
|
+
*/
|
|
1785
|
+
declare function deleteCommentThread(pkg: OoxmlPackage, commentId: string, owner?: CommentDeletionOwner): OoxmlPackage | null;
|
|
1786
|
+
/**
|
|
1787
|
+
* Delete every comment the edit between `before` and `after` emptied in `owner`'s story.
|
|
1788
|
+
*
|
|
1789
|
+
* `owner` omitted is the main document body, matching {@link deleteCommentThread}.
|
|
1790
|
+
*
|
|
1791
|
+
* THE TEST, exactly, and per story. A comment dies when the words it covered in that story are
|
|
1792
|
+
* gone and nothing in that story still places it. A neighbour that reused the same `w:id` is
|
|
1793
|
+
* judged under its own owner. Notes that vanished (reference cascade) are reaped as their own
|
|
1794
|
+
* stories so a unique id still loses its `comments.xml` body. Remaining-marker overflow
|
|
1795
|
+
* preserves comments/commentEx/commentId metadata rather than deleting records the scan could
|
|
1796
|
+
* not prove unused. Null is reserved for a removal that actually failed.
|
|
1797
|
+
*/
|
|
1798
|
+
declare function cascadeEmptiedComments(before: OoxmlPackage, after: OoxmlPackage, owner?: CommentDeletionOwner): OoxmlPackage | null;
|
|
1799
|
+
|
|
1800
|
+
/** Presentation settings the document itself states. Absence is the answer, never an error. */
|
|
1801
|
+
interface DocumentViewSettings {
|
|
1802
|
+
/**
|
|
1803
|
+
* `w:doNotShadeFormData` (§17.15.1.49) — do NOT shade legacy form fields.
|
|
1804
|
+
*
|
|
1805
|
+
* Word draws a grey block behind every `w:ffData` field so a reader can find the blanks in a
|
|
1806
|
+
* form. It is on by DEFAULT, and this element is how a document turns it off, so the absent
|
|
1807
|
+
* case means shading. Reading the name as "shade form data" inverts it and blanks the shading
|
|
1808
|
+
* on exactly the documents that asked for it loudest.
|
|
1809
|
+
*
|
|
1810
|
+
* Never printed, by Word or by us: it marks where to type, and a printed form has no blanks
|
|
1811
|
+
* to find.
|
|
1812
|
+
*/
|
|
1813
|
+
readonly doNotShadeFormData: boolean;
|
|
1814
|
+
}
|
|
1815
|
+
/** The defaults a document with no `settings.xml` gets: everything Word would shade, shaded. */
|
|
1816
|
+
declare const DEFAULT_VIEW_SETTINGS: DocumentViewSettings;
|
|
1817
|
+
/** Read the view settings from a `settings.xml` root, or the defaults when it has none. */
|
|
1818
|
+
declare function readViewSettings(settingsRoot: OoxmlNode | null | undefined): DocumentViewSettings;
|
|
1819
|
+
|
|
1820
|
+
/** How deep transparent block wrappers may nest before the walk stops descending. */
|
|
1821
|
+
declare const MAX_STORY_SDT_NESTING = 32;
|
|
1822
|
+
/** Which kind of story a root is. Layout walks all four the same way. */
|
|
1823
|
+
type OoxmlStoryKind = 'body' | 'header' | 'footer' | 'note';
|
|
1824
|
+
/** One story root and the blocks under it, with transparent block wrappers already flattened. */
|
|
1825
|
+
interface OoxmlStoryRoot {
|
|
1826
|
+
readonly kind: OoxmlStoryKind;
|
|
1827
|
+
/** The `w:body` / `w:hdr` / `w:ftr` / `w:footnote` element that holds the blocks. */
|
|
1828
|
+
readonly root: OoxmlNode;
|
|
1829
|
+
}
|
|
1830
|
+
/**
|
|
1831
|
+
* Every story root in a part, in document order.
|
|
1832
|
+
*
|
|
1833
|
+
* Does not descend INTO a story: a story's blocks are the walk below, and a story root never
|
|
1834
|
+
* contains another story root.
|
|
1835
|
+
*/
|
|
1836
|
+
declare function storyRootsOf(part: OoxmlPart): readonly OoxmlStoryRoot[];
|
|
1837
|
+
/**
|
|
1838
|
+
* Whether a part is SHAPED to hold stories — a body, a header, a footer, or a notes part.
|
|
1839
|
+
*
|
|
1840
|
+
* A shape test, deliberately not `storyRootsOf(part).length > 0`. That counts EDITABLE stories,
|
|
1841
|
+
* and a notes part holding nothing but `w:separator` and `w:continuationSeparator` has none —
|
|
1842
|
+
* which is the footnotes part Word writes into every document that ever held a footnote. A
|
|
1843
|
+
* caller asking "should I walk this part at all" that used the editable count skipped it
|
|
1844
|
+
* entirely, and the two callers that ask are a payload sweep and an export strip: both DELETE
|
|
1845
|
+
* what they conclude nothing names.
|
|
1846
|
+
*/
|
|
1847
|
+
declare function isStoryPart(part: OoxmlPart): boolean;
|
|
1848
|
+
/** The main body story of a part, or null when the part holds none. */
|
|
1849
|
+
declare function bodyStoryRoot(part: OoxmlPart): OoxmlNode | null;
|
|
1850
|
+
/**
|
|
1851
|
+
* Every paragraph of one story, in reading order.
|
|
1852
|
+
*
|
|
1853
|
+
* Descends through tables (rows, cells, nested tables), block controls and block custom XML.
|
|
1854
|
+
* The returned nodes are paragraph elements; a caller addresses them by `id`.
|
|
1855
|
+
*/
|
|
1856
|
+
declare function storyParagraphs(root: OoxmlNode): readonly OoxmlNode[];
|
|
1857
|
+
/**
|
|
1858
|
+
* The block walk itself, appending into `out`.
|
|
1859
|
+
*
|
|
1860
|
+
* Exported so `allParagraphs` in the binding lane is the same traversal rather than a second
|
|
1861
|
+
* copy of it.
|
|
1862
|
+
*/
|
|
1863
|
+
declare function collectStoryParagraphs(children: readonly OoxmlNode[], out: OoxmlNode[], sdtDepth: number): void;
|
|
1864
|
+
|
|
1865
|
+
/** One searchable text-box story and the drawing location that can reveal it. */
|
|
1866
|
+
interface TextboxStoryRoot {
|
|
1867
|
+
/** The `w:txbxContent` story root. */
|
|
1868
|
+
readonly root: OoxmlElement;
|
|
1869
|
+
/** Layout atom id used to select the drawing, including an MC wrapper when present. */
|
|
1870
|
+
readonly drawingNodeId: string;
|
|
1871
|
+
/** Canonical node id of the paragraph that anchors the drawing. */
|
|
1872
|
+
readonly hostParagraphId: string;
|
|
1873
|
+
}
|
|
1874
|
+
/**
|
|
1875
|
+
* List the text-box stories in one part, in document order.
|
|
1876
|
+
*
|
|
1877
|
+
* The bounded walk stops at drawings. It does not project pictures, shape geometry, or story
|
|
1878
|
+
* content. Results are memoized by immutable part-root identity.
|
|
1879
|
+
*/
|
|
1880
|
+
declare function textboxStoriesInPart(part: OoxmlPart): readonly TextboxStoryRoot[];
|
|
1881
|
+
|
|
1882
|
+
/** Relationship from the story to one data part. */
|
|
1883
|
+
declare const CUSTOM_XML_REL = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXml";
|
|
1884
|
+
/** Relationship from a data part to the properties that carry its `ds:itemID`. */
|
|
1885
|
+
declare const CUSTOM_XML_PROPS_REL = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXmlProps";
|
|
1886
|
+
/** `itemPropsN.xml` needs an Override; `itemN.xml` rides the package's `xml` default. */
|
|
1887
|
+
declare const CUSTOM_XML_PROPS_TYPE = "application/vnd.openxmlformats-officedocument.customXmlProperties+xml";
|
|
1888
|
+
/** The datastore namespace `ds:datastoreItem` lives in. */
|
|
1889
|
+
declare const DATASTORE_NAMESPACE_URI = "http://schemas.openxmlformats.org/officeDocument/2006/customXml";
|
|
1890
|
+
/** A data part located in a package: where it lives, and the GUID an SDT binds to. */
|
|
1891
|
+
interface CustomXmlDataPart {
|
|
1892
|
+
/** Canonical part name, e.g. `/customXml/item1.xml`. */
|
|
1893
|
+
readonly partName: string;
|
|
1894
|
+
/** Part name of its properties, e.g. `/customXml/itemProps1.xml`. */
|
|
1895
|
+
readonly propsPartName: string;
|
|
1896
|
+
/** `ds:itemID`, braced and upper-case, as `w:storeItemID` must spell it. */
|
|
1897
|
+
readonly itemId: string;
|
|
1898
|
+
/** Namespace URI of the payload root, which is what identifies one store among several. */
|
|
1899
|
+
readonly namespaceUri: string;
|
|
1900
|
+
}
|
|
1901
|
+
/**
|
|
1902
|
+
* A `ds:itemID` derived from the seed rather than drawn at random.
|
|
1903
|
+
*
|
|
1904
|
+
* Exported so a caller that authors a store OUTSIDE a package — a template engine splicing
|
|
1905
|
+
* markup it will assemble into a `.docx` later — mints the id the same way this does, rather
|
|
1906
|
+
* than inventing a second GUID shape Word has to be tolerant of.
|
|
1907
|
+
*
|
|
1908
|
+
* The store is a pure function of what it is asked to write: the same document written twice
|
|
1909
|
+
* has to produce the same bytes, or a save/reopen/save round trip stops being a fixed point
|
|
1910
|
+
* and every digest taken over saved bytes moves. A GUID's job here is uniqueness within one
|
|
1911
|
+
* package, not unguessability, so four FNV-1a passes over a salted seed carry it.
|
|
1912
|
+
*/
|
|
1913
|
+
declare function datastoreItemIdFor(seed: string): string;
|
|
1914
|
+
/**
|
|
1915
|
+
* The data parts a story relates to, in relationship order.
|
|
1916
|
+
*
|
|
1917
|
+
* Reads the relationships rather than scanning `/customXml/` by name: a part nothing relates
|
|
1918
|
+
* to is not part of the document, and a package from a hostile sender can hold as many
|
|
1919
|
+
* plausibly-named files as it likes.
|
|
1920
|
+
*/
|
|
1921
|
+
declare function customXmlDataParts(pkg: OoxmlPackage, storyPartName: string): CustomXmlDataPart[];
|
|
1922
|
+
/** The data part carrying this namespace, or null when the document has none yet. */
|
|
1923
|
+
declare function findCustomXmlDataPart(pkg: OoxmlPackage, storyPartName: string, namespaceUri: string): CustomXmlDataPart | null;
|
|
1924
|
+
/** What {@link withCustomXmlDataPart} answers. */
|
|
1925
|
+
interface CustomXmlDataPartResult {
|
|
1926
|
+
readonly pkg: OoxmlPackage;
|
|
1927
|
+
/** Null when the part could not be authored; the package then comes back unchanged. */
|
|
1928
|
+
readonly part: CustomXmlDataPart | null;
|
|
1929
|
+
}
|
|
1930
|
+
/**
|
|
1931
|
+
* Ensure the document carries a data part for this namespace, creating it and everything it
|
|
1932
|
+
* needs — properties, both relationships, the properties content type — when it does not.
|
|
1933
|
+
*
|
|
1934
|
+
* Idempotent: a package that already has one for the namespace comes back untouched, so a
|
|
1935
|
+
* second node added to the same store does not author a second store.
|
|
1936
|
+
*
|
|
1937
|
+
* @param storyPartName - Whose relationships the store hangs off. Word enumerates its data
|
|
1938
|
+
* store from the MAIN DOCUMENT part, so a store authored off a header or footer is one Word
|
|
1939
|
+
* never sees.
|
|
1940
|
+
*/
|
|
1941
|
+
declare function withCustomXmlDataPart(pkg: OoxmlPackage, storyPartName: string, namespaceUri: string, rootLocalName: string): CustomXmlDataPartResult;
|
|
1942
|
+
/**
|
|
1943
|
+
* Remove a store from a document: both parts, both relationships, the Override.
|
|
1944
|
+
*
|
|
1945
|
+
* PACKAGE ONLY. It does not touch the body, so a `w:sdt` bound to the store keeps its
|
|
1946
|
+
* `w:dataBinding`, its `w:storeItemID` and its `w:tag`, and Word then opens a control bound to
|
|
1947
|
+
* a store that is not there. Stripping those is the export path's job and is not built; this
|
|
1948
|
+
* is the half that removes the payload, which is the half a caller can rely on.
|
|
1949
|
+
*
|
|
1950
|
+
* `ok: false` means nothing was removed and the package is unchanged — most often because an
|
|
1951
|
+
* owner's `.rels` was never parsed into a tree, which {@link withoutPart} refuses to work
|
|
1952
|
+
* around. A caller exporting a document has to treat that as a failure to export rather than
|
|
1953
|
+
* as a document with nothing to strip, or it ships the payload it meant to remove.
|
|
1954
|
+
*/
|
|
1955
|
+
declare function withoutCustomXmlDataPart(pkg: OoxmlPackage, storyPartName: string, namespaceUri: string): WithoutPartResult;
|
|
1956
|
+
|
|
1957
|
+
/** One node in a store: its id, the bound text, and the payload beside it. */
|
|
1958
|
+
interface CustomXmlNode {
|
|
1959
|
+
readonly id: string;
|
|
1960
|
+
/** Text a `w:dataBinding` resolves to. Untrusted file input. */
|
|
1961
|
+
readonly label: string;
|
|
1962
|
+
/** Payload as authored, JSON by convention and unparsed here. Untrusted file input. */
|
|
1963
|
+
readonly data: string;
|
|
1964
|
+
}
|
|
1965
|
+
/** Every node a store holds, in document order. */
|
|
1966
|
+
declare function customXmlNodes(pkg: OoxmlPackage, partName: string): CustomXmlNode[];
|
|
1967
|
+
/** One node by id, or null. */
|
|
1968
|
+
declare function readCustomXmlNode(pkg: OoxmlPackage, partName: string, nodeId: string): CustomXmlNode | null;
|
|
1969
|
+
/**
|
|
1970
|
+
* Write a node, replacing one that already has the id.
|
|
1971
|
+
*
|
|
1972
|
+
* Replace rather than append: a second node with the same id makes the binding xpath ambiguous,
|
|
1973
|
+
* and Word resolves an ambiguous xpath to the first match — so an "update" that appended would
|
|
1974
|
+
* leave the control showing its old text forever.
|
|
1975
|
+
*/
|
|
1976
|
+
declare function withCustomXmlNode(pkg: OoxmlPackage, partName: string, node: CustomXmlNode): OoxmlPackage;
|
|
1977
|
+
/** Drop one node by id. A store that never held it comes back unchanged. */
|
|
1978
|
+
declare function withoutCustomXmlNode(pkg: OoxmlPackage, partName: string, nodeId: string): OoxmlPackage;
|
|
1979
|
+
/**
|
|
1980
|
+
* Drop every node no longer referenced, given the ids the document still binds.
|
|
1981
|
+
*
|
|
1982
|
+
* This is the whole deletion story. Deleting a control in THIS editor can remove its node
|
|
1983
|
+
* directly, but a control deleted in Word leaves the node behind — Word has no lifecycle link
|
|
1984
|
+
* between the two and no way to run our code. Reconciling against what the story actually binds
|
|
1985
|
+
* collects both, and is the only thing that can collect the second.
|
|
1986
|
+
*
|
|
1987
|
+
* Takes the referenced ids rather than reading the story itself: the caller already walked it,
|
|
1988
|
+
* and a sweep that guessed at which controls exist would delete a payload on a mistake.
|
|
1989
|
+
*/
|
|
1990
|
+
declare function withoutOrphanCustomXmlNodes(pkg: OoxmlPackage, partName: string, referencedIds: ReadonlySet<string>): {
|
|
1991
|
+
readonly pkg: OoxmlPackage;
|
|
1992
|
+
readonly removed: readonly string[];
|
|
1993
|
+
};
|
|
1994
|
+
/**
|
|
1995
|
+
* The `w:xpath` a binding uses to reach a node's label, or null when the id cannot be addressed.
|
|
1996
|
+
*
|
|
1997
|
+
* Word needs a prefix for the payload namespace even when the store declares it as a default —
|
|
1998
|
+
* an unprefixed step in an XPath means "no namespace", so `/docxEditor/node` would match
|
|
1999
|
+
* nothing in a namespaced store. The prefix is declared in `w:prefixMappings` beside it.
|
|
2000
|
+
*/
|
|
2001
|
+
declare function customXmlLabelXPath(prefix: string, rootLocalName: string, nodeId: string): string | null;
|
|
2002
|
+
/** The `w:prefixMappings` value declaring that prefix, or null when it cannot be written.
|
|
2003
|
+
* The namespace sits inside single quotes inside a double-quoted attribute, so a namespace
|
|
2004
|
+
* carrying either quote character has no representation here. */
|
|
2005
|
+
declare function customXmlPrefixMappings(prefix: string, namespaceUri: string): string | null;
|
|
2006
|
+
|
|
2007
|
+
/** The prefix every binding this library authors declares and quotes. */
|
|
2008
|
+
declare const CUSTOM_NODE_XPATH_PREFIX = "ns0";
|
|
2009
|
+
/** The three attributes a `w:dataBinding` carries. */
|
|
2010
|
+
interface CustomNodeBinding {
|
|
2011
|
+
readonly prefixMappings: string;
|
|
2012
|
+
readonly xpath: string;
|
|
2013
|
+
readonly storeItemId: string;
|
|
2014
|
+
}
|
|
2015
|
+
/**
|
|
2016
|
+
* The binding for one node in one store, or null when the id cannot be addressed by an XPath.
|
|
2017
|
+
*
|
|
2018
|
+
* Refuses rather than escapes: XPath 1.0 has no escape for a quote inside a literal, so an id
|
|
2019
|
+
* carrying one could close the predicate and append an expression of the sender's choosing.
|
|
2020
|
+
* The ids are minted by a host, so refusing is honest — see `ADDRESSABLE_ID`.
|
|
2021
|
+
*/
|
|
2022
|
+
declare function customNodeBinding(part: CustomXmlDataPart, rootLocalName: string, nodeId: string): CustomNodeBinding | null;
|
|
2023
|
+
/**
|
|
2024
|
+
* Every node id the story's controls bind to in one store, in document order.
|
|
2025
|
+
*
|
|
2026
|
+
* This is the input the orphan sweep takes: a node whose id is not in here is one no control
|
|
2027
|
+
* names, whether it was deleted in this editor or in Word. Reading it from the STORY rather than
|
|
2028
|
+
* from a host's bookkeeping is what makes the two cases one mechanism.
|
|
2029
|
+
*/
|
|
2030
|
+
declare function boundCustomXmlNodeIds(part: OoxmlPart, storeItemId: string): Set<string>;
|
|
2031
|
+
/**
|
|
2032
|
+
* Every node id ANY story in the package binds, in one store.
|
|
2033
|
+
*
|
|
2034
|
+
* THE WHOLE PACKAGE, not one story. A payload is reachable from a header as easily as from the
|
|
2035
|
+
* body — Word enumerates its data store from the main part, but nothing stops a control
|
|
2036
|
+
* elsewhere quoting the same `w:storeItemID` — and the two callers that decide what is an orphan
|
|
2037
|
+
* both destroy data when they are wrong. The sweep would collect a payload a header still paints;
|
|
2038
|
+
* the export would strip a store a header still names, which is a document Word offers to repair.
|
|
2039
|
+
*
|
|
2040
|
+
* Costs one walk per story per store, on open and on export. Neither is a keystroke.
|
|
2041
|
+
*/
|
|
2042
|
+
declare function boundCustomXmlNodeIdsInPackage(pkg: OoxmlPackage, storeItemId: string): Set<string>;
|
|
2043
|
+
/** The node id one control binds to in the named store, or null when it binds to nothing there. */
|
|
2044
|
+
declare function boundCustomXmlNodeIdOf(control: OoxmlNode, storeItemId: string): string | null;
|
|
2045
|
+
|
|
2046
|
+
/** What happens to one control when the document is exported. */
|
|
2047
|
+
type CustomNodeExportPolicy = 'keep' | 'text' | 'remove';
|
|
2048
|
+
/** How {@link withExportedCustomNodes} decides, and which stores it may tidy afterwards. */
|
|
2049
|
+
interface CustomNodeExportRequest {
|
|
2050
|
+
/** The story whose controls are policed, and whose relationships the stores hang off. */
|
|
2051
|
+
readonly storyPartName: string;
|
|
2052
|
+
/**
|
|
2053
|
+
* Payload namespaces the caller CLAIMS.
|
|
2054
|
+
*
|
|
2055
|
+
* The store cleanup runs only over these. Word's own Cover Page Properties store rides in most
|
|
2056
|
+
* templates, and an export that tidied every customXml part would be deleting from documents it
|
|
2057
|
+
* was only asked to strip its own markup from.
|
|
2058
|
+
*/
|
|
2059
|
+
readonly namespaces: readonly string[];
|
|
2060
|
+
/** The fate of a control carrying this `w:tag`. A control with no tag is never touched. */
|
|
2061
|
+
readonly decide: (tag: string) => CustomNodeExportPolicy;
|
|
2062
|
+
}
|
|
2063
|
+
/**
|
|
2064
|
+
* The export, or the reason there is no export.
|
|
2065
|
+
*
|
|
2066
|
+
* A refusal answers no package on purpose. "Stripping failed, here is the document anyway" is the
|
|
2067
|
+
* one outcome that must not be possible: a caller would ship the markup it asked to remove and
|
|
2068
|
+
* have been told the export succeeded.
|
|
2069
|
+
*/
|
|
2070
|
+
type CustomNodeExportResult = {
|
|
2071
|
+
readonly ok: true;
|
|
2072
|
+
readonly pkg: OoxmlPackage;
|
|
2073
|
+
/** Controls unwrapped (`text`) and controls removed (`remove`). */
|
|
2074
|
+
readonly unwrapped: number;
|
|
2075
|
+
readonly removed: number;
|
|
2076
|
+
} | {
|
|
2077
|
+
readonly ok: false;
|
|
2078
|
+
readonly reason: string;
|
|
2079
|
+
};
|
|
2080
|
+
/**
|
|
2081
|
+
* Apply the policy, then take the payloads and the stores the policy orphaned.
|
|
2082
|
+
*
|
|
2083
|
+
* Order matters and is the reverse of the write's. The BODY goes first, so the sweep that follows
|
|
2084
|
+
* sees the controls that actually survive; the stores go last, once nothing binds them. Doing it
|
|
2085
|
+
* the other way would strip a store while a control still quoted its `w:storeItemID`, which is a
|
|
2086
|
+
* document Word opens and offers to repair.
|
|
2087
|
+
*/
|
|
2088
|
+
declare function withExportedCustomNodes(pkg: OoxmlPackage, request: CustomNodeExportRequest): CustomNodeExportResult;
|
|
2089
|
+
|
|
2090
|
+
/**
|
|
2091
|
+
* WHERE a copy reaches, computed by the editing surface against the published layout with
|
|
2092
|
+
* the same full-coverage predicate `planRangeDeletion` uses. Pure data: paragraph ids in
|
|
2093
|
+
* document order, edge offsets in the store's segment offset space, and the coverage sets.
|
|
2094
|
+
*/
|
|
2095
|
+
interface FragmentCoverage {
|
|
2096
|
+
/** Story part the range lives in (`/word/document.xml` for the body). */
|
|
2097
|
+
readonly partName: string;
|
|
2098
|
+
/** Every paragraph the range touches, in document order, edges included. */
|
|
2099
|
+
readonly paragraphIds: readonly string[];
|
|
2100
|
+
/** Offset into the first paragraph where the range starts. */
|
|
2101
|
+
readonly startOffset: number;
|
|
2102
|
+
/** Offset into the last paragraph where the range ends. */
|
|
2103
|
+
readonly endOffset: number;
|
|
2104
|
+
/** Paragraphs the range covers mark-to-mark (the deletion planner's `covered`). */
|
|
2105
|
+
readonly coveredParagraphIds: readonly string[];
|
|
2106
|
+
/** Outermost tables and block SDTs whose every paragraph is covered. */
|
|
2107
|
+
readonly fullyCoveredBlockIds: readonly string[];
|
|
2108
|
+
/** True when the range reaches the last paragraph's far edge (its mark travels). */
|
|
2109
|
+
readonly lastMarkCovered: boolean;
|
|
2110
|
+
}
|
|
2111
|
+
type FragmentExtractRejection = 'unknown-part' | 'empty-range' | 'trim-refused' | 'resource-limit' | 'unsupported-content';
|
|
2112
|
+
type FragmentExtractResult = {
|
|
2113
|
+
readonly ok: true;
|
|
2114
|
+
/** The fragment package zip, readable by `readOoxmlPackage`. */
|
|
2115
|
+
readonly bytes: Uint8Array;
|
|
2116
|
+
/** The same fragment as an already-assembled in-memory package, so the copy
|
|
2117
|
+
* path renders interop HTML without re-inflating and re-parsing `bytes`. */
|
|
2118
|
+
readonly package: OoxmlPackage;
|
|
2119
|
+
/** Travels beside the zip (HTML attribute): whether the last paragraph mark is covered. */
|
|
2120
|
+
readonly lastMarkCovered: boolean;
|
|
2121
|
+
readonly blockCount: number;
|
|
2122
|
+
/** Total bytes of media carried, for the copy-side degrade tiers. */
|
|
2123
|
+
readonly mediaBytes: number;
|
|
2124
|
+
} | {
|
|
2125
|
+
readonly ok: false;
|
|
2126
|
+
readonly reason: FragmentExtractRejection;
|
|
2127
|
+
};
|
|
2128
|
+
/**
|
|
2129
|
+
* Extract the covered range into a fragment package zip.
|
|
2130
|
+
*
|
|
2131
|
+
* Pure over its inputs: the package and the coverage description. The blocks travel with
|
|
2132
|
+
* their dependency closure (styles, numbering, media, hyperlink rels, referenced note
|
|
2133
|
+
* bodies) and without headers/footers, `w:sectPr`, comments, settings, docDefaults (beyond
|
|
2134
|
+
* the materialized copy in the fragment styles part), or theme.
|
|
2135
|
+
*/
|
|
2136
|
+
declare function extractFragmentPackage(pkg: OoxmlPackage, coverage: FragmentCoverage, options?: {
|
|
2137
|
+
/** Copy-side degrade tier 1: leave media behind; their drawings degrade away. */
|
|
2138
|
+
readonly omitMedia?: boolean;
|
|
2139
|
+
}): FragmentExtractResult;
|
|
2140
|
+
|
|
2141
|
+
type FragmentMergeRejection = 'no-fragment-document' | 'no-target-part' | 'merge-refused' | 'unsupported-content';
|
|
2142
|
+
type FragmentMergeResult = {
|
|
2143
|
+
readonly ok: true;
|
|
2144
|
+
readonly pkg: OoxmlPackage;
|
|
2145
|
+
/** The fragment blocks, rewritten to target identifiers, ready for `insertFragment`. */
|
|
2146
|
+
readonly blocks: readonly OoxmlNode[];
|
|
2147
|
+
} | {
|
|
2148
|
+
readonly ok: false;
|
|
2149
|
+
readonly reason: FragmentMergeRejection;
|
|
2150
|
+
};
|
|
2151
|
+
/**
|
|
2152
|
+
* Merge a fragment package's resources into `target` and rewrite the fragment blocks to
|
|
2153
|
+
* the target's identifiers. Pure: returns a new package; the caller commits it through
|
|
2154
|
+
* `ctx.applyPackage` beside the `insertFragment` op.
|
|
2155
|
+
*/
|
|
2156
|
+
declare function mergeFragmentIntoPackage(target: OoxmlPackage, fragment: OoxmlPackage, ownerPartName: string): FragmentMergeResult;
|
|
2157
|
+
|
|
2158
|
+
/** Where a comment is anchored, in the model offset space of one story. */
|
|
2159
|
+
interface CommentAnchorRequest {
|
|
2160
|
+
readonly paragraphId: string;
|
|
2161
|
+
readonly start: number;
|
|
2162
|
+
/** May sit in the same paragraph or a later one; `endParagraphId` names it when it differs. */
|
|
2163
|
+
readonly end: number;
|
|
2164
|
+
readonly endParagraphId?: string;
|
|
2165
|
+
}
|
|
2166
|
+
/**
|
|
2167
|
+
* What adding a comment needs: where it anchors, who wrote it, and its body.
|
|
2168
|
+
*
|
|
2169
|
+
* `author` is required because `CT_Comment` makes `@w:author` mandatory — a comment without one
|
|
2170
|
+
* writes invalid XML, so the write is refused rather than filled with an empty attribute.
|
|
2171
|
+
*/
|
|
2172
|
+
interface AddCommentRequest {
|
|
2173
|
+
readonly anchor: CommentAnchorRequest;
|
|
2174
|
+
/** Required by `CT_TrackChange`. A comment without one writes invalid XML. */
|
|
2175
|
+
readonly author: string;
|
|
2176
|
+
readonly initials?: string;
|
|
2177
|
+
/** ISO-8601. Absent writes no `@w:date`, because inventing one is a content change. */
|
|
2178
|
+
readonly date?: string;
|
|
2179
|
+
readonly text: string;
|
|
2180
|
+
/** The comment this replies to. Its thread link is written to `commentsExtended.xml`. */
|
|
2181
|
+
readonly replyToCommentId?: string;
|
|
2182
|
+
/**
|
|
2183
|
+
* Collaboration actor that mints `@w:id`. Absent keeps Word's dense solo sequence.
|
|
2184
|
+
*
|
|
2185
|
+
* Concurrent peers that both take "highest + 1" mint the same comment id, and the CRDT
|
|
2186
|
+
* then cross-links their anchors. The actor is the store transaction's `actorId`.
|
|
2187
|
+
*/
|
|
2188
|
+
readonly actorId?: string;
|
|
2189
|
+
}
|
|
2190
|
+
/** The new comment's id and the story change, or the reason the write was refused. */
|
|
2191
|
+
type AddCommentResult = {
|
|
2192
|
+
readonly ok: true;
|
|
2193
|
+
readonly commentId: string;
|
|
2194
|
+
/**
|
|
2195
|
+
* The story transaction's own change, so the coordinator can publish it.
|
|
2196
|
+
*
|
|
2197
|
+
* A comment write commits straight on the story store rather than through
|
|
2198
|
+
* `applyTreeOps`, and the change is what carries the dirty anchor paragraphs and the
|
|
2199
|
+
* `text-local` impact. Dropping it here left the caller with nothing precise to
|
|
2200
|
+
* publish and no way to tell a committed write from an identity no-op.
|
|
2201
|
+
*/
|
|
2202
|
+
readonly change: TreeModelChange | null;
|
|
2203
|
+
} | {
|
|
2204
|
+
readonly ok: false;
|
|
2205
|
+
readonly reason: TreeOpRejection | 'invalid-author';
|
|
2206
|
+
};
|
|
2207
|
+
/**
|
|
2208
|
+
* Add a comment, or a reply, in ONE transaction.
|
|
2209
|
+
*
|
|
2210
|
+
* The comment id and the `w14:paraId` are computed before the transaction opens, because the
|
|
2211
|
+
* story markers have to carry the same id the body does and deriving each separately is how the
|
|
2212
|
+
* two come to disagree.
|
|
2213
|
+
*
|
|
2214
|
+
* `w14:paraId` is minted here and only here: on a comment WRITE. Allocating on load would
|
|
2215
|
+
* rewrite a document nobody edited and break fingerprint equality on an untouched round trip.
|
|
2216
|
+
*/
|
|
2217
|
+
declare function addComment(store: TreeDocumentStore, request: AddCommentRequest): AddCommentResult;
|
|
2218
|
+
/** Whether resolving a thread applied. Marks the comment AND every reply to it, as Word does. */
|
|
2219
|
+
type SetCommentResolvedResult = {
|
|
2220
|
+
readonly ok: true;
|
|
2221
|
+
readonly changed: boolean;
|
|
2222
|
+
/** The story transaction's change, for the coordinator to publish — see {@link AddCommentResult}. */
|
|
2223
|
+
readonly change: TreeModelChange | null;
|
|
2224
|
+
} | {
|
|
2225
|
+
readonly ok: false;
|
|
2226
|
+
readonly reason: TreeOpRejection | 'unknown-comment';
|
|
2227
|
+
};
|
|
2228
|
+
|
|
2229
|
+
/**
|
|
2230
|
+
* Mark a comment thread resolved, or reopen it.
|
|
2231
|
+
*
|
|
2232
|
+
* A THREAD, not one remark: Word resolves a conversation, and its own pane greys the replies with
|
|
2233
|
+
* the comment they answer. Resolving only the parent would leave a file whose reply still reads as
|
|
2234
|
+
* open under a closed remark — a state Word does not produce and no reader would draw sensibly.
|
|
2235
|
+
*
|
|
2236
|
+
* The thread is the bounded, relationship-scoped index {@link indexCommentThread}: nested
|
|
2237
|
+
* `@w15:paraIdParent` and `@w16cid:parentId` descendants, plus coincident-anchor replies the
|
|
2238
|
+
* review reader already treats as a thread. Truncation, duplicate records, or conflicting
|
|
2239
|
+
* metadata refuse before any package write.
|
|
2240
|
+
*
|
|
2241
|
+
* `@w15:done` lives in `commentsExtended.xml`, which many documents do not have: a file with no
|
|
2242
|
+
* reply has no thread state to record. So the part is created when it is missing, exactly as
|
|
2243
|
+
* {@link addComment} creates it, and every comment being resolved gets an entry — a comment with
|
|
2244
|
+
* no `w14:paraId` gets one minted, because the state is keyed by it and there is nothing else to
|
|
2245
|
+
* key it by.
|
|
2246
|
+
*
|
|
2247
|
+
* ONE package transaction: the part, its relationship, its content-type override and the entries
|
|
2248
|
+
* commit together, so a resolved thread is never half-recorded.
|
|
2249
|
+
*/
|
|
2250
|
+
declare function setCommentResolved(store: TreeDocumentStore, commentId: string, resolved: boolean): SetCommentResolvedResult;
|
|
2251
|
+
/** A comment part exists and declares the comment content type. */
|
|
2252
|
+
declare function hasCommentPart(pkg: OoxmlPackage, storyPartName: string): boolean;
|
|
2253
|
+
/** Exposed so a surface can tell "no comment part yet" from "no comments". */
|
|
2254
|
+
declare function commentPartNameOf(pkg: OoxmlPackage, storyPartName: string): string;
|
|
2255
|
+
/**
|
|
2256
|
+
* The `commentsExtended.xml` a story points at.
|
|
2257
|
+
*
|
|
2258
|
+
* Exported for the same reason as {@link commentPartNameOf}: the READER has to resolve the
|
|
2259
|
+
* same name the writer does. Hardcoding `/word/comments.xml` on one side and following the
|
|
2260
|
+
* relationship on the other is a split that shows up as a comment written and never read back.
|
|
2261
|
+
*/
|
|
2262
|
+
declare function commentsExtendedPartNameOf(pkg: OoxmlPackage, storyPartName: string): string;
|
|
2263
|
+
|
|
2264
|
+
/**
|
|
2265
|
+
* Add a comment on one story and publish the new package shell.
|
|
2266
|
+
*
|
|
2267
|
+
* The story store still performs the write. The package coordinator records the undo unit
|
|
2268
|
+
* and, when observed, the primitive journal.
|
|
2269
|
+
*/
|
|
2270
|
+
declare function addPackageComment(packageStore: TreePackageStore, request: AddCommentRequest, scope?: StoryScope): AddCommentResult;
|
|
2271
|
+
/**
|
|
2272
|
+
* Resolve or reopen a comment thread and publish the new package shell.
|
|
2273
|
+
*
|
|
2274
|
+
* `@w15:done` lives in `commentsExtended.xml`, which a document with no reply does not have.
|
|
2275
|
+
* Capture must be armed for that create-part, or a peer keeps an open thread.
|
|
2276
|
+
*/
|
|
2277
|
+
declare function setPackageCommentResolved(packageStore: TreePackageStore, commentId: string, resolved: boolean): SetCommentResolvedResult;
|
|
2278
|
+
/** One comment object in a delete batch: a root, or a reply naming its parent. */
|
|
2279
|
+
interface PackageCommentDelete {
|
|
2280
|
+
readonly commentId: string;
|
|
2281
|
+
readonly parentCommentId?: string;
|
|
2282
|
+
}
|
|
2283
|
+
/**
|
|
2284
|
+
* Delete comment threads or replies and install the rewritten package.
|
|
2285
|
+
*
|
|
2286
|
+
* Installed, not shell-replaced: `replacePackageShell` re-overlays every opened story
|
|
2287
|
+
* store, and a header the reader had entered would restore its markers after the body
|
|
2288
|
+
* had already dropped them.
|
|
2289
|
+
*/
|
|
2290
|
+
declare function deletePackageComments(packageStore: TreePackageStore, comments: readonly PackageCommentDelete[], scope?: StoryScope, noteId?: number): boolean;
|
|
2291
|
+
|
|
2292
|
+
/**
|
|
2293
|
+
* Insert a custom node on one story and publish the new package shell.
|
|
2294
|
+
*
|
|
2295
|
+
* The store hangs off the main document part even when the control lands in a header:
|
|
2296
|
+
* Word enumerates data stores from that part and nowhere else.
|
|
2297
|
+
*/
|
|
2298
|
+
declare function insertPackageCustomNode(packageStore: TreePackageStore, write: InsertCustomNodeWrite, scope?: StoryScope): CustomNodeWriteResult;
|
|
2299
|
+
/** Remove a custom node and the payload it bound, then publish the new package shell. */
|
|
2300
|
+
declare function removePackageCustomNode(packageStore: TreePackageStore, controlNodeId: string, scope?: StoryScope): CustomNodeWriteResult;
|
|
2301
|
+
|
|
2302
|
+
/**
|
|
2303
|
+
* Highest `w:comment/@w:id` in the part, so the next is seeded from the document.
|
|
2304
|
+
*
|
|
2305
|
+
* No actor keeps Word's dense "one past highest" sequence. An attached collaboration
|
|
2306
|
+
* actor takes the next unused id in its stripe, so two peers cannot mint the same
|
|
2307
|
+
* `@w:id` and then cross-link their anchors after sync.
|
|
2308
|
+
*/
|
|
2309
|
+
declare function nextCommentId(part: OoxmlPart | undefined, actorId?: string): string;
|
|
2310
|
+
|
|
2311
|
+
/**
|
|
2312
|
+
* Which revision halves the reader is looking at.
|
|
2313
|
+
*
|
|
2314
|
+
* Structurally identical to layout's `RevisionDisplayMode`, and pinned equal to it by
|
|
2315
|
+
* `packages/core/src/layout/__tests__/revision-display-mode-parity.test.ts`. Redeclared
|
|
2316
|
+
* rather than imported because the `store` lane may import no other lane (see
|
|
2317
|
+
* `packages/core/src/__tests__/core-lane-graph.ts`), and the formatting walks live here so
|
|
2318
|
+
* that the automation lane — which has no layout at all — reaches them.
|
|
2319
|
+
*/
|
|
2320
|
+
type FormattingDisplayMode = 'all-markup' | 'proposed' | 'original';
|
|
2321
|
+
/** View-time revision visibility used by mounted formatting lanes. */
|
|
2322
|
+
interface FormattingRevisionAuthorFilter {
|
|
2323
|
+
readonly hiddenAuthors: ReadonlySet<string>;
|
|
2324
|
+
readonly includesNode?: (nodeId: string, author: string) => boolean;
|
|
2325
|
+
/** Accepted/original projection for a revision excluded by `includesNode`. */
|
|
2326
|
+
readonly excludedNodeMode?: (nodeId: string, author: string) => 'proposed' | 'original';
|
|
2327
|
+
}
|
|
2328
|
+
/**
|
|
2329
|
+
* What the formatting lanes assume when nobody names a view.
|
|
2330
|
+
*
|
|
2331
|
+
* The RESOLVED result — Word's "No Markup" — because a caller with no view is a caller with
|
|
2332
|
+
* no reader: a headless automation host answers for the text that survives. It is not what a
|
|
2333
|
+
* mounted surface uses; that one names its own mode, and with the review module registered
|
|
2334
|
+
* the layout default is `all-markup`.
|
|
2335
|
+
*/
|
|
2336
|
+
declare const DEFAULT_FORMATTING_DISPLAY_MODE: FormattingDisplayMode;
|
|
2337
|
+
|
|
2338
|
+
/** The D8 paragraph op vocabulary. */
|
|
2339
|
+
declare const AUTHORABLE_PARAGRAPH_PROPERTIES: ReadonlySet<string>;
|
|
2340
|
+
/** The D8 run op vocabulary, for `w:rPr` on a run and on the paragraph mark alike. */
|
|
2341
|
+
declare const AUTHORABLE_RUN_PROPERTIES: ReadonlySet<string>;
|
|
2342
|
+
/**
|
|
2343
|
+
* Whether an op may name this run property at all.
|
|
2344
|
+
*
|
|
2345
|
+
* The stored-marks lane needs this AT ARM TIME. Every other write reaches the store in the same
|
|
2346
|
+
* turn as the press, so a name the store refuses surfaces immediately; an ARMED property is not
|
|
2347
|
+
* applied until the user types, and it rides the keystroke's own transaction — a name outside the
|
|
2348
|
+
* vocabulary would take the typed characters down with it, silently, on every keystroke until the
|
|
2349
|
+
* caret moved.
|
|
2350
|
+
*/
|
|
2351
|
+
declare function isAuthorableRunProperty(localName: string): boolean;
|
|
2352
|
+
/**
|
|
2353
|
+
* A node's own property container (`w:pPr`, `w:rPr`) among its children.
|
|
2354
|
+
*
|
|
2355
|
+
* A container the canonical read demoted to generic is still the node's own properties —
|
|
2356
|
+
* matching only the typed kind lost the whole set.
|
|
2357
|
+
*/
|
|
2358
|
+
declare function propertyContainer(parent: OoxmlNode | null | undefined, kind: 'paragraphProperties' | 'runProperties', localName: 'pPr' | 'rPr'): OoxmlNode | undefined;
|
|
2359
|
+
/** What a container itself authors, narrowed to the names an op is allowed to carry. */
|
|
2360
|
+
declare function authoredProperties(container: OoxmlNode | undefined, authorable: ReadonlySet<string>): readonly OoxmlProperty[];
|
|
2361
|
+
/**
|
|
2362
|
+
* What a paragraph itself authors: its own `w:pPr`, narrowed to what an op can express.
|
|
2363
|
+
*
|
|
2364
|
+
* Properties outside the vocabulary are dropped from the OP, not from the paragraph: the applier
|
|
2365
|
+
* keeps every `w:pPr` child an op cannot name (the mark, `w:sectPr`, `w:pBdr`, `w:outlineLvl`)
|
|
2366
|
+
* exactly as authored.
|
|
2367
|
+
*/
|
|
2368
|
+
declare function directParagraphProperties(part: OoxmlPart, paragraphId: string): readonly OoxmlProperty[];
|
|
2369
|
+
/**
|
|
2370
|
+
* What a paragraph MARK itself authors: `w:pPr/w:rPr`, narrowed to the run vocabulary.
|
|
2371
|
+
*
|
|
2372
|
+
* Same rule as a run's own `w:rPr`, for the same reason — the mark is a run property container,
|
|
2373
|
+
* and `setParagraphMarkProperties` rewrites the names its op carries.
|
|
2374
|
+
*/
|
|
2375
|
+
declare function directParagraphMarkProperties(part: OoxmlPart, paragraphId: string): readonly OoxmlProperty[];
|
|
2376
|
+
/**
|
|
2377
|
+
* Merge properties into a set, replacing any entry with the same name.
|
|
2378
|
+
*
|
|
2379
|
+
* `setRunProperties` and `setParagraphProperties` REPLACE the whole container, so sending one
|
|
2380
|
+
* property alone deleted every other: pressing Bold stripped a run's font, size and colour, and
|
|
2381
|
+
* pressing Centre stripped a paragraph's style, numbering and indents.
|
|
2382
|
+
*
|
|
2383
|
+
* Takes one property or a list, because a toolbar press carries one and an object-model
|
|
2384
|
+
* formatting write carries several at once — and applying several one at a time would be the
|
|
2385
|
+
* same fold written at every call site.
|
|
2386
|
+
*/
|
|
2387
|
+
declare function mergedProperties(existing: readonly OoxmlProperty[], incoming: OoxmlProperty | readonly OoxmlProperty[]): OoxmlProperty[];
|
|
2388
|
+
/**
|
|
2389
|
+
* A `w:rFonts` write merged over what the run already authors, slot by slot.
|
|
2390
|
+
*
|
|
2391
|
+
* `w:rFonts` is the one run property carrying SEVERAL independent settings, so replacing it
|
|
2392
|
+
* wholesale to change the Latin font deleted the run's East Asian and complex-script faces
|
|
2393
|
+
* and its `w:hint`. That loss is invisible here — this engine resolves the Latin slot — and
|
|
2394
|
+
* shows up on save: CJK text in that run reopens in Word in a different font.
|
|
2395
|
+
*
|
|
2396
|
+
* `w:hint` rides along untouched. It says which slot ambiguous characters resolve through,
|
|
2397
|
+
* which is a property of the text, not of the font just picked.
|
|
2398
|
+
*/
|
|
2399
|
+
declare function mergedFontProperty(authored: readonly OoxmlProperty[], incoming: OoxmlProperty): OoxmlProperty;
|
|
2400
|
+
/** Per-run UTF-16 ranges from `segmentsOf` (fields/notes collapse to one unit on begin). */
|
|
2401
|
+
declare function runAddressRanges(paragraph: Extract<OoxmlNode, {
|
|
2402
|
+
kind: 'paragraph';
|
|
2403
|
+
}>): Map<string, {
|
|
2404
|
+
start: number;
|
|
2405
|
+
end: number;
|
|
2406
|
+
}>;
|
|
2407
|
+
/** Runs that own field-result formatting for atoms in this paragraph. */
|
|
2408
|
+
declare function formatOwnedRunIds(paragraph: Extract<OoxmlNode, {
|
|
2409
|
+
kind: 'paragraph';
|
|
2410
|
+
}>): ReadonlySet<string>;
|
|
2411
|
+
/** One run's share of a range edit: the slice it covers and the properties to write there. */
|
|
2412
|
+
interface RunPropertyEdit {
|
|
2413
|
+
readonly start: number;
|
|
2414
|
+
readonly end: number;
|
|
2415
|
+
readonly properties: readonly OoxmlProperty[];
|
|
2416
|
+
/**
|
|
2417
|
+
* When set, `setRunProperties` formats only these runs (field result ownership). Needed when
|
|
2418
|
+
* several result runs share one atom offset so each keeps its own merged bag.
|
|
2419
|
+
*/
|
|
2420
|
+
readonly targetRunIds?: readonly string[];
|
|
2421
|
+
}
|
|
2422
|
+
/**
|
|
2423
|
+
* One incoming write merged over what the node authors, for the properties that carry
|
|
2424
|
+
* SEVERAL independent settings in one element.
|
|
2425
|
+
*
|
|
2426
|
+
* Almost every run property is one setting and replaces cleanly. Two are not: `w:rFonts`
|
|
2427
|
+
* carries a font per script (see {@link mergedFontProperty}), and `w:u` carries the
|
|
2428
|
+
* underline style AND its colour, so toggling the style off and on again dropped an
|
|
2429
|
+
* authored `w:color` and repainted a red underline black.
|
|
2430
|
+
*
|
|
2431
|
+
* Exported because the editor lane keeps its own content-control-aware run walk beside this
|
|
2432
|
+
* one, and the two must reach the same answer.
|
|
2433
|
+
*/
|
|
2434
|
+
declare function mergedMultiSettingProperty(authored: readonly OoxmlProperty[], incoming: OoxmlProperty): OoxmlProperty;
|
|
2435
|
+
/**
|
|
2436
|
+
* A paragraph MARK's own properties with one write merged in, per attribute where it counts.
|
|
2437
|
+
*
|
|
2438
|
+
* The mark carries a `w:rPr` like any run, so a font change has to keep its other font slots
|
|
2439
|
+
* for the same reason a run does — without this the marker of a CJK list item lost its East
|
|
2440
|
+
* Asian face while the text beside it kept one. Lives here because BOTH lanes write the mark:
|
|
2441
|
+
* the editor's toolbar and the automation object model.
|
|
2442
|
+
*/
|
|
2443
|
+
declare function mergedParagraphMarkProperties(part: OoxmlPart, paragraphId: string, incoming: OoxmlProperty | readonly OoxmlProperty[]): OoxmlProperty[];
|
|
2444
|
+
/**
|
|
2445
|
+
* A range run-property change, split into ONE edit per run it covers, each merged over that
|
|
2446
|
+
* run's own `w:rPr`.
|
|
2447
|
+
*
|
|
2448
|
+
* Neither half of that is optional. The base MUST be the run's own properties (see this file's
|
|
2449
|
+
* header). And the split MUST be per run: the op REPLACES the properties it names across its
|
|
2450
|
+
* whole range, so one op carrying one run's bag over a mixed selection homogenised it — bolding
|
|
2451
|
+
* `hello ` + `Georgia` rewrote the second run's `w:rFonts` with the first's. Runs are addressed by
|
|
2452
|
+
* offset rather than by id because these edits apply in sequence and the applier splits runs at
|
|
2453
|
+
* the range edges; offsets are unmoved by a property write, ids are not.
|
|
2454
|
+
*/
|
|
2455
|
+
declare function runPropertyEdits(part: OoxmlPart, paragraphId: string, start: number, end: number, incoming: OoxmlProperty | readonly OoxmlProperty[], displayMode?: FormattingDisplayMode, authorFilter?: FormattingRevisionAuthorFilter): readonly RunPropertyEdit[];
|
|
2456
|
+
/**
|
|
2457
|
+
* The slices of `[start, end)` a formatting write may reach, coalesced, in document order.
|
|
2458
|
+
*
|
|
2459
|
+
* For the one write that does NOT split per run: the eraser states `properties: []` over a
|
|
2460
|
+
* whole range, and a single op there is right — clearing is the one change that legitimately
|
|
2461
|
+
* homogenises what it covers, since there is no bag to carry forward. But the applier derives
|
|
2462
|
+
* its run set from `segmentsOf`, which knows nothing about display modes, so one op over the
|
|
2463
|
+
* whole range reached hidden revision halves at the same offsets: erasing a visible selection
|
|
2464
|
+
* cleared a tracked deletion's `w:rPr` and — in suggesting mode — raised a review card for a
|
|
2465
|
+
* change nobody could see made.
|
|
2466
|
+
*
|
|
2467
|
+
* Slicing solves it without a per-run op: a hidden half is a GAP in the offset space between
|
|
2468
|
+
* two visible runs, so the ranges either side of it never coalesce across it.
|
|
2469
|
+
*/
|
|
2470
|
+
declare function formattableRanges(part: OoxmlPart, paragraphId: string, start: number, end: number, displayMode?: FormattingDisplayMode, authorFilter?: FormattingRevisionAuthorFilter): readonly {
|
|
2471
|
+
readonly start: number;
|
|
2472
|
+
readonly end: number;
|
|
2473
|
+
}[];
|
|
2474
|
+
/**
|
|
2475
|
+
* Every run that contributes at least one character of `[start, end)`, in document order.
|
|
2476
|
+
*
|
|
2477
|
+
* A COLLAPSED range answers the run it sits inside, which is what a caret reads. Callers that
|
|
2478
|
+
* want the empty answer for a collapsed range check the offsets themselves.
|
|
2479
|
+
*/
|
|
2480
|
+
declare function runsCovering(part: OoxmlPart, paragraphId: string, start: number, end: number, displayMode?: FormattingDisplayMode, authorFilter?: FormattingRevisionAuthorFilter): readonly OoxmlNode[];
|
|
2481
|
+
|
|
2482
|
+
interface RevisionSite {
|
|
2483
|
+
readonly node: OoxmlElement;
|
|
2484
|
+
readonly parent: OoxmlElement | null;
|
|
2485
|
+
/** True when this site cannot be resolved and the whole op must refuse. */
|
|
2486
|
+
readonly refused: boolean;
|
|
2487
|
+
/** True for `w:pPr/w:rPr/w:ins|w:del` — the paragraph MARK, not content. */
|
|
2488
|
+
readonly paragraphMark: boolean;
|
|
2489
|
+
/** True for a supported property-history wrapper. */
|
|
2490
|
+
readonly propertyChange: boolean;
|
|
2491
|
+
/**
|
|
2492
|
+
* How many content-revision wrappers ENCLOSE this one, counted within its own paragraph.
|
|
2493
|
+
*
|
|
2494
|
+
* Revisions nest for real: `w:ins` wrapping `w:del` is content one reviewer added and another
|
|
2495
|
+
* struck, and both stay pending because each author has to be answered separately. The two
|
|
2496
|
+
* wrappers then cover exactly the same characters, so a range cannot tell them apart and
|
|
2497
|
+
* "which change is this text under" has only one honest answer — the innermost one, which is
|
|
2498
|
+
* the change that decides what the reader is looking at.
|
|
2499
|
+
*
|
|
2500
|
+
* Relative to the paragraph or table subtree, which is the unit the site walk memoizes. That
|
|
2501
|
+
* is enough and it is what keeps the memo valid: a content revision cannot enclose a
|
|
2502
|
+
* paragraph, and two sites can only cover one position if they are in the same paragraph.
|
|
2503
|
+
*/
|
|
2504
|
+
readonly nesting: number;
|
|
2505
|
+
}
|
|
2506
|
+
/** Every revision-bearing element in the part. */
|
|
2507
|
+
declare function collectRevisionSites(part: OoxmlPart): RevisionSite[];
|
|
2508
|
+
|
|
2509
|
+
/** The `w:p` a node sits inside, and the model offset it starts at within that paragraph. */
|
|
2510
|
+
interface SiteLocation {
|
|
2511
|
+
readonly paragraphId: string;
|
|
2512
|
+
readonly start: number;
|
|
2513
|
+
readonly end: number;
|
|
2514
|
+
}
|
|
2515
|
+
/**
|
|
2516
|
+
* Locate every revision site in one walk.
|
|
2517
|
+
*
|
|
2518
|
+
* One walk rather than a lookup per site: `resolveRevisions` learned the same lesson the hard
|
|
2519
|
+
* way, where a per-site tree walk inside a per-site loop made accept-all quadratic.
|
|
2520
|
+
*
|
|
2521
|
+
* Offsets come from `paragraphOffsetIndex`, which is `segmentsOf`'s walk. A private one here
|
|
2522
|
+
* measured a run by summing its text and gave a note reference, an atomic field and a field's
|
|
2523
|
+
* instruction text the wrong lengths, so every card in a paragraph holding one reported a
|
|
2524
|
+
* range the caret and the ops disagreed with.
|
|
2525
|
+
*/
|
|
2526
|
+
declare function locateSites(part: OoxmlPart): ReadonlyMap<string, SiteLocation>;
|
|
2527
|
+
|
|
2528
|
+
/**
|
|
2529
|
+
* Every revision in one story, one card per DECISION.
|
|
2530
|
+
*
|
|
2531
|
+
* Sites sharing an `(id, author, date)` and revision kind retain their source sites.
|
|
2532
|
+
* Unchanged text separates inline decisions even when their source attributes match.
|
|
2533
|
+
*
|
|
2534
|
+
* Cached by part root except for paragraph-scoped synthetic roots. Results are shared
|
|
2535
|
+
* and readonly; part names are checked because ranges embed them.
|
|
2536
|
+
*/
|
|
2537
|
+
declare function revisionItemsOf(part: OoxmlPart): readonly ReviewRevisionItem[];
|
|
2538
|
+
/**
|
|
2539
|
+
* Comment cards, threaded however the file says so and flat when nothing says so.
|
|
2540
|
+
*
|
|
2541
|
+
* ECMA-376 §17.13.4.2 gives `CT_Comment` no parent pointer, so threading is never something
|
|
2542
|
+
* the standard states outright. Three sources, strongest first: `@w15:paraIdParent`, then
|
|
2543
|
+
* `@w16cid:parentId` — both in namespaces outside Part 1 — and finally a COINCIDENT anchor, a
|
|
2544
|
+
* comment whose `w:commentRangeStart`/`End` cover exactly the characters an earlier comment's
|
|
2545
|
+
* cover. The ranges are Part 1's own vocabulary and the only part of a thread that survives a
|
|
2546
|
+
* producer dropping the extension parts. Coincidence is the last resort and never overrides a
|
|
2547
|
+
* stated link.
|
|
2548
|
+
*
|
|
2549
|
+
* Deliberately not containment. A remark on one word inside another remark's sentence nests
|
|
2550
|
+
* without being a reply, and reading that as a thread would bury an independent comment inside
|
|
2551
|
+
* someone else's.
|
|
2552
|
+
*/
|
|
2553
|
+
declare function commentItemsOf(comments: readonly CommentRecord[], anchors: readonly {
|
|
2554
|
+
commentId: string;
|
|
2555
|
+
partName: string;
|
|
2556
|
+
start: ReviewPosition;
|
|
2557
|
+
end: ReviewPosition;
|
|
2558
|
+
orphaned: boolean;
|
|
2559
|
+
}[], threadState: ReadonlyMap<string, CommentThreadState>): ReviewCommentItem[];
|
|
2560
|
+
/**
|
|
2561
|
+
* Everything the review surface lists, in document order.
|
|
2562
|
+
*
|
|
2563
|
+
* Order is by paragraph position within the story, then by offset. A comment and the revision
|
|
2564
|
+
* it covers therefore arrive together, which is what lets a surface group them. Furniture
|
|
2565
|
+
* stories rank after the body in one merged order — their geometry (the page they first paint
|
|
2566
|
+
* on) is a layout question the queue deliberately does not answer.
|
|
2567
|
+
*/
|
|
2568
|
+
declare function collectReviewItems(input: ReviewModelInput): ReviewItem[];
|
|
2569
|
+
/**
|
|
2570
|
+
* The shape {@link linkRevisionReplies} needs, stated STRUCTURALLY.
|
|
2571
|
+
*
|
|
2572
|
+
* The store's queue is revisions and comments; the layout lane's adds a third kind for custom
|
|
2573
|
+
* nodes, and neither union is assignable to the other. Both lanes have to run this pass — the
|
|
2574
|
+
* store on the full derivation, the session on the locally patched list — so the pass is
|
|
2575
|
+
* written against the fields it actually reads rather than against either union, and hands
|
|
2576
|
+
* back the caller's own item type.
|
|
2577
|
+
*/
|
|
2578
|
+
interface LinkableReviewItem {
|
|
2579
|
+
readonly kind: string;
|
|
2580
|
+
readonly id: string;
|
|
2581
|
+
readonly ranges?: readonly ReviewRange[];
|
|
2582
|
+
readonly range?: ReviewRange | null;
|
|
2583
|
+
readonly parentId?: string;
|
|
2584
|
+
readonly parentRevisionId?: string;
|
|
2585
|
+
readonly replyIds?: readonly string[];
|
|
2586
|
+
readonly orphaned?: boolean;
|
|
2587
|
+
/** How deeply a revision is nested; absent on the kinds that cannot nest. */
|
|
2588
|
+
readonly nesting?: number;
|
|
2589
|
+
}
|
|
2590
|
+
/**
|
|
2591
|
+
* Attach each comment that answers a tracked change to the change it answers.
|
|
2592
|
+
*
|
|
2593
|
+
* A matching non-empty RANGE is the evidence. A stated comment reply beats an inferred revision
|
|
2594
|
+
* link, and the deepest revision on a shared span wins to match click targeting.
|
|
2595
|
+
*
|
|
2596
|
+
* The WHOLE conversation moves, not its head. A change's card renders `replyIds` as a flat list,
|
|
2597
|
+
* so linking only the top comment of a thread left every answer to that answer rendered by
|
|
2598
|
+
* nobody. Descendants ride along in authoring order.
|
|
2599
|
+
*
|
|
2600
|
+
* The pass is idempotent: every link is rebuilt from ranges, so locally patched queues cannot
|
|
2601
|
+
* retain stale `parentRevisionId` values after edits move a revision.
|
|
2602
|
+
*/
|
|
2603
|
+
declare function linkRevisionReplies<T extends LinkableReviewItem>(items: readonly T[]): T[];
|
|
2604
|
+
|
|
2605
|
+
/**
|
|
2606
|
+
* Longest accepted query. A query is host input rather than file content, but the scan is
|
|
2607
|
+
* proportional to it and there is no legitimate find phrase this long.
|
|
2608
|
+
*/
|
|
2609
|
+
declare const SEARCH_QUERY_MAX = 256;
|
|
2610
|
+
/**
|
|
2611
|
+
* Most matches one search returns. A single-character query against a long document would
|
|
2612
|
+
* otherwise allocate an entry per character; the scan stops here instead. A caller showing a
|
|
2613
|
+
* count treats a full result as "at least this many".
|
|
2614
|
+
*/
|
|
2615
|
+
declare const SEARCH_MATCH_LIMIT = 2000;
|
|
2616
|
+
/** How a text search is narrowed. Options the engine cannot honour are refused, never ignored. */
|
|
2617
|
+
interface TextMatchOptions {
|
|
2618
|
+
readonly matchCase?: boolean;
|
|
2619
|
+
readonly wholeWord?: boolean;
|
|
2620
|
+
/**
|
|
2621
|
+
* Report only matches lying wholly inside `[from, to)`.
|
|
2622
|
+
*
|
|
2623
|
+
* A WINDOW ON THE TEXT, not a slice of it: the whole-word test still reads the characters on
|
|
2624
|
+
* either side of the window, so scanning the first three characters of `category` for `cat`
|
|
2625
|
+
* finds nothing when whole words were asked for. Slicing first would answer a match, because
|
|
2626
|
+
* the `e` that disqualifies it would have been cut off — the window is where a caller is
|
|
2627
|
+
* looking, not what the paragraph says.
|
|
2628
|
+
*/
|
|
2629
|
+
readonly from?: number;
|
|
2630
|
+
readonly to?: number;
|
|
2631
|
+
}
|
|
2632
|
+
/** One occurrence, as UTF-16 offsets into the text that was scanned. */
|
|
2633
|
+
interface TextOccurrence {
|
|
2634
|
+
readonly start: number;
|
|
2635
|
+
readonly length: number;
|
|
2636
|
+
}
|
|
2637
|
+
/** Where a phrase occurs in a story, as paragraph-plus-offset ranges. */
|
|
2638
|
+
interface TextOccurrences {
|
|
2639
|
+
readonly matches: readonly TextOccurrence[];
|
|
2640
|
+
/** The scan stopped at `limit` with occurrences still ahead of it. */
|
|
2641
|
+
readonly truncated: boolean;
|
|
2642
|
+
}
|
|
2643
|
+
/**
|
|
2644
|
+
* Lower-case `text` WITHOUT changing its length.
|
|
2645
|
+
*
|
|
2646
|
+
* `String.prototype.toLowerCase` can expand (Turkish dotted capital I lowercases to two code
|
|
2647
|
+
* units), and an expansion mid-paragraph would slide every offset after it — the match would
|
|
2648
|
+
* be reported at the wrong place. The per-unit fallback folds only the characters that stay
|
|
2649
|
+
* one unit, so an expanding character simply compares case-sensitively. That is a real
|
|
2650
|
+
* degradation and it is the safe direction: a missed case-insensitive match beats a match
|
|
2651
|
+
* reported at an offset an editor then selects.
|
|
2652
|
+
*/
|
|
2653
|
+
declare function foldCase(text: string): string;
|
|
2654
|
+
/** Whether a match at `[start, end)` in `text` stands alone as a word. */
|
|
2655
|
+
declare function isWholeWord(text: string, start: number, end: number): boolean;
|
|
2656
|
+
/** Whether a query is one this module will scan for at all. */
|
|
2657
|
+
declare function isSearchableQuery(query: unknown): query is string;
|
|
2658
|
+
/**
|
|
2659
|
+
* Every occurrence of `query` in `text`, in order, NON-OVERLAPPING.
|
|
2660
|
+
*
|
|
2661
|
+
* Non-overlapping is what a find dialog counts: `aa` in `aaaa` is two, not three. `limit` is
|
|
2662
|
+
* the caller's remaining budget, so a caller scanning many paragraphs enforces ONE global cap
|
|
2663
|
+
* rather than one per paragraph.
|
|
2664
|
+
*/
|
|
2665
|
+
declare function findOccurrences(text: string, query: string, limit: number, options?: TextMatchOptions): TextOccurrences;
|
|
2666
|
+
|
|
2667
|
+
declare function drawingOpImpact(op: DrawingTreeDocOp): ImpactClass;
|
|
2668
|
+
/** Validate a drawing op's extents, crops and positions before it reaches the store. */
|
|
2669
|
+
declare function validateDrawingOp(part: OoxmlPart, op: DrawingTreeDocOp): TreeOpRejection | null;
|
|
2670
|
+
/** Map the nine wrap targets to anchor wrap element + behindDoc. */
|
|
2671
|
+
declare function wrapTargetToAnchorSpec(target: ImageWrapTarget): {
|
|
2672
|
+
readonly behindDocument: boolean;
|
|
2673
|
+
readonly wrapLocalName: 'wrapNone' | 'wrapSquare' | 'wrapTight' | 'wrapThrough' | 'wrapTopAndBottom';
|
|
2674
|
+
readonly wrapText?: 'bothSides' | 'left' | 'right' | 'largest';
|
|
2675
|
+
};
|
|
2676
|
+
/** Whether an op is one of the drawing ops. Narrows the type. */
|
|
2677
|
+
declare function isDrawingTreeDocOp(op: TreeDocOp): op is DrawingTreeDocOp;
|
|
2678
|
+
|
|
2679
|
+
/**
|
|
2680
|
+
* Fill every empty prompt-bearing control in `part` with its placeholder and mark it as
|
|
2681
|
+
* showing one. Returns `part` itself when there is nothing to fill.
|
|
2682
|
+
*/
|
|
2683
|
+
declare function materializeGlossaryPlaceholders(pkg: OoxmlPackage, part: OoxmlPart): OoxmlPart;
|
|
2684
|
+
|
|
2685
|
+
/**
|
|
2686
|
+
* Read forms protection from the settings root.
|
|
2687
|
+
*
|
|
2688
|
+
* Delegates to the ONE parse of `w:documentProtection` rather than reading the element again:
|
|
2689
|
+
* a second reading of `@w:enforcement` is how a document ends up protected to the Review menu
|
|
2690
|
+
* and unprotected to the store.
|
|
2691
|
+
*/
|
|
2692
|
+
declare function formsProtectionEnabled(root: OoxmlNode | null | undefined): boolean;
|
|
2693
|
+
/**
|
|
2694
|
+
* Whether the section owning a node still has form protection on.
|
|
2695
|
+
*
|
|
2696
|
+
* `w:formProt` is per-section, so a protected document may carry an unprotected section. The
|
|
2697
|
+
* owning section is the first `w:sectPr` at or after the node in body order, which is how a
|
|
2698
|
+
* section's extent is expressed in the body at all.
|
|
2699
|
+
*/
|
|
2700
|
+
declare function sectionProtectsForms(part: OoxmlPart, nodeId: string): boolean;
|
|
2701
|
+
|
|
2702
|
+
/** Every {@link TreeDocOpKind}, for validation and exhaustiveness checks. */
|
|
2703
|
+
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"];
|
|
2704
|
+
|
|
2705
|
+
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, 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 };
|
|
2706
|
+
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 };
|