@eigenpal/docx-editor-core 1.3.0 → 1.3.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.
Files changed (92) hide show
  1. package/dist/chunk-4MYKVWNF.js +1 -0
  2. package/dist/{chunk-Q5B5GKXD.mjs → chunk-55XWETY4.mjs} +1 -1
  3. package/dist/chunk-6QO4O52Y.mjs +1 -0
  4. package/dist/chunk-DE2V4X3B.mjs +1 -0
  5. package/dist/{chunk-TJRROR6U.js → chunk-DG2CMDSM.js} +1 -1
  6. package/dist/chunk-HPJBZL37.mjs +1 -0
  7. package/dist/{chunk-TURYWKNS.js → chunk-J3YFJDZD.js} +1 -1
  8. package/dist/chunk-JHTURDPX.mjs +1 -0
  9. package/dist/chunk-LX35TFGF.mjs +1 -0
  10. package/dist/chunk-NRWQ65NX.js +1 -0
  11. package/dist/{chunk-WDBZ3QVB.js → chunk-QLAIOTQB.js} +1 -1
  12. package/dist/chunk-RSU4HTC6.js +1 -0
  13. package/dist/{chunk-L6YTCHOQ.mjs → chunk-W7CQRQZ6.mjs} +1 -1
  14. package/dist/chunk-YGWUKRFD.mjs +1 -0
  15. package/dist/chunk-YM7SMTYY.js +1 -0
  16. package/dist/chunk-YPKIQMPR.js +1 -0
  17. package/dist/core.d.mts +2 -2
  18. package/dist/core.d.ts +2 -2
  19. package/dist/core.js +1 -1
  20. package/dist/core.mjs +1 -1
  21. package/dist/editor/index.d.mts +128 -0
  22. package/dist/editor/index.d.ts +128 -0
  23. package/dist/editor/index.js +1 -0
  24. package/dist/editor/index.mjs +1 -0
  25. package/dist/{footnotes-BtVc6VFl.d.mts → footnotes-BZ24OTAT.d.mts} +11 -1
  26. package/dist/{footnotes-DcUMWXul.d.ts → footnotes-DMsicPGd.d.ts} +11 -1
  27. package/dist/{headerFooterLayout-4E-S4Aay.d.ts → headerFooterLayout-AtAOhM8E.d.ts} +18 -2
  28. package/dist/{headerFooterLayout-DlJLWmpR.d.mts → headerFooterLayout-CU6hvszp.d.mts} +18 -2
  29. package/dist/layout-bridge/clickToPositionDom.js +1 -1
  30. package/dist/layout-bridge/clickToPositionDom.mjs +1 -1
  31. package/dist/layout-bridge/index.d.mts +109 -5
  32. package/dist/layout-bridge/index.d.ts +109 -5
  33. package/dist/layout-bridge/index.js +1 -1
  34. package/dist/layout-bridge/index.mjs +1 -1
  35. package/dist/layout-bridge/measuring/index.d.mts +5 -95
  36. package/dist/layout-bridge/measuring/index.d.ts +5 -95
  37. package/dist/layout-bridge/measuring/index.js +1 -1
  38. package/dist/layout-bridge/measuring/index.mjs +1 -1
  39. package/dist/layout-bridge/tableInsertHover.js +1 -1
  40. package/dist/layout-bridge/tableInsertHover.mjs +1 -1
  41. package/dist/layout-engine/index.js +1 -1
  42. package/dist/layout-engine/index.mjs +1 -1
  43. package/dist/layout-painter/index.d.mts +2 -2
  44. package/dist/layout-painter/index.d.ts +2 -2
  45. package/dist/layout-painter/index.js +1 -1
  46. package/dist/layout-painter/index.mjs +1 -1
  47. package/dist/layout-painter/renderPage.d.mts +8 -3
  48. package/dist/layout-painter/renderPage.d.ts +8 -3
  49. package/dist/layout-painter/renderPage.js +1 -1
  50. package/dist/layout-painter/renderPage.mjs +1 -1
  51. package/dist/measureBlocksPipeline-BMqbRFQB.d.mts +96 -0
  52. package/dist/measureBlocksPipeline-iYNzAH-o.d.ts +96 -0
  53. package/dist/prosemirror/applyFormatting.d.mts +67 -0
  54. package/dist/prosemirror/applyFormatting.d.ts +67 -0
  55. package/dist/prosemirror/applyFormatting.js +1 -0
  56. package/dist/prosemirror/applyFormatting.mjs +1 -0
  57. package/dist/prosemirror/commentIdAllocator.d.mts +50 -0
  58. package/dist/prosemirror/commentIdAllocator.d.ts +50 -0
  59. package/dist/prosemirror/commentIdAllocator.js +1 -0
  60. package/dist/prosemirror/commentIdAllocator.mjs +1 -0
  61. package/dist/prosemirror/commentOps.d.mts +46 -0
  62. package/dist/prosemirror/commentOps.d.ts +46 -0
  63. package/dist/prosemirror/commentOps.js +1 -0
  64. package/dist/prosemirror/commentOps.mjs +1 -0
  65. package/dist/prosemirror/imageCommit.d.mts +35 -0
  66. package/dist/prosemirror/imageCommit.d.ts +35 -0
  67. package/dist/prosemirror/imageCommit.js +1 -0
  68. package/dist/prosemirror/imageCommit.mjs +1 -0
  69. package/dist/prosemirror/paraText.d.mts +52 -0
  70. package/dist/prosemirror/paraText.d.ts +52 -0
  71. package/dist/prosemirror/paraText.js +1 -0
  72. package/dist/prosemirror/paraText.mjs +1 -0
  73. package/dist/prosemirror/queries.d.mts +65 -0
  74. package/dist/prosemirror/queries.d.ts +65 -0
  75. package/dist/prosemirror/queries.js +2 -0
  76. package/dist/prosemirror/queries.mjs +2 -0
  77. package/dist/prosemirror/tableResize.d.mts +58 -0
  78. package/dist/prosemirror/tableResize.d.ts +58 -0
  79. package/dist/prosemirror/tableResize.js +1 -0
  80. package/dist/prosemirror/tableResize.mjs +1 -0
  81. package/dist/utils/autoScroll.d.mts +24 -0
  82. package/dist/utils/autoScroll.d.ts +24 -0
  83. package/dist/utils/autoScroll.js +1 -0
  84. package/dist/utils/autoScroll.mjs +1 -0
  85. package/package.json +73 -1
  86. package/dist/chunk-72KLR6TJ.mjs +0 -1
  87. package/dist/chunk-7JQVKJRN.mjs +0 -1
  88. package/dist/chunk-7WGN2OBZ.js +0 -1
  89. package/dist/chunk-JUMHC5Z6.mjs +0 -1
  90. package/dist/chunk-MEVZCB56.mjs +0 -1
  91. package/dist/chunk-T4RYVPAB.js +0 -1
  92. package/dist/chunk-XWC67YLW.js +0 -1
@@ -0,0 +1,128 @@
1
+ import { EditorState, Transaction } from 'prosemirror-state';
2
+ import { Node } from 'prosemirror-model';
3
+ import { PageMargins, ColumnLayout, FlowBlock, Measure, Layout } from '../layout-engine/types.mjs';
4
+ import { Document } from '../types/document.mjs';
5
+ import { S as SectionProperties, y as HeaderFooter } from '../content-3xF4WDE8.mjs';
6
+ import { F as FloatPageGeometry } from '../measureBlocksPipeline-BMqbRFQB.mjs';
7
+ import { H as HeaderFooterContent, F as FootnoteRenderItem } from '../footnotes-BZ24OTAT.mjs';
8
+ import { W as Watermark } from '../watermark-DAcnAs_J.mjs';
9
+ import { T as Theme, S as StyleDefinitions } from '../styles-BOJ93SAm.mjs';
10
+ import '../formatting-BH4hcZiq.mjs';
11
+ import '../colors-C3vA7HUU.mjs';
12
+ import '../docx/wrapTypes.mjs';
13
+ import '../anchoredObjectPosition-KJEyF-wr.mjs';
14
+
15
+ /**
16
+ * The pure layout COMPUTE pass shared by the React and Vue adapters — issue
17
+ * #696 Tier 2, the clean half of the engine spine.
18
+ *
19
+ * This is the 6-step pass from React's `useLayoutPipeline` minus the DOM paint
20
+ * + scroll/event side-effects (which stay adapter-side, where the framework
21
+ * timing lives): PM doc → flow blocks → measure → header/footer resolve →
22
+ * margin extension → `layoutDocument` (+ two-pass footnote stabilization) →
23
+ * footnote render items. It is pure (no DOM, no refs, no rAF) and returns
24
+ * everything the adapter needs to paint.
25
+ *
26
+ * The one injected seam is `measureBlocks` — each adapter passes its own
27
+ * measurer (React's is caching), same pattern as `measureBlocksWithFloats`.
28
+ * `getHfPmDoc` is the HF-unification seam (prefer the persistent PM doc over
29
+ * re-parsing `HeaderFooter.content`).
30
+ */
31
+
32
+ interface PageSizePx {
33
+ w: number;
34
+ h: number;
35
+ }
36
+ /** Adapter-supplied block measurer (React's is caching). */
37
+ type MeasureBlocksFn = (blocks: FlowBlock[], contentWidth: number | number[], pageGeometry?: FloatPageGeometry) => Measure[];
38
+ interface ComputeLayoutInputs {
39
+ state: EditorState;
40
+ document: Document | null;
41
+ pageSize: PageSizePx;
42
+ margins: PageMargins;
43
+ columns: ColumnLayout | undefined;
44
+ finalPageSize: PageSizePx;
45
+ finalMargins: PageMargins;
46
+ finalColumns: ColumnLayout | undefined;
47
+ pageGap: number;
48
+ contentWidth: number;
49
+ theme: Theme | null | undefined;
50
+ styles: StyleDefinitions | null | undefined;
51
+ sectionProperties: SectionProperties | null | undefined;
52
+ finalSectionProperties: SectionProperties | null | undefined;
53
+ /** Resolved HF objects for the section (default + first-page). */
54
+ headerContent: HeaderFooter | null | undefined;
55
+ footerContent: HeaderFooter | null | undefined;
56
+ firstPageHeaderContent: HeaderFooter | null | undefined;
57
+ firstPageFooterContent: HeaderFooter | null | undefined;
58
+ measureBlocks: MeasureBlocksFn;
59
+ /** HF unification: the persistent PM doc for an HF, or null to re-parse content. */
60
+ getHfPmDoc: (hf: HeaderFooter) => Node | null | undefined;
61
+ }
62
+ interface LayoutComputation {
63
+ blocks: FlowBlock[];
64
+ measures: Measure[];
65
+ layout: Layout;
66
+ headerContentForRender: HeaderFooterContent | undefined;
67
+ footerContentForRender: HeaderFooterContent | undefined;
68
+ firstPageHeaderForRender: HeaderFooterContent | undefined;
69
+ firstPageFooterForRender: HeaderFooterContent | undefined;
70
+ hasTitlePg: boolean;
71
+ watermark: Watermark | undefined;
72
+ headerDistancePx: number | undefined;
73
+ footerDistancePx: number | undefined;
74
+ pageBorders: SectionProperties['pageBorders'] | undefined;
75
+ footnotesByPage: Map<number, FootnoteRenderItem[]> | undefined;
76
+ }
77
+ /**
78
+ * Run the pure layout compute pass (the 6 steps in this file's header), lifted
79
+ * verbatim from `useLayoutPipeline`. The adapter performs the DOM paint
80
+ * (`renderPages`), scroll-restore, `painter:painted`, and state writeback with
81
+ * the returned values.
82
+ */
83
+ declare function computeLayout(inputs: ComputeLayoutInputs): LayoutComputation;
84
+
85
+ /**
86
+ * rAF-coalescing layout scheduler shared by the React and Vue adapters
87
+ * (issue #696 Tier 2). Rapid doc-changing transactions (a burst of
88
+ * keystrokes) collapse to a single layout pass per animation frame: while a
89
+ * frame is pending, later `schedule` calls just replace the target state, so
90
+ * only the final state lays out.
91
+ *
92
+ * `scheduleFrame`/`cancelFrame` are injected so a headless/test host can pass
93
+ * a synchronous stub; they default to requestAnimationFrame.
94
+ */
95
+
96
+ interface LayoutScheduler {
97
+ /** Request a layout for `state`, coalesced into the pending frame. */
98
+ schedule(state: EditorState): void;
99
+ /** Cancel any pending frame (call on teardown). */
100
+ cancel(): void;
101
+ }
102
+ declare function createLayoutScheduler(run: (state: EditorState) => void, scheduleFrame?: (cb: () => void) => number, cancelFrame?: (handle: number) => void): LayoutScheduler;
103
+
104
+ /**
105
+ * Strip ProseMirror's internal `UPDATED_SCROLL` flag from a transaction so the
106
+ * hidden, off-screen editor's `updateState` does not force-scroll its ancestors
107
+ * to the selection — the paginated painter owns scroll, not the PM view.
108
+ *
109
+ * Shared by both adapters' `dispatchTransaction` (issue #696 Tier 2). React has
110
+ * always done this; Vue did not, so its hidden editor could yank an ancestor's
111
+ * scroll on edit. Centralizing the magic bit + the drift canary here keeps the
112
+ * two in lockstep.
113
+ *
114
+ * `Transaction.updated` is a private bitfield in `prosemirror-state` whose
115
+ * `UPDATED_SCROLL` bit is not exported. It is `4` in current PM
116
+ * (state/src/transaction.ts). If a future PM release renumbers the bits before
117
+ * SCROLL, `assertScrollFlagShape` logs once so the constant can be updated.
118
+ */
119
+
120
+ /**
121
+ * Clear the scroll-into-view flag on `transaction` in place. Call inside
122
+ * `dispatchTransaction` before `state.apply(transaction)`. `probeTr` should be
123
+ * a fresh `view.state.tr` used only for the one-shot drift canary (so the real
124
+ * transaction is never mutated by the probe).
125
+ */
126
+ declare function stripScrollFlag(transaction: Transaction, probeTr: Transaction): void;
127
+
128
+ export { type ComputeLayoutInputs, type LayoutComputation, type LayoutScheduler, type MeasureBlocksFn, computeLayout, createLayoutScheduler, stripScrollFlag };
@@ -0,0 +1,128 @@
1
+ import { EditorState, Transaction } from 'prosemirror-state';
2
+ import { Node } from 'prosemirror-model';
3
+ import { PageMargins, ColumnLayout, FlowBlock, Measure, Layout } from '../layout-engine/types.js';
4
+ import { Document } from '../types/document.js';
5
+ import { S as SectionProperties, y as HeaderFooter } from '../content-C8fc_tL6.js';
6
+ import { F as FloatPageGeometry } from '../measureBlocksPipeline-iYNzAH-o.js';
7
+ import { H as HeaderFooterContent, F as FootnoteRenderItem } from '../footnotes-DMsicPGd.js';
8
+ import { W as Watermark } from '../watermark-DAcnAs_J.js';
9
+ import { T as Theme, S as StyleDefinitions } from '../styles-BWqX2AS-.js';
10
+ import '../formatting-_OXU8gLB.js';
11
+ import '../colors-C3vA7HUU.js';
12
+ import '../docx/wrapTypes.js';
13
+ import '../anchoredObjectPosition-CS-8BfhO.js';
14
+
15
+ /**
16
+ * The pure layout COMPUTE pass shared by the React and Vue adapters — issue
17
+ * #696 Tier 2, the clean half of the engine spine.
18
+ *
19
+ * This is the 6-step pass from React's `useLayoutPipeline` minus the DOM paint
20
+ * + scroll/event side-effects (which stay adapter-side, where the framework
21
+ * timing lives): PM doc → flow blocks → measure → header/footer resolve →
22
+ * margin extension → `layoutDocument` (+ two-pass footnote stabilization) →
23
+ * footnote render items. It is pure (no DOM, no refs, no rAF) and returns
24
+ * everything the adapter needs to paint.
25
+ *
26
+ * The one injected seam is `measureBlocks` — each adapter passes its own
27
+ * measurer (React's is caching), same pattern as `measureBlocksWithFloats`.
28
+ * `getHfPmDoc` is the HF-unification seam (prefer the persistent PM doc over
29
+ * re-parsing `HeaderFooter.content`).
30
+ */
31
+
32
+ interface PageSizePx {
33
+ w: number;
34
+ h: number;
35
+ }
36
+ /** Adapter-supplied block measurer (React's is caching). */
37
+ type MeasureBlocksFn = (blocks: FlowBlock[], contentWidth: number | number[], pageGeometry?: FloatPageGeometry) => Measure[];
38
+ interface ComputeLayoutInputs {
39
+ state: EditorState;
40
+ document: Document | null;
41
+ pageSize: PageSizePx;
42
+ margins: PageMargins;
43
+ columns: ColumnLayout | undefined;
44
+ finalPageSize: PageSizePx;
45
+ finalMargins: PageMargins;
46
+ finalColumns: ColumnLayout | undefined;
47
+ pageGap: number;
48
+ contentWidth: number;
49
+ theme: Theme | null | undefined;
50
+ styles: StyleDefinitions | null | undefined;
51
+ sectionProperties: SectionProperties | null | undefined;
52
+ finalSectionProperties: SectionProperties | null | undefined;
53
+ /** Resolved HF objects for the section (default + first-page). */
54
+ headerContent: HeaderFooter | null | undefined;
55
+ footerContent: HeaderFooter | null | undefined;
56
+ firstPageHeaderContent: HeaderFooter | null | undefined;
57
+ firstPageFooterContent: HeaderFooter | null | undefined;
58
+ measureBlocks: MeasureBlocksFn;
59
+ /** HF unification: the persistent PM doc for an HF, or null to re-parse content. */
60
+ getHfPmDoc: (hf: HeaderFooter) => Node | null | undefined;
61
+ }
62
+ interface LayoutComputation {
63
+ blocks: FlowBlock[];
64
+ measures: Measure[];
65
+ layout: Layout;
66
+ headerContentForRender: HeaderFooterContent | undefined;
67
+ footerContentForRender: HeaderFooterContent | undefined;
68
+ firstPageHeaderForRender: HeaderFooterContent | undefined;
69
+ firstPageFooterForRender: HeaderFooterContent | undefined;
70
+ hasTitlePg: boolean;
71
+ watermark: Watermark | undefined;
72
+ headerDistancePx: number | undefined;
73
+ footerDistancePx: number | undefined;
74
+ pageBorders: SectionProperties['pageBorders'] | undefined;
75
+ footnotesByPage: Map<number, FootnoteRenderItem[]> | undefined;
76
+ }
77
+ /**
78
+ * Run the pure layout compute pass (the 6 steps in this file's header), lifted
79
+ * verbatim from `useLayoutPipeline`. The adapter performs the DOM paint
80
+ * (`renderPages`), scroll-restore, `painter:painted`, and state writeback with
81
+ * the returned values.
82
+ */
83
+ declare function computeLayout(inputs: ComputeLayoutInputs): LayoutComputation;
84
+
85
+ /**
86
+ * rAF-coalescing layout scheduler shared by the React and Vue adapters
87
+ * (issue #696 Tier 2). Rapid doc-changing transactions (a burst of
88
+ * keystrokes) collapse to a single layout pass per animation frame: while a
89
+ * frame is pending, later `schedule` calls just replace the target state, so
90
+ * only the final state lays out.
91
+ *
92
+ * `scheduleFrame`/`cancelFrame` are injected so a headless/test host can pass
93
+ * a synchronous stub; they default to requestAnimationFrame.
94
+ */
95
+
96
+ interface LayoutScheduler {
97
+ /** Request a layout for `state`, coalesced into the pending frame. */
98
+ schedule(state: EditorState): void;
99
+ /** Cancel any pending frame (call on teardown). */
100
+ cancel(): void;
101
+ }
102
+ declare function createLayoutScheduler(run: (state: EditorState) => void, scheduleFrame?: (cb: () => void) => number, cancelFrame?: (handle: number) => void): LayoutScheduler;
103
+
104
+ /**
105
+ * Strip ProseMirror's internal `UPDATED_SCROLL` flag from a transaction so the
106
+ * hidden, off-screen editor's `updateState` does not force-scroll its ancestors
107
+ * to the selection — the paginated painter owns scroll, not the PM view.
108
+ *
109
+ * Shared by both adapters' `dispatchTransaction` (issue #696 Tier 2). React has
110
+ * always done this; Vue did not, so its hidden editor could yank an ancestor's
111
+ * scroll on edit. Centralizing the magic bit + the drift canary here keeps the
112
+ * two in lockstep.
113
+ *
114
+ * `Transaction.updated` is a private bitfield in `prosemirror-state` whose
115
+ * `UPDATED_SCROLL` bit is not exported. It is `4` in current PM
116
+ * (state/src/transaction.ts). If a future PM release renumbers the bits before
117
+ * SCROLL, `assertScrollFlagShape` logs once so the constant can be updated.
118
+ */
119
+
120
+ /**
121
+ * Clear the scroll-into-view flag on `transaction` in place. Call inside
122
+ * `dispatchTransaction` before `state.apply(transaction)`. `probeTr` should be
123
+ * a fresh `view.state.tr` used only for the one-shot drift canary (so the real
124
+ * transaction is never mutated by the probe).
125
+ */
126
+ declare function stripScrollFlag(transaction: Transaction, probeTr: Transaction): void;
127
+
128
+ export { type ComputeLayoutInputs, type LayoutComputation, type LayoutScheduler, type MeasureBlocksFn, computeLayout, createLayoutScheduler, stripScrollFlag };
@@ -0,0 +1 @@
1
+ 'use strict';require('../chunk-YPKIQMPR.js');var chunkYM7SMTYY_js=require('../chunk-YM7SMTYY.js');require('../chunk-DG2CMDSM.js');var chunkQLAIOTQB_js=require('../chunk-QLAIOTQB.js'),chunkFQS436KN_js=require('../chunk-FQS436KN.js');require('../chunk-4MYKVWNF.js');var chunkJ3YFJDZD_js=require('../chunk-J3YFJDZD.js'),chunkRSU4HTC6_js=require('../chunk-RSU4HTC6.js');require('../chunk-IMKU4O3P.js'),require('../chunk-DROCYKAR.js'),require('../chunk-LERLET2D.js'),require('../chunk-FIGLFSNR.js'),require('../chunk-BUCOTKYY.js'),require('../chunk-C45EFOVP.js'),require('../chunk-ISKTBM4L.js'),require('../chunk-JFZIXFRC.js'),require('../chunk-RQVHKDXK.js'),require('../chunk-SCK6ZM5V.js'),require('../chunk-Z3LGMBJC.js'),require('../chunk-3R7QHNI5.js'),require('../chunk-WWBNJ7KF.js'),require('../chunk-4RTVLMRZ.js'),require('../chunk-BHBOAP6Z.js'),require('../chunk-MZ7LW5CH.js'),require('../chunk-N3Y5BUKV.js'),require('../chunk-WVERBZZU.js'),require('../chunk-6LVPRTB6.js'),require('../chunk-LWH66Q7Q.js'),require('../chunk-TUIEV7Q7.js'),require('../chunk-7HANRHHL.js'),require('../chunk-MJ5FQX7Q.js'),require('../chunk-C2BAPYGJ.js'),require('../chunk-4Q2IP5FW.js'),require('../chunk-GSKMHXHG.js'),require('../chunk-DC7S76ZX.js');function de(a){let{state:t,document:n,pageSize:e,margins:o,columns:p,finalPageSize:d,finalMargins:L,finalColumns:M,pageGap:K,contentWidth:f,theme:m,styles:D,sectionProperties:s,finalSectionProperties:Q,headerContent:X,footerContent:Y,firstPageHeaderContent:Z,firstPageFooterContent:ee,measureBlocks:g,getHfPmDoc:te}=a,oe=e.h-o.top-o.bottom,r=chunkFQS436KN_js.c(t.doc,{theme:m,pageContentHeight:oe}),ne=chunkYM7SMTYY_js.O(r,{pageSize:e,margins:o,columns:p},{pageSize:d,margins:L,columns:M}),l=g(r,ne,chunkJ3YFJDZD_js.f({size:e,margins:o})),y=chunkQLAIOTQB_js.d(r),k=y.length>0&&!!n?.package?.footnotes,H={section:"header",pageSize:e,margins:o},x={section:"footer",pageSize:e,margins:o},T=t.doc.attrs?.defaultTabStopTwips,w={styles:D,theme:m,measureBlocks:g,defaultTabStopTwips:T},c=(i,u)=>{if(!i)return;let _=te(i);return _?chunkYM7SMTYY_js.z(_,f,u,w):chunkYM7SMTYY_js.y(i,f,u,w)},B=c(X,H),R=c(Y,x),F=s?.titlePg===true,v=F?c(Z,H):void 0,z=F?c(ee,x):void 0,re=t.doc.attrs?.watermark??void 0,{margins:ae,finalMargins:ie}=chunkYM7SMTYY_js.D({pageSize:e,margins:o,finalMargins:L,bodyBlocks:r,headers:[B,v],footers:[R,z],warn:i=>console.warn(`[computeLayout] ${i}`)}),se=Q?.sectionStart,P={pageSize:e,margins:ae,finalPageSize:d,finalMargins:ie,columns:M,bodyBreakType:se,pageGap:K},h,E=new Map,S=new Map;if(k){let i=chunkRSU4HTC6_js.U(r,l,P);S=chunkQLAIOTQB_js.h(n.package.footnotes,y,f,{styles:D??void 0,theme:m??null,measureBlocks:g,defaultTabStopTwips:T});let u=chunkQLAIOTQB_js.j({blocks:r,measures:l,layoutOpts:P,footnoteRefs:y,footnoteContentMap:S,initialLayout:i});h=u.layout,E=u.pageFootnoteMap;}else h=chunkRSU4HTC6_js.U(r,l,P);let W=k?chunkQLAIOTQB_js.k(E,S,n):void 0;return {blocks:r,measures:l,layout:h,headerContentForRender:B,footerContentForRender:R,firstPageHeaderForRender:v,firstPageFooterForRender:z,hasTitlePg:F,watermark:re,headerDistancePx:s?.headerDistance?chunkYM7SMTYY_js.I(s.headerDistance):void 0,footerDistancePx:s?.footerDistance?chunkYM7SMTYY_js.I(s.footerDistance):void 0,pageBorders:s?.pageBorders,footnotesByPage:W?.size?W:void 0}}function ue(a,t=e=>requestAnimationFrame(e),n=e=>cancelAnimationFrame(e)){let e=null;return {schedule(o){if(e){e.state=o;return}e={handle:0,state:o};let p=t(()=>{let d=e;e=null,d&&a(d.state);});e&&(e.handle=p);},cancel(){e&&(n(e.handle),e=null);}}}var J=false;function le(a){if(!J){J=true;try{let t=a.scrollIntoView();(typeof t.updated!="number"||(t.updated&4)===0)&&console.warn("[docx-editor] prosemirror-state UPDATED_SCROLL bit shape changed; paginated scroll suppression may be stale. Update PM_UPDATED_SCROLL.");}catch{}}}function ce(a,t){le(t);let n=a;typeof n.updated=="number"&&(n.updated&=-5);}exports.computeLayout=de;exports.createLayoutScheduler=ue;exports.stripScrollFlag=ce;
@@ -0,0 +1 @@
1
+ import'../chunk-DE2V4X3B.mjs';import {O,D,I,z,y}from'../chunk-6QO4O52Y.mjs';import'../chunk-W7CQRQZ6.mjs';import {d,h,j,k}from'../chunk-YGWUKRFD.mjs';import {c}from'../chunk-B46V5G46.mjs';import'../chunk-LX35TFGF.mjs';import {f}from'../chunk-55XWETY4.mjs';import {U}from'../chunk-JHTURDPX.mjs';import'../chunk-FCJWLEKT.mjs';import'../chunk-7E5VBRDL.mjs';import'../chunk-3G44SFHX.mjs';import'../chunk-MOCGHQ4A.mjs';import'../chunk-IUVQJ6PX.mjs';import'../chunk-7OW3VCZE.mjs';import'../chunk-LK6I3HMH.mjs';import'../chunk-QPFJJPIC.mjs';import'../chunk-GYWTUUXX.mjs';import'../chunk-7CZEZ3UL.mjs';import'../chunk-W77JXDEV.mjs';import'../chunk-3ANZ3252.mjs';import'../chunk-4GFTMGSV.mjs';import'../chunk-SWBLJF6R.mjs';import'../chunk-MOKKS75W.mjs';import'../chunk-OZMNIX6U.mjs';import'../chunk-AMENZY5F.mjs';import'../chunk-U67MWOPZ.mjs';import'../chunk-BGY3CB37.mjs';import'../chunk-2XP6GLA4.mjs';import'../chunk-ZX26QZJ5.mjs';import'../chunk-MJ6XZFVD.mjs';import'../chunk-67LVRQIR.mjs';import'../chunk-LE67NTCN.mjs';import'../chunk-VW22RZ6C.mjs';import'../chunk-DI6CRWSW.mjs';import'../chunk-QYUPLKLP.mjs';function de(a){let{state:t,document:n,pageSize:e,margins:o,columns:p,finalPageSize:d$1,finalMargins:L,finalColumns:M,pageGap:K,contentWidth:f$1,theme:m,styles:D$1,sectionProperties:s,finalSectionProperties:Q,headerContent:X,footerContent:Y,firstPageHeaderContent:Z,firstPageFooterContent:ee,measureBlocks:g,getHfPmDoc:te}=a,oe=e.h-o.top-o.bottom,r=c(t.doc,{theme:m,pageContentHeight:oe}),ne=O(r,{pageSize:e,margins:o,columns:p},{pageSize:d$1,margins:L,columns:M}),l=g(r,ne,f({size:e,margins:o})),y$1=d(r),k$1=y$1.length>0&&!!n?.package?.footnotes,H={section:"header",pageSize:e,margins:o},x={section:"footer",pageSize:e,margins:o},T=t.doc.attrs?.defaultTabStopTwips,w={styles:D$1,theme:m,measureBlocks:g,defaultTabStopTwips:T},c$1=(i,u)=>{if(!i)return;let _=te(i);return _?z(_,f$1,u,w):y(i,f$1,u,w)},B=c$1(X,H),R=c$1(Y,x),F=s?.titlePg===true,v=F?c$1(Z,H):void 0,z$1=F?c$1(ee,x):void 0,re=t.doc.attrs?.watermark??void 0,{margins:ae,finalMargins:ie}=D({pageSize:e,margins:o,finalMargins:L,bodyBlocks:r,headers:[B,v],footers:[R,z$1],warn:i=>console.warn(`[computeLayout] ${i}`)}),se=Q?.sectionStart,P={pageSize:e,margins:ae,finalPageSize:d$1,finalMargins:ie,columns:M,bodyBreakType:se,pageGap:K},h$1,E=new Map,S=new Map;if(k$1){let i=U(r,l,P);S=h(n.package.footnotes,y$1,f$1,{styles:D$1??void 0,theme:m??null,measureBlocks:g,defaultTabStopTwips:T});let u=j({blocks:r,measures:l,layoutOpts:P,footnoteRefs:y$1,footnoteContentMap:S,initialLayout:i});h$1=u.layout,E=u.pageFootnoteMap;}else h$1=U(r,l,P);let W=k$1?k(E,S,n):void 0;return {blocks:r,measures:l,layout:h$1,headerContentForRender:B,footerContentForRender:R,firstPageHeaderForRender:v,firstPageFooterForRender:z$1,hasTitlePg:F,watermark:re,headerDistancePx:s?.headerDistance?I(s.headerDistance):void 0,footerDistancePx:s?.footerDistance?I(s.footerDistance):void 0,pageBorders:s?.pageBorders,footnotesByPage:W?.size?W:void 0}}function ue(a,t=e=>requestAnimationFrame(e),n=e=>cancelAnimationFrame(e)){let e=null;return {schedule(o){if(e){e.state=o;return}e={handle:0,state:o};let p=t(()=>{let d=e;e=null,d&&a(d.state);});e&&(e.handle=p);},cancel(){e&&(n(e.handle),e=null);}}}var J=false;function le(a){if(!J){J=true;try{let t=a.scrollIntoView();(typeof t.updated!="number"||(t.updated&4)===0)&&console.warn("[docx-editor] prosemirror-state UPDATED_SCROLL bit shape changed; paginated scroll suppression may be stale. Update PM_UPDATED_SCROLL.");}catch{}}}function ce(a,t){le(t);let n=a;typeof n.updated=="number"&&(n.updated&=-5);}export{de as computeLayout,ue as createLayoutScheduler,ce as stripScrollFlag};
@@ -19,8 +19,18 @@ interface HeaderFooterContent {
19
19
  blocks: FlowBlock[];
20
20
  /** Measurements for the blocks. */
21
21
  measures: Measure[];
22
- /** Total height of the content. */
22
+ /** Total height of the content (in-flow stack incl. floating blocks). */
23
23
  height: number;
24
+ /**
25
+ * In-flow band height: the height of strictly in-flow content
26
+ * (paragraphs, tables, inline images/text boxes), EXCLUDING anchored /
27
+ * floating objects. This is what grows the header/footer band and pushes
28
+ * the body margin, mirroring Word: a page/margin-anchored shape (e.g. a
29
+ * full-page letterhead in a header) is positioned independently and does
30
+ * NOT push body text down. Use this — not `height`/`visualBottom` — for
31
+ * margin extension. Falls back to `height` when undefined.
32
+ */
33
+ flowHeight?: number;
24
34
  /** Top-most visual extent relative to the nominal flow origin. */
25
35
  visualTop?: number;
26
36
  /** Bottom-most visual extent relative to the nominal flow origin. */
@@ -19,8 +19,18 @@ interface HeaderFooterContent {
19
19
  blocks: FlowBlock[];
20
20
  /** Measurements for the blocks. */
21
21
  measures: Measure[];
22
- /** Total height of the content. */
22
+ /** Total height of the content (in-flow stack incl. floating blocks). */
23
23
  height: number;
24
+ /**
25
+ * In-flow band height: the height of strictly in-flow content
26
+ * (paragraphs, tables, inline images/text boxes), EXCLUDING anchored /
27
+ * floating objects. This is what grows the header/footer band and pushes
28
+ * the body margin, mirroring Word: a page/margin-anchored shape (e.g. a
29
+ * full-page letterhead in a header) is positioned independently and does
30
+ * NOT push body text down. Use this — not `height`/`visualBottom` — for
31
+ * margin extension. Falls back to `height` when undefined.
32
+ */
33
+ flowHeight?: number;
24
34
  /** Top-most visual extent relative to the nominal flow origin. */
25
35
  visualTop?: number;
26
36
  /** Bottom-most visual extent relative to the nominal flow origin. */
@@ -3,7 +3,7 @@ import { EditorView } from 'prosemirror-view';
3
3
  import { FlowBlock, Measure, LayoutOptions, FootnoteContent, Layout, Page, PageMargins, ImageRun } from './layout-engine/types.js';
4
4
  import { F as Footnote, y as HeaderFooter } from './content-C8fc_tL6.js';
5
5
  import { S as StyleDefinitions, T as Theme } from './styles-BWqX2AS-.js';
6
- import { F as FootnoteRenderItem, H as HeaderFooterContent } from './footnotes-DcUMWXul.js';
6
+ import { F as FootnoteRenderItem, H as HeaderFooterContent } from './footnotes-DMsicPGd.js';
7
7
  import { Document } from './types/document.js';
8
8
 
9
9
  /**
@@ -193,6 +193,22 @@ type HeaderFooterMetrics = {
193
193
  };
194
194
  declare function normalizeHeaderFooterMeasureBlocks(blocks: FlowBlock[]): FlowBlock[];
195
195
  declare function resolveHeaderFooterVisualTop(run: ImageRun, paragraphY: number, flowHeight: number, metrics: HeaderFooterMetrics): number;
196
+ /**
197
+ * Whether a header/footer block participates in the in-flow band height that
198
+ * pushes the body margin.
199
+ *
200
+ * OOXML semantics: Word grows the header/footer band — and shifts body text —
201
+ * based only on the story's in-flow content. A floating/anchored object
202
+ * (`wp:anchor` DrawingML or an absolutely-positioned VML shape, e.g. a
203
+ * full-page letterhead anchored to the page in a header) is removed from the
204
+ * text flow and positioned on the page; it does NOT grow the band or push the
205
+ * body. So only inline-flow blocks count here. Anchored image *runs* inside a
206
+ * paragraph are likewise out of flow, but they don't contribute to the
207
+ * paragraph's measured line height, so paragraphs need no special handling.
208
+ *
209
+ * @public
210
+ */
211
+ declare function contributesToHeaderFooterFlowHeight(block: FlowBlock): boolean;
196
212
  declare function calculateHeaderFooterVisualBounds(blocks: FlowBlock[], measures: Measure[], flowHeight: number, metrics: HeaderFooterMetrics): {
197
213
  visualTop: number;
198
214
  visualBottom: number;
@@ -289,4 +305,4 @@ declare function computeHfSelectionRectsFromView(view: EditorView, section: 'hea
289
305
  height: number;
290
306
  }>;
291
307
 
292
- export { type ConvertFootnoteOptions as C, FOOTNOTE_SEPARATOR_HEIGHT as F, type HeaderFooterMetrics as H, MAX_FOOTNOTE_LAYOUT_PASSES as M, type StabilizeFootnoteLayoutArgs as S, type ConvertHeaderFooterOptions as a, type MeasureBlocksFn as b, type StabilizeFootnoteLayoutResult as c, buildFootnoteContentMap as d, buildFootnoteRenderItems as e, calculateFootnoteReservedHeights as f, collectFootnoteRefs as g, convertHeaderFooterToContent as h, footnoteReservedHeightsEqual as i, applyFootnotePresentation as j, calculateHeaderFooterVisualBounds as k, computeHfCaretRectFromView as l, mapFootnotesToPages as m, computeHfSelectionRectsFromView as n, convertFootnoteToContent as o, convertHeaderFooterPmDocToContent as p, invalidateHfDomCache as q, normalizeHeaderFooterMeasureBlocks as r, stabilizeFootnoteLayout as s, resolveHeaderFooterVisualTop as t };
308
+ export { type ConvertFootnoteOptions as C, FOOTNOTE_SEPARATOR_HEIGHT as F, type HeaderFooterMetrics as H, MAX_FOOTNOTE_LAYOUT_PASSES as M, type StabilizeFootnoteLayoutArgs as S, type ConvertHeaderFooterOptions as a, type MeasureBlocksFn as b, type StabilizeFootnoteLayoutResult as c, buildFootnoteContentMap as d, buildFootnoteRenderItems as e, calculateFootnoteReservedHeights as f, collectFootnoteRefs as g, convertHeaderFooterToContent as h, footnoteReservedHeightsEqual as i, applyFootnotePresentation as j, calculateHeaderFooterVisualBounds as k, computeHfCaretRectFromView as l, mapFootnotesToPages as m, computeHfSelectionRectsFromView as n, contributesToHeaderFooterFlowHeight as o, convertFootnoteToContent as p, convertHeaderFooterPmDocToContent as q, invalidateHfDomCache as r, stabilizeFootnoteLayout as s, normalizeHeaderFooterMeasureBlocks as t, resolveHeaderFooterVisualTop as u };
@@ -3,7 +3,7 @@ import { EditorView } from 'prosemirror-view';
3
3
  import { FlowBlock, Measure, LayoutOptions, FootnoteContent, Layout, Page, PageMargins, ImageRun } from './layout-engine/types.mjs';
4
4
  import { F as Footnote, y as HeaderFooter } from './content-3xF4WDE8.mjs';
5
5
  import { S as StyleDefinitions, T as Theme } from './styles-BOJ93SAm.mjs';
6
- import { F as FootnoteRenderItem, H as HeaderFooterContent } from './footnotes-BtVc6VFl.mjs';
6
+ import { F as FootnoteRenderItem, H as HeaderFooterContent } from './footnotes-BZ24OTAT.mjs';
7
7
  import { Document } from './types/document.mjs';
8
8
 
9
9
  /**
@@ -193,6 +193,22 @@ type HeaderFooterMetrics = {
193
193
  };
194
194
  declare function normalizeHeaderFooterMeasureBlocks(blocks: FlowBlock[]): FlowBlock[];
195
195
  declare function resolveHeaderFooterVisualTop(run: ImageRun, paragraphY: number, flowHeight: number, metrics: HeaderFooterMetrics): number;
196
+ /**
197
+ * Whether a header/footer block participates in the in-flow band height that
198
+ * pushes the body margin.
199
+ *
200
+ * OOXML semantics: Word grows the header/footer band — and shifts body text —
201
+ * based only on the story's in-flow content. A floating/anchored object
202
+ * (`wp:anchor` DrawingML or an absolutely-positioned VML shape, e.g. a
203
+ * full-page letterhead anchored to the page in a header) is removed from the
204
+ * text flow and positioned on the page; it does NOT grow the band or push the
205
+ * body. So only inline-flow blocks count here. Anchored image *runs* inside a
206
+ * paragraph are likewise out of flow, but they don't contribute to the
207
+ * paragraph's measured line height, so paragraphs need no special handling.
208
+ *
209
+ * @public
210
+ */
211
+ declare function contributesToHeaderFooterFlowHeight(block: FlowBlock): boolean;
196
212
  declare function calculateHeaderFooterVisualBounds(blocks: FlowBlock[], measures: Measure[], flowHeight: number, metrics: HeaderFooterMetrics): {
197
213
  visualTop: number;
198
214
  visualBottom: number;
@@ -289,4 +305,4 @@ declare function computeHfSelectionRectsFromView(view: EditorView, section: 'hea
289
305
  height: number;
290
306
  }>;
291
307
 
292
- export { type ConvertFootnoteOptions as C, FOOTNOTE_SEPARATOR_HEIGHT as F, type HeaderFooterMetrics as H, MAX_FOOTNOTE_LAYOUT_PASSES as M, type StabilizeFootnoteLayoutArgs as S, type ConvertHeaderFooterOptions as a, type MeasureBlocksFn as b, type StabilizeFootnoteLayoutResult as c, buildFootnoteContentMap as d, buildFootnoteRenderItems as e, calculateFootnoteReservedHeights as f, collectFootnoteRefs as g, convertHeaderFooterToContent as h, footnoteReservedHeightsEqual as i, applyFootnotePresentation as j, calculateHeaderFooterVisualBounds as k, computeHfCaretRectFromView as l, mapFootnotesToPages as m, computeHfSelectionRectsFromView as n, convertFootnoteToContent as o, convertHeaderFooterPmDocToContent as p, invalidateHfDomCache as q, normalizeHeaderFooterMeasureBlocks as r, stabilizeFootnoteLayout as s, resolveHeaderFooterVisualTop as t };
308
+ export { type ConvertFootnoteOptions as C, FOOTNOTE_SEPARATOR_HEIGHT as F, type HeaderFooterMetrics as H, MAX_FOOTNOTE_LAYOUT_PASSES as M, type StabilizeFootnoteLayoutArgs as S, type ConvertHeaderFooterOptions as a, type MeasureBlocksFn as b, type StabilizeFootnoteLayoutResult as c, buildFootnoteContentMap as d, buildFootnoteRenderItems as e, calculateFootnoteReservedHeights as f, collectFootnoteRefs as g, convertHeaderFooterToContent as h, footnoteReservedHeightsEqual as i, applyFootnotePresentation as j, calculateHeaderFooterVisualBounds as k, computeHfCaretRectFromView as l, mapFootnotesToPages as m, computeHfSelectionRectsFromView as n, contributesToHeaderFooterFlowHeight as o, convertFootnoteToContent as p, convertHeaderFooterPmDocToContent as q, invalidateHfDomCache as r, stabilizeFootnoteLayout as s, normalizeHeaderFooterMeasureBlocks as t, resolveHeaderFooterVisualTop as u };
@@ -1 +1 @@
1
- 'use strict';var chunk7WGN2OBZ_js=require('../chunk-7WGN2OBZ.js');require('../chunk-DC7S76ZX.js');Object.defineProperty(exports,"clickToPositionDom",{enumerable:true,get:function(){return chunk7WGN2OBZ_js.e}});Object.defineProperty(exports,"clipRectToTableWindow",{enumerable:true,get:function(){return chunk7WGN2OBZ_js.f}});Object.defineProperty(exports,"getCaretPositionFromDom",{enumerable:true,get:function(){return chunk7WGN2OBZ_js.h}});Object.defineProperty(exports,"getSelectionRectsFromDom",{enumerable:true,get:function(){return chunk7WGN2OBZ_js.g}});
1
+ 'use strict';var chunk4MYKVWNF_js=require('../chunk-4MYKVWNF.js');require('../chunk-DC7S76ZX.js');Object.defineProperty(exports,"clickToPositionDom",{enumerable:true,get:function(){return chunk4MYKVWNF_js.e}});Object.defineProperty(exports,"clipRectToTableWindow",{enumerable:true,get:function(){return chunk4MYKVWNF_js.f}});Object.defineProperty(exports,"getCaretPositionFromDom",{enumerable:true,get:function(){return chunk4MYKVWNF_js.h}});Object.defineProperty(exports,"getSelectionRectsFromDom",{enumerable:true,get:function(){return chunk4MYKVWNF_js.g}});
@@ -1 +1 @@
1
- export{e as clickToPositionDom,f as clipRectToTableWindow,h as getCaretPositionFromDom,g as getSelectionRectsFromDom}from'../chunk-MEVZCB56.mjs';import'../chunk-QYUPLKLP.mjs';
1
+ export{e as clickToPositionDom,f as clipRectToTableWindow,h as getCaretPositionFromDom,g as getSelectionRectsFromDom}from'../chunk-LX35TFGF.mjs';import'../chunk-QYUPLKLP.mjs';
@@ -9,11 +9,15 @@
9
9
  * @public
10
10
  */
11
11
  export { ToFlowBlocksOptions, convertBorderSpecToLayout, resetBlockIdCounter, resolveListTemplate, toFlowBlocks } from './toFlowBlocks.mjs';
12
- import { TableBlock, Fragment, FlowBlock, Measure, Page, TableFragment, TableMeasure, ParagraphBlock, ParagraphMeasure, Layout, PageMargins } from '../layout-engine/types.mjs';
13
- export { FloatPageGeometry, FloatingExclusionRect, FloatingImageZone, FloatingLineSegmentZone, FontMetrics, FontStyle, MeasureBlockFn, MeasureParagraphOptions, RunMeasurement, TextMeasurement, buildFontString, clampFloatingWrapMargins, clearAllCaches, clearFontMetricsCache, clearParagraphMeasureCache, clearTextWidthCache, findCharacterAtX, getCachedFontMetrics, getCachedParagraphMeasure, getCachedTextWidth, getCanvasContext, getFloatingMargins, getFontCacheSize, getFontMetrics, getParagraphCacheSize, getRunCharWidths, getTextCacheSize, getTotalCacheSize, getXForCharacter, halfPtToPx, hashParagraphBlock, measureBlocksWithFloats, measureParagraph, measureParagraphs, measureRun, measureText, measureTextWidth, ptToPx, pxToHalfPt, pxToPt, pxToTwips, rectsToFloatingZones, resetCanvasContext, setCachedFontMetrics, setCachedParagraphMeasure, setCachedTextWidth, setFontCacheSize, setParagraphCacheSize, setTextCacheSize, twipsToPx } from './measuring/index.mjs';
12
+ import { TableBlock, Fragment, FlowBlock, Measure, Page, TableFragment, TableMeasure, ParagraphBlock, ParagraphMeasure, Layout, PageMargins, ColumnLayout } from '../layout-engine/types.mjs';
13
+ export { FontMetrics, FontStyle, MeasureParagraphOptions, RunMeasurement, TextMeasurement, buildFontString, clampFloatingWrapMargins, clearAllCaches, clearFontMetricsCache, clearParagraphMeasureCache, clearTextWidthCache, findCharacterAtX, getCachedFontMetrics, getCachedParagraphMeasure, getCachedTextWidth, getCanvasContext, getFontCacheSize, getFontMetrics, getParagraphCacheSize, getRunCharWidths, getTextCacheSize, getTotalCacheSize, getXForCharacter, halfPtToPx, hashParagraphBlock, measureParagraph, measureParagraphs, measureRun, measureText, measureTextWidth, ptToPx, pxToHalfPt, pxToPt, pxToTwips, resetCanvasContext, setCachedFontMetrics, setCachedParagraphMeasure, setCachedTextWidth, setFontCacheSize, setParagraphCacheSize, setTextCacheSize, twipsToPx } from './measuring/index.mjs';
14
+ export { F as FloatPageGeometry, a as FloatingExclusionRect, b as FloatingImageZone, c as FloatingLineSegmentZone, M as MeasureBlockFn, g as getFloatingMargins, m as measureBlocksWithFloats, r as rectsToFloatingZones } from '../measureBlocksPipeline-BMqbRFQB.mjs';
14
15
  export { DomCaretPosition, DomSelectionRect, clickToPositionDom, clipRectToTableWindow, getCaretPositionFromDom, getSelectionRectsFromDom, clickToPositionDom as mouseToPosition } from './clickToPositionDom.mjs';
15
- export { C as ConvertFootnoteOptions, a as ConvertHeaderFooterOptions, F as FOOTNOTE_SEPARATOR_HEIGHT, H as HeaderFooterMetrics, M as MAX_FOOTNOTE_LAYOUT_PASSES, b as MeasureBlocksFn, S as StabilizeFootnoteLayoutArgs, c as StabilizeFootnoteLayoutResult, j as applyFootnotePresentation, d as buildFootnoteContentMap, e as buildFootnoteRenderItems, f as calculateFootnoteReservedHeights, k as calculateHeaderFooterVisualBounds, g as collectFootnoteRefs, l as computeHfCaretRectFromView, n as computeHfSelectionRectsFromView, o as convertFootnoteToContent, p as convertHeaderFooterPmDocToContent, h as convertHeaderFooterToContent, i as footnoteReservedHeightsEqual, q as invalidateHfDomCache, m as mapFootnotesToPages, r as normalizeHeaderFooterMeasureBlocks, t as resolveHeaderFooterVisualTop, s as stabilizeFootnoteLayout } from '../headerFooterLayout-DlJLWmpR.mjs';
16
+ import { EditorState } from 'prosemirror-state';
17
+ export { C as ConvertFootnoteOptions, a as ConvertHeaderFooterOptions, F as FOOTNOTE_SEPARATOR_HEIGHT, H as HeaderFooterMetrics, M as MAX_FOOTNOTE_LAYOUT_PASSES, b as MeasureBlocksFn, S as StabilizeFootnoteLayoutArgs, c as StabilizeFootnoteLayoutResult, j as applyFootnotePresentation, d as buildFootnoteContentMap, e as buildFootnoteRenderItems, f as calculateFootnoteReservedHeights, k as calculateHeaderFooterVisualBounds, g as collectFootnoteRefs, l as computeHfCaretRectFromView, n as computeHfSelectionRectsFromView, o as contributesToHeaderFooterFlowHeight, p as convertFootnoteToContent, q as convertHeaderFooterPmDocToContent, h as convertHeaderFooterToContent, i as footnoteReservedHeightsEqual, r as invalidateHfDomCache, m as mapFootnotesToPages, t as normalizeHeaderFooterMeasureBlocks, u as resolveHeaderFooterVisualTop, s as stabilizeFootnoteLayout } from '../headerFooterLayout-CU6hvszp.mjs';
18
+ import { H as HeaderFooterContent } from '../footnotes-BZ24OTAT.mjs';
16
19
  export { TABLE_INSERT_EDGE_PROXIMITY, TABLE_INSERT_HIDE_DELAY_MS, TableInsertHoverHit, TableInsertHoverInput, detectTableInsertHover } from './tableInsertHover.mjs';
20
+ import { SectionLayoutConfig } from '../layout-engine/index.mjs';
17
21
  import { Document } from '../types/document.mjs';
18
22
  import { S as SectionProperties, y as HeaderFooter } from '../content-3xF4WDE8.mjs';
19
23
  import 'prosemirror-model';
@@ -24,7 +28,6 @@ import '../docx/wrapTypes.mjs';
24
28
  import '../watermark-DAcnAs_J.mjs';
25
29
  import '../anchoredObjectPosition-KJEyF-wr.mjs';
26
30
  import 'prosemirror-view';
27
- import '../footnotes-BtVc6VFl.mjs';
28
31
 
29
32
  /**
30
33
  * @internal Helpers for resolving DOCX table-width metadata into pixel widths.
@@ -285,6 +288,29 @@ declare function getPositionRect(block: ParagraphBlock, measure: ParagraphMeasur
285
288
  height: number;
286
289
  } | null;
287
290
 
291
+ /**
292
+ * Apply the visual cell-selection highlight class onto rendered table cells.
293
+ *
294
+ * The layout painter renders pages as static DOM with `data-pm-start` on each
295
+ * table cell. This walk translates a ProseMirror `CellSelection` into the
296
+ * `.layout-table-cell-selected` class on the matching painted cells. Shared by
297
+ * the React and Vue adapters.
298
+ */
299
+
300
+ /**
301
+ * Apply the `.layout-table-cell-selected` class to painted layout cells
302
+ * matching a CellSelection in the PM state. Clears the class everywhere
303
+ * (within scope) first so toggling off (or moving to a TextSelection) erases
304
+ * prior highlights.
305
+ *
306
+ * Duck-types CellSelection via `$anchorCell` / `forEachCell` rather than
307
+ * `instanceof` to dodge bundling issues across `prosemirror-tables` copies
308
+ * (the same trick used inline in the selection-overlay update).
309
+ */
310
+ declare function applyCellSelectionHighlight(pagesContainer: HTMLElement, state: EditorState, options?: {
311
+ scope?: 'body' | 'header' | 'footer';
312
+ }): void;
313
+
288
314
  /**
289
315
  * Selection Rectangles
290
316
  *
@@ -359,6 +385,69 @@ declare function isMultiPageSelection(rects: SelectionRect[]): boolean;
359
385
  */
360
386
  declare function groupRectsByPage(rects: SelectionRect[]): Map<number, SelectionRect[]>;
361
387
 
388
+ /**
389
+ * Header/footer body-margin extension.
390
+ *
391
+ * Word grows the header (or footer) band when its in-flow content is taller
392
+ * than the authored top (or bottom) margin minus the header/footer distance,
393
+ * pushing the body text down (or up). This module owns that computation so the
394
+ * React and Vue adapters share one implementation instead of byte-identical
395
+ * inline copies (the layout pipelines were drifting candidates — see
396
+ * `docx-editor` engine-unification work, issue #696).
397
+ *
398
+ * Two correctness rules live here:
399
+ *
400
+ * 1. The band height is driven by `HeaderFooterContent.flowHeight` (in-flow
401
+ * content only), NOT `height` / `visualBottom`. A page/margin-anchored
402
+ * float — e.g. a full-page letterhead anchored in a header — is positioned
403
+ * on the page and does not push the body in Word. Counting it inflated the
404
+ * effective top margin past the page on real-world templates, so the
405
+ * paginator hard-threw "page size and margins yield no content area" and
406
+ * the document rendered blank (issue #705).
407
+ *
408
+ * 2. A clamp guarantees `top + bottom` never consumes the whole page, so a
409
+ * pathological in-flow header degrades to a thin content band with a
410
+ * warning instead of aborting pagination.
411
+ */
412
+
413
+ /** @public */
414
+ interface ExtendMarginsForHeaderFooterInput {
415
+ pageSize: {
416
+ w: number;
417
+ h: number;
418
+ };
419
+ /** Body fallback margins. */
420
+ margins: PageMargins;
421
+ /** Final-section margins (last `sectPr`). */
422
+ finalMargins: PageMargins;
423
+ /**
424
+ * Body flow blocks. Each `sectionBreak` block's `margins` is extended IN
425
+ * PLACE so multi-section documents paginate with the same band growth (the
426
+ * layout engine prefers `sectionBreak.margins` over the body fallback).
427
+ */
428
+ bodyBlocks?: FlowBlock[];
429
+ /** Header variants in play this layout (e.g. default + first-page). */
430
+ headers?: Array<HeaderFooterContent | undefined>;
431
+ /** Footer variants in play this layout. */
432
+ footers?: Array<HeaderFooterContent | undefined>;
433
+ /** Optional diagnostic sink for the clamp (adapters pass `console.warn`). */
434
+ warn?: (message: string) => void;
435
+ }
436
+ /** @public */
437
+ interface ExtendMarginsForHeaderFooterResult {
438
+ margins: PageMargins;
439
+ finalMargins: PageMargins;
440
+ }
441
+ /**
442
+ * Extend body margins so the body clears the header/footer bands, mirroring
443
+ * Word. Returns new `margins` / `finalMargins`; mutates `sectionBreak.margins`
444
+ * in place. When no extension is needed the original objects are returned
445
+ * unchanged.
446
+ *
447
+ * @public
448
+ */
449
+ declare function extendMarginsForHeaderFooter(input: ExtendMarginsForHeaderFooterInput): ExtendMarginsForHeaderFooterResult;
450
+
362
451
  /**
363
452
  * Body-scoped DOM lookups for `data-pm-start` / `data-pm-end` markers.
364
453
  *
@@ -453,6 +542,8 @@ declare const DEFAULT_PAGE_HEIGHT_PX = 1056;
453
542
  declare const DEFAULT_BODY_MARGIN_PX = 96;
454
543
  /** Word's default `headerDistance` / `footerDistance` (0.5in = 48px). */
455
544
  declare const DEFAULT_HF_DISTANCE_PX = 48;
545
+ /** Convert twips to pixels (1 twip = 1/20 point, 96 pixels per inch). */
546
+ declare function twipsToPixels(twips: number): number;
456
547
  /** Convert SectionProperties page size (twips) → pixel `{ w, h }`. */
457
548
  declare function getPageSize(sp: SectionProperties | null | undefined): {
458
549
  w: number;
@@ -480,5 +571,18 @@ declare function resolveHeaderFooter(doc: Document | null, sp: SectionProperties
480
571
  firstHeader: HeaderFooter | null;
481
572
  firstFooter: HeaderFooter | null;
482
573
  };
574
+ /**
575
+ * Extract column layout from section properties.
576
+ * Returns undefined for single-column (default) to avoid unnecessary paginator overhead.
577
+ */
578
+ declare function getColumns(sectionProps: SectionProperties | null | undefined): ColumnLayout | undefined;
579
+ declare function columnWidthForSection(config: SectionLayoutConfig): number;
580
+ /**
581
+ * Compute per-block measurement widths by scanning for section breaks.
582
+ * Blocks must be measured with the page width/margins/columns of their own
583
+ * section so that the layout engine can paginate them against the right
584
+ * geometry without remeasuring.
585
+ */
586
+ declare function computePerBlockWidths(blocks: FlowBlock[], initialConfig: SectionLayoutConfig, finalConfig: SectionLayoutConfig): number[];
483
587
 
484
- export { type CaretPosition, DEFAULT_BODY_MARGIN_PX, DEFAULT_HF_DISTANCE_PX, DEFAULT_PAGE_HEIGHT_PX, DEFAULT_PAGE_WIDTH_PX, type FragmentHit, type HitTestResult, type PageHit, type Point, type PositionResult, type ResolvedGridCell, type SelectionRect, type TableCellHit, clickToPosition, clickToPositionInParagraph, clickToPositionInTableCell, countTableColumns, findBodyEmptyRuns, findBodyPmAnchor, findBodyPmAnchors, findBodyPmSpans, getCaretPosition, getMargins, getPageBounds, getPageIndexAtY, getPageSize, getPageTop, getPositionRect, getScrollYForPage, getTotalDocumentHeight, groupRectsByPage, hitTest, hitTestFragment, hitTestImageFragment, hitTestPage, hitTestTableCell, isMultiPageSelection, measureTableBlock, measureTableCellBlockVisualHeight, normalizeTableColumnWidths, positionToX, resolveCellGrid, resolveHeaderFooter, resolveTableWidthPx, selectionToRects };
588
+ export { type CaretPosition, DEFAULT_BODY_MARGIN_PX, DEFAULT_HF_DISTANCE_PX, DEFAULT_PAGE_HEIGHT_PX, DEFAULT_PAGE_WIDTH_PX, type ExtendMarginsForHeaderFooterInput, type ExtendMarginsForHeaderFooterResult, type FragmentHit, type HitTestResult, type PageHit, type Point, type PositionResult, type ResolvedGridCell, type SelectionRect, type TableCellHit, applyCellSelectionHighlight, clickToPosition, clickToPositionInParagraph, clickToPositionInTableCell, columnWidthForSection, computePerBlockWidths, countTableColumns, extendMarginsForHeaderFooter, findBodyEmptyRuns, findBodyPmAnchor, findBodyPmAnchors, findBodyPmSpans, getCaretPosition, getColumns, getMargins, getPageBounds, getPageIndexAtY, getPageSize, getPageTop, getPositionRect, getScrollYForPage, getTotalDocumentHeight, groupRectsByPage, hitTest, hitTestFragment, hitTestImageFragment, hitTestPage, hitTestTableCell, isMultiPageSelection, measureTableBlock, measureTableCellBlockVisualHeight, normalizeTableColumnWidths, positionToX, resolveCellGrid, resolveHeaderFooter, resolveTableWidthPx, selectionToRects, twipsToPixels };