@docx-editor.dev/core 2.31.0 → 2.33.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +25 -1
- package/THIRD_PARTY_NOTICES.md +1 -0
- package/dist/automation.cjs +1 -1
- package/dist/automation.d.ts +16 -54
- package/dist/automation.js +1 -1
- package/dist/binding.cjs +1 -1
- package/dist/binding.d.ts +17 -15
- package/dist/binding.js +1 -1
- package/dist/{chrome-print-BWvaVEhD.d.ts → chrome-print-CrPI9ZQc.d.ts} +128 -38
- package/dist/chunk-23MKR33J.js +4 -0
- package/dist/chunk-2CWQY27B.cjs +1 -0
- package/dist/chunk-2DEY5NUC.cjs +32 -0
- package/dist/chunk-2DR4TH6B.js +1 -0
- package/dist/chunk-2F2UEAE2.js +2 -0
- package/dist/chunk-2GPGAFOJ.cjs +5 -0
- package/dist/chunk-ALD626VU.cjs +2 -0
- package/dist/chunk-AU33YWEJ.js +236 -0
- package/dist/chunk-AXU63LYW.cjs +1 -0
- package/dist/chunk-CM5VZRBV.js +32 -0
- package/dist/chunk-D7FAFFTN.js +1 -0
- package/dist/chunk-DYUVJNDD.cjs +1 -0
- package/dist/chunk-ESYUKD5D.js +2 -0
- package/dist/chunk-F7TGQMVR.js +5 -0
- package/dist/chunk-FLW7KIQX.js +30 -0
- package/dist/chunk-JG4A6W6I.js +7 -0
- package/dist/chunk-JNGLSBPH.js +2 -0
- package/dist/chunk-KE6ZWRIY.cjs +236 -0
- package/dist/chunk-L3YXJDPX.js +1 -0
- package/dist/chunk-LI42N7OW.cjs +4 -0
- package/dist/chunk-PLKDS4JT.js +1 -0
- package/dist/chunk-PXMTQ73F.cjs +2 -0
- package/dist/chunk-R4R3AAE4.js +1 -0
- package/dist/chunk-RFUNFTGV.cjs +1 -0
- package/dist/chunk-SVM6PGMS.js +3 -0
- package/dist/chunk-SZURLHR3.cjs +3 -0
- package/dist/chunk-UYCGCVZ2.cjs +1 -0
- package/dist/chunk-WN7ICTA5.js +1 -0
- package/dist/chunk-X34QRAUU.cjs +1 -0
- package/dist/chunk-XNBYG4XJ.cjs +30 -0
- package/dist/chunk-ZDFJW5XS.cjs +2 -0
- package/dist/chunk-ZWO4JHNN.cjs +7 -0
- package/dist/collaboration/replication.cjs +1 -1
- package/dist/collaboration/replication.d.ts +29 -4
- package/dist/collaboration/replication.js +1 -1
- package/dist/collaboration.cjs +1 -1
- package/dist/collaboration.d.ts +5 -5
- package/dist/collaboration.js +1 -1
- package/dist/contracts/document.d.ts +3 -3
- package/dist/contracts/editor.d.ts +13 -9
- package/dist/contracts/interaction.d.ts +2 -2
- package/dist/contracts/modules.d.ts +15 -12
- package/dist/contracts/types.d.ts +135 -2
- package/dist/{custom-node-writes-TeUvMP13.d.ts → custom-node-writes-AqY5KpVx.d.ts} +7 -2
- package/dist/diagnostic-context-CuzhOX0g.d.ts +98 -0
- package/dist/{diagnostic-hints-C9JlLz1L.d.ts → diagnostic-hints-BtCaCqQC.d.ts} +4 -4
- package/dist/{document-protection-C8x3P2J6.d.ts → document-protection-BvbpSXbQ.d.ts} +1 -1
- package/dist/drawing-graphic-kind-CXYGYbB3.d.ts +324 -0
- package/dist/drawing-preview-package-B9lSLRg4.d.ts +115 -0
- package/dist/{editor-B2ShlO23.d.ts → editor-B7OOAAie.d.ts} +181 -244
- package/dist/editor-fonts-D_-vjuJi.d.ts +53 -0
- package/dist/{editor-scope-C7ke1KJG.d.ts → editor-scope-CA6egMaK.d.ts} +6 -2
- package/dist/editor.cjs +1 -1
- package/dist/editor.css +4 -4
- package/dist/editor.d.ts +259 -31
- package/dist/editor.js +1 -1
- package/dist/export.cjs +2 -2
- package/dist/export.d.ts +48 -19
- package/dist/export.js +2 -2
- package/dist/{failure-NS2lsya4.d.ts → failure-6KGFrDO9.d.ts} +1 -1
- package/dist/{font-resolver-CWh40DYp.d.ts → font-resolver-Bm9XqTNO.d.ts} +15 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +43 -26
- package/dist/index.js +1 -1
- package/dist/{layout-shaping-CWS3j0Xr.d.ts → layout-shaping-Ci_BTnSU.d.ts} +1 -1
- package/dist/layout.cjs +1 -1
- package/dist/layout.d.ts +181 -99
- package/dist/layout.js +1 -1
- package/dist/metafile-drawing-DtMFyMKq.d.ts +107 -0
- package/dist/{note-properties-QsKh24sM.d.ts → note-properties-DCIJUKIy.d.ts} +1 -1
- package/dist/output.cjs +1 -1
- package/dist/output.d.ts +11 -7
- package/dist/output.js +1 -1
- package/dist/{protocol-COZJUKUY.d.ts → protocol-Cp_QzVxS.d.ts} +75 -5
- package/dist/{review-paragraph-order-C_QbCKcH.d.ts → review-paragraph-order-BJQ43_r0.d.ts} +1 -1
- package/dist/revision-projection-OVusTS77.d.ts +258 -0
- package/dist/{semantic-cell-selection-Cub9FDa8.d.ts → semantic-cell-selection-CoI5hHBm.d.ts} +2 -2
- package/dist/{semantic-interaction-dApRIYpt.d.ts → semantic-interaction-BbA4dgEo.d.ts} +1 -1
- package/dist/{semantic-paint-DLzA8sjP.d.ts → semantic-paint-B5JcIv9c.d.ts} +19 -9
- package/dist/{semantic-record-queries-3yp9o11g.d.ts → semantic-record-queries-DnO8J5_j.d.ts} +1 -1
- package/dist/{semantic-records-B-akgRch.d.ts → semantic-records-DoK0lNjS.d.ts} +439 -418
- package/dist/store.cjs +1 -1
- package/dist/store.d.ts +511 -20
- package/dist/store.js +1 -1
- package/dist/{types-barrel-CkF2JbU4.d.ts → tree-op-types-Df4oY2u4.d.ts} +1081 -524
- package/dist/{tree-package-store-B8l8DX3Z.d.ts → tree-package-store-DXhX1PE-.d.ts} +8 -3
- package/dist/{tree-session-contract-DeLRqohz.d.ts → tree-session-contract-CF2625mv.d.ts} +5 -5
- package/dist/unsupported-elements-CUojsaCr.d.ts +23 -0
- package/docs/accept-reject-without-scrolling.md +95 -0
- package/docs/comment-on-found-text.md +72 -0
- package/docs/custom-review-cards.md +178 -0
- package/docs/highlight-ranges.md +48 -0
- package/docs/index.md +36 -0
- package/docs/propose-rewrite.md +247 -0
- package/docs/tracked-replacement.md +68 -0
- package/licenses/ECMA-376.md +29 -0
- package/package.json +3 -2
- package/dist/bookmark-names-DDuAra_V.d.ts +0 -37
- package/dist/chunk-243W4WW2.cjs +0 -2
- package/dist/chunk-2E2RPEKX.js +0 -1
- package/dist/chunk-4S24UOPG.js +0 -30
- package/dist/chunk-5JPIEN54.cjs +0 -3
- package/dist/chunk-5SO5QDMV.cjs +0 -2
- package/dist/chunk-6IDOVU6L.cjs +0 -1
- package/dist/chunk-6JIJOZDW.js +0 -1
- package/dist/chunk-BTQKU64Q.cjs +0 -1
- package/dist/chunk-DBOOTED4.cjs +0 -30
- package/dist/chunk-EOTAXOJY.cjs +0 -5
- package/dist/chunk-FDAKJ2SJ.cjs +0 -30
- package/dist/chunk-FNNOJNGY.js +0 -3
- package/dist/chunk-FT33HRZP.js +0 -5
- package/dist/chunk-HC6YNKUI.cjs +0 -1
- package/dist/chunk-HZ66UCIS.js +0 -2
- package/dist/chunk-IBRBNT37.cjs +0 -1
- package/dist/chunk-IVIN7X43.js +0 -30
- package/dist/chunk-LZY6B6IV.js +0 -4
- package/dist/chunk-MOYYRVFV.cjs +0 -2
- package/dist/chunk-N6B3BXCL.js +0 -1
- package/dist/chunk-Q5K2GGNG.js +0 -2
- package/dist/chunk-R2XINWVE.js +0 -7
- package/dist/chunk-SUEXVBPR.js +0 -1
- package/dist/chunk-T2QQHG5C.js +0 -18
- package/dist/chunk-VWIJKH4A.js +0 -1
- package/dist/chunk-WO4V6PNS.cjs +0 -18
- package/dist/chunk-XMJKFURD.cjs +0 -4
- package/dist/chunk-XSTGE3NI.cjs +0 -1
- package/dist/chunk-YQWMI6J5.cjs +0 -7
- package/dist/chunk-ZCJS7D7S.js +0 -2
- package/dist/diagnostic-context-DJ0P1uZE.d.ts +0 -31
- package/dist/headless-document-view-qOpaCF82.d.ts +0 -143
- package/dist/omml-equation-BsLAa2lX.d.ts +0 -115
|
@@ -0,0 +1,324 @@
|
|
|
1
|
+
import { aG as OoxmlNodeId, ax as OoxmlGenericElementNode, a4 as OoxmlNode, a5 as OoxmlPackage, O as OoxmlPart, av as OoxmlElement, aA as OoxmlPackageRejection } from './tree-op-types-Df4oY2u4.js';
|
|
2
|
+
import { e as HeaderFooterParts, f as HeaderFooterSectionResolution, T as TreePackageStore } from './tree-package-store-DXhX1PE-.js';
|
|
3
|
+
|
|
4
|
+
/** Office Math Markup Language namespace. */
|
|
5
|
+
declare const OFFICE_MATH_NAMESPACE_URI = "http://schemas.openxmlformats.org/officeDocument/2006/math";
|
|
6
|
+
declare const DEFAULT_OMML_LIMITS: Readonly<{
|
|
7
|
+
maxDepth: 24;
|
|
8
|
+
maxNodes: 256;
|
|
9
|
+
maxTextLength: 512;
|
|
10
|
+
}>;
|
|
11
|
+
/** Shared work limits for untrusted OMML and linear-math input. */
|
|
12
|
+
interface OmmlLimits {
|
|
13
|
+
readonly maxDepth?: number;
|
|
14
|
+
readonly maxNodes?: number;
|
|
15
|
+
readonly maxTextLength?: number;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Marks a structure whose property element carries `m:ctrlPr` operator run formatting that
|
|
19
|
+
* compact replacement cannot reproduce.
|
|
20
|
+
*
|
|
21
|
+
* The source keeps those properties verbatim. Layout draws the operator glyphs with the
|
|
22
|
+
* default math formatting. When every `m:ctrlPr` of the equation holds only default
|
|
23
|
+
* formatting, no structure carries this mark: compact replacement writes the same control
|
|
24
|
+
* properties back on each structure it emits.
|
|
25
|
+
*/
|
|
26
|
+
interface EquationControlSource {
|
|
27
|
+
/** The structure carries non-default `m:ctrlPr` properties, so compact replacement refuses it. */
|
|
28
|
+
readonly controlProperties?: true;
|
|
29
|
+
}
|
|
30
|
+
type EquationExpression = {
|
|
31
|
+
readonly kind: 'row';
|
|
32
|
+
readonly items: readonly EquationExpression[];
|
|
33
|
+
} | {
|
|
34
|
+
readonly kind: 'text';
|
|
35
|
+
readonly value: string;
|
|
36
|
+
readonly format?: {
|
|
37
|
+
readonly fontFamily?: string;
|
|
38
|
+
readonly bold?: boolean;
|
|
39
|
+
readonly italic?: boolean;
|
|
40
|
+
readonly literal?: boolean;
|
|
41
|
+
readonly normalText?: boolean;
|
|
42
|
+
readonly mathStyle?: 'p' | 'b' | 'i' | 'bi';
|
|
43
|
+
};
|
|
44
|
+
} | ({
|
|
45
|
+
readonly kind: 'bar';
|
|
46
|
+
readonly body: EquationExpression;
|
|
47
|
+
readonly position: 'top' | 'bottom';
|
|
48
|
+
} & EquationControlSource) | ({
|
|
49
|
+
readonly kind: 'fraction';
|
|
50
|
+
readonly numerator: EquationExpression;
|
|
51
|
+
readonly denominator: EquationExpression;
|
|
52
|
+
} & EquationControlSource) | ({
|
|
53
|
+
readonly kind: 'radical';
|
|
54
|
+
readonly radicand: EquationExpression;
|
|
55
|
+
readonly degree?: EquationExpression;
|
|
56
|
+
} & EquationControlSource) | ({
|
|
57
|
+
readonly kind: 'script';
|
|
58
|
+
readonly base: EquationExpression;
|
|
59
|
+
readonly subscript?: EquationExpression;
|
|
60
|
+
readonly superscript?: EquationExpression;
|
|
61
|
+
} & EquationControlSource) | ({
|
|
62
|
+
readonly kind: 'nary';
|
|
63
|
+
readonly operator: string;
|
|
64
|
+
readonly body: EquationExpression;
|
|
65
|
+
readonly lowerLimit?: EquationExpression;
|
|
66
|
+
readonly upperLimit?: EquationExpression;
|
|
67
|
+
} & EquationControlSource) | {
|
|
68
|
+
readonly kind: 'fallback';
|
|
69
|
+
readonly text: string;
|
|
70
|
+
};
|
|
71
|
+
interface OmmlEquationProjection {
|
|
72
|
+
readonly sourceNodeId: OoxmlNodeId;
|
|
73
|
+
readonly expression: EquationExpression;
|
|
74
|
+
readonly fallbackText: string;
|
|
75
|
+
readonly truncated: boolean;
|
|
76
|
+
readonly visitedNodes: number;
|
|
77
|
+
/**
|
|
78
|
+
* The font size, in points, that every run of the equation shares through default run
|
|
79
|
+
* properties (`w:sz`). Absent, the equation takes the size of the surrounding text.
|
|
80
|
+
*/
|
|
81
|
+
readonly fontSizePt?: number;
|
|
82
|
+
}
|
|
83
|
+
type LinearMathRejection = 'empty' | 'invalid-syntax' | 'invalid-xml-text' | 'depth-limit' | 'node-limit' | 'text-limit';
|
|
84
|
+
type LinearMathParseResult = {
|
|
85
|
+
readonly ok: true;
|
|
86
|
+
readonly expression: EquationExpression;
|
|
87
|
+
} | {
|
|
88
|
+
readonly ok: false;
|
|
89
|
+
readonly reason: LinearMathRejection;
|
|
90
|
+
};
|
|
91
|
+
type LinearMathOmmlResult = {
|
|
92
|
+
readonly ok: true;
|
|
93
|
+
readonly expression: EquationExpression;
|
|
94
|
+
readonly equation: OoxmlGenericElementNode;
|
|
95
|
+
} | {
|
|
96
|
+
readonly ok: false;
|
|
97
|
+
readonly reason: LinearMathRejection;
|
|
98
|
+
};
|
|
99
|
+
/**
|
|
100
|
+
* Project one preserved `m:oMath` generic node without changing its canonical source.
|
|
101
|
+
*/
|
|
102
|
+
declare function projectOmmlEquation(node: OoxmlNode, limits?: OmmlLimits): OmmlEquationProjection | null;
|
|
103
|
+
/** Parse the supported compact linear-math subset with fixed work limits. */
|
|
104
|
+
declare function parseLinearMath(input: string, limits?: OmmlLimits): LinearMathParseResult;
|
|
105
|
+
/**
|
|
106
|
+
* Convert a projected expression into reversible compact syntax.
|
|
107
|
+
*
|
|
108
|
+
* Returns an empty string when parsing the result would change the projected meaning.
|
|
109
|
+
*/
|
|
110
|
+
declare function equationExpressionToLinearMath(expression: EquationExpression): string;
|
|
111
|
+
type NextNodeId = () => string;
|
|
112
|
+
/** Parse compact linear math and generate fresh canonical OMML in one bounded operation. */
|
|
113
|
+
declare function linearMathToOmml(input: string, nextId: NextNodeId, limits?: OmmlLimits): LinearMathOmmlResult;
|
|
114
|
+
|
|
115
|
+
/** The package with a hyperlink relationship guaranteed present, and that relationship's id. */
|
|
116
|
+
interface EnsuredHyperlinkRelationship {
|
|
117
|
+
readonly pkg: OoxmlPackage;
|
|
118
|
+
readonly relationshipId: string;
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* The target this engine would write for `url`, or null when it would write none.
|
|
122
|
+
*
|
|
123
|
+
* The VALIDATION half of {@link ensureHyperlinkRelationship}, exported so a caller that must decide
|
|
124
|
+
* "would this be authored?" before it is allowed to change the package can ask without changing it.
|
|
125
|
+
* A relationship outlives a refusal — it lives beside the trees, outside the undo stack — so a
|
|
126
|
+
* caller planning a batch that may yet be refused has to ask this and mint later.
|
|
127
|
+
*
|
|
128
|
+
* Same rules, one implementation: `sanitizeHref`'s allowlist, a bound on the length, XML-writable
|
|
129
|
+
* text, and the absolute-URI gate the READ side applies. There is no legitimate reason for this
|
|
130
|
+
* engine to author a scheme it would refuse to open.
|
|
131
|
+
*/
|
|
132
|
+
declare function authorableHyperlinkTarget(url: string): string | null;
|
|
133
|
+
/**
|
|
134
|
+
* The external hyperlink relationship for `url` on `ownerPart` (default: main document),
|
|
135
|
+
* reusing an existing one with the same target, or `null` when the URL is not something to
|
|
136
|
+
* write.
|
|
137
|
+
*
|
|
138
|
+
* REUSE IS BY EXACT TARGET, matching Word: linking twice to the same address produces one
|
|
139
|
+
* relationship. It is safe because a hyperlink relationship carries nothing but its target —
|
|
140
|
+
* two links sharing one are indistinguishable from two links with identical targets, and
|
|
141
|
+
* retargeting one always mints rather than rewriting (see the edit op).
|
|
142
|
+
*
|
|
143
|
+
* Ownership follows the story that holds the `w:hyperlink`: a header/footer or notes part
|
|
144
|
+
* mints into that part's `.rels`, never into `document.xml.rels`. Passing an owner the
|
|
145
|
+
* package does not declare fails closed (`null`) so a scoped insert cannot leave a stray
|
|
146
|
+
* body relationship behind.
|
|
147
|
+
*
|
|
148
|
+
* The URL is refused unless `sanitizeHref` admits it. Storing a `javascript:` target that a
|
|
149
|
+
* FILE authored is required — round-tripping never rewrites a document — but AUTHORING one
|
|
150
|
+
* here is not: there is no legitimate reason for this engine to write a scheme it would then
|
|
151
|
+
* refuse to open, and writing it would hand the next reader a live target this reader made.
|
|
152
|
+
*/
|
|
153
|
+
declare function ensureHyperlinkRelationship(pkg: OoxmlPackage, url: string, ownerPart?: string): EnsuredHyperlinkRelationship | null;
|
|
154
|
+
/**
|
|
155
|
+
* What a part's relationships answer for one `r:id`, over both maps.
|
|
156
|
+
*
|
|
157
|
+
* `relationships` holds the internal records and `externalTargets` the external ones, so a
|
|
158
|
+
* resolver reading only the first sees every hyperlink as dangling.
|
|
159
|
+
*/
|
|
160
|
+
declare function relationshipTargetIn(pkg: OoxmlPackage, ownerPart: string, relationshipId: string): {
|
|
161
|
+
readonly target: string;
|
|
162
|
+
readonly external: boolean;
|
|
163
|
+
readonly sinkSafe?: boolean;
|
|
164
|
+
} | null;
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* The document metadata Word's document-property fields render.
|
|
168
|
+
*
|
|
169
|
+
* Every member is optional: an absent part, an absent element, or an empty value all read as
|
|
170
|
+
* `undefined`, and a field over a missing property paints nothing. Keys are engine-internal
|
|
171
|
+
* names; the field → property mapping (`TITLE` → `title`, `AUTHOR` → `creator`, …) lives in
|
|
172
|
+
* `layout/field-doc-property.ts`.
|
|
173
|
+
*/
|
|
174
|
+
interface DocumentProperties {
|
|
175
|
+
/** `dc:title` — TITLE. */
|
|
176
|
+
readonly title?: string;
|
|
177
|
+
/** `dc:creator` — AUTHOR. */
|
|
178
|
+
readonly creator?: string;
|
|
179
|
+
/** `dc:subject` — SUBJECT. */
|
|
180
|
+
readonly subject?: string;
|
|
181
|
+
/** `cp:keywords` — KEYWORDS. */
|
|
182
|
+
readonly keywords?: string;
|
|
183
|
+
/** `cp:lastModifiedBy` — LASTSAVEDBY. */
|
|
184
|
+
readonly lastModifiedBy?: string;
|
|
185
|
+
/** `dc:description` — COMMENTS. */
|
|
186
|
+
readonly description?: string;
|
|
187
|
+
/** `Company` from `docProps/app.xml`. No field maps to it yet; carried for completeness. */
|
|
188
|
+
readonly company?: string;
|
|
189
|
+
/** `Manager` from `docProps/app.xml`. No field maps to it yet; carried for completeness. */
|
|
190
|
+
readonly manager?: string;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
/** Theme typefaces already validated for use by layout. @public */
|
|
194
|
+
interface HeadlessThemeFonts {
|
|
195
|
+
readonly major: string | null;
|
|
196
|
+
readonly minor: string | null;
|
|
197
|
+
/** East Asian heading face; optional for backwards-compatible custom views. */
|
|
198
|
+
readonly majorEastAsia?: string | null;
|
|
199
|
+
/** East Asian body face; optional for backwards-compatible custom views. */
|
|
200
|
+
readonly minorEastAsia?: string | null;
|
|
201
|
+
/** Complex-script heading and body theme faces. */
|
|
202
|
+
readonly majorBidi?: string | null;
|
|
203
|
+
readonly minorBidi?: string | null;
|
|
204
|
+
/** Language-specific theme faces, keyed by ISO 15924 script. */
|
|
205
|
+
readonly majorSupplemental?: Readonly<Record<string, string>>;
|
|
206
|
+
readonly minorSupplemental?: Readonly<Record<string, string>>;
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* The read capabilities shared by browser layout, server export, and future renderers.
|
|
210
|
+
*
|
|
211
|
+
* It deliberately exposes resolved package facts rather than a binding or editor session.
|
|
212
|
+
* An exporter can therefore consume the live document without importing ProseMirror or a DOM.
|
|
213
|
+
* @public
|
|
214
|
+
*/
|
|
215
|
+
interface HeadlessDocumentView {
|
|
216
|
+
part(): OoxmlPart;
|
|
217
|
+
currentPackage(): OoxmlPackage;
|
|
218
|
+
packageRevision(): number;
|
|
219
|
+
stylesRoot(): OoxmlElement | null;
|
|
220
|
+
numberingRoot(): OoxmlElement | null;
|
|
221
|
+
settingsRoot(): OoxmlElement | null;
|
|
222
|
+
documentThemeFonts(): HeadlessThemeFonts;
|
|
223
|
+
documentProperties(): DocumentProperties;
|
|
224
|
+
headerFooterPartsBySection(): readonly HeaderFooterParts[];
|
|
225
|
+
/**
|
|
226
|
+
* Occurrence-specific relationship metadata for header/footer stories.
|
|
227
|
+
*
|
|
228
|
+
* Optional for backwards-compatible host views; core derives it from `currentPackage()` when
|
|
229
|
+
* absent. Hosts with a working-tree overlay should expose their canonical resolution directly.
|
|
230
|
+
*/
|
|
231
|
+
headerFooterResolutionBySection?(): readonly HeaderFooterSectionResolution[];
|
|
232
|
+
relationshipTarget(relationshipId: string): ReturnType<typeof relationshipTargetIn>;
|
|
233
|
+
}
|
|
234
|
+
/** A bad package is data, not an exceptional control path. @public */
|
|
235
|
+
type HeadlessDocumentRejection = OoxmlPackageRejection | 'no-main-document-tree';
|
|
236
|
+
/** Result of opening untrusted DOCX bytes for neutral layout. @public */
|
|
237
|
+
type OpenHeadlessDocumentResult = {
|
|
238
|
+
readonly ok: true;
|
|
239
|
+
readonly view: HeadlessDocumentView;
|
|
240
|
+
} | {
|
|
241
|
+
readonly ok: false;
|
|
242
|
+
readonly reason: HeadlessDocumentRejection;
|
|
243
|
+
readonly detail?: string;
|
|
244
|
+
};
|
|
245
|
+
/**
|
|
246
|
+
* Open DOCX bytes through the bounded store reader and expose only neutral layout reads.
|
|
247
|
+
* @public
|
|
248
|
+
*/
|
|
249
|
+
declare function openHeadlessDocument(bytes: Uint8Array): OpenHeadlessDocumentResult;
|
|
250
|
+
/** Internal live read view over the canonical store, preserving node identities for field pagination. */
|
|
251
|
+
declare function headlessViewOfStore(store: TreePackageStore): HeadlessDocumentView;
|
|
252
|
+
|
|
253
|
+
/**
|
|
254
|
+
* A drawing feature that the editor does not show as authored. Each code means:
|
|
255
|
+
*
|
|
256
|
+
* - `unsupported-effect`: the editor ignores an explicit effect, such as `a:blur`, `a:duotone`,
|
|
257
|
+
* or `a14:imgProps`. The drawing renders without it.
|
|
258
|
+
* - `renderer-required`: an optional effect, such as `a:glow`, needs the drawing module:
|
|
259
|
+
* `drawingModule()` or `installDrawing()` from `@docx-editor.dev/pro/drawing`. It appears
|
|
260
|
+
* only while that module is not installed in the current process, for occurrences and
|
|
261
|
+
* reports alike.
|
|
262
|
+
* - `unverified-3d`: the drawing has 3-D properties (`a:scene3d`, `a:sp3d`), which render flat.
|
|
263
|
+
* - `saved-fallback`: the editor shows the saved `mc:Fallback` content, not the main content.
|
|
264
|
+
* - `unplaced-drawing`: the drawing has no layout position, so the editor does not show it.
|
|
265
|
+
* - `inspection-limit`: a scan budget stopped the check, so the result is incomplete.
|
|
266
|
+
* - `projection-diagnostic`: the source is malformed or partly unusable. `detail` holds the
|
|
267
|
+
* diagnostic code, such as `invalid-geometry` or `resource-refused`.
|
|
268
|
+
*
|
|
269
|
+
* The check reads the drawing's own XML. It does not read chart or diagram parts, inherited
|
|
270
|
+
* theme effects, or image bytes, so an empty list does not prove full fidelity.
|
|
271
|
+
*
|
|
272
|
+
* @public
|
|
273
|
+
*/
|
|
274
|
+
interface DrawingSupportIssue {
|
|
275
|
+
/** The kind of limitation. The list in this type's description explains each code. */
|
|
276
|
+
readonly code: 'unsupported-effect' | 'renderer-required' | 'unverified-3d' | 'saved-fallback' | 'unplaced-drawing' | 'inspection-limit' | 'projection-diagnostic';
|
|
277
|
+
/**
|
|
278
|
+
* The source node with the feature: in the inspected package for a report, or in the
|
|
279
|
+
* editor's current document for an occurrence's `drawingIssues`.
|
|
280
|
+
*/
|
|
281
|
+
readonly nodeId: string;
|
|
282
|
+
/** The namespace of the node with the feature. */
|
|
283
|
+
readonly namespaceUri: string;
|
|
284
|
+
/** The local name of the node with the feature, such as `blur`. */
|
|
285
|
+
readonly localName: string;
|
|
286
|
+
/** The feature, such as `a:blur` or `mc:Fallback`, or the projection diagnostic code. */
|
|
287
|
+
readonly detail: string;
|
|
288
|
+
}
|
|
289
|
+
/**
|
|
290
|
+
* How completely the editor shows a drawing:
|
|
291
|
+
*
|
|
292
|
+
* - `native`: the editor renders the drawing and found no unsupported feature in its source.
|
|
293
|
+
* - `partial`: the editor renders the drawing, but without some features, or it shows a saved
|
|
294
|
+
* fallback. The issue list names the features.
|
|
295
|
+
* - `unrendered`: the editor shows a placeholder, or the drawing has no layout position.
|
|
296
|
+
*
|
|
297
|
+
* A drawing that the document itself hides is `native` or `partial`: the editor shows it as
|
|
298
|
+
* authored, which is not at all.
|
|
299
|
+
*
|
|
300
|
+
* Charts and SmartArt diagrams that the editor draws report `native`, because the check does
|
|
301
|
+
* not read their chart or diagram parts. Inherited theme effects and image bytes are not
|
|
302
|
+
* checked either.
|
|
303
|
+
*
|
|
304
|
+
* @public
|
|
305
|
+
*/
|
|
306
|
+
type DrawingSupport = 'native' | 'partial' | 'unrendered';
|
|
307
|
+
|
|
308
|
+
/**
|
|
309
|
+
* The kind of graphic a drawing holds. Note: `textbox` names every DrawingML shape, with or
|
|
310
|
+
* without text, and `shape` names only legacy VML drawings.
|
|
311
|
+
*
|
|
312
|
+
* Read from its source: `picture`, `chart` (a chart),
|
|
313
|
+
* `diagram` (SmartArt), `textbox` (a DrawingML shape, with or without text), `group` (a shape
|
|
314
|
+
* group), `canvas` (a drawing canvas), `shape` (a legacy VML drawing, such as WordArt), or
|
|
315
|
+
* `graphic` (any other graphic). It does not say whether the engine renders the graphic.
|
|
316
|
+
* The names match `placeholderGraphicKind`, which adds no `picture` and is set only for
|
|
317
|
+
* placeholders.
|
|
318
|
+
*
|
|
319
|
+
* @public
|
|
320
|
+
*/
|
|
321
|
+
type DrawingGraphicKind = 'picture' | 'chart' | 'diagram' | 'shape' | 'group' | 'textbox' | 'canvas' | 'graphic';
|
|
322
|
+
|
|
323
|
+
export { DEFAULT_OMML_LIMITS as e, OFFICE_MATH_NAMESPACE_URI as k, authorableHyperlinkTarget as n, ensureHyperlinkRelationship as o, equationExpressionToLinearMath as p, headlessViewOfStore as q, linearMathToOmml as r, openHeadlessDocument as s, parseLinearMath as t, projectOmmlEquation as u, relationshipTargetIn as v };
|
|
324
|
+
export type { DrawingGraphicKind as D, EnsuredHyperlinkRelationship as E, HeadlessDocumentView as H, LinearMathOmmlResult as L, OmmlEquationProjection as O, DrawingSupport as a, DrawingSupportIssue as b, DocumentProperties as c, HeadlessDocumentRejection as d, EquationControlSource as f, EquationExpression as g, HeadlessThemeFonts as h, LinearMathParseResult as i, LinearMathRejection as j, OmmlLimits as l, OpenHeadlessDocumentResult as m };
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { a5 as OoxmlPackage } from './tree-op-types-Df4oY2u4.js';
|
|
2
|
+
|
|
3
|
+
/** The longest name a bookmark is written with. */
|
|
4
|
+
declare const MAX_AUTHORED_BOOKMARK_NAME_LENGTH = 40;
|
|
5
|
+
/**
|
|
6
|
+
* Why a name cannot be written, or null when it can.
|
|
7
|
+
*
|
|
8
|
+
* - `empty`: no characters.
|
|
9
|
+
* - `tooLong`: more than {@link MAX_AUTHORED_BOOKMARK_NAME_LENGTH} characters.
|
|
10
|
+
* - `invalidStart`: the first character is not a letter or an underscore.
|
|
11
|
+
* - `invalidCharacter`: a later character is not a letter, a digit or an underscore.
|
|
12
|
+
*
|
|
13
|
+
* @public
|
|
14
|
+
*/
|
|
15
|
+
type BookmarkNameProblem = 'empty' | 'tooLong' | 'invalidStart' | 'invalidCharacter';
|
|
16
|
+
/**
|
|
17
|
+
* Check a name before it is written. Measured in code points, so a letter outside the Basic
|
|
18
|
+
* Multilingual Plane counts once.
|
|
19
|
+
*
|
|
20
|
+
* @public
|
|
21
|
+
*/
|
|
22
|
+
declare function bookmarkNameProblem(name: string): BookmarkNameProblem | null;
|
|
23
|
+
/**
|
|
24
|
+
* Whether a bookmark is hidden: its name starts with an underscore. Hidden bookmarks are the
|
|
25
|
+
* ones applications write for themselves, such as the targets of a table of contents.
|
|
26
|
+
*
|
|
27
|
+
* @public
|
|
28
|
+
*/
|
|
29
|
+
declare function isHiddenBookmarkName(name: string): boolean;
|
|
30
|
+
/**
|
|
31
|
+
* The key two names are compared by. Names are case-insensitive, so `Intro` and `intro`
|
|
32
|
+
* share a key.
|
|
33
|
+
*
|
|
34
|
+
* @public
|
|
35
|
+
*/
|
|
36
|
+
declare function bookmarkNameKey(name: string): string;
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Where a drawing is. Pass an `inspectDrawingSupport` entry or an editor occurrence as is.
|
|
40
|
+
*
|
|
41
|
+
* @public
|
|
42
|
+
*/
|
|
43
|
+
interface DrawingPreviewTarget {
|
|
44
|
+
/** The part that holds the drawing, such as `/word/document.xml`. */
|
|
45
|
+
readonly ownerPartName: string;
|
|
46
|
+
/**
|
|
47
|
+
* The drawing, its compatibility wrapper, or any node inside them, in the package you pass.
|
|
48
|
+
* Every node of one drawing gives the same package.
|
|
49
|
+
*/
|
|
50
|
+
readonly nodeId: string;
|
|
51
|
+
}
|
|
52
|
+
/** Caps for {@link createDrawingPreviewPackage}. @public */
|
|
53
|
+
interface DrawingPreviewPackageLimits {
|
|
54
|
+
/** Maximum number of copied parts. Defaults to 64. */
|
|
55
|
+
readonly maxParts?: number;
|
|
56
|
+
/** Maximum number of copied bytes. Defaults to 64 MiB. */
|
|
57
|
+
readonly maxBytes?: number;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* A preview package, or why it could not be built.
|
|
61
|
+
*
|
|
62
|
+
* - `drawing-not-found`: the target is not a drawing in the package.
|
|
63
|
+
* - `too-many-parts` or `too-large`: the drawing needs more than the limits allow.
|
|
64
|
+
*
|
|
65
|
+
* @public
|
|
66
|
+
*/
|
|
67
|
+
type DrawingPreviewPackageResult = {
|
|
68
|
+
readonly ok: true;
|
|
69
|
+
/**
|
|
70
|
+
* DOCX bytes with one paragraph that holds the drawing. The same drawing and document
|
|
71
|
+
* parts always give the same bytes, so a hash of them works as a cache key.
|
|
72
|
+
*/
|
|
73
|
+
readonly docx: Uint8Array;
|
|
74
|
+
/**
|
|
75
|
+
* True when the page has the drawing's size, so the first page is the preview image.
|
|
76
|
+
* False when the size is unknown, such as a legacy VML drawing without a width and height
|
|
77
|
+
* in its style. Then the page has the document's page size and no margins, and the
|
|
78
|
+
* drawing starts at its top left corner. With the occurrence's `element.bounds`, crop
|
|
79
|
+
* from (0, 0) to `bounds.width * dpi / 72` by `bounds.height * dpi / 72` pixels;
|
|
80
|
+
* `bounds.x` and `bounds.y` are page positions, not crop offsets. Send this flag and the
|
|
81
|
+
* `bounds` size to your renderer with the bytes.
|
|
82
|
+
* Without `bounds`, such as for a report entry, trim the white space instead.
|
|
83
|
+
*/
|
|
84
|
+
readonly pageFitsDrawing: boolean;
|
|
85
|
+
/** The package parts copied from the source document, for logging and caching. */
|
|
86
|
+
readonly copiedParts: readonly string[];
|
|
87
|
+
} | {
|
|
88
|
+
readonly ok: false;
|
|
89
|
+
readonly reason: 'drawing-not-found' | 'too-many-parts' | 'too-large';
|
|
90
|
+
};
|
|
91
|
+
/**
|
|
92
|
+
* Build a small DOCX that holds one drawing for an external renderer.
|
|
93
|
+
*
|
|
94
|
+
* Contents: one paragraph with the drawing, plus the chart and diagram parts, images, styles,
|
|
95
|
+
* theme, settings, and fonts it needs. Relationships to external targets, embedded objects,
|
|
96
|
+
* macros, and templates are dropped, so the package never points outside itself.
|
|
97
|
+
*
|
|
98
|
+
* Page: the first page is the preview. It has the drawing's size, including its effect
|
|
99
|
+
* extent, so it matches the occurrence's `bounds`, and it has no margins. A floating drawing
|
|
100
|
+
* is placed on the line, and a legacy VML drawing takes its size from its style. When the
|
|
101
|
+
* size is unknown, `pageFitsDrawing` is false; see that field for how to crop.
|
|
102
|
+
*
|
|
103
|
+
* Renderer: use one other than this library, whose own exporters show the same placeholder.
|
|
104
|
+
* The bytes come from the document, so run the renderer in a sandbox without network access,
|
|
105
|
+
* with time and memory limits.
|
|
106
|
+
*
|
|
107
|
+
* Pass the package that the target comes from: an `inspectDrawingSupport` entry with the
|
|
108
|
+
* parsed package it inspected, or an editor occurrence with the editor's current package.
|
|
109
|
+
*
|
|
110
|
+
* @public
|
|
111
|
+
*/
|
|
112
|
+
declare function createDrawingPreviewPackage(pkg: OoxmlPackage, target: DrawingPreviewTarget, limits?: DrawingPreviewPackageLimits): DrawingPreviewPackageResult;
|
|
113
|
+
|
|
114
|
+
export { MAX_AUTHORED_BOOKMARK_NAME_LENGTH as M, bookmarkNameKey as c, bookmarkNameProblem as d, createDrawingPreviewPackage as e, isHiddenBookmarkName as i };
|
|
115
|
+
export type { BookmarkNameProblem as B, DrawingPreviewPackageLimits as D, DrawingPreviewPackageResult as a, DrawingPreviewTarget as b };
|