@betteroffice/docx 0.0.1
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/LICENSE +201 -0
- package/README.md +41 -0
- package/dist/Subscribable-DOz6Ohoo.d.mts +33 -0
- package/dist/agent/index.d.mts +531 -0
- package/dist/agent/index.mjs +1 -0
- package/dist/chunk-34K66SY4.mjs +1 -0
- package/dist/chunk-3UBMCDME.mjs +1 -0
- package/dist/chunk-4RCISPPE.mjs +1 -0
- package/dist/chunk-4UD54UM5.mjs +1 -0
- package/dist/chunk-52GB3Y42.mjs +1 -0
- package/dist/chunk-6NEKRDXF.mjs +1 -0
- package/dist/chunk-6PW4CWUG.mjs +1 -0
- package/dist/chunk-7DEIW7FL.mjs +1 -0
- package/dist/chunk-7PCO5I2O.mjs +1 -0
- package/dist/chunk-BI3B33LI.mjs +1 -0
- package/dist/chunk-BIQWVK5P.mjs +2 -0
- package/dist/chunk-CIRN3LZA.mjs +1 -0
- package/dist/chunk-DXKG3HQ5.mjs +16 -0
- package/dist/chunk-EUUIJVM6.mjs +0 -0
- package/dist/chunk-FPZBTOD6.mjs +1 -0
- package/dist/chunk-FZIA7OFY.mjs +1 -0
- package/dist/chunk-GWKJ2Y4Y.mjs +1 -0
- package/dist/chunk-H3JCIGWK.mjs +1 -0
- package/dist/chunk-HJGAQIU7.mjs +2 -0
- package/dist/chunk-I6KKMUUC.mjs +1 -0
- package/dist/chunk-IL5JZJT7.mjs +1 -0
- package/dist/chunk-JY6ILTNS.mjs +1 -0
- package/dist/chunk-KEE52TT5.mjs +1 -0
- package/dist/chunk-KVKLLTDP.mjs +58 -0
- package/dist/chunk-KXNZFTTK.mjs +1 -0
- package/dist/chunk-L5ISVQ3W.mjs +1 -0
- package/dist/chunk-LDUWIM7M.mjs +1 -0
- package/dist/chunk-N5Q3YN64.mjs +1 -0
- package/dist/chunk-NEWOMDTX.mjs +1 -0
- package/dist/chunk-O2QSE2I7.mjs +1 -0
- package/dist/chunk-OBQGPMPQ.mjs +1 -0
- package/dist/chunk-OJOHXQNQ.mjs +1 -0
- package/dist/chunk-OMR3TWCD.mjs +2 -0
- package/dist/chunk-P3KDV4M2.mjs +1 -0
- package/dist/chunk-Q7PO7V73.mjs +1 -0
- package/dist/chunk-QOUFE3VX.mjs +1 -0
- package/dist/chunk-SINEY6ZF.mjs +1 -0
- package/dist/chunk-T4EZMUXM.mjs +1 -0
- package/dist/chunk-TTRUPDAB.mjs +1 -0
- package/dist/chunk-TYHI7RAD.mjs +1 -0
- package/dist/chunk-UIEJWORW.mjs +1 -0
- package/dist/chunk-VAOUFAUH.mjs +1 -0
- package/dist/chunk-VBOTMRXV.mjs +1 -0
- package/dist/chunk-VCER63GQ.mjs +1 -0
- package/dist/chunk-WAUF2UC7.mjs +2 -0
- package/dist/chunk-WRWRCBLK.mjs +1 -0
- package/dist/chunk-X4XDO3LZ.mjs +1 -0
- package/dist/chunk-XQBCCJBO.mjs +9 -0
- package/dist/chunk-XWUOLYRQ.mjs +2 -0
- package/dist/chunk-XYH6XWP3.mjs +10 -0
- package/dist/chunk-YBIM6UJV.mjs +8 -0
- package/dist/chunk-YCIH2Q3E.mjs +1 -0
- package/dist/chunk-YUOKI2HB.mjs +1 -0
- package/dist/chunk-ZOV5KL7C.mjs +1 -0
- package/dist/colorResolver-n0o7H7ep.d.mts +290 -0
- package/dist/content-sSHuWw49.d.mts +2202 -0
- package/dist/core-plugins.d.mts +37 -0
- package/dist/core-plugins.mjs +1 -0
- package/dist/core.d.mts +451 -0
- package/dist/core.mjs +1 -0
- package/dist/displayListQueries-p-ijSzdh.d.mts +222 -0
- package/dist/docx/index.d.mts +618 -0
- package/dist/docx/index.mjs +2 -0
- package/dist/docx/parser.d.mts +41 -0
- package/dist/docx/parser.mjs +1 -0
- package/dist/docx/rezip.d.mts +148 -0
- package/dist/docx/rezip.mjs +1 -0
- package/dist/docx/serializer/index.d.mts +42 -0
- package/dist/docx/serializer/index.mjs +1 -0
- package/dist/docx/wrapTypes.d.mts +19 -0
- package/dist/docx/wrapTypes.mjs +1 -0
- package/dist/docxInput-DTbCa48g.d.mts +21 -0
- package/dist/editor/index.d.mts +170 -0
- package/dist/editor/index.mjs +1 -0
- package/dist/editorTree-DO5PyDK8.d.mts +37 -0
- package/dist/executor-7O2RBJ2B.mjs +1 -0
- package/dist/fontLoader-Bx6DK6-2.d.mts +327 -0
- package/dist/formatting-DoL7KBSL.d.mts +823 -0
- 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/headerFooterLayout-0zPT64Qc.d.mts +316 -0
- package/dist/headless.d.mts +69 -0
- package/dist/headless.mjs +1 -0
- package/dist/layout/flow/index.d.mts +149 -0
- package/dist/layout/flow/index.mjs +1 -0
- package/dist/layout/index.d.mts +307 -0
- package/dist/layout/index.mjs +1 -0
- package/dist/layout/measure/index.d.mts +324 -0
- package/dist/layout/measure/index.mjs +1 -0
- package/dist/layout/pagination/index.d.mts +60 -0
- package/dist/layout/pagination/index.mjs +1 -0
- package/dist/layout/pagination/types.d.mts +4 -0
- package/dist/layout/pagination/types.mjs +1 -0
- package/dist/layout/render/index.d.mts +733 -0
- package/dist/layout/render/index.mjs +1 -0
- package/dist/loadWasmAsset-CMvnVkfA.d.mts +3 -0
- package/dist/managers/AutoSaveManager.d.mts +81 -0
- package/dist/managers/AutoSaveManager.mjs +1 -0
- package/dist/managers/TableSelectionManager.d.mts +74 -0
- package/dist/managers/TableSelectionManager.mjs +1 -0
- package/dist/managers/types.d.mts +113 -0
- package/dist/managers/types.mjs +0 -0
- package/dist/mcp-cli.mjs +142 -0
- package/dist/mcp.d.mts +162 -0
- package/dist/mcp.mjs +16 -0
- package/dist/measureBlocksPipeline-Df0Bbrwy.d.mts +109 -0
- package/dist/measuredBlock-DZwz8zhD.d.mts +26 -0
- package/dist/plugin-api/RenderedDomContext.d.mts +114 -0
- package/dist/plugin-api/RenderedDomContext.mjs +1 -0
- package/dist/plugin-api/index.d.mts +7 -0
- package/dist/plugin-api/index.mjs +0 -0
- package/dist/plugin-api/resolveItemPositions.d.mts +39 -0
- package/dist/plugin-api/resolveItemPositions.mjs +1 -0
- package/dist/plugin-api/types.d.mts +193 -0
- package/dist/plugin-api/types.mjs +0 -0
- package/dist/processTemplate-HDUIZFJ5.mjs +1 -0
- package/dist/registry-DMM5VTdT.d.mts +165 -0
- package/dist/rustDisplayList-dqunvwxH.d.mts +1036 -0
- package/dist/rustPagination-Bj2hq013.d.mts +106 -0
- package/dist/sectionConfigs-DW3J8q0X.d.mts +55 -0
- package/dist/selectionContext-Buc9BCU1.d.mts +570 -0
- package/dist/selectiveSave-oFBJ1n71.d.mts +16 -0
- package/dist/selectiveXmlPatch-ypkxlTD_.d.mts +23 -0
- package/dist/settingsParser-CcGvtmCK.d.mts +33 -0
- package/dist/styles/index.d.mts +162 -0
- package/dist/styles/index.mjs +1 -0
- package/dist/styles-VxNcXLdi.d.mts +189 -0
- package/dist/types/agentApi.d.mts +456 -0
- package/dist/types/agentApi.mjs +1 -0
- package/dist/types/content.d.mts +3 -0
- package/dist/types/content.mjs +1 -0
- package/dist/types/document.d.mts +117 -0
- package/dist/types/document.mjs +1 -0
- package/dist/types-DNrYr6yQ.d.mts +1754 -0
- package/dist/types-dYdjUZMo.d.mts +311 -0
- package/dist/units-O5Y02RKQ.d.mts +34 -0
- package/dist/utils/autoScroll.d.mts +24 -0
- package/dist/utils/autoScroll.mjs +1 -0
- package/dist/utils/cardStyles.d.mts +22 -0
- package/dist/utils/cardStyles.mjs +1 -0
- package/dist/utils/comments.d.mts +120 -0
- package/dist/utils/comments.mjs +4 -0
- package/dist/utils/findReplace.d.mts +114 -0
- package/dist/utils/findReplace.mjs +2 -0
- package/dist/utils/findVerticalScrollParent.d.mts +25 -0
- package/dist/utils/findVerticalScrollParent.mjs +1 -0
- package/dist/utils/fontOptions.d.mts +21 -0
- package/dist/utils/fontOptions.mjs +1 -0
- package/dist/utils/headingCollector.d.mts +28 -0
- package/dist/utils/headingCollector.mjs +1 -0
- package/dist/utils/highlightColors.d.mts +14 -0
- package/dist/utils/highlightColors.mjs +1 -0
- package/dist/utils/index.d.mts +956 -0
- package/dist/utils/index.mjs +84 -0
- package/dist/utils/listState.d.mts +27 -0
- package/dist/utils/listState.mjs +1 -0
- package/dist/utils/reportIssue.d.mts +23 -0
- package/dist/utils/reportIssue.mjs +2 -0
- package/dist/utils/sidebarConstants.d.mts +10 -0
- package/dist/utils/sidebarConstants.mjs +1 -0
- package/dist/utils/stylePreview.d.mts +70 -0
- package/dist/utils/stylePreview.mjs +1 -0
- package/dist/utils/textSelection.d.mts +92 -0
- package/dist/utils/textSelection.mjs +1 -0
- package/dist/utils/units.d.mts +78 -0
- package/dist/utils/units.mjs +1 -0
- package/dist/variableDetector-Borj29SF.d.mts +115 -0
- package/dist/wasm-FZQ5XB2Y.mjs +1 -0
- package/dist/wasm-SA237OSP.mjs +1 -0
- package/dist/wasm-edit.d.mts +473 -0
- package/dist/wasm-edit.mjs +1 -0
- package/dist/wasm-layout.d.mts +112 -0
- package/dist/wasm-layout.mjs +1 -0
- package/dist/wasm-opc.d.mts +16 -0
- package/dist/wasm-opc.mjs +1 -0
- package/dist/wasm-parse.d.mts +18 -0
- package/dist/wasm-parse.mjs +1 -0
- package/dist/watermarkApi-DCxjutkg.d.mts +38 -0
- package/dist/yrs/index.d.mts +882 -0
- package/dist/yrs/index.mjs +1 -0
- package/dist/yrs/residentEngineWorker.d.mts +2 -0
- package/dist/yrs/residentEngineWorker.mjs +1 -0
- package/package.json +365 -0
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { L as LayoutOptions, a as Layout } from './types-DNrYr6yQ.mjs';
|
|
2
|
+
import { M as MeasuredBlock } from './measuredBlock-DZwz8zhD.mjs';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* The mandatory Rust pagination source — the seam through which EVERY
|
|
6
|
+
* pagination pass (full, incremental-trigger, footnote pass 1, and each
|
|
7
|
+
* footnote-stabilization iteration in `layout/regions/footnoteLayout.ts`)
|
|
8
|
+
* runs the wasm `docx-layout` engine. There is no TypeScript pagination
|
|
9
|
+
* kernel anymore; this seam is the only way a `Layout` is produced.
|
|
10
|
+
*
|
|
11
|
+
* Contract (pinned by the golden corpus — `__golden__/rustParity.test.ts`
|
|
12
|
+
* proves the engine reproduces every golden byte-for-byte, and
|
|
13
|
+
* `__golden__/rustPaginationSeam.test.ts` proves this seam adds zero drift
|
|
14
|
+
* on top):
|
|
15
|
+
* - Input marshaling is exactly the golden convention:
|
|
16
|
+
* `JSON.stringify({ measured, options }, mapReplacer)` where the replacer
|
|
17
|
+
* turns `Map`s (`options.footnoteReservedHeights`) into plain objects
|
|
18
|
+
* keyed by decimal page number — the shape the Rust `LayoutOptions`
|
|
19
|
+
* deserializer expects.
|
|
20
|
+
* - `layout_document_json` in, `Layout` JSON out. Engine failures THROW —
|
|
21
|
+
* the layout pipeline surfaces the error (`onError` / console) and keeps
|
|
22
|
+
* the previous committed layout; nothing falls back to a hidden kernel.
|
|
23
|
+
* - The wasm engine is synchronous once loaded. Adapters gate layout passes
|
|
24
|
+
* on {@link RustPaginationSource.isReady} / `whenReady()` (the same
|
|
25
|
+
* defer-and-rerun pattern as the Rust measurement readiness gate), so
|
|
26
|
+
* `paginate` never runs against an unloaded engine. The wasm module is
|
|
27
|
+
* shared with the measurement engine, so in practice it is already
|
|
28
|
+
* resolved by the time the first measured pass reaches pagination.
|
|
29
|
+
*
|
|
30
|
+
* @packageDocumentation
|
|
31
|
+
* @public
|
|
32
|
+
*/
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* The narrow seam `editor/computeLayout.ts` consumes: a synchronous
|
|
36
|
+
* pagination call over the measured blocks + options, plus the readiness
|
|
37
|
+
* surface adapters use to defer layout passes until the wasm engine has
|
|
38
|
+
* loaded. `paginate` throws if called before readiness or when the engine
|
|
39
|
+
* rejects the input — there is no fallback engine.
|
|
40
|
+
*
|
|
41
|
+
* @public
|
|
42
|
+
*/
|
|
43
|
+
interface LayoutPaginationSource {
|
|
44
|
+
/** Paginate through the loaded Rust engine. Throws when not ready or on engine failure. */
|
|
45
|
+
paginate(measured: MeasuredBlock[], options: LayoutOptions): Layout;
|
|
46
|
+
/** Whether the wasm engine has finished its lazy load. */
|
|
47
|
+
isReady(): boolean;
|
|
48
|
+
/** Resolves when the engine is loaded; rejects if the load failed. */
|
|
49
|
+
whenReady(): Promise<void>;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Thin sync facade over the wasm pagination export (`layout_document_json`).
|
|
53
|
+
* Injectable so unit tests can script responses without loading wasm — the
|
|
54
|
+
* same pattern as the measurement seam's `RustTextEngine`.
|
|
55
|
+
*
|
|
56
|
+
* @public
|
|
57
|
+
*/
|
|
58
|
+
interface RustLayoutEngine {
|
|
59
|
+
/** `{ measured, options }` JSON in, `Layout` JSON out. Throws on any input the engine rejects. */
|
|
60
|
+
layoutDocumentJson(input: string): string;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Lazily load the embedded wasm module and expose its pagination surface as
|
|
64
|
+
* a {@link RustLayoutEngine}. The dynamic `import()` keeps the ~800KB base64
|
|
65
|
+
* module out of the synchronous require graph; the module — and therefore
|
|
66
|
+
* the wasm instantiation — is shared with the measurement seam
|
|
67
|
+
* (`getRustTextEngine`), so only one load happens per session.
|
|
68
|
+
*
|
|
69
|
+
* @public
|
|
70
|
+
*/
|
|
71
|
+
declare function getRustLayoutEngine(): Promise<RustLayoutEngine>;
|
|
72
|
+
/** Counters for observability (passes paginated / engine errors). @public */
|
|
73
|
+
interface RustPaginationStats {
|
|
74
|
+
/** Layout passes paginated by the Rust engine. */
|
|
75
|
+
rustPaginated: number;
|
|
76
|
+
/** Passes where the engine threw (the pass produced no layout). */
|
|
77
|
+
engineErrors: number;
|
|
78
|
+
}
|
|
79
|
+
/** Options for {@link createRustPaginationSource}. @public */
|
|
80
|
+
interface RustPaginationSourceOptions {
|
|
81
|
+
/** Pre-loaded engine (tests). When set, the source is ready immediately. */
|
|
82
|
+
engine?: RustLayoutEngine;
|
|
83
|
+
/** Engine loader override (tests). Defaults to {@link getRustLayoutEngine}. */
|
|
84
|
+
loadEngine?: () => Promise<RustLayoutEngine>;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* The mandatory pagination source. Create with
|
|
88
|
+
* {@link createRustPaginationSource}; see the module doc for the contract.
|
|
89
|
+
*
|
|
90
|
+
* @public
|
|
91
|
+
*/
|
|
92
|
+
interface RustPaginationSource extends LayoutPaginationSource {
|
|
93
|
+
/** Snapshot of the pagination counters (never reset implicitly). */
|
|
94
|
+
getStats(): RustPaginationStats;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Build a {@link RustPaginationSource}. The wasm load starts immediately at
|
|
98
|
+
* construction; adapters defer layout passes until `isReady()` and re-run
|
|
99
|
+
* the pipeline off `whenReady()` — mirroring the Rust measurement readiness
|
|
100
|
+
* gate, and sharing the same underlying wasm module load.
|
|
101
|
+
*
|
|
102
|
+
* @public
|
|
103
|
+
*/
|
|
104
|
+
declare function createRustPaginationSource(opts?: RustPaginationSourceOptions): RustPaginationSource;
|
|
105
|
+
|
|
106
|
+
export { type LayoutPaginationSource as L, type RustLayoutEngine as R, type RustPaginationSource as a, type RustPaginationSourceOptions as b, type RustPaginationStats as c, createRustPaginationSource as d, getRustLayoutEngine as g };
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { P as PageMargins, C as ColumnLayout, b as PageHeaderFooterRefs, c as PageNumberingContract, d as PageBorderContract, S as SectionBreakBlock, N as NoteSettingsContract, e as LayoutBlock, L as LayoutOptions } from './types-DNrYr6yQ.mjs';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Per-section geometry collection.
|
|
5
|
+
*
|
|
6
|
+
* Walks a block list once and resolves the effective page geometry of every
|
|
7
|
+
* section (size, margins, columns, header/footer refs, numbering, borders,
|
|
8
|
+
* …), inheriting from the previous section where a break leaves a property
|
|
9
|
+
* unset and applying any upstream section contracts. The live consumer is
|
|
10
|
+
* `layout/regions/sectionGeometry.ts` (per-section measurement widths); the
|
|
11
|
+
* Rust engine mirrors the same resolution natively.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Page-flow geometry resolved from a single section's properties.
|
|
16
|
+
* Exported so the React paged editor can reuse the same shape when
|
|
17
|
+
* measuring blocks per section width — keeping pagination and
|
|
18
|
+
* measurement consistent.
|
|
19
|
+
*/
|
|
20
|
+
type SectionLayoutConfig = {
|
|
21
|
+
pageSize: {
|
|
22
|
+
w: number;
|
|
23
|
+
h: number;
|
|
24
|
+
};
|
|
25
|
+
margins: PageMargins;
|
|
26
|
+
/** Optional. Sections without explicit columns inherit `{ count: 1 }`. */
|
|
27
|
+
columns?: ColumnLayout;
|
|
28
|
+
/** Stable section/page state copied onto every page created in this section. */
|
|
29
|
+
sectionIndex?: number;
|
|
30
|
+
sectionId?: string;
|
|
31
|
+
orientation?: 'portrait' | 'landscape';
|
|
32
|
+
headerFooterRefs?: PageHeaderFooterRefs;
|
|
33
|
+
pageNumbering?: PageNumberingContract;
|
|
34
|
+
pageBorders?: PageBorderContract;
|
|
35
|
+
watermark?: SectionBreakBlock['watermark'];
|
|
36
|
+
verticalAlign?: SectionBreakBlock['verticalAlign'];
|
|
37
|
+
noteSettings?: NoteSettingsContract;
|
|
38
|
+
/** Versioned page metadata is emitted only when an upstream contract opts in. */
|
|
39
|
+
emitPageMetadata?: boolean;
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
* Walk `blocks` once and collect per-section geometry. `configs` has one
|
|
43
|
+
* entry per section break plus a trailing `finalConfig`. `breakIndices` is
|
|
44
|
+
* 1-to-1 with the inner break entries (same length as `configs.length - 1`).
|
|
45
|
+
* Callers that need the break `type` can read it from
|
|
46
|
+
* `(blocks[breakIndices[i]] as SectionBreakBlock).type`.
|
|
47
|
+
*
|
|
48
|
+
* @internal
|
|
49
|
+
*/
|
|
50
|
+
declare function collectSectionConfigs(blocks: LayoutBlock[], initialConfig: SectionLayoutConfig, finalConfig: SectionLayoutConfig, sectionContracts?: LayoutOptions['sections']): {
|
|
51
|
+
configs: SectionLayoutConfig[];
|
|
52
|
+
breakIndices: number[];
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
export { type SectionLayoutConfig as S, collectSectionConfigs as c };
|