@betteroffice/docx 0.0.3 → 0.1.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 +22 -8
- package/dist/chunk-24DL53QL.mjs +1 -0
- package/dist/chunk-5F6DLQZP.mjs +1 -0
- package/dist/chunk-BUZ2X5CT.mjs +16 -0
- package/dist/chunk-CTBUQRYQ.mjs +1 -0
- package/dist/{chunk-B4IR6YP4.mjs → chunk-GHEHBYQK.mjs} +1 -1
- package/dist/{chunk-NJHOPXZW.mjs → chunk-HLDJMU3R.mjs} +1 -1
- package/dist/chunk-HTDNSQ44.mjs +1 -0
- package/dist/{chunk-IFT6DUJX.mjs → chunk-LTVVQMHB.mjs} +1 -1
- package/dist/chunk-PI2I3TO5.mjs +57 -0
- package/dist/chunk-TMHG7OAZ.mjs +1 -0
- package/dist/chunk-VRGUAKOC.mjs +1 -0
- package/dist/collaboration/index.d.mts +32 -8
- package/dist/collaboration/index.mjs +1 -1
- package/dist/{content-MOZ6hKP4.d.mts → content-DrqzbIr7.d.mts} +582 -666
- package/dist/core.d.mts +7 -7
- package/dist/core.mjs +1 -1
- package/dist/{displayListQueries-BJlo7Jkz.d.mts → displayListQueries-DGDR-OWc.d.mts} +98 -50
- package/dist/docx/index.d.mts +5 -5
- package/dist/docx/index.mjs +1 -1
- package/dist/editor/index.d.mts +8 -8
- package/dist/{fontLoader-aSewHMKF.d.mts → fontLoader-DnixuYST.d.mts} +127 -2
- package/dist/{formatting-D1EPSaJP.d.mts → formatting-BqrFPeev.d.mts} +85 -203
- package/dist/{frameDelta-D965X8yK.d.mts → frameDelta-DMgR8n13.d.mts} +17 -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-Dx4Z3lkz.d.mts → index-ImoMd0Ju.d.mts} +97 -67
- package/dist/layout/index.d.mts +40 -12
- 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-BRuZBqdL.d.mts → rustDisplayList-B9dQoLHI.d.mts} +79 -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 +3 -3
- package/dist/{styles-Dn_o3Vo5.d.mts → styles-CMybYYHS.d.mts} +1 -1
- package/dist/types/content.d.mts +2 -2
- package/dist/types/document.d.mts +7 -7
- package/dist/{types-BfqUl2h_.d.mts → types-CXLxVF1t.d.mts} +27 -23
- 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/utils/units.d.mts +4 -34
- package/dist/utils/units.mjs +1 -1
- package/dist/wasm-CJHQHBDE.mjs +1 -0
- package/dist/wasm-T2CRCO7S.mjs +1 -0
- package/dist/wasm-edit.d.mts +524 -168
- package/dist/wasm-edit.mjs +1 -1
- package/dist/wasm-layout.d.mts +35 -28
- package/dist/wasm-layout.mjs +1 -1
- package/dist/wasm-opc.mjs +1 -1
- package/dist/wasm-parse.mjs +1 -1
- package/dist/yrs/index.d.mts +6 -6
- package/dist/yrs/index.mjs +1 -1
- package/dist/yrs/residentEngineWorker.mjs +1 -1
- package/package.json +19 -3
- package/dist/chunk-3UBMCDME.mjs +0 -1
- package/dist/chunk-AEQOEQJ7.mjs +0 -57
- package/dist/chunk-AZ52IWB6.mjs +0 -16
- package/dist/chunk-GGEGIQRK.mjs +0 -1
- package/dist/chunk-T4EZMUXM.mjs +0 -1
- package/dist/chunk-WON6K4FY.mjs +0 -1
- package/dist/chunk-Y7RUNRU2.mjs +0 -1
- package/dist/wasm-DO3BUV7C.mjs +0 -1
- package/dist/wasm-NWXX4H5G.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-DGDR-OWc.mjs';
|
|
3
3
|
import '../types/document.mjs';
|
|
4
|
-
import '../content-
|
|
5
|
-
import '../formatting-
|
|
4
|
+
import '../content-DrqzbIr7.mjs';
|
|
5
|
+
import '../formatting-BqrFPeev.mjs';
|
|
6
6
|
import '../docx/wrapTypes.mjs';
|
|
7
|
-
import '../styles-
|
|
8
|
-
import '../frameDelta-
|
|
9
|
-
import '../rustDisplayList-
|
|
10
|
-
import '../types-
|
|
7
|
+
import '../styles-CMybYYHS.mjs';
|
|
8
|
+
import '../frameDelta-DMgR8n13.mjs';
|
|
9
|
+
import '../rustDisplayList-B9dQoLHI.mjs';
|
|
10
|
+
import '../types-CXLxVF1t.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-DrqzbIr7.mjs';
|
|
3
|
+
import '../formatting-BqrFPeev.mjs';
|
|
4
4
|
import '../docx/wrapTypes.mjs';
|
|
5
|
-
import '../styles-
|
|
5
|
+
import '../styles-CMybYYHS.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-DrqzbIr7.mjs';
|
|
4
|
+
import '../formatting-BqrFPeev.mjs';
|
|
5
5
|
import '../docx/wrapTypes.mjs';
|
|
6
|
-
import '../styles-
|
|
6
|
+
import '../styles-CMybYYHS.mjs';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* Pure layout algorithm: given a list of sidebar items + their
|
|
@@ -1,27 +1,34 @@
|
|
|
1
|
-
import { a as Layout } from './types-
|
|
1
|
+
import { a as Layout } from './types-CXLxVF1t.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-DMgR8n13.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,34 +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;
|
|
205
|
+
displayVerticalMoveJson?(position: number, direction: 'up' | 'down', goalX: number): string;
|
|
194
206
|
displayRangeRectsJson?(from: number, to: number): string;
|
|
195
|
-
displayRangeRectsRegionJson?(region:
|
|
207
|
+
displayRangeRectsRegionJson?(region: string, partId: string, from: number, to: number): string;
|
|
196
208
|
}
|
|
197
209
|
type RustDisplayListSourceErrorStage = 'load' | 'build' | 'parse' | 'decode' | 'apply';
|
|
198
210
|
interface RustDisplayFrameResult {
|
|
199
211
|
displayList: DisplayList;
|
|
200
|
-
/**
|
|
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
|
+
*/
|
|
201
216
|
frame: RetainedFrame | null;
|
|
202
217
|
transport: 'frame-delta-v1' | 'json';
|
|
203
218
|
}
|
|
@@ -214,28 +229,32 @@ declare class RustDisplayListSourceError extends Error {
|
|
|
214
229
|
* Query surface over an already-built display list, injectable so tests can
|
|
215
230
|
* fake the wasm module.
|
|
216
231
|
*
|
|
217
|
-
* The `*Json`
|
|
218
|
-
* side re-parses it per query
|
|
219
|
-
* session-handle members parse the list
|
|
220
|
-
* answer many queries by handle with no re-serialization,
|
|
221
|
-
* hit
|
|
222
|
-
*
|
|
223
|
-
*
|
|
224
|
-
* 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.
|
|
225
240
|
*/
|
|
226
241
|
interface RustDisplayListQueryEngine {
|
|
227
|
-
/**
|
|
242
|
+
/**
|
|
243
|
+
* region-aware hit test → `{"region","rId"?,"noteId"?,"pos","target"}` or
|
|
244
|
+
* `"null"` JSON
|
|
245
|
+
*/
|
|
228
246
|
hitTestRegionsJson(displayList: string, pageIndex: number, x: number, y: number): string;
|
|
229
|
-
/**
|
|
247
|
+
/** closest caret position on the adjacent visual line */
|
|
248
|
+
verticalMoveJson?(displayList: string, position: number, direction: 'up' | 'down', goalX: number): string;
|
|
249
|
+
/** body document range → JSON array of `{pageIndex,x,y,width,height}` rects */
|
|
230
250
|
rangeRectsJson(displayList: string, from: number, to: number): string;
|
|
231
251
|
/**
|
|
232
|
-
* Region-aware
|
|
233
|
-
* `
|
|
234
|
-
* (empty for body
|
|
235
|
-
*
|
|
236
|
-
* `[]` 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.
|
|
237
256
|
*/
|
|
238
|
-
rangeRectsRegionJson?(displayList: string, region: string,
|
|
257
|
+
rangeRectsRegionJson?(displayList: string, region: string, partId: string, from: number, to: number): string;
|
|
239
258
|
/** true when the embedded wasm carries the region-aware range-rect exports */
|
|
240
259
|
hasRangeRectsRegion?(): boolean;
|
|
241
260
|
/** true when the embedded wasm carries the session-handle exports below */
|
|
@@ -250,10 +269,12 @@ interface RustDisplayListQueryEngine {
|
|
|
250
269
|
hasDisplayListUpdate?(): boolean;
|
|
251
270
|
/** region-aware hit test against a stored display list (by handle) */
|
|
252
271
|
hitTestRegionsByHandle?(handle: number, pageIndex: number, x: number, y: number): string;
|
|
253
|
-
/**
|
|
272
|
+
/** adjacent visual-line move against a stored display list */
|
|
273
|
+
verticalMoveByHandle?(handle: number, position: number, direction: 'up' | 'down', goalX: number): string;
|
|
274
|
+
/** body document range against a stored display list (by handle) */
|
|
254
275
|
rangeRectsByHandle?(handle: number, from: number, to: number): string;
|
|
255
|
-
/** region-aware
|
|
256
|
-
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;
|
|
257
278
|
}
|
|
258
279
|
/**
|
|
259
280
|
* Lazily load the wasm query surface (hit-test + range-rects). Shares the
|
|
@@ -265,13 +286,21 @@ declare function loadRustDisplayListQueryEngine(): Promise<RustDisplayListQueryE
|
|
|
265
286
|
declare function encodeDisplayListFrameExtras(inputs: DisplayListBuildInputs): string;
|
|
266
287
|
/**
|
|
267
288
|
* Build a DisplayList for a computed layout through the Rust engine. Throws
|
|
268
|
-
*
|
|
269
|
-
*
|
|
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.
|
|
270
292
|
*/
|
|
271
293
|
declare function buildRustDisplayList(inputs: DisplayListBuildInputs, engine?: RustDisplayListEngine): Promise<DisplayList>;
|
|
272
294
|
/**
|
|
273
|
-
*
|
|
274
|
-
*
|
|
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`.
|
|
275
304
|
*/
|
|
276
305
|
declare function buildRustDisplayFrame(inputs: DisplayListBuildInputs, engine?: RustDisplayListEngine, previous?: RetainedFrame | null): Promise<RustDisplayFrameResult>;
|
|
277
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,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { S as StyleDefinitions, a as Style, D as DocDefaults } from '../styles-
|
|
1
|
+
import { a as ParagraphFormatting, b as TextFormatting } from '../formatting-BqrFPeev.mjs';
|
|
2
|
+
import { S as StyleDefinitions, a as Style, D as DocDefaults } from '../styles-CMybYYHS.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:
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { b as TextFormatting, a as ParagraphFormatting, c as TableFormatting, d as TableRowFormatting, e as TableCellFormatting } from './formatting-BqrFPeev.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,
|
|
2
|
-
|
|
1
|
+
export { B as BlockContent, l as BlockSdt, m as BookmarkEnd, n as BookmarkStart, o as BreakContent, e as Chart, p as ChartAxis, q as ChartContent, t as ChartLegend, x as ChartSeries, y as ChartType, z as Column, f 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, a5 as Hyperlink, a7 as Image, a8 as ImageCrop, ab as ImagePadding, ac as ImagePosition, ae as ImageSize, af as ImageTransform, ag as ImageWrap, ai as InlineSdt, aj as Insertion, ak as InstrTextContent, am as LineNumberRestart, ap as MathEquation, aq as MoveFrom, ar as MoveFromRangeEnd, as as MoveFromRangeStart, at as MoveTo, au as MoveToRangeEnd, av as MoveToRangeStart, aw as NoBreakHyphenContent, ax as NoteNumberRestart, ay as NoteRefMarkContent, az as NoteReferenceContent, aE as PageOrientation, P as Paragraph, aF as ParagraphContent, aG as ParagraphPropertyChange, aH as PictureWatermark, aI as PropertyChangeInfo, aJ as Run, aK as RunContent, aL as RunPropertyChange, aN as SdtDataBinding, b as SdtProperties, aQ as SdtType, aR as Section, S as SectionProperties, aS as SectionStart, aT as SeparatorContent, aU as Shape, aV as ShapeContent, aY as ShapeTextBody, aZ as SimpleField, a_ as SoftHyphenContent, b1 as SymbolContent, b2 as TabContent, b3 as Table, b4 as TableCell, b5 as TableCellPropertyChange, b6 as TablePropertyChange, b7 as TableRow, b8 as TableRowPropertyChange, b9 as TableStructuralChangeInfo, ba as TextBox, bb as TextContent, bc as TextWatermark, bd as TrackedChangeInfo, be as TrackedRunChange, bf as VerticalAlign, W as Watermark, bg as pictureWatermarkDisplayEmu } from '../content-DrqzbIr7.mjs';
|
|
2
|
+
export { k as ShapeFill, l as ShapeOutline, m as ShapeType } from '../formatting-BqrFPeev.mjs';
|
|
3
3
|
import '../docx/wrapTypes.mjs';
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { F as FootnoteProperties, E as EndnoteProperties,
|
|
2
|
-
export { A as AbstractNumbering, B as BlockContent,
|
|
3
|
-
import {
|
|
4
|
-
export { B as BorderSpec, g as CellMargins, h as ConditionalFormatStyle, E as EmphasisMark, F as FloatingTableProperties, L as LineSpacingRule, i as ParagraphAlignment,
|
|
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, e as Chart, k as BookmarkRange } from '../content-DrqzbIr7.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, f 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 Hyperlink, a6 as HyperlinkContent, a7 as Image, a8 as ImageCrop, a9 as ImageEffect, aa as ImageHyperlink, ab as ImagePadding, ac as ImagePosition, ad as ImageRotationBounds, ae as ImageSize, af as ImageTransform, ag as ImageWrap, ah as ImageWrapPoint, ai as InlineSdt, aj as Insertion, ak as InstrTextContent, al as LevelSuffix, am as LineNumberRestart, an as ListLevel, ao as ListRendering, ap as MathEquation, aq as MoveFrom, ar as MoveFromRangeEnd, as as MoveFromRangeStart, at as MoveTo, au as MoveToRangeEnd, av as MoveToRangeStart, aw as NoBreakHyphenContent, N as NoteKind, ax as NoteNumberRestart, ay as NoteRefMarkContent, az as NoteReferenceContent, aA as NoteSeparatorReference, aB as NumberFormat, aC as NumberingInstance, aD as PageNumberingProperties, aE as PageOrientation, P as Paragraph, aF as ParagraphContent, aG as ParagraphPropertyChange, aH as PictureWatermark, aI as PropertyChangeInfo, aJ as Run, aK as RunContent, aL as RunPropertyChange, aM as SdtCheckboxGlyph, a as SdtControlState, aN as SdtDataBinding, aO as SdtDateState, aP as SdtGalleryState, b as SdtProperties, aQ as SdtType, aR as Section, S as SectionProperties, aS as SectionStart, aT as SeparatorContent, aU as Shape, aV as ShapeContent, c as ShapeEffect, aW as ShapeFillPaint, aX as ShapeStrokePaint, aY as ShapeTextBody, d as ShapeTextBodyProperties, aZ as SimpleField, a_ as SoftHyphenContent, a$ as StructuredFieldContent, b0 as StructuredFieldTree, b1 as SymbolContent, b2 as TabContent, b3 as Table, b4 as TableCell, b5 as TableCellPropertyChange, b6 as TablePropertyChange, b7 as TableRow, b8 as TableRowPropertyChange, b9 as TableStructuralChangeInfo, ba as TextBox, bb as TextContent, bc as TextWatermark, bd as TrackedChangeInfo, be as TrackedRunChange, bf as VerticalAlign, W as Watermark, bg as pictureWatermarkDisplayEmu } from '../content-DrqzbIr7.mjs';
|
|
3
|
+
import { f as Theme, C as ColorValue } from '../formatting-BqrFPeev.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-BqrFPeev.mjs';
|
|
5
|
+
import { S as StyleDefinitions, F as FontTable, R as RelationshipMap, M as MediaFile } from '../styles-CMybYYHS.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-CMybYYHS.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;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { a as SdtControlState, b as SdtProperties, R as RevisionInfo, C as CellMarker,
|
|
2
|
-
import { T as TextModernEffects, B as BorderSpec } from './formatting-
|
|
1
|
+
import { a as SdtControlState, b as SdtProperties, R as RevisionInfo, C as CellMarker, D as DrawingScene, c as ShapeEffect, d as ShapeTextBodyProperties, e as Chart, W as Watermark, F as FootnoteProperties, E as EndnoteProperties } from './content-DrqzbIr7.mjs';
|
|
2
|
+
import { T as TextModernEffects, P as PresetGeometryPathCommand, B as BorderSpec } from './formatting-BqrFPeev.mjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Inline SDT widget metadata carried by a painted text run.
|
|
6
6
|
*/
|
|
7
7
|
interface InlineSdtWidget {
|
|
8
8
|
kind: 'checkbox';
|
|
9
|
-
/** Stable per-document id derived from the
|
|
9
|
+
/** Stable per-document id derived from the node position. */
|
|
10
10
|
groupId: string;
|
|
11
|
-
/**
|
|
11
|
+
/** Document position of the inline SDT node. */
|
|
12
12
|
pos: number;
|
|
13
13
|
/** Word tag value (`w:tag`). */
|
|
14
14
|
tag?: string;
|
|
@@ -20,7 +20,7 @@ interface InlineSdtWidget {
|
|
|
20
20
|
/**
|
|
21
21
|
* One run's visible slice on a laid-out line: the run to render/measure plus
|
|
22
22
|
* its on-line text. For a boundary text run this is a shallow copy sliced to
|
|
23
|
-
* the line's head/tail char (
|
|
23
|
+
* the line's head/tail char (document positions shifted to match); tabs, images,
|
|
24
24
|
* line breaks, and fields pass through whole with an empty `text`. `text` is
|
|
25
25
|
* the run's textual contribution to the line (empty for non-text runs), so
|
|
26
26
|
* joining a line's segment texts reconstructs the line's visible characters.
|
|
@@ -195,9 +195,9 @@ type TextRun = RunFormatting & {
|
|
|
195
195
|
text: string;
|
|
196
196
|
/** Hyperlink information if this run is a link. */
|
|
197
197
|
hyperlink?: HyperlinkInfo;
|
|
198
|
-
/**
|
|
198
|
+
/** Document offset where the run's text begins. */
|
|
199
199
|
pmStart?: number;
|
|
200
|
-
/**
|
|
200
|
+
/** Document offset one past the run's final character. */
|
|
201
201
|
pmEnd?: number;
|
|
202
202
|
/** Inline content-control widget metadata when this run is the visible glyph. */
|
|
203
203
|
inlineSdtWidget?: InlineSdtWidget;
|
|
@@ -432,6 +432,8 @@ type ParagraphAttrs = {
|
|
|
432
432
|
indent?: ParagraphIndent;
|
|
433
433
|
keepNext?: boolean;
|
|
434
434
|
keepLines?: boolean;
|
|
435
|
+
/** w:widowControl, a toggle defaulting on: only an authored off is carried. */
|
|
436
|
+
widowControl?: boolean;
|
|
435
437
|
pageBreakBefore?: boolean;
|
|
436
438
|
styleId?: string;
|
|
437
439
|
contextualSpacing?: boolean;
|
|
@@ -484,13 +486,13 @@ type ParagraphBlock = {
|
|
|
484
486
|
sdtGroups?: SdtGroup[];
|
|
485
487
|
kind: 'paragraph';
|
|
486
488
|
id: BlockId;
|
|
487
|
-
/** Stable Word `w14:paraId
|
|
489
|
+
/** Stable Word `w14:paraId`, when available. */
|
|
488
490
|
paraId?: string;
|
|
489
491
|
runs: Run[];
|
|
490
492
|
attrs?: ParagraphAttrs;
|
|
491
|
-
/**
|
|
493
|
+
/** Document start position for this block. */
|
|
492
494
|
pmStart?: number;
|
|
493
|
-
/**
|
|
495
|
+
/** Document end position for this block. */
|
|
494
496
|
pmEnd?: number;
|
|
495
497
|
};
|
|
496
498
|
/**
|
|
@@ -827,7 +829,7 @@ type ShapeBlock = {
|
|
|
827
829
|
decorative?: boolean;
|
|
828
830
|
title?: string;
|
|
829
831
|
description?: string;
|
|
830
|
-
/**
|
|
832
|
+
/** Document positions for selection mapping. */
|
|
831
833
|
docStart?: number;
|
|
832
834
|
docEnd?: number;
|
|
833
835
|
pmStart?: number;
|
|
@@ -952,9 +954,9 @@ type TextBoxBlock = {
|
|
|
952
954
|
};
|
|
953
955
|
/** Paragraph blocks inside the text box */
|
|
954
956
|
content: ParagraphBlock[];
|
|
955
|
-
/** Display mode copied from the
|
|
957
|
+
/** Display mode copied from the text box node */
|
|
956
958
|
displayMode?: 'inline' | 'float' | 'block';
|
|
957
|
-
/** CSS float direction copied from the
|
|
959
|
+
/** CSS float direction copied from the text box node */
|
|
958
960
|
cssFloat?: 'left' | 'right' | 'none';
|
|
959
961
|
/** OOXML wrap type for anchored text boxes */
|
|
960
962
|
wrapType?: string;
|
|
@@ -986,9 +988,9 @@ interface SdtGroup {
|
|
|
986
988
|
checked?: boolean;
|
|
987
989
|
bound?: boolean;
|
|
988
990
|
repeatingItem?: boolean;
|
|
989
|
-
/** Authored numeric `w:id`; undefined = address by `id`/
|
|
991
|
+
/** Authored numeric `w:id`; undefined = address by `id`/position. */
|
|
990
992
|
controlId?: number;
|
|
991
|
-
/** Stable
|
|
993
|
+
/** Stable document position for untagged controls. */
|
|
992
994
|
pos?: number;
|
|
993
995
|
/** Typed overlay state. Undefined = derive from content. */
|
|
994
996
|
controlState?: SdtControlState;
|
|
@@ -1035,6 +1037,8 @@ type TypesetRow = {
|
|
|
1035
1037
|
descent: number;
|
|
1036
1038
|
/** Total line height in pixels. */
|
|
1037
1039
|
lineHeight: number;
|
|
1040
|
+
/** Deterministic line geometry produced without a measurement face. */
|
|
1041
|
+
syntheticFallback?: boolean;
|
|
1038
1042
|
/** Left offset from floating images (pixels from content left edge). */
|
|
1039
1043
|
leftOffset?: number;
|
|
1040
1044
|
/** Right offset from floating images (pixels from content right edge). */
|
|
@@ -1177,7 +1181,7 @@ type TextBoxExtent = {
|
|
|
1177
1181
|
type BlockExtent = ParagraphExtent | ImageExtent | ShapeExtent | ChartExtent | TableExtent | TextBoxExtent | SectionBreakExtent | PageBreakExtent | ColumnBreakExtent;
|
|
1178
1182
|
/**
|
|
1179
1183
|
* Fields every fragment carries: which block it came from, where it sits on
|
|
1180
|
-
* its page, and the
|
|
1184
|
+
* its page, and the document span it maps to.
|
|
1181
1185
|
*/
|
|
1182
1186
|
type FragmentBase = {
|
|
1183
1187
|
/** Block ID this fragment belongs to. */
|
|
@@ -1188,9 +1192,9 @@ type FragmentBase = {
|
|
|
1188
1192
|
y: number;
|
|
1189
1193
|
/** Width of the fragment. */
|
|
1190
1194
|
width: number;
|
|
1191
|
-
/**
|
|
1195
|
+
/** Document start position (for click mapping). */
|
|
1192
1196
|
pmStart?: number;
|
|
1193
|
-
/**
|
|
1197
|
+
/** Document end position (for click mapping). */
|
|
1194
1198
|
pmEnd?: number;
|
|
1195
1199
|
};
|
|
1196
1200
|
/**
|
|
@@ -1274,7 +1278,7 @@ type ShapeFragment = FragmentBase & {
|
|
|
1274
1278
|
kind: 'shape';
|
|
1275
1279
|
/** Height of the shape bbox. */
|
|
1276
1280
|
height: number;
|
|
1277
|
-
/**
|
|
1281
|
+
/** Document positions for display-list consumers that use docStart/docEnd names. */
|
|
1278
1282
|
docStart?: number;
|
|
1279
1283
|
docEnd?: number;
|
|
1280
1284
|
/** True when positioned outside normal flow. */
|
|
@@ -1547,7 +1551,7 @@ type LayoutOptions = {
|
|
|
1547
1551
|
/** Per-page footnote reserved heights (pageNumber → height in pixels). */
|
|
1548
1552
|
footnoteReservedHeights?: Map<number, number>;
|
|
1549
1553
|
/** Section break type for the body-level (final) section (for section transition logic). */
|
|
1550
|
-
bodyBreakType?: 'continuous' | 'nextPage' | 'evenPage' | 'oddPage';
|
|
1554
|
+
bodyBreakType?: 'continuous' | 'nextPage' | 'evenPage' | 'oddPage' | 'nextColumn';
|
|
1551
1555
|
/** Effective section states, indexed by section. Undefined = legacy globals. */
|
|
1552
1556
|
sections?: Array<{
|
|
1553
1557
|
sectionId?: string;
|
|
@@ -1579,8 +1583,8 @@ type HitTestResult = {
|
|
|
1579
1583
|
localY?: number;
|
|
1580
1584
|
};
|
|
1581
1585
|
/**
|
|
1582
|
-
* A location expressed in block/run/character terms, with the matching
|
|
1583
|
-
* position when known.
|
|
1586
|
+
* A location expressed in block/run/character terms, with the matching
|
|
1587
|
+
* document position when known.
|
|
1584
1588
|
*/
|
|
1585
1589
|
type DocumentPosition = {
|
|
1586
1590
|
/** Block index. */
|
|
@@ -1589,7 +1593,7 @@ type DocumentPosition = {
|
|
|
1589
1593
|
runIndex?: number;
|
|
1590
1594
|
/** Character offset within the run. */
|
|
1591
1595
|
charOffset?: number;
|
|
1592
|
-
/**
|
|
1596
|
+
/** Document position. */
|
|
1593
1597
|
pmPos?: number;
|
|
1594
1598
|
};
|
|
1595
1599
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import '../formatting-
|
|
1
|
+
import { P as Paragraph, B as BlockContent, f as Comment } from '../content-DrqzbIr7.mjs';
|
|
2
|
+
import '../formatting-BqrFPeev.mjs';
|
|
3
3
|
import '../docx/wrapTypes.mjs';
|
|
4
4
|
|
|
5
5
|
/**
|