@paprize/core 0.0.4 → 0.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -2,4 +2,4 @@
2
2
 
3
3
  Design your report using the full power of JavaScript and CSS, mark the report section by paprize components and then paprize pagination engine will transforming it into a beautiful, professional, print-ready pages.
4
4
 
5
- ![Components](https://raw.githubusercontent.com/PejmanNik/paprize/refs/heads/bootstrap/packages/website/static/img/components.svg)
5
+ ![Components](https://raw.githubusercontent.com/PejmanNik/paprize/refs/heads/main/packages/website/static/img/components.svg)
@@ -1,37 +1,20 @@
1
+ import type * as CSS_2 from 'csstype';
1
2
  import { default as default_2 } from 'loglevel';
2
3
 
3
- declare const AttributeDef: {
4
- hyphen: AttributeValueDef<string>;
5
- keepOnSamePage: AttributeValueDef<boolean>;
6
- hyphenationEnabled: AttributeValueDef<boolean>;
7
- };
8
-
9
- declare type AttributeKey = keyof typeof AttributeDef;
4
+ export declare function adjustPageSize(size: PageSize, orientation?: PageOrientation): PageSize;
10
5
 
11
6
  export declare const attributePrefix = "data-pz-";
12
7
 
13
- declare type AttributeValue<K extends AttributeKey> = (typeof AttributeDef)[K] extends AttributeValueDef<infer R> ? R : never;
14
-
15
- declare class AttributeValueDef<T> {
16
- name: string;
17
- defaultValue: T;
18
- private _reader;
19
- constructor(name: string, reader: (value: string) => T, defaultValue: T);
20
- read(value: string): T;
21
- static createStr(name: string, defaultValue: string): AttributeValueDef<string>;
22
- static createBool(name: string, defaultValue: boolean): AttributeValueDef<boolean>;
23
- }
8
+ export declare function buildPageId(sectionId: string, pageIndex: number): string;
24
9
 
25
10
  export declare function callPluginHook<T extends PluginHookNames>(plugins: PaginationPlugin[], hookName: T, ...args: Parameters<NonNullable<PaginationPlugin[T]>>): void;
26
11
 
27
- export declare type ConfigAttribute = {
28
- [K in AttributeKey]?: AttributeValue<K>;
29
- };
30
-
31
- export declare function configToAttributeMap(config: ConfigAttribute): Record<string, string>;
12
+ export declare function cloneComponents(components: SectionComponents): SectionComponents;
32
13
 
33
14
  export declare function createLoremIpsumParagraph(wordCount: number, seed: number): string;
34
15
 
16
+ export declare type CSSProperties = CSS_2.Properties<string | number>;
17
+
35
18
  export declare const currentElementClassName = "pz-current-element";
36
19
 
37
20
  export declare const currentTextClassName = "pz-current-text";
@@ -47,15 +30,15 @@ export declare class DomState {
47
30
  private _completed;
48
31
  private _currentNode;
49
32
  private _previousNode;
50
- constructor(root: Element, transaction: Transaction, config: PaginationConfig);
33
+ constructor(root: Element, transaction: Transaction, config: PaginationOptions);
51
34
  get completed(): boolean;
52
35
  get currentNode(): PageNode | null;
53
36
  get previousNode(): PageNode | null;
54
- nextNode(): void;
55
- nextSiblingOrParentSibling(): {
37
+ goToNextNode(): void;
38
+ goToNextSiblingOrParentSibling(): {
56
39
  parentsTraversed: number;
57
40
  };
58
- firstChildOrNextNode(): {
41
+ goToFirstChildOrNextNode(): {
59
42
  parentsTraversed: number;
60
43
  };
61
44
  private setState;
@@ -63,8 +46,21 @@ export declare class DomState {
63
46
 
64
47
  export declare const enableDebugMode: () => void;
65
48
 
49
+ export declare class EventDispatcher<TEvents> {
50
+ private registry;
51
+ addEventListener<T extends keyof TEvents>(name: T, handler: EventHandler<T, TEvents>): () => void;
52
+ removeEventListener<T extends keyof TEvents>(name: T, handler: EventHandler<T, TEvents>): void;
53
+ dispatch<T extends keyof TEvents>(name: T, ...args: Parameters<EventHandler<T, TEvents>>): void;
54
+ }
55
+
56
+ declare type EventHandler<TKey extends keyof TEvents, TEvents> = TEvents[TKey] extends (...args: infer TArgs) => infer TReturn ? (...args: TArgs) => TReturn : never;
57
+
66
58
  export declare function getVisibleHeight(element: Element): number;
67
59
 
60
+ export declare const globalStyle = "\n html {\n box-sizing: border-box;\n }\n\n *,\n *:before,\n *:after {\n box-sizing: inherit;\n }\n\n :root {\n --paprize-page-background-color: #ffffff;\n --paprize-page-margin-bottom: 10px;\n --paprize-page-box-shadow: rgb(142 138 138) -1px 3px 5px 2px;\n --paprize-section-margin-bottom: 10px;\n --paprize-preview-background-color: rgb(218 220 224);\n --paprize-preview-padding: 30px 10px;\n }\n\n body {\n margin: 0;\n }\n \n @media screen {\n .pz-preview {\n min-height: 100vh;\n display: flex;\n flex-direction: column;\n align-items: center;\n background-color: var(--paprize-preview-background-color);\n padding: var(--paprize-preview-padding);\n }\n\n .pz-page {\n box-shadow: var(--paprize-page-box-shadow);\n margin-bottom: var(--paprize-page-margin-bottom);\n background-color: var(--paprize-page-background-color);\n }\n\n .pz-section {\n margin-bottom: var(--paprize-section-margin-bottom);\n }\n }\n\n @media print {\n html:has(.pz-preview) *:not(.pz-preview):not(.pz-preview *):not(:has(.pz-preview)) {\n display: none !important;\n }\n } \n ";
61
+
62
+ export declare const globalStyleId = "paprize-global-style";
63
+
68
64
  export declare const ignoredElementClassName = "pz-ignored-element";
69
65
 
70
66
  export declare const ignoredTextClassName = "pz-ignored-text";
@@ -75,26 +71,86 @@ export declare function isElement(node: Node): node is Element;
75
71
 
76
72
  export declare function isTextNode(node: Node): node is Text;
77
73
 
74
+ /**
75
+ * Layout options for the pagination engine
76
+ */
77
+ export declare interface LayoutOptions {
78
+ /**
79
+ * Specifies the character used for hyphenation when a word is broken across lines.
80
+ * @defaultValue "-"
81
+ */
82
+ hyphen?: string;
83
+ /**
84
+ * Prevents an element from being split across pages.
85
+ * If an element does not fit in the available space on the current page,
86
+ * it will be moved entirely to the next page. If it still does not fit on an empty page,
87
+ * it will be skipped and not rendered.
88
+ * @defaultValue false
89
+ */
90
+ keepOnSamePage?: boolean;
91
+ /**
92
+ * Disables automatic word hyphenation.
93
+ * When disabled, if a word (a sequence of text without whitespace) does not fit
94
+ * on the current page, it will move to the next page instead of being split
95
+ * with a hyphen character.
96
+ * @defaultValue false
97
+ */
98
+ hyphenationDisabled?: boolean;
99
+ }
100
+
101
+ export declare function layoutOptionsToAttributes(config: LayoutOptions): Record<string, string>;
102
+
78
103
  export declare const logger: default_2.Logger;
79
104
 
80
105
  export declare const loggerName = "paprize";
81
106
 
107
+ export declare type Monitor<TEvents> = Omit<EventDispatcher<TEvents>, 'dispatch'>;
108
+
82
109
  export declare function moveOffscreen(element: HTMLDivElement): void;
83
110
 
84
111
  export declare const pageBreakAttributeName = "data-pz-page-break";
85
112
 
86
- export declare const pageBreakPlugin: PaginationPlugin;
87
-
88
- export declare const pageBreakPluginName = "pageBreak";
113
+ export declare class PageBreakPlugin implements PaginationPlugin {
114
+ name: string;
115
+ order: number;
116
+ onVisitElement: (_id: string, domState: DomState & {
117
+ currentNode: PageElement;
118
+ }, pageManager: PageManager, context: VisitContext) => void;
119
+ }
89
120
 
90
121
  export declare const pageClassName = "pz-page";
91
122
 
123
+ /**
124
+ * Context information for a paginated page.
125
+ */
126
+ export declare interface PageContext {
127
+ /**
128
+ * Index of the section to which this page belongs
129
+ */
130
+ sectionId: string;
131
+ /**
132
+ * Index of this page within its section.
133
+ */
134
+ pageIndex: number;
135
+ /**
136
+ * Total number of pages in the section that contains this page.
137
+ */
138
+ totalPages: number;
139
+ /**
140
+ * HTML string representing the paginated content of this page.
141
+ */
142
+ pageContentHtml: string;
143
+ }
144
+
92
145
  declare class PageElement {
93
146
  private readonly _node;
94
- private readonly _transaction;
147
+ config: PaginationOptions;
95
148
  readonly type: 'element';
96
- readonly config: PaginationConfig;
97
- constructor(element: Element, transaction: Transaction, config: PaginationConfig);
149
+ readonly transaction: Transaction;
150
+ readonly clonedFrom?: PageElement;
151
+ readonly cloneCount: number;
152
+ constructor(element: Element, transaction: Transaction, config: PaginationOptions, clonedFrom?: PageElement);
153
+ getOriginalNode(): Node | undefined;
98
154
  appendChild(node: PageNode): void;
99
155
  clone(withChildren?: boolean): PageElement;
100
156
  getHeight(): number;
@@ -109,7 +165,7 @@ declare class PageManager {
109
165
  private readonly _transaction;
110
166
  private readonly _tempContainer;
111
167
  private readonly _config;
112
- constructor(tempContainer: Element, pageSize: PageSize, transaction: Transaction, config: PaginationConfig);
168
+ constructor(tempContainer: Element, pageSize: RealizedPageSize, transaction: Transaction, config: PaginationOptions);
113
169
  nextPage(): void;
114
170
  private cloneParentStackToNewPage;
115
171
  private cleanupEmptyParent;
@@ -129,13 +185,96 @@ declare class PageManager {
129
185
  getPageState(): PageState;
130
186
  }
131
187
 
188
+ /**
189
+ * Represents the margin sizes for a page.
190
+ * All values should be valid CSS size strings (e.g., '10mm', '1in').
191
+ *
192
+ * Common presets are available in {@link pageMargin}
193
+ */
194
+ export declare interface PageMargin {
195
+ /** @public */
196
+ top: string;
197
+ /** @public */
198
+ right: string;
199
+ /** @public */
200
+ bottom: string;
201
+ /** @public */
202
+ left: string;
203
+ }
204
+
205
+ /**
206
+ * Predefined values for commonly used {@link PageMargin}
207
+ * @privateRemarks
208
+ * Type casting is only for cleaner TypeDoc output
209
+ */
210
+ export declare const pageMargin: {
211
+ /** Top, Right, Bottom, Left: 1in */
212
+ readonly Normal: PageMargin;
213
+ /** Top: 0.4in, Right, Bottom, Left: 0.6in */
214
+ readonly Narrow: PageMargin;
215
+ /** Top, Bottom: 0.5in, Right, Left: 2in */
216
+ readonly Wide: PageMargin;
217
+ /** Top, Right, Bottom, Left: 0 */
218
+ readonly None: PageMargin;
219
+ };
220
+
132
221
  declare type PageNode = PageElement | PageText;
133
222
 
223
+ /**
224
+ * Describes the page orientation.
225
+ *
226
+ * - 'portrait' (default): the page is taller than it is wide. Use the provided
227
+ * width and height as-is.
228
+ * - 'landscape': the page is wider than it is tall. When applying landscape,
229
+ * swap the width and height.
230
+ */
231
+ export declare type PageOrientation = 'portrait' | 'landscape';
232
+
233
+ /**
234
+ * Represents the dimensions of a page.
235
+ * All values should be valid CSS size strings (e.g., '210mm', '8.5in').
236
+ *
237
+ * Common presets are available in {@link pageSize}
238
+ */
134
239
  export declare interface PageSize {
135
- width: number;
136
- height: number;
240
+ /** @public */
241
+ height: string;
242
+ /** @public */
243
+ width: string;
137
244
  }
138
245
 
246
+ /**
247
+ * Predefined values for commonly used {@link PageSize}
248
+ * @privateRemarks
249
+ * Type casting is only for cleaner TypeDoc output
250
+ */
251
+ export declare const pageSize: {
252
+ /** 841mm x 594mm */
253
+ readonly A1: PageSize;
254
+ /** 594mm x 420mm */
255
+ readonly A2: PageSize;
256
+ /** 420mm x 297mm */
257
+ readonly A3: PageSize;
258
+ /** 297mm x 210mm */
259
+ readonly A4: PageSize;
260
+ /** 210mm x 148mm */
261
+ readonly A5: PageSize;
262
+ /** 148mm x 105mm */
263
+ readonly A6: PageSize;
264
+ /** 500mm x 353mm */
265
+ readonly B3: PageSize;
266
+ /** 353mm x 250mm */
267
+ readonly B4: PageSize;
268
+ /** 250mm x 176mm */
269
+ readonly B5: PageSize;
270
+ /** 8.5in x 11in */
271
+ readonly Letter: PageSize;
272
+ /** 11in x 8.5in */
273
+ readonly Legal: PageSize;
274
+ /** 11in x 17in */
275
+ readonly Tabloid: PageSize;
276
+ };
277
+
139
278
  declare class PageState {
140
279
  currentPage: PageElement;
141
280
  activeElement: PageNode | null;
@@ -151,10 +290,10 @@ declare class PageState {
151
290
 
152
291
  declare class PageText {
153
292
  private readonly _node;
154
- private readonly _transaction;
155
293
  readonly type: 'text';
156
- readonly config: PaginationConfig;
157
- constructor(text: Text, transaction: Transaction, config: PaginationConfig);
294
+ readonly transaction: Transaction;
295
+ config: PaginationOptions;
296
+ constructor(text: Text, transaction: Transaction, config: PaginationOptions);
158
297
  get textContent(): string;
159
298
  set textContent(value: string);
160
299
  remove(): void;
@@ -163,8 +302,29 @@ declare class PageText {
163
302
 
164
303
  export declare type PaginateResult = string[];
165
304
 
166
- export declare type PaginationConfig = Required<ConfigAttribute> & {
305
+ /**
306
+ * Context information for pagination cycle.
307
+ */
308
+ export declare interface PaginationCycleCompleted {
309
+ /**
310
+ * All paginated section within the report.
311
+ */
312
+ sections: SectionContext[];
313
+ }
314
+
315
+ /**
316
+ * Pagination options
317
+ * @interface
318
+ * @inlineType LayoutOptions
319
+ */
320
+ export declare type PaginationOptions = Required<LayoutOptions> & {
321
+ /**
322
+ * Unique id of the pagination.
323
+ */
167
324
  id: string;
325
+ /**
326
+ * List of plugins to use during pagination.
327
+ */
168
328
  plugins: PaginationPlugin[];
169
329
  };
170
330
 
@@ -177,7 +337,7 @@ export declare interface PaginationPlugin {
177
337
  onVisitElement?: (id: string, domState: DomState & {
178
338
  currentNode: PageElement;
179
339
  }, pageManager: PageManager, context: VisitContext) => void;
180
- afterVisitNode?: (id: string, domState: DomState, pageManager: PageManager) => void;
340
+ afterVisitNode?: (id: string, result: SplitResult, domState: DomState, pageManager: PageManager) => void;
181
341
  onNewPage?: (id: string, pageManager: PageManager) => void;
182
342
  onClone?: (id: string, source: Element, cloned: PageElement) => void;
183
343
  }
@@ -190,7 +350,7 @@ export declare class Paginator {
190
350
  private readonly _config;
191
351
  private constructor();
192
352
  private static createTempContainer;
193
- static paginate(root: Element, pageSize: PageSize, config?: Partial<PaginationConfig>): PaginateResult;
353
+ static paginate(root: Element, pageSize: RealizedPageSize, config?: Partial<PaginationOptions>): PaginateResult;
194
354
  private processAllNodes;
195
355
  private handleNodeSkipped;
196
356
  private handleFullNodePlaced;
@@ -198,6 +358,8 @@ export declare class Paginator {
198
358
  private processCurrentNode;
199
359
  }
200
360
 
361
+ export declare const paprize_isInitialized = "__PAPRIZE_IS_INITIALIZED";
362
+
201
363
  export declare const paprize_isReady = "__PAPRIZE_IS_READY";
202
364
 
203
365
  export declare const paprize_readJsonDataFile = "__PAPRIZE_READ_JSON_DATA_FILE";
@@ -205,19 +367,230 @@ export declare const paprize_readJsonDataFile = "__PAPRIZE_READ_JSON_DATA_FILE";
205
367
  declare type PluginHookNames = NonNullable<PluginKeys>;
206
368
 
207
369
  declare type PluginKeys = {
208
- [K in keyof PaginationPlugin]: PaginationPlugin[K] extends ((...args: any[]) => any) | undefined ? K : never;
370
+ [K in keyof PaginationPlugin]: PaginationPlugin[K] extends ((...args: never[]) => unknown) | undefined ? K : never;
209
371
  }[keyof PaginationPlugin];
210
372
 
373
+ export declare const previewClassName = "pz-preview";
374
+
375
+ export declare interface RealizedPageSize {
376
+ width: number;
377
+ height: number;
378
+ }
379
+
380
+ /**
381
+ * The report builder class that contains the logic for handling pagination
382
+ * and managing the report layout.
383
+ */
384
+ export declare class ReportBuilder {
385
+ private readonly _sections;
386
+ private readonly _monitor;
387
+ private _paginationInProgress;
388
+ private _pendingPaginateResolvers;
389
+ private _currentAbortController;
390
+ constructor();
391
+ /**
392
+ * Monitor instance used to subscribe to pagination events.
393
+ * See {@link ReportBuilderEvents} for available event types.
394
+ */
395
+ get monitor(): Monitor<ReportBuilderEvents>;
396
+ /**
397
+ * Removes a section from the registered sections, if it has already been registered in the report.
398
+ */
399
+ removeSection(sectionId: string): void;
400
+ /**
401
+ * Registers a section by its ID, specifying the page size, margins, and other options.
402
+ *
403
+ * @param options - Configuration options for the section.
404
+ * @param components - The DOM components associated with the section.
405
+ * @param onPaginationCompleted - Callback invoked when pagination for the section is completed.
406
+ * @returns `true` if the section was added to the report’s section list, or `false` if it already exists.
407
+ */
408
+ tryAddSection(options: SectionOptions, components: SectionComponents, onPaginationCompleted: (pages: PageContext[]) => void): boolean;
409
+ /**
410
+ * Schedules a pagination operation.
411
+ *
412
+ * It is not possible to schedule multiple pagination operations in parallel,
413
+ * as the process involves DOM manipulation, and concurrent modifications
414
+ * could cause conflicts and unexpected results.
415
+ * Each newly scheduled operation is queued and executed sequentially.
416
+ * When a new pagination is scheduled, any ongoing or pending operations
417
+ * will be aborted, and the new pagination will start immediately afterward.
418
+ *
419
+ * @returns A promise that resolves when the first pagination cycle is completed.
420
+ * It does not wait for suspended sections to resolve and be paginated.
421
+ * To wait for all sections to complete pagination, use the
422
+ * `suspension` property of the returned result object.
423
+ */
424
+ schedulePagination(): Promise<ScheduleResult>;
425
+ private _executePagination;
426
+ private _processPendingPagination;
427
+ private _injectStyle;
428
+ private _paginateSection;
429
+ }
430
+
431
+ /**
432
+ * Available events that can be subscribed to, during the pagination process.
433
+ */
434
+ export declare interface ReportBuilderEvents {
435
+ /**
436
+ * Triggered when a page has been fully paginated.
437
+ * event: {@link PageContext}
438
+ */
439
+ pageCompleted: (event: PageContext) => void;
440
+ /**
441
+ * Triggered when a section has been fully paginated.
442
+ * event: {@link SectionContext}
443
+ */
444
+ sectionCompleted: (event: SectionContext) => void;
445
+ /**
446
+ * Triggered when a new section is created.
447
+ * event: {@link SectionContext}
448
+ */
449
+ sectionCreated: (event: SectionContext) => void;
450
+ /**
451
+ * Triggered when an entire pagination cycle is completed.
452
+ * event: {@link PaginationCycleCompleted}
453
+ */
454
+ paginationCycleCompleted: (event: PaginationCycleCompleted) => void;
455
+ }
456
+
457
+ export declare const reportStyles: {
458
+ globalStyle: string;
459
+ component: CSSProperties;
460
+ outOfScreen: CSSProperties;
461
+ page: (pageSize: PageSize, pageMargin: PageMargin) => CSSProperties;
462
+ overlay: CSSProperties;
463
+ pageContent: CSSProperties;
464
+ sectionPageMedia: typeof sectionPageMedia;
465
+ section: (sectionId: string) => CSSProperties;
466
+ };
467
+
211
468
  declare type SafeElement = Omit<Element, 'removeChild' | 'appendChild' | 'replaceChild' | 'remove'>;
212
469
 
213
470
  declare type SafeText = Omit<Text, 'remove'>;
214
471
 
472
+ /**
473
+ * Represents the result of a scheduled pagination process.
474
+ */
475
+ export declare interface ScheduleResult {
476
+ /**
477
+ * List of all registered sections.
478
+ */
479
+ sections: SectionContext[];
480
+ /**
481
+ * If there are any suspended sections, this Promise tracks their state
482
+ * and resolves only after all suspended sections have been resumed
483
+ * and paginated.
484
+ */
485
+ suspension: Promise<void>;
486
+ }
487
+
488
+ export declare const sectionClassName = "pz-section";
489
+
490
+ /**
491
+ * Represents the collection of DOM elements generated by
492
+ * the pagination engine from the report components on the current page.
493
+ */
494
+ export declare interface SectionComponents {
495
+ /**
496
+ * The HTML element that serves as the header for the entire section.
497
+ * `null` if the section has no section header.
498
+ */
499
+ sectionHeader: HTMLElement | null;
500
+ /**
501
+ * The HTML element that serves as the footer for the entire section.
502
+ * `null` if the section has no section footer.
503
+ */
504
+ sectionFooter: HTMLElement | null;
505
+ /**
506
+ * The HTML element that serves as the header for this page.
507
+ * `null` if the page has no header.
508
+ */
509
+ pageHeader: HTMLElement | null;
510
+ /**
511
+ * The HTML element that serves as the footer for this page.
512
+ * `null` if the page has no footer.
513
+ */
514
+ pageFooter: HTMLElement | null;
515
+ /**
516
+ * The main HTML element for the this page content
517
+ * This property is always defined.
518
+ */
519
+ pageContent: HTMLElement;
520
+ }
521
+
522
+ /**
523
+ * Context information for a paginated section.
524
+ */
525
+ export declare interface SectionContext {
526
+ /**
527
+ * Index of the section within the report.
528
+ */
529
+ sectionIndex: number;
530
+ /**
531
+ * Unique identifier of the section.
532
+ */
533
+ sectionId: string;
534
+ /**
535
+ * Indicates whether pagination for this section is suspended
536
+ * and waiting for the suspension to be resolved.
537
+ */
538
+ isSuspended: boolean;
539
+ /**
540
+ * Indicates whether pagination for this section has completed.
541
+ */
542
+ isPaginated: boolean;
543
+ /**
544
+ * All paginated pages that belong to this section.
545
+ */
546
+ pages: PageContext[];
547
+ }
548
+
549
+ /**
550
+ * Configuration options for a section.
551
+ * @inlineType PaginationConfig
552
+ */
553
+ export declare interface SectionOptions extends Partial<Omit<PaginationOptions, 'id'>> {
554
+ /**
555
+ * Unique id of the section within the report.
556
+ */
557
+ readonly id: string;
558
+ /**
559
+ * Page size used for this section.
560
+ */
561
+ readonly size: PageSize;
562
+ /**
563
+ * Page orientation used for this section.
564
+ * @inlineType PageOrientation
565
+ * @default portrait
566
+ */
567
+ readonly orientation?: PageOrientation;
568
+ /**
569
+ * Page margins for this section.
570
+ */
571
+ readonly margin?: PageMargin;
572
+ /**
573
+ * A list of promises that must be resolved before the section can be paginated.
574
+ */
575
+ readonly suspense?: Promise<unknown>[];
576
+ }
577
+
578
+ declare function sectionPageMedia(sectionId: string, size: PageSize): string;
579
+
580
+ export declare interface SectionState {
581
+ options: SectionOptions;
582
+ context: SectionContext;
583
+ components: SectionComponents;
584
+ onPaginationCompleted: (pages: PageContext[]) => void;
585
+ }
586
+
215
587
  export declare const sectionTocName = "sectionToc";
216
588
 
217
589
  export declare class SectionTocPlugin implements PaginationPlugin {
218
- readonly state: SectionTocState[];
219
590
  readonly name = "sectionToc";
220
591
  readonly order = 1;
592
+ private _state;
593
+ getContentList: () => SectionTocState[];
221
594
  onVisitElement: (id: string, domState: DomState & {
222
595
  currentNode: PageElement;
223
596
  }, pageManager: PageManager) => void;
@@ -226,7 +599,7 @@ export declare class SectionTocPlugin implements PaginationPlugin {
226
599
 
227
600
  export declare type SectionTocState = {
228
601
  sectionId: string;
229
- pageNumber: number;
602
+ pageIndex: number;
230
603
  title: string;
231
604
  level: number;
232
605
  };
@@ -239,6 +612,35 @@ export declare const SplitResult: {
239
612
 
240
613
  export declare type SplitResult = (typeof SplitResult)[keyof typeof SplitResult];
241
614
 
615
+ export declare class TablePlugin implements PaginationPlugin {
616
+ private readonly _options;
617
+ name: string;
618
+ order: number;
619
+ constructor(options?: TablePluginOptions);
620
+ onNewPage: (_id: string, pageManager: PageManager) => void;
621
+ onClone: (_id: string, source: Element, cloned: PageElement) => void;
622
+ private _isTable;
623
+ private _isTableBodyEmpty;
624
+ }
625
+
626
+ /**
627
+ * Table plugin options
628
+ */
629
+ export declare interface TablePluginOptions {
630
+ /**
631
+ * If true, the table header (thead) will be cloned on each page.
632
+ */
633
+ cloneHeader?: boolean;
634
+ /**
635
+ * If true, the table footer (tfoot) will be cloned on each page.
636
+ */
637
+ cloneFooter?: boolean;
638
+ /**
639
+ * When true, tables containing only a header (no body rows) will not be removed.
640
+ */
641
+ includeHeaderOnlyTables?: boolean;
642
+ }
643
+
242
644
  export declare const tempContainerClassName = "pz-temp-container";
243
645
 
244
646
  declare class Transaction {
@@ -262,6 +664,7 @@ export { }
262
664
 
263
665
  declare global {
264
666
  interface Window {
667
+ [paprize_isInitialized]?: boolean;
265
668
  [paprize_isReady]?: boolean;
266
669
  [paprize_readJsonDataFile]?: () => Promise<string>;
267
670
  }