superdoc 2.4.0-next.22 → 2.4.0-next.24

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.
@@ -19,7 +19,7 @@ var COLLABORATION_UPGRADE_ENGINE_MINIMUM_NODE_MAJOR = 20;
19
19
  var PRIVATE_ENGINE_INFO = (0, _superdoc_docx_engine_collaboration_upgrade_engine.getCollaborationUpgradeEngineInfo)();
20
20
  var ENGINE_INFO = Object.freeze({
21
21
  ...PRIVATE_ENGINE_INFO,
22
- superdocVersion: "2.4.0-next.22",
22
+ superdocVersion: "2.4.0-next.24",
23
23
  roomSchemaVersion: Object.freeze({ ...PRIVATE_ENGINE_INFO.roomSchemaVersion }),
24
24
  supportedBundleVersions: SUPPORTED_COLLABORATION_UPGRADE_BUNDLE_VERSIONS,
25
25
  supportedV1ReaderContractVersions: SUPPORTED_V1_READER_CONTRACT_VERSIONS
@@ -18,7 +18,7 @@ var COLLABORATION_UPGRADE_ENGINE_MINIMUM_NODE_MAJOR = 20;
18
18
  var PRIVATE_ENGINE_INFO = getCollaborationUpgradeEngineInfo$1();
19
19
  var ENGINE_INFO = Object.freeze({
20
20
  ...PRIVATE_ENGINE_INFO,
21
- superdocVersion: "2.4.0-next.22",
21
+ superdocVersion: "2.4.0-next.24",
22
22
  roomSchemaVersion: Object.freeze({ ...PRIVATE_ENGINE_INFO.roomSchemaVersion }),
23
23
  supportedBundleVersions: SUPPORTED_COLLABORATION_UPGRADE_BUNDLE_VERSIONS,
24
24
  supportedV1ReaderContractVersions: SUPPORTED_V1_READER_CONTRACT_VERSIONS
@@ -1807,6 +1807,13 @@ export declare const isForcedSectPrSectionBreak: (block: FlowBlock | undefined)
1807
1807
  * accepted only when their source/anchor proves they belong to the same filler
1808
1808
  * run.
1809
1809
  */
1810
+ export type SectionBoundaryFillerScanCheckpoint = {
1811
+ index: number;
1812
+ total: number;
1813
+ };
1814
+ export declare function collectSectionBoundaryFillerBlockIdsSteps(blocks: readonly FlowBlock[], options?: {
1815
+ isTinyInlineBoundaryDrawing?: (block: DrawingBlock, index: number) => boolean;
1816
+ }, checkpointEveryBlocks?: number | null): Generator<SectionBoundaryFillerScanCheckpoint, ReadonlySet<string>, void>;
1810
1817
  export declare const collectSectionBoundaryFillerBlockIds: (blocks: readonly FlowBlock[], options?: {
1811
1818
  isTinyInlineBoundaryDrawing?: (block: DrawingBlock, index: number) => boolean;
1812
1819
  }) => ReadonlySet<string>;
@@ -0,0 +1,9 @@
1
+ import { FlowBlock, ParagraphBlock, ParagraphMeasure } from '../../contracts/src/index.js';
2
+ type TextboxRemeasure = (block: ParagraphBlock, maxWidth: number) => ParagraphMeasure;
3
+ /**
4
+ * Derives table-cell textbox measurements without mutating the projection
5
+ * plane supplied by the caller. Only the textbox and its table ancestry are
6
+ * copied; documents without table textboxes retain their original identities.
7
+ */
8
+ export declare function hydrateTableTextboxMeasures(blocks: FlowBlock[], remeasure: TextboxRemeasure): FlowBlock[];
9
+ export {};
@@ -1,6 +1,6 @@
1
- import { NonFlowingPageRelativeAnchorDependencyProof, PageCheckpointDependencyClass, FlowBlock, Layout, Measure, HeaderFooterLayout, ParagraphBlock, ParagraphMeasure, ColumnLayout } from '../../contracts/src/index.js';
1
+ import { NonFlowingPageRelativeAnchorDependencyProof, PageCheckpointDependencyClass, FlowBlock, Layout, Measure, HeaderFooterLayout, ColumnLayout } from '../../contracts/src/index.js';
2
2
  import { FontMeasureContext } from '../../../shared/font-system/src/index.js';
3
- import { LayoutOptions, HeaderFooterConstraints } from '../../layout-engine/src/index.js';
3
+ import { LayoutOptions, HeaderFooterConstraints, LayoutExecutionCheckpoint } from '../../layout-engine/src/index.js';
4
4
  import { computeDirtyRegions } from './diff.js';
5
5
  import { MeasureCache } from './cache.js';
6
6
  import { HeaderFooterBatch } from './layoutHeaderFooter.js';
@@ -52,6 +52,8 @@ export type FootnoteReserveSeed = {
52
52
  };
53
53
  export type IncrementalLayoutResult = {
54
54
  layout: Layout;
55
+ /** Pass-owned block plane after derived layout annotations are attached. */
56
+ blocks: FlowBlock[];
55
57
  measures: Measure[];
56
58
  dirty: ReturnType<typeof computeDirtyRegions>;
57
59
  headers?: HeaderFooterLayoutResult[];
@@ -277,10 +279,13 @@ export declare const measureCache: MeasureCache<Measure>;
277
279
  */
278
280
  export declare function clearIncrementalModuleState(): void;
279
281
  export interface IncrementalLayoutExecutionControl {
282
+ signal?: AbortSignal;
280
283
  /** Budget-aware host-task yield; may resolve immediately. */
281
- yieldToHost?: () => Promise<void>;
282
- /** Checkpoint cadence for the block measurement loop. Defaults to 32. */
284
+ yieldToHost?: (checkpoint?: LayoutExecutionCheckpoint) => Promise<void>;
285
+ /** Measurement checkpoints default to 32 blocks; nested layout checkpoints default to 16. */
283
286
  yieldEveryBlocks?: number;
287
+ /** Time-aware mounted probe. Null is the allocation-free under-budget path. */
288
+ checkpointIfDue?: () => Promise<void> | null;
284
289
  }
285
290
  export declare function incrementalLayout(previousBlocks: FlowBlock[], _previousLayout: Layout | null, nextBlocks: FlowBlock[], options: LayoutOptions, measureBlock: (block: FlowBlock, constraints: {
286
291
  maxWidth: number;
@@ -326,12 +331,6 @@ export declare function incrementalLayout(previousBlocks: FlowBlock[], _previous
326
331
  * @returns The normalized margin value (guaranteed to be finite)
327
332
  */
328
333
  export declare const normalizeMargin: (value: number | undefined, fallback: number) => number;
329
- /**
330
- * Walks table blocks (including nested tables) and computes `contentMeasures` for any
331
- * `textboxShape` drawings found in table cells. Stores results directly on the block so
332
- * the painter can read them without a `DrawingFragment` (table-cell drawings have none).
333
- */
334
- export declare function hydrateTableTextboxMeasures(blocks: FlowBlock[], remeasure: (block: ParagraphBlock, maxWidth: number) => ParagraphMeasure): void;
335
334
  /**
336
335
  * Resolves the maximum measurement constraints (width and height) needed for measuring blocks
337
336
  * across all sections in a document.
@@ -11,9 +11,10 @@ export { findWordBoundaries, findParagraphBoundaries } from './text-boundaries.j
11
11
  export type { BoundaryRange } from './text-boundaries.js';
12
12
  export { buildSectionAwareHeaderFooterLayoutKey, buildSectionContentWidth, buildEffectiveHeaderFooterRefsBySection, collectReferencedHeaderFooterRIds, buildSectionAwareHeaderFooterMeasurementGroups, } from './sectionAwareHeaderFooter.js';
13
13
  export type { HeaderFooterSectionKind, HeaderFooterRefs, SectionAwareHeaderFooterMeasurementGroup, } from './sectionAwareHeaderFooter.js';
14
- export { clearIncrementalModuleState, incrementalLayout, measureCache, normalizeMargin, hydrateTableTextboxMeasures, } from './incrementalLayout.js';
14
+ export { clearIncrementalModuleState, incrementalLayout, measureCache, normalizeMargin } from './incrementalLayout.js';
15
+ export { hydrateTableTextboxMeasures } from './hydrateTableTextboxMeasures.js';
15
16
  export { hashMeasureContent } from './cache.js';
16
- export type { HeaderFooterLayoutResult, IncrementalLayoutBridgeTiming, IncrementalLayoutResult, IncrementalMeasureReuseProof, IncrementalLayoutReuseOptions, IncrementalLayoutReuseSummary, IncrementalSectionPageNumberTransform, IncrementalLayoutTailAdoption, IncrementalLayoutTailDisposition, IncrementalPaginationProof, LayoutPositionTransform, FootnoteReserveSeed, } from './incrementalLayout.js';
17
+ export type { HeaderFooterLayoutResult, IncrementalLayoutBridgeTiming, IncrementalLayoutResult, IncrementalLayoutExecutionControl, IncrementalMeasureReuseProof, IncrementalLayoutReuseOptions, IncrementalLayoutReuseSummary, IncrementalSectionPageNumberTransform, IncrementalLayoutTailAdoption, IncrementalLayoutTailDisposition, IncrementalPaginationProof, LayoutPositionTransform, FootnoteReserveSeed, } from './incrementalLayout.js';
17
18
  export { collectFootnoteLedgers, getPreferredReserveCandidates, getPreferredReserveTrialTargets, isMandatoryOnlyFootnotePage, scoreFootnoteWindow, summarizeFootnoteWindow, } from './footnote-scorer.js';
18
19
  export type { FootnotePreferredReserveCandidate, FootnoteWindowScoreInput, FootnoteWindowScoreReason, FootnoteWindowScoreResult, FootnoteWindowStats, } from './footnote-scorer.js';
19
20
  export { computeDisplayPageNumber } from '../../layout-engine/src/index.js';
@@ -1,5 +1,5 @@
1
1
  import { FlowBlock, HeaderFooterLayout, Measure, PageNumberChapterSeparator, PageNumberFormat, ParagraphBlock, ParagraphMeasure } from '../../contracts/src/index.js';
2
- import { HeaderFooterConstraints } from '../../layout-engine/src/index.js';
2
+ import { HeaderFooterConstraints, LayoutExecutionControl } from '../../layout-engine/src/index.js';
3
3
  import { MeasureCache } from './cache.js';
4
4
  import { ResolveHeaderFooterTokensOptions } from './resolveHeaderFooterTokens.js';
5
5
  export type HeaderFooterBatch = Partial<Record<'default' | 'first' | 'even' | 'odd', FlowBlock[]>>;
@@ -28,6 +28,11 @@ export type PageResolver = (pageNumber: number) => {
28
28
  chapterNumberText?: string;
29
29
  chapterSeparator?: PageNumberChapterSeparator;
30
30
  };
31
+ /** Optional cooperative execution hooks for browser-owned furniture builds. */
32
+ export interface HeaderFooterLayoutExecution extends LayoutExecutionControl {
33
+ /** Time-aware mounted probe. Null is the allocation-free under-budget path. */
34
+ checkpointIfDue?: () => Promise<void> | null;
35
+ }
31
36
  /**
32
37
  * Digit bucket for page number caching strategy.
33
38
  * Different digit lengths require different measurements due to width changes.
@@ -85,7 +90,7 @@ export declare class HeaderFooterLayoutCache {
85
90
  measureBlocks(blocks: FlowBlock[], constraints: {
86
91
  width: number;
87
92
  height: number;
88
- }, measureBlock: MeasureResolver, fontSignature?: string): Promise<Measure[]>;
93
+ }, measureBlock: MeasureResolver, fontSignature?: string, execution?: LayoutExecutionControl): Promise<Measure[]>;
89
94
  invalidate(blockIds: string[]): void;
90
95
  /**
91
96
  * Gets cache statistics for monitoring and debugging.
@@ -120,4 +125,4 @@ export declare function invalidateHeaderFooterMeasureCache(blockIds: string[]):
120
125
  * @param pageResolver - Callback to resolve display page info for a physical page number
121
126
  * @returns Batch result with layouts, blocks, and measures for each variant
122
127
  */
123
- export declare function layoutHeaderFooterWithCache(sections: HeaderFooterBatch, constraints: HeaderFooterConstraints, measureBlock: MeasureResolver, cache?: HeaderFooterLayoutCache, totalPages?: number, pageResolver?: PageResolver, kind?: 'header' | 'footer', fontSignature?: string, remeasureParagraph?: (block: ParagraphBlock, maxWidth: number, firstLineIndent?: number) => ParagraphMeasure, options?: ResolveHeaderFooterTokensOptions): Promise<HeaderFooterBatchResult>;
128
+ export declare function layoutHeaderFooterWithCache(sections: HeaderFooterBatch, constraints: HeaderFooterConstraints, measureBlock: MeasureResolver, cache?: HeaderFooterLayoutCache, totalPages?: number, pageResolver?: PageResolver, kind?: 'header' | 'footer', fontSignature?: string, remeasureParagraph?: (block: ParagraphBlock, maxWidth: number, firstLineIndent?: number) => ParagraphMeasure, options?: ResolveHeaderFooterTokensOptions, execution?: HeaderFooterLayoutExecution): Promise<HeaderFooterBatchResult>;
@@ -1,5 +1,6 @@
1
1
  import { FlowBlock, ImageBlock, ImageMeasure, Measure, DrawingBlock, DrawingMeasure, TableBlock, TableMeasure, isPageRelativeAnchor } from '../../contracts/src/index.js';
2
2
  import { resolveFloatingTableAnchorResolution } from './floating-table-anchor.js';
3
+ import { LayoutWorkCheckpoint } from './execution.js';
3
4
  export type { FloatingTableAnchorResolution } from './floating-table-anchor.js';
4
5
  export { resolveFloatingTableAnchorResolution };
5
6
  export { isPageRelativeAnchor };
@@ -39,14 +40,17 @@ export type AnchoredTableCollection = {
39
40
  * @param measures - Corresponding measures for each block
40
41
  * @returns Array of anchored drawings that should be pre-registered
41
42
  */
43
+ export declare function collectPreRegisteredAnchorsSteps(blocks: FlowBlock[], measures: Measure[], checkpointEveryBlocks?: number | null): Generator<LayoutWorkCheckpoint, AnchoredDrawing[], void>;
42
44
  export declare function collectPreRegisteredAnchors(blocks: FlowBlock[], measures: Measure[]): AnchoredDrawing[];
43
45
  /**
44
46
  * Collect anchored drawings (images/drawings) mapped to their anchor paragraph index.
45
47
  * Map of paragraph block index -> anchored images/drawings associated with that paragraph.
46
48
  */
49
+ export declare function collectAnchoredDrawingsSteps(blocks: FlowBlock[], measures: Measure[], checkpointEveryBlocks?: number | null): Generator<LayoutWorkCheckpoint, AnchoredDrawingCollection, void>;
47
50
  export declare function collectAnchoredDrawings(blocks: FlowBlock[], measures: Measure[]): AnchoredDrawingCollection;
48
51
  /**
49
52
  * Collect anchored/floating tables mapped to their anchor paragraph index.
50
53
  * Also returns anchored tables that have no paragraph to attach to.
51
54
  */
55
+ export declare function collectAnchoredTablesSteps(blocks: FlowBlock[], measures: Measure[], checkpointEveryBlocks?: number | null): Generator<LayoutWorkCheckpoint, AnchoredTableCollection, void>;
52
56
  export declare function collectAnchoredTables(blocks: FlowBlock[], measures: Measure[]): AnchoredTableCollection;
@@ -0,0 +1,21 @@
1
+ export type LayoutExecutionPhase = 'measure:block' | 'layout-document:prepare' | 'layout-document:preflight-section' | 'layout-document:preflight-footnote' | 'layout-document:preflight-anchor' | 'layout-document:preflight-keep-next' | 'layout-document:block' | 'layout-document:finalize-page' | 'layout-document:finalize-section' | 'page-token:prepare' | 'page-token:page' | 'numbering-context:chapter' | 'numbering-context:page' | 'footnote:phase' | 'header-footer:variant' | 'header-footer:block' | 'header-footer:page';
2
+ export type LayoutExecutionCheckpoint = {
3
+ phase: LayoutExecutionPhase;
4
+ index?: number;
5
+ total?: number;
6
+ };
7
+ /** Phase-agnostic progress emitted by resumable layout helpers. */
8
+ export type LayoutWorkCheckpoint = {
9
+ index: number;
10
+ total?: number;
11
+ };
12
+ export interface LayoutExecutionControl {
13
+ signal?: AbortSignal;
14
+ /** Host-owned task boundary. It may resolve immediately while the current budget remains. */
15
+ yieldToHost?: (checkpoint: LayoutExecutionCheckpoint) => Promise<void>;
16
+ /** Work cadence for document/block loops. Defaults to 16. */
17
+ checkpointEveryBlocks?: number;
18
+ }
19
+ export declare function layoutExecutionCheckpointEveryBlocks(execution: LayoutExecutionControl | undefined): number;
20
+ export declare function throwIfLayoutExecutionAborted(execution: LayoutExecutionControl | undefined): void;
21
+ export declare function checkpointLayoutExecution(execution: LayoutExecutionControl | undefined, checkpoint: LayoutExecutionCheckpoint): Promise<void>;
@@ -1,4 +1,5 @@
1
1
  import { FlowBlock, Measure, TableBlock, TableMeasure } from '../../contracts/src/index.js';
2
+ import { LayoutWorkCheckpoint } from './execution.js';
2
3
  export type FloatingTableAnchorResolution = {
3
4
  paragraphIndex: number;
4
5
  offsetV: number;
@@ -18,4 +19,5 @@ export declare function isAnchoredTableFullWidth(block: TableBlock, measure: Tab
18
19
  /**
19
20
  * Resolve anchor paragraph + vertical offset for a block-level floating table.
20
21
  */
22
+ export declare function resolveFloatingTableAnchorResolutionSteps(blocks: FlowBlock[], measures: Measure[], len: number, tableIndex: number, tableBlock: TableBlock, paragraphIndexById: Map<string, number>, checkpointEveryBlocks?: number | null): Generator<LayoutWorkCheckpoint, FloatingTableAnchorResolution | null, void>;
21
23
  export declare function resolveFloatingTableAnchorResolution(blocks: FlowBlock[], measures: Measure[], len: number, tableIndex: number, tableBlock: TableBlock, paragraphIndexById: Map<string, number>): FloatingTableAnchorResolution | null;
@@ -1,5 +1,6 @@
1
1
  import { ColumnLayout, FlowBlock, HeaderFooterLayout, Layout, Measure, Page, ParagraphBlock, ParagraphMeasure, SectionMetadata, FlowMode, DocumentBackground } from '../../contracts/src/index.js';
2
2
  import { PageState, ConstraintBoundary } from './paginator.js';
3
+ import { LayoutExecutionControl } from './execution.js';
3
4
  type PageSize = {
4
5
  w: number;
5
6
  h: number;
@@ -258,13 +259,12 @@ export type HeaderFooterConstraints = {
258
259
  overflowBaseHeight?: number;
259
260
  };
260
261
  /**
261
- * Layout FlowBlocks into paginated fragments using measured line data.
262
- *
263
- * The function is intentionally deterministic: it walks the provided
264
- * FlowBlocks in order, consumes their Measure objects (same index),
265
- * and greedily stacks fragments inside the content box of each page/column.
262
+ * The synchronous API drains the same resumable state machine without host
263
+ * turns. Mounted orchestration uses `layoutDocumentCooperatively`; keeping one
264
+ * algorithm prevents cancellation support from becoming a second paginator.
266
265
  */
267
266
  export declare function layoutDocument(blocks: FlowBlock[], measures: Measure[], options?: LayoutOptions): Layout;
267
+ export declare function layoutDocumentCooperatively(blocks: FlowBlock[], measures: Measure[], options?: LayoutOptions, execution?: LayoutExecutionControl): Promise<Layout>;
268
268
  export type LayoutRangeBoundaryPolicy = 'conservative-context' | 'overscan' | 'degraded-on-incomplete-state';
269
269
  export type LayoutRangeExactness = 'exact' | 'pending-layout' | 'degraded-unsupported' | 'stale';
270
270
  export type LayoutRangeSourceRange = {
@@ -338,12 +338,15 @@ export declare function layoutDocumentRange(input: LayoutRangeInput): LayoutRang
338
338
  * (for overlay shift). See the Coordinate Contract in the fix plan for details.
339
339
  */
340
340
  export declare function layoutHeaderFooter(blocks: FlowBlock[], measures: Measure[], constraints: HeaderFooterConstraints, kind?: 'header' | 'footer', remeasureParagraph?: (block: ParagraphBlock, maxWidth: number, firstLineIndent?: number) => ParagraphMeasure): HeaderFooterLayout;
341
+ export declare function layoutHeaderFooterCooperatively(blocks: FlowBlock[], measures: Measure[], constraints: HeaderFooterConstraints, kind?: 'header' | 'footer', remeasureParagraph?: (block: ParagraphBlock, maxWidth: number, firstLineIndent?: number) => ParagraphMeasure, execution?: LayoutExecutionControl): Promise<HeaderFooterLayout>;
341
342
  export { buildAnchorMap, resolvePageRefTokens, getTocBlocksForRemeasurement } from './resolvePageRefs.js';
342
- export { buildChapterContextByPage, computeDisplayPageNumber, formatPageNumber, formatPageNumberFieldValue, formatSectionPageNumberText, normalizeChapterMarkerText, } from './pageNumbering.js';
343
+ export { buildChapterContextByPage, buildChapterContextByPageCooperatively, computeDisplayPageNumber, computeDisplayPageNumberCooperatively, formatPageNumber, formatPageNumberFieldValue, formatSectionPageNumberText, normalizeChapterMarkerText, } from './pageNumbering.js';
343
344
  export type { ChapterPageInfo, DisplayPageInfo, PageNumberFormat } from './pageNumbering.js';
344
- export { resolvePageNumberTokens } from './resolvePageTokens.js';
345
+ export { resolvePageNumberTokens, resolvePageNumberTokensCooperatively } from './resolvePageTokens.js';
345
346
  export type { NumberingContext, ResolvePageTokensResult, ResolvePageTokensOptions } from './resolvePageTokens.js';
346
347
  export { getCellLines, getEmbeddedRowLines, resolveTableFrame, resolveRenderedTableWidth } from './layout-table.js';
347
348
  export { describeCellRenderBlocks, computeCellSliceContentHeight } from './table-cell-slice.js';
348
349
  export { layoutTextboxContent, resolveTextboxContentMeasures } from './layout-textbox.js';
349
350
  export { SINGLE_COLUMN_DEFAULT } from './section-breaks.js';
351
+ export { checkpointLayoutExecution, throwIfLayoutExecutionAborted } from './execution.js';
352
+ export type { LayoutExecutionCheckpoint, LayoutExecutionControl, LayoutExecutionPhase } from './execution.js';
@@ -1,4 +1,5 @@
1
1
  import { formatPageNumber, formatPageNumberFieldValue, formatSectionPageNumberText, FlowBlock, Layout, Page, PageNumberChapterSeparator, PageNumberFormat, SectionMetadata } from '../../contracts/src/index.js';
2
+ import { LayoutExecutionControl } from './execution.js';
2
3
  export { formatPageNumber, formatPageNumberFieldValue, formatSectionPageNumberText };
3
4
  export type { PageNumberFormat };
4
5
  export interface ChapterPageInfo {
@@ -29,45 +30,6 @@ export interface DisplayPageInfo {
29
30
  }
30
31
  export declare function normalizeChapterMarkerText(markerText: unknown): string | undefined;
31
32
  export declare function buildChapterContextByPage(layout: Layout, blocks: FlowBlock[] | ReadonlyMap<string, FlowBlock>, sections: SectionMetadata[]): Map<number, ChapterPageInfo>;
32
- /**
33
- * Computes section-aware display page numbers for all pages in a document.
34
- *
35
- * This function implements MS Word's section numbering behavior:
36
- * - Each section can have its own page number format
37
- * - Sections can restart numbering at a specific value
38
- * - Continuous sections inherit the previous section's running count unless restart is set
39
- * - Display numbers are calculated as: pageIndexWithinSection + offset (or restart value)
40
- * - Display numbers are never less than 1
41
- *
42
- * Algorithm:
43
- * 1. Map each page to its owning section
44
- * 2. For each section:
45
- * - If restart/start is set, begin counting from that value
46
- * - Otherwise, continue from previous section's count
47
- * 3. For each page within a section:
48
- * - Calculate displayIndex = pageIndexWithinSection + offset
49
- * - Clamp displayNumber = max(1, displayIndex)
50
- * - Format displayText using the section's number format
51
- *
52
- * @param pages - Array of pages from the layout (with page.number 1-indexed)
53
- * @param sections - Array of section metadata (aligned by sectionIndex)
54
- * @returns Array of display page information for each page
55
- *
56
- * @example
57
- * ```typescript
58
- * const pages = [
59
- * { number: 1, ... },
60
- * { number: 2, ... },
61
- * { number: 3, ... },
62
- * ];
63
- * const sections = [
64
- * { sectionIndex: 0, numbering: { format: 'lowerRoman', start: 1 } },
65
- * { sectionIndex: 1, numbering: { format: 'decimal', start: 1 } },
66
- * ];
67
- * const displayInfo = computeDisplayPageNumber(pages, sections);
68
- * // displayInfo[0]: { physicalPage: 1, displayNumber: 1, displayText: "i", sectionIndex: 0 }
69
- * // displayInfo[1]: { physicalPage: 2, displayNumber: 2, displayText: "ii", sectionIndex: 0 }
70
- * // displayInfo[2]: { physicalPage: 3, displayNumber: 1, displayText: "1", sectionIndex: 1 }
71
- * ```
72
- */
33
+ export declare function buildChapterContextByPageCooperatively(layout: Layout, blocks: FlowBlock[] | ReadonlyMap<string, FlowBlock>, sections: SectionMetadata[], execution?: LayoutExecutionControl): Promise<Map<number, ChapterPageInfo>>;
73
34
  export declare function computeDisplayPageNumber(pages: Page[], sections: SectionMetadata[], chapterInfoByPage?: ReadonlyMap<number, ChapterPageInfo>): DisplayPageInfo[];
35
+ export declare function computeDisplayPageNumberCooperatively(pages: Page[], sections: SectionMetadata[], chapterInfoByPage: ReadonlyMap<number, ChapterPageInfo> | undefined, execution?: LayoutExecutionControl): Promise<DisplayPageInfo[]>;
@@ -1,5 +1,6 @@
1
1
  import { Layout, FlowBlock, ParagraphBlock, Measure } from '../../contracts/src/index.js';
2
2
  import { DisplayPageInfo } from './pageNumbering.js';
3
+ import { LayoutExecutionControl } from './execution.js';
3
4
  /**
4
5
  * Numbering context for page token resolution.
5
6
  * Contains display page information for each physical page in the document.
@@ -59,6 +60,7 @@ export interface ResolvePageTokensOptions {
59
60
  pageCountFieldsExact?: boolean;
60
61
  }
61
62
  export declare function resolvePageNumberTokens(layout: Layout, blocks: FlowBlock[], measures: Measure[], numberingCtx: NumberingContext, options?: ResolvePageTokensOptions): ResolvePageTokensResult;
63
+ export declare function resolvePageNumberTokensCooperatively(layout: Layout, blocks: FlowBlock[], measures: Measure[], numberingCtx: NumberingContext, options?: ResolvePageTokensOptions, execution?: LayoutExecutionControl): Promise<ResolvePageTokensResult>;
62
64
  /**
63
65
  * Resolves page number tokens in paragraph blocks.
64
66
  *
@@ -62,4 +62,9 @@ export type SectionProps = {
62
62
  * }
63
63
  * ```
64
64
  */
65
+ export type SectionPropsScanCheckpoint = {
66
+ index: number;
67
+ total: number;
68
+ };
69
+ export declare function computeNextSectionPropsAtBreakSteps(blocks: FlowBlock[], checkpointEveryBlocks?: number | null): Generator<SectionPropsScanCheckpoint, Map<number, SectionProps>, void>;
65
70
  export declare function computeNextSectionPropsAtBreak(blocks: FlowBlock[]): Map<number, SectionProps>;
package/dist/superdoc.cjs CHANGED
@@ -43268,7 +43268,7 @@ var SuperDoc = class extends require_eventemitter3.import_eventemitter3.default
43268
43268
  this.config.colors = shuffleArray(this.config.colors);
43269
43269
  this.userColorMap = /* @__PURE__ */ new Map();
43270
43270
  this.colorIndex = 0;
43271
- this.version = "2.4.0-next.22";
43271
+ this.version = "2.4.0-next.24";
43272
43272
  this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
43273
43273
  this.superdocId = config.superdocId || require_uuid.v4();
43274
43274
  this.colors = this.config.colors ?? [];
@@ -43201,7 +43201,7 @@ var SuperDoc = class extends import_eventemitter3.default {
43201
43201
  this.config.colors = shuffleArray(this.config.colors);
43202
43202
  this.userColorMap = /* @__PURE__ */ new Map();
43203
43203
  this.colorIndex = 0;
43204
- this.version = "2.4.0-next.22";
43204
+ this.version = "2.4.0-next.24";
43205
43205
  this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
43206
43206
  this.superdocId = config.superdocId || v4();
43207
43207
  this.colors = this.config.colors ?? [];