@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
|
@@ -1,149 +0,0 @@
|
|
|
1
|
-
import { E as EditorTreeNode } from '../../editorTree-DO5PyDK8.mjs';
|
|
2
|
-
import { j as BorderStyle, e as LayoutBlock, ao as TableBlock } from '../../types-DNrYr6yQ.mjs';
|
|
3
|
-
import { a as Theme } from '../../formatting-DoL7KBSL.mjs';
|
|
4
|
-
import { aC as NumberFormat } from '../../content-sSHuWw49.mjs';
|
|
5
|
-
import '../../docx/wrapTypes.mjs';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Shared types and primitive helpers used across toLayoutBlocks sub-modules.
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Options for the conversion.
|
|
13
|
-
*/
|
|
14
|
-
type ToLayoutBlocksOptions = {
|
|
15
|
-
/** Default font family. */
|
|
16
|
-
defaultFont?: string;
|
|
17
|
-
/** Default font size in points. */
|
|
18
|
-
defaultSize?: number;
|
|
19
|
-
/** Theme for resolving theme colors. */
|
|
20
|
-
theme?: Theme | null;
|
|
21
|
-
/** Page content height in pixels (pageHeight - marginTop - marginBottom). Images taller than this are scaled down to fit. */
|
|
22
|
-
pageContentHeight?: number;
|
|
23
|
-
/**
|
|
24
|
-
* Document-wide `w:defaultTabStop` (§17.6.13) in twips. Stamped onto each
|
|
25
|
-
* paragraph's attrs so the layout-time list-marker helper can snap body
|
|
26
|
-
* text to the default tab grid when no custom `w:tabs` are defined.
|
|
27
|
-
* Default 720 twips (Word's spec default).
|
|
28
|
-
*/
|
|
29
|
-
defaultTabStopTwips?: number;
|
|
30
|
-
/**
|
|
31
|
-
* @internal Allocated by toLayoutBlocks() and threaded through table /
|
|
32
|
-
* text-box conversion so list numbering stays continuous across containers.
|
|
33
|
-
* Keyed by abstractNumId when known (ECMA-376 §17.9.18: numIds sharing one
|
|
34
|
-
* abstractNum share counter state); falls back to numId.
|
|
35
|
-
*/
|
|
36
|
-
listCounters?: Map<number, number[]>;
|
|
37
|
-
/**
|
|
38
|
-
* @internal Tracks `${numId}:${ilvl}` pairs whose startOverride has already
|
|
39
|
-
* been applied. Per ECMA-376 §17.9.27 the override fires the first time
|
|
40
|
-
* each level of a numId is encountered, so a numId with overrides on
|
|
41
|
-
* multiple ilvls fires each one independently.
|
|
42
|
-
*/
|
|
43
|
-
listSeenNumIds?: Set<string>;
|
|
44
|
-
};
|
|
45
|
-
declare function resetBlockIdCounter(): void;
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* Border Conversion
|
|
49
|
-
*
|
|
50
|
-
* Shared OOXML BorderSpec → layout/pagination BorderStyle conversion, used by
|
|
51
|
-
* paragraph borders, table cell borders, and header/footer borders.
|
|
52
|
-
*/
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* Convert an OOXML BorderSpec to a layout/pagination BorderStyle.
|
|
56
|
-
* Shared by paragraph borders, cell borders, and header/footer borders.
|
|
57
|
-
*/
|
|
58
|
-
declare function convertBorderSpecToLayout(border: {
|
|
59
|
-
style?: string;
|
|
60
|
-
size?: number;
|
|
61
|
-
space?: number;
|
|
62
|
-
color?: {
|
|
63
|
-
rgb?: string;
|
|
64
|
-
themeColor?: string;
|
|
65
|
-
themeTint?: string;
|
|
66
|
-
themeShade?: string;
|
|
67
|
-
};
|
|
68
|
-
}, theme?: Theme | null): BorderStyle | undefined;
|
|
69
|
-
|
|
70
|
-
/**
|
|
71
|
-
* List Marker Resolution
|
|
72
|
-
*
|
|
73
|
-
* Helpers for rendering OOXML list markers from the counter stack:
|
|
74
|
-
* - format numbers as decimal/roman/letter per ECMA-376 §17.9.16 numFmt
|
|
75
|
-
* - resolve lvlText templates ("%1.%2.") against the counter stack
|
|
76
|
-
* - drive the per-paragraph counter increment, including startOverride.
|
|
77
|
-
*/
|
|
78
|
-
|
|
79
|
-
/**
|
|
80
|
-
* Resolve an OOXML lvlText template like "%1.%2." against the counter stack
|
|
81
|
-
* and per-level numFmt list (ECMA-376 §17.9.11).
|
|
82
|
-
*
|
|
83
|
-
* When a referenced counter has no value yet (e.g. "%2" referenced from a
|
|
84
|
-
* level-0 paragraph), the placeholder AND the punctuation immediately
|
|
85
|
-
* following it are dropped — matches Word's behavior so "%1.%2." renders
|
|
86
|
-
* "1." rather than "1..".
|
|
87
|
-
*
|
|
88
|
-
* Exported for unit testing.
|
|
89
|
-
*/
|
|
90
|
-
declare function resolveListTemplate(template: string, counters: number[], levelNumFmts: NumberFormat[] | undefined): string;
|
|
91
|
-
|
|
92
|
-
/**
|
|
93
|
-
* ProseMirror to LayoutBlock Converter
|
|
94
|
-
*
|
|
95
|
-
* Converts a ProseMirror document into LayoutBlock[] for the layout engine.
|
|
96
|
-
* Tracks pmStart/pmEnd positions for click-to-position mapping.
|
|
97
|
-
*
|
|
98
|
-
* The deep import `@openooxml/.../layout/flow` is part of the
|
|
99
|
-
* public surface (Vue adapter + tests), so the per-domain helpers under
|
|
100
|
-
* ./toLayoutBlocks/ are re-exported from here to keep that path stable.
|
|
101
|
-
* @packageDocumentation
|
|
102
|
-
* @public
|
|
103
|
-
*/
|
|
104
|
-
|
|
105
|
-
/**
|
|
106
|
-
* Convert a ProseMirror document to LayoutBlock array.
|
|
107
|
-
*
|
|
108
|
-
* Walks the document tree, converting each node to the appropriate block type.
|
|
109
|
-
* Tracks pmStart/pmEnd positions for each block for click-to-position mapping.
|
|
110
|
-
*/
|
|
111
|
-
declare function toLayoutBlocks(doc: EditorTreeNode, options?: ToLayoutBlocksOptions): LayoutBlock[];
|
|
112
|
-
|
|
113
|
-
/**
|
|
114
|
-
* Floating-table compatibility helpers.
|
|
115
|
-
*
|
|
116
|
-
* A DOCX table with `w:tblpPr` is a positioned ("floating") table — text wraps
|
|
117
|
-
* around it. But contract templates routinely make a full-width form table
|
|
118
|
-
* floating (often a paste artifact), leaving NO horizontal room for text on
|
|
119
|
-
* either side. Word and Google Docs treat such a table as a normal in-flow
|
|
120
|
-
* block: it paginates across pages and following content flows beneath it.
|
|
121
|
-
*
|
|
122
|
-
* The paginator now preserves authored floating status: block-like floats
|
|
123
|
-
* advance flow beneath their exclusion, and unavoidable tall floats fragment
|
|
124
|
-
* at safe row/line boundaries.
|
|
125
|
-
*
|
|
126
|
-
* The predicate mirrors the geometry in `layoutFloatingTable` (the existing
|
|
127
|
-
* block-like cursor-advance) and `extractFloatingTableZone`; keep the three in
|
|
128
|
-
* sync. Narrow floating tables — where text genuinely wraps beside them — fall
|
|
129
|
-
* below the threshold and stay floating.
|
|
130
|
-
*/
|
|
131
|
-
|
|
132
|
-
/**
|
|
133
|
-
* True when a floating table is effectively full-width — it leaves less than
|
|
134
|
-
* {@link MIN_WRAP_SEGMENT_WIDTH} of usable text room on BOTH sides, so no text
|
|
135
|
-
* can wrap beside it. Returns false for non-floating tables and for narrow
|
|
136
|
-
* floats that leave real wrap room.
|
|
137
|
-
*
|
|
138
|
-
* @internal
|
|
139
|
-
*/
|
|
140
|
-
declare function isBlockLikeFloatingTable(block: TableBlock, contentWidth: number): boolean;
|
|
141
|
-
/**
|
|
142
|
-
* Legacy no-op kept so external callers compiled against the old helper do not
|
|
143
|
-
* break. Authored `floating` is never cleared.
|
|
144
|
-
*
|
|
145
|
-
* @internal
|
|
146
|
-
*/
|
|
147
|
-
declare function demoteBlockLikeFloatingTables(_blocks: LayoutBlock[], _blockWidths: number[], _fallbackWidth: number): void;
|
|
148
|
-
|
|
149
|
-
export { type ToLayoutBlocksOptions, convertBorderSpecToLayout, demoteBlockLikeFloatingTables, isBlockLikeFloatingTable, resetBlockIdCounter, resolveListTemplate, toLayoutBlocks };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export{a as convertBorderSpecToLayout,e as demoteBlockLikeFloatingTables,d as isBlockLikeFloatingTable,b as resolveListTemplate,c as toLayoutBlocks}from'../../chunk-IL5JZJT7.mjs';export{d as resetBlockIdCounter}from'../../chunk-GWKJ2Y4Y.mjs';import'../../chunk-52GB3Y42.mjs';import'../../chunk-X4XDO3LZ.mjs';import'../../chunk-L5ISVQ3W.mjs';import'../../chunk-XWUOLYRQ.mjs';import'../../chunk-HJGAQIU7.mjs';import'../../chunk-FZIA7OFY.mjs';import'../../chunk-OBQGPMPQ.mjs';import'../../chunk-3UBMCDME.mjs';import'../../chunk-FPZBTOD6.mjs';import'../../chunk-H3JCIGWK.mjs';import'../../chunk-SINEY6ZF.mjs';import'../../chunk-T4EZMUXM.mjs';import'../../chunk-TTRUPDAB.mjs';
|
|
@@ -1,324 +0,0 @@
|
|
|
1
|
-
import { M as MeasureBlockFn } from '../../measureBlocksPipeline-Df0Bbrwy.mjs';
|
|
2
|
-
export { F as FloatPageGeometry, a as FloatingExclusionRect, b as FloatingImageZone, c as FloatingLineSegmentZone, d as clampFloatingWrapMargins, g as getFloatingMargins, m as measureBlocksWithFloats, r as rectsToFloatingZones } from '../../measureBlocksPipeline-Df0Bbrwy.mjs';
|
|
3
|
-
import { C as CompatibilityFlags } from '../../settingsParser-CcGvtmCK.mjs';
|
|
4
|
-
import { e as LayoutBlock, a1 as ParagraphBlock } from '../../types-DNrYr6yQ.mjs';
|
|
5
|
-
import '../../content-sSHuWw49.mjs';
|
|
6
|
-
import '../../formatting-DoL7KBSL.mjs';
|
|
7
|
-
import '../../docx/wrapTypes.mjs';
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Script bucket a fallback face provides glyph coverage for. Han text is
|
|
11
|
-
* region-resolved by the caller (SC/TC/JP/KR — see `rustMeasureSource.ts`);
|
|
12
|
-
* kana, Hangul, Arabic and Hebrew detect directly.
|
|
13
|
-
*
|
|
14
|
-
* @public
|
|
15
|
-
*/
|
|
16
|
-
type FontScript = 'cjk-sc' | 'cjk-tc' | 'cjk-jp' | 'cjk-kr' | 'arabic' | 'hebrew';
|
|
17
|
-
/**
|
|
18
|
-
* Resolver for the bundled metric-compatible set (Carlito↔Calibri,
|
|
19
|
-
* Liberation↔Arial/Times/Courier, …). Returns a lazy byte loader so the
|
|
20
|
-
* (lazily fetched, same-origin) binary is only downloaded when a document
|
|
21
|
-
* actually needs the face, or `undefined` when the family has no bundled
|
|
22
|
-
* substitute.
|
|
23
|
-
*
|
|
24
|
-
* @public
|
|
25
|
-
*/
|
|
26
|
-
interface BundledFontProvider {
|
|
27
|
-
/** Resolve a Word family to bundled metric-compatible face byte loaders, or undefined. */
|
|
28
|
-
resolve(family: string, bold: boolean, italic: boolean): (() => Promise<ArrayBuffer>) | undefined;
|
|
29
|
-
/**
|
|
30
|
-
* Optional per-script coverage fallback (Noto CJK/RTL faces). Same loader
|
|
31
|
-
* contract as {@link BundledFontProvider.resolve}; providers without
|
|
32
|
-
* script faces simply omit the method. These faces are coverage fallbacks
|
|
33
|
-
* first, metric approximations second — CJK metric compatibility is much
|
|
34
|
-
* weaker than the Carlito/Calibri class of substitutes.
|
|
35
|
-
*/
|
|
36
|
-
resolveScriptFallback?(script: FontScript, bold: boolean, italic: boolean): (() => Promise<ArrayBuffer>) | undefined;
|
|
37
|
-
/**
|
|
38
|
-
* The always-available last-resort base face (broad-coverage Latin —
|
|
39
|
-
* Liberation Sans/Serif per serif-ness). Unlike {@link
|
|
40
|
-
* BundledFontProvider.resolve}, a conforming provider (e.g.
|
|
41
|
-
* `@betteroffice/docx-fonts`'s `resolveLastResortFace`) returns a loader for
|
|
42
|
-
* EVERY family, so the chain this registry builds is guaranteed non-empty
|
|
43
|
-
* and a run never routes to the browser measurer for want of font bytes. The
|
|
44
|
-
* face's metrics are the base font's, not the requested family's — the
|
|
45
|
-
* accepted divergence for a truly-unknown font, in exchange for staying on
|
|
46
|
-
* the native measurement path.
|
|
47
|
-
*
|
|
48
|
-
* Optional so mock/partial providers can omit it; when absent (or returning
|
|
49
|
-
* undefined) an unmapped family still yields an empty chain and the caller
|
|
50
|
-
* browser-falls-back that run — the pre-policy behavior. Same lazy loader
|
|
51
|
-
* contract as {@link BundledFontProvider.resolve}.
|
|
52
|
-
*/
|
|
53
|
-
resolveLastResort?(family: string, bold: boolean, italic: boolean): (() => Promise<ArrayBuffer>) | undefined;
|
|
54
|
-
}
|
|
55
|
-
/**
|
|
56
|
-
* One embedded face extracted from the open document. Structurally identical
|
|
57
|
-
* to `EmbeddedFontFace` (`utils/embeddedFonts.ts`), so the output of
|
|
58
|
-
* `getEmbeddedFontFaces` feeds straight in; duplicated here so this module
|
|
59
|
-
* stays decoupled from the loader.
|
|
60
|
-
*
|
|
61
|
-
* @public
|
|
62
|
-
*/
|
|
63
|
-
interface EmbeddedFaceInput {
|
|
64
|
-
/** Word font name the face is registered under (attacker-controlled). */
|
|
65
|
-
family: string;
|
|
66
|
-
/** `'bold'` for the embedBold/embedBoldItalic slots, else `'normal'`. */
|
|
67
|
-
weight: 'normal' | 'bold';
|
|
68
|
-
/** `'italic'` for the embedItalic/embedBoldItalic slots, else `'normal'`. */
|
|
69
|
-
style: 'normal' | 'italic';
|
|
70
|
-
/** De-obfuscated OpenType/TrueType bytes. */
|
|
71
|
-
data: ArrayBuffer;
|
|
72
|
-
/** Whether the source face was subsetted (`w:subsetted`). */
|
|
73
|
-
subsetted: boolean;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
/**
|
|
77
|
-
* The Rust measurement source — the SOLE text/layout measurement path. Every
|
|
78
|
-
* block kind is measured here: paragraphs through the wasm `docx-text` engine
|
|
79
|
-
* (Word metrics), tables/text boxes/shapes by pure recursion through the same
|
|
80
|
-
* measurer, and image/chart/break extents synthesized from declared
|
|
81
|
-
* dimensions. There is no browser `measureText` anywhere in layout.
|
|
82
|
-
*
|
|
83
|
-
* Division of labor:
|
|
84
|
-
* - {@link TextMeasureFontRegistry} (owned here) turns Word font requests
|
|
85
|
-
* into ordered engine font-id chains from embedded + bundled bytes, and
|
|
86
|
-
* resolves the shared per-script coverage fallbacks (CJK/RTL Noto faces).
|
|
87
|
-
* Resolution is deterministic: embedded faces → bundled metric-compatible
|
|
88
|
-
* face → always-available last-resort base face; never OS/local fonts.
|
|
89
|
-
* - {@link RustMeasureSource.prepareFonts} is the ONLY async step: it warms
|
|
90
|
-
* the registry for every (family, bold, italic) combo a block list uses,
|
|
91
|
-
* plus the script fallbacks for every script detected in the blocks'
|
|
92
|
-
* text — and for every request an earlier measure pass found unresolved
|
|
93
|
-
* (header/footer and footnote paragraphs reach measurement without
|
|
94
|
-
* passing through the adapters' block notifications; recording their
|
|
95
|
-
* misses here closes that gap). Call sites re-layout after it resolves.
|
|
96
|
-
* - {@link RustMeasureSource.createMeasureBlock} builds the sync
|
|
97
|
-
* `MeasureBlockFn` the float pipeline consumes. Paragraph blocks whose
|
|
98
|
-
* font chains are cached go to the engine — float-zoned blocks included,
|
|
99
|
-
* with the zones and cumulative Y passed through in the envelope.
|
|
100
|
-
*
|
|
101
|
-
* READINESS GATE (how measurement never races an unloaded face): a paragraph
|
|
102
|
-
* whose font chain (or script fallback) has not settled yet measures as a
|
|
103
|
-
* deterministic SYNTHETIC extent and records the miss;
|
|
104
|
-
* {@link RustMeasureSource.hasPendingFonts} then reports true, the adapter
|
|
105
|
-
* discards that provisional pass instead of committing it, and re-runs the
|
|
106
|
-
* pipeline when `prepareFonts` settles. Once settled, `font-unready` can
|
|
107
|
-
* never recur for those chains (the sync registry view is populated), so
|
|
108
|
-
* committed layouts are always measured against real, loaded font bytes.
|
|
109
|
-
*
|
|
110
|
-
* SELF-SUFFICIENT FONTS: every family chain the registry builds terminates in
|
|
111
|
-
* an always-available last-resort base face (broad-coverage Liberation
|
|
112
|
-
* Sans/Serif per serif-ness, supplied by the bundled provider's
|
|
113
|
-
* `resolveLastResort`), and the per-script Noto fallback is appended whenever
|
|
114
|
-
* a covered script is detected. A run whose family has no embedded/bundled
|
|
115
|
-
* match — or a character outside the family chain's coverage — still has real
|
|
116
|
-
* font bytes to measure with; the engine substitutes the terminal face's
|
|
117
|
-
* `.notdef` for genuinely uncovered characters. For a truly-unknown font the
|
|
118
|
-
* measured metrics are the base font's, not the requested family's — the
|
|
119
|
-
* accepted, deterministic substitution tradeoff.
|
|
120
|
-
*
|
|
121
|
-
* SYNTHETIC extents (deterministic pure arithmetic, no font tables, no
|
|
122
|
-
* platform state) stand in for exactly two residual cases: (a) an engine
|
|
123
|
-
* refusal — degenerate/attacker-crafted input tripping the security clamps,
|
|
124
|
-
* or a malformed payload; (b) a chain that SETTLED EMPTY, which can only
|
|
125
|
-
* happen when the host injects no bundled provider (`resolveLastResort`
|
|
126
|
-
* guarantees non-empty chains otherwise) and the document embeds nothing for
|
|
127
|
-
* the family. Both are counted in {@link RustMeasureStats}.
|
|
128
|
-
*
|
|
129
|
-
* Script fallbacks: runs are scanned for Unicode script ranges — kana → JP,
|
|
130
|
-
* Hangul → KR, Arabic → arabic, Hebrew → hebrew — and Han is region-resolved:
|
|
131
|
-
* kana in the same block wins (Japanese text), else the document's
|
|
132
|
-
* `w:themeFontLang` eastAsia hint ({@link RustMeasureSource.setScriptHints}),
|
|
133
|
-
* else Hangul in the block (hanja), else SC. The resolved script ids are
|
|
134
|
-
* appended AFTER the family faces of every chain the block uses, so the
|
|
135
|
-
* family face keeps supplying metrics/Latin glyphs and the script face only
|
|
136
|
-
* covers what the family face cannot. RTL text measures natively (the engine
|
|
137
|
-
* splits UBA level runs before shaping).
|
|
138
|
-
*
|
|
139
|
-
* @packageDocumentation
|
|
140
|
-
* @public
|
|
141
|
-
*/
|
|
142
|
-
|
|
143
|
-
/**
|
|
144
|
-
* Font styling properties for a short-text measurement request (the
|
|
145
|
-
* `measureTextWidthWithActiveRustSource` latch and tab-leader glyph
|
|
146
|
-
* sizing).
|
|
147
|
-
*
|
|
148
|
-
* @public
|
|
149
|
-
*/
|
|
150
|
-
interface FontStyle {
|
|
151
|
-
fontFamily?: string;
|
|
152
|
-
/** In points. */
|
|
153
|
-
fontSize?: number;
|
|
154
|
-
bold?: boolean;
|
|
155
|
-
italic?: boolean;
|
|
156
|
-
/** In pixels. */
|
|
157
|
-
letterSpacing?: number;
|
|
158
|
-
}
|
|
159
|
-
/**
|
|
160
|
-
* Thin sync facade over the wasm measure exports (`register_measure_font`,
|
|
161
|
-
* `clear_measure_fonts`, `measure_paragraph_json`). Injectable so unit tests
|
|
162
|
-
* can script responses without loading wasm.
|
|
163
|
-
*
|
|
164
|
-
* @public
|
|
165
|
-
*/
|
|
166
|
-
interface RustTextEngine {
|
|
167
|
-
/** Register raw sfnt bytes; returns the engine font id. Throws on bad bytes. */
|
|
168
|
-
registerFont(bytes: Uint8Array): number;
|
|
169
|
-
/** Drop every registered font (ids restart at 0). */
|
|
170
|
-
clearFonts(): void;
|
|
171
|
-
/**
|
|
172
|
-
* Measurement input JSON in, `ParagraphExtent` JSON out. Throws with a
|
|
173
|
-
* message starting `UNSUPPORTED:` for blocks the engine cannot measure.
|
|
174
|
-
*/
|
|
175
|
-
measureParagraphJson(input: string): string;
|
|
176
|
-
}
|
|
177
|
-
/**
|
|
178
|
-
* Lazily load the embedded wasm module and expose its measure surface as a
|
|
179
|
-
* {@link RustTextEngine}. The dynamic `import()` keeps the ~800KB base64
|
|
180
|
-
* module out of the default bundle — only callers that actually enable Rust
|
|
181
|
-
* measurement pay for it (same pattern as the display-list builder's
|
|
182
|
-
* `loadEngine`).
|
|
183
|
-
*
|
|
184
|
-
* @public
|
|
185
|
-
*/
|
|
186
|
-
declare function getRustTextEngine(): Promise<RustTextEngine>;
|
|
187
|
-
/** Counters for the debug log line (rust vs synthetic per layout pass). */
|
|
188
|
-
interface RustMeasureStats {
|
|
189
|
-
/** Paragraph blocks measured by the Rust engine (including memo hits). */
|
|
190
|
-
rustMeasured: number;
|
|
191
|
-
/** Paragraphs that measured as a synthetic extent — sum of the reasons below. */
|
|
192
|
-
syntheticFallback: number;
|
|
193
|
-
/**
|
|
194
|
-
* Synthetic extents caused by a font chain (or script fallback) not having
|
|
195
|
-
* resolved yet. Transient by construction: the miss is recorded, the
|
|
196
|
-
* adapter discards the pass (`hasPendingFonts`), and the fonts-settled
|
|
197
|
-
* re-layout measures natively — so no COMMITTED layout ever contains one,
|
|
198
|
-
* and this MUST hold constant once `prepareFonts` settles.
|
|
199
|
-
*/
|
|
200
|
-
syntheticFontUnready: number;
|
|
201
|
-
/**
|
|
202
|
-
* Synthetic extents caused by an engine glyph-coverage refusal. Dormant —
|
|
203
|
-
* chains terminate in a last-resort face whose `.notdef` the shaper
|
|
204
|
-
* substitutes — but kept so a coverage regression is categorized rather
|
|
205
|
-
* than lumped in with `non-font` refusals.
|
|
206
|
-
*/
|
|
207
|
-
syntheticUncovered: number;
|
|
208
|
-
/**
|
|
209
|
-
* Synthetic-extent counts by `LayoutBlock.kind`. The audit counter proving
|
|
210
|
-
* text-bearing block kinds (`paragraph`, `table`, `textBox`) measure
|
|
211
|
-
* natively once fonts are ready.
|
|
212
|
-
*/
|
|
213
|
-
syntheticBlockKinds: Record<string, number>;
|
|
214
|
-
}
|
|
215
|
-
/**
|
|
216
|
-
* The selectable measurement source. Create with
|
|
217
|
-
* {@link createRustMeasureSource}; see the module doc for the contract.
|
|
218
|
-
*
|
|
219
|
-
* @public
|
|
220
|
-
*/
|
|
221
|
-
interface RustMeasureSource {
|
|
222
|
-
/** Feed the open document's embedded faces (invalidates the measure memo). */
|
|
223
|
-
setEmbeddedFaces(faces: EmbeddedFaceInput[]): void;
|
|
224
|
-
/**
|
|
225
|
-
* Thread the document's compat flags (`w:compat`) into every subsequent
|
|
226
|
-
* engine call. Pass `undefined` to reset to all-off defaults. The memo key
|
|
227
|
-
* includes the flags, so switching documents cannot serve stale extents.
|
|
228
|
-
*/
|
|
229
|
-
setCompat(flags: CompatibilityFlags | undefined): void;
|
|
230
|
-
/**
|
|
231
|
-
* Thread document-level script hints into Han region resolution: pass the
|
|
232
|
-
* `w:themeFontLang` eastAsia tag (`settingsParser` → `themeFontLang`).
|
|
233
|
-
* Without a hint (or with a non-East-Asian tag) Han-only text defaults to
|
|
234
|
-
* Simplified Chinese. Invalidates the measure memo — region choice changes
|
|
235
|
-
* the fallback face and therefore the measured extents.
|
|
236
|
-
*/
|
|
237
|
-
setScriptHints(hints: {
|
|
238
|
-
eastAsia?: string;
|
|
239
|
-
} | undefined): void;
|
|
240
|
-
/**
|
|
241
|
-
* Warm the font registry for every (family, bold, italic) combo — plus the
|
|
242
|
-
* per-family regulars and the per-script coverage fallbacks — that
|
|
243
|
-
* `blocks`' paragraphs use, AND for every request an earlier measure pass
|
|
244
|
-
* recorded as unresolved (header/footer and footnote paragraphs reach the
|
|
245
|
-
* measurer without appearing in the adapters' block lists). The only async
|
|
246
|
-
* step; per-face failures are tolerated (the chain settles without that
|
|
247
|
-
* face). Resolves `true` when at least one previously-unsettled chain or
|
|
248
|
-
* script fallback settled — even settled-empty — i.e. a re-layout would
|
|
249
|
-
* measure differently (or the deferred pass can now proceed).
|
|
250
|
-
*/
|
|
251
|
-
prepareFonts(blocks: LayoutBlock[]): Promise<boolean>;
|
|
252
|
-
/**
|
|
253
|
-
* True while a font chain (or script fallback) some measured paragraph
|
|
254
|
-
* needed is still unresolved. The adapter's readiness gate: a pass measured
|
|
255
|
-
* with pending fonts is provisional (those paragraphs carry synthetic
|
|
256
|
-
* extents) and must be discarded, not committed; `prepareFonts` settles the
|
|
257
|
-
* pending set and the fonts-ready re-layout measures natively. Self-clears
|
|
258
|
-
* once every recorded request has settled.
|
|
259
|
-
*/
|
|
260
|
-
hasPendingFonts(): boolean;
|
|
261
|
-
/**
|
|
262
|
-
* The sync measure function for the float pipeline — the sole measurement
|
|
263
|
-
* path, exhaustive over every `LayoutBlock` kind. Paragraph blocks whose
|
|
264
|
-
* chains (and detected script fallbacks) are cached go to the engine —
|
|
265
|
-
* float-zoned blocks pass their zones and cumulative Y through in the
|
|
266
|
-
* envelope (measured fresh, never memoized). Tables, text boxes and shapes
|
|
267
|
-
* recurse through the same measurer; images/charts/breaks synthesize
|
|
268
|
-
* extents from declared dimensions. Unresolved chains and engine refusals
|
|
269
|
-
* produce deterministic synthetic extents (see the module doc).
|
|
270
|
-
*/
|
|
271
|
-
createMeasureBlock(): MeasureBlockFn;
|
|
272
|
-
/**
|
|
273
|
-
* The merged, doc-wide font-id chain map for `blocks` — every
|
|
274
|
-
* `"<family lowercase>|<bold 0|1>|<italic 0|1>"` combo the blocks' paragraphs
|
|
275
|
-
* use, mapped to its cached engine font-id chain (with the per-block script
|
|
276
|
-
* fallbacks appended after the family faces, exactly as
|
|
277
|
-
* {@link RustMeasureSource.createMeasureBlock} assembles them). Only chains that
|
|
278
|
-
* are already resolved (non-empty in the sync registry cache) are included; a
|
|
279
|
-
* combo whose chain has not settled yet is simply omitted (its runs stay on
|
|
280
|
-
* the char-distributed draw path until `prepareFonts` settles and a
|
|
281
|
-
* re-layout retries). Returns an empty object when nothing is resolved.
|
|
282
|
-
*
|
|
283
|
-
* This is the map the canvas display-list builder consumes to gate GlyphRun
|
|
284
|
-
* emission: the ids reference the same measurement `FontStore` the engine
|
|
285
|
-
* registered, so the outline provider can rasterize them.
|
|
286
|
-
*/
|
|
287
|
-
getDocumentFontChains(blocks: LayoutBlock[]): Record<string, number[]>;
|
|
288
|
-
/** Drop every cached chain, registration, and memoized measure. */
|
|
289
|
-
clear(): void;
|
|
290
|
-
/** Snapshot of the rust-vs-fallback counters (never reset implicitly). */
|
|
291
|
-
getStats(): RustMeasureStats;
|
|
292
|
-
}
|
|
293
|
-
/**
|
|
294
|
-
* Build a {@link RustMeasureSource} over a loaded engine. The source owns a
|
|
295
|
-
* {@link TextMeasureFontRegistry} whose sink is `engine.registerFont`;
|
|
296
|
-
* `bundled` is the optional metric-compatible font provider (injected — core
|
|
297
|
-
* never imports a fonts package).
|
|
298
|
-
*
|
|
299
|
-
* @public
|
|
300
|
-
*/
|
|
301
|
-
declare function createRustMeasureSource(opts: {
|
|
302
|
-
engine: RustTextEngine;
|
|
303
|
-
bundled?: BundledFontProvider;
|
|
304
|
-
}): RustMeasureSource;
|
|
305
|
-
|
|
306
|
-
/**
|
|
307
|
-
* Stable identity hash for a paragraph block, used as the Rust measure
|
|
308
|
-
* memo's key so blocks that would lay out identically share one measurement.
|
|
309
|
-
* Every field that can change the rendered result contributes a labelled
|
|
310
|
-
* token; the assembled token list is serialized as JSON so no separator
|
|
311
|
-
* character can leak in from content.
|
|
312
|
-
*
|
|
313
|
-
* @packageDocumentation
|
|
314
|
-
* @public
|
|
315
|
-
*/
|
|
316
|
-
|
|
317
|
-
/**
|
|
318
|
-
* Build the stable identity string for a paragraph block.
|
|
319
|
-
*
|
|
320
|
-
* @public
|
|
321
|
-
*/
|
|
322
|
-
declare function hashParagraphBlock(block: ParagraphBlock): string;
|
|
323
|
-
|
|
324
|
-
export { type BundledFontProvider, type EmbeddedFaceInput, type FontScript, type FontStyle, MeasureBlockFn, type RustMeasureSource, type RustMeasureStats, type RustTextEngine, createRustMeasureSource, getRustTextEngine, hashParagraphBlock };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export{h as createRustMeasureSource,e as getRustTextEngine,d as hashParagraphBlock,c as measureBlocksWithFloats}from'../../chunk-7DEIW7FL.mjs';export{g as clampFloatingWrapMargins,i as getFloatingMargins,h as rectsToFloatingZones}from'../../chunk-52GB3Y42.mjs';import'../../chunk-7PCO5I2O.mjs';import'../../chunk-X4XDO3LZ.mjs';import'../../chunk-OBQGPMPQ.mjs';import'../../chunk-3UBMCDME.mjs';import'../../chunk-TTRUPDAB.mjs';
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
export { A as AnchoredObjectPositionInput, B as BlockExtent, f as BlockId, j as BorderStyle, k as CellBorderSpec, l as CellBorders, m as ChartBlock, n as ChartExtent, o as ChartFragment, p as ColumnBreakBlock, q as ColumnBreakExtent, C as ColumnLayout, D as DEFAULT_TEXTBOX_MARGINS, r as DEFAULT_TEXTBOX_WIDTH, s as DocumentPosition, t as FieldRun, u as FloatingTablePosition, F as FootnoteContent, h as FootnoteRenderItem, v as Fragment, w as FragmentBase, H as HeaderFooterContent, x as HeaderFooterContentHeights, y as HeaderFooterLayout, z as HitTestResult, E as HyperlinkInfo, G as ImageBlock, J as ImageExtent, K as ImageFragment, I as ImageRun, M as ImageRunPosition, O as InlineSdtWidget, a as Layout, e as LayoutBlock, L as LayoutOptions, R as LineBreakRun, U as ListNumPr, V as NoteAreaContract, X as NoteLayoutItem, N as NoteSettingsContract, g as Page, d as PageBorderContract, Y as PageBreakBlock, Z as PageBreakExtent, i as PageGeometry, b as PageHeaderFooterRefs, P as PageMargins, c as PageNumberingContract, a0 as ParagraphAttrs, a1 as ParagraphBlock, a2 as ParagraphBorders, a3 as ParagraphExtent, a4 as ParagraphFragment, a5 as ParagraphIndent, a6 as ParagraphSpacing, a7 as ResolvedLine, a8 as ResolvedSegment, a9 as Run, aa as RunFontSlots, ab as RunFormatting, ac as RunLanguageSlots, ad as SdtGroup, S as SectionBreakBlock, ae as SectionBreakExtent, af as ShapeBlock, ag as ShapeBlockFill, ah as ShapeBlockStroke, ai as ShapeBlockTransform, aj as ShapeExtent, ak as ShapeFragment, al as TabAlignment, am as TabRun, an as TabStop, ao as TableBlock, ap as TableCell, aq as TableCellExtent, ar as TableExtent, as as TableFragment, at as TableRow, au as TableRowExtent, T as TextBoxBlock, av as TextBoxExtent, aw as TextBoxFragment, ax as TextRun, ay as TypesetBidiSlice, az as TypesetClusterAdvance, aA as TypesetRow, aB as TypesetRowSegment, aC as TypesetRunAdvance, W as WrapTextDirection, aD as assertExhaustiveLayoutBlock, aE as isTextWrappingFloatingImageRun, aF as pageGeometryFromPage, aG as resolveAnchoredObjectVerticalTop } from '../../types-DNrYr6yQ.mjs';
|
|
2
|
-
import '../../content-sSHuWw49.mjs';
|
|
3
|
-
import '../../formatting-DoL7KBSL.mjs';
|
|
4
|
-
import '../../docx/wrapTypes.mjs';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export{a as DEFAULT_TEXTBOX_MARGINS,b as DEFAULT_TEXTBOX_WIDTH,c as assertExhaustiveLayoutBlock,f as isTextWrappingFloatingImageRun,d as pageGeometryFromPage,e as resolveAnchoredObjectVerticalTop}from'../../chunk-X4XDO3LZ.mjs';import'../../chunk-OBQGPMPQ.mjs';import'../../chunk-3UBMCDME.mjs';import'../../chunk-TTRUPDAB.mjs';
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
import { S as Subscribable } from '../Subscribable-DOz6Ohoo.mjs';
|
|
2
|
-
import { AutoSaveSnapshot, AutoSaveManagerOptions, SavedDocumentData, AutoSaveStatus } from './types.mjs';
|
|
3
|
-
import { Document } from '../types/document.mjs';
|
|
4
|
-
import '../content-sSHuWw49.mjs';
|
|
5
|
-
import '../formatting-DoL7KBSL.mjs';
|
|
6
|
-
import '../docx/wrapTypes.mjs';
|
|
7
|
-
import '../styles-VxNcXLdi.mjs';
|
|
8
|
-
import '../settingsParser-CcGvtmCK.mjs';
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* AutoSaveManager
|
|
12
|
-
*
|
|
13
|
-
* Framework-agnostic class for auto-saving documents to localStorage.
|
|
14
|
-
* Extracted from the React `useAutoSave` hook.
|
|
15
|
-
*
|
|
16
|
-
* Usage with React:
|
|
17
|
-
* ```ts
|
|
18
|
-
* const snapshot = useSyncExternalStore(manager.subscribe, manager.getSnapshot);
|
|
19
|
-
* ```
|
|
20
|
-
* @packageDocumentation
|
|
21
|
-
* @public
|
|
22
|
-
*/
|
|
23
|
-
|
|
24
|
-
declare class AutoSaveManager extends Subscribable<AutoSaveSnapshot> {
|
|
25
|
-
private storageKey;
|
|
26
|
-
private interval;
|
|
27
|
-
private maxAge;
|
|
28
|
-
private saveOnChange;
|
|
29
|
-
private debounceDelay;
|
|
30
|
-
private onSaveCallback?;
|
|
31
|
-
private onErrorCallback?;
|
|
32
|
-
private onRecoveryAvailableCallback?;
|
|
33
|
-
private storageAvailable;
|
|
34
|
-
private currentDocument;
|
|
35
|
-
private lastSavedJson;
|
|
36
|
-
private intervalTimer;
|
|
37
|
-
private debounceTimer;
|
|
38
|
-
private status;
|
|
39
|
-
private lastSaveTime;
|
|
40
|
-
private _hasRecoveryData;
|
|
41
|
-
private _isEnabled;
|
|
42
|
-
constructor(options?: AutoSaveManagerOptions);
|
|
43
|
-
/** Update the current document. Triggers debounced save if enabled. */
|
|
44
|
-
onDocumentChanged(document: Document | null): void;
|
|
45
|
-
/** Manually trigger a save. */
|
|
46
|
-
save(): Promise<boolean>;
|
|
47
|
-
/** Clear auto-saved data from storage. */
|
|
48
|
-
clear(): void;
|
|
49
|
-
/** Get recovery data from storage. */
|
|
50
|
-
getRecoveryData(): SavedDocumentData | null;
|
|
51
|
-
/** Accept recovery and return the document. */
|
|
52
|
-
acceptRecovery(): Document | null;
|
|
53
|
-
/** Dismiss recovery and clear saved data. */
|
|
54
|
-
dismissRecovery(): void;
|
|
55
|
-
/** Enable auto-save and start the interval timer. */
|
|
56
|
-
enable(): void;
|
|
57
|
-
/** Disable auto-save and stop all timers. */
|
|
58
|
-
disable(): void;
|
|
59
|
-
/** Start the interval timer. Call after enabling or on init. */
|
|
60
|
-
startInterval(): void;
|
|
61
|
-
/** Save synchronously on destroy (best-effort). */
|
|
62
|
-
destroy(): void;
|
|
63
|
-
private checkRecoveryData;
|
|
64
|
-
private persistToStorage;
|
|
65
|
-
private debounceSave;
|
|
66
|
-
private stopTimers;
|
|
67
|
-
private updateStatus;
|
|
68
|
-
private emitSnapshot;
|
|
69
|
-
}
|
|
70
|
-
/** Format last save time for display */
|
|
71
|
-
declare function formatLastSaveTime(date: Date | null): string;
|
|
72
|
-
/** Get auto-save status label */
|
|
73
|
-
declare function getAutoSaveStatusLabel(status: AutoSaveStatus): string;
|
|
74
|
-
/** Get storage size used by auto-save */
|
|
75
|
-
declare function getAutoSaveStorageSize(storageKey?: string): number;
|
|
76
|
-
/** Format storage size for display */
|
|
77
|
-
declare function formatStorageSize(bytes: number): string;
|
|
78
|
-
/** Check if auto-save is supported */
|
|
79
|
-
declare function isAutoSaveSupported(): boolean;
|
|
80
|
-
|
|
81
|
-
export { AutoSaveManager, formatLastSaveTime, formatStorageSize, getAutoSaveStatusLabel, getAutoSaveStorageSize, isAutoSaveSupported };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export{a as AutoSaveManager,b as formatLastSaveTime,e as formatStorageSize,c as getAutoSaveStatusLabel,d as getAutoSaveStorageSize,f as isAutoSaveSupported}from'../chunk-VCER63GQ.mjs';import'../chunk-BI3B33LI.mjs';import'../chunk-TTRUPDAB.mjs';
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import { S as Subscribable } from '../Subscribable-DOz6Ohoo.mjs';
|
|
2
|
-
import { TableSelectionSnapshot, CellCoordinates } from './types.mjs';
|
|
3
|
-
import { Document } from '../types/document.mjs';
|
|
4
|
-
import { T as Table } from '../content-sSHuWw49.mjs';
|
|
5
|
-
import '../formatting-DoL7KBSL.mjs';
|
|
6
|
-
import '../styles-VxNcXLdi.mjs';
|
|
7
|
-
import '../settingsParser-CcGvtmCK.mjs';
|
|
8
|
-
import '../docx/wrapTypes.mjs';
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* TableSelectionManager
|
|
12
|
-
*
|
|
13
|
-
* Framework-agnostic class for managing table cell selection state.
|
|
14
|
-
* Extracted from the React `useTableSelection` hook.
|
|
15
|
-
*
|
|
16
|
-
* Handles:
|
|
17
|
-
* - Cell selection via data-attribute queries on the DOM
|
|
18
|
-
* - Table document operations (add/delete rows/columns, merge/split)
|
|
19
|
-
*
|
|
20
|
-
* @remarks
|
|
21
|
-
* Tagged `@internal` post-1.0 cut. Adapters bind to this class today,
|
|
22
|
-
* but consumers should reach for `useTableSelection()` (React/Vue) instead
|
|
23
|
-
* of this raw subpath. The subpath stays in `package.json` `exports` for
|
|
24
|
-
* back-compat; expect it to move behind a public surface in a future major.
|
|
25
|
-
*
|
|
26
|
-
* @packageDocumentation
|
|
27
|
-
* @internal
|
|
28
|
-
*/
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* Data attributes for table elements in the rendered DOM
|
|
32
|
-
* @internal
|
|
33
|
-
*/
|
|
34
|
-
declare const TABLE_DATA_ATTRIBUTES: {
|
|
35
|
-
readonly TABLE_INDEX: "data-table-index";
|
|
36
|
-
readonly ROW_INDEX: "data-row";
|
|
37
|
-
readonly COLUMN_INDEX: "data-col";
|
|
38
|
-
readonly TABLE_CELL: "data-table-cell";
|
|
39
|
-
};
|
|
40
|
-
/**
|
|
41
|
-
* Find table cell coordinates from a click target by walking up the DOM
|
|
42
|
-
* and reading data attributes.
|
|
43
|
-
* @internal
|
|
44
|
-
*/
|
|
45
|
-
declare function findTableFromClick(target: EventTarget | null, container?: HTMLElement | null): CellCoordinates | null;
|
|
46
|
-
/**
|
|
47
|
-
* Get a table from the document by index.
|
|
48
|
-
* @internal
|
|
49
|
-
*/
|
|
50
|
-
declare function getTableFromDocument(doc: Document, tableIndex: number): Table | null;
|
|
51
|
-
/**
|
|
52
|
-
* Update a table in the document immutably.
|
|
53
|
-
* @internal
|
|
54
|
-
*/
|
|
55
|
-
declare function updateTableInDocument(doc: Document, tableIndex: number, newTable: Table): Document;
|
|
56
|
-
/**
|
|
57
|
-
* Delete a table from the document immutably.
|
|
58
|
-
* @internal
|
|
59
|
-
*/
|
|
60
|
-
declare function deleteTableFromDocument(doc: Document, tableIndex: number): Document;
|
|
61
|
-
/** @internal */
|
|
62
|
-
declare class TableSelectionManager extends Subscribable<TableSelectionSnapshot> {
|
|
63
|
-
constructor();
|
|
64
|
-
/** Select a specific cell. */
|
|
65
|
-
selectCell(coords: CellCoordinates): void;
|
|
66
|
-
/** Clear the current selection. */
|
|
67
|
-
clearSelection(): void;
|
|
68
|
-
/** Check if a specific cell is selected. */
|
|
69
|
-
isCellSelected(tableIndex: number, rowIndex: number, columnIndex: number): boolean;
|
|
70
|
-
/** Get the currently selected cell coordinates, or null. */
|
|
71
|
-
getSelectedCell(): CellCoordinates | null;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
export { TABLE_DATA_ATTRIBUTES, TableSelectionManager, deleteTableFromDocument, findTableFromClick, getTableFromDocument, updateTableInDocument };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export{a as TABLE_DATA_ATTRIBUTES,f as TableSelectionManager,e as deleteTableFromDocument,b as findTableFromClick,c as getTableFromDocument,d as updateTableInDocument}from'../chunk-JY6ILTNS.mjs';import'../chunk-BI3B33LI.mjs';import'../chunk-TTRUPDAB.mjs';
|