docxodus 3.7.1 → 3.8.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.
@@ -67,6 +67,7 @@ var DocxodusPagination = (() => {
67
67
  * @param options - Pagination options
68
68
  */
69
69
  constructor(staging, container, options = {}) {
70
+ this.pendingFootnoteContinuation = null;
70
71
  this.stagingElement = typeof staging === "string" ? document.getElementById(staging) : staging;
71
72
  this.containerElement = typeof container === "string" ? document.getElementById(container) : container;
72
73
  if (!this.stagingElement) {
@@ -80,6 +81,7 @@ var DocxodusPagination = (() => {
80
81
  this.showPageNumbers = options.showPageNumbers ?? true;
81
82
  this.pageGap = options.pageGap ?? 20;
82
83
  this.hfRegistry = /* @__PURE__ */ new Map();
84
+ this.footnoteRegistry = /* @__PURE__ */ new Map();
83
85
  }
84
86
  /**
85
87
  * Runs the pagination process.
@@ -90,6 +92,7 @@ var DocxodusPagination = (() => {
90
92
  const pages = [];
91
93
  let pageNumber = 1;
92
94
  this.hfRegistry = this.parseHeaderFooterRegistry();
95
+ this.footnoteRegistry = this.parseFootnoteRegistry();
93
96
  const sections = this.stagingElement.querySelectorAll(
94
97
  "[data-section-index]"
95
98
  );
@@ -182,6 +185,225 @@ var DocxodusPagination = (() => {
182
185
  }
183
186
  return registry;
184
187
  }
188
+ /**
189
+ * Parses the footnote registry from the staging element.
190
+ */
191
+ parseFootnoteRegistry() {
192
+ const registry = /* @__PURE__ */ new Map();
193
+ const registryEl = this.stagingElement.querySelector("#pagination-footnote-registry");
194
+ if (!registryEl) return registry;
195
+ const entries = Array.from(registryEl.querySelectorAll("[data-footnote-id]"));
196
+ for (const entry of entries) {
197
+ const footnoteId = entry.dataset.footnoteId;
198
+ if (footnoteId) {
199
+ registry.set(footnoteId, entry.cloneNode(true));
200
+ }
201
+ }
202
+ return registry;
203
+ }
204
+ /**
205
+ * Extracts footnote reference IDs from an element.
206
+ */
207
+ extractFootnoteRefs(element) {
208
+ const refs = element.querySelectorAll("[data-footnote-id]");
209
+ const ids = [];
210
+ for (const ref of Array.from(refs)) {
211
+ const id = ref.dataset.footnoteId;
212
+ if (id && !ids.includes(id)) {
213
+ ids.push(id);
214
+ }
215
+ }
216
+ return ids;
217
+ }
218
+ /**
219
+ * Measures the height of footnotes for given IDs (in points).
220
+ * Creates a temporary container to measure the footnotes.
221
+ * @param footnoteIds - IDs of footnotes to measure
222
+ * @param contentWidth - Width for measurement
223
+ * @param continuation - Optional continuation content to include first
224
+ */
225
+ measureFootnotesHeight(footnoteIds, contentWidth, continuation) {
226
+ const hasContinuation = continuation && continuation.remainingElements.length > 0;
227
+ if (footnoteIds.length === 0 && !hasContinuation || this.footnoteRegistry.size === 0) {
228
+ return 0;
229
+ }
230
+ const measureContainer = document.createElement("div");
231
+ measureContainer.style.position = "absolute";
232
+ measureContainer.style.visibility = "hidden";
233
+ measureContainer.style.width = `${contentWidth}pt`;
234
+ measureContainer.style.left = "-9999px";
235
+ const hr = document.createElement("hr");
236
+ measureContainer.appendChild(hr);
237
+ if (hasContinuation) {
238
+ const contWrapper = document.createElement("div");
239
+ contWrapper.className = "footnote-continuation";
240
+ for (const el of continuation.remainingElements) {
241
+ contWrapper.appendChild(el.cloneNode(true));
242
+ }
243
+ measureContainer.appendChild(contWrapper);
244
+ }
245
+ for (const id of footnoteIds) {
246
+ const footnote = this.footnoteRegistry.get(id);
247
+ if (footnote) {
248
+ measureContainer.appendChild(footnote.cloneNode(true));
249
+ }
250
+ }
251
+ this.stagingElement.appendChild(measureContainer);
252
+ const rect = measureContainer.getBoundingClientRect();
253
+ const heightPt = pxToPt(rect.height);
254
+ this.stagingElement.removeChild(measureContainer);
255
+ return heightPt;
256
+ }
257
+ /**
258
+ * Measures the height of just the continuation content (in points).
259
+ */
260
+ measureContinuationHeight(continuation, contentWidth) {
261
+ if (!continuation || continuation.remainingElements.length === 0) {
262
+ return 0;
263
+ }
264
+ const measureContainer = document.createElement("div");
265
+ measureContainer.style.position = "absolute";
266
+ measureContainer.style.visibility = "hidden";
267
+ measureContainer.style.width = `${contentWidth}pt`;
268
+ measureContainer.style.left = "-9999px";
269
+ const hr = document.createElement("hr");
270
+ measureContainer.appendChild(hr);
271
+ for (const el of continuation.remainingElements) {
272
+ measureContainer.appendChild(el.cloneNode(true));
273
+ }
274
+ this.stagingElement.appendChild(measureContainer);
275
+ const rect = measureContainer.getBoundingClientRect();
276
+ const heightPt = pxToPt(rect.height);
277
+ this.stagingElement.removeChild(measureContainer);
278
+ return heightPt;
279
+ }
280
+ /**
281
+ * Splits a footnote element into parts that fit within the available height.
282
+ * Returns the elements that fit and the elements that need to continue.
283
+ */
284
+ splitFootnoteToFit(footnoteElement, availableHeightPt, contentWidth) {
285
+ const footnoteContent = footnoteElement.querySelector(".footnote-content");
286
+ if (!footnoteContent) {
287
+ return { fits: [footnoteElement.cloneNode(true)], overflow: [] };
288
+ }
289
+ const children = Array.from(footnoteContent.children);
290
+ if (children.length <= 1) {
291
+ return { fits: [footnoteElement.cloneNode(true)], overflow: [] };
292
+ }
293
+ const fits = [];
294
+ const overflow = [];
295
+ let currentHeight = 0;
296
+ const hrMeasure = document.createElement("div");
297
+ hrMeasure.style.position = "absolute";
298
+ hrMeasure.style.visibility = "hidden";
299
+ hrMeasure.style.width = `${contentWidth}pt`;
300
+ hrMeasure.style.left = "-9999px";
301
+ const hr = document.createElement("hr");
302
+ hrMeasure.appendChild(hr);
303
+ this.stagingElement.appendChild(hrMeasure);
304
+ const hrHeight = pxToPt(hrMeasure.getBoundingClientRect().height);
305
+ this.stagingElement.removeChild(hrMeasure);
306
+ currentHeight = hrHeight;
307
+ const footnoteNumber = footnoteElement.querySelector(".footnote-number");
308
+ for (let i = 0; i < children.length; i++) {
309
+ const child = children[i];
310
+ const measureContainer = document.createElement("div");
311
+ measureContainer.style.position = "absolute";
312
+ measureContainer.style.visibility = "hidden";
313
+ measureContainer.style.width = `${contentWidth}pt`;
314
+ measureContainer.style.left = "-9999px";
315
+ measureContainer.appendChild(child.cloneNode(true));
316
+ this.stagingElement.appendChild(measureContainer);
317
+ const childHeight = pxToPt(measureContainer.getBoundingClientRect().height);
318
+ this.stagingElement.removeChild(measureContainer);
319
+ if (currentHeight + childHeight <= availableHeightPt) {
320
+ fits.push(child.cloneNode(true));
321
+ currentHeight += childHeight;
322
+ } else {
323
+ for (let j = i; j < children.length; j++) {
324
+ overflow.push(children[j].cloneNode(true));
325
+ }
326
+ break;
327
+ }
328
+ }
329
+ return { fits, overflow };
330
+ }
331
+ /**
332
+ * Measures a single footnote's height.
333
+ */
334
+ measureSingleFootnoteHeight(footnoteId, contentWidth) {
335
+ const footnote = this.footnoteRegistry.get(footnoteId);
336
+ if (!footnote) return 0;
337
+ const measureContainer = document.createElement("div");
338
+ measureContainer.style.position = "absolute";
339
+ measureContainer.style.visibility = "hidden";
340
+ measureContainer.style.width = `${contentWidth}pt`;
341
+ measureContainer.style.left = "-9999px";
342
+ measureContainer.appendChild(footnote.cloneNode(true));
343
+ this.stagingElement.appendChild(measureContainer);
344
+ const rect = measureContainer.getBoundingClientRect();
345
+ const heightPt = pxToPt(rect.height);
346
+ this.stagingElement.removeChild(measureContainer);
347
+ return heightPt;
348
+ }
349
+ /**
350
+ * Adds footnotes to a page container, including continuation content.
351
+ */
352
+ addPageFootnotes(pageBox, footnoteIds, dims, continuation, partialFootnotes) {
353
+ const hasContinuation = continuation && continuation.remainingElements.length > 0;
354
+ if (footnoteIds.length === 0 && !hasContinuation) {
355
+ return;
356
+ }
357
+ if (this.footnoteRegistry.size === 0 && !hasContinuation) {
358
+ return;
359
+ }
360
+ const partialFootnoteIds = new Set(partialFootnotes?.map((p) => p.footnoteId) || []);
361
+ const footnotesDiv = document.createElement("div");
362
+ footnotesDiv.className = `${this.cssPrefix}footnotes`;
363
+ footnotesDiv.style.position = "absolute";
364
+ footnotesDiv.style.bottom = `${dims.marginBottom}pt`;
365
+ footnotesDiv.style.left = `${dims.marginLeft}pt`;
366
+ footnotesDiv.style.width = `${dims.contentWidth}pt`;
367
+ footnotesDiv.style.boxSizing = "border-box";
368
+ const hr = document.createElement("hr");
369
+ footnotesDiv.appendChild(hr);
370
+ if (hasContinuation) {
371
+ const contWrapper = document.createElement("div");
372
+ contWrapper.className = "footnote-continuation";
373
+ for (const el of continuation.remainingElements) {
374
+ contWrapper.appendChild(el.cloneNode(true));
375
+ }
376
+ footnotesDiv.appendChild(contWrapper);
377
+ }
378
+ for (const id of footnoteIds) {
379
+ const partial = partialFootnotes?.find((p) => p.footnoteId === id);
380
+ if (partial) {
381
+ const footnote = this.footnoteRegistry.get(id);
382
+ if (footnote) {
383
+ const partialDiv = document.createElement("div");
384
+ partialDiv.className = "footnote-item";
385
+ partialDiv.dataset.footnoteId = id;
386
+ const numberSpan = footnote.querySelector(".footnote-number");
387
+ if (numberSpan) {
388
+ partialDiv.appendChild(numberSpan.cloneNode(true));
389
+ }
390
+ const contentSpan = document.createElement("span");
391
+ contentSpan.className = "footnote-content";
392
+ for (const el of partial.fittingElements) {
393
+ contentSpan.appendChild(el.cloneNode(true));
394
+ }
395
+ partialDiv.appendChild(contentSpan);
396
+ footnotesDiv.appendChild(partialDiv);
397
+ }
398
+ } else {
399
+ const footnote = this.footnoteRegistry.get(id);
400
+ if (footnote) {
401
+ footnotesDiv.appendChild(footnote.cloneNode(true));
402
+ }
403
+ }
404
+ }
405
+ pageBox.appendChild(footnotesDiv);
406
+ }
185
407
  /**
186
408
  * Selects the appropriate header for a page based on section, page position, and page number.
187
409
  */
@@ -212,6 +434,8 @@ var DocxodusPagination = (() => {
212
434
  }
213
435
  /**
214
436
  * Flows measured blocks into page containers.
437
+ * Implements a single-pass, forward-only algorithm that is compatible with future lazy loading.
438
+ * Supports footnote continuation - long footnotes can split across pages.
215
439
  */
216
440
  flowToPages(blocks, dims, startPageNumber, sectionIndex) {
217
441
  const pages = [];
@@ -220,15 +444,41 @@ var DocxodusPagination = (() => {
220
444
  let pageNumber = startPageNumber;
221
445
  let pageInSection = 1;
222
446
  let prevMarginBottomPt = 0;
447
+ let currentFootnoteIds = [];
448
+ let currentFootnoteHeight = 0;
449
+ let currentContinuation = this.pendingFootnoteContinuation;
450
+ let nextPageContinuation = null;
451
+ let currentPartialFootnotes = [];
452
+ if (currentContinuation && currentContinuation.remainingElements.length > 0) {
453
+ currentFootnoteHeight = this.measureContinuationHeight(currentContinuation, dims.contentWidth);
454
+ }
223
455
  const finishPage = () => {
224
- if (currentContent.length === 0) return;
225
- const page = this.createPage(dims, pageNumber, sectionIndex, currentContent, pageInSection);
456
+ if (currentContent.length === 0 && !currentContinuation) return;
457
+ const page = this.createPage(
458
+ dims,
459
+ pageNumber,
460
+ sectionIndex,
461
+ currentContent,
462
+ pageInSection,
463
+ currentFootnoteIds,
464
+ currentContinuation,
465
+ currentPartialFootnotes.length > 0 ? currentPartialFootnotes : void 0
466
+ );
226
467
  pages.push(page);
227
468
  pageNumber++;
228
469
  pageInSection++;
229
470
  currentContent = [];
230
471
  remainingHeight = dims.contentHeight;
231
472
  prevMarginBottomPt = 0;
473
+ currentFootnoteIds = [];
474
+ currentPartialFootnotes = [];
475
+ currentContinuation = nextPageContinuation;
476
+ nextPageContinuation = null;
477
+ if (currentContinuation && currentContinuation.remainingElements.length > 0) {
478
+ currentFootnoteHeight = this.measureContinuationHeight(currentContinuation, dims.contentWidth);
479
+ } else {
480
+ currentFootnoteHeight = 0;
481
+ }
232
482
  };
233
483
  for (let i = 0; i < blocks.length; i++) {
234
484
  const block = blocks[i];
@@ -240,42 +490,118 @@ var DocxodusPagination = (() => {
240
490
  if (block.pageBreakBefore && currentContent.length > 0) {
241
491
  finishPage();
242
492
  }
493
+ const blockFootnoteIds = this.extractFootnoteRefs(block.element);
494
+ const newFootnoteIds = blockFootnoteIds.filter((id) => !currentFootnoteIds.includes(id));
495
+ let additionalFootnoteHeight = 0;
496
+ if (newFootnoteIds.length > 0 && this.footnoteRegistry.size > 0) {
497
+ const combinedFootnoteIds = [...currentFootnoteIds, ...newFootnoteIds];
498
+ const totalFootnoteHeight = this.measureFootnotesHeight(
499
+ combinedFootnoteIds,
500
+ dims.contentWidth,
501
+ currentContinuation
502
+ );
503
+ additionalFootnoteHeight = totalFootnoteHeight - currentFootnoteHeight;
504
+ }
243
505
  const isFirstOnPage = currentContent.length === 0;
244
506
  let effectiveMarginTop = block.marginTopPt;
245
507
  if (!isFirstOnPage) {
246
508
  effectiveMarginTop = Math.max(block.marginTopPt, prevMarginBottomPt) - prevMarginBottomPt;
247
509
  }
248
- const blockSpace = effectiveMarginTop + block.heightPt + block.marginBottomPt;
510
+ const blockSpace = effectiveMarginTop + block.heightPt + block.marginBottomPt + additionalFootnoteHeight;
249
511
  let neededHeight = blockSpace;
250
512
  if (block.keepWithNext && nextBlock && !nextBlock.isPageBreak) {
251
513
  const collapsedMargin = Math.max(block.marginBottomPt, nextBlock.marginTopPt);
252
- neededHeight = effectiveMarginTop + block.heightPt + collapsedMargin + nextBlock.heightPt + nextBlock.marginBottomPt;
514
+ neededHeight = effectiveMarginTop + block.heightPt + collapsedMargin + nextBlock.heightPt + nextBlock.marginBottomPt + additionalFootnoteHeight;
253
515
  }
254
- if (blockSpace <= remainingHeight) {
516
+ const effectiveRemainingHeight = remainingHeight - currentFootnoteHeight;
517
+ if (blockSpace <= effectiveRemainingHeight) {
255
518
  currentContent.push(block.element.cloneNode(true));
256
- remainingHeight -= blockSpace;
519
+ remainingHeight -= effectiveMarginTop + block.heightPt + block.marginBottomPt;
257
520
  prevMarginBottomPt = block.marginBottomPt;
521
+ if (newFootnoteIds.length > 0) {
522
+ currentFootnoteIds.push(...newFootnoteIds);
523
+ currentFootnoteHeight += additionalFootnoteHeight;
524
+ }
258
525
  } else if (block.heightPt + block.marginTopPt + block.marginBottomPt <= dims.contentHeight) {
259
- finishPage();
260
- const newPageSpace = block.marginTopPt + block.heightPt + block.marginBottomPt;
261
- currentContent.push(block.element.cloneNode(true));
262
- remainingHeight = dims.contentHeight - newPageSpace;
263
- prevMarginBottomPt = block.marginBottomPt;
526
+ const blockSpaceWithoutFootnotes = effectiveMarginTop + block.heightPt + block.marginBottomPt;
527
+ if (newFootnoteIds.length > 0 && blockSpaceWithoutFootnotes <= effectiveRemainingHeight) {
528
+ currentContent.push(block.element.cloneNode(true));
529
+ remainingHeight -= effectiveMarginTop + block.heightPt + block.marginBottomPt;
530
+ prevMarginBottomPt = block.marginBottomPt;
531
+ const spaceForFootnotes = remainingHeight - currentFootnoteHeight;
532
+ for (const footnoteId of newFootnoteIds) {
533
+ const footnote = this.footnoteRegistry.get(footnoteId);
534
+ if (!footnote) continue;
535
+ const footnoteHeight = this.measureSingleFootnoteHeight(footnoteId, dims.contentWidth);
536
+ if (footnoteHeight <= spaceForFootnotes - currentFootnoteHeight) {
537
+ currentFootnoteIds.push(footnoteId);
538
+ currentFootnoteHeight += footnoteHeight;
539
+ } else {
540
+ const availableForThisFootnote = spaceForFootnotes;
541
+ if (availableForThisFootnote > 20) {
542
+ const { fits, overflow } = this.splitFootnoteToFit(
543
+ footnote,
544
+ availableForThisFootnote,
545
+ dims.contentWidth
546
+ );
547
+ if (fits.length > 0) {
548
+ currentFootnoteIds.push(footnoteId);
549
+ currentPartialFootnotes.push({
550
+ footnoteId,
551
+ fittingElements: fits
552
+ });
553
+ nextPageContinuation = {
554
+ footnoteId,
555
+ remainingElements: overflow
556
+ };
557
+ currentFootnoteHeight = spaceForFootnotes;
558
+ } else {
559
+ nextPageContinuation = {
560
+ footnoteId,
561
+ remainingElements: Array.from(footnote.querySelectorAll(".footnote-content > *")).map((el) => el.cloneNode(true))
562
+ };
563
+ if (nextPageContinuation.remainingElements.length === 0) {
564
+ nextPageContinuation.remainingElements = [footnote.cloneNode(true)];
565
+ }
566
+ }
567
+ } else {
568
+ nextPageContinuation = {
569
+ footnoteId,
570
+ remainingElements: Array.from(footnote.querySelectorAll(".footnote-content > *")).map((el) => el.cloneNode(true))
571
+ };
572
+ if (nextPageContinuation.remainingElements.length === 0) {
573
+ nextPageContinuation.remainingElements = [footnote.cloneNode(true)];
574
+ }
575
+ }
576
+ }
577
+ }
578
+ } else {
579
+ finishPage();
580
+ const newPageFootnoteHeight = blockFootnoteIds.length > 0 ? this.measureFootnotesHeight(blockFootnoteIds, dims.contentWidth, currentContinuation) : currentContinuation ? this.measureContinuationHeight(currentContinuation, dims.contentWidth) : 0;
581
+ const newPageSpace = block.marginTopPt + block.heightPt + block.marginBottomPt;
582
+ currentContent.push(block.element.cloneNode(true));
583
+ remainingHeight = dims.contentHeight - newPageSpace;
584
+ prevMarginBottomPt = block.marginBottomPt;
585
+ currentFootnoteIds = [...blockFootnoteIds];
586
+ currentFootnoteHeight = newPageFootnoteHeight;
587
+ }
264
588
  } else {
265
589
  if (currentContent.length > 0) {
266
590
  finishPage();
267
591
  }
268
592
  currentContent.push(block.element.cloneNode(true));
593
+ currentFootnoteIds = [...blockFootnoteIds];
269
594
  finishPage();
270
595
  }
271
596
  }
272
597
  finishPage();
598
+ this.pendingFootnoteContinuation = nextPageContinuation;
273
599
  return pages;
274
600
  }
275
601
  /**
276
602
  * Creates a page container element.
277
603
  */
278
- createPage(dims, pageNumber, sectionIndex, content, pageInSection) {
604
+ createPage(dims, pageNumber, sectionIndex, content, pageInSection, footnoteIds = [], continuation, partialFootnotes) {
279
605
  const pageBox = document.createElement("div");
280
606
  pageBox.className = `${this.cssPrefix}box`;
281
607
  pageBox.style.width = `${dims.pageWidth}pt`;
@@ -302,10 +628,16 @@ var DocxodusPagination = (() => {
302
628
  const headerDiv = document.createElement("div");
303
629
  headerDiv.className = `${this.cssPrefix}header`;
304
630
  headerDiv.style.position = "absolute";
305
- headerDiv.style.top = `${dims.headerHeight}pt`;
631
+ headerDiv.style.top = "0";
306
632
  headerDiv.style.left = `${dims.marginLeft}pt`;
307
633
  headerDiv.style.width = `${dims.contentWidth}pt`;
634
+ headerDiv.style.height = `${dims.marginTop}pt`;
308
635
  headerDiv.style.overflow = "hidden";
636
+ headerDiv.style.boxSizing = "border-box";
637
+ headerDiv.style.display = "flex";
638
+ headerDiv.style.flexDirection = "column";
639
+ headerDiv.style.justifyContent = "flex-end";
640
+ headerDiv.style.paddingBottom = "4pt";
309
641
  for (const child of Array.from(headerSource.childNodes)) {
310
642
  headerDiv.appendChild(child.cloneNode(true));
311
643
  }
@@ -323,15 +655,25 @@ var DocxodusPagination = (() => {
323
655
  contentArea.appendChild(el);
324
656
  }
325
657
  pageBox.appendChild(contentArea);
658
+ const hasContinuation = continuation && continuation.remainingElements.length > 0;
659
+ if (footnoteIds.length > 0 || hasContinuation) {
660
+ this.addPageFootnotes(pageBox, footnoteIds, dims, continuation, partialFootnotes);
661
+ }
326
662
  const footerSource = this.selectFooter(sectionIndex, pageInSection, pageNumber);
327
663
  if (footerSource) {
328
664
  const footerDiv = document.createElement("div");
329
665
  footerDiv.className = `${this.cssPrefix}footer`;
330
666
  footerDiv.style.position = "absolute";
331
- footerDiv.style.bottom = `${dims.footerHeight}pt`;
667
+ footerDiv.style.bottom = "0";
332
668
  footerDiv.style.left = `${dims.marginLeft}pt`;
333
669
  footerDiv.style.width = `${dims.contentWidth}pt`;
670
+ footerDiv.style.height = `${dims.marginBottom}pt`;
334
671
  footerDiv.style.overflow = "hidden";
672
+ footerDiv.style.boxSizing = "border-box";
673
+ footerDiv.style.display = "flex";
674
+ footerDiv.style.flexDirection = "column";
675
+ footerDiv.style.justifyContent = "flex-start";
676
+ footerDiv.style.paddingTop = "4pt";
335
677
  for (const child of Array.from(footerSource.childNodes)) {
336
678
  footerDiv.appendChild(child.cloneNode(true));
337
679
  }
@@ -110,6 +110,10 @@ export interface PaginationOptions {
110
110
  * Pagination engine that converts HTML with pagination metadata
111
111
  * into a paginated view with fixed-size page containers.
112
112
  */
113
+ /**
114
+ * Registry of footnotes by ID for per-page distribution.
115
+ */
116
+ export type FootnoteRegistry = Map<string, HTMLElement>;
113
117
  export declare class PaginationEngine {
114
118
  private stagingElement;
115
119
  private containerElement;
@@ -118,6 +122,8 @@ export declare class PaginationEngine {
118
122
  private showPageNumbers;
119
123
  private pageGap;
120
124
  private hfRegistry;
125
+ private footnoteRegistry;
126
+ private pendingFootnoteContinuation;
121
127
  /**
122
128
  * Creates a new pagination engine.
123
129
  *
@@ -140,6 +146,39 @@ export declare class PaginationEngine {
140
146
  * Parses the header/footer registry from the staging element.
141
147
  */
142
148
  private parseHeaderFooterRegistry;
149
+ /**
150
+ * Parses the footnote registry from the staging element.
151
+ */
152
+ private parseFootnoteRegistry;
153
+ /**
154
+ * Extracts footnote reference IDs from an element.
155
+ */
156
+ private extractFootnoteRefs;
157
+ /**
158
+ * Measures the height of footnotes for given IDs (in points).
159
+ * Creates a temporary container to measure the footnotes.
160
+ * @param footnoteIds - IDs of footnotes to measure
161
+ * @param contentWidth - Width for measurement
162
+ * @param continuation - Optional continuation content to include first
163
+ */
164
+ private measureFootnotesHeight;
165
+ /**
166
+ * Measures the height of just the continuation content (in points).
167
+ */
168
+ private measureContinuationHeight;
169
+ /**
170
+ * Splits a footnote element into parts that fit within the available height.
171
+ * Returns the elements that fit and the elements that need to continue.
172
+ */
173
+ private splitFootnoteToFit;
174
+ /**
175
+ * Measures a single footnote's height.
176
+ */
177
+ private measureSingleFootnoteHeight;
178
+ /**
179
+ * Adds footnotes to a page container, including continuation content.
180
+ */
181
+ private addPageFootnotes;
143
182
  /**
144
183
  * Selects the appropriate header for a page based on section, page position, and page number.
145
184
  */
@@ -150,6 +189,8 @@ export declare class PaginationEngine {
150
189
  private selectFooter;
151
190
  /**
152
191
  * Flows measured blocks into page containers.
192
+ * Implements a single-pass, forward-only algorithm that is compatible with future lazy loading.
193
+ * Supports footnote continuation - long footnotes can split across pages.
153
194
  */
154
195
  private flowToPages;
155
196
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"pagination.d.ts","sourceRoot":"","sources":["../src/pagination.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,2BAA2B;IAC3B,SAAS,EAAE,MAAM,CAAC;IAClB,4BAA4B;IAC5B,UAAU,E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AK,CAAS;IACtB,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,eAAe,CAAU;IACjC,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,UAAU,CAAuB;IACzC,OAAO,CAAC,gBAAgB,CAAmB;IAC3C,OAAO,CAAC,2BAA2B,CAAqC;IAExE;;;;;;OAMG;gBAED,OAAO,EAAE,WAAW,GAAG,MAAM,EAC7B,SAAS,EAAE,WAAW,GAAG,MAAM,EAC/B,OAAO,GAAE,iBAAsB;IA0BjC;;;;OAIG;IACH,QAAQ,IAAI,gBAAgB;IA+C5B;;OAEG;IACH,OAAO,CAAC,aAAa;IA4CrB;;OAEG;IACH,OAAO,CAAC,yBAAyB;IA6CjC;;OAEG;IACH,OAAO,CAAC,qBAAqB;IAmB7B;;OAEG;IACH,OAAO,CAAC,mBAAmB;IAY3B;;;;;;OAMG;IACH,OAAO,CAAC,sBAAsB;IAoD9B;;OAEG;IACH,OAAO,CAAC,yBAAyB;IA+BjC;;;OAGG;IACH,OAAO,CAAC,kBAAkB;IAoE1B;;OAEG;IACH,OAAO,CAAC,2BAA2B;IAmBnC;;OAEG;IACH,OAAO,CAAC,gBAAgB;IAgFxB;;OAEG;IACH,OAAO,CAAC,YAAY;IAsBpB;;OAEG;IACH,OAAO,CAAC,YAAY;IAsBpB;;;;OAIG;IACH,OAAO,CAAC,WAAW;IAsPnB;;OAEG;IACH,OAAO,CAAC,UAAU;CAkInB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,YAAY,CAC1B,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,WAAW,GAAG,MAAM,EAC/B,OAAO,GAAE,iBAAsB,GAC9B,gBAAgB,CAgClB"}
@@ -49,10 +49,6 @@ function parseDimensions(section) {
49
49
  footerHeight,
50
50
  };
51
51
  }
52
- /**
53
- * Pagination engine that converts HTML with pagination metadata
54
- * into a paginated view with fixed-size page containers.
55
- */
56
52
  export class PaginationEngine {
57
53
  /**
58
54
  * Creates a new pagination engine.
@@ -62,6 +58,7 @@ export class PaginationEngine {
62
58
  * @param options - Pagination options
63
59
  */
64
60
  constructor(staging, container, options = {}) {
61
+ this.pendingFootnoteContinuation = null;
65
62
  this.stagingElement =
66
63
  typeof staging === "string"
67
64
  ? document.getElementById(staging)
@@ -81,6 +78,7 @@ export class PaginationEngine {
81
78
  this.showPageNumbers = options.showPageNumbers ?? true;
82
79
  this.pageGap = options.pageGap ?? 20;
83
80
  this.hfRegistry = new Map();
81
+ this.footnoteRegistry = new Map();
84
82
  }
85
83
  /**
86
84
  * Runs the pagination process.
@@ -92,6 +90,8 @@ export class PaginationEngine {
92
90
  let pageNumber = 1;
93
91
  // Parse the header/footer registry if present
94
92
  this.hfRegistry = this.parseHeaderFooterRegistry();
93
+ // Parse the footnote registry if present
94
+ this.footnoteRegistry = this.parseFootnoteRegistry();
95
95
  // Find all section containers
96
96
  const sections = this.stagingElement.querySelectorAll("[data-section-index]");
97
97
  // If no sections found, treat the entire staging content as one section
@@ -197,6 +197,255 @@ export class PaginationEngine {
197
197
  }
198
198
  return registry;
199
199
  }
200
+ /**
201
+ * Parses the footnote registry from the staging element.
202
+ */
203
+ parseFootnoteRegistry() {
204
+ const registry = new Map();
205
+ const registryEl = this.stagingElement.querySelector("#pagination-footnote-registry");
206
+ if (!registryEl)
207
+ return registry;
208
+ const entries = Array.from(registryEl.querySelectorAll("[data-footnote-id]"));
209
+ for (const entry of entries) {
210
+ const footnoteId = entry.dataset.footnoteId;
211
+ if (footnoteId) {
212
+ // Clone the footnote element for later use
213
+ registry.set(footnoteId, entry.cloneNode(true));
214
+ }
215
+ }
216
+ return registry;
217
+ }
218
+ /**
219
+ * Extracts footnote reference IDs from an element.
220
+ */
221
+ extractFootnoteRefs(element) {
222
+ const refs = element.querySelectorAll("[data-footnote-id]");
223
+ const ids = [];
224
+ for (const ref of Array.from(refs)) {
225
+ const id = ref.dataset.footnoteId;
226
+ if (id && !ids.includes(id)) {
227
+ ids.push(id);
228
+ }
229
+ }
230
+ return ids;
231
+ }
232
+ /**
233
+ * Measures the height of footnotes for given IDs (in points).
234
+ * Creates a temporary container to measure the footnotes.
235
+ * @param footnoteIds - IDs of footnotes to measure
236
+ * @param contentWidth - Width for measurement
237
+ * @param continuation - Optional continuation content to include first
238
+ */
239
+ measureFootnotesHeight(footnoteIds, contentWidth, continuation) {
240
+ const hasContinuation = continuation && continuation.remainingElements.length > 0;
241
+ if ((footnoteIds.length === 0 && !hasContinuation) || this.footnoteRegistry.size === 0) {
242
+ return 0;
243
+ }
244
+ // Create a temporary measurement container
245
+ const measureContainer = document.createElement("div");
246
+ measureContainer.style.position = "absolute";
247
+ measureContainer.style.visibility = "hidden";
248
+ measureContainer.style.width = `${contentWidth}pt`;
249
+ measureContainer.style.left = "-9999px";
250
+ // Add separator line (same as will be rendered)
251
+ const hr = document.createElement("hr");
252
+ measureContainer.appendChild(hr);
253
+ // Add continuation content first (if any)
254
+ if (hasContinuation) {
255
+ const contWrapper = document.createElement("div");
256
+ contWrapper.className = "footnote-continuation";
257
+ for (const el of continuation.remainingElements) {
258
+ contWrapper.appendChild(el.cloneNode(true));
259
+ }
260
+ measureContainer.appendChild(contWrapper);
261
+ }
262
+ // Add footnotes
263
+ for (const id of footnoteIds) {
264
+ const footnote = this.footnoteRegistry.get(id);
265
+ if (footnote) {
266
+ measureContainer.appendChild(footnote.cloneNode(true));
267
+ }
268
+ }
269
+ // Append to staging for measurement
270
+ this.stagingElement.appendChild(measureContainer);
271
+ // Measure
272
+ const rect = measureContainer.getBoundingClientRect();
273
+ const heightPt = pxToPt(rect.height);
274
+ // Clean up
275
+ this.stagingElement.removeChild(measureContainer);
276
+ return heightPt;
277
+ }
278
+ /**
279
+ * Measures the height of just the continuation content (in points).
280
+ */
281
+ measureContinuationHeight(continuation, contentWidth) {
282
+ if (!continuation || continuation.remainingElements.length === 0) {
283
+ return 0;
284
+ }
285
+ const measureContainer = document.createElement("div");
286
+ measureContainer.style.position = "absolute";
287
+ measureContainer.style.visibility = "hidden";
288
+ measureContainer.style.width = `${contentWidth}pt`;
289
+ measureContainer.style.left = "-9999px";
290
+ // Add separator line
291
+ const hr = document.createElement("hr");
292
+ measureContainer.appendChild(hr);
293
+ // Add continuation content
294
+ for (const el of continuation.remainingElements) {
295
+ measureContainer.appendChild(el.cloneNode(true));
296
+ }
297
+ this.stagingElement.appendChild(measureContainer);
298
+ const rect = measureContainer.getBoundingClientRect();
299
+ const heightPt = pxToPt(rect.height);
300
+ this.stagingElement.removeChild(measureContainer);
301
+ return heightPt;
302
+ }
303
+ /**
304
+ * Splits a footnote element into parts that fit within the available height.
305
+ * Returns the elements that fit and the elements that need to continue.
306
+ */
307
+ splitFootnoteToFit(footnoteElement, availableHeightPt, contentWidth) {
308
+ // Get child elements (paragraphs) of the footnote content
309
+ const footnoteContent = footnoteElement.querySelector(".footnote-content");
310
+ if (!footnoteContent) {
311
+ // No content structure, can't split - return whole footnote
312
+ return { fits: [footnoteElement.cloneNode(true)], overflow: [] };
313
+ }
314
+ const children = Array.from(footnoteContent.children);
315
+ if (children.length <= 1) {
316
+ // Single paragraph, can't split at paragraph level
317
+ return { fits: [footnoteElement.cloneNode(true)], overflow: [] };
318
+ }
319
+ const fits = [];
320
+ const overflow = [];
321
+ let currentHeight = 0;
322
+ // Measure separator line height
323
+ const hrMeasure = document.createElement("div");
324
+ hrMeasure.style.position = "absolute";
325
+ hrMeasure.style.visibility = "hidden";
326
+ hrMeasure.style.width = `${contentWidth}pt`;
327
+ hrMeasure.style.left = "-9999px";
328
+ const hr = document.createElement("hr");
329
+ hrMeasure.appendChild(hr);
330
+ this.stagingElement.appendChild(hrMeasure);
331
+ const hrHeight = pxToPt(hrMeasure.getBoundingClientRect().height);
332
+ this.stagingElement.removeChild(hrMeasure);
333
+ currentHeight = hrHeight;
334
+ // Also account for footnote number
335
+ const footnoteNumber = footnoteElement.querySelector(".footnote-number");
336
+ for (let i = 0; i < children.length; i++) {
337
+ const child = children[i];
338
+ // Measure this element
339
+ const measureContainer = document.createElement("div");
340
+ measureContainer.style.position = "absolute";
341
+ measureContainer.style.visibility = "hidden";
342
+ measureContainer.style.width = `${contentWidth}pt`;
343
+ measureContainer.style.left = "-9999px";
344
+ measureContainer.appendChild(child.cloneNode(true));
345
+ this.stagingElement.appendChild(measureContainer);
346
+ const childHeight = pxToPt(measureContainer.getBoundingClientRect().height);
347
+ this.stagingElement.removeChild(measureContainer);
348
+ if (currentHeight + childHeight <= availableHeightPt) {
349
+ fits.push(child.cloneNode(true));
350
+ currentHeight += childHeight;
351
+ }
352
+ else {
353
+ // This and remaining elements overflow
354
+ for (let j = i; j < children.length; j++) {
355
+ overflow.push(children[j].cloneNode(true));
356
+ }
357
+ break;
358
+ }
359
+ }
360
+ return { fits, overflow };
361
+ }
362
+ /**
363
+ * Measures a single footnote's height.
364
+ */
365
+ measureSingleFootnoteHeight(footnoteId, contentWidth) {
366
+ const footnote = this.footnoteRegistry.get(footnoteId);
367
+ if (!footnote)
368
+ return 0;
369
+ const measureContainer = document.createElement("div");
370
+ measureContainer.style.position = "absolute";
371
+ measureContainer.style.visibility = "hidden";
372
+ measureContainer.style.width = `${contentWidth}pt`;
373
+ measureContainer.style.left = "-9999px";
374
+ measureContainer.appendChild(footnote.cloneNode(true));
375
+ this.stagingElement.appendChild(measureContainer);
376
+ const rect = measureContainer.getBoundingClientRect();
377
+ const heightPt = pxToPt(rect.height);
378
+ this.stagingElement.removeChild(measureContainer);
379
+ return heightPt;
380
+ }
381
+ /**
382
+ * Adds footnotes to a page container, including continuation content.
383
+ */
384
+ addPageFootnotes(pageBox, footnoteIds, dims, continuation, partialFootnotes) {
385
+ const hasContinuation = continuation && continuation.remainingElements.length > 0;
386
+ if (footnoteIds.length === 0 && !hasContinuation) {
387
+ return;
388
+ }
389
+ if (this.footnoteRegistry.size === 0 && !hasContinuation) {
390
+ return;
391
+ }
392
+ // Create a set of partial footnote IDs for quick lookup
393
+ const partialFootnoteIds = new Set(partialFootnotes?.map(p => p.footnoteId) || []);
394
+ const footnotesDiv = document.createElement("div");
395
+ footnotesDiv.className = `${this.cssPrefix}footnotes`;
396
+ footnotesDiv.style.position = "absolute";
397
+ footnotesDiv.style.bottom = `${dims.marginBottom}pt`; // Above footer area
398
+ footnotesDiv.style.left = `${dims.marginLeft}pt`;
399
+ footnotesDiv.style.width = `${dims.contentWidth}pt`;
400
+ footnotesDiv.style.boxSizing = "border-box";
401
+ // Add separator line
402
+ const hr = document.createElement("hr");
403
+ footnotesDiv.appendChild(hr);
404
+ // Add continuation content first (if any)
405
+ if (hasContinuation) {
406
+ const contWrapper = document.createElement("div");
407
+ contWrapper.className = "footnote-continuation";
408
+ for (const el of continuation.remainingElements) {
409
+ contWrapper.appendChild(el.cloneNode(true));
410
+ }
411
+ footnotesDiv.appendChild(contWrapper);
412
+ }
413
+ // Clone footnotes in order of appearance
414
+ for (const id of footnoteIds) {
415
+ // Check if this is a partial footnote
416
+ const partial = partialFootnotes?.find(p => p.footnoteId === id);
417
+ if (partial) {
418
+ // Render partial footnote (only the fitting elements)
419
+ const footnote = this.footnoteRegistry.get(id);
420
+ if (footnote) {
421
+ const partialDiv = document.createElement("div");
422
+ partialDiv.className = "footnote-item";
423
+ partialDiv.dataset.footnoteId = id;
424
+ // Add footnote number
425
+ const numberSpan = footnote.querySelector(".footnote-number");
426
+ if (numberSpan) {
427
+ partialDiv.appendChild(numberSpan.cloneNode(true));
428
+ }
429
+ // Add only the fitting content
430
+ const contentSpan = document.createElement("span");
431
+ contentSpan.className = "footnote-content";
432
+ for (const el of partial.fittingElements) {
433
+ contentSpan.appendChild(el.cloneNode(true));
434
+ }
435
+ partialDiv.appendChild(contentSpan);
436
+ footnotesDiv.appendChild(partialDiv);
437
+ }
438
+ }
439
+ else {
440
+ // Render full footnote from registry
441
+ const footnote = this.footnoteRegistry.get(id);
442
+ if (footnote) {
443
+ footnotesDiv.appendChild(footnote.cloneNode(true));
444
+ }
445
+ }
446
+ }
447
+ pageBox.appendChild(footnotesDiv);
448
+ }
200
449
  /**
201
450
  * Selects the appropriate header for a page based on section, page position, and page number.
202
451
  */
@@ -235,6 +484,8 @@ export class PaginationEngine {
235
484
  }
236
485
  /**
237
486
  * Flows measured blocks into page containers.
487
+ * Implements a single-pass, forward-only algorithm that is compatible with future lazy loading.
488
+ * Supports footnote continuation - long footnotes can split across pages.
238
489
  */
239
490
  flowToPages(blocks, dims, startPageNumber, sectionIndex) {
240
491
  const pages = [];
@@ -245,16 +496,42 @@ export class PaginationEngine {
245
496
  let pageInSection = 1;
246
497
  // Track the previous block's bottom margin for margin collapsing
247
498
  let prevMarginBottomPt = 0;
499
+ // Track footnote IDs for the current page
500
+ let currentFootnoteIds = [];
501
+ // Track height consumed by footnotes on current page
502
+ let currentFootnoteHeight = 0;
503
+ // Track footnote continuation for current page (from previous page)
504
+ let currentContinuation = this.pendingFootnoteContinuation;
505
+ // Track any new continuation that will carry to next page
506
+ let nextPageContinuation = null;
507
+ // Track partial footnotes for current page (footnotes that were split)
508
+ let currentPartialFootnotes = [];
509
+ // Account for any continuation from previous section/page
510
+ if (currentContinuation && currentContinuation.remainingElements.length > 0) {
511
+ currentFootnoteHeight = this.measureContinuationHeight(currentContinuation, dims.contentWidth);
512
+ }
248
513
  const finishPage = () => {
249
- if (currentContent.length === 0)
514
+ if (currentContent.length === 0 && !currentContinuation)
250
515
  return;
251
- const page = this.createPage(dims, pageNumber, sectionIndex, currentContent, pageInSection);
516
+ const page = this.createPage(dims, pageNumber, sectionIndex, currentContent, pageInSection, currentFootnoteIds, currentContinuation, currentPartialFootnotes.length > 0 ? currentPartialFootnotes : undefined);
252
517
  pages.push(page);
253
518
  pageNumber++;
254
519
  pageInSection++;
255
520
  currentContent = [];
256
521
  remainingHeight = dims.contentHeight;
257
522
  prevMarginBottomPt = 0; // Reset margin tracking for new page
523
+ currentFootnoteIds = []; // Reset footnotes for new page
524
+ currentPartialFootnotes = []; // Reset partial footnotes for new page
525
+ // Carry over continuation to next page
526
+ currentContinuation = nextPageContinuation;
527
+ nextPageContinuation = null;
528
+ // Account for continuation height on new page
529
+ if (currentContinuation && currentContinuation.remainingElements.length > 0) {
530
+ currentFootnoteHeight = this.measureContinuationHeight(currentContinuation, dims.contentWidth);
531
+ }
532
+ else {
533
+ currentFootnoteHeight = 0;
534
+ }
258
535
  };
259
536
  for (let i = 0; i < blocks.length; i++) {
260
537
  const block = blocks[i];
@@ -268,6 +545,19 @@ export class PaginationEngine {
268
545
  if (block.pageBreakBefore && currentContent.length > 0) {
269
546
  finishPage();
270
547
  }
548
+ // Extract footnote references from this block
549
+ const blockFootnoteIds = this.extractFootnoteRefs(block.element);
550
+ // Only count new footnotes (not already on this page)
551
+ const newFootnoteIds = blockFootnoteIds.filter(id => !currentFootnoteIds.includes(id));
552
+ // Calculate additional footnote height if this block is added
553
+ let additionalFootnoteHeight = 0;
554
+ if (newFootnoteIds.length > 0 && this.footnoteRegistry.size > 0) {
555
+ // Measure the combined height of all footnotes that would be on this page
556
+ // (including any continuation)
557
+ const combinedFootnoteIds = [...currentFootnoteIds, ...newFootnoteIds];
558
+ const totalFootnoteHeight = this.measureFootnotesHeight(combinedFootnoteIds, dims.contentWidth, currentContinuation);
559
+ additionalFootnoteHeight = totalFootnoteHeight - currentFootnoteHeight;
560
+ }
271
561
  // Calculate the effective height this block will consume
272
562
  // Account for margin collapsing: the gap between blocks is max(prevBottom, currTop), not sum
273
563
  const isFirstOnPage = currentContent.length === 0;
@@ -276,32 +566,117 @@ export class PaginationEngine {
276
566
  // Margin collapsing: use the larger of the two adjacent margins
277
567
  effectiveMarginTop = Math.max(block.marginTopPt, prevMarginBottomPt) - prevMarginBottomPt;
278
568
  }
279
- // Total height = top margin gap + content + bottom margin
280
- // But we only count bottom margin if it's the last block (otherwise it collapses with next)
281
- const blockSpace = effectiveMarginTop + block.heightPt + block.marginBottomPt;
569
+ // Total height = top margin gap + content + bottom margin + footnote space
570
+ const blockSpace = effectiveMarginTop + block.heightPt + block.marginBottomPt + additionalFootnoteHeight;
282
571
  // Calculate needed height (including keepWithNext)
283
572
  let neededHeight = blockSpace;
284
573
  if (block.keepWithNext && nextBlock && !nextBlock.isPageBreak) {
285
574
  // For keepWithNext, include the next block with collapsed margins
286
575
  const collapsedMargin = Math.max(block.marginBottomPt, nextBlock.marginTopPt);
287
576
  neededHeight = effectiveMarginTop + block.heightPt + collapsedMargin +
288
- nextBlock.heightPt + nextBlock.marginBottomPt;
577
+ nextBlock.heightPt + nextBlock.marginBottomPt + additionalFootnoteHeight;
289
578
  }
290
- // Check if block fits on current page
291
- if (blockSpace <= remainingHeight) {
579
+ // Effective remaining height (content area minus footnotes already on page)
580
+ const effectiveRemainingHeight = remainingHeight - currentFootnoteHeight;
581
+ // Check if block fits on current page (including its footnotes)
582
+ if (blockSpace <= effectiveRemainingHeight) {
292
583
  // Block fits
293
584
  currentContent.push(block.element.cloneNode(true));
294
- remainingHeight -= blockSpace;
585
+ remainingHeight -= (effectiveMarginTop + block.heightPt + block.marginBottomPt);
295
586
  prevMarginBottomPt = block.marginBottomPt;
587
+ // Add new footnotes to current page
588
+ if (newFootnoteIds.length > 0) {
589
+ currentFootnoteIds.push(...newFootnoteIds);
590
+ currentFootnoteHeight += additionalFootnoteHeight;
591
+ }
296
592
  }
297
593
  else if (block.heightPt + block.marginTopPt + block.marginBottomPt <= dims.contentHeight) {
298
- // Block doesn't fit but will fit on a new page
299
- finishPage();
300
- // On new page, include full top margin
301
- const newPageSpace = block.marginTopPt + block.heightPt + block.marginBottomPt;
302
- currentContent.push(block.element.cloneNode(true));
303
- remainingHeight = dims.contentHeight - newPageSpace;
304
- prevMarginBottomPt = block.marginBottomPt;
594
+ // Block doesn't fit but will fit on a new page (even with footnotes)
595
+ // Check if we need to split any footnotes on the current page first
596
+ // Try to fit the block with partial footnotes using footnote continuation
597
+ const blockSpaceWithoutFootnotes = effectiveMarginTop + block.heightPt + block.marginBottomPt;
598
+ if (newFootnoteIds.length > 0 && blockSpaceWithoutFootnotes <= effectiveRemainingHeight) {
599
+ // Block itself fits, but footnotes don't - try footnote continuation
600
+ currentContent.push(block.element.cloneNode(true));
601
+ remainingHeight -= (effectiveMarginTop + block.heightPt + block.marginBottomPt);
602
+ prevMarginBottomPt = block.marginBottomPt;
603
+ // Calculate space available for footnotes
604
+ const spaceForFootnotes = remainingHeight - currentFootnoteHeight;
605
+ // Try to fit as much of each new footnote as possible
606
+ for (const footnoteId of newFootnoteIds) {
607
+ const footnote = this.footnoteRegistry.get(footnoteId);
608
+ if (!footnote)
609
+ continue;
610
+ const footnoteHeight = this.measureSingleFootnoteHeight(footnoteId, dims.contentWidth);
611
+ if (footnoteHeight <= spaceForFootnotes - currentFootnoteHeight) {
612
+ // Whole footnote fits
613
+ currentFootnoteIds.push(footnoteId);
614
+ currentFootnoteHeight += footnoteHeight;
615
+ }
616
+ else {
617
+ // Footnote needs to be split - try to fit part of it
618
+ const availableForThisFootnote = spaceForFootnotes;
619
+ if (availableForThisFootnote > 20) { // Minimum space to start a footnote (roughly 1 line + separator)
620
+ const { fits, overflow } = this.splitFootnoteToFit(footnote, availableForThisFootnote, dims.contentWidth);
621
+ if (fits.length > 0) {
622
+ // Add partial footnote to current page
623
+ currentFootnoteIds.push(footnoteId);
624
+ // Track this as a partial footnote so we only render the fitting part
625
+ currentPartialFootnotes.push({
626
+ footnoteId,
627
+ fittingElements: fits
628
+ });
629
+ // Store overflow for next page
630
+ nextPageContinuation = {
631
+ footnoteId,
632
+ remainingElements: overflow
633
+ };
634
+ // Update height (approximate - we've added some content)
635
+ currentFootnoteHeight = spaceForFootnotes;
636
+ }
637
+ else {
638
+ // Nothing fits, entire footnote continues to next page
639
+ nextPageContinuation = {
640
+ footnoteId,
641
+ remainingElements: Array.from(footnote.querySelectorAll(".footnote-content > *"))
642
+ .map(el => el.cloneNode(true))
643
+ };
644
+ // If no content elements found, use the whole footnote
645
+ if (nextPageContinuation.remainingElements.length === 0) {
646
+ nextPageContinuation.remainingElements = [footnote.cloneNode(true)];
647
+ }
648
+ }
649
+ }
650
+ else {
651
+ // Not enough space to start footnote - continue whole thing
652
+ nextPageContinuation = {
653
+ footnoteId,
654
+ remainingElements: Array.from(footnote.querySelectorAll(".footnote-content > *"))
655
+ .map(el => el.cloneNode(true))
656
+ };
657
+ if (nextPageContinuation.remainingElements.length === 0) {
658
+ nextPageContinuation.remainingElements = [footnote.cloneNode(true)];
659
+ }
660
+ }
661
+ }
662
+ }
663
+ }
664
+ else {
665
+ // Block itself doesn't fit - start new page
666
+ finishPage();
667
+ // On new page, recalculate footnote height for just this block's footnotes
668
+ // (plus any continuation from previous page)
669
+ const newPageFootnoteHeight = blockFootnoteIds.length > 0
670
+ ? this.measureFootnotesHeight(blockFootnoteIds, dims.contentWidth, currentContinuation)
671
+ : (currentContinuation ? this.measureContinuationHeight(currentContinuation, dims.contentWidth) : 0);
672
+ // Include full top margin
673
+ const newPageSpace = block.marginTopPt + block.heightPt + block.marginBottomPt;
674
+ currentContent.push(block.element.cloneNode(true));
675
+ remainingHeight = dims.contentHeight - newPageSpace;
676
+ prevMarginBottomPt = block.marginBottomPt;
677
+ currentFootnoteIds = [...blockFootnoteIds];
678
+ currentFootnoteHeight = newPageFootnoteHeight;
679
+ }
305
680
  }
306
681
  else {
307
682
  // Block is taller than a page - add it and let it overflow
@@ -310,17 +685,20 @@ export class PaginationEngine {
310
685
  finishPage();
311
686
  }
312
687
  currentContent.push(block.element.cloneNode(true));
688
+ currentFootnoteIds = [...blockFootnoteIds];
313
689
  finishPage();
314
690
  }
315
691
  }
316
692
  // Finish last page
317
693
  finishPage();
694
+ // Store any remaining continuation for next section
695
+ this.pendingFootnoteContinuation = nextPageContinuation;
318
696
  return pages;
319
697
  }
320
698
  /**
321
699
  * Creates a page container element.
322
700
  */
323
- createPage(dims, pageNumber, sectionIndex, content, pageInSection) {
701
+ createPage(dims, pageNumber, sectionIndex, content, pageInSection, footnoteIds = [], continuation, partialFootnotes) {
324
702
  // Create page box at full size, then scale the entire box
325
703
  // This ensures proper clipping and consistent scaling of all elements
326
704
  const pageBox = document.createElement("div");
@@ -359,10 +737,16 @@ export class PaginationEngine {
359
737
  const headerDiv = document.createElement("div");
360
738
  headerDiv.className = `${this.cssPrefix}header`;
361
739
  headerDiv.style.position = "absolute";
362
- headerDiv.style.top = `${dims.headerHeight}pt`;
740
+ headerDiv.style.top = "0"; // Start at page top
363
741
  headerDiv.style.left = `${dims.marginLeft}pt`;
364
742
  headerDiv.style.width = `${dims.contentWidth}pt`;
743
+ headerDiv.style.height = `${dims.marginTop}pt`; // Constrain to top margin area
365
744
  headerDiv.style.overflow = "hidden";
745
+ headerDiv.style.boxSizing = "border-box";
746
+ headerDiv.style.display = "flex";
747
+ headerDiv.style.flexDirection = "column";
748
+ headerDiv.style.justifyContent = "flex-end"; // Align content to bottom of header area
749
+ headerDiv.style.paddingBottom = "4pt"; // Small gap before content area
366
750
  // Clone the header content (skip the wrapper div's data attributes)
367
751
  for (const child of Array.from(headerSource.childNodes)) {
368
752
  headerDiv.appendChild(child.cloneNode(true));
@@ -383,16 +767,27 @@ export class PaginationEngine {
383
767
  contentArea.appendChild(el);
384
768
  }
385
769
  pageBox.appendChild(contentArea);
770
+ // Add footnotes if any references appear on this page (or continuation from previous)
771
+ const hasContinuation = continuation && continuation.remainingElements.length > 0;
772
+ if (footnoteIds.length > 0 || hasContinuation) {
773
+ this.addPageFootnotes(pageBox, footnoteIds, dims, continuation, partialFootnotes);
774
+ }
386
775
  // Add footer if available for this section/page
387
776
  const footerSource = this.selectFooter(sectionIndex, pageInSection, pageNumber);
388
777
  if (footerSource) {
389
778
  const footerDiv = document.createElement("div");
390
779
  footerDiv.className = `${this.cssPrefix}footer`;
391
780
  footerDiv.style.position = "absolute";
392
- footerDiv.style.bottom = `${dims.footerHeight}pt`;
781
+ footerDiv.style.bottom = "0"; // Start at page bottom
393
782
  footerDiv.style.left = `${dims.marginLeft}pt`;
394
783
  footerDiv.style.width = `${dims.contentWidth}pt`;
784
+ footerDiv.style.height = `${dims.marginBottom}pt`; // Constrain to bottom margin area
395
785
  footerDiv.style.overflow = "hidden";
786
+ footerDiv.style.boxSizing = "border-box";
787
+ footerDiv.style.display = "flex";
788
+ footerDiv.style.flexDirection = "column";
789
+ footerDiv.style.justifyContent = "flex-start"; // Align content to top of footer area
790
+ footerDiv.style.paddingTop = "4pt"; // Small gap after content area
396
791
  // Clone the footer content (skip the wrapper div's data attributes)
397
792
  for (const child of Array.from(footerSource.childNodes)) {
398
793
  footerDiv.appendChild(child.cloneNode(true));
@@ -1 +1 @@
1
- {"version":3,"file":"pagination.js","sourceRoot":"","sources":["../src/pagination.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AA+GH,yDAAyD;AACzD,MAAM,kBAAkB,GAAG,GAAG,CAAC;AAC/B,MAAM,mBAAmB,GAAG,GAAG,CAAC;AAChC,MAAM,cAAc,GAAG,EAAE,CAAC,CAAC,SAAS;AAEpC;;GAEG;AACH,SAAS,MAAM,CAAC,EAAU;IACxB,OAAO,EAAE,GAAG,IAAI,CAAC,CAAC,wBAAwB;AAC5C,CAAC;AAED;;GAEG;AACH,SAAS,MAAM,CAAC,EAAU;IACxB,OAAO,EAAE,GAAG,IAAI,CAAC;AACnB,CAAC;AAED,4CAA4C;AAC5C,MAAM,4BAA4B,GAAG,EAAE,CAAC;AAExC;;GAEG;AACH,SAAS,eAAe,CAAC,OAAoB;IAC3C,MAAM,SAAS,GAAG,UAAU,CAAC,OAAO,CAAC,OAAO,CAAC,SAAS,IAAI,EAAE,CAAC,IAAI,kBAAkB,CAAC;IACpF,MAAM,UAAU,GAAG,UAAU,CAAC,OAAO,CAAC,OAAO,CAAC,UAAU,IAAI,EAAE,CAAC,IAAI,mBAAmB,CAAC;IACvF,MAAM,YAAY,GAAG,UAAU,CAAC,OAAO,CAAC,OAAO,CAAC,YAAY,IAAI,EAAE,CAAC,IAAI,SAAS,GAAG,CAAC,GAAG,cAAc,CAAC;IACtG,MAAM,aAAa,GAAG,UAAU,CAAC,OAAO,CAAC,OAAO,CAAC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5
  "jsModuleNative": {
6
6
  "dotnet.native.js": "sha256-YLwjs9CPwrZG7YKULjmqr5bYsmhxwcWJOhQNM4bG6Gc="
7
7
  },
@@ -17,8 +17,8 @@
17
17
  "assembly": {
18
18
  "DocumentFormat.OpenXml.wasm": "sha256-edAN2rIA7QQ8K5qp1o5QXplt8M80fEiVmuMgT/MBmLM=",
19
19
  "DocumentFormat.OpenXml.Framework.wasm": "sha256-CFdrD1dSpnkcOk0gxZcKb2T5p+q2ck9ivs+TOML6Jmw=",
20
- "Docxodus.wasm": "sha256-uylIIIcg4ekUgL7C/3g6bKR4lg4r49+fNrjl+DmzuAc=",
21
- "DocxodusWasm.wasm": "sha256-4FjLhdIdAKhqWxpDRlVPl8p0sU08Y/e7H8kbXZSIWyM=",
20
+ "Docxodus.wasm": "sha256-OvZl/9HSRpL+1JEJwO0mgaE0j65ablClKKCv9Jd7QoY=",
21
+ "DocxodusWasm.wasm": "sha256-Z25cMxmJXbqKUF/HAmC1MgLELIeCNbdSFxOZc2gIRNs=",
22
22
  "SkiaSharp.wasm": "sha256-U6RbqUVBn8Vx8qpghJC5+r/DC1NSBY+EIRDxP8o6dsk=",
23
23
  "System.Collections.Concurrent.wasm": "sha256-xXJbJWNeQ2DSYvAGUoUHjF9y4Iajv2ed0eACOxWD19U=",
24
24
  "System.Collections.wasm": "sha256-mNLhFaXT8X16KYjUVNFYwcdw0h3BUjgD427TR5IWVKU=",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "docxodus",
3
- "version": "3.7.1",
3
+ "version": "3.8.1",
4
4
  "description": "DOCX document comparison and HTML conversion in the browser using WebAssembly",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",