@arbidocs/blocks 0.4.101 → 0.4.102
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-EQB3WELX.js +269 -0
- package/dist/chunk-EQB3WELX.js.map +1 -0
- 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/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
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@docx-editor.dev/core/contracts/interaction` — semantic addressing and interaction outcomes.
|
|
3
|
+
*
|
|
4
|
+
* Semantic identities and targets: the vocabulary a caller uses to say WHICH text it means,
|
|
5
|
+
* independent of layout, DOM or any editing engine's positions. Plus the outcome type an
|
|
6
|
+
* interaction attempt answers with. That is the whole module.
|
|
7
|
+
*
|
|
8
|
+
* It used to be 599 lines. An "interaction frame" lived here — a revision-tagged projection
|
|
9
|
+
* of display, page geometry, caret and selection overlays, focus, composition and
|
|
10
|
+
* accessibility, plus a typed pointer-intent dispatch protocol and a render IR of glyph
|
|
11
|
+
* runs — and every one of those declarations was consumed by exactly nothing. They
|
|
12
|
+
* described an architecture the engine does not use: the paginated surface owns pointer
|
|
13
|
+
* interaction internally and paints through `Editor.attach`, so no frame was ever published
|
|
14
|
+
* and no intent ever dispatched.
|
|
15
|
+
* THREE of them (`CaretGeometry`, `HitTestOptions`, `ShapedCluster`) also collided by name
|
|
16
|
+
* with the REAL, differently-shaped types in `layout/`, so the published contract carried a
|
|
17
|
+
* second definition of a live concept and `import { ShapedCluster }` meant different things
|
|
18
|
+
* depending on which module you reached for.
|
|
19
|
+
* `InteractionFrameId` and a frame-tagged `SemanticSelection` outlived that cut. Both were
|
|
20
|
+
* the same mistake: the id was a placeholder nothing ever minted (`focus` returned a literal
|
|
21
|
+
* `{ value: 0 }`), and the selection could not be CONSTRUCTED without one, which made it a
|
|
22
|
+
* fourth name-collision with the real `SemanticSelection` in `layout/` that a caller could
|
|
23
|
+
* never actually satisfy.
|
|
24
|
+
*
|
|
25
|
+
* CONTRACT ONLY — declarations, not an implementation.
|
|
26
|
+
*
|
|
27
|
+
* @packageDocumentation
|
|
28
|
+
* @public
|
|
29
|
+
*/
|
|
30
|
+
import { V as ViewScope } from '../editor-scope-OHPwVQ5l.js';
|
|
31
|
+
export { E as EditorScope } from '../editor-scope-OHPwVQ5l.js';
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* `@docx-editor.dev/core/contracts/interaction` — semantic addressing and interaction outcomes.
|
|
35
|
+
*
|
|
36
|
+
* Semantic identities and targets: the vocabulary a caller uses to say WHICH text it means,
|
|
37
|
+
* independent of layout, DOM or any editing engine's positions. Plus the outcome type an
|
|
38
|
+
* interaction attempt answers with. That is the whole module.
|
|
39
|
+
*
|
|
40
|
+
* It used to be 599 lines. An "interaction frame" lived here — a revision-tagged projection
|
|
41
|
+
* of display, page geometry, caret and selection overlays, focus, composition and
|
|
42
|
+
* accessibility, plus a typed pointer-intent dispatch protocol and a render IR of glyph
|
|
43
|
+
* runs — and every one of those declarations was consumed by exactly nothing. They
|
|
44
|
+
* described an architecture the engine does not use: the paginated surface owns pointer
|
|
45
|
+
* interaction internally and paints through `Editor.attach`, so no frame was ever published
|
|
46
|
+
* and no intent ever dispatched.
|
|
47
|
+
* THREE of them (`CaretGeometry`, `HitTestOptions`, `ShapedCluster`) also collided by name
|
|
48
|
+
* with the REAL, differently-shaped types in `layout/`, so the published contract carried a
|
|
49
|
+
* second definition of a live concept and `import { ShapedCluster }` meant different things
|
|
50
|
+
* depending on which module you reached for.
|
|
51
|
+
* `InteractionFrameId` and a frame-tagged `SemanticSelection` outlived that cut. Both were
|
|
52
|
+
* the same mistake: the id was a placeholder nothing ever minted (`focus` returned a literal
|
|
53
|
+
* `{ value: 0 }`), and the selection could not be CONSTRUCTED without one, which made it a
|
|
54
|
+
* fourth name-collision with the real `SemanticSelection` in `layout/` that a caller could
|
|
55
|
+
* never actually satisfy.
|
|
56
|
+
*
|
|
57
|
+
* CONTRACT ONLY — declarations, not an implementation.
|
|
58
|
+
*
|
|
59
|
+
* @packageDocumentation
|
|
60
|
+
* @public
|
|
61
|
+
*/
|
|
62
|
+
|
|
63
|
+
/** Bidi/grapheme affinity for a text caret or hit target. */
|
|
64
|
+
type InteractionAffinity = 'upstream' | 'downstream';
|
|
65
|
+
/**
|
|
66
|
+
* Model-derived stable identity within a scope. Positions resolve through this
|
|
67
|
+
* index, not accumulated display-item lengths or editing-engine coordinates.
|
|
68
|
+
*/
|
|
69
|
+
interface SemanticIdentity {
|
|
70
|
+
readonly storyId: string;
|
|
71
|
+
readonly blockId: string;
|
|
72
|
+
}
|
|
73
|
+
/** A PM-free semantic caret, range endpoint, or atomic selection target. */
|
|
74
|
+
type SemanticTarget = {
|
|
75
|
+
readonly kind: 'text';
|
|
76
|
+
readonly scope: ViewScope;
|
|
77
|
+
readonly identity: SemanticIdentity;
|
|
78
|
+
readonly graphemeOffset: number;
|
|
79
|
+
readonly affinity: InteractionAffinity;
|
|
80
|
+
} | {
|
|
81
|
+
readonly kind: 'atomic';
|
|
82
|
+
readonly scope: ViewScope;
|
|
83
|
+
readonly objectId: string;
|
|
84
|
+
};
|
|
85
|
+
/** Typed rejection for pending, read-only, invalid, or unsupported interaction. */
|
|
86
|
+
type InteractionOutcomeCode = 'pendingLayout' | 'pendingSelection' | 'readOnly' | 'invalidTarget' | 'unsupported';
|
|
87
|
+
/**
|
|
88
|
+
* The result of one interaction attempt.
|
|
89
|
+
*
|
|
90
|
+
* A rejection carries the ENGINE's own `reason`, which is what lets a caller surface why an
|
|
91
|
+
* interaction was refused instead of guessing.
|
|
92
|
+
*/
|
|
93
|
+
type InteractionOutcome<T> = {
|
|
94
|
+
readonly ok: true;
|
|
95
|
+
readonly value: T;
|
|
96
|
+
} | {
|
|
97
|
+
readonly ok: false;
|
|
98
|
+
readonly code: InteractionOutcomeCode;
|
|
99
|
+
readonly reason: string;
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
export { ViewScope };
|
|
103
|
+
export type { InteractionAffinity, InteractionOutcome, InteractionOutcomeCode, SemanticIdentity, SemanticTarget };
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict';var chunkNBCVVZOM_cjs=require('../chunk-NBCVVZOM.cjs');Object.defineProperty(exports,"resolveEditorModules",{enumerable:true,get:function(){return chunkNBCVVZOM_cjs.a}});
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@docx-editor.dev/core/contracts/modules` — the `EditorModule` seam.
|
|
3
|
+
*
|
|
4
|
+
* How a paid or optional capability contributes to the engine without the free tier importing
|
|
5
|
+
* it: the review module and custom nodes both arrive through here, and their absence leaves the
|
|
6
|
+
* corresponding chrome disabled with the engine's own reason.
|
|
7
|
+
*
|
|
8
|
+
* NOT a plugin system. The shape is closed: every contribution point is named
|
|
9
|
+
* here, core iterates registered modules at its existing dispatch points, and
|
|
10
|
+
* core never imports a capability package. A capability absent from this file
|
|
11
|
+
* is not extendable from outside — deliberately, so the one-pipeline principle
|
|
12
|
+
* survives the packaging boundary.
|
|
13
|
+
* The free engine behaves identically with an empty registry: documents
|
|
14
|
+
* round-trip losslessly, revisions render in their final-state projection, and
|
|
15
|
+
* the review chrome slots stay disabled with the engine's own reason.
|
|
16
|
+
*
|
|
17
|
+
* @packageDocumentation
|
|
18
|
+
* @public
|
|
19
|
+
*/
|
|
20
|
+
import { R as RevisionMarkupDialogSession, a as ReviewDisplayMode } from '../revision-projection-DZ4kKVev.js';
|
|
21
|
+
export { b as RevisionDisplayMode } from '../revision-projection-DZ4kKVev.js';
|
|
22
|
+
import { R as ReviewPaneOptions } from '../review-pane-D9jm8DcY.js';
|
|
23
|
+
import { R as ReviewModelInput, a as ReviewItem, O as OoxmlPart, b as ReviewRevisionItem } from '../types-barrel-D3xCgQX6.js';
|
|
24
|
+
export { C as CommentRecord, c as ReviewCommentItem, d as ReviewCustomItem, e as ReviewPosition, f as ReviewRange, g as ReviewRevisionKind, h as RevisionAddress } from '../types-barrel-D3xCgQX6.js';
|
|
25
|
+
import { CollaborationModuleContribution } from '../collaboration.js';
|
|
26
|
+
import '../editor-scope-OHPwVQ5l.js';
|
|
27
|
+
import '../tree-package-fragment-BeeKxDw8.js';
|
|
28
|
+
import '../image-resources-BN-hUgCn.js';
|
|
29
|
+
import '../collaboration/replication.js';
|
|
30
|
+
import '../failure-NS2lsya4.js';
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Derives the review queue — every pending revision decision and comment
|
|
34
|
+
* thread — from one story part plus its comment parts. Implemented by the pro
|
|
35
|
+
* review module; the free engine has no implementation and reports an empty
|
|
36
|
+
* queue.
|
|
37
|
+
*
|
|
38
|
+
* @public
|
|
39
|
+
*/
|
|
40
|
+
type CollectReviewItems = (input: ReviewModelInput) => readonly ReviewItem[];
|
|
41
|
+
/** Viewer settings dialog supplied by the review module. @public */
|
|
42
|
+
interface RevisionMarkupDialog {
|
|
43
|
+
open(): void;
|
|
44
|
+
destroy(): void;
|
|
45
|
+
}
|
|
46
|
+
/** Local settings access for review chrome. No document mutations occur here. @public */
|
|
47
|
+
interface RevisionMarkupDialogHost extends RevisionMarkupDialogSession {
|
|
48
|
+
readonly container: HTMLElement;
|
|
49
|
+
readonly translate?: (key: string) => string | undefined;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* What a review module contributes: the queue derivation, and the revision
|
|
53
|
+
* display modes the editor may enter beyond the free tier's final-state
|
|
54
|
+
* projection.
|
|
55
|
+
*
|
|
56
|
+
* @public
|
|
57
|
+
*/
|
|
58
|
+
interface ReviewModuleContribution {
|
|
59
|
+
/** Create local review settings chrome when a host opens the dialog. */
|
|
60
|
+
readonly createRevisionMarkupDialog?: (host: RevisionMarkupDialogHost) => RevisionMarkupDialog;
|
|
61
|
+
/**
|
|
62
|
+
* Display modes this module unlocks (the free engine renders `proposed` only).
|
|
63
|
+
*
|
|
64
|
+
* The module enables the listed review projections.
|
|
65
|
+
*/
|
|
66
|
+
readonly displayModes: readonly ReviewDisplayMode[];
|
|
67
|
+
/**
|
|
68
|
+
* The review pane settings the editor starts with. `setReviewPaneOptions` changes them later.
|
|
69
|
+
*/
|
|
70
|
+
readonly pane?: ReviewPaneOptions;
|
|
71
|
+
/** The review queue derivation. */
|
|
72
|
+
readonly collectReviewItems: CollectReviewItems;
|
|
73
|
+
/**
|
|
74
|
+
* Revisions wholly inside one paragraph — for the conservative local review
|
|
75
|
+
* patch after a text-local body edit.
|
|
76
|
+
*/
|
|
77
|
+
readonly revisionItemsOfParagraph: (part: OoxmlPart, paragraphId: string) => readonly ReviewRevisionItem[];
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* One registered capability module. Registration is construction-time
|
|
82
|
+
* (`createDocxEditor({ modules })`) and immutable for the instance's lifetime.
|
|
83
|
+
*
|
|
84
|
+
* @public
|
|
85
|
+
*/
|
|
86
|
+
interface EditorModule {
|
|
87
|
+
/** Diagnostic identity (`'review'`, `'custom-nodes'`); not a dispatch key. */
|
|
88
|
+
readonly id: string;
|
|
89
|
+
/** Review capability: queue derivation, commands gate, display modes. */
|
|
90
|
+
readonly review?: ReviewModuleContribution;
|
|
91
|
+
/**
|
|
92
|
+
* Collaboration replica. Absent, the editor stays single-user: local undo
|
|
93
|
+
* stays the authority, and `snapshot().collaborationStatus` is `'inactive'`.
|
|
94
|
+
*/
|
|
95
|
+
readonly collaboration?: CollaborationModuleContribution;
|
|
96
|
+
/**
|
|
97
|
+
* Custom inline node definitions. Reserved: the definition shape lands with
|
|
98
|
+
* the custom-nodes lane; the registry carries them opaquely until then.
|
|
99
|
+
*/
|
|
100
|
+
readonly customNodes?: readonly unknown[];
|
|
101
|
+
/**
|
|
102
|
+
* customXml payload namespaces this module OWNS, swept for orphans when a document opens.
|
|
103
|
+
*
|
|
104
|
+
* A payload lives in a customXml data part, and Word will not delete one when a user deletes
|
|
105
|
+
* the control bound to it — nothing in OOXML asks it to. So a document can arrive holding
|
|
106
|
+
* payloads for chips that no longer exist, and reconciling against what the story actually
|
|
107
|
+
* binds is the only thing that collects them.
|
|
108
|
+
*
|
|
109
|
+
* The claim is what keeps the sweep off other people's stores: Word's own Cover Page
|
|
110
|
+
* Properties store rides in most templates, and a sweep that walked every customXml part
|
|
111
|
+
* would be deleting from it on the strength of a name collision. A namespace no module names
|
|
112
|
+
* is never touched.
|
|
113
|
+
*/
|
|
114
|
+
readonly customNodePayloadNamespaces?: readonly string[];
|
|
115
|
+
/**
|
|
116
|
+
* Told when the recognition pass finds something wrong with a node in THIS editor's document.
|
|
117
|
+
*
|
|
118
|
+
* Carried per module rather than kept by the capability package, so two editors on one page
|
|
119
|
+
* hear only their own documents and a detached editor's listener goes with it. The shape is
|
|
120
|
+
* opaque here for the same reason `customNodes` is: what a diagnostic means belongs to the
|
|
121
|
+
* package that raised it.
|
|
122
|
+
*/
|
|
123
|
+
readonly onCustomNodeDiagnostic?: (diagnostic: unknown) => void;
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* The resolved registry the editor instance holds: at most one review
|
|
127
|
+
* contribution and at most one collaboration contribution (first registration
|
|
128
|
+
* wins for each), all custom node definitions in registration order.
|
|
129
|
+
*/
|
|
130
|
+
interface EditorModuleRegistry {
|
|
131
|
+
readonly review: ReviewModuleContribution | null;
|
|
132
|
+
readonly collaboration: CollaborationModuleContribution | null;
|
|
133
|
+
readonly customNodes: readonly unknown[];
|
|
134
|
+
/** Every claimed payload namespace, deduplicated, in registration order. */
|
|
135
|
+
readonly customNodePayloadNamespaces: readonly string[];
|
|
136
|
+
/** Every registered diagnostic listener, in registration order. */
|
|
137
|
+
readonly customNodeDiagnostics: readonly ((diagnostic: unknown) => void)[];
|
|
138
|
+
}
|
|
139
|
+
/** Resolve construction-time modules into the registry the instance dispatches over. */
|
|
140
|
+
declare function resolveEditorModules(modules: readonly EditorModule[] | undefined): EditorModuleRegistry;
|
|
141
|
+
|
|
142
|
+
export { CollaborationModuleContribution, OoxmlPart, ReviewDisplayMode, ReviewItem, ReviewModelInput, ReviewRevisionItem, resolveEditorModules };
|
|
143
|
+
export type { CollectReviewItems, EditorModule, EditorModuleRegistry, ReviewModuleContribution, RevisionMarkupDialog, RevisionMarkupDialogHost };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{a as resolveEditorModules}from'../chunk-O5INAWZQ.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@docx-editor.dev/core/contracts/types` — the shared type vocabulary. Zero runtime.
|
|
3
|
+
*
|
|
4
|
+
* Addressing (`DocAnchor`, `DocTarget`), the document model, and the geometry primitives every
|
|
5
|
+
* other contract is written in terms of.
|
|
6
|
+
*
|
|
7
|
+
* @packageDocumentation
|
|
8
|
+
* @public
|
|
9
|
+
*/
|
|
10
|
+
export { B as Block, r as ColorValue, m as ContainerRef, s as ContentControl, n as ContentControlFilter, i as ContentControlType, t as DocAnchor, u as DocAnchorRange, q as DocComment, v as DocLocation, o as DocRange, j as DocTarget, w as DocumentBody, D as DocxDocument, av as DocxDocumentJSON, x as ExecErrorCode, E as ExecResult, l as Extent, ay as FontDefinition, H as HeaderFooterSet, y as IndentFormatting, I as InsertableContentControlType, az as NumberingRef, aA as PageMargins, P as Paragraph, aB as ParagraphDisagreements, z as ParagraphFlags, aq as ParagraphFormatCommand, A as ParagraphTabStop, aC as Point, as as Rect, p as Revision, F as RevisionType, aD as Run, k as RunFormatting, G as Section, J as SectionProperties, at as SelectionPin, K as StyleDefinition, S as StyleDefinitions, T as Table, aE as TableCell, aF as TableRow, L as Theme, M as ThemeColorScheme, au as Unsubscribe, ar as Watermark } from '../types-barrel-D3xCgQX6.js';
|
|
11
|
+
import '../editor-scope-OHPwVQ5l.js';
|
|
File without changes
|
|
@@ -0,0 +1,323 @@
|
|
|
1
|
+
import { Q as OoxmlPackage, O as OoxmlPart, N as OoxmlNode, a8 as TreeOpRejection } from './types-barrel-D3xCgQX6.js';
|
|
2
|
+
import { e as TreeModelChange, f as TreeDocumentStore } from './tree-package-fragment-BeeKxDw8.js';
|
|
3
|
+
|
|
4
|
+
/** Which of a family's four faces an embedded font relationship supplies. */
|
|
5
|
+
type FontStyleKey = 'regular' | 'bold' | 'italic' | 'boldItalic';
|
|
6
|
+
/**
|
|
7
|
+
* One font whose bytes travel inside the package.
|
|
8
|
+
*
|
|
9
|
+
* The family name is the DOCUMENT's and is not validated — it is attacker-controlled, so it is
|
|
10
|
+
* escaped into CSS and never registered globally on `document.fonts`, where it would shadow the
|
|
11
|
+
* host application's own fonts.
|
|
12
|
+
*/
|
|
13
|
+
interface EmbeddedFont {
|
|
14
|
+
/** The family as the document names it. Not validated against anything. */
|
|
15
|
+
readonly family: string;
|
|
16
|
+
readonly style: FontStyleKey;
|
|
17
|
+
/** Deobfuscated bytes, ready to be offered to a font validator. */
|
|
18
|
+
readonly bytes: Uint8Array;
|
|
19
|
+
/** The part they came from, for diagnostics. */
|
|
20
|
+
readonly partName: string;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Undo Word's embedded-font obfuscation (ECMA-376 Part 4 §2.8.1).
|
|
24
|
+
*
|
|
25
|
+
* The key is the `w:fontKey` GUID's 16 bytes in REVERSED order — not the per-group
|
|
26
|
+
* little-endian reading a GUID usually gets. It is XORed over the first 32 bytes of the
|
|
27
|
+
* part, applied twice. Getting the order wrong produces a font that looks corrupt rather
|
|
28
|
+
* than obfuscated, which is indistinguishable from a damaged file at the point it fails.
|
|
29
|
+
*
|
|
30
|
+
* Pure XOR, so the same operation obfuscates and deobfuscates.
|
|
31
|
+
*/
|
|
32
|
+
declare function deobfuscateFont(bytes: Uint8Array, fontKey: string): Uint8Array | null;
|
|
33
|
+
/** Limits and instrumentation for reading embedded fonts out of a package. */
|
|
34
|
+
interface ReadEmbeddedFontsOptions {
|
|
35
|
+
/** Refuse a font part larger than this. Defaults to 16 MB. */
|
|
36
|
+
readonly maxFontBytes?: number;
|
|
37
|
+
/** Refuse more than this many fonts. Defaults to 64. */
|
|
38
|
+
readonly maxFonts?: number;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Every font the package embeds, deobfuscated.
|
|
42
|
+
*
|
|
43
|
+
* Silently skips anything malformed rather than rejecting the document: a broken font table
|
|
44
|
+
* is a reason to fall back to substitution, never a reason to refuse to open the file.
|
|
45
|
+
*/
|
|
46
|
+
declare function readEmbeddedFonts(pkg: OoxmlPackage, fontTable: OoxmlPart | undefined, options?: ReadEmbeddedFontsOptions): EmbeddedFont[];
|
|
47
|
+
|
|
48
|
+
/** The two list kinds a toolbar offers. */
|
|
49
|
+
type ListKind = 'bullet' | 'ordered';
|
|
50
|
+
interface EnsuredListDefinition {
|
|
51
|
+
readonly pkg: OoxmlPackage;
|
|
52
|
+
/** The `w:numId` a paragraph's `w:numPr` should name. */
|
|
53
|
+
readonly numId: string;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Find or create a list definition of `kind`, returning the package that holds it.
|
|
57
|
+
*
|
|
58
|
+
* An existing abstract definition of the same kind is reused, but every disconnected list
|
|
59
|
+
* gets a fresh `w:num` instance. Counters belong to `w:num`, so reusing that instance would
|
|
60
|
+
* continue an earlier list. Returns null only when the part cannot be built at all.
|
|
61
|
+
*/
|
|
62
|
+
declare function ensureListDefinition(pkg: OoxmlPackage, kind: ListKind): EnsuredListDefinition | null;
|
|
63
|
+
/**
|
|
64
|
+
* Declare `level` in the definition `numId` names, with Word's default format for that
|
|
65
|
+
* level, or refuse.
|
|
66
|
+
*
|
|
67
|
+
* Word never greys Increase Indent out on a list item: demoting past the deepest level a
|
|
68
|
+
* `w:abstractNum` declares makes Word DEFINE the level, cycling its stock bullets
|
|
69
|
+
* (Symbol •, Courier `o`, Wingdings ▪) or number formats (decimal, lowerLetter,
|
|
70
|
+
* lowerRoman) by depth. This is that write. An already-declared level returns the package
|
|
71
|
+
* unchanged, so callers may ask first and act second without a second lookup.
|
|
72
|
+
*
|
|
73
|
+
* A delegating definition (`w:numStyleLink`, 17.9.21) is refused: its levels live on the
|
|
74
|
+
* linked style's definition, and a `w:lvl` grafted here would be shadowed the moment the
|
|
75
|
+
* link resolves.
|
|
76
|
+
*/
|
|
77
|
+
declare function ensureNumberingLevel(pkg: OoxmlPackage, numId: string, level: number, kind: ListKind): OoxmlPackage | null;
|
|
78
|
+
|
|
79
|
+
/** One bookmark's name and the range its marker pair currently encloses. */
|
|
80
|
+
interface BookmarkAnchor {
|
|
81
|
+
readonly name: string;
|
|
82
|
+
/** Canonical node id of the paragraph the marker sits in. */
|
|
83
|
+
readonly paragraphId: string;
|
|
84
|
+
/** UTF-16 offset within that paragraph, in `paragraphTextOf`'s vocabulary. */
|
|
85
|
+
readonly offset: number;
|
|
86
|
+
}
|
|
87
|
+
/** Bookmarks by name. A name the document declares twice resolves to the first in order. */
|
|
88
|
+
type BookmarkIndex = ReadonlyMap<string, BookmarkAnchor>;
|
|
89
|
+
/**
|
|
90
|
+
* Build `name -> position` for every bookmark start in a part, in document order.
|
|
91
|
+
*
|
|
92
|
+
* FIRST IN DOCUMENT ORDER WINS on a duplicate name. Word treats a repeated bookmark name as
|
|
93
|
+
* the same bookmark and jumps to the first, and the alternative — last-wins — makes a jump
|
|
94
|
+
* target move when an edit far away happens to duplicate a name.
|
|
95
|
+
*
|
|
96
|
+
* The offset is measured the way the ops measure: text of the runs before the marker inside
|
|
97
|
+
* its own paragraph, hyperlink runs included, so the position a jump places the caret at is a
|
|
98
|
+
* position `setSelection` accepts.
|
|
99
|
+
*/
|
|
100
|
+
declare function buildBookmarkIndex(part: OoxmlPart): BookmarkIndex;
|
|
101
|
+
|
|
102
|
+
/** What the document asks for. Every field defaults to "the document said nothing". */
|
|
103
|
+
interface DocumentTrackingSettings {
|
|
104
|
+
/** `w:trackRevisions` — the document asks for edits to be tracked. */
|
|
105
|
+
readonly trackRevisions: boolean;
|
|
106
|
+
/**
|
|
107
|
+
* `w:documentProtection/@w:edit="trackedChanges"` — tracking may not be turned OFF.
|
|
108
|
+
*
|
|
109
|
+
* Advisory. Presenting it as enforcement would be a lie about a file anyone can edit.
|
|
110
|
+
*/
|
|
111
|
+
readonly restrictedToTrackedChanges: boolean;
|
|
112
|
+
/**
|
|
113
|
+
* `w:documentProtection/@w:edit="forms"` enforced — Track Changes is UNAVAILABLE.
|
|
114
|
+
*
|
|
115
|
+
* Word refuses to turn tracking on while a document is protected for filling in forms. A
|
|
116
|
+
* document tracked BEFORE it was protected keeps the revisions it already carries; what the
|
|
117
|
+
* protection stops is making new ones.
|
|
118
|
+
*/
|
|
119
|
+
readonly restrictedToForms: boolean;
|
|
120
|
+
/** `w:documentProtection/@w:edit="readOnly"` enforced — no edit is permitted at all. */
|
|
121
|
+
readonly restrictedToReadOnly: boolean;
|
|
122
|
+
/** `w:documentProtection/@w:edit="comments"` enforced — only comments are permitted. */
|
|
123
|
+
readonly restrictedToComments: boolean;
|
|
124
|
+
/** `w:doNotTrackMoves` — write a move as a delete and an insert. */
|
|
125
|
+
readonly doNotTrackMoves: boolean;
|
|
126
|
+
/** `w:doNotTrackFormatting` — apply formatting without recording a `w:rPrChange`. */
|
|
127
|
+
readonly doNotTrackFormatting: boolean;
|
|
128
|
+
}
|
|
129
|
+
/** The frozen "nothing is tracked" settings — what a document with no `w:trackChanges` gets. */
|
|
130
|
+
declare const NO_TRACKING_SETTINGS: DocumentTrackingSettings;
|
|
131
|
+
/** Read the tracking settings from a `settings.xml` root, or the defaults when it has none. */
|
|
132
|
+
declare function readTrackingSettings(settingsRoot: OoxmlNode | null | undefined): DocumentTrackingSettings;
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* The payload half of an insert: which store, which node, and what it holds.
|
|
136
|
+
*
|
|
137
|
+
* `data` is opaque here. The lane that owns a schema is the one that declared it, and a store
|
|
138
|
+
* that parsed payloads would be a second opinion about what a host's node means.
|
|
139
|
+
*/
|
|
140
|
+
interface CustomNodePayloadWrite {
|
|
141
|
+
/** Namespace of the store's root element — what identifies one store among several. */
|
|
142
|
+
readonly namespaceUri: string;
|
|
143
|
+
/** Local name of that root. An NCName; anything else refuses. */
|
|
144
|
+
readonly rootLocalName: string;
|
|
145
|
+
/** The node's own id, which the binding's xpath quotes. */
|
|
146
|
+
readonly nodeId: string;
|
|
147
|
+
/** The text the control shows. Word paints this from the store, so an empty one is an empty chip. */
|
|
148
|
+
readonly label: string;
|
|
149
|
+
/** The payload, serialized. JSON by convention; never parsed here. */
|
|
150
|
+
readonly data: string;
|
|
151
|
+
}
|
|
152
|
+
/** Where the control goes, what it says, and the payload it carries. */
|
|
153
|
+
interface InsertCustomNodeWrite {
|
|
154
|
+
readonly paragraphId: string;
|
|
155
|
+
readonly offset: number;
|
|
156
|
+
/**
|
|
157
|
+
* Wrap rather than insert: the text from `offset` to here is removed first.
|
|
158
|
+
*
|
|
159
|
+
* The node's label REPLACES the words it covered, because that is what turning a stretch of a
|
|
160
|
+
* sentence into a citation means. Removed inside the same transaction, so a refused insert
|
|
161
|
+
* leaves the text where it was.
|
|
162
|
+
*/
|
|
163
|
+
readonly replaceUntil?: number;
|
|
164
|
+
/**
|
|
165
|
+
* Rewrite an existing control: it and the payload it bound go first, in this transaction.
|
|
166
|
+
*
|
|
167
|
+
* An UPDATE is remove-and-reinsert, because the tag codec has no in-place rewrite and
|
|
168
|
+
* pretending it did would put a second write path beside this one. Doing both halves here is
|
|
169
|
+
* what keeps it one undo step, and what stops an update from leaving a label and a payload
|
|
170
|
+
* that disagree.
|
|
171
|
+
*/
|
|
172
|
+
readonly replaceControlId?: string;
|
|
173
|
+
readonly tag: string;
|
|
174
|
+
readonly text: string;
|
|
175
|
+
readonly alias?: string;
|
|
176
|
+
/** Defaults to none. Callers that want Word's own "cannot type into it" pass `contentLocked`. */
|
|
177
|
+
readonly lock?: 'sdtLocked' | 'sdtContentLocked' | 'contentLocked';
|
|
178
|
+
/** Omitted authors an ordinary tagged control with no store — the pre-payload behaviour. */
|
|
179
|
+
readonly payload?: CustomNodePayloadWrite;
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* Why a payload write was refused.
|
|
183
|
+
*
|
|
184
|
+
* The tree rejections pass through unchanged, so a locked paragraph refuses a bound insert for
|
|
185
|
+
* the same named reason it refuses a plain one. The three added here are the payload's own.
|
|
186
|
+
*/
|
|
187
|
+
type CustomNodeWriteRejection = TreeOpRejection
|
|
188
|
+
/** The id, root name or namespace cannot be spelled in an XPath, so no binding could name it. */
|
|
189
|
+
| 'unaddressable-payload'
|
|
190
|
+
/** The store could not be authored — see `withCustomXmlDataPart` for every way that happens. */
|
|
191
|
+
| 'store-not-authored'
|
|
192
|
+
/** The payload or the label is past the cap. */
|
|
193
|
+
| 'payload-too-large';
|
|
194
|
+
type CustomNodeWriteResult = {
|
|
195
|
+
readonly ok: true;
|
|
196
|
+
readonly change: TreeModelChange | null;
|
|
197
|
+
/**
|
|
198
|
+
* The control this write authored, when it authored one. A rewrite replaces the control
|
|
199
|
+
* rather than editing it, so the id the caller passed in names nothing afterwards.
|
|
200
|
+
*/
|
|
201
|
+
readonly nodeId?: string;
|
|
202
|
+
} | {
|
|
203
|
+
readonly ok: false;
|
|
204
|
+
readonly reason: CustomNodeWriteRejection;
|
|
205
|
+
readonly detail?: string;
|
|
206
|
+
};
|
|
207
|
+
/**
|
|
208
|
+
* The largest payload one node may carry, in UTF-16 code units.
|
|
209
|
+
*
|
|
210
|
+
* Same figure as the read side's (`parseCustomNodeData`) and for the same reason: far past any
|
|
211
|
+
* legitimate chip, far short of anything that hurts. Checked on the WRITE too, so a document
|
|
212
|
+
* cannot be authored here holding a payload the reader will later refuse to parse.
|
|
213
|
+
*/
|
|
214
|
+
declare const MAX_CUSTOM_NODE_PAYLOAD_LENGTH: number;
|
|
215
|
+
/** The longest label a binding may paint. Word renders it as the control's whole content. */
|
|
216
|
+
declare const MAX_CUSTOM_NODE_LABEL_LENGTH = 4096;
|
|
217
|
+
/**
|
|
218
|
+
* Insert one custom node, with its payload, as a single transaction.
|
|
219
|
+
*
|
|
220
|
+
* Answers the store transaction's own change so the caller can publish it — a payload write is a
|
|
221
|
+
* package write reaching through a story store, exactly as a comment is, and the coordinator
|
|
222
|
+
* needs the change to know which paragraphs went dirty.
|
|
223
|
+
*/
|
|
224
|
+
declare function insertCustomNodeWrite(store: TreeDocumentStore, write: InsertCustomNodeWrite,
|
|
225
|
+
/**
|
|
226
|
+
* The part the customXml store hangs off, defaulting to the story being written.
|
|
227
|
+
*
|
|
228
|
+
* A chip in a header is written against the HEADER store, but Word enumerates the data
|
|
229
|
+
* store from the main document part — a store authored off a header is one Word never
|
|
230
|
+
* sees. So the caller passes the main part while the control itself lands in the story.
|
|
231
|
+
*/
|
|
232
|
+
dataOwnerPartName?: string): CustomNodeWriteResult;
|
|
233
|
+
/**
|
|
234
|
+
* Remove a control and, in the same transaction, the payload it bound.
|
|
235
|
+
*
|
|
236
|
+
* The sweep would collect the node eventually — that is what makes deletion in Word survivable —
|
|
237
|
+
* but "eventually" is the next open, and a document saved in between carries a payload for a
|
|
238
|
+
* chip that is gone. Doing it here means the ordinary case is exact and the sweep is a backstop.
|
|
239
|
+
*/
|
|
240
|
+
declare function removeCustomNodeWrite(store: TreeDocumentStore, controlNodeId: string): CustomNodeWriteResult;
|
|
241
|
+
/**
|
|
242
|
+
* What one sweep collected, or why it collected nothing.
|
|
243
|
+
*
|
|
244
|
+
* `ok: false` is NOT "the document was already tidy" — that is `ok: true` with an empty
|
|
245
|
+
* `removed`. It means a store this sweep was asked to tidy refused the rewrite, which a caller
|
|
246
|
+
* that keeps saving into the same document should know about rather than silently retry forever.
|
|
247
|
+
*/
|
|
248
|
+
type CustomNodeSweepResult = {
|
|
249
|
+
readonly ok: true;
|
|
250
|
+
readonly pkg: OoxmlPackage;
|
|
251
|
+
/** Node ids removed, across every store swept. Empty means there were no orphans. */
|
|
252
|
+
readonly removed: readonly string[];
|
|
253
|
+
} | {
|
|
254
|
+
readonly ok: false;
|
|
255
|
+
readonly reason: string;
|
|
256
|
+
};
|
|
257
|
+
/**
|
|
258
|
+
* Drop every payload no control binds, in the stores whose namespaces a host claims.
|
|
259
|
+
*
|
|
260
|
+
* ON OPEN, NOT ON SAVE. A chip cut to the clipboard is unbound for as long as it sits there, so a
|
|
261
|
+
* save mid-cut would destroy the payload the user is about to paste. On open the only unbound
|
|
262
|
+
* nodes are ones a control genuinely lost — deleted here, or deleted in Word, which is the case
|
|
263
|
+
* nothing else can collect.
|
|
264
|
+
*
|
|
265
|
+
* `namespaces` is the claim, and it is what keeps this off other people's stores: Word's own Cover
|
|
266
|
+
* Page Properties store rides in most templates, and a sweep that walked every customXml part
|
|
267
|
+
* would be deleting from it on the strength of a name collision.
|
|
268
|
+
*/
|
|
269
|
+
declare function sweepCustomNodePayloads(pkg: OoxmlPackage, storyPartName: string, namespaces: readonly string[]): CustomNodeSweepResult;
|
|
270
|
+
/** One control's payload, as the store holds it. Both strings are untrusted file input. */
|
|
271
|
+
interface CustomNodePayloadRead {
|
|
272
|
+
/** The store node's own id. */
|
|
273
|
+
readonly nodeId: string;
|
|
274
|
+
/** The text Word paints the control from. */
|
|
275
|
+
readonly label: string;
|
|
276
|
+
/** The payload as authored. JSON by convention, unparsed here. */
|
|
277
|
+
readonly data: string;
|
|
278
|
+
}
|
|
279
|
+
/**
|
|
280
|
+
* The payload every control in a story binds to, keyed by the CONTROL's canonical node id.
|
|
281
|
+
*
|
|
282
|
+
* Keyed by the control rather than by the store node because that is the question a reader
|
|
283
|
+
* actually has — "what does this chip carry" — and because two stores may each hold a `cx1`.
|
|
284
|
+
* Resolved here rather than by a capability package: the stores are package parts, and a
|
|
285
|
+
* derivation that only gets story parts has no way to reach them.
|
|
286
|
+
*
|
|
287
|
+
* Every store the story relates to, so a document carrying two definitions' payloads answers
|
|
288
|
+
* for both without anyone naming a namespace.
|
|
289
|
+
*/
|
|
290
|
+
declare function customNodePayloadsByControl(pkg: OoxmlPackage, storyPartName: string,
|
|
291
|
+
/**
|
|
292
|
+
* The part that RELATES the customXml store, when it is not the story's own.
|
|
293
|
+
*
|
|
294
|
+
* Two different questions wear one name here: which part holds the CONTROLS, and which part
|
|
295
|
+
* relates the STORE they bind into. Word only reads a store hung off the main document part,
|
|
296
|
+
* so {@link writeCustomNode} already takes them separately — this read did not, and answered
|
|
297
|
+
* with the body's controls whatever story it was asked about. A chip in a header therefore
|
|
298
|
+
* read as having no payload at all, and an update that meant to keep the existing data
|
|
299
|
+
* dropped it.
|
|
300
|
+
*/
|
|
301
|
+
dataOwnerPartName?: string): ReadonlyMap<string, CustomNodePayloadRead>;
|
|
302
|
+
/** Every payload one store holds, for a caller resolving a control's `data`. */
|
|
303
|
+
declare function customNodePayloadsOf(pkg: OoxmlPackage, storyPartName: string, namespaceUri: string): ReadonlyMap<string, {
|
|
304
|
+
readonly label: string;
|
|
305
|
+
readonly data: string;
|
|
306
|
+
}>;
|
|
307
|
+
/**
|
|
308
|
+
* What the session answers for a sweep: the ids collected, or the reason none were.
|
|
309
|
+
*
|
|
310
|
+
* Narrower than {@link CustomNodeSweepResult}, which also carries the rewritten package — the
|
|
311
|
+
* session has already installed that, and handing it back would invite a caller to install it
|
|
312
|
+
* twice.
|
|
313
|
+
*/
|
|
314
|
+
type CustomNodeSweepOutcome = {
|
|
315
|
+
readonly ok: true;
|
|
316
|
+
readonly removed: readonly string[];
|
|
317
|
+
} | {
|
|
318
|
+
readonly ok: false;
|
|
319
|
+
readonly reason: string;
|
|
320
|
+
};
|
|
321
|
+
|
|
322
|
+
export { MAX_CUSTOM_NODE_LABEL_LENGTH as M, NO_TRACKING_SETTINGS as N, MAX_CUSTOM_NODE_PAYLOAD_LENGTH as g, buildBookmarkIndex as h, customNodePayloadsByControl as i, customNodePayloadsOf as j, deobfuscateFont as k, ensureListDefinition as l, ensureNumberingLevel as m, insertCustomNodeWrite as n, readTrackingSettings as o, removeCustomNodeWrite as p, readEmbeddedFonts as r, sweepCustomNodePayloads as s };
|
|
323
|
+
export type { BookmarkIndex as B, CustomNodeWriteResult as C, DocumentTrackingSettings as D, EmbeddedFont as E, FontStyleKey as F, InsertCustomNodeWrite as I, ListKind as L, ReadEmbeddedFontsOptions as R, CustomNodeSweepOutcome as a, BookmarkAnchor as b, CustomNodePayloadRead as c, CustomNodePayloadWrite as d, CustomNodeSweepResult as e, CustomNodeWriteRejection as f };
|