@particle-academy/last-word-ui 0.4.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -156,6 +156,8 @@ interface ChartBlock {
156
156
  }
157
157
  interface PageBreakBlock {
158
158
  type: "pageBreak";
159
+ /** Change the page from here on: see `docStretches()`. */
160
+ page?: Page;
159
161
  }
160
162
  interface HrBlock {
161
163
  type: "hr";
@@ -225,9 +227,14 @@ interface Doc {
225
227
  interface DocViewerLayout {
226
228
  /** Number of pages the document laid out to. */
227
229
  pages: number;
228
- /** Page size in points, orientation applied. */
230
+ /** The first page's size in points, orientation applied. */
229
231
  pageWidth: number;
230
232
  pageHeight: number;
233
+ /** Every page's size, when the document's page changes partway. */
234
+ pageSizes?: Array<{
235
+ width: number;
236
+ height: number;
237
+ }>;
231
238
  /** The scale the pages are drawn at. */
232
239
  scale: number;
233
240
  /**
@@ -240,7 +247,7 @@ interface DocViewerLayout {
240
247
  font: ViewerFont;
241
248
  /**
242
249
  * JSON Pointers to page layout the document asks for and this viewer does not
243
- * show (`pageBreak.page`, page keys straight on a break, a top-level `sections`).
250
+ * show (`page` on a nested break, page keys straight on a break, a top-level `sections`).
244
251
  * Absent when there is none. The visible notice says the same thing.
245
252
  */
246
253
  notShown?: string[];
@@ -296,6 +303,8 @@ interface DocViewerProps {
296
303
  * document order); each footnote `data-footnote`; bands `data-lw-band`, with
297
304
  * `data-lw-band-variant` naming the one drawn (`default`, `first`, `even`);
298
305
  * `data-lw-layout-notice` when the document asks for page layout it does not show.
306
+ * A `pageBreak` carrying `page` changes the page from there on, each page drawn and
307
+ * its text measured at its own size.
299
308
  *
300
309
  * Header and footer text takes field tokens -- `{page}`, `{pages}`,
301
310
  * `{section}`, `{sectionpages}`, `{author}`, `{title}`, `{filename}`, `{date}`,
@@ -338,16 +347,18 @@ declare function carlitoFaces(doc: Doc): string[];
338
347
  declare function docFromReader(output: unknown): Doc;
339
348
 
340
349
  /**
341
- * What the viewer says when a document asks for more than one page setup. It draws
342
- * one until per-page geometry lands; drawing nothing, or drawing it wrong in
343
- * silence, are the two worse answers. The same words as fancy-docs.
350
+ * What the viewer says when a document asks for page settings in a form it does not
351
+ * honour. A `page` on a top-level break is drawn; what is left here is what the writers
352
+ * refuse too. Drawing nothing, or drawing it wrong in silence, are the two worse answers.
353
+ * The same words as fancy-docs.
344
354
  */
345
- declare const LAYOUT_NOTICE = "Mixed page orientation isn't shown yet. This document asks for different page settings partway through; every page here uses the document's one page setup.";
355
+ declare const LAYOUT_NOTICE = "Some page settings in this document aren't shown. It sets them somewhere they don't apply: on a page break directly, in a quote or a table cell, or under a sections key.";
346
356
  /**
347
- * JSON Pointers to what this viewer ignores about page layout: `pageBreak.page`,
348
- * the near-miss keys on a break and a top-level `sections`, at any depth. Empty for
349
- * a document with one page setup. The Doc arrives as JSON from any writer, so
350
- * nothing here trusts its shape. A walk, not a recursion: the nesting is the file's.
357
+ * JSON Pointers to what this viewer ignores about page layout: `page` on a nested
358
+ * break or one that is not an object, a background on a break, the near-miss keys on a
359
+ * break and a top-level `sections`, at any depth. The Doc arrives as JSON from any
360
+ * writer, so nothing here trusts its shape. A walk, not a recursion: the nesting is
361
+ * the file's.
351
362
  */
352
363
  declare function unshownLayout(doc: Doc): string[];
353
364
 
@@ -405,6 +416,12 @@ interface TableItem {
405
416
  }
406
417
  interface BreakItem {
407
418
  type: "break";
419
+ /**
420
+ * This break starts a run of pages of another shape, and these are its heights.
421
+ * `firstPageHeight` is its first page when that page is odd and
422
+ * `firstEvenPageHeight` when even: the pages before it decide which.
423
+ */
424
+ stretch?: Pick<PackOptions, "pageHeight" | "firstPageHeight" | "firstEvenPageHeight" | "evenPageHeight">;
408
425
  }
409
426
  type PackItem = BlockItem | TableItem | BreakItem;
410
427
  interface PackOptions {
@@ -423,6 +440,12 @@ interface PackOptions {
423
440
  * `pageHeight` when absent. Page 1 is odd, so it never takes this.
424
441
  */
425
442
  evenPageHeight?: number;
443
+ /**
444
+ * The body height of a stretch's first page when that page is even. Page 1 is
445
+ * odd, so the first stretch never takes it. `firstPageHeight` does not stand in:
446
+ * absent, the page is an ordinary even page.
447
+ */
448
+ firstEvenPageHeight?: number;
426
449
  /**
427
450
  * Height of the separator rule above a page's footnotes, reserved once on
428
451
  * any page that holds at least one note. 0 when absent.
@@ -462,15 +485,18 @@ interface PageLayout {
462
485
  used: number;
463
486
  /** The body height this page had to fill (`pageCapacity()` for its index). */
464
487
  capacity: number;
488
+ /** Which stretch it is in, 0-based. Absent in the first. */
489
+ stretch?: number;
465
490
  }
466
491
  /**
467
- * The body height of the page at 0-based `index`: page 1 takes
468
- * `firstPageHeight`, even pages (odd indices) `evenPageHeight`, the rest
469
- * `pageHeight`. A variant that is absent, non-finite or not positive falls
470
- * back to `pageHeight`. At least 1, so a page always makes progress.
492
+ * The body height of the page at 0-based `index`, in a stretch whose first page is at
493
+ * `start`: that first page takes `firstPageHeight` (`firstEvenPageHeight` on an even
494
+ * page), even pages (odd indices) `evenPageHeight`, the rest `pageHeight`. A variant
495
+ * that is absent, non-finite or not positive falls back. At least 1, so a page always
496
+ * makes progress.
471
497
  */
472
- declare function pageCapacity(options: PackOptions, index: number): number;
473
- declare function paginate(items: PackItem[], options: PackOptions): PageLayout[];
498
+ declare function pageCapacity(options: PackOptions, index: number, start?: number): number;
499
+ declare function paginate(items: PackItem[], initial: PackOptions): PageLayout[];
474
500
 
475
501
  /**
476
502
  * Paper sizes in points, portrait. A4 is 11906 x 16838 twips, which is what
@@ -552,19 +578,25 @@ declare function bodyBox(g: PageGeometry, headerHeight: number, footerHeight: nu
552
578
  type BandKind = "header" | "footer";
553
579
  /** Which of a kind's bands applies: the default, the first-page or the even-page one. */
554
580
  type BandSlot = "default" | "first" | "even";
555
- /** Page 1, an even page, or an odd page after the first. */
556
- type PageClass = "first" | "even" | "odd";
581
+ /**
582
+ * Page 1 or a stretch's first page, an even page, or an odd page after the first.
583
+ * `firstEven` is a stretch's first page on an even number: its first band when it has
584
+ * one, else its even band, per kind.
585
+ */
586
+ type PageClass = "first" | "even" | "odd" | "firstEven";
557
587
  /** Measured band heights per kind and slot, in any one unit; 0 when absent or blank. */
558
588
  type BandHeights = Record<BandKind, Record<BandSlot, number>>;
559
589
  /** The class of the page at 0-based `index`. */
560
590
  declare function pageClass(index: number): PageClass;
591
+ /** The class of the page at 0-based `index`, in a stretch whose first page is at `start`. */
592
+ declare function pageClassIn(index: number, start: number): PageClass;
561
593
  /** The slot a page class draws for one kind: its variant when that is set, else the default. */
562
594
  declare function bandSlot(page: Page | undefined, kind: BandKind, cls: PageClass): BandSlot;
563
595
  /**
564
596
  * The band the page at 0-based `index` draws for `kind`, or null when it
565
597
  * draws none (no band, or a blank variant).
566
598
  */
567
- declare function pageBand(page: Page | undefined, kind: BandKind, index: number): Band | BlocksBand | null;
599
+ declare function pageBand(page: Page | undefined, kind: BandKind, index: number, start?: number): Band | BlocksBand | null;
568
600
  /**
569
601
  * The body box of each page class from the measured band heights (points):
570
602
  * each class uses the header and footer it actually draws, so a tall
@@ -572,6 +604,39 @@ declare function pageBand(page: Page | undefined, kind: BandKind, index: number)
572
604
  */
573
605
  declare function pageBodyBoxes(g: PageGeometry, page: Page | undefined, heights: BandHeights): Record<PageClass, BodyBox>;
574
606
 
607
+ /**
608
+ * A document's runs of pages of one setup: what is before the first `pageBreak`
609
+ * carrying a `page`, then what follows each one. Word calls each a section. A plain
610
+ * break, or one nested in a quote or a table cell, starts no stretch. The same reading
611
+ * as last-word and fine-print's `Schema::stretches()`.
612
+ */
613
+ interface Stretch {
614
+ /** The page as this stretch sees it: margins merged, every other key replaced whole. */
615
+ page: Page | undefined;
616
+ geometry: PageGeometry;
617
+ /** Index of the break that starts it; null for the first. */
618
+ breakAt: number | null;
619
+ }
620
+ declare function docStretches(doc: Doc): Stretch[];
621
+ /** Which stretch each top-level block is in. A break carrying `page` opens the one after it. */
622
+ declare function blockStretches(stretches: Stretch[], count: number): number[];
623
+ interface PackInput {
624
+ items: PackItem[];
625
+ options: PackOptions;
626
+ /** The body box of each page class, per stretch. */
627
+ boxes: Record<PageClass, BodyBox>[];
628
+ }
629
+ /**
630
+ * What the packer is given: the first stretch's heights as its options, and each later
631
+ * stretch's on the break that starts it, because which page class its first page falls
632
+ * in depends on how many pages the stretches before it took.
633
+ */
634
+ declare function packInput(stretches: Stretch[], measured: {
635
+ items: PackItem[];
636
+ stretchBands: BandHeights[];
637
+ footnoteSeparator: number;
638
+ }): PackInput;
639
+
575
640
  /**
576
641
  * The live values a header or footer's field tokens take on one page.
577
642
  *
@@ -583,12 +648,9 @@ interface PageFields {
583
648
  /** 1-based. */
584
649
  page: number;
585
650
  pages: number;
586
- /**
587
- * `{section}`. A last-word Doc is ONE section, so this is 1 unless a caller
588
- * says otherwise.
589
- */
651
+ /** `{section}`: which stretch the page is in, 1-based, as Word's SECTION. 1 when absent. */
590
652
  section?: number;
591
- /** `{sectionpages}`. The Doc is one section, so the page total when absent. */
653
+ /** `{sectionpages}`: the pages of that stretch, as Word's SECTIONPAGES. The page total when absent. */
592
654
  sectionPages?: number;
593
655
  /** `{author}`: `doc.meta.author`. Empty when absent. */
594
656
  author?: string;
@@ -642,4 +704,4 @@ interface FootnoteNumbering {
642
704
  */
643
705
  declare function numberFootnotes(doc: Doc): FootnoteNumbering;
644
706
 
645
- export { type Align, type Band, type BandHeights, type BandKind, type BandSlot, type Block, type BlockFragment, type BlockItem, type BlocksBand, type BodyBox, type Border, type BorderStyle, type BoxBorders, type BoxSides, type BreakItem, CARLITO_FACES, CARLITO_FAMILY, type ChartBlock, type CodeBlock, type Doc, type DocMeta, DocViewer, type DocViewerLayout, type DocViewerProps, FONT_LOAD_TIMEOUT_MS, type Footnote, type FootnoteMark, type FootnoteNumbering, type Fragment, type HeadingBlock, type HrBlock, type ImageBlock, LAYOUT_NOTICE, type ListBlock, type ListItem, type Orientation, PAGE_BAND_DISTANCE_DEFAULT, PAGE_MARGIN_DEFAULT, PAGE_SIZES_PT, PX_PER_PT, type PackItem, type PackOptions, type Page, type PageBreakBlock, type PageClass, type PageFields, type PageGeometry, type PageLayout, type PageMargins, type PageSize, type ParagraphBlock, type ParagraphProps, type QuoteBlock, type ResolvedMargins, type Run, type TableBlock, type TableBorders, type TableCell, type TableFragment, type TableItem, type TableRow, type TableRowItem, type VAlign, type ViewerFont, bandSlot, bodyBox, carlitoFaces, docFromReader, fontFaceCss, formatDatePicture, numberFootnotes, pageBand, pageBodyBoxes, pageCapacity, pageClass, pageGeometry, pageMargins, paginate, resolveNow, substituteFields, unshownLayout };
707
+ export { type Align, type Band, type BandHeights, type BandKind, type BandSlot, type Block, type BlockFragment, type BlockItem, type BlocksBand, type BodyBox, type Border, type BorderStyle, type BoxBorders, type BoxSides, type BreakItem, CARLITO_FACES, CARLITO_FAMILY, type ChartBlock, type CodeBlock, type Doc, type DocMeta, DocViewer, type DocViewerLayout, type DocViewerProps, FONT_LOAD_TIMEOUT_MS, type Footnote, type FootnoteMark, type FootnoteNumbering, type Fragment, type HeadingBlock, type HrBlock, type ImageBlock, LAYOUT_NOTICE, type ListBlock, type ListItem, type Orientation, PAGE_BAND_DISTANCE_DEFAULT, PAGE_MARGIN_DEFAULT, PAGE_SIZES_PT, PX_PER_PT, type PackInput, type PackItem, type PackOptions, type Page, type PageBreakBlock, type PageClass, type PageFields, type PageGeometry, type PageLayout, type PageMargins, type PageSize, type ParagraphBlock, type ParagraphProps, type QuoteBlock, type ResolvedMargins, type Run, type Stretch, type TableBlock, type TableBorders, type TableCell, type TableFragment, type TableItem, type TableRow, type TableRowItem, type VAlign, type ViewerFont, bandSlot, blockStretches, bodyBox, carlitoFaces, docFromReader, docStretches, fontFaceCss, formatDatePicture, numberFootnotes, packInput, pageBand, pageBodyBoxes, pageCapacity, pageClass, pageClassIn, pageGeometry, pageMargins, paginate, resolveNow, substituteFields, unshownLayout };
package/dist/index.d.ts CHANGED
@@ -156,6 +156,8 @@ interface ChartBlock {
156
156
  }
157
157
  interface PageBreakBlock {
158
158
  type: "pageBreak";
159
+ /** Change the page from here on: see `docStretches()`. */
160
+ page?: Page;
159
161
  }
160
162
  interface HrBlock {
161
163
  type: "hr";
@@ -225,9 +227,14 @@ interface Doc {
225
227
  interface DocViewerLayout {
226
228
  /** Number of pages the document laid out to. */
227
229
  pages: number;
228
- /** Page size in points, orientation applied. */
230
+ /** The first page's size in points, orientation applied. */
229
231
  pageWidth: number;
230
232
  pageHeight: number;
233
+ /** Every page's size, when the document's page changes partway. */
234
+ pageSizes?: Array<{
235
+ width: number;
236
+ height: number;
237
+ }>;
231
238
  /** The scale the pages are drawn at. */
232
239
  scale: number;
233
240
  /**
@@ -240,7 +247,7 @@ interface DocViewerLayout {
240
247
  font: ViewerFont;
241
248
  /**
242
249
  * JSON Pointers to page layout the document asks for and this viewer does not
243
- * show (`pageBreak.page`, page keys straight on a break, a top-level `sections`).
250
+ * show (`page` on a nested break, page keys straight on a break, a top-level `sections`).
244
251
  * Absent when there is none. The visible notice says the same thing.
245
252
  */
246
253
  notShown?: string[];
@@ -296,6 +303,8 @@ interface DocViewerProps {
296
303
  * document order); each footnote `data-footnote`; bands `data-lw-band`, with
297
304
  * `data-lw-band-variant` naming the one drawn (`default`, `first`, `even`);
298
305
  * `data-lw-layout-notice` when the document asks for page layout it does not show.
306
+ * A `pageBreak` carrying `page` changes the page from there on, each page drawn and
307
+ * its text measured at its own size.
299
308
  *
300
309
  * Header and footer text takes field tokens -- `{page}`, `{pages}`,
301
310
  * `{section}`, `{sectionpages}`, `{author}`, `{title}`, `{filename}`, `{date}`,
@@ -338,16 +347,18 @@ declare function carlitoFaces(doc: Doc): string[];
338
347
  declare function docFromReader(output: unknown): Doc;
339
348
 
340
349
  /**
341
- * What the viewer says when a document asks for more than one page setup. It draws
342
- * one until per-page geometry lands; drawing nothing, or drawing it wrong in
343
- * silence, are the two worse answers. The same words as fancy-docs.
350
+ * What the viewer says when a document asks for page settings in a form it does not
351
+ * honour. A `page` on a top-level break is drawn; what is left here is what the writers
352
+ * refuse too. Drawing nothing, or drawing it wrong in silence, are the two worse answers.
353
+ * The same words as fancy-docs.
344
354
  */
345
- declare const LAYOUT_NOTICE = "Mixed page orientation isn't shown yet. This document asks for different page settings partway through; every page here uses the document's one page setup.";
355
+ declare const LAYOUT_NOTICE = "Some page settings in this document aren't shown. It sets them somewhere they don't apply: on a page break directly, in a quote or a table cell, or under a sections key.";
346
356
  /**
347
- * JSON Pointers to what this viewer ignores about page layout: `pageBreak.page`,
348
- * the near-miss keys on a break and a top-level `sections`, at any depth. Empty for
349
- * a document with one page setup. The Doc arrives as JSON from any writer, so
350
- * nothing here trusts its shape. A walk, not a recursion: the nesting is the file's.
357
+ * JSON Pointers to what this viewer ignores about page layout: `page` on a nested
358
+ * break or one that is not an object, a background on a break, the near-miss keys on a
359
+ * break and a top-level `sections`, at any depth. The Doc arrives as JSON from any
360
+ * writer, so nothing here trusts its shape. A walk, not a recursion: the nesting is
361
+ * the file's.
351
362
  */
352
363
  declare function unshownLayout(doc: Doc): string[];
353
364
 
@@ -405,6 +416,12 @@ interface TableItem {
405
416
  }
406
417
  interface BreakItem {
407
418
  type: "break";
419
+ /**
420
+ * This break starts a run of pages of another shape, and these are its heights.
421
+ * `firstPageHeight` is its first page when that page is odd and
422
+ * `firstEvenPageHeight` when even: the pages before it decide which.
423
+ */
424
+ stretch?: Pick<PackOptions, "pageHeight" | "firstPageHeight" | "firstEvenPageHeight" | "evenPageHeight">;
408
425
  }
409
426
  type PackItem = BlockItem | TableItem | BreakItem;
410
427
  interface PackOptions {
@@ -423,6 +440,12 @@ interface PackOptions {
423
440
  * `pageHeight` when absent. Page 1 is odd, so it never takes this.
424
441
  */
425
442
  evenPageHeight?: number;
443
+ /**
444
+ * The body height of a stretch's first page when that page is even. Page 1 is
445
+ * odd, so the first stretch never takes it. `firstPageHeight` does not stand in:
446
+ * absent, the page is an ordinary even page.
447
+ */
448
+ firstEvenPageHeight?: number;
426
449
  /**
427
450
  * Height of the separator rule above a page's footnotes, reserved once on
428
451
  * any page that holds at least one note. 0 when absent.
@@ -462,15 +485,18 @@ interface PageLayout {
462
485
  used: number;
463
486
  /** The body height this page had to fill (`pageCapacity()` for its index). */
464
487
  capacity: number;
488
+ /** Which stretch it is in, 0-based. Absent in the first. */
489
+ stretch?: number;
465
490
  }
466
491
  /**
467
- * The body height of the page at 0-based `index`: page 1 takes
468
- * `firstPageHeight`, even pages (odd indices) `evenPageHeight`, the rest
469
- * `pageHeight`. A variant that is absent, non-finite or not positive falls
470
- * back to `pageHeight`. At least 1, so a page always makes progress.
492
+ * The body height of the page at 0-based `index`, in a stretch whose first page is at
493
+ * `start`: that first page takes `firstPageHeight` (`firstEvenPageHeight` on an even
494
+ * page), even pages (odd indices) `evenPageHeight`, the rest `pageHeight`. A variant
495
+ * that is absent, non-finite or not positive falls back. At least 1, so a page always
496
+ * makes progress.
471
497
  */
472
- declare function pageCapacity(options: PackOptions, index: number): number;
473
- declare function paginate(items: PackItem[], options: PackOptions): PageLayout[];
498
+ declare function pageCapacity(options: PackOptions, index: number, start?: number): number;
499
+ declare function paginate(items: PackItem[], initial: PackOptions): PageLayout[];
474
500
 
475
501
  /**
476
502
  * Paper sizes in points, portrait. A4 is 11906 x 16838 twips, which is what
@@ -552,19 +578,25 @@ declare function bodyBox(g: PageGeometry, headerHeight: number, footerHeight: nu
552
578
  type BandKind = "header" | "footer";
553
579
  /** Which of a kind's bands applies: the default, the first-page or the even-page one. */
554
580
  type BandSlot = "default" | "first" | "even";
555
- /** Page 1, an even page, or an odd page after the first. */
556
- type PageClass = "first" | "even" | "odd";
581
+ /**
582
+ * Page 1 or a stretch's first page, an even page, or an odd page after the first.
583
+ * `firstEven` is a stretch's first page on an even number: its first band when it has
584
+ * one, else its even band, per kind.
585
+ */
586
+ type PageClass = "first" | "even" | "odd" | "firstEven";
557
587
  /** Measured band heights per kind and slot, in any one unit; 0 when absent or blank. */
558
588
  type BandHeights = Record<BandKind, Record<BandSlot, number>>;
559
589
  /** The class of the page at 0-based `index`. */
560
590
  declare function pageClass(index: number): PageClass;
591
+ /** The class of the page at 0-based `index`, in a stretch whose first page is at `start`. */
592
+ declare function pageClassIn(index: number, start: number): PageClass;
561
593
  /** The slot a page class draws for one kind: its variant when that is set, else the default. */
562
594
  declare function bandSlot(page: Page | undefined, kind: BandKind, cls: PageClass): BandSlot;
563
595
  /**
564
596
  * The band the page at 0-based `index` draws for `kind`, or null when it
565
597
  * draws none (no band, or a blank variant).
566
598
  */
567
- declare function pageBand(page: Page | undefined, kind: BandKind, index: number): Band | BlocksBand | null;
599
+ declare function pageBand(page: Page | undefined, kind: BandKind, index: number, start?: number): Band | BlocksBand | null;
568
600
  /**
569
601
  * The body box of each page class from the measured band heights (points):
570
602
  * each class uses the header and footer it actually draws, so a tall
@@ -572,6 +604,39 @@ declare function pageBand(page: Page | undefined, kind: BandKind, index: number)
572
604
  */
573
605
  declare function pageBodyBoxes(g: PageGeometry, page: Page | undefined, heights: BandHeights): Record<PageClass, BodyBox>;
574
606
 
607
+ /**
608
+ * A document's runs of pages of one setup: what is before the first `pageBreak`
609
+ * carrying a `page`, then what follows each one. Word calls each a section. A plain
610
+ * break, or one nested in a quote or a table cell, starts no stretch. The same reading
611
+ * as last-word and fine-print's `Schema::stretches()`.
612
+ */
613
+ interface Stretch {
614
+ /** The page as this stretch sees it: margins merged, every other key replaced whole. */
615
+ page: Page | undefined;
616
+ geometry: PageGeometry;
617
+ /** Index of the break that starts it; null for the first. */
618
+ breakAt: number | null;
619
+ }
620
+ declare function docStretches(doc: Doc): Stretch[];
621
+ /** Which stretch each top-level block is in. A break carrying `page` opens the one after it. */
622
+ declare function blockStretches(stretches: Stretch[], count: number): number[];
623
+ interface PackInput {
624
+ items: PackItem[];
625
+ options: PackOptions;
626
+ /** The body box of each page class, per stretch. */
627
+ boxes: Record<PageClass, BodyBox>[];
628
+ }
629
+ /**
630
+ * What the packer is given: the first stretch's heights as its options, and each later
631
+ * stretch's on the break that starts it, because which page class its first page falls
632
+ * in depends on how many pages the stretches before it took.
633
+ */
634
+ declare function packInput(stretches: Stretch[], measured: {
635
+ items: PackItem[];
636
+ stretchBands: BandHeights[];
637
+ footnoteSeparator: number;
638
+ }): PackInput;
639
+
575
640
  /**
576
641
  * The live values a header or footer's field tokens take on one page.
577
642
  *
@@ -583,12 +648,9 @@ interface PageFields {
583
648
  /** 1-based. */
584
649
  page: number;
585
650
  pages: number;
586
- /**
587
- * `{section}`. A last-word Doc is ONE section, so this is 1 unless a caller
588
- * says otherwise.
589
- */
651
+ /** `{section}`: which stretch the page is in, 1-based, as Word's SECTION. 1 when absent. */
590
652
  section?: number;
591
- /** `{sectionpages}`. The Doc is one section, so the page total when absent. */
653
+ /** `{sectionpages}`: the pages of that stretch, as Word's SECTIONPAGES. The page total when absent. */
592
654
  sectionPages?: number;
593
655
  /** `{author}`: `doc.meta.author`. Empty when absent. */
594
656
  author?: string;
@@ -642,4 +704,4 @@ interface FootnoteNumbering {
642
704
  */
643
705
  declare function numberFootnotes(doc: Doc): FootnoteNumbering;
644
706
 
645
- export { type Align, type Band, type BandHeights, type BandKind, type BandSlot, type Block, type BlockFragment, type BlockItem, type BlocksBand, type BodyBox, type Border, type BorderStyle, type BoxBorders, type BoxSides, type BreakItem, CARLITO_FACES, CARLITO_FAMILY, type ChartBlock, type CodeBlock, type Doc, type DocMeta, DocViewer, type DocViewerLayout, type DocViewerProps, FONT_LOAD_TIMEOUT_MS, type Footnote, type FootnoteMark, type FootnoteNumbering, type Fragment, type HeadingBlock, type HrBlock, type ImageBlock, LAYOUT_NOTICE, type ListBlock, type ListItem, type Orientation, PAGE_BAND_DISTANCE_DEFAULT, PAGE_MARGIN_DEFAULT, PAGE_SIZES_PT, PX_PER_PT, type PackItem, type PackOptions, type Page, type PageBreakBlock, type PageClass, type PageFields, type PageGeometry, type PageLayout, type PageMargins, type PageSize, type ParagraphBlock, type ParagraphProps, type QuoteBlock, type ResolvedMargins, type Run, type TableBlock, type TableBorders, type TableCell, type TableFragment, type TableItem, type TableRow, type TableRowItem, type VAlign, type ViewerFont, bandSlot, bodyBox, carlitoFaces, docFromReader, fontFaceCss, formatDatePicture, numberFootnotes, pageBand, pageBodyBoxes, pageCapacity, pageClass, pageGeometry, pageMargins, paginate, resolveNow, substituteFields, unshownLayout };
707
+ export { type Align, type Band, type BandHeights, type BandKind, type BandSlot, type Block, type BlockFragment, type BlockItem, type BlocksBand, type BodyBox, type Border, type BorderStyle, type BoxBorders, type BoxSides, type BreakItem, CARLITO_FACES, CARLITO_FAMILY, type ChartBlock, type CodeBlock, type Doc, type DocMeta, DocViewer, type DocViewerLayout, type DocViewerProps, FONT_LOAD_TIMEOUT_MS, type Footnote, type FootnoteMark, type FootnoteNumbering, type Fragment, type HeadingBlock, type HrBlock, type ImageBlock, LAYOUT_NOTICE, type ListBlock, type ListItem, type Orientation, PAGE_BAND_DISTANCE_DEFAULT, PAGE_MARGIN_DEFAULT, PAGE_SIZES_PT, PX_PER_PT, type PackInput, type PackItem, type PackOptions, type Page, type PageBreakBlock, type PageClass, type PageFields, type PageGeometry, type PageLayout, type PageMargins, type PageSize, type ParagraphBlock, type ParagraphProps, type QuoteBlock, type ResolvedMargins, type Run, type Stretch, type TableBlock, type TableBorders, type TableCell, type TableFragment, type TableItem, type TableRow, type TableRowItem, type VAlign, type ViewerFont, bandSlot, blockStretches, bodyBox, carlitoFaces, docFromReader, docStretches, fontFaceCss, formatDatePicture, numberFootnotes, packInput, pageBand, pageBodyBoxes, pageCapacity, pageClass, pageClassIn, pageGeometry, pageMargins, paginate, resolveNow, substituteFields, unshownLayout };