@betteroffice/docx 0.0.1 → 0.0.2
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 +19 -0
- package/dist/chunk-AEQOEQJ7.mjs +57 -0
- package/dist/chunk-AZ52IWB6.mjs +16 -0
- package/dist/{chunk-SINEY6ZF.mjs → chunk-B4IR6YP4.mjs} +1 -1
- package/dist/chunk-IFT6DUJX.mjs +1 -0
- package/dist/{chunk-H3JCIGWK.mjs → chunk-NJHOPXZW.mjs} +1 -1
- package/dist/chunk-NTQM4EYN.mjs +1 -0
- package/dist/{chunk-KXNZFTTK.mjs → chunk-WBH3SXI6.mjs} +1 -1
- package/dist/collaboration/index.d.mts +64 -0
- package/dist/collaboration/index.mjs +1 -0
- package/dist/{content-sSHuWw49.d.mts → content-DLFHRQav.d.mts} +8 -8
- package/dist/core.d.mts +148 -341
- package/dist/core.mjs +1 -1
- package/dist/{displayListQueries-p-ijSzdh.d.mts → displayListQueries-UGc_XBUv.d.mts} +1 -1
- package/dist/docx/index.d.mts +40 -520
- package/dist/docx/index.mjs +2 -2
- package/dist/editor/index.d.mts +35 -151
- package/dist/editor/index.mjs +1 -1
- package/dist/{fontLoader-Bx6DK6-2.d.mts → fontLoader-aSewHMKF.d.mts} +65 -63
- package/dist/{formatting-DoL7KBSL.d.mts → formatting-D1EPSaJP.d.mts} +1 -1
- 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-Bwxm3oiC.d.mts +934 -0
- package/dist/layout/index.d.mts +18 -240
- package/dist/layout/index.mjs +1 -1
- package/dist/layout/pagination/index.d.mts +10 -58
- package/dist/layout/pagination/index.mjs +1 -1
- package/dist/layout/render/index.d.mts +10 -11
- package/dist/layout/render/index.mjs +1 -1
- package/dist/plugin-api/RenderedDomContext.d.mts +8 -9
- package/dist/plugin-api/index.d.mts +191 -6
- package/dist/plugin-api/resolveItemPositions.d.mts +4 -5
- package/dist/{rustDisplayList-dqunvwxH.d.mts → rustDisplayList-CX78djsZ.d.mts} +5 -5
- package/dist/rustMeasureSource-D1KsQvVC.d.mts +106 -0
- package/dist/selectiveSave-CVoajSKE.d.mts +56 -0
- package/dist/styles/index.d.mts +4 -39
- package/dist/styles/index.mjs +1 -1
- package/dist/{styles-VxNcXLdi.d.mts → styles-Dn_o3Vo5.d.mts} +2 -2
- package/dist/types/content.d.mts +2 -2
- package/dist/types/document.d.mts +40 -14
- package/dist/{types-DNrYr6yQ.d.mts → types-DMkDbvEu.d.mts} +3 -71
- package/dist/utils/comments.d.mts +2 -2
- package/dist/utils/index.d.mts +110 -576
- package/dist/utils/index.mjs +1 -84
- package/dist/utils/stylePreview.d.mts +2 -2
- package/dist/utils/units.d.mts +33 -2
- package/dist/wasm-BGQBTR2J.mjs +1 -0
- package/dist/wasm-edit.d.mts +13 -5
- package/dist/wasm-edit.mjs +1 -1
- package/dist/wasm-opc.mjs +1 -1
- package/dist/wasm-parse.mjs +1 -1
- package/dist/yrs/index.d.mts +5 -881
- package/dist/yrs/index.mjs +1 -1
- package/dist/yrs/residentEngineWorker.mjs +1 -1
- package/package.json +16 -139
- package/dist/Subscribable-DOz6Ohoo.d.mts +0 -33
- package/dist/agent/index.d.mts +0 -531
- package/dist/agent/index.mjs +0 -1
- package/dist/chunk-34K66SY4.mjs +0 -1
- package/dist/chunk-4RCISPPE.mjs +0 -1
- package/dist/chunk-52GB3Y42.mjs +0 -1
- package/dist/chunk-6PW4CWUG.mjs +0 -1
- package/dist/chunk-7DEIW7FL.mjs +0 -1
- package/dist/chunk-7PCO5I2O.mjs +0 -1
- package/dist/chunk-BI3B33LI.mjs +0 -1
- package/dist/chunk-BIQWVK5P.mjs +0 -2
- package/dist/chunk-DXKG3HQ5.mjs +0 -16
- package/dist/chunk-FPZBTOD6.mjs +0 -1
- package/dist/chunk-FZIA7OFY.mjs +0 -1
- package/dist/chunk-GWKJ2Y4Y.mjs +0 -1
- package/dist/chunk-HJGAQIU7.mjs +0 -2
- package/dist/chunk-I6KKMUUC.mjs +0 -1
- package/dist/chunk-IL5JZJT7.mjs +0 -1
- package/dist/chunk-JY6ILTNS.mjs +0 -1
- package/dist/chunk-KEE52TT5.mjs +0 -1
- package/dist/chunk-KVKLLTDP.mjs +0 -58
- package/dist/chunk-L5ISVQ3W.mjs +0 -1
- package/dist/chunk-LDUWIM7M.mjs +0 -1
- package/dist/chunk-N5Q3YN64.mjs +0 -1
- package/dist/chunk-NEWOMDTX.mjs +0 -1
- package/dist/chunk-O2QSE2I7.mjs +0 -1
- package/dist/chunk-OJOHXQNQ.mjs +0 -1
- package/dist/chunk-OMR3TWCD.mjs +0 -2
- package/dist/chunk-P3KDV4M2.mjs +0 -1
- package/dist/chunk-Q7PO7V73.mjs +0 -1
- package/dist/chunk-QOUFE3VX.mjs +0 -1
- package/dist/chunk-TYHI7RAD.mjs +0 -1
- package/dist/chunk-UIEJWORW.mjs +0 -1
- package/dist/chunk-VAOUFAUH.mjs +0 -1
- package/dist/chunk-VBOTMRXV.mjs +0 -1
- package/dist/chunk-VCER63GQ.mjs +0 -1
- package/dist/chunk-WAUF2UC7.mjs +0 -2
- package/dist/chunk-X4XDO3LZ.mjs +0 -1
- package/dist/chunk-XQBCCJBO.mjs +0 -9
- package/dist/chunk-XWUOLYRQ.mjs +0 -2
- package/dist/chunk-XYH6XWP3.mjs +0 -10
- package/dist/chunk-YBIM6UJV.mjs +0 -8
- package/dist/chunk-YCIH2Q3E.mjs +0 -1
- package/dist/chunk-ZOV5KL7C.mjs +0 -1
- package/dist/colorResolver-n0o7H7ep.d.mts +0 -290
- package/dist/core-plugins.d.mts +0 -37
- package/dist/core-plugins.mjs +0 -1
- package/dist/docx/parser.d.mts +0 -41
- package/dist/docx/parser.mjs +0 -1
- package/dist/docx/rezip.d.mts +0 -148
- package/dist/docx/rezip.mjs +0 -1
- package/dist/docx/serializer/index.d.mts +0 -42
- package/dist/docx/serializer/index.mjs +0 -1
- package/dist/editorTree-DO5PyDK8.d.mts +0 -37
- package/dist/executor-7O2RBJ2B.mjs +0 -1
- package/dist/headerFooterLayout-0zPT64Qc.d.mts +0 -316
- package/dist/headless.d.mts +0 -69
- package/dist/headless.mjs +0 -1
- package/dist/layout/flow/index.d.mts +0 -149
- package/dist/layout/flow/index.mjs +0 -1
- package/dist/layout/measure/index.d.mts +0 -324
- package/dist/layout/measure/index.mjs +0 -1
- package/dist/layout/pagination/types.d.mts +0 -4
- package/dist/layout/pagination/types.mjs +0 -1
- package/dist/managers/AutoSaveManager.d.mts +0 -81
- package/dist/managers/AutoSaveManager.mjs +0 -1
- package/dist/managers/TableSelectionManager.d.mts +0 -74
- package/dist/managers/TableSelectionManager.mjs +0 -1
- package/dist/managers/types.d.mts +0 -113
- package/dist/managers/types.mjs +0 -0
- package/dist/mcp-cli.mjs +0 -142
- package/dist/mcp.d.mts +0 -162
- package/dist/mcp.mjs +0 -16
- package/dist/measureBlocksPipeline-Df0Bbrwy.d.mts +0 -109
- package/dist/measuredBlock-DZwz8zhD.d.mts +0 -26
- package/dist/plugin-api/types.d.mts +0 -193
- package/dist/plugin-api/types.mjs +0 -0
- package/dist/processTemplate-HDUIZFJ5.mjs +0 -1
- package/dist/registry-DMM5VTdT.d.mts +0 -165
- package/dist/rustPagination-Bj2hq013.d.mts +0 -106
- package/dist/sectionConfigs-DW3J8q0X.d.mts +0 -55
- package/dist/selectionContext-Buc9BCU1.d.mts +0 -570
- package/dist/selectiveSave-oFBJ1n71.d.mts +0 -16
- package/dist/selectiveXmlPatch-ypkxlTD_.d.mts +0 -23
- package/dist/settingsParser-CcGvtmCK.d.mts +0 -33
- package/dist/types/agentApi.d.mts +0 -456
- package/dist/types/agentApi.mjs +0 -1
- package/dist/types-dYdjUZMo.d.mts +0 -311
- package/dist/units-O5Y02RKQ.d.mts +0 -34
- package/dist/utils/headingCollector.d.mts +0 -28
- package/dist/utils/headingCollector.mjs +0 -1
- package/dist/utils/highlightColors.d.mts +0 -14
- package/dist/utils/highlightColors.mjs +0 -1
- package/dist/utils/textSelection.d.mts +0 -92
- package/dist/utils/textSelection.mjs +0 -1
- package/dist/variableDetector-Borj29SF.d.mts +0 -115
- package/dist/wasm-FZQ5XB2Y.mjs +0 -1
- package/dist/watermarkApi-DCxjutkg.d.mts +0 -38
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { CompatibilityFlags } from './types/document.mjs';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Script bucket a fallback face provides glyph coverage for. Han text is
|
|
5
|
+
* region-resolved by the caller (SC/TC/JP/KR — see `rustMeasureSource.ts`);
|
|
6
|
+
* kana, Hangul, Arabic and Hebrew detect directly.
|
|
7
|
+
*
|
|
8
|
+
* @public
|
|
9
|
+
*/
|
|
10
|
+
type FontScript = 'cjk-sc' | 'cjk-tc' | 'cjk-jp' | 'cjk-kr' | 'arabic' | 'hebrew';
|
|
11
|
+
/**
|
|
12
|
+
* Resolver for the bundled metric-compatible set (Carlito↔Calibri,
|
|
13
|
+
* Liberation↔Arial/Times/Courier, …). Returns a lazy byte loader so the
|
|
14
|
+
* (lazily fetched, same-origin) binary is only downloaded when a document
|
|
15
|
+
* actually needs the face, or `undefined` when the family has no bundled
|
|
16
|
+
* substitute.
|
|
17
|
+
*
|
|
18
|
+
* @public
|
|
19
|
+
*/
|
|
20
|
+
interface BundledFontProvider {
|
|
21
|
+
/** Resolve a Word family to bundled metric-compatible face byte loaders, or undefined. */
|
|
22
|
+
resolve(family: string, bold: boolean, italic: boolean): (() => Promise<ArrayBuffer>) | undefined;
|
|
23
|
+
/**
|
|
24
|
+
* Optional per-script coverage fallback (Noto CJK/RTL faces). Same loader
|
|
25
|
+
* contract as {@link BundledFontProvider.resolve}; providers without
|
|
26
|
+
* script faces simply omit the method. These faces are coverage fallbacks
|
|
27
|
+
* first, metric approximations second — CJK metric compatibility is much
|
|
28
|
+
* weaker than the Carlito/Calibri class of substitutes.
|
|
29
|
+
*/
|
|
30
|
+
resolveScriptFallback?(script: FontScript, bold: boolean, italic: boolean): (() => Promise<ArrayBuffer>) | undefined;
|
|
31
|
+
/**
|
|
32
|
+
* The always-available last-resort base face (broad-coverage Latin —
|
|
33
|
+
* Liberation Sans/Serif per serif-ness). Unlike {@link
|
|
34
|
+
* BundledFontProvider.resolve}, a conforming provider (e.g.
|
|
35
|
+
* `@betteroffice/docx-fonts`'s `resolveLastResortFace`) returns a loader for
|
|
36
|
+
* EVERY family, so the chain this registry builds is guaranteed non-empty
|
|
37
|
+
* and a run never routes to the browser measurer for want of font bytes. The
|
|
38
|
+
* face's metrics are the base font's, not the requested family's — the
|
|
39
|
+
* accepted divergence for a truly-unknown font, in exchange for staying on
|
|
40
|
+
* the native measurement path.
|
|
41
|
+
*
|
|
42
|
+
* Optional so mock/partial providers can omit it; when absent (or returning
|
|
43
|
+
* undefined) an unmapped family still yields an empty chain and the caller
|
|
44
|
+
* browser-falls-back that run — the pre-policy behavior. Same lazy loader
|
|
45
|
+
* contract as {@link BundledFontProvider.resolve}.
|
|
46
|
+
*/
|
|
47
|
+
resolveLastResort?(family: string, bold: boolean, italic: boolean): (() => Promise<ArrayBuffer>) | undefined;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* One embedded face extracted from the open document. Structurally identical
|
|
51
|
+
* to `EmbeddedFontFace` (`utils/embeddedFonts.ts`), so the output of
|
|
52
|
+
* `getEmbeddedFontFaces` feeds straight in; duplicated here so this module
|
|
53
|
+
* stays decoupled from the loader.
|
|
54
|
+
*
|
|
55
|
+
* @public
|
|
56
|
+
*/
|
|
57
|
+
interface EmbeddedFaceInput {
|
|
58
|
+
/** Word font name the face is registered under (attacker-controlled). */
|
|
59
|
+
family: string;
|
|
60
|
+
/** `'bold'` for the embedBold/embedBoldItalic slots, else `'normal'`. */
|
|
61
|
+
weight: 'normal' | 'bold';
|
|
62
|
+
/** `'italic'` for the embedItalic/embedBoldItalic slots, else `'normal'`. */
|
|
63
|
+
style: 'normal' | 'italic';
|
|
64
|
+
/** De-obfuscated OpenType/TrueType bytes. */
|
|
65
|
+
data: ArrayBuffer;
|
|
66
|
+
/** Whether the source face was subsetted (`w:subsetted`). */
|
|
67
|
+
subsetted: boolean;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
interface RustTextEngine {
|
|
71
|
+
registerFont(bytes: Uint8Array): number;
|
|
72
|
+
clearFonts(): void;
|
|
73
|
+
}
|
|
74
|
+
interface ResidentFontRequirement {
|
|
75
|
+
key: string;
|
|
76
|
+
family: string;
|
|
77
|
+
bold: boolean;
|
|
78
|
+
italic: boolean;
|
|
79
|
+
scripts?: FontScript[];
|
|
80
|
+
}
|
|
81
|
+
interface ResidentMeasurementConfig {
|
|
82
|
+
fontChains: Record<string, number[]>;
|
|
83
|
+
defaults: {
|
|
84
|
+
fontSize: 11;
|
|
85
|
+
fontFamily: 'Calibri';
|
|
86
|
+
};
|
|
87
|
+
compat: {
|
|
88
|
+
noLeading: boolean;
|
|
89
|
+
doNotExpandShiftReturn: boolean;
|
|
90
|
+
};
|
|
91
|
+
authoritativeShaping: true;
|
|
92
|
+
}
|
|
93
|
+
interface RustMeasureSource {
|
|
94
|
+
setEmbeddedFaces(faces: EmbeddedFaceInput[]): void;
|
|
95
|
+
setCompat(flags: CompatibilityFlags | undefined): void;
|
|
96
|
+
prepareFontRequirements(requirements: ResidentFontRequirement[]): Promise<boolean>;
|
|
97
|
+
measurementConfigForRequirements(requirements: ResidentFontRequirement[]): ResidentMeasurementConfig | undefined;
|
|
98
|
+
clear(): void;
|
|
99
|
+
}
|
|
100
|
+
declare function getRustTextEngine(): Promise<RustTextEngine>;
|
|
101
|
+
declare function createRustMeasureSource(options: {
|
|
102
|
+
engine: RustTextEngine;
|
|
103
|
+
bundled?: BundledFontProvider;
|
|
104
|
+
}): RustMeasureSource;
|
|
105
|
+
|
|
106
|
+
export { type BundledFontProvider as B, type EmbeddedFaceInput as E, type FontScript as F, type ResidentMeasurementConfig as R, type ResidentFontRequirement as a, type RustMeasureSource as b, type RustTextEngine as c, createRustMeasureSource as d, getRustTextEngine as g };
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { Document } from './types/document.mjs';
|
|
2
|
+
import { D as DocxInput } from './docxInput-DTbCa48g.mjs';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Public DOCX parser facade.
|
|
6
|
+
*
|
|
7
|
+
* Rust S9 owns ZIP/XML parsing. TypeScript only normalizes host inputs,
|
|
8
|
+
* rehydrates the public `Document`, reports progress, and registers fonts.
|
|
9
|
+
* @packageDocumentation
|
|
10
|
+
* @public
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
type ProgressCallback = (stage: string, percent: number) => void;
|
|
14
|
+
interface ParseOptions {
|
|
15
|
+
onProgress?: ProgressCallback;
|
|
16
|
+
preloadFonts?: boolean;
|
|
17
|
+
parseHeadersFooters?: boolean;
|
|
18
|
+
parseNotes?: boolean;
|
|
19
|
+
}
|
|
20
|
+
declare function parseDocx(input: DocxInput, options?: ParseOptions): Promise<Document>;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Public DOCX package I/O wrappers.
|
|
24
|
+
*
|
|
25
|
+
* Model serialization and selective package writing are Rust-owned. The
|
|
26
|
+
* TypeScript kept here is compatibility glue for public ZIP utilities and host
|
|
27
|
+
* values; package inflation/deflation continues through `docx-container` wasm.
|
|
28
|
+
* @packageDocumentation
|
|
29
|
+
* @public
|
|
30
|
+
*/
|
|
31
|
+
|
|
32
|
+
interface RepackOptions {
|
|
33
|
+
/** Retained for signature compatibility; `docx-container` chooses compression. */
|
|
34
|
+
compressionLevel?: number;
|
|
35
|
+
updateModifiedDate?: boolean;
|
|
36
|
+
modifiedBy?: string;
|
|
37
|
+
}
|
|
38
|
+
/** Repack a public Document through the live Rust S13 writer. */
|
|
39
|
+
declare function repackDocx(doc: Document, options?: RepackOptions): Promise<ArrayBuffer>;
|
|
40
|
+
declare function updateMultipleFiles(originalBuffer: ArrayBuffer, updates: Map<string, string | ArrayBuffer>, options?: RepackOptions): Promise<ArrayBuffer>;
|
|
41
|
+
declare function createDocx(doc: Document): Promise<ArrayBuffer>;
|
|
42
|
+
|
|
43
|
+
/** Rust-backed selective DOCX save compatibility wrapper. */
|
|
44
|
+
|
|
45
|
+
interface SelectiveSaveOptions {
|
|
46
|
+
changedParaIds: Set<string>;
|
|
47
|
+
structuralChange: boolean;
|
|
48
|
+
hasUntrackedChanges: boolean;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Patch changed paragraphs through the Rust S13 writer. Returns `null` when
|
|
52
|
+
* selective save is unsafe so callers can fall back to a full repack.
|
|
53
|
+
*/
|
|
54
|
+
declare function attemptSelectiveSave(doc: Document, originalBuffer: ArrayBuffer, options: SelectiveSaveOptions): Promise<ArrayBuffer | null>;
|
|
55
|
+
|
|
56
|
+
export { attemptSelectiveSave as a, createDocx as c, parseDocx as p, repackDocx as r, updateMultipleFiles as u };
|
package/dist/styles/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { P as ParagraphFormatting,
|
|
2
|
-
import {
|
|
1
|
+
import { P as ParagraphFormatting, a as TextFormatting } from '../formatting-D1EPSaJP.mjs';
|
|
2
|
+
import { S as StyleDefinitions, a as Style, D as DocDefaults } from '../styles-Dn_o3Vo5.mjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Style Resolver for ProseMirror Editor
|
|
@@ -8,7 +8,7 @@ import { a as StyleDefinitions, S as Style, D as DocDefaults } from '../styles-V
|
|
|
8
8
|
* Handles the cascade:
|
|
9
9
|
* 1. Document defaults (docDefaults)
|
|
10
10
|
* 2. Normal style (if no explicit styleId)
|
|
11
|
-
* 3. Style chain (basedOn inheritance
|
|
11
|
+
* 3. Style chain (basedOn inheritance resolved during parsing)
|
|
12
12
|
* 4. Inline properties
|
|
13
13
|
*
|
|
14
14
|
* Based on ECMA-376 style cascade rules.
|
|
@@ -124,39 +124,4 @@ declare class StyleResolver {
|
|
|
124
124
|
*/
|
|
125
125
|
declare function createStyleResolver(styleDefinitions: StyleDefinitions | undefined): StyleResolver;
|
|
126
126
|
|
|
127
|
-
|
|
128
|
-
* Which table style a freshly inserted table should wear.
|
|
129
|
-
*
|
|
130
|
-
* Both insert paths (toolbar and agent) call into here so a new table picks
|
|
131
|
-
* up the document's own table look instead of a bare black grid. The
|
|
132
|
-
* document can express that look two ways, and we trust them in order of
|
|
133
|
-
* specificity: an explicit `w:defaultTableStyle` in settings.xml
|
|
134
|
-
* (§17.15.1.44) wins when it points at a real style; failing that, a table
|
|
135
|
-
* style marked `w:default="1"` (§17.7.4.18) is used — except when that
|
|
136
|
-
* default is only the formatting-free base ("Table Normal"), which every
|
|
137
|
-
* table already inherits and which would add nothing. With neither present
|
|
138
|
-
* the caller keeps its plain-border fallback.
|
|
139
|
-
*
|
|
140
|
-
* We deliberately never guess by probing for the TableGrid builtin: a
|
|
141
|
-
* document may ship that style without meaning it as its insert default,
|
|
142
|
-
* and the two spec elements above are how templates state intent.
|
|
143
|
-
*/
|
|
144
|
-
|
|
145
|
-
/**
|
|
146
|
-
* `tblLook` Word applies to a brand-new table (val="04A0"): style the first
|
|
147
|
-
* row and first column, enable horizontal banding, disable vertical banding.
|
|
148
|
-
* Setting this lets a resolved table style paint its header-row and banding
|
|
149
|
-
* conditional formatting on the inserted table, matching how Word renders a
|
|
150
|
-
* fresh table created with that style.
|
|
151
|
-
*/
|
|
152
|
-
declare const DEFAULT_NEW_TABLE_LOOK: TableLook;
|
|
153
|
-
/**
|
|
154
|
-
* StyleId a brand-new table should adopt, or `undefined` when the document
|
|
155
|
-
* declares nothing usable (the caller then keeps its plain-border default).
|
|
156
|
-
*
|
|
157
|
-
* @param settingsStyleId - `w:defaultTableStyle` from settings.xml
|
|
158
|
-
* @param styles - the document's style resolver (null when unavailable)
|
|
159
|
-
*/
|
|
160
|
-
declare function pickTableStyleForInsert(settingsStyleId: string | undefined | null, styles: StyleResolver | null | undefined): string | undefined;
|
|
161
|
-
|
|
162
|
-
export { DEFAULT_NEW_TABLE_LOOK, type ResolvedParagraphStyle, StyleResolver, createStyleResolver, pickTableStyleForInsert };
|
|
127
|
+
export { type ResolvedParagraphStyle, StyleResolver, createStyleResolver };
|
package/dist/styles/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{
|
|
1
|
+
export{b as StyleResolver,c as createStyleResolver}from'../chunk-WBH3SXI6.mjs';import'../chunk-TTRUPDAB.mjs';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { a as TextFormatting, P as ParagraphFormatting, b as TableFormatting, c as TableRowFormatting, d as TableCellFormatting } from './formatting-D1EPSaJP.mjs';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Styles, Theme, Font Table, Relationships & Media Types
|
|
@@ -186,4 +186,4 @@ interface MediaFile {
|
|
|
186
186
|
dataUrl?: string;
|
|
187
187
|
}
|
|
188
188
|
|
|
189
|
-
export type { DocDefaults as D, FontTable as F, MediaFile as M,
|
|
189
|
+
export type { DocDefaults as D, FontTable as F, MediaFile as M, RelationshipMap as R, StyleDefinitions as S, Style as a, FontEmbed as b, FontInfo as c, Relationship as d, RelationshipType as e, StyleType as f };
|
package/dist/types/content.d.mts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { B as BlockContent,
|
|
2
|
-
import '../formatting-
|
|
1
|
+
export { B as BlockContent, m as BlockSdt, n as BookmarkEnd, o as BookmarkStart, p as BreakContent, e as Chart, q as ChartAxis, r as ChartContent, t as ChartLegend, w as ChartSeries, x as ChartType, y as Column, g as Comment, I as CommentRangeEnd, J as CommentRangeStart, L as ComplexField, O as DEFAULT_WATERMARK_PRESETS, Q as Deletion, h as DocumentBody, T as DrawingContent, k as Endnote, V as EndnotePosition, E as EndnoteProperties, X as Field, Y as FieldCharContent, $ as FieldType, a0 as FooterReference, j as Footnote, a1 as FootnotePosition, F as FootnoteProperties, H as HeaderFooter, a2 as HeaderFooterType, a3 as HeaderReference, a4 as Hyperlink, a6 as Image, a7 as ImageCrop, aa as ImagePadding, ab as ImagePosition, ad as ImageSize, ae as ImageTransform, af as ImageWrap, ah as InlineSdt, ai as Insertion, aj as InstrTextContent, al as LineNumberRestart, ao as MathEquation, ap as MoveFrom, aq as MoveFromRangeEnd, ar as MoveFromRangeStart, as as MoveTo, at as MoveToRangeEnd, au as MoveToRangeStart, av as NoBreakHyphenContent, aw as NoteNumberRestart, ax as NoteRefMarkContent, ay as NoteReferenceContent, aD as PageOrientation, f as Paragraph, aE as ParagraphContent, aF as ParagraphPropertyChange, aG as PictureWatermark, aH as PropertyChangeInfo, aI as Run, aJ as RunContent, aK as RunPropertyChange, aM as SdtDataBinding, b as SdtProperties, aP as SdtType, aQ as Section, S as SectionProperties, aR as SectionStart, aS as SeparatorContent, aT as Shape, aU as ShapeContent, aV as ShapeFill, aX as ShapeOutline, aZ as ShapeTextBody, a_ as ShapeType, a$ as SimpleField, b0 as SoftHyphenContent, b3 as SymbolContent, b4 as TabContent, b5 as Table, b6 as TableCell, b7 as TableCellPropertyChange, b8 as TablePropertyChange, b9 as TableRow, ba as TableRowPropertyChange, bb as TableStructuralChangeInfo, bc as TextBox, bd as TextContent, be as TextWatermark, bf as TrackedChangeInfo, bg as TrackedRunChange, bh as VerticalAlign, W as Watermark, bi as pictureWatermarkDisplayEmu } from '../content-DLFHRQav.mjs';
|
|
2
|
+
import '../formatting-D1EPSaJP.mjs';
|
|
3
3
|
import '../docx/wrapTypes.mjs';
|
|
@@ -1,13 +1,41 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export { A as AbstractNumbering, B as BlockContent,
|
|
3
|
-
import {
|
|
4
|
-
export { B as BorderSpec,
|
|
5
|
-
import {
|
|
6
|
-
export { D as DocDefaults,
|
|
7
|
-
import { D as DocumentSettings } from '../settingsParser-CcGvtmCK.mjs';
|
|
8
|
-
export { C as CompatibilityFlags } from '../settingsParser-CcGvtmCK.mjs';
|
|
1
|
+
import { F as FootnoteProperties, E as EndnoteProperties, h as DocumentBody, i as NumberingDefinitions, j as Footnote, k as Endnote, H as HeaderFooter, e as Chart, l as BookmarkRange } from '../content-DLFHRQav.mjs';
|
|
2
|
+
export { A as AbstractNumbering, B as BlockContent, m as BlockSdt, n as BookmarkEnd, o as BookmarkStart, p as BreakContent, q as ChartAxis, r as ChartContent, s as ChartGrouping, t as ChartLegend, u as ChartPlotGroup, v as ChartPoint, w as ChartSeries, x as ChartType, y as Column, g as Comment, z as CommentAnchorRange, G as CommentAuthor, I as CommentRangeEnd, J as CommentRangeStart, K as CommentReferenceContent, L as ComplexField, M as ContentPosition, O as DEFAULT_WATERMARK_PRESETS, Q as Deletion, T as DrawingContent, D as DrawingScene, U as DrawingSceneNode, V as EndnotePosition, X as Field, Y as FieldCharContent, Z as FieldFormData, _ as FieldInlineContent, $ as FieldType, a0 as FooterReference, a1 as FootnotePosition, a2 as HeaderFooterType, a3 as HeaderReference, a4 as Hyperlink, a5 as HyperlinkContent, a6 as Image, a7 as ImageCrop, a8 as ImageEffect, a9 as ImageHyperlink, aa as ImagePadding, ab as ImagePosition, ac as ImageRotationBounds, ad as ImageSize, ae as ImageTransform, af as ImageWrap, ag as ImageWrapPoint, ah as InlineSdt, ai as Insertion, aj as InstrTextContent, ak as LevelSuffix, al as LineNumberRestart, am as ListLevel, an as ListRendering, ao as MathEquation, ap as MoveFrom, aq as MoveFromRangeEnd, ar as MoveFromRangeStart, as as MoveTo, at as MoveToRangeEnd, au as MoveToRangeStart, av as NoBreakHyphenContent, N as NoteKind, aw as NoteNumberRestart, ax as NoteRefMarkContent, ay as NoteReferenceContent, az as NoteSeparatorReference, aA as NumberFormat, aB as NumberingInstance, aC as PageNumberingProperties, aD as PageOrientation, f as Paragraph, aE as ParagraphContent, aF as ParagraphPropertyChange, aG as PictureWatermark, aH as PropertyChangeInfo, aI as Run, aJ as RunContent, aK as RunPropertyChange, aL as SdtCheckboxGlyph, a as SdtControlState, aM as SdtDataBinding, aN as SdtDateState, aO as SdtGalleryState, b as SdtProperties, aP as SdtType, aQ as Section, S as SectionProperties, aR as SectionStart, aS as SeparatorContent, aT as Shape, aU as ShapeContent, c as ShapeEffect, aV as ShapeFill, aW as ShapeFillPaint, aX as ShapeOutline, aY as ShapeStrokePaint, aZ as ShapeTextBody, d as ShapeTextBodyProperties, a_ as ShapeType, a$ as SimpleField, b0 as SoftHyphenContent, b1 as StructuredFieldContent, b2 as StructuredFieldTree, b3 as SymbolContent, b4 as TabContent, b5 as Table, b6 as TableCell, b7 as TableCellPropertyChange, b8 as TablePropertyChange, b9 as TableRow, ba as TableRowPropertyChange, bb as TableStructuralChangeInfo, bc as TextBox, bd as TextContent, be as TextWatermark, bf as TrackedChangeInfo, bg as TrackedRunChange, bh as VerticalAlign, W as Watermark, bi as pictureWatermarkDisplayEmu } from '../content-DLFHRQav.mjs';
|
|
3
|
+
import { e as Theme, C as ColorValue } from '../formatting-D1EPSaJP.mjs';
|
|
4
|
+
export { B as BorderSpec, g as CellMargins, h as ConditionalFormatStyle, E as EmphasisMark, F as FloatingTableProperties, L as LineSpacingRule, i as ParagraphAlignment, P as ParagraphFormatting, R as RunFontHint, j as RunLanguage, S as ShadingProperties, k as TabLeader, l as TabStop, m as TabStopAlignment, n as TableBorders, d as TableCellFormatting, b as TableFormatting, o as TableLook, p as TableMeasurement, c as TableRowFormatting, q as TableStyleCascade, r as TableStyleRegion, s as TableWidthType, t as TextEffect, a as TextFormatting, T as TextModernEffects, u as ThemeColorScheme, f as ThemeColorSlot, v as ThemeFont, w as ThemeFontScheme, U as UnderlineStyle } from '../formatting-D1EPSaJP.mjs';
|
|
5
|
+
import { S as StyleDefinitions, F as FontTable, R as RelationshipMap, M as MediaFile } from '../styles-Dn_o3Vo5.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-Dn_o3Vo5.mjs';
|
|
9
7
|
import '../docx/wrapTypes.mjs';
|
|
10
8
|
|
|
9
|
+
interface CompatibilityFlags {
|
|
10
|
+
compatibilityMode: number;
|
|
11
|
+
noLeading: boolean;
|
|
12
|
+
doNotExpandShiftReturn: boolean;
|
|
13
|
+
useWord97LineBreakRules: boolean;
|
|
14
|
+
balanceSingleByteDoubleByteWidth: boolean;
|
|
15
|
+
}
|
|
16
|
+
/** Public model contract rehydrated by the Rust S9 facade. */
|
|
17
|
+
interface DocumentSettings {
|
|
18
|
+
defaultTabStop: number;
|
|
19
|
+
defaultTableStyle?: string;
|
|
20
|
+
themeFontLang?: {
|
|
21
|
+
eastAsia?: string;
|
|
22
|
+
bidi?: string;
|
|
23
|
+
};
|
|
24
|
+
compatibilityFlags: CompatibilityFlags;
|
|
25
|
+
updateFields?: boolean;
|
|
26
|
+
trackRevisions?: boolean;
|
|
27
|
+
doNotTrackMoves?: boolean;
|
|
28
|
+
doNotTrackFormatting?: boolean;
|
|
29
|
+
revisionView?: {
|
|
30
|
+
markup?: boolean;
|
|
31
|
+
comments?: boolean;
|
|
32
|
+
insertionsDeletions?: boolean;
|
|
33
|
+
formatting?: boolean;
|
|
34
|
+
};
|
|
35
|
+
footnotePr?: FootnoteProperties;
|
|
36
|
+
endnotePr?: EndnoteProperties;
|
|
37
|
+
}
|
|
38
|
+
|
|
11
39
|
/**
|
|
12
40
|
* Comprehensive TypeScript types for full DOCX document representation
|
|
13
41
|
*
|
|
@@ -91,12 +119,12 @@ interface DocxPackage {
|
|
|
91
119
|
* Top-level parsed DOCX document — the result of `parseDocx(buffer)`.
|
|
92
120
|
*
|
|
93
121
|
* Wraps the unzipped DOCX package (`document.xml`, `styles.xml`, etc.),
|
|
94
|
-
* the original buffer for round-trip saves
|
|
95
|
-
*
|
|
122
|
+
* the original buffer for round-trip saves and parse warnings detected during
|
|
123
|
+
* ingestion.
|
|
96
124
|
*
|
|
97
125
|
* @example
|
|
98
126
|
* ```ts
|
|
99
|
-
* import { parseDocx } from '@betteroffice/docx/
|
|
127
|
+
* import { parseDocx } from '@betteroffice/docx/docx';
|
|
100
128
|
* const doc = await parseDocx(buffer);
|
|
101
129
|
* console.log(doc.package.document.content.length);
|
|
102
130
|
* ```
|
|
@@ -108,10 +136,8 @@ interface Document {
|
|
|
108
136
|
package: DocxPackage;
|
|
109
137
|
/** Original DOCX buffer. Kept for round-trip saves that preserve untouched parts. */
|
|
110
138
|
originalBuffer?: ArrayBuffer;
|
|
111
|
-
/** Detected docxtemplater variables (e.g. `{name}`, `{address}`). Populated when the document is recognized as a template. */
|
|
112
|
-
templateVariables?: string[];
|
|
113
139
|
/** Non-fatal parser diagnostics — malformed parts, unsupported features, fallbacks. */
|
|
114
140
|
warnings?: string[];
|
|
115
141
|
}
|
|
116
142
|
|
|
117
|
-
export { BookmarkRange, Chart, ColorValue, type Document, DocumentBody, DocumentSettings, type DocxPackage, Endnote, FontTable, Footnote, HeaderFooter, MediaFile, NumberingDefinitions, RelationshipMap, StyleDefinitions, Theme };
|
|
143
|
+
export { BookmarkRange, Chart, ColorValue, type CompatibilityFlags, type Document, DocumentBody, type DocumentSettings, type DocxPackage, Endnote, EndnoteProperties, FontTable, Footnote, FootnoteProperties, HeaderFooter, MediaFile, NumberingDefinitions, RelationshipMap, StyleDefinitions, Theme };
|
|
@@ -1,68 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Layout checkpoints — page-start bookmarks carried on `Layout.checkpoints`.
|
|
6
|
-
*
|
|
7
|
-
* A checkpoint captures everything a paginator holds when a block starts on a
|
|
8
|
-
* pristine page: the block about to be placed, the section cursor, and the
|
|
9
|
-
* live page-flow geometry (including any continuous-section geometry still
|
|
10
|
-
* queued per ECMA-376 §17.6.22). The field is derived data — fully determined
|
|
11
|
-
* by the same inputs as the layout itself — and remains an optional part of
|
|
12
|
-
* the `Layout` contract (omitted from the golden serialization; see
|
|
13
|
-
* `__golden__/serializeLayout.ts`). The Rust engine performs full passes and
|
|
14
|
-
* does not resume from checkpoints.
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
/** Stable section/page state copied onto every page created in a section. */
|
|
18
|
-
type PageSectionState = {
|
|
19
|
-
emitPageMetadata?: boolean;
|
|
20
|
-
sectionIndex?: number;
|
|
21
|
-
sectionId?: string;
|
|
22
|
-
orientation?: 'portrait' | 'landscape';
|
|
23
|
-
headerFooterRefs?: PageHeaderFooterRefs;
|
|
24
|
-
pageNumbering?: PageNumberingContract;
|
|
25
|
-
pageBorders?: PageBorderContract;
|
|
26
|
-
watermark?: SectionBreakBlock['watermark'];
|
|
27
|
-
verticalAlign?: SectionBreakBlock['verticalAlign'];
|
|
28
|
-
noteSettings?: NoteSettingsContract;
|
|
29
|
-
};
|
|
30
|
-
/**
|
|
31
|
-
* The page-flow geometry a layout checkpoint captures: everything a
|
|
32
|
-
* paginator's closure holds that survives across pages, including geometry
|
|
33
|
-
* queued by a continuous section break (ECMA-376 §17.6.22) that has not been
|
|
34
|
-
* applied yet. Plain data — checkpoints ride on `Layout`.
|
|
35
|
-
*/
|
|
36
|
-
type PageFlowGeometry = {
|
|
37
|
-
pageSize: {
|
|
38
|
-
w: number;
|
|
39
|
-
h: number;
|
|
40
|
-
};
|
|
41
|
-
margins: PageMargins;
|
|
42
|
-
columns: ColumnLayout;
|
|
43
|
-
pendingPageSize?: {
|
|
44
|
-
w: number;
|
|
45
|
-
h: number;
|
|
46
|
-
};
|
|
47
|
-
pendingMargins?: PageMargins;
|
|
48
|
-
section?: PageSectionState;
|
|
49
|
-
pendingSection?: PageSectionState;
|
|
50
|
-
sectionPageIndex?: number;
|
|
51
|
-
lastLogicalPageNumber?: number;
|
|
52
|
-
lastCreatedSectionKey?: string;
|
|
53
|
-
};
|
|
54
|
-
interface LayoutCheckpoint {
|
|
55
|
-
/** Index of the measured block about to be placed on the pristine page. */
|
|
56
|
-
blockIndex: number;
|
|
57
|
-
/** The place walk's section cursor at that point. */
|
|
58
|
-
sectionIdx: number;
|
|
59
|
-
/** Index into `Layout.pages` of the page being started. */
|
|
60
|
-
pageIndex: number;
|
|
61
|
-
/** 1-based page number of that page. */
|
|
62
|
-
pageNumber: number;
|
|
63
|
-
/** Live paginator geometry at the moment the page was created. */
|
|
64
|
-
flow: PageFlowGeometry;
|
|
65
|
-
}
|
|
1
|
+
import { a as SdtControlState, b as SdtProperties, R as RevisionInfo, C as CellMarker, P as PresetGeometryPathCommand, D as DrawingScene, c as ShapeEffect, d as ShapeTextBodyProperties, e as Chart, W as Watermark, F as FootnoteProperties, E as EndnoteProperties } from './content-DLFHRQav.mjs';
|
|
2
|
+
import { T as TextModernEffects, B as BorderSpec } from './formatting-D1EPSaJP.mjs';
|
|
66
3
|
|
|
67
4
|
/**
|
|
68
5
|
* Inline SDT widget metadata carried by a painted text run.
|
|
@@ -1541,11 +1478,6 @@ type Layout = {
|
|
|
1541
1478
|
footers?: Record<string, HeaderFooterLayout>;
|
|
1542
1479
|
/** Gap between pages in pixels (for rendering). */
|
|
1543
1480
|
pageGap?: number;
|
|
1544
|
-
/**
|
|
1545
|
-
* Resume bookmarks for incremental pagination (derived data — omitted from
|
|
1546
|
-
* golden serialization). See `checkpoints.ts`.
|
|
1547
|
-
*/
|
|
1548
|
-
checkpoints?: LayoutCheckpoint[];
|
|
1549
1481
|
};
|
|
1550
1482
|
/**
|
|
1551
1483
|
* Measured header/footer heights keyed by variant.
|
|
@@ -1751,4 +1683,4 @@ interface FootnoteRenderItem {
|
|
|
1751
1683
|
content?: FootnoteContent;
|
|
1752
1684
|
}
|
|
1753
1685
|
|
|
1754
|
-
export { type
|
|
1686
|
+
export { type ParagraphExtent as $, type AnchoredObjectPositionInput as A, type BlockExtent as B, type CellBorderSpec as C, DEFAULT_TEXTBOX_MARGINS as D, type ImageRunPosition as E, type FootnoteContent as F, type InlineSdtWidget as G, type HeaderFooterContent as H, type ImageBlock as I, type LineBreakRun as J, type ListNumPr as K, type LayoutBlock as L, type NoteLayoutItem as M, type NoteAreaContract as N, type NoteSettingsContract as O, type Page as P, type PageBorderContract as Q, type ResolvedLine as R, type PageBreakBlock as S, type PageBreakExtent as T, type PageGeometry as U, type PageHeaderFooterRefs as V, type PageMargins as W, type PageNumberingContract as X, type ParagraphAttrs as Y, type ParagraphBlock as Z, type ParagraphBorders as _, type Layout as a, type ParagraphFragment as a0, type ParagraphIndent as a1, type ParagraphSpacing as a2, type Run as a3, type RunFontSlots as a4, type RunFormatting as a5, type RunLanguageSlots as a6, type SdtGroup as a7, type SectionBreakBlock as a8, type SectionBreakExtent as a9, assertExhaustiveLayoutBlock as aA, isTextWrappingFloatingImageRun as aB, pageGeometryFromPage as aC, resolveAnchoredObjectVerticalTop as aD, type ShapeBlock as aa, type ShapeBlockFill as ab, type ShapeBlockStroke as ac, type ShapeBlockTransform as ad, type ShapeExtent as ae, type ShapeFragment as af, type TabAlignment as ag, type TabRun as ah, type TabStop as ai, type TableBlock as aj, type TableCell as ak, type TableCellExtent as al, type TableExtent as am, type TableFragment as an, type TableRow as ao, type TableRowExtent as ap, type TextBoxBlock as aq, type TextBoxExtent as ar, type TextBoxFragment as as, type TextRun as at, type TypesetBidiSlice as au, type TypesetClusterAdvance as av, type TypesetRow as aw, type TypesetRowSegment as ax, type TypesetRunAdvance as ay, type WrapTextDirection as az, type LayoutOptions as b, type ResolvedSegment as c, type BlockId as d, type BorderStyle as e, type CellBorders as f, type ChartBlock as g, type ChartExtent as h, type ChartFragment as i, type ColumnBreakBlock as j, type ColumnBreakExtent as k, type ColumnLayout as l, DEFAULT_TEXTBOX_WIDTH as m, type DocumentPosition as n, type FieldRun as o, type FloatingTablePosition as p, type FootnoteRenderItem as q, type Fragment as r, type FragmentBase as s, type HeaderFooterContentHeights as t, type HeaderFooterLayout as u, type HitTestResult as v, type HyperlinkInfo as w, type ImageExtent as x, type ImageFragment as y, type ImageRun as z };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import '../formatting-
|
|
1
|
+
import { f as Paragraph, B as BlockContent, g as Comment } from '../content-DLFHRQav.mjs';
|
|
2
|
+
import '../formatting-D1EPSaJP.mjs';
|
|
3
3
|
import '../docx/wrapTypes.mjs';
|
|
4
4
|
|
|
5
5
|
/**
|