@betteroffice/docx 0.0.4 → 0.2.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 +4 -7
- package/dist/chunk-47Q2FMFF.mjs +1 -0
- package/dist/chunk-5F6DLQZP.mjs +1 -0
- package/dist/chunk-6LQJAKOC.mjs +1 -0
- package/dist/chunk-ACGKK7IB.mjs +1 -0
- package/dist/{chunk-NTSSE5QK.mjs → chunk-AFMVSI4Z.mjs} +2 -2
- package/dist/chunk-GD4VNJ64.mjs +1 -0
- package/dist/{chunk-NJHOPXZW.mjs → chunk-HLDJMU3R.mjs} +1 -1
- package/dist/{chunk-YTILOUAA.mjs → chunk-JHJLG4I6.mjs} +1 -1
- package/dist/chunk-PGMXWI5X.mjs +1 -0
- package/dist/{chunk-NBSLB77E.mjs → chunk-WTFRNX5K.mjs} +1 -1
- package/dist/collaboration/index.d.mts +6 -6
- package/dist/{content-C3sTRz-u.d.mts → content-CvEtPl0c.d.mts} +124 -22
- package/dist/core.d.mts +8 -8
- package/dist/core.mjs +1 -1
- package/dist/{displayListQueries-DLzpvJV6.d.mts → displayListQueries-DF8F6fMl.d.mts} +87 -50
- package/dist/docx/index.d.mts +5 -5
- package/dist/docx/index.mjs +1 -1
- package/dist/editor/index.d.mts +21 -12
- package/dist/editor/index.mjs +1 -1
- package/dist/{fontLoader-CMH3bZ2Z.d.mts → fontLoader-b8eicJKV.d.mts} +1 -1
- package/dist/{formatting-BEkIBePP.d.mts → formatting-7zKCTu5a.d.mts} +11 -2
- package/dist/{frameDelta-B2kC6XiP.d.mts → frameDelta-pA4jrQ1G.d.mts} +16 -10
- package/dist/generated/edit/docx_edit_bg.wasm +0 -0
- package/dist/generated/layout/docx_layout_bg.wasm +0 -0
- package/dist/generated/opc/ooxml_opc_bg.wasm +0 -0
- package/dist/generated/parse/docx_parse_bg.wasm +0 -0
- package/dist/{index-2piKi4gO.d.mts → index-CHl2zLJ7.d.mts} +146 -77
- package/dist/layout/index.d.mts +40 -13
- package/dist/layout/index.mjs +1 -1
- package/dist/layout/pagination/index.d.mts +4 -4
- package/dist/layout/pagination/index.mjs +1 -1
- package/dist/layout/render/index.d.mts +33 -77
- package/dist/layout/render/index.mjs +1 -1
- package/dist/plugin-api/RenderedDomContext.d.mts +7 -7
- package/dist/plugin-api/index.d.mts +3 -3
- package/dist/plugin-api/resolveItemPositions.d.mts +3 -3
- package/dist/{rustDisplayList-B0M2eBkU.d.mts → rustDisplayList-BJqaN9tt.d.mts} +74 -50
- package/dist/{rustMeasureSource-D1KsQvVC.d.mts → rustMeasureSource-C0EZB055.d.mts} +5 -2
- package/dist/{selectiveSave-CVoajSKE.d.mts → selectiveSave-CRh-_Y_C.d.mts} +3 -3
- package/dist/styles/index.d.mts +6 -10
- package/dist/styles/index.mjs +1 -1
- package/dist/{styles-BK3Jecxs.d.mts → styles-7e-mq3c-.d.mts} +1 -1
- package/dist/types/content.d.mts +2 -2
- package/dist/types/document.d.mts +8 -7
- package/dist/{types-C1rv3KM-.d.mts → types-C4A8mWjU.d.mts} +44 -24
- package/dist/utils/comments.d.mts +2 -2
- package/dist/utils/index.d.mts +11 -13
- package/dist/utils/index.mjs +1 -1
- package/dist/utils/stylePreview.d.mts +2 -2
- package/dist/wasm-7SOSHNGP.mjs +1 -0
- package/dist/{wasm-JE7B3ROD.mjs → wasm-ZQAVP7P2.mjs} +1 -1
- package/dist/wasm-edit.d.mts +525 -185
- package/dist/wasm-edit.mjs +1 -1
- package/dist/wasm-layout.d.mts +31 -28
- package/dist/wasm-layout.mjs +1 -1
- package/dist/wasm-opc.mjs +1 -1
- package/dist/wasm-parse.d.mts +2 -1
- package/dist/wasm-parse.mjs +1 -1
- package/dist/yrs/index.d.mts +5 -5
- package/dist/yrs/index.mjs +1 -1
- package/dist/yrs/residentEngineWorker.mjs +1 -1
- package/package.json +19 -2
- package/dist/chunk-4V6MDZIK.mjs +0 -1
- package/dist/chunk-6KDV6AIL.mjs +0 -1
- package/dist/chunk-B4IR6YP4.mjs +0 -1
- package/dist/chunk-GGEGIQRK.mjs +0 -1
- package/dist/chunk-T4EZMUXM.mjs +0 -1
- package/dist/chunk-WBH3SXI6.mjs +0 -1
- package/dist/wasm-F2ETFAYL.mjs +0 -1
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { RenderedDomContext, PositionCoordinates } from './index.mjs';
|
|
2
|
-
import { D as DisplayListRect, a as DisplayListQueries } from '../displayListQueries-
|
|
2
|
+
import { D as DisplayListRect, a as DisplayListQueries } from '../displayListQueries-DF8F6fMl.mjs';
|
|
3
3
|
import '../types/document.mjs';
|
|
4
|
-
import '../content-
|
|
5
|
-
import '../formatting-
|
|
4
|
+
import '../content-CvEtPl0c.mjs';
|
|
5
|
+
import '../formatting-7zKCTu5a.mjs';
|
|
6
6
|
import '../docx/wrapTypes.mjs';
|
|
7
|
-
import '../styles-
|
|
8
|
-
import '../frameDelta-
|
|
9
|
-
import '../rustDisplayList-
|
|
10
|
-
import '../types-
|
|
7
|
+
import '../styles-7e-mq3c-.mjs';
|
|
8
|
+
import '../frameDelta-pA4jrQ1G.mjs';
|
|
9
|
+
import '../rustDisplayList-BJqaN9tt.mjs';
|
|
10
|
+
import '../types-C4A8mWjU.mjs';
|
|
11
11
|
import '../layout/pagination/index.mjs';
|
|
12
12
|
|
|
13
13
|
/**
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Document } from '../types/document.mjs';
|
|
2
|
-
import '../content-
|
|
3
|
-
import '../formatting-
|
|
2
|
+
import '../content-CvEtPl0c.mjs';
|
|
3
|
+
import '../formatting-7zKCTu5a.mjs';
|
|
4
4
|
import '../docx/wrapTypes.mjs';
|
|
5
|
-
import '../styles-
|
|
5
|
+
import '../styles-7e-mq3c-.mjs';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Framework-Agnostic Plugin Interface for the DOCX Editor
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { SidebarItem, RenderedDomContext } from './index.mjs';
|
|
2
2
|
import '../types/document.mjs';
|
|
3
|
-
import '../content-
|
|
4
|
-
import '../formatting-
|
|
3
|
+
import '../content-CvEtPl0c.mjs';
|
|
4
|
+
import '../formatting-7zKCTu5a.mjs';
|
|
5
5
|
import '../docx/wrapTypes.mjs';
|
|
6
|
-
import '../styles-
|
|
6
|
+
import '../styles-7e-mq3c-.mjs';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* Pure layout algorithm: given a list of sidebar items + their
|
|
@@ -1,27 +1,34 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { L as Layout } from './types-C4A8mWjU.mjs';
|
|
2
2
|
import { MeasuredBlock } from './layout/pagination/index.mjs';
|
|
3
|
-
import { D as DisplayList, R as RetainedFrame } from './frameDelta-
|
|
3
|
+
import { D as DisplayList, R as RetainedFrame } from './frameDelta-pA4jrQ1G.mjs';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
|
-
* JS seam to the Rust display-list builder
|
|
6
|
+
* JS seam to the Rust display-list builder.
|
|
7
7
|
*
|
|
8
|
-
* Marshals the
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
8
|
+
* Marshals the `{ measured, options, layout }` envelope across the wasm
|
|
9
|
+
* boundary and hands back a DisplayList. Every paint and geometry decision
|
|
10
|
+
* happens in Rust; this module is serialization glue and nothing else, so a
|
|
11
|
+
* failure here is terminal — the types below carry no second engine to fall
|
|
12
|
+
* back to, only a typed {@link RustDisplayListSourceError} naming the stage
|
|
13
|
+
* that failed.
|
|
12
14
|
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
15
|
+
* Two transports exist. {@link buildRustDisplayList} sends the whole envelope
|
|
16
|
+
* and parses a DisplayList back. {@link buildRustDisplayFrame} prefers an
|
|
17
|
+
* engine that already retains pagination: it sends only the display-level
|
|
18
|
+
* extras and receives a binary FrameDelta, which is applied to the previous
|
|
19
|
+
* frame so unchanged pages keep object identity — the invariant the query
|
|
20
|
+
* facade's page-delta adoption depends on. An engine without
|
|
21
|
+
* `buildDisplayListFrame` takes the full-JSON path instead.
|
|
16
22
|
*
|
|
17
|
-
*
|
|
23
|
+
* The wasm module is loaded lazily on first build, so the inlined binary costs
|
|
24
|
+
* nothing until a display list is actually requested.
|
|
18
25
|
*/
|
|
19
26
|
|
|
20
27
|
/**
|
|
21
28
|
* One header/footer part in the `headersFooters` envelope field: the measured
|
|
22
|
-
* blocks of the
|
|
23
|
-
*
|
|
24
|
-
*
|
|
29
|
+
* blocks of the header/footer document identified by `rId`, plus the band
|
|
30
|
+
* metrics the caller already computed. The builder passes the metrics through
|
|
31
|
+
* verbatim and re-derives none of them.
|
|
25
32
|
*/
|
|
26
33
|
interface DisplayListHfVariant {
|
|
27
34
|
rId: string;
|
|
@@ -41,14 +48,14 @@ interface DisplayListHfVariant {
|
|
|
41
48
|
* line width is measured ONCE at the field's fallback text ("1"), so without
|
|
42
49
|
* this the builder holds the same centered position on every page even though
|
|
43
50
|
* "Page 2 of 3"/"Page 10 of 12" have different widths. Omitted ⇒ the fields
|
|
44
|
-
* ride the char-distributed fallback width
|
|
51
|
+
* ride the char-distributed fallback width on every page.
|
|
45
52
|
*/
|
|
46
53
|
fieldWidths?: DisplayListFieldWidths[];
|
|
47
54
|
}
|
|
48
55
|
/**
|
|
49
56
|
* Per-page widths of one PAGE/NUMPAGES field run in an HF part. `pmStart` is the
|
|
50
|
-
* field run's position in the
|
|
51
|
-
* matches
|
|
57
|
+
* field run's position in the header/footer document, and is the key the Rust
|
|
58
|
+
* builder matches on. `fallbackWidth` is the width the measure baked into `line.width`
|
|
52
59
|
* (the field's fallback text); `perPage[i]` is the width of the field's resolved
|
|
53
60
|
* text on layout page index `i` (PAGE → that page's number, NUMPAGES → total).
|
|
54
61
|
*/
|
|
@@ -71,7 +78,7 @@ interface DisplayListHeadersFooters {
|
|
|
71
78
|
/** Page-level Word watermark, painted behind body/header/footer content. */
|
|
72
79
|
watermark?: DisplayListWatermark;
|
|
73
80
|
variants: DisplayListHfVariant[];
|
|
74
|
-
/** Stable section identity. Undefined
|
|
81
|
+
/** Stable section identity. Undefined ⇒ the envelope covers the whole document. */
|
|
75
82
|
sectionId?: string;
|
|
76
83
|
/** Zero-based section index. */
|
|
77
84
|
sectionIndex?: number;
|
|
@@ -158,7 +165,7 @@ interface DisplayListCommentThread {
|
|
|
158
165
|
}
|
|
159
166
|
/** The `{ measured, options, layout }` envelope the Rust builder consumes. */
|
|
160
167
|
interface DisplayListBuildInputs {
|
|
161
|
-
/** Serialization contract version. Undefined reads as
|
|
168
|
+
/** Serialization contract version. Undefined reads as version 0. */
|
|
162
169
|
contractVersion?: number;
|
|
163
170
|
measured: MeasuredBlock[];
|
|
164
171
|
options: unknown;
|
|
@@ -170,35 +177,42 @@ interface DisplayListBuildInputs {
|
|
|
170
177
|
* → measurement `FontStore` ids — the SAME map the measurement input carries.
|
|
171
178
|
* Present only under Rust measurement (the ids must belong to a populated
|
|
172
179
|
* store); its presence against that store is what gates GlyphRun emission.
|
|
173
|
-
* Omitted ⇒ every text run
|
|
174
|
-
*
|
|
180
|
+
* Omitted ⇒ every text run is emitted as a browser-measured
|
|
181
|
+
* `TextRunPrimitive` rather than a shaped `GlyphRun`.
|
|
175
182
|
*/
|
|
176
183
|
fontChains?: Record<string, number[]>;
|
|
177
184
|
/** Page/section note regions. Undefined = no note emission. */
|
|
178
185
|
noteAreas?: DisplayListNoteArea[];
|
|
179
186
|
/** Resolved comments suppressed from active tint. Undefined = none known. */
|
|
180
187
|
resolvedCommentIds?: number[];
|
|
181
|
-
/** Stable reviewer palette. Undefined
|
|
188
|
+
/** Stable reviewer palette. Undefined ⇒ the builder's built-in colors. */
|
|
182
189
|
commentAuthors?: DisplayListCommentAuthor[];
|
|
183
190
|
/** Per-comment thread metadata for a11y announcements. Undefined = none. */
|
|
184
191
|
commentThreads?: DisplayListCommentThread[];
|
|
185
192
|
}
|
|
186
|
-
/**
|
|
193
|
+
/**
|
|
194
|
+
* Minimal build surface, injectable so tests can fake the wasm module. Only
|
|
195
|
+
* `buildDisplayListJson` is required; the optional members are what an engine
|
|
196
|
+
* that retains its own pagination and display state additionally offers.
|
|
197
|
+
*/
|
|
187
198
|
interface RustDisplayListEngine {
|
|
188
199
|
buildDisplayListJson(input: string): string;
|
|
189
|
-
/**
|
|
200
|
+
/** Binary FrameDelta build; the stateless layout wasm does not offer it. */
|
|
190
201
|
buildDisplayListFrame?(input: string, expectedFrameEpoch: number): Uint8Array;
|
|
191
|
-
/**
|
|
202
|
+
/** Applies one keystroke and returns its frame, without a layout round trip. */
|
|
192
203
|
applyInput?(text: string, expectedFrameEpoch: number): Uint8Array;
|
|
193
204
|
displayHitTestRegionsJson?(pageIndex: number, x: number, y: number): string;
|
|
194
205
|
displayVerticalMoveJson?(position: number, direction: 'up' | 'down', goalX: number): string;
|
|
195
206
|
displayRangeRectsJson?(from: number, to: number): string;
|
|
196
|
-
displayRangeRectsRegionJson?(region:
|
|
207
|
+
displayRangeRectsRegionJson?(region: string, partId: string, from: number, to: number): string;
|
|
197
208
|
}
|
|
198
209
|
type RustDisplayListSourceErrorStage = 'load' | 'build' | 'parse' | 'decode' | 'apply';
|
|
199
210
|
interface RustDisplayFrameResult {
|
|
200
211
|
displayList: DisplayList;
|
|
201
|
-
/**
|
|
212
|
+
/**
|
|
213
|
+
* The retained frame to pass as `previous` on the next build. Null when the
|
|
214
|
+
* engine answered over full JSON, which retains nothing.
|
|
215
|
+
*/
|
|
202
216
|
frame: RetainedFrame | null;
|
|
203
217
|
transport: 'frame-delta-v1' | 'json';
|
|
204
218
|
}
|
|
@@ -215,30 +229,32 @@ declare class RustDisplayListSourceError extends Error {
|
|
|
215
229
|
* Query surface over an already-built display list, injectable so tests can
|
|
216
230
|
* fake the wasm module.
|
|
217
231
|
*
|
|
218
|
-
* The `*Json`
|
|
219
|
-
* side re-parses it per query
|
|
220
|
-
* session-handle members parse the list
|
|
221
|
-
* answer many queries by handle with no re-serialization,
|
|
222
|
-
* hit
|
|
223
|
-
*
|
|
224
|
-
*
|
|
225
|
-
* falls back to the `*Json` path when
|
|
232
|
+
* The required `*Json` members take the display-list JSON as an argument and
|
|
233
|
+
* the Rust side re-parses it per query, so callers should cache the string.
|
|
234
|
+
* The OPTIONAL session-handle members parse the list once (`openDisplayList` →
|
|
235
|
+
* a handle) and answer many queries by handle with no re-serialization,
|
|
236
|
+
* reusing the same hit and range logic so results are byte-identical. They are
|
|
237
|
+
* optional because the embedded wasm may not carry them; `hasDisplayListSession`
|
|
238
|
+
* and `hasRangeRectsRegion` report what is present, and
|
|
239
|
+
* `createDisplayListQueries` falls back to the `*Json` path when it is not.
|
|
226
240
|
*/
|
|
227
241
|
interface RustDisplayListQueryEngine {
|
|
228
|
-
/**
|
|
242
|
+
/**
|
|
243
|
+
* region-aware hit test → `{"region","rId"?,"noteId"?,"pos","target"}` or
|
|
244
|
+
* `"null"` JSON
|
|
245
|
+
*/
|
|
229
246
|
hitTestRegionsJson(displayList: string, pageIndex: number, x: number, y: number): string;
|
|
230
247
|
/** closest caret position on the adjacent visual line */
|
|
231
248
|
verticalMoveJson?(displayList: string, position: number, direction: 'up' | 'down', goalX: number): string;
|
|
232
|
-
/** body
|
|
249
|
+
/** body document range → JSON array of `{pageIndex,x,y,width,height}` rects */
|
|
233
250
|
rangeRectsJson(displayList: string, from: number, to: number): string;
|
|
234
251
|
/**
|
|
235
|
-
* Region-aware
|
|
236
|
-
* `
|
|
237
|
-
* (empty for body
|
|
238
|
-
*
|
|
239
|
-
* `[]` when absent (HF selection geometry stays a documented gap until then).
|
|
252
|
+
* Region-aware document range → JSON array of rects. `region` is a
|
|
253
|
+
* `DisplayListHitRegion` discriminant; `partId` names the instance — a
|
|
254
|
+
* header/footer part (empty for body, or to match any band of the kind) or a
|
|
255
|
+
* note id. Optional — the facade returns `[]` when it is absent.
|
|
240
256
|
*/
|
|
241
|
-
rangeRectsRegionJson?(displayList: string, region: string,
|
|
257
|
+
rangeRectsRegionJson?(displayList: string, region: string, partId: string, from: number, to: number): string;
|
|
242
258
|
/** true when the embedded wasm carries the region-aware range-rect exports */
|
|
243
259
|
hasRangeRectsRegion?(): boolean;
|
|
244
260
|
/** true when the embedded wasm carries the session-handle exports below */
|
|
@@ -255,10 +271,10 @@ interface RustDisplayListQueryEngine {
|
|
|
255
271
|
hitTestRegionsByHandle?(handle: number, pageIndex: number, x: number, y: number): string;
|
|
256
272
|
/** adjacent visual-line move against a stored display list */
|
|
257
273
|
verticalMoveByHandle?(handle: number, position: number, direction: 'up' | 'down', goalX: number): string;
|
|
258
|
-
/** body
|
|
274
|
+
/** body document range against a stored display list (by handle) */
|
|
259
275
|
rangeRectsByHandle?(handle: number, from: number, to: number): string;
|
|
260
|
-
/** region-aware
|
|
261
|
-
rangeRectsRegionByHandle?(handle: number, region: string,
|
|
276
|
+
/** region-aware document range against a stored display list (by handle) */
|
|
277
|
+
rangeRectsRegionByHandle?(handle: number, region: string, partId: string, from: number, to: number): string;
|
|
262
278
|
}
|
|
263
279
|
/**
|
|
264
280
|
* Lazily load the wasm query surface (hit-test + range-rects). Shares the
|
|
@@ -270,13 +286,21 @@ declare function loadRustDisplayListQueryEngine(): Promise<RustDisplayListQueryE
|
|
|
270
286
|
declare function encodeDisplayListFrameExtras(inputs: DisplayListBuildInputs): string;
|
|
271
287
|
/**
|
|
272
288
|
* Build a DisplayList for a computed layout through the Rust engine. Throws
|
|
273
|
-
*
|
|
274
|
-
*
|
|
289
|
+
* {@link RustDisplayListSourceError} tagged with the failing stage — `load`,
|
|
290
|
+
* `build` or `parse` — when the wasm module cannot be loaded, the builder
|
|
291
|
+
* rejects the input, or its output does not parse.
|
|
275
292
|
*/
|
|
276
293
|
declare function buildRustDisplayList(inputs: DisplayListBuildInputs, engine?: RustDisplayListEngine): Promise<DisplayList>;
|
|
277
294
|
/**
|
|
278
|
-
*
|
|
279
|
-
*
|
|
295
|
+
* Build one display frame. An engine that retains pagination returns a binary
|
|
296
|
+
* FrameDelta, decoded and applied on top of `previous` so unchanged pages keep
|
|
297
|
+
* object identity; `previous` also supplies the frame epoch the engine checks
|
|
298
|
+
* before sending a delta rather than a full frame. An engine without
|
|
299
|
+
* `buildDisplayListFrame` takes the full-JSON path, and its result carries
|
|
300
|
+
* `frame: null` and `transport: 'json'`.
|
|
301
|
+
*
|
|
302
|
+
* Throws {@link RustDisplayListSourceError} tagged with the failing stage:
|
|
303
|
+
* `load`, `build`, `decode` or `apply`.
|
|
280
304
|
*/
|
|
281
305
|
declare function buildRustDisplayFrame(inputs: DisplayListBuildInputs, engine?: RustDisplayListEngine, previous?: RetainedFrame | null): Promise<RustDisplayFrameResult>;
|
|
282
306
|
|
|
@@ -32,7 +32,7 @@ interface BundledFontProvider {
|
|
|
32
32
|
* The always-available last-resort base face (broad-coverage Latin —
|
|
33
33
|
* Liberation Sans/Serif per serif-ness). Unlike {@link
|
|
34
34
|
* BundledFontProvider.resolve}, a conforming provider (e.g.
|
|
35
|
-
* `@betteroffice/
|
|
35
|
+
* `@betteroffice/fonts`'s `resolveLastResortFace`) returns a loader for
|
|
36
36
|
* EVERY family, so the chain this registry builds is guaranteed non-empty
|
|
37
37
|
* and a run never routes to the browser measurer for want of font bytes. The
|
|
38
38
|
* face's metrics are the base font's, not the requested family's — the
|
|
@@ -66,6 +66,8 @@ interface EmbeddedFaceInput {
|
|
|
66
66
|
/** Whether the source face was subsetted (`w:subsetted`). */
|
|
67
67
|
subsetted: boolean;
|
|
68
68
|
}
|
|
69
|
+
/** A provider or async factory; `undefined` means no bundled bytes. @public */
|
|
70
|
+
type BundledFontProviderSource = BundledFontProvider | (() => Promise<BundledFontProvider | undefined>);
|
|
69
71
|
|
|
70
72
|
interface RustTextEngine {
|
|
71
73
|
registerFont(bytes: Uint8Array): number;
|
|
@@ -98,9 +100,10 @@ interface RustMeasureSource {
|
|
|
98
100
|
clear(): void;
|
|
99
101
|
}
|
|
100
102
|
declare function getRustTextEngine(): Promise<RustTextEngine>;
|
|
103
|
+
/** Builds a source with an explicit provider or the optional default package. */
|
|
101
104
|
declare function createRustMeasureSource(options: {
|
|
102
105
|
engine: RustTextEngine;
|
|
103
106
|
bundled?: BundledFontProvider;
|
|
104
107
|
}): RustMeasureSource;
|
|
105
108
|
|
|
106
|
-
export { type BundledFontProvider as B, type EmbeddedFaceInput as E, type FontScript as F, type ResidentMeasurementConfig as R, type
|
|
109
|
+
export { type BundledFontProvider as B, type EmbeddedFaceInput as E, type FontScript as F, type ResidentMeasurementConfig as R, type BundledFontProviderSource as a, type ResidentFontRequirement as b, type RustMeasureSource as c, type RustTextEngine as d, createRustMeasureSource as e, getRustTextEngine as g };
|
|
@@ -4,7 +4,7 @@ import { D as DocxInput } from './docxInput-DTbCa48g.mjs';
|
|
|
4
4
|
/**
|
|
5
5
|
* Public DOCX parser facade.
|
|
6
6
|
*
|
|
7
|
-
* Rust
|
|
7
|
+
* Rust owns ZIP/XML parsing. TypeScript only normalizes host inputs,
|
|
8
8
|
* rehydrates the public `Document`, reports progress, and registers fonts.
|
|
9
9
|
* @packageDocumentation
|
|
10
10
|
* @public
|
|
@@ -35,7 +35,7 @@ interface RepackOptions {
|
|
|
35
35
|
updateModifiedDate?: boolean;
|
|
36
36
|
modifiedBy?: string;
|
|
37
37
|
}
|
|
38
|
-
/** Repack a public Document through the
|
|
38
|
+
/** Repack a public Document through the Rust package writer. */
|
|
39
39
|
declare function repackDocx(doc: Document, options?: RepackOptions): Promise<ArrayBuffer>;
|
|
40
40
|
declare function updateMultipleFiles(originalBuffer: ArrayBuffer, updates: Map<string, string | ArrayBuffer>, options?: RepackOptions): Promise<ArrayBuffer>;
|
|
41
41
|
declare function createDocx(doc: Document): Promise<ArrayBuffer>;
|
|
@@ -48,7 +48,7 @@ interface SelectiveSaveOptions {
|
|
|
48
48
|
hasUntrackedChanges: boolean;
|
|
49
49
|
}
|
|
50
50
|
/**
|
|
51
|
-
* Patch changed paragraphs through the Rust
|
|
51
|
+
* Patch changed paragraphs through the Rust package writer. Returns `null` when
|
|
52
52
|
* selective save is unsafe so callers can fall back to a full repack.
|
|
53
53
|
*/
|
|
54
54
|
declare function attemptSelectiveSave(doc: Document, originalBuffer: ArrayBuffer, options: SelectiveSaveOptions): Promise<ArrayBuffer | null>;
|
package/dist/styles/index.d.mts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { a as ParagraphFormatting, b as TextFormatting } from '../formatting-
|
|
2
|
-
import { S as StyleDefinitions, a as Style, D as DocDefaults } from '../styles-
|
|
1
|
+
import { a as ParagraphFormatting, b as TextFormatting } from '../formatting-7zKCTu5a.mjs';
|
|
2
|
+
import { S as StyleDefinitions, a as Style, D as DocDefaults } from '../styles-7e-mq3c-.mjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
* Style Resolver
|
|
5
|
+
* Style Resolver
|
|
6
6
|
*
|
|
7
7
|
* Resolves OOXML style definitions to final paragraph and run properties.
|
|
8
8
|
* Handles the cascade:
|
|
9
9
|
* 1. Document defaults (docDefaults)
|
|
10
|
-
* 2.
|
|
11
|
-
* 3.
|
|
10
|
+
* 2. Table paragraph context
|
|
11
|
+
* 3. Normal style or style chain (basedOn inheritance resolved during parsing)
|
|
12
12
|
* 4. Inline properties
|
|
13
13
|
*
|
|
14
14
|
* Based on ECMA-376 style cascade rules.
|
|
@@ -54,7 +54,7 @@ declare class StyleResolver {
|
|
|
54
54
|
* @param styleId - The style ID to resolve (e.g., 'Heading1', 'Normal')
|
|
55
55
|
* @returns Resolved paragraph and run formatting
|
|
56
56
|
*/
|
|
57
|
-
resolveParagraphStyle(styleId: string | undefined | null): ResolvedParagraphStyle;
|
|
57
|
+
resolveParagraphStyle(styleId: string | undefined | null, tableParagraphFormatting?: ParagraphFormatting): ResolvedParagraphStyle;
|
|
58
58
|
/**
|
|
59
59
|
* Resolve the style applied to the paragraph that follows one styled with
|
|
60
60
|
* `styleId` when the user presses Enter (OOXML `w:next`, §17.7.4.10).
|
|
@@ -113,10 +113,6 @@ declare class StyleResolver {
|
|
|
113
113
|
hasStyle(styleId: string): boolean;
|
|
114
114
|
private findDefaultStyle;
|
|
115
115
|
private mergeStyleIntoResult;
|
|
116
|
-
/**
|
|
117
|
-
* Merge paragraph formatting (source overrides target)
|
|
118
|
-
*/
|
|
119
|
-
private mergeParagraphFormatting;
|
|
120
116
|
private mergeTextFormatting;
|
|
121
117
|
}
|
|
122
118
|
/**
|
package/dist/styles/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{
|
|
1
|
+
export{c as StyleResolver,d as createStyleResolver}from'../chunk-47Q2FMFF.mjs';import'../chunk-TTRUPDAB.mjs';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { b as TextFormatting, a as ParagraphFormatting, c as TableFormatting, d as TableRowFormatting, e as TableCellFormatting } from './formatting-
|
|
1
|
+
import { b as TextFormatting, a as ParagraphFormatting, c as TableFormatting, d as TableRowFormatting, e as TableCellFormatting } from './formatting-7zKCTu5a.mjs';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Styles, Theme, Font Table, Relationships & Media Types
|
package/dist/types/content.d.mts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { B as BlockContent, l as BlockSdt, m as BookmarkEnd, n as BookmarkStart, o as BreakContent,
|
|
2
|
-
export { k as ShapeFill, l as ShapeOutline, m as ShapeType } from '../formatting-
|
|
1
|
+
export { B as BlockContent, l as BlockSdt, m as BookmarkEnd, n as BookmarkStart, o as BreakContent, d as Chart, p as ChartAxis, q as ChartContent, t as ChartLegend, x as ChartSeries, y as ChartType, z as Column, e as Comment, J as CommentRangeEnd, K as CommentRangeStart, M as ComplexField, Q as DEFAULT_WATERMARK_PRESETS, T as Deletion, g as DocumentBody, U as DrawingContent, j as Endnote, X as EndnotePosition, E as EndnoteProperties, Y as Field, Z as FieldCharContent, a0 as FieldType, a1 as FooterReference, i as Footnote, a2 as FootnotePosition, F as FootnoteProperties, H as HeaderFooter, a3 as HeaderFooterType, a4 as HeaderReference, a6 as Hyperlink, a8 as Image, a9 as ImageCrop, ac as ImagePadding, ad as ImagePosition, af as ImageSize, ag as ImageTransform, ah as ImageWrap, aj as InlineSdt, ak as Insertion, al as InstrTextContent, an as LineNumberRestart, aq as MathEquation, ar as MoveFrom, as as MoveFromRangeEnd, at as MoveFromRangeStart, au as MoveTo, av as MoveToRangeEnd, aw as MoveToRangeStart, ax as NoBreakHyphenContent, ay as NoteNumberRestart, az as NoteRefMarkContent, aA as NoteReferenceContent, aF as PageOrientation, P as Paragraph, aG as ParagraphContent, aH as ParagraphPropertyChange, aI as PictureWatermark, aJ as PropertyChangeInfo, bi as RawXml, aK as Run, aL as RunContent, aM as RunPropertyChange, aO as SdtDataBinding, a as SdtProperties, aR as SdtType, aS as Section, f as SectionProperties, aT as SectionStart, aU as SeparatorContent, aV as Shape, aW as ShapeContent, aZ as ShapeTextBody, a_ as SimpleField, a$ as SoftHyphenContent, b2 as SymbolContent, b3 as TabContent, b4 as Table, b5 as TableCell, b6 as TableCellPropertyChange, b7 as TablePropertyChange, b8 as TableRow, b9 as TableRowPropertyChange, ba as TableStructuralChangeInfo, bb as TextBox, bc as TextContent, bd as TextWatermark, be as TrackedChangeInfo, bf as TrackedRunChange, bg as VerticalAlign, W as Watermark, bh as pictureWatermarkDisplayEmu } from '../content-CvEtPl0c.mjs';
|
|
2
|
+
export { k as ShapeFill, l as ShapeOutline, m as ShapeType } from '../formatting-7zKCTu5a.mjs';
|
|
3
3
|
import '../docx/wrapTypes.mjs';
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { F as FootnoteProperties, E as EndnoteProperties, g as DocumentBody, h as NumberingDefinitions, i as Footnote, j as Endnote, H as HeaderFooter,
|
|
2
|
-
export { A as AbstractNumbering, B as BlockContent, l as BlockSdt, m as BookmarkEnd, n as BookmarkStart, o as BreakContent, p as ChartAxis, q as ChartContent, r as
|
|
3
|
-
import { f as Theme, C as ColorValue } from '../formatting-
|
|
4
|
-
export { B as BorderSpec, g as CellMargins, h as ConditionalFormatStyle, E as EmphasisMark, F as FloatingTableProperties, L as LineSpacingRule, i as ParagraphAlignment, a as ParagraphFormatting, R as RunFontHint, j as RunLanguage, S as ShadingProperties, k as ShapeFill, l as ShapeOutline, m as ShapeType, n as TabLeader, o as TabStop, p as TabStopAlignment, q as TableBorders, e as TableCellFormatting, c as TableFormatting, r as TableLook, s as TableMeasurement, d as TableRowFormatting, t as TableStyleCascade, u as TableStyleRegion, v as TableWidthType, w as TextEffect, b as TextFormatting, T as TextModernEffects, x as ThemeColorScheme, y as ThemeColorSlot, z as ThemeFont, A as ThemeFontScheme, U as UnderlineStyle } from '../formatting-
|
|
5
|
-
import { S as StyleDefinitions, F as FontTable, R as RelationshipMap, M as MediaFile } from '../styles-
|
|
6
|
-
export { D as DocDefaults, b as FontEmbed, c as FontInfo, d as Relationship, e as RelationshipType, a as Style, f as StyleType } from '../styles-
|
|
1
|
+
import { F as FootnoteProperties, E as EndnoteProperties, g as DocumentBody, h as NumberingDefinitions, i as Footnote, j as Endnote, H as HeaderFooter, d as Chart, k as BookmarkRange } from '../content-CvEtPl0c.mjs';
|
|
2
|
+
export { A as AbstractNumbering, B as BlockContent, l as BlockSdt, m as BookmarkEnd, n as BookmarkStart, o as BreakContent, p as ChartAxis, q as ChartContent, r as ChartDataLabels, s as ChartGrouping, t as ChartLegend, u as ChartPlotGroup, v as ChartPoint, w as ChartPointLabel, x as ChartSeries, y as ChartType, z as Column, e as Comment, G as CommentAnchorRange, I as CommentAuthor, J as CommentRangeEnd, K as CommentRangeStart, L as CommentReferenceContent, M as ComplexField, O as ContentPosition, Q as DEFAULT_WATERMARK_PRESETS, T as Deletion, U as DrawingContent, D as DrawingScene, V as DrawingSceneNode, X as EndnotePosition, Y as Field, Z as FieldCharContent, _ as FieldFormData, $ as FieldInlineContent, a0 as FieldType, a1 as FooterReference, a2 as FootnotePosition, a3 as HeaderFooterType, a4 as HeaderReference, a5 as HorizontalRuleContent, a6 as Hyperlink, a7 as HyperlinkContent, a8 as Image, a9 as ImageCrop, aa as ImageEffect, ab as ImageHyperlink, ac as ImagePadding, ad as ImagePosition, ae as ImageRotationBounds, af as ImageSize, ag as ImageTransform, ah as ImageWrap, ai as ImageWrapPoint, aj as InlineSdt, ak as Insertion, al as InstrTextContent, am as LevelSuffix, an as LineNumberRestart, ao as ListLevel, ap as ListRendering, aq as MathEquation, ar as MoveFrom, as as MoveFromRangeEnd, at as MoveFromRangeStart, au as MoveTo, av as MoveToRangeEnd, aw as MoveToRangeStart, ax as NoBreakHyphenContent, N as NoteKind, ay as NoteNumberRestart, az as NoteRefMarkContent, aA as NoteReferenceContent, aB as NoteSeparatorReference, aC as NumberFormat, aD as NumberingInstance, aE as PageNumberingProperties, aF as PageOrientation, P as Paragraph, aG as ParagraphContent, aH as ParagraphPropertyChange, aI as PictureWatermark, aJ as PropertyChangeInfo, aK as Run, aL as RunContent, aM as RunPropertyChange, aN as SdtCheckboxGlyph, S as SdtControlState, aO as SdtDataBinding, aP as SdtDateState, aQ as SdtGalleryState, a as SdtProperties, aR as SdtType, aS as Section, f as SectionProperties, aT as SectionStart, aU as SeparatorContent, aV as Shape, aW as ShapeContent, b as ShapeEffect, aX as ShapeFillPaint, aY as ShapeStrokePaint, aZ as ShapeTextBody, c as ShapeTextBodyProperties, a_ as SimpleField, a$ as SoftHyphenContent, b0 as StructuredFieldContent, b1 as StructuredFieldTree, b2 as SymbolContent, b3 as TabContent, b4 as Table, b5 as TableCell, b6 as TableCellPropertyChange, b7 as TablePropertyChange, b8 as TableRow, b9 as TableRowPropertyChange, ba as TableStructuralChangeInfo, bb as TextBox, bc as TextContent, bd as TextWatermark, be as TrackedChangeInfo, bf as TrackedRunChange, bg as VerticalAlign, W as Watermark, bh as pictureWatermarkDisplayEmu } from '../content-CvEtPl0c.mjs';
|
|
3
|
+
import { f as Theme, C as ColorValue } from '../formatting-7zKCTu5a.mjs';
|
|
4
|
+
export { B as BorderSpec, g as CellMargins, h as ConditionalFormatStyle, E as EmphasisMark, F as FloatingTableProperties, L as LineSpacingRule, i as ParagraphAlignment, a as ParagraphFormatting, R as RunFontHint, j as RunLanguage, S as ShadingProperties, k as ShapeFill, l as ShapeOutline, m as ShapeType, n as TabLeader, o as TabStop, p as TabStopAlignment, q as TableBorders, e as TableCellFormatting, c as TableFormatting, r as TableLook, s as TableMeasurement, d as TableRowFormatting, t as TableStyleCascade, u as TableStyleRegion, v as TableWidthType, w as TextEffect, b as TextFormatting, T as TextModernEffects, x as ThemeColorScheme, y as ThemeColorSlot, z as ThemeFont, A as ThemeFontScheme, U as UnderlineStyle } from '../formatting-7zKCTu5a.mjs';
|
|
5
|
+
import { S as StyleDefinitions, F as FontTable, R as RelationshipMap, M as MediaFile } from '../styles-7e-mq3c-.mjs';
|
|
6
|
+
export { D as DocDefaults, b as FontEmbed, c as FontInfo, d as Relationship, e as RelationshipType, a as Style, f as StyleType } from '../styles-7e-mq3c-.mjs';
|
|
7
7
|
import '../docx/wrapTypes.mjs';
|
|
8
8
|
|
|
9
9
|
interface CompatibilityFlags {
|
|
@@ -13,7 +13,7 @@ interface CompatibilityFlags {
|
|
|
13
13
|
useWord97LineBreakRules: boolean;
|
|
14
14
|
balanceSingleByteDoubleByteWidth: boolean;
|
|
15
15
|
}
|
|
16
|
-
/** Public model contract rehydrated by the Rust
|
|
16
|
+
/** Public model contract rehydrated by the Rust parser. */
|
|
17
17
|
interface DocumentSettings {
|
|
18
18
|
defaultTabStop: number;
|
|
19
19
|
defaultTableStyle?: string;
|
|
@@ -23,6 +23,7 @@ interface DocumentSettings {
|
|
|
23
23
|
};
|
|
24
24
|
compatibilityFlags: CompatibilityFlags;
|
|
25
25
|
updateFields?: boolean;
|
|
26
|
+
evenAndOddHeaders?: boolean;
|
|
26
27
|
trackRevisions?: boolean;
|
|
27
28
|
doNotTrackMoves?: boolean;
|
|
28
29
|
doNotTrackFormatting?: boolean;
|